Freeciv-3.3: /fast/freeciv/nightly/main/common/packets_gen.c Source File

Freeciv-3.3

Loading...
Searching...
No Matches
packets_gen.c
Go to the documentation of this file.
1 /**************************************************************************
2 * THIS FILE WAS GENERATED *
3 * Script: common/generate_packets.py *
4 * Input: common/networking/packets.def *
5 * DO NOT CHANGE THIS FILE *
6 **************************************************************************/
7
8#ifdef HAVE_CONFIG_H
9#include <fc_config.h>
10#endif
11
12#include <string.h>
13
14/* utility */
15#include "bitvector.h"
16#include "capability.h"
17#include "genhash.h"
18#include "log.h"
19#include "mem.h"
20#include "support.h"
21
22/* common */
23#include "capstr.h"
24#include "connection.h"
25#include "dataio.h"
26#include "game.h"
27
28#include "packets.h"
29
30 const char *const packet_functional_capability = "";
31
32#ifdef FREECIV_DELTA_PROTOCOL
33static genhash_val_t hash_const(const void *vkey)
34{
35 return 0;
36}
37
38static bool cmp_const(const void *vkey1, const void *vkey2)
39{
40 return TRUE;
41}
42#endif /* FREECIV_DELTA_PROTOCOL */
43
44 void delta_stats_report(void) {}
45
46 void delta_stats_reset(void) {}
47
48 const char *packet_name(enum packet_type type)
49{
50 static const char *const names[PACKET_LAST] = {
51 "PACKET_PROCESSING_STARTED",
52 "PACKET_PROCESSING_FINISHED",
53 "unknown",
54 "unknown",
55 "PACKET_SERVER_JOIN_REQ",
56 "PACKET_SERVER_JOIN_REPLY",
57 "PACKET_AUTHENTICATION_REQ",
58 "PACKET_AUTHENTICATION_REPLY",
59 "PACKET_SERVER_SHUTDOWN",
60 "PACKET_RULESET_TECH_CLASS",
61 "PACKET_NATION_SELECT_REQ",
62 "PACKET_PLAYER_READY",
63 "PACKET_ENDGAME_REPORT",
64 "PACKET_SCENARIO_DESCRIPTION",
65 "PACKET_EDIT_SCENARIO_DESC",
66 "PACKET_TILE_INFO",
67 "PACKET_GAME_INFO",
68 "PACKET_MAP_INFO",
69 "PACKET_NUKE_TILE_INFO",
70 "PACKET_TEAM_NAME_INFO",
71 "PACKET_RULESET_IMPR_FLAG",
72 "PACKET_INVESTIGATE_STARTED",
73 "PACKET_INVESTIGATE_FINISHED",
74 "unknown",
75 "unknown",
76 "PACKET_CHAT_MSG",
77 "PACKET_CHAT_MSG_REQ",
78 "PACKET_CONNECT_MSG",
79 "PACKET_EARLY_CHAT_MSG",
80 "PACKET_SERVER_INFO",
81 "PACKET_CITY_REMOVE",
82 "PACKET_CITY_INFO",
83 "PACKET_CITY_SHORT_INFO",
84 "PACKET_CITY_SELL",
85 "PACKET_CITY_BUY",
86 "PACKET_CITY_CHANGE",
87 "PACKET_CITY_WORKLIST",
88 "PACKET_CITY_MAKE_SPECIALIST",
89 "PACKET_CITY_MAKE_WORKER",
90 "PACKET_CITY_CHANGE_SPECIALIST",
91 "PACKET_CITY_RENAME",
92 "PACKET_CITY_OPTIONS_REQ",
93 "PACKET_CITY_REFRESH",
94 "PACKET_CITY_NAME_SUGGESTION_REQ",
95 "PACKET_CITY_NAME_SUGGESTION_INFO",
96 "PACKET_CITY_SABOTAGE_LIST",
97 "PACKET_CITY_NATIONALITIES",
98 "unknown",
99 "unknown",
100 "unknown",
101 "PACKET_PLAYER_REMOVE",
102 "PACKET_PLAYER_INFO",
103 "PACKET_PLAYER_PHASE_DONE",
104 "PACKET_PLAYER_RATES",
105 "PACKET_PLAYER_CHANGE_GOVERNMENT",
106 "PACKET_PLAYER_RESEARCH",
107 "PACKET_PLAYER_TECH_GOAL",
108 "PACKET_PLAYER_ATTRIBUTE_BLOCK",
109 "PACKET_PLAYER_ATTRIBUTE_CHUNK",
110 "PACKET_PLAYER_DIPLSTATE",
111 "PACKET_RESEARCH_INFO",
112 "PACKET_PLAYER_PLACE_INFRA",
113 "PACKET_UNIT_REMOVE",
114 "PACKET_UNIT_INFO",
115 "PACKET_UNIT_SHORT_INFO",
116 "PACKET_UNIT_COMBAT_INFO",
117 "PACKET_UNKNOWN_RESEARCH",
118 "unknown",
119 "unknown",
120 "unknown",
121 "unknown",
122 "PACKET_UNIT_SSCS_SET",
123 "unknown",
124 "PACKET_UNIT_ORDERS",
125 "PACKET_UNIT_SERVER_SIDE_AGENT_SET",
126 "unknown",
127 "unknown",
128 "unknown",
129 "unknown",
130 "unknown",
131 "unknown",
132 "unknown",
133 "PACKET_UNIT_ACTION_QUERY",
134 "PACKET_UNIT_TYPE_UPGRADE",
135 "PACKET_UNIT_DO_ACTION",
136 "PACKET_UNIT_ACTION_ANSWER",
137 "unknown",
138 "PACKET_UNIT_GET_ACTIONS",
139 "PACKET_CONN_PING",
140 "PACKET_CONN_PONG",
141 "PACKET_UNIT_ACTIONS",
142 "unknown",
143 "unknown",
144 "unknown",
145 "unknown",
146 "PACKET_DIPLOMACY_INIT_MEETING_REQ",
147 "PACKET_DIPLOMACY_INIT_MEETING",
148 "PACKET_DIPLOMACY_CANCEL_MEETING_REQ",
149 "PACKET_DIPLOMACY_CANCEL_MEETING",
150 "PACKET_DIPLOMACY_CREATE_CLAUSE_REQ",
151 "PACKET_DIPLOMACY_CREATE_CLAUSE",
152 "PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ",
153 "PACKET_DIPLOMACY_REMOVE_CLAUSE",
154 "PACKET_DIPLOMACY_ACCEPT_TREATY_REQ",
155 "PACKET_DIPLOMACY_ACCEPT_TREATY",
156 "PACKET_DIPLOMACY_CANCEL_PACT",
157 "unknown",
158 "unknown",
159 "unknown",
160 "unknown",
161 "PACKET_PAGE_MSG",
162 "PACKET_REPORT_REQ",
163 "unknown",
164 "unknown",
165 "unknown",
166 "PACKET_CONN_INFO",
167 "PACKET_CONN_PING_INFO",
168 "unknown",
169 "unknown",
170 "PACKET_CLIENT_INFO",
171 "unknown",
172 "unknown",
173 "unknown",
174 "unknown",
175 "unknown",
176 "PACKET_END_PHASE",
177 "PACKET_START_PHASE",
178 "PACKET_NEW_YEAR",
179 "PACKET_BEGIN_TURN",
180 "PACKET_END_TURN",
181 "PACKET_FREEZE_CLIENT",
182 "PACKET_THAW_CLIENT",
183 "unknown",
184 "unknown",
185 "unknown",
186 "PACKET_SPACESHIP_LAUNCH",
187 "PACKET_SPACESHIP_PLACE",
188 "PACKET_SPACESHIP_INFO",
189 "PACKET_CITY_RALLY_POINT",
190 "unknown",
191 "PACKET_RULESET_UNIT",
192 "PACKET_RULESET_GAME",
193 "PACKET_RULESET_SPECIALIST",
194 "PACKET_RULESET_GOVERNMENT_RULER_TITLE",
195 "PACKET_RULESET_TECH",
196 "PACKET_RULESET_GOVERNMENT",
197 "PACKET_RULESET_TERRAIN_CONTROL",
198 "PACKET_RULESET_NATION_GROUPS",
199 "PACKET_RULESET_NATION",
200 "PACKET_RULESET_CITY",
201 "PACKET_RULESET_BUILDING",
202 "PACKET_RULESET_TERRAIN",
203 "PACKET_RULESET_UNIT_CLASS",
204 "PACKET_RULESET_BASE",
205 "unknown",
206 "PACKET_RULESET_CONTROL",
207 "unknown",
208 "unknown",
209 "unknown",
210 "unknown",
211 "PACKET_SINGLE_WANT_HACK_REQ",
212 "PACKET_SINGLE_WANT_HACK_REPLY",
213 "PACKET_RULESET_CHOICES",
214 "PACKET_GAME_LOAD",
215 "PACKET_SERVER_SETTING_CONTROL",
216 "PACKET_SERVER_SETTING_CONST",
217 "PACKET_SERVER_SETTING_BOOL",
218 "PACKET_SERVER_SETTING_INT",
219 "PACKET_SERVER_SETTING_STR",
220 "PACKET_SERVER_SETTING_ENUM",
221 "PACKET_SERVER_SETTING_BITWISE",
222 "PACKET_RULESET_SELECT",
223 "unknown",
224 "unknown",
225 "unknown",
226 "PACKET_RULESET_EFFECT",
227 "unknown",
228 "PACKET_RULESET_RESOURCE",
229 "unknown",
230 "unknown",
231 "PACKET_SCENARIO_INFO",
232 "PACKET_SAVE_SCENARIO",
233 "unknown",
234 "unknown",
235 "unknown",
236 "PACKET_VOTE_NEW",
237 "PACKET_VOTE_UPDATE",
238 "PACKET_VOTE_REMOVE",
239 "PACKET_VOTE_RESOLVE",
240 "PACKET_VOTE_SUBMIT",
241 "PACKET_EDIT_MODE",
242 "unknown",
243 "unknown",
244 "unknown",
245 "unknown",
246 "unknown",
247 "unknown",
248 "PACKET_EDIT_RECALCULATE_BORDERS",
249 "PACKET_EDIT_CHECK_TILES",
250 "PACKET_EDIT_TOGGLE_FOGOFWAR",
251 "PACKET_EDIT_TILE_TERRAIN",
252 "unknown",
253 "PACKET_EDIT_TILE_EXTRA",
254 "unknown",
255 "PACKET_EDIT_STARTPOS",
256 "PACKET_EDIT_STARTPOS_FULL",
257 "PACKET_EDIT_TILE",
258 "PACKET_EDIT_UNIT_CREATE",
259 "PACKET_EDIT_UNIT_REMOVE",
260 "PACKET_EDIT_UNIT_REMOVE_BY_ID",
261 "PACKET_EDIT_UNIT",
262 "PACKET_EDIT_CITY_CREATE",
263 "PACKET_EDIT_CITY_REMOVE",
264 "PACKET_EDIT_CITY",
265 "PACKET_EDIT_PLAYER_CREATE",
266 "PACKET_EDIT_PLAYER_REMOVE",
267 "PACKET_EDIT_PLAYER",
268 "PACKET_EDIT_PLAYER_VISION",
269 "PACKET_EDIT_GAME",
270 "PACKET_EDIT_OBJECT_CREATED",
271 "PACKET_RULESET_ROAD",
272 "unknown",
273 "PACKET_UNIT_CHANGE_ACTIVITY",
274 "PACKET_ENDGAME_PLAYER",
275 "PACKET_RULESET_DISASTER",
276 "PACKET_RULESETS_READY",
277 "PACKET_RULESET_EXTRA_FLAG",
278 "PACKET_RULESET_TRADE",
279 "PACKET_RULESET_UNIT_BONUS",
280 "PACKET_RULESET_UNIT_FLAG",
281 "PACKET_RULESET_UNIT_CLASS_FLAG",
282 "PACKET_RULESET_TERRAIN_FLAG",
283 "PACKET_RULESET_EXTRA",
284 "PACKET_RULESET_ACHIEVEMENT",
285 "PACKET_RULESET_TECH_FLAG",
286 "PACKET_RULESET_ACTION_ENABLER",
287 "PACKET_RULESET_NATION_SETS",
288 "PACKET_NATION_AVAILABILITY",
289 "PACKET_ACHIEVEMENT_INFO",
290 "PACKET_RULESET_STYLE",
291 "PACKET_RULESET_MUSIC",
292 "PACKET_WORKER_TASK",
293 "PACKET_PLAYER_MULTIPLIER",
294 "PACKET_RULESET_MULTIPLIER",
295 "PACKET_TIMEOUT_INFO",
296 "PACKET_PLAY_MUSIC",
297 "PACKET_RULESET_ACTION",
298 "PACKET_RULESET_DESCRIPTION_PART",
299 "PACKET_RULESET_GOODS",
300 "PACKET_TRADE_ROUTE_INFO",
301 "PACKET_PAGE_MSG_PART",
302 "PACKET_RULESET_SUMMARY",
303 "PACKET_RULESET_ACTION_AUTO",
304 "PACKET_SET_TOPOLOGY",
305 "PACKET_CLIENT_HEARTBEAT",
306 "PACKET_CALENDAR_INFO",
307 "PACKET_WEB_CITY_INFO_ADDITION",
308 "PACKET_WEB_CMA_SET",
309 "PACKET_WEB_CMA_CLEAR",
310 "PACKET_WEB_PLAYER_INFO_ADDITION",
311 "PACKET_WEB_RULESET_UNIT_ADDITION",
312 "unknown",
313 "unknown",
314 "unknown",
315 "unknown",
316 "unknown",
317 "unknown",
318 "unknown",
319 "unknown",
320 "unknown",
321 "unknown",
322 "unknown",
323 "unknown",
324 "unknown",
325 "unknown",
326 "unknown",
327 "unknown",
328 "unknown",
329 "unknown",
330 "unknown",
331 "unknown",
332 "unknown",
333 "unknown",
334 "unknown",
335 "unknown",
336 "unknown",
337 "unknown",
338 "unknown",
339 "unknown",
340 "unknown",
341 "unknown",
342 "unknown",
343 "unknown",
344 "unknown",
345 "unknown",
346 "unknown",
347 "unknown",
348 "unknown",
349 "unknown",
350 "unknown",
351 "unknown",
352 "unknown",
353 "unknown",
354 "unknown",
355 "unknown",
356 "unknown",
357 "unknown",
358 "unknown",
359 "unknown",
360 "unknown",
361 "unknown",
362 "unknown",
363 "unknown",
364 "unknown",
365 "unknown",
366 "unknown",
367 "unknown",
368 "unknown",
369 "unknown",
370 "unknown",
371 "unknown",
372 "unknown",
373 "unknown",
374 "unknown",
375 "unknown",
376 "unknown",
377 "unknown",
378 "unknown",
379 "unknown",
380 "unknown",
381 "unknown",
382 "unknown",
383 "unknown",
384 "unknown",
385 "unknown",
386 "unknown",
387 "unknown",
388 "unknown",
389 "unknown",
390 "unknown",
391 "unknown",
392 "unknown",
393 "unknown",
394 "unknown",
395 "unknown",
396 "unknown",
397 "unknown",
398 "unknown",
399 "unknown",
400 "unknown",
401 "unknown",
402 "unknown",
403 "unknown",
404 "unknown",
405 "unknown",
406 "unknown",
407 "unknown",
408 "unknown",
409 "unknown",
410 "unknown",
411 "unknown",
412 "unknown",
413 "unknown",
414 "unknown",
415 "unknown",
416 "unknown",
417 "unknown",
418 "unknown",
419 "unknown",
420 "unknown",
421 "unknown",
422 "unknown",
423 "unknown",
424 "unknown",
425 "unknown",
426 "unknown",
427 "unknown",
428 "unknown",
429 "unknown",
430 "unknown",
431 "unknown",
432 "unknown",
433 "unknown",
434 "unknown",
435 "unknown",
436 "unknown",
437 "unknown",
438 "unknown",
439 "unknown",
440 "unknown",
441 "unknown",
442 "unknown",
443 "unknown",
444 "unknown",
445 "unknown",
446 "unknown",
447 "unknown",
448 "unknown",
449 "unknown",
450 "unknown",
451 "unknown",
452 "unknown",
453 "unknown",
454 "unknown",
455 "unknown",
456 "unknown",
457 "unknown",
458 "unknown",
459 "unknown",
460 "unknown",
461 "unknown",
462 "unknown",
463 "unknown",
464 "unknown",
465 "unknown",
466 "unknown",
467 "unknown",
468 "unknown",
469 "unknown",
470 "unknown",
471 "unknown",
472 "unknown",
473 "unknown",
474 "unknown",
475 "unknown",
476 "unknown",
477 "unknown",
478 "unknown",
479 "unknown",
480 "unknown",
481 "unknown",
482 "unknown",
483 "unknown",
484 "unknown",
485 "unknown",
486 "unknown",
487 "unknown",
488 "unknown",
489 "unknown",
490 "unknown",
491 "unknown",
492 "unknown",
493 "unknown",
494 "unknown",
495 "unknown",
496 "unknown",
497 "unknown",
498 "unknown",
499 "unknown",
500 "unknown",
501 "unknown",
502 "unknown",
503 "unknown",
504 "unknown",
505 "unknown",
506 "unknown",
507 "unknown",
508 "unknown",
509 "unknown",
510 "unknown",
511 "unknown",
512 "unknown",
513 "unknown",
514 "unknown",
515 "unknown",
516 "unknown",
517 "unknown",
518 "unknown",
519 "unknown",
520 "unknown",
521 "unknown",
522 "unknown",
523 "unknown",
524 "unknown",
525 "unknown",
526 "unknown",
527 "unknown",
528 "unknown",
529 "unknown",
530 "unknown",
531 "unknown",
532 "unknown",
533 "unknown",
534 "unknown",
535 "unknown",
536 "unknown",
537 "unknown",
538 "unknown",
539 "unknown",
540 "unknown",
541 "unknown",
542 "unknown",
543 "unknown",
544 "unknown",
545 "unknown",
546 "unknown",
547 "unknown",
548 "unknown",
549 "unknown",
550 "unknown",
551 "unknown",
552 "unknown",
553 "unknown",
554 "unknown",
555 "unknown",
556 "unknown",
557 "unknown",
558 "unknown",
559 "unknown",
560 "unknown",
561 "unknown",
562 "unknown",
563 "PACKET_RULESET_CLAUSE",
564 "PACKET_RULESET_COUNTER",
565 "PACKET_CITY_UPDATE_COUNTERS",
566 };
567
568 return (type < PACKET_LAST ? names[type] : "unknown");
569}
570
571 bool packet_has_game_info_flag(enum packet_type type)
572{
573 static const bool flag[PACKET_LAST] = {
574 FALSE, /* PACKET_PROCESSING_STARTED */
575 FALSE, /* PACKET_PROCESSING_FINISHED */
576 FALSE,
577 FALSE,
578 FALSE, /* PACKET_SERVER_JOIN_REQ */
579 FALSE, /* PACKET_SERVER_JOIN_REPLY */
580 FALSE, /* PACKET_AUTHENTICATION_REQ */
581 FALSE, /* PACKET_AUTHENTICATION_REPLY */
582 FALSE, /* PACKET_SERVER_SHUTDOWN */
583 FALSE, /* PACKET_RULESET_TECH_CLASS */
584 FALSE, /* PACKET_NATION_SELECT_REQ */
585 FALSE, /* PACKET_PLAYER_READY */
586 FALSE, /* PACKET_ENDGAME_REPORT */
587 FALSE, /* PACKET_SCENARIO_DESCRIPTION */
588 FALSE, /* PACKET_EDIT_SCENARIO_DESC */
589 TRUE, /* PACKET_TILE_INFO */
590 FALSE, /* PACKET_GAME_INFO */
591 FALSE, /* PACKET_MAP_INFO */
592 FALSE, /* PACKET_NUKE_TILE_INFO */
593 FALSE, /* PACKET_TEAM_NAME_INFO */
594 FALSE, /* PACKET_RULESET_IMPR_FLAG */
595 FALSE, /* PACKET_INVESTIGATE_STARTED */
596 FALSE, /* PACKET_INVESTIGATE_FINISHED */
597 FALSE,
598 FALSE,
599 FALSE, /* PACKET_CHAT_MSG */
600 FALSE, /* PACKET_CHAT_MSG_REQ */
601 FALSE, /* PACKET_CONNECT_MSG */
602 FALSE, /* PACKET_EARLY_CHAT_MSG */
603 FALSE, /* PACKET_SERVER_INFO */
604 FALSE, /* PACKET_CITY_REMOVE */
605 TRUE, /* PACKET_CITY_INFO */
606 TRUE, /* PACKET_CITY_SHORT_INFO */
607 FALSE, /* PACKET_CITY_SELL */
608 FALSE, /* PACKET_CITY_BUY */
609 FALSE, /* PACKET_CITY_CHANGE */
610 FALSE, /* PACKET_CITY_WORKLIST */
611 FALSE, /* PACKET_CITY_MAKE_SPECIALIST */
612 FALSE, /* PACKET_CITY_MAKE_WORKER */
613 FALSE, /* PACKET_CITY_CHANGE_SPECIALIST */
614 FALSE, /* PACKET_CITY_RENAME */
615 FALSE, /* PACKET_CITY_OPTIONS_REQ */
616 FALSE, /* PACKET_CITY_REFRESH */
617 FALSE, /* PACKET_CITY_NAME_SUGGESTION_REQ */
618 FALSE, /* PACKET_CITY_NAME_SUGGESTION_INFO */
619 FALSE, /* PACKET_CITY_SABOTAGE_LIST */
620 TRUE, /* PACKET_CITY_NATIONALITIES */
621 FALSE,
622 FALSE,
623 FALSE,
624 FALSE, /* PACKET_PLAYER_REMOVE */
625 FALSE, /* PACKET_PLAYER_INFO */
626 FALSE, /* PACKET_PLAYER_PHASE_DONE */
627 FALSE, /* PACKET_PLAYER_RATES */
628 FALSE, /* PACKET_PLAYER_CHANGE_GOVERNMENT */
629 FALSE, /* PACKET_PLAYER_RESEARCH */
630 FALSE, /* PACKET_PLAYER_TECH_GOAL */
631 FALSE, /* PACKET_PLAYER_ATTRIBUTE_BLOCK */
632 FALSE, /* PACKET_PLAYER_ATTRIBUTE_CHUNK */
633 FALSE, /* PACKET_PLAYER_DIPLSTATE */
634 TRUE, /* PACKET_RESEARCH_INFO */
635 FALSE, /* PACKET_PLAYER_PLACE_INFRA */
636 FALSE, /* PACKET_UNIT_REMOVE */
637 TRUE, /* PACKET_UNIT_INFO */
638 TRUE, /* PACKET_UNIT_SHORT_INFO */
639 FALSE, /* PACKET_UNIT_COMBAT_INFO */
640 TRUE, /* PACKET_UNKNOWN_RESEARCH */
641 FALSE,
642 FALSE,
643 FALSE,
644 FALSE,
645 FALSE, /* PACKET_UNIT_SSCS_SET */
646 FALSE,
647 FALSE, /* PACKET_UNIT_ORDERS */
648 FALSE, /* PACKET_UNIT_SERVER_SIDE_AGENT_SET */
649 FALSE,
650 FALSE,
651 FALSE,
652 FALSE,
653 FALSE,
654 FALSE,
655 FALSE,
656 FALSE, /* PACKET_UNIT_ACTION_QUERY */
657 FALSE, /* PACKET_UNIT_TYPE_UPGRADE */
658 FALSE, /* PACKET_UNIT_DO_ACTION */
659 FALSE, /* PACKET_UNIT_ACTION_ANSWER */
660 FALSE,
661 FALSE, /* PACKET_UNIT_GET_ACTIONS */
662 FALSE, /* PACKET_CONN_PING */
663 FALSE, /* PACKET_CONN_PONG */
664 FALSE, /* PACKET_UNIT_ACTIONS */
665 FALSE,
666 FALSE,
667 FALSE,
668 FALSE,
669 FALSE, /* PACKET_DIPLOMACY_INIT_MEETING_REQ */
670 FALSE, /* PACKET_DIPLOMACY_INIT_MEETING */
671 FALSE, /* PACKET_DIPLOMACY_CANCEL_MEETING_REQ */
672 FALSE, /* PACKET_DIPLOMACY_CANCEL_MEETING */
673 FALSE, /* PACKET_DIPLOMACY_CREATE_CLAUSE_REQ */
674 FALSE, /* PACKET_DIPLOMACY_CREATE_CLAUSE */
675 FALSE, /* PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ */
676 FALSE, /* PACKET_DIPLOMACY_REMOVE_CLAUSE */
677 FALSE, /* PACKET_DIPLOMACY_ACCEPT_TREATY_REQ */
678 FALSE, /* PACKET_DIPLOMACY_ACCEPT_TREATY */
679 FALSE, /* PACKET_DIPLOMACY_CANCEL_PACT */
680 FALSE,
681 FALSE,
682 FALSE,
683 FALSE,
684 FALSE, /* PACKET_PAGE_MSG */
685 FALSE, /* PACKET_REPORT_REQ */
686 FALSE,
687 FALSE,
688 FALSE,
689 FALSE, /* PACKET_CONN_INFO */
690 FALSE, /* PACKET_CONN_PING_INFO */
691 FALSE,
692 FALSE,
693 FALSE, /* PACKET_CLIENT_INFO */
694 FALSE,
695 FALSE,
696 FALSE,
697 FALSE,
698 FALSE,
699 FALSE, /* PACKET_END_PHASE */
700 FALSE, /* PACKET_START_PHASE */
701 FALSE, /* PACKET_NEW_YEAR */
702 FALSE, /* PACKET_BEGIN_TURN */
703 FALSE, /* PACKET_END_TURN */
704 FALSE, /* PACKET_FREEZE_CLIENT */
705 FALSE, /* PACKET_THAW_CLIENT */
706 FALSE,
707 FALSE,
708 FALSE,
709 FALSE, /* PACKET_SPACESHIP_LAUNCH */
710 FALSE, /* PACKET_SPACESHIP_PLACE */
711 TRUE, /* PACKET_SPACESHIP_INFO */
712 TRUE, /* PACKET_CITY_RALLY_POINT */
713 FALSE,
714 FALSE, /* PACKET_RULESET_UNIT */
715 FALSE, /* PACKET_RULESET_GAME */
716 FALSE, /* PACKET_RULESET_SPECIALIST */
717 FALSE, /* PACKET_RULESET_GOVERNMENT_RULER_TITLE */
718 FALSE, /* PACKET_RULESET_TECH */
719 FALSE, /* PACKET_RULESET_GOVERNMENT */
720 FALSE, /* PACKET_RULESET_TERRAIN_CONTROL */
721 FALSE, /* PACKET_RULESET_NATION_GROUPS */
722 FALSE, /* PACKET_RULESET_NATION */
723 FALSE, /* PACKET_RULESET_CITY */
724 FALSE, /* PACKET_RULESET_BUILDING */
725 FALSE, /* PACKET_RULESET_TERRAIN */
726 FALSE, /* PACKET_RULESET_UNIT_CLASS */
727 FALSE, /* PACKET_RULESET_BASE */
728 FALSE,
729 FALSE, /* PACKET_RULESET_CONTROL */
730 FALSE,
731 FALSE,
732 FALSE,
733 FALSE,
734 FALSE, /* PACKET_SINGLE_WANT_HACK_REQ */
735 FALSE, /* PACKET_SINGLE_WANT_HACK_REPLY */
736 FALSE, /* PACKET_RULESET_CHOICES */
737 FALSE, /* PACKET_GAME_LOAD */
738 FALSE, /* PACKET_SERVER_SETTING_CONTROL */
739 FALSE, /* PACKET_SERVER_SETTING_CONST */
740 FALSE, /* PACKET_SERVER_SETTING_BOOL */
741 FALSE, /* PACKET_SERVER_SETTING_INT */
742 FALSE, /* PACKET_SERVER_SETTING_STR */
743 FALSE, /* PACKET_SERVER_SETTING_ENUM */
744 FALSE, /* PACKET_SERVER_SETTING_BITWISE */
745 FALSE, /* PACKET_RULESET_SELECT */
746 FALSE,
747 FALSE,
748 FALSE,
749 FALSE, /* PACKET_RULESET_EFFECT */
750 FALSE,
751 FALSE, /* PACKET_RULESET_RESOURCE */
752 FALSE,
753 FALSE,
754 FALSE, /* PACKET_SCENARIO_INFO */
755 FALSE, /* PACKET_SAVE_SCENARIO */
756 FALSE,
757 FALSE,
758 FALSE,
759 FALSE, /* PACKET_VOTE_NEW */
760 FALSE, /* PACKET_VOTE_UPDATE */
761 FALSE, /* PACKET_VOTE_REMOVE */
762 FALSE, /* PACKET_VOTE_RESOLVE */
763 FALSE, /* PACKET_VOTE_SUBMIT */
764 FALSE, /* PACKET_EDIT_MODE */
765 FALSE,
766 FALSE,
767 FALSE,
768 FALSE,
769 FALSE,
770 FALSE,
771 FALSE, /* PACKET_EDIT_RECALCULATE_BORDERS */
772 FALSE, /* PACKET_EDIT_CHECK_TILES */
773 FALSE, /* PACKET_EDIT_TOGGLE_FOGOFWAR */
774 FALSE, /* PACKET_EDIT_TILE_TERRAIN */
775 FALSE,
776 FALSE, /* PACKET_EDIT_TILE_EXTRA */
777 FALSE,
778 FALSE, /* PACKET_EDIT_STARTPOS */
779 FALSE, /* PACKET_EDIT_STARTPOS_FULL */
780 FALSE, /* PACKET_EDIT_TILE */
781 FALSE, /* PACKET_EDIT_UNIT_CREATE */
782 FALSE, /* PACKET_EDIT_UNIT_REMOVE */
783 FALSE, /* PACKET_EDIT_UNIT_REMOVE_BY_ID */
784 FALSE, /* PACKET_EDIT_UNIT */
785 FALSE, /* PACKET_EDIT_CITY_CREATE */
786 FALSE, /* PACKET_EDIT_CITY_REMOVE */
787 FALSE, /* PACKET_EDIT_CITY */
788 FALSE, /* PACKET_EDIT_PLAYER_CREATE */
789 FALSE, /* PACKET_EDIT_PLAYER_REMOVE */
790 FALSE, /* PACKET_EDIT_PLAYER */
791 FALSE, /* PACKET_EDIT_PLAYER_VISION */
792 FALSE, /* PACKET_EDIT_GAME */
793 FALSE, /* PACKET_EDIT_OBJECT_CREATED */
794 FALSE, /* PACKET_RULESET_ROAD */
795 FALSE,
796 FALSE, /* PACKET_UNIT_CHANGE_ACTIVITY */
797 FALSE, /* PACKET_ENDGAME_PLAYER */
798 FALSE, /* PACKET_RULESET_DISASTER */
799 FALSE, /* PACKET_RULESETS_READY */
800 FALSE, /* PACKET_RULESET_EXTRA_FLAG */
801 FALSE, /* PACKET_RULESET_TRADE */
802 FALSE, /* PACKET_RULESET_UNIT_BONUS */
803 FALSE, /* PACKET_RULESET_UNIT_FLAG */
804 FALSE, /* PACKET_RULESET_UNIT_CLASS_FLAG */
805 FALSE, /* PACKET_RULESET_TERRAIN_FLAG */
806 FALSE, /* PACKET_RULESET_EXTRA */
807 FALSE, /* PACKET_RULESET_ACHIEVEMENT */
808 FALSE, /* PACKET_RULESET_TECH_FLAG */
809 FALSE, /* PACKET_RULESET_ACTION_ENABLER */
810 FALSE, /* PACKET_RULESET_NATION_SETS */
811 FALSE, /* PACKET_NATION_AVAILABILITY */
812 FALSE, /* PACKET_ACHIEVEMENT_INFO */
813 FALSE, /* PACKET_RULESET_STYLE */
814 FALSE, /* PACKET_RULESET_MUSIC */
815 FALSE, /* PACKET_WORKER_TASK */
816 FALSE, /* PACKET_PLAYER_MULTIPLIER */
817 FALSE, /* PACKET_RULESET_MULTIPLIER */
818 FALSE, /* PACKET_TIMEOUT_INFO */
819 FALSE, /* PACKET_PLAY_MUSIC */
820 FALSE, /* PACKET_RULESET_ACTION */
821 FALSE, /* PACKET_RULESET_DESCRIPTION_PART */
822 FALSE, /* PACKET_RULESET_GOODS */
823 FALSE, /* PACKET_TRADE_ROUTE_INFO */
824 FALSE, /* PACKET_PAGE_MSG_PART */
825 FALSE, /* PACKET_RULESET_SUMMARY */
826 FALSE, /* PACKET_RULESET_ACTION_AUTO */
827 FALSE, /* PACKET_SET_TOPOLOGY */
828 FALSE, /* PACKET_CLIENT_HEARTBEAT */
829 FALSE, /* PACKET_CALENDAR_INFO */
830 TRUE, /* PACKET_WEB_CITY_INFO_ADDITION */
831 FALSE, /* PACKET_WEB_CMA_SET */
832 FALSE, /* PACKET_WEB_CMA_CLEAR */
833 FALSE, /* PACKET_WEB_PLAYER_INFO_ADDITION */
834 FALSE, /* PACKET_WEB_RULESET_UNIT_ADDITION */
835 FALSE,
836 FALSE,
837 FALSE,
838 FALSE,
839 FALSE,
840 FALSE,
841 FALSE,
842 FALSE,
843 FALSE,
844 FALSE,
845 FALSE,
846 FALSE,
847 FALSE,
848 FALSE,
849 FALSE,
850 FALSE,
851 FALSE,
852 FALSE,
853 FALSE,
854 FALSE,
855 FALSE,
856 FALSE,
857 FALSE,
858 FALSE,
859 FALSE,
860 FALSE,
861 FALSE,
862 FALSE,
863 FALSE,
864 FALSE,
865 FALSE,
866 FALSE,
867 FALSE,
868 FALSE,
869 FALSE,
870 FALSE,
871 FALSE,
872 FALSE,
873 FALSE,
874 FALSE,
875 FALSE,
876 FALSE,
877 FALSE,
878 FALSE,
879 FALSE,
880 FALSE,
881 FALSE,
882 FALSE,
883 FALSE,
884 FALSE,
885 FALSE,
886 FALSE,
887 FALSE,
888 FALSE,
889 FALSE,
890 FALSE,
891 FALSE,
892 FALSE,
893 FALSE,
894 FALSE,
895 FALSE,
896 FALSE,
897 FALSE,
898 FALSE,
899 FALSE,
900 FALSE,
901 FALSE,
902 FALSE,
903 FALSE,
904 FALSE,
905 FALSE,
906 FALSE,
907 FALSE,
908 FALSE,
909 FALSE,
910 FALSE,
911 FALSE,
912 FALSE,
913 FALSE,
914 FALSE,
915 FALSE,
916 FALSE,
917 FALSE,
918 FALSE,
919 FALSE,
920 FALSE,
921 FALSE,
922 FALSE,
923 FALSE,
924 FALSE,
925 FALSE,
926 FALSE,
927 FALSE,
928 FALSE,
929 FALSE,
930 FALSE,
931 FALSE,
932 FALSE,
933 FALSE,
934 FALSE,
935 FALSE,
936 FALSE,
937 FALSE,
938 FALSE,
939 FALSE,
940 FALSE,
941 FALSE,
942 FALSE,
943 FALSE,
944 FALSE,
945 FALSE,
946 FALSE,
947 FALSE,
948 FALSE,
949 FALSE,
950 FALSE,
951 FALSE,
952 FALSE,
953 FALSE,
954 FALSE,
955 FALSE,
956 FALSE,
957 FALSE,
958 FALSE,
959 FALSE,
960 FALSE,
961 FALSE,
962 FALSE,
963 FALSE,
964 FALSE,
965 FALSE,
966 FALSE,
967 FALSE,
968 FALSE,
969 FALSE,
970 FALSE,
971 FALSE,
972 FALSE,
973 FALSE,
974 FALSE,
975 FALSE,
976 FALSE,
977 FALSE,
978 FALSE,
979 FALSE,
980 FALSE,
981 FALSE,
982 FALSE,
983 FALSE,
984 FALSE,
985 FALSE,
986 FALSE,
987 FALSE,
988 FALSE,
989 FALSE,
990 FALSE,
991 FALSE,
992 FALSE,
993 FALSE,
994 FALSE,
995 FALSE,
996 FALSE,
997 FALSE,
998 FALSE,
999 FALSE,
1000 FALSE,
1001 FALSE,
1002 FALSE,
1003 FALSE,
1004 FALSE,
1005 FALSE,
1006 FALSE,
1007 FALSE,
1008 FALSE,
1009 FALSE,
1010 FALSE,
1011 FALSE,
1012 FALSE,
1013 FALSE,
1014 FALSE,
1015 FALSE,
1016 FALSE,
1017 FALSE,
1018 FALSE,
1019 FALSE,
1020 FALSE,
1021 FALSE,
1022 FALSE,
1023 FALSE,
1024 FALSE,
1025 FALSE,
1026 FALSE,
1027 FALSE,
1028 FALSE,
1029 FALSE,
1030 FALSE,
1031 FALSE,
1032 FALSE,
1033 FALSE,
1034 FALSE,
1035 FALSE,
1036 FALSE,
1037 FALSE,
1038 FALSE,
1039 FALSE,
1040 FALSE,
1041 FALSE,
1042 FALSE,
1043 FALSE,
1044 FALSE,
1045 FALSE,
1046 FALSE,
1047 FALSE,
1048 FALSE,
1049 FALSE,
1050 FALSE,
1051 FALSE,
1052 FALSE,
1053 FALSE,
1054 FALSE,
1055 FALSE,
1056 FALSE,
1057 FALSE,
1058 FALSE,
1059 FALSE,
1060 FALSE,
1061 FALSE,
1062 FALSE,
1063 FALSE,
1064 FALSE,
1065 FALSE,
1066 FALSE,
1067 FALSE,
1068 FALSE,
1069 FALSE,
1070 FALSE,
1071 FALSE,
1072 FALSE,
1073 FALSE,
1074 FALSE,
1075 FALSE,
1076 FALSE,
1077 FALSE,
1078 FALSE,
1079 FALSE,
1080 FALSE,
1081 FALSE,
1082 FALSE,
1083 FALSE,
1084 FALSE,
1085 FALSE,
1086 FALSE, /* PACKET_RULESET_CLAUSE */
1087 FALSE, /* PACKET_RULESET_COUNTER */
1088 TRUE, /* PACKET_CITY_UPDATE_COUNTERS */
1089 };
1090
1091 return (type < PACKET_LAST ? flag[type] : FALSE);
1092}
1093
1094 static inline void init_packet_processing_started(struct packet_processing_started *packet)
1095{
1096 memset(packet, 0, sizeof(*packet));
1097}
1098
1099#define free_packet_processing_started(_packet) (void) 0
1100#define destroy_packet_processing_started free
1101
1102 static struct packet_processing_started *receive_packet_processing_started_100(struct connection *pc)
1103{
1104#define FREE_PACKET_STRUCT(_packet) free_packet_processing_started(_packet)
1105 RECEIVE_PACKET_START(packet_processing_started, real_packet);
1106#if 1 /* To match endif */
1107 real_packet->__dummy = 0xff;
1108#endif
1109 log_packet_detailed("packet_processing_started_100: got info about ()");
1110 RECEIVE_PACKET_END(real_packet);
1111#undef FREE_PACKET_STRUCT
1112}
1113
1114 static int send_packet_processing_started_100(struct connection *pc)
1115{
1116 SEND_PACKET_START(PACKET_PROCESSING_STARTED);
1117
1118 log_packet_detailed("packet_processing_started_100: sending info about ()");
1119 SEND_PACKET_END(PACKET_PROCESSING_STARTED);
1120}
1121
1122 int send_packet_processing_started(struct connection *pc)
1123{
1124 if (!pc->used) {
1125 log_error("WARNING: trying to send data to the closed connection %s",
1126 conn_description(pc));
1127 return -1;
1128 }
1129 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PROCESSING_STARTED].no_packet != nullptr, -1,
1130 "Handler for PACKET_PROCESSING_STARTED not installed");
1131 return pc->phs.handlers->send[PACKET_PROCESSING_STARTED].no_packet(pc);
1132}
1133
1134 static inline void init_packet_processing_finished(struct packet_processing_finished *packet)
1135{
1136 memset(packet, 0, sizeof(*packet));
1137}
1138
1139#define free_packet_processing_finished(_packet) (void) 0
1140#define destroy_packet_processing_finished free
1141
1142 static struct packet_processing_finished *receive_packet_processing_finished_100(struct connection *pc)
1143{
1144#define FREE_PACKET_STRUCT(_packet) free_packet_processing_finished(_packet)
1145 RECEIVE_PACKET_START(packet_processing_finished, real_packet);
1146#if 1 /* To match endif */
1147 real_packet->__dummy = 0xff;
1148#endif
1149 log_packet_detailed("packet_processing_finished_100: got info about ()");
1150 RECEIVE_PACKET_END(real_packet);
1151#undef FREE_PACKET_STRUCT
1152}
1153
1154 static int send_packet_processing_finished_100(struct connection *pc)
1155{
1156 SEND_PACKET_START(PACKET_PROCESSING_FINISHED);
1157
1158 log_packet_detailed("packet_processing_finished_100: sending info about ()");
1159 SEND_PACKET_END(PACKET_PROCESSING_FINISHED);
1160}
1161
1162 int send_packet_processing_finished(struct connection *pc)
1163{
1164 if (!pc->used) {
1165 log_error("WARNING: trying to send data to the closed connection %s",
1166 conn_description(pc));
1167 return -1;
1168 }
1169 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PROCESSING_FINISHED].no_packet != nullptr, -1,
1170 "Handler for PACKET_PROCESSING_FINISHED not installed");
1171 return pc->phs.handlers->send[PACKET_PROCESSING_FINISHED].no_packet(pc);
1172}
1173
1174 static inline void init_packet_investigate_started(struct packet_investigate_started *packet)
1175{
1176 memset(packet, 0, sizeof(*packet));
1177}
1178
1179#define free_packet_investigate_started(_packet) (void) 0
1180#define destroy_packet_investigate_started free
1181
1182#ifdef FREECIV_DELTA_PROTOCOL
1183#define hash_packet_investigate_started_100 hash_const
1184
1185#define cmp_packet_investigate_started_100 cmp_const
1186
1187 BV_DEFINE(packet_investigate_started_100_fields, 2);
1188#endif /* FREECIV_DELTA_PROTOCOL */
1189
1190 static struct packet_investigate_started *receive_packet_investigate_started_100(struct connection *pc)
1191{
1192#define FREE_PACKET_STRUCT(_packet) free_packet_investigate_started(_packet)
1193#ifdef FREECIV_DELTA_PROTOCOL
1194 packet_investigate_started_100_fields fields;
1195 struct packet_investigate_started *old;
1196 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_STARTED;
1197#endif /* FREECIV_DELTA_PROTOCOL */
1198 RECEIVE_PACKET_START(packet_investigate_started, real_packet);
1199#ifdef FREECIV_JSON_CONNECTION
1200 struct plocation field_addr;
1201 {
1202 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1203 field_addr = *field_addr_tmp;
1204 FC_FREE(field_addr_tmp);
1205 }
1206#endif /* FREECIV_JSON_CONNECTION */
1207
1208#ifdef FREECIV_DELTA_PROTOCOL
1209#ifdef FREECIV_JSON_CONNECTION
1210 field_addr.name = "fields";
1211#endif /* FREECIV_JSON_CONNECTION */
1212 DIO_BV_GET(&din, &field_addr, fields);
1213
1214#else /* FREECIV_DELTA_PROTOCOL */
1215#ifdef FREECIV_JSON_CONNECTION
1216 field_addr.name = "unit_id";
1217#endif /* FREECIV_JSON_CONNECTION */
1218 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1219 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1220 }
1221#ifdef FREECIV_JSON_CONNECTION
1222 field_addr.name = "city_id";
1223#endif /* FREECIV_JSON_CONNECTION */
1224 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1225 RECEIVE_PACKET_FIELD_ERROR(city_id);
1226 }
1227#endif
1228 log_packet_detailed("packet_investigate_started_100: got info about ()");
1229
1230#ifdef FREECIV_DELTA_PROTOCOL
1231 if (nullptr == *hash) {
1232 *hash = genhash_new_full(hash_packet_investigate_started_100, cmp_packet_investigate_started_100,
1233 nullptr, nullptr, nullptr, destroy_packet_investigate_started);
1234 }
1235
1236 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1237 *real_packet = *old;
1238 } else {
1239 /* packet is already initialized empty */
1240 log_packet_detailed(" no old info");
1241 }
1242
1243 if (BV_ISSET(fields, 0)) {
1244 log_packet_detailed(" got field 'unit_id'");
1245#ifdef FREECIV_JSON_CONNECTION
1246 field_addr.name = "unit_id";
1247#endif /* FREECIV_JSON_CONNECTION */
1248 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1249 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1250 }
1251 }
1252 if (BV_ISSET(fields, 1)) {
1253 log_packet_detailed(" got field 'city_id'");
1254#ifdef FREECIV_JSON_CONNECTION
1255 field_addr.name = "city_id";
1256#endif /* FREECIV_JSON_CONNECTION */
1257 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1258 RECEIVE_PACKET_FIELD_ERROR(city_id);
1259 }
1260 }
1261
1262 if (nullptr == old) {
1263 old = fc_malloc(sizeof(*old));
1264 init_packet_investigate_started(old);
1265 *old = *real_packet;
1266 genhash_insert(*hash, old, old);
1267 } else {
1268 *old = *real_packet;
1269 }
1270
1271#endif /* FREECIV_DELTA_PROTOCOL */
1272 RECEIVE_PACKET_END(real_packet);
1273#undef FREE_PACKET_STRUCT
1274}
1275
1276 static int send_packet_investigate_started_100(struct connection *pc, const struct packet_investigate_started *packet)
1277{
1278 const struct packet_investigate_started *real_packet = packet;
1279 int e;
1280#ifdef FREECIV_DELTA_PROTOCOL
1281 packet_investigate_started_100_fields fields;
1282 struct packet_investigate_started *old;
1283 bool differ;
1284 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_STARTED;
1285#endif /* FREECIV_DELTA_PROTOCOL */
1286 SEND_PACKET_START(PACKET_INVESTIGATE_STARTED);
1287#ifdef FREECIV_JSON_CONNECTION
1288 struct plocation field_addr;
1289 {
1290 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1291 field_addr = *field_addr_tmp;
1292 FC_FREE(field_addr_tmp);
1293 }
1294#endif /* FREECIV_JSON_CONNECTION */
1295
1296 log_packet_detailed("packet_investigate_started_100: sending info about ()");
1297
1298#ifdef FREECIV_DELTA_PROTOCOL
1299 if (nullptr == *hash) {
1300 *hash = genhash_new_full(hash_packet_investigate_started_100, cmp_packet_investigate_started_100,
1301 nullptr, nullptr, nullptr, destroy_packet_investigate_started);
1302 }
1303 BV_CLR_ALL(fields);
1304
1305 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1306 old = fc_malloc(sizeof(*old));
1307 /* temporary bitcopy just to insert correctly */
1308 *old = *real_packet;
1309 genhash_insert(*hash, old, old);
1310 init_packet_investigate_started(old);
1311 }
1312 differ = (old->unit_id != real_packet->unit_id);
1313 if (differ) {
1314 BV_SET(fields, 0);
1315 }
1316
1317 differ = (old->city_id != real_packet->city_id);
1318 if (differ) {
1319 BV_SET(fields, 1);
1320 }
1321
1322
1323#ifdef FREECIV_JSON_CONNECTION
1324 field_addr.name = "fields";
1325#endif /* FREECIV_JSON_CONNECTION */
1326 e = 0;
1327 e |= DIO_BV_PUT(&dout, &field_addr, fields);
1328 if (e) {
1329 log_packet_detailed("fields bitvector error detected");
1330 }
1331
1332 if (BV_ISSET(fields, 0)) {
1333 log_packet_detailed(" field 'unit_id' has changed");
1334#ifdef FREECIV_JSON_CONNECTION
1335 field_addr.name = "unit_id";
1336#endif /* FREECIV_JSON_CONNECTION */
1337 e = 0;
1338 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1339 if (e) {
1340 log_packet_detailed("'unit_id' field error detected");
1341 }
1342 }
1343 if (BV_ISSET(fields, 1)) {
1344 log_packet_detailed(" field 'city_id' has changed");
1345#ifdef FREECIV_JSON_CONNECTION
1346 field_addr.name = "city_id";
1347#endif /* FREECIV_JSON_CONNECTION */
1348 e = 0;
1349 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1350 if (e) {
1351 log_packet_detailed("'city_id' field error detected");
1352 }
1353 }
1354
1355 *old = *real_packet;
1356#endif /* FREECIV_DELTA_PROTOCOL */
1357#ifndef FREECIV_DELTA_PROTOCOL
1358#ifdef FREECIV_JSON_CONNECTION
1359 field_addr.name = "unit_id";
1360#endif /* FREECIV_JSON_CONNECTION */
1361 e = 0;
1362 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1363 if (e) {
1364 log_packet_detailed("'unit_id' field error detected");
1365 }
1366#ifdef FREECIV_JSON_CONNECTION
1367 field_addr.name = "city_id";
1368#endif /* FREECIV_JSON_CONNECTION */
1369 e = 0;
1370 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1371 if (e) {
1372 log_packet_detailed("'city_id' field error detected");
1373 }
1374
1375#endif
1376 SEND_PACKET_END(PACKET_INVESTIGATE_STARTED);
1377}
1378
1379 int send_packet_investigate_started(struct connection *pc, const struct packet_investigate_started *packet)
1380{
1381 if (!pc->used) {
1382 log_error("WARNING: trying to send data to the closed connection %s",
1383 conn_description(pc));
1384 return -1;
1385 }
1386 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_INVESTIGATE_STARTED].packet != nullptr, -1,
1387 "Handler for PACKET_INVESTIGATE_STARTED not installed");
1388 return pc->phs.handlers->send[PACKET_INVESTIGATE_STARTED].packet(pc, packet);
1389}
1390
1391 void lsend_packet_investigate_started(struct conn_list *dest, const struct packet_investigate_started *packet)
1392{
1393 conn_list_iterate(dest, pconn) {
1394 send_packet_investigate_started(pconn, packet);
1395 } conn_list_iterate_end;
1396}
1397
1398 int dsend_packet_investigate_started(struct connection *pc, int unit_id, int city_id)
1399{
1400 struct packet_investigate_started packet, *real_packet = &packet;
1401
1402 real_packet->unit_id = unit_id;
1403 real_packet->city_id = city_id;
1404
1405 return send_packet_investigate_started(pc, real_packet);
1406}
1407
1408 void dlsend_packet_investigate_started(struct conn_list *dest, int unit_id, int city_id)
1409{
1410 struct packet_investigate_started packet, *real_packet = &packet;
1411
1412 real_packet->unit_id = unit_id;
1413 real_packet->city_id = city_id;
1414
1415 lsend_packet_investigate_started(dest, real_packet);
1416}
1417
1418 static inline void init_packet_investigate_finished(struct packet_investigate_finished *packet)
1419{
1420 memset(packet, 0, sizeof(*packet));
1421}
1422
1423#define free_packet_investigate_finished(_packet) (void) 0
1424#define destroy_packet_investigate_finished free
1425
1426#ifdef FREECIV_DELTA_PROTOCOL
1427#define hash_packet_investigate_finished_100 hash_const
1428
1429#define cmp_packet_investigate_finished_100 cmp_const
1430
1431 BV_DEFINE(packet_investigate_finished_100_fields, 2);
1432#endif /* FREECIV_DELTA_PROTOCOL */
1433
1434 static struct packet_investigate_finished *receive_packet_investigate_finished_100(struct connection *pc)
1435{
1436#define FREE_PACKET_STRUCT(_packet) free_packet_investigate_finished(_packet)
1437#ifdef FREECIV_DELTA_PROTOCOL
1438 packet_investigate_finished_100_fields fields;
1439 struct packet_investigate_finished *old;
1440 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_FINISHED;
1441#endif /* FREECIV_DELTA_PROTOCOL */
1442 RECEIVE_PACKET_START(packet_investigate_finished, real_packet);
1443#ifdef FREECIV_JSON_CONNECTION
1444 struct plocation field_addr;
1445 {
1446 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1447 field_addr = *field_addr_tmp;
1448 FC_FREE(field_addr_tmp);
1449 }
1450#endif /* FREECIV_JSON_CONNECTION */
1451
1452#ifdef FREECIV_DELTA_PROTOCOL
1453#ifdef FREECIV_JSON_CONNECTION
1454 field_addr.name = "fields";
1455#endif /* FREECIV_JSON_CONNECTION */
1456 DIO_BV_GET(&din, &field_addr, fields);
1457
1458#else /* FREECIV_DELTA_PROTOCOL */
1459#ifdef FREECIV_JSON_CONNECTION
1460 field_addr.name = "unit_id";
1461#endif /* FREECIV_JSON_CONNECTION */
1462 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1463 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1464 }
1465#ifdef FREECIV_JSON_CONNECTION
1466 field_addr.name = "city_id";
1467#endif /* FREECIV_JSON_CONNECTION */
1468 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1469 RECEIVE_PACKET_FIELD_ERROR(city_id);
1470 }
1471#endif
1472 log_packet_detailed("packet_investigate_finished_100: got info about ()");
1473
1474#ifdef FREECIV_DELTA_PROTOCOL
1475 if (nullptr == *hash) {
1476 *hash = genhash_new_full(hash_packet_investigate_finished_100, cmp_packet_investigate_finished_100,
1477 nullptr, nullptr, nullptr, destroy_packet_investigate_finished);
1478 }
1479
1480 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1481 *real_packet = *old;
1482 } else {
1483 /* packet is already initialized empty */
1484 log_packet_detailed(" no old info");
1485 }
1486
1487 if (BV_ISSET(fields, 0)) {
1488 log_packet_detailed(" got field 'unit_id'");
1489#ifdef FREECIV_JSON_CONNECTION
1490 field_addr.name = "unit_id";
1491#endif /* FREECIV_JSON_CONNECTION */
1492 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1493 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1494 }
1495 }
1496 if (BV_ISSET(fields, 1)) {
1497 log_packet_detailed(" got field 'city_id'");
1498#ifdef FREECIV_JSON_CONNECTION
1499 field_addr.name = "city_id";
1500#endif /* FREECIV_JSON_CONNECTION */
1501 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1502 RECEIVE_PACKET_FIELD_ERROR(city_id);
1503 }
1504 }
1505
1506 if (nullptr == old) {
1507 old = fc_malloc(sizeof(*old));
1508 init_packet_investigate_finished(old);
1509 *old = *real_packet;
1510 genhash_insert(*hash, old, old);
1511 } else {
1512 *old = *real_packet;
1513 }
1514
1515#endif /* FREECIV_DELTA_PROTOCOL */
1516 RECEIVE_PACKET_END(real_packet);
1517#undef FREE_PACKET_STRUCT
1518}
1519
1520 static int send_packet_investigate_finished_100(struct connection *pc, const struct packet_investigate_finished *packet)
1521{
1522 const struct packet_investigate_finished *real_packet = packet;
1523 int e;
1524#ifdef FREECIV_DELTA_PROTOCOL
1525 packet_investigate_finished_100_fields fields;
1526 struct packet_investigate_finished *old;
1527 bool differ;
1528 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_FINISHED;
1529#endif /* FREECIV_DELTA_PROTOCOL */
1530 SEND_PACKET_START(PACKET_INVESTIGATE_FINISHED);
1531#ifdef FREECIV_JSON_CONNECTION
1532 struct plocation field_addr;
1533 {
1534 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1535 field_addr = *field_addr_tmp;
1536 FC_FREE(field_addr_tmp);
1537 }
1538#endif /* FREECIV_JSON_CONNECTION */
1539
1540 log_packet_detailed("packet_investigate_finished_100: sending info about ()");
1541
1542#ifdef FREECIV_DELTA_PROTOCOL
1543 if (nullptr == *hash) {
1544 *hash = genhash_new_full(hash_packet_investigate_finished_100, cmp_packet_investigate_finished_100,
1545 nullptr, nullptr, nullptr, destroy_packet_investigate_finished);
1546 }
1547 BV_CLR_ALL(fields);
1548
1549 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1550 old = fc_malloc(sizeof(*old));
1551 /* temporary bitcopy just to insert correctly */
1552 *old = *real_packet;
1553 genhash_insert(*hash, old, old);
1554 init_packet_investigate_finished(old);
1555 }
1556 differ = (old->unit_id != real_packet->unit_id);
1557 if (differ) {
1558 BV_SET(fields, 0);
1559 }
1560
1561 differ = (old->city_id != real_packet->city_id);
1562 if (differ) {
1563 BV_SET(fields, 1);
1564 }
1565
1566
1567#ifdef FREECIV_JSON_CONNECTION
1568 field_addr.name = "fields";
1569#endif /* FREECIV_JSON_CONNECTION */
1570 e = 0;
1571 e |= DIO_BV_PUT(&dout, &field_addr, fields);
1572 if (e) {
1573 log_packet_detailed("fields bitvector error detected");
1574 }
1575
1576 if (BV_ISSET(fields, 0)) {
1577 log_packet_detailed(" field 'unit_id' has changed");
1578#ifdef FREECIV_JSON_CONNECTION
1579 field_addr.name = "unit_id";
1580#endif /* FREECIV_JSON_CONNECTION */
1581 e = 0;
1582 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1583 if (e) {
1584 log_packet_detailed("'unit_id' field error detected");
1585 }
1586 }
1587 if (BV_ISSET(fields, 1)) {
1588 log_packet_detailed(" field 'city_id' has changed");
1589#ifdef FREECIV_JSON_CONNECTION
1590 field_addr.name = "city_id";
1591#endif /* FREECIV_JSON_CONNECTION */
1592 e = 0;
1593 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1594 if (e) {
1595 log_packet_detailed("'city_id' field error detected");
1596 }
1597 }
1598
1599 *old = *real_packet;
1600#endif /* FREECIV_DELTA_PROTOCOL */
1601#ifndef FREECIV_DELTA_PROTOCOL
1602#ifdef FREECIV_JSON_CONNECTION
1603 field_addr.name = "unit_id";
1604#endif /* FREECIV_JSON_CONNECTION */
1605 e = 0;
1606 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1607 if (e) {
1608 log_packet_detailed("'unit_id' field error detected");
1609 }
1610#ifdef FREECIV_JSON_CONNECTION
1611 field_addr.name = "city_id";
1612#endif /* FREECIV_JSON_CONNECTION */
1613 e = 0;
1614 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1615 if (e) {
1616 log_packet_detailed("'city_id' field error detected");
1617 }
1618
1619#endif
1620 SEND_PACKET_END(PACKET_INVESTIGATE_FINISHED);
1621}
1622
1623 int send_packet_investigate_finished(struct connection *pc, const struct packet_investigate_finished *packet)
1624{
1625 if (!pc->used) {
1626 log_error("WARNING: trying to send data to the closed connection %s",
1627 conn_description(pc));
1628 return -1;
1629 }
1630 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_INVESTIGATE_FINISHED].packet != nullptr, -1,
1631 "Handler for PACKET_INVESTIGATE_FINISHED not installed");
1632 return pc->phs.handlers->send[PACKET_INVESTIGATE_FINISHED].packet(pc, packet);
1633}
1634
1635 void lsend_packet_investigate_finished(struct conn_list *dest, const struct packet_investigate_finished *packet)
1636{
1637 conn_list_iterate(dest, pconn) {
1638 send_packet_investigate_finished(pconn, packet);
1639 } conn_list_iterate_end;
1640}
1641
1642 int dsend_packet_investigate_finished(struct connection *pc, int unit_id, int city_id)
1643{
1644 struct packet_investigate_finished packet, *real_packet = &packet;
1645
1646 real_packet->unit_id = unit_id;
1647 real_packet->city_id = city_id;
1648
1649 return send_packet_investigate_finished(pc, real_packet);
1650}
1651
1652 void dlsend_packet_investigate_finished(struct conn_list *dest, int unit_id, int city_id)
1653{
1654 struct packet_investigate_finished packet, *real_packet = &packet;
1655
1656 real_packet->unit_id = unit_id;
1657 real_packet->city_id = city_id;
1658
1659 lsend_packet_investigate_finished(dest, real_packet);
1660}
1661
1662 static inline void init_packet_server_join_req(struct packet_server_join_req *packet)
1663{
1664 memset(packet, 0, sizeof(*packet));
1665}
1666
1667#define free_packet_server_join_req(_packet) (void) 0
1668#define destroy_packet_server_join_req free
1669
1670 static struct packet_server_join_req *receive_packet_server_join_req_100(struct connection *pc)
1671{
1672#define FREE_PACKET_STRUCT(_packet) free_packet_server_join_req(_packet)
1673 RECEIVE_PACKET_START(packet_server_join_req, real_packet);
1674#ifdef FREECIV_JSON_CONNECTION
1675 struct plocation field_addr;
1676 {
1677 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1678 field_addr = *field_addr_tmp;
1679 FC_FREE(field_addr_tmp);
1680 }
1681#endif /* FREECIV_JSON_CONNECTION */
1682#if 1 /* To match endif */
1683#ifdef FREECIV_JSON_CONNECTION
1684 field_addr.name = "username";
1685#endif /* FREECIV_JSON_CONNECTION */
1686 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
1687 RECEIVE_PACKET_FIELD_ERROR(username);
1688 }
1689#ifdef FREECIV_JSON_CONNECTION
1690 field_addr.name = "capability";
1691#endif /* FREECIV_JSON_CONNECTION */
1692 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
1693 RECEIVE_PACKET_FIELD_ERROR(capability);
1694 }
1695#ifdef FREECIV_JSON_CONNECTION
1696 field_addr.name = "version_label";
1697#endif /* FREECIV_JSON_CONNECTION */
1698 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
1699 RECEIVE_PACKET_FIELD_ERROR(version_label);
1700 }
1701#ifdef FREECIV_JSON_CONNECTION
1702 field_addr.name = "major_version";
1703#endif /* FREECIV_JSON_CONNECTION */
1704 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
1705 RECEIVE_PACKET_FIELD_ERROR(major_version);
1706 }
1707#ifdef FREECIV_JSON_CONNECTION
1708 field_addr.name = "minor_version";
1709#endif /* FREECIV_JSON_CONNECTION */
1710 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
1711 RECEIVE_PACKET_FIELD_ERROR(minor_version);
1712 }
1713#ifdef FREECIV_JSON_CONNECTION
1714 field_addr.name = "patch_version";
1715#endif /* FREECIV_JSON_CONNECTION */
1716 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
1717 RECEIVE_PACKET_FIELD_ERROR(patch_version);
1718 }
1719#endif
1720 log_packet_detailed("packet_server_join_req_100: got info about ()");
1721 RECEIVE_PACKET_END(real_packet);
1722#undef FREE_PACKET_STRUCT
1723}
1724
1725 static int send_packet_server_join_req_100(struct connection *pc, const struct packet_server_join_req *packet)
1726{
1727 const struct packet_server_join_req *real_packet = packet;
1728 int e;
1729 SEND_PACKET_START(PACKET_SERVER_JOIN_REQ);
1730#ifdef FREECIV_JSON_CONNECTION
1731 struct plocation field_addr;
1732 {
1733 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1734 field_addr = *field_addr_tmp;
1735 FC_FREE(field_addr_tmp);
1736 }
1737#endif /* FREECIV_JSON_CONNECTION */
1738
1739 log_packet_detailed("packet_server_join_req_100: sending info about ()");
1740#if 1 /* To match endif */
1741#ifdef FREECIV_JSON_CONNECTION
1742 field_addr.name = "username";
1743#endif /* FREECIV_JSON_CONNECTION */
1744 e = 0;
1745 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
1746 if (e) {
1747 log_packet_detailed("'username' field error detected");
1748 }
1749#ifdef FREECIV_JSON_CONNECTION
1750 field_addr.name = "capability";
1751#endif /* FREECIV_JSON_CONNECTION */
1752 e = 0;
1753 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
1754 if (e) {
1755 log_packet_detailed("'capability' field error detected");
1756 }
1757#ifdef FREECIV_JSON_CONNECTION
1758 field_addr.name = "version_label";
1759#endif /* FREECIV_JSON_CONNECTION */
1760 e = 0;
1761 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
1762 if (e) {
1763 log_packet_detailed("'version_label' field error detected");
1764 }
1765#ifdef FREECIV_JSON_CONNECTION
1766 field_addr.name = "major_version";
1767#endif /* FREECIV_JSON_CONNECTION */
1768 e = 0;
1769 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
1770 if (e) {
1771 log_packet_detailed("'major_version' field error detected");
1772 }
1773#ifdef FREECIV_JSON_CONNECTION
1774 field_addr.name = "minor_version";
1775#endif /* FREECIV_JSON_CONNECTION */
1776 e = 0;
1777 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
1778 if (e) {
1779 log_packet_detailed("'minor_version' field error detected");
1780 }
1781#ifdef FREECIV_JSON_CONNECTION
1782 field_addr.name = "patch_version";
1783#endif /* FREECIV_JSON_CONNECTION */
1784 e = 0;
1785 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
1786 if (e) {
1787 log_packet_detailed("'patch_version' field error detected");
1788 }
1789
1790#endif
1791 SEND_PACKET_END(PACKET_SERVER_JOIN_REQ);
1792}
1793
1794 int send_packet_server_join_req(struct connection *pc, const struct packet_server_join_req *packet)
1795{
1796 if (!pc->used) {
1797 log_error("WARNING: trying to send data to the closed connection %s",
1798 conn_description(pc));
1799 return -1;
1800 }
1801 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_JOIN_REQ].packet != nullptr, -1,
1802 "Handler for PACKET_SERVER_JOIN_REQ not installed");
1803 return pc->phs.handlers->send[PACKET_SERVER_JOIN_REQ].packet(pc, packet);
1804}
1805
1806 int dsend_packet_server_join_req(struct connection *pc, const char *username, const char *capability, const char *version_label, int major_version, int minor_version, int patch_version)
1807{
1808 struct packet_server_join_req packet, *real_packet = &packet;
1809
1810 sz_strlcpy(real_packet->username, username);
1811 sz_strlcpy(real_packet->capability, capability);
1812 sz_strlcpy(real_packet->version_label, version_label);
1813 real_packet->major_version = major_version;
1814 real_packet->minor_version = minor_version;
1815 real_packet->patch_version = patch_version;
1816
1817 return send_packet_server_join_req(pc, real_packet);
1818}
1819
1820 static inline void init_packet_server_join_reply(struct packet_server_join_reply *packet)
1821{
1822 memset(packet, 0, sizeof(*packet));
1823}
1824
1825#define free_packet_server_join_reply(_packet) (void) 0
1826#define destroy_packet_server_join_reply free
1827
1828 static struct packet_server_join_reply *receive_packet_server_join_reply_100(struct connection *pc)
1829{
1830#define FREE_PACKET_STRUCT(_packet) free_packet_server_join_reply(_packet)
1831 RECEIVE_PACKET_START(packet_server_join_reply, real_packet);
1832#ifdef FREECIV_JSON_CONNECTION
1833 struct plocation field_addr;
1834 {
1835 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1836 field_addr = *field_addr_tmp;
1837 FC_FREE(field_addr_tmp);
1838 }
1839#endif /* FREECIV_JSON_CONNECTION */
1840#if 1 /* To match endif */
1841#ifdef FREECIV_JSON_CONNECTION
1842 field_addr.name = "you_can_join";
1843#endif /* FREECIV_JSON_CONNECTION */
1844 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->you_can_join)) {
1845 RECEIVE_PACKET_FIELD_ERROR(you_can_join);
1846 }
1847#ifdef FREECIV_JSON_CONNECTION
1848 field_addr.name = "message";
1849#endif /* FREECIV_JSON_CONNECTION */
1850 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
1851 RECEIVE_PACKET_FIELD_ERROR(message);
1852 }
1853#ifdef FREECIV_JSON_CONNECTION
1854 field_addr.name = "capability";
1855#endif /* FREECIV_JSON_CONNECTION */
1856 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
1857 RECEIVE_PACKET_FIELD_ERROR(capability);
1858 }
1859#ifdef FREECIV_JSON_CONNECTION
1860 field_addr.name = "challenge_file";
1861#endif /* FREECIV_JSON_CONNECTION */
1862 if (!DIO_GET(string, &din, &field_addr, real_packet->challenge_file, sizeof(real_packet->challenge_file))) {
1863 RECEIVE_PACKET_FIELD_ERROR(challenge_file);
1864 }
1865#ifdef FREECIV_JSON_CONNECTION
1866 field_addr.name = "conn_id";
1867#endif /* FREECIV_JSON_CONNECTION */
1868 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
1869 RECEIVE_PACKET_FIELD_ERROR(conn_id);
1870 }
1871#endif
1872 log_packet_detailed("packet_server_join_reply_100: got info about ()");
1873 post_receive_packet_server_join_reply(pc, real_packet);
1874 RECEIVE_PACKET_END(real_packet);
1875#undef FREE_PACKET_STRUCT
1876}
1877
1878 static int send_packet_server_join_reply_100(struct connection *pc, const struct packet_server_join_reply *packet)
1879{
1880 const struct packet_server_join_reply *real_packet = packet;
1881 int e;
1882 SEND_PACKET_START(PACKET_SERVER_JOIN_REPLY);
1883#ifdef FREECIV_JSON_CONNECTION
1884 struct plocation field_addr;
1885 {
1886 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1887 field_addr = *field_addr_tmp;
1888 FC_FREE(field_addr_tmp);
1889 }
1890#endif /* FREECIV_JSON_CONNECTION */
1891
1892 log_packet_detailed("packet_server_join_reply_100: sending info about ()");
1893#if 1 /* To match endif */
1894#ifdef FREECIV_JSON_CONNECTION
1895 field_addr.name = "you_can_join";
1896#endif /* FREECIV_JSON_CONNECTION */
1897 e = 0;
1898 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->you_can_join);
1899 if (e) {
1900 log_packet_detailed("'you_can_join' field error detected");
1901 }
1902#ifdef FREECIV_JSON_CONNECTION
1903 field_addr.name = "message";
1904#endif /* FREECIV_JSON_CONNECTION */
1905 e = 0;
1906 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
1907 if (e) {
1908 log_packet_detailed("'message' field error detected");
1909 }
1910#ifdef FREECIV_JSON_CONNECTION
1911 field_addr.name = "capability";
1912#endif /* FREECIV_JSON_CONNECTION */
1913 e = 0;
1914 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
1915 if (e) {
1916 log_packet_detailed("'capability' field error detected");
1917 }
1918#ifdef FREECIV_JSON_CONNECTION
1919 field_addr.name = "challenge_file";
1920#endif /* FREECIV_JSON_CONNECTION */
1921 e = 0;
1922 e |= DIO_PUT(string, &dout, &field_addr, real_packet->challenge_file);
1923 if (e) {
1924 log_packet_detailed("'challenge_file' field error detected");
1925 }
1926#ifdef FREECIV_JSON_CONNECTION
1927 field_addr.name = "conn_id";
1928#endif /* FREECIV_JSON_CONNECTION */
1929 e = 0;
1930 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
1931 if (e) {
1932 log_packet_detailed("'conn_id' field error detected");
1933 }
1934
1935#endif
1936 post_send_packet_server_join_reply(pc, real_packet);
1937 SEND_PACKET_END(PACKET_SERVER_JOIN_REPLY);
1938}
1939
1940 int send_packet_server_join_reply(struct connection *pc, const struct packet_server_join_reply *packet)
1941{
1942 if (!pc->used) {
1943 log_error("WARNING: trying to send data to the closed connection %s",
1944 conn_description(pc));
1945 return -1;
1946 }
1947 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_JOIN_REPLY].packet != nullptr, -1,
1948 "Handler for PACKET_SERVER_JOIN_REPLY not installed");
1949 return pc->phs.handlers->send[PACKET_SERVER_JOIN_REPLY].packet(pc, packet);
1950}
1951
1952 static inline void init_packet_authentication_req(struct packet_authentication_req *packet)
1953{
1954 memset(packet, 0, sizeof(*packet));
1955}
1956
1957#define free_packet_authentication_req(_packet) (void) 0
1958#define destroy_packet_authentication_req free
1959
1960#ifdef FREECIV_DELTA_PROTOCOL
1961#define hash_packet_authentication_req_100 hash_const
1962
1963#define cmp_packet_authentication_req_100 cmp_const
1964
1965 BV_DEFINE(packet_authentication_req_100_fields, 2);
1966#endif /* FREECIV_DELTA_PROTOCOL */
1967
1968 static struct packet_authentication_req *receive_packet_authentication_req_100(struct connection *pc)
1969{
1970#define FREE_PACKET_STRUCT(_packet) free_packet_authentication_req(_packet)
1971#ifdef FREECIV_DELTA_PROTOCOL
1972 packet_authentication_req_100_fields fields;
1973 struct packet_authentication_req *old;
1974 struct genhash **hash = pc->phs.received + PACKET_AUTHENTICATION_REQ;
1975#endif /* FREECIV_DELTA_PROTOCOL */
1976 RECEIVE_PACKET_START(packet_authentication_req, real_packet);
1977#ifdef FREECIV_JSON_CONNECTION
1978 struct plocation field_addr;
1979 {
1980 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
1981 field_addr = *field_addr_tmp;
1982 FC_FREE(field_addr_tmp);
1983 }
1984#endif /* FREECIV_JSON_CONNECTION */
1985
1986#ifdef FREECIV_DELTA_PROTOCOL
1987#ifdef FREECIV_JSON_CONNECTION
1988 field_addr.name = "fields";
1989#endif /* FREECIV_JSON_CONNECTION */
1990 DIO_BV_GET(&din, &field_addr, fields);
1991
1992#else /* FREECIV_DELTA_PROTOCOL */
1993#ifdef FREECIV_JSON_CONNECTION
1994 field_addr.name = "type";
1995#endif /* FREECIV_JSON_CONNECTION */
1996 {
1997 int readin;
1998
1999 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
2000 RECEIVE_PACKET_FIELD_ERROR(type);
2001 }
2002 real_packet->type = readin;
2003 }
2004#ifdef FREECIV_JSON_CONNECTION
2005 field_addr.name = "message";
2006#endif /* FREECIV_JSON_CONNECTION */
2007 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
2008 RECEIVE_PACKET_FIELD_ERROR(message);
2009 }
2010#endif
2011 log_packet_detailed("packet_authentication_req_100: got info about ()");
2012
2013#ifdef FREECIV_DELTA_PROTOCOL
2014 if (nullptr == *hash) {
2015 *hash = genhash_new_full(hash_packet_authentication_req_100, cmp_packet_authentication_req_100,
2016 nullptr, nullptr, nullptr, destroy_packet_authentication_req);
2017 }
2018
2019 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2020 *real_packet = *old;
2021 } else {
2022 /* packet is already initialized empty */
2023 log_packet_detailed(" no old info");
2024 }
2025
2026 if (BV_ISSET(fields, 0)) {
2027 log_packet_detailed(" got field 'type'");
2028#ifdef FREECIV_JSON_CONNECTION
2029 field_addr.name = "type";
2030#endif /* FREECIV_JSON_CONNECTION */
2031 {
2032 int readin;
2033
2034 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
2035 RECEIVE_PACKET_FIELD_ERROR(type);
2036 }
2037 real_packet->type = readin;
2038 }
2039 }
2040 if (BV_ISSET(fields, 1)) {
2041 log_packet_detailed(" got field 'message'");
2042#ifdef FREECIV_JSON_CONNECTION
2043 field_addr.name = "message";
2044#endif /* FREECIV_JSON_CONNECTION */
2045 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
2046 RECEIVE_PACKET_FIELD_ERROR(message);
2047 }
2048 }
2049
2050 if (nullptr == old) {
2051 old = fc_malloc(sizeof(*old));
2052 init_packet_authentication_req(old);
2053 *old = *real_packet;
2054 genhash_insert(*hash, old, old);
2055 } else {
2056 *old = *real_packet;
2057 }
2058
2059#endif /* FREECIV_DELTA_PROTOCOL */
2060 RECEIVE_PACKET_END(real_packet);
2061#undef FREE_PACKET_STRUCT
2062}
2063
2064 static int send_packet_authentication_req_100(struct connection *pc, const struct packet_authentication_req *packet)
2065{
2066 const struct packet_authentication_req *real_packet = packet;
2067 int e;
2068#ifdef FREECIV_DELTA_PROTOCOL
2069 packet_authentication_req_100_fields fields;
2070 struct packet_authentication_req *old;
2071 bool differ;
2072 struct genhash **hash = pc->phs.sent + PACKET_AUTHENTICATION_REQ;
2073#endif /* FREECIV_DELTA_PROTOCOL */
2074 SEND_PACKET_START(PACKET_AUTHENTICATION_REQ);
2075#ifdef FREECIV_JSON_CONNECTION
2076 struct plocation field_addr;
2077 {
2078 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2079 field_addr = *field_addr_tmp;
2080 FC_FREE(field_addr_tmp);
2081 }
2082#endif /* FREECIV_JSON_CONNECTION */
2083
2084 log_packet_detailed("packet_authentication_req_100: sending info about ()");
2085
2086#ifdef FREECIV_DELTA_PROTOCOL
2087 if (nullptr == *hash) {
2088 *hash = genhash_new_full(hash_packet_authentication_req_100, cmp_packet_authentication_req_100,
2089 nullptr, nullptr, nullptr, destroy_packet_authentication_req);
2090 }
2091 BV_CLR_ALL(fields);
2092
2093 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2094 old = fc_malloc(sizeof(*old));
2095 /* temporary bitcopy just to insert correctly */
2096 *old = *real_packet;
2097 genhash_insert(*hash, old, old);
2098 init_packet_authentication_req(old);
2099 }
2100 differ = (old->type != real_packet->type);
2101 if (differ) {
2102 BV_SET(fields, 0);
2103 }
2104
2105 differ = (strcmp(old->message, real_packet->message) != 0);
2106 if (differ) {
2107 BV_SET(fields, 1);
2108 }
2109
2110
2111#ifdef FREECIV_JSON_CONNECTION
2112 field_addr.name = "fields";
2113#endif /* FREECIV_JSON_CONNECTION */
2114 e = 0;
2115 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2116 if (e) {
2117 log_packet_detailed("fields bitvector error detected");
2118 }
2119
2120 if (BV_ISSET(fields, 0)) {
2121 log_packet_detailed(" field 'type' has changed");
2122#ifdef FREECIV_JSON_CONNECTION
2123 field_addr.name = "type";
2124#endif /* FREECIV_JSON_CONNECTION */
2125 e = 0;
2126 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
2127 if (e) {
2128 log_packet_detailed("'type' field error detected");
2129 }
2130 }
2131 if (BV_ISSET(fields, 1)) {
2132 log_packet_detailed(" field 'message' has changed");
2133#ifdef FREECIV_JSON_CONNECTION
2134 field_addr.name = "message";
2135#endif /* FREECIV_JSON_CONNECTION */
2136 e = 0;
2137 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
2138 if (e) {
2139 log_packet_detailed("'message' field error detected");
2140 }
2141 }
2142
2143 *old = *real_packet;
2144#endif /* FREECIV_DELTA_PROTOCOL */
2145#ifndef FREECIV_DELTA_PROTOCOL
2146#ifdef FREECIV_JSON_CONNECTION
2147 field_addr.name = "type";
2148#endif /* FREECIV_JSON_CONNECTION */
2149 e = 0;
2150 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
2151 if (e) {
2152 log_packet_detailed("'type' field error detected");
2153 }
2154#ifdef FREECIV_JSON_CONNECTION
2155 field_addr.name = "message";
2156#endif /* FREECIV_JSON_CONNECTION */
2157 e = 0;
2158 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
2159 if (e) {
2160 log_packet_detailed("'message' field error detected");
2161 }
2162
2163#endif
2164 SEND_PACKET_END(PACKET_AUTHENTICATION_REQ);
2165}
2166
2167 int send_packet_authentication_req(struct connection *pc, const struct packet_authentication_req *packet)
2168{
2169 if (!pc->used) {
2170 log_error("WARNING: trying to send data to the closed connection %s",
2171 conn_description(pc));
2172 return -1;
2173 }
2174 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_AUTHENTICATION_REQ].packet != nullptr, -1,
2175 "Handler for PACKET_AUTHENTICATION_REQ not installed");
2176 return pc->phs.handlers->send[PACKET_AUTHENTICATION_REQ].packet(pc, packet);
2177}
2178
2179 int dsend_packet_authentication_req(struct connection *pc, enum authentication_type type, const char *message)
2180{
2181 struct packet_authentication_req packet, *real_packet = &packet;
2182
2183 real_packet->type = type;
2184 sz_strlcpy(real_packet->message, message);
2185
2186 return send_packet_authentication_req(pc, real_packet);
2187}
2188
2189 static inline void init_packet_authentication_reply(struct packet_authentication_reply *packet)
2190{
2191 memset(packet, 0, sizeof(*packet));
2192}
2193
2194#define free_packet_authentication_reply(_packet) (void) 0
2195#define destroy_packet_authentication_reply free
2196
2197#ifdef FREECIV_DELTA_PROTOCOL
2198#define hash_packet_authentication_reply_100 hash_const
2199
2200#define cmp_packet_authentication_reply_100 cmp_const
2201
2202 BV_DEFINE(packet_authentication_reply_100_fields, 1);
2203#endif /* FREECIV_DELTA_PROTOCOL */
2204
2205 static struct packet_authentication_reply *receive_packet_authentication_reply_100(struct connection *pc)
2206{
2207#define FREE_PACKET_STRUCT(_packet) free_packet_authentication_reply(_packet)
2208#ifdef FREECIV_DELTA_PROTOCOL
2209 packet_authentication_reply_100_fields fields;
2210 struct packet_authentication_reply *old;
2211 struct genhash **hash = pc->phs.received + PACKET_AUTHENTICATION_REPLY;
2212#endif /* FREECIV_DELTA_PROTOCOL */
2213 RECEIVE_PACKET_START(packet_authentication_reply, real_packet);
2214#ifdef FREECIV_JSON_CONNECTION
2215 struct plocation field_addr;
2216 {
2217 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2218 field_addr = *field_addr_tmp;
2219 FC_FREE(field_addr_tmp);
2220 }
2221#endif /* FREECIV_JSON_CONNECTION */
2222
2223#ifdef FREECIV_DELTA_PROTOCOL
2224#ifdef FREECIV_JSON_CONNECTION
2225 field_addr.name = "fields";
2226#endif /* FREECIV_JSON_CONNECTION */
2227 DIO_BV_GET(&din, &field_addr, fields);
2228
2229#else /* FREECIV_DELTA_PROTOCOL */
2230#ifdef FREECIV_JSON_CONNECTION
2231 field_addr.name = "password";
2232#endif /* FREECIV_JSON_CONNECTION */
2233 if (!DIO_GET(string, &din, &field_addr, real_packet->password, sizeof(real_packet->password))) {
2234 RECEIVE_PACKET_FIELD_ERROR(password);
2235 }
2236#endif
2237 log_packet_detailed("packet_authentication_reply_100: got info about ()");
2238
2239#ifdef FREECIV_DELTA_PROTOCOL
2240 if (nullptr == *hash) {
2241 *hash = genhash_new_full(hash_packet_authentication_reply_100, cmp_packet_authentication_reply_100,
2242 nullptr, nullptr, nullptr, destroy_packet_authentication_reply);
2243 }
2244
2245 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2246 *real_packet = *old;
2247 } else {
2248 /* packet is already initialized empty */
2249 log_packet_detailed(" no old info");
2250 }
2251
2252 if (BV_ISSET(fields, 0)) {
2253 log_packet_detailed(" got field 'password'");
2254#ifdef FREECIV_JSON_CONNECTION
2255 field_addr.name = "password";
2256#endif /* FREECIV_JSON_CONNECTION */
2257 if (!DIO_GET(string, &din, &field_addr, real_packet->password, sizeof(real_packet->password))) {
2258 RECEIVE_PACKET_FIELD_ERROR(password);
2259 }
2260 }
2261
2262 if (nullptr == old) {
2263 old = fc_malloc(sizeof(*old));
2264 init_packet_authentication_reply(old);
2265 *old = *real_packet;
2266 genhash_insert(*hash, old, old);
2267 } else {
2268 *old = *real_packet;
2269 }
2270
2271#endif /* FREECIV_DELTA_PROTOCOL */
2272 RECEIVE_PACKET_END(real_packet);
2273#undef FREE_PACKET_STRUCT
2274}
2275
2276 static int send_packet_authentication_reply_100(struct connection *pc, const struct packet_authentication_reply *packet)
2277{
2278 const struct packet_authentication_reply *real_packet = packet;
2279 int e;
2280#ifdef FREECIV_DELTA_PROTOCOL
2281 packet_authentication_reply_100_fields fields;
2282 struct packet_authentication_reply *old;
2283 bool differ;
2284 struct genhash **hash = pc->phs.sent + PACKET_AUTHENTICATION_REPLY;
2285#endif /* FREECIV_DELTA_PROTOCOL */
2286 SEND_PACKET_START(PACKET_AUTHENTICATION_REPLY);
2287#ifdef FREECIV_JSON_CONNECTION
2288 struct plocation field_addr;
2289 {
2290 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2291 field_addr = *field_addr_tmp;
2292 FC_FREE(field_addr_tmp);
2293 }
2294#endif /* FREECIV_JSON_CONNECTION */
2295
2296 log_packet_detailed("packet_authentication_reply_100: sending info about ()");
2297
2298#ifdef FREECIV_DELTA_PROTOCOL
2299 if (nullptr == *hash) {
2300 *hash = genhash_new_full(hash_packet_authentication_reply_100, cmp_packet_authentication_reply_100,
2301 nullptr, nullptr, nullptr, destroy_packet_authentication_reply);
2302 }
2303 BV_CLR_ALL(fields);
2304
2305 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2306 old = fc_malloc(sizeof(*old));
2307 /* temporary bitcopy just to insert correctly */
2308 *old = *real_packet;
2309 genhash_insert(*hash, old, old);
2310 init_packet_authentication_reply(old);
2311 }
2312 differ = (strcmp(old->password, real_packet->password) != 0);
2313 if (differ) {
2314 BV_SET(fields, 0);
2315 }
2316
2317
2318#ifdef FREECIV_JSON_CONNECTION
2319 field_addr.name = "fields";
2320#endif /* FREECIV_JSON_CONNECTION */
2321 e = 0;
2322 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2323 if (e) {
2324 log_packet_detailed("fields bitvector error detected");
2325 }
2326
2327 if (BV_ISSET(fields, 0)) {
2328 log_packet_detailed(" field 'password' has changed");
2329#ifdef FREECIV_JSON_CONNECTION
2330 field_addr.name = "password";
2331#endif /* FREECIV_JSON_CONNECTION */
2332 e = 0;
2333 e |= DIO_PUT(string, &dout, &field_addr, real_packet->password);
2334 if (e) {
2335 log_packet_detailed("'password' field error detected");
2336 }
2337 }
2338
2339 *old = *real_packet;
2340#endif /* FREECIV_DELTA_PROTOCOL */
2341#ifndef FREECIV_DELTA_PROTOCOL
2342#ifdef FREECIV_JSON_CONNECTION
2343 field_addr.name = "password";
2344#endif /* FREECIV_JSON_CONNECTION */
2345 e = 0;
2346 e |= DIO_PUT(string, &dout, &field_addr, real_packet->password);
2347 if (e) {
2348 log_packet_detailed("'password' field error detected");
2349 }
2350
2351#endif
2352 SEND_PACKET_END(PACKET_AUTHENTICATION_REPLY);
2353}
2354
2355 int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
2356{
2357 if (!pc->used) {
2358 log_error("WARNING: trying to send data to the closed connection %s",
2359 conn_description(pc));
2360 return -1;
2361 }
2362 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_AUTHENTICATION_REPLY].packet != nullptr, -1,
2363 "Handler for PACKET_AUTHENTICATION_REPLY not installed");
2364 return pc->phs.handlers->send[PACKET_AUTHENTICATION_REPLY].packet(pc, packet);
2365}
2366
2367 static inline void init_packet_server_shutdown(struct packet_server_shutdown *packet)
2368{
2369 memset(packet, 0, sizeof(*packet));
2370}
2371
2372#define free_packet_server_shutdown(_packet) (void) 0
2373#define destroy_packet_server_shutdown free
2374
2375 static struct packet_server_shutdown *receive_packet_server_shutdown_100(struct connection *pc)
2376{
2377#define FREE_PACKET_STRUCT(_packet) free_packet_server_shutdown(_packet)
2378 RECEIVE_PACKET_START(packet_server_shutdown, real_packet);
2379#if 1 /* To match endif */
2380 real_packet->__dummy = 0xff;
2381#endif
2382 log_packet_detailed("packet_server_shutdown_100: got info about ()");
2383 RECEIVE_PACKET_END(real_packet);
2384#undef FREE_PACKET_STRUCT
2385}
2386
2387 static int send_packet_server_shutdown_100(struct connection *pc)
2388{
2389 SEND_PACKET_START(PACKET_SERVER_SHUTDOWN);
2390
2391 log_packet_detailed("packet_server_shutdown_100: sending info about ()");
2392 SEND_PACKET_END(PACKET_SERVER_SHUTDOWN);
2393}
2394
2395 int send_packet_server_shutdown(struct connection *pc)
2396{
2397 if (!pc->used) {
2398 log_error("WARNING: trying to send data to the closed connection %s",
2399 conn_description(pc));
2400 return -1;
2401 }
2402 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SHUTDOWN].no_packet != nullptr, -1,
2403 "Handler for PACKET_SERVER_SHUTDOWN not installed");
2404 return pc->phs.handlers->send[PACKET_SERVER_SHUTDOWN].no_packet(pc);
2405}
2406
2407 void lsend_packet_server_shutdown(struct conn_list *dest)
2408{
2409 conn_list_iterate(dest, pconn) {
2410 send_packet_server_shutdown(pconn);
2411 } conn_list_iterate_end;
2412}
2413
2414 static inline void init_packet_nation_select_req(struct packet_nation_select_req *packet)
2415{
2416 memset(packet, 0, sizeof(*packet));
2417}
2418
2419#define free_packet_nation_select_req(_packet) (void) 0
2420#define destroy_packet_nation_select_req free
2421
2422#ifdef FREECIV_DELTA_PROTOCOL
2423#define hash_packet_nation_select_req_100 hash_const
2424
2425#define cmp_packet_nation_select_req_100 cmp_const
2426
2427 BV_DEFINE(packet_nation_select_req_100_fields, 5);
2428#endif /* FREECIV_DELTA_PROTOCOL */
2429
2430 static struct packet_nation_select_req *receive_packet_nation_select_req_100(struct connection *pc)
2431{
2432#define FREE_PACKET_STRUCT(_packet) free_packet_nation_select_req(_packet)
2433#ifdef FREECIV_DELTA_PROTOCOL
2434 packet_nation_select_req_100_fields fields;
2435 struct packet_nation_select_req *old;
2436 struct genhash **hash = pc->phs.received + PACKET_NATION_SELECT_REQ;
2437#endif /* FREECIV_DELTA_PROTOCOL */
2438 RECEIVE_PACKET_START(packet_nation_select_req, real_packet);
2439#ifdef FREECIV_JSON_CONNECTION
2440 struct plocation field_addr;
2441 {
2442 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2443 field_addr = *field_addr_tmp;
2444 FC_FREE(field_addr_tmp);
2445 }
2446#endif /* FREECIV_JSON_CONNECTION */
2447
2448#ifdef FREECIV_DELTA_PROTOCOL
2449#ifdef FREECIV_JSON_CONNECTION
2450 field_addr.name = "fields";
2451#endif /* FREECIV_JSON_CONNECTION */
2452 DIO_BV_GET(&din, &field_addr, fields);
2453
2454#else /* FREECIV_DELTA_PROTOCOL */
2455#ifdef FREECIV_JSON_CONNECTION
2456 field_addr.name = "player_no";
2457#endif /* FREECIV_JSON_CONNECTION */
2458 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_no)) {
2459 RECEIVE_PACKET_FIELD_ERROR(player_no);
2460 }
2461#ifdef FREECIV_JSON_CONNECTION
2462 field_addr.name = "nation_no";
2463#endif /* FREECIV_JSON_CONNECTION */
2464 {
2465 int readin;
2466
2467 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
2468 RECEIVE_PACKET_FIELD_ERROR(nation_no);
2469 }
2470 real_packet->nation_no = readin;
2471 }
2472#ifdef FREECIV_JSON_CONNECTION
2473 field_addr.name = "is_male";
2474#endif /* FREECIV_JSON_CONNECTION */
2475 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
2476 RECEIVE_PACKET_FIELD_ERROR(is_male);
2477 }
2478#ifdef FREECIV_JSON_CONNECTION
2479 field_addr.name = "name";
2480#endif /* FREECIV_JSON_CONNECTION */
2481 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
2482 RECEIVE_PACKET_FIELD_ERROR(name);
2483 }
2484#ifdef FREECIV_JSON_CONNECTION
2485 field_addr.name = "style";
2486#endif /* FREECIV_JSON_CONNECTION */
2487 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
2488 RECEIVE_PACKET_FIELD_ERROR(style);
2489 }
2490#endif
2491 log_packet_detailed("packet_nation_select_req_100: got info about ()");
2492
2493#ifdef FREECIV_DELTA_PROTOCOL
2494 if (nullptr == *hash) {
2495 *hash = genhash_new_full(hash_packet_nation_select_req_100, cmp_packet_nation_select_req_100,
2496 nullptr, nullptr, nullptr, destroy_packet_nation_select_req);
2497 }
2498
2499 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2500 *real_packet = *old;
2501 } else {
2502 /* packet is already initialized empty */
2503 log_packet_detailed(" no old info");
2504 }
2505
2506 if (BV_ISSET(fields, 0)) {
2507 log_packet_detailed(" got field 'player_no'");
2508#ifdef FREECIV_JSON_CONNECTION
2509 field_addr.name = "player_no";
2510#endif /* FREECIV_JSON_CONNECTION */
2511 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_no)) {
2512 RECEIVE_PACKET_FIELD_ERROR(player_no);
2513 }
2514 }
2515 if (BV_ISSET(fields, 1)) {
2516 log_packet_detailed(" got field 'nation_no'");
2517#ifdef FREECIV_JSON_CONNECTION
2518 field_addr.name = "nation_no";
2519#endif /* FREECIV_JSON_CONNECTION */
2520 {
2521 int readin;
2522
2523 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
2524 RECEIVE_PACKET_FIELD_ERROR(nation_no);
2525 }
2526 real_packet->nation_no = readin;
2527 }
2528 }
2529 real_packet->is_male = BV_ISSET(fields, 2);
2530 if (BV_ISSET(fields, 3)) {
2531 log_packet_detailed(" got field 'name'");
2532#ifdef FREECIV_JSON_CONNECTION
2533 field_addr.name = "name";
2534#endif /* FREECIV_JSON_CONNECTION */
2535 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
2536 RECEIVE_PACKET_FIELD_ERROR(name);
2537 }
2538 }
2539 if (BV_ISSET(fields, 4)) {
2540 log_packet_detailed(" got field 'style'");
2541#ifdef FREECIV_JSON_CONNECTION
2542 field_addr.name = "style";
2543#endif /* FREECIV_JSON_CONNECTION */
2544 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
2545 RECEIVE_PACKET_FIELD_ERROR(style);
2546 }
2547 }
2548
2549 if (nullptr == old) {
2550 old = fc_malloc(sizeof(*old));
2551 init_packet_nation_select_req(old);
2552 *old = *real_packet;
2553 genhash_insert(*hash, old, old);
2554 } else {
2555 *old = *real_packet;
2556 }
2557
2558#endif /* FREECIV_DELTA_PROTOCOL */
2559 RECEIVE_PACKET_END(real_packet);
2560#undef FREE_PACKET_STRUCT
2561}
2562
2563 static int send_packet_nation_select_req_100(struct connection *pc, const struct packet_nation_select_req *packet)
2564{
2565 const struct packet_nation_select_req *real_packet = packet;
2566 int e;
2567#ifdef FREECIV_DELTA_PROTOCOL
2568 packet_nation_select_req_100_fields fields;
2569 struct packet_nation_select_req *old;
2570 bool differ;
2571 struct genhash **hash = pc->phs.sent + PACKET_NATION_SELECT_REQ;
2572#endif /* FREECIV_DELTA_PROTOCOL */
2573 SEND_PACKET_START(PACKET_NATION_SELECT_REQ);
2574#ifdef FREECIV_JSON_CONNECTION
2575 struct plocation field_addr;
2576 {
2577 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2578 field_addr = *field_addr_tmp;
2579 FC_FREE(field_addr_tmp);
2580 }
2581#endif /* FREECIV_JSON_CONNECTION */
2582
2583 log_packet_detailed("packet_nation_select_req_100: sending info about ()");
2584
2585#ifdef FREECIV_DELTA_PROTOCOL
2586 if (nullptr == *hash) {
2587 *hash = genhash_new_full(hash_packet_nation_select_req_100, cmp_packet_nation_select_req_100,
2588 nullptr, nullptr, nullptr, destroy_packet_nation_select_req);
2589 }
2590 BV_CLR_ALL(fields);
2591
2592 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2593 old = fc_malloc(sizeof(*old));
2594 /* temporary bitcopy just to insert correctly */
2595 *old = *real_packet;
2596 genhash_insert(*hash, old, old);
2597 init_packet_nation_select_req(old);
2598 }
2599 differ = (old->player_no != real_packet->player_no);
2600 if (differ) {
2601 BV_SET(fields, 0);
2602 }
2603
2604 differ = (old->nation_no != real_packet->nation_no);
2605 if (differ) {
2606 BV_SET(fields, 1);
2607 }
2608
2609 if (packet->is_male) {
2610 BV_SET(fields, 2);
2611 }
2612
2613 differ = (strcmp(old->name, real_packet->name) != 0);
2614 if (differ) {
2615 BV_SET(fields, 3);
2616 }
2617
2618 differ = (old->style != real_packet->style);
2619 if (differ) {
2620 BV_SET(fields, 4);
2621 }
2622
2623
2624#ifdef FREECIV_JSON_CONNECTION
2625 field_addr.name = "fields";
2626#endif /* FREECIV_JSON_CONNECTION */
2627 e = 0;
2628 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2629 if (e) {
2630 log_packet_detailed("fields bitvector error detected");
2631 }
2632
2633 if (BV_ISSET(fields, 0)) {
2634 log_packet_detailed(" field 'player_no' has changed");
2635#ifdef FREECIV_JSON_CONNECTION
2636 field_addr.name = "player_no";
2637#endif /* FREECIV_JSON_CONNECTION */
2638 e = 0;
2639 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_no);
2640 if (e) {
2641 log_packet_detailed("'player_no' field error detected");
2642 }
2643 }
2644 if (BV_ISSET(fields, 1)) {
2645 log_packet_detailed(" field 'nation_no' has changed");
2646#ifdef FREECIV_JSON_CONNECTION
2647 field_addr.name = "nation_no";
2648#endif /* FREECIV_JSON_CONNECTION */
2649 e = 0;
2650 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_no);
2651 if (e) {
2652 log_packet_detailed("'nation_no' field error detected");
2653 }
2654 }
2655 /* field 2 is folded into the header */
2656 if (BV_ISSET(fields, 3)) {
2657 log_packet_detailed(" field 'name' has changed");
2658#ifdef FREECIV_JSON_CONNECTION
2659 field_addr.name = "name";
2660#endif /* FREECIV_JSON_CONNECTION */
2661 e = 0;
2662 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
2663 if (e) {
2664 log_packet_detailed("'name' field error detected");
2665 }
2666 }
2667 if (BV_ISSET(fields, 4)) {
2668 log_packet_detailed(" field 'style' has changed");
2669#ifdef FREECIV_JSON_CONNECTION
2670 field_addr.name = "style";
2671#endif /* FREECIV_JSON_CONNECTION */
2672 e = 0;
2673 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
2674 if (e) {
2675 log_packet_detailed("'style' field error detected");
2676 }
2677 }
2678
2679 *old = *real_packet;
2680#endif /* FREECIV_DELTA_PROTOCOL */
2681#ifndef FREECIV_DELTA_PROTOCOL
2682#ifdef FREECIV_JSON_CONNECTION
2683 field_addr.name = "player_no";
2684#endif /* FREECIV_JSON_CONNECTION */
2685 e = 0;
2686 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_no);
2687 if (e) {
2688 log_packet_detailed("'player_no' field error detected");
2689 }
2690#ifdef FREECIV_JSON_CONNECTION
2691 field_addr.name = "nation_no";
2692#endif /* FREECIV_JSON_CONNECTION */
2693 e = 0;
2694 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_no);
2695 if (e) {
2696 log_packet_detailed("'nation_no' field error detected");
2697 }
2698#ifdef FREECIV_JSON_CONNECTION
2699 field_addr.name = "is_male";
2700#endif /* FREECIV_JSON_CONNECTION */
2701 e = 0;
2702 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
2703 if (e) {
2704 log_packet_detailed("'is_male' field error detected");
2705 }
2706#ifdef FREECIV_JSON_CONNECTION
2707 field_addr.name = "name";
2708#endif /* FREECIV_JSON_CONNECTION */
2709 e = 0;
2710 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
2711 if (e) {
2712 log_packet_detailed("'name' field error detected");
2713 }
2714#ifdef FREECIV_JSON_CONNECTION
2715 field_addr.name = "style";
2716#endif /* FREECIV_JSON_CONNECTION */
2717 e = 0;
2718 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
2719 if (e) {
2720 log_packet_detailed("'style' field error detected");
2721 }
2722
2723#endif
2724 SEND_PACKET_END(PACKET_NATION_SELECT_REQ);
2725}
2726
2727 int send_packet_nation_select_req(struct connection *pc, const struct packet_nation_select_req *packet)
2728{
2729 if (!pc->used) {
2730 log_error("WARNING: trying to send data to the closed connection %s",
2731 conn_description(pc));
2732 return -1;
2733 }
2734 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NATION_SELECT_REQ].packet != nullptr, -1,
2735 "Handler for PACKET_NATION_SELECT_REQ not installed");
2736 return pc->phs.handlers->send[PACKET_NATION_SELECT_REQ].packet(pc, packet);
2737}
2738
2739 int dsend_packet_nation_select_req(struct connection *pc, int player_no, Nation_type_id nation_no, bool is_male, const char *name, int style)
2740{
2741 struct packet_nation_select_req packet, *real_packet = &packet;
2742
2743 real_packet->player_no = player_no;
2744 real_packet->nation_no = nation_no;
2745 real_packet->is_male = is_male;
2746 sz_strlcpy(real_packet->name, name);
2747 real_packet->style = style;
2748
2749 return send_packet_nation_select_req(pc, real_packet);
2750}
2751
2752 static inline void init_packet_player_ready(struct packet_player_ready *packet)
2753{
2754 memset(packet, 0, sizeof(*packet));
2755}
2756
2757#define free_packet_player_ready(_packet) (void) 0
2758#define destroy_packet_player_ready free
2759
2760#ifdef FREECIV_DELTA_PROTOCOL
2761#define hash_packet_player_ready_100 hash_const
2762
2763#define cmp_packet_player_ready_100 cmp_const
2764
2765 BV_DEFINE(packet_player_ready_100_fields, 2);
2766#endif /* FREECIV_DELTA_PROTOCOL */
2767
2768 static struct packet_player_ready *receive_packet_player_ready_100(struct connection *pc)
2769{
2770#define FREE_PACKET_STRUCT(_packet) free_packet_player_ready(_packet)
2771#ifdef FREECIV_DELTA_PROTOCOL
2772 packet_player_ready_100_fields fields;
2773 struct packet_player_ready *old;
2774 struct genhash **hash = pc->phs.received + PACKET_PLAYER_READY;
2775#endif /* FREECIV_DELTA_PROTOCOL */
2776 RECEIVE_PACKET_START(packet_player_ready, real_packet);
2777#ifdef FREECIV_JSON_CONNECTION
2778 struct plocation field_addr;
2779 {
2780 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2781 field_addr = *field_addr_tmp;
2782 FC_FREE(field_addr_tmp);
2783 }
2784#endif /* FREECIV_JSON_CONNECTION */
2785
2786#ifdef FREECIV_DELTA_PROTOCOL
2787#ifdef FREECIV_JSON_CONNECTION
2788 field_addr.name = "fields";
2789#endif /* FREECIV_JSON_CONNECTION */
2790 DIO_BV_GET(&din, &field_addr, fields);
2791
2792#else /* FREECIV_DELTA_PROTOCOL */
2793#ifdef FREECIV_JSON_CONNECTION
2794 field_addr.name = "player_no";
2795#endif /* FREECIV_JSON_CONNECTION */
2796 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_no)) {
2797 RECEIVE_PACKET_FIELD_ERROR(player_no);
2798 }
2799#ifdef FREECIV_JSON_CONNECTION
2800 field_addr.name = "is_ready";
2801#endif /* FREECIV_JSON_CONNECTION */
2802 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_ready)) {
2803 RECEIVE_PACKET_FIELD_ERROR(is_ready);
2804 }
2805#endif
2806 log_packet_detailed("packet_player_ready_100: got info about ()");
2807
2808#ifdef FREECIV_DELTA_PROTOCOL
2809 if (nullptr == *hash) {
2810 *hash = genhash_new_full(hash_packet_player_ready_100, cmp_packet_player_ready_100,
2811 nullptr, nullptr, nullptr, destroy_packet_player_ready);
2812 }
2813
2814 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2815 *real_packet = *old;
2816 } else {
2817 /* packet is already initialized empty */
2818 log_packet_detailed(" no old info");
2819 }
2820
2821 if (BV_ISSET(fields, 0)) {
2822 log_packet_detailed(" got field 'player_no'");
2823#ifdef FREECIV_JSON_CONNECTION
2824 field_addr.name = "player_no";
2825#endif /* FREECIV_JSON_CONNECTION */
2826 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_no)) {
2827 RECEIVE_PACKET_FIELD_ERROR(player_no);
2828 }
2829 }
2830 real_packet->is_ready = BV_ISSET(fields, 1);
2831
2832 if (nullptr == old) {
2833 old = fc_malloc(sizeof(*old));
2834 init_packet_player_ready(old);
2835 *old = *real_packet;
2836 genhash_insert(*hash, old, old);
2837 } else {
2838 *old = *real_packet;
2839 }
2840
2841#endif /* FREECIV_DELTA_PROTOCOL */
2842 RECEIVE_PACKET_END(real_packet);
2843#undef FREE_PACKET_STRUCT
2844}
2845
2846 static int send_packet_player_ready_100(struct connection *pc, const struct packet_player_ready *packet)
2847{
2848 const struct packet_player_ready *real_packet = packet;
2849 int e;
2850#ifdef FREECIV_DELTA_PROTOCOL
2851 packet_player_ready_100_fields fields;
2852 struct packet_player_ready *old;
2853 bool differ;
2854 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_READY;
2855#endif /* FREECIV_DELTA_PROTOCOL */
2856 SEND_PACKET_START(PACKET_PLAYER_READY);
2857#ifdef FREECIV_JSON_CONNECTION
2858 struct plocation field_addr;
2859 {
2860 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2861 field_addr = *field_addr_tmp;
2862 FC_FREE(field_addr_tmp);
2863 }
2864#endif /* FREECIV_JSON_CONNECTION */
2865
2866 log_packet_detailed("packet_player_ready_100: sending info about ()");
2867
2868#ifdef FREECIV_DELTA_PROTOCOL
2869 if (nullptr == *hash) {
2870 *hash = genhash_new_full(hash_packet_player_ready_100, cmp_packet_player_ready_100,
2871 nullptr, nullptr, nullptr, destroy_packet_player_ready);
2872 }
2873 BV_CLR_ALL(fields);
2874
2875 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2876 old = fc_malloc(sizeof(*old));
2877 /* temporary bitcopy just to insert correctly */
2878 *old = *real_packet;
2879 genhash_insert(*hash, old, old);
2880 init_packet_player_ready(old);
2881 }
2882 differ = (old->player_no != real_packet->player_no);
2883 if (differ) {
2884 BV_SET(fields, 0);
2885 }
2886
2887 if (packet->is_ready) {
2888 BV_SET(fields, 1);
2889 }
2890
2891
2892#ifdef FREECIV_JSON_CONNECTION
2893 field_addr.name = "fields";
2894#endif /* FREECIV_JSON_CONNECTION */
2895 e = 0;
2896 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2897 if (e) {
2898 log_packet_detailed("fields bitvector error detected");
2899 }
2900
2901 if (BV_ISSET(fields, 0)) {
2902 log_packet_detailed(" field 'player_no' has changed");
2903#ifdef FREECIV_JSON_CONNECTION
2904 field_addr.name = "player_no";
2905#endif /* FREECIV_JSON_CONNECTION */
2906 e = 0;
2907 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_no);
2908 if (e) {
2909 log_packet_detailed("'player_no' field error detected");
2910 }
2911 }
2912 /* field 1 is folded into the header */
2913
2914 *old = *real_packet;
2915#endif /* FREECIV_DELTA_PROTOCOL */
2916#ifndef FREECIV_DELTA_PROTOCOL
2917#ifdef FREECIV_JSON_CONNECTION
2918 field_addr.name = "player_no";
2919#endif /* FREECIV_JSON_CONNECTION */
2920 e = 0;
2921 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_no);
2922 if (e) {
2923 log_packet_detailed("'player_no' field error detected");
2924 }
2925#ifdef FREECIV_JSON_CONNECTION
2926 field_addr.name = "is_ready";
2927#endif /* FREECIV_JSON_CONNECTION */
2928 e = 0;
2929 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_ready);
2930 if (e) {
2931 log_packet_detailed("'is_ready' field error detected");
2932 }
2933
2934#endif
2935 SEND_PACKET_END(PACKET_PLAYER_READY);
2936}
2937
2938 int send_packet_player_ready(struct connection *pc, const struct packet_player_ready *packet)
2939{
2940 if (!pc->used) {
2941 log_error("WARNING: trying to send data to the closed connection %s",
2942 conn_description(pc));
2943 return -1;
2944 }
2945 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_READY].packet != nullptr, -1,
2946 "Handler for PACKET_PLAYER_READY not installed");
2947 return pc->phs.handlers->send[PACKET_PLAYER_READY].packet(pc, packet);
2948}
2949
2950 int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
2951{
2952 struct packet_player_ready packet, *real_packet = &packet;
2953
2954 real_packet->player_no = player_no;
2955 real_packet->is_ready = is_ready;
2956
2957 return send_packet_player_ready(pc, real_packet);
2958}
2959
2960 static inline void init_packet_endgame_report(struct packet_endgame_report *packet)
2961{
2962 memset(packet, 0, sizeof(*packet));
2963}
2964
2965#define free_packet_endgame_report(_packet) (void) 0
2966#define destroy_packet_endgame_report free
2967
2968 static struct packet_endgame_report *receive_packet_endgame_report_100(struct connection *pc)
2969{
2970#define FREE_PACKET_STRUCT(_packet) free_packet_endgame_report(_packet)
2971 RECEIVE_PACKET_START(packet_endgame_report, real_packet);
2972#ifdef FREECIV_JSON_CONNECTION
2973 struct plocation field_addr;
2974 {
2975 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
2976 field_addr = *field_addr_tmp;
2977 FC_FREE(field_addr_tmp);
2978 }
2979#endif /* FREECIV_JSON_CONNECTION */
2980#if 1 /* To match endif */
2981#ifdef FREECIV_JSON_CONNECTION
2982 field_addr.name = "category_num";
2983#endif /* FREECIV_JSON_CONNECTION */
2984 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category_num)) {
2985 RECEIVE_PACKET_FIELD_ERROR(category_num);
2986 }
2987#ifdef FREECIV_JSON_CONNECTION
2988 field_addr.name = "category_name";
2989#endif /* FREECIV_JSON_CONNECTION */
2990 {
2991 int i;
2992
2993#ifdef FREECIV_JSON_CONNECTION
2994 /* Enter array. */
2995 field_addr.sub_location = plocation_elem_new(0);
2996#endif /* FREECIV_JSON_CONNECTION */
2997
2998 if (real_packet->category_num > 32) {
2999 RECEIVE_PACKET_FIELD_ERROR(category_name, ": truncation array");
3000 }
3001 for (i = 0; i < real_packet->category_num; i++) {
3002#ifdef FREECIV_JSON_CONNECTION
3003 field_addr.sub_location->number = i;
3004#endif /* FREECIV_JSON_CONNECTION */
3005 if (!DIO_GET(string, &din, &field_addr, real_packet->category_name[i], sizeof(real_packet->category_name[i]))) {
3006 RECEIVE_PACKET_FIELD_ERROR(category_name);
3007 }
3008 }
3009
3010#ifdef FREECIV_JSON_CONNECTION
3011 /* Exit array. */
3012 FC_FREE(field_addr.sub_location);
3013#endif /* FREECIV_JSON_CONNECTION */
3014 }
3015#ifdef FREECIV_JSON_CONNECTION
3016 field_addr.name = "player_num";
3017#endif /* FREECIV_JSON_CONNECTION */
3018 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_num)) {
3019 RECEIVE_PACKET_FIELD_ERROR(player_num);
3020 }
3021#endif
3022 log_packet_detailed("packet_endgame_report_100: got info about ()");
3023 RECEIVE_PACKET_END(real_packet);
3024#undef FREE_PACKET_STRUCT
3025}
3026
3027 static int send_packet_endgame_report_100(struct connection *pc, const struct packet_endgame_report *packet)
3028{
3029 const struct packet_endgame_report *real_packet = packet;
3030 int e;
3031 SEND_PACKET_START(PACKET_ENDGAME_REPORT);
3032#ifdef FREECIV_JSON_CONNECTION
3033 struct plocation field_addr;
3034 {
3035 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
3036 field_addr = *field_addr_tmp;
3037 FC_FREE(field_addr_tmp);
3038 }
3039#endif /* FREECIV_JSON_CONNECTION */
3040
3041 log_packet_detailed("packet_endgame_report_100: sending info about ()");
3042#if 1 /* To match endif */
3043#ifdef FREECIV_JSON_CONNECTION
3044 field_addr.name = "category_num";
3045#endif /* FREECIV_JSON_CONNECTION */
3046 e = 0;
3047 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category_num);
3048 if (e) {
3049 log_packet_detailed("'category_num' field error detected");
3050 }
3051#ifdef FREECIV_JSON_CONNECTION
3052 field_addr.name = "category_name";
3053#endif /* FREECIV_JSON_CONNECTION */
3054 e = 0;
3055 {
3056 int i;
3057
3058#ifdef FREECIV_JSON_CONNECTION
3059 /* Create the array. */
3060 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->category_num);
3061
3062 /* Enter the array. */
3063 field_addr.sub_location = plocation_elem_new(0);
3064#endif /* FREECIV_JSON_CONNECTION */
3065
3066 for (i = 0; i < real_packet->category_num; i++) {
3067#ifdef FREECIV_JSON_CONNECTION
3068 /* Next array element. */
3069 field_addr.sub_location->number = i;
3070#endif /* FREECIV_JSON_CONNECTION */
3071 e |= DIO_PUT(string, &dout, &field_addr, real_packet->category_name[i]);
3072 }
3073
3074#ifdef FREECIV_JSON_CONNECTION
3075 /* Exit array. */
3076 FC_FREE(field_addr.sub_location);
3077#endif /* FREECIV_JSON_CONNECTION */
3078 }
3079 if (e) {
3080 log_packet_detailed("'category_name' field error detected");
3081 }
3082#ifdef FREECIV_JSON_CONNECTION
3083 field_addr.name = "player_num";
3084#endif /* FREECIV_JSON_CONNECTION */
3085 e = 0;
3086 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_num);
3087 if (e) {
3088 log_packet_detailed("'player_num' field error detected");
3089 }
3090
3091#endif
3092 SEND_PACKET_END(PACKET_ENDGAME_REPORT);
3093}
3094
3095 int send_packet_endgame_report(struct connection *pc, const struct packet_endgame_report *packet)
3096{
3097 if (!pc->used) {
3098 log_error("WARNING: trying to send data to the closed connection %s",
3099 conn_description(pc));
3100 return -1;
3101 }
3102 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ENDGAME_REPORT].packet != nullptr, -1,
3103 "Handler for PACKET_ENDGAME_REPORT not installed");
3104 return pc->phs.handlers->send[PACKET_ENDGAME_REPORT].packet(pc, packet);
3105}
3106
3107 void lsend_packet_endgame_report(struct conn_list *dest, const struct packet_endgame_report *packet)
3108{
3109 conn_list_iterate(dest, pconn) {
3110 send_packet_endgame_report(pconn, packet);
3111 } conn_list_iterate_end;
3112}
3113
3114 static inline void init_packet_endgame_player(struct packet_endgame_player *packet)
3115{
3116 memset(packet, 0, sizeof(*packet));
3117}
3118
3119#define free_packet_endgame_player(_packet) (void) 0
3120#define destroy_packet_endgame_player free
3121
3122 static struct packet_endgame_player *receive_packet_endgame_player_100(struct connection *pc)
3123{
3124#define FREE_PACKET_STRUCT(_packet) free_packet_endgame_player(_packet)
3125 RECEIVE_PACKET_START(packet_endgame_player, real_packet);
3126#ifdef FREECIV_JSON_CONNECTION
3127 struct plocation field_addr;
3128 {
3129 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
3130 field_addr = *field_addr_tmp;
3131 FC_FREE(field_addr_tmp);
3132 }
3133#endif /* FREECIV_JSON_CONNECTION */
3134#if 1 /* To match endif */
3135#ifdef FREECIV_JSON_CONNECTION
3136 field_addr.name = "category_num";
3137#endif /* FREECIV_JSON_CONNECTION */
3138 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category_num)) {
3139 RECEIVE_PACKET_FIELD_ERROR(category_num);
3140 }
3141#ifdef FREECIV_JSON_CONNECTION
3142 field_addr.name = "player_id";
3143#endif /* FREECIV_JSON_CONNECTION */
3144 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_id)) {
3145 RECEIVE_PACKET_FIELD_ERROR(player_id);
3146 }
3147#ifdef FREECIV_JSON_CONNECTION
3148 field_addr.name = "score";
3149#endif /* FREECIV_JSON_CONNECTION */
3150 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
3151 RECEIVE_PACKET_FIELD_ERROR(score);
3152 }
3153#ifdef FREECIV_JSON_CONNECTION
3154 field_addr.name = "category_score";
3155#endif /* FREECIV_JSON_CONNECTION */
3156 {
3157 int i;
3158
3159#ifdef FREECIV_JSON_CONNECTION
3160 /* Enter array. */
3161 field_addr.sub_location = plocation_elem_new(0);
3162#endif /* FREECIV_JSON_CONNECTION */
3163
3164 if (real_packet->category_num > 32) {
3165 RECEIVE_PACKET_FIELD_ERROR(category_score, ": truncation array");
3166 }
3167 for (i = 0; i < real_packet->category_num; i++) {
3168#ifdef FREECIV_JSON_CONNECTION
3169 field_addr.sub_location->number = i;
3170#endif /* FREECIV_JSON_CONNECTION */
3171 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->category_score[i])) {
3172 RECEIVE_PACKET_FIELD_ERROR(category_score);
3173 }
3174 }
3175
3176#ifdef FREECIV_JSON_CONNECTION
3177 /* Exit array. */
3178 FC_FREE(field_addr.sub_location);
3179#endif /* FREECIV_JSON_CONNECTION */
3180 }
3181#ifdef FREECIV_JSON_CONNECTION
3182 field_addr.name = "winner";
3183#endif /* FREECIV_JSON_CONNECTION */
3184 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->winner)) {
3185 RECEIVE_PACKET_FIELD_ERROR(winner);
3186 }
3187#endif
3188 log_packet_detailed("packet_endgame_player_100: got info about ()");
3189 RECEIVE_PACKET_END(real_packet);
3190#undef FREE_PACKET_STRUCT
3191}
3192
3193 static int send_packet_endgame_player_100(struct connection *pc, const struct packet_endgame_player *packet)
3194{
3195 const struct packet_endgame_player *real_packet = packet;
3196 int e;
3197 SEND_PACKET_START(PACKET_ENDGAME_PLAYER);
3198#ifdef FREECIV_JSON_CONNECTION
3199 struct plocation field_addr;
3200 {
3201 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
3202 field_addr = *field_addr_tmp;
3203 FC_FREE(field_addr_tmp);
3204 }
3205#endif /* FREECIV_JSON_CONNECTION */
3206
3207 log_packet_detailed("packet_endgame_player_100: sending info about ()");
3208#if 1 /* To match endif */
3209#ifdef FREECIV_JSON_CONNECTION
3210 field_addr.name = "category_num";
3211#endif /* FREECIV_JSON_CONNECTION */
3212 e = 0;
3213 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category_num);
3214 if (e) {
3215 log_packet_detailed("'category_num' field error detected");
3216 }
3217#ifdef FREECIV_JSON_CONNECTION
3218 field_addr.name = "player_id";
3219#endif /* FREECIV_JSON_CONNECTION */
3220 e = 0;
3221 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_id);
3222 if (e) {
3223 log_packet_detailed("'player_id' field error detected");
3224 }
3225#ifdef FREECIV_JSON_CONNECTION
3226 field_addr.name = "score";
3227#endif /* FREECIV_JSON_CONNECTION */
3228 e = 0;
3229 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
3230 if (e) {
3231 log_packet_detailed("'score' field error detected");
3232 }
3233#ifdef FREECIV_JSON_CONNECTION
3234 field_addr.name = "category_score";
3235#endif /* FREECIV_JSON_CONNECTION */
3236 e = 0;
3237 {
3238 int i;
3239
3240#ifdef FREECIV_JSON_CONNECTION
3241 /* Create the array. */
3242 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->category_num);
3243
3244 /* Enter the array. */
3245 field_addr.sub_location = plocation_elem_new(0);
3246#endif /* FREECIV_JSON_CONNECTION */
3247
3248 for (i = 0; i < real_packet->category_num; i++) {
3249#ifdef FREECIV_JSON_CONNECTION
3250 /* Next array element. */
3251 field_addr.sub_location->number = i;
3252#endif /* FREECIV_JSON_CONNECTION */
3253 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->category_score[i]);
3254 }
3255
3256#ifdef FREECIV_JSON_CONNECTION
3257 /* Exit array. */
3258 FC_FREE(field_addr.sub_location);
3259#endif /* FREECIV_JSON_CONNECTION */
3260 }
3261 if (e) {
3262 log_packet_detailed("'category_score' field error detected");
3263 }
3264#ifdef FREECIV_JSON_CONNECTION
3265 field_addr.name = "winner";
3266#endif /* FREECIV_JSON_CONNECTION */
3267 e = 0;
3268 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->winner);
3269 if (e) {
3270 log_packet_detailed("'winner' field error detected");
3271 }
3272
3273#endif
3274 SEND_PACKET_END(PACKET_ENDGAME_PLAYER);
3275}
3276
3277 int send_packet_endgame_player(struct connection *pc, const struct packet_endgame_player *packet)
3278{
3279 if (!pc->used) {
3280 log_error("WARNING: trying to send data to the closed connection %s",
3281 conn_description(pc));
3282 return -1;
3283 }
3284 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ENDGAME_PLAYER].packet != nullptr, -1,
3285 "Handler for PACKET_ENDGAME_PLAYER not installed");
3286 return pc->phs.handlers->send[PACKET_ENDGAME_PLAYER].packet(pc, packet);
3287}
3288
3289 void lsend_packet_endgame_player(struct conn_list *dest, const struct packet_endgame_player *packet)
3290{
3291 conn_list_iterate(dest, pconn) {
3292 send_packet_endgame_player(pconn, packet);
3293 } conn_list_iterate_end;
3294}
3295
3296 static inline void init_packet_tile_info(struct packet_tile_info *packet)
3297{
3298 memset(packet, 0, sizeof(*packet));
3299}
3300
3301#define free_packet_tile_info(_packet) (void) 0
3302#define destroy_packet_tile_info free
3303
3304#ifdef FREECIV_DELTA_PROTOCOL
3305static genhash_val_t hash_packet_tile_info_100(const void *vkey)
3306{
3307 const struct packet_tile_info *key = (const struct packet_tile_info *) vkey;
3308 genhash_val_t result = 0;
3309
3310 result += key->tile;
3311
3312 result &= 0xFFFFFFFF;
3313 return result;
3314}
3315
3316static bool cmp_packet_tile_info_100(const void *vkey1, const void *vkey2)
3317{
3318 const struct packet_tile_info *old = (const struct packet_tile_info *) vkey1;
3319 const struct packet_tile_info *real_packet = (const struct packet_tile_info *) vkey2;
3320 bool differ;
3321
3322 differ = (old->tile != real_packet->tile);
3323
3324 return !differ;
3325}
3326 BV_DEFINE(packet_tile_info_100_fields, 13);
3327#endif /* FREECIV_DELTA_PROTOCOL */
3328
3329 static struct packet_tile_info *receive_packet_tile_info_100(struct connection *pc)
3330{
3331#define FREE_PACKET_STRUCT(_packet) free_packet_tile_info(_packet)
3332#ifdef FREECIV_DELTA_PROTOCOL
3333 packet_tile_info_100_fields fields;
3334 struct packet_tile_info *old;
3335 struct genhash **hash = pc->phs.received + PACKET_TILE_INFO;
3336#endif /* FREECIV_DELTA_PROTOCOL */
3337 RECEIVE_PACKET_START(packet_tile_info, real_packet);
3338#ifdef FREECIV_JSON_CONNECTION
3339 struct plocation field_addr;
3340 {
3341 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
3342 field_addr = *field_addr_tmp;
3343 FC_FREE(field_addr_tmp);
3344 }
3345#endif /* FREECIV_JSON_CONNECTION */
3346
3347#ifdef FREECIV_DELTA_PROTOCOL
3348#ifdef FREECIV_JSON_CONNECTION
3349 field_addr.name = "fields";
3350#endif /* FREECIV_JSON_CONNECTION */
3351 DIO_BV_GET(&din, &field_addr, fields);
3352#ifdef FREECIV_JSON_CONNECTION
3353 field_addr.name = "tile";
3354#endif /* FREECIV_JSON_CONNECTION */
3355 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3356 RECEIVE_PACKET_FIELD_ERROR(tile);
3357 }
3358
3359#else /* FREECIV_DELTA_PROTOCOL */
3360#ifdef FREECIV_JSON_CONNECTION
3361 field_addr.name = "tile";
3362#endif /* FREECIV_JSON_CONNECTION */
3363 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3364 RECEIVE_PACKET_FIELD_ERROR(tile);
3365 }
3366#ifdef FREECIV_JSON_CONNECTION
3367 field_addr.name = "continent";
3368#endif /* FREECIV_JSON_CONNECTION */
3369 {
3370 int readin;
3371
3372 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
3373 RECEIVE_PACKET_FIELD_ERROR(continent);
3374 }
3375 real_packet->continent = readin;
3376 }
3377#ifdef FREECIV_JSON_CONNECTION
3378 field_addr.name = "known";
3379#endif /* FREECIV_JSON_CONNECTION */
3380 {
3381 int readin;
3382
3383 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3384 RECEIVE_PACKET_FIELD_ERROR(known);
3385 }
3386 real_packet->known = readin;
3387 }
3388#ifdef FREECIV_JSON_CONNECTION
3389 field_addr.name = "owner";
3390#endif /* FREECIV_JSON_CONNECTION */
3391 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
3392 RECEIVE_PACKET_FIELD_ERROR(owner);
3393 }
3394#ifdef FREECIV_JSON_CONNECTION
3395 field_addr.name = "extras_owner";
3396#endif /* FREECIV_JSON_CONNECTION */
3397 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->extras_owner)) {
3398 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
3399 }
3400#ifdef FREECIV_JSON_CONNECTION
3401 field_addr.name = "worked";
3402#endif /* FREECIV_JSON_CONNECTION */
3403 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->worked)) {
3404 RECEIVE_PACKET_FIELD_ERROR(worked);
3405 }
3406#ifdef FREECIV_JSON_CONNECTION
3407 field_addr.name = "terrain";
3408#endif /* FREECIV_JSON_CONNECTION */
3409 {
3410 int readin;
3411
3412 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3413 RECEIVE_PACKET_FIELD_ERROR(terrain);
3414 }
3415 real_packet->terrain = readin;
3416 }
3417#ifdef FREECIV_JSON_CONNECTION
3418 field_addr.name = "resource";
3419#endif /* FREECIV_JSON_CONNECTION */
3420 {
3421 int readin;
3422
3423 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3424 RECEIVE_PACKET_FIELD_ERROR(resource);
3425 }
3426 real_packet->resource = readin;
3427 }
3428#ifdef FREECIV_JSON_CONNECTION
3429 field_addr.name = "extras";
3430#endif /* FREECIV_JSON_CONNECTION */
3431 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
3432 RECEIVE_PACKET_FIELD_ERROR(extras);
3433 }
3434#ifdef FREECIV_JSON_CONNECTION
3435 field_addr.name = "placing";
3436#endif /* FREECIV_JSON_CONNECTION */
3437 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
3438 RECEIVE_PACKET_FIELD_ERROR(placing);
3439 }
3440#ifdef FREECIV_JSON_CONNECTION
3441 field_addr.name = "place_turn";
3442#endif /* FREECIV_JSON_CONNECTION */
3443 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
3444 RECEIVE_PACKET_FIELD_ERROR(place_turn);
3445 }
3446#ifdef FREECIV_JSON_CONNECTION
3447 field_addr.name = "altitude";
3448#endif /* FREECIV_JSON_CONNECTION */
3449 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->altitude)) {
3450 RECEIVE_PACKET_FIELD_ERROR(altitude);
3451 }
3452#ifdef FREECIV_JSON_CONNECTION
3453 field_addr.name = "spec_sprite";
3454#endif /* FREECIV_JSON_CONNECTION */
3455 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
3456 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
3457 }
3458#ifdef FREECIV_JSON_CONNECTION
3459 field_addr.name = "label";
3460#endif /* FREECIV_JSON_CONNECTION */
3461 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
3462 RECEIVE_PACKET_FIELD_ERROR(label);
3463 }
3464#endif
3465 log_packet_detailed("packet_tile_info_100: got info about (%d)",
3466 real_packet->tile);
3467
3468#ifdef FREECIV_DELTA_PROTOCOL
3469 if (nullptr == *hash) {
3470 *hash = genhash_new_full(hash_packet_tile_info_100, cmp_packet_tile_info_100,
3471 nullptr, nullptr, nullptr, destroy_packet_tile_info);
3472 }
3473
3474 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
3475 *real_packet = *old;
3476 } else {
3477 /* packet is already initialized empty */
3478 log_packet_detailed(" no old info");
3479 }
3480
3481 if (BV_ISSET(fields, 0)) {
3482 log_packet_detailed(" got field 'continent'");
3483#ifdef FREECIV_JSON_CONNECTION
3484 field_addr.name = "continent";
3485#endif /* FREECIV_JSON_CONNECTION */
3486 {
3487 int readin;
3488
3489 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
3490 RECEIVE_PACKET_FIELD_ERROR(continent);
3491 }
3492 real_packet->continent = readin;
3493 }
3494 }
3495 if (BV_ISSET(fields, 1)) {
3496 log_packet_detailed(" got field 'known'");
3497#ifdef FREECIV_JSON_CONNECTION
3498 field_addr.name = "known";
3499#endif /* FREECIV_JSON_CONNECTION */
3500 {
3501 int readin;
3502
3503 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3504 RECEIVE_PACKET_FIELD_ERROR(known);
3505 }
3506 real_packet->known = readin;
3507 }
3508 }
3509 if (BV_ISSET(fields, 2)) {
3510 log_packet_detailed(" got field 'owner'");
3511#ifdef FREECIV_JSON_CONNECTION
3512 field_addr.name = "owner";
3513#endif /* FREECIV_JSON_CONNECTION */
3514 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
3515 RECEIVE_PACKET_FIELD_ERROR(owner);
3516 }
3517 }
3518 if (BV_ISSET(fields, 3)) {
3519 log_packet_detailed(" got field 'extras_owner'");
3520#ifdef FREECIV_JSON_CONNECTION
3521 field_addr.name = "extras_owner";
3522#endif /* FREECIV_JSON_CONNECTION */
3523 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->extras_owner)) {
3524 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
3525 }
3526 }
3527 if (BV_ISSET(fields, 4)) {
3528 log_packet_detailed(" got field 'worked'");
3529#ifdef FREECIV_JSON_CONNECTION
3530 field_addr.name = "worked";
3531#endif /* FREECIV_JSON_CONNECTION */
3532 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->worked)) {
3533 RECEIVE_PACKET_FIELD_ERROR(worked);
3534 }
3535 }
3536 if (BV_ISSET(fields, 5)) {
3537 log_packet_detailed(" got field 'terrain'");
3538#ifdef FREECIV_JSON_CONNECTION
3539 field_addr.name = "terrain";
3540#endif /* FREECIV_JSON_CONNECTION */
3541 {
3542 int readin;
3543
3544 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3545 RECEIVE_PACKET_FIELD_ERROR(terrain);
3546 }
3547 real_packet->terrain = readin;
3548 }
3549 }
3550 if (BV_ISSET(fields, 6)) {
3551 log_packet_detailed(" got field 'resource'");
3552#ifdef FREECIV_JSON_CONNECTION
3553 field_addr.name = "resource";
3554#endif /* FREECIV_JSON_CONNECTION */
3555 {
3556 int readin;
3557
3558 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3559 RECEIVE_PACKET_FIELD_ERROR(resource);
3560 }
3561 real_packet->resource = readin;
3562 }
3563 }
3564 if (BV_ISSET(fields, 7)) {
3565 log_packet_detailed(" got field 'extras'");
3566#ifdef FREECIV_JSON_CONNECTION
3567 field_addr.name = "extras";
3568#endif /* FREECIV_JSON_CONNECTION */
3569 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
3570 RECEIVE_PACKET_FIELD_ERROR(extras);
3571 }
3572 }
3573 if (BV_ISSET(fields, 8)) {
3574 log_packet_detailed(" got field 'placing'");
3575#ifdef FREECIV_JSON_CONNECTION
3576 field_addr.name = "placing";
3577#endif /* FREECIV_JSON_CONNECTION */
3578 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
3579 RECEIVE_PACKET_FIELD_ERROR(placing);
3580 }
3581 }
3582 if (BV_ISSET(fields, 9)) {
3583 log_packet_detailed(" got field 'place_turn'");
3584#ifdef FREECIV_JSON_CONNECTION
3585 field_addr.name = "place_turn";
3586#endif /* FREECIV_JSON_CONNECTION */
3587 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
3588 RECEIVE_PACKET_FIELD_ERROR(place_turn);
3589 }
3590 }
3591 if (BV_ISSET(fields, 10)) {
3592 log_packet_detailed(" got field 'altitude'");
3593#ifdef FREECIV_JSON_CONNECTION
3594 field_addr.name = "altitude";
3595#endif /* FREECIV_JSON_CONNECTION */
3596 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->altitude)) {
3597 RECEIVE_PACKET_FIELD_ERROR(altitude);
3598 }
3599 }
3600 if (BV_ISSET(fields, 11)) {
3601 log_packet_detailed(" got field 'spec_sprite'");
3602#ifdef FREECIV_JSON_CONNECTION
3603 field_addr.name = "spec_sprite";
3604#endif /* FREECIV_JSON_CONNECTION */
3605 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
3606 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
3607 }
3608 }
3609 if (BV_ISSET(fields, 12)) {
3610 log_packet_detailed(" got field 'label'");
3611#ifdef FREECIV_JSON_CONNECTION
3612 field_addr.name = "label";
3613#endif /* FREECIV_JSON_CONNECTION */
3614 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
3615 RECEIVE_PACKET_FIELD_ERROR(label);
3616 }
3617 }
3618
3619 if (nullptr == old) {
3620 old = fc_malloc(sizeof(*old));
3621 init_packet_tile_info(old);
3622 *old = *real_packet;
3623 genhash_insert(*hash, old, old);
3624 } else {
3625 *old = *real_packet;
3626 }
3627
3628#endif /* FREECIV_DELTA_PROTOCOL */
3629 RECEIVE_PACKET_END(real_packet);
3630#undef FREE_PACKET_STRUCT
3631}
3632
3633 static int send_packet_tile_info_100(struct connection *pc, const struct packet_tile_info *packet)
3634{
3635 const struct packet_tile_info *real_packet = packet;
3636 int e;
3637#ifdef FREECIV_DELTA_PROTOCOL
3638 packet_tile_info_100_fields fields;
3639 struct packet_tile_info *old;
3640 bool differ;
3641 struct genhash **hash = pc->phs.sent + PACKET_TILE_INFO;
3642 int different = 0;
3643#endif /* FREECIV_DELTA_PROTOCOL */
3644 SEND_PACKET_START(PACKET_TILE_INFO);
3645#ifdef FREECIV_JSON_CONNECTION
3646 struct plocation field_addr;
3647 {
3648 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
3649 field_addr = *field_addr_tmp;
3650 FC_FREE(field_addr_tmp);
3651 }
3652#endif /* FREECIV_JSON_CONNECTION */
3653
3654 log_packet_detailed("packet_tile_info_100: sending info about (%d)",
3655 real_packet->tile);
3656
3657#ifdef FREECIV_DELTA_PROTOCOL
3658 if (nullptr == *hash) {
3659 *hash = genhash_new_full(hash_packet_tile_info_100, cmp_packet_tile_info_100,
3660 nullptr, nullptr, nullptr, destroy_packet_tile_info);
3661 }
3662 BV_CLR_ALL(fields);
3663
3664 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
3665 old = fc_malloc(sizeof(*old));
3666 /* temporary bitcopy just to insert correctly */
3667 *old = *real_packet;
3668 genhash_insert(*hash, old, old);
3669 init_packet_tile_info(old);
3670 different = 1; /* Force to send. */
3671 }
3672 differ = (old->continent != real_packet->continent);
3673 if (differ) {
3674 different++;
3675 BV_SET(fields, 0);
3676 }
3677
3678 differ = (old->known != real_packet->known);
3679 if (differ) {
3680 different++;
3681 BV_SET(fields, 1);
3682 }
3683
3684 differ = (old->owner != real_packet->owner);
3685 if (differ) {
3686 different++;
3687 BV_SET(fields, 2);
3688 }
3689
3690 differ = (old->extras_owner != real_packet->extras_owner);
3691 if (differ) {
3692 different++;
3693 BV_SET(fields, 3);
3694 }
3695
3696 differ = (old->worked != real_packet->worked);
3697 if (differ) {
3698 different++;
3699 BV_SET(fields, 4);
3700 }
3701
3702 differ = (old->terrain != real_packet->terrain);
3703 if (differ) {
3704 different++;
3705 BV_SET(fields, 5);
3706 }
3707
3708 differ = (old->resource != real_packet->resource);
3709 if (differ) {
3710 different++;
3711 BV_SET(fields, 6);
3712 }
3713
3714 differ = !BV_ARE_EQUAL(old->extras, real_packet->extras);
3715 if (differ) {
3716 different++;
3717 BV_SET(fields, 7);
3718 }
3719
3720 differ = (old->placing != real_packet->placing);
3721 if (differ) {
3722 different++;
3723 BV_SET(fields, 8);
3724 }
3725
3726 differ = (old->place_turn != real_packet->place_turn);
3727 if (differ) {
3728 different++;
3729 BV_SET(fields, 9);
3730 }
3731
3732 differ = (old->altitude != real_packet->altitude);
3733 if (differ) {
3734 different++;
3735 BV_SET(fields, 10);
3736 }
3737
3738 differ = (strcmp(old->spec_sprite, real_packet->spec_sprite) != 0);
3739 if (differ) {
3740 different++;
3741 BV_SET(fields, 11);
3742 }
3743
3744 differ = (strcmp(old->label, real_packet->label) != 0);
3745 if (differ) {
3746 different++;
3747 BV_SET(fields, 12);
3748 }
3749
3750 if (different == 0) {
3751 log_packet_detailed(" no change -> discard");
3752 return 0;
3753 }
3754
3755#ifdef FREECIV_JSON_CONNECTION
3756 field_addr.name = "fields";
3757#endif /* FREECIV_JSON_CONNECTION */
3758 e = 0;
3759 e |= DIO_BV_PUT(&dout, &field_addr, fields);
3760 if (e) {
3761 log_packet_detailed("fields bitvector error detected");
3762 }
3763#ifdef FREECIV_JSON_CONNECTION
3764 field_addr.name = "tile";
3765#endif /* FREECIV_JSON_CONNECTION */
3766 e = 0;
3767 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
3768 if (e) {
3769 log_packet_detailed("'tile' field error detected");
3770 }
3771
3772 if (BV_ISSET(fields, 0)) {
3773 log_packet_detailed(" field 'continent' has changed");
3774#ifdef FREECIV_JSON_CONNECTION
3775 field_addr.name = "continent";
3776#endif /* FREECIV_JSON_CONNECTION */
3777 e = 0;
3778 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
3779 if (e) {
3780 log_packet_detailed("'continent' field error detected");
3781 }
3782 }
3783 if (BV_ISSET(fields, 1)) {
3784 log_packet_detailed(" field 'known' has changed");
3785#ifdef FREECIV_JSON_CONNECTION
3786 field_addr.name = "known";
3787#endif /* FREECIV_JSON_CONNECTION */
3788 e = 0;
3789 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
3790 if (e) {
3791 log_packet_detailed("'known' field error detected");
3792 }
3793 }
3794 if (BV_ISSET(fields, 2)) {
3795 log_packet_detailed(" field 'owner' has changed");
3796#ifdef FREECIV_JSON_CONNECTION
3797 field_addr.name = "owner";
3798#endif /* FREECIV_JSON_CONNECTION */
3799 e = 0;
3800 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
3801 if (e) {
3802 log_packet_detailed("'owner' field error detected");
3803 }
3804 }
3805 if (BV_ISSET(fields, 3)) {
3806 log_packet_detailed(" field 'extras_owner' has changed");
3807#ifdef FREECIV_JSON_CONNECTION
3808 field_addr.name = "extras_owner";
3809#endif /* FREECIV_JSON_CONNECTION */
3810 e = 0;
3811 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->extras_owner);
3812 if (e) {
3813 log_packet_detailed("'extras_owner' field error detected");
3814 }
3815 }
3816 if (BV_ISSET(fields, 4)) {
3817 log_packet_detailed(" field 'worked' has changed");
3818#ifdef FREECIV_JSON_CONNECTION
3819 field_addr.name = "worked";
3820#endif /* FREECIV_JSON_CONNECTION */
3821 e = 0;
3822 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->worked);
3823 if (e) {
3824 log_packet_detailed("'worked' field error detected");
3825 }
3826 }
3827 if (BV_ISSET(fields, 5)) {
3828 log_packet_detailed(" field 'terrain' has changed");
3829#ifdef FREECIV_JSON_CONNECTION
3830 field_addr.name = "terrain";
3831#endif /* FREECIV_JSON_CONNECTION */
3832 e = 0;
3833 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
3834 if (e) {
3835 log_packet_detailed("'terrain' field error detected");
3836 }
3837 }
3838 if (BV_ISSET(fields, 6)) {
3839 log_packet_detailed(" field 'resource' has changed");
3840#ifdef FREECIV_JSON_CONNECTION
3841 field_addr.name = "resource";
3842#endif /* FREECIV_JSON_CONNECTION */
3843 e = 0;
3844 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
3845 if (e) {
3846 log_packet_detailed("'resource' field error detected");
3847 }
3848 }
3849 if (BV_ISSET(fields, 7)) {
3850 log_packet_detailed(" field 'extras' has changed");
3851#ifdef FREECIV_JSON_CONNECTION
3852 field_addr.name = "extras";
3853#endif /* FREECIV_JSON_CONNECTION */
3854 e = 0;
3855 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
3856 if (e) {
3857 log_packet_detailed("'extras' field error detected");
3858 }
3859 }
3860 if (BV_ISSET(fields, 8)) {
3861 log_packet_detailed(" field 'placing' has changed");
3862#ifdef FREECIV_JSON_CONNECTION
3863 field_addr.name = "placing";
3864#endif /* FREECIV_JSON_CONNECTION */
3865 e = 0;
3866 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
3867 if (e) {
3868 log_packet_detailed("'placing' field error detected");
3869 }
3870 }
3871 if (BV_ISSET(fields, 9)) {
3872 log_packet_detailed(" field 'place_turn' has changed");
3873#ifdef FREECIV_JSON_CONNECTION
3874 field_addr.name = "place_turn";
3875#endif /* FREECIV_JSON_CONNECTION */
3876 e = 0;
3877 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
3878 if (e) {
3879 log_packet_detailed("'place_turn' field error detected");
3880 }
3881 }
3882 if (BV_ISSET(fields, 10)) {
3883 log_packet_detailed(" field 'altitude' has changed");
3884#ifdef FREECIV_JSON_CONNECTION
3885 field_addr.name = "altitude";
3886#endif /* FREECIV_JSON_CONNECTION */
3887 e = 0;
3888 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->altitude);
3889 if (e) {
3890 log_packet_detailed("'altitude' field error detected");
3891 }
3892 }
3893 if (BV_ISSET(fields, 11)) {
3894 log_packet_detailed(" field 'spec_sprite' has changed");
3895#ifdef FREECIV_JSON_CONNECTION
3896 field_addr.name = "spec_sprite";
3897#endif /* FREECIV_JSON_CONNECTION */
3898 e = 0;
3899 e |= DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
3900 if (e) {
3901 log_packet_detailed("'spec_sprite' field error detected");
3902 }
3903 }
3904 if (BV_ISSET(fields, 12)) {
3905 log_packet_detailed(" field 'label' has changed");
3906#ifdef FREECIV_JSON_CONNECTION
3907 field_addr.name = "label";
3908#endif /* FREECIV_JSON_CONNECTION */
3909 e = 0;
3910 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
3911 if (e) {
3912 log_packet_detailed("'label' field error detected");
3913 }
3914 }
3915
3916 *old = *real_packet;
3917#endif /* FREECIV_DELTA_PROTOCOL */
3918#ifndef FREECIV_DELTA_PROTOCOL
3919#ifdef FREECIV_JSON_CONNECTION
3920 field_addr.name = "tile";
3921#endif /* FREECIV_JSON_CONNECTION */
3922 e = 0;
3923 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
3924 if (e) {
3925 log_packet_detailed("'tile' field error detected");
3926 }
3927#ifdef FREECIV_JSON_CONNECTION
3928 field_addr.name = "continent";
3929#endif /* FREECIV_JSON_CONNECTION */
3930 e = 0;
3931 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
3932 if (e) {
3933 log_packet_detailed("'continent' field error detected");
3934 }
3935#ifdef FREECIV_JSON_CONNECTION
3936 field_addr.name = "known";
3937#endif /* FREECIV_JSON_CONNECTION */
3938 e = 0;
3939 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
3940 if (e) {
3941 log_packet_detailed("'known' field error detected");
3942 }
3943#ifdef FREECIV_JSON_CONNECTION
3944 field_addr.name = "owner";
3945#endif /* FREECIV_JSON_CONNECTION */
3946 e = 0;
3947 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
3948 if (e) {
3949 log_packet_detailed("'owner' field error detected");
3950 }
3951#ifdef FREECIV_JSON_CONNECTION
3952 field_addr.name = "extras_owner";
3953#endif /* FREECIV_JSON_CONNECTION */
3954 e = 0;
3955 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->extras_owner);
3956 if (e) {
3957 log_packet_detailed("'extras_owner' field error detected");
3958 }
3959#ifdef FREECIV_JSON_CONNECTION
3960 field_addr.name = "worked";
3961#endif /* FREECIV_JSON_CONNECTION */
3962 e = 0;
3963 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->worked);
3964 if (e) {
3965 log_packet_detailed("'worked' field error detected");
3966 }
3967#ifdef FREECIV_JSON_CONNECTION
3968 field_addr.name = "terrain";
3969#endif /* FREECIV_JSON_CONNECTION */
3970 e = 0;
3971 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
3972 if (e) {
3973 log_packet_detailed("'terrain' field error detected");
3974 }
3975#ifdef FREECIV_JSON_CONNECTION
3976 field_addr.name = "resource";
3977#endif /* FREECIV_JSON_CONNECTION */
3978 e = 0;
3979 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
3980 if (e) {
3981 log_packet_detailed("'resource' field error detected");
3982 }
3983#ifdef FREECIV_JSON_CONNECTION
3984 field_addr.name = "extras";
3985#endif /* FREECIV_JSON_CONNECTION */
3986 e = 0;
3987 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
3988 if (e) {
3989 log_packet_detailed("'extras' field error detected");
3990 }
3991#ifdef FREECIV_JSON_CONNECTION
3992 field_addr.name = "placing";
3993#endif /* FREECIV_JSON_CONNECTION */
3994 e = 0;
3995 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
3996 if (e) {
3997 log_packet_detailed("'placing' field error detected");
3998 }
3999#ifdef FREECIV_JSON_CONNECTION
4000 field_addr.name = "place_turn";
4001#endif /* FREECIV_JSON_CONNECTION */
4002 e = 0;
4003 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
4004 if (e) {
4005 log_packet_detailed("'place_turn' field error detected");
4006 }
4007#ifdef FREECIV_JSON_CONNECTION
4008 field_addr.name = "altitude";
4009#endif /* FREECIV_JSON_CONNECTION */
4010 e = 0;
4011 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->altitude);
4012 if (e) {
4013 log_packet_detailed("'altitude' field error detected");
4014 }
4015#ifdef FREECIV_JSON_CONNECTION
4016 field_addr.name = "spec_sprite";
4017#endif /* FREECIV_JSON_CONNECTION */
4018 e = 0;
4019 e |= DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
4020 if (e) {
4021 log_packet_detailed("'spec_sprite' field error detected");
4022 }
4023#ifdef FREECIV_JSON_CONNECTION
4024 field_addr.name = "label";
4025#endif /* FREECIV_JSON_CONNECTION */
4026 e = 0;
4027 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
4028 if (e) {
4029 log_packet_detailed("'label' field error detected");
4030 }
4031
4032#endif
4033 SEND_PACKET_END(PACKET_TILE_INFO);
4034}
4035
4036 int send_packet_tile_info(struct connection *pc, const struct packet_tile_info *packet)
4037{
4038 if (!pc->used) {
4039 log_error("WARNING: trying to send data to the closed connection %s",
4040 conn_description(pc));
4041 return -1;
4042 }
4043 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TILE_INFO].packet != nullptr, -1,
4044 "Handler for PACKET_TILE_INFO not installed");
4045 return pc->phs.handlers->send[PACKET_TILE_INFO].packet(pc, packet);
4046}
4047
4048 void lsend_packet_tile_info(struct conn_list *dest, const struct packet_tile_info *packet)
4049{
4050 conn_list_iterate(dest, pconn) {
4051 send_packet_tile_info(pconn, packet);
4052 } conn_list_iterate_end;
4053}
4054
4055 static inline void init_packet_game_info(struct packet_game_info *packet)
4056{
4057 memset(packet, 0, sizeof(*packet));
4058}
4059
4060#define free_packet_game_info(_packet) (void) 0
4061#define destroy_packet_game_info free
4062
4063#ifdef FREECIV_DELTA_PROTOCOL
4064#define hash_packet_game_info_100 hash_const
4065
4066#define cmp_packet_game_info_100 cmp_const
4067
4068 BV_DEFINE(packet_game_info_100_fields, 137);
4069#endif /* FREECIV_DELTA_PROTOCOL */
4070
4071 static struct packet_game_info *receive_packet_game_info_100(struct connection *pc)
4072{
4073#define FREE_PACKET_STRUCT(_packet) free_packet_game_info(_packet)
4074#ifdef FREECIV_DELTA_PROTOCOL
4075 packet_game_info_100_fields fields;
4076 struct packet_game_info *old;
4077 struct genhash **hash = pc->phs.received + PACKET_GAME_INFO;
4078#endif /* FREECIV_DELTA_PROTOCOL */
4079 RECEIVE_PACKET_START(packet_game_info, real_packet);
4080#ifdef FREECIV_JSON_CONNECTION
4081 struct plocation field_addr;
4082 {
4083 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
4084 field_addr = *field_addr_tmp;
4085 FC_FREE(field_addr_tmp);
4086 }
4087#endif /* FREECIV_JSON_CONNECTION */
4088
4089#ifdef FREECIV_DELTA_PROTOCOL
4090#ifdef FREECIV_JSON_CONNECTION
4091 field_addr.name = "fields";
4092#endif /* FREECIV_JSON_CONNECTION */
4093 DIO_BV_GET(&din, &field_addr, fields);
4094
4095#else /* FREECIV_DELTA_PROTOCOL */
4096#ifdef FREECIV_JSON_CONNECTION
4097 field_addr.name = "add_to_size_limit";
4098#endif /* FREECIV_JSON_CONNECTION */
4099 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->add_to_size_limit)) {
4100 RECEIVE_PACKET_FIELD_ERROR(add_to_size_limit);
4101 }
4102#ifdef FREECIV_JSON_CONNECTION
4103 field_addr.name = "aifill";
4104#endif /* FREECIV_JSON_CONNECTION */
4105 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->aifill)) {
4106 RECEIVE_PACKET_FIELD_ERROR(aifill);
4107 }
4108#ifdef FREECIV_JSON_CONNECTION
4109 field_addr.name = "persistent_ready";
4110#endif /* FREECIV_JSON_CONNECTION */
4111 {
4112 int readin;
4113
4114 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4115 RECEIVE_PACKET_FIELD_ERROR(persistent_ready);
4116 }
4117 real_packet->persistent_ready = readin;
4118 }
4119#ifdef FREECIV_JSON_CONNECTION
4120 field_addr.name = "airlifting_style";
4121#endif /* FREECIV_JSON_CONNECTION */
4122 {
4123 int readin;
4124
4125 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4126 RECEIVE_PACKET_FIELD_ERROR(airlifting_style);
4127 }
4128 real_packet->airlifting_style = readin;
4129 }
4130#ifdef FREECIV_JSON_CONNECTION
4131 field_addr.name = "airlift_from_always_enabled";
4132#endif /* FREECIV_JSON_CONNECTION */
4133 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift_from_always_enabled)) {
4134 RECEIVE_PACKET_FIELD_ERROR(airlift_from_always_enabled);
4135 }
4136#ifdef FREECIV_JSON_CONNECTION
4137 field_addr.name = "airlift_to_always_enabled";
4138#endif /* FREECIV_JSON_CONNECTION */
4139 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift_to_always_enabled)) {
4140 RECEIVE_PACKET_FIELD_ERROR(airlift_to_always_enabled);
4141 }
4142#ifdef FREECIV_JSON_CONNECTION
4143 field_addr.name = "angrycitizen";
4144#endif /* FREECIV_JSON_CONNECTION */
4145 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->angrycitizen)) {
4146 RECEIVE_PACKET_FIELD_ERROR(angrycitizen);
4147 }
4148#ifdef FREECIV_JSON_CONNECTION
4149 field_addr.name = "base_pollution";
4150#endif /* FREECIV_JSON_CONNECTION */
4151 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->base_pollution)) {
4152 RECEIVE_PACKET_FIELD_ERROR(base_pollution);
4153 }
4154#ifdef FREECIV_JSON_CONNECTION
4155 field_addr.name = "base_tech_cost";
4156#endif /* FREECIV_JSON_CONNECTION */
4157 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->base_tech_cost)) {
4158 RECEIVE_PACKET_FIELD_ERROR(base_tech_cost);
4159 }
4160#ifdef FREECIV_JSON_CONNECTION
4161 field_addr.name = "min_tech_cost";
4162#endif /* FREECIV_JSON_CONNECTION */
4163 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_tech_cost)) {
4164 RECEIVE_PACKET_FIELD_ERROR(min_tech_cost);
4165 }
4166#ifdef FREECIV_JSON_CONNECTION
4167 field_addr.name = "tech_leak_pct";
4168#endif /* FREECIV_JSON_CONNECTION */
4169 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_leak_pct)) {
4170 RECEIVE_PACKET_FIELD_ERROR(tech_leak_pct);
4171 }
4172#ifdef FREECIV_JSON_CONNECTION
4173 field_addr.name = "border_city_radius_sq";
4174#endif /* FREECIV_JSON_CONNECTION */
4175 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->border_city_radius_sq)) {
4176 RECEIVE_PACKET_FIELD_ERROR(border_city_radius_sq);
4177 }
4178#ifdef FREECIV_JSON_CONNECTION
4179 field_addr.name = "border_size_effect";
4180#endif /* FREECIV_JSON_CONNECTION */
4181 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->border_size_effect)) {
4182 RECEIVE_PACKET_FIELD_ERROR(border_size_effect);
4183 }
4184#ifdef FREECIV_JSON_CONNECTION
4185 field_addr.name = "border_city_permanent_radius_sq";
4186#endif /* FREECIV_JSON_CONNECTION */
4187 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->border_city_permanent_radius_sq)) {
4188 RECEIVE_PACKET_FIELD_ERROR(border_city_permanent_radius_sq);
4189 }
4190#ifdef FREECIV_JSON_CONNECTION
4191 field_addr.name = "borders";
4192#endif /* FREECIV_JSON_CONNECTION */
4193 {
4194 int readin;
4195
4196 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4197 RECEIVE_PACKET_FIELD_ERROR(borders);
4198 }
4199 real_packet->borders = readin;
4200 }
4201#ifdef FREECIV_JSON_CONNECTION
4202 field_addr.name = "base_bribe_cost";
4203#endif /* FREECIV_JSON_CONNECTION */
4204 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->base_bribe_cost)) {
4205 RECEIVE_PACKET_FIELD_ERROR(base_bribe_cost);
4206 }
4207#ifdef FREECIV_JSON_CONNECTION
4208 field_addr.name = "caravan_bonus_style";
4209#endif /* FREECIV_JSON_CONNECTION */
4210 {
4211 int readin;
4212
4213 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4214 RECEIVE_PACKET_FIELD_ERROR(caravan_bonus_style);
4215 }
4216 real_packet->caravan_bonus_style = readin;
4217 }
4218#ifdef FREECIV_JSON_CONNECTION
4219 field_addr.name = "culture_vic_points";
4220#endif /* FREECIV_JSON_CONNECTION */
4221 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture_vic_points)) {
4222 RECEIVE_PACKET_FIELD_ERROR(culture_vic_points);
4223 }
4224#ifdef FREECIV_JSON_CONNECTION
4225 field_addr.name = "culture_vic_lead";
4226#endif /* FREECIV_JSON_CONNECTION */
4227 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_vic_lead)) {
4228 RECEIVE_PACKET_FIELD_ERROR(culture_vic_lead);
4229 }
4230#ifdef FREECIV_JSON_CONNECTION
4231 field_addr.name = "culture_migration_pml";
4232#endif /* FREECIV_JSON_CONNECTION */
4233 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_migration_pml)) {
4234 RECEIVE_PACKET_FIELD_ERROR(culture_migration_pml);
4235 }
4236#ifdef FREECIV_JSON_CONNECTION
4237 field_addr.name = "history_interest_pml";
4238#endif /* FREECIV_JSON_CONNECTION */
4239 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->history_interest_pml)) {
4240 RECEIVE_PACKET_FIELD_ERROR(history_interest_pml);
4241 }
4242#ifdef FREECIV_JSON_CONNECTION
4243 field_addr.name = "world_peace_turns";
4244#endif /* FREECIV_JSON_CONNECTION */
4245 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->world_peace_turns)) {
4246 RECEIVE_PACKET_FIELD_ERROR(world_peace_turns);
4247 }
4248#ifdef FREECIV_JSON_CONNECTION
4249 field_addr.name = "celebratesize";
4250#endif /* FREECIV_JSON_CONNECTION */
4251 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->celebratesize)) {
4252 RECEIVE_PACKET_FIELD_ERROR(celebratesize);
4253 }
4254#ifdef FREECIV_JSON_CONNECTION
4255 field_addr.name = "changable_tax";
4256#endif /* FREECIV_JSON_CONNECTION */
4257 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->changable_tax)) {
4258 RECEIVE_PACKET_FIELD_ERROR(changable_tax);
4259 }
4260#ifdef FREECIV_JSON_CONNECTION
4261 field_addr.name = "pop_report_zeroes";
4262#endif /* FREECIV_JSON_CONNECTION */
4263 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_report_zeroes)) {
4264 RECEIVE_PACKET_FIELD_ERROR(pop_report_zeroes);
4265 }
4266#ifdef FREECIV_JSON_CONNECTION
4267 field_addr.name = "citizen_nationality";
4268#endif /* FREECIV_JSON_CONNECTION */
4269 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->citizen_nationality)) {
4270 RECEIVE_PACKET_FIELD_ERROR(citizen_nationality);
4271 }
4272#ifdef FREECIV_JSON_CONNECTION
4273 field_addr.name = "unit_builders_nationality";
4274#endif /* FREECIV_JSON_CONNECTION */
4275 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unit_builders_nationality)) {
4276 RECEIVE_PACKET_FIELD_ERROR(unit_builders_nationality);
4277 }
4278#ifdef FREECIV_JSON_CONNECTION
4279 field_addr.name = "citizen_convert_speed";
4280#endif /* FREECIV_JSON_CONNECTION */
4281 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->citizen_convert_speed)) {
4282 RECEIVE_PACKET_FIELD_ERROR(citizen_convert_speed);
4283 }
4284#ifdef FREECIV_JSON_CONNECTION
4285 field_addr.name = "conquest_convert_pct";
4286#endif /* FREECIV_JSON_CONNECTION */
4287 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->conquest_convert_pct)) {
4288 RECEIVE_PACKET_FIELD_ERROR(conquest_convert_pct);
4289 }
4290#ifdef FREECIV_JSON_CONNECTION
4291 field_addr.name = "citizen_partisans_pct";
4292#endif /* FREECIV_JSON_CONNECTION */
4293 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citizen_partisans_pct)) {
4294 RECEIVE_PACKET_FIELD_ERROR(citizen_partisans_pct);
4295 }
4296#ifdef FREECIV_JSON_CONNECTION
4297 field_addr.name = "citymindist";
4298#endif /* FREECIV_JSON_CONNECTION */
4299 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citymindist)) {
4300 RECEIVE_PACKET_FIELD_ERROR(citymindist);
4301 }
4302#ifdef FREECIV_JSON_CONNECTION
4303 field_addr.name = "cooling";
4304#endif /* FREECIV_JSON_CONNECTION */
4305 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cooling)) {
4306 RECEIVE_PACKET_FIELD_ERROR(cooling);
4307 }
4308#ifdef FREECIV_JSON_CONNECTION
4309 field_addr.name = "coolinglevel";
4310#endif /* FREECIV_JSON_CONNECTION */
4311 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->coolinglevel)) {
4312 RECEIVE_PACKET_FIELD_ERROR(coolinglevel);
4313 }
4314#ifdef FREECIV_JSON_CONNECTION
4315 field_addr.name = "diplchance_initial_odds";
4316#endif /* FREECIV_JSON_CONNECTION */
4317 if (!DIO_BV_GET(&din, &field_addr, real_packet->diplchance_initial_odds)) {
4318 RECEIVE_PACKET_FIELD_ERROR(diplchance_initial_odds);
4319 }
4320#ifdef FREECIV_JSON_CONNECTION
4321 field_addr.name = "diplomacy";
4322#endif /* FREECIV_JSON_CONNECTION */
4323 {
4324 int readin;
4325
4326 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4327 RECEIVE_PACKET_FIELD_ERROR(diplomacy);
4328 }
4329 real_packet->diplomacy = readin;
4330 }
4331#ifdef FREECIV_JSON_CONNECTION
4332 field_addr.name = "fogofwar";
4333#endif /* FREECIV_JSON_CONNECTION */
4334 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->fogofwar)) {
4335 RECEIVE_PACKET_FIELD_ERROR(fogofwar);
4336 }
4337#ifdef FREECIV_JSON_CONNECTION
4338 field_addr.name = "food_cost";
4339#endif /* FREECIV_JSON_CONNECTION */
4340 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_cost)) {
4341 RECEIVE_PACKET_FIELD_ERROR(food_cost);
4342 }
4343#ifdef FREECIV_JSON_CONNECTION
4344 field_addr.name = "foodbox";
4345#endif /* FREECIV_JSON_CONNECTION */
4346 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->foodbox)) {
4347 RECEIVE_PACKET_FIELD_ERROR(foodbox);
4348 }
4349#ifdef FREECIV_JSON_CONNECTION
4350 field_addr.name = "forced_gold";
4351#endif /* FREECIV_JSON_CONNECTION */
4352 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_gold)) {
4353 RECEIVE_PACKET_FIELD_ERROR(forced_gold);
4354 }
4355#ifdef FREECIV_JSON_CONNECTION
4356 field_addr.name = "forced_luxury";
4357#endif /* FREECIV_JSON_CONNECTION */
4358 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_luxury)) {
4359 RECEIVE_PACKET_FIELD_ERROR(forced_luxury);
4360 }
4361#ifdef FREECIV_JSON_CONNECTION
4362 field_addr.name = "forced_science";
4363#endif /* FREECIV_JSON_CONNECTION */
4364 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_science)) {
4365 RECEIVE_PACKET_FIELD_ERROR(forced_science);
4366 }
4367#ifdef FREECIV_JSON_CONNECTION
4368 field_addr.name = "fulltradesize";
4369#endif /* FREECIV_JSON_CONNECTION */
4370 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fulltradesize)) {
4371 RECEIVE_PACKET_FIELD_ERROR(fulltradesize);
4372 }
4373#ifdef FREECIV_JSON_CONNECTION
4374 field_addr.name = "trade_world_rel_pct";
4375#endif /* FREECIV_JSON_CONNECTION */
4376 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_world_rel_pct)) {
4377 RECEIVE_PACKET_FIELD_ERROR(trade_world_rel_pct);
4378 }
4379#ifdef FREECIV_JSON_CONNECTION
4380 field_addr.name = "min_trade_route_val";
4381#endif /* FREECIV_JSON_CONNECTION */
4382 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_trade_route_val)) {
4383 RECEIVE_PACKET_FIELD_ERROR(min_trade_route_val);
4384 }
4385#ifdef FREECIV_JSON_CONNECTION
4386 field_addr.name = "reveal_trade_partner";
4387#endif /* FREECIV_JSON_CONNECTION */
4388 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->reveal_trade_partner)) {
4389 RECEIVE_PACKET_FIELD_ERROR(reveal_trade_partner);
4390 }
4391#ifdef FREECIV_JSON_CONNECTION
4392 field_addr.name = "goods_selection";
4393#endif /* FREECIV_JSON_CONNECTION */
4394 {
4395 int readin;
4396
4397 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4398 RECEIVE_PACKET_FIELD_ERROR(goods_selection);
4399 }
4400 real_packet->goods_selection = readin;
4401 }
4402#ifdef FREECIV_JSON_CONNECTION
4403 field_addr.name = "global_advance_count";
4404#endif /* FREECIV_JSON_CONNECTION */
4405 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_advance_count)) {
4406 RECEIVE_PACKET_FIELD_ERROR(global_advance_count);
4407 }
4408#ifdef FREECIV_JSON_CONNECTION
4409 field_addr.name = "global_advances";
4410#endif /* FREECIV_JSON_CONNECTION */
4411 {
4412 int i;
4413
4414#ifdef FREECIV_JSON_CONNECTION
4415 /* Enter array. */
4416 field_addr.sub_location = plocation_elem_new(0);
4417#endif /* FREECIV_JSON_CONNECTION */
4418
4419 for (i = 0; i < A_LAST; i++) {
4420#ifdef FREECIV_JSON_CONNECTION
4421 field_addr.sub_location->number = i;
4422#endif /* FREECIV_JSON_CONNECTION */
4423 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_advances[i])) {
4424 RECEIVE_PACKET_FIELD_ERROR(global_advances);
4425 }
4426 }
4427
4428#ifdef FREECIV_JSON_CONNECTION
4429 /* Exit array. */
4430 FC_FREE(field_addr.sub_location);
4431#endif /* FREECIV_JSON_CONNECTION */
4432 }
4433#ifdef FREECIV_JSON_CONNECTION
4434 field_addr.name = "global_warming";
4435#endif /* FREECIV_JSON_CONNECTION */
4436 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_warming)) {
4437 RECEIVE_PACKET_FIELD_ERROR(global_warming);
4438 }
4439#ifdef FREECIV_JSON_CONNECTION
4440 field_addr.name = "globalwarming";
4441#endif /* FREECIV_JSON_CONNECTION */
4442 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->globalwarming)) {
4443 RECEIVE_PACKET_FIELD_ERROR(globalwarming);
4444 }
4445#ifdef FREECIV_JSON_CONNECTION
4446 field_addr.name = "gold";
4447#endif /* FREECIV_JSON_CONNECTION */
4448 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
4449 RECEIVE_PACKET_FIELD_ERROR(gold);
4450 }
4451#ifdef FREECIV_JSON_CONNECTION
4452 field_addr.name = "gold_upkeep_style";
4453#endif /* FREECIV_JSON_CONNECTION */
4454 {
4455 int readin;
4456
4457 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4458 RECEIVE_PACKET_FIELD_ERROR(gold_upkeep_style);
4459 }
4460 real_packet->gold_upkeep_style = readin;
4461 }
4462#ifdef FREECIV_JSON_CONNECTION
4463 field_addr.name = "homeless_gold_upkeep";
4464#endif /* FREECIV_JSON_CONNECTION */
4465 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->homeless_gold_upkeep)) {
4466 RECEIVE_PACKET_FIELD_ERROR(homeless_gold_upkeep);
4467 }
4468#ifdef FREECIV_JSON_CONNECTION
4469 field_addr.name = "infrapoints";
4470#endif /* FREECIV_JSON_CONNECTION */
4471 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
4472 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
4473 }
4474#ifdef FREECIV_JSON_CONNECTION
4475 field_addr.name = "revolentype";
4476#endif /* FREECIV_JSON_CONNECTION */
4477 {
4478 int readin;
4479
4480 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4481 RECEIVE_PACKET_FIELD_ERROR(revolentype);
4482 }
4483 real_packet->revolentype = readin;
4484 }
4485#ifdef FREECIV_JSON_CONNECTION
4486 field_addr.name = "default_government_id";
4487#endif /* FREECIV_JSON_CONNECTION */
4488 {
4489 int readin;
4490
4491 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
4492 RECEIVE_PACKET_FIELD_ERROR(default_government_id);
4493 }
4494 real_packet->default_government_id = readin;
4495 }
4496#ifdef FREECIV_JSON_CONNECTION
4497 field_addr.name = "government_during_revolution_id";
4498#endif /* FREECIV_JSON_CONNECTION */
4499 {
4500 int readin;
4501
4502 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
4503 RECEIVE_PACKET_FIELD_ERROR(government_during_revolution_id);
4504 }
4505 real_packet->government_during_revolution_id = readin;
4506 }
4507#ifdef FREECIV_JSON_CONNECTION
4508 field_addr.name = "granary_food_inc";
4509#endif /* FREECIV_JSON_CONNECTION */
4510 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_inc)) {
4511 RECEIVE_PACKET_FIELD_ERROR(granary_food_inc);
4512 }
4513#ifdef FREECIV_JSON_CONNECTION
4514 field_addr.name = "granary_food_ini";
4515#endif /* FREECIV_JSON_CONNECTION */
4516 {
4517 int i;
4518
4519#ifdef FREECIV_JSON_CONNECTION
4520 /* Enter array. */
4521 field_addr.sub_location = plocation_elem_new(0);
4522#endif /* FREECIV_JSON_CONNECTION */
4523
4524 for (i = 0; i < MAX_GRANARY_INIS; i++) {
4525#ifdef FREECIV_JSON_CONNECTION
4526 field_addr.sub_location->number = i;
4527#endif /* FREECIV_JSON_CONNECTION */
4528 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_ini[i])) {
4529 RECEIVE_PACKET_FIELD_ERROR(granary_food_ini);
4530 }
4531 }
4532
4533#ifdef FREECIV_JSON_CONNECTION
4534 /* Exit array. */
4535 FC_FREE(field_addr.sub_location);
4536#endif /* FREECIV_JSON_CONNECTION */
4537 }
4538#ifdef FREECIV_JSON_CONNECTION
4539 field_addr.name = "granary_num_inis";
4540#endif /* FREECIV_JSON_CONNECTION */
4541 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->granary_num_inis)) {
4542 RECEIVE_PACKET_FIELD_ERROR(granary_num_inis);
4543 }
4544#ifdef FREECIV_JSON_CONNECTION
4545 field_addr.name = "great_wonder_owners";
4546#endif /* FREECIV_JSON_CONNECTION */
4547 {
4548 int i;
4549
4550#ifdef FREECIV_JSON_CONNECTION
4551 /* Enter array. */
4552 field_addr.sub_location = plocation_elem_new(0);
4553#endif /* FREECIV_JSON_CONNECTION */
4554
4555 for (i = 0; i < B_LAST; i++) {
4556#ifdef FREECIV_JSON_CONNECTION
4557 field_addr.sub_location->number = i;
4558#endif /* FREECIV_JSON_CONNECTION */
4559 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->great_wonder_owners[i])) {
4560 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
4561 }
4562 }
4563
4564#ifdef FREECIV_JSON_CONNECTION
4565 /* Exit array. */
4566 FC_FREE(field_addr.sub_location);
4567#endif /* FREECIV_JSON_CONNECTION */
4568 }
4569#ifdef FREECIV_JSON_CONNECTION
4570 field_addr.name = "happy_cost";
4571#endif /* FREECIV_JSON_CONNECTION */
4572 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->happy_cost)) {
4573 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
4574 }
4575#ifdef FREECIV_JSON_CONNECTION
4576 field_addr.name = "happyborders";
4577#endif /* FREECIV_JSON_CONNECTION */
4578 {
4579 int readin;
4580
4581 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4582 RECEIVE_PACKET_FIELD_ERROR(happyborders);
4583 }
4584 real_packet->happyborders = readin;
4585 }
4586#ifdef FREECIV_JSON_CONNECTION
4587 field_addr.name = "heating";
4588#endif /* FREECIV_JSON_CONNECTION */
4589 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->heating)) {
4590 RECEIVE_PACKET_FIELD_ERROR(heating);
4591 }
4592#ifdef FREECIV_JSON_CONNECTION
4593 field_addr.name = "illness_base_factor";
4594#endif /* FREECIV_JSON_CONNECTION */
4595 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_base_factor)) {
4596 RECEIVE_PACKET_FIELD_ERROR(illness_base_factor);
4597 }
4598#ifdef FREECIV_JSON_CONNECTION
4599 field_addr.name = "illness_min_size";
4600#endif /* FREECIV_JSON_CONNECTION */
4601 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->illness_min_size)) {
4602 RECEIVE_PACKET_FIELD_ERROR(illness_min_size);
4603 }
4604#ifdef FREECIV_JSON_CONNECTION
4605 field_addr.name = "illness_on";
4606#endif /* FREECIV_JSON_CONNECTION */
4607 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->illness_on)) {
4608 RECEIVE_PACKET_FIELD_ERROR(illness_on);
4609 }
4610#ifdef FREECIV_JSON_CONNECTION
4611 field_addr.name = "illness_pollution_factor";
4612#endif /* FREECIV_JSON_CONNECTION */
4613 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_pollution_factor)) {
4614 RECEIVE_PACKET_FIELD_ERROR(illness_pollution_factor);
4615 }
4616#ifdef FREECIV_JSON_CONNECTION
4617 field_addr.name = "illness_trade_infection";
4618#endif /* FREECIV_JSON_CONNECTION */
4619 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade_infection)) {
4620 RECEIVE_PACKET_FIELD_ERROR(illness_trade_infection);
4621 }
4622#ifdef FREECIV_JSON_CONNECTION
4623 field_addr.name = "init_city_radius_sq";
4624#endif /* FREECIV_JSON_CONNECTION */
4625 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_city_radius_sq)) {
4626 RECEIVE_PACKET_FIELD_ERROR(init_city_radius_sq);
4627 }
4628#ifdef FREECIV_JSON_CONNECTION
4629 field_addr.name = "is_edit_mode";
4630#endif /* FREECIV_JSON_CONNECTION */
4631 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_edit_mode)) {
4632 RECEIVE_PACKET_FIELD_ERROR(is_edit_mode);
4633 }
4634#ifdef FREECIV_JSON_CONNECTION
4635 field_addr.name = "is_new_game";
4636#endif /* FREECIV_JSON_CONNECTION */
4637 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_new_game)) {
4638 RECEIVE_PACKET_FIELD_ERROR(is_new_game);
4639 }
4640#ifdef FREECIV_JSON_CONNECTION
4641 field_addr.name = "killcitizen";
4642#endif /* FREECIV_JSON_CONNECTION */
4643 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->killcitizen)) {
4644 RECEIVE_PACKET_FIELD_ERROR(killcitizen);
4645 }
4646#ifdef FREECIV_JSON_CONNECTION
4647 field_addr.name = "killstack";
4648#endif /* FREECIV_JSON_CONNECTION */
4649 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->killstack)) {
4650 RECEIVE_PACKET_FIELD_ERROR(killstack);
4651 }
4652#ifdef FREECIV_JSON_CONNECTION
4653 field_addr.name = "only_killing_makes_veteran";
4654#endif /* FREECIV_JSON_CONNECTION */
4655 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->only_killing_makes_veteran)) {
4656 RECEIVE_PACKET_FIELD_ERROR(only_killing_makes_veteran);
4657 }
4658#ifdef FREECIV_JSON_CONNECTION
4659 field_addr.name = "only_real_fight_makes_veteran";
4660#endif /* FREECIV_JSON_CONNECTION */
4661 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->only_real_fight_makes_veteran)) {
4662 RECEIVE_PACKET_FIELD_ERROR(only_real_fight_makes_veteran);
4663 }
4664#ifdef FREECIV_JSON_CONNECTION
4665 field_addr.name = "combat_odds_scaled_veterancy";
4666#endif /* FREECIV_JSON_CONNECTION */
4667 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->combat_odds_scaled_veterancy)) {
4668 RECEIVE_PACKET_FIELD_ERROR(combat_odds_scaled_veterancy);
4669 }
4670#ifdef FREECIV_JSON_CONNECTION
4671 field_addr.name = "damage_reduces_bombard_rate";
4672#endif /* FREECIV_JSON_CONNECTION */
4673 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->damage_reduces_bombard_rate)) {
4674 RECEIVE_PACKET_FIELD_ERROR(damage_reduces_bombard_rate);
4675 }
4676#ifdef FREECIV_JSON_CONNECTION
4677 field_addr.name = "low_firepower_badwallattacker";
4678#endif /* FREECIV_JSON_CONNECTION */
4679 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_badwallattacker)) {
4680 RECEIVE_PACKET_FIELD_ERROR(low_firepower_badwallattacker);
4681 }
4682#ifdef FREECIV_JSON_CONNECTION
4683 field_addr.name = "low_firepower_pearl_harbour";
4684#endif /* FREECIV_JSON_CONNECTION */
4685 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_pearl_harbour)) {
4686 RECEIVE_PACKET_FIELD_ERROR(low_firepower_pearl_harbour);
4687 }
4688#ifdef FREECIV_JSON_CONNECTION
4689 field_addr.name = "low_firepower_combat_bonus";
4690#endif /* FREECIV_JSON_CONNECTION */
4691 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_combat_bonus)) {
4692 RECEIVE_PACKET_FIELD_ERROR(low_firepower_combat_bonus);
4693 }
4694#ifdef FREECIV_JSON_CONNECTION
4695 field_addr.name = "low_firepower_nonnat_bombard";
4696#endif /* FREECIV_JSON_CONNECTION */
4697 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_nonnat_bombard)) {
4698 RECEIVE_PACKET_FIELD_ERROR(low_firepower_nonnat_bombard);
4699 }
4700#ifdef FREECIV_JSON_CONNECTION
4701 field_addr.name = "nuke_pop_loss_pct";
4702#endif /* FREECIV_JSON_CONNECTION */
4703 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_pop_loss_pct)) {
4704 RECEIVE_PACKET_FIELD_ERROR(nuke_pop_loss_pct);
4705 }
4706#ifdef FREECIV_JSON_CONNECTION
4707 field_addr.name = "nuke_defender_survival_chance_pct";
4708#endif /* FREECIV_JSON_CONNECTION */
4709 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_defender_survival_chance_pct)) {
4710 RECEIVE_PACKET_FIELD_ERROR(nuke_defender_survival_chance_pct);
4711 }
4712#ifdef FREECIV_JSON_CONNECTION
4713 field_addr.name = "min_city_center_output";
4714#endif /* FREECIV_JSON_CONNECTION */
4715 {
4716 int i;
4717
4718#ifdef FREECIV_JSON_CONNECTION
4719 /* Enter array. */
4720 field_addr.sub_location = plocation_elem_new(0);
4721#endif /* FREECIV_JSON_CONNECTION */
4722
4723 for (i = 0; i < O_LAST; i++) {
4724#ifdef FREECIV_JSON_CONNECTION
4725 field_addr.sub_location->number = i;
4726#endif /* FREECIV_JSON_CONNECTION */
4727 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_city_center_output[i])) {
4728 RECEIVE_PACKET_FIELD_ERROR(min_city_center_output);
4729 }
4730 }
4731
4732#ifdef FREECIV_JSON_CONNECTION
4733 /* Exit array. */
4734 FC_FREE(field_addr.sub_location);
4735#endif /* FREECIV_JSON_CONNECTION */
4736 }
4737#ifdef FREECIV_JSON_CONNECTION
4738 field_addr.name = "muuk_food_wipe";
4739#endif /* FREECIV_JSON_CONNECTION */
4740 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_food_wipe)) {
4741 RECEIVE_PACKET_FIELD_ERROR(muuk_food_wipe);
4742 }
4743#ifdef FREECIV_JSON_CONNECTION
4744 field_addr.name = "muuk_gold_wipe";
4745#endif /* FREECIV_JSON_CONNECTION */
4746 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_gold_wipe)) {
4747 RECEIVE_PACKET_FIELD_ERROR(muuk_gold_wipe);
4748 }
4749#ifdef FREECIV_JSON_CONNECTION
4750 field_addr.name = "muuk_shield_wipe";
4751#endif /* FREECIV_JSON_CONNECTION */
4752 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_shield_wipe)) {
4753 RECEIVE_PACKET_FIELD_ERROR(muuk_shield_wipe);
4754 }
4755#ifdef FREECIV_JSON_CONNECTION
4756 field_addr.name = "notradesize";
4757#endif /* FREECIV_JSON_CONNECTION */
4758 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->notradesize)) {
4759 RECEIVE_PACKET_FIELD_ERROR(notradesize);
4760 }
4761#ifdef FREECIV_JSON_CONNECTION
4762 field_addr.name = "nuclear_winter";
4763#endif /* FREECIV_JSON_CONNECTION */
4764 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->nuclear_winter)) {
4765 RECEIVE_PACKET_FIELD_ERROR(nuclear_winter);
4766 }
4767#ifdef FREECIV_JSON_CONNECTION
4768 field_addr.name = "nuclearwinter";
4769#endif /* FREECIV_JSON_CONNECTION */
4770 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->nuclearwinter)) {
4771 RECEIVE_PACKET_FIELD_ERROR(nuclearwinter);
4772 }
4773#ifdef FREECIV_JSON_CONNECTION
4774 field_addr.name = "phase";
4775#endif /* FREECIV_JSON_CONNECTION */
4776 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
4777 RECEIVE_PACKET_FIELD_ERROR(phase);
4778 }
4779#ifdef FREECIV_JSON_CONNECTION
4780 field_addr.name = "phase_mode";
4781#endif /* FREECIV_JSON_CONNECTION */
4782 {
4783 int readin;
4784
4785 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4786 RECEIVE_PACKET_FIELD_ERROR(phase_mode);
4787 }
4788 real_packet->phase_mode = readin;
4789 }
4790#ifdef FREECIV_JSON_CONNECTION
4791 field_addr.name = "pillage_select";
4792#endif /* FREECIV_JSON_CONNECTION */
4793 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->pillage_select)) {
4794 RECEIVE_PACKET_FIELD_ERROR(pillage_select);
4795 }
4796#ifdef FREECIV_JSON_CONNECTION
4797 field_addr.name = "steal_maps_reveals_all_cities";
4798#endif /* FREECIV_JSON_CONNECTION */
4799 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->steal_maps_reveals_all_cities)) {
4800 RECEIVE_PACKET_FIELD_ERROR(steal_maps_reveals_all_cities);
4801 }
4802#ifdef FREECIV_JSON_CONNECTION
4803 field_addr.name = "poison_empties_food_stock";
4804#endif /* FREECIV_JSON_CONNECTION */
4805 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->poison_empties_food_stock)) {
4806 RECEIVE_PACKET_FIELD_ERROR(poison_empties_food_stock);
4807 }
4808#ifdef FREECIV_JSON_CONNECTION
4809 field_addr.name = "tech_steal_allow_holes";
4810#endif /* FREECIV_JSON_CONNECTION */
4811 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_steal_allow_holes)) {
4812 RECEIVE_PACKET_FIELD_ERROR(tech_steal_allow_holes);
4813 }
4814#ifdef FREECIV_JSON_CONNECTION
4815 field_addr.name = "tech_trade_allow_holes";
4816#endif /* FREECIV_JSON_CONNECTION */
4817 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_trade_allow_holes)) {
4818 RECEIVE_PACKET_FIELD_ERROR(tech_trade_allow_holes);
4819 }
4820#ifdef FREECIV_JSON_CONNECTION
4821 field_addr.name = "tech_trade_loss_allow_holes";
4822#endif /* FREECIV_JSON_CONNECTION */
4823 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_trade_loss_allow_holes)) {
4824 RECEIVE_PACKET_FIELD_ERROR(tech_trade_loss_allow_holes);
4825 }
4826#ifdef FREECIV_JSON_CONNECTION
4827 field_addr.name = "tech_parasite_allow_holes";
4828#endif /* FREECIV_JSON_CONNECTION */
4829 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_parasite_allow_holes)) {
4830 RECEIVE_PACKET_FIELD_ERROR(tech_parasite_allow_holes);
4831 }
4832#ifdef FREECIV_JSON_CONNECTION
4833 field_addr.name = "tech_loss_allow_holes";
4834#endif /* FREECIV_JSON_CONNECTION */
4835 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_loss_allow_holes)) {
4836 RECEIVE_PACKET_FIELD_ERROR(tech_loss_allow_holes);
4837 }
4838#ifdef FREECIV_JSON_CONNECTION
4839 field_addr.name = "rapturedelay";
4840#endif /* FREECIV_JSON_CONNECTION */
4841 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapturedelay)) {
4842 RECEIVE_PACKET_FIELD_ERROR(rapturedelay);
4843 }
4844#ifdef FREECIV_JSON_CONNECTION
4845 field_addr.name = "disasters";
4846#endif /* FREECIV_JSON_CONNECTION */
4847 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disasters)) {
4848 RECEIVE_PACKET_FIELD_ERROR(disasters);
4849 }
4850#ifdef FREECIV_JSON_CONNECTION
4851 field_addr.name = "restrictinfra";
4852#endif /* FREECIV_JSON_CONNECTION */
4853 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->restrictinfra)) {
4854 RECEIVE_PACKET_FIELD_ERROR(restrictinfra);
4855 }
4856#ifdef FREECIV_JSON_CONNECTION
4857 field_addr.name = "unreachable_protects";
4858#endif /* FREECIV_JSON_CONNECTION */
4859 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unreachable_protects)) {
4860 RECEIVE_PACKET_FIELD_ERROR(unreachable_protects);
4861 }
4862#ifdef FREECIV_JSON_CONNECTION
4863 field_addr.name = "sciencebox";
4864#endif /* FREECIV_JSON_CONNECTION */
4865 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->sciencebox)) {
4866 RECEIVE_PACKET_FIELD_ERROR(sciencebox);
4867 }
4868#ifdef FREECIV_JSON_CONNECTION
4869 field_addr.name = "shieldbox";
4870#endif /* FREECIV_JSON_CONNECTION */
4871 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->shieldbox)) {
4872 RECEIVE_PACKET_FIELD_ERROR(shieldbox);
4873 }
4874#ifdef FREECIV_JSON_CONNECTION
4875 field_addr.name = "skill_level";
4876#endif /* FREECIV_JSON_CONNECTION */
4877 {
4878 int readin;
4879
4880 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4881 RECEIVE_PACKET_FIELD_ERROR(skill_level);
4882 }
4883 real_packet->skill_level = readin;
4884 }
4885#ifdef FREECIV_JSON_CONNECTION
4886 field_addr.name = "victory_conditions";
4887#endif /* FREECIV_JSON_CONNECTION */
4888 {
4889 int readin;
4890
4891 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4892 RECEIVE_PACKET_FIELD_ERROR(victory_conditions);
4893 }
4894 real_packet->victory_conditions = readin;
4895 }
4896#ifdef FREECIV_JSON_CONNECTION
4897 field_addr.name = "team_pooled_research";
4898#endif /* FREECIV_JSON_CONNECTION */
4899 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->team_pooled_research)) {
4900 RECEIVE_PACKET_FIELD_ERROR(team_pooled_research);
4901 }
4902#ifdef FREECIV_JSON_CONNECTION
4903 field_addr.name = "tech";
4904#endif /* FREECIV_JSON_CONNECTION */
4905 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->tech)) {
4906 RECEIVE_PACKET_FIELD_ERROR(tech);
4907 }
4908#ifdef FREECIV_JSON_CONNECTION
4909 field_addr.name = "tech_cost_style";
4910#endif /* FREECIV_JSON_CONNECTION */
4911 {
4912 int readin;
4913
4914 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4915 RECEIVE_PACKET_FIELD_ERROR(tech_cost_style);
4916 }
4917 real_packet->tech_cost_style = readin;
4918 }
4919#ifdef FREECIV_JSON_CONNECTION
4920 field_addr.name = "tech_leakage";
4921#endif /* FREECIV_JSON_CONNECTION */
4922 {
4923 int readin;
4924
4925 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4926 RECEIVE_PACKET_FIELD_ERROR(tech_leakage);
4927 }
4928 real_packet->tech_leakage = readin;
4929 }
4930#ifdef FREECIV_JSON_CONNECTION
4931 field_addr.name = "tech_upkeep_divider";
4932#endif /* FREECIV_JSON_CONNECTION */
4933 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep_divider)) {
4934 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_divider);
4935 }
4936#ifdef FREECIV_JSON_CONNECTION
4937 field_addr.name = "tech_upkeep_style";
4938#endif /* FREECIV_JSON_CONNECTION */
4939 {
4940 int readin;
4941
4942 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4943 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_style);
4944 }
4945 real_packet->tech_upkeep_style = readin;
4946 }
4947#ifdef FREECIV_JSON_CONNECTION
4948 field_addr.name = "techloss_forgiveness";
4949#endif /* FREECIV_JSON_CONNECTION */
4950 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->techloss_forgiveness)) {
4951 RECEIVE_PACKET_FIELD_ERROR(techloss_forgiveness);
4952 }
4953#ifdef FREECIV_JSON_CONNECTION
4954 field_addr.name = "free_tech_method";
4955#endif /* FREECIV_JSON_CONNECTION */
4956 {
4957 int readin;
4958
4959 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4960 RECEIVE_PACKET_FIELD_ERROR(free_tech_method);
4961 }
4962 real_packet->free_tech_method = readin;
4963 }
4964#ifdef FREECIV_JSON_CONNECTION
4965 field_addr.name = "gameloss_style";
4966#endif /* FREECIV_JSON_CONNECTION */
4967 {
4968 int readin;
4969
4970 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4971 RECEIVE_PACKET_FIELD_ERROR(gameloss_style);
4972 }
4973 real_packet->gameloss_style = readin;
4974 }
4975#ifdef FREECIV_JSON_CONNECTION
4976 field_addr.name = "timeout";
4977#endif /* FREECIV_JSON_CONNECTION */
4978 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->timeout)) {
4979 RECEIVE_PACKET_FIELD_ERROR(timeout);
4980 }
4981#ifdef FREECIV_JSON_CONNECTION
4982 field_addr.name = "first_timeout";
4983#endif /* FREECIV_JSON_CONNECTION */
4984 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->first_timeout)) {
4985 RECEIVE_PACKET_FIELD_ERROR(first_timeout);
4986 }
4987#ifdef FREECIV_JSON_CONNECTION
4988 field_addr.name = "tired_attack";
4989#endif /* FREECIV_JSON_CONNECTION */
4990 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tired_attack)) {
4991 RECEIVE_PACKET_FIELD_ERROR(tired_attack);
4992 }
4993#ifdef FREECIV_JSON_CONNECTION
4994 field_addr.name = "trademindist";
4995#endif /* FREECIV_JSON_CONNECTION */
4996 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trademindist)) {
4997 RECEIVE_PACKET_FIELD_ERROR(trademindist);
4998 }
4999#ifdef FREECIV_JSON_CONNECTION
5000 field_addr.name = "trade_revenue_style";
5001#endif /* FREECIV_JSON_CONNECTION */
5002 {
5003 int readin;
5004
5005 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5006 RECEIVE_PACKET_FIELD_ERROR(trade_revenue_style);
5007 }
5008 real_packet->trade_revenue_style = readin;
5009 }
5010#ifdef FREECIV_JSON_CONNECTION
5011 field_addr.name = "trading_city";
5012#endif /* FREECIV_JSON_CONNECTION */
5013 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_city)) {
5014 RECEIVE_PACKET_FIELD_ERROR(trading_city);
5015 }
5016#ifdef FREECIV_JSON_CONNECTION
5017 field_addr.name = "trading_gold";
5018#endif /* FREECIV_JSON_CONNECTION */
5019 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_gold)) {
5020 RECEIVE_PACKET_FIELD_ERROR(trading_gold);
5021 }
5022#ifdef FREECIV_JSON_CONNECTION
5023 field_addr.name = "trading_tech";
5024#endif /* FREECIV_JSON_CONNECTION */
5025 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_tech)) {
5026 RECEIVE_PACKET_FIELD_ERROR(trading_tech);
5027 }
5028#ifdef FREECIV_JSON_CONNECTION
5029 field_addr.name = "turn";
5030#endif /* FREECIV_JSON_CONNECTION */
5031 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
5032 RECEIVE_PACKET_FIELD_ERROR(turn);
5033 }
5034#ifdef FREECIV_JSON_CONNECTION
5035 field_addr.name = "warminglevel";
5036#endif /* FREECIV_JSON_CONNECTION */
5037 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->warminglevel)) {
5038 RECEIVE_PACKET_FIELD_ERROR(warminglevel);
5039 }
5040#ifdef FREECIV_JSON_CONNECTION
5041 field_addr.name = "year";
5042#endif /* FREECIV_JSON_CONNECTION */
5043 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
5044 RECEIVE_PACKET_FIELD_ERROR(year);
5045 }
5046#ifdef FREECIV_JSON_CONNECTION
5047 field_addr.name = "year_0_hack";
5048#endif /* FREECIV_JSON_CONNECTION */
5049 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->year_0_hack)) {
5050 RECEIVE_PACKET_FIELD_ERROR(year_0_hack);
5051 }
5052#ifdef FREECIV_JSON_CONNECTION
5053 field_addr.name = "top_cities_count";
5054#endif /* FREECIV_JSON_CONNECTION */
5055 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->top_cities_count)) {
5056 RECEIVE_PACKET_FIELD_ERROR(top_cities_count);
5057 }
5058#ifdef FREECIV_JSON_CONNECTION
5059 field_addr.name = "fragment_count";
5060#endif /* FREECIV_JSON_CONNECTION */
5061 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragment_count)) {
5062 RECEIVE_PACKET_FIELD_ERROR(fragment_count);
5063 }
5064#ifdef FREECIV_JSON_CONNECTION
5065 field_addr.name = "civil_war_enabled";
5066#endif /* FREECIV_JSON_CONNECTION */
5067 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->civil_war_enabled)) {
5068 RECEIVE_PACKET_FIELD_ERROR(civil_war_enabled);
5069 }
5070#ifdef FREECIV_JSON_CONNECTION
5071 field_addr.name = "civil_war_bonus_celebrating";
5072#endif /* FREECIV_JSON_CONNECTION */
5073 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_celebrating)) {
5074 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_celebrating);
5075 }
5076#ifdef FREECIV_JSON_CONNECTION
5077 field_addr.name = "civil_war_bonus_unhappy";
5078#endif /* FREECIV_JSON_CONNECTION */
5079 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_unhappy)) {
5080 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_unhappy);
5081 }
5082#ifdef FREECIV_JSON_CONNECTION
5083 field_addr.name = "granularity";
5084#endif /* FREECIV_JSON_CONNECTION */
5085 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granularity)) {
5086 RECEIVE_PACKET_FIELD_ERROR(granularity);
5087 }
5088#ifdef FREECIV_JSON_CONNECTION
5089 field_addr.name = "small_wonder_visibility";
5090#endif /* FREECIV_JSON_CONNECTION */
5091 {
5092 int readin;
5093
5094 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5095 RECEIVE_PACKET_FIELD_ERROR(small_wonder_visibility);
5096 }
5097 real_packet->small_wonder_visibility = readin;
5098 }
5099#endif
5100 log_packet_detailed("packet_game_info_100: got info about ()");
5101
5102#ifdef FREECIV_DELTA_PROTOCOL
5103 if (nullptr == *hash) {
5104 *hash = genhash_new_full(hash_packet_game_info_100, cmp_packet_game_info_100,
5105 nullptr, nullptr, nullptr, destroy_packet_game_info);
5106 }
5107
5108 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
5109 *real_packet = *old;
5110 } else {
5111 /* packet is already initialized empty */
5112 log_packet_detailed(" no old info");
5113 }
5114
5115 if (BV_ISSET(fields, 0)) {
5116 log_packet_detailed(" got field 'add_to_size_limit'");
5117#ifdef FREECIV_JSON_CONNECTION
5118 field_addr.name = "add_to_size_limit";
5119#endif /* FREECIV_JSON_CONNECTION */
5120 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->add_to_size_limit)) {
5121 RECEIVE_PACKET_FIELD_ERROR(add_to_size_limit);
5122 }
5123 }
5124 if (BV_ISSET(fields, 1)) {
5125 log_packet_detailed(" got field 'aifill'");
5126#ifdef FREECIV_JSON_CONNECTION
5127 field_addr.name = "aifill";
5128#endif /* FREECIV_JSON_CONNECTION */
5129 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->aifill)) {
5130 RECEIVE_PACKET_FIELD_ERROR(aifill);
5131 }
5132 }
5133 if (BV_ISSET(fields, 2)) {
5134 log_packet_detailed(" got field 'persistent_ready'");
5135#ifdef FREECIV_JSON_CONNECTION
5136 field_addr.name = "persistent_ready";
5137#endif /* FREECIV_JSON_CONNECTION */
5138 {
5139 int readin;
5140
5141 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5142 RECEIVE_PACKET_FIELD_ERROR(persistent_ready);
5143 }
5144 real_packet->persistent_ready = readin;
5145 }
5146 }
5147 if (BV_ISSET(fields, 3)) {
5148 log_packet_detailed(" got field 'airlifting_style'");
5149#ifdef FREECIV_JSON_CONNECTION
5150 field_addr.name = "airlifting_style";
5151#endif /* FREECIV_JSON_CONNECTION */
5152 {
5153 int readin;
5154
5155 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5156 RECEIVE_PACKET_FIELD_ERROR(airlifting_style);
5157 }
5158 real_packet->airlifting_style = readin;
5159 }
5160 }
5161 real_packet->airlift_from_always_enabled = BV_ISSET(fields, 4);
5162 real_packet->airlift_to_always_enabled = BV_ISSET(fields, 5);
5163 if (BV_ISSET(fields, 6)) {
5164 log_packet_detailed(" got field 'angrycitizen'");
5165#ifdef FREECIV_JSON_CONNECTION
5166 field_addr.name = "angrycitizen";
5167#endif /* FREECIV_JSON_CONNECTION */
5168 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->angrycitizen)) {
5169 RECEIVE_PACKET_FIELD_ERROR(angrycitizen);
5170 }
5171 }
5172 if (BV_ISSET(fields, 7)) {
5173 log_packet_detailed(" got field 'base_pollution'");
5174#ifdef FREECIV_JSON_CONNECTION
5175 field_addr.name = "base_pollution";
5176#endif /* FREECIV_JSON_CONNECTION */
5177 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->base_pollution)) {
5178 RECEIVE_PACKET_FIELD_ERROR(base_pollution);
5179 }
5180 }
5181 if (BV_ISSET(fields, 8)) {
5182 log_packet_detailed(" got field 'base_tech_cost'");
5183#ifdef FREECIV_JSON_CONNECTION
5184 field_addr.name = "base_tech_cost";
5185#endif /* FREECIV_JSON_CONNECTION */
5186 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->base_tech_cost)) {
5187 RECEIVE_PACKET_FIELD_ERROR(base_tech_cost);
5188 }
5189 }
5190 if (BV_ISSET(fields, 9)) {
5191 log_packet_detailed(" got field 'min_tech_cost'");
5192#ifdef FREECIV_JSON_CONNECTION
5193 field_addr.name = "min_tech_cost";
5194#endif /* FREECIV_JSON_CONNECTION */
5195 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_tech_cost)) {
5196 RECEIVE_PACKET_FIELD_ERROR(min_tech_cost);
5197 }
5198 }
5199 if (BV_ISSET(fields, 10)) {
5200 log_packet_detailed(" got field 'tech_leak_pct'");
5201#ifdef FREECIV_JSON_CONNECTION
5202 field_addr.name = "tech_leak_pct";
5203#endif /* FREECIV_JSON_CONNECTION */
5204 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_leak_pct)) {
5205 RECEIVE_PACKET_FIELD_ERROR(tech_leak_pct);
5206 }
5207 }
5208 if (BV_ISSET(fields, 11)) {
5209 log_packet_detailed(" got field 'border_city_radius_sq'");
5210#ifdef FREECIV_JSON_CONNECTION
5211 field_addr.name = "border_city_radius_sq";
5212#endif /* FREECIV_JSON_CONNECTION */
5213 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->border_city_radius_sq)) {
5214 RECEIVE_PACKET_FIELD_ERROR(border_city_radius_sq);
5215 }
5216 }
5217 if (BV_ISSET(fields, 12)) {
5218 log_packet_detailed(" got field 'border_size_effect'");
5219#ifdef FREECIV_JSON_CONNECTION
5220 field_addr.name = "border_size_effect";
5221#endif /* FREECIV_JSON_CONNECTION */
5222 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->border_size_effect)) {
5223 RECEIVE_PACKET_FIELD_ERROR(border_size_effect);
5224 }
5225 }
5226 if (BV_ISSET(fields, 13)) {
5227 log_packet_detailed(" got field 'border_city_permanent_radius_sq'");
5228#ifdef FREECIV_JSON_CONNECTION
5229 field_addr.name = "border_city_permanent_radius_sq";
5230#endif /* FREECIV_JSON_CONNECTION */
5231 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->border_city_permanent_radius_sq)) {
5232 RECEIVE_PACKET_FIELD_ERROR(border_city_permanent_radius_sq);
5233 }
5234 }
5235 if (BV_ISSET(fields, 14)) {
5236 log_packet_detailed(" got field 'borders'");
5237#ifdef FREECIV_JSON_CONNECTION
5238 field_addr.name = "borders";
5239#endif /* FREECIV_JSON_CONNECTION */
5240 {
5241 int readin;
5242
5243 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5244 RECEIVE_PACKET_FIELD_ERROR(borders);
5245 }
5246 real_packet->borders = readin;
5247 }
5248 }
5249 if (BV_ISSET(fields, 15)) {
5250 log_packet_detailed(" got field 'base_bribe_cost'");
5251#ifdef FREECIV_JSON_CONNECTION
5252 field_addr.name = "base_bribe_cost";
5253#endif /* FREECIV_JSON_CONNECTION */
5254 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->base_bribe_cost)) {
5255 RECEIVE_PACKET_FIELD_ERROR(base_bribe_cost);
5256 }
5257 }
5258 if (BV_ISSET(fields, 16)) {
5259 log_packet_detailed(" got field 'caravan_bonus_style'");
5260#ifdef FREECIV_JSON_CONNECTION
5261 field_addr.name = "caravan_bonus_style";
5262#endif /* FREECIV_JSON_CONNECTION */
5263 {
5264 int readin;
5265
5266 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5267 RECEIVE_PACKET_FIELD_ERROR(caravan_bonus_style);
5268 }
5269 real_packet->caravan_bonus_style = readin;
5270 }
5271 }
5272 if (BV_ISSET(fields, 17)) {
5273 log_packet_detailed(" got field 'culture_vic_points'");
5274#ifdef FREECIV_JSON_CONNECTION
5275 field_addr.name = "culture_vic_points";
5276#endif /* FREECIV_JSON_CONNECTION */
5277 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture_vic_points)) {
5278 RECEIVE_PACKET_FIELD_ERROR(culture_vic_points);
5279 }
5280 }
5281 if (BV_ISSET(fields, 18)) {
5282 log_packet_detailed(" got field 'culture_vic_lead'");
5283#ifdef FREECIV_JSON_CONNECTION
5284 field_addr.name = "culture_vic_lead";
5285#endif /* FREECIV_JSON_CONNECTION */
5286 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_vic_lead)) {
5287 RECEIVE_PACKET_FIELD_ERROR(culture_vic_lead);
5288 }
5289 }
5290 if (BV_ISSET(fields, 19)) {
5291 log_packet_detailed(" got field 'culture_migration_pml'");
5292#ifdef FREECIV_JSON_CONNECTION
5293 field_addr.name = "culture_migration_pml";
5294#endif /* FREECIV_JSON_CONNECTION */
5295 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_migration_pml)) {
5296 RECEIVE_PACKET_FIELD_ERROR(culture_migration_pml);
5297 }
5298 }
5299 if (BV_ISSET(fields, 20)) {
5300 log_packet_detailed(" got field 'history_interest_pml'");
5301#ifdef FREECIV_JSON_CONNECTION
5302 field_addr.name = "history_interest_pml";
5303#endif /* FREECIV_JSON_CONNECTION */
5304 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->history_interest_pml)) {
5305 RECEIVE_PACKET_FIELD_ERROR(history_interest_pml);
5306 }
5307 }
5308 if (BV_ISSET(fields, 21)) {
5309 log_packet_detailed(" got field 'world_peace_turns'");
5310#ifdef FREECIV_JSON_CONNECTION
5311 field_addr.name = "world_peace_turns";
5312#endif /* FREECIV_JSON_CONNECTION */
5313 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->world_peace_turns)) {
5314 RECEIVE_PACKET_FIELD_ERROR(world_peace_turns);
5315 }
5316 }
5317 if (BV_ISSET(fields, 22)) {
5318 log_packet_detailed(" got field 'celebratesize'");
5319#ifdef FREECIV_JSON_CONNECTION
5320 field_addr.name = "celebratesize";
5321#endif /* FREECIV_JSON_CONNECTION */
5322 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->celebratesize)) {
5323 RECEIVE_PACKET_FIELD_ERROR(celebratesize);
5324 }
5325 }
5326 real_packet->changable_tax = BV_ISSET(fields, 23);
5327 if (BV_ISSET(fields, 24)) {
5328 log_packet_detailed(" got field 'pop_report_zeroes'");
5329#ifdef FREECIV_JSON_CONNECTION
5330 field_addr.name = "pop_report_zeroes";
5331#endif /* FREECIV_JSON_CONNECTION */
5332 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_report_zeroes)) {
5333 RECEIVE_PACKET_FIELD_ERROR(pop_report_zeroes);
5334 }
5335 }
5336 real_packet->citizen_nationality = BV_ISSET(fields, 25);
5337 real_packet->unit_builders_nationality = BV_ISSET(fields, 26);
5338 if (BV_ISSET(fields, 27)) {
5339 log_packet_detailed(" got field 'citizen_convert_speed'");
5340#ifdef FREECIV_JSON_CONNECTION
5341 field_addr.name = "citizen_convert_speed";
5342#endif /* FREECIV_JSON_CONNECTION */
5343 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->citizen_convert_speed)) {
5344 RECEIVE_PACKET_FIELD_ERROR(citizen_convert_speed);
5345 }
5346 }
5347 if (BV_ISSET(fields, 28)) {
5348 log_packet_detailed(" got field 'conquest_convert_pct'");
5349#ifdef FREECIV_JSON_CONNECTION
5350 field_addr.name = "conquest_convert_pct";
5351#endif /* FREECIV_JSON_CONNECTION */
5352 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->conquest_convert_pct)) {
5353 RECEIVE_PACKET_FIELD_ERROR(conquest_convert_pct);
5354 }
5355 }
5356 if (BV_ISSET(fields, 29)) {
5357 log_packet_detailed(" got field 'citizen_partisans_pct'");
5358#ifdef FREECIV_JSON_CONNECTION
5359 field_addr.name = "citizen_partisans_pct";
5360#endif /* FREECIV_JSON_CONNECTION */
5361 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citizen_partisans_pct)) {
5362 RECEIVE_PACKET_FIELD_ERROR(citizen_partisans_pct);
5363 }
5364 }
5365 if (BV_ISSET(fields, 30)) {
5366 log_packet_detailed(" got field 'citymindist'");
5367#ifdef FREECIV_JSON_CONNECTION
5368 field_addr.name = "citymindist";
5369#endif /* FREECIV_JSON_CONNECTION */
5370 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citymindist)) {
5371 RECEIVE_PACKET_FIELD_ERROR(citymindist);
5372 }
5373 }
5374 if (BV_ISSET(fields, 31)) {
5375 log_packet_detailed(" got field 'cooling'");
5376#ifdef FREECIV_JSON_CONNECTION
5377 field_addr.name = "cooling";
5378#endif /* FREECIV_JSON_CONNECTION */
5379 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cooling)) {
5380 RECEIVE_PACKET_FIELD_ERROR(cooling);
5381 }
5382 }
5383 if (BV_ISSET(fields, 32)) {
5384 log_packet_detailed(" got field 'coolinglevel'");
5385#ifdef FREECIV_JSON_CONNECTION
5386 field_addr.name = "coolinglevel";
5387#endif /* FREECIV_JSON_CONNECTION */
5388 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->coolinglevel)) {
5389 RECEIVE_PACKET_FIELD_ERROR(coolinglevel);
5390 }
5391 }
5392 if (BV_ISSET(fields, 33)) {
5393 log_packet_detailed(" got field 'diplchance_initial_odds'");
5394#ifdef FREECIV_JSON_CONNECTION
5395 field_addr.name = "diplchance_initial_odds";
5396#endif /* FREECIV_JSON_CONNECTION */
5397 if (!DIO_BV_GET(&din, &field_addr, real_packet->diplchance_initial_odds)) {
5398 RECEIVE_PACKET_FIELD_ERROR(diplchance_initial_odds);
5399 }
5400 }
5401 if (BV_ISSET(fields, 34)) {
5402 log_packet_detailed(" got field 'diplomacy'");
5403#ifdef FREECIV_JSON_CONNECTION
5404 field_addr.name = "diplomacy";
5405#endif /* FREECIV_JSON_CONNECTION */
5406 {
5407 int readin;
5408
5409 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5410 RECEIVE_PACKET_FIELD_ERROR(diplomacy);
5411 }
5412 real_packet->diplomacy = readin;
5413 }
5414 }
5415 real_packet->fogofwar = BV_ISSET(fields, 35);
5416 if (BV_ISSET(fields, 36)) {
5417 log_packet_detailed(" got field 'food_cost'");
5418#ifdef FREECIV_JSON_CONNECTION
5419 field_addr.name = "food_cost";
5420#endif /* FREECIV_JSON_CONNECTION */
5421 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_cost)) {
5422 RECEIVE_PACKET_FIELD_ERROR(food_cost);
5423 }
5424 }
5425 if (BV_ISSET(fields, 37)) {
5426 log_packet_detailed(" got field 'foodbox'");
5427#ifdef FREECIV_JSON_CONNECTION
5428 field_addr.name = "foodbox";
5429#endif /* FREECIV_JSON_CONNECTION */
5430 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->foodbox)) {
5431 RECEIVE_PACKET_FIELD_ERROR(foodbox);
5432 }
5433 }
5434 if (BV_ISSET(fields, 38)) {
5435 log_packet_detailed(" got field 'forced_gold'");
5436#ifdef FREECIV_JSON_CONNECTION
5437 field_addr.name = "forced_gold";
5438#endif /* FREECIV_JSON_CONNECTION */
5439 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_gold)) {
5440 RECEIVE_PACKET_FIELD_ERROR(forced_gold);
5441 }
5442 }
5443 if (BV_ISSET(fields, 39)) {
5444 log_packet_detailed(" got field 'forced_luxury'");
5445#ifdef FREECIV_JSON_CONNECTION
5446 field_addr.name = "forced_luxury";
5447#endif /* FREECIV_JSON_CONNECTION */
5448 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_luxury)) {
5449 RECEIVE_PACKET_FIELD_ERROR(forced_luxury);
5450 }
5451 }
5452 if (BV_ISSET(fields, 40)) {
5453 log_packet_detailed(" got field 'forced_science'");
5454#ifdef FREECIV_JSON_CONNECTION
5455 field_addr.name = "forced_science";
5456#endif /* FREECIV_JSON_CONNECTION */
5457 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_science)) {
5458 RECEIVE_PACKET_FIELD_ERROR(forced_science);
5459 }
5460 }
5461 if (BV_ISSET(fields, 41)) {
5462 log_packet_detailed(" got field 'fulltradesize'");
5463#ifdef FREECIV_JSON_CONNECTION
5464 field_addr.name = "fulltradesize";
5465#endif /* FREECIV_JSON_CONNECTION */
5466 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fulltradesize)) {
5467 RECEIVE_PACKET_FIELD_ERROR(fulltradesize);
5468 }
5469 }
5470 if (BV_ISSET(fields, 42)) {
5471 log_packet_detailed(" got field 'trade_world_rel_pct'");
5472#ifdef FREECIV_JSON_CONNECTION
5473 field_addr.name = "trade_world_rel_pct";
5474#endif /* FREECIV_JSON_CONNECTION */
5475 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_world_rel_pct)) {
5476 RECEIVE_PACKET_FIELD_ERROR(trade_world_rel_pct);
5477 }
5478 }
5479 if (BV_ISSET(fields, 43)) {
5480 log_packet_detailed(" got field 'min_trade_route_val'");
5481#ifdef FREECIV_JSON_CONNECTION
5482 field_addr.name = "min_trade_route_val";
5483#endif /* FREECIV_JSON_CONNECTION */
5484 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_trade_route_val)) {
5485 RECEIVE_PACKET_FIELD_ERROR(min_trade_route_val);
5486 }
5487 }
5488 real_packet->reveal_trade_partner = BV_ISSET(fields, 44);
5489 if (BV_ISSET(fields, 45)) {
5490 log_packet_detailed(" got field 'goods_selection'");
5491#ifdef FREECIV_JSON_CONNECTION
5492 field_addr.name = "goods_selection";
5493#endif /* FREECIV_JSON_CONNECTION */
5494 {
5495 int readin;
5496
5497 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5498 RECEIVE_PACKET_FIELD_ERROR(goods_selection);
5499 }
5500 real_packet->goods_selection = readin;
5501 }
5502 }
5503 if (BV_ISSET(fields, 46)) {
5504 log_packet_detailed(" got field 'global_advance_count'");
5505#ifdef FREECIV_JSON_CONNECTION
5506 field_addr.name = "global_advance_count";
5507#endif /* FREECIV_JSON_CONNECTION */
5508 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_advance_count)) {
5509 RECEIVE_PACKET_FIELD_ERROR(global_advance_count);
5510 }
5511 }
5512 if (BV_ISSET(fields, 47)) {
5513 log_packet_detailed(" got field 'global_advances'");
5514#ifdef FREECIV_JSON_CONNECTION
5515 field_addr.name = "global_advances";
5516#endif /* FREECIV_JSON_CONNECTION */
5517 {
5518#ifdef FREECIV_JSON_CONNECTION
5519 int count_i;
5520
5521 /* Enter array. */
5522 field_addr.sub_location = plocation_elem_new(0);
5523
5524 for (count_i = 0;; count_i++) {
5525 int i;
5526
5527 field_addr.sub_location->number = count_i;
5528
5529 /* Enter diff array element (start at the index address). */
5530 field_addr.sub_location->sub_location = plocation_elem_new(0);
5531#else /* FREECIV_JSON_CONNECTION */
5532 while (TRUE) {
5533 int i;
5534#endif /* FREECIV_JSON_CONNECTION */
5535
5536 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
5537 RECEIVE_PACKET_FIELD_ERROR(global_advances);
5538 }
5539 if (i == MAX_UINT16) {
5540#ifdef FREECIV_JSON_CONNECTION
5541 /* Exit diff array element. */
5542 FC_FREE(field_addr.sub_location->sub_location);
5543
5544 /* Exit diff array. */
5545 FC_FREE(field_addr.sub_location);
5546#endif /* FREECIV_JSON_CONNECTION */
5547
5548 break;
5549 }
5550 if (i > A_LAST) {
5551 RECEIVE_PACKET_FIELD_ERROR(global_advances,
5552 ": unexpected value %d "
5553 "(> A_LAST) in array diff",
5554 i);
5555 } else {
5556#ifdef FREECIV_JSON_CONNECTION
5557 /* Content address. */
5558 field_addr.sub_location->sub_location->number = 1;
5559#endif /* FREECIV_JSON_CONNECTION */
5560 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_advances[i])) {
5561 RECEIVE_PACKET_FIELD_ERROR(global_advances);
5562 }
5563 }
5564
5565#ifdef FREECIV_JSON_CONNECTION
5566 /* Exit diff array element. */
5567 FC_FREE(field_addr.sub_location->sub_location);
5568#endif /* FREECIV_JSON_CONNECTION */
5569 }
5570
5571#ifdef FREECIV_JSON_CONNECTION
5572 /* Exit array. */
5573 FC_FREE(field_addr.sub_location);
5574#endif /* FREECIV_JSON_CONNECTION */
5575 }
5576 }
5577 real_packet->global_warming = BV_ISSET(fields, 48);
5578 if (BV_ISSET(fields, 49)) {
5579 log_packet_detailed(" got field 'globalwarming'");
5580#ifdef FREECIV_JSON_CONNECTION
5581 field_addr.name = "globalwarming";
5582#endif /* FREECIV_JSON_CONNECTION */
5583 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->globalwarming)) {
5584 RECEIVE_PACKET_FIELD_ERROR(globalwarming);
5585 }
5586 }
5587 if (BV_ISSET(fields, 50)) {
5588 log_packet_detailed(" got field 'gold'");
5589#ifdef FREECIV_JSON_CONNECTION
5590 field_addr.name = "gold";
5591#endif /* FREECIV_JSON_CONNECTION */
5592 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
5593 RECEIVE_PACKET_FIELD_ERROR(gold);
5594 }
5595 }
5596 if (BV_ISSET(fields, 51)) {
5597 log_packet_detailed(" got field 'gold_upkeep_style'");
5598#ifdef FREECIV_JSON_CONNECTION
5599 field_addr.name = "gold_upkeep_style";
5600#endif /* FREECIV_JSON_CONNECTION */
5601 {
5602 int readin;
5603
5604 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5605 RECEIVE_PACKET_FIELD_ERROR(gold_upkeep_style);
5606 }
5607 real_packet->gold_upkeep_style = readin;
5608 }
5609 }
5610 real_packet->homeless_gold_upkeep = BV_ISSET(fields, 52);
5611 if (BV_ISSET(fields, 53)) {
5612 log_packet_detailed(" got field 'infrapoints'");
5613#ifdef FREECIV_JSON_CONNECTION
5614 field_addr.name = "infrapoints";
5615#endif /* FREECIV_JSON_CONNECTION */
5616 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
5617 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
5618 }
5619 }
5620 if (BV_ISSET(fields, 54)) {
5621 log_packet_detailed(" got field 'revolentype'");
5622#ifdef FREECIV_JSON_CONNECTION
5623 field_addr.name = "revolentype";
5624#endif /* FREECIV_JSON_CONNECTION */
5625 {
5626 int readin;
5627
5628 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5629 RECEIVE_PACKET_FIELD_ERROR(revolentype);
5630 }
5631 real_packet->revolentype = readin;
5632 }
5633 }
5634 if (BV_ISSET(fields, 55)) {
5635 log_packet_detailed(" got field 'default_government_id'");
5636#ifdef FREECIV_JSON_CONNECTION
5637 field_addr.name = "default_government_id";
5638#endif /* FREECIV_JSON_CONNECTION */
5639 {
5640 int readin;
5641
5642 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
5643 RECEIVE_PACKET_FIELD_ERROR(default_government_id);
5644 }
5645 real_packet->default_government_id = readin;
5646 }
5647 }
5648 if (BV_ISSET(fields, 56)) {
5649 log_packet_detailed(" got field 'government_during_revolution_id'");
5650#ifdef FREECIV_JSON_CONNECTION
5651 field_addr.name = "government_during_revolution_id";
5652#endif /* FREECIV_JSON_CONNECTION */
5653 {
5654 int readin;
5655
5656 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
5657 RECEIVE_PACKET_FIELD_ERROR(government_during_revolution_id);
5658 }
5659 real_packet->government_during_revolution_id = readin;
5660 }
5661 }
5662 if (BV_ISSET(fields, 57)) {
5663 log_packet_detailed(" got field 'granary_food_inc'");
5664#ifdef FREECIV_JSON_CONNECTION
5665 field_addr.name = "granary_food_inc";
5666#endif /* FREECIV_JSON_CONNECTION */
5667 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_inc)) {
5668 RECEIVE_PACKET_FIELD_ERROR(granary_food_inc);
5669 }
5670 }
5671 if (BV_ISSET(fields, 58)) {
5672 log_packet_detailed(" got field 'granary_food_ini'");
5673#ifdef FREECIV_JSON_CONNECTION
5674 field_addr.name = "granary_food_ini";
5675#endif /* FREECIV_JSON_CONNECTION */
5676 {
5677 int i;
5678
5679#ifdef FREECIV_JSON_CONNECTION
5680 /* Enter array. */
5681 field_addr.sub_location = plocation_elem_new(0);
5682#endif /* FREECIV_JSON_CONNECTION */
5683
5684 for (i = 0; i < MAX_GRANARY_INIS; i++) {
5685#ifdef FREECIV_JSON_CONNECTION
5686 field_addr.sub_location->number = i;
5687#endif /* FREECIV_JSON_CONNECTION */
5688 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_ini[i])) {
5689 RECEIVE_PACKET_FIELD_ERROR(granary_food_ini);
5690 }
5691 }
5692
5693#ifdef FREECIV_JSON_CONNECTION
5694 /* Exit array. */
5695 FC_FREE(field_addr.sub_location);
5696#endif /* FREECIV_JSON_CONNECTION */
5697 }
5698 }
5699 if (BV_ISSET(fields, 59)) {
5700 log_packet_detailed(" got field 'granary_num_inis'");
5701#ifdef FREECIV_JSON_CONNECTION
5702 field_addr.name = "granary_num_inis";
5703#endif /* FREECIV_JSON_CONNECTION */
5704 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->granary_num_inis)) {
5705 RECEIVE_PACKET_FIELD_ERROR(granary_num_inis);
5706 }
5707 }
5708 if (BV_ISSET(fields, 60)) {
5709 log_packet_detailed(" got field 'great_wonder_owners'");
5710#ifdef FREECIV_JSON_CONNECTION
5711 field_addr.name = "great_wonder_owners";
5712#endif /* FREECIV_JSON_CONNECTION */
5713 {
5714#ifdef FREECIV_JSON_CONNECTION
5715 int count_i;
5716
5717 /* Enter array. */
5718 field_addr.sub_location = plocation_elem_new(0);
5719
5720 for (count_i = 0;; count_i++) {
5721 int i;
5722
5723 field_addr.sub_location->number = count_i;
5724
5725 /* Enter diff array element (start at the index address). */
5726 field_addr.sub_location->sub_location = plocation_elem_new(0);
5727#else /* FREECIV_JSON_CONNECTION */
5728 while (TRUE) {
5729 int i;
5730#endif /* FREECIV_JSON_CONNECTION */
5731
5732 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
5733 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
5734 }
5735 if (i == MAX_UINT16) {
5736#ifdef FREECIV_JSON_CONNECTION
5737 /* Exit diff array element. */
5738 FC_FREE(field_addr.sub_location->sub_location);
5739
5740 /* Exit diff array. */
5741 FC_FREE(field_addr.sub_location);
5742#endif /* FREECIV_JSON_CONNECTION */
5743
5744 break;
5745 }
5746 if (i > B_LAST) {
5747 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners,
5748 ": unexpected value %d "
5749 "(> B_LAST) in array diff",
5750 i);
5751 } else {
5752#ifdef FREECIV_JSON_CONNECTION
5753 /* Content address. */
5754 field_addr.sub_location->sub_location->number = 1;
5755#endif /* FREECIV_JSON_CONNECTION */
5756 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->great_wonder_owners[i])) {
5757 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
5758 }
5759 }
5760
5761#ifdef FREECIV_JSON_CONNECTION
5762 /* Exit diff array element. */
5763 FC_FREE(field_addr.sub_location->sub_location);
5764#endif /* FREECIV_JSON_CONNECTION */
5765 }
5766
5767#ifdef FREECIV_JSON_CONNECTION
5768 /* Exit array. */
5769 FC_FREE(field_addr.sub_location);
5770#endif /* FREECIV_JSON_CONNECTION */
5771 }
5772 }
5773 if (BV_ISSET(fields, 61)) {
5774 log_packet_detailed(" got field 'happy_cost'");
5775#ifdef FREECIV_JSON_CONNECTION
5776 field_addr.name = "happy_cost";
5777#endif /* FREECIV_JSON_CONNECTION */
5778 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->happy_cost)) {
5779 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
5780 }
5781 }
5782 if (BV_ISSET(fields, 62)) {
5783 log_packet_detailed(" got field 'happyborders'");
5784#ifdef FREECIV_JSON_CONNECTION
5785 field_addr.name = "happyborders";
5786#endif /* FREECIV_JSON_CONNECTION */
5787 {
5788 int readin;
5789
5790 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5791 RECEIVE_PACKET_FIELD_ERROR(happyborders);
5792 }
5793 real_packet->happyborders = readin;
5794 }
5795 }
5796 if (BV_ISSET(fields, 63)) {
5797 log_packet_detailed(" got field 'heating'");
5798#ifdef FREECIV_JSON_CONNECTION
5799 field_addr.name = "heating";
5800#endif /* FREECIV_JSON_CONNECTION */
5801 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->heating)) {
5802 RECEIVE_PACKET_FIELD_ERROR(heating);
5803 }
5804 }
5805 if (BV_ISSET(fields, 64)) {
5806 log_packet_detailed(" got field 'illness_base_factor'");
5807#ifdef FREECIV_JSON_CONNECTION
5808 field_addr.name = "illness_base_factor";
5809#endif /* FREECIV_JSON_CONNECTION */
5810 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_base_factor)) {
5811 RECEIVE_PACKET_FIELD_ERROR(illness_base_factor);
5812 }
5813 }
5814 if (BV_ISSET(fields, 65)) {
5815 log_packet_detailed(" got field 'illness_min_size'");
5816#ifdef FREECIV_JSON_CONNECTION
5817 field_addr.name = "illness_min_size";
5818#endif /* FREECIV_JSON_CONNECTION */
5819 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->illness_min_size)) {
5820 RECEIVE_PACKET_FIELD_ERROR(illness_min_size);
5821 }
5822 }
5823 real_packet->illness_on = BV_ISSET(fields, 66);
5824 if (BV_ISSET(fields, 67)) {
5825 log_packet_detailed(" got field 'illness_pollution_factor'");
5826#ifdef FREECIV_JSON_CONNECTION
5827 field_addr.name = "illness_pollution_factor";
5828#endif /* FREECIV_JSON_CONNECTION */
5829 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_pollution_factor)) {
5830 RECEIVE_PACKET_FIELD_ERROR(illness_pollution_factor);
5831 }
5832 }
5833 if (BV_ISSET(fields, 68)) {
5834 log_packet_detailed(" got field 'illness_trade_infection'");
5835#ifdef FREECIV_JSON_CONNECTION
5836 field_addr.name = "illness_trade_infection";
5837#endif /* FREECIV_JSON_CONNECTION */
5838 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade_infection)) {
5839 RECEIVE_PACKET_FIELD_ERROR(illness_trade_infection);
5840 }
5841 }
5842 if (BV_ISSET(fields, 69)) {
5843 log_packet_detailed(" got field 'init_city_radius_sq'");
5844#ifdef FREECIV_JSON_CONNECTION
5845 field_addr.name = "init_city_radius_sq";
5846#endif /* FREECIV_JSON_CONNECTION */
5847 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_city_radius_sq)) {
5848 RECEIVE_PACKET_FIELD_ERROR(init_city_radius_sq);
5849 }
5850 }
5851 real_packet->is_edit_mode = BV_ISSET(fields, 70);
5852 real_packet->is_new_game = BV_ISSET(fields, 71);
5853 real_packet->killcitizen = BV_ISSET(fields, 72);
5854 real_packet->killstack = BV_ISSET(fields, 73);
5855 real_packet->only_killing_makes_veteran = BV_ISSET(fields, 74);
5856 real_packet->only_real_fight_makes_veteran = BV_ISSET(fields, 75);
5857 real_packet->combat_odds_scaled_veterancy = BV_ISSET(fields, 76);
5858 real_packet->damage_reduces_bombard_rate = BV_ISSET(fields, 77);
5859 if (BV_ISSET(fields, 78)) {
5860 log_packet_detailed(" got field 'low_firepower_badwallattacker'");
5861#ifdef FREECIV_JSON_CONNECTION
5862 field_addr.name = "low_firepower_badwallattacker";
5863#endif /* FREECIV_JSON_CONNECTION */
5864 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_badwallattacker)) {
5865 RECEIVE_PACKET_FIELD_ERROR(low_firepower_badwallattacker);
5866 }
5867 }
5868 if (BV_ISSET(fields, 79)) {
5869 log_packet_detailed(" got field 'low_firepower_pearl_harbour'");
5870#ifdef FREECIV_JSON_CONNECTION
5871 field_addr.name = "low_firepower_pearl_harbour";
5872#endif /* FREECIV_JSON_CONNECTION */
5873 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_pearl_harbour)) {
5874 RECEIVE_PACKET_FIELD_ERROR(low_firepower_pearl_harbour);
5875 }
5876 }
5877 if (BV_ISSET(fields, 80)) {
5878 log_packet_detailed(" got field 'low_firepower_combat_bonus'");
5879#ifdef FREECIV_JSON_CONNECTION
5880 field_addr.name = "low_firepower_combat_bonus";
5881#endif /* FREECIV_JSON_CONNECTION */
5882 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_combat_bonus)) {
5883 RECEIVE_PACKET_FIELD_ERROR(low_firepower_combat_bonus);
5884 }
5885 }
5886 if (BV_ISSET(fields, 81)) {
5887 log_packet_detailed(" got field 'low_firepower_nonnat_bombard'");
5888#ifdef FREECIV_JSON_CONNECTION
5889 field_addr.name = "low_firepower_nonnat_bombard";
5890#endif /* FREECIV_JSON_CONNECTION */
5891 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_nonnat_bombard)) {
5892 RECEIVE_PACKET_FIELD_ERROR(low_firepower_nonnat_bombard);
5893 }
5894 }
5895 if (BV_ISSET(fields, 82)) {
5896 log_packet_detailed(" got field 'nuke_pop_loss_pct'");
5897#ifdef FREECIV_JSON_CONNECTION
5898 field_addr.name = "nuke_pop_loss_pct";
5899#endif /* FREECIV_JSON_CONNECTION */
5900 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_pop_loss_pct)) {
5901 RECEIVE_PACKET_FIELD_ERROR(nuke_pop_loss_pct);
5902 }
5903 }
5904 if (BV_ISSET(fields, 83)) {
5905 log_packet_detailed(" got field 'nuke_defender_survival_chance_pct'");
5906#ifdef FREECIV_JSON_CONNECTION
5907 field_addr.name = "nuke_defender_survival_chance_pct";
5908#endif /* FREECIV_JSON_CONNECTION */
5909 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_defender_survival_chance_pct)) {
5910 RECEIVE_PACKET_FIELD_ERROR(nuke_defender_survival_chance_pct);
5911 }
5912 }
5913 if (BV_ISSET(fields, 84)) {
5914 log_packet_detailed(" got field 'min_city_center_output'");
5915#ifdef FREECIV_JSON_CONNECTION
5916 field_addr.name = "min_city_center_output";
5917#endif /* FREECIV_JSON_CONNECTION */
5918 {
5919 int i;
5920
5921#ifdef FREECIV_JSON_CONNECTION
5922 /* Enter array. */
5923 field_addr.sub_location = plocation_elem_new(0);
5924#endif /* FREECIV_JSON_CONNECTION */
5925
5926 for (i = 0; i < O_LAST; i++) {
5927#ifdef FREECIV_JSON_CONNECTION
5928 field_addr.sub_location->number = i;
5929#endif /* FREECIV_JSON_CONNECTION */
5930 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_city_center_output[i])) {
5931 RECEIVE_PACKET_FIELD_ERROR(min_city_center_output);
5932 }
5933 }
5934
5935#ifdef FREECIV_JSON_CONNECTION
5936 /* Exit array. */
5937 FC_FREE(field_addr.sub_location);
5938#endif /* FREECIV_JSON_CONNECTION */
5939 }
5940 }
5941 real_packet->muuk_food_wipe = BV_ISSET(fields, 85);
5942 real_packet->muuk_gold_wipe = BV_ISSET(fields, 86);
5943 real_packet->muuk_shield_wipe = BV_ISSET(fields, 87);
5944 if (BV_ISSET(fields, 88)) {
5945 log_packet_detailed(" got field 'notradesize'");
5946#ifdef FREECIV_JSON_CONNECTION
5947 field_addr.name = "notradesize";
5948#endif /* FREECIV_JSON_CONNECTION */
5949 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->notradesize)) {
5950 RECEIVE_PACKET_FIELD_ERROR(notradesize);
5951 }
5952 }
5953 real_packet->nuclear_winter = BV_ISSET(fields, 89);
5954 if (BV_ISSET(fields, 90)) {
5955 log_packet_detailed(" got field 'nuclearwinter'");
5956#ifdef FREECIV_JSON_CONNECTION
5957 field_addr.name = "nuclearwinter";
5958#endif /* FREECIV_JSON_CONNECTION */
5959 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->nuclearwinter)) {
5960 RECEIVE_PACKET_FIELD_ERROR(nuclearwinter);
5961 }
5962 }
5963 if (BV_ISSET(fields, 91)) {
5964 log_packet_detailed(" got field 'phase'");
5965#ifdef FREECIV_JSON_CONNECTION
5966 field_addr.name = "phase";
5967#endif /* FREECIV_JSON_CONNECTION */
5968 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
5969 RECEIVE_PACKET_FIELD_ERROR(phase);
5970 }
5971 }
5972 if (BV_ISSET(fields, 92)) {
5973 log_packet_detailed(" got field 'phase_mode'");
5974#ifdef FREECIV_JSON_CONNECTION
5975 field_addr.name = "phase_mode";
5976#endif /* FREECIV_JSON_CONNECTION */
5977 {
5978 int readin;
5979
5980 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5981 RECEIVE_PACKET_FIELD_ERROR(phase_mode);
5982 }
5983 real_packet->phase_mode = readin;
5984 }
5985 }
5986 real_packet->pillage_select = BV_ISSET(fields, 93);
5987 real_packet->steal_maps_reveals_all_cities = BV_ISSET(fields, 94);
5988 real_packet->poison_empties_food_stock = BV_ISSET(fields, 95);
5989 real_packet->tech_steal_allow_holes = BV_ISSET(fields, 96);
5990 real_packet->tech_trade_allow_holes = BV_ISSET(fields, 97);
5991 real_packet->tech_trade_loss_allow_holes = BV_ISSET(fields, 98);
5992 real_packet->tech_parasite_allow_holes = BV_ISSET(fields, 99);
5993 real_packet->tech_loss_allow_holes = BV_ISSET(fields, 100);
5994 if (BV_ISSET(fields, 101)) {
5995 log_packet_detailed(" got field 'rapturedelay'");
5996#ifdef FREECIV_JSON_CONNECTION
5997 field_addr.name = "rapturedelay";
5998#endif /* FREECIV_JSON_CONNECTION */
5999 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapturedelay)) {
6000 RECEIVE_PACKET_FIELD_ERROR(rapturedelay);
6001 }
6002 }
6003 if (BV_ISSET(fields, 102)) {
6004 log_packet_detailed(" got field 'disasters'");
6005#ifdef FREECIV_JSON_CONNECTION
6006 field_addr.name = "disasters";
6007#endif /* FREECIV_JSON_CONNECTION */
6008 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disasters)) {
6009 RECEIVE_PACKET_FIELD_ERROR(disasters);
6010 }
6011 }
6012 real_packet->restrictinfra = BV_ISSET(fields, 103);
6013 real_packet->unreachable_protects = BV_ISSET(fields, 104);
6014 if (BV_ISSET(fields, 105)) {
6015 log_packet_detailed(" got field 'sciencebox'");
6016#ifdef FREECIV_JSON_CONNECTION
6017 field_addr.name = "sciencebox";
6018#endif /* FREECIV_JSON_CONNECTION */
6019 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->sciencebox)) {
6020 RECEIVE_PACKET_FIELD_ERROR(sciencebox);
6021 }
6022 }
6023 if (BV_ISSET(fields, 106)) {
6024 log_packet_detailed(" got field 'shieldbox'");
6025#ifdef FREECIV_JSON_CONNECTION
6026 field_addr.name = "shieldbox";
6027#endif /* FREECIV_JSON_CONNECTION */
6028 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->shieldbox)) {
6029 RECEIVE_PACKET_FIELD_ERROR(shieldbox);
6030 }
6031 }
6032 if (BV_ISSET(fields, 107)) {
6033 log_packet_detailed(" got field 'skill_level'");
6034#ifdef FREECIV_JSON_CONNECTION
6035 field_addr.name = "skill_level";
6036#endif /* FREECIV_JSON_CONNECTION */
6037 {
6038 int readin;
6039
6040 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6041 RECEIVE_PACKET_FIELD_ERROR(skill_level);
6042 }
6043 real_packet->skill_level = readin;
6044 }
6045 }
6046 if (BV_ISSET(fields, 108)) {
6047 log_packet_detailed(" got field 'victory_conditions'");
6048#ifdef FREECIV_JSON_CONNECTION
6049 field_addr.name = "victory_conditions";
6050#endif /* FREECIV_JSON_CONNECTION */
6051 {
6052 int readin;
6053
6054 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6055 RECEIVE_PACKET_FIELD_ERROR(victory_conditions);
6056 }
6057 real_packet->victory_conditions = readin;
6058 }
6059 }
6060 real_packet->team_pooled_research = BV_ISSET(fields, 109);
6061 if (BV_ISSET(fields, 110)) {
6062 log_packet_detailed(" got field 'tech'");
6063#ifdef FREECIV_JSON_CONNECTION
6064 field_addr.name = "tech";
6065#endif /* FREECIV_JSON_CONNECTION */
6066 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->tech)) {
6067 RECEIVE_PACKET_FIELD_ERROR(tech);
6068 }
6069 }
6070 if (BV_ISSET(fields, 111)) {
6071 log_packet_detailed(" got field 'tech_cost_style'");
6072#ifdef FREECIV_JSON_CONNECTION
6073 field_addr.name = "tech_cost_style";
6074#endif /* FREECIV_JSON_CONNECTION */
6075 {
6076 int readin;
6077
6078 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6079 RECEIVE_PACKET_FIELD_ERROR(tech_cost_style);
6080 }
6081 real_packet->tech_cost_style = readin;
6082 }
6083 }
6084 if (BV_ISSET(fields, 112)) {
6085 log_packet_detailed(" got field 'tech_leakage'");
6086#ifdef FREECIV_JSON_CONNECTION
6087 field_addr.name = "tech_leakage";
6088#endif /* FREECIV_JSON_CONNECTION */
6089 {
6090 int readin;
6091
6092 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6093 RECEIVE_PACKET_FIELD_ERROR(tech_leakage);
6094 }
6095 real_packet->tech_leakage = readin;
6096 }
6097 }
6098 if (BV_ISSET(fields, 113)) {
6099 log_packet_detailed(" got field 'tech_upkeep_divider'");
6100#ifdef FREECIV_JSON_CONNECTION
6101 field_addr.name = "tech_upkeep_divider";
6102#endif /* FREECIV_JSON_CONNECTION */
6103 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep_divider)) {
6104 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_divider);
6105 }
6106 }
6107 if (BV_ISSET(fields, 114)) {
6108 log_packet_detailed(" got field 'tech_upkeep_style'");
6109#ifdef FREECIV_JSON_CONNECTION
6110 field_addr.name = "tech_upkeep_style";
6111#endif /* FREECIV_JSON_CONNECTION */
6112 {
6113 int readin;
6114
6115 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6116 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_style);
6117 }
6118 real_packet->tech_upkeep_style = readin;
6119 }
6120 }
6121 if (BV_ISSET(fields, 115)) {
6122 log_packet_detailed(" got field 'techloss_forgiveness'");
6123#ifdef FREECIV_JSON_CONNECTION
6124 field_addr.name = "techloss_forgiveness";
6125#endif /* FREECIV_JSON_CONNECTION */
6126 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->techloss_forgiveness)) {
6127 RECEIVE_PACKET_FIELD_ERROR(techloss_forgiveness);
6128 }
6129 }
6130 if (BV_ISSET(fields, 116)) {
6131 log_packet_detailed(" got field 'free_tech_method'");
6132#ifdef FREECIV_JSON_CONNECTION
6133 field_addr.name = "free_tech_method";
6134#endif /* FREECIV_JSON_CONNECTION */
6135 {
6136 int readin;
6137
6138 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6139 RECEIVE_PACKET_FIELD_ERROR(free_tech_method);
6140 }
6141 real_packet->free_tech_method = readin;
6142 }
6143 }
6144 if (BV_ISSET(fields, 117)) {
6145 log_packet_detailed(" got field 'gameloss_style'");
6146#ifdef FREECIV_JSON_CONNECTION
6147 field_addr.name = "gameloss_style";
6148#endif /* FREECIV_JSON_CONNECTION */
6149 {
6150 int readin;
6151
6152 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6153 RECEIVE_PACKET_FIELD_ERROR(gameloss_style);
6154 }
6155 real_packet->gameloss_style = readin;
6156 }
6157 }
6158 if (BV_ISSET(fields, 118)) {
6159 log_packet_detailed(" got field 'timeout'");
6160#ifdef FREECIV_JSON_CONNECTION
6161 field_addr.name = "timeout";
6162#endif /* FREECIV_JSON_CONNECTION */
6163 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->timeout)) {
6164 RECEIVE_PACKET_FIELD_ERROR(timeout);
6165 }
6166 }
6167 if (BV_ISSET(fields, 119)) {
6168 log_packet_detailed(" got field 'first_timeout'");
6169#ifdef FREECIV_JSON_CONNECTION
6170 field_addr.name = "first_timeout";
6171#endif /* FREECIV_JSON_CONNECTION */
6172 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->first_timeout)) {
6173 RECEIVE_PACKET_FIELD_ERROR(first_timeout);
6174 }
6175 }
6176 real_packet->tired_attack = BV_ISSET(fields, 120);
6177 if (BV_ISSET(fields, 121)) {
6178 log_packet_detailed(" got field 'trademindist'");
6179#ifdef FREECIV_JSON_CONNECTION
6180 field_addr.name = "trademindist";
6181#endif /* FREECIV_JSON_CONNECTION */
6182 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trademindist)) {
6183 RECEIVE_PACKET_FIELD_ERROR(trademindist);
6184 }
6185 }
6186 if (BV_ISSET(fields, 122)) {
6187 log_packet_detailed(" got field 'trade_revenue_style'");
6188#ifdef FREECIV_JSON_CONNECTION
6189 field_addr.name = "trade_revenue_style";
6190#endif /* FREECIV_JSON_CONNECTION */
6191 {
6192 int readin;
6193
6194 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6195 RECEIVE_PACKET_FIELD_ERROR(trade_revenue_style);
6196 }
6197 real_packet->trade_revenue_style = readin;
6198 }
6199 }
6200 real_packet->trading_city = BV_ISSET(fields, 123);
6201 real_packet->trading_gold = BV_ISSET(fields, 124);
6202 real_packet->trading_tech = BV_ISSET(fields, 125);
6203 if (BV_ISSET(fields, 126)) {
6204 log_packet_detailed(" got field 'turn'");
6205#ifdef FREECIV_JSON_CONNECTION
6206 field_addr.name = "turn";
6207#endif /* FREECIV_JSON_CONNECTION */
6208 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
6209 RECEIVE_PACKET_FIELD_ERROR(turn);
6210 }
6211 }
6212 if (BV_ISSET(fields, 127)) {
6213 log_packet_detailed(" got field 'warminglevel'");
6214#ifdef FREECIV_JSON_CONNECTION
6215 field_addr.name = "warminglevel";
6216#endif /* FREECIV_JSON_CONNECTION */
6217 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->warminglevel)) {
6218 RECEIVE_PACKET_FIELD_ERROR(warminglevel);
6219 }
6220 }
6221 if (BV_ISSET(fields, 128)) {
6222 log_packet_detailed(" got field 'year'");
6223#ifdef FREECIV_JSON_CONNECTION
6224 field_addr.name = "year";
6225#endif /* FREECIV_JSON_CONNECTION */
6226 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
6227 RECEIVE_PACKET_FIELD_ERROR(year);
6228 }
6229 }
6230 real_packet->year_0_hack = BV_ISSET(fields, 129);
6231 if (BV_ISSET(fields, 130)) {
6232 log_packet_detailed(" got field 'top_cities_count'");
6233#ifdef FREECIV_JSON_CONNECTION
6234 field_addr.name = "top_cities_count";
6235#endif /* FREECIV_JSON_CONNECTION */
6236 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->top_cities_count)) {
6237 RECEIVE_PACKET_FIELD_ERROR(top_cities_count);
6238 }
6239 }
6240 if (BV_ISSET(fields, 131)) {
6241 log_packet_detailed(" got field 'fragment_count'");
6242#ifdef FREECIV_JSON_CONNECTION
6243 field_addr.name = "fragment_count";
6244#endif /* FREECIV_JSON_CONNECTION */
6245 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragment_count)) {
6246 RECEIVE_PACKET_FIELD_ERROR(fragment_count);
6247 }
6248 }
6249 real_packet->civil_war_enabled = BV_ISSET(fields, 132);
6250 if (BV_ISSET(fields, 133)) {
6251 log_packet_detailed(" got field 'civil_war_bonus_celebrating'");
6252#ifdef FREECIV_JSON_CONNECTION
6253 field_addr.name = "civil_war_bonus_celebrating";
6254#endif /* FREECIV_JSON_CONNECTION */
6255 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_celebrating)) {
6256 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_celebrating);
6257 }
6258 }
6259 if (BV_ISSET(fields, 134)) {
6260 log_packet_detailed(" got field 'civil_war_bonus_unhappy'");
6261#ifdef FREECIV_JSON_CONNECTION
6262 field_addr.name = "civil_war_bonus_unhappy";
6263#endif /* FREECIV_JSON_CONNECTION */
6264 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_unhappy)) {
6265 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_unhappy);
6266 }
6267 }
6268 if (BV_ISSET(fields, 135)) {
6269 log_packet_detailed(" got field 'granularity'");
6270#ifdef FREECIV_JSON_CONNECTION
6271 field_addr.name = "granularity";
6272#endif /* FREECIV_JSON_CONNECTION */
6273 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granularity)) {
6274 RECEIVE_PACKET_FIELD_ERROR(granularity);
6275 }
6276 }
6277 if (BV_ISSET(fields, 136)) {
6278 log_packet_detailed(" got field 'small_wonder_visibility'");
6279#ifdef FREECIV_JSON_CONNECTION
6280 field_addr.name = "small_wonder_visibility";
6281#endif /* FREECIV_JSON_CONNECTION */
6282 {
6283 int readin;
6284
6285 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6286 RECEIVE_PACKET_FIELD_ERROR(small_wonder_visibility);
6287 }
6288 real_packet->small_wonder_visibility = readin;
6289 }
6290 }
6291
6292 if (nullptr == old) {
6293 old = fc_malloc(sizeof(*old));
6294 init_packet_game_info(old);
6295 *old = *real_packet;
6296 genhash_insert(*hash, old, old);
6297 } else {
6298 *old = *real_packet;
6299 }
6300
6301#endif /* FREECIV_DELTA_PROTOCOL */
6302 RECEIVE_PACKET_END(real_packet);
6303#undef FREE_PACKET_STRUCT
6304}
6305
6306 static int send_packet_game_info_100(struct connection *pc, const struct packet_game_info *packet)
6307{
6308 const struct packet_game_info *real_packet = packet;
6309 int e;
6310#ifdef FREECIV_DELTA_PROTOCOL
6311 packet_game_info_100_fields fields;
6312 struct packet_game_info *old;
6313 bool differ;
6314 struct genhash **hash = pc->phs.sent + PACKET_GAME_INFO;
6315 int different = 0;
6316#endif /* FREECIV_DELTA_PROTOCOL */
6317 SEND_PACKET_START(PACKET_GAME_INFO);
6318#ifdef FREECIV_JSON_CONNECTION
6319 struct plocation field_addr;
6320 {
6321 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
6322 field_addr = *field_addr_tmp;
6323 FC_FREE(field_addr_tmp);
6324 }
6325#endif /* FREECIV_JSON_CONNECTION */
6326
6327 log_packet_detailed("packet_game_info_100: sending info about ()");
6328
6329#ifdef FREECIV_DELTA_PROTOCOL
6330 if (nullptr == *hash) {
6331 *hash = genhash_new_full(hash_packet_game_info_100, cmp_packet_game_info_100,
6332 nullptr, nullptr, nullptr, destroy_packet_game_info);
6333 }
6334 BV_CLR_ALL(fields);
6335
6336 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
6337 old = fc_malloc(sizeof(*old));
6338 /* temporary bitcopy just to insert correctly */
6339 *old = *real_packet;
6340 genhash_insert(*hash, old, old);
6341 init_packet_game_info(old);
6342 different = 1; /* Force to send. */
6343 }
6344 differ = (old->add_to_size_limit != real_packet->add_to_size_limit);
6345 if (differ) {
6346 different++;
6347 BV_SET(fields, 0);
6348 }
6349
6350 differ = (old->aifill != real_packet->aifill);
6351 if (differ) {
6352 different++;
6353 BV_SET(fields, 1);
6354 }
6355
6356 differ = (old->persistent_ready != real_packet->persistent_ready);
6357 if (differ) {
6358 different++;
6359 BV_SET(fields, 2);
6360 }
6361
6362 differ = (old->airlifting_style != real_packet->airlifting_style);
6363 if (differ) {
6364 different++;
6365 BV_SET(fields, 3);
6366 }
6367
6368 differ = (old->airlift_from_always_enabled != real_packet->airlift_from_always_enabled);
6369 if (differ) {
6370 different++;
6371 }
6372 if (packet->airlift_from_always_enabled) {
6373 BV_SET(fields, 4);
6374 }
6375
6376 differ = (old->airlift_to_always_enabled != real_packet->airlift_to_always_enabled);
6377 if (differ) {
6378 different++;
6379 }
6380 if (packet->airlift_to_always_enabled) {
6381 BV_SET(fields, 5);
6382 }
6383
6384 differ = (old->angrycitizen != real_packet->angrycitizen);
6385 if (differ) {
6386 different++;
6387 BV_SET(fields, 6);
6388 }
6389
6390 differ = (old->base_pollution != real_packet->base_pollution);
6391 if (differ) {
6392 different++;
6393 BV_SET(fields, 7);
6394 }
6395
6396 differ = (old->base_tech_cost != real_packet->base_tech_cost);
6397 if (differ) {
6398 different++;
6399 BV_SET(fields, 8);
6400 }
6401
6402 differ = (old->min_tech_cost != real_packet->min_tech_cost);
6403 if (differ) {
6404 different++;
6405 BV_SET(fields, 9);
6406 }
6407
6408 differ = (old->tech_leak_pct != real_packet->tech_leak_pct);
6409 if (differ) {
6410 different++;
6411 BV_SET(fields, 10);
6412 }
6413
6414 differ = (old->border_city_radius_sq != real_packet->border_city_radius_sq);
6415 if (differ) {
6416 different++;
6417 BV_SET(fields, 11);
6418 }
6419
6420 differ = (old->border_size_effect != real_packet->border_size_effect);
6421 if (differ) {
6422 different++;
6423 BV_SET(fields, 12);
6424 }
6425
6426 differ = (old->border_city_permanent_radius_sq != real_packet->border_city_permanent_radius_sq);
6427 if (differ) {
6428 different++;
6429 BV_SET(fields, 13);
6430 }
6431
6432 differ = (old->borders != real_packet->borders);
6433 if (differ) {
6434 different++;
6435 BV_SET(fields, 14);
6436 }
6437
6438 differ = (old->base_bribe_cost != real_packet->base_bribe_cost);
6439 if (differ) {
6440 different++;
6441 BV_SET(fields, 15);
6442 }
6443
6444 differ = (old->caravan_bonus_style != real_packet->caravan_bonus_style);
6445 if (differ) {
6446 different++;
6447 BV_SET(fields, 16);
6448 }
6449
6450 differ = (old->culture_vic_points != real_packet->culture_vic_points);
6451 if (differ) {
6452 different++;
6453 BV_SET(fields, 17);
6454 }
6455
6456 differ = (old->culture_vic_lead != real_packet->culture_vic_lead);
6457 if (differ) {
6458 different++;
6459 BV_SET(fields, 18);
6460 }
6461
6462 differ = (old->culture_migration_pml != real_packet->culture_migration_pml);
6463 if (differ) {
6464 different++;
6465 BV_SET(fields, 19);
6466 }
6467
6468 differ = (old->history_interest_pml != real_packet->history_interest_pml);
6469 if (differ) {
6470 different++;
6471 BV_SET(fields, 20);
6472 }
6473
6474 differ = (old->world_peace_turns != real_packet->world_peace_turns);
6475 if (differ) {
6476 different++;
6477 BV_SET(fields, 21);
6478 }
6479
6480 differ = (old->celebratesize != real_packet->celebratesize);
6481 if (differ) {
6482 different++;
6483 BV_SET(fields, 22);
6484 }
6485
6486 differ = (old->changable_tax != real_packet->changable_tax);
6487 if (differ) {
6488 different++;
6489 }
6490 if (packet->changable_tax) {
6491 BV_SET(fields, 23);
6492 }
6493
6494 differ = (old->pop_report_zeroes != real_packet->pop_report_zeroes);
6495 if (differ) {
6496 different++;
6497 BV_SET(fields, 24);
6498 }
6499
6500 differ = (old->citizen_nationality != real_packet->citizen_nationality);
6501 if (differ) {
6502 different++;
6503 }
6504 if (packet->citizen_nationality) {
6505 BV_SET(fields, 25);
6506 }
6507
6508 differ = (old->unit_builders_nationality != real_packet->unit_builders_nationality);
6509 if (differ) {
6510 different++;
6511 }
6512 if (packet->unit_builders_nationality) {
6513 BV_SET(fields, 26);
6514 }
6515
6516 differ = (old->citizen_convert_speed != real_packet->citizen_convert_speed);
6517 if (differ) {
6518 different++;
6519 BV_SET(fields, 27);
6520 }
6521
6522 differ = (old->conquest_convert_pct != real_packet->conquest_convert_pct);
6523 if (differ) {
6524 different++;
6525 BV_SET(fields, 28);
6526 }
6527
6528 differ = (old->citizen_partisans_pct != real_packet->citizen_partisans_pct);
6529 if (differ) {
6530 different++;
6531 BV_SET(fields, 29);
6532 }
6533
6534 differ = (old->citymindist != real_packet->citymindist);
6535 if (differ) {
6536 different++;
6537 BV_SET(fields, 30);
6538 }
6539
6540 differ = (old->cooling != real_packet->cooling);
6541 if (differ) {
6542 different++;
6543 BV_SET(fields, 31);
6544 }
6545
6546 differ = (old->coolinglevel != real_packet->coolinglevel);
6547 if (differ) {
6548 different++;
6549 BV_SET(fields, 32);
6550 }
6551
6552 differ = !BV_ARE_EQUAL(old->diplchance_initial_odds, real_packet->diplchance_initial_odds);
6553 if (differ) {
6554 different++;
6555 BV_SET(fields, 33);
6556 }
6557
6558 differ = (old->diplomacy != real_packet->diplomacy);
6559 if (differ) {
6560 different++;
6561 BV_SET(fields, 34);
6562 }
6563
6564 differ = (old->fogofwar != real_packet->fogofwar);
6565 if (differ) {
6566 different++;
6567 }
6568 if (packet->fogofwar) {
6569 BV_SET(fields, 35);
6570 }
6571
6572 differ = (old->food_cost != real_packet->food_cost);
6573 if (differ) {
6574 different++;
6575 BV_SET(fields, 36);
6576 }
6577
6578 differ = (old->foodbox != real_packet->foodbox);
6579 if (differ) {
6580 different++;
6581 BV_SET(fields, 37);
6582 }
6583
6584 differ = (old->forced_gold != real_packet->forced_gold);
6585 if (differ) {
6586 different++;
6587 BV_SET(fields, 38);
6588 }
6589
6590 differ = (old->forced_luxury != real_packet->forced_luxury);
6591 if (differ) {
6592 different++;
6593 BV_SET(fields, 39);
6594 }
6595
6596 differ = (old->forced_science != real_packet->forced_science);
6597 if (differ) {
6598 different++;
6599 BV_SET(fields, 40);
6600 }
6601
6602 differ = (old->fulltradesize != real_packet->fulltradesize);
6603 if (differ) {
6604 different++;
6605 BV_SET(fields, 41);
6606 }
6607
6608 differ = (old->trade_world_rel_pct != real_packet->trade_world_rel_pct);
6609 if (differ) {
6610 different++;
6611 BV_SET(fields, 42);
6612 }
6613
6614 differ = (old->min_trade_route_val != real_packet->min_trade_route_val);
6615 if (differ) {
6616 different++;
6617 BV_SET(fields, 43);
6618 }
6619
6620 differ = (old->reveal_trade_partner != real_packet->reveal_trade_partner);
6621 if (differ) {
6622 different++;
6623 }
6624 if (packet->reveal_trade_partner) {
6625 BV_SET(fields, 44);
6626 }
6627
6628 differ = (old->goods_selection != real_packet->goods_selection);
6629 if (differ) {
6630 different++;
6631 BV_SET(fields, 45);
6632 }
6633
6634 differ = (old->global_advance_count != real_packet->global_advance_count);
6635 if (differ) {
6636 different++;
6637 BV_SET(fields, 46);
6638 }
6639
6640 differ = FALSE;
6641 {
6642 int i;
6643
6644 for (i = 0; i < A_LAST; i++) {
6645 differ = (old->global_advances[i] != real_packet->global_advances[i]);
6646 if (differ) {
6647 break;
6648 }
6649 }
6650 }
6651 if (differ) {
6652 different++;
6653 BV_SET(fields, 47);
6654 }
6655
6656 differ = (old->global_warming != real_packet->global_warming);
6657 if (differ) {
6658 different++;
6659 }
6660 if (packet->global_warming) {
6661 BV_SET(fields, 48);
6662 }
6663
6664 differ = (old->globalwarming != real_packet->globalwarming);
6665 if (differ) {
6666 different++;
6667 BV_SET(fields, 49);
6668 }
6669
6670 differ = (old->gold != real_packet->gold);
6671 if (differ) {
6672 different++;
6673 BV_SET(fields, 50);
6674 }
6675
6676 differ = (old->gold_upkeep_style != real_packet->gold_upkeep_style);
6677 if (differ) {
6678 different++;
6679 BV_SET(fields, 51);
6680 }
6681
6682 differ = (old->homeless_gold_upkeep != real_packet->homeless_gold_upkeep);
6683 if (differ) {
6684 different++;
6685 }
6686 if (packet->homeless_gold_upkeep) {
6687 BV_SET(fields, 52);
6688 }
6689
6690 differ = (old->infrapoints != real_packet->infrapoints);
6691 if (differ) {
6692 different++;
6693 BV_SET(fields, 53);
6694 }
6695
6696 differ = (old->revolentype != real_packet->revolentype);
6697 if (differ) {
6698 different++;
6699 BV_SET(fields, 54);
6700 }
6701
6702 differ = (old->default_government_id != real_packet->default_government_id);
6703 if (differ) {
6704 different++;
6705 BV_SET(fields, 55);
6706 }
6707
6708 differ = (old->government_during_revolution_id != real_packet->government_during_revolution_id);
6709 if (differ) {
6710 different++;
6711 BV_SET(fields, 56);
6712 }
6713
6714 differ = (old->granary_food_inc != real_packet->granary_food_inc);
6715 if (differ) {
6716 different++;
6717 BV_SET(fields, 57);
6718 }
6719
6720 differ = FALSE;
6721 {
6722 int i;
6723
6724 for (i = 0; i < MAX_GRANARY_INIS; i++) {
6725 differ = (old->granary_food_ini[i] != real_packet->granary_food_ini[i]);
6726 if (differ) {
6727 break;
6728 }
6729 }
6730 }
6731 if (differ) {
6732 different++;
6733 BV_SET(fields, 58);
6734 }
6735
6736 differ = (old->granary_num_inis != real_packet->granary_num_inis);
6737 if (differ) {
6738 different++;
6739 BV_SET(fields, 59);
6740 }
6741
6742 differ = FALSE;
6743 {
6744 int i;
6745
6746 for (i = 0; i < B_LAST; i++) {
6747 differ = (old->great_wonder_owners[i] != real_packet->great_wonder_owners[i]);
6748 if (differ) {
6749 break;
6750 }
6751 }
6752 }
6753 if (differ) {
6754 different++;
6755 BV_SET(fields, 60);
6756 }
6757
6758 differ = (old->happy_cost != real_packet->happy_cost);
6759 if (differ) {
6760 different++;
6761 BV_SET(fields, 61);
6762 }
6763
6764 differ = (old->happyborders != real_packet->happyborders);
6765 if (differ) {
6766 different++;
6767 BV_SET(fields, 62);
6768 }
6769
6770 differ = (old->heating != real_packet->heating);
6771 if (differ) {
6772 different++;
6773 BV_SET(fields, 63);
6774 }
6775
6776 differ = (old->illness_base_factor != real_packet->illness_base_factor);
6777 if (differ) {
6778 different++;
6779 BV_SET(fields, 64);
6780 }
6781
6782 differ = (old->illness_min_size != real_packet->illness_min_size);
6783 if (differ) {
6784 different++;
6785 BV_SET(fields, 65);
6786 }
6787
6788 differ = (old->illness_on != real_packet->illness_on);
6789 if (differ) {
6790 different++;
6791 }
6792 if (packet->illness_on) {
6793 BV_SET(fields, 66);
6794 }
6795
6796 differ = (old->illness_pollution_factor != real_packet->illness_pollution_factor);
6797 if (differ) {
6798 different++;
6799 BV_SET(fields, 67);
6800 }
6801
6802 differ = (old->illness_trade_infection != real_packet->illness_trade_infection);
6803 if (differ) {
6804 different++;
6805 BV_SET(fields, 68);
6806 }
6807
6808 differ = (old->init_city_radius_sq != real_packet->init_city_radius_sq);
6809 if (differ) {
6810 different++;
6811 BV_SET(fields, 69);
6812 }
6813
6814 differ = (old->is_edit_mode != real_packet->is_edit_mode);
6815 if (differ) {
6816 different++;
6817 }
6818 if (packet->is_edit_mode) {
6819 BV_SET(fields, 70);
6820 }
6821
6822 differ = (old->is_new_game != real_packet->is_new_game);
6823 if (differ) {
6824 different++;
6825 }
6826 if (packet->is_new_game) {
6827 BV_SET(fields, 71);
6828 }
6829
6830 differ = (old->killcitizen != real_packet->killcitizen);
6831 if (differ) {
6832 different++;
6833 }
6834 if (packet->killcitizen) {
6835 BV_SET(fields, 72);
6836 }
6837
6838 differ = (old->killstack != real_packet->killstack);
6839 if (differ) {
6840 different++;
6841 }
6842 if (packet->killstack) {
6843 BV_SET(fields, 73);
6844 }
6845
6846 differ = (old->only_killing_makes_veteran != real_packet->only_killing_makes_veteran);
6847 if (differ) {
6848 different++;
6849 }
6850 if (packet->only_killing_makes_veteran) {
6851 BV_SET(fields, 74);
6852 }
6853
6854 differ = (old->only_real_fight_makes_veteran != real_packet->only_real_fight_makes_veteran);
6855 if (differ) {
6856 different++;
6857 }
6858 if (packet->only_real_fight_makes_veteran) {
6859 BV_SET(fields, 75);
6860 }
6861
6862 differ = (old->combat_odds_scaled_veterancy != real_packet->combat_odds_scaled_veterancy);
6863 if (differ) {
6864 different++;
6865 }
6866 if (packet->combat_odds_scaled_veterancy) {
6867 BV_SET(fields, 76);
6868 }
6869
6870 differ = (old->damage_reduces_bombard_rate != real_packet->damage_reduces_bombard_rate);
6871 if (differ) {
6872 different++;
6873 }
6874 if (packet->damage_reduces_bombard_rate) {
6875 BV_SET(fields, 77);
6876 }
6877
6878 differ = (old->low_firepower_badwallattacker != real_packet->low_firepower_badwallattacker);
6879 if (differ) {
6880 different++;
6881 BV_SET(fields, 78);
6882 }
6883
6884 differ = (old->low_firepower_pearl_harbour != real_packet->low_firepower_pearl_harbour);
6885 if (differ) {
6886 different++;
6887 BV_SET(fields, 79);
6888 }
6889
6890 differ = (old->low_firepower_combat_bonus != real_packet->low_firepower_combat_bonus);
6891 if (differ) {
6892 different++;
6893 BV_SET(fields, 80);
6894 }
6895
6896 differ = (old->low_firepower_nonnat_bombard != real_packet->low_firepower_nonnat_bombard);
6897 if (differ) {
6898 different++;
6899 BV_SET(fields, 81);
6900 }
6901
6902 differ = (old->nuke_pop_loss_pct != real_packet->nuke_pop_loss_pct);
6903 if (differ) {
6904 different++;
6905 BV_SET(fields, 82);
6906 }
6907
6908 differ = (old->nuke_defender_survival_chance_pct != real_packet->nuke_defender_survival_chance_pct);
6909 if (differ) {
6910 different++;
6911 BV_SET(fields, 83);
6912 }
6913
6914 differ = FALSE;
6915 {
6916 int i;
6917
6918 for (i = 0; i < O_LAST; i++) {
6919 differ = (old->min_city_center_output[i] != real_packet->min_city_center_output[i]);
6920 if (differ) {
6921 break;
6922 }
6923 }
6924 }
6925 if (differ) {
6926 different++;
6927 BV_SET(fields, 84);
6928 }
6929
6930 differ = (old->muuk_food_wipe != real_packet->muuk_food_wipe);
6931 if (differ) {
6932 different++;
6933 }
6934 if (packet->muuk_food_wipe) {
6935 BV_SET(fields, 85);
6936 }
6937
6938 differ = (old->muuk_gold_wipe != real_packet->muuk_gold_wipe);
6939 if (differ) {
6940 different++;
6941 }
6942 if (packet->muuk_gold_wipe) {
6943 BV_SET(fields, 86);
6944 }
6945
6946 differ = (old->muuk_shield_wipe != real_packet->muuk_shield_wipe);
6947 if (differ) {
6948 different++;
6949 }
6950 if (packet->muuk_shield_wipe) {
6951 BV_SET(fields, 87);
6952 }
6953
6954 differ = (old->notradesize != real_packet->notradesize);
6955 if (differ) {
6956 different++;
6957 BV_SET(fields, 88);
6958 }
6959
6960 differ = (old->nuclear_winter != real_packet->nuclear_winter);
6961 if (differ) {
6962 different++;
6963 }
6964 if (packet->nuclear_winter) {
6965 BV_SET(fields, 89);
6966 }
6967
6968 differ = (old->nuclearwinter != real_packet->nuclearwinter);
6969 if (differ) {
6970 different++;
6971 BV_SET(fields, 90);
6972 }
6973
6974 differ = (old->phase != real_packet->phase);
6975 if (differ) {
6976 different++;
6977 BV_SET(fields, 91);
6978 }
6979
6980 differ = (old->phase_mode != real_packet->phase_mode);
6981 if (differ) {
6982 different++;
6983 BV_SET(fields, 92);
6984 }
6985
6986 differ = (old->pillage_select != real_packet->pillage_select);
6987 if (differ) {
6988 different++;
6989 }
6990 if (packet->pillage_select) {
6991 BV_SET(fields, 93);
6992 }
6993
6994 differ = (old->steal_maps_reveals_all_cities != real_packet->steal_maps_reveals_all_cities);
6995 if (differ) {
6996 different++;
6997 }
6998 if (packet->steal_maps_reveals_all_cities) {
6999 BV_SET(fields, 94);
7000 }
7001
7002 differ = (old->poison_empties_food_stock != real_packet->poison_empties_food_stock);
7003 if (differ) {
7004 different++;
7005 }
7006 if (packet->poison_empties_food_stock) {
7007 BV_SET(fields, 95);
7008 }
7009
7010 differ = (old->tech_steal_allow_holes != real_packet->tech_steal_allow_holes);
7011 if (differ) {
7012 different++;
7013 }
7014 if (packet->tech_steal_allow_holes) {
7015 BV_SET(fields, 96);
7016 }
7017
7018 differ = (old->tech_trade_allow_holes != real_packet->tech_trade_allow_holes);
7019 if (differ) {
7020 different++;
7021 }
7022 if (packet->tech_trade_allow_holes) {
7023 BV_SET(fields, 97);
7024 }
7025
7026 differ = (old->tech_trade_loss_allow_holes != real_packet->tech_trade_loss_allow_holes);
7027 if (differ) {
7028 different++;
7029 }
7030 if (packet->tech_trade_loss_allow_holes) {
7031 BV_SET(fields, 98);
7032 }
7033
7034 differ = (old->tech_parasite_allow_holes != real_packet->tech_parasite_allow_holes);
7035 if (differ) {
7036 different++;
7037 }
7038 if (packet->tech_parasite_allow_holes) {
7039 BV_SET(fields, 99);
7040 }
7041
7042 differ = (old->tech_loss_allow_holes != real_packet->tech_loss_allow_holes);
7043 if (differ) {
7044 different++;
7045 }
7046 if (packet->tech_loss_allow_holes) {
7047 BV_SET(fields, 100);
7048 }
7049
7050 differ = (old->rapturedelay != real_packet->rapturedelay);
7051 if (differ) {
7052 different++;
7053 BV_SET(fields, 101);
7054 }
7055
7056 differ = (old->disasters != real_packet->disasters);
7057 if (differ) {
7058 different++;
7059 BV_SET(fields, 102);
7060 }
7061
7062 differ = (old->restrictinfra != real_packet->restrictinfra);
7063 if (differ) {
7064 different++;
7065 }
7066 if (packet->restrictinfra) {
7067 BV_SET(fields, 103);
7068 }
7069
7070 differ = (old->unreachable_protects != real_packet->unreachable_protects);
7071 if (differ) {
7072 different++;
7073 }
7074 if (packet->unreachable_protects) {
7075 BV_SET(fields, 104);
7076 }
7077
7078 differ = (old->sciencebox != real_packet->sciencebox);
7079 if (differ) {
7080 different++;
7081 BV_SET(fields, 105);
7082 }
7083
7084 differ = (old->shieldbox != real_packet->shieldbox);
7085 if (differ) {
7086 different++;
7087 BV_SET(fields, 106);
7088 }
7089
7090 differ = (old->skill_level != real_packet->skill_level);
7091 if (differ) {
7092 different++;
7093 BV_SET(fields, 107);
7094 }
7095
7096 differ = (old->victory_conditions != real_packet->victory_conditions);
7097 if (differ) {
7098 different++;
7099 BV_SET(fields, 108);
7100 }
7101
7102 differ = (old->team_pooled_research != real_packet->team_pooled_research);
7103 if (differ) {
7104 different++;
7105 }
7106 if (packet->team_pooled_research) {
7107 BV_SET(fields, 109);
7108 }
7109
7110 differ = (old->tech != real_packet->tech);
7111 if (differ) {
7112 different++;
7113 BV_SET(fields, 110);
7114 }
7115
7116 differ = (old->tech_cost_style != real_packet->tech_cost_style);
7117 if (differ) {
7118 different++;
7119 BV_SET(fields, 111);
7120 }
7121
7122 differ = (old->tech_leakage != real_packet->tech_leakage);
7123 if (differ) {
7124 different++;
7125 BV_SET(fields, 112);
7126 }
7127
7128 differ = (old->tech_upkeep_divider != real_packet->tech_upkeep_divider);
7129 if (differ) {
7130 different++;
7131 BV_SET(fields, 113);
7132 }
7133
7134 differ = (old->tech_upkeep_style != real_packet->tech_upkeep_style);
7135 if (differ) {
7136 different++;
7137 BV_SET(fields, 114);
7138 }
7139
7140 differ = (old->techloss_forgiveness != real_packet->techloss_forgiveness);
7141 if (differ) {
7142 different++;
7143 BV_SET(fields, 115);
7144 }
7145
7146 differ = (old->free_tech_method != real_packet->free_tech_method);
7147 if (differ) {
7148 different++;
7149 BV_SET(fields, 116);
7150 }
7151
7152 differ = (old->gameloss_style != real_packet->gameloss_style);
7153 if (differ) {
7154 different++;
7155 BV_SET(fields, 117);
7156 }
7157
7158 differ = (old->timeout != real_packet->timeout);
7159 if (differ) {
7160 different++;
7161 BV_SET(fields, 118);
7162 }
7163
7164 differ = (old->first_timeout != real_packet->first_timeout);
7165 if (differ) {
7166 different++;
7167 BV_SET(fields, 119);
7168 }
7169
7170 differ = (old->tired_attack != real_packet->tired_attack);
7171 if (differ) {
7172 different++;
7173 }
7174 if (packet->tired_attack) {
7175 BV_SET(fields, 120);
7176 }
7177
7178 differ = (old->trademindist != real_packet->trademindist);
7179 if (differ) {
7180 different++;
7181 BV_SET(fields, 121);
7182 }
7183
7184 differ = (old->trade_revenue_style != real_packet->trade_revenue_style);
7185 if (differ) {
7186 different++;
7187 BV_SET(fields, 122);
7188 }
7189
7190 differ = (old->trading_city != real_packet->trading_city);
7191 if (differ) {
7192 different++;
7193 }
7194 if (packet->trading_city) {
7195 BV_SET(fields, 123);
7196 }
7197
7198 differ = (old->trading_gold != real_packet->trading_gold);
7199 if (differ) {
7200 different++;
7201 }
7202 if (packet->trading_gold) {
7203 BV_SET(fields, 124);
7204 }
7205
7206 differ = (old->trading_tech != real_packet->trading_tech);
7207 if (differ) {
7208 different++;
7209 }
7210 if (packet->trading_tech) {
7211 BV_SET(fields, 125);
7212 }
7213
7214 differ = (old->turn != real_packet->turn);
7215 if (differ) {
7216 different++;
7217 BV_SET(fields, 126);
7218 }
7219
7220 differ = (old->warminglevel != real_packet->warminglevel);
7221 if (differ) {
7222 different++;
7223 BV_SET(fields, 127);
7224 }
7225
7226 differ = (old->year != real_packet->year);
7227 if (differ) {
7228 different++;
7229 BV_SET(fields, 128);
7230 }
7231
7232 differ = (old->year_0_hack != real_packet->year_0_hack);
7233 if (differ) {
7234 different++;
7235 }
7236 if (packet->year_0_hack) {
7237 BV_SET(fields, 129);
7238 }
7239
7240 differ = (old->top_cities_count != real_packet->top_cities_count);
7241 if (differ) {
7242 different++;
7243 BV_SET(fields, 130);
7244 }
7245
7246 differ = (old->fragment_count != real_packet->fragment_count);
7247 if (differ) {
7248 different++;
7249 BV_SET(fields, 131);
7250 }
7251
7252 differ = (old->civil_war_enabled != real_packet->civil_war_enabled);
7253 if (differ) {
7254 different++;
7255 }
7256 if (packet->civil_war_enabled) {
7257 BV_SET(fields, 132);
7258 }
7259
7260 differ = (old->civil_war_bonus_celebrating != real_packet->civil_war_bonus_celebrating);
7261 if (differ) {
7262 different++;
7263 BV_SET(fields, 133);
7264 }
7265
7266 differ = (old->civil_war_bonus_unhappy != real_packet->civil_war_bonus_unhappy);
7267 if (differ) {
7268 different++;
7269 BV_SET(fields, 134);
7270 }
7271
7272 differ = (old->granularity != real_packet->granularity);
7273 if (differ) {
7274 different++;
7275 BV_SET(fields, 135);
7276 }
7277
7278 differ = (old->small_wonder_visibility != real_packet->small_wonder_visibility);
7279 if (differ) {
7280 different++;
7281 BV_SET(fields, 136);
7282 }
7283
7284 if (different == 0) {
7285 log_packet_detailed(" no change -> discard");
7286 return 0;
7287 }
7288
7289#ifdef FREECIV_JSON_CONNECTION
7290 field_addr.name = "fields";
7291#endif /* FREECIV_JSON_CONNECTION */
7292 e = 0;
7293 e |= DIO_BV_PUT(&dout, &field_addr, fields);
7294 if (e) {
7295 log_packet_detailed("fields bitvector error detected");
7296 }
7297
7298 if (BV_ISSET(fields, 0)) {
7299 log_packet_detailed(" field 'add_to_size_limit' has changed");
7300#ifdef FREECIV_JSON_CONNECTION
7301 field_addr.name = "add_to_size_limit";
7302#endif /* FREECIV_JSON_CONNECTION */
7303 e = 0;
7304 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->add_to_size_limit);
7305 if (e) {
7306 log_packet_detailed("'add_to_size_limit' field error detected");
7307 }
7308 }
7309 if (BV_ISSET(fields, 1)) {
7310 log_packet_detailed(" field 'aifill' has changed");
7311#ifdef FREECIV_JSON_CONNECTION
7312 field_addr.name = "aifill";
7313#endif /* FREECIV_JSON_CONNECTION */
7314 e = 0;
7315 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->aifill);
7316 if (e) {
7317 log_packet_detailed("'aifill' field error detected");
7318 }
7319 }
7320 if (BV_ISSET(fields, 2)) {
7321 log_packet_detailed(" field 'persistent_ready' has changed");
7322#ifdef FREECIV_JSON_CONNECTION
7323 field_addr.name = "persistent_ready";
7324#endif /* FREECIV_JSON_CONNECTION */
7325 e = 0;
7326 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->persistent_ready);
7327 if (e) {
7328 log_packet_detailed("'persistent_ready' field error detected");
7329 }
7330 }
7331 if (BV_ISSET(fields, 3)) {
7332 log_packet_detailed(" field 'airlifting_style' has changed");
7333#ifdef FREECIV_JSON_CONNECTION
7334 field_addr.name = "airlifting_style";
7335#endif /* FREECIV_JSON_CONNECTION */
7336 e = 0;
7337 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlifting_style);
7338 if (e) {
7339 log_packet_detailed("'airlifting_style' field error detected");
7340 }
7341 }
7342 /* field 4 is folded into the header */
7343 /* field 5 is folded into the header */
7344 if (BV_ISSET(fields, 6)) {
7345 log_packet_detailed(" field 'angrycitizen' has changed");
7346#ifdef FREECIV_JSON_CONNECTION
7347 field_addr.name = "angrycitizen";
7348#endif /* FREECIV_JSON_CONNECTION */
7349 e = 0;
7350 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->angrycitizen);
7351 if (e) {
7352 log_packet_detailed("'angrycitizen' field error detected");
7353 }
7354 }
7355 if (BV_ISSET(fields, 7)) {
7356 log_packet_detailed(" field 'base_pollution' has changed");
7357#ifdef FREECIV_JSON_CONNECTION
7358 field_addr.name = "base_pollution";
7359#endif /* FREECIV_JSON_CONNECTION */
7360 e = 0;
7361 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->base_pollution);
7362 if (e) {
7363 log_packet_detailed("'base_pollution' field error detected");
7364 }
7365 }
7366 if (BV_ISSET(fields, 8)) {
7367 log_packet_detailed(" field 'base_tech_cost' has changed");
7368#ifdef FREECIV_JSON_CONNECTION
7369 field_addr.name = "base_tech_cost";
7370#endif /* FREECIV_JSON_CONNECTION */
7371 e = 0;
7372 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->base_tech_cost);
7373 if (e) {
7374 log_packet_detailed("'base_tech_cost' field error detected");
7375 }
7376 }
7377 if (BV_ISSET(fields, 9)) {
7378 log_packet_detailed(" field 'min_tech_cost' has changed");
7379#ifdef FREECIV_JSON_CONNECTION
7380 field_addr.name = "min_tech_cost";
7381#endif /* FREECIV_JSON_CONNECTION */
7382 e = 0;
7383 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_tech_cost);
7384 if (e) {
7385 log_packet_detailed("'min_tech_cost' field error detected");
7386 }
7387 }
7388 if (BV_ISSET(fields, 10)) {
7389 log_packet_detailed(" field 'tech_leak_pct' has changed");
7390#ifdef FREECIV_JSON_CONNECTION
7391 field_addr.name = "tech_leak_pct";
7392#endif /* FREECIV_JSON_CONNECTION */
7393 e = 0;
7394 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leak_pct);
7395 if (e) {
7396 log_packet_detailed("'tech_leak_pct' field error detected");
7397 }
7398 }
7399 if (BV_ISSET(fields, 11)) {
7400 log_packet_detailed(" field 'border_city_radius_sq' has changed");
7401#ifdef FREECIV_JSON_CONNECTION
7402 field_addr.name = "border_city_radius_sq";
7403#endif /* FREECIV_JSON_CONNECTION */
7404 e = 0;
7405 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->border_city_radius_sq);
7406 if (e) {
7407 log_packet_detailed("'border_city_radius_sq' field error detected");
7408 }
7409 }
7410 if (BV_ISSET(fields, 12)) {
7411 log_packet_detailed(" field 'border_size_effect' has changed");
7412#ifdef FREECIV_JSON_CONNECTION
7413 field_addr.name = "border_size_effect";
7414#endif /* FREECIV_JSON_CONNECTION */
7415 e = 0;
7416 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->border_size_effect);
7417 if (e) {
7418 log_packet_detailed("'border_size_effect' field error detected");
7419 }
7420 }
7421 if (BV_ISSET(fields, 13)) {
7422 log_packet_detailed(" field 'border_city_permanent_radius_sq' has changed");
7423#ifdef FREECIV_JSON_CONNECTION
7424 field_addr.name = "border_city_permanent_radius_sq";
7425#endif /* FREECIV_JSON_CONNECTION */
7426 e = 0;
7427 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->border_city_permanent_radius_sq);
7428 if (e) {
7429 log_packet_detailed("'border_city_permanent_radius_sq' field error detected");
7430 }
7431 }
7432 if (BV_ISSET(fields, 14)) {
7433 log_packet_detailed(" field 'borders' has changed");
7434#ifdef FREECIV_JSON_CONNECTION
7435 field_addr.name = "borders";
7436#endif /* FREECIV_JSON_CONNECTION */
7437 e = 0;
7438 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->borders);
7439 if (e) {
7440 log_packet_detailed("'borders' field error detected");
7441 }
7442 }
7443 if (BV_ISSET(fields, 15)) {
7444 log_packet_detailed(" field 'base_bribe_cost' has changed");
7445#ifdef FREECIV_JSON_CONNECTION
7446 field_addr.name = "base_bribe_cost";
7447#endif /* FREECIV_JSON_CONNECTION */
7448 e = 0;
7449 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->base_bribe_cost);
7450 if (e) {
7451 log_packet_detailed("'base_bribe_cost' field error detected");
7452 }
7453 }
7454 if (BV_ISSET(fields, 16)) {
7455 log_packet_detailed(" field 'caravan_bonus_style' has changed");
7456#ifdef FREECIV_JSON_CONNECTION
7457 field_addr.name = "caravan_bonus_style";
7458#endif /* FREECIV_JSON_CONNECTION */
7459 e = 0;
7460 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->caravan_bonus_style);
7461 if (e) {
7462 log_packet_detailed("'caravan_bonus_style' field error detected");
7463 }
7464 }
7465 if (BV_ISSET(fields, 17)) {
7466 log_packet_detailed(" field 'culture_vic_points' has changed");
7467#ifdef FREECIV_JSON_CONNECTION
7468 field_addr.name = "culture_vic_points";
7469#endif /* FREECIV_JSON_CONNECTION */
7470 e = 0;
7471 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture_vic_points);
7472 if (e) {
7473 log_packet_detailed("'culture_vic_points' field error detected");
7474 }
7475 }
7476 if (BV_ISSET(fields, 18)) {
7477 log_packet_detailed(" field 'culture_vic_lead' has changed");
7478#ifdef FREECIV_JSON_CONNECTION
7479 field_addr.name = "culture_vic_lead";
7480#endif /* FREECIV_JSON_CONNECTION */
7481 e = 0;
7482 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_vic_lead);
7483 if (e) {
7484 log_packet_detailed("'culture_vic_lead' field error detected");
7485 }
7486 }
7487 if (BV_ISSET(fields, 19)) {
7488 log_packet_detailed(" field 'culture_migration_pml' has changed");
7489#ifdef FREECIV_JSON_CONNECTION
7490 field_addr.name = "culture_migration_pml";
7491#endif /* FREECIV_JSON_CONNECTION */
7492 e = 0;
7493 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_migration_pml);
7494 if (e) {
7495 log_packet_detailed("'culture_migration_pml' field error detected");
7496 }
7497 }
7498 if (BV_ISSET(fields, 20)) {
7499 log_packet_detailed(" field 'history_interest_pml' has changed");
7500#ifdef FREECIV_JSON_CONNECTION
7501 field_addr.name = "history_interest_pml";
7502#endif /* FREECIV_JSON_CONNECTION */
7503 e = 0;
7504 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->history_interest_pml);
7505 if (e) {
7506 log_packet_detailed("'history_interest_pml' field error detected");
7507 }
7508 }
7509 if (BV_ISSET(fields, 21)) {
7510 log_packet_detailed(" field 'world_peace_turns' has changed");
7511#ifdef FREECIV_JSON_CONNECTION
7512 field_addr.name = "world_peace_turns";
7513#endif /* FREECIV_JSON_CONNECTION */
7514 e = 0;
7515 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->world_peace_turns);
7516 if (e) {
7517 log_packet_detailed("'world_peace_turns' field error detected");
7518 }
7519 }
7520 if (BV_ISSET(fields, 22)) {
7521 log_packet_detailed(" field 'celebratesize' has changed");
7522#ifdef FREECIV_JSON_CONNECTION
7523 field_addr.name = "celebratesize";
7524#endif /* FREECIV_JSON_CONNECTION */
7525 e = 0;
7526 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->celebratesize);
7527 if (e) {
7528 log_packet_detailed("'celebratesize' field error detected");
7529 }
7530 }
7531 /* field 23 is folded into the header */
7532 if (BV_ISSET(fields, 24)) {
7533 log_packet_detailed(" field 'pop_report_zeroes' has changed");
7534#ifdef FREECIV_JSON_CONNECTION
7535 field_addr.name = "pop_report_zeroes";
7536#endif /* FREECIV_JSON_CONNECTION */
7537 e = 0;
7538 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_report_zeroes);
7539 if (e) {
7540 log_packet_detailed("'pop_report_zeroes' field error detected");
7541 }
7542 }
7543 /* field 25 is folded into the header */
7544 /* field 26 is folded into the header */
7545 if (BV_ISSET(fields, 27)) {
7546 log_packet_detailed(" field 'citizen_convert_speed' has changed");
7547#ifdef FREECIV_JSON_CONNECTION
7548 field_addr.name = "citizen_convert_speed";
7549#endif /* FREECIV_JSON_CONNECTION */
7550 e = 0;
7551 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->citizen_convert_speed);
7552 if (e) {
7553 log_packet_detailed("'citizen_convert_speed' field error detected");
7554 }
7555 }
7556 if (BV_ISSET(fields, 28)) {
7557 log_packet_detailed(" field 'conquest_convert_pct' has changed");
7558#ifdef FREECIV_JSON_CONNECTION
7559 field_addr.name = "conquest_convert_pct";
7560#endif /* FREECIV_JSON_CONNECTION */
7561 e = 0;
7562 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->conquest_convert_pct);
7563 if (e) {
7564 log_packet_detailed("'conquest_convert_pct' field error detected");
7565 }
7566 }
7567 if (BV_ISSET(fields, 29)) {
7568 log_packet_detailed(" field 'citizen_partisans_pct' has changed");
7569#ifdef FREECIV_JSON_CONNECTION
7570 field_addr.name = "citizen_partisans_pct";
7571#endif /* FREECIV_JSON_CONNECTION */
7572 e = 0;
7573 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citizen_partisans_pct);
7574 if (e) {
7575 log_packet_detailed("'citizen_partisans_pct' field error detected");
7576 }
7577 }
7578 if (BV_ISSET(fields, 30)) {
7579 log_packet_detailed(" field 'citymindist' has changed");
7580#ifdef FREECIV_JSON_CONNECTION
7581 field_addr.name = "citymindist";
7582#endif /* FREECIV_JSON_CONNECTION */
7583 e = 0;
7584 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citymindist);
7585 if (e) {
7586 log_packet_detailed("'citymindist' field error detected");
7587 }
7588 }
7589 if (BV_ISSET(fields, 31)) {
7590 log_packet_detailed(" field 'cooling' has changed");
7591#ifdef FREECIV_JSON_CONNECTION
7592 field_addr.name = "cooling";
7593#endif /* FREECIV_JSON_CONNECTION */
7594 e = 0;
7595 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cooling);
7596 if (e) {
7597 log_packet_detailed("'cooling' field error detected");
7598 }
7599 }
7600 if (BV_ISSET(fields, 32)) {
7601 log_packet_detailed(" field 'coolinglevel' has changed");
7602#ifdef FREECIV_JSON_CONNECTION
7603 field_addr.name = "coolinglevel";
7604#endif /* FREECIV_JSON_CONNECTION */
7605 e = 0;
7606 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->coolinglevel);
7607 if (e) {
7608 log_packet_detailed("'coolinglevel' field error detected");
7609 }
7610 }
7611 if (BV_ISSET(fields, 33)) {
7612 log_packet_detailed(" field 'diplchance_initial_odds' has changed");
7613#ifdef FREECIV_JSON_CONNECTION
7614 field_addr.name = "diplchance_initial_odds";
7615#endif /* FREECIV_JSON_CONNECTION */
7616 e = 0;
7617 e |= DIO_BV_PUT(&dout, &field_addr, packet->diplchance_initial_odds);
7618 if (e) {
7619 log_packet_detailed("'diplchance_initial_odds' field error detected");
7620 }
7621 }
7622 if (BV_ISSET(fields, 34)) {
7623 log_packet_detailed(" field 'diplomacy' has changed");
7624#ifdef FREECIV_JSON_CONNECTION
7625 field_addr.name = "diplomacy";
7626#endif /* FREECIV_JSON_CONNECTION */
7627 e = 0;
7628 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->diplomacy);
7629 if (e) {
7630 log_packet_detailed("'diplomacy' field error detected");
7631 }
7632 }
7633 /* field 35 is folded into the header */
7634 if (BV_ISSET(fields, 36)) {
7635 log_packet_detailed(" field 'food_cost' has changed");
7636#ifdef FREECIV_JSON_CONNECTION
7637 field_addr.name = "food_cost";
7638#endif /* FREECIV_JSON_CONNECTION */
7639 e = 0;
7640 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_cost);
7641 if (e) {
7642 log_packet_detailed("'food_cost' field error detected");
7643 }
7644 }
7645 if (BV_ISSET(fields, 37)) {
7646 log_packet_detailed(" field 'foodbox' has changed");
7647#ifdef FREECIV_JSON_CONNECTION
7648 field_addr.name = "foodbox";
7649#endif /* FREECIV_JSON_CONNECTION */
7650 e = 0;
7651 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->foodbox);
7652 if (e) {
7653 log_packet_detailed("'foodbox' field error detected");
7654 }
7655 }
7656 if (BV_ISSET(fields, 38)) {
7657 log_packet_detailed(" field 'forced_gold' has changed");
7658#ifdef FREECIV_JSON_CONNECTION
7659 field_addr.name = "forced_gold";
7660#endif /* FREECIV_JSON_CONNECTION */
7661 e = 0;
7662 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_gold);
7663 if (e) {
7664 log_packet_detailed("'forced_gold' field error detected");
7665 }
7666 }
7667 if (BV_ISSET(fields, 39)) {
7668 log_packet_detailed(" field 'forced_luxury' has changed");
7669#ifdef FREECIV_JSON_CONNECTION
7670 field_addr.name = "forced_luxury";
7671#endif /* FREECIV_JSON_CONNECTION */
7672 e = 0;
7673 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_luxury);
7674 if (e) {
7675 log_packet_detailed("'forced_luxury' field error detected");
7676 }
7677 }
7678 if (BV_ISSET(fields, 40)) {
7679 log_packet_detailed(" field 'forced_science' has changed");
7680#ifdef FREECIV_JSON_CONNECTION
7681 field_addr.name = "forced_science";
7682#endif /* FREECIV_JSON_CONNECTION */
7683 e = 0;
7684 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_science);
7685 if (e) {
7686 log_packet_detailed("'forced_science' field error detected");
7687 }
7688 }
7689 if (BV_ISSET(fields, 41)) {
7690 log_packet_detailed(" field 'fulltradesize' has changed");
7691#ifdef FREECIV_JSON_CONNECTION
7692 field_addr.name = "fulltradesize";
7693#endif /* FREECIV_JSON_CONNECTION */
7694 e = 0;
7695 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fulltradesize);
7696 if (e) {
7697 log_packet_detailed("'fulltradesize' field error detected");
7698 }
7699 }
7700 if (BV_ISSET(fields, 42)) {
7701 log_packet_detailed(" field 'trade_world_rel_pct' has changed");
7702#ifdef FREECIV_JSON_CONNECTION
7703 field_addr.name = "trade_world_rel_pct";
7704#endif /* FREECIV_JSON_CONNECTION */
7705 e = 0;
7706 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_world_rel_pct);
7707 if (e) {
7708 log_packet_detailed("'trade_world_rel_pct' field error detected");
7709 }
7710 }
7711 if (BV_ISSET(fields, 43)) {
7712 log_packet_detailed(" field 'min_trade_route_val' has changed");
7713#ifdef FREECIV_JSON_CONNECTION
7714 field_addr.name = "min_trade_route_val";
7715#endif /* FREECIV_JSON_CONNECTION */
7716 e = 0;
7717 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_trade_route_val);
7718 if (e) {
7719 log_packet_detailed("'min_trade_route_val' field error detected");
7720 }
7721 }
7722 /* field 44 is folded into the header */
7723 if (BV_ISSET(fields, 45)) {
7724 log_packet_detailed(" field 'goods_selection' has changed");
7725#ifdef FREECIV_JSON_CONNECTION
7726 field_addr.name = "goods_selection";
7727#endif /* FREECIV_JSON_CONNECTION */
7728 e = 0;
7729 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods_selection);
7730 if (e) {
7731 log_packet_detailed("'goods_selection' field error detected");
7732 }
7733 }
7734 if (BV_ISSET(fields, 46)) {
7735 log_packet_detailed(" field 'global_advance_count' has changed");
7736#ifdef FREECIV_JSON_CONNECTION
7737 field_addr.name = "global_advance_count";
7738#endif /* FREECIV_JSON_CONNECTION */
7739 e = 0;
7740 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_advance_count);
7741 if (e) {
7742 log_packet_detailed("'global_advance_count' field error detected");
7743 }
7744 }
7745 if (BV_ISSET(fields, 47)) {
7746 log_packet_detailed(" field 'global_advances' has changed");
7747#ifdef FREECIV_JSON_CONNECTION
7748 field_addr.name = "global_advances";
7749#endif /* FREECIV_JSON_CONNECTION */
7750 e = 0;
7751 {
7752 int i;
7753
7754#ifdef FREECIV_JSON_CONNECTION
7755 size_t count_i = 0;
7756
7757 /* Create the array. */
7758 e |= DIO_PUT(farray, &dout, &field_addr, 0);
7759
7760 /* Enter array. */
7761 field_addr.sub_location = plocation_elem_new(0);
7762#endif /* FREECIV_JSON_CONNECTION */
7763
7764 fc_assert(A_LAST < MAX_UINT16);
7765
7766 for (i = 0; i < A_LAST; i++) {
7767 differ = (old->global_advances[i] != real_packet->global_advances[i]);
7768
7769 if (differ) {
7770#ifdef FREECIV_JSON_CONNECTION
7771 /* Append next diff array element. */
7772 field_addr.sub_location->number = -1;
7773
7774 /* Create the diff array element. */
7775 e |= DIO_PUT(farray, &dout, &field_addr, 2);
7776
7777 /* Enter diff array element (start at the index address). */
7778 field_addr.sub_location->number = count_i++;
7779 field_addr.sub_location->sub_location = plocation_elem_new(0);
7780#endif /* FREECIV_JSON_CONNECTION */
7781 e |= DIO_PUT(uint16, &dout, &field_addr, i);
7782
7783#ifdef FREECIV_JSON_CONNECTION
7784 /* Content address. */
7785 field_addr.sub_location->sub_location->number = 1;
7786#endif /* FREECIV_JSON_CONNECTION */
7787 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->global_advances[i]);
7788
7789#ifdef FREECIV_JSON_CONNECTION
7790 /* Exit diff array element. */
7791 FC_FREE(field_addr.sub_location->sub_location);
7792#endif /* FREECIV_JSON_CONNECTION */
7793 }
7794 }
7795#ifdef FREECIV_JSON_CONNECTION
7796 /* Append diff array element. */
7797 field_addr.sub_location->number = -1;
7798
7799 /* Create the terminating diff array element. */
7800 e |= DIO_PUT(farray, &dout, &field_addr, 1);
7801
7802 /* Enter diff array element (start at the index address). */
7803 field_addr.sub_location->number = count_i;
7804 field_addr.sub_location->sub_location = plocation_elem_new(0);
7805#endif /* FREECIV_JSON_CONNECTION */
7806 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
7807
7808#ifdef FREECIV_JSON_CONNECTION
7809 /* Exit diff array element. */
7810 FC_FREE(field_addr.sub_location->sub_location);
7811
7812 /* Exit array. */
7813 FC_FREE(field_addr.sub_location);
7814#endif /* FREECIV_JSON_CONNECTION */
7815 }
7816 if (e) {
7817 log_packet_detailed("'global_advances' field error detected");
7818 }
7819 }
7820 /* field 48 is folded into the header */
7821 if (BV_ISSET(fields, 49)) {
7822 log_packet_detailed(" field 'globalwarming' has changed");
7823#ifdef FREECIV_JSON_CONNECTION
7824 field_addr.name = "globalwarming";
7825#endif /* FREECIV_JSON_CONNECTION */
7826 e = 0;
7827 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->globalwarming);
7828 if (e) {
7829 log_packet_detailed("'globalwarming' field error detected");
7830 }
7831 }
7832 if (BV_ISSET(fields, 50)) {
7833 log_packet_detailed(" field 'gold' has changed");
7834#ifdef FREECIV_JSON_CONNECTION
7835 field_addr.name = "gold";
7836#endif /* FREECIV_JSON_CONNECTION */
7837 e = 0;
7838 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
7839 if (e) {
7840 log_packet_detailed("'gold' field error detected");
7841 }
7842 }
7843 if (BV_ISSET(fields, 51)) {
7844 log_packet_detailed(" field 'gold_upkeep_style' has changed");
7845#ifdef FREECIV_JSON_CONNECTION
7846 field_addr.name = "gold_upkeep_style";
7847#endif /* FREECIV_JSON_CONNECTION */
7848 e = 0;
7849 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gold_upkeep_style);
7850 if (e) {
7851 log_packet_detailed("'gold_upkeep_style' field error detected");
7852 }
7853 }
7854 /* field 52 is folded into the header */
7855 if (BV_ISSET(fields, 53)) {
7856 log_packet_detailed(" field 'infrapoints' has changed");
7857#ifdef FREECIV_JSON_CONNECTION
7858 field_addr.name = "infrapoints";
7859#endif /* FREECIV_JSON_CONNECTION */
7860 e = 0;
7861 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
7862 if (e) {
7863 log_packet_detailed("'infrapoints' field error detected");
7864 }
7865 }
7866 if (BV_ISSET(fields, 54)) {
7867 log_packet_detailed(" field 'revolentype' has changed");
7868#ifdef FREECIV_JSON_CONNECTION
7869 field_addr.name = "revolentype";
7870#endif /* FREECIV_JSON_CONNECTION */
7871 e = 0;
7872 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->revolentype);
7873 if (e) {
7874 log_packet_detailed("'revolentype' field error detected");
7875 }
7876 }
7877 if (BV_ISSET(fields, 55)) {
7878 log_packet_detailed(" field 'default_government_id' has changed");
7879#ifdef FREECIV_JSON_CONNECTION
7880 field_addr.name = "default_government_id";
7881#endif /* FREECIV_JSON_CONNECTION */
7882 e = 0;
7883 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_government_id);
7884 if (e) {
7885 log_packet_detailed("'default_government_id' field error detected");
7886 }
7887 }
7888 if (BV_ISSET(fields, 56)) {
7889 log_packet_detailed(" field 'government_during_revolution_id' has changed");
7890#ifdef FREECIV_JSON_CONNECTION
7891 field_addr.name = "government_during_revolution_id";
7892#endif /* FREECIV_JSON_CONNECTION */
7893 e = 0;
7894 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government_during_revolution_id);
7895 if (e) {
7896 log_packet_detailed("'government_during_revolution_id' field error detected");
7897 }
7898 }
7899 if (BV_ISSET(fields, 57)) {
7900 log_packet_detailed(" field 'granary_food_inc' has changed");
7901#ifdef FREECIV_JSON_CONNECTION
7902 field_addr.name = "granary_food_inc";
7903#endif /* FREECIV_JSON_CONNECTION */
7904 e = 0;
7905 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_inc);
7906 if (e) {
7907 log_packet_detailed("'granary_food_inc' field error detected");
7908 }
7909 }
7910 if (BV_ISSET(fields, 58)) {
7911 log_packet_detailed(" field 'granary_food_ini' has changed");
7912#ifdef FREECIV_JSON_CONNECTION
7913 field_addr.name = "granary_food_ini";
7914#endif /* FREECIV_JSON_CONNECTION */
7915 e = 0;
7916 {
7917 int i;
7918
7919#ifdef FREECIV_JSON_CONNECTION
7920 /* Create the array. */
7921 e |= DIO_PUT(farray, &dout, &field_addr, MAX_GRANARY_INIS);
7922
7923 /* Enter the array. */
7924 field_addr.sub_location = plocation_elem_new(0);
7925#endif /* FREECIV_JSON_CONNECTION */
7926
7927 for (i = 0; i < MAX_GRANARY_INIS; i++) {
7928#ifdef FREECIV_JSON_CONNECTION
7929 /* Next array element. */
7930 field_addr.sub_location->number = i;
7931#endif /* FREECIV_JSON_CONNECTION */
7932 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_ini[i]);
7933 }
7934
7935#ifdef FREECIV_JSON_CONNECTION
7936 /* Exit array. */
7937 FC_FREE(field_addr.sub_location);
7938#endif /* FREECIV_JSON_CONNECTION */
7939 }
7940 if (e) {
7941 log_packet_detailed("'granary_food_ini' field error detected");
7942 }
7943 }
7944 if (BV_ISSET(fields, 59)) {
7945 log_packet_detailed(" field 'granary_num_inis' has changed");
7946#ifdef FREECIV_JSON_CONNECTION
7947 field_addr.name = "granary_num_inis";
7948#endif /* FREECIV_JSON_CONNECTION */
7949 e = 0;
7950 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->granary_num_inis);
7951 if (e) {
7952 log_packet_detailed("'granary_num_inis' field error detected");
7953 }
7954 }
7955 if (BV_ISSET(fields, 60)) {
7956 log_packet_detailed(" field 'great_wonder_owners' has changed");
7957#ifdef FREECIV_JSON_CONNECTION
7958 field_addr.name = "great_wonder_owners";
7959#endif /* FREECIV_JSON_CONNECTION */
7960 e = 0;
7961 {
7962 int i;
7963
7964#ifdef FREECIV_JSON_CONNECTION
7965 size_t count_i = 0;
7966
7967 /* Create the array. */
7968 e |= DIO_PUT(farray, &dout, &field_addr, 0);
7969
7970 /* Enter array. */
7971 field_addr.sub_location = plocation_elem_new(0);
7972#endif /* FREECIV_JSON_CONNECTION */
7973
7974 fc_assert(B_LAST < MAX_UINT16);
7975
7976 for (i = 0; i < B_LAST; i++) {
7977 differ = (old->great_wonder_owners[i] != real_packet->great_wonder_owners[i]);
7978
7979 if (differ) {
7980#ifdef FREECIV_JSON_CONNECTION
7981 /* Append next diff array element. */
7982 field_addr.sub_location->number = -1;
7983
7984 /* Create the diff array element. */
7985 e |= DIO_PUT(farray, &dout, &field_addr, 2);
7986
7987 /* Enter diff array element (start at the index address). */
7988 field_addr.sub_location->number = count_i++;
7989 field_addr.sub_location->sub_location = plocation_elem_new(0);
7990#endif /* FREECIV_JSON_CONNECTION */
7991 e |= DIO_PUT(uint16, &dout, &field_addr, i);
7992
7993#ifdef FREECIV_JSON_CONNECTION
7994 /* Content address. */
7995 field_addr.sub_location->sub_location->number = 1;
7996#endif /* FREECIV_JSON_CONNECTION */
7997 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->great_wonder_owners[i]);
7998
7999#ifdef FREECIV_JSON_CONNECTION
8000 /* Exit diff array element. */
8001 FC_FREE(field_addr.sub_location->sub_location);
8002#endif /* FREECIV_JSON_CONNECTION */
8003 }
8004 }
8005#ifdef FREECIV_JSON_CONNECTION
8006 /* Append diff array element. */
8007 field_addr.sub_location->number = -1;
8008
8009 /* Create the terminating diff array element. */
8010 e |= DIO_PUT(farray, &dout, &field_addr, 1);
8011
8012 /* Enter diff array element (start at the index address). */
8013 field_addr.sub_location->number = count_i;
8014 field_addr.sub_location->sub_location = plocation_elem_new(0);
8015#endif /* FREECIV_JSON_CONNECTION */
8016 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
8017
8018#ifdef FREECIV_JSON_CONNECTION
8019 /* Exit diff array element. */
8020 FC_FREE(field_addr.sub_location->sub_location);
8021
8022 /* Exit array. */
8023 FC_FREE(field_addr.sub_location);
8024#endif /* FREECIV_JSON_CONNECTION */
8025 }
8026 if (e) {
8027 log_packet_detailed("'great_wonder_owners' field error detected");
8028 }
8029 }
8030 if (BV_ISSET(fields, 61)) {
8031 log_packet_detailed(" field 'happy_cost' has changed");
8032#ifdef FREECIV_JSON_CONNECTION
8033 field_addr.name = "happy_cost";
8034#endif /* FREECIV_JSON_CONNECTION */
8035 e = 0;
8036 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->happy_cost);
8037 if (e) {
8038 log_packet_detailed("'happy_cost' field error detected");
8039 }
8040 }
8041 if (BV_ISSET(fields, 62)) {
8042 log_packet_detailed(" field 'happyborders' has changed");
8043#ifdef FREECIV_JSON_CONNECTION
8044 field_addr.name = "happyborders";
8045#endif /* FREECIV_JSON_CONNECTION */
8046 e = 0;
8047 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happyborders);
8048 if (e) {
8049 log_packet_detailed("'happyborders' field error detected");
8050 }
8051 }
8052 if (BV_ISSET(fields, 63)) {
8053 log_packet_detailed(" field 'heating' has changed");
8054#ifdef FREECIV_JSON_CONNECTION
8055 field_addr.name = "heating";
8056#endif /* FREECIV_JSON_CONNECTION */
8057 e = 0;
8058 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->heating);
8059 if (e) {
8060 log_packet_detailed("'heating' field error detected");
8061 }
8062 }
8063 if (BV_ISSET(fields, 64)) {
8064 log_packet_detailed(" field 'illness_base_factor' has changed");
8065#ifdef FREECIV_JSON_CONNECTION
8066 field_addr.name = "illness_base_factor";
8067#endif /* FREECIV_JSON_CONNECTION */
8068 e = 0;
8069 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_base_factor);
8070 if (e) {
8071 log_packet_detailed("'illness_base_factor' field error detected");
8072 }
8073 }
8074 if (BV_ISSET(fields, 65)) {
8075 log_packet_detailed(" field 'illness_min_size' has changed");
8076#ifdef FREECIV_JSON_CONNECTION
8077 field_addr.name = "illness_min_size";
8078#endif /* FREECIV_JSON_CONNECTION */
8079 e = 0;
8080 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->illness_min_size);
8081 if (e) {
8082 log_packet_detailed("'illness_min_size' field error detected");
8083 }
8084 }
8085 /* field 66 is folded into the header */
8086 if (BV_ISSET(fields, 67)) {
8087 log_packet_detailed(" field 'illness_pollution_factor' has changed");
8088#ifdef FREECIV_JSON_CONNECTION
8089 field_addr.name = "illness_pollution_factor";
8090#endif /* FREECIV_JSON_CONNECTION */
8091 e = 0;
8092 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_pollution_factor);
8093 if (e) {
8094 log_packet_detailed("'illness_pollution_factor' field error detected");
8095 }
8096 }
8097 if (BV_ISSET(fields, 68)) {
8098 log_packet_detailed(" field 'illness_trade_infection' has changed");
8099#ifdef FREECIV_JSON_CONNECTION
8100 field_addr.name = "illness_trade_infection";
8101#endif /* FREECIV_JSON_CONNECTION */
8102 e = 0;
8103 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade_infection);
8104 if (e) {
8105 log_packet_detailed("'illness_trade_infection' field error detected");
8106 }
8107 }
8108 if (BV_ISSET(fields, 69)) {
8109 log_packet_detailed(" field 'init_city_radius_sq' has changed");
8110#ifdef FREECIV_JSON_CONNECTION
8111 field_addr.name = "init_city_radius_sq";
8112#endif /* FREECIV_JSON_CONNECTION */
8113 e = 0;
8114 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_city_radius_sq);
8115 if (e) {
8116 log_packet_detailed("'init_city_radius_sq' field error detected");
8117 }
8118 }
8119 /* field 70 is folded into the header */
8120 /* field 71 is folded into the header */
8121 /* field 72 is folded into the header */
8122 /* field 73 is folded into the header */
8123 /* field 74 is folded into the header */
8124 /* field 75 is folded into the header */
8125 /* field 76 is folded into the header */
8126 /* field 77 is folded into the header */
8127 if (BV_ISSET(fields, 78)) {
8128 log_packet_detailed(" field 'low_firepower_badwallattacker' has changed");
8129#ifdef FREECIV_JSON_CONNECTION
8130 field_addr.name = "low_firepower_badwallattacker";
8131#endif /* FREECIV_JSON_CONNECTION */
8132 e = 0;
8133 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_badwallattacker);
8134 if (e) {
8135 log_packet_detailed("'low_firepower_badwallattacker' field error detected");
8136 }
8137 }
8138 if (BV_ISSET(fields, 79)) {
8139 log_packet_detailed(" field 'low_firepower_pearl_harbour' has changed");
8140#ifdef FREECIV_JSON_CONNECTION
8141 field_addr.name = "low_firepower_pearl_harbour";
8142#endif /* FREECIV_JSON_CONNECTION */
8143 e = 0;
8144 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_pearl_harbour);
8145 if (e) {
8146 log_packet_detailed("'low_firepower_pearl_harbour' field error detected");
8147 }
8148 }
8149 if (BV_ISSET(fields, 80)) {
8150 log_packet_detailed(" field 'low_firepower_combat_bonus' has changed");
8151#ifdef FREECIV_JSON_CONNECTION
8152 field_addr.name = "low_firepower_combat_bonus";
8153#endif /* FREECIV_JSON_CONNECTION */
8154 e = 0;
8155 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_combat_bonus);
8156 if (e) {
8157 log_packet_detailed("'low_firepower_combat_bonus' field error detected");
8158 }
8159 }
8160 if (BV_ISSET(fields, 81)) {
8161 log_packet_detailed(" field 'low_firepower_nonnat_bombard' has changed");
8162#ifdef FREECIV_JSON_CONNECTION
8163 field_addr.name = "low_firepower_nonnat_bombard";
8164#endif /* FREECIV_JSON_CONNECTION */
8165 e = 0;
8166 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_nonnat_bombard);
8167 if (e) {
8168 log_packet_detailed("'low_firepower_nonnat_bombard' field error detected");
8169 }
8170 }
8171 if (BV_ISSET(fields, 82)) {
8172 log_packet_detailed(" field 'nuke_pop_loss_pct' has changed");
8173#ifdef FREECIV_JSON_CONNECTION
8174 field_addr.name = "nuke_pop_loss_pct";
8175#endif /* FREECIV_JSON_CONNECTION */
8176 e = 0;
8177 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_pop_loss_pct);
8178 if (e) {
8179 log_packet_detailed("'nuke_pop_loss_pct' field error detected");
8180 }
8181 }
8182 if (BV_ISSET(fields, 83)) {
8183 log_packet_detailed(" field 'nuke_defender_survival_chance_pct' has changed");
8184#ifdef FREECIV_JSON_CONNECTION
8185 field_addr.name = "nuke_defender_survival_chance_pct";
8186#endif /* FREECIV_JSON_CONNECTION */
8187 e = 0;
8188 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_defender_survival_chance_pct);
8189 if (e) {
8190 log_packet_detailed("'nuke_defender_survival_chance_pct' field error detected");
8191 }
8192 }
8193 if (BV_ISSET(fields, 84)) {
8194 log_packet_detailed(" field 'min_city_center_output' has changed");
8195#ifdef FREECIV_JSON_CONNECTION
8196 field_addr.name = "min_city_center_output";
8197#endif /* FREECIV_JSON_CONNECTION */
8198 e = 0;
8199 {
8200 int i;
8201
8202#ifdef FREECIV_JSON_CONNECTION
8203 /* Create the array. */
8204 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
8205
8206 /* Enter the array. */
8207 field_addr.sub_location = plocation_elem_new(0);
8208#endif /* FREECIV_JSON_CONNECTION */
8209
8210 for (i = 0; i < O_LAST; i++) {
8211#ifdef FREECIV_JSON_CONNECTION
8212 /* Next array element. */
8213 field_addr.sub_location->number = i;
8214#endif /* FREECIV_JSON_CONNECTION */
8215 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_city_center_output[i]);
8216 }
8217
8218#ifdef FREECIV_JSON_CONNECTION
8219 /* Exit array. */
8220 FC_FREE(field_addr.sub_location);
8221#endif /* FREECIV_JSON_CONNECTION */
8222 }
8223 if (e) {
8224 log_packet_detailed("'min_city_center_output' field error detected");
8225 }
8226 }
8227 /* field 85 is folded into the header */
8228 /* field 86 is folded into the header */
8229 /* field 87 is folded into the header */
8230 if (BV_ISSET(fields, 88)) {
8231 log_packet_detailed(" field 'notradesize' has changed");
8232#ifdef FREECIV_JSON_CONNECTION
8233 field_addr.name = "notradesize";
8234#endif /* FREECIV_JSON_CONNECTION */
8235 e = 0;
8236 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->notradesize);
8237 if (e) {
8238 log_packet_detailed("'notradesize' field error detected");
8239 }
8240 }
8241 /* field 89 is folded into the header */
8242 if (BV_ISSET(fields, 90)) {
8243 log_packet_detailed(" field 'nuclearwinter' has changed");
8244#ifdef FREECIV_JSON_CONNECTION
8245 field_addr.name = "nuclearwinter";
8246#endif /* FREECIV_JSON_CONNECTION */
8247 e = 0;
8248 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->nuclearwinter);
8249 if (e) {
8250 log_packet_detailed("'nuclearwinter' field error detected");
8251 }
8252 }
8253 if (BV_ISSET(fields, 91)) {
8254 log_packet_detailed(" field 'phase' has changed");
8255#ifdef FREECIV_JSON_CONNECTION
8256 field_addr.name = "phase";
8257#endif /* FREECIV_JSON_CONNECTION */
8258 e = 0;
8259 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
8260 if (e) {
8261 log_packet_detailed("'phase' field error detected");
8262 }
8263 }
8264 if (BV_ISSET(fields, 92)) {
8265 log_packet_detailed(" field 'phase_mode' has changed");
8266#ifdef FREECIV_JSON_CONNECTION
8267 field_addr.name = "phase_mode";
8268#endif /* FREECIV_JSON_CONNECTION */
8269 e = 0;
8270 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->phase_mode);
8271 if (e) {
8272 log_packet_detailed("'phase_mode' field error detected");
8273 }
8274 }
8275 /* field 93 is folded into the header */
8276 /* field 94 is folded into the header */
8277 /* field 95 is folded into the header */
8278 /* field 96 is folded into the header */
8279 /* field 97 is folded into the header */
8280 /* field 98 is folded into the header */
8281 /* field 99 is folded into the header */
8282 /* field 100 is folded into the header */
8283 if (BV_ISSET(fields, 101)) {
8284 log_packet_detailed(" field 'rapturedelay' has changed");
8285#ifdef FREECIV_JSON_CONNECTION
8286 field_addr.name = "rapturedelay";
8287#endif /* FREECIV_JSON_CONNECTION */
8288 e = 0;
8289 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapturedelay);
8290 if (e) {
8291 log_packet_detailed("'rapturedelay' field error detected");
8292 }
8293 }
8294 if (BV_ISSET(fields, 102)) {
8295 log_packet_detailed(" field 'disasters' has changed");
8296#ifdef FREECIV_JSON_CONNECTION
8297 field_addr.name = "disasters";
8298#endif /* FREECIV_JSON_CONNECTION */
8299 e = 0;
8300 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disasters);
8301 if (e) {
8302 log_packet_detailed("'disasters' field error detected");
8303 }
8304 }
8305 /* field 103 is folded into the header */
8306 /* field 104 is folded into the header */
8307 if (BV_ISSET(fields, 105)) {
8308 log_packet_detailed(" field 'sciencebox' has changed");
8309#ifdef FREECIV_JSON_CONNECTION
8310 field_addr.name = "sciencebox";
8311#endif /* FREECIV_JSON_CONNECTION */
8312 e = 0;
8313 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->sciencebox);
8314 if (e) {
8315 log_packet_detailed("'sciencebox' field error detected");
8316 }
8317 }
8318 if (BV_ISSET(fields, 106)) {
8319 log_packet_detailed(" field 'shieldbox' has changed");
8320#ifdef FREECIV_JSON_CONNECTION
8321 field_addr.name = "shieldbox";
8322#endif /* FREECIV_JSON_CONNECTION */
8323 e = 0;
8324 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->shieldbox);
8325 if (e) {
8326 log_packet_detailed("'shieldbox' field error detected");
8327 }
8328 }
8329 if (BV_ISSET(fields, 107)) {
8330 log_packet_detailed(" field 'skill_level' has changed");
8331#ifdef FREECIV_JSON_CONNECTION
8332 field_addr.name = "skill_level";
8333#endif /* FREECIV_JSON_CONNECTION */
8334 e = 0;
8335 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->skill_level);
8336 if (e) {
8337 log_packet_detailed("'skill_level' field error detected");
8338 }
8339 }
8340 if (BV_ISSET(fields, 108)) {
8341 log_packet_detailed(" field 'victory_conditions' has changed");
8342#ifdef FREECIV_JSON_CONNECTION
8343 field_addr.name = "victory_conditions";
8344#endif /* FREECIV_JSON_CONNECTION */
8345 e = 0;
8346 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->victory_conditions);
8347 if (e) {
8348 log_packet_detailed("'victory_conditions' field error detected");
8349 }
8350 }
8351 /* field 109 is folded into the header */
8352 if (BV_ISSET(fields, 110)) {
8353 log_packet_detailed(" field 'tech' has changed");
8354#ifdef FREECIV_JSON_CONNECTION
8355 field_addr.name = "tech";
8356#endif /* FREECIV_JSON_CONNECTION */
8357 e = 0;
8358 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->tech);
8359 if (e) {
8360 log_packet_detailed("'tech' field error detected");
8361 }
8362 }
8363 if (BV_ISSET(fields, 111)) {
8364 log_packet_detailed(" field 'tech_cost_style' has changed");
8365#ifdef FREECIV_JSON_CONNECTION
8366 field_addr.name = "tech_cost_style";
8367#endif /* FREECIV_JSON_CONNECTION */
8368 e = 0;
8369 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_cost_style);
8370 if (e) {
8371 log_packet_detailed("'tech_cost_style' field error detected");
8372 }
8373 }
8374 if (BV_ISSET(fields, 112)) {
8375 log_packet_detailed(" field 'tech_leakage' has changed");
8376#ifdef FREECIV_JSON_CONNECTION
8377 field_addr.name = "tech_leakage";
8378#endif /* FREECIV_JSON_CONNECTION */
8379 e = 0;
8380 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leakage);
8381 if (e) {
8382 log_packet_detailed("'tech_leakage' field error detected");
8383 }
8384 }
8385 if (BV_ISSET(fields, 113)) {
8386 log_packet_detailed(" field 'tech_upkeep_divider' has changed");
8387#ifdef FREECIV_JSON_CONNECTION
8388 field_addr.name = "tech_upkeep_divider";
8389#endif /* FREECIV_JSON_CONNECTION */
8390 e = 0;
8391 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep_divider);
8392 if (e) {
8393 log_packet_detailed("'tech_upkeep_divider' field error detected");
8394 }
8395 }
8396 if (BV_ISSET(fields, 114)) {
8397 log_packet_detailed(" field 'tech_upkeep_style' has changed");
8398#ifdef FREECIV_JSON_CONNECTION
8399 field_addr.name = "tech_upkeep_style";
8400#endif /* FREECIV_JSON_CONNECTION */
8401 e = 0;
8402 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_upkeep_style);
8403 if (e) {
8404 log_packet_detailed("'tech_upkeep_style' field error detected");
8405 }
8406 }
8407 if (BV_ISSET(fields, 115)) {
8408 log_packet_detailed(" field 'techloss_forgiveness' has changed");
8409#ifdef FREECIV_JSON_CONNECTION
8410 field_addr.name = "techloss_forgiveness";
8411#endif /* FREECIV_JSON_CONNECTION */
8412 e = 0;
8413 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->techloss_forgiveness);
8414 if (e) {
8415 log_packet_detailed("'techloss_forgiveness' field error detected");
8416 }
8417 }
8418 if (BV_ISSET(fields, 116)) {
8419 log_packet_detailed(" field 'free_tech_method' has changed");
8420#ifdef FREECIV_JSON_CONNECTION
8421 field_addr.name = "free_tech_method";
8422#endif /* FREECIV_JSON_CONNECTION */
8423 e = 0;
8424 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->free_tech_method);
8425 if (e) {
8426 log_packet_detailed("'free_tech_method' field error detected");
8427 }
8428 }
8429 if (BV_ISSET(fields, 117)) {
8430 log_packet_detailed(" field 'gameloss_style' has changed");
8431#ifdef FREECIV_JSON_CONNECTION
8432 field_addr.name = "gameloss_style";
8433#endif /* FREECIV_JSON_CONNECTION */
8434 e = 0;
8435 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gameloss_style);
8436 if (e) {
8437 log_packet_detailed("'gameloss_style' field error detected");
8438 }
8439 }
8440 if (BV_ISSET(fields, 118)) {
8441 log_packet_detailed(" field 'timeout' has changed");
8442#ifdef FREECIV_JSON_CONNECTION
8443 field_addr.name = "timeout";
8444#endif /* FREECIV_JSON_CONNECTION */
8445 e = 0;
8446 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->timeout);
8447 if (e) {
8448 log_packet_detailed("'timeout' field error detected");
8449 }
8450 }
8451 if (BV_ISSET(fields, 119)) {
8452 log_packet_detailed(" field 'first_timeout' has changed");
8453#ifdef FREECIV_JSON_CONNECTION
8454 field_addr.name = "first_timeout";
8455#endif /* FREECIV_JSON_CONNECTION */
8456 e = 0;
8457 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->first_timeout);
8458 if (e) {
8459 log_packet_detailed("'first_timeout' field error detected");
8460 }
8461 }
8462 /* field 120 is folded into the header */
8463 if (BV_ISSET(fields, 121)) {
8464 log_packet_detailed(" field 'trademindist' has changed");
8465#ifdef FREECIV_JSON_CONNECTION
8466 field_addr.name = "trademindist";
8467#endif /* FREECIV_JSON_CONNECTION */
8468 e = 0;
8469 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trademindist);
8470 if (e) {
8471 log_packet_detailed("'trademindist' field error detected");
8472 }
8473 }
8474 if (BV_ISSET(fields, 122)) {
8475 log_packet_detailed(" field 'trade_revenue_style' has changed");
8476#ifdef FREECIV_JSON_CONNECTION
8477 field_addr.name = "trade_revenue_style";
8478#endif /* FREECIV_JSON_CONNECTION */
8479 e = 0;
8480 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_revenue_style);
8481 if (e) {
8482 log_packet_detailed("'trade_revenue_style' field error detected");
8483 }
8484 }
8485 /* field 123 is folded into the header */
8486 /* field 124 is folded into the header */
8487 /* field 125 is folded into the header */
8488 if (BV_ISSET(fields, 126)) {
8489 log_packet_detailed(" field 'turn' has changed");
8490#ifdef FREECIV_JSON_CONNECTION
8491 field_addr.name = "turn";
8492#endif /* FREECIV_JSON_CONNECTION */
8493 e = 0;
8494 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
8495 if (e) {
8496 log_packet_detailed("'turn' field error detected");
8497 }
8498 }
8499 if (BV_ISSET(fields, 127)) {
8500 log_packet_detailed(" field 'warminglevel' has changed");
8501#ifdef FREECIV_JSON_CONNECTION
8502 field_addr.name = "warminglevel";
8503#endif /* FREECIV_JSON_CONNECTION */
8504 e = 0;
8505 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->warminglevel);
8506 if (e) {
8507 log_packet_detailed("'warminglevel' field error detected");
8508 }
8509 }
8510 if (BV_ISSET(fields, 128)) {
8511 log_packet_detailed(" field 'year' has changed");
8512#ifdef FREECIV_JSON_CONNECTION
8513 field_addr.name = "year";
8514#endif /* FREECIV_JSON_CONNECTION */
8515 e = 0;
8516 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
8517 if (e) {
8518 log_packet_detailed("'year' field error detected");
8519 }
8520 }
8521 /* field 129 is folded into the header */
8522 if (BV_ISSET(fields, 130)) {
8523 log_packet_detailed(" field 'top_cities_count' has changed");
8524#ifdef FREECIV_JSON_CONNECTION
8525 field_addr.name = "top_cities_count";
8526#endif /* FREECIV_JSON_CONNECTION */
8527 e = 0;
8528 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->top_cities_count);
8529 if (e) {
8530 log_packet_detailed("'top_cities_count' field error detected");
8531 }
8532 }
8533 if (BV_ISSET(fields, 131)) {
8534 log_packet_detailed(" field 'fragment_count' has changed");
8535#ifdef FREECIV_JSON_CONNECTION
8536 field_addr.name = "fragment_count";
8537#endif /* FREECIV_JSON_CONNECTION */
8538 e = 0;
8539 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragment_count);
8540 if (e) {
8541 log_packet_detailed("'fragment_count' field error detected");
8542 }
8543 }
8544 /* field 132 is folded into the header */
8545 if (BV_ISSET(fields, 133)) {
8546 log_packet_detailed(" field 'civil_war_bonus_celebrating' has changed");
8547#ifdef FREECIV_JSON_CONNECTION
8548 field_addr.name = "civil_war_bonus_celebrating";
8549#endif /* FREECIV_JSON_CONNECTION */
8550 e = 0;
8551 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_celebrating);
8552 if (e) {
8553 log_packet_detailed("'civil_war_bonus_celebrating' field error detected");
8554 }
8555 }
8556 if (BV_ISSET(fields, 134)) {
8557 log_packet_detailed(" field 'civil_war_bonus_unhappy' has changed");
8558#ifdef FREECIV_JSON_CONNECTION
8559 field_addr.name = "civil_war_bonus_unhappy";
8560#endif /* FREECIV_JSON_CONNECTION */
8561 e = 0;
8562 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_unhappy);
8563 if (e) {
8564 log_packet_detailed("'civil_war_bonus_unhappy' field error detected");
8565 }
8566 }
8567 if (BV_ISSET(fields, 135)) {
8568 log_packet_detailed(" field 'granularity' has changed");
8569#ifdef FREECIV_JSON_CONNECTION
8570 field_addr.name = "granularity";
8571#endif /* FREECIV_JSON_CONNECTION */
8572 e = 0;
8573 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granularity);
8574 if (e) {
8575 log_packet_detailed("'granularity' field error detected");
8576 }
8577 }
8578 if (BV_ISSET(fields, 136)) {
8579 log_packet_detailed(" field 'small_wonder_visibility' has changed");
8580#ifdef FREECIV_JSON_CONNECTION
8581 field_addr.name = "small_wonder_visibility";
8582#endif /* FREECIV_JSON_CONNECTION */
8583 e = 0;
8584 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->small_wonder_visibility);
8585 if (e) {
8586 log_packet_detailed("'small_wonder_visibility' field error detected");
8587 }
8588 }
8589
8590 *old = *real_packet;
8591#endif /* FREECIV_DELTA_PROTOCOL */
8592#ifndef FREECIV_DELTA_PROTOCOL
8593#ifdef FREECIV_JSON_CONNECTION
8594 field_addr.name = "add_to_size_limit";
8595#endif /* FREECIV_JSON_CONNECTION */
8596 e = 0;
8597 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->add_to_size_limit);
8598 if (e) {
8599 log_packet_detailed("'add_to_size_limit' field error detected");
8600 }
8601#ifdef FREECIV_JSON_CONNECTION
8602 field_addr.name = "aifill";
8603#endif /* FREECIV_JSON_CONNECTION */
8604 e = 0;
8605 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->aifill);
8606 if (e) {
8607 log_packet_detailed("'aifill' field error detected");
8608 }
8609#ifdef FREECIV_JSON_CONNECTION
8610 field_addr.name = "persistent_ready";
8611#endif /* FREECIV_JSON_CONNECTION */
8612 e = 0;
8613 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->persistent_ready);
8614 if (e) {
8615 log_packet_detailed("'persistent_ready' field error detected");
8616 }
8617#ifdef FREECIV_JSON_CONNECTION
8618 field_addr.name = "airlifting_style";
8619#endif /* FREECIV_JSON_CONNECTION */
8620 e = 0;
8621 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlifting_style);
8622 if (e) {
8623 log_packet_detailed("'airlifting_style' field error detected");
8624 }
8625#ifdef FREECIV_JSON_CONNECTION
8626 field_addr.name = "airlift_from_always_enabled";
8627#endif /* FREECIV_JSON_CONNECTION */
8628 e = 0;
8629 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift_from_always_enabled);
8630 if (e) {
8631 log_packet_detailed("'airlift_from_always_enabled' field error detected");
8632 }
8633#ifdef FREECIV_JSON_CONNECTION
8634 field_addr.name = "airlift_to_always_enabled";
8635#endif /* FREECIV_JSON_CONNECTION */
8636 e = 0;
8637 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift_to_always_enabled);
8638 if (e) {
8639 log_packet_detailed("'airlift_to_always_enabled' field error detected");
8640 }
8641#ifdef FREECIV_JSON_CONNECTION
8642 field_addr.name = "angrycitizen";
8643#endif /* FREECIV_JSON_CONNECTION */
8644 e = 0;
8645 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->angrycitizen);
8646 if (e) {
8647 log_packet_detailed("'angrycitizen' field error detected");
8648 }
8649#ifdef FREECIV_JSON_CONNECTION
8650 field_addr.name = "base_pollution";
8651#endif /* FREECIV_JSON_CONNECTION */
8652 e = 0;
8653 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->base_pollution);
8654 if (e) {
8655 log_packet_detailed("'base_pollution' field error detected");
8656 }
8657#ifdef FREECIV_JSON_CONNECTION
8658 field_addr.name = "base_tech_cost";
8659#endif /* FREECIV_JSON_CONNECTION */
8660 e = 0;
8661 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->base_tech_cost);
8662 if (e) {
8663 log_packet_detailed("'base_tech_cost' field error detected");
8664 }
8665#ifdef FREECIV_JSON_CONNECTION
8666 field_addr.name = "min_tech_cost";
8667#endif /* FREECIV_JSON_CONNECTION */
8668 e = 0;
8669 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_tech_cost);
8670 if (e) {
8671 log_packet_detailed("'min_tech_cost' field error detected");
8672 }
8673#ifdef FREECIV_JSON_CONNECTION
8674 field_addr.name = "tech_leak_pct";
8675#endif /* FREECIV_JSON_CONNECTION */
8676 e = 0;
8677 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leak_pct);
8678 if (e) {
8679 log_packet_detailed("'tech_leak_pct' field error detected");
8680 }
8681#ifdef FREECIV_JSON_CONNECTION
8682 field_addr.name = "border_city_radius_sq";
8683#endif /* FREECIV_JSON_CONNECTION */
8684 e = 0;
8685 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->border_city_radius_sq);
8686 if (e) {
8687 log_packet_detailed("'border_city_radius_sq' field error detected");
8688 }
8689#ifdef FREECIV_JSON_CONNECTION
8690 field_addr.name = "border_size_effect";
8691#endif /* FREECIV_JSON_CONNECTION */
8692 e = 0;
8693 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->border_size_effect);
8694 if (e) {
8695 log_packet_detailed("'border_size_effect' field error detected");
8696 }
8697#ifdef FREECIV_JSON_CONNECTION
8698 field_addr.name = "border_city_permanent_radius_sq";
8699#endif /* FREECIV_JSON_CONNECTION */
8700 e = 0;
8701 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->border_city_permanent_radius_sq);
8702 if (e) {
8703 log_packet_detailed("'border_city_permanent_radius_sq' field error detected");
8704 }
8705#ifdef FREECIV_JSON_CONNECTION
8706 field_addr.name = "borders";
8707#endif /* FREECIV_JSON_CONNECTION */
8708 e = 0;
8709 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->borders);
8710 if (e) {
8711 log_packet_detailed("'borders' field error detected");
8712 }
8713#ifdef FREECIV_JSON_CONNECTION
8714 field_addr.name = "base_bribe_cost";
8715#endif /* FREECIV_JSON_CONNECTION */
8716 e = 0;
8717 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->base_bribe_cost);
8718 if (e) {
8719 log_packet_detailed("'base_bribe_cost' field error detected");
8720 }
8721#ifdef FREECIV_JSON_CONNECTION
8722 field_addr.name = "caravan_bonus_style";
8723#endif /* FREECIV_JSON_CONNECTION */
8724 e = 0;
8725 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->caravan_bonus_style);
8726 if (e) {
8727 log_packet_detailed("'caravan_bonus_style' field error detected");
8728 }
8729#ifdef FREECIV_JSON_CONNECTION
8730 field_addr.name = "culture_vic_points";
8731#endif /* FREECIV_JSON_CONNECTION */
8732 e = 0;
8733 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture_vic_points);
8734 if (e) {
8735 log_packet_detailed("'culture_vic_points' field error detected");
8736 }
8737#ifdef FREECIV_JSON_CONNECTION
8738 field_addr.name = "culture_vic_lead";
8739#endif /* FREECIV_JSON_CONNECTION */
8740 e = 0;
8741 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_vic_lead);
8742 if (e) {
8743 log_packet_detailed("'culture_vic_lead' field error detected");
8744 }
8745#ifdef FREECIV_JSON_CONNECTION
8746 field_addr.name = "culture_migration_pml";
8747#endif /* FREECIV_JSON_CONNECTION */
8748 e = 0;
8749 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_migration_pml);
8750 if (e) {
8751 log_packet_detailed("'culture_migration_pml' field error detected");
8752 }
8753#ifdef FREECIV_JSON_CONNECTION
8754 field_addr.name = "history_interest_pml";
8755#endif /* FREECIV_JSON_CONNECTION */
8756 e = 0;
8757 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->history_interest_pml);
8758 if (e) {
8759 log_packet_detailed("'history_interest_pml' field error detected");
8760 }
8761#ifdef FREECIV_JSON_CONNECTION
8762 field_addr.name = "world_peace_turns";
8763#endif /* FREECIV_JSON_CONNECTION */
8764 e = 0;
8765 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->world_peace_turns);
8766 if (e) {
8767 log_packet_detailed("'world_peace_turns' field error detected");
8768 }
8769#ifdef FREECIV_JSON_CONNECTION
8770 field_addr.name = "celebratesize";
8771#endif /* FREECIV_JSON_CONNECTION */
8772 e = 0;
8773 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->celebratesize);
8774 if (e) {
8775 log_packet_detailed("'celebratesize' field error detected");
8776 }
8777#ifdef FREECIV_JSON_CONNECTION
8778 field_addr.name = "changable_tax";
8779#endif /* FREECIV_JSON_CONNECTION */
8780 e = 0;
8781 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->changable_tax);
8782 if (e) {
8783 log_packet_detailed("'changable_tax' field error detected");
8784 }
8785#ifdef FREECIV_JSON_CONNECTION
8786 field_addr.name = "pop_report_zeroes";
8787#endif /* FREECIV_JSON_CONNECTION */
8788 e = 0;
8789 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_report_zeroes);
8790 if (e) {
8791 log_packet_detailed("'pop_report_zeroes' field error detected");
8792 }
8793#ifdef FREECIV_JSON_CONNECTION
8794 field_addr.name = "citizen_nationality";
8795#endif /* FREECIV_JSON_CONNECTION */
8796 e = 0;
8797 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->citizen_nationality);
8798 if (e) {
8799 log_packet_detailed("'citizen_nationality' field error detected");
8800 }
8801#ifdef FREECIV_JSON_CONNECTION
8802 field_addr.name = "unit_builders_nationality";
8803#endif /* FREECIV_JSON_CONNECTION */
8804 e = 0;
8805 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unit_builders_nationality);
8806 if (e) {
8807 log_packet_detailed("'unit_builders_nationality' field error detected");
8808 }
8809#ifdef FREECIV_JSON_CONNECTION
8810 field_addr.name = "citizen_convert_speed";
8811#endif /* FREECIV_JSON_CONNECTION */
8812 e = 0;
8813 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->citizen_convert_speed);
8814 if (e) {
8815 log_packet_detailed("'citizen_convert_speed' field error detected");
8816 }
8817#ifdef FREECIV_JSON_CONNECTION
8818 field_addr.name = "conquest_convert_pct";
8819#endif /* FREECIV_JSON_CONNECTION */
8820 e = 0;
8821 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->conquest_convert_pct);
8822 if (e) {
8823 log_packet_detailed("'conquest_convert_pct' field error detected");
8824 }
8825#ifdef FREECIV_JSON_CONNECTION
8826 field_addr.name = "citizen_partisans_pct";
8827#endif /* FREECIV_JSON_CONNECTION */
8828 e = 0;
8829 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citizen_partisans_pct);
8830 if (e) {
8831 log_packet_detailed("'citizen_partisans_pct' field error detected");
8832 }
8833#ifdef FREECIV_JSON_CONNECTION
8834 field_addr.name = "citymindist";
8835#endif /* FREECIV_JSON_CONNECTION */
8836 e = 0;
8837 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citymindist);
8838 if (e) {
8839 log_packet_detailed("'citymindist' field error detected");
8840 }
8841#ifdef FREECIV_JSON_CONNECTION
8842 field_addr.name = "cooling";
8843#endif /* FREECIV_JSON_CONNECTION */
8844 e = 0;
8845 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cooling);
8846 if (e) {
8847 log_packet_detailed("'cooling' field error detected");
8848 }
8849#ifdef FREECIV_JSON_CONNECTION
8850 field_addr.name = "coolinglevel";
8851#endif /* FREECIV_JSON_CONNECTION */
8852 e = 0;
8853 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->coolinglevel);
8854 if (e) {
8855 log_packet_detailed("'coolinglevel' field error detected");
8856 }
8857#ifdef FREECIV_JSON_CONNECTION
8858 field_addr.name = "diplchance_initial_odds";
8859#endif /* FREECIV_JSON_CONNECTION */
8860 e = 0;
8861 e |= DIO_BV_PUT(&dout, &field_addr, packet->diplchance_initial_odds);
8862 if (e) {
8863 log_packet_detailed("'diplchance_initial_odds' field error detected");
8864 }
8865#ifdef FREECIV_JSON_CONNECTION
8866 field_addr.name = "diplomacy";
8867#endif /* FREECIV_JSON_CONNECTION */
8868 e = 0;
8869 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->diplomacy);
8870 if (e) {
8871 log_packet_detailed("'diplomacy' field error detected");
8872 }
8873#ifdef FREECIV_JSON_CONNECTION
8874 field_addr.name = "fogofwar";
8875#endif /* FREECIV_JSON_CONNECTION */
8876 e = 0;
8877 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->fogofwar);
8878 if (e) {
8879 log_packet_detailed("'fogofwar' field error detected");
8880 }
8881#ifdef FREECIV_JSON_CONNECTION
8882 field_addr.name = "food_cost";
8883#endif /* FREECIV_JSON_CONNECTION */
8884 e = 0;
8885 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_cost);
8886 if (e) {
8887 log_packet_detailed("'food_cost' field error detected");
8888 }
8889#ifdef FREECIV_JSON_CONNECTION
8890 field_addr.name = "foodbox";
8891#endif /* FREECIV_JSON_CONNECTION */
8892 e = 0;
8893 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->foodbox);
8894 if (e) {
8895 log_packet_detailed("'foodbox' field error detected");
8896 }
8897#ifdef FREECIV_JSON_CONNECTION
8898 field_addr.name = "forced_gold";
8899#endif /* FREECIV_JSON_CONNECTION */
8900 e = 0;
8901 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_gold);
8902 if (e) {
8903 log_packet_detailed("'forced_gold' field error detected");
8904 }
8905#ifdef FREECIV_JSON_CONNECTION
8906 field_addr.name = "forced_luxury";
8907#endif /* FREECIV_JSON_CONNECTION */
8908 e = 0;
8909 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_luxury);
8910 if (e) {
8911 log_packet_detailed("'forced_luxury' field error detected");
8912 }
8913#ifdef FREECIV_JSON_CONNECTION
8914 field_addr.name = "forced_science";
8915#endif /* FREECIV_JSON_CONNECTION */
8916 e = 0;
8917 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_science);
8918 if (e) {
8919 log_packet_detailed("'forced_science' field error detected");
8920 }
8921#ifdef FREECIV_JSON_CONNECTION
8922 field_addr.name = "fulltradesize";
8923#endif /* FREECIV_JSON_CONNECTION */
8924 e = 0;
8925 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fulltradesize);
8926 if (e) {
8927 log_packet_detailed("'fulltradesize' field error detected");
8928 }
8929#ifdef FREECIV_JSON_CONNECTION
8930 field_addr.name = "trade_world_rel_pct";
8931#endif /* FREECIV_JSON_CONNECTION */
8932 e = 0;
8933 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_world_rel_pct);
8934 if (e) {
8935 log_packet_detailed("'trade_world_rel_pct' field error detected");
8936 }
8937#ifdef FREECIV_JSON_CONNECTION
8938 field_addr.name = "min_trade_route_val";
8939#endif /* FREECIV_JSON_CONNECTION */
8940 e = 0;
8941 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_trade_route_val);
8942 if (e) {
8943 log_packet_detailed("'min_trade_route_val' field error detected");
8944 }
8945#ifdef FREECIV_JSON_CONNECTION
8946 field_addr.name = "reveal_trade_partner";
8947#endif /* FREECIV_JSON_CONNECTION */
8948 e = 0;
8949 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->reveal_trade_partner);
8950 if (e) {
8951 log_packet_detailed("'reveal_trade_partner' field error detected");
8952 }
8953#ifdef FREECIV_JSON_CONNECTION
8954 field_addr.name = "goods_selection";
8955#endif /* FREECIV_JSON_CONNECTION */
8956 e = 0;
8957 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods_selection);
8958 if (e) {
8959 log_packet_detailed("'goods_selection' field error detected");
8960 }
8961#ifdef FREECIV_JSON_CONNECTION
8962 field_addr.name = "global_advance_count";
8963#endif /* FREECIV_JSON_CONNECTION */
8964 e = 0;
8965 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_advance_count);
8966 if (e) {
8967 log_packet_detailed("'global_advance_count' field error detected");
8968 }
8969#ifdef FREECIV_JSON_CONNECTION
8970 field_addr.name = "global_advances";
8971#endif /* FREECIV_JSON_CONNECTION */
8972 e = 0;
8973 {
8974 int i;
8975
8976#ifdef FREECIV_JSON_CONNECTION
8977 /* Create the array. */
8978 e |= DIO_PUT(farray, &dout, &field_addr, A_LAST);
8979
8980 /* Enter the array. */
8981 field_addr.sub_location = plocation_elem_new(0);
8982#endif /* FREECIV_JSON_CONNECTION */
8983
8984 for (i = 0; i < A_LAST; i++) {
8985#ifdef FREECIV_JSON_CONNECTION
8986 /* Next array element. */
8987 field_addr.sub_location->number = i;
8988#endif /* FREECIV_JSON_CONNECTION */
8989 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->global_advances[i]);
8990 }
8991
8992#ifdef FREECIV_JSON_CONNECTION
8993 /* Exit array. */
8994 FC_FREE(field_addr.sub_location);
8995#endif /* FREECIV_JSON_CONNECTION */
8996 }
8997 if (e) {
8998 log_packet_detailed("'global_advances' field error detected");
8999 }
9000#ifdef FREECIV_JSON_CONNECTION
9001 field_addr.name = "global_warming";
9002#endif /* FREECIV_JSON_CONNECTION */
9003 e = 0;
9004 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->global_warming);
9005 if (e) {
9006 log_packet_detailed("'global_warming' field error detected");
9007 }
9008#ifdef FREECIV_JSON_CONNECTION
9009 field_addr.name = "globalwarming";
9010#endif /* FREECIV_JSON_CONNECTION */
9011 e = 0;
9012 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->globalwarming);
9013 if (e) {
9014 log_packet_detailed("'globalwarming' field error detected");
9015 }
9016#ifdef FREECIV_JSON_CONNECTION
9017 field_addr.name = "gold";
9018#endif /* FREECIV_JSON_CONNECTION */
9019 e = 0;
9020 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
9021 if (e) {
9022 log_packet_detailed("'gold' field error detected");
9023 }
9024#ifdef FREECIV_JSON_CONNECTION
9025 field_addr.name = "gold_upkeep_style";
9026#endif /* FREECIV_JSON_CONNECTION */
9027 e = 0;
9028 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gold_upkeep_style);
9029 if (e) {
9030 log_packet_detailed("'gold_upkeep_style' field error detected");
9031 }
9032#ifdef FREECIV_JSON_CONNECTION
9033 field_addr.name = "homeless_gold_upkeep";
9034#endif /* FREECIV_JSON_CONNECTION */
9035 e = 0;
9036 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->homeless_gold_upkeep);
9037 if (e) {
9038 log_packet_detailed("'homeless_gold_upkeep' field error detected");
9039 }
9040#ifdef FREECIV_JSON_CONNECTION
9041 field_addr.name = "infrapoints";
9042#endif /* FREECIV_JSON_CONNECTION */
9043 e = 0;
9044 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
9045 if (e) {
9046 log_packet_detailed("'infrapoints' field error detected");
9047 }
9048#ifdef FREECIV_JSON_CONNECTION
9049 field_addr.name = "revolentype";
9050#endif /* FREECIV_JSON_CONNECTION */
9051 e = 0;
9052 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->revolentype);
9053 if (e) {
9054 log_packet_detailed("'revolentype' field error detected");
9055 }
9056#ifdef FREECIV_JSON_CONNECTION
9057 field_addr.name = "default_government_id";
9058#endif /* FREECIV_JSON_CONNECTION */
9059 e = 0;
9060 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_government_id);
9061 if (e) {
9062 log_packet_detailed("'default_government_id' field error detected");
9063 }
9064#ifdef FREECIV_JSON_CONNECTION
9065 field_addr.name = "government_during_revolution_id";
9066#endif /* FREECIV_JSON_CONNECTION */
9067 e = 0;
9068 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government_during_revolution_id);
9069 if (e) {
9070 log_packet_detailed("'government_during_revolution_id' field error detected");
9071 }
9072#ifdef FREECIV_JSON_CONNECTION
9073 field_addr.name = "granary_food_inc";
9074#endif /* FREECIV_JSON_CONNECTION */
9075 e = 0;
9076 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_inc);
9077 if (e) {
9078 log_packet_detailed("'granary_food_inc' field error detected");
9079 }
9080#ifdef FREECIV_JSON_CONNECTION
9081 field_addr.name = "granary_food_ini";
9082#endif /* FREECIV_JSON_CONNECTION */
9083 e = 0;
9084 {
9085 int i;
9086
9087#ifdef FREECIV_JSON_CONNECTION
9088 /* Create the array. */
9089 e |= DIO_PUT(farray, &dout, &field_addr, MAX_GRANARY_INIS);
9090
9091 /* Enter the array. */
9092 field_addr.sub_location = plocation_elem_new(0);
9093#endif /* FREECIV_JSON_CONNECTION */
9094
9095 for (i = 0; i < MAX_GRANARY_INIS; i++) {
9096#ifdef FREECIV_JSON_CONNECTION
9097 /* Next array element. */
9098 field_addr.sub_location->number = i;
9099#endif /* FREECIV_JSON_CONNECTION */
9100 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_ini[i]);
9101 }
9102
9103#ifdef FREECIV_JSON_CONNECTION
9104 /* Exit array. */
9105 FC_FREE(field_addr.sub_location);
9106#endif /* FREECIV_JSON_CONNECTION */
9107 }
9108 if (e) {
9109 log_packet_detailed("'granary_food_ini' field error detected");
9110 }
9111#ifdef FREECIV_JSON_CONNECTION
9112 field_addr.name = "granary_num_inis";
9113#endif /* FREECIV_JSON_CONNECTION */
9114 e = 0;
9115 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->granary_num_inis);
9116 if (e) {
9117 log_packet_detailed("'granary_num_inis' field error detected");
9118 }
9119#ifdef FREECIV_JSON_CONNECTION
9120 field_addr.name = "great_wonder_owners";
9121#endif /* FREECIV_JSON_CONNECTION */
9122 e = 0;
9123 {
9124 int i;
9125
9126#ifdef FREECIV_JSON_CONNECTION
9127 /* Create the array. */
9128 e |= DIO_PUT(farray, &dout, &field_addr, B_LAST);
9129
9130 /* Enter the array. */
9131 field_addr.sub_location = plocation_elem_new(0);
9132#endif /* FREECIV_JSON_CONNECTION */
9133
9134 for (i = 0; i < B_LAST; i++) {
9135#ifdef FREECIV_JSON_CONNECTION
9136 /* Next array element. */
9137 field_addr.sub_location->number = i;
9138#endif /* FREECIV_JSON_CONNECTION */
9139 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->great_wonder_owners[i]);
9140 }
9141
9142#ifdef FREECIV_JSON_CONNECTION
9143 /* Exit array. */
9144 FC_FREE(field_addr.sub_location);
9145#endif /* FREECIV_JSON_CONNECTION */
9146 }
9147 if (e) {
9148 log_packet_detailed("'great_wonder_owners' field error detected");
9149 }
9150#ifdef FREECIV_JSON_CONNECTION
9151 field_addr.name = "happy_cost";
9152#endif /* FREECIV_JSON_CONNECTION */
9153 e = 0;
9154 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->happy_cost);
9155 if (e) {
9156 log_packet_detailed("'happy_cost' field error detected");
9157 }
9158#ifdef FREECIV_JSON_CONNECTION
9159 field_addr.name = "happyborders";
9160#endif /* FREECIV_JSON_CONNECTION */
9161 e = 0;
9162 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happyborders);
9163 if (e) {
9164 log_packet_detailed("'happyborders' field error detected");
9165 }
9166#ifdef FREECIV_JSON_CONNECTION
9167 field_addr.name = "heating";
9168#endif /* FREECIV_JSON_CONNECTION */
9169 e = 0;
9170 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->heating);
9171 if (e) {
9172 log_packet_detailed("'heating' field error detected");
9173 }
9174#ifdef FREECIV_JSON_CONNECTION
9175 field_addr.name = "illness_base_factor";
9176#endif /* FREECIV_JSON_CONNECTION */
9177 e = 0;
9178 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_base_factor);
9179 if (e) {
9180 log_packet_detailed("'illness_base_factor' field error detected");
9181 }
9182#ifdef FREECIV_JSON_CONNECTION
9183 field_addr.name = "illness_min_size";
9184#endif /* FREECIV_JSON_CONNECTION */
9185 e = 0;
9186 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->illness_min_size);
9187 if (e) {
9188 log_packet_detailed("'illness_min_size' field error detected");
9189 }
9190#ifdef FREECIV_JSON_CONNECTION
9191 field_addr.name = "illness_on";
9192#endif /* FREECIV_JSON_CONNECTION */
9193 e = 0;
9194 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->illness_on);
9195 if (e) {
9196 log_packet_detailed("'illness_on' field error detected");
9197 }
9198#ifdef FREECIV_JSON_CONNECTION
9199 field_addr.name = "illness_pollution_factor";
9200#endif /* FREECIV_JSON_CONNECTION */
9201 e = 0;
9202 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_pollution_factor);
9203 if (e) {
9204 log_packet_detailed("'illness_pollution_factor' field error detected");
9205 }
9206#ifdef FREECIV_JSON_CONNECTION
9207 field_addr.name = "illness_trade_infection";
9208#endif /* FREECIV_JSON_CONNECTION */
9209 e = 0;
9210 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade_infection);
9211 if (e) {
9212 log_packet_detailed("'illness_trade_infection' field error detected");
9213 }
9214#ifdef FREECIV_JSON_CONNECTION
9215 field_addr.name = "init_city_radius_sq";
9216#endif /* FREECIV_JSON_CONNECTION */
9217 e = 0;
9218 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_city_radius_sq);
9219 if (e) {
9220 log_packet_detailed("'init_city_radius_sq' field error detected");
9221 }
9222#ifdef FREECIV_JSON_CONNECTION
9223 field_addr.name = "is_edit_mode";
9224#endif /* FREECIV_JSON_CONNECTION */
9225 e = 0;
9226 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_edit_mode);
9227 if (e) {
9228 log_packet_detailed("'is_edit_mode' field error detected");
9229 }
9230#ifdef FREECIV_JSON_CONNECTION
9231 field_addr.name = "is_new_game";
9232#endif /* FREECIV_JSON_CONNECTION */
9233 e = 0;
9234 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_new_game);
9235 if (e) {
9236 log_packet_detailed("'is_new_game' field error detected");
9237 }
9238#ifdef FREECIV_JSON_CONNECTION
9239 field_addr.name = "killcitizen";
9240#endif /* FREECIV_JSON_CONNECTION */
9241 e = 0;
9242 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->killcitizen);
9243 if (e) {
9244 log_packet_detailed("'killcitizen' field error detected");
9245 }
9246#ifdef FREECIV_JSON_CONNECTION
9247 field_addr.name = "killstack";
9248#endif /* FREECIV_JSON_CONNECTION */
9249 e = 0;
9250 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->killstack);
9251 if (e) {
9252 log_packet_detailed("'killstack' field error detected");
9253 }
9254#ifdef FREECIV_JSON_CONNECTION
9255 field_addr.name = "only_killing_makes_veteran";
9256#endif /* FREECIV_JSON_CONNECTION */
9257 e = 0;
9258 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->only_killing_makes_veteran);
9259 if (e) {
9260 log_packet_detailed("'only_killing_makes_veteran' field error detected");
9261 }
9262#ifdef FREECIV_JSON_CONNECTION
9263 field_addr.name = "only_real_fight_makes_veteran";
9264#endif /* FREECIV_JSON_CONNECTION */
9265 e = 0;
9266 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->only_real_fight_makes_veteran);
9267 if (e) {
9268 log_packet_detailed("'only_real_fight_makes_veteran' field error detected");
9269 }
9270#ifdef FREECIV_JSON_CONNECTION
9271 field_addr.name = "combat_odds_scaled_veterancy";
9272#endif /* FREECIV_JSON_CONNECTION */
9273 e = 0;
9274 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->combat_odds_scaled_veterancy);
9275 if (e) {
9276 log_packet_detailed("'combat_odds_scaled_veterancy' field error detected");
9277 }
9278#ifdef FREECIV_JSON_CONNECTION
9279 field_addr.name = "damage_reduces_bombard_rate";
9280#endif /* FREECIV_JSON_CONNECTION */
9281 e = 0;
9282 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->damage_reduces_bombard_rate);
9283 if (e) {
9284 log_packet_detailed("'damage_reduces_bombard_rate' field error detected");
9285 }
9286#ifdef FREECIV_JSON_CONNECTION
9287 field_addr.name = "low_firepower_badwallattacker";
9288#endif /* FREECIV_JSON_CONNECTION */
9289 e = 0;
9290 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_badwallattacker);
9291 if (e) {
9292 log_packet_detailed("'low_firepower_badwallattacker' field error detected");
9293 }
9294#ifdef FREECIV_JSON_CONNECTION
9295 field_addr.name = "low_firepower_pearl_harbour";
9296#endif /* FREECIV_JSON_CONNECTION */
9297 e = 0;
9298 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_pearl_harbour);
9299 if (e) {
9300 log_packet_detailed("'low_firepower_pearl_harbour' field error detected");
9301 }
9302#ifdef FREECIV_JSON_CONNECTION
9303 field_addr.name = "low_firepower_combat_bonus";
9304#endif /* FREECIV_JSON_CONNECTION */
9305 e = 0;
9306 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_combat_bonus);
9307 if (e) {
9308 log_packet_detailed("'low_firepower_combat_bonus' field error detected");
9309 }
9310#ifdef FREECIV_JSON_CONNECTION
9311 field_addr.name = "low_firepower_nonnat_bombard";
9312#endif /* FREECIV_JSON_CONNECTION */
9313 e = 0;
9314 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_nonnat_bombard);
9315 if (e) {
9316 log_packet_detailed("'low_firepower_nonnat_bombard' field error detected");
9317 }
9318#ifdef FREECIV_JSON_CONNECTION
9319 field_addr.name = "nuke_pop_loss_pct";
9320#endif /* FREECIV_JSON_CONNECTION */
9321 e = 0;
9322 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_pop_loss_pct);
9323 if (e) {
9324 log_packet_detailed("'nuke_pop_loss_pct' field error detected");
9325 }
9326#ifdef FREECIV_JSON_CONNECTION
9327 field_addr.name = "nuke_defender_survival_chance_pct";
9328#endif /* FREECIV_JSON_CONNECTION */
9329 e = 0;
9330 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_defender_survival_chance_pct);
9331 if (e) {
9332 log_packet_detailed("'nuke_defender_survival_chance_pct' field error detected");
9333 }
9334#ifdef FREECIV_JSON_CONNECTION
9335 field_addr.name = "min_city_center_output";
9336#endif /* FREECIV_JSON_CONNECTION */
9337 e = 0;
9338 {
9339 int i;
9340
9341#ifdef FREECIV_JSON_CONNECTION
9342 /* Create the array. */
9343 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
9344
9345 /* Enter the array. */
9346 field_addr.sub_location = plocation_elem_new(0);
9347#endif /* FREECIV_JSON_CONNECTION */
9348
9349 for (i = 0; i < O_LAST; i++) {
9350#ifdef FREECIV_JSON_CONNECTION
9351 /* Next array element. */
9352 field_addr.sub_location->number = i;
9353#endif /* FREECIV_JSON_CONNECTION */
9354 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_city_center_output[i]);
9355 }
9356
9357#ifdef FREECIV_JSON_CONNECTION
9358 /* Exit array. */
9359 FC_FREE(field_addr.sub_location);
9360#endif /* FREECIV_JSON_CONNECTION */
9361 }
9362 if (e) {
9363 log_packet_detailed("'min_city_center_output' field error detected");
9364 }
9365#ifdef FREECIV_JSON_CONNECTION
9366 field_addr.name = "muuk_food_wipe";
9367#endif /* FREECIV_JSON_CONNECTION */
9368 e = 0;
9369 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_food_wipe);
9370 if (e) {
9371 log_packet_detailed("'muuk_food_wipe' field error detected");
9372 }
9373#ifdef FREECIV_JSON_CONNECTION
9374 field_addr.name = "muuk_gold_wipe";
9375#endif /* FREECIV_JSON_CONNECTION */
9376 e = 0;
9377 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_gold_wipe);
9378 if (e) {
9379 log_packet_detailed("'muuk_gold_wipe' field error detected");
9380 }
9381#ifdef FREECIV_JSON_CONNECTION
9382 field_addr.name = "muuk_shield_wipe";
9383#endif /* FREECIV_JSON_CONNECTION */
9384 e = 0;
9385 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_shield_wipe);
9386 if (e) {
9387 log_packet_detailed("'muuk_shield_wipe' field error detected");
9388 }
9389#ifdef FREECIV_JSON_CONNECTION
9390 field_addr.name = "notradesize";
9391#endif /* FREECIV_JSON_CONNECTION */
9392 e = 0;
9393 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->notradesize);
9394 if (e) {
9395 log_packet_detailed("'notradesize' field error detected");
9396 }
9397#ifdef FREECIV_JSON_CONNECTION
9398 field_addr.name = "nuclear_winter";
9399#endif /* FREECIV_JSON_CONNECTION */
9400 e = 0;
9401 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->nuclear_winter);
9402 if (e) {
9403 log_packet_detailed("'nuclear_winter' field error detected");
9404 }
9405#ifdef FREECIV_JSON_CONNECTION
9406 field_addr.name = "nuclearwinter";
9407#endif /* FREECIV_JSON_CONNECTION */
9408 e = 0;
9409 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->nuclearwinter);
9410 if (e) {
9411 log_packet_detailed("'nuclearwinter' field error detected");
9412 }
9413#ifdef FREECIV_JSON_CONNECTION
9414 field_addr.name = "phase";
9415#endif /* FREECIV_JSON_CONNECTION */
9416 e = 0;
9417 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
9418 if (e) {
9419 log_packet_detailed("'phase' field error detected");
9420 }
9421#ifdef FREECIV_JSON_CONNECTION
9422 field_addr.name = "phase_mode";
9423#endif /* FREECIV_JSON_CONNECTION */
9424 e = 0;
9425 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->phase_mode);
9426 if (e) {
9427 log_packet_detailed("'phase_mode' field error detected");
9428 }
9429#ifdef FREECIV_JSON_CONNECTION
9430 field_addr.name = "pillage_select";
9431#endif /* FREECIV_JSON_CONNECTION */
9432 e = 0;
9433 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->pillage_select);
9434 if (e) {
9435 log_packet_detailed("'pillage_select' field error detected");
9436 }
9437#ifdef FREECIV_JSON_CONNECTION
9438 field_addr.name = "steal_maps_reveals_all_cities";
9439#endif /* FREECIV_JSON_CONNECTION */
9440 e = 0;
9441 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->steal_maps_reveals_all_cities);
9442 if (e) {
9443 log_packet_detailed("'steal_maps_reveals_all_cities' field error detected");
9444 }
9445#ifdef FREECIV_JSON_CONNECTION
9446 field_addr.name = "poison_empties_food_stock";
9447#endif /* FREECIV_JSON_CONNECTION */
9448 e = 0;
9449 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->poison_empties_food_stock);
9450 if (e) {
9451 log_packet_detailed("'poison_empties_food_stock' field error detected");
9452 }
9453#ifdef FREECIV_JSON_CONNECTION
9454 field_addr.name = "tech_steal_allow_holes";
9455#endif /* FREECIV_JSON_CONNECTION */
9456 e = 0;
9457 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_steal_allow_holes);
9458 if (e) {
9459 log_packet_detailed("'tech_steal_allow_holes' field error detected");
9460 }
9461#ifdef FREECIV_JSON_CONNECTION
9462 field_addr.name = "tech_trade_allow_holes";
9463#endif /* FREECIV_JSON_CONNECTION */
9464 e = 0;
9465 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_trade_allow_holes);
9466 if (e) {
9467 log_packet_detailed("'tech_trade_allow_holes' field error detected");
9468 }
9469#ifdef FREECIV_JSON_CONNECTION
9470 field_addr.name = "tech_trade_loss_allow_holes";
9471#endif /* FREECIV_JSON_CONNECTION */
9472 e = 0;
9473 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_trade_loss_allow_holes);
9474 if (e) {
9475 log_packet_detailed("'tech_trade_loss_allow_holes' field error detected");
9476 }
9477#ifdef FREECIV_JSON_CONNECTION
9478 field_addr.name = "tech_parasite_allow_holes";
9479#endif /* FREECIV_JSON_CONNECTION */
9480 e = 0;
9481 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_parasite_allow_holes);
9482 if (e) {
9483 log_packet_detailed("'tech_parasite_allow_holes' field error detected");
9484 }
9485#ifdef FREECIV_JSON_CONNECTION
9486 field_addr.name = "tech_loss_allow_holes";
9487#endif /* FREECIV_JSON_CONNECTION */
9488 e = 0;
9489 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_loss_allow_holes);
9490 if (e) {
9491 log_packet_detailed("'tech_loss_allow_holes' field error detected");
9492 }
9493#ifdef FREECIV_JSON_CONNECTION
9494 field_addr.name = "rapturedelay";
9495#endif /* FREECIV_JSON_CONNECTION */
9496 e = 0;
9497 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapturedelay);
9498 if (e) {
9499 log_packet_detailed("'rapturedelay' field error detected");
9500 }
9501#ifdef FREECIV_JSON_CONNECTION
9502 field_addr.name = "disasters";
9503#endif /* FREECIV_JSON_CONNECTION */
9504 e = 0;
9505 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disasters);
9506 if (e) {
9507 log_packet_detailed("'disasters' field error detected");
9508 }
9509#ifdef FREECIV_JSON_CONNECTION
9510 field_addr.name = "restrictinfra";
9511#endif /* FREECIV_JSON_CONNECTION */
9512 e = 0;
9513 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->restrictinfra);
9514 if (e) {
9515 log_packet_detailed("'restrictinfra' field error detected");
9516 }
9517#ifdef FREECIV_JSON_CONNECTION
9518 field_addr.name = "unreachable_protects";
9519#endif /* FREECIV_JSON_CONNECTION */
9520 e = 0;
9521 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unreachable_protects);
9522 if (e) {
9523 log_packet_detailed("'unreachable_protects' field error detected");
9524 }
9525#ifdef FREECIV_JSON_CONNECTION
9526 field_addr.name = "sciencebox";
9527#endif /* FREECIV_JSON_CONNECTION */
9528 e = 0;
9529 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->sciencebox);
9530 if (e) {
9531 log_packet_detailed("'sciencebox' field error detected");
9532 }
9533#ifdef FREECIV_JSON_CONNECTION
9534 field_addr.name = "shieldbox";
9535#endif /* FREECIV_JSON_CONNECTION */
9536 e = 0;
9537 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->shieldbox);
9538 if (e) {
9539 log_packet_detailed("'shieldbox' field error detected");
9540 }
9541#ifdef FREECIV_JSON_CONNECTION
9542 field_addr.name = "skill_level";
9543#endif /* FREECIV_JSON_CONNECTION */
9544 e = 0;
9545 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->skill_level);
9546 if (e) {
9547 log_packet_detailed("'skill_level' field error detected");
9548 }
9549#ifdef FREECIV_JSON_CONNECTION
9550 field_addr.name = "victory_conditions";
9551#endif /* FREECIV_JSON_CONNECTION */
9552 e = 0;
9553 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->victory_conditions);
9554 if (e) {
9555 log_packet_detailed("'victory_conditions' field error detected");
9556 }
9557#ifdef FREECIV_JSON_CONNECTION
9558 field_addr.name = "team_pooled_research";
9559#endif /* FREECIV_JSON_CONNECTION */
9560 e = 0;
9561 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->team_pooled_research);
9562 if (e) {
9563 log_packet_detailed("'team_pooled_research' field error detected");
9564 }
9565#ifdef FREECIV_JSON_CONNECTION
9566 field_addr.name = "tech";
9567#endif /* FREECIV_JSON_CONNECTION */
9568 e = 0;
9569 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->tech);
9570 if (e) {
9571 log_packet_detailed("'tech' field error detected");
9572 }
9573#ifdef FREECIV_JSON_CONNECTION
9574 field_addr.name = "tech_cost_style";
9575#endif /* FREECIV_JSON_CONNECTION */
9576 e = 0;
9577 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_cost_style);
9578 if (e) {
9579 log_packet_detailed("'tech_cost_style' field error detected");
9580 }
9581#ifdef FREECIV_JSON_CONNECTION
9582 field_addr.name = "tech_leakage";
9583#endif /* FREECIV_JSON_CONNECTION */
9584 e = 0;
9585 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leakage);
9586 if (e) {
9587 log_packet_detailed("'tech_leakage' field error detected");
9588 }
9589#ifdef FREECIV_JSON_CONNECTION
9590 field_addr.name = "tech_upkeep_divider";
9591#endif /* FREECIV_JSON_CONNECTION */
9592 e = 0;
9593 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep_divider);
9594 if (e) {
9595 log_packet_detailed("'tech_upkeep_divider' field error detected");
9596 }
9597#ifdef FREECIV_JSON_CONNECTION
9598 field_addr.name = "tech_upkeep_style";
9599#endif /* FREECIV_JSON_CONNECTION */
9600 e = 0;
9601 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_upkeep_style);
9602 if (e) {
9603 log_packet_detailed("'tech_upkeep_style' field error detected");
9604 }
9605#ifdef FREECIV_JSON_CONNECTION
9606 field_addr.name = "techloss_forgiveness";
9607#endif /* FREECIV_JSON_CONNECTION */
9608 e = 0;
9609 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->techloss_forgiveness);
9610 if (e) {
9611 log_packet_detailed("'techloss_forgiveness' field error detected");
9612 }
9613#ifdef FREECIV_JSON_CONNECTION
9614 field_addr.name = "free_tech_method";
9615#endif /* FREECIV_JSON_CONNECTION */
9616 e = 0;
9617 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->free_tech_method);
9618 if (e) {
9619 log_packet_detailed("'free_tech_method' field error detected");
9620 }
9621#ifdef FREECIV_JSON_CONNECTION
9622 field_addr.name = "gameloss_style";
9623#endif /* FREECIV_JSON_CONNECTION */
9624 e = 0;
9625 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gameloss_style);
9626 if (e) {
9627 log_packet_detailed("'gameloss_style' field error detected");
9628 }
9629#ifdef FREECIV_JSON_CONNECTION
9630 field_addr.name = "timeout";
9631#endif /* FREECIV_JSON_CONNECTION */
9632 e = 0;
9633 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->timeout);
9634 if (e) {
9635 log_packet_detailed("'timeout' field error detected");
9636 }
9637#ifdef FREECIV_JSON_CONNECTION
9638 field_addr.name = "first_timeout";
9639#endif /* FREECIV_JSON_CONNECTION */
9640 e = 0;
9641 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->first_timeout);
9642 if (e) {
9643 log_packet_detailed("'first_timeout' field error detected");
9644 }
9645#ifdef FREECIV_JSON_CONNECTION
9646 field_addr.name = "tired_attack";
9647#endif /* FREECIV_JSON_CONNECTION */
9648 e = 0;
9649 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tired_attack);
9650 if (e) {
9651 log_packet_detailed("'tired_attack' field error detected");
9652 }
9653#ifdef FREECIV_JSON_CONNECTION
9654 field_addr.name = "trademindist";
9655#endif /* FREECIV_JSON_CONNECTION */
9656 e = 0;
9657 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trademindist);
9658 if (e) {
9659 log_packet_detailed("'trademindist' field error detected");
9660 }
9661#ifdef FREECIV_JSON_CONNECTION
9662 field_addr.name = "trade_revenue_style";
9663#endif /* FREECIV_JSON_CONNECTION */
9664 e = 0;
9665 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_revenue_style);
9666 if (e) {
9667 log_packet_detailed("'trade_revenue_style' field error detected");
9668 }
9669#ifdef FREECIV_JSON_CONNECTION
9670 field_addr.name = "trading_city";
9671#endif /* FREECIV_JSON_CONNECTION */
9672 e = 0;
9673 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_city);
9674 if (e) {
9675 log_packet_detailed("'trading_city' field error detected");
9676 }
9677#ifdef FREECIV_JSON_CONNECTION
9678 field_addr.name = "trading_gold";
9679#endif /* FREECIV_JSON_CONNECTION */
9680 e = 0;
9681 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_gold);
9682 if (e) {
9683 log_packet_detailed("'trading_gold' field error detected");
9684 }
9685#ifdef FREECIV_JSON_CONNECTION
9686 field_addr.name = "trading_tech";
9687#endif /* FREECIV_JSON_CONNECTION */
9688 e = 0;
9689 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_tech);
9690 if (e) {
9691 log_packet_detailed("'trading_tech' field error detected");
9692 }
9693#ifdef FREECIV_JSON_CONNECTION
9694 field_addr.name = "turn";
9695#endif /* FREECIV_JSON_CONNECTION */
9696 e = 0;
9697 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
9698 if (e) {
9699 log_packet_detailed("'turn' field error detected");
9700 }
9701#ifdef FREECIV_JSON_CONNECTION
9702 field_addr.name = "warminglevel";
9703#endif /* FREECIV_JSON_CONNECTION */
9704 e = 0;
9705 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->warminglevel);
9706 if (e) {
9707 log_packet_detailed("'warminglevel' field error detected");
9708 }
9709#ifdef FREECIV_JSON_CONNECTION
9710 field_addr.name = "year";
9711#endif /* FREECIV_JSON_CONNECTION */
9712 e = 0;
9713 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
9714 if (e) {
9715 log_packet_detailed("'year' field error detected");
9716 }
9717#ifdef FREECIV_JSON_CONNECTION
9718 field_addr.name = "year_0_hack";
9719#endif /* FREECIV_JSON_CONNECTION */
9720 e = 0;
9721 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->year_0_hack);
9722 if (e) {
9723 log_packet_detailed("'year_0_hack' field error detected");
9724 }
9725#ifdef FREECIV_JSON_CONNECTION
9726 field_addr.name = "top_cities_count";
9727#endif /* FREECIV_JSON_CONNECTION */
9728 e = 0;
9729 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->top_cities_count);
9730 if (e) {
9731 log_packet_detailed("'top_cities_count' field error detected");
9732 }
9733#ifdef FREECIV_JSON_CONNECTION
9734 field_addr.name = "fragment_count";
9735#endif /* FREECIV_JSON_CONNECTION */
9736 e = 0;
9737 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragment_count);
9738 if (e) {
9739 log_packet_detailed("'fragment_count' field error detected");
9740 }
9741#ifdef FREECIV_JSON_CONNECTION
9742 field_addr.name = "civil_war_enabled";
9743#endif /* FREECIV_JSON_CONNECTION */
9744 e = 0;
9745 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->civil_war_enabled);
9746 if (e) {
9747 log_packet_detailed("'civil_war_enabled' field error detected");
9748 }
9749#ifdef FREECIV_JSON_CONNECTION
9750 field_addr.name = "civil_war_bonus_celebrating";
9751#endif /* FREECIV_JSON_CONNECTION */
9752 e = 0;
9753 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_celebrating);
9754 if (e) {
9755 log_packet_detailed("'civil_war_bonus_celebrating' field error detected");
9756 }
9757#ifdef FREECIV_JSON_CONNECTION
9758 field_addr.name = "civil_war_bonus_unhappy";
9759#endif /* FREECIV_JSON_CONNECTION */
9760 e = 0;
9761 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_unhappy);
9762 if (e) {
9763 log_packet_detailed("'civil_war_bonus_unhappy' field error detected");
9764 }
9765#ifdef FREECIV_JSON_CONNECTION
9766 field_addr.name = "granularity";
9767#endif /* FREECIV_JSON_CONNECTION */
9768 e = 0;
9769 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granularity);
9770 if (e) {
9771 log_packet_detailed("'granularity' field error detected");
9772 }
9773#ifdef FREECIV_JSON_CONNECTION
9774 field_addr.name = "small_wonder_visibility";
9775#endif /* FREECIV_JSON_CONNECTION */
9776 e = 0;
9777 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->small_wonder_visibility);
9778 if (e) {
9779 log_packet_detailed("'small_wonder_visibility' field error detected");
9780 }
9781
9782#endif
9783 SEND_PACKET_END(PACKET_GAME_INFO);
9784}
9785
9786 int send_packet_game_info(struct connection *pc, const struct packet_game_info *packet)
9787{
9788 if (!pc->used) {
9789 log_error("WARNING: trying to send data to the closed connection %s",
9790 conn_description(pc));
9791 return -1;
9792 }
9793 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_GAME_INFO].packet != nullptr, -1,
9794 "Handler for PACKET_GAME_INFO not installed");
9795 return pc->phs.handlers->send[PACKET_GAME_INFO].packet(pc, packet);
9796}
9797
9798 static inline void init_packet_calendar_info(struct packet_calendar_info *packet)
9799{
9800 memset(packet, 0, sizeof(*packet));
9801}
9802
9803#define free_packet_calendar_info(_packet) (void) 0
9804#define destroy_packet_calendar_info free
9805
9806#ifdef FREECIV_DELTA_PROTOCOL
9807#define hash_packet_calendar_info_100 hash_const
9808
9809#define cmp_packet_calendar_info_100 cmp_const
9810
9811 BV_DEFINE(packet_calendar_info_100_fields, 5);
9812#endif /* FREECIV_DELTA_PROTOCOL */
9813
9814 static struct packet_calendar_info *receive_packet_calendar_info_100(struct connection *pc)
9815{
9816#define FREE_PACKET_STRUCT(_packet) free_packet_calendar_info(_packet)
9817#ifdef FREECIV_DELTA_PROTOCOL
9818 packet_calendar_info_100_fields fields;
9819 struct packet_calendar_info *old;
9820 struct genhash **hash = pc->phs.received + PACKET_CALENDAR_INFO;
9821#endif /* FREECIV_DELTA_PROTOCOL */
9822 RECEIVE_PACKET_START(packet_calendar_info, real_packet);
9823#ifdef FREECIV_JSON_CONNECTION
9824 struct plocation field_addr;
9825 {
9826 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
9827 field_addr = *field_addr_tmp;
9828 FC_FREE(field_addr_tmp);
9829 }
9830#endif /* FREECIV_JSON_CONNECTION */
9831
9832#ifdef FREECIV_DELTA_PROTOCOL
9833#ifdef FREECIV_JSON_CONNECTION
9834 field_addr.name = "fields";
9835#endif /* FREECIV_JSON_CONNECTION */
9836 DIO_BV_GET(&din, &field_addr, fields);
9837
9838#else /* FREECIV_DELTA_PROTOCOL */
9839#ifdef FREECIV_JSON_CONNECTION
9840 field_addr.name = "positive_year_label";
9841#endif /* FREECIV_JSON_CONNECTION */
9842 if (!DIO_GET(string, &din, &field_addr, real_packet->positive_year_label, sizeof(real_packet->positive_year_label))) {
9843 RECEIVE_PACKET_FIELD_ERROR(positive_year_label);
9844 }
9845#ifdef FREECIV_JSON_CONNECTION
9846 field_addr.name = "negative_year_label";
9847#endif /* FREECIV_JSON_CONNECTION */
9848 if (!DIO_GET(string, &din, &field_addr, real_packet->negative_year_label, sizeof(real_packet->negative_year_label))) {
9849 RECEIVE_PACKET_FIELD_ERROR(negative_year_label);
9850 }
9851#ifdef FREECIV_JSON_CONNECTION
9852 field_addr.name = "calendar_fragments";
9853#endif /* FREECIV_JSON_CONNECTION */
9854 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->calendar_fragments)) {
9855 RECEIVE_PACKET_FIELD_ERROR(calendar_fragments);
9856 }
9857#ifdef FREECIV_JSON_CONNECTION
9858 field_addr.name = "calendar_fragment_name";
9859#endif /* FREECIV_JSON_CONNECTION */
9860 {
9861 int i;
9862
9863#ifdef FREECIV_JSON_CONNECTION
9864 /* Enter array. */
9865 field_addr.sub_location = plocation_elem_new(0);
9866#endif /* FREECIV_JSON_CONNECTION */
9867
9868 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9869#ifdef FREECIV_JSON_CONNECTION
9870 field_addr.sub_location->number = i;
9871#endif /* FREECIV_JSON_CONNECTION */
9872 if (!DIO_GET(string, &din, &field_addr, real_packet->calendar_fragment_name[i], sizeof(real_packet->calendar_fragment_name[i]))) {
9873 RECEIVE_PACKET_FIELD_ERROR(calendar_fragment_name);
9874 }
9875 }
9876
9877#ifdef FREECIV_JSON_CONNECTION
9878 /* Exit array. */
9879 FC_FREE(field_addr.sub_location);
9880#endif /* FREECIV_JSON_CONNECTION */
9881 }
9882#ifdef FREECIV_JSON_CONNECTION
9883 field_addr.name = "calendar_skip_0";
9884#endif /* FREECIV_JSON_CONNECTION */
9885 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->calendar_skip_0)) {
9886 RECEIVE_PACKET_FIELD_ERROR(calendar_skip_0);
9887 }
9888#endif
9889 log_packet_detailed("packet_calendar_info_100: got info about ()");
9890
9891#ifdef FREECIV_DELTA_PROTOCOL
9892 if (nullptr == *hash) {
9893 *hash = genhash_new_full(hash_packet_calendar_info_100, cmp_packet_calendar_info_100,
9894 nullptr, nullptr, nullptr, destroy_packet_calendar_info);
9895 }
9896
9897 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
9898 *real_packet = *old;
9899 } else {
9900 /* packet is already initialized empty */
9901 log_packet_detailed(" no old info");
9902 }
9903
9904 if (BV_ISSET(fields, 0)) {
9905 log_packet_detailed(" got field 'positive_year_label'");
9906#ifdef FREECIV_JSON_CONNECTION
9907 field_addr.name = "positive_year_label";
9908#endif /* FREECIV_JSON_CONNECTION */
9909 if (!DIO_GET(string, &din, &field_addr, real_packet->positive_year_label, sizeof(real_packet->positive_year_label))) {
9910 RECEIVE_PACKET_FIELD_ERROR(positive_year_label);
9911 }
9912 }
9913 if (BV_ISSET(fields, 1)) {
9914 log_packet_detailed(" got field 'negative_year_label'");
9915#ifdef FREECIV_JSON_CONNECTION
9916 field_addr.name = "negative_year_label";
9917#endif /* FREECIV_JSON_CONNECTION */
9918 if (!DIO_GET(string, &din, &field_addr, real_packet->negative_year_label, sizeof(real_packet->negative_year_label))) {
9919 RECEIVE_PACKET_FIELD_ERROR(negative_year_label);
9920 }
9921 }
9922 if (BV_ISSET(fields, 2)) {
9923 log_packet_detailed(" got field 'calendar_fragments'");
9924#ifdef FREECIV_JSON_CONNECTION
9925 field_addr.name = "calendar_fragments";
9926#endif /* FREECIV_JSON_CONNECTION */
9927 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->calendar_fragments)) {
9928 RECEIVE_PACKET_FIELD_ERROR(calendar_fragments);
9929 }
9930 }
9931 if (BV_ISSET(fields, 3)) {
9932 log_packet_detailed(" got field 'calendar_fragment_name'");
9933#ifdef FREECIV_JSON_CONNECTION
9934 field_addr.name = "calendar_fragment_name";
9935#endif /* FREECIV_JSON_CONNECTION */
9936 {
9937 int i;
9938
9939#ifdef FREECIV_JSON_CONNECTION
9940 /* Enter array. */
9941 field_addr.sub_location = plocation_elem_new(0);
9942#endif /* FREECIV_JSON_CONNECTION */
9943
9944 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9945#ifdef FREECIV_JSON_CONNECTION
9946 field_addr.sub_location->number = i;
9947#endif /* FREECIV_JSON_CONNECTION */
9948 if (!DIO_GET(string, &din, &field_addr, real_packet->calendar_fragment_name[i], sizeof(real_packet->calendar_fragment_name[i]))) {
9949 RECEIVE_PACKET_FIELD_ERROR(calendar_fragment_name);
9950 }
9951 }
9952
9953#ifdef FREECIV_JSON_CONNECTION
9954 /* Exit array. */
9955 FC_FREE(field_addr.sub_location);
9956#endif /* FREECIV_JSON_CONNECTION */
9957 }
9958 }
9959 real_packet->calendar_skip_0 = BV_ISSET(fields, 4);
9960
9961 if (nullptr == old) {
9962 old = fc_malloc(sizeof(*old));
9963 init_packet_calendar_info(old);
9964 *old = *real_packet;
9965 genhash_insert(*hash, old, old);
9966 } else {
9967 *old = *real_packet;
9968 }
9969
9970#endif /* FREECIV_DELTA_PROTOCOL */
9971 RECEIVE_PACKET_END(real_packet);
9972#undef FREE_PACKET_STRUCT
9973}
9974
9975 static int send_packet_calendar_info_100(struct connection *pc, const struct packet_calendar_info *packet)
9976{
9977 const struct packet_calendar_info *real_packet = packet;
9978 int e;
9979#ifdef FREECIV_DELTA_PROTOCOL
9980 packet_calendar_info_100_fields fields;
9981 struct packet_calendar_info *old;
9982 bool differ;
9983 struct genhash **hash = pc->phs.sent + PACKET_CALENDAR_INFO;
9984 int different = 0;
9985#endif /* FREECIV_DELTA_PROTOCOL */
9986 SEND_PACKET_START(PACKET_CALENDAR_INFO);
9987#ifdef FREECIV_JSON_CONNECTION
9988 struct plocation field_addr;
9989 {
9990 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
9991 field_addr = *field_addr_tmp;
9992 FC_FREE(field_addr_tmp);
9993 }
9994#endif /* FREECIV_JSON_CONNECTION */
9995
9996 log_packet_detailed("packet_calendar_info_100: sending info about ()");
9997
9998#ifdef FREECIV_DELTA_PROTOCOL
9999 if (nullptr == *hash) {
10000 *hash = genhash_new_full(hash_packet_calendar_info_100, cmp_packet_calendar_info_100,
10001 nullptr, nullptr, nullptr, destroy_packet_calendar_info);
10002 }
10003 BV_CLR_ALL(fields);
10004
10005 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10006 old = fc_malloc(sizeof(*old));
10007 /* temporary bitcopy just to insert correctly */
10008 *old = *real_packet;
10009 genhash_insert(*hash, old, old);
10010 init_packet_calendar_info(old);
10011 different = 1; /* Force to send. */
10012 }
10013 differ = (strcmp(old->positive_year_label, real_packet->positive_year_label) != 0);
10014 if (differ) {
10015 different++;
10016 BV_SET(fields, 0);
10017 }
10018
10019 differ = (strcmp(old->negative_year_label, real_packet->negative_year_label) != 0);
10020 if (differ) {
10021 different++;
10022 BV_SET(fields, 1);
10023 }
10024
10025 differ = (old->calendar_fragments != real_packet->calendar_fragments);
10026 if (differ) {
10027 different++;
10028 BV_SET(fields, 2);
10029 }
10030
10031 differ = FALSE;
10032 {
10033 int i;
10034
10035 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
10036 differ = (strcmp(old->calendar_fragment_name[i], real_packet->calendar_fragment_name[i]) != 0);
10037 if (differ) {
10038 break;
10039 }
10040 }
10041 }
10042 if (differ) {
10043 different++;
10044 BV_SET(fields, 3);
10045 }
10046
10047 differ = (old->calendar_skip_0 != real_packet->calendar_skip_0);
10048 if (differ) {
10049 different++;
10050 }
10051 if (packet->calendar_skip_0) {
10052 BV_SET(fields, 4);
10053 }
10054
10055 if (different == 0) {
10056 log_packet_detailed(" no change -> discard");
10057 return 0;
10058 }
10059
10060#ifdef FREECIV_JSON_CONNECTION
10061 field_addr.name = "fields";
10062#endif /* FREECIV_JSON_CONNECTION */
10063 e = 0;
10064 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10065 if (e) {
10066 log_packet_detailed("fields bitvector error detected");
10067 }
10068
10069 if (BV_ISSET(fields, 0)) {
10070 log_packet_detailed(" field 'positive_year_label' has changed");
10071#ifdef FREECIV_JSON_CONNECTION
10072 field_addr.name = "positive_year_label";
10073#endif /* FREECIV_JSON_CONNECTION */
10074 e = 0;
10075 e |= DIO_PUT(string, &dout, &field_addr, real_packet->positive_year_label);
10076 if (e) {
10077 log_packet_detailed("'positive_year_label' field error detected");
10078 }
10079 }
10080 if (BV_ISSET(fields, 1)) {
10081 log_packet_detailed(" field 'negative_year_label' has changed");
10082#ifdef FREECIV_JSON_CONNECTION
10083 field_addr.name = "negative_year_label";
10084#endif /* FREECIV_JSON_CONNECTION */
10085 e = 0;
10086 e |= DIO_PUT(string, &dout, &field_addr, real_packet->negative_year_label);
10087 if (e) {
10088 log_packet_detailed("'negative_year_label' field error detected");
10089 }
10090 }
10091 if (BV_ISSET(fields, 2)) {
10092 log_packet_detailed(" field 'calendar_fragments' has changed");
10093#ifdef FREECIV_JSON_CONNECTION
10094 field_addr.name = "calendar_fragments";
10095#endif /* FREECIV_JSON_CONNECTION */
10096 e = 0;
10097 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->calendar_fragments);
10098 if (e) {
10099 log_packet_detailed("'calendar_fragments' field error detected");
10100 }
10101 }
10102 if (BV_ISSET(fields, 3)) {
10103 log_packet_detailed(" field 'calendar_fragment_name' has changed");
10104#ifdef FREECIV_JSON_CONNECTION
10105 field_addr.name = "calendar_fragment_name";
10106#endif /* FREECIV_JSON_CONNECTION */
10107 e = 0;
10108 {
10109 int i;
10110
10111#ifdef FREECIV_JSON_CONNECTION
10112 /* Create the array. */
10113 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CALENDAR_FRAGMENTS);
10114
10115 /* Enter the array. */
10116 field_addr.sub_location = plocation_elem_new(0);
10117#endif /* FREECIV_JSON_CONNECTION */
10118
10119 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
10120#ifdef FREECIV_JSON_CONNECTION
10121 /* Next array element. */
10122 field_addr.sub_location->number = i;
10123#endif /* FREECIV_JSON_CONNECTION */
10124 e |= DIO_PUT(string, &dout, &field_addr, real_packet->calendar_fragment_name[i]);
10125 }
10126
10127#ifdef FREECIV_JSON_CONNECTION
10128 /* Exit array. */
10129 FC_FREE(field_addr.sub_location);
10130#endif /* FREECIV_JSON_CONNECTION */
10131 }
10132 if (e) {
10133 log_packet_detailed("'calendar_fragment_name' field error detected");
10134 }
10135 }
10136 /* field 4 is folded into the header */
10137
10138 *old = *real_packet;
10139#endif /* FREECIV_DELTA_PROTOCOL */
10140#ifndef FREECIV_DELTA_PROTOCOL
10141#ifdef FREECIV_JSON_CONNECTION
10142 field_addr.name = "positive_year_label";
10143#endif /* FREECIV_JSON_CONNECTION */
10144 e = 0;
10145 e |= DIO_PUT(string, &dout, &field_addr, real_packet->positive_year_label);
10146 if (e) {
10147 log_packet_detailed("'positive_year_label' field error detected");
10148 }
10149#ifdef FREECIV_JSON_CONNECTION
10150 field_addr.name = "negative_year_label";
10151#endif /* FREECIV_JSON_CONNECTION */
10152 e = 0;
10153 e |= DIO_PUT(string, &dout, &field_addr, real_packet->negative_year_label);
10154 if (e) {
10155 log_packet_detailed("'negative_year_label' field error detected");
10156 }
10157#ifdef FREECIV_JSON_CONNECTION
10158 field_addr.name = "calendar_fragments";
10159#endif /* FREECIV_JSON_CONNECTION */
10160 e = 0;
10161 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->calendar_fragments);
10162 if (e) {
10163 log_packet_detailed("'calendar_fragments' field error detected");
10164 }
10165#ifdef FREECIV_JSON_CONNECTION
10166 field_addr.name = "calendar_fragment_name";
10167#endif /* FREECIV_JSON_CONNECTION */
10168 e = 0;
10169 {
10170 int i;
10171
10172#ifdef FREECIV_JSON_CONNECTION
10173 /* Create the array. */
10174 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CALENDAR_FRAGMENTS);
10175
10176 /* Enter the array. */
10177 field_addr.sub_location = plocation_elem_new(0);
10178#endif /* FREECIV_JSON_CONNECTION */
10179
10180 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
10181#ifdef FREECIV_JSON_CONNECTION
10182 /* Next array element. */
10183 field_addr.sub_location->number = i;
10184#endif /* FREECIV_JSON_CONNECTION */
10185 e |= DIO_PUT(string, &dout, &field_addr, real_packet->calendar_fragment_name[i]);
10186 }
10187
10188#ifdef FREECIV_JSON_CONNECTION
10189 /* Exit array. */
10190 FC_FREE(field_addr.sub_location);
10191#endif /* FREECIV_JSON_CONNECTION */
10192 }
10193 if (e) {
10194 log_packet_detailed("'calendar_fragment_name' field error detected");
10195 }
10196#ifdef FREECIV_JSON_CONNECTION
10197 field_addr.name = "calendar_skip_0";
10198#endif /* FREECIV_JSON_CONNECTION */
10199 e = 0;
10200 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->calendar_skip_0);
10201 if (e) {
10202 log_packet_detailed("'calendar_skip_0' field error detected");
10203 }
10204
10205#endif
10206 SEND_PACKET_END(PACKET_CALENDAR_INFO);
10207}
10208
10209 int send_packet_calendar_info(struct connection *pc, const struct packet_calendar_info *packet)
10210{
10211 if (!pc->used) {
10212 log_error("WARNING: trying to send data to the closed connection %s",
10213 conn_description(pc));
10214 return -1;
10215 }
10216 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CALENDAR_INFO].packet != nullptr, -1,
10217 "Handler for PACKET_CALENDAR_INFO not installed");
10218 return pc->phs.handlers->send[PACKET_CALENDAR_INFO].packet(pc, packet);
10219}
10220
10221 static inline void init_packet_timeout_info(struct packet_timeout_info *packet)
10222{
10223 memset(packet, 0, sizeof(*packet));
10224}
10225
10226#define free_packet_timeout_info(_packet) (void) 0
10227#define destroy_packet_timeout_info free
10228
10229#ifdef FREECIV_DELTA_PROTOCOL
10230#define hash_packet_timeout_info_100 hash_const
10231
10232#define cmp_packet_timeout_info_100 cmp_const
10233
10234 BV_DEFINE(packet_timeout_info_100_fields, 2);
10235#endif /* FREECIV_DELTA_PROTOCOL */
10236
10237 static struct packet_timeout_info *receive_packet_timeout_info_100(struct connection *pc)
10238{
10239#define FREE_PACKET_STRUCT(_packet) free_packet_timeout_info(_packet)
10240#ifdef FREECIV_DELTA_PROTOCOL
10241 packet_timeout_info_100_fields fields;
10242 struct packet_timeout_info *old;
10243 struct genhash **hash = pc->phs.received + PACKET_TIMEOUT_INFO;
10244#endif /* FREECIV_DELTA_PROTOCOL */
10245 RECEIVE_PACKET_START(packet_timeout_info, real_packet);
10246#ifdef FREECIV_JSON_CONNECTION
10247 struct plocation field_addr;
10248 {
10249 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
10250 field_addr = *field_addr_tmp;
10251 FC_FREE(field_addr_tmp);
10252 }
10253#endif /* FREECIV_JSON_CONNECTION */
10254
10255#ifdef FREECIV_DELTA_PROTOCOL
10256#ifdef FREECIV_JSON_CONNECTION
10257 field_addr.name = "fields";
10258#endif /* FREECIV_JSON_CONNECTION */
10259 DIO_BV_GET(&din, &field_addr, fields);
10260
10261#else /* FREECIV_DELTA_PROTOCOL */
10262#ifdef FREECIV_JSON_CONNECTION
10263 field_addr.name = "seconds_to_phasedone";
10264#endif /* FREECIV_JSON_CONNECTION */
10265 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->seconds_to_phasedone, 100)) {
10266 RECEIVE_PACKET_FIELD_ERROR(seconds_to_phasedone);
10267 }
10268#ifdef FREECIV_JSON_CONNECTION
10269 field_addr.name = "last_turn_change_time";
10270#endif /* FREECIV_JSON_CONNECTION */
10271 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->last_turn_change_time, 100)) {
10272 RECEIVE_PACKET_FIELD_ERROR(last_turn_change_time);
10273 }
10274#endif
10275 log_packet_detailed("packet_timeout_info_100: got info about ()");
10276
10277#ifdef FREECIV_DELTA_PROTOCOL
10278 if (nullptr == *hash) {
10279 *hash = genhash_new_full(hash_packet_timeout_info_100, cmp_packet_timeout_info_100,
10280 nullptr, nullptr, nullptr, destroy_packet_timeout_info);
10281 }
10282
10283 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10284 *real_packet = *old;
10285 } else {
10286 /* packet is already initialized empty */
10287 log_packet_detailed(" no old info");
10288 }
10289
10290 if (BV_ISSET(fields, 0)) {
10291 log_packet_detailed(" got field 'seconds_to_phasedone'");
10292#ifdef FREECIV_JSON_CONNECTION
10293 field_addr.name = "seconds_to_phasedone";
10294#endif /* FREECIV_JSON_CONNECTION */
10295 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->seconds_to_phasedone, 100)) {
10296 RECEIVE_PACKET_FIELD_ERROR(seconds_to_phasedone);
10297 }
10298 }
10299 if (BV_ISSET(fields, 1)) {
10300 log_packet_detailed(" got field 'last_turn_change_time'");
10301#ifdef FREECIV_JSON_CONNECTION
10302 field_addr.name = "last_turn_change_time";
10303#endif /* FREECIV_JSON_CONNECTION */
10304 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->last_turn_change_time, 100)) {
10305 RECEIVE_PACKET_FIELD_ERROR(last_turn_change_time);
10306 }
10307 }
10308
10309 if (nullptr == old) {
10310 old = fc_malloc(sizeof(*old));
10311 init_packet_timeout_info(old);
10312 *old = *real_packet;
10313 genhash_insert(*hash, old, old);
10314 } else {
10315 *old = *real_packet;
10316 }
10317
10318#endif /* FREECIV_DELTA_PROTOCOL */
10319 RECEIVE_PACKET_END(real_packet);
10320#undef FREE_PACKET_STRUCT
10321}
10322
10323 static int send_packet_timeout_info_100(struct connection *pc, const struct packet_timeout_info *packet)
10324{
10325 const struct packet_timeout_info *real_packet = packet;
10326 int e;
10327#ifdef FREECIV_DELTA_PROTOCOL
10328 packet_timeout_info_100_fields fields;
10329 struct packet_timeout_info *old;
10330 bool differ;
10331 struct genhash **hash = pc->phs.sent + PACKET_TIMEOUT_INFO;
10332#endif /* FREECIV_DELTA_PROTOCOL */
10333 SEND_PACKET_START(PACKET_TIMEOUT_INFO);
10334#ifdef FREECIV_JSON_CONNECTION
10335 struct plocation field_addr;
10336 {
10337 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
10338 field_addr = *field_addr_tmp;
10339 FC_FREE(field_addr_tmp);
10340 }
10341#endif /* FREECIV_JSON_CONNECTION */
10342
10343 log_packet_detailed("packet_timeout_info_100: sending info about ()");
10344
10345#ifdef FREECIV_DELTA_PROTOCOL
10346 if (nullptr == *hash) {
10347 *hash = genhash_new_full(hash_packet_timeout_info_100, cmp_packet_timeout_info_100,
10348 nullptr, nullptr, nullptr, destroy_packet_timeout_info);
10349 }
10350 BV_CLR_ALL(fields);
10351
10352 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10353 old = fc_malloc(sizeof(*old));
10354 /* temporary bitcopy just to insert correctly */
10355 *old = *real_packet;
10356 genhash_insert(*hash, old, old);
10357 init_packet_timeout_info(old);
10358 }
10359 differ = ((int) (old->seconds_to_phasedone * 100) != (int) (real_packet->seconds_to_phasedone * 100));
10360 if (differ) {
10361 BV_SET(fields, 0);
10362 }
10363
10364 differ = ((int) (old->last_turn_change_time * 100) != (int) (real_packet->last_turn_change_time * 100));
10365 if (differ) {
10366 BV_SET(fields, 1);
10367 }
10368
10369
10370#ifdef FREECIV_JSON_CONNECTION
10371 field_addr.name = "fields";
10372#endif /* FREECIV_JSON_CONNECTION */
10373 e = 0;
10374 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10375 if (e) {
10376 log_packet_detailed("fields bitvector error detected");
10377 }
10378
10379 if (BV_ISSET(fields, 0)) {
10380 log_packet_detailed(" field 'seconds_to_phasedone' has changed");
10381#ifdef FREECIV_JSON_CONNECTION
10382 field_addr.name = "seconds_to_phasedone";
10383#endif /* FREECIV_JSON_CONNECTION */
10384 e = 0;
10385 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->seconds_to_phasedone, 100);
10386 if (e) {
10387 log_packet_detailed("'seconds_to_phasedone' field error detected");
10388 }
10389 }
10390 if (BV_ISSET(fields, 1)) {
10391 log_packet_detailed(" field 'last_turn_change_time' has changed");
10392#ifdef FREECIV_JSON_CONNECTION
10393 field_addr.name = "last_turn_change_time";
10394#endif /* FREECIV_JSON_CONNECTION */
10395 e = 0;
10396 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->last_turn_change_time, 100);
10397 if (e) {
10398 log_packet_detailed("'last_turn_change_time' field error detected");
10399 }
10400 }
10401
10402 *old = *real_packet;
10403#endif /* FREECIV_DELTA_PROTOCOL */
10404#ifndef FREECIV_DELTA_PROTOCOL
10405#ifdef FREECIV_JSON_CONNECTION
10406 field_addr.name = "seconds_to_phasedone";
10407#endif /* FREECIV_JSON_CONNECTION */
10408 e = 0;
10409 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->seconds_to_phasedone, 100);
10410 if (e) {
10411 log_packet_detailed("'seconds_to_phasedone' field error detected");
10412 }
10413#ifdef FREECIV_JSON_CONNECTION
10414 field_addr.name = "last_turn_change_time";
10415#endif /* FREECIV_JSON_CONNECTION */
10416 e = 0;
10417 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->last_turn_change_time, 100);
10418 if (e) {
10419 log_packet_detailed("'last_turn_change_time' field error detected");
10420 }
10421
10422#endif
10423 SEND_PACKET_END(PACKET_TIMEOUT_INFO);
10424}
10425
10426 int send_packet_timeout_info(struct connection *pc, const struct packet_timeout_info *packet)
10427{
10428 if (!pc->used) {
10429 log_error("WARNING: trying to send data to the closed connection %s",
10430 conn_description(pc));
10431 return -1;
10432 }
10433 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TIMEOUT_INFO].packet != nullptr, -1,
10434 "Handler for PACKET_TIMEOUT_INFO not installed");
10435 return pc->phs.handlers->send[PACKET_TIMEOUT_INFO].packet(pc, packet);
10436}
10437
10438 static inline void init_packet_map_info(struct packet_map_info *packet)
10439{
10440 memset(packet, 0, sizeof(*packet));
10441}
10442
10443#define free_packet_map_info(_packet) (void) 0
10444#define destroy_packet_map_info free
10445
10446#ifdef FREECIV_DELTA_PROTOCOL
10447#define hash_packet_map_info_100 hash_const
10448
10449#define cmp_packet_map_info_100 cmp_const
10450
10451 BV_DEFINE(packet_map_info_100_fields, 7);
10452#endif /* FREECIV_DELTA_PROTOCOL */
10453
10454 static struct packet_map_info *receive_packet_map_info_100(struct connection *pc)
10455{
10456#define FREE_PACKET_STRUCT(_packet) free_packet_map_info(_packet)
10457#ifdef FREECIV_DELTA_PROTOCOL
10458 packet_map_info_100_fields fields;
10459 struct packet_map_info *old;
10460 struct genhash **hash = pc->phs.received + PACKET_MAP_INFO;
10461#endif /* FREECIV_DELTA_PROTOCOL */
10462 RECEIVE_PACKET_START(packet_map_info, real_packet);
10463#ifdef FREECIV_JSON_CONNECTION
10464 struct plocation field_addr;
10465 {
10466 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
10467 field_addr = *field_addr_tmp;
10468 FC_FREE(field_addr_tmp);
10469 }
10470#endif /* FREECIV_JSON_CONNECTION */
10471
10472#ifdef FREECIV_DELTA_PROTOCOL
10473#ifdef FREECIV_JSON_CONNECTION
10474 field_addr.name = "fields";
10475#endif /* FREECIV_JSON_CONNECTION */
10476 DIO_BV_GET(&din, &field_addr, fields);
10477
10478#else /* FREECIV_DELTA_PROTOCOL */
10479#ifdef FREECIV_JSON_CONNECTION
10480 field_addr.name = "xsize";
10481#endif /* FREECIV_JSON_CONNECTION */
10482 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->xsize)) {
10483 RECEIVE_PACKET_FIELD_ERROR(xsize);
10484 }
10485#ifdef FREECIV_JSON_CONNECTION
10486 field_addr.name = "ysize";
10487#endif /* FREECIV_JSON_CONNECTION */
10488 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ysize)) {
10489 RECEIVE_PACKET_FIELD_ERROR(ysize);
10490 }
10491#ifdef FREECIV_JSON_CONNECTION
10492 field_addr.name = "topology_id";
10493#endif /* FREECIV_JSON_CONNECTION */
10494 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
10495 RECEIVE_PACKET_FIELD_ERROR(topology_id);
10496 }
10497#ifdef FREECIV_JSON_CONNECTION
10498 field_addr.name = "wrap_id";
10499#endif /* FREECIV_JSON_CONNECTION */
10500 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
10501 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
10502 }
10503#ifdef FREECIV_JSON_CONNECTION
10504 field_addr.name = "north_latitude";
10505#endif /* FREECIV_JSON_CONNECTION */
10506 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->north_latitude)) {
10507 RECEIVE_PACKET_FIELD_ERROR(north_latitude);
10508 }
10509#ifdef FREECIV_JSON_CONNECTION
10510 field_addr.name = "south_latitude";
10511#endif /* FREECIV_JSON_CONNECTION */
10512 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->south_latitude)) {
10513 RECEIVE_PACKET_FIELD_ERROR(south_latitude);
10514 }
10515#ifdef FREECIV_JSON_CONNECTION
10516 field_addr.name = "altitude_info";
10517#endif /* FREECIV_JSON_CONNECTION */
10518 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->altitude_info)) {
10519 RECEIVE_PACKET_FIELD_ERROR(altitude_info);
10520 }
10521#endif
10522 log_packet_detailed("packet_map_info_100: got info about ()");
10523
10524#ifdef FREECIV_DELTA_PROTOCOL
10525 if (nullptr == *hash) {
10526 *hash = genhash_new_full(hash_packet_map_info_100, cmp_packet_map_info_100,
10527 nullptr, nullptr, nullptr, destroy_packet_map_info);
10528 }
10529
10530 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10531 *real_packet = *old;
10532 } else {
10533 /* packet is already initialized empty */
10534 log_packet_detailed(" no old info");
10535 }
10536
10537 if (BV_ISSET(fields, 0)) {
10538 log_packet_detailed(" got field 'xsize'");
10539#ifdef FREECIV_JSON_CONNECTION
10540 field_addr.name = "xsize";
10541#endif /* FREECIV_JSON_CONNECTION */
10542 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->xsize)) {
10543 RECEIVE_PACKET_FIELD_ERROR(xsize);
10544 }
10545 }
10546 if (BV_ISSET(fields, 1)) {
10547 log_packet_detailed(" got field 'ysize'");
10548#ifdef FREECIV_JSON_CONNECTION
10549 field_addr.name = "ysize";
10550#endif /* FREECIV_JSON_CONNECTION */
10551 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ysize)) {
10552 RECEIVE_PACKET_FIELD_ERROR(ysize);
10553 }
10554 }
10555 if (BV_ISSET(fields, 2)) {
10556 log_packet_detailed(" got field 'topology_id'");
10557#ifdef FREECIV_JSON_CONNECTION
10558 field_addr.name = "topology_id";
10559#endif /* FREECIV_JSON_CONNECTION */
10560 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
10561 RECEIVE_PACKET_FIELD_ERROR(topology_id);
10562 }
10563 }
10564 if (BV_ISSET(fields, 3)) {
10565 log_packet_detailed(" got field 'wrap_id'");
10566#ifdef FREECIV_JSON_CONNECTION
10567 field_addr.name = "wrap_id";
10568#endif /* FREECIV_JSON_CONNECTION */
10569 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
10570 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
10571 }
10572 }
10573 if (BV_ISSET(fields, 4)) {
10574 log_packet_detailed(" got field 'north_latitude'");
10575#ifdef FREECIV_JSON_CONNECTION
10576 field_addr.name = "north_latitude";
10577#endif /* FREECIV_JSON_CONNECTION */
10578 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->north_latitude)) {
10579 RECEIVE_PACKET_FIELD_ERROR(north_latitude);
10580 }
10581 }
10582 if (BV_ISSET(fields, 5)) {
10583 log_packet_detailed(" got field 'south_latitude'");
10584#ifdef FREECIV_JSON_CONNECTION
10585 field_addr.name = "south_latitude";
10586#endif /* FREECIV_JSON_CONNECTION */
10587 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->south_latitude)) {
10588 RECEIVE_PACKET_FIELD_ERROR(south_latitude);
10589 }
10590 }
10591 real_packet->altitude_info = BV_ISSET(fields, 6);
10592
10593 if (nullptr == old) {
10594 old = fc_malloc(sizeof(*old));
10595 init_packet_map_info(old);
10596 *old = *real_packet;
10597 genhash_insert(*hash, old, old);
10598 } else {
10599 *old = *real_packet;
10600 }
10601
10602#endif /* FREECIV_DELTA_PROTOCOL */
10603 RECEIVE_PACKET_END(real_packet);
10604#undef FREE_PACKET_STRUCT
10605}
10606
10607 static int send_packet_map_info_100(struct connection *pc, const struct packet_map_info *packet)
10608{
10609 const struct packet_map_info *real_packet = packet;
10610 int e;
10611#ifdef FREECIV_DELTA_PROTOCOL
10612 packet_map_info_100_fields fields;
10613 struct packet_map_info *old;
10614 bool differ;
10615 struct genhash **hash = pc->phs.sent + PACKET_MAP_INFO;
10616#endif /* FREECIV_DELTA_PROTOCOL */
10617 SEND_PACKET_START(PACKET_MAP_INFO);
10618#ifdef FREECIV_JSON_CONNECTION
10619 struct plocation field_addr;
10620 {
10621 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
10622 field_addr = *field_addr_tmp;
10623 FC_FREE(field_addr_tmp);
10624 }
10625#endif /* FREECIV_JSON_CONNECTION */
10626
10627 log_packet_detailed("packet_map_info_100: sending info about ()");
10628
10629#ifdef FREECIV_DELTA_PROTOCOL
10630 if (nullptr == *hash) {
10631 *hash = genhash_new_full(hash_packet_map_info_100, cmp_packet_map_info_100,
10632 nullptr, nullptr, nullptr, destroy_packet_map_info);
10633 }
10634 BV_CLR_ALL(fields);
10635
10636 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10637 old = fc_malloc(sizeof(*old));
10638 /* temporary bitcopy just to insert correctly */
10639 *old = *real_packet;
10640 genhash_insert(*hash, old, old);
10641 init_packet_map_info(old);
10642 }
10643 differ = (old->xsize != real_packet->xsize);
10644 if (differ) {
10645 BV_SET(fields, 0);
10646 }
10647
10648 differ = (old->ysize != real_packet->ysize);
10649 if (differ) {
10650 BV_SET(fields, 1);
10651 }
10652
10653 differ = (old->topology_id != real_packet->topology_id);
10654 if (differ) {
10655 BV_SET(fields, 2);
10656 }
10657
10658 differ = (old->wrap_id != real_packet->wrap_id);
10659 if (differ) {
10660 BV_SET(fields, 3);
10661 }
10662
10663 differ = (old->north_latitude != real_packet->north_latitude);
10664 if (differ) {
10665 BV_SET(fields, 4);
10666 }
10667
10668 differ = (old->south_latitude != real_packet->south_latitude);
10669 if (differ) {
10670 BV_SET(fields, 5);
10671 }
10672
10673 if (packet->altitude_info) {
10674 BV_SET(fields, 6);
10675 }
10676
10677
10678#ifdef FREECIV_JSON_CONNECTION
10679 field_addr.name = "fields";
10680#endif /* FREECIV_JSON_CONNECTION */
10681 e = 0;
10682 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10683 if (e) {
10684 log_packet_detailed("fields bitvector error detected");
10685 }
10686
10687 if (BV_ISSET(fields, 0)) {
10688 log_packet_detailed(" field 'xsize' has changed");
10689#ifdef FREECIV_JSON_CONNECTION
10690 field_addr.name = "xsize";
10691#endif /* FREECIV_JSON_CONNECTION */
10692 e = 0;
10693 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->xsize);
10694 if (e) {
10695 log_packet_detailed("'xsize' field error detected");
10696 }
10697 }
10698 if (BV_ISSET(fields, 1)) {
10699 log_packet_detailed(" field 'ysize' has changed");
10700#ifdef FREECIV_JSON_CONNECTION
10701 field_addr.name = "ysize";
10702#endif /* FREECIV_JSON_CONNECTION */
10703 e = 0;
10704 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ysize);
10705 if (e) {
10706 log_packet_detailed("'ysize' field error detected");
10707 }
10708 }
10709 if (BV_ISSET(fields, 2)) {
10710 log_packet_detailed(" field 'topology_id' has changed");
10711#ifdef FREECIV_JSON_CONNECTION
10712 field_addr.name = "topology_id";
10713#endif /* FREECIV_JSON_CONNECTION */
10714 e = 0;
10715 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
10716 if (e) {
10717 log_packet_detailed("'topology_id' field error detected");
10718 }
10719 }
10720 if (BV_ISSET(fields, 3)) {
10721 log_packet_detailed(" field 'wrap_id' has changed");
10722#ifdef FREECIV_JSON_CONNECTION
10723 field_addr.name = "wrap_id";
10724#endif /* FREECIV_JSON_CONNECTION */
10725 e = 0;
10726 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
10727 if (e) {
10728 log_packet_detailed("'wrap_id' field error detected");
10729 }
10730 }
10731 if (BV_ISSET(fields, 4)) {
10732 log_packet_detailed(" field 'north_latitude' has changed");
10733#ifdef FREECIV_JSON_CONNECTION
10734 field_addr.name = "north_latitude";
10735#endif /* FREECIV_JSON_CONNECTION */
10736 e = 0;
10737 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->north_latitude);
10738 if (e) {
10739 log_packet_detailed("'north_latitude' field error detected");
10740 }
10741 }
10742 if (BV_ISSET(fields, 5)) {
10743 log_packet_detailed(" field 'south_latitude' has changed");
10744#ifdef FREECIV_JSON_CONNECTION
10745 field_addr.name = "south_latitude";
10746#endif /* FREECIV_JSON_CONNECTION */
10747 e = 0;
10748 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->south_latitude);
10749 if (e) {
10750 log_packet_detailed("'south_latitude' field error detected");
10751 }
10752 }
10753 /* field 6 is folded into the header */
10754
10755 *old = *real_packet;
10756#endif /* FREECIV_DELTA_PROTOCOL */
10757#ifndef FREECIV_DELTA_PROTOCOL
10758#ifdef FREECIV_JSON_CONNECTION
10759 field_addr.name = "xsize";
10760#endif /* FREECIV_JSON_CONNECTION */
10761 e = 0;
10762 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->xsize);
10763 if (e) {
10764 log_packet_detailed("'xsize' field error detected");
10765 }
10766#ifdef FREECIV_JSON_CONNECTION
10767 field_addr.name = "ysize";
10768#endif /* FREECIV_JSON_CONNECTION */
10769 e = 0;
10770 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ysize);
10771 if (e) {
10772 log_packet_detailed("'ysize' field error detected");
10773 }
10774#ifdef FREECIV_JSON_CONNECTION
10775 field_addr.name = "topology_id";
10776#endif /* FREECIV_JSON_CONNECTION */
10777 e = 0;
10778 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
10779 if (e) {
10780 log_packet_detailed("'topology_id' field error detected");
10781 }
10782#ifdef FREECIV_JSON_CONNECTION
10783 field_addr.name = "wrap_id";
10784#endif /* FREECIV_JSON_CONNECTION */
10785 e = 0;
10786 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
10787 if (e) {
10788 log_packet_detailed("'wrap_id' field error detected");
10789 }
10790#ifdef FREECIV_JSON_CONNECTION
10791 field_addr.name = "north_latitude";
10792#endif /* FREECIV_JSON_CONNECTION */
10793 e = 0;
10794 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->north_latitude);
10795 if (e) {
10796 log_packet_detailed("'north_latitude' field error detected");
10797 }
10798#ifdef FREECIV_JSON_CONNECTION
10799 field_addr.name = "south_latitude";
10800#endif /* FREECIV_JSON_CONNECTION */
10801 e = 0;
10802 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->south_latitude);
10803 if (e) {
10804 log_packet_detailed("'south_latitude' field error detected");
10805 }
10806#ifdef FREECIV_JSON_CONNECTION
10807 field_addr.name = "altitude_info";
10808#endif /* FREECIV_JSON_CONNECTION */
10809 e = 0;
10810 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->altitude_info);
10811 if (e) {
10812 log_packet_detailed("'altitude_info' field error detected");
10813 }
10814
10815#endif
10816 SEND_PACKET_END(PACKET_MAP_INFO);
10817}
10818
10819 int send_packet_map_info(struct connection *pc, const struct packet_map_info *packet)
10820{
10821 if (!pc->used) {
10822 log_error("WARNING: trying to send data to the closed connection %s",
10823 conn_description(pc));
10824 return -1;
10825 }
10826 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_MAP_INFO].packet != nullptr, -1,
10827 "Handler for PACKET_MAP_INFO not installed");
10828 return pc->phs.handlers->send[PACKET_MAP_INFO].packet(pc, packet);
10829}
10830
10831 void lsend_packet_map_info(struct conn_list *dest, const struct packet_map_info *packet)
10832{
10833 conn_list_iterate(dest, pconn) {
10834 send_packet_map_info(pconn, packet);
10835 } conn_list_iterate_end;
10836}
10837
10838 static inline void init_packet_nuke_tile_info(struct packet_nuke_tile_info *packet)
10839{
10840 memset(packet, 0, sizeof(*packet));
10841}
10842
10843#define free_packet_nuke_tile_info(_packet) (void) 0
10844#define destroy_packet_nuke_tile_info free
10845
10846#ifdef FREECIV_DELTA_PROTOCOL
10847#define hash_packet_nuke_tile_info_100 hash_const
10848
10849#define cmp_packet_nuke_tile_info_100 cmp_const
10850
10851 BV_DEFINE(packet_nuke_tile_info_100_fields, 1);
10852#endif /* FREECIV_DELTA_PROTOCOL */
10853
10854 static struct packet_nuke_tile_info *receive_packet_nuke_tile_info_100(struct connection *pc)
10855{
10856#define FREE_PACKET_STRUCT(_packet) free_packet_nuke_tile_info(_packet)
10857#ifdef FREECIV_DELTA_PROTOCOL
10858 packet_nuke_tile_info_100_fields fields;
10859 struct packet_nuke_tile_info *old;
10860 struct genhash **hash = pc->phs.received + PACKET_NUKE_TILE_INFO;
10861#endif /* FREECIV_DELTA_PROTOCOL */
10862 RECEIVE_PACKET_START(packet_nuke_tile_info, real_packet);
10863#ifdef FREECIV_JSON_CONNECTION
10864 struct plocation field_addr;
10865 {
10866 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
10867 field_addr = *field_addr_tmp;
10868 FC_FREE(field_addr_tmp);
10869 }
10870#endif /* FREECIV_JSON_CONNECTION */
10871
10872#ifdef FREECIV_DELTA_PROTOCOL
10873#ifdef FREECIV_JSON_CONNECTION
10874 field_addr.name = "fields";
10875#endif /* FREECIV_JSON_CONNECTION */
10876 DIO_BV_GET(&din, &field_addr, fields);
10877
10878#else /* FREECIV_DELTA_PROTOCOL */
10879#ifdef FREECIV_JSON_CONNECTION
10880 field_addr.name = "tile";
10881#endif /* FREECIV_JSON_CONNECTION */
10882 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10883 RECEIVE_PACKET_FIELD_ERROR(tile);
10884 }
10885#endif
10886 log_packet_detailed("packet_nuke_tile_info_100: got info about ()");
10887
10888#ifdef FREECIV_DELTA_PROTOCOL
10889 if (nullptr == *hash) {
10890 *hash = genhash_new_full(hash_packet_nuke_tile_info_100, cmp_packet_nuke_tile_info_100,
10891 nullptr, nullptr, nullptr, destroy_packet_nuke_tile_info);
10892 }
10893
10894 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10895 *real_packet = *old;
10896 } else {
10897 /* packet is already initialized empty */
10898 log_packet_detailed(" no old info");
10899 }
10900
10901 if (BV_ISSET(fields, 0)) {
10902 log_packet_detailed(" got field 'tile'");
10903#ifdef FREECIV_JSON_CONNECTION
10904 field_addr.name = "tile";
10905#endif /* FREECIV_JSON_CONNECTION */
10906 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10907 RECEIVE_PACKET_FIELD_ERROR(tile);
10908 }
10909 }
10910
10911 if (nullptr == old) {
10912 old = fc_malloc(sizeof(*old));
10913 init_packet_nuke_tile_info(old);
10914 *old = *real_packet;
10915 genhash_insert(*hash, old, old);
10916 } else {
10917 *old = *real_packet;
10918 }
10919
10920#endif /* FREECIV_DELTA_PROTOCOL */
10921 RECEIVE_PACKET_END(real_packet);
10922#undef FREE_PACKET_STRUCT
10923}
10924
10925 static int send_packet_nuke_tile_info_100(struct connection *pc, const struct packet_nuke_tile_info *packet)
10926{
10927 const struct packet_nuke_tile_info *real_packet = packet;
10928 int e;
10929#ifdef FREECIV_DELTA_PROTOCOL
10930 packet_nuke_tile_info_100_fields fields;
10931 struct packet_nuke_tile_info *old;
10932 bool differ;
10933 struct genhash **hash = pc->phs.sent + PACKET_NUKE_TILE_INFO;
10934#endif /* FREECIV_DELTA_PROTOCOL */
10935 SEND_PACKET_START(PACKET_NUKE_TILE_INFO);
10936#ifdef FREECIV_JSON_CONNECTION
10937 struct plocation field_addr;
10938 {
10939 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
10940 field_addr = *field_addr_tmp;
10941 FC_FREE(field_addr_tmp);
10942 }
10943#endif /* FREECIV_JSON_CONNECTION */
10944
10945 log_packet_detailed("packet_nuke_tile_info_100: sending info about ()");
10946
10947#ifdef FREECIV_DELTA_PROTOCOL
10948 if (nullptr == *hash) {
10949 *hash = genhash_new_full(hash_packet_nuke_tile_info_100, cmp_packet_nuke_tile_info_100,
10950 nullptr, nullptr, nullptr, destroy_packet_nuke_tile_info);
10951 }
10952 BV_CLR_ALL(fields);
10953
10954 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10955 old = fc_malloc(sizeof(*old));
10956 /* temporary bitcopy just to insert correctly */
10957 *old = *real_packet;
10958 genhash_insert(*hash, old, old);
10959 init_packet_nuke_tile_info(old);
10960 }
10961 differ = (old->tile != real_packet->tile);
10962 if (differ) {
10963 BV_SET(fields, 0);
10964 }
10965
10966
10967#ifdef FREECIV_JSON_CONNECTION
10968 field_addr.name = "fields";
10969#endif /* FREECIV_JSON_CONNECTION */
10970 e = 0;
10971 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10972 if (e) {
10973 log_packet_detailed("fields bitvector error detected");
10974 }
10975
10976 if (BV_ISSET(fields, 0)) {
10977 log_packet_detailed(" field 'tile' has changed");
10978#ifdef FREECIV_JSON_CONNECTION
10979 field_addr.name = "tile";
10980#endif /* FREECIV_JSON_CONNECTION */
10981 e = 0;
10982 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10983 if (e) {
10984 log_packet_detailed("'tile' field error detected");
10985 }
10986 }
10987
10988 *old = *real_packet;
10989#endif /* FREECIV_DELTA_PROTOCOL */
10990#ifndef FREECIV_DELTA_PROTOCOL
10991#ifdef FREECIV_JSON_CONNECTION
10992 field_addr.name = "tile";
10993#endif /* FREECIV_JSON_CONNECTION */
10994 e = 0;
10995 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10996 if (e) {
10997 log_packet_detailed("'tile' field error detected");
10998 }
10999
11000#endif
11001 SEND_PACKET_END(PACKET_NUKE_TILE_INFO);
11002}
11003
11004 int send_packet_nuke_tile_info(struct connection *pc, const struct packet_nuke_tile_info *packet)
11005{
11006 if (!pc->used) {
11007 log_error("WARNING: trying to send data to the closed connection %s",
11008 conn_description(pc));
11009 return -1;
11010 }
11011 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NUKE_TILE_INFO].packet != nullptr, -1,
11012 "Handler for PACKET_NUKE_TILE_INFO not installed");
11013 return pc->phs.handlers->send[PACKET_NUKE_TILE_INFO].packet(pc, packet);
11014}
11015
11016 void lsend_packet_nuke_tile_info(struct conn_list *dest, const struct packet_nuke_tile_info *packet)
11017{
11018 conn_list_iterate(dest, pconn) {
11019 send_packet_nuke_tile_info(pconn, packet);
11020 } conn_list_iterate_end;
11021}
11022
11023 int dsend_packet_nuke_tile_info(struct connection *pc, int tile)
11024{
11025 struct packet_nuke_tile_info packet, *real_packet = &packet;
11026
11027 real_packet->tile = tile;
11028
11029 return send_packet_nuke_tile_info(pc, real_packet);
11030}
11031
11032 void dlsend_packet_nuke_tile_info(struct conn_list *dest, int tile)
11033{
11034 struct packet_nuke_tile_info packet, *real_packet = &packet;
11035
11036 real_packet->tile = tile;
11037
11038 lsend_packet_nuke_tile_info(dest, real_packet);
11039}
11040
11041 static inline void init_packet_team_name_info(struct packet_team_name_info *packet)
11042{
11043 memset(packet, 0, sizeof(*packet));
11044}
11045
11046#define free_packet_team_name_info(_packet) (void) 0
11047#define destroy_packet_team_name_info free
11048
11049#ifdef FREECIV_DELTA_PROTOCOL
11050static genhash_val_t hash_packet_team_name_info_100(const void *vkey)
11051{
11052 const struct packet_team_name_info *key = (const struct packet_team_name_info *) vkey;
11053 genhash_val_t result = 0;
11054
11055 result += key->team_id;
11056
11057 result &= 0xFFFFFFFF;
11058 return result;
11059}
11060
11061static bool cmp_packet_team_name_info_100(const void *vkey1, const void *vkey2)
11062{
11063 const struct packet_team_name_info *old = (const struct packet_team_name_info *) vkey1;
11064 const struct packet_team_name_info *real_packet = (const struct packet_team_name_info *) vkey2;
11065 bool differ;
11066
11067 differ = (old->team_id != real_packet->team_id);
11068
11069 return !differ;
11070}
11071 BV_DEFINE(packet_team_name_info_100_fields, 1);
11072#endif /* FREECIV_DELTA_PROTOCOL */
11073
11074 static struct packet_team_name_info *receive_packet_team_name_info_100(struct connection *pc)
11075{
11076#define FREE_PACKET_STRUCT(_packet) free_packet_team_name_info(_packet)
11077#ifdef FREECIV_DELTA_PROTOCOL
11078 packet_team_name_info_100_fields fields;
11079 struct packet_team_name_info *old;
11080 struct genhash **hash = pc->phs.received + PACKET_TEAM_NAME_INFO;
11081#endif /* FREECIV_DELTA_PROTOCOL */
11082 RECEIVE_PACKET_START(packet_team_name_info, real_packet);
11083#ifdef FREECIV_JSON_CONNECTION
11084 struct plocation field_addr;
11085 {
11086 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
11087 field_addr = *field_addr_tmp;
11088 FC_FREE(field_addr_tmp);
11089 }
11090#endif /* FREECIV_JSON_CONNECTION */
11091
11092#ifdef FREECIV_DELTA_PROTOCOL
11093#ifdef FREECIV_JSON_CONNECTION
11094 field_addr.name = "fields";
11095#endif /* FREECIV_JSON_CONNECTION */
11096 DIO_BV_GET(&din, &field_addr, fields);
11097#ifdef FREECIV_JSON_CONNECTION
11098 field_addr.name = "team_id";
11099#endif /* FREECIV_JSON_CONNECTION */
11100 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->team_id)) {
11101 RECEIVE_PACKET_FIELD_ERROR(team_id);
11102 }
11103
11104#else /* FREECIV_DELTA_PROTOCOL */
11105#ifdef FREECIV_JSON_CONNECTION
11106 field_addr.name = "team_id";
11107#endif /* FREECIV_JSON_CONNECTION */
11108 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->team_id)) {
11109 RECEIVE_PACKET_FIELD_ERROR(team_id);
11110 }
11111#ifdef FREECIV_JSON_CONNECTION
11112 field_addr.name = "team_name";
11113#endif /* FREECIV_JSON_CONNECTION */
11114 if (!DIO_GET(string, &din, &field_addr, real_packet->team_name, sizeof(real_packet->team_name))) {
11115 RECEIVE_PACKET_FIELD_ERROR(team_name);
11116 }
11117#endif
11118 log_packet_detailed("packet_team_name_info_100: got info about (%d)",
11119 real_packet->team_id);
11120
11121#ifdef FREECIV_DELTA_PROTOCOL
11122 if (nullptr == *hash) {
11123 *hash = genhash_new_full(hash_packet_team_name_info_100, cmp_packet_team_name_info_100,
11124 nullptr, nullptr, nullptr, destroy_packet_team_name_info);
11125 }
11126
11127 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11128 *real_packet = *old;
11129 } else {
11130 /* packet is already initialized empty */
11131 log_packet_detailed(" no old info");
11132 }
11133
11134 if (BV_ISSET(fields, 0)) {
11135 log_packet_detailed(" got field 'team_name'");
11136#ifdef FREECIV_JSON_CONNECTION
11137 field_addr.name = "team_name";
11138#endif /* FREECIV_JSON_CONNECTION */
11139 if (!DIO_GET(string, &din, &field_addr, real_packet->team_name, sizeof(real_packet->team_name))) {
11140 RECEIVE_PACKET_FIELD_ERROR(team_name);
11141 }
11142 }
11143
11144 if (nullptr == old) {
11145 old = fc_malloc(sizeof(*old));
11146 init_packet_team_name_info(old);
11147 *old = *real_packet;
11148 genhash_insert(*hash, old, old);
11149 } else {
11150 *old = *real_packet;
11151 }
11152
11153#endif /* FREECIV_DELTA_PROTOCOL */
11154 RECEIVE_PACKET_END(real_packet);
11155#undef FREE_PACKET_STRUCT
11156}
11157
11158 static int send_packet_team_name_info_100(struct connection *pc, const struct packet_team_name_info *packet)
11159{
11160 const struct packet_team_name_info *real_packet = packet;
11161 int e;
11162#ifdef FREECIV_DELTA_PROTOCOL
11163 packet_team_name_info_100_fields fields;
11164 struct packet_team_name_info *old;
11165 bool differ;
11166 struct genhash **hash = pc->phs.sent + PACKET_TEAM_NAME_INFO;
11167#endif /* FREECIV_DELTA_PROTOCOL */
11168 SEND_PACKET_START(PACKET_TEAM_NAME_INFO);
11169#ifdef FREECIV_JSON_CONNECTION
11170 struct plocation field_addr;
11171 {
11172 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
11173 field_addr = *field_addr_tmp;
11174 FC_FREE(field_addr_tmp);
11175 }
11176#endif /* FREECIV_JSON_CONNECTION */
11177
11178 log_packet_detailed("packet_team_name_info_100: sending info about (%d)",
11179 real_packet->team_id);
11180
11181#ifdef FREECIV_DELTA_PROTOCOL
11182 if (nullptr == *hash) {
11183 *hash = genhash_new_full(hash_packet_team_name_info_100, cmp_packet_team_name_info_100,
11184 nullptr, nullptr, nullptr, destroy_packet_team_name_info);
11185 }
11186 BV_CLR_ALL(fields);
11187
11188 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11189 old = fc_malloc(sizeof(*old));
11190 /* temporary bitcopy just to insert correctly */
11191 *old = *real_packet;
11192 genhash_insert(*hash, old, old);
11193 init_packet_team_name_info(old);
11194 }
11195 differ = (strcmp(old->team_name, real_packet->team_name) != 0);
11196 if (differ) {
11197 BV_SET(fields, 0);
11198 }
11199
11200
11201#ifdef FREECIV_JSON_CONNECTION
11202 field_addr.name = "fields";
11203#endif /* FREECIV_JSON_CONNECTION */
11204 e = 0;
11205 e |= DIO_BV_PUT(&dout, &field_addr, fields);
11206 if (e) {
11207 log_packet_detailed("fields bitvector error detected");
11208 }
11209#ifdef FREECIV_JSON_CONNECTION
11210 field_addr.name = "team_id";
11211#endif /* FREECIV_JSON_CONNECTION */
11212 e = 0;
11213 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->team_id);
11214 if (e) {
11215 log_packet_detailed("'team_id' field error detected");
11216 }
11217
11218 if (BV_ISSET(fields, 0)) {
11219 log_packet_detailed(" field 'team_name' has changed");
11220#ifdef FREECIV_JSON_CONNECTION
11221 field_addr.name = "team_name";
11222#endif /* FREECIV_JSON_CONNECTION */
11223 e = 0;
11224 e |= DIO_PUT(string, &dout, &field_addr, real_packet->team_name);
11225 if (e) {
11226 log_packet_detailed("'team_name' field error detected");
11227 }
11228 }
11229
11230 *old = *real_packet;
11231#endif /* FREECIV_DELTA_PROTOCOL */
11232#ifndef FREECIV_DELTA_PROTOCOL
11233#ifdef FREECIV_JSON_CONNECTION
11234 field_addr.name = "team_id";
11235#endif /* FREECIV_JSON_CONNECTION */
11236 e = 0;
11237 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->team_id);
11238 if (e) {
11239 log_packet_detailed("'team_id' field error detected");
11240 }
11241#ifdef FREECIV_JSON_CONNECTION
11242 field_addr.name = "team_name";
11243#endif /* FREECIV_JSON_CONNECTION */
11244 e = 0;
11245 e |= DIO_PUT(string, &dout, &field_addr, real_packet->team_name);
11246 if (e) {
11247 log_packet_detailed("'team_name' field error detected");
11248 }
11249
11250#endif
11251 SEND_PACKET_END(PACKET_TEAM_NAME_INFO);
11252}
11253
11254 int send_packet_team_name_info(struct connection *pc, const struct packet_team_name_info *packet)
11255{
11256 if (!pc->used) {
11257 log_error("WARNING: trying to send data to the closed connection %s",
11258 conn_description(pc));
11259 return -1;
11260 }
11261 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TEAM_NAME_INFO].packet != nullptr, -1,
11262 "Handler for PACKET_TEAM_NAME_INFO not installed");
11263 return pc->phs.handlers->send[PACKET_TEAM_NAME_INFO].packet(pc, packet);
11264}
11265
11266 void lsend_packet_team_name_info(struct conn_list *dest, const struct packet_team_name_info *packet)
11267{
11268 conn_list_iterate(dest, pconn) {
11269 send_packet_team_name_info(pconn, packet);
11270 } conn_list_iterate_end;
11271}
11272
11273 static inline void init_packet_achievement_info(struct packet_achievement_info *packet)
11274{
11275 memset(packet, 0, sizeof(*packet));
11276}
11277
11278#define free_packet_achievement_info(_packet) (void) 0
11279#define destroy_packet_achievement_info free
11280
11281#ifdef FREECIV_DELTA_PROTOCOL
11282#define hash_packet_achievement_info_100 hash_const
11283
11284#define cmp_packet_achievement_info_100 cmp_const
11285
11286 BV_DEFINE(packet_achievement_info_100_fields, 3);
11287#endif /* FREECIV_DELTA_PROTOCOL */
11288
11289 static struct packet_achievement_info *receive_packet_achievement_info_100(struct connection *pc)
11290{
11291#define FREE_PACKET_STRUCT(_packet) free_packet_achievement_info(_packet)
11292#ifdef FREECIV_DELTA_PROTOCOL
11293 packet_achievement_info_100_fields fields;
11294 struct packet_achievement_info *old;
11295 struct genhash **hash = pc->phs.received + PACKET_ACHIEVEMENT_INFO;
11296#endif /* FREECIV_DELTA_PROTOCOL */
11297 RECEIVE_PACKET_START(packet_achievement_info, real_packet);
11298#ifdef FREECIV_JSON_CONNECTION
11299 struct plocation field_addr;
11300 {
11301 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
11302 field_addr = *field_addr_tmp;
11303 FC_FREE(field_addr_tmp);
11304 }
11305#endif /* FREECIV_JSON_CONNECTION */
11306
11307#ifdef FREECIV_DELTA_PROTOCOL
11308#ifdef FREECIV_JSON_CONNECTION
11309 field_addr.name = "fields";
11310#endif /* FREECIV_JSON_CONNECTION */
11311 DIO_BV_GET(&din, &field_addr, fields);
11312
11313#else /* FREECIV_DELTA_PROTOCOL */
11314#ifdef FREECIV_JSON_CONNECTION
11315 field_addr.name = "id";
11316#endif /* FREECIV_JSON_CONNECTION */
11317 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
11318 RECEIVE_PACKET_FIELD_ERROR(id);
11319 }
11320#ifdef FREECIV_JSON_CONNECTION
11321 field_addr.name = "gained";
11322#endif /* FREECIV_JSON_CONNECTION */
11323 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->gained)) {
11324 RECEIVE_PACKET_FIELD_ERROR(gained);
11325 }
11326#ifdef FREECIV_JSON_CONNECTION
11327 field_addr.name = "first";
11328#endif /* FREECIV_JSON_CONNECTION */
11329 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->first)) {
11330 RECEIVE_PACKET_FIELD_ERROR(first);
11331 }
11332#endif
11333 log_packet_detailed("packet_achievement_info_100: got info about ()");
11334
11335#ifdef FREECIV_DELTA_PROTOCOL
11336 if (nullptr == *hash) {
11337 *hash = genhash_new_full(hash_packet_achievement_info_100, cmp_packet_achievement_info_100,
11338 nullptr, nullptr, nullptr, destroy_packet_achievement_info);
11339 }
11340
11341 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11342 *real_packet = *old;
11343 } else {
11344 /* packet is already initialized empty */
11345 log_packet_detailed(" no old info");
11346 }
11347
11348 if (BV_ISSET(fields, 0)) {
11349 log_packet_detailed(" got field 'id'");
11350#ifdef FREECIV_JSON_CONNECTION
11351 field_addr.name = "id";
11352#endif /* FREECIV_JSON_CONNECTION */
11353 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
11354 RECEIVE_PACKET_FIELD_ERROR(id);
11355 }
11356 }
11357 real_packet->gained = BV_ISSET(fields, 1);
11358 real_packet->first = BV_ISSET(fields, 2);
11359
11360 if (nullptr == old) {
11361 old = fc_malloc(sizeof(*old));
11362 init_packet_achievement_info(old);
11363 *old = *real_packet;
11364 genhash_insert(*hash, old, old);
11365 } else {
11366 *old = *real_packet;
11367 }
11368
11369#endif /* FREECIV_DELTA_PROTOCOL */
11370 RECEIVE_PACKET_END(real_packet);
11371#undef FREE_PACKET_STRUCT
11372}
11373
11374 static int send_packet_achievement_info_100(struct connection *pc, const struct packet_achievement_info *packet)
11375{
11376 const struct packet_achievement_info *real_packet = packet;
11377 int e;
11378#ifdef FREECIV_DELTA_PROTOCOL
11379 packet_achievement_info_100_fields fields;
11380 struct packet_achievement_info *old;
11381 bool differ;
11382 struct genhash **hash = pc->phs.sent + PACKET_ACHIEVEMENT_INFO;
11383#endif /* FREECIV_DELTA_PROTOCOL */
11384 SEND_PACKET_START(PACKET_ACHIEVEMENT_INFO);
11385#ifdef FREECIV_JSON_CONNECTION
11386 struct plocation field_addr;
11387 {
11388 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
11389 field_addr = *field_addr_tmp;
11390 FC_FREE(field_addr_tmp);
11391 }
11392#endif /* FREECIV_JSON_CONNECTION */
11393
11394 log_packet_detailed("packet_achievement_info_100: sending info about ()");
11395
11396#ifdef FREECIV_DELTA_PROTOCOL
11397 if (nullptr == *hash) {
11398 *hash = genhash_new_full(hash_packet_achievement_info_100, cmp_packet_achievement_info_100,
11399 nullptr, nullptr, nullptr, destroy_packet_achievement_info);
11400 }
11401 BV_CLR_ALL(fields);
11402
11403 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11404 old = fc_malloc(sizeof(*old));
11405 /* temporary bitcopy just to insert correctly */
11406 *old = *real_packet;
11407 genhash_insert(*hash, old, old);
11408 init_packet_achievement_info(old);
11409 }
11410 differ = (old->id != real_packet->id);
11411 if (differ) {
11412 BV_SET(fields, 0);
11413 }
11414
11415 if (packet->gained) {
11416 BV_SET(fields, 1);
11417 }
11418
11419 if (packet->first) {
11420 BV_SET(fields, 2);
11421 }
11422
11423
11424#ifdef FREECIV_JSON_CONNECTION
11425 field_addr.name = "fields";
11426#endif /* FREECIV_JSON_CONNECTION */
11427 e = 0;
11428 e |= DIO_BV_PUT(&dout, &field_addr, fields);
11429 if (e) {
11430 log_packet_detailed("fields bitvector error detected");
11431 }
11432
11433 if (BV_ISSET(fields, 0)) {
11434 log_packet_detailed(" field 'id' has changed");
11435#ifdef FREECIV_JSON_CONNECTION
11436 field_addr.name = "id";
11437#endif /* FREECIV_JSON_CONNECTION */
11438 e = 0;
11439 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
11440 if (e) {
11441 log_packet_detailed("'id' field error detected");
11442 }
11443 }
11444 /* field 1 is folded into the header */
11445 /* field 2 is folded into the header */
11446
11447 *old = *real_packet;
11448#endif /* FREECIV_DELTA_PROTOCOL */
11449#ifndef FREECIV_DELTA_PROTOCOL
11450#ifdef FREECIV_JSON_CONNECTION
11451 field_addr.name = "id";
11452#endif /* FREECIV_JSON_CONNECTION */
11453 e = 0;
11454 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
11455 if (e) {
11456 log_packet_detailed("'id' field error detected");
11457 }
11458#ifdef FREECIV_JSON_CONNECTION
11459 field_addr.name = "gained";
11460#endif /* FREECIV_JSON_CONNECTION */
11461 e = 0;
11462 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->gained);
11463 if (e) {
11464 log_packet_detailed("'gained' field error detected");
11465 }
11466#ifdef FREECIV_JSON_CONNECTION
11467 field_addr.name = "first";
11468#endif /* FREECIV_JSON_CONNECTION */
11469 e = 0;
11470 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->first);
11471 if (e) {
11472 log_packet_detailed("'first' field error detected");
11473 }
11474
11475#endif
11476 SEND_PACKET_END(PACKET_ACHIEVEMENT_INFO);
11477}
11478
11479 int send_packet_achievement_info(struct connection *pc, const struct packet_achievement_info *packet)
11480{
11481 if (!pc->used) {
11482 log_error("WARNING: trying to send data to the closed connection %s",
11483 conn_description(pc));
11484 return -1;
11485 }
11486 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ACHIEVEMENT_INFO].packet != nullptr, -1,
11487 "Handler for PACKET_ACHIEVEMENT_INFO not installed");
11488 return pc->phs.handlers->send[PACKET_ACHIEVEMENT_INFO].packet(pc, packet);
11489}
11490
11491 void lsend_packet_achievement_info(struct conn_list *dest, const struct packet_achievement_info *packet)
11492{
11493 conn_list_iterate(dest, pconn) {
11494 send_packet_achievement_info(pconn, packet);
11495 } conn_list_iterate_end;
11496}
11497
11498 static inline void init_packet_chat_msg(struct packet_chat_msg *packet)
11499{
11500 memset(packet, 0, sizeof(*packet));
11501}
11502
11503#define free_packet_chat_msg(_packet) (void) 0
11504#define destroy_packet_chat_msg free
11505
11506#ifdef FREECIV_DELTA_PROTOCOL
11507#define hash_packet_chat_msg_100 hash_const
11508
11509#define cmp_packet_chat_msg_100 cmp_const
11510
11511 BV_DEFINE(packet_chat_msg_100_fields, 6);
11512#endif /* FREECIV_DELTA_PROTOCOL */
11513
11514 static struct packet_chat_msg *receive_packet_chat_msg_100(struct connection *pc)
11515{
11516#define FREE_PACKET_STRUCT(_packet) free_packet_chat_msg(_packet)
11517#ifdef FREECIV_DELTA_PROTOCOL
11518 packet_chat_msg_100_fields fields;
11519 struct packet_chat_msg *old;
11520 struct genhash **hash = pc->phs.received + PACKET_CHAT_MSG;
11521#endif /* FREECIV_DELTA_PROTOCOL */
11522 RECEIVE_PACKET_START(packet_chat_msg, real_packet);
11523#ifdef FREECIV_JSON_CONNECTION
11524 struct plocation field_addr;
11525 {
11526 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
11527 field_addr = *field_addr_tmp;
11528 FC_FREE(field_addr_tmp);
11529 }
11530#endif /* FREECIV_JSON_CONNECTION */
11531
11532#ifdef FREECIV_DELTA_PROTOCOL
11533#ifdef FREECIV_JSON_CONNECTION
11534 field_addr.name = "fields";
11535#endif /* FREECIV_JSON_CONNECTION */
11536 DIO_BV_GET(&din, &field_addr, fields);
11537
11538#else /* FREECIV_DELTA_PROTOCOL */
11539#ifdef FREECIV_JSON_CONNECTION
11540 field_addr.name = "message";
11541#endif /* FREECIV_JSON_CONNECTION */
11542 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11543 RECEIVE_PACKET_FIELD_ERROR(message);
11544 }
11545#ifdef FREECIV_JSON_CONNECTION
11546 field_addr.name = "tile";
11547#endif /* FREECIV_JSON_CONNECTION */
11548 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
11549 RECEIVE_PACKET_FIELD_ERROR(tile);
11550 }
11551#ifdef FREECIV_JSON_CONNECTION
11552 field_addr.name = "event";
11553#endif /* FREECIV_JSON_CONNECTION */
11554 {
11555 int readin;
11556
11557 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
11558 RECEIVE_PACKET_FIELD_ERROR(event);
11559 }
11560 real_packet->event = readin;
11561 }
11562#ifdef FREECIV_JSON_CONNECTION
11563 field_addr.name = "turn";
11564#endif /* FREECIV_JSON_CONNECTION */
11565 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
11566 RECEIVE_PACKET_FIELD_ERROR(turn);
11567 }
11568#ifdef FREECIV_JSON_CONNECTION
11569 field_addr.name = "phase";
11570#endif /* FREECIV_JSON_CONNECTION */
11571 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
11572 RECEIVE_PACKET_FIELD_ERROR(phase);
11573 }
11574#ifdef FREECIV_JSON_CONNECTION
11575 field_addr.name = "conn_id";
11576#endif /* FREECIV_JSON_CONNECTION */
11577 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
11578 RECEIVE_PACKET_FIELD_ERROR(conn_id);
11579 }
11580#endif
11581 log_packet_detailed("packet_chat_msg_100: got info about ()");
11582
11583#ifdef FREECIV_DELTA_PROTOCOL
11584 if (nullptr == *hash) {
11585 *hash = genhash_new_full(hash_packet_chat_msg_100, cmp_packet_chat_msg_100,
11586 nullptr, nullptr, nullptr, destroy_packet_chat_msg);
11587 }
11588
11589 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11590 *real_packet = *old;
11591 } else {
11592 /* packet is already initialized empty */
11593 log_packet_detailed(" no old info");
11594 }
11595
11596 if (BV_ISSET(fields, 0)) {
11597 log_packet_detailed(" got field 'message'");
11598#ifdef FREECIV_JSON_CONNECTION
11599 field_addr.name = "message";
11600#endif /* FREECIV_JSON_CONNECTION */
11601 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11602 RECEIVE_PACKET_FIELD_ERROR(message);
11603 }
11604 }
11605 if (BV_ISSET(fields, 1)) {
11606 log_packet_detailed(" got field 'tile'");
11607#ifdef FREECIV_JSON_CONNECTION
11608 field_addr.name = "tile";
11609#endif /* FREECIV_JSON_CONNECTION */
11610 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
11611 RECEIVE_PACKET_FIELD_ERROR(tile);
11612 }
11613 }
11614 if (BV_ISSET(fields, 2)) {
11615 log_packet_detailed(" got field 'event'");
11616#ifdef FREECIV_JSON_CONNECTION
11617 field_addr.name = "event";
11618#endif /* FREECIV_JSON_CONNECTION */
11619 {
11620 int readin;
11621
11622 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
11623 RECEIVE_PACKET_FIELD_ERROR(event);
11624 }
11625 real_packet->event = readin;
11626 }
11627 }
11628 if (BV_ISSET(fields, 3)) {
11629 log_packet_detailed(" got field 'turn'");
11630#ifdef FREECIV_JSON_CONNECTION
11631 field_addr.name = "turn";
11632#endif /* FREECIV_JSON_CONNECTION */
11633 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
11634 RECEIVE_PACKET_FIELD_ERROR(turn);
11635 }
11636 }
11637 if (BV_ISSET(fields, 4)) {
11638 log_packet_detailed(" got field 'phase'");
11639#ifdef FREECIV_JSON_CONNECTION
11640 field_addr.name = "phase";
11641#endif /* FREECIV_JSON_CONNECTION */
11642 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
11643 RECEIVE_PACKET_FIELD_ERROR(phase);
11644 }
11645 }
11646 if (BV_ISSET(fields, 5)) {
11647 log_packet_detailed(" got field 'conn_id'");
11648#ifdef FREECIV_JSON_CONNECTION
11649 field_addr.name = "conn_id";
11650#endif /* FREECIV_JSON_CONNECTION */
11651 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
11652 RECEIVE_PACKET_FIELD_ERROR(conn_id);
11653 }
11654 }
11655
11656 if (nullptr == old) {
11657 old = fc_malloc(sizeof(*old));
11658 init_packet_chat_msg(old);
11659 *old = *real_packet;
11660 genhash_insert(*hash, old, old);
11661 } else {
11662 *old = *real_packet;
11663 }
11664
11665#endif /* FREECIV_DELTA_PROTOCOL */
11666 RECEIVE_PACKET_END(real_packet);
11667#undef FREE_PACKET_STRUCT
11668}
11669
11670 static int send_packet_chat_msg_100(struct connection *pc, const struct packet_chat_msg *packet)
11671{
11672 const struct packet_chat_msg *real_packet = packet;
11673 int e;
11674#ifdef FREECIV_DELTA_PROTOCOL
11675 packet_chat_msg_100_fields fields;
11676 struct packet_chat_msg *old;
11677 bool differ;
11678 struct genhash **hash = pc->phs.sent + PACKET_CHAT_MSG;
11679#endif /* FREECIV_DELTA_PROTOCOL */
11680 SEND_PACKET_START(PACKET_CHAT_MSG);
11681#ifdef FREECIV_JSON_CONNECTION
11682 struct plocation field_addr;
11683 {
11684 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
11685 field_addr = *field_addr_tmp;
11686 FC_FREE(field_addr_tmp);
11687 }
11688#endif /* FREECIV_JSON_CONNECTION */
11689
11690 log_packet_detailed("packet_chat_msg_100: sending info about ()");
11691
11692#ifdef FREECIV_DELTA_PROTOCOL
11693 if (nullptr == *hash) {
11694 *hash = genhash_new_full(hash_packet_chat_msg_100, cmp_packet_chat_msg_100,
11695 nullptr, nullptr, nullptr, destroy_packet_chat_msg);
11696 }
11697 BV_CLR_ALL(fields);
11698
11699 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11700 old = fc_malloc(sizeof(*old));
11701 /* temporary bitcopy just to insert correctly */
11702 *old = *real_packet;
11703 genhash_insert(*hash, old, old);
11704 init_packet_chat_msg(old);
11705 }
11706 differ = (strcmp(old->message, real_packet->message) != 0);
11707 if (differ) {
11708 BV_SET(fields, 0);
11709 }
11710
11711 differ = (old->tile != real_packet->tile);
11712 if (differ) {
11713 BV_SET(fields, 1);
11714 }
11715
11716 differ = (old->event != real_packet->event);
11717 if (differ) {
11718 BV_SET(fields, 2);
11719 }
11720
11721 differ = (old->turn != real_packet->turn);
11722 if (differ) {
11723 BV_SET(fields, 3);
11724 }
11725
11726 differ = (old->phase != real_packet->phase);
11727 if (differ) {
11728 BV_SET(fields, 4);
11729 }
11730
11731 differ = (old->conn_id != real_packet->conn_id);
11732 if (differ) {
11733 BV_SET(fields, 5);
11734 }
11735
11736
11737#ifdef FREECIV_JSON_CONNECTION
11738 field_addr.name = "fields";
11739#endif /* FREECIV_JSON_CONNECTION */
11740 e = 0;
11741 e |= DIO_BV_PUT(&dout, &field_addr, fields);
11742 if (e) {
11743 log_packet_detailed("fields bitvector error detected");
11744 }
11745
11746 if (BV_ISSET(fields, 0)) {
11747 log_packet_detailed(" field 'message' has changed");
11748#ifdef FREECIV_JSON_CONNECTION
11749 field_addr.name = "message";
11750#endif /* FREECIV_JSON_CONNECTION */
11751 e = 0;
11752 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
11753 if (e) {
11754 log_packet_detailed("'message' field error detected");
11755 }
11756 }
11757 if (BV_ISSET(fields, 1)) {
11758 log_packet_detailed(" field 'tile' has changed");
11759#ifdef FREECIV_JSON_CONNECTION
11760 field_addr.name = "tile";
11761#endif /* FREECIV_JSON_CONNECTION */
11762 e = 0;
11763 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11764 if (e) {
11765 log_packet_detailed("'tile' field error detected");
11766 }
11767 }
11768 if (BV_ISSET(fields, 2)) {
11769 log_packet_detailed(" field 'event' has changed");
11770#ifdef FREECIV_JSON_CONNECTION
11771 field_addr.name = "event";
11772#endif /* FREECIV_JSON_CONNECTION */
11773 e = 0;
11774 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11775 if (e) {
11776 log_packet_detailed("'event' field error detected");
11777 }
11778 }
11779 if (BV_ISSET(fields, 3)) {
11780 log_packet_detailed(" field 'turn' has changed");
11781#ifdef FREECIV_JSON_CONNECTION
11782 field_addr.name = "turn";
11783#endif /* FREECIV_JSON_CONNECTION */
11784 e = 0;
11785 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11786 if (e) {
11787 log_packet_detailed("'turn' field error detected");
11788 }
11789 }
11790 if (BV_ISSET(fields, 4)) {
11791 log_packet_detailed(" field 'phase' has changed");
11792#ifdef FREECIV_JSON_CONNECTION
11793 field_addr.name = "phase";
11794#endif /* FREECIV_JSON_CONNECTION */
11795 e = 0;
11796 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11797 if (e) {
11798 log_packet_detailed("'phase' field error detected");
11799 }
11800 }
11801 if (BV_ISSET(fields, 5)) {
11802 log_packet_detailed(" field 'conn_id' has changed");
11803#ifdef FREECIV_JSON_CONNECTION
11804 field_addr.name = "conn_id";
11805#endif /* FREECIV_JSON_CONNECTION */
11806 e = 0;
11807 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11808 if (e) {
11809 log_packet_detailed("'conn_id' field error detected");
11810 }
11811 }
11812
11813 *old = *real_packet;
11814#endif /* FREECIV_DELTA_PROTOCOL */
11815#ifndef FREECIV_DELTA_PROTOCOL
11816#ifdef FREECIV_JSON_CONNECTION
11817 field_addr.name = "message";
11818#endif /* FREECIV_JSON_CONNECTION */
11819 e = 0;
11820 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
11821 if (e) {
11822 log_packet_detailed("'message' field error detected");
11823 }
11824#ifdef FREECIV_JSON_CONNECTION
11825 field_addr.name = "tile";
11826#endif /* FREECIV_JSON_CONNECTION */
11827 e = 0;
11828 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11829 if (e) {
11830 log_packet_detailed("'tile' field error detected");
11831 }
11832#ifdef FREECIV_JSON_CONNECTION
11833 field_addr.name = "event";
11834#endif /* FREECIV_JSON_CONNECTION */
11835 e = 0;
11836 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11837 if (e) {
11838 log_packet_detailed("'event' field error detected");
11839 }
11840#ifdef FREECIV_JSON_CONNECTION
11841 field_addr.name = "turn";
11842#endif /* FREECIV_JSON_CONNECTION */
11843 e = 0;
11844 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11845 if (e) {
11846 log_packet_detailed("'turn' field error detected");
11847 }
11848#ifdef FREECIV_JSON_CONNECTION
11849 field_addr.name = "phase";
11850#endif /* FREECIV_JSON_CONNECTION */
11851 e = 0;
11852 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11853 if (e) {
11854 log_packet_detailed("'phase' field error detected");
11855 }
11856#ifdef FREECIV_JSON_CONNECTION
11857 field_addr.name = "conn_id";
11858#endif /* FREECIV_JSON_CONNECTION */
11859 e = 0;
11860 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11861 if (e) {
11862 log_packet_detailed("'conn_id' field error detected");
11863 }
11864
11865#endif
11866 SEND_PACKET_END(PACKET_CHAT_MSG);
11867}
11868
11869 int send_packet_chat_msg(struct connection *pc, const struct packet_chat_msg *packet)
11870{
11871 if (!pc->used) {
11872 log_error("WARNING: trying to send data to the closed connection %s",
11873 conn_description(pc));
11874 return -1;
11875 }
11876 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CHAT_MSG].packet != nullptr, -1,
11877 "Handler for PACKET_CHAT_MSG not installed");
11878 return pc->phs.handlers->send[PACKET_CHAT_MSG].packet(pc, packet);
11879}
11880
11881 void lsend_packet_chat_msg(struct conn_list *dest, const struct packet_chat_msg *packet)
11882{
11883 conn_list_iterate(dest, pconn) {
11884 send_packet_chat_msg(pconn, packet);
11885 } conn_list_iterate_end;
11886}
11887
11888 static inline void init_packet_early_chat_msg(struct packet_early_chat_msg *packet)
11889{
11890 memset(packet, 0, sizeof(*packet));
11891}
11892
11893#define free_packet_early_chat_msg(_packet) (void) 0
11894#define destroy_packet_early_chat_msg free
11895
11896#ifdef FREECIV_DELTA_PROTOCOL
11897#define hash_packet_early_chat_msg_100 hash_const
11898
11899#define cmp_packet_early_chat_msg_100 cmp_const
11900
11901 BV_DEFINE(packet_early_chat_msg_100_fields, 6);
11902#endif /* FREECIV_DELTA_PROTOCOL */
11903
11904 static struct packet_early_chat_msg *receive_packet_early_chat_msg_100(struct connection *pc)
11905{
11906#define FREE_PACKET_STRUCT(_packet) free_packet_early_chat_msg(_packet)
11907#ifdef FREECIV_DELTA_PROTOCOL
11908 packet_early_chat_msg_100_fields fields;
11909 struct packet_early_chat_msg *old;
11910 struct genhash **hash = pc->phs.received + PACKET_EARLY_CHAT_MSG;
11911#endif /* FREECIV_DELTA_PROTOCOL */
11912 RECEIVE_PACKET_START(packet_early_chat_msg, real_packet);
11913#ifdef FREECIV_JSON_CONNECTION
11914 struct plocation field_addr;
11915 {
11916 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
11917 field_addr = *field_addr_tmp;
11918 FC_FREE(field_addr_tmp);
11919 }
11920#endif /* FREECIV_JSON_CONNECTION */
11921
11922#ifdef FREECIV_DELTA_PROTOCOL
11923#ifdef FREECIV_JSON_CONNECTION
11924 field_addr.name = "fields";
11925#endif /* FREECIV_JSON_CONNECTION */
11926 DIO_BV_GET(&din, &field_addr, fields);
11927
11928#else /* FREECIV_DELTA_PROTOCOL */
11929#ifdef FREECIV_JSON_CONNECTION
11930 field_addr.name = "message";
11931#endif /* FREECIV_JSON_CONNECTION */
11932 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11933 RECEIVE_PACKET_FIELD_ERROR(message);
11934 }
11935#ifdef FREECIV_JSON_CONNECTION
11936 field_addr.name = "tile";
11937#endif /* FREECIV_JSON_CONNECTION */
11938 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
11939 RECEIVE_PACKET_FIELD_ERROR(tile);
11940 }
11941#ifdef FREECIV_JSON_CONNECTION
11942 field_addr.name = "event";
11943#endif /* FREECIV_JSON_CONNECTION */
11944 {
11945 int readin;
11946
11947 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
11948 RECEIVE_PACKET_FIELD_ERROR(event);
11949 }
11950 real_packet->event = readin;
11951 }
11952#ifdef FREECIV_JSON_CONNECTION
11953 field_addr.name = "turn";
11954#endif /* FREECIV_JSON_CONNECTION */
11955 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
11956 RECEIVE_PACKET_FIELD_ERROR(turn);
11957 }
11958#ifdef FREECIV_JSON_CONNECTION
11959 field_addr.name = "phase";
11960#endif /* FREECIV_JSON_CONNECTION */
11961 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
11962 RECEIVE_PACKET_FIELD_ERROR(phase);
11963 }
11964#ifdef FREECIV_JSON_CONNECTION
11965 field_addr.name = "conn_id";
11966#endif /* FREECIV_JSON_CONNECTION */
11967 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
11968 RECEIVE_PACKET_FIELD_ERROR(conn_id);
11969 }
11970#endif
11971 log_packet_detailed("packet_early_chat_msg_100: got info about ()");
11972
11973#ifdef FREECIV_DELTA_PROTOCOL
11974 if (nullptr == *hash) {
11975 *hash = genhash_new_full(hash_packet_early_chat_msg_100, cmp_packet_early_chat_msg_100,
11976 nullptr, nullptr, nullptr, destroy_packet_early_chat_msg);
11977 }
11978
11979 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11980 *real_packet = *old;
11981 } else {
11982 /* packet is already initialized empty */
11983 log_packet_detailed(" no old info");
11984 }
11985
11986 if (BV_ISSET(fields, 0)) {
11987 log_packet_detailed(" got field 'message'");
11988#ifdef FREECIV_JSON_CONNECTION
11989 field_addr.name = "message";
11990#endif /* FREECIV_JSON_CONNECTION */
11991 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11992 RECEIVE_PACKET_FIELD_ERROR(message);
11993 }
11994 }
11995 if (BV_ISSET(fields, 1)) {
11996 log_packet_detailed(" got field 'tile'");
11997#ifdef FREECIV_JSON_CONNECTION
11998 field_addr.name = "tile";
11999#endif /* FREECIV_JSON_CONNECTION */
12000 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
12001 RECEIVE_PACKET_FIELD_ERROR(tile);
12002 }
12003 }
12004 if (BV_ISSET(fields, 2)) {
12005 log_packet_detailed(" got field 'event'");
12006#ifdef FREECIV_JSON_CONNECTION
12007 field_addr.name = "event";
12008#endif /* FREECIV_JSON_CONNECTION */
12009 {
12010 int readin;
12011
12012 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
12013 RECEIVE_PACKET_FIELD_ERROR(event);
12014 }
12015 real_packet->event = readin;
12016 }
12017 }
12018 if (BV_ISSET(fields, 3)) {
12019 log_packet_detailed(" got field 'turn'");
12020#ifdef FREECIV_JSON_CONNECTION
12021 field_addr.name = "turn";
12022#endif /* FREECIV_JSON_CONNECTION */
12023 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
12024 RECEIVE_PACKET_FIELD_ERROR(turn);
12025 }
12026 }
12027 if (BV_ISSET(fields, 4)) {
12028 log_packet_detailed(" got field 'phase'");
12029#ifdef FREECIV_JSON_CONNECTION
12030 field_addr.name = "phase";
12031#endif /* FREECIV_JSON_CONNECTION */
12032 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
12033 RECEIVE_PACKET_FIELD_ERROR(phase);
12034 }
12035 }
12036 if (BV_ISSET(fields, 5)) {
12037 log_packet_detailed(" got field 'conn_id'");
12038#ifdef FREECIV_JSON_CONNECTION
12039 field_addr.name = "conn_id";
12040#endif /* FREECIV_JSON_CONNECTION */
12041 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
12042 RECEIVE_PACKET_FIELD_ERROR(conn_id);
12043 }
12044 }
12045
12046 if (nullptr == old) {
12047 old = fc_malloc(sizeof(*old));
12048 init_packet_early_chat_msg(old);
12049 *old = *real_packet;
12050 genhash_insert(*hash, old, old);
12051 } else {
12052 *old = *real_packet;
12053 }
12054
12055#endif /* FREECIV_DELTA_PROTOCOL */
12056 RECEIVE_PACKET_END(real_packet);
12057#undef FREE_PACKET_STRUCT
12058}
12059
12060 static int send_packet_early_chat_msg_100(struct connection *pc, const struct packet_early_chat_msg *packet)
12061{
12062 const struct packet_early_chat_msg *real_packet = packet;
12063 int e;
12064#ifdef FREECIV_DELTA_PROTOCOL
12065 packet_early_chat_msg_100_fields fields;
12066 struct packet_early_chat_msg *old;
12067 bool differ;
12068 struct genhash **hash = pc->phs.sent + PACKET_EARLY_CHAT_MSG;
12069#endif /* FREECIV_DELTA_PROTOCOL */
12070 SEND_PACKET_START(PACKET_EARLY_CHAT_MSG);
12071#ifdef FREECIV_JSON_CONNECTION
12072 struct plocation field_addr;
12073 {
12074 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
12075 field_addr = *field_addr_tmp;
12076 FC_FREE(field_addr_tmp);
12077 }
12078#endif /* FREECIV_JSON_CONNECTION */
12079
12080 log_packet_detailed("packet_early_chat_msg_100: sending info about ()");
12081
12082#ifdef FREECIV_DELTA_PROTOCOL
12083 if (nullptr == *hash) {
12084 *hash = genhash_new_full(hash_packet_early_chat_msg_100, cmp_packet_early_chat_msg_100,
12085 nullptr, nullptr, nullptr, destroy_packet_early_chat_msg);
12086 }
12087 BV_CLR_ALL(fields);
12088
12089 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12090 old = fc_malloc(sizeof(*old));
12091 /* temporary bitcopy just to insert correctly */
12092 *old = *real_packet;
12093 genhash_insert(*hash, old, old);
12094 init_packet_early_chat_msg(old);
12095 }
12096 differ = (strcmp(old->message, real_packet->message) != 0);
12097 if (differ) {
12098 BV_SET(fields, 0);
12099 }
12100
12101 differ = (old->tile != real_packet->tile);
12102 if (differ) {
12103 BV_SET(fields, 1);
12104 }
12105
12106 differ = (old->event != real_packet->event);
12107 if (differ) {
12108 BV_SET(fields, 2);
12109 }
12110
12111 differ = (old->turn != real_packet->turn);
12112 if (differ) {
12113 BV_SET(fields, 3);
12114 }
12115
12116 differ = (old->phase != real_packet->phase);
12117 if (differ) {
12118 BV_SET(fields, 4);
12119 }
12120
12121 differ = (old->conn_id != real_packet->conn_id);
12122 if (differ) {
12123 BV_SET(fields, 5);
12124 }
12125
12126
12127#ifdef FREECIV_JSON_CONNECTION
12128 field_addr.name = "fields";
12129#endif /* FREECIV_JSON_CONNECTION */
12130 e = 0;
12131 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12132 if (e) {
12133 log_packet_detailed("fields bitvector error detected");
12134 }
12135
12136 if (BV_ISSET(fields, 0)) {
12137 log_packet_detailed(" field 'message' has changed");
12138#ifdef FREECIV_JSON_CONNECTION
12139 field_addr.name = "message";
12140#endif /* FREECIV_JSON_CONNECTION */
12141 e = 0;
12142 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
12143 if (e) {
12144 log_packet_detailed("'message' field error detected");
12145 }
12146 }
12147 if (BV_ISSET(fields, 1)) {
12148 log_packet_detailed(" field 'tile' has changed");
12149#ifdef FREECIV_JSON_CONNECTION
12150 field_addr.name = "tile";
12151#endif /* FREECIV_JSON_CONNECTION */
12152 e = 0;
12153 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
12154 if (e) {
12155 log_packet_detailed("'tile' field error detected");
12156 }
12157 }
12158 if (BV_ISSET(fields, 2)) {
12159 log_packet_detailed(" field 'event' has changed");
12160#ifdef FREECIV_JSON_CONNECTION
12161 field_addr.name = "event";
12162#endif /* FREECIV_JSON_CONNECTION */
12163 e = 0;
12164 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
12165 if (e) {
12166 log_packet_detailed("'event' field error detected");
12167 }
12168 }
12169 if (BV_ISSET(fields, 3)) {
12170 log_packet_detailed(" field 'turn' has changed");
12171#ifdef FREECIV_JSON_CONNECTION
12172 field_addr.name = "turn";
12173#endif /* FREECIV_JSON_CONNECTION */
12174 e = 0;
12175 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
12176 if (e) {
12177 log_packet_detailed("'turn' field error detected");
12178 }
12179 }
12180 if (BV_ISSET(fields, 4)) {
12181 log_packet_detailed(" field 'phase' has changed");
12182#ifdef FREECIV_JSON_CONNECTION
12183 field_addr.name = "phase";
12184#endif /* FREECIV_JSON_CONNECTION */
12185 e = 0;
12186 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
12187 if (e) {
12188 log_packet_detailed("'phase' field error detected");
12189 }
12190 }
12191 if (BV_ISSET(fields, 5)) {
12192 log_packet_detailed(" field 'conn_id' has changed");
12193#ifdef FREECIV_JSON_CONNECTION
12194 field_addr.name = "conn_id";
12195#endif /* FREECIV_JSON_CONNECTION */
12196 e = 0;
12197 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
12198 if (e) {
12199 log_packet_detailed("'conn_id' field error detected");
12200 }
12201 }
12202
12203 *old = *real_packet;
12204#endif /* FREECIV_DELTA_PROTOCOL */
12205#ifndef FREECIV_DELTA_PROTOCOL
12206#ifdef FREECIV_JSON_CONNECTION
12207 field_addr.name = "message";
12208#endif /* FREECIV_JSON_CONNECTION */
12209 e = 0;
12210 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
12211 if (e) {
12212 log_packet_detailed("'message' field error detected");
12213 }
12214#ifdef FREECIV_JSON_CONNECTION
12215 field_addr.name = "tile";
12216#endif /* FREECIV_JSON_CONNECTION */
12217 e = 0;
12218 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
12219 if (e) {
12220 log_packet_detailed("'tile' field error detected");
12221 }
12222#ifdef FREECIV_JSON_CONNECTION
12223 field_addr.name = "event";
12224#endif /* FREECIV_JSON_CONNECTION */
12225 e = 0;
12226 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
12227 if (e) {
12228 log_packet_detailed("'event' field error detected");
12229 }
12230#ifdef FREECIV_JSON_CONNECTION
12231 field_addr.name = "turn";
12232#endif /* FREECIV_JSON_CONNECTION */
12233 e = 0;
12234 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
12235 if (e) {
12236 log_packet_detailed("'turn' field error detected");
12237 }
12238#ifdef FREECIV_JSON_CONNECTION
12239 field_addr.name = "phase";
12240#endif /* FREECIV_JSON_CONNECTION */
12241 e = 0;
12242 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
12243 if (e) {
12244 log_packet_detailed("'phase' field error detected");
12245 }
12246#ifdef FREECIV_JSON_CONNECTION
12247 field_addr.name = "conn_id";
12248#endif /* FREECIV_JSON_CONNECTION */
12249 e = 0;
12250 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
12251 if (e) {
12252 log_packet_detailed("'conn_id' field error detected");
12253 }
12254
12255#endif
12256 SEND_PACKET_END(PACKET_EARLY_CHAT_MSG);
12257}
12258
12259 int send_packet_early_chat_msg(struct connection *pc, const struct packet_early_chat_msg *packet)
12260{
12261 if (!pc->used) {
12262 log_error("WARNING: trying to send data to the closed connection %s",
12263 conn_description(pc));
12264 return -1;
12265 }
12266 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EARLY_CHAT_MSG].packet != nullptr, -1,
12267 "Handler for PACKET_EARLY_CHAT_MSG not installed");
12268 return pc->phs.handlers->send[PACKET_EARLY_CHAT_MSG].packet(pc, packet);
12269}
12270
12271 void lsend_packet_early_chat_msg(struct conn_list *dest, const struct packet_early_chat_msg *packet)
12272{
12273 conn_list_iterate(dest, pconn) {
12274 send_packet_early_chat_msg(pconn, packet);
12275 } conn_list_iterate_end;
12276}
12277
12278 static inline void init_packet_chat_msg_req(struct packet_chat_msg_req *packet)
12279{
12280 memset(packet, 0, sizeof(*packet));
12281}
12282
12283#define free_packet_chat_msg_req(_packet) (void) 0
12284#define destroy_packet_chat_msg_req free
12285
12286#ifdef FREECIV_DELTA_PROTOCOL
12287#define hash_packet_chat_msg_req_100 hash_const
12288
12289#define cmp_packet_chat_msg_req_100 cmp_const
12290
12291 BV_DEFINE(packet_chat_msg_req_100_fields, 1);
12292#endif /* FREECIV_DELTA_PROTOCOL */
12293
12294 static struct packet_chat_msg_req *receive_packet_chat_msg_req_100(struct connection *pc)
12295{
12296#define FREE_PACKET_STRUCT(_packet) free_packet_chat_msg_req(_packet)
12297#ifdef FREECIV_DELTA_PROTOCOL
12298 packet_chat_msg_req_100_fields fields;
12299 struct packet_chat_msg_req *old;
12300 struct genhash **hash = pc->phs.received + PACKET_CHAT_MSG_REQ;
12301#endif /* FREECIV_DELTA_PROTOCOL */
12302 RECEIVE_PACKET_START(packet_chat_msg_req, real_packet);
12303#ifdef FREECIV_JSON_CONNECTION
12304 struct plocation field_addr;
12305 {
12306 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
12307 field_addr = *field_addr_tmp;
12308 FC_FREE(field_addr_tmp);
12309 }
12310#endif /* FREECIV_JSON_CONNECTION */
12311
12312#ifdef FREECIV_DELTA_PROTOCOL
12313#ifdef FREECIV_JSON_CONNECTION
12314 field_addr.name = "fields";
12315#endif /* FREECIV_JSON_CONNECTION */
12316 DIO_BV_GET(&din, &field_addr, fields);
12317
12318#else /* FREECIV_DELTA_PROTOCOL */
12319#ifdef FREECIV_JSON_CONNECTION
12320 field_addr.name = "message";
12321#endif /* FREECIV_JSON_CONNECTION */
12322 if (!DIO_GET(estring, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
12323 RECEIVE_PACKET_FIELD_ERROR(message);
12324 }
12325#endif
12326 log_packet_detailed("packet_chat_msg_req_100: got info about ()");
12327
12328#ifdef FREECIV_DELTA_PROTOCOL
12329 if (nullptr == *hash) {
12330 *hash = genhash_new_full(hash_packet_chat_msg_req_100, cmp_packet_chat_msg_req_100,
12331 nullptr, nullptr, nullptr, destroy_packet_chat_msg_req);
12332 }
12333
12334 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
12335 *real_packet = *old;
12336 } else {
12337 /* packet is already initialized empty */
12338 log_packet_detailed(" no old info");
12339 }
12340
12341 if (BV_ISSET(fields, 0)) {
12342 log_packet_detailed(" got field 'message'");
12343#ifdef FREECIV_JSON_CONNECTION
12344 field_addr.name = "message";
12345#endif /* FREECIV_JSON_CONNECTION */
12346 if (!DIO_GET(estring, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
12347 RECEIVE_PACKET_FIELD_ERROR(message);
12348 }
12349 }
12350
12351 if (nullptr == old) {
12352 old = fc_malloc(sizeof(*old));
12353 init_packet_chat_msg_req(old);
12354 *old = *real_packet;
12355 genhash_insert(*hash, old, old);
12356 } else {
12357 *old = *real_packet;
12358 }
12359
12360#endif /* FREECIV_DELTA_PROTOCOL */
12361 RECEIVE_PACKET_END(real_packet);
12362#undef FREE_PACKET_STRUCT
12363}
12364
12365 static int send_packet_chat_msg_req_100(struct connection *pc, const struct packet_chat_msg_req *packet)
12366{
12367 const struct packet_chat_msg_req *real_packet = packet;
12368 int e;
12369#ifdef FREECIV_DELTA_PROTOCOL
12370 packet_chat_msg_req_100_fields fields;
12371 struct packet_chat_msg_req *old;
12372 bool differ;
12373 struct genhash **hash = pc->phs.sent + PACKET_CHAT_MSG_REQ;
12374#endif /* FREECIV_DELTA_PROTOCOL */
12375 SEND_PACKET_START(PACKET_CHAT_MSG_REQ);
12376#ifdef FREECIV_JSON_CONNECTION
12377 struct plocation field_addr;
12378 {
12379 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
12380 field_addr = *field_addr_tmp;
12381 FC_FREE(field_addr_tmp);
12382 }
12383#endif /* FREECIV_JSON_CONNECTION */
12384
12385 log_packet_detailed("packet_chat_msg_req_100: sending info about ()");
12386
12387#ifdef FREECIV_DELTA_PROTOCOL
12388 if (nullptr == *hash) {
12389 *hash = genhash_new_full(hash_packet_chat_msg_req_100, cmp_packet_chat_msg_req_100,
12390 nullptr, nullptr, nullptr, destroy_packet_chat_msg_req);
12391 }
12392 BV_CLR_ALL(fields);
12393
12394 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12395 old = fc_malloc(sizeof(*old));
12396 /* temporary bitcopy just to insert correctly */
12397 *old = *real_packet;
12398 genhash_insert(*hash, old, old);
12399 init_packet_chat_msg_req(old);
12400 }
12401 differ = (strcmp(old->message, real_packet->message) != 0);
12402 if (differ) {
12403 BV_SET(fields, 0);
12404 }
12405
12406
12407#ifdef FREECIV_JSON_CONNECTION
12408 field_addr.name = "fields";
12409#endif /* FREECIV_JSON_CONNECTION */
12410 e = 0;
12411 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12412 if (e) {
12413 log_packet_detailed("fields bitvector error detected");
12414 }
12415
12416 if (BV_ISSET(fields, 0)) {
12417 log_packet_detailed(" field 'message' has changed");
12418#ifdef FREECIV_JSON_CONNECTION
12419 field_addr.name = "message";
12420#endif /* FREECIV_JSON_CONNECTION */
12421 e = 0;
12422 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->message);
12423 if (e) {
12424 log_packet_detailed("'message' field error detected");
12425 }
12426 }
12427
12428 *old = *real_packet;
12429#endif /* FREECIV_DELTA_PROTOCOL */
12430#ifndef FREECIV_DELTA_PROTOCOL
12431#ifdef FREECIV_JSON_CONNECTION
12432 field_addr.name = "message";
12433#endif /* FREECIV_JSON_CONNECTION */
12434 e = 0;
12435 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->message);
12436 if (e) {
12437 log_packet_detailed("'message' field error detected");
12438 }
12439
12440#endif
12441 SEND_PACKET_END(PACKET_CHAT_MSG_REQ);
12442}
12443
12444 int send_packet_chat_msg_req(struct connection *pc, const struct packet_chat_msg_req *packet)
12445{
12446 if (!pc->used) {
12447 log_error("WARNING: trying to send data to the closed connection %s",
12448 conn_description(pc));
12449 return -1;
12450 }
12451 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CHAT_MSG_REQ].packet != nullptr, -1,
12452 "Handler for PACKET_CHAT_MSG_REQ not installed");
12453 return pc->phs.handlers->send[PACKET_CHAT_MSG_REQ].packet(pc, packet);
12454}
12455
12456 int dsend_packet_chat_msg_req(struct connection *pc, const char *message)
12457{
12458 struct packet_chat_msg_req packet, *real_packet = &packet;
12459
12460 sz_strlcpy(real_packet->message, message);
12461
12462 return send_packet_chat_msg_req(pc, real_packet);
12463}
12464
12465 static inline void init_packet_connect_msg(struct packet_connect_msg *packet)
12466{
12467 memset(packet, 0, sizeof(*packet));
12468}
12469
12470#define free_packet_connect_msg(_packet) (void) 0
12471#define destroy_packet_connect_msg free
12472
12473#ifdef FREECIV_DELTA_PROTOCOL
12474#define hash_packet_connect_msg_100 hash_const
12475
12476#define cmp_packet_connect_msg_100 cmp_const
12477
12478 BV_DEFINE(packet_connect_msg_100_fields, 1);
12479#endif /* FREECIV_DELTA_PROTOCOL */
12480
12481 static struct packet_connect_msg *receive_packet_connect_msg_100(struct connection *pc)
12482{
12483#define FREE_PACKET_STRUCT(_packet) free_packet_connect_msg(_packet)
12484#ifdef FREECIV_DELTA_PROTOCOL
12485 packet_connect_msg_100_fields fields;
12486 struct packet_connect_msg *old;
12487 struct genhash **hash = pc->phs.received + PACKET_CONNECT_MSG;
12488#endif /* FREECIV_DELTA_PROTOCOL */
12489 RECEIVE_PACKET_START(packet_connect_msg, real_packet);
12490#ifdef FREECIV_JSON_CONNECTION
12491 struct plocation field_addr;
12492 {
12493 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
12494 field_addr = *field_addr_tmp;
12495 FC_FREE(field_addr_tmp);
12496 }
12497#endif /* FREECIV_JSON_CONNECTION */
12498
12499#ifdef FREECIV_DELTA_PROTOCOL
12500#ifdef FREECIV_JSON_CONNECTION
12501 field_addr.name = "fields";
12502#endif /* FREECIV_JSON_CONNECTION */
12503 DIO_BV_GET(&din, &field_addr, fields);
12504
12505#else /* FREECIV_DELTA_PROTOCOL */
12506#ifdef FREECIV_JSON_CONNECTION
12507 field_addr.name = "message";
12508#endif /* FREECIV_JSON_CONNECTION */
12509 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
12510 RECEIVE_PACKET_FIELD_ERROR(message);
12511 }
12512#endif
12513 log_packet_detailed("packet_connect_msg_100: got info about ()");
12514
12515#ifdef FREECIV_DELTA_PROTOCOL
12516 if (nullptr == *hash) {
12517 *hash = genhash_new_full(hash_packet_connect_msg_100, cmp_packet_connect_msg_100,
12518 nullptr, nullptr, nullptr, destroy_packet_connect_msg);
12519 }
12520
12521 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
12522 *real_packet = *old;
12523 } else {
12524 /* packet is already initialized empty */
12525 log_packet_detailed(" no old info");
12526 }
12527
12528 if (BV_ISSET(fields, 0)) {
12529 log_packet_detailed(" got field 'message'");
12530#ifdef FREECIV_JSON_CONNECTION
12531 field_addr.name = "message";
12532#endif /* FREECIV_JSON_CONNECTION */
12533 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
12534 RECEIVE_PACKET_FIELD_ERROR(message);
12535 }
12536 }
12537
12538 if (nullptr == old) {
12539 old = fc_malloc(sizeof(*old));
12540 init_packet_connect_msg(old);
12541 *old = *real_packet;
12542 genhash_insert(*hash, old, old);
12543 } else {
12544 *old = *real_packet;
12545 }
12546
12547#endif /* FREECIV_DELTA_PROTOCOL */
12548 RECEIVE_PACKET_END(real_packet);
12549#undef FREE_PACKET_STRUCT
12550}
12551
12552 static int send_packet_connect_msg_100(struct connection *pc, const struct packet_connect_msg *packet)
12553{
12554 const struct packet_connect_msg *real_packet = packet;
12555 int e;
12556#ifdef FREECIV_DELTA_PROTOCOL
12557 packet_connect_msg_100_fields fields;
12558 struct packet_connect_msg *old;
12559 bool differ;
12560 struct genhash **hash = pc->phs.sent + PACKET_CONNECT_MSG;
12561#endif /* FREECIV_DELTA_PROTOCOL */
12562 SEND_PACKET_START(PACKET_CONNECT_MSG);
12563#ifdef FREECIV_JSON_CONNECTION
12564 struct plocation field_addr;
12565 {
12566 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
12567 field_addr = *field_addr_tmp;
12568 FC_FREE(field_addr_tmp);
12569 }
12570#endif /* FREECIV_JSON_CONNECTION */
12571
12572 log_packet_detailed("packet_connect_msg_100: sending info about ()");
12573
12574#ifdef FREECIV_DELTA_PROTOCOL
12575 if (nullptr == *hash) {
12576 *hash = genhash_new_full(hash_packet_connect_msg_100, cmp_packet_connect_msg_100,
12577 nullptr, nullptr, nullptr, destroy_packet_connect_msg);
12578 }
12579 BV_CLR_ALL(fields);
12580
12581 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12582 old = fc_malloc(sizeof(*old));
12583 /* temporary bitcopy just to insert correctly */
12584 *old = *real_packet;
12585 genhash_insert(*hash, old, old);
12586 init_packet_connect_msg(old);
12587 }
12588 differ = (strcmp(old->message, real_packet->message) != 0);
12589 if (differ) {
12590 BV_SET(fields, 0);
12591 }
12592
12593
12594#ifdef FREECIV_JSON_CONNECTION
12595 field_addr.name = "fields";
12596#endif /* FREECIV_JSON_CONNECTION */
12597 e = 0;
12598 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12599 if (e) {
12600 log_packet_detailed("fields bitvector error detected");
12601 }
12602
12603 if (BV_ISSET(fields, 0)) {
12604 log_packet_detailed(" field 'message' has changed");
12605#ifdef FREECIV_JSON_CONNECTION
12606 field_addr.name = "message";
12607#endif /* FREECIV_JSON_CONNECTION */
12608 e = 0;
12609 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
12610 if (e) {
12611 log_packet_detailed("'message' field error detected");
12612 }
12613 }
12614
12615 *old = *real_packet;
12616#endif /* FREECIV_DELTA_PROTOCOL */
12617#ifndef FREECIV_DELTA_PROTOCOL
12618#ifdef FREECIV_JSON_CONNECTION
12619 field_addr.name = "message";
12620#endif /* FREECIV_JSON_CONNECTION */
12621 e = 0;
12622 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
12623 if (e) {
12624 log_packet_detailed("'message' field error detected");
12625 }
12626
12627#endif
12628 SEND_PACKET_END(PACKET_CONNECT_MSG);
12629}
12630
12631 int send_packet_connect_msg(struct connection *pc, const struct packet_connect_msg *packet)
12632{
12633 if (!pc->used) {
12634 log_error("WARNING: trying to send data to the closed connection %s",
12635 conn_description(pc));
12636 return -1;
12637 }
12638 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONNECT_MSG].packet != nullptr, -1,
12639 "Handler for PACKET_CONNECT_MSG not installed");
12640 return pc->phs.handlers->send[PACKET_CONNECT_MSG].packet(pc, packet);
12641}
12642
12643 int dsend_packet_connect_msg(struct connection *pc, const char *message)
12644{
12645 struct packet_connect_msg packet, *real_packet = &packet;
12646
12647 sz_strlcpy(real_packet->message, message);
12648
12649 return send_packet_connect_msg(pc, real_packet);
12650}
12651
12652 static inline void init_packet_server_info(struct packet_server_info *packet)
12653{
12654 memset(packet, 0, sizeof(*packet));
12655}
12656
12657#define free_packet_server_info(_packet) (void) 0
12658#define destroy_packet_server_info free
12659
12660#ifdef FREECIV_DELTA_PROTOCOL
12661#define hash_packet_server_info_100 hash_const
12662
12663#define cmp_packet_server_info_100 cmp_const
12664
12665 BV_DEFINE(packet_server_info_100_fields, 5);
12666#endif /* FREECIV_DELTA_PROTOCOL */
12667
12668 static struct packet_server_info *receive_packet_server_info_100(struct connection *pc)
12669{
12670#define FREE_PACKET_STRUCT(_packet) free_packet_server_info(_packet)
12671#ifdef FREECIV_DELTA_PROTOCOL
12672 packet_server_info_100_fields fields;
12673 struct packet_server_info *old;
12674 struct genhash **hash = pc->phs.received + PACKET_SERVER_INFO;
12675#endif /* FREECIV_DELTA_PROTOCOL */
12676 RECEIVE_PACKET_START(packet_server_info, real_packet);
12677#ifdef FREECIV_JSON_CONNECTION
12678 struct plocation field_addr;
12679 {
12680 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
12681 field_addr = *field_addr_tmp;
12682 FC_FREE(field_addr_tmp);
12683 }
12684#endif /* FREECIV_JSON_CONNECTION */
12685
12686#ifdef FREECIV_DELTA_PROTOCOL
12687#ifdef FREECIV_JSON_CONNECTION
12688 field_addr.name = "fields";
12689#endif /* FREECIV_JSON_CONNECTION */
12690 DIO_BV_GET(&din, &field_addr, fields);
12691
12692#else /* FREECIV_DELTA_PROTOCOL */
12693#ifdef FREECIV_JSON_CONNECTION
12694 field_addr.name = "version_label";
12695#endif /* FREECIV_JSON_CONNECTION */
12696 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
12697 RECEIVE_PACKET_FIELD_ERROR(version_label);
12698 }
12699#ifdef FREECIV_JSON_CONNECTION
12700 field_addr.name = "major_version";
12701#endif /* FREECIV_JSON_CONNECTION */
12702 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
12703 RECEIVE_PACKET_FIELD_ERROR(major_version);
12704 }
12705#ifdef FREECIV_JSON_CONNECTION
12706 field_addr.name = "minor_version";
12707#endif /* FREECIV_JSON_CONNECTION */
12708 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
12709 RECEIVE_PACKET_FIELD_ERROR(minor_version);
12710 }
12711#ifdef FREECIV_JSON_CONNECTION
12712 field_addr.name = "patch_version";
12713#endif /* FREECIV_JSON_CONNECTION */
12714 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
12715 RECEIVE_PACKET_FIELD_ERROR(patch_version);
12716 }
12717#ifdef FREECIV_JSON_CONNECTION
12718 field_addr.name = "emerg_version";
12719#endif /* FREECIV_JSON_CONNECTION */
12720 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
12721 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
12722 }
12723#endif
12724 log_packet_detailed("packet_server_info_100: got info about ()");
12725
12726#ifdef FREECIV_DELTA_PROTOCOL
12727 if (nullptr == *hash) {
12728 *hash = genhash_new_full(hash_packet_server_info_100, cmp_packet_server_info_100,
12729 nullptr, nullptr, nullptr, destroy_packet_server_info);
12730 }
12731
12732 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
12733 *real_packet = *old;
12734 } else {
12735 /* packet is already initialized empty */
12736 log_packet_detailed(" no old info");
12737 }
12738
12739 if (BV_ISSET(fields, 0)) {
12740 log_packet_detailed(" got field 'version_label'");
12741#ifdef FREECIV_JSON_CONNECTION
12742 field_addr.name = "version_label";
12743#endif /* FREECIV_JSON_CONNECTION */
12744 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
12745 RECEIVE_PACKET_FIELD_ERROR(version_label);
12746 }
12747 }
12748 if (BV_ISSET(fields, 1)) {
12749 log_packet_detailed(" got field 'major_version'");
12750#ifdef FREECIV_JSON_CONNECTION
12751 field_addr.name = "major_version";
12752#endif /* FREECIV_JSON_CONNECTION */
12753 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
12754 RECEIVE_PACKET_FIELD_ERROR(major_version);
12755 }
12756 }
12757 if (BV_ISSET(fields, 2)) {
12758 log_packet_detailed(" got field 'minor_version'");
12759#ifdef FREECIV_JSON_CONNECTION
12760 field_addr.name = "minor_version";
12761#endif /* FREECIV_JSON_CONNECTION */
12762 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
12763 RECEIVE_PACKET_FIELD_ERROR(minor_version);
12764 }
12765 }
12766 if (BV_ISSET(fields, 3)) {
12767 log_packet_detailed(" got field 'patch_version'");
12768#ifdef FREECIV_JSON_CONNECTION
12769 field_addr.name = "patch_version";
12770#endif /* FREECIV_JSON_CONNECTION */
12771 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
12772 RECEIVE_PACKET_FIELD_ERROR(patch_version);
12773 }
12774 }
12775 if (BV_ISSET(fields, 4)) {
12776 log_packet_detailed(" got field 'emerg_version'");
12777#ifdef FREECIV_JSON_CONNECTION
12778 field_addr.name = "emerg_version";
12779#endif /* FREECIV_JSON_CONNECTION */
12780 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
12781 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
12782 }
12783 }
12784
12785 if (nullptr == old) {
12786 old = fc_malloc(sizeof(*old));
12787 init_packet_server_info(old);
12788 *old = *real_packet;
12789 genhash_insert(*hash, old, old);
12790 } else {
12791 *old = *real_packet;
12792 }
12793
12794#endif /* FREECIV_DELTA_PROTOCOL */
12795 RECEIVE_PACKET_END(real_packet);
12796#undef FREE_PACKET_STRUCT
12797}
12798
12799 static int send_packet_server_info_100(struct connection *pc, const struct packet_server_info *packet)
12800{
12801 const struct packet_server_info *real_packet = packet;
12802 int e;
12803#ifdef FREECIV_DELTA_PROTOCOL
12804 packet_server_info_100_fields fields;
12805 struct packet_server_info *old;
12806 bool differ;
12807 struct genhash **hash = pc->phs.sent + PACKET_SERVER_INFO;
12808#endif /* FREECIV_DELTA_PROTOCOL */
12809 SEND_PACKET_START(PACKET_SERVER_INFO);
12810#ifdef FREECIV_JSON_CONNECTION
12811 struct plocation field_addr;
12812 {
12813 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
12814 field_addr = *field_addr_tmp;
12815 FC_FREE(field_addr_tmp);
12816 }
12817#endif /* FREECIV_JSON_CONNECTION */
12818
12819 log_packet_detailed("packet_server_info_100: sending info about ()");
12820
12821#ifdef FREECIV_DELTA_PROTOCOL
12822 if (nullptr == *hash) {
12823 *hash = genhash_new_full(hash_packet_server_info_100, cmp_packet_server_info_100,
12824 nullptr, nullptr, nullptr, destroy_packet_server_info);
12825 }
12826 BV_CLR_ALL(fields);
12827
12828 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12829 old = fc_malloc(sizeof(*old));
12830 /* temporary bitcopy just to insert correctly */
12831 *old = *real_packet;
12832 genhash_insert(*hash, old, old);
12833 init_packet_server_info(old);
12834 }
12835 differ = (strcmp(old->version_label, real_packet->version_label) != 0);
12836 if (differ) {
12837 BV_SET(fields, 0);
12838 }
12839
12840 differ = (old->major_version != real_packet->major_version);
12841 if (differ) {
12842 BV_SET(fields, 1);
12843 }
12844
12845 differ = (old->minor_version != real_packet->minor_version);
12846 if (differ) {
12847 BV_SET(fields, 2);
12848 }
12849
12850 differ = (old->patch_version != real_packet->patch_version);
12851 if (differ) {
12852 BV_SET(fields, 3);
12853 }
12854
12855 differ = (old->emerg_version != real_packet->emerg_version);
12856 if (differ) {
12857 BV_SET(fields, 4);
12858 }
12859
12860
12861#ifdef FREECIV_JSON_CONNECTION
12862 field_addr.name = "fields";
12863#endif /* FREECIV_JSON_CONNECTION */
12864 e = 0;
12865 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12866 if (e) {
12867 log_packet_detailed("fields bitvector error detected");
12868 }
12869
12870 if (BV_ISSET(fields, 0)) {
12871 log_packet_detailed(" field 'version_label' has changed");
12872#ifdef FREECIV_JSON_CONNECTION
12873 field_addr.name = "version_label";
12874#endif /* FREECIV_JSON_CONNECTION */
12875 e = 0;
12876 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
12877 if (e) {
12878 log_packet_detailed("'version_label' field error detected");
12879 }
12880 }
12881 if (BV_ISSET(fields, 1)) {
12882 log_packet_detailed(" field 'major_version' has changed");
12883#ifdef FREECIV_JSON_CONNECTION
12884 field_addr.name = "major_version";
12885#endif /* FREECIV_JSON_CONNECTION */
12886 e = 0;
12887 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
12888 if (e) {
12889 log_packet_detailed("'major_version' field error detected");
12890 }
12891 }
12892 if (BV_ISSET(fields, 2)) {
12893 log_packet_detailed(" field 'minor_version' has changed");
12894#ifdef FREECIV_JSON_CONNECTION
12895 field_addr.name = "minor_version";
12896#endif /* FREECIV_JSON_CONNECTION */
12897 e = 0;
12898 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
12899 if (e) {
12900 log_packet_detailed("'minor_version' field error detected");
12901 }
12902 }
12903 if (BV_ISSET(fields, 3)) {
12904 log_packet_detailed(" field 'patch_version' has changed");
12905#ifdef FREECIV_JSON_CONNECTION
12906 field_addr.name = "patch_version";
12907#endif /* FREECIV_JSON_CONNECTION */
12908 e = 0;
12909 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
12910 if (e) {
12911 log_packet_detailed("'patch_version' field error detected");
12912 }
12913 }
12914 if (BV_ISSET(fields, 4)) {
12915 log_packet_detailed(" field 'emerg_version' has changed");
12916#ifdef FREECIV_JSON_CONNECTION
12917 field_addr.name = "emerg_version";
12918#endif /* FREECIV_JSON_CONNECTION */
12919 e = 0;
12920 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
12921 if (e) {
12922 log_packet_detailed("'emerg_version' field error detected");
12923 }
12924 }
12925
12926 *old = *real_packet;
12927#endif /* FREECIV_DELTA_PROTOCOL */
12928#ifndef FREECIV_DELTA_PROTOCOL
12929#ifdef FREECIV_JSON_CONNECTION
12930 field_addr.name = "version_label";
12931#endif /* FREECIV_JSON_CONNECTION */
12932 e = 0;
12933 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
12934 if (e) {
12935 log_packet_detailed("'version_label' field error detected");
12936 }
12937#ifdef FREECIV_JSON_CONNECTION
12938 field_addr.name = "major_version";
12939#endif /* FREECIV_JSON_CONNECTION */
12940 e = 0;
12941 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
12942 if (e) {
12943 log_packet_detailed("'major_version' field error detected");
12944 }
12945#ifdef FREECIV_JSON_CONNECTION
12946 field_addr.name = "minor_version";
12947#endif /* FREECIV_JSON_CONNECTION */
12948 e = 0;
12949 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
12950 if (e) {
12951 log_packet_detailed("'minor_version' field error detected");
12952 }
12953#ifdef FREECIV_JSON_CONNECTION
12954 field_addr.name = "patch_version";
12955#endif /* FREECIV_JSON_CONNECTION */
12956 e = 0;
12957 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
12958 if (e) {
12959 log_packet_detailed("'patch_version' field error detected");
12960 }
12961#ifdef FREECIV_JSON_CONNECTION
12962 field_addr.name = "emerg_version";
12963#endif /* FREECIV_JSON_CONNECTION */
12964 e = 0;
12965 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
12966 if (e) {
12967 log_packet_detailed("'emerg_version' field error detected");
12968 }
12969
12970#endif
12971 SEND_PACKET_END(PACKET_SERVER_INFO);
12972}
12973
12974 int send_packet_server_info(struct connection *pc, const struct packet_server_info *packet)
12975{
12976 if (!pc->used) {
12977 log_error("WARNING: trying to send data to the closed connection %s",
12978 conn_description(pc));
12979 return -1;
12980 }
12981 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_INFO].packet != nullptr, -1,
12982 "Handler for PACKET_SERVER_INFO not installed");
12983 return pc->phs.handlers->send[PACKET_SERVER_INFO].packet(pc, packet);
12984}
12985
12986 int dsend_packet_server_info(struct connection *pc, const char *version_label, int major_version, int minor_version, int patch_version, int emerg_version)
12987{
12988 struct packet_server_info packet, *real_packet = &packet;
12989
12990 sz_strlcpy(real_packet->version_label, version_label);
12991 real_packet->major_version = major_version;
12992 real_packet->minor_version = minor_version;
12993 real_packet->patch_version = patch_version;
12994 real_packet->emerg_version = emerg_version;
12995
12996 return send_packet_server_info(pc, real_packet);
12997}
12998
12999 static inline void init_packet_city_remove(struct packet_city_remove *packet)
13000{
13001 memset(packet, 0, sizeof(*packet));
13002}
13003
13004#define free_packet_city_remove(_packet) (void) 0
13005#define destroy_packet_city_remove free
13006
13007#ifdef FREECIV_DELTA_PROTOCOL
13008#define hash_packet_city_remove_100 hash_const
13009
13010#define cmp_packet_city_remove_100 cmp_const
13011
13012 BV_DEFINE(packet_city_remove_100_fields, 1);
13013#endif /* FREECIV_DELTA_PROTOCOL */
13014
13015 static struct packet_city_remove *receive_packet_city_remove_100(struct connection *pc)
13016{
13017#define FREE_PACKET_STRUCT(_packet) free_packet_city_remove(_packet)
13018#ifdef FREECIV_DELTA_PROTOCOL
13019 packet_city_remove_100_fields fields;
13020 struct packet_city_remove *old;
13021 struct genhash **hash = pc->phs.received + PACKET_CITY_REMOVE;
13022#endif /* FREECIV_DELTA_PROTOCOL */
13023 RECEIVE_PACKET_START(packet_city_remove, real_packet);
13024#ifdef FREECIV_JSON_CONNECTION
13025 struct plocation field_addr;
13026 {
13027 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
13028 field_addr = *field_addr_tmp;
13029 FC_FREE(field_addr_tmp);
13030 }
13031#endif /* FREECIV_JSON_CONNECTION */
13032
13033#ifdef FREECIV_DELTA_PROTOCOL
13034#ifdef FREECIV_JSON_CONNECTION
13035 field_addr.name = "fields";
13036#endif /* FREECIV_JSON_CONNECTION */
13037 DIO_BV_GET(&din, &field_addr, fields);
13038
13039#else /* FREECIV_DELTA_PROTOCOL */
13040#ifdef FREECIV_JSON_CONNECTION
13041 field_addr.name = "city_id";
13042#endif /* FREECIV_JSON_CONNECTION */
13043 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
13044 RECEIVE_PACKET_FIELD_ERROR(city_id);
13045 }
13046#endif
13047 log_packet_detailed("packet_city_remove_100: got info about ()");
13048
13049#ifdef FREECIV_DELTA_PROTOCOL
13050 if (nullptr == *hash) {
13051 *hash = genhash_new_full(hash_packet_city_remove_100, cmp_packet_city_remove_100,
13052 nullptr, nullptr, nullptr, destroy_packet_city_remove);
13053 }
13054
13055 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
13056 *real_packet = *old;
13057 } else {
13058 /* packet is already initialized empty */
13059 log_packet_detailed(" no old info");
13060 }
13061
13062 if (BV_ISSET(fields, 0)) {
13063 log_packet_detailed(" got field 'city_id'");
13064#ifdef FREECIV_JSON_CONNECTION
13065 field_addr.name = "city_id";
13066#endif /* FREECIV_JSON_CONNECTION */
13067 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
13068 RECEIVE_PACKET_FIELD_ERROR(city_id);
13069 }
13070 }
13071
13072 if (nullptr == old) {
13073 old = fc_malloc(sizeof(*old));
13074 init_packet_city_remove(old);
13075 *old = *real_packet;
13076 genhash_insert(*hash, old, old);
13077 } else {
13078 *old = *real_packet;
13079 }
13080
13081 hash = pc->phs.received + PACKET_CITY_INFO;
13082 if (nullptr != *hash) {
13083 genhash_remove(*hash, real_packet);
13084 }
13085
13086 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
13087 if (nullptr != *hash) {
13088 genhash_remove(*hash, real_packet);
13089 }
13090
13091 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
13092 if (nullptr != *hash) {
13093 genhash_remove(*hash, real_packet);
13094 }
13095
13096 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
13097 if (nullptr != *hash) {
13098 genhash_remove(*hash, real_packet);
13099 }
13100
13101 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
13102 if (nullptr != *hash) {
13103 genhash_remove(*hash, real_packet);
13104 }
13105
13106#endif /* FREECIV_DELTA_PROTOCOL */
13107 RECEIVE_PACKET_END(real_packet);
13108#undef FREE_PACKET_STRUCT
13109}
13110
13111 static int send_packet_city_remove_100(struct connection *pc, const struct packet_city_remove *packet)
13112{
13113 const struct packet_city_remove *real_packet = packet;
13114 int e;
13115#ifdef FREECIV_DELTA_PROTOCOL
13116 packet_city_remove_100_fields fields;
13117 struct packet_city_remove *old;
13118 bool differ;
13119 struct genhash **hash = pc->phs.sent + PACKET_CITY_REMOVE;
13120#endif /* FREECIV_DELTA_PROTOCOL */
13121 SEND_PACKET_START(PACKET_CITY_REMOVE);
13122#ifdef FREECIV_JSON_CONNECTION
13123 struct plocation field_addr;
13124 {
13125 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
13126 field_addr = *field_addr_tmp;
13127 FC_FREE(field_addr_tmp);
13128 }
13129#endif /* FREECIV_JSON_CONNECTION */
13130
13131 log_packet_detailed("packet_city_remove_100: sending info about ()");
13132
13133#ifdef FREECIV_DELTA_PROTOCOL
13134 if (nullptr == *hash) {
13135 *hash = genhash_new_full(hash_packet_city_remove_100, cmp_packet_city_remove_100,
13136 nullptr, nullptr, nullptr, destroy_packet_city_remove);
13137 }
13138 BV_CLR_ALL(fields);
13139
13140 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
13141 old = fc_malloc(sizeof(*old));
13142 /* temporary bitcopy just to insert correctly */
13143 *old = *real_packet;
13144 genhash_insert(*hash, old, old);
13145 init_packet_city_remove(old);
13146 }
13147 differ = (old->city_id != real_packet->city_id);
13148 if (differ) {
13149 BV_SET(fields, 0);
13150 }
13151
13152
13153#ifdef FREECIV_JSON_CONNECTION
13154 field_addr.name = "fields";
13155#endif /* FREECIV_JSON_CONNECTION */
13156 e = 0;
13157 e |= DIO_BV_PUT(&dout, &field_addr, fields);
13158 if (e) {
13159 log_packet_detailed("fields bitvector error detected");
13160 }
13161
13162 if (BV_ISSET(fields, 0)) {
13163 log_packet_detailed(" field 'city_id' has changed");
13164#ifdef FREECIV_JSON_CONNECTION
13165 field_addr.name = "city_id";
13166#endif /* FREECIV_JSON_CONNECTION */
13167 e = 0;
13168 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
13169 if (e) {
13170 log_packet_detailed("'city_id' field error detected");
13171 }
13172 }
13173
13174 *old = *real_packet;
13175
13176 hash = pc->phs.sent + PACKET_CITY_INFO;
13177 if (nullptr != *hash) {
13178 genhash_remove(*hash, real_packet);
13179 }
13180
13181 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
13182 if (nullptr != *hash) {
13183 genhash_remove(*hash, real_packet);
13184 }
13185
13186 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
13187 if (nullptr != *hash) {
13188 genhash_remove(*hash, real_packet);
13189 }
13190
13191 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
13192 if (nullptr != *hash) {
13193 genhash_remove(*hash, real_packet);
13194 }
13195
13196 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
13197 if (nullptr != *hash) {
13198 genhash_remove(*hash, real_packet);
13199 }
13200#endif /* FREECIV_DELTA_PROTOCOL */
13201#ifndef FREECIV_DELTA_PROTOCOL
13202#ifdef FREECIV_JSON_CONNECTION
13203 field_addr.name = "city_id";
13204#endif /* FREECIV_JSON_CONNECTION */
13205 e = 0;
13206 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
13207 if (e) {
13208 log_packet_detailed("'city_id' field error detected");
13209 }
13210
13211#endif
13212 SEND_PACKET_END(PACKET_CITY_REMOVE);
13213}
13214
13215 int send_packet_city_remove(struct connection *pc, const struct packet_city_remove *packet)
13216{
13217 if (!pc->used) {
13218 log_error("WARNING: trying to send data to the closed connection %s",
13219 conn_description(pc));
13220 return -1;
13221 }
13222 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_REMOVE].packet != nullptr, -1,
13223 "Handler for PACKET_CITY_REMOVE not installed");
13224 return pc->phs.handlers->send[PACKET_CITY_REMOVE].packet(pc, packet);
13225}
13226
13227 void lsend_packet_city_remove(struct conn_list *dest, const struct packet_city_remove *packet)
13228{
13229 conn_list_iterate(dest, pconn) {
13230 send_packet_city_remove(pconn, packet);
13231 } conn_list_iterate_end;
13232}
13233
13234 int dsend_packet_city_remove(struct connection *pc, int city_id)
13235{
13236 struct packet_city_remove packet, *real_packet = &packet;
13237
13238 real_packet->city_id = city_id;
13239
13240 return send_packet_city_remove(pc, real_packet);
13241}
13242
13243 void dlsend_packet_city_remove(struct conn_list *dest, int city_id)
13244{
13245 struct packet_city_remove packet, *real_packet = &packet;
13246
13247 real_packet->city_id = city_id;
13248
13249 lsend_packet_city_remove(dest, real_packet);
13250}
13251
13252 static inline void init_packet_city_info(struct packet_city_info *packet)
13253{
13254 memset(packet, 0, sizeof(*packet));
13255}
13256
13257#define free_packet_city_info(_packet) (void) 0
13258#define destroy_packet_city_info free
13259
13260#ifdef FREECIV_DELTA_PROTOCOL
13261static genhash_val_t hash_packet_city_info_100(const void *vkey)
13262{
13263 const struct packet_city_info *key = (const struct packet_city_info *) vkey;
13264 genhash_val_t result = 0;
13265
13266 result += key->id;
13267
13268 result &= 0xFFFFFFFF;
13269 return result;
13270}
13271
13272static bool cmp_packet_city_info_100(const void *vkey1, const void *vkey2)
13273{
13274 const struct packet_city_info *old = (const struct packet_city_info *) vkey1;
13275 const struct packet_city_info *real_packet = (const struct packet_city_info *) vkey2;
13276 bool differ;
13277
13278 differ = (old->id != real_packet->id);
13279
13280 return !differ;
13281}
13282 BV_DEFINE(packet_city_info_100_fields, 50);
13283#endif /* FREECIV_DELTA_PROTOCOL */
13284
13285 static struct packet_city_info *receive_packet_city_info_100(struct connection *pc)
13286{
13287#define FREE_PACKET_STRUCT(_packet) free_packet_city_info(_packet)
13288#ifdef FREECIV_DELTA_PROTOCOL
13289 packet_city_info_100_fields fields;
13290 struct packet_city_info *old;
13291 struct genhash **hash = pc->phs.received + PACKET_CITY_INFO;
13292#endif /* FREECIV_DELTA_PROTOCOL */
13293 RECEIVE_PACKET_START(packet_city_info, real_packet);
13294#ifdef FREECIV_JSON_CONNECTION
13295 struct plocation field_addr;
13296 {
13297 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
13298 field_addr = *field_addr_tmp;
13299 FC_FREE(field_addr_tmp);
13300 }
13301#endif /* FREECIV_JSON_CONNECTION */
13302
13303#ifdef FREECIV_DELTA_PROTOCOL
13304#ifdef FREECIV_JSON_CONNECTION
13305 field_addr.name = "fields";
13306#endif /* FREECIV_JSON_CONNECTION */
13307 DIO_BV_GET(&din, &field_addr, fields);
13308#ifdef FREECIV_JSON_CONNECTION
13309 field_addr.name = "id";
13310#endif /* FREECIV_JSON_CONNECTION */
13311 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
13312 RECEIVE_PACKET_FIELD_ERROR(id);
13313 }
13314
13315#else /* FREECIV_DELTA_PROTOCOL */
13316#ifdef FREECIV_JSON_CONNECTION
13317 field_addr.name = "id";
13318#endif /* FREECIV_JSON_CONNECTION */
13319 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
13320 RECEIVE_PACKET_FIELD_ERROR(id);
13321 }
13322#ifdef FREECIV_JSON_CONNECTION
13323 field_addr.name = "tile";
13324#endif /* FREECIV_JSON_CONNECTION */
13325 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
13326 RECEIVE_PACKET_FIELD_ERROR(tile);
13327 }
13328#ifdef FREECIV_JSON_CONNECTION
13329 field_addr.name = "owner";
13330#endif /* FREECIV_JSON_CONNECTION */
13331 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
13332 RECEIVE_PACKET_FIELD_ERROR(owner);
13333 }
13334#ifdef FREECIV_JSON_CONNECTION
13335 field_addr.name = "original";
13336#endif /* FREECIV_JSON_CONNECTION */
13337 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->original)) {
13338 RECEIVE_PACKET_FIELD_ERROR(original);
13339 }
13340#ifdef FREECIV_JSON_CONNECTION
13341 field_addr.name = "size";
13342#endif /* FREECIV_JSON_CONNECTION */
13343 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
13344 RECEIVE_PACKET_FIELD_ERROR(size);
13345 }
13346#ifdef FREECIV_JSON_CONNECTION
13347 field_addr.name = "city_radius_sq";
13348#endif /* FREECIV_JSON_CONNECTION */
13349 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
13350 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
13351 }
13352#ifdef FREECIV_JSON_CONNECTION
13353 field_addr.name = "style";
13354#endif /* FREECIV_JSON_CONNECTION */
13355 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
13356 RECEIVE_PACKET_FIELD_ERROR(style);
13357 }
13358#ifdef FREECIV_JSON_CONNECTION
13359 field_addr.name = "capital";
13360#endif /* FREECIV_JSON_CONNECTION */
13361 {
13362 int readin;
13363
13364 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
13365 RECEIVE_PACKET_FIELD_ERROR(capital);
13366 }
13367 real_packet->capital = readin;
13368 }
13369#ifdef FREECIV_JSON_CONNECTION
13370 field_addr.name = "ppl_happy";
13371#endif /* FREECIV_JSON_CONNECTION */
13372 {
13373 int i;
13374
13375#ifdef FREECIV_JSON_CONNECTION
13376 /* Enter array. */
13377 field_addr.sub_location = plocation_elem_new(0);
13378#endif /* FREECIV_JSON_CONNECTION */
13379
13380 for (i = 0; i < FEELING_LAST; i++) {
13381#ifdef FREECIV_JSON_CONNECTION
13382 field_addr.sub_location->number = i;
13383#endif /* FREECIV_JSON_CONNECTION */
13384 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
13385 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
13386 }
13387 }
13388
13389#ifdef FREECIV_JSON_CONNECTION
13390 /* Exit array. */
13391 FC_FREE(field_addr.sub_location);
13392#endif /* FREECIV_JSON_CONNECTION */
13393 }
13394#ifdef FREECIV_JSON_CONNECTION
13395 field_addr.name = "ppl_content";
13396#endif /* FREECIV_JSON_CONNECTION */
13397 {
13398 int i;
13399
13400#ifdef FREECIV_JSON_CONNECTION
13401 /* Enter array. */
13402 field_addr.sub_location = plocation_elem_new(0);
13403#endif /* FREECIV_JSON_CONNECTION */
13404
13405 for (i = 0; i < FEELING_LAST; i++) {
13406#ifdef FREECIV_JSON_CONNECTION
13407 field_addr.sub_location->number = i;
13408#endif /* FREECIV_JSON_CONNECTION */
13409 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
13410 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
13411 }
13412 }
13413
13414#ifdef FREECIV_JSON_CONNECTION
13415 /* Exit array. */
13416 FC_FREE(field_addr.sub_location);
13417#endif /* FREECIV_JSON_CONNECTION */
13418 }
13419#ifdef FREECIV_JSON_CONNECTION
13420 field_addr.name = "ppl_unhappy";
13421#endif /* FREECIV_JSON_CONNECTION */
13422 {
13423 int i;
13424
13425#ifdef FREECIV_JSON_CONNECTION
13426 /* Enter array. */
13427 field_addr.sub_location = plocation_elem_new(0);
13428#endif /* FREECIV_JSON_CONNECTION */
13429
13430 for (i = 0; i < FEELING_LAST; i++) {
13431#ifdef FREECIV_JSON_CONNECTION
13432 field_addr.sub_location->number = i;
13433#endif /* FREECIV_JSON_CONNECTION */
13434 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
13435 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
13436 }
13437 }
13438
13439#ifdef FREECIV_JSON_CONNECTION
13440 /* Exit array. */
13441 FC_FREE(field_addr.sub_location);
13442#endif /* FREECIV_JSON_CONNECTION */
13443 }
13444#ifdef FREECIV_JSON_CONNECTION
13445 field_addr.name = "ppl_angry";
13446#endif /* FREECIV_JSON_CONNECTION */
13447 {
13448 int i;
13449
13450#ifdef FREECIV_JSON_CONNECTION
13451 /* Enter array. */
13452 field_addr.sub_location = plocation_elem_new(0);
13453#endif /* FREECIV_JSON_CONNECTION */
13454
13455 for (i = 0; i < FEELING_LAST; i++) {
13456#ifdef FREECIV_JSON_CONNECTION
13457 field_addr.sub_location->number = i;
13458#endif /* FREECIV_JSON_CONNECTION */
13459 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
13460 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
13461 }
13462 }
13463
13464#ifdef FREECIV_JSON_CONNECTION
13465 /* Exit array. */
13466 FC_FREE(field_addr.sub_location);
13467#endif /* FREECIV_JSON_CONNECTION */
13468 }
13469#ifdef FREECIV_JSON_CONNECTION
13470 field_addr.name = "specialists_size";
13471#endif /* FREECIV_JSON_CONNECTION */
13472 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
13473 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
13474 }
13475#ifdef FREECIV_JSON_CONNECTION
13476 field_addr.name = "specialists";
13477#endif /* FREECIV_JSON_CONNECTION */
13478 {
13479 int i;
13480
13481#ifdef FREECIV_JSON_CONNECTION
13482 /* Enter array. */
13483 field_addr.sub_location = plocation_elem_new(0);
13484#endif /* FREECIV_JSON_CONNECTION */
13485
13486 if (real_packet->specialists_size > SP_MAX) {
13487 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
13488 }
13489 for (i = 0; i < real_packet->specialists_size; i++) {
13490#ifdef FREECIV_JSON_CONNECTION
13491 field_addr.sub_location->number = i;
13492#endif /* FREECIV_JSON_CONNECTION */
13493 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
13494 RECEIVE_PACKET_FIELD_ERROR(specialists);
13495 }
13496 }
13497
13498#ifdef FREECIV_JSON_CONNECTION
13499 /* Exit array. */
13500 FC_FREE(field_addr.sub_location);
13501#endif /* FREECIV_JSON_CONNECTION */
13502 }
13503#ifdef FREECIV_JSON_CONNECTION
13504 field_addr.name = "history";
13505#endif /* FREECIV_JSON_CONNECTION */
13506 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
13507 RECEIVE_PACKET_FIELD_ERROR(history);
13508 }
13509#ifdef FREECIV_JSON_CONNECTION
13510 field_addr.name = "culture";
13511#endif /* FREECIV_JSON_CONNECTION */
13512 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
13513 RECEIVE_PACKET_FIELD_ERROR(culture);
13514 }
13515#ifdef FREECIV_JSON_CONNECTION
13516 field_addr.name = "buy_cost";
13517#endif /* FREECIV_JSON_CONNECTION */
13518 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
13519 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
13520 }
13521#ifdef FREECIV_JSON_CONNECTION
13522 field_addr.name = "surplus";
13523#endif /* FREECIV_JSON_CONNECTION */
13524 {
13525 int i;
13526
13527#ifdef FREECIV_JSON_CONNECTION
13528 /* Enter array. */
13529 field_addr.sub_location = plocation_elem_new(0);
13530#endif /* FREECIV_JSON_CONNECTION */
13531
13532 for (i = 0; i < O_LAST; i++) {
13533#ifdef FREECIV_JSON_CONNECTION
13534 field_addr.sub_location->number = i;
13535#endif /* FREECIV_JSON_CONNECTION */
13536 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
13537 RECEIVE_PACKET_FIELD_ERROR(surplus);
13538 }
13539 }
13540
13541#ifdef FREECIV_JSON_CONNECTION
13542 /* Exit array. */
13543 FC_FREE(field_addr.sub_location);
13544#endif /* FREECIV_JSON_CONNECTION */
13545 }
13546#ifdef FREECIV_JSON_CONNECTION
13547 field_addr.name = "waste";
13548#endif /* FREECIV_JSON_CONNECTION */
13549 {
13550 int i;
13551
13552#ifdef FREECIV_JSON_CONNECTION
13553 /* Enter array. */
13554 field_addr.sub_location = plocation_elem_new(0);
13555#endif /* FREECIV_JSON_CONNECTION */
13556
13557 for (i = 0; i < O_LAST; i++) {
13558#ifdef FREECIV_JSON_CONNECTION
13559 field_addr.sub_location->number = i;
13560#endif /* FREECIV_JSON_CONNECTION */
13561 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
13562 RECEIVE_PACKET_FIELD_ERROR(waste);
13563 }
13564 }
13565
13566#ifdef FREECIV_JSON_CONNECTION
13567 /* Exit array. */
13568 FC_FREE(field_addr.sub_location);
13569#endif /* FREECIV_JSON_CONNECTION */
13570 }
13571#ifdef FREECIV_JSON_CONNECTION
13572 field_addr.name = "unhappy_penalty";
13573#endif /* FREECIV_JSON_CONNECTION */
13574 {
13575 int i;
13576
13577#ifdef FREECIV_JSON_CONNECTION
13578 /* Enter array. */
13579 field_addr.sub_location = plocation_elem_new(0);
13580#endif /* FREECIV_JSON_CONNECTION */
13581
13582 for (i = 0; i < O_LAST; i++) {
13583#ifdef FREECIV_JSON_CONNECTION
13584 field_addr.sub_location->number = i;
13585#endif /* FREECIV_JSON_CONNECTION */
13586 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
13587 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
13588 }
13589 }
13590
13591#ifdef FREECIV_JSON_CONNECTION
13592 /* Exit array. */
13593 FC_FREE(field_addr.sub_location);
13594#endif /* FREECIV_JSON_CONNECTION */
13595 }
13596#ifdef FREECIV_JSON_CONNECTION
13597 field_addr.name = "prod";
13598#endif /* FREECIV_JSON_CONNECTION */
13599 {
13600 int i;
13601
13602#ifdef FREECIV_JSON_CONNECTION
13603 /* Enter array. */
13604 field_addr.sub_location = plocation_elem_new(0);
13605#endif /* FREECIV_JSON_CONNECTION */
13606
13607 for (i = 0; i < O_LAST; i++) {
13608#ifdef FREECIV_JSON_CONNECTION
13609 field_addr.sub_location->number = i;
13610#endif /* FREECIV_JSON_CONNECTION */
13611 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
13612 RECEIVE_PACKET_FIELD_ERROR(prod);
13613 }
13614 }
13615
13616#ifdef FREECIV_JSON_CONNECTION
13617 /* Exit array. */
13618 FC_FREE(field_addr.sub_location);
13619#endif /* FREECIV_JSON_CONNECTION */
13620 }
13621#ifdef FREECIV_JSON_CONNECTION
13622 field_addr.name = "citizen_base";
13623#endif /* FREECIV_JSON_CONNECTION */
13624 {
13625 int i;
13626
13627#ifdef FREECIV_JSON_CONNECTION
13628 /* Enter array. */
13629 field_addr.sub_location = plocation_elem_new(0);
13630#endif /* FREECIV_JSON_CONNECTION */
13631
13632 for (i = 0; i < O_LAST; i++) {
13633#ifdef FREECIV_JSON_CONNECTION
13634 field_addr.sub_location->number = i;
13635#endif /* FREECIV_JSON_CONNECTION */
13636 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
13637 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
13638 }
13639 }
13640
13641#ifdef FREECIV_JSON_CONNECTION
13642 /* Exit array. */
13643 FC_FREE(field_addr.sub_location);
13644#endif /* FREECIV_JSON_CONNECTION */
13645 }
13646#ifdef FREECIV_JSON_CONNECTION
13647 field_addr.name = "usage";
13648#endif /* FREECIV_JSON_CONNECTION */
13649 {
13650 int i;
13651
13652#ifdef FREECIV_JSON_CONNECTION
13653 /* Enter array. */
13654 field_addr.sub_location = plocation_elem_new(0);
13655#endif /* FREECIV_JSON_CONNECTION */
13656
13657 for (i = 0; i < O_LAST; i++) {
13658#ifdef FREECIV_JSON_CONNECTION
13659 field_addr.sub_location->number = i;
13660#endif /* FREECIV_JSON_CONNECTION */
13661 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
13662 RECEIVE_PACKET_FIELD_ERROR(usage);
13663 }
13664 }
13665
13666#ifdef FREECIV_JSON_CONNECTION
13667 /* Exit array. */
13668 FC_FREE(field_addr.sub_location);
13669#endif /* FREECIV_JSON_CONNECTION */
13670 }
13671#ifdef FREECIV_JSON_CONNECTION
13672 field_addr.name = "food_stock";
13673#endif /* FREECIV_JSON_CONNECTION */
13674 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
13675 RECEIVE_PACKET_FIELD_ERROR(food_stock);
13676 }
13677#ifdef FREECIV_JSON_CONNECTION
13678 field_addr.name = "shield_stock";
13679#endif /* FREECIV_JSON_CONNECTION */
13680 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
13681 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
13682 }
13683#ifdef FREECIV_JSON_CONNECTION
13684 field_addr.name = "trade_route_count";
13685#endif /* FREECIV_JSON_CONNECTION */
13686 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
13687 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
13688 }
13689#ifdef FREECIV_JSON_CONNECTION
13690 field_addr.name = "pollution";
13691#endif /* FREECIV_JSON_CONNECTION */
13692 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
13693 RECEIVE_PACKET_FIELD_ERROR(pollution);
13694 }
13695#ifdef FREECIV_JSON_CONNECTION
13696 field_addr.name = "illness_trade";
13697#endif /* FREECIV_JSON_CONNECTION */
13698 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
13699 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
13700 }
13701#ifdef FREECIV_JSON_CONNECTION
13702 field_addr.name = "production_kind";
13703#endif /* FREECIV_JSON_CONNECTION */
13704 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
13705 RECEIVE_PACKET_FIELD_ERROR(production_kind);
13706 }
13707#ifdef FREECIV_JSON_CONNECTION
13708 field_addr.name = "production_value";
13709#endif /* FREECIV_JSON_CONNECTION */
13710 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
13711 RECEIVE_PACKET_FIELD_ERROR(production_value);
13712 }
13713#ifdef FREECIV_JSON_CONNECTION
13714 field_addr.name = "turn_founded";
13715#endif /* FREECIV_JSON_CONNECTION */
13716 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
13717 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
13718 }
13719#ifdef FREECIV_JSON_CONNECTION
13720 field_addr.name = "turn_last_built";
13721#endif /* FREECIV_JSON_CONNECTION */
13722 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
13723 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
13724 }
13725#ifdef FREECIV_JSON_CONNECTION
13726 field_addr.name = "changed_from_kind";
13727#endif /* FREECIV_JSON_CONNECTION */
13728 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
13729 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
13730 }
13731#ifdef FREECIV_JSON_CONNECTION
13732 field_addr.name = "changed_from_value";
13733#endif /* FREECIV_JSON_CONNECTION */
13734 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
13735 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
13736 }
13737#ifdef FREECIV_JSON_CONNECTION
13738 field_addr.name = "before_change_shields";
13739#endif /* FREECIV_JSON_CONNECTION */
13740 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
13741 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
13742 }
13743#ifdef FREECIV_JSON_CONNECTION
13744 field_addr.name = "disbanded_shields";
13745#endif /* FREECIV_JSON_CONNECTION */
13746 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
13747 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
13748 }
13749#ifdef FREECIV_JSON_CONNECTION
13750 field_addr.name = "caravan_shields";
13751#endif /* FREECIV_JSON_CONNECTION */
13752 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
13753 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
13754 }
13755#ifdef FREECIV_JSON_CONNECTION
13756 field_addr.name = "last_turns_shield_surplus";
13757#endif /* FREECIV_JSON_CONNECTION */
13758 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
13759 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
13760 }
13761#ifdef FREECIV_JSON_CONNECTION
13762 field_addr.name = "airlift";
13763#endif /* FREECIV_JSON_CONNECTION */
13764 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
13765 RECEIVE_PACKET_FIELD_ERROR(airlift);
13766 }
13767#ifdef FREECIV_JSON_CONNECTION
13768 field_addr.name = "did_buy";
13769#endif /* FREECIV_JSON_CONNECTION */
13770 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
13771 RECEIVE_PACKET_FIELD_ERROR(did_buy);
13772 }
13773#ifdef FREECIV_JSON_CONNECTION
13774 field_addr.name = "did_sell";
13775#endif /* FREECIV_JSON_CONNECTION */
13776 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
13777 RECEIVE_PACKET_FIELD_ERROR(did_sell);
13778 }
13779#ifdef FREECIV_JSON_CONNECTION
13780 field_addr.name = "was_happy";
13781#endif /* FREECIV_JSON_CONNECTION */
13782 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
13783 RECEIVE_PACKET_FIELD_ERROR(was_happy);
13784 }
13785#ifdef FREECIV_JSON_CONNECTION
13786 field_addr.name = "had_famine";
13787#endif /* FREECIV_JSON_CONNECTION */
13788 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->had_famine)) {
13789 RECEIVE_PACKET_FIELD_ERROR(had_famine);
13790 }
13791#ifdef FREECIV_JSON_CONNECTION
13792 field_addr.name = "diplomat_investigate";
13793#endif /* FREECIV_JSON_CONNECTION */
13794 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->diplomat_investigate)) {
13795 RECEIVE_PACKET_FIELD_ERROR(diplomat_investigate);
13796 }
13797#ifdef FREECIV_JSON_CONNECTION
13798 field_addr.name = "walls";
13799#endif /* FREECIV_JSON_CONNECTION */
13800 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
13801 RECEIVE_PACKET_FIELD_ERROR(walls);
13802 }
13803#ifdef FREECIV_JSON_CONNECTION
13804 field_addr.name = "city_image";
13805#endif /* FREECIV_JSON_CONNECTION */
13806 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
13807 RECEIVE_PACKET_FIELD_ERROR(city_image);
13808 }
13809#ifdef FREECIV_JSON_CONNECTION
13810 field_addr.name = "steal";
13811#endif /* FREECIV_JSON_CONNECTION */
13812 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
13813 RECEIVE_PACKET_FIELD_ERROR(steal);
13814 }
13815#ifdef FREECIV_JSON_CONNECTION
13816 field_addr.name = "worklist";
13817#endif /* FREECIV_JSON_CONNECTION */
13818 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
13819 RECEIVE_PACKET_FIELD_ERROR(worklist);
13820 }
13821#ifdef FREECIV_JSON_CONNECTION
13822 field_addr.name = "improvements";
13823#endif /* FREECIV_JSON_CONNECTION */
13824 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
13825 RECEIVE_PACKET_FIELD_ERROR(improvements);
13826 }
13827#ifdef FREECIV_JSON_CONNECTION
13828 field_addr.name = "city_options";
13829#endif /* FREECIV_JSON_CONNECTION */
13830 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
13831 RECEIVE_PACKET_FIELD_ERROR(city_options);
13832 }
13833#ifdef FREECIV_JSON_CONNECTION
13834 field_addr.name = "name";
13835#endif /* FREECIV_JSON_CONNECTION */
13836 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
13837 RECEIVE_PACKET_FIELD_ERROR(name);
13838 }
13839#endif
13840 log_packet_detailed("packet_city_info_100: got info about (%d)",
13841 real_packet->id);
13842
13843#ifdef FREECIV_DELTA_PROTOCOL
13844 if (nullptr == *hash) {
13845 *hash = genhash_new_full(hash_packet_city_info_100, cmp_packet_city_info_100,
13846 nullptr, nullptr, nullptr, destroy_packet_city_info);
13847 }
13848
13849 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
13850 *real_packet = *old;
13851 } else {
13852 /* packet is already initialized empty */
13853 log_packet_detailed(" no old info");
13854 }
13855
13856 if (BV_ISSET(fields, 0)) {
13857 log_packet_detailed(" got field 'tile'");
13858#ifdef FREECIV_JSON_CONNECTION
13859 field_addr.name = "tile";
13860#endif /* FREECIV_JSON_CONNECTION */
13861 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
13862 RECEIVE_PACKET_FIELD_ERROR(tile);
13863 }
13864 }
13865 if (BV_ISSET(fields, 1)) {
13866 log_packet_detailed(" got field 'owner'");
13867#ifdef FREECIV_JSON_CONNECTION
13868 field_addr.name = "owner";
13869#endif /* FREECIV_JSON_CONNECTION */
13870 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
13871 RECEIVE_PACKET_FIELD_ERROR(owner);
13872 }
13873 }
13874 if (BV_ISSET(fields, 2)) {
13875 log_packet_detailed(" got field 'original'");
13876#ifdef FREECIV_JSON_CONNECTION
13877 field_addr.name = "original";
13878#endif /* FREECIV_JSON_CONNECTION */
13879 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->original)) {
13880 RECEIVE_PACKET_FIELD_ERROR(original);
13881 }
13882 }
13883 if (BV_ISSET(fields, 3)) {
13884 log_packet_detailed(" got field 'size'");
13885#ifdef FREECIV_JSON_CONNECTION
13886 field_addr.name = "size";
13887#endif /* FREECIV_JSON_CONNECTION */
13888 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
13889 RECEIVE_PACKET_FIELD_ERROR(size);
13890 }
13891 }
13892 if (BV_ISSET(fields, 4)) {
13893 log_packet_detailed(" got field 'city_radius_sq'");
13894#ifdef FREECIV_JSON_CONNECTION
13895 field_addr.name = "city_radius_sq";
13896#endif /* FREECIV_JSON_CONNECTION */
13897 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
13898 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
13899 }
13900 }
13901 if (BV_ISSET(fields, 5)) {
13902 log_packet_detailed(" got field 'style'");
13903#ifdef FREECIV_JSON_CONNECTION
13904 field_addr.name = "style";
13905#endif /* FREECIV_JSON_CONNECTION */
13906 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
13907 RECEIVE_PACKET_FIELD_ERROR(style);
13908 }
13909 }
13910 if (BV_ISSET(fields, 6)) {
13911 log_packet_detailed(" got field 'capital'");
13912#ifdef FREECIV_JSON_CONNECTION
13913 field_addr.name = "capital";
13914#endif /* FREECIV_JSON_CONNECTION */
13915 {
13916 int readin;
13917
13918 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
13919 RECEIVE_PACKET_FIELD_ERROR(capital);
13920 }
13921 real_packet->capital = readin;
13922 }
13923 }
13924 if (BV_ISSET(fields, 7)) {
13925 log_packet_detailed(" got field 'ppl_happy'");
13926#ifdef FREECIV_JSON_CONNECTION
13927 field_addr.name = "ppl_happy";
13928#endif /* FREECIV_JSON_CONNECTION */
13929 {
13930 int i;
13931
13932#ifdef FREECIV_JSON_CONNECTION
13933 /* Enter array. */
13934 field_addr.sub_location = plocation_elem_new(0);
13935#endif /* FREECIV_JSON_CONNECTION */
13936
13937 for (i = 0; i < FEELING_LAST; i++) {
13938#ifdef FREECIV_JSON_CONNECTION
13939 field_addr.sub_location->number = i;
13940#endif /* FREECIV_JSON_CONNECTION */
13941 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
13942 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
13943 }
13944 }
13945
13946#ifdef FREECIV_JSON_CONNECTION
13947 /* Exit array. */
13948 FC_FREE(field_addr.sub_location);
13949#endif /* FREECIV_JSON_CONNECTION */
13950 }
13951 }
13952 if (BV_ISSET(fields, 8)) {
13953 log_packet_detailed(" got field 'ppl_content'");
13954#ifdef FREECIV_JSON_CONNECTION
13955 field_addr.name = "ppl_content";
13956#endif /* FREECIV_JSON_CONNECTION */
13957 {
13958 int i;
13959
13960#ifdef FREECIV_JSON_CONNECTION
13961 /* Enter array. */
13962 field_addr.sub_location = plocation_elem_new(0);
13963#endif /* FREECIV_JSON_CONNECTION */
13964
13965 for (i = 0; i < FEELING_LAST; i++) {
13966#ifdef FREECIV_JSON_CONNECTION
13967 field_addr.sub_location->number = i;
13968#endif /* FREECIV_JSON_CONNECTION */
13969 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
13970 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
13971 }
13972 }
13973
13974#ifdef FREECIV_JSON_CONNECTION
13975 /* Exit array. */
13976 FC_FREE(field_addr.sub_location);
13977#endif /* FREECIV_JSON_CONNECTION */
13978 }
13979 }
13980 if (BV_ISSET(fields, 9)) {
13981 log_packet_detailed(" got field 'ppl_unhappy'");
13982#ifdef FREECIV_JSON_CONNECTION
13983 field_addr.name = "ppl_unhappy";
13984#endif /* FREECIV_JSON_CONNECTION */
13985 {
13986 int i;
13987
13988#ifdef FREECIV_JSON_CONNECTION
13989 /* Enter array. */
13990 field_addr.sub_location = plocation_elem_new(0);
13991#endif /* FREECIV_JSON_CONNECTION */
13992
13993 for (i = 0; i < FEELING_LAST; i++) {
13994#ifdef FREECIV_JSON_CONNECTION
13995 field_addr.sub_location->number = i;
13996#endif /* FREECIV_JSON_CONNECTION */
13997 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
13998 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
13999 }
14000 }
14001
14002#ifdef FREECIV_JSON_CONNECTION
14003 /* Exit array. */
14004 FC_FREE(field_addr.sub_location);
14005#endif /* FREECIV_JSON_CONNECTION */
14006 }
14007 }
14008 if (BV_ISSET(fields, 10)) {
14009 log_packet_detailed(" got field 'ppl_angry'");
14010#ifdef FREECIV_JSON_CONNECTION
14011 field_addr.name = "ppl_angry";
14012#endif /* FREECIV_JSON_CONNECTION */
14013 {
14014 int i;
14015
14016#ifdef FREECIV_JSON_CONNECTION
14017 /* Enter array. */
14018 field_addr.sub_location = plocation_elem_new(0);
14019#endif /* FREECIV_JSON_CONNECTION */
14020
14021 for (i = 0; i < FEELING_LAST; i++) {
14022#ifdef FREECIV_JSON_CONNECTION
14023 field_addr.sub_location->number = i;
14024#endif /* FREECIV_JSON_CONNECTION */
14025 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
14026 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
14027 }
14028 }
14029
14030#ifdef FREECIV_JSON_CONNECTION
14031 /* Exit array. */
14032 FC_FREE(field_addr.sub_location);
14033#endif /* FREECIV_JSON_CONNECTION */
14034 }
14035 }
14036 if (BV_ISSET(fields, 11)) {
14037 log_packet_detailed(" got field 'specialists_size'");
14038#ifdef FREECIV_JSON_CONNECTION
14039 field_addr.name = "specialists_size";
14040#endif /* FREECIV_JSON_CONNECTION */
14041 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
14042 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
14043 }
14044 }
14045 if (BV_ISSET(fields, 12)) {
14046 log_packet_detailed(" got field 'specialists'");
14047#ifdef FREECIV_JSON_CONNECTION
14048 field_addr.name = "specialists";
14049#endif /* FREECIV_JSON_CONNECTION */
14050 {
14051 int i;
14052
14053#ifdef FREECIV_JSON_CONNECTION
14054 /* Enter array. */
14055 field_addr.sub_location = plocation_elem_new(0);
14056#endif /* FREECIV_JSON_CONNECTION */
14057
14058 if (real_packet->specialists_size > SP_MAX) {
14059 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
14060 }
14061 for (i = 0; i < real_packet->specialists_size; i++) {
14062#ifdef FREECIV_JSON_CONNECTION
14063 field_addr.sub_location->number = i;
14064#endif /* FREECIV_JSON_CONNECTION */
14065 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
14066 RECEIVE_PACKET_FIELD_ERROR(specialists);
14067 }
14068 }
14069
14070#ifdef FREECIV_JSON_CONNECTION
14071 /* Exit array. */
14072 FC_FREE(field_addr.sub_location);
14073#endif /* FREECIV_JSON_CONNECTION */
14074 }
14075 }
14076 if (BV_ISSET(fields, 13)) {
14077 log_packet_detailed(" got field 'history'");
14078#ifdef FREECIV_JSON_CONNECTION
14079 field_addr.name = "history";
14080#endif /* FREECIV_JSON_CONNECTION */
14081 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
14082 RECEIVE_PACKET_FIELD_ERROR(history);
14083 }
14084 }
14085 if (BV_ISSET(fields, 14)) {
14086 log_packet_detailed(" got field 'culture'");
14087#ifdef FREECIV_JSON_CONNECTION
14088 field_addr.name = "culture";
14089#endif /* FREECIV_JSON_CONNECTION */
14090 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
14091 RECEIVE_PACKET_FIELD_ERROR(culture);
14092 }
14093 }
14094 if (BV_ISSET(fields, 15)) {
14095 log_packet_detailed(" got field 'buy_cost'");
14096#ifdef FREECIV_JSON_CONNECTION
14097 field_addr.name = "buy_cost";
14098#endif /* FREECIV_JSON_CONNECTION */
14099 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
14100 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
14101 }
14102 }
14103 if (BV_ISSET(fields, 16)) {
14104 log_packet_detailed(" got field 'surplus'");
14105#ifdef FREECIV_JSON_CONNECTION
14106 field_addr.name = "surplus";
14107#endif /* FREECIV_JSON_CONNECTION */
14108 {
14109 int i;
14110
14111#ifdef FREECIV_JSON_CONNECTION
14112 /* Enter array. */
14113 field_addr.sub_location = plocation_elem_new(0);
14114#endif /* FREECIV_JSON_CONNECTION */
14115
14116 for (i = 0; i < O_LAST; i++) {
14117#ifdef FREECIV_JSON_CONNECTION
14118 field_addr.sub_location->number = i;
14119#endif /* FREECIV_JSON_CONNECTION */
14120 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
14121 RECEIVE_PACKET_FIELD_ERROR(surplus);
14122 }
14123 }
14124
14125#ifdef FREECIV_JSON_CONNECTION
14126 /* Exit array. */
14127 FC_FREE(field_addr.sub_location);
14128#endif /* FREECIV_JSON_CONNECTION */
14129 }
14130 }
14131 if (BV_ISSET(fields, 17)) {
14132 log_packet_detailed(" got field 'waste'");
14133#ifdef FREECIV_JSON_CONNECTION
14134 field_addr.name = "waste";
14135#endif /* FREECIV_JSON_CONNECTION */
14136 {
14137 int i;
14138
14139#ifdef FREECIV_JSON_CONNECTION
14140 /* Enter array. */
14141 field_addr.sub_location = plocation_elem_new(0);
14142#endif /* FREECIV_JSON_CONNECTION */
14143
14144 for (i = 0; i < O_LAST; i++) {
14145#ifdef FREECIV_JSON_CONNECTION
14146 field_addr.sub_location->number = i;
14147#endif /* FREECIV_JSON_CONNECTION */
14148 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
14149 RECEIVE_PACKET_FIELD_ERROR(waste);
14150 }
14151 }
14152
14153#ifdef FREECIV_JSON_CONNECTION
14154 /* Exit array. */
14155 FC_FREE(field_addr.sub_location);
14156#endif /* FREECIV_JSON_CONNECTION */
14157 }
14158 }
14159 if (BV_ISSET(fields, 18)) {
14160 log_packet_detailed(" got field 'unhappy_penalty'");
14161#ifdef FREECIV_JSON_CONNECTION
14162 field_addr.name = "unhappy_penalty";
14163#endif /* FREECIV_JSON_CONNECTION */
14164 {
14165 int i;
14166
14167#ifdef FREECIV_JSON_CONNECTION
14168 /* Enter array. */
14169 field_addr.sub_location = plocation_elem_new(0);
14170#endif /* FREECIV_JSON_CONNECTION */
14171
14172 for (i = 0; i < O_LAST; i++) {
14173#ifdef FREECIV_JSON_CONNECTION
14174 field_addr.sub_location->number = i;
14175#endif /* FREECIV_JSON_CONNECTION */
14176 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
14177 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
14178 }
14179 }
14180
14181#ifdef FREECIV_JSON_CONNECTION
14182 /* Exit array. */
14183 FC_FREE(field_addr.sub_location);
14184#endif /* FREECIV_JSON_CONNECTION */
14185 }
14186 }
14187 if (BV_ISSET(fields, 19)) {
14188 log_packet_detailed(" got field 'prod'");
14189#ifdef FREECIV_JSON_CONNECTION
14190 field_addr.name = "prod";
14191#endif /* FREECIV_JSON_CONNECTION */
14192 {
14193 int i;
14194
14195#ifdef FREECIV_JSON_CONNECTION
14196 /* Enter array. */
14197 field_addr.sub_location = plocation_elem_new(0);
14198#endif /* FREECIV_JSON_CONNECTION */
14199
14200 for (i = 0; i < O_LAST; i++) {
14201#ifdef FREECIV_JSON_CONNECTION
14202 field_addr.sub_location->number = i;
14203#endif /* FREECIV_JSON_CONNECTION */
14204 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
14205 RECEIVE_PACKET_FIELD_ERROR(prod);
14206 }
14207 }
14208
14209#ifdef FREECIV_JSON_CONNECTION
14210 /* Exit array. */
14211 FC_FREE(field_addr.sub_location);
14212#endif /* FREECIV_JSON_CONNECTION */
14213 }
14214 }
14215 if (BV_ISSET(fields, 20)) {
14216 log_packet_detailed(" got field 'citizen_base'");
14217#ifdef FREECIV_JSON_CONNECTION
14218 field_addr.name = "citizen_base";
14219#endif /* FREECIV_JSON_CONNECTION */
14220 {
14221 int i;
14222
14223#ifdef FREECIV_JSON_CONNECTION
14224 /* Enter array. */
14225 field_addr.sub_location = plocation_elem_new(0);
14226#endif /* FREECIV_JSON_CONNECTION */
14227
14228 for (i = 0; i < O_LAST; i++) {
14229#ifdef FREECIV_JSON_CONNECTION
14230 field_addr.sub_location->number = i;
14231#endif /* FREECIV_JSON_CONNECTION */
14232 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
14233 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
14234 }
14235 }
14236
14237#ifdef FREECIV_JSON_CONNECTION
14238 /* Exit array. */
14239 FC_FREE(field_addr.sub_location);
14240#endif /* FREECIV_JSON_CONNECTION */
14241 }
14242 }
14243 if (BV_ISSET(fields, 21)) {
14244 log_packet_detailed(" got field 'usage'");
14245#ifdef FREECIV_JSON_CONNECTION
14246 field_addr.name = "usage";
14247#endif /* FREECIV_JSON_CONNECTION */
14248 {
14249 int i;
14250
14251#ifdef FREECIV_JSON_CONNECTION
14252 /* Enter array. */
14253 field_addr.sub_location = plocation_elem_new(0);
14254#endif /* FREECIV_JSON_CONNECTION */
14255
14256 for (i = 0; i < O_LAST; i++) {
14257#ifdef FREECIV_JSON_CONNECTION
14258 field_addr.sub_location->number = i;
14259#endif /* FREECIV_JSON_CONNECTION */
14260 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
14261 RECEIVE_PACKET_FIELD_ERROR(usage);
14262 }
14263 }
14264
14265#ifdef FREECIV_JSON_CONNECTION
14266 /* Exit array. */
14267 FC_FREE(field_addr.sub_location);
14268#endif /* FREECIV_JSON_CONNECTION */
14269 }
14270 }
14271 if (BV_ISSET(fields, 22)) {
14272 log_packet_detailed(" got field 'food_stock'");
14273#ifdef FREECIV_JSON_CONNECTION
14274 field_addr.name = "food_stock";
14275#endif /* FREECIV_JSON_CONNECTION */
14276 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
14277 RECEIVE_PACKET_FIELD_ERROR(food_stock);
14278 }
14279 }
14280 if (BV_ISSET(fields, 23)) {
14281 log_packet_detailed(" got field 'shield_stock'");
14282#ifdef FREECIV_JSON_CONNECTION
14283 field_addr.name = "shield_stock";
14284#endif /* FREECIV_JSON_CONNECTION */
14285 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
14286 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
14287 }
14288 }
14289 if (BV_ISSET(fields, 24)) {
14290 log_packet_detailed(" got field 'trade_route_count'");
14291#ifdef FREECIV_JSON_CONNECTION
14292 field_addr.name = "trade_route_count";
14293#endif /* FREECIV_JSON_CONNECTION */
14294 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
14295 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
14296 }
14297 }
14298 if (BV_ISSET(fields, 25)) {
14299 log_packet_detailed(" got field 'pollution'");
14300#ifdef FREECIV_JSON_CONNECTION
14301 field_addr.name = "pollution";
14302#endif /* FREECIV_JSON_CONNECTION */
14303 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
14304 RECEIVE_PACKET_FIELD_ERROR(pollution);
14305 }
14306 }
14307 if (BV_ISSET(fields, 26)) {
14308 log_packet_detailed(" got field 'illness_trade'");
14309#ifdef FREECIV_JSON_CONNECTION
14310 field_addr.name = "illness_trade";
14311#endif /* FREECIV_JSON_CONNECTION */
14312 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
14313 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
14314 }
14315 }
14316 if (BV_ISSET(fields, 27)) {
14317 log_packet_detailed(" got field 'production_kind'");
14318#ifdef FREECIV_JSON_CONNECTION
14319 field_addr.name = "production_kind";
14320#endif /* FREECIV_JSON_CONNECTION */
14321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
14322 RECEIVE_PACKET_FIELD_ERROR(production_kind);
14323 }
14324 }
14325 if (BV_ISSET(fields, 28)) {
14326 log_packet_detailed(" got field 'production_value'");
14327#ifdef FREECIV_JSON_CONNECTION
14328 field_addr.name = "production_value";
14329#endif /* FREECIV_JSON_CONNECTION */
14330 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
14331 RECEIVE_PACKET_FIELD_ERROR(production_value);
14332 }
14333 }
14334 if (BV_ISSET(fields, 29)) {
14335 log_packet_detailed(" got field 'turn_founded'");
14336#ifdef FREECIV_JSON_CONNECTION
14337 field_addr.name = "turn_founded";
14338#endif /* FREECIV_JSON_CONNECTION */
14339 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
14340 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
14341 }
14342 }
14343 if (BV_ISSET(fields, 30)) {
14344 log_packet_detailed(" got field 'turn_last_built'");
14345#ifdef FREECIV_JSON_CONNECTION
14346 field_addr.name = "turn_last_built";
14347#endif /* FREECIV_JSON_CONNECTION */
14348 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
14349 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
14350 }
14351 }
14352 if (BV_ISSET(fields, 31)) {
14353 log_packet_detailed(" got field 'changed_from_kind'");
14354#ifdef FREECIV_JSON_CONNECTION
14355 field_addr.name = "changed_from_kind";
14356#endif /* FREECIV_JSON_CONNECTION */
14357 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
14358 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
14359 }
14360 }
14361 if (BV_ISSET(fields, 32)) {
14362 log_packet_detailed(" got field 'changed_from_value'");
14363#ifdef FREECIV_JSON_CONNECTION
14364 field_addr.name = "changed_from_value";
14365#endif /* FREECIV_JSON_CONNECTION */
14366 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
14367 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
14368 }
14369 }
14370 if (BV_ISSET(fields, 33)) {
14371 log_packet_detailed(" got field 'before_change_shields'");
14372#ifdef FREECIV_JSON_CONNECTION
14373 field_addr.name = "before_change_shields";
14374#endif /* FREECIV_JSON_CONNECTION */
14375 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
14376 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
14377 }
14378 }
14379 if (BV_ISSET(fields, 34)) {
14380 log_packet_detailed(" got field 'disbanded_shields'");
14381#ifdef FREECIV_JSON_CONNECTION
14382 field_addr.name = "disbanded_shields";
14383#endif /* FREECIV_JSON_CONNECTION */
14384 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
14385 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
14386 }
14387 }
14388 if (BV_ISSET(fields, 35)) {
14389 log_packet_detailed(" got field 'caravan_shields'");
14390#ifdef FREECIV_JSON_CONNECTION
14391 field_addr.name = "caravan_shields";
14392#endif /* FREECIV_JSON_CONNECTION */
14393 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
14394 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
14395 }
14396 }
14397 if (BV_ISSET(fields, 36)) {
14398 log_packet_detailed(" got field 'last_turns_shield_surplus'");
14399#ifdef FREECIV_JSON_CONNECTION
14400 field_addr.name = "last_turns_shield_surplus";
14401#endif /* FREECIV_JSON_CONNECTION */
14402 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
14403 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
14404 }
14405 }
14406 if (BV_ISSET(fields, 37)) {
14407 log_packet_detailed(" got field 'airlift'");
14408#ifdef FREECIV_JSON_CONNECTION
14409 field_addr.name = "airlift";
14410#endif /* FREECIV_JSON_CONNECTION */
14411 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
14412 RECEIVE_PACKET_FIELD_ERROR(airlift);
14413 }
14414 }
14415 real_packet->did_buy = BV_ISSET(fields, 38);
14416 real_packet->did_sell = BV_ISSET(fields, 39);
14417 real_packet->was_happy = BV_ISSET(fields, 40);
14418 real_packet->had_famine = BV_ISSET(fields, 41);
14419 real_packet->diplomat_investigate = BV_ISSET(fields, 42);
14420 if (BV_ISSET(fields, 43)) {
14421 log_packet_detailed(" got field 'walls'");
14422#ifdef FREECIV_JSON_CONNECTION
14423 field_addr.name = "walls";
14424#endif /* FREECIV_JSON_CONNECTION */
14425 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
14426 RECEIVE_PACKET_FIELD_ERROR(walls);
14427 }
14428 }
14429 if (BV_ISSET(fields, 44)) {
14430 log_packet_detailed(" got field 'city_image'");
14431#ifdef FREECIV_JSON_CONNECTION
14432 field_addr.name = "city_image";
14433#endif /* FREECIV_JSON_CONNECTION */
14434 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
14435 RECEIVE_PACKET_FIELD_ERROR(city_image);
14436 }
14437 }
14438 if (BV_ISSET(fields, 45)) {
14439 log_packet_detailed(" got field 'steal'");
14440#ifdef FREECIV_JSON_CONNECTION
14441 field_addr.name = "steal";
14442#endif /* FREECIV_JSON_CONNECTION */
14443 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
14444 RECEIVE_PACKET_FIELD_ERROR(steal);
14445 }
14446 }
14447 if (BV_ISSET(fields, 46)) {
14448 log_packet_detailed(" got field 'worklist'");
14449#ifdef FREECIV_JSON_CONNECTION
14450 field_addr.name = "worklist";
14451#endif /* FREECIV_JSON_CONNECTION */
14452 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
14453 RECEIVE_PACKET_FIELD_ERROR(worklist);
14454 }
14455 }
14456 if (BV_ISSET(fields, 47)) {
14457 log_packet_detailed(" got field 'improvements'");
14458#ifdef FREECIV_JSON_CONNECTION
14459 field_addr.name = "improvements";
14460#endif /* FREECIV_JSON_CONNECTION */
14461 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
14462 RECEIVE_PACKET_FIELD_ERROR(improvements);
14463 }
14464 }
14465 if (BV_ISSET(fields, 48)) {
14466 log_packet_detailed(" got field 'city_options'");
14467#ifdef FREECIV_JSON_CONNECTION
14468 field_addr.name = "city_options";
14469#endif /* FREECIV_JSON_CONNECTION */
14470 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
14471 RECEIVE_PACKET_FIELD_ERROR(city_options);
14472 }
14473 }
14474 if (BV_ISSET(fields, 49)) {
14475 log_packet_detailed(" got field 'name'");
14476#ifdef FREECIV_JSON_CONNECTION
14477 field_addr.name = "name";
14478#endif /* FREECIV_JSON_CONNECTION */
14479 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
14480 RECEIVE_PACKET_FIELD_ERROR(name);
14481 }
14482 }
14483
14484 if (nullptr == old) {
14485 old = fc_malloc(sizeof(*old));
14486 init_packet_city_info(old);
14487 *old = *real_packet;
14488 genhash_insert(*hash, old, old);
14489 } else {
14490 *old = *real_packet;
14491 }
14492
14493 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
14494 if (nullptr != *hash) {
14495 genhash_remove(*hash, real_packet);
14496 }
14497
14498#endif /* FREECIV_DELTA_PROTOCOL */
14499 RECEIVE_PACKET_END(real_packet);
14500#undef FREE_PACKET_STRUCT
14501}
14502
14503 static int send_packet_city_info_100(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
14504{
14505 const struct packet_city_info *real_packet = packet;
14506 int e;
14507#ifdef FREECIV_DELTA_PROTOCOL
14508 packet_city_info_100_fields fields;
14509 struct packet_city_info *old;
14510 bool differ;
14511 struct genhash **hash = pc->phs.sent + PACKET_CITY_INFO;
14512 int different = force_to_send;
14513#endif /* FREECIV_DELTA_PROTOCOL */
14514 SEND_PACKET_START(PACKET_CITY_INFO);
14515#ifdef FREECIV_JSON_CONNECTION
14516 struct plocation field_addr;
14517 {
14518 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
14519 field_addr = *field_addr_tmp;
14520 FC_FREE(field_addr_tmp);
14521 }
14522#endif /* FREECIV_JSON_CONNECTION */
14523
14524 log_packet_detailed("packet_city_info_100: sending info about (%d)",
14525 real_packet->id);
14526
14527#ifdef FREECIV_DELTA_PROTOCOL
14528 if (nullptr == *hash) {
14529 *hash = genhash_new_full(hash_packet_city_info_100, cmp_packet_city_info_100,
14530 nullptr, nullptr, nullptr, destroy_packet_city_info);
14531 }
14532 BV_CLR_ALL(fields);
14533
14534 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
14535 old = fc_malloc(sizeof(*old));
14536 /* temporary bitcopy just to insert correctly */
14537 *old = *real_packet;
14538 genhash_insert(*hash, old, old);
14539 init_packet_city_info(old);
14540 different = 1; /* Force to send. */
14541 }
14542 differ = (old->tile != real_packet->tile);
14543 if (differ) {
14544 different++;
14545 BV_SET(fields, 0);
14546 }
14547
14548 differ = (old->owner != real_packet->owner);
14549 if (differ) {
14550 different++;
14551 BV_SET(fields, 1);
14552 }
14553
14554 differ = (old->original != real_packet->original);
14555 if (differ) {
14556 different++;
14557 BV_SET(fields, 2);
14558 }
14559
14560 differ = (old->size != real_packet->size);
14561 if (differ) {
14562 different++;
14563 BV_SET(fields, 3);
14564 }
14565
14566 differ = (old->city_radius_sq != real_packet->city_radius_sq);
14567 if (differ) {
14568 different++;
14569 BV_SET(fields, 4);
14570 }
14571
14572 differ = (old->style != real_packet->style);
14573 if (differ) {
14574 different++;
14575 BV_SET(fields, 5);
14576 }
14577
14578 differ = (old->capital != real_packet->capital);
14579 if (differ) {
14580 different++;
14581 BV_SET(fields, 6);
14582 }
14583
14584 differ = FALSE;
14585 {
14586 int i;
14587
14588 for (i = 0; i < FEELING_LAST; i++) {
14589 differ = (old->ppl_happy[i] != real_packet->ppl_happy[i]);
14590 if (differ) {
14591 break;
14592 }
14593 }
14594 }
14595 if (differ) {
14596 different++;
14597 BV_SET(fields, 7);
14598 }
14599
14600 differ = FALSE;
14601 {
14602 int i;
14603
14604 for (i = 0; i < FEELING_LAST; i++) {
14605 differ = (old->ppl_content[i] != real_packet->ppl_content[i]);
14606 if (differ) {
14607 break;
14608 }
14609 }
14610 }
14611 if (differ) {
14612 different++;
14613 BV_SET(fields, 8);
14614 }
14615
14616 differ = FALSE;
14617 {
14618 int i;
14619
14620 for (i = 0; i < FEELING_LAST; i++) {
14621 differ = (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]);
14622 if (differ) {
14623 break;
14624 }
14625 }
14626 }
14627 if (differ) {
14628 different++;
14629 BV_SET(fields, 9);
14630 }
14631
14632 differ = FALSE;
14633 {
14634 int i;
14635
14636 for (i = 0; i < FEELING_LAST; i++) {
14637 differ = (old->ppl_angry[i] != real_packet->ppl_angry[i]);
14638 if (differ) {
14639 break;
14640 }
14641 }
14642 }
14643 if (differ) {
14644 different++;
14645 BV_SET(fields, 10);
14646 }
14647
14648 differ = (old->specialists_size != real_packet->specialists_size);
14649 if (differ) {
14650 different++;
14651 BV_SET(fields, 11);
14652 }
14653
14654 differ = (old->specialists_size != real_packet->specialists_size);
14655 if (!differ) {
14656 int i;
14657
14658 for (i = 0; i < real_packet->specialists_size; i++) {
14659 differ = (old->specialists[i] != real_packet->specialists[i]);
14660 if (differ) {
14661 break;
14662 }
14663 }
14664 }
14665 if (differ) {
14666 different++;
14667 BV_SET(fields, 12);
14668 }
14669
14670 differ = (old->history != real_packet->history);
14671 if (differ) {
14672 different++;
14673 BV_SET(fields, 13);
14674 }
14675
14676 differ = (old->culture != real_packet->culture);
14677 if (differ) {
14678 different++;
14679 BV_SET(fields, 14);
14680 }
14681
14682 differ = (old->buy_cost != real_packet->buy_cost);
14683 if (differ) {
14684 different++;
14685 BV_SET(fields, 15);
14686 }
14687
14688 differ = FALSE;
14689 {
14690 int i;
14691
14692 for (i = 0; i < O_LAST; i++) {
14693 differ = (old->surplus[i] != real_packet->surplus[i]);
14694 if (differ) {
14695 break;
14696 }
14697 }
14698 }
14699 if (differ) {
14700 different++;
14701 BV_SET(fields, 16);
14702 }
14703
14704 differ = FALSE;
14705 {
14706 int i;
14707
14708 for (i = 0; i < O_LAST; i++) {
14709 differ = (old->waste[i] != real_packet->waste[i]);
14710 if (differ) {
14711 break;
14712 }
14713 }
14714 }
14715 if (differ) {
14716 different++;
14717 BV_SET(fields, 17);
14718 }
14719
14720 differ = FALSE;
14721 {
14722 int i;
14723
14724 for (i = 0; i < O_LAST; i++) {
14725 differ = (old->unhappy_penalty[i] != real_packet->unhappy_penalty[i]);
14726 if (differ) {
14727 break;
14728 }
14729 }
14730 }
14731 if (differ) {
14732 different++;
14733 BV_SET(fields, 18);
14734 }
14735
14736 differ = FALSE;
14737 {
14738 int i;
14739
14740 for (i = 0; i < O_LAST; i++) {
14741 differ = (old->prod[i] != real_packet->prod[i]);
14742 if (differ) {
14743 break;
14744 }
14745 }
14746 }
14747 if (differ) {
14748 different++;
14749 BV_SET(fields, 19);
14750 }
14751
14752 differ = FALSE;
14753 {
14754 int i;
14755
14756 for (i = 0; i < O_LAST; i++) {
14757 differ = (old->citizen_base[i] != real_packet->citizen_base[i]);
14758 if (differ) {
14759 break;
14760 }
14761 }
14762 }
14763 if (differ) {
14764 different++;
14765 BV_SET(fields, 20);
14766 }
14767
14768 differ = FALSE;
14769 {
14770 int i;
14771
14772 for (i = 0; i < O_LAST; i++) {
14773 differ = (old->usage[i] != real_packet->usage[i]);
14774 if (differ) {
14775 break;
14776 }
14777 }
14778 }
14779 if (differ) {
14780 different++;
14781 BV_SET(fields, 21);
14782 }
14783
14784 differ = (old->food_stock != real_packet->food_stock);
14785 if (differ) {
14786 different++;
14787 BV_SET(fields, 22);
14788 }
14789
14790 differ = (old->shield_stock != real_packet->shield_stock);
14791 if (differ) {
14792 different++;
14793 BV_SET(fields, 23);
14794 }
14795
14796 differ = (old->trade_route_count != real_packet->trade_route_count);
14797 if (differ) {
14798 different++;
14799 BV_SET(fields, 24);
14800 }
14801
14802 differ = (old->pollution != real_packet->pollution);
14803 if (differ) {
14804 different++;
14805 BV_SET(fields, 25);
14806 }
14807
14808 differ = (old->illness_trade != real_packet->illness_trade);
14809 if (differ) {
14810 different++;
14811 BV_SET(fields, 26);
14812 }
14813
14814 differ = (old->production_kind != real_packet->production_kind);
14815 if (differ) {
14816 different++;
14817 BV_SET(fields, 27);
14818 }
14819
14820 differ = (old->production_value != real_packet->production_value);
14821 if (differ) {
14822 different++;
14823 BV_SET(fields, 28);
14824 }
14825
14826 differ = (old->turn_founded != real_packet->turn_founded);
14827 if (differ) {
14828 different++;
14829 BV_SET(fields, 29);
14830 }
14831
14832 differ = (old->turn_last_built != real_packet->turn_last_built);
14833 if (differ) {
14834 different++;
14835 BV_SET(fields, 30);
14836 }
14837
14838 differ = (old->changed_from_kind != real_packet->changed_from_kind);
14839 if (differ) {
14840 different++;
14841 BV_SET(fields, 31);
14842 }
14843
14844 differ = (old->changed_from_value != real_packet->changed_from_value);
14845 if (differ) {
14846 different++;
14847 BV_SET(fields, 32);
14848 }
14849
14850 differ = (old->before_change_shields != real_packet->before_change_shields);
14851 if (differ) {
14852 different++;
14853 BV_SET(fields, 33);
14854 }
14855
14856 differ = (old->disbanded_shields != real_packet->disbanded_shields);
14857 if (differ) {
14858 different++;
14859 BV_SET(fields, 34);
14860 }
14861
14862 differ = (old->caravan_shields != real_packet->caravan_shields);
14863 if (differ) {
14864 different++;
14865 BV_SET(fields, 35);
14866 }
14867
14868 differ = (old->last_turns_shield_surplus != real_packet->last_turns_shield_surplus);
14869 if (differ) {
14870 different++;
14871 BV_SET(fields, 36);
14872 }
14873
14874 differ = (old->airlift != real_packet->airlift);
14875 if (differ) {
14876 different++;
14877 BV_SET(fields, 37);
14878 }
14879
14880 differ = (old->did_buy != real_packet->did_buy);
14881 if (differ) {
14882 different++;
14883 }
14884 if (packet->did_buy) {
14885 BV_SET(fields, 38);
14886 }
14887
14888 differ = (old->did_sell != real_packet->did_sell);
14889 if (differ) {
14890 different++;
14891 }
14892 if (packet->did_sell) {
14893 BV_SET(fields, 39);
14894 }
14895
14896 differ = (old->was_happy != real_packet->was_happy);
14897 if (differ) {
14898 different++;
14899 }
14900 if (packet->was_happy) {
14901 BV_SET(fields, 40);
14902 }
14903
14904 differ = (old->had_famine != real_packet->had_famine);
14905 if (differ) {
14906 different++;
14907 }
14908 if (packet->had_famine) {
14909 BV_SET(fields, 41);
14910 }
14911
14912 differ = (old->diplomat_investigate != real_packet->diplomat_investigate);
14913 if (differ) {
14914 different++;
14915 }
14916 if (packet->diplomat_investigate) {
14917 BV_SET(fields, 42);
14918 }
14919
14920 differ = (old->walls != real_packet->walls);
14921 if (differ) {
14922 different++;
14923 BV_SET(fields, 43);
14924 }
14925
14926 differ = (old->city_image != real_packet->city_image);
14927 if (differ) {
14928 different++;
14929 BV_SET(fields, 44);
14930 }
14931
14932 differ = (old->steal != real_packet->steal);
14933 if (differ) {
14934 different++;
14935 BV_SET(fields, 45);
14936 }
14937
14938 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
14939 if (differ) {
14940 different++;
14941 BV_SET(fields, 46);
14942 }
14943
14944 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
14945 if (differ) {
14946 different++;
14947 BV_SET(fields, 47);
14948 }
14949
14950 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
14951 if (differ) {
14952 different++;
14953 BV_SET(fields, 48);
14954 }
14955
14956 differ = (strcmp(old->name, real_packet->name) != 0);
14957 if (differ) {
14958 different++;
14959 BV_SET(fields, 49);
14960 }
14961
14962 if (different == 0) {
14963 log_packet_detailed(" no change -> discard");
14964 return 0;
14965 }
14966
14967#ifdef FREECIV_JSON_CONNECTION
14968 field_addr.name = "fields";
14969#endif /* FREECIV_JSON_CONNECTION */
14970 e = 0;
14971 e |= DIO_BV_PUT(&dout, &field_addr, fields);
14972 if (e) {
14973 log_packet_detailed("fields bitvector error detected");
14974 }
14975#ifdef FREECIV_JSON_CONNECTION
14976 field_addr.name = "id";
14977#endif /* FREECIV_JSON_CONNECTION */
14978 e = 0;
14979 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
14980 if (e) {
14981 log_packet_detailed("'id' field error detected");
14982 }
14983
14984 if (BV_ISSET(fields, 0)) {
14985 log_packet_detailed(" field 'tile' has changed");
14986#ifdef FREECIV_JSON_CONNECTION
14987 field_addr.name = "tile";
14988#endif /* FREECIV_JSON_CONNECTION */
14989 e = 0;
14990 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
14991 if (e) {
14992 log_packet_detailed("'tile' field error detected");
14993 }
14994 }
14995 if (BV_ISSET(fields, 1)) {
14996 log_packet_detailed(" field 'owner' has changed");
14997#ifdef FREECIV_JSON_CONNECTION
14998 field_addr.name = "owner";
14999#endif /* FREECIV_JSON_CONNECTION */
15000 e = 0;
15001 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
15002 if (e) {
15003 log_packet_detailed("'owner' field error detected");
15004 }
15005 }
15006 if (BV_ISSET(fields, 2)) {
15007 log_packet_detailed(" field 'original' has changed");
15008#ifdef FREECIV_JSON_CONNECTION
15009 field_addr.name = "original";
15010#endif /* FREECIV_JSON_CONNECTION */
15011 e = 0;
15012 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->original);
15013 if (e) {
15014 log_packet_detailed("'original' field error detected");
15015 }
15016 }
15017 if (BV_ISSET(fields, 3)) {
15018 log_packet_detailed(" field 'size' has changed");
15019#ifdef FREECIV_JSON_CONNECTION
15020 field_addr.name = "size";
15021#endif /* FREECIV_JSON_CONNECTION */
15022 e = 0;
15023 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
15024 if (e) {
15025 log_packet_detailed("'size' field error detected");
15026 }
15027 }
15028 if (BV_ISSET(fields, 4)) {
15029 log_packet_detailed(" field 'city_radius_sq' has changed");
15030#ifdef FREECIV_JSON_CONNECTION
15031 field_addr.name = "city_radius_sq";
15032#endif /* FREECIV_JSON_CONNECTION */
15033 e = 0;
15034 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
15035 if (e) {
15036 log_packet_detailed("'city_radius_sq' field error detected");
15037 }
15038 }
15039 if (BV_ISSET(fields, 5)) {
15040 log_packet_detailed(" field 'style' has changed");
15041#ifdef FREECIV_JSON_CONNECTION
15042 field_addr.name = "style";
15043#endif /* FREECIV_JSON_CONNECTION */
15044 e = 0;
15045 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
15046 if (e) {
15047 log_packet_detailed("'style' field error detected");
15048 }
15049 }
15050 if (BV_ISSET(fields, 6)) {
15051 log_packet_detailed(" field 'capital' has changed");
15052#ifdef FREECIV_JSON_CONNECTION
15053 field_addr.name = "capital";
15054#endif /* FREECIV_JSON_CONNECTION */
15055 e = 0;
15056 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
15057 if (e) {
15058 log_packet_detailed("'capital' field error detected");
15059 }
15060 }
15061 if (BV_ISSET(fields, 7)) {
15062 log_packet_detailed(" field 'ppl_happy' has changed");
15063#ifdef FREECIV_JSON_CONNECTION
15064 field_addr.name = "ppl_happy";
15065#endif /* FREECIV_JSON_CONNECTION */
15066 e = 0;
15067 {
15068 int i;
15069
15070#ifdef FREECIV_JSON_CONNECTION
15071 /* Create the array. */
15072 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15073
15074 /* Enter the array. */
15075 field_addr.sub_location = plocation_elem_new(0);
15076#endif /* FREECIV_JSON_CONNECTION */
15077
15078 for (i = 0; i < FEELING_LAST; i++) {
15079#ifdef FREECIV_JSON_CONNECTION
15080 /* Next array element. */
15081 field_addr.sub_location->number = i;
15082#endif /* FREECIV_JSON_CONNECTION */
15083 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
15084 }
15085
15086#ifdef FREECIV_JSON_CONNECTION
15087 /* Exit array. */
15088 FC_FREE(field_addr.sub_location);
15089#endif /* FREECIV_JSON_CONNECTION */
15090 }
15091 if (e) {
15092 log_packet_detailed("'ppl_happy' field error detected");
15093 }
15094 }
15095 if (BV_ISSET(fields, 8)) {
15096 log_packet_detailed(" field 'ppl_content' has changed");
15097#ifdef FREECIV_JSON_CONNECTION
15098 field_addr.name = "ppl_content";
15099#endif /* FREECIV_JSON_CONNECTION */
15100 e = 0;
15101 {
15102 int i;
15103
15104#ifdef FREECIV_JSON_CONNECTION
15105 /* Create the array. */
15106 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15107
15108 /* Enter the array. */
15109 field_addr.sub_location = plocation_elem_new(0);
15110#endif /* FREECIV_JSON_CONNECTION */
15111
15112 for (i = 0; i < FEELING_LAST; i++) {
15113#ifdef FREECIV_JSON_CONNECTION
15114 /* Next array element. */
15115 field_addr.sub_location->number = i;
15116#endif /* FREECIV_JSON_CONNECTION */
15117 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
15118 }
15119
15120#ifdef FREECIV_JSON_CONNECTION
15121 /* Exit array. */
15122 FC_FREE(field_addr.sub_location);
15123#endif /* FREECIV_JSON_CONNECTION */
15124 }
15125 if (e) {
15126 log_packet_detailed("'ppl_content' field error detected");
15127 }
15128 }
15129 if (BV_ISSET(fields, 9)) {
15130 log_packet_detailed(" field 'ppl_unhappy' has changed");
15131#ifdef FREECIV_JSON_CONNECTION
15132 field_addr.name = "ppl_unhappy";
15133#endif /* FREECIV_JSON_CONNECTION */
15134 e = 0;
15135 {
15136 int i;
15137
15138#ifdef FREECIV_JSON_CONNECTION
15139 /* Create the array. */
15140 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15141
15142 /* Enter the array. */
15143 field_addr.sub_location = plocation_elem_new(0);
15144#endif /* FREECIV_JSON_CONNECTION */
15145
15146 for (i = 0; i < FEELING_LAST; i++) {
15147#ifdef FREECIV_JSON_CONNECTION
15148 /* Next array element. */
15149 field_addr.sub_location->number = i;
15150#endif /* FREECIV_JSON_CONNECTION */
15151 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
15152 }
15153
15154#ifdef FREECIV_JSON_CONNECTION
15155 /* Exit array. */
15156 FC_FREE(field_addr.sub_location);
15157#endif /* FREECIV_JSON_CONNECTION */
15158 }
15159 if (e) {
15160 log_packet_detailed("'ppl_unhappy' field error detected");
15161 }
15162 }
15163 if (BV_ISSET(fields, 10)) {
15164 log_packet_detailed(" field 'ppl_angry' has changed");
15165#ifdef FREECIV_JSON_CONNECTION
15166 field_addr.name = "ppl_angry";
15167#endif /* FREECIV_JSON_CONNECTION */
15168 e = 0;
15169 {
15170 int i;
15171
15172#ifdef FREECIV_JSON_CONNECTION
15173 /* Create the array. */
15174 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15175
15176 /* Enter the array. */
15177 field_addr.sub_location = plocation_elem_new(0);
15178#endif /* FREECIV_JSON_CONNECTION */
15179
15180 for (i = 0; i < FEELING_LAST; i++) {
15181#ifdef FREECIV_JSON_CONNECTION
15182 /* Next array element. */
15183 field_addr.sub_location->number = i;
15184#endif /* FREECIV_JSON_CONNECTION */
15185 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
15186 }
15187
15188#ifdef FREECIV_JSON_CONNECTION
15189 /* Exit array. */
15190 FC_FREE(field_addr.sub_location);
15191#endif /* FREECIV_JSON_CONNECTION */
15192 }
15193 if (e) {
15194 log_packet_detailed("'ppl_angry' field error detected");
15195 }
15196 }
15197 if (BV_ISSET(fields, 11)) {
15198 log_packet_detailed(" field 'specialists_size' has changed");
15199#ifdef FREECIV_JSON_CONNECTION
15200 field_addr.name = "specialists_size";
15201#endif /* FREECIV_JSON_CONNECTION */
15202 e = 0;
15203 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
15204 if (e) {
15205 log_packet_detailed("'specialists_size' field error detected");
15206 }
15207 }
15208 if (BV_ISSET(fields, 12)) {
15209 log_packet_detailed(" field 'specialists' has changed");
15210#ifdef FREECIV_JSON_CONNECTION
15211 field_addr.name = "specialists";
15212#endif /* FREECIV_JSON_CONNECTION */
15213 e = 0;
15214 {
15215 int i;
15216
15217#ifdef FREECIV_JSON_CONNECTION
15218 /* Create the array. */
15219 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
15220
15221 /* Enter the array. */
15222 field_addr.sub_location = plocation_elem_new(0);
15223#endif /* FREECIV_JSON_CONNECTION */
15224
15225 for (i = 0; i < real_packet->specialists_size; i++) {
15226#ifdef FREECIV_JSON_CONNECTION
15227 /* Next array element. */
15228 field_addr.sub_location->number = i;
15229#endif /* FREECIV_JSON_CONNECTION */
15230 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
15231 }
15232
15233#ifdef FREECIV_JSON_CONNECTION
15234 /* Exit array. */
15235 FC_FREE(field_addr.sub_location);
15236#endif /* FREECIV_JSON_CONNECTION */
15237 }
15238 if (e) {
15239 log_packet_detailed("'specialists' field error detected");
15240 }
15241 }
15242 if (BV_ISSET(fields, 13)) {
15243 log_packet_detailed(" field 'history' has changed");
15244#ifdef FREECIV_JSON_CONNECTION
15245 field_addr.name = "history";
15246#endif /* FREECIV_JSON_CONNECTION */
15247 e = 0;
15248 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
15249 if (e) {
15250 log_packet_detailed("'history' field error detected");
15251 }
15252 }
15253 if (BV_ISSET(fields, 14)) {
15254 log_packet_detailed(" field 'culture' has changed");
15255#ifdef FREECIV_JSON_CONNECTION
15256 field_addr.name = "culture";
15257#endif /* FREECIV_JSON_CONNECTION */
15258 e = 0;
15259 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
15260 if (e) {
15261 log_packet_detailed("'culture' field error detected");
15262 }
15263 }
15264 if (BV_ISSET(fields, 15)) {
15265 log_packet_detailed(" field 'buy_cost' has changed");
15266#ifdef FREECIV_JSON_CONNECTION
15267 field_addr.name = "buy_cost";
15268#endif /* FREECIV_JSON_CONNECTION */
15269 e = 0;
15270 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
15271 if (e) {
15272 log_packet_detailed("'buy_cost' field error detected");
15273 }
15274 }
15275 if (BV_ISSET(fields, 16)) {
15276 log_packet_detailed(" field 'surplus' has changed");
15277#ifdef FREECIV_JSON_CONNECTION
15278 field_addr.name = "surplus";
15279#endif /* FREECIV_JSON_CONNECTION */
15280 e = 0;
15281 {
15282 int i;
15283
15284#ifdef FREECIV_JSON_CONNECTION
15285 /* Create the array. */
15286 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15287
15288 /* Enter the array. */
15289 field_addr.sub_location = plocation_elem_new(0);
15290#endif /* FREECIV_JSON_CONNECTION */
15291
15292 for (i = 0; i < O_LAST; i++) {
15293#ifdef FREECIV_JSON_CONNECTION
15294 /* Next array element. */
15295 field_addr.sub_location->number = i;
15296#endif /* FREECIV_JSON_CONNECTION */
15297 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
15298 }
15299
15300#ifdef FREECIV_JSON_CONNECTION
15301 /* Exit array. */
15302 FC_FREE(field_addr.sub_location);
15303#endif /* FREECIV_JSON_CONNECTION */
15304 }
15305 if (e) {
15306 log_packet_detailed("'surplus' field error detected");
15307 }
15308 }
15309 if (BV_ISSET(fields, 17)) {
15310 log_packet_detailed(" field 'waste' has changed");
15311#ifdef FREECIV_JSON_CONNECTION
15312 field_addr.name = "waste";
15313#endif /* FREECIV_JSON_CONNECTION */
15314 e = 0;
15315 {
15316 int i;
15317
15318#ifdef FREECIV_JSON_CONNECTION
15319 /* Create the array. */
15320 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15321
15322 /* Enter the array. */
15323 field_addr.sub_location = plocation_elem_new(0);
15324#endif /* FREECIV_JSON_CONNECTION */
15325
15326 for (i = 0; i < O_LAST; i++) {
15327#ifdef FREECIV_JSON_CONNECTION
15328 /* Next array element. */
15329 field_addr.sub_location->number = i;
15330#endif /* FREECIV_JSON_CONNECTION */
15331 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
15332 }
15333
15334#ifdef FREECIV_JSON_CONNECTION
15335 /* Exit array. */
15336 FC_FREE(field_addr.sub_location);
15337#endif /* FREECIV_JSON_CONNECTION */
15338 }
15339 if (e) {
15340 log_packet_detailed("'waste' field error detected");
15341 }
15342 }
15343 if (BV_ISSET(fields, 18)) {
15344 log_packet_detailed(" field 'unhappy_penalty' has changed");
15345#ifdef FREECIV_JSON_CONNECTION
15346 field_addr.name = "unhappy_penalty";
15347#endif /* FREECIV_JSON_CONNECTION */
15348 e = 0;
15349 {
15350 int i;
15351
15352#ifdef FREECIV_JSON_CONNECTION
15353 /* Create the array. */
15354 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15355
15356 /* Enter the array. */
15357 field_addr.sub_location = plocation_elem_new(0);
15358#endif /* FREECIV_JSON_CONNECTION */
15359
15360 for (i = 0; i < O_LAST; i++) {
15361#ifdef FREECIV_JSON_CONNECTION
15362 /* Next array element. */
15363 field_addr.sub_location->number = i;
15364#endif /* FREECIV_JSON_CONNECTION */
15365 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
15366 }
15367
15368#ifdef FREECIV_JSON_CONNECTION
15369 /* Exit array. */
15370 FC_FREE(field_addr.sub_location);
15371#endif /* FREECIV_JSON_CONNECTION */
15372 }
15373 if (e) {
15374 log_packet_detailed("'unhappy_penalty' field error detected");
15375 }
15376 }
15377 if (BV_ISSET(fields, 19)) {
15378 log_packet_detailed(" field 'prod' has changed");
15379#ifdef FREECIV_JSON_CONNECTION
15380 field_addr.name = "prod";
15381#endif /* FREECIV_JSON_CONNECTION */
15382 e = 0;
15383 {
15384 int i;
15385
15386#ifdef FREECIV_JSON_CONNECTION
15387 /* Create the array. */
15388 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15389
15390 /* Enter the array. */
15391 field_addr.sub_location = plocation_elem_new(0);
15392#endif /* FREECIV_JSON_CONNECTION */
15393
15394 for (i = 0; i < O_LAST; i++) {
15395#ifdef FREECIV_JSON_CONNECTION
15396 /* Next array element. */
15397 field_addr.sub_location->number = i;
15398#endif /* FREECIV_JSON_CONNECTION */
15399 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
15400 }
15401
15402#ifdef FREECIV_JSON_CONNECTION
15403 /* Exit array. */
15404 FC_FREE(field_addr.sub_location);
15405#endif /* FREECIV_JSON_CONNECTION */
15406 }
15407 if (e) {
15408 log_packet_detailed("'prod' field error detected");
15409 }
15410 }
15411 if (BV_ISSET(fields, 20)) {
15412 log_packet_detailed(" field 'citizen_base' has changed");
15413#ifdef FREECIV_JSON_CONNECTION
15414 field_addr.name = "citizen_base";
15415#endif /* FREECIV_JSON_CONNECTION */
15416 e = 0;
15417 {
15418 int i;
15419
15420#ifdef FREECIV_JSON_CONNECTION
15421 /* Create the array. */
15422 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15423
15424 /* Enter the array. */
15425 field_addr.sub_location = plocation_elem_new(0);
15426#endif /* FREECIV_JSON_CONNECTION */
15427
15428 for (i = 0; i < O_LAST; i++) {
15429#ifdef FREECIV_JSON_CONNECTION
15430 /* Next array element. */
15431 field_addr.sub_location->number = i;
15432#endif /* FREECIV_JSON_CONNECTION */
15433 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
15434 }
15435
15436#ifdef FREECIV_JSON_CONNECTION
15437 /* Exit array. */
15438 FC_FREE(field_addr.sub_location);
15439#endif /* FREECIV_JSON_CONNECTION */
15440 }
15441 if (e) {
15442 log_packet_detailed("'citizen_base' field error detected");
15443 }
15444 }
15445 if (BV_ISSET(fields, 21)) {
15446 log_packet_detailed(" field 'usage' has changed");
15447#ifdef FREECIV_JSON_CONNECTION
15448 field_addr.name = "usage";
15449#endif /* FREECIV_JSON_CONNECTION */
15450 e = 0;
15451 {
15452 int i;
15453
15454#ifdef FREECIV_JSON_CONNECTION
15455 /* Create the array. */
15456 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15457
15458 /* Enter the array. */
15459 field_addr.sub_location = plocation_elem_new(0);
15460#endif /* FREECIV_JSON_CONNECTION */
15461
15462 for (i = 0; i < O_LAST; i++) {
15463#ifdef FREECIV_JSON_CONNECTION
15464 /* Next array element. */
15465 field_addr.sub_location->number = i;
15466#endif /* FREECIV_JSON_CONNECTION */
15467 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
15468 }
15469
15470#ifdef FREECIV_JSON_CONNECTION
15471 /* Exit array. */
15472 FC_FREE(field_addr.sub_location);
15473#endif /* FREECIV_JSON_CONNECTION */
15474 }
15475 if (e) {
15476 log_packet_detailed("'usage' field error detected");
15477 }
15478 }
15479 if (BV_ISSET(fields, 22)) {
15480 log_packet_detailed(" field 'food_stock' has changed");
15481#ifdef FREECIV_JSON_CONNECTION
15482 field_addr.name = "food_stock";
15483#endif /* FREECIV_JSON_CONNECTION */
15484 e = 0;
15485 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
15486 if (e) {
15487 log_packet_detailed("'food_stock' field error detected");
15488 }
15489 }
15490 if (BV_ISSET(fields, 23)) {
15491 log_packet_detailed(" field 'shield_stock' has changed");
15492#ifdef FREECIV_JSON_CONNECTION
15493 field_addr.name = "shield_stock";
15494#endif /* FREECIV_JSON_CONNECTION */
15495 e = 0;
15496 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
15497 if (e) {
15498 log_packet_detailed("'shield_stock' field error detected");
15499 }
15500 }
15501 if (BV_ISSET(fields, 24)) {
15502 log_packet_detailed(" field 'trade_route_count' has changed");
15503#ifdef FREECIV_JSON_CONNECTION
15504 field_addr.name = "trade_route_count";
15505#endif /* FREECIV_JSON_CONNECTION */
15506 e = 0;
15507 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
15508 if (e) {
15509 log_packet_detailed("'trade_route_count' field error detected");
15510 }
15511 }
15512 if (BV_ISSET(fields, 25)) {
15513 log_packet_detailed(" field 'pollution' has changed");
15514#ifdef FREECIV_JSON_CONNECTION
15515 field_addr.name = "pollution";
15516#endif /* FREECIV_JSON_CONNECTION */
15517 e = 0;
15518 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
15519 if (e) {
15520 log_packet_detailed("'pollution' field error detected");
15521 }
15522 }
15523 if (BV_ISSET(fields, 26)) {
15524 log_packet_detailed(" field 'illness_trade' has changed");
15525#ifdef FREECIV_JSON_CONNECTION
15526 field_addr.name = "illness_trade";
15527#endif /* FREECIV_JSON_CONNECTION */
15528 e = 0;
15529 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
15530 if (e) {
15531 log_packet_detailed("'illness_trade' field error detected");
15532 }
15533 }
15534 if (BV_ISSET(fields, 27)) {
15535 log_packet_detailed(" field 'production_kind' has changed");
15536#ifdef FREECIV_JSON_CONNECTION
15537 field_addr.name = "production_kind";
15538#endif /* FREECIV_JSON_CONNECTION */
15539 e = 0;
15540 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
15541 if (e) {
15542 log_packet_detailed("'production_kind' field error detected");
15543 }
15544 }
15545 if (BV_ISSET(fields, 28)) {
15546 log_packet_detailed(" field 'production_value' has changed");
15547#ifdef FREECIV_JSON_CONNECTION
15548 field_addr.name = "production_value";
15549#endif /* FREECIV_JSON_CONNECTION */
15550 e = 0;
15551 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
15552 if (e) {
15553 log_packet_detailed("'production_value' field error detected");
15554 }
15555 }
15556 if (BV_ISSET(fields, 29)) {
15557 log_packet_detailed(" field 'turn_founded' has changed");
15558#ifdef FREECIV_JSON_CONNECTION
15559 field_addr.name = "turn_founded";
15560#endif /* FREECIV_JSON_CONNECTION */
15561 e = 0;
15562 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
15563 if (e) {
15564 log_packet_detailed("'turn_founded' field error detected");
15565 }
15566 }
15567 if (BV_ISSET(fields, 30)) {
15568 log_packet_detailed(" field 'turn_last_built' has changed");
15569#ifdef FREECIV_JSON_CONNECTION
15570 field_addr.name = "turn_last_built";
15571#endif /* FREECIV_JSON_CONNECTION */
15572 e = 0;
15573 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
15574 if (e) {
15575 log_packet_detailed("'turn_last_built' field error detected");
15576 }
15577 }
15578 if (BV_ISSET(fields, 31)) {
15579 log_packet_detailed(" field 'changed_from_kind' has changed");
15580#ifdef FREECIV_JSON_CONNECTION
15581 field_addr.name = "changed_from_kind";
15582#endif /* FREECIV_JSON_CONNECTION */
15583 e = 0;
15584 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
15585 if (e) {
15586 log_packet_detailed("'changed_from_kind' field error detected");
15587 }
15588 }
15589 if (BV_ISSET(fields, 32)) {
15590 log_packet_detailed(" field 'changed_from_value' has changed");
15591#ifdef FREECIV_JSON_CONNECTION
15592 field_addr.name = "changed_from_value";
15593#endif /* FREECIV_JSON_CONNECTION */
15594 e = 0;
15595 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
15596 if (e) {
15597 log_packet_detailed("'changed_from_value' field error detected");
15598 }
15599 }
15600 if (BV_ISSET(fields, 33)) {
15601 log_packet_detailed(" field 'before_change_shields' has changed");
15602#ifdef FREECIV_JSON_CONNECTION
15603 field_addr.name = "before_change_shields";
15604#endif /* FREECIV_JSON_CONNECTION */
15605 e = 0;
15606 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
15607 if (e) {
15608 log_packet_detailed("'before_change_shields' field error detected");
15609 }
15610 }
15611 if (BV_ISSET(fields, 34)) {
15612 log_packet_detailed(" field 'disbanded_shields' has changed");
15613#ifdef FREECIV_JSON_CONNECTION
15614 field_addr.name = "disbanded_shields";
15615#endif /* FREECIV_JSON_CONNECTION */
15616 e = 0;
15617 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
15618 if (e) {
15619 log_packet_detailed("'disbanded_shields' field error detected");
15620 }
15621 }
15622 if (BV_ISSET(fields, 35)) {
15623 log_packet_detailed(" field 'caravan_shields' has changed");
15624#ifdef FREECIV_JSON_CONNECTION
15625 field_addr.name = "caravan_shields";
15626#endif /* FREECIV_JSON_CONNECTION */
15627 e = 0;
15628 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
15629 if (e) {
15630 log_packet_detailed("'caravan_shields' field error detected");
15631 }
15632 }
15633 if (BV_ISSET(fields, 36)) {
15634 log_packet_detailed(" field 'last_turns_shield_surplus' has changed");
15635#ifdef FREECIV_JSON_CONNECTION
15636 field_addr.name = "last_turns_shield_surplus";
15637#endif /* FREECIV_JSON_CONNECTION */
15638 e = 0;
15639 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
15640 if (e) {
15641 log_packet_detailed("'last_turns_shield_surplus' field error detected");
15642 }
15643 }
15644 if (BV_ISSET(fields, 37)) {
15645 log_packet_detailed(" field 'airlift' has changed");
15646#ifdef FREECIV_JSON_CONNECTION
15647 field_addr.name = "airlift";
15648#endif /* FREECIV_JSON_CONNECTION */
15649 e = 0;
15650 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
15651 if (e) {
15652 log_packet_detailed("'airlift' field error detected");
15653 }
15654 }
15655 /* field 38 is folded into the header */
15656 /* field 39 is folded into the header */
15657 /* field 40 is folded into the header */
15658 /* field 41 is folded into the header */
15659 /* field 42 is folded into the header */
15660 if (BV_ISSET(fields, 43)) {
15661 log_packet_detailed(" field 'walls' has changed");
15662#ifdef FREECIV_JSON_CONNECTION
15663 field_addr.name = "walls";
15664#endif /* FREECIV_JSON_CONNECTION */
15665 e = 0;
15666 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
15667 if (e) {
15668 log_packet_detailed("'walls' field error detected");
15669 }
15670 }
15671 if (BV_ISSET(fields, 44)) {
15672 log_packet_detailed(" field 'city_image' has changed");
15673#ifdef FREECIV_JSON_CONNECTION
15674 field_addr.name = "city_image";
15675#endif /* FREECIV_JSON_CONNECTION */
15676 e = 0;
15677 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
15678 if (e) {
15679 log_packet_detailed("'city_image' field error detected");
15680 }
15681 }
15682 if (BV_ISSET(fields, 45)) {
15683 log_packet_detailed(" field 'steal' has changed");
15684#ifdef FREECIV_JSON_CONNECTION
15685 field_addr.name = "steal";
15686#endif /* FREECIV_JSON_CONNECTION */
15687 e = 0;
15688 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
15689 if (e) {
15690 log_packet_detailed("'steal' field error detected");
15691 }
15692 }
15693 if (BV_ISSET(fields, 46)) {
15694 log_packet_detailed(" field 'worklist' has changed");
15695#ifdef FREECIV_JSON_CONNECTION
15696 field_addr.name = "worklist";
15697#endif /* FREECIV_JSON_CONNECTION */
15698 e = 0;
15699 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
15700 if (e) {
15701 log_packet_detailed("'worklist' field error detected");
15702 }
15703 }
15704 if (BV_ISSET(fields, 47)) {
15705 log_packet_detailed(" field 'improvements' has changed");
15706#ifdef FREECIV_JSON_CONNECTION
15707 field_addr.name = "improvements";
15708#endif /* FREECIV_JSON_CONNECTION */
15709 e = 0;
15710 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
15711 if (e) {
15712 log_packet_detailed("'improvements' field error detected");
15713 }
15714 }
15715 if (BV_ISSET(fields, 48)) {
15716 log_packet_detailed(" field 'city_options' has changed");
15717#ifdef FREECIV_JSON_CONNECTION
15718 field_addr.name = "city_options";
15719#endif /* FREECIV_JSON_CONNECTION */
15720 e = 0;
15721 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
15722 if (e) {
15723 log_packet_detailed("'city_options' field error detected");
15724 }
15725 }
15726 if (BV_ISSET(fields, 49)) {
15727 log_packet_detailed(" field 'name' has changed");
15728#ifdef FREECIV_JSON_CONNECTION
15729 field_addr.name = "name";
15730#endif /* FREECIV_JSON_CONNECTION */
15731 e = 0;
15732 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
15733 if (e) {
15734 log_packet_detailed("'name' field error detected");
15735 }
15736 }
15737
15738 *old = *real_packet;
15739
15740 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
15741 if (nullptr != *hash) {
15742 genhash_remove(*hash, real_packet);
15743 }
15744#endif /* FREECIV_DELTA_PROTOCOL */
15745#ifndef FREECIV_DELTA_PROTOCOL
15746#ifdef FREECIV_JSON_CONNECTION
15747 field_addr.name = "id";
15748#endif /* FREECIV_JSON_CONNECTION */
15749 e = 0;
15750 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
15751 if (e) {
15752 log_packet_detailed("'id' field error detected");
15753 }
15754#ifdef FREECIV_JSON_CONNECTION
15755 field_addr.name = "tile";
15756#endif /* FREECIV_JSON_CONNECTION */
15757 e = 0;
15758 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
15759 if (e) {
15760 log_packet_detailed("'tile' field error detected");
15761 }
15762#ifdef FREECIV_JSON_CONNECTION
15763 field_addr.name = "owner";
15764#endif /* FREECIV_JSON_CONNECTION */
15765 e = 0;
15766 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
15767 if (e) {
15768 log_packet_detailed("'owner' field error detected");
15769 }
15770#ifdef FREECIV_JSON_CONNECTION
15771 field_addr.name = "original";
15772#endif /* FREECIV_JSON_CONNECTION */
15773 e = 0;
15774 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->original);
15775 if (e) {
15776 log_packet_detailed("'original' field error detected");
15777 }
15778#ifdef FREECIV_JSON_CONNECTION
15779 field_addr.name = "size";
15780#endif /* FREECIV_JSON_CONNECTION */
15781 e = 0;
15782 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
15783 if (e) {
15784 log_packet_detailed("'size' field error detected");
15785 }
15786#ifdef FREECIV_JSON_CONNECTION
15787 field_addr.name = "city_radius_sq";
15788#endif /* FREECIV_JSON_CONNECTION */
15789 e = 0;
15790 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
15791 if (e) {
15792 log_packet_detailed("'city_radius_sq' field error detected");
15793 }
15794#ifdef FREECIV_JSON_CONNECTION
15795 field_addr.name = "style";
15796#endif /* FREECIV_JSON_CONNECTION */
15797 e = 0;
15798 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
15799 if (e) {
15800 log_packet_detailed("'style' field error detected");
15801 }
15802#ifdef FREECIV_JSON_CONNECTION
15803 field_addr.name = "capital";
15804#endif /* FREECIV_JSON_CONNECTION */
15805 e = 0;
15806 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
15807 if (e) {
15808 log_packet_detailed("'capital' field error detected");
15809 }
15810#ifdef FREECIV_JSON_CONNECTION
15811 field_addr.name = "ppl_happy";
15812#endif /* FREECIV_JSON_CONNECTION */
15813 e = 0;
15814 {
15815 int i;
15816
15817#ifdef FREECIV_JSON_CONNECTION
15818 /* Create the array. */
15819 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15820
15821 /* Enter the array. */
15822 field_addr.sub_location = plocation_elem_new(0);
15823#endif /* FREECIV_JSON_CONNECTION */
15824
15825 for (i = 0; i < FEELING_LAST; i++) {
15826#ifdef FREECIV_JSON_CONNECTION
15827 /* Next array element. */
15828 field_addr.sub_location->number = i;
15829#endif /* FREECIV_JSON_CONNECTION */
15830 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
15831 }
15832
15833#ifdef FREECIV_JSON_CONNECTION
15834 /* Exit array. */
15835 FC_FREE(field_addr.sub_location);
15836#endif /* FREECIV_JSON_CONNECTION */
15837 }
15838 if (e) {
15839 log_packet_detailed("'ppl_happy' field error detected");
15840 }
15841#ifdef FREECIV_JSON_CONNECTION
15842 field_addr.name = "ppl_content";
15843#endif /* FREECIV_JSON_CONNECTION */
15844 e = 0;
15845 {
15846 int i;
15847
15848#ifdef FREECIV_JSON_CONNECTION
15849 /* Create the array. */
15850 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15851
15852 /* Enter the array. */
15853 field_addr.sub_location = plocation_elem_new(0);
15854#endif /* FREECIV_JSON_CONNECTION */
15855
15856 for (i = 0; i < FEELING_LAST; i++) {
15857#ifdef FREECIV_JSON_CONNECTION
15858 /* Next array element. */
15859 field_addr.sub_location->number = i;
15860#endif /* FREECIV_JSON_CONNECTION */
15861 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
15862 }
15863
15864#ifdef FREECIV_JSON_CONNECTION
15865 /* Exit array. */
15866 FC_FREE(field_addr.sub_location);
15867#endif /* FREECIV_JSON_CONNECTION */
15868 }
15869 if (e) {
15870 log_packet_detailed("'ppl_content' field error detected");
15871 }
15872#ifdef FREECIV_JSON_CONNECTION
15873 field_addr.name = "ppl_unhappy";
15874#endif /* FREECIV_JSON_CONNECTION */
15875 e = 0;
15876 {
15877 int i;
15878
15879#ifdef FREECIV_JSON_CONNECTION
15880 /* Create the array. */
15881 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15882
15883 /* Enter the array. */
15884 field_addr.sub_location = plocation_elem_new(0);
15885#endif /* FREECIV_JSON_CONNECTION */
15886
15887 for (i = 0; i < FEELING_LAST; i++) {
15888#ifdef FREECIV_JSON_CONNECTION
15889 /* Next array element. */
15890 field_addr.sub_location->number = i;
15891#endif /* FREECIV_JSON_CONNECTION */
15892 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
15893 }
15894
15895#ifdef FREECIV_JSON_CONNECTION
15896 /* Exit array. */
15897 FC_FREE(field_addr.sub_location);
15898#endif /* FREECIV_JSON_CONNECTION */
15899 }
15900 if (e) {
15901 log_packet_detailed("'ppl_unhappy' field error detected");
15902 }
15903#ifdef FREECIV_JSON_CONNECTION
15904 field_addr.name = "ppl_angry";
15905#endif /* FREECIV_JSON_CONNECTION */
15906 e = 0;
15907 {
15908 int i;
15909
15910#ifdef FREECIV_JSON_CONNECTION
15911 /* Create the array. */
15912 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15913
15914 /* Enter the array. */
15915 field_addr.sub_location = plocation_elem_new(0);
15916#endif /* FREECIV_JSON_CONNECTION */
15917
15918 for (i = 0; i < FEELING_LAST; i++) {
15919#ifdef FREECIV_JSON_CONNECTION
15920 /* Next array element. */
15921 field_addr.sub_location->number = i;
15922#endif /* FREECIV_JSON_CONNECTION */
15923 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
15924 }
15925
15926#ifdef FREECIV_JSON_CONNECTION
15927 /* Exit array. */
15928 FC_FREE(field_addr.sub_location);
15929#endif /* FREECIV_JSON_CONNECTION */
15930 }
15931 if (e) {
15932 log_packet_detailed("'ppl_angry' field error detected");
15933 }
15934#ifdef FREECIV_JSON_CONNECTION
15935 field_addr.name = "specialists_size";
15936#endif /* FREECIV_JSON_CONNECTION */
15937 e = 0;
15938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
15939 if (e) {
15940 log_packet_detailed("'specialists_size' field error detected");
15941 }
15942#ifdef FREECIV_JSON_CONNECTION
15943 field_addr.name = "specialists";
15944#endif /* FREECIV_JSON_CONNECTION */
15945 e = 0;
15946 {
15947 int i;
15948
15949#ifdef FREECIV_JSON_CONNECTION
15950 /* Create the array. */
15951 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
15952
15953 /* Enter the array. */
15954 field_addr.sub_location = plocation_elem_new(0);
15955#endif /* FREECIV_JSON_CONNECTION */
15956
15957 for (i = 0; i < real_packet->specialists_size; i++) {
15958#ifdef FREECIV_JSON_CONNECTION
15959 /* Next array element. */
15960 field_addr.sub_location->number = i;
15961#endif /* FREECIV_JSON_CONNECTION */
15962 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
15963 }
15964
15965#ifdef FREECIV_JSON_CONNECTION
15966 /* Exit array. */
15967 FC_FREE(field_addr.sub_location);
15968#endif /* FREECIV_JSON_CONNECTION */
15969 }
15970 if (e) {
15971 log_packet_detailed("'specialists' field error detected");
15972 }
15973#ifdef FREECIV_JSON_CONNECTION
15974 field_addr.name = "history";
15975#endif /* FREECIV_JSON_CONNECTION */
15976 e = 0;
15977 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
15978 if (e) {
15979 log_packet_detailed("'history' field error detected");
15980 }
15981#ifdef FREECIV_JSON_CONNECTION
15982 field_addr.name = "culture";
15983#endif /* FREECIV_JSON_CONNECTION */
15984 e = 0;
15985 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
15986 if (e) {
15987 log_packet_detailed("'culture' field error detected");
15988 }
15989#ifdef FREECIV_JSON_CONNECTION
15990 field_addr.name = "buy_cost";
15991#endif /* FREECIV_JSON_CONNECTION */
15992 e = 0;
15993 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
15994 if (e) {
15995 log_packet_detailed("'buy_cost' field error detected");
15996 }
15997#ifdef FREECIV_JSON_CONNECTION
15998 field_addr.name = "surplus";
15999#endif /* FREECIV_JSON_CONNECTION */
16000 e = 0;
16001 {
16002 int i;
16003
16004#ifdef FREECIV_JSON_CONNECTION
16005 /* Create the array. */
16006 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
16007
16008 /* Enter the array. */
16009 field_addr.sub_location = plocation_elem_new(0);
16010#endif /* FREECIV_JSON_CONNECTION */
16011
16012 for (i = 0; i < O_LAST; i++) {
16013#ifdef FREECIV_JSON_CONNECTION
16014 /* Next array element. */
16015 field_addr.sub_location->number = i;
16016#endif /* FREECIV_JSON_CONNECTION */
16017 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
16018 }
16019
16020#ifdef FREECIV_JSON_CONNECTION
16021 /* Exit array. */
16022 FC_FREE(field_addr.sub_location);
16023#endif /* FREECIV_JSON_CONNECTION */
16024 }
16025 if (e) {
16026 log_packet_detailed("'surplus' field error detected");
16027 }
16028#ifdef FREECIV_JSON_CONNECTION
16029 field_addr.name = "waste";
16030#endif /* FREECIV_JSON_CONNECTION */
16031 e = 0;
16032 {
16033 int i;
16034
16035#ifdef FREECIV_JSON_CONNECTION
16036 /* Create the array. */
16037 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
16038
16039 /* Enter the array. */
16040 field_addr.sub_location = plocation_elem_new(0);
16041#endif /* FREECIV_JSON_CONNECTION */
16042
16043 for (i = 0; i < O_LAST; i++) {
16044#ifdef FREECIV_JSON_CONNECTION
16045 /* Next array element. */
16046 field_addr.sub_location->number = i;
16047#endif /* FREECIV_JSON_CONNECTION */
16048 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
16049 }
16050
16051#ifdef FREECIV_JSON_CONNECTION
16052 /* Exit array. */
16053 FC_FREE(field_addr.sub_location);
16054#endif /* FREECIV_JSON_CONNECTION */
16055 }
16056 if (e) {
16057 log_packet_detailed("'waste' field error detected");
16058 }
16059#ifdef FREECIV_JSON_CONNECTION
16060 field_addr.name = "unhappy_penalty";
16061#endif /* FREECIV_JSON_CONNECTION */
16062 e = 0;
16063 {
16064 int i;
16065
16066#ifdef FREECIV_JSON_CONNECTION
16067 /* Create the array. */
16068 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
16069
16070 /* Enter the array. */
16071 field_addr.sub_location = plocation_elem_new(0);
16072#endif /* FREECIV_JSON_CONNECTION */
16073
16074 for (i = 0; i < O_LAST; i++) {
16075#ifdef FREECIV_JSON_CONNECTION
16076 /* Next array element. */
16077 field_addr.sub_location->number = i;
16078#endif /* FREECIV_JSON_CONNECTION */
16079 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
16080 }
16081
16082#ifdef FREECIV_JSON_CONNECTION
16083 /* Exit array. */
16084 FC_FREE(field_addr.sub_location);
16085#endif /* FREECIV_JSON_CONNECTION */
16086 }
16087 if (e) {
16088 log_packet_detailed("'unhappy_penalty' field error detected");
16089 }
16090#ifdef FREECIV_JSON_CONNECTION
16091 field_addr.name = "prod";
16092#endif /* FREECIV_JSON_CONNECTION */
16093 e = 0;
16094 {
16095 int i;
16096
16097#ifdef FREECIV_JSON_CONNECTION
16098 /* Create the array. */
16099 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
16100
16101 /* Enter the array. */
16102 field_addr.sub_location = plocation_elem_new(0);
16103#endif /* FREECIV_JSON_CONNECTION */
16104
16105 for (i = 0; i < O_LAST; i++) {
16106#ifdef FREECIV_JSON_CONNECTION
16107 /* Next array element. */
16108 field_addr.sub_location->number = i;
16109#endif /* FREECIV_JSON_CONNECTION */
16110 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
16111 }
16112
16113#ifdef FREECIV_JSON_CONNECTION
16114 /* Exit array. */
16115 FC_FREE(field_addr.sub_location);
16116#endif /* FREECIV_JSON_CONNECTION */
16117 }
16118 if (e) {
16119 log_packet_detailed("'prod' field error detected");
16120 }
16121#ifdef FREECIV_JSON_CONNECTION
16122 field_addr.name = "citizen_base";
16123#endif /* FREECIV_JSON_CONNECTION */
16124 e = 0;
16125 {
16126 int i;
16127
16128#ifdef FREECIV_JSON_CONNECTION
16129 /* Create the array. */
16130 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
16131
16132 /* Enter the array. */
16133 field_addr.sub_location = plocation_elem_new(0);
16134#endif /* FREECIV_JSON_CONNECTION */
16135
16136 for (i = 0; i < O_LAST; i++) {
16137#ifdef FREECIV_JSON_CONNECTION
16138 /* Next array element. */
16139 field_addr.sub_location->number = i;
16140#endif /* FREECIV_JSON_CONNECTION */
16141 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
16142 }
16143
16144#ifdef FREECIV_JSON_CONNECTION
16145 /* Exit array. */
16146 FC_FREE(field_addr.sub_location);
16147#endif /* FREECIV_JSON_CONNECTION */
16148 }
16149 if (e) {
16150 log_packet_detailed("'citizen_base' field error detected");
16151 }
16152#ifdef FREECIV_JSON_CONNECTION
16153 field_addr.name = "usage";
16154#endif /* FREECIV_JSON_CONNECTION */
16155 e = 0;
16156 {
16157 int i;
16158
16159#ifdef FREECIV_JSON_CONNECTION
16160 /* Create the array. */
16161 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
16162
16163 /* Enter the array. */
16164 field_addr.sub_location = plocation_elem_new(0);
16165#endif /* FREECIV_JSON_CONNECTION */
16166
16167 for (i = 0; i < O_LAST; i++) {
16168#ifdef FREECIV_JSON_CONNECTION
16169 /* Next array element. */
16170 field_addr.sub_location->number = i;
16171#endif /* FREECIV_JSON_CONNECTION */
16172 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
16173 }
16174
16175#ifdef FREECIV_JSON_CONNECTION
16176 /* Exit array. */
16177 FC_FREE(field_addr.sub_location);
16178#endif /* FREECIV_JSON_CONNECTION */
16179 }
16180 if (e) {
16181 log_packet_detailed("'usage' field error detected");
16182 }
16183#ifdef FREECIV_JSON_CONNECTION
16184 field_addr.name = "food_stock";
16185#endif /* FREECIV_JSON_CONNECTION */
16186 e = 0;
16187 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
16188 if (e) {
16189 log_packet_detailed("'food_stock' field error detected");
16190 }
16191#ifdef FREECIV_JSON_CONNECTION
16192 field_addr.name = "shield_stock";
16193#endif /* FREECIV_JSON_CONNECTION */
16194 e = 0;
16195 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
16196 if (e) {
16197 log_packet_detailed("'shield_stock' field error detected");
16198 }
16199#ifdef FREECIV_JSON_CONNECTION
16200 field_addr.name = "trade_route_count";
16201#endif /* FREECIV_JSON_CONNECTION */
16202 e = 0;
16203 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
16204 if (e) {
16205 log_packet_detailed("'trade_route_count' field error detected");
16206 }
16207#ifdef FREECIV_JSON_CONNECTION
16208 field_addr.name = "pollution";
16209#endif /* FREECIV_JSON_CONNECTION */
16210 e = 0;
16211 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
16212 if (e) {
16213 log_packet_detailed("'pollution' field error detected");
16214 }
16215#ifdef FREECIV_JSON_CONNECTION
16216 field_addr.name = "illness_trade";
16217#endif /* FREECIV_JSON_CONNECTION */
16218 e = 0;
16219 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
16220 if (e) {
16221 log_packet_detailed("'illness_trade' field error detected");
16222 }
16223#ifdef FREECIV_JSON_CONNECTION
16224 field_addr.name = "production_kind";
16225#endif /* FREECIV_JSON_CONNECTION */
16226 e = 0;
16227 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
16228 if (e) {
16229 log_packet_detailed("'production_kind' field error detected");
16230 }
16231#ifdef FREECIV_JSON_CONNECTION
16232 field_addr.name = "production_value";
16233#endif /* FREECIV_JSON_CONNECTION */
16234 e = 0;
16235 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
16236 if (e) {
16237 log_packet_detailed("'production_value' field error detected");
16238 }
16239#ifdef FREECIV_JSON_CONNECTION
16240 field_addr.name = "turn_founded";
16241#endif /* FREECIV_JSON_CONNECTION */
16242 e = 0;
16243 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
16244 if (e) {
16245 log_packet_detailed("'turn_founded' field error detected");
16246 }
16247#ifdef FREECIV_JSON_CONNECTION
16248 field_addr.name = "turn_last_built";
16249#endif /* FREECIV_JSON_CONNECTION */
16250 e = 0;
16251 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
16252 if (e) {
16253 log_packet_detailed("'turn_last_built' field error detected");
16254 }
16255#ifdef FREECIV_JSON_CONNECTION
16256 field_addr.name = "changed_from_kind";
16257#endif /* FREECIV_JSON_CONNECTION */
16258 e = 0;
16259 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
16260 if (e) {
16261 log_packet_detailed("'changed_from_kind' field error detected");
16262 }
16263#ifdef FREECIV_JSON_CONNECTION
16264 field_addr.name = "changed_from_value";
16265#endif /* FREECIV_JSON_CONNECTION */
16266 e = 0;
16267 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
16268 if (e) {
16269 log_packet_detailed("'changed_from_value' field error detected");
16270 }
16271#ifdef FREECIV_JSON_CONNECTION
16272 field_addr.name = "before_change_shields";
16273#endif /* FREECIV_JSON_CONNECTION */
16274 e = 0;
16275 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
16276 if (e) {
16277 log_packet_detailed("'before_change_shields' field error detected");
16278 }
16279#ifdef FREECIV_JSON_CONNECTION
16280 field_addr.name = "disbanded_shields";
16281#endif /* FREECIV_JSON_CONNECTION */
16282 e = 0;
16283 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
16284 if (e) {
16285 log_packet_detailed("'disbanded_shields' field error detected");
16286 }
16287#ifdef FREECIV_JSON_CONNECTION
16288 field_addr.name = "caravan_shields";
16289#endif /* FREECIV_JSON_CONNECTION */
16290 e = 0;
16291 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
16292 if (e) {
16293 log_packet_detailed("'caravan_shields' field error detected");
16294 }
16295#ifdef FREECIV_JSON_CONNECTION
16296 field_addr.name = "last_turns_shield_surplus";
16297#endif /* FREECIV_JSON_CONNECTION */
16298 e = 0;
16299 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
16300 if (e) {
16301 log_packet_detailed("'last_turns_shield_surplus' field error detected");
16302 }
16303#ifdef FREECIV_JSON_CONNECTION
16304 field_addr.name = "airlift";
16305#endif /* FREECIV_JSON_CONNECTION */
16306 e = 0;
16307 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
16308 if (e) {
16309 log_packet_detailed("'airlift' field error detected");
16310 }
16311#ifdef FREECIV_JSON_CONNECTION
16312 field_addr.name = "did_buy";
16313#endif /* FREECIV_JSON_CONNECTION */
16314 e = 0;
16315 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
16316 if (e) {
16317 log_packet_detailed("'did_buy' field error detected");
16318 }
16319#ifdef FREECIV_JSON_CONNECTION
16320 field_addr.name = "did_sell";
16321#endif /* FREECIV_JSON_CONNECTION */
16322 e = 0;
16323 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
16324 if (e) {
16325 log_packet_detailed("'did_sell' field error detected");
16326 }
16327#ifdef FREECIV_JSON_CONNECTION
16328 field_addr.name = "was_happy";
16329#endif /* FREECIV_JSON_CONNECTION */
16330 e = 0;
16331 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
16332 if (e) {
16333 log_packet_detailed("'was_happy' field error detected");
16334 }
16335#ifdef FREECIV_JSON_CONNECTION
16336 field_addr.name = "had_famine";
16337#endif /* FREECIV_JSON_CONNECTION */
16338 e = 0;
16339 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->had_famine);
16340 if (e) {
16341 log_packet_detailed("'had_famine' field error detected");
16342 }
16343#ifdef FREECIV_JSON_CONNECTION
16344 field_addr.name = "diplomat_investigate";
16345#endif /* FREECIV_JSON_CONNECTION */
16346 e = 0;
16347 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->diplomat_investigate);
16348 if (e) {
16349 log_packet_detailed("'diplomat_investigate' field error detected");
16350 }
16351#ifdef FREECIV_JSON_CONNECTION
16352 field_addr.name = "walls";
16353#endif /* FREECIV_JSON_CONNECTION */
16354 e = 0;
16355 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
16356 if (e) {
16357 log_packet_detailed("'walls' field error detected");
16358 }
16359#ifdef FREECIV_JSON_CONNECTION
16360 field_addr.name = "city_image";
16361#endif /* FREECIV_JSON_CONNECTION */
16362 e = 0;
16363 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
16364 if (e) {
16365 log_packet_detailed("'city_image' field error detected");
16366 }
16367#ifdef FREECIV_JSON_CONNECTION
16368 field_addr.name = "steal";
16369#endif /* FREECIV_JSON_CONNECTION */
16370 e = 0;
16371 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
16372 if (e) {
16373 log_packet_detailed("'steal' field error detected");
16374 }
16375#ifdef FREECIV_JSON_CONNECTION
16376 field_addr.name = "worklist";
16377#endif /* FREECIV_JSON_CONNECTION */
16378 e = 0;
16379 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
16380 if (e) {
16381 log_packet_detailed("'worklist' field error detected");
16382 }
16383#ifdef FREECIV_JSON_CONNECTION
16384 field_addr.name = "improvements";
16385#endif /* FREECIV_JSON_CONNECTION */
16386 e = 0;
16387 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
16388 if (e) {
16389 log_packet_detailed("'improvements' field error detected");
16390 }
16391#ifdef FREECIV_JSON_CONNECTION
16392 field_addr.name = "city_options";
16393#endif /* FREECIV_JSON_CONNECTION */
16394 e = 0;
16395 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
16396 if (e) {
16397 log_packet_detailed("'city_options' field error detected");
16398 }
16399#ifdef FREECIV_JSON_CONNECTION
16400 field_addr.name = "name";
16401#endif /* FREECIV_JSON_CONNECTION */
16402 e = 0;
16403 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
16404 if (e) {
16405 log_packet_detailed("'name' field error detected");
16406 }
16407
16408#endif
16409 SEND_PACKET_END(PACKET_CITY_INFO);
16410}
16411
16412 int send_packet_city_info(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
16413{
16414 if (!pc->used) {
16415 log_error("WARNING: trying to send data to the closed connection %s",
16416 conn_description(pc));
16417 return -1;
16418 }
16419 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_INFO].force_to_send != nullptr, -1,
16420 "Handler for PACKET_CITY_INFO not installed");
16421 return pc->phs.handlers->send[PACKET_CITY_INFO].force_to_send(pc, packet, force_to_send);
16422}
16423
16424 void lsend_packet_city_info(struct conn_list *dest, const struct packet_city_info *packet, bool force_to_send)
16425{
16426 conn_list_iterate(dest, pconn) {
16427 send_packet_city_info(pconn, packet, force_to_send);
16428 } conn_list_iterate_end;
16429}
16430
16431 static inline void init_packet_city_nationalities(struct packet_city_nationalities *packet)
16432{
16433 memset(packet, 0, sizeof(*packet));
16434}
16435
16436#define free_packet_city_nationalities(_packet) (void) 0
16437#define destroy_packet_city_nationalities free
16438
16439#ifdef FREECIV_DELTA_PROTOCOL
16440static genhash_val_t hash_packet_city_nationalities_100(const void *vkey)
16441{
16442 const struct packet_city_nationalities *key = (const struct packet_city_nationalities *) vkey;
16443 genhash_val_t result = 0;
16444
16445 result += key->id;
16446
16447 result &= 0xFFFFFFFF;
16448 return result;
16449}
16450
16451static bool cmp_packet_city_nationalities_100(const void *vkey1, const void *vkey2)
16452{
16453 const struct packet_city_nationalities *old = (const struct packet_city_nationalities *) vkey1;
16454 const struct packet_city_nationalities *real_packet = (const struct packet_city_nationalities *) vkey2;
16455 bool differ;
16456
16457 differ = (old->id != real_packet->id);
16458
16459 return !differ;
16460}
16461 BV_DEFINE(packet_city_nationalities_100_fields, 3);
16462#endif /* FREECIV_DELTA_PROTOCOL */
16463
16464 static struct packet_city_nationalities *receive_packet_city_nationalities_100(struct connection *pc)
16465{
16466#define FREE_PACKET_STRUCT(_packet) free_packet_city_nationalities(_packet)
16467#ifdef FREECIV_DELTA_PROTOCOL
16468 packet_city_nationalities_100_fields fields;
16469 struct packet_city_nationalities *old;
16470 struct genhash **hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
16471#endif /* FREECIV_DELTA_PROTOCOL */
16472 RECEIVE_PACKET_START(packet_city_nationalities, real_packet);
16473#ifdef FREECIV_JSON_CONNECTION
16474 struct plocation field_addr;
16475 {
16476 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
16477 field_addr = *field_addr_tmp;
16478 FC_FREE(field_addr_tmp);
16479 }
16480#endif /* FREECIV_JSON_CONNECTION */
16481
16482#ifdef FREECIV_DELTA_PROTOCOL
16483#ifdef FREECIV_JSON_CONNECTION
16484 field_addr.name = "fields";
16485#endif /* FREECIV_JSON_CONNECTION */
16486 DIO_BV_GET(&din, &field_addr, fields);
16487#ifdef FREECIV_JSON_CONNECTION
16488 field_addr.name = "id";
16489#endif /* FREECIV_JSON_CONNECTION */
16490 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
16491 RECEIVE_PACKET_FIELD_ERROR(id);
16492 }
16493
16494#else /* FREECIV_DELTA_PROTOCOL */
16495#ifdef FREECIV_JSON_CONNECTION
16496 field_addr.name = "id";
16497#endif /* FREECIV_JSON_CONNECTION */
16498 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
16499 RECEIVE_PACKET_FIELD_ERROR(id);
16500 }
16501#ifdef FREECIV_JSON_CONNECTION
16502 field_addr.name = "nationalities_count";
16503#endif /* FREECIV_JSON_CONNECTION */
16504 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
16505 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
16506 }
16507#ifdef FREECIV_JSON_CONNECTION
16508 field_addr.name = "nation_id";
16509#endif /* FREECIV_JSON_CONNECTION */
16510 {
16511 int i;
16512
16513#ifdef FREECIV_JSON_CONNECTION
16514 /* Enter array. */
16515 field_addr.sub_location = plocation_elem_new(0);
16516#endif /* FREECIV_JSON_CONNECTION */
16517
16518 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16519 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
16520 }
16521 for (i = 0; i < real_packet->nationalities_count; i++) {
16522#ifdef FREECIV_JSON_CONNECTION
16523 field_addr.sub_location->number = i;
16524#endif /* FREECIV_JSON_CONNECTION */
16525 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nation_id[i])) {
16526 RECEIVE_PACKET_FIELD_ERROR(nation_id);
16527 }
16528 }
16529
16530#ifdef FREECIV_JSON_CONNECTION
16531 /* Exit array. */
16532 FC_FREE(field_addr.sub_location);
16533#endif /* FREECIV_JSON_CONNECTION */
16534 }
16535#ifdef FREECIV_JSON_CONNECTION
16536 field_addr.name = "nation_citizens";
16537#endif /* FREECIV_JSON_CONNECTION */
16538 {
16539 int i;
16540
16541#ifdef FREECIV_JSON_CONNECTION
16542 /* Enter array. */
16543 field_addr.sub_location = plocation_elem_new(0);
16544#endif /* FREECIV_JSON_CONNECTION */
16545
16546 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16547 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
16548 }
16549 for (i = 0; i < real_packet->nationalities_count; i++) {
16550#ifdef FREECIV_JSON_CONNECTION
16551 field_addr.sub_location->number = i;
16552#endif /* FREECIV_JSON_CONNECTION */
16553 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
16554 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
16555 }
16556 }
16557
16558#ifdef FREECIV_JSON_CONNECTION
16559 /* Exit array. */
16560 FC_FREE(field_addr.sub_location);
16561#endif /* FREECIV_JSON_CONNECTION */
16562 }
16563#endif
16564 log_packet_detailed("packet_city_nationalities_100: got info about (%d)",
16565 real_packet->id);
16566
16567#ifdef FREECIV_DELTA_PROTOCOL
16568 if (nullptr == *hash) {
16569 *hash = genhash_new_full(hash_packet_city_nationalities_100, cmp_packet_city_nationalities_100,
16570 nullptr, nullptr, nullptr, destroy_packet_city_nationalities);
16571 }
16572
16573 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
16574 *real_packet = *old;
16575 } else {
16576 /* packet is already initialized empty */
16577 log_packet_detailed(" no old info");
16578 }
16579
16580 if (BV_ISSET(fields, 0)) {
16581 log_packet_detailed(" got field 'nationalities_count'");
16582#ifdef FREECIV_JSON_CONNECTION
16583 field_addr.name = "nationalities_count";
16584#endif /* FREECIV_JSON_CONNECTION */
16585 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
16586 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
16587 }
16588 }
16589 if (BV_ISSET(fields, 1)) {
16590 log_packet_detailed(" got field 'nation_id'");
16591#ifdef FREECIV_JSON_CONNECTION
16592 field_addr.name = "nation_id";
16593#endif /* FREECIV_JSON_CONNECTION */
16594 {
16595 int i;
16596
16597#ifdef FREECIV_JSON_CONNECTION
16598 /* Enter array. */
16599 field_addr.sub_location = plocation_elem_new(0);
16600#endif /* FREECIV_JSON_CONNECTION */
16601
16602 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16603 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
16604 }
16605 for (i = 0; i < real_packet->nationalities_count; i++) {
16606#ifdef FREECIV_JSON_CONNECTION
16607 field_addr.sub_location->number = i;
16608#endif /* FREECIV_JSON_CONNECTION */
16609 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nation_id[i])) {
16610 RECEIVE_PACKET_FIELD_ERROR(nation_id);
16611 }
16612 }
16613
16614#ifdef FREECIV_JSON_CONNECTION
16615 /* Exit array. */
16616 FC_FREE(field_addr.sub_location);
16617#endif /* FREECIV_JSON_CONNECTION */
16618 }
16619 }
16620 if (BV_ISSET(fields, 2)) {
16621 log_packet_detailed(" got field 'nation_citizens'");
16622#ifdef FREECIV_JSON_CONNECTION
16623 field_addr.name = "nation_citizens";
16624#endif /* FREECIV_JSON_CONNECTION */
16625 {
16626 int i;
16627
16628#ifdef FREECIV_JSON_CONNECTION
16629 /* Enter array. */
16630 field_addr.sub_location = plocation_elem_new(0);
16631#endif /* FREECIV_JSON_CONNECTION */
16632
16633 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16634 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
16635 }
16636 for (i = 0; i < real_packet->nationalities_count; i++) {
16637#ifdef FREECIV_JSON_CONNECTION
16638 field_addr.sub_location->number = i;
16639#endif /* FREECIV_JSON_CONNECTION */
16640 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
16641 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
16642 }
16643 }
16644
16645#ifdef FREECIV_JSON_CONNECTION
16646 /* Exit array. */
16647 FC_FREE(field_addr.sub_location);
16648#endif /* FREECIV_JSON_CONNECTION */
16649 }
16650 }
16651
16652 if (nullptr == old) {
16653 old = fc_malloc(sizeof(*old));
16654 init_packet_city_nationalities(old);
16655 *old = *real_packet;
16656 genhash_insert(*hash, old, old);
16657 } else {
16658 *old = *real_packet;
16659 }
16660
16661#endif /* FREECIV_DELTA_PROTOCOL */
16662 RECEIVE_PACKET_END(real_packet);
16663#undef FREE_PACKET_STRUCT
16664}
16665
16666 static int send_packet_city_nationalities_100(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
16667{
16668 const struct packet_city_nationalities *real_packet = packet;
16669 int e;
16670#ifdef FREECIV_DELTA_PROTOCOL
16671 packet_city_nationalities_100_fields fields;
16672 struct packet_city_nationalities *old;
16673 bool differ;
16674 struct genhash **hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
16675 int different = force_to_send;
16676#endif /* FREECIV_DELTA_PROTOCOL */
16677 SEND_PACKET_START(PACKET_CITY_NATIONALITIES);
16678#ifdef FREECIV_JSON_CONNECTION
16679 struct plocation field_addr;
16680 {
16681 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
16682 field_addr = *field_addr_tmp;
16683 FC_FREE(field_addr_tmp);
16684 }
16685#endif /* FREECIV_JSON_CONNECTION */
16686
16687 log_packet_detailed("packet_city_nationalities_100: sending info about (%d)",
16688 real_packet->id);
16689
16690#ifdef FREECIV_DELTA_PROTOCOL
16691 if (nullptr == *hash) {
16692 *hash = genhash_new_full(hash_packet_city_nationalities_100, cmp_packet_city_nationalities_100,
16693 nullptr, nullptr, nullptr, destroy_packet_city_nationalities);
16694 }
16695 BV_CLR_ALL(fields);
16696
16697 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
16698 old = fc_malloc(sizeof(*old));
16699 /* temporary bitcopy just to insert correctly */
16700 *old = *real_packet;
16701 genhash_insert(*hash, old, old);
16702 init_packet_city_nationalities(old);
16703 different = 1; /* Force to send. */
16704 }
16705 differ = (old->nationalities_count != real_packet->nationalities_count);
16706 if (differ) {
16707 different++;
16708 BV_SET(fields, 0);
16709 }
16710
16711 differ = (old->nationalities_count != real_packet->nationalities_count);
16712 if (!differ) {
16713 int i;
16714
16715 for (i = 0; i < real_packet->nationalities_count; i++) {
16716 differ = (old->nation_id[i] != real_packet->nation_id[i]);
16717 if (differ) {
16718 break;
16719 }
16720 }
16721 }
16722 if (differ) {
16723 different++;
16724 BV_SET(fields, 1);
16725 }
16726
16727 differ = (old->nationalities_count != real_packet->nationalities_count);
16728 if (!differ) {
16729 int i;
16730
16731 for (i = 0; i < real_packet->nationalities_count; i++) {
16732 differ = (old->nation_citizens[i] != real_packet->nation_citizens[i]);
16733 if (differ) {
16734 break;
16735 }
16736 }
16737 }
16738 if (differ) {
16739 different++;
16740 BV_SET(fields, 2);
16741 }
16742
16743 if (different == 0) {
16744 log_packet_detailed(" no change -> discard");
16745 return 0;
16746 }
16747
16748#ifdef FREECIV_JSON_CONNECTION
16749 field_addr.name = "fields";
16750#endif /* FREECIV_JSON_CONNECTION */
16751 e = 0;
16752 e |= DIO_BV_PUT(&dout, &field_addr, fields);
16753 if (e) {
16754 log_packet_detailed("fields bitvector error detected");
16755 }
16756#ifdef FREECIV_JSON_CONNECTION
16757 field_addr.name = "id";
16758#endif /* FREECIV_JSON_CONNECTION */
16759 e = 0;
16760 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
16761 if (e) {
16762 log_packet_detailed("'id' field error detected");
16763 }
16764
16765 if (BV_ISSET(fields, 0)) {
16766 log_packet_detailed(" field 'nationalities_count' has changed");
16767#ifdef FREECIV_JSON_CONNECTION
16768 field_addr.name = "nationalities_count";
16769#endif /* FREECIV_JSON_CONNECTION */
16770 e = 0;
16771 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
16772 if (e) {
16773 log_packet_detailed("'nationalities_count' field error detected");
16774 }
16775 }
16776 if (BV_ISSET(fields, 1)) {
16777 log_packet_detailed(" field 'nation_id' has changed");
16778#ifdef FREECIV_JSON_CONNECTION
16779 field_addr.name = "nation_id";
16780#endif /* FREECIV_JSON_CONNECTION */
16781 e = 0;
16782 {
16783 int i;
16784
16785#ifdef FREECIV_JSON_CONNECTION
16786 /* Create the array. */
16787 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16788
16789 /* Enter the array. */
16790 field_addr.sub_location = plocation_elem_new(0);
16791#endif /* FREECIV_JSON_CONNECTION */
16792
16793 for (i = 0; i < real_packet->nationalities_count; i++) {
16794#ifdef FREECIV_JSON_CONNECTION
16795 /* Next array element. */
16796 field_addr.sub_location->number = i;
16797#endif /* FREECIV_JSON_CONNECTION */
16798 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_id[i]);
16799 }
16800
16801#ifdef FREECIV_JSON_CONNECTION
16802 /* Exit array. */
16803 FC_FREE(field_addr.sub_location);
16804#endif /* FREECIV_JSON_CONNECTION */
16805 }
16806 if (e) {
16807 log_packet_detailed("'nation_id' field error detected");
16808 }
16809 }
16810 if (BV_ISSET(fields, 2)) {
16811 log_packet_detailed(" field 'nation_citizens' has changed");
16812#ifdef FREECIV_JSON_CONNECTION
16813 field_addr.name = "nation_citizens";
16814#endif /* FREECIV_JSON_CONNECTION */
16815 e = 0;
16816 {
16817 int i;
16818
16819#ifdef FREECIV_JSON_CONNECTION
16820 /* Create the array. */
16821 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16822
16823 /* Enter the array. */
16824 field_addr.sub_location = plocation_elem_new(0);
16825#endif /* FREECIV_JSON_CONNECTION */
16826
16827 for (i = 0; i < real_packet->nationalities_count; i++) {
16828#ifdef FREECIV_JSON_CONNECTION
16829 /* Next array element. */
16830 field_addr.sub_location->number = i;
16831#endif /* FREECIV_JSON_CONNECTION */
16832 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
16833 }
16834
16835#ifdef FREECIV_JSON_CONNECTION
16836 /* Exit array. */
16837 FC_FREE(field_addr.sub_location);
16838#endif /* FREECIV_JSON_CONNECTION */
16839 }
16840 if (e) {
16841 log_packet_detailed("'nation_citizens' field error detected");
16842 }
16843 }
16844
16845 *old = *real_packet;
16846#endif /* FREECIV_DELTA_PROTOCOL */
16847#ifndef FREECIV_DELTA_PROTOCOL
16848#ifdef FREECIV_JSON_CONNECTION
16849 field_addr.name = "id";
16850#endif /* FREECIV_JSON_CONNECTION */
16851 e = 0;
16852 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
16853 if (e) {
16854 log_packet_detailed("'id' field error detected");
16855 }
16856#ifdef FREECIV_JSON_CONNECTION
16857 field_addr.name = "nationalities_count";
16858#endif /* FREECIV_JSON_CONNECTION */
16859 e = 0;
16860 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
16861 if (e) {
16862 log_packet_detailed("'nationalities_count' field error detected");
16863 }
16864#ifdef FREECIV_JSON_CONNECTION
16865 field_addr.name = "nation_id";
16866#endif /* FREECIV_JSON_CONNECTION */
16867 e = 0;
16868 {
16869 int i;
16870
16871#ifdef FREECIV_JSON_CONNECTION
16872 /* Create the array. */
16873 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16874
16875 /* Enter the array. */
16876 field_addr.sub_location = plocation_elem_new(0);
16877#endif /* FREECIV_JSON_CONNECTION */
16878
16879 for (i = 0; i < real_packet->nationalities_count; i++) {
16880#ifdef FREECIV_JSON_CONNECTION
16881 /* Next array element. */
16882 field_addr.sub_location->number = i;
16883#endif /* FREECIV_JSON_CONNECTION */
16884 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_id[i]);
16885 }
16886
16887#ifdef FREECIV_JSON_CONNECTION
16888 /* Exit array. */
16889 FC_FREE(field_addr.sub_location);
16890#endif /* FREECIV_JSON_CONNECTION */
16891 }
16892 if (e) {
16893 log_packet_detailed("'nation_id' field error detected");
16894 }
16895#ifdef FREECIV_JSON_CONNECTION
16896 field_addr.name = "nation_citizens";
16897#endif /* FREECIV_JSON_CONNECTION */
16898 e = 0;
16899 {
16900 int i;
16901
16902#ifdef FREECIV_JSON_CONNECTION
16903 /* Create the array. */
16904 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16905
16906 /* Enter the array. */
16907 field_addr.sub_location = plocation_elem_new(0);
16908#endif /* FREECIV_JSON_CONNECTION */
16909
16910 for (i = 0; i < real_packet->nationalities_count; i++) {
16911#ifdef FREECIV_JSON_CONNECTION
16912 /* Next array element. */
16913 field_addr.sub_location->number = i;
16914#endif /* FREECIV_JSON_CONNECTION */
16915 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
16916 }
16917
16918#ifdef FREECIV_JSON_CONNECTION
16919 /* Exit array. */
16920 FC_FREE(field_addr.sub_location);
16921#endif /* FREECIV_JSON_CONNECTION */
16922 }
16923 if (e) {
16924 log_packet_detailed("'nation_citizens' field error detected");
16925 }
16926
16927#endif
16928 SEND_PACKET_END(PACKET_CITY_NATIONALITIES);
16929}
16930
16931 int send_packet_city_nationalities(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
16932{
16933 if (!pc->used) {
16934 log_error("WARNING: trying to send data to the closed connection %s",
16935 conn_description(pc));
16936 return -1;
16937 }
16938 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NATIONALITIES].force_to_send != nullptr, -1,
16939 "Handler for PACKET_CITY_NATIONALITIES not installed");
16940 return pc->phs.handlers->send[PACKET_CITY_NATIONALITIES].force_to_send(pc, packet, force_to_send);
16941}
16942
16943 void lsend_packet_city_nationalities(struct conn_list *dest, const struct packet_city_nationalities *packet, bool force_to_send)
16944{
16945 conn_list_iterate(dest, pconn) {
16946 send_packet_city_nationalities(pconn, packet, force_to_send);
16947 } conn_list_iterate_end;
16948}
16949
16950 static inline void init_packet_city_update_counters(struct packet_city_update_counters *packet)
16951{
16952 memset(packet, 0, sizeof(*packet));
16953}
16954
16955#define free_packet_city_update_counters(_packet) (void) 0
16956#define destroy_packet_city_update_counters free
16957
16958#ifdef FREECIV_DELTA_PROTOCOL
16959static genhash_val_t hash_packet_city_update_counters_100(const void *vkey)
16960{
16961 const struct packet_city_update_counters *key = (const struct packet_city_update_counters *) vkey;
16962 genhash_val_t result = 0;
16963
16964 result += key->city;
16965
16966 result &= 0xFFFFFFFF;
16967 return result;
16968}
16969
16970static bool cmp_packet_city_update_counters_100(const void *vkey1, const void *vkey2)
16971{
16972 const struct packet_city_update_counters *old = (const struct packet_city_update_counters *) vkey1;
16973 const struct packet_city_update_counters *real_packet = (const struct packet_city_update_counters *) vkey2;
16974 bool differ;
16975
16976 differ = (old->city != real_packet->city);
16977
16978 return !differ;
16979}
16980 BV_DEFINE(packet_city_update_counters_100_fields, 2);
16981#endif /* FREECIV_DELTA_PROTOCOL */
16982
16983 static struct packet_city_update_counters *receive_packet_city_update_counters_100(struct connection *pc)
16984{
16985#define FREE_PACKET_STRUCT(_packet) free_packet_city_update_counters(_packet)
16986#ifdef FREECIV_DELTA_PROTOCOL
16987 packet_city_update_counters_100_fields fields;
16988 struct packet_city_update_counters *old;
16989 struct genhash **hash = pc->phs.received + PACKET_CITY_UPDATE_COUNTERS;
16990#endif /* FREECIV_DELTA_PROTOCOL */
16991 RECEIVE_PACKET_START(packet_city_update_counters, real_packet);
16992#ifdef FREECIV_JSON_CONNECTION
16993 struct plocation field_addr;
16994 {
16995 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
16996 field_addr = *field_addr_tmp;
16997 FC_FREE(field_addr_tmp);
16998 }
16999#endif /* FREECIV_JSON_CONNECTION */
17000
17001#ifdef FREECIV_DELTA_PROTOCOL
17002#ifdef FREECIV_JSON_CONNECTION
17003 field_addr.name = "fields";
17004#endif /* FREECIV_JSON_CONNECTION */
17005 DIO_BV_GET(&din, &field_addr, fields);
17006#ifdef FREECIV_JSON_CONNECTION
17007 field_addr.name = "city";
17008#endif /* FREECIV_JSON_CONNECTION */
17009 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
17010 RECEIVE_PACKET_FIELD_ERROR(city);
17011 }
17012
17013#else /* FREECIV_DELTA_PROTOCOL */
17014#ifdef FREECIV_JSON_CONNECTION
17015 field_addr.name = "city";
17016#endif /* FREECIV_JSON_CONNECTION */
17017 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
17018 RECEIVE_PACKET_FIELD_ERROR(city);
17019 }
17020#ifdef FREECIV_JSON_CONNECTION
17021 field_addr.name = "count";
17022#endif /* FREECIV_JSON_CONNECTION */
17023 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
17024 RECEIVE_PACKET_FIELD_ERROR(count);
17025 }
17026#ifdef FREECIV_JSON_CONNECTION
17027 field_addr.name = "counters";
17028#endif /* FREECIV_JSON_CONNECTION */
17029 {
17030 int i;
17031
17032#ifdef FREECIV_JSON_CONNECTION
17033 /* Enter array. */
17034 field_addr.sub_location = plocation_elem_new(0);
17035#endif /* FREECIV_JSON_CONNECTION */
17036
17037 if (real_packet->count > MAX_COUNTERS) {
17038 RECEIVE_PACKET_FIELD_ERROR(counters, ": truncation array");
17039 }
17040 for (i = 0; i < real_packet->count; i++) {
17041#ifdef FREECIV_JSON_CONNECTION
17042 field_addr.sub_location->number = i;
17043#endif /* FREECIV_JSON_CONNECTION */
17044 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->counters[i])) {
17045 RECEIVE_PACKET_FIELD_ERROR(counters);
17046 }
17047 }
17048
17049#ifdef FREECIV_JSON_CONNECTION
17050 /* Exit array. */
17051 FC_FREE(field_addr.sub_location);
17052#endif /* FREECIV_JSON_CONNECTION */
17053 }
17054#endif
17055 log_packet_detailed("packet_city_update_counters_100: got info about (%d)",
17056 real_packet->city);
17057
17058#ifdef FREECIV_DELTA_PROTOCOL
17059 if (nullptr == *hash) {
17060 *hash = genhash_new_full(hash_packet_city_update_counters_100, cmp_packet_city_update_counters_100,
17061 nullptr, nullptr, nullptr, destroy_packet_city_update_counters);
17062 }
17063
17064 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
17065 *real_packet = *old;
17066 } else {
17067 /* packet is already initialized empty */
17068 log_packet_detailed(" no old info");
17069 }
17070
17071 if (BV_ISSET(fields, 0)) {
17072 log_packet_detailed(" got field 'count'");
17073#ifdef FREECIV_JSON_CONNECTION
17074 field_addr.name = "count";
17075#endif /* FREECIV_JSON_CONNECTION */
17076 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
17077 RECEIVE_PACKET_FIELD_ERROR(count);
17078 }
17079 }
17080 if (BV_ISSET(fields, 1)) {
17081 log_packet_detailed(" got field 'counters'");
17082#ifdef FREECIV_JSON_CONNECTION
17083 field_addr.name = "counters";
17084#endif /* FREECIV_JSON_CONNECTION */
17085 {
17086 int i;
17087
17088#ifdef FREECIV_JSON_CONNECTION
17089 /* Enter array. */
17090 field_addr.sub_location = plocation_elem_new(0);
17091#endif /* FREECIV_JSON_CONNECTION */
17092
17093 if (real_packet->count > MAX_COUNTERS) {
17094 RECEIVE_PACKET_FIELD_ERROR(counters, ": truncation array");
17095 }
17096 for (i = 0; i < real_packet->count; i++) {
17097#ifdef FREECIV_JSON_CONNECTION
17098 field_addr.sub_location->number = i;
17099#endif /* FREECIV_JSON_CONNECTION */
17100 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->counters[i])) {
17101 RECEIVE_PACKET_FIELD_ERROR(counters);
17102 }
17103 }
17104
17105#ifdef FREECIV_JSON_CONNECTION
17106 /* Exit array. */
17107 FC_FREE(field_addr.sub_location);
17108#endif /* FREECIV_JSON_CONNECTION */
17109 }
17110 }
17111
17112 if (nullptr == old) {
17113 old = fc_malloc(sizeof(*old));
17114 init_packet_city_update_counters(old);
17115 *old = *real_packet;
17116 genhash_insert(*hash, old, old);
17117 } else {
17118 *old = *real_packet;
17119 }
17120
17121#endif /* FREECIV_DELTA_PROTOCOL */
17122 RECEIVE_PACKET_END(real_packet);
17123#undef FREE_PACKET_STRUCT
17124}
17125
17126 static int send_packet_city_update_counters_100(struct connection *pc, const struct packet_city_update_counters *packet)
17127{
17128 const struct packet_city_update_counters *real_packet = packet;
17129 int e;
17130#ifdef FREECIV_DELTA_PROTOCOL
17131 packet_city_update_counters_100_fields fields;
17132 struct packet_city_update_counters *old;
17133 bool differ;
17134 struct genhash **hash = pc->phs.sent + PACKET_CITY_UPDATE_COUNTERS;
17135 int different = 0;
17136#endif /* FREECIV_DELTA_PROTOCOL */
17137 SEND_PACKET_START(PACKET_CITY_UPDATE_COUNTERS);
17138#ifdef FREECIV_JSON_CONNECTION
17139 struct plocation field_addr;
17140 {
17141 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
17142 field_addr = *field_addr_tmp;
17143 FC_FREE(field_addr_tmp);
17144 }
17145#endif /* FREECIV_JSON_CONNECTION */
17146
17147 log_packet_detailed("packet_city_update_counters_100: sending info about (%d)",
17148 real_packet->city);
17149
17150#ifdef FREECIV_DELTA_PROTOCOL
17151 if (nullptr == *hash) {
17152 *hash = genhash_new_full(hash_packet_city_update_counters_100, cmp_packet_city_update_counters_100,
17153 nullptr, nullptr, nullptr, destroy_packet_city_update_counters);
17154 }
17155 BV_CLR_ALL(fields);
17156
17157 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
17158 old = fc_malloc(sizeof(*old));
17159 /* temporary bitcopy just to insert correctly */
17160 *old = *real_packet;
17161 genhash_insert(*hash, old, old);
17162 init_packet_city_update_counters(old);
17163 different = 1; /* Force to send. */
17164 }
17165 differ = (old->count != real_packet->count);
17166 if (differ) {
17167 different++;
17168 BV_SET(fields, 0);
17169 }
17170
17171 differ = (old->count != real_packet->count);
17172 if (!differ) {
17173 int i;
17174
17175 for (i = 0; i < real_packet->count; i++) {
17176 differ = (old->counters[i] != real_packet->counters[i]);
17177 if (differ) {
17178 break;
17179 }
17180 }
17181 }
17182 if (differ) {
17183 different++;
17184 BV_SET(fields, 1);
17185 }
17186
17187 if (different == 0) {
17188 log_packet_detailed(" no change -> discard");
17189 return 0;
17190 }
17191
17192#ifdef FREECIV_JSON_CONNECTION
17193 field_addr.name = "fields";
17194#endif /* FREECIV_JSON_CONNECTION */
17195 e = 0;
17196 e |= DIO_BV_PUT(&dout, &field_addr, fields);
17197 if (e) {
17198 log_packet_detailed("fields bitvector error detected");
17199 }
17200#ifdef FREECIV_JSON_CONNECTION
17201 field_addr.name = "city";
17202#endif /* FREECIV_JSON_CONNECTION */
17203 e = 0;
17204 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
17205 if (e) {
17206 log_packet_detailed("'city' field error detected");
17207 }
17208
17209 if (BV_ISSET(fields, 0)) {
17210 log_packet_detailed(" field 'count' has changed");
17211#ifdef FREECIV_JSON_CONNECTION
17212 field_addr.name = "count";
17213#endif /* FREECIV_JSON_CONNECTION */
17214 e = 0;
17215 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
17216 if (e) {
17217 log_packet_detailed("'count' field error detected");
17218 }
17219 }
17220 if (BV_ISSET(fields, 1)) {
17221 log_packet_detailed(" field 'counters' has changed");
17222#ifdef FREECIV_JSON_CONNECTION
17223 field_addr.name = "counters";
17224#endif /* FREECIV_JSON_CONNECTION */
17225 e = 0;
17226 {
17227 int i;
17228
17229#ifdef FREECIV_JSON_CONNECTION
17230 /* Create the array. */
17231 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
17232
17233 /* Enter the array. */
17234 field_addr.sub_location = plocation_elem_new(0);
17235#endif /* FREECIV_JSON_CONNECTION */
17236
17237 for (i = 0; i < real_packet->count; i++) {
17238#ifdef FREECIV_JSON_CONNECTION
17239 /* Next array element. */
17240 field_addr.sub_location->number = i;
17241#endif /* FREECIV_JSON_CONNECTION */
17242 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->counters[i]);
17243 }
17244
17245#ifdef FREECIV_JSON_CONNECTION
17246 /* Exit array. */
17247 FC_FREE(field_addr.sub_location);
17248#endif /* FREECIV_JSON_CONNECTION */
17249 }
17250 if (e) {
17251 log_packet_detailed("'counters' field error detected");
17252 }
17253 }
17254
17255 *old = *real_packet;
17256#endif /* FREECIV_DELTA_PROTOCOL */
17257#ifndef FREECIV_DELTA_PROTOCOL
17258#ifdef FREECIV_JSON_CONNECTION
17259 field_addr.name = "city";
17260#endif /* FREECIV_JSON_CONNECTION */
17261 e = 0;
17262 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
17263 if (e) {
17264 log_packet_detailed("'city' field error detected");
17265 }
17266#ifdef FREECIV_JSON_CONNECTION
17267 field_addr.name = "count";
17268#endif /* FREECIV_JSON_CONNECTION */
17269 e = 0;
17270 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
17271 if (e) {
17272 log_packet_detailed("'count' field error detected");
17273 }
17274#ifdef FREECIV_JSON_CONNECTION
17275 field_addr.name = "counters";
17276#endif /* FREECIV_JSON_CONNECTION */
17277 e = 0;
17278 {
17279 int i;
17280
17281#ifdef FREECIV_JSON_CONNECTION
17282 /* Create the array. */
17283 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
17284
17285 /* Enter the array. */
17286 field_addr.sub_location = plocation_elem_new(0);
17287#endif /* FREECIV_JSON_CONNECTION */
17288
17289 for (i = 0; i < real_packet->count; i++) {
17290#ifdef FREECIV_JSON_CONNECTION
17291 /* Next array element. */
17292 field_addr.sub_location->number = i;
17293#endif /* FREECIV_JSON_CONNECTION */
17294 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->counters[i]);
17295 }
17296
17297#ifdef FREECIV_JSON_CONNECTION
17298 /* Exit array. */
17299 FC_FREE(field_addr.sub_location);
17300#endif /* FREECIV_JSON_CONNECTION */
17301 }
17302 if (e) {
17303 log_packet_detailed("'counters' field error detected");
17304 }
17305
17306#endif
17307 SEND_PACKET_END(PACKET_CITY_UPDATE_COUNTERS);
17308}
17309
17310 int send_packet_city_update_counters(struct connection *pc, const struct packet_city_update_counters *packet)
17311{
17312 if (!pc->used) {
17313 log_error("WARNING: trying to send data to the closed connection %s",
17314 conn_description(pc));
17315 return -1;
17316 }
17317 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_UPDATE_COUNTERS].packet != nullptr, -1,
17318 "Handler for PACKET_CITY_UPDATE_COUNTERS not installed");
17319 return pc->phs.handlers->send[PACKET_CITY_UPDATE_COUNTERS].packet(pc, packet);
17320}
17321
17322 void lsend_packet_city_update_counters(struct conn_list *dest, const struct packet_city_update_counters *packet)
17323{
17324 conn_list_iterate(dest, pconn) {
17325 send_packet_city_update_counters(pconn, packet);
17326 } conn_list_iterate_end;
17327}
17328
17329 static inline void init_packet_city_short_info(struct packet_city_short_info *packet)
17330{
17331 memset(packet, 0, sizeof(*packet));
17332}
17333
17334#define free_packet_city_short_info(_packet) (void) 0
17335#define destroy_packet_city_short_info free
17336
17337#ifdef FREECIV_DELTA_PROTOCOL
17338static genhash_val_t hash_packet_city_short_info_100(const void *vkey)
17339{
17340 const struct packet_city_short_info *key = (const struct packet_city_short_info *) vkey;
17341 genhash_val_t result = 0;
17342
17343 result += key->id;
17344
17345 result &= 0xFFFFFFFF;
17346 return result;
17347}
17348
17349static bool cmp_packet_city_short_info_100(const void *vkey1, const void *vkey2)
17350{
17351 const struct packet_city_short_info *old = (const struct packet_city_short_info *) vkey1;
17352 const struct packet_city_short_info *real_packet = (const struct packet_city_short_info *) vkey2;
17353 bool differ;
17354
17355 differ = (old->id != real_packet->id);
17356
17357 return !differ;
17358}
17359 BV_DEFINE(packet_city_short_info_100_fields, 12);
17360#endif /* FREECIV_DELTA_PROTOCOL */
17361
17362 static struct packet_city_short_info *receive_packet_city_short_info_100(struct connection *pc)
17363{
17364#define FREE_PACKET_STRUCT(_packet) free_packet_city_short_info(_packet)
17365#ifdef FREECIV_DELTA_PROTOCOL
17366 packet_city_short_info_100_fields fields;
17367 struct packet_city_short_info *old;
17368 struct genhash **hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
17369#endif /* FREECIV_DELTA_PROTOCOL */
17370 RECEIVE_PACKET_START(packet_city_short_info, real_packet);
17371#ifdef FREECIV_JSON_CONNECTION
17372 struct plocation field_addr;
17373 {
17374 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
17375 field_addr = *field_addr_tmp;
17376 FC_FREE(field_addr_tmp);
17377 }
17378#endif /* FREECIV_JSON_CONNECTION */
17379
17380#ifdef FREECIV_DELTA_PROTOCOL
17381#ifdef FREECIV_JSON_CONNECTION
17382 field_addr.name = "fields";
17383#endif /* FREECIV_JSON_CONNECTION */
17384 DIO_BV_GET(&din, &field_addr, fields);
17385#ifdef FREECIV_JSON_CONNECTION
17386 field_addr.name = "id";
17387#endif /* FREECIV_JSON_CONNECTION */
17388 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
17389 RECEIVE_PACKET_FIELD_ERROR(id);
17390 }
17391
17392#else /* FREECIV_DELTA_PROTOCOL */
17393#ifdef FREECIV_JSON_CONNECTION
17394 field_addr.name = "id";
17395#endif /* FREECIV_JSON_CONNECTION */
17396 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
17397 RECEIVE_PACKET_FIELD_ERROR(id);
17398 }
17399#ifdef FREECIV_JSON_CONNECTION
17400 field_addr.name = "tile";
17401#endif /* FREECIV_JSON_CONNECTION */
17402 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
17403 RECEIVE_PACKET_FIELD_ERROR(tile);
17404 }
17405#ifdef FREECIV_JSON_CONNECTION
17406 field_addr.name = "owner";
17407#endif /* FREECIV_JSON_CONNECTION */
17408 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
17409 RECEIVE_PACKET_FIELD_ERROR(owner);
17410 }
17411#ifdef FREECIV_JSON_CONNECTION
17412 field_addr.name = "size";
17413#endif /* FREECIV_JSON_CONNECTION */
17414 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
17415 RECEIVE_PACKET_FIELD_ERROR(size);
17416 }
17417#ifdef FREECIV_JSON_CONNECTION
17418 field_addr.name = "style";
17419#endif /* FREECIV_JSON_CONNECTION */
17420 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
17421 RECEIVE_PACKET_FIELD_ERROR(style);
17422 }
17423#ifdef FREECIV_JSON_CONNECTION
17424 field_addr.name = "capital";
17425#endif /* FREECIV_JSON_CONNECTION */
17426 {
17427 int readin;
17428
17429 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17430 RECEIVE_PACKET_FIELD_ERROR(capital);
17431 }
17432 real_packet->capital = readin;
17433 }
17434#ifdef FREECIV_JSON_CONNECTION
17435 field_addr.name = "occupied";
17436#endif /* FREECIV_JSON_CONNECTION */
17437 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
17438 RECEIVE_PACKET_FIELD_ERROR(occupied);
17439 }
17440#ifdef FREECIV_JSON_CONNECTION
17441 field_addr.name = "walls";
17442#endif /* FREECIV_JSON_CONNECTION */
17443 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
17444 RECEIVE_PACKET_FIELD_ERROR(walls);
17445 }
17446#ifdef FREECIV_JSON_CONNECTION
17447 field_addr.name = "happy";
17448#endif /* FREECIV_JSON_CONNECTION */
17449 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->happy)) {
17450 RECEIVE_PACKET_FIELD_ERROR(happy);
17451 }
17452#ifdef FREECIV_JSON_CONNECTION
17453 field_addr.name = "unhappy";
17454#endif /* FREECIV_JSON_CONNECTION */
17455 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unhappy)) {
17456 RECEIVE_PACKET_FIELD_ERROR(unhappy);
17457 }
17458#ifdef FREECIV_JSON_CONNECTION
17459 field_addr.name = "city_image";
17460#endif /* FREECIV_JSON_CONNECTION */
17461 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
17462 RECEIVE_PACKET_FIELD_ERROR(city_image);
17463 }
17464#ifdef FREECIV_JSON_CONNECTION
17465 field_addr.name = "improvements";
17466#endif /* FREECIV_JSON_CONNECTION */
17467 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
17468 RECEIVE_PACKET_FIELD_ERROR(improvements);
17469 }
17470#ifdef FREECIV_JSON_CONNECTION
17471 field_addr.name = "name";
17472#endif /* FREECIV_JSON_CONNECTION */
17473 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
17474 RECEIVE_PACKET_FIELD_ERROR(name);
17475 }
17476#endif
17477 log_packet_detailed("packet_city_short_info_100: got info about (%d)",
17478 real_packet->id);
17479
17480#ifdef FREECIV_DELTA_PROTOCOL
17481 if (nullptr == *hash) {
17482 *hash = genhash_new_full(hash_packet_city_short_info_100, cmp_packet_city_short_info_100,
17483 nullptr, nullptr, nullptr, destroy_packet_city_short_info);
17484 }
17485
17486 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
17487 *real_packet = *old;
17488 } else {
17489 /* packet is already initialized empty */
17490 log_packet_detailed(" no old info");
17491 }
17492
17493 if (BV_ISSET(fields, 0)) {
17494 log_packet_detailed(" got field 'tile'");
17495#ifdef FREECIV_JSON_CONNECTION
17496 field_addr.name = "tile";
17497#endif /* FREECIV_JSON_CONNECTION */
17498 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
17499 RECEIVE_PACKET_FIELD_ERROR(tile);
17500 }
17501 }
17502 if (BV_ISSET(fields, 1)) {
17503 log_packet_detailed(" got field 'owner'");
17504#ifdef FREECIV_JSON_CONNECTION
17505 field_addr.name = "owner";
17506#endif /* FREECIV_JSON_CONNECTION */
17507 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
17508 RECEIVE_PACKET_FIELD_ERROR(owner);
17509 }
17510 }
17511 if (BV_ISSET(fields, 2)) {
17512 log_packet_detailed(" got field 'size'");
17513#ifdef FREECIV_JSON_CONNECTION
17514 field_addr.name = "size";
17515#endif /* FREECIV_JSON_CONNECTION */
17516 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
17517 RECEIVE_PACKET_FIELD_ERROR(size);
17518 }
17519 }
17520 if (BV_ISSET(fields, 3)) {
17521 log_packet_detailed(" got field 'style'");
17522#ifdef FREECIV_JSON_CONNECTION
17523 field_addr.name = "style";
17524#endif /* FREECIV_JSON_CONNECTION */
17525 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
17526 RECEIVE_PACKET_FIELD_ERROR(style);
17527 }
17528 }
17529 if (BV_ISSET(fields, 4)) {
17530 log_packet_detailed(" got field 'capital'");
17531#ifdef FREECIV_JSON_CONNECTION
17532 field_addr.name = "capital";
17533#endif /* FREECIV_JSON_CONNECTION */
17534 {
17535 int readin;
17536
17537 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17538 RECEIVE_PACKET_FIELD_ERROR(capital);
17539 }
17540 real_packet->capital = readin;
17541 }
17542 }
17543 real_packet->occupied = BV_ISSET(fields, 5);
17544 if (BV_ISSET(fields, 6)) {
17545 log_packet_detailed(" got field 'walls'");
17546#ifdef FREECIV_JSON_CONNECTION
17547 field_addr.name = "walls";
17548#endif /* FREECIV_JSON_CONNECTION */
17549 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
17550 RECEIVE_PACKET_FIELD_ERROR(walls);
17551 }
17552 }
17553 real_packet->happy = BV_ISSET(fields, 7);
17554 real_packet->unhappy = BV_ISSET(fields, 8);
17555 if (BV_ISSET(fields, 9)) {
17556 log_packet_detailed(" got field 'city_image'");
17557#ifdef FREECIV_JSON_CONNECTION
17558 field_addr.name = "city_image";
17559#endif /* FREECIV_JSON_CONNECTION */
17560 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
17561 RECEIVE_PACKET_FIELD_ERROR(city_image);
17562 }
17563 }
17564 if (BV_ISSET(fields, 10)) {
17565 log_packet_detailed(" got field 'improvements'");
17566#ifdef FREECIV_JSON_CONNECTION
17567 field_addr.name = "improvements";
17568#endif /* FREECIV_JSON_CONNECTION */
17569 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
17570 RECEIVE_PACKET_FIELD_ERROR(improvements);
17571 }
17572 }
17573 if (BV_ISSET(fields, 11)) {
17574 log_packet_detailed(" got field 'name'");
17575#ifdef FREECIV_JSON_CONNECTION
17576 field_addr.name = "name";
17577#endif /* FREECIV_JSON_CONNECTION */
17578 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
17579 RECEIVE_PACKET_FIELD_ERROR(name);
17580 }
17581 }
17582
17583 if (nullptr == old) {
17584 old = fc_malloc(sizeof(*old));
17585 init_packet_city_short_info(old);
17586 *old = *real_packet;
17587 genhash_insert(*hash, old, old);
17588 } else {
17589 *old = *real_packet;
17590 }
17591
17592 hash = pc->phs.received + PACKET_CITY_INFO;
17593 if (nullptr != *hash) {
17594 genhash_remove(*hash, real_packet);
17595 }
17596
17597 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
17598 if (nullptr != *hash) {
17599 genhash_remove(*hash, real_packet);
17600 }
17601
17602 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
17603 if (nullptr != *hash) {
17604 genhash_remove(*hash, real_packet);
17605 }
17606
17607 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
17608 if (nullptr != *hash) {
17609 genhash_remove(*hash, real_packet);
17610 }
17611
17612#endif /* FREECIV_DELTA_PROTOCOL */
17613 RECEIVE_PACKET_END(real_packet);
17614#undef FREE_PACKET_STRUCT
17615}
17616
17617 static int send_packet_city_short_info_100(struct connection *pc, const struct packet_city_short_info *packet)
17618{
17619 const struct packet_city_short_info *real_packet = packet;
17620 int e;
17621#ifdef FREECIV_DELTA_PROTOCOL
17622 packet_city_short_info_100_fields fields;
17623 struct packet_city_short_info *old;
17624 bool differ;
17625 struct genhash **hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
17626 int different = 0;
17627#endif /* FREECIV_DELTA_PROTOCOL */
17628 SEND_PACKET_START(PACKET_CITY_SHORT_INFO);
17629#ifdef FREECIV_JSON_CONNECTION
17630 struct plocation field_addr;
17631 {
17632 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
17633 field_addr = *field_addr_tmp;
17634 FC_FREE(field_addr_tmp);
17635 }
17636#endif /* FREECIV_JSON_CONNECTION */
17637
17638 log_packet_detailed("packet_city_short_info_100: sending info about (%d)",
17639 real_packet->id);
17640
17641#ifdef FREECIV_DELTA_PROTOCOL
17642 if (nullptr == *hash) {
17643 *hash = genhash_new_full(hash_packet_city_short_info_100, cmp_packet_city_short_info_100,
17644 nullptr, nullptr, nullptr, destroy_packet_city_short_info);
17645 }
17646 BV_CLR_ALL(fields);
17647
17648 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
17649 old = fc_malloc(sizeof(*old));
17650 /* temporary bitcopy just to insert correctly */
17651 *old = *real_packet;
17652 genhash_insert(*hash, old, old);
17653 init_packet_city_short_info(old);
17654 different = 1; /* Force to send. */
17655 }
17656 differ = (old->tile != real_packet->tile);
17657 if (differ) {
17658 different++;
17659 BV_SET(fields, 0);
17660 }
17661
17662 differ = (old->owner != real_packet->owner);
17663 if (differ) {
17664 different++;
17665 BV_SET(fields, 1);
17666 }
17667
17668 differ = (old->size != real_packet->size);
17669 if (differ) {
17670 different++;
17671 BV_SET(fields, 2);
17672 }
17673
17674 differ = (old->style != real_packet->style);
17675 if (differ) {
17676 different++;
17677 BV_SET(fields, 3);
17678 }
17679
17680 differ = (old->capital != real_packet->capital);
17681 if (differ) {
17682 different++;
17683 BV_SET(fields, 4);
17684 }
17685
17686 differ = (old->occupied != real_packet->occupied);
17687 if (differ) {
17688 different++;
17689 }
17690 if (packet->occupied) {
17691 BV_SET(fields, 5);
17692 }
17693
17694 differ = (old->walls != real_packet->walls);
17695 if (differ) {
17696 different++;
17697 BV_SET(fields, 6);
17698 }
17699
17700 differ = (old->happy != real_packet->happy);
17701 if (differ) {
17702 different++;
17703 }
17704 if (packet->happy) {
17705 BV_SET(fields, 7);
17706 }
17707
17708 differ = (old->unhappy != real_packet->unhappy);
17709 if (differ) {
17710 different++;
17711 }
17712 if (packet->unhappy) {
17713 BV_SET(fields, 8);
17714 }
17715
17716 differ = (old->city_image != real_packet->city_image);
17717 if (differ) {
17718 different++;
17719 BV_SET(fields, 9);
17720 }
17721
17722 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
17723 if (differ) {
17724 different++;
17725 BV_SET(fields, 10);
17726 }
17727
17728 differ = (strcmp(old->name, real_packet->name) != 0);
17729 if (differ) {
17730 different++;
17731 BV_SET(fields, 11);
17732 }
17733
17734 if (different == 0) {
17735 log_packet_detailed(" no change -> discard");
17736 return 0;
17737 }
17738
17739#ifdef FREECIV_JSON_CONNECTION
17740 field_addr.name = "fields";
17741#endif /* FREECIV_JSON_CONNECTION */
17742 e = 0;
17743 e |= DIO_BV_PUT(&dout, &field_addr, fields);
17744 if (e) {
17745 log_packet_detailed("fields bitvector error detected");
17746 }
17747#ifdef FREECIV_JSON_CONNECTION
17748 field_addr.name = "id";
17749#endif /* FREECIV_JSON_CONNECTION */
17750 e = 0;
17751 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
17752 if (e) {
17753 log_packet_detailed("'id' field error detected");
17754 }
17755
17756 if (BV_ISSET(fields, 0)) {
17757 log_packet_detailed(" field 'tile' has changed");
17758#ifdef FREECIV_JSON_CONNECTION
17759 field_addr.name = "tile";
17760#endif /* FREECIV_JSON_CONNECTION */
17761 e = 0;
17762 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
17763 if (e) {
17764 log_packet_detailed("'tile' field error detected");
17765 }
17766 }
17767 if (BV_ISSET(fields, 1)) {
17768 log_packet_detailed(" field 'owner' has changed");
17769#ifdef FREECIV_JSON_CONNECTION
17770 field_addr.name = "owner";
17771#endif /* FREECIV_JSON_CONNECTION */
17772 e = 0;
17773 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
17774 if (e) {
17775 log_packet_detailed("'owner' field error detected");
17776 }
17777 }
17778 if (BV_ISSET(fields, 2)) {
17779 log_packet_detailed(" field 'size' has changed");
17780#ifdef FREECIV_JSON_CONNECTION
17781 field_addr.name = "size";
17782#endif /* FREECIV_JSON_CONNECTION */
17783 e = 0;
17784 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
17785 if (e) {
17786 log_packet_detailed("'size' field error detected");
17787 }
17788 }
17789 if (BV_ISSET(fields, 3)) {
17790 log_packet_detailed(" field 'style' has changed");
17791#ifdef FREECIV_JSON_CONNECTION
17792 field_addr.name = "style";
17793#endif /* FREECIV_JSON_CONNECTION */
17794 e = 0;
17795 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
17796 if (e) {
17797 log_packet_detailed("'style' field error detected");
17798 }
17799 }
17800 if (BV_ISSET(fields, 4)) {
17801 log_packet_detailed(" field 'capital' has changed");
17802#ifdef FREECIV_JSON_CONNECTION
17803 field_addr.name = "capital";
17804#endif /* FREECIV_JSON_CONNECTION */
17805 e = 0;
17806 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
17807 if (e) {
17808 log_packet_detailed("'capital' field error detected");
17809 }
17810 }
17811 /* field 5 is folded into the header */
17812 if (BV_ISSET(fields, 6)) {
17813 log_packet_detailed(" field 'walls' has changed");
17814#ifdef FREECIV_JSON_CONNECTION
17815 field_addr.name = "walls";
17816#endif /* FREECIV_JSON_CONNECTION */
17817 e = 0;
17818 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
17819 if (e) {
17820 log_packet_detailed("'walls' field error detected");
17821 }
17822 }
17823 /* field 7 is folded into the header */
17824 /* field 8 is folded into the header */
17825 if (BV_ISSET(fields, 9)) {
17826 log_packet_detailed(" field 'city_image' has changed");
17827#ifdef FREECIV_JSON_CONNECTION
17828 field_addr.name = "city_image";
17829#endif /* FREECIV_JSON_CONNECTION */
17830 e = 0;
17831 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
17832 if (e) {
17833 log_packet_detailed("'city_image' field error detected");
17834 }
17835 }
17836 if (BV_ISSET(fields, 10)) {
17837 log_packet_detailed(" field 'improvements' has changed");
17838#ifdef FREECIV_JSON_CONNECTION
17839 field_addr.name = "improvements";
17840#endif /* FREECIV_JSON_CONNECTION */
17841 e = 0;
17842 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
17843 if (e) {
17844 log_packet_detailed("'improvements' field error detected");
17845 }
17846 }
17847 if (BV_ISSET(fields, 11)) {
17848 log_packet_detailed(" field 'name' has changed");
17849#ifdef FREECIV_JSON_CONNECTION
17850 field_addr.name = "name";
17851#endif /* FREECIV_JSON_CONNECTION */
17852 e = 0;
17853 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
17854 if (e) {
17855 log_packet_detailed("'name' field error detected");
17856 }
17857 }
17858
17859 *old = *real_packet;
17860
17861 hash = pc->phs.sent + PACKET_CITY_INFO;
17862 if (nullptr != *hash) {
17863 genhash_remove(*hash, real_packet);
17864 }
17865
17866 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
17867 if (nullptr != *hash) {
17868 genhash_remove(*hash, real_packet);
17869 }
17870
17871 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
17872 if (nullptr != *hash) {
17873 genhash_remove(*hash, real_packet);
17874 }
17875
17876 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
17877 if (nullptr != *hash) {
17878 genhash_remove(*hash, real_packet);
17879 }
17880#endif /* FREECIV_DELTA_PROTOCOL */
17881#ifndef FREECIV_DELTA_PROTOCOL
17882#ifdef FREECIV_JSON_CONNECTION
17883 field_addr.name = "id";
17884#endif /* FREECIV_JSON_CONNECTION */
17885 e = 0;
17886 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
17887 if (e) {
17888 log_packet_detailed("'id' field error detected");
17889 }
17890#ifdef FREECIV_JSON_CONNECTION
17891 field_addr.name = "tile";
17892#endif /* FREECIV_JSON_CONNECTION */
17893 e = 0;
17894 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
17895 if (e) {
17896 log_packet_detailed("'tile' field error detected");
17897 }
17898#ifdef FREECIV_JSON_CONNECTION
17899 field_addr.name = "owner";
17900#endif /* FREECIV_JSON_CONNECTION */
17901 e = 0;
17902 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
17903 if (e) {
17904 log_packet_detailed("'owner' field error detected");
17905 }
17906#ifdef FREECIV_JSON_CONNECTION
17907 field_addr.name = "size";
17908#endif /* FREECIV_JSON_CONNECTION */
17909 e = 0;
17910 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
17911 if (e) {
17912 log_packet_detailed("'size' field error detected");
17913 }
17914#ifdef FREECIV_JSON_CONNECTION
17915 field_addr.name = "style";
17916#endif /* FREECIV_JSON_CONNECTION */
17917 e = 0;
17918 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
17919 if (e) {
17920 log_packet_detailed("'style' field error detected");
17921 }
17922#ifdef FREECIV_JSON_CONNECTION
17923 field_addr.name = "capital";
17924#endif /* FREECIV_JSON_CONNECTION */
17925 e = 0;
17926 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
17927 if (e) {
17928 log_packet_detailed("'capital' field error detected");
17929 }
17930#ifdef FREECIV_JSON_CONNECTION
17931 field_addr.name = "occupied";
17932#endif /* FREECIV_JSON_CONNECTION */
17933 e = 0;
17934 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
17935 if (e) {
17936 log_packet_detailed("'occupied' field error detected");
17937 }
17938#ifdef FREECIV_JSON_CONNECTION
17939 field_addr.name = "walls";
17940#endif /* FREECIV_JSON_CONNECTION */
17941 e = 0;
17942 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
17943 if (e) {
17944 log_packet_detailed("'walls' field error detected");
17945 }
17946#ifdef FREECIV_JSON_CONNECTION
17947 field_addr.name = "happy";
17948#endif /* FREECIV_JSON_CONNECTION */
17949 e = 0;
17950 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->happy);
17951 if (e) {
17952 log_packet_detailed("'happy' field error detected");
17953 }
17954#ifdef FREECIV_JSON_CONNECTION
17955 field_addr.name = "unhappy";
17956#endif /* FREECIV_JSON_CONNECTION */
17957 e = 0;
17958 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unhappy);
17959 if (e) {
17960 log_packet_detailed("'unhappy' field error detected");
17961 }
17962#ifdef FREECIV_JSON_CONNECTION
17963 field_addr.name = "city_image";
17964#endif /* FREECIV_JSON_CONNECTION */
17965 e = 0;
17966 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
17967 if (e) {
17968 log_packet_detailed("'city_image' field error detected");
17969 }
17970#ifdef FREECIV_JSON_CONNECTION
17971 field_addr.name = "improvements";
17972#endif /* FREECIV_JSON_CONNECTION */
17973 e = 0;
17974 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
17975 if (e) {
17976 log_packet_detailed("'improvements' field error detected");
17977 }
17978#ifdef FREECIV_JSON_CONNECTION
17979 field_addr.name = "name";
17980#endif /* FREECIV_JSON_CONNECTION */
17981 e = 0;
17982 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
17983 if (e) {
17984 log_packet_detailed("'name' field error detected");
17985 }
17986
17987#endif
17988 SEND_PACKET_END(PACKET_CITY_SHORT_INFO);
17989}
17990
17991 int send_packet_city_short_info(struct connection *pc, const struct packet_city_short_info *packet)
17992{
17993 if (!pc->used) {
17994 log_error("WARNING: trying to send data to the closed connection %s",
17995 conn_description(pc));
17996 return -1;
17997 }
17998 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SHORT_INFO].packet != nullptr, -1,
17999 "Handler for PACKET_CITY_SHORT_INFO not installed");
18000 return pc->phs.handlers->send[PACKET_CITY_SHORT_INFO].packet(pc, packet);
18001}
18002
18003 void lsend_packet_city_short_info(struct conn_list *dest, const struct packet_city_short_info *packet)
18004{
18005 conn_list_iterate(dest, pconn) {
18006 send_packet_city_short_info(pconn, packet);
18007 } conn_list_iterate_end;
18008}
18009
18010 static inline void init_packet_trade_route_info(struct packet_trade_route_info *packet)
18011{
18012 memset(packet, 0, sizeof(*packet));
18013}
18014
18015#define free_packet_trade_route_info(_packet) (void) 0
18016#define destroy_packet_trade_route_info free
18017
18018#ifdef FREECIV_DELTA_PROTOCOL
18019#define hash_packet_trade_route_info_100 hash_const
18020
18021#define cmp_packet_trade_route_info_100 cmp_const
18022
18023 BV_DEFINE(packet_trade_route_info_100_fields, 6);
18024#endif /* FREECIV_DELTA_PROTOCOL */
18025
18026 static struct packet_trade_route_info *receive_packet_trade_route_info_100(struct connection *pc)
18027{
18028#define FREE_PACKET_STRUCT(_packet) free_packet_trade_route_info(_packet)
18029#ifdef FREECIV_DELTA_PROTOCOL
18030 packet_trade_route_info_100_fields fields;
18031 struct packet_trade_route_info *old;
18032 struct genhash **hash = pc->phs.received + PACKET_TRADE_ROUTE_INFO;
18033#endif /* FREECIV_DELTA_PROTOCOL */
18034 RECEIVE_PACKET_START(packet_trade_route_info, real_packet);
18035#ifdef FREECIV_JSON_CONNECTION
18036 struct plocation field_addr;
18037 {
18038 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18039 field_addr = *field_addr_tmp;
18040 FC_FREE(field_addr_tmp);
18041 }
18042#endif /* FREECIV_JSON_CONNECTION */
18043
18044#ifdef FREECIV_DELTA_PROTOCOL
18045#ifdef FREECIV_JSON_CONNECTION
18046 field_addr.name = "fields";
18047#endif /* FREECIV_JSON_CONNECTION */
18048 DIO_BV_GET(&din, &field_addr, fields);
18049
18050#else /* FREECIV_DELTA_PROTOCOL */
18051#ifdef FREECIV_JSON_CONNECTION
18052 field_addr.name = "city";
18053#endif /* FREECIV_JSON_CONNECTION */
18054 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
18055 RECEIVE_PACKET_FIELD_ERROR(city);
18056 }
18057#ifdef FREECIV_JSON_CONNECTION
18058 field_addr.name = "index";
18059#endif /* FREECIV_JSON_CONNECTION */
18060 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
18061 RECEIVE_PACKET_FIELD_ERROR(index);
18062 }
18063#ifdef FREECIV_JSON_CONNECTION
18064 field_addr.name = "partner";
18065#endif /* FREECIV_JSON_CONNECTION */
18066 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->partner)) {
18067 RECEIVE_PACKET_FIELD_ERROR(partner);
18068 }
18069#ifdef FREECIV_JSON_CONNECTION
18070 field_addr.name = "value";
18071#endif /* FREECIV_JSON_CONNECTION */
18072 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
18073 RECEIVE_PACKET_FIELD_ERROR(value);
18074 }
18075#ifdef FREECIV_JSON_CONNECTION
18076 field_addr.name = "direction";
18077#endif /* FREECIV_JSON_CONNECTION */
18078 {
18079 int readin;
18080
18081 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
18082 RECEIVE_PACKET_FIELD_ERROR(direction);
18083 }
18084 real_packet->direction = readin;
18085 }
18086#ifdef FREECIV_JSON_CONNECTION
18087 field_addr.name = "goods";
18088#endif /* FREECIV_JSON_CONNECTION */
18089 {
18090 int readin;
18091
18092 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
18093 RECEIVE_PACKET_FIELD_ERROR(goods);
18094 }
18095 real_packet->goods = readin;
18096 }
18097#endif
18098 log_packet_detailed("packet_trade_route_info_100: got info about ()");
18099
18100#ifdef FREECIV_DELTA_PROTOCOL
18101 if (nullptr == *hash) {
18102 *hash = genhash_new_full(hash_packet_trade_route_info_100, cmp_packet_trade_route_info_100,
18103 nullptr, nullptr, nullptr, destroy_packet_trade_route_info);
18104 }
18105
18106 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18107 *real_packet = *old;
18108 } else {
18109 /* packet is already initialized empty */
18110 log_packet_detailed(" no old info");
18111 }
18112
18113 if (BV_ISSET(fields, 0)) {
18114 log_packet_detailed(" got field 'city'");
18115#ifdef FREECIV_JSON_CONNECTION
18116 field_addr.name = "city";
18117#endif /* FREECIV_JSON_CONNECTION */
18118 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
18119 RECEIVE_PACKET_FIELD_ERROR(city);
18120 }
18121 }
18122 if (BV_ISSET(fields, 1)) {
18123 log_packet_detailed(" got field 'index'");
18124#ifdef FREECIV_JSON_CONNECTION
18125 field_addr.name = "index";
18126#endif /* FREECIV_JSON_CONNECTION */
18127 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
18128 RECEIVE_PACKET_FIELD_ERROR(index);
18129 }
18130 }
18131 if (BV_ISSET(fields, 2)) {
18132 log_packet_detailed(" got field 'partner'");
18133#ifdef FREECIV_JSON_CONNECTION
18134 field_addr.name = "partner";
18135#endif /* FREECIV_JSON_CONNECTION */
18136 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->partner)) {
18137 RECEIVE_PACKET_FIELD_ERROR(partner);
18138 }
18139 }
18140 if (BV_ISSET(fields, 3)) {
18141 log_packet_detailed(" got field 'value'");
18142#ifdef FREECIV_JSON_CONNECTION
18143 field_addr.name = "value";
18144#endif /* FREECIV_JSON_CONNECTION */
18145 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
18146 RECEIVE_PACKET_FIELD_ERROR(value);
18147 }
18148 }
18149 if (BV_ISSET(fields, 4)) {
18150 log_packet_detailed(" got field 'direction'");
18151#ifdef FREECIV_JSON_CONNECTION
18152 field_addr.name = "direction";
18153#endif /* FREECIV_JSON_CONNECTION */
18154 {
18155 int readin;
18156
18157 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
18158 RECEIVE_PACKET_FIELD_ERROR(direction);
18159 }
18160 real_packet->direction = readin;
18161 }
18162 }
18163 if (BV_ISSET(fields, 5)) {
18164 log_packet_detailed(" got field 'goods'");
18165#ifdef FREECIV_JSON_CONNECTION
18166 field_addr.name = "goods";
18167#endif /* FREECIV_JSON_CONNECTION */
18168 {
18169 int readin;
18170
18171 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
18172 RECEIVE_PACKET_FIELD_ERROR(goods);
18173 }
18174 real_packet->goods = readin;
18175 }
18176 }
18177
18178 if (nullptr == old) {
18179 old = fc_malloc(sizeof(*old));
18180 init_packet_trade_route_info(old);
18181 *old = *real_packet;
18182 genhash_insert(*hash, old, old);
18183 } else {
18184 *old = *real_packet;
18185 }
18186
18187#endif /* FREECIV_DELTA_PROTOCOL */
18188 RECEIVE_PACKET_END(real_packet);
18189#undef FREE_PACKET_STRUCT
18190}
18191
18192 static int send_packet_trade_route_info_100(struct connection *pc, const struct packet_trade_route_info *packet)
18193{
18194 const struct packet_trade_route_info *real_packet = packet;
18195 int e;
18196#ifdef FREECIV_DELTA_PROTOCOL
18197 packet_trade_route_info_100_fields fields;
18198 struct packet_trade_route_info *old;
18199 bool differ;
18200 struct genhash **hash = pc->phs.sent + PACKET_TRADE_ROUTE_INFO;
18201#endif /* FREECIV_DELTA_PROTOCOL */
18202 SEND_PACKET_START(PACKET_TRADE_ROUTE_INFO);
18203#ifdef FREECIV_JSON_CONNECTION
18204 struct plocation field_addr;
18205 {
18206 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18207 field_addr = *field_addr_tmp;
18208 FC_FREE(field_addr_tmp);
18209 }
18210#endif /* FREECIV_JSON_CONNECTION */
18211
18212 log_packet_detailed("packet_trade_route_info_100: sending info about ()");
18213
18214#ifdef FREECIV_DELTA_PROTOCOL
18215 if (nullptr == *hash) {
18216 *hash = genhash_new_full(hash_packet_trade_route_info_100, cmp_packet_trade_route_info_100,
18217 nullptr, nullptr, nullptr, destroy_packet_trade_route_info);
18218 }
18219 BV_CLR_ALL(fields);
18220
18221 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18222 old = fc_malloc(sizeof(*old));
18223 /* temporary bitcopy just to insert correctly */
18224 *old = *real_packet;
18225 genhash_insert(*hash, old, old);
18226 init_packet_trade_route_info(old);
18227 }
18228 differ = (old->city != real_packet->city);
18229 if (differ) {
18230 BV_SET(fields, 0);
18231 }
18232
18233 differ = (old->index != real_packet->index);
18234 if (differ) {
18235 BV_SET(fields, 1);
18236 }
18237
18238 differ = (old->partner != real_packet->partner);
18239 if (differ) {
18240 BV_SET(fields, 2);
18241 }
18242
18243 differ = (old->value != real_packet->value);
18244 if (differ) {
18245 BV_SET(fields, 3);
18246 }
18247
18248 differ = (old->direction != real_packet->direction);
18249 if (differ) {
18250 BV_SET(fields, 4);
18251 }
18252
18253 differ = (old->goods != real_packet->goods);
18254 if (differ) {
18255 BV_SET(fields, 5);
18256 }
18257
18258
18259#ifdef FREECIV_JSON_CONNECTION
18260 field_addr.name = "fields";
18261#endif /* FREECIV_JSON_CONNECTION */
18262 e = 0;
18263 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18264 if (e) {
18265 log_packet_detailed("fields bitvector error detected");
18266 }
18267
18268 if (BV_ISSET(fields, 0)) {
18269 log_packet_detailed(" field 'city' has changed");
18270#ifdef FREECIV_JSON_CONNECTION
18271 field_addr.name = "city";
18272#endif /* FREECIV_JSON_CONNECTION */
18273 e = 0;
18274 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
18275 if (e) {
18276 log_packet_detailed("'city' field error detected");
18277 }
18278 }
18279 if (BV_ISSET(fields, 1)) {
18280 log_packet_detailed(" field 'index' has changed");
18281#ifdef FREECIV_JSON_CONNECTION
18282 field_addr.name = "index";
18283#endif /* FREECIV_JSON_CONNECTION */
18284 e = 0;
18285 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
18286 if (e) {
18287 log_packet_detailed("'index' field error detected");
18288 }
18289 }
18290 if (BV_ISSET(fields, 2)) {
18291 log_packet_detailed(" field 'partner' has changed");
18292#ifdef FREECIV_JSON_CONNECTION
18293 field_addr.name = "partner";
18294#endif /* FREECIV_JSON_CONNECTION */
18295 e = 0;
18296 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->partner);
18297 if (e) {
18298 log_packet_detailed("'partner' field error detected");
18299 }
18300 }
18301 if (BV_ISSET(fields, 3)) {
18302 log_packet_detailed(" field 'value' has changed");
18303#ifdef FREECIV_JSON_CONNECTION
18304 field_addr.name = "value";
18305#endif /* FREECIV_JSON_CONNECTION */
18306 e = 0;
18307 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
18308 if (e) {
18309 log_packet_detailed("'value' field error detected");
18310 }
18311 }
18312 if (BV_ISSET(fields, 4)) {
18313 log_packet_detailed(" field 'direction' has changed");
18314#ifdef FREECIV_JSON_CONNECTION
18315 field_addr.name = "direction";
18316#endif /* FREECIV_JSON_CONNECTION */
18317 e = 0;
18318 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
18319 if (e) {
18320 log_packet_detailed("'direction' field error detected");
18321 }
18322 }
18323 if (BV_ISSET(fields, 5)) {
18324 log_packet_detailed(" field 'goods' has changed");
18325#ifdef FREECIV_JSON_CONNECTION
18326 field_addr.name = "goods";
18327#endif /* FREECIV_JSON_CONNECTION */
18328 e = 0;
18329 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
18330 if (e) {
18331 log_packet_detailed("'goods' field error detected");
18332 }
18333 }
18334
18335 *old = *real_packet;
18336#endif /* FREECIV_DELTA_PROTOCOL */
18337#ifndef FREECIV_DELTA_PROTOCOL
18338#ifdef FREECIV_JSON_CONNECTION
18339 field_addr.name = "city";
18340#endif /* FREECIV_JSON_CONNECTION */
18341 e = 0;
18342 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
18343 if (e) {
18344 log_packet_detailed("'city' field error detected");
18345 }
18346#ifdef FREECIV_JSON_CONNECTION
18347 field_addr.name = "index";
18348#endif /* FREECIV_JSON_CONNECTION */
18349 e = 0;
18350 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
18351 if (e) {
18352 log_packet_detailed("'index' field error detected");
18353 }
18354#ifdef FREECIV_JSON_CONNECTION
18355 field_addr.name = "partner";
18356#endif /* FREECIV_JSON_CONNECTION */
18357 e = 0;
18358 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->partner);
18359 if (e) {
18360 log_packet_detailed("'partner' field error detected");
18361 }
18362#ifdef FREECIV_JSON_CONNECTION
18363 field_addr.name = "value";
18364#endif /* FREECIV_JSON_CONNECTION */
18365 e = 0;
18366 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
18367 if (e) {
18368 log_packet_detailed("'value' field error detected");
18369 }
18370#ifdef FREECIV_JSON_CONNECTION
18371 field_addr.name = "direction";
18372#endif /* FREECIV_JSON_CONNECTION */
18373 e = 0;
18374 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
18375 if (e) {
18376 log_packet_detailed("'direction' field error detected");
18377 }
18378#ifdef FREECIV_JSON_CONNECTION
18379 field_addr.name = "goods";
18380#endif /* FREECIV_JSON_CONNECTION */
18381 e = 0;
18382 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
18383 if (e) {
18384 log_packet_detailed("'goods' field error detected");
18385 }
18386
18387#endif
18388 SEND_PACKET_END(PACKET_TRADE_ROUTE_INFO);
18389}
18390
18391 int send_packet_trade_route_info(struct connection *pc, const struct packet_trade_route_info *packet)
18392{
18393 if (!pc->used) {
18394 log_error("WARNING: trying to send data to the closed connection %s",
18395 conn_description(pc));
18396 return -1;
18397 }
18398 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TRADE_ROUTE_INFO].packet != nullptr, -1,
18399 "Handler for PACKET_TRADE_ROUTE_INFO not installed");
18400 return pc->phs.handlers->send[PACKET_TRADE_ROUTE_INFO].packet(pc, packet);
18401}
18402
18403 void lsend_packet_trade_route_info(struct conn_list *dest, const struct packet_trade_route_info *packet)
18404{
18405 conn_list_iterate(dest, pconn) {
18406 send_packet_trade_route_info(pconn, packet);
18407 } conn_list_iterate_end;
18408}
18409
18410 static inline void init_packet_city_sell(struct packet_city_sell *packet)
18411{
18412 memset(packet, 0, sizeof(*packet));
18413}
18414
18415#define free_packet_city_sell(_packet) (void) 0
18416#define destroy_packet_city_sell free
18417
18418#ifdef FREECIV_DELTA_PROTOCOL
18419#define hash_packet_city_sell_100 hash_const
18420
18421#define cmp_packet_city_sell_100 cmp_const
18422
18423 BV_DEFINE(packet_city_sell_100_fields, 2);
18424#endif /* FREECIV_DELTA_PROTOCOL */
18425
18426 static struct packet_city_sell *receive_packet_city_sell_100(struct connection *pc)
18427{
18428#define FREE_PACKET_STRUCT(_packet) free_packet_city_sell(_packet)
18429#ifdef FREECIV_DELTA_PROTOCOL
18430 packet_city_sell_100_fields fields;
18431 struct packet_city_sell *old;
18432 struct genhash **hash = pc->phs.received + PACKET_CITY_SELL;
18433#endif /* FREECIV_DELTA_PROTOCOL */
18434 RECEIVE_PACKET_START(packet_city_sell, real_packet);
18435#ifdef FREECIV_JSON_CONNECTION
18436 struct plocation field_addr;
18437 {
18438 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18439 field_addr = *field_addr_tmp;
18440 FC_FREE(field_addr_tmp);
18441 }
18442#endif /* FREECIV_JSON_CONNECTION */
18443
18444#ifdef FREECIV_DELTA_PROTOCOL
18445#ifdef FREECIV_JSON_CONNECTION
18446 field_addr.name = "fields";
18447#endif /* FREECIV_JSON_CONNECTION */
18448 DIO_BV_GET(&din, &field_addr, fields);
18449
18450#else /* FREECIV_DELTA_PROTOCOL */
18451#ifdef FREECIV_JSON_CONNECTION
18452 field_addr.name = "city_id";
18453#endif /* FREECIV_JSON_CONNECTION */
18454 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18455 RECEIVE_PACKET_FIELD_ERROR(city_id);
18456 }
18457#ifdef FREECIV_JSON_CONNECTION
18458 field_addr.name = "build_id";
18459#endif /* FREECIV_JSON_CONNECTION */
18460 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
18461 RECEIVE_PACKET_FIELD_ERROR(build_id);
18462 }
18463#endif
18464 log_packet_detailed("packet_city_sell_100: got info about ()");
18465
18466#ifdef FREECIV_DELTA_PROTOCOL
18467 if (nullptr == *hash) {
18468 *hash = genhash_new_full(hash_packet_city_sell_100, cmp_packet_city_sell_100,
18469 nullptr, nullptr, nullptr, destroy_packet_city_sell);
18470 }
18471
18472 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18473 *real_packet = *old;
18474 } else {
18475 /* packet is already initialized empty */
18476 log_packet_detailed(" no old info");
18477 }
18478
18479 if (BV_ISSET(fields, 0)) {
18480 log_packet_detailed(" got field 'city_id'");
18481#ifdef FREECIV_JSON_CONNECTION
18482 field_addr.name = "city_id";
18483#endif /* FREECIV_JSON_CONNECTION */
18484 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18485 RECEIVE_PACKET_FIELD_ERROR(city_id);
18486 }
18487 }
18488 if (BV_ISSET(fields, 1)) {
18489 log_packet_detailed(" got field 'build_id'");
18490#ifdef FREECIV_JSON_CONNECTION
18491 field_addr.name = "build_id";
18492#endif /* FREECIV_JSON_CONNECTION */
18493 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
18494 RECEIVE_PACKET_FIELD_ERROR(build_id);
18495 }
18496 }
18497
18498 if (nullptr == old) {
18499 old = fc_malloc(sizeof(*old));
18500 init_packet_city_sell(old);
18501 *old = *real_packet;
18502 genhash_insert(*hash, old, old);
18503 } else {
18504 *old = *real_packet;
18505 }
18506
18507#endif /* FREECIV_DELTA_PROTOCOL */
18508 RECEIVE_PACKET_END(real_packet);
18509#undef FREE_PACKET_STRUCT
18510}
18511
18512 static int send_packet_city_sell_100(struct connection *pc, const struct packet_city_sell *packet)
18513{
18514 const struct packet_city_sell *real_packet = packet;
18515 int e;
18516#ifdef FREECIV_DELTA_PROTOCOL
18517 packet_city_sell_100_fields fields;
18518 struct packet_city_sell *old;
18519 bool differ;
18520 struct genhash **hash = pc->phs.sent + PACKET_CITY_SELL;
18521#endif /* FREECIV_DELTA_PROTOCOL */
18522 SEND_PACKET_START(PACKET_CITY_SELL);
18523#ifdef FREECIV_JSON_CONNECTION
18524 struct plocation field_addr;
18525 {
18526 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18527 field_addr = *field_addr_tmp;
18528 FC_FREE(field_addr_tmp);
18529 }
18530#endif /* FREECIV_JSON_CONNECTION */
18531
18532 log_packet_detailed("packet_city_sell_100: sending info about ()");
18533
18534#ifdef FREECIV_DELTA_PROTOCOL
18535 if (nullptr == *hash) {
18536 *hash = genhash_new_full(hash_packet_city_sell_100, cmp_packet_city_sell_100,
18537 nullptr, nullptr, nullptr, destroy_packet_city_sell);
18538 }
18539 BV_CLR_ALL(fields);
18540
18541 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18542 old = fc_malloc(sizeof(*old));
18543 /* temporary bitcopy just to insert correctly */
18544 *old = *real_packet;
18545 genhash_insert(*hash, old, old);
18546 init_packet_city_sell(old);
18547 }
18548 differ = (old->city_id != real_packet->city_id);
18549 if (differ) {
18550 BV_SET(fields, 0);
18551 }
18552
18553 differ = (old->build_id != real_packet->build_id);
18554 if (differ) {
18555 BV_SET(fields, 1);
18556 }
18557
18558
18559#ifdef FREECIV_JSON_CONNECTION
18560 field_addr.name = "fields";
18561#endif /* FREECIV_JSON_CONNECTION */
18562 e = 0;
18563 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18564 if (e) {
18565 log_packet_detailed("fields bitvector error detected");
18566 }
18567
18568 if (BV_ISSET(fields, 0)) {
18569 log_packet_detailed(" field 'city_id' has changed");
18570#ifdef FREECIV_JSON_CONNECTION
18571 field_addr.name = "city_id";
18572#endif /* FREECIV_JSON_CONNECTION */
18573 e = 0;
18574 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18575 if (e) {
18576 log_packet_detailed("'city_id' field error detected");
18577 }
18578 }
18579 if (BV_ISSET(fields, 1)) {
18580 log_packet_detailed(" field 'build_id' has changed");
18581#ifdef FREECIV_JSON_CONNECTION
18582 field_addr.name = "build_id";
18583#endif /* FREECIV_JSON_CONNECTION */
18584 e = 0;
18585 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
18586 if (e) {
18587 log_packet_detailed("'build_id' field error detected");
18588 }
18589 }
18590
18591 *old = *real_packet;
18592#endif /* FREECIV_DELTA_PROTOCOL */
18593#ifndef FREECIV_DELTA_PROTOCOL
18594#ifdef FREECIV_JSON_CONNECTION
18595 field_addr.name = "city_id";
18596#endif /* FREECIV_JSON_CONNECTION */
18597 e = 0;
18598 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18599 if (e) {
18600 log_packet_detailed("'city_id' field error detected");
18601 }
18602#ifdef FREECIV_JSON_CONNECTION
18603 field_addr.name = "build_id";
18604#endif /* FREECIV_JSON_CONNECTION */
18605 e = 0;
18606 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
18607 if (e) {
18608 log_packet_detailed("'build_id' field error detected");
18609 }
18610
18611#endif
18612 SEND_PACKET_END(PACKET_CITY_SELL);
18613}
18614
18615 int send_packet_city_sell(struct connection *pc, const struct packet_city_sell *packet)
18616{
18617 if (!pc->used) {
18618 log_error("WARNING: trying to send data to the closed connection %s",
18619 conn_description(pc));
18620 return -1;
18621 }
18622 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SELL].packet != nullptr, -1,
18623 "Handler for PACKET_CITY_SELL not installed");
18624 return pc->phs.handlers->send[PACKET_CITY_SELL].packet(pc, packet);
18625}
18626
18627 int dsend_packet_city_sell(struct connection *pc, int city_id, int build_id)
18628{
18629 struct packet_city_sell packet, *real_packet = &packet;
18630
18631 real_packet->city_id = city_id;
18632 real_packet->build_id = build_id;
18633
18634 return send_packet_city_sell(pc, real_packet);
18635}
18636
18637 static inline void init_packet_city_buy(struct packet_city_buy *packet)
18638{
18639 memset(packet, 0, sizeof(*packet));
18640}
18641
18642#define free_packet_city_buy(_packet) (void) 0
18643#define destroy_packet_city_buy free
18644
18645#ifdef FREECIV_DELTA_PROTOCOL
18646#define hash_packet_city_buy_100 hash_const
18647
18648#define cmp_packet_city_buy_100 cmp_const
18649
18650 BV_DEFINE(packet_city_buy_100_fields, 1);
18651#endif /* FREECIV_DELTA_PROTOCOL */
18652
18653 static struct packet_city_buy *receive_packet_city_buy_100(struct connection *pc)
18654{
18655#define FREE_PACKET_STRUCT(_packet) free_packet_city_buy(_packet)
18656#ifdef FREECIV_DELTA_PROTOCOL
18657 packet_city_buy_100_fields fields;
18658 struct packet_city_buy *old;
18659 struct genhash **hash = pc->phs.received + PACKET_CITY_BUY;
18660#endif /* FREECIV_DELTA_PROTOCOL */
18661 RECEIVE_PACKET_START(packet_city_buy, real_packet);
18662#ifdef FREECIV_JSON_CONNECTION
18663 struct plocation field_addr;
18664 {
18665 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18666 field_addr = *field_addr_tmp;
18667 FC_FREE(field_addr_tmp);
18668 }
18669#endif /* FREECIV_JSON_CONNECTION */
18670
18671#ifdef FREECIV_DELTA_PROTOCOL
18672#ifdef FREECIV_JSON_CONNECTION
18673 field_addr.name = "fields";
18674#endif /* FREECIV_JSON_CONNECTION */
18675 DIO_BV_GET(&din, &field_addr, fields);
18676
18677#else /* FREECIV_DELTA_PROTOCOL */
18678#ifdef FREECIV_JSON_CONNECTION
18679 field_addr.name = "city_id";
18680#endif /* FREECIV_JSON_CONNECTION */
18681 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18682 RECEIVE_PACKET_FIELD_ERROR(city_id);
18683 }
18684#endif
18685 log_packet_detailed("packet_city_buy_100: got info about ()");
18686
18687#ifdef FREECIV_DELTA_PROTOCOL
18688 if (nullptr == *hash) {
18689 *hash = genhash_new_full(hash_packet_city_buy_100, cmp_packet_city_buy_100,
18690 nullptr, nullptr, nullptr, destroy_packet_city_buy);
18691 }
18692
18693 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18694 *real_packet = *old;
18695 } else {
18696 /* packet is already initialized empty */
18697 log_packet_detailed(" no old info");
18698 }
18699
18700 if (BV_ISSET(fields, 0)) {
18701 log_packet_detailed(" got field 'city_id'");
18702#ifdef FREECIV_JSON_CONNECTION
18703 field_addr.name = "city_id";
18704#endif /* FREECIV_JSON_CONNECTION */
18705 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18706 RECEIVE_PACKET_FIELD_ERROR(city_id);
18707 }
18708 }
18709
18710 if (nullptr == old) {
18711 old = fc_malloc(sizeof(*old));
18712 init_packet_city_buy(old);
18713 *old = *real_packet;
18714 genhash_insert(*hash, old, old);
18715 } else {
18716 *old = *real_packet;
18717 }
18718
18719#endif /* FREECIV_DELTA_PROTOCOL */
18720 RECEIVE_PACKET_END(real_packet);
18721#undef FREE_PACKET_STRUCT
18722}
18723
18724 static int send_packet_city_buy_100(struct connection *pc, const struct packet_city_buy *packet)
18725{
18726 const struct packet_city_buy *real_packet = packet;
18727 int e;
18728#ifdef FREECIV_DELTA_PROTOCOL
18729 packet_city_buy_100_fields fields;
18730 struct packet_city_buy *old;
18731 bool differ;
18732 struct genhash **hash = pc->phs.sent + PACKET_CITY_BUY;
18733#endif /* FREECIV_DELTA_PROTOCOL */
18734 SEND_PACKET_START(PACKET_CITY_BUY);
18735#ifdef FREECIV_JSON_CONNECTION
18736 struct plocation field_addr;
18737 {
18738 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18739 field_addr = *field_addr_tmp;
18740 FC_FREE(field_addr_tmp);
18741 }
18742#endif /* FREECIV_JSON_CONNECTION */
18743
18744 log_packet_detailed("packet_city_buy_100: sending info about ()");
18745
18746#ifdef FREECIV_DELTA_PROTOCOL
18747 if (nullptr == *hash) {
18748 *hash = genhash_new_full(hash_packet_city_buy_100, cmp_packet_city_buy_100,
18749 nullptr, nullptr, nullptr, destroy_packet_city_buy);
18750 }
18751 BV_CLR_ALL(fields);
18752
18753 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18754 old = fc_malloc(sizeof(*old));
18755 /* temporary bitcopy just to insert correctly */
18756 *old = *real_packet;
18757 genhash_insert(*hash, old, old);
18758 init_packet_city_buy(old);
18759 }
18760 differ = (old->city_id != real_packet->city_id);
18761 if (differ) {
18762 BV_SET(fields, 0);
18763 }
18764
18765
18766#ifdef FREECIV_JSON_CONNECTION
18767 field_addr.name = "fields";
18768#endif /* FREECIV_JSON_CONNECTION */
18769 e = 0;
18770 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18771 if (e) {
18772 log_packet_detailed("fields bitvector error detected");
18773 }
18774
18775 if (BV_ISSET(fields, 0)) {
18776 log_packet_detailed(" field 'city_id' has changed");
18777#ifdef FREECIV_JSON_CONNECTION
18778 field_addr.name = "city_id";
18779#endif /* FREECIV_JSON_CONNECTION */
18780 e = 0;
18781 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18782 if (e) {
18783 log_packet_detailed("'city_id' field error detected");
18784 }
18785 }
18786
18787 *old = *real_packet;
18788#endif /* FREECIV_DELTA_PROTOCOL */
18789#ifndef FREECIV_DELTA_PROTOCOL
18790#ifdef FREECIV_JSON_CONNECTION
18791 field_addr.name = "city_id";
18792#endif /* FREECIV_JSON_CONNECTION */
18793 e = 0;
18794 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18795 if (e) {
18796 log_packet_detailed("'city_id' field error detected");
18797 }
18798
18799#endif
18800 SEND_PACKET_END(PACKET_CITY_BUY);
18801}
18802
18803 int send_packet_city_buy(struct connection *pc, const struct packet_city_buy *packet)
18804{
18805 if (!pc->used) {
18806 log_error("WARNING: trying to send data to the closed connection %s",
18807 conn_description(pc));
18808 return -1;
18809 }
18810 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_BUY].packet != nullptr, -1,
18811 "Handler for PACKET_CITY_BUY not installed");
18812 return pc->phs.handlers->send[PACKET_CITY_BUY].packet(pc, packet);
18813}
18814
18815 int dsend_packet_city_buy(struct connection *pc, int city_id)
18816{
18817 struct packet_city_buy packet, *real_packet = &packet;
18818
18819 real_packet->city_id = city_id;
18820
18821 return send_packet_city_buy(pc, real_packet);
18822}
18823
18824 static inline void init_packet_city_change(struct packet_city_change *packet)
18825{
18826 memset(packet, 0, sizeof(*packet));
18827}
18828
18829#define free_packet_city_change(_packet) (void) 0
18830#define destroy_packet_city_change free
18831
18832#ifdef FREECIV_DELTA_PROTOCOL
18833#define hash_packet_city_change_100 hash_const
18834
18835#define cmp_packet_city_change_100 cmp_const
18836
18837 BV_DEFINE(packet_city_change_100_fields, 3);
18838#endif /* FREECIV_DELTA_PROTOCOL */
18839
18840 static struct packet_city_change *receive_packet_city_change_100(struct connection *pc)
18841{
18842#define FREE_PACKET_STRUCT(_packet) free_packet_city_change(_packet)
18843#ifdef FREECIV_DELTA_PROTOCOL
18844 packet_city_change_100_fields fields;
18845 struct packet_city_change *old;
18846 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE;
18847#endif /* FREECIV_DELTA_PROTOCOL */
18848 RECEIVE_PACKET_START(packet_city_change, real_packet);
18849#ifdef FREECIV_JSON_CONNECTION
18850 struct plocation field_addr;
18851 {
18852 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18853 field_addr = *field_addr_tmp;
18854 FC_FREE(field_addr_tmp);
18855 }
18856#endif /* FREECIV_JSON_CONNECTION */
18857
18858#ifdef FREECIV_DELTA_PROTOCOL
18859#ifdef FREECIV_JSON_CONNECTION
18860 field_addr.name = "fields";
18861#endif /* FREECIV_JSON_CONNECTION */
18862 DIO_BV_GET(&din, &field_addr, fields);
18863
18864#else /* FREECIV_DELTA_PROTOCOL */
18865#ifdef FREECIV_JSON_CONNECTION
18866 field_addr.name = "city_id";
18867#endif /* FREECIV_JSON_CONNECTION */
18868 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18869 RECEIVE_PACKET_FIELD_ERROR(city_id);
18870 }
18871#ifdef FREECIV_JSON_CONNECTION
18872 field_addr.name = "production_kind";
18873#endif /* FREECIV_JSON_CONNECTION */
18874 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
18875 RECEIVE_PACKET_FIELD_ERROR(production_kind);
18876 }
18877#ifdef FREECIV_JSON_CONNECTION
18878 field_addr.name = "production_value";
18879#endif /* FREECIV_JSON_CONNECTION */
18880 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
18881 RECEIVE_PACKET_FIELD_ERROR(production_value);
18882 }
18883#endif
18884 log_packet_detailed("packet_city_change_100: got info about ()");
18885
18886#ifdef FREECIV_DELTA_PROTOCOL
18887 if (nullptr == *hash) {
18888 *hash = genhash_new_full(hash_packet_city_change_100, cmp_packet_city_change_100,
18889 nullptr, nullptr, nullptr, destroy_packet_city_change);
18890 }
18891
18892 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18893 *real_packet = *old;
18894 } else {
18895 /* packet is already initialized empty */
18896 log_packet_detailed(" no old info");
18897 }
18898
18899 if (BV_ISSET(fields, 0)) {
18900 log_packet_detailed(" got field 'city_id'");
18901#ifdef FREECIV_JSON_CONNECTION
18902 field_addr.name = "city_id";
18903#endif /* FREECIV_JSON_CONNECTION */
18904 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18905 RECEIVE_PACKET_FIELD_ERROR(city_id);
18906 }
18907 }
18908 if (BV_ISSET(fields, 1)) {
18909 log_packet_detailed(" got field 'production_kind'");
18910#ifdef FREECIV_JSON_CONNECTION
18911 field_addr.name = "production_kind";
18912#endif /* FREECIV_JSON_CONNECTION */
18913 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
18914 RECEIVE_PACKET_FIELD_ERROR(production_kind);
18915 }
18916 }
18917 if (BV_ISSET(fields, 2)) {
18918 log_packet_detailed(" got field 'production_value'");
18919#ifdef FREECIV_JSON_CONNECTION
18920 field_addr.name = "production_value";
18921#endif /* FREECIV_JSON_CONNECTION */
18922 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
18923 RECEIVE_PACKET_FIELD_ERROR(production_value);
18924 }
18925 }
18926
18927 if (nullptr == old) {
18928 old = fc_malloc(sizeof(*old));
18929 init_packet_city_change(old);
18930 *old = *real_packet;
18931 genhash_insert(*hash, old, old);
18932 } else {
18933 *old = *real_packet;
18934 }
18935
18936#endif /* FREECIV_DELTA_PROTOCOL */
18937 RECEIVE_PACKET_END(real_packet);
18938#undef FREE_PACKET_STRUCT
18939}
18940
18941 static int send_packet_city_change_100(struct connection *pc, const struct packet_city_change *packet)
18942{
18943 const struct packet_city_change *real_packet = packet;
18944 int e;
18945#ifdef FREECIV_DELTA_PROTOCOL
18946 packet_city_change_100_fields fields;
18947 struct packet_city_change *old;
18948 bool differ;
18949 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE;
18950#endif /* FREECIV_DELTA_PROTOCOL */
18951 SEND_PACKET_START(PACKET_CITY_CHANGE);
18952#ifdef FREECIV_JSON_CONNECTION
18953 struct plocation field_addr;
18954 {
18955 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
18956 field_addr = *field_addr_tmp;
18957 FC_FREE(field_addr_tmp);
18958 }
18959#endif /* FREECIV_JSON_CONNECTION */
18960
18961 log_packet_detailed("packet_city_change_100: sending info about ()");
18962
18963#ifdef FREECIV_DELTA_PROTOCOL
18964 if (nullptr == *hash) {
18965 *hash = genhash_new_full(hash_packet_city_change_100, cmp_packet_city_change_100,
18966 nullptr, nullptr, nullptr, destroy_packet_city_change);
18967 }
18968 BV_CLR_ALL(fields);
18969
18970 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18971 old = fc_malloc(sizeof(*old));
18972 /* temporary bitcopy just to insert correctly */
18973 *old = *real_packet;
18974 genhash_insert(*hash, old, old);
18975 init_packet_city_change(old);
18976 }
18977 differ = (old->city_id != real_packet->city_id);
18978 if (differ) {
18979 BV_SET(fields, 0);
18980 }
18981
18982 differ = (old->production_kind != real_packet->production_kind);
18983 if (differ) {
18984 BV_SET(fields, 1);
18985 }
18986
18987 differ = (old->production_value != real_packet->production_value);
18988 if (differ) {
18989 BV_SET(fields, 2);
18990 }
18991
18992
18993#ifdef FREECIV_JSON_CONNECTION
18994 field_addr.name = "fields";
18995#endif /* FREECIV_JSON_CONNECTION */
18996 e = 0;
18997 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18998 if (e) {
18999 log_packet_detailed("fields bitvector error detected");
19000 }
19001
19002 if (BV_ISSET(fields, 0)) {
19003 log_packet_detailed(" field 'city_id' has changed");
19004#ifdef FREECIV_JSON_CONNECTION
19005 field_addr.name = "city_id";
19006#endif /* FREECIV_JSON_CONNECTION */
19007 e = 0;
19008 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19009 if (e) {
19010 log_packet_detailed("'city_id' field error detected");
19011 }
19012 }
19013 if (BV_ISSET(fields, 1)) {
19014 log_packet_detailed(" field 'production_kind' has changed");
19015#ifdef FREECIV_JSON_CONNECTION
19016 field_addr.name = "production_kind";
19017#endif /* FREECIV_JSON_CONNECTION */
19018 e = 0;
19019 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
19020 if (e) {
19021 log_packet_detailed("'production_kind' field error detected");
19022 }
19023 }
19024 if (BV_ISSET(fields, 2)) {
19025 log_packet_detailed(" field 'production_value' has changed");
19026#ifdef FREECIV_JSON_CONNECTION
19027 field_addr.name = "production_value";
19028#endif /* FREECIV_JSON_CONNECTION */
19029 e = 0;
19030 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
19031 if (e) {
19032 log_packet_detailed("'production_value' field error detected");
19033 }
19034 }
19035
19036 *old = *real_packet;
19037#endif /* FREECIV_DELTA_PROTOCOL */
19038#ifndef FREECIV_DELTA_PROTOCOL
19039#ifdef FREECIV_JSON_CONNECTION
19040 field_addr.name = "city_id";
19041#endif /* FREECIV_JSON_CONNECTION */
19042 e = 0;
19043 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19044 if (e) {
19045 log_packet_detailed("'city_id' field error detected");
19046 }
19047#ifdef FREECIV_JSON_CONNECTION
19048 field_addr.name = "production_kind";
19049#endif /* FREECIV_JSON_CONNECTION */
19050 e = 0;
19051 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
19052 if (e) {
19053 log_packet_detailed("'production_kind' field error detected");
19054 }
19055#ifdef FREECIV_JSON_CONNECTION
19056 field_addr.name = "production_value";
19057#endif /* FREECIV_JSON_CONNECTION */
19058 e = 0;
19059 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
19060 if (e) {
19061 log_packet_detailed("'production_value' field error detected");
19062 }
19063
19064#endif
19065 SEND_PACKET_END(PACKET_CITY_CHANGE);
19066}
19067
19068 int send_packet_city_change(struct connection *pc, const struct packet_city_change *packet)
19069{
19070 if (!pc->used) {
19071 log_error("WARNING: trying to send data to the closed connection %s",
19072 conn_description(pc));
19073 return -1;
19074 }
19075 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_CHANGE].packet != nullptr, -1,
19076 "Handler for PACKET_CITY_CHANGE not installed");
19077 return pc->phs.handlers->send[PACKET_CITY_CHANGE].packet(pc, packet);
19078}
19079
19080 int dsend_packet_city_change(struct connection *pc, int city_id, int production_kind, int production_value)
19081{
19082 struct packet_city_change packet, *real_packet = &packet;
19083
19084 real_packet->city_id = city_id;
19085 real_packet->production_kind = production_kind;
19086 real_packet->production_value = production_value;
19087
19088 return send_packet_city_change(pc, real_packet);
19089}
19090
19091 static inline void init_packet_city_worklist(struct packet_city_worklist *packet)
19092{
19093 memset(packet, 0, sizeof(*packet));
19094}
19095
19096#define free_packet_city_worklist(_packet) (void) 0
19097#define destroy_packet_city_worklist free
19098
19099#ifdef FREECIV_DELTA_PROTOCOL
19100#define hash_packet_city_worklist_100 hash_const
19101
19102#define cmp_packet_city_worklist_100 cmp_const
19103
19104 BV_DEFINE(packet_city_worklist_100_fields, 2);
19105#endif /* FREECIV_DELTA_PROTOCOL */
19106
19107 static struct packet_city_worklist *receive_packet_city_worklist_100(struct connection *pc)
19108{
19109#define FREE_PACKET_STRUCT(_packet) free_packet_city_worklist(_packet)
19110#ifdef FREECIV_DELTA_PROTOCOL
19111 packet_city_worklist_100_fields fields;
19112 struct packet_city_worklist *old;
19113 struct genhash **hash = pc->phs.received + PACKET_CITY_WORKLIST;
19114#endif /* FREECIV_DELTA_PROTOCOL */
19115 RECEIVE_PACKET_START(packet_city_worklist, real_packet);
19116#ifdef FREECIV_JSON_CONNECTION
19117 struct plocation field_addr;
19118 {
19119 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19120 field_addr = *field_addr_tmp;
19121 FC_FREE(field_addr_tmp);
19122 }
19123#endif /* FREECIV_JSON_CONNECTION */
19124
19125#ifdef FREECIV_DELTA_PROTOCOL
19126#ifdef FREECIV_JSON_CONNECTION
19127 field_addr.name = "fields";
19128#endif /* FREECIV_JSON_CONNECTION */
19129 DIO_BV_GET(&din, &field_addr, fields);
19130
19131#else /* FREECIV_DELTA_PROTOCOL */
19132#ifdef FREECIV_JSON_CONNECTION
19133 field_addr.name = "city_id";
19134#endif /* FREECIV_JSON_CONNECTION */
19135 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19136 RECEIVE_PACKET_FIELD_ERROR(city_id);
19137 }
19138#ifdef FREECIV_JSON_CONNECTION
19139 field_addr.name = "worklist";
19140#endif /* FREECIV_JSON_CONNECTION */
19141 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
19142 RECEIVE_PACKET_FIELD_ERROR(worklist);
19143 }
19144#endif
19145 log_packet_detailed("packet_city_worklist_100: got info about ()");
19146
19147#ifdef FREECIV_DELTA_PROTOCOL
19148 if (nullptr == *hash) {
19149 *hash = genhash_new_full(hash_packet_city_worklist_100, cmp_packet_city_worklist_100,
19150 nullptr, nullptr, nullptr, destroy_packet_city_worklist);
19151 }
19152
19153 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19154 *real_packet = *old;
19155 } else {
19156 /* packet is already initialized empty */
19157 log_packet_detailed(" no old info");
19158 }
19159
19160 if (BV_ISSET(fields, 0)) {
19161 log_packet_detailed(" got field 'city_id'");
19162#ifdef FREECIV_JSON_CONNECTION
19163 field_addr.name = "city_id";
19164#endif /* FREECIV_JSON_CONNECTION */
19165 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19166 RECEIVE_PACKET_FIELD_ERROR(city_id);
19167 }
19168 }
19169 if (BV_ISSET(fields, 1)) {
19170 log_packet_detailed(" got field 'worklist'");
19171#ifdef FREECIV_JSON_CONNECTION
19172 field_addr.name = "worklist";
19173#endif /* FREECIV_JSON_CONNECTION */
19174 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
19175 RECEIVE_PACKET_FIELD_ERROR(worklist);
19176 }
19177 }
19178
19179 if (nullptr == old) {
19180 old = fc_malloc(sizeof(*old));
19181 init_packet_city_worklist(old);
19182 *old = *real_packet;
19183 genhash_insert(*hash, old, old);
19184 } else {
19185 *old = *real_packet;
19186 }
19187
19188#endif /* FREECIV_DELTA_PROTOCOL */
19189 RECEIVE_PACKET_END(real_packet);
19190#undef FREE_PACKET_STRUCT
19191}
19192
19193 static int send_packet_city_worklist_100(struct connection *pc, const struct packet_city_worklist *packet)
19194{
19195 const struct packet_city_worklist *real_packet = packet;
19196 int e;
19197#ifdef FREECIV_DELTA_PROTOCOL
19198 packet_city_worklist_100_fields fields;
19199 struct packet_city_worklist *old;
19200 bool differ;
19201 struct genhash **hash = pc->phs.sent + PACKET_CITY_WORKLIST;
19202#endif /* FREECIV_DELTA_PROTOCOL */
19203 SEND_PACKET_START(PACKET_CITY_WORKLIST);
19204#ifdef FREECIV_JSON_CONNECTION
19205 struct plocation field_addr;
19206 {
19207 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19208 field_addr = *field_addr_tmp;
19209 FC_FREE(field_addr_tmp);
19210 }
19211#endif /* FREECIV_JSON_CONNECTION */
19212
19213 log_packet_detailed("packet_city_worklist_100: sending info about ()");
19214
19215#ifdef FREECIV_DELTA_PROTOCOL
19216 if (nullptr == *hash) {
19217 *hash = genhash_new_full(hash_packet_city_worklist_100, cmp_packet_city_worklist_100,
19218 nullptr, nullptr, nullptr, destroy_packet_city_worklist);
19219 }
19220 BV_CLR_ALL(fields);
19221
19222 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19223 old = fc_malloc(sizeof(*old));
19224 /* temporary bitcopy just to insert correctly */
19225 *old = *real_packet;
19226 genhash_insert(*hash, old, old);
19227 init_packet_city_worklist(old);
19228 }
19229 differ = (old->city_id != real_packet->city_id);
19230 if (differ) {
19231 BV_SET(fields, 0);
19232 }
19233
19234 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
19235 if (differ) {
19236 BV_SET(fields, 1);
19237 }
19238
19239
19240#ifdef FREECIV_JSON_CONNECTION
19241 field_addr.name = "fields";
19242#endif /* FREECIV_JSON_CONNECTION */
19243 e = 0;
19244 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19245 if (e) {
19246 log_packet_detailed("fields bitvector error detected");
19247 }
19248
19249 if (BV_ISSET(fields, 0)) {
19250 log_packet_detailed(" field 'city_id' has changed");
19251#ifdef FREECIV_JSON_CONNECTION
19252 field_addr.name = "city_id";
19253#endif /* FREECIV_JSON_CONNECTION */
19254 e = 0;
19255 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19256 if (e) {
19257 log_packet_detailed("'city_id' field error detected");
19258 }
19259 }
19260 if (BV_ISSET(fields, 1)) {
19261 log_packet_detailed(" field 'worklist' has changed");
19262#ifdef FREECIV_JSON_CONNECTION
19263 field_addr.name = "worklist";
19264#endif /* FREECIV_JSON_CONNECTION */
19265 e = 0;
19266 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
19267 if (e) {
19268 log_packet_detailed("'worklist' field error detected");
19269 }
19270 }
19271
19272 *old = *real_packet;
19273#endif /* FREECIV_DELTA_PROTOCOL */
19274#ifndef FREECIV_DELTA_PROTOCOL
19275#ifdef FREECIV_JSON_CONNECTION
19276 field_addr.name = "city_id";
19277#endif /* FREECIV_JSON_CONNECTION */
19278 e = 0;
19279 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19280 if (e) {
19281 log_packet_detailed("'city_id' field error detected");
19282 }
19283#ifdef FREECIV_JSON_CONNECTION
19284 field_addr.name = "worklist";
19285#endif /* FREECIV_JSON_CONNECTION */
19286 e = 0;
19287 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
19288 if (e) {
19289 log_packet_detailed("'worklist' field error detected");
19290 }
19291
19292#endif
19293 SEND_PACKET_END(PACKET_CITY_WORKLIST);
19294}
19295
19296 int send_packet_city_worklist(struct connection *pc, const struct packet_city_worklist *packet)
19297{
19298 if (!pc->used) {
19299 log_error("WARNING: trying to send data to the closed connection %s",
19300 conn_description(pc));
19301 return -1;
19302 }
19303 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_WORKLIST].packet != nullptr, -1,
19304 "Handler for PACKET_CITY_WORKLIST not installed");
19305 return pc->phs.handlers->send[PACKET_CITY_WORKLIST].packet(pc, packet);
19306}
19307
19308 int dsend_packet_city_worklist(struct connection *pc, int city_id, const struct worklist *worklist)
19309{
19310 struct packet_city_worklist packet, *real_packet = &packet;
19311
19312 real_packet->city_id = city_id;
19313 worklist_copy(&real_packet->worklist, worklist);
19314
19315 return send_packet_city_worklist(pc, real_packet);
19316}
19317
19318 static inline void init_packet_city_make_specialist(struct packet_city_make_specialist *packet)
19319{
19320 memset(packet, 0, sizeof(*packet));
19321}
19322
19323#define free_packet_city_make_specialist(_packet) (void) 0
19324#define destroy_packet_city_make_specialist free
19325
19326#ifdef FREECIV_DELTA_PROTOCOL
19327#define hash_packet_city_make_specialist_100 hash_const
19328
19329#define cmp_packet_city_make_specialist_100 cmp_const
19330
19331 BV_DEFINE(packet_city_make_specialist_100_fields, 2);
19332#endif /* FREECIV_DELTA_PROTOCOL */
19333
19334 static struct packet_city_make_specialist *receive_packet_city_make_specialist_100(struct connection *pc)
19335{
19336#define FREE_PACKET_STRUCT(_packet) free_packet_city_make_specialist(_packet)
19337#ifdef FREECIV_DELTA_PROTOCOL
19338 packet_city_make_specialist_100_fields fields;
19339 struct packet_city_make_specialist *old;
19340 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_SPECIALIST;
19341#endif /* FREECIV_DELTA_PROTOCOL */
19342 RECEIVE_PACKET_START(packet_city_make_specialist, real_packet);
19343#ifdef FREECIV_JSON_CONNECTION
19344 struct plocation field_addr;
19345 {
19346 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19347 field_addr = *field_addr_tmp;
19348 FC_FREE(field_addr_tmp);
19349 }
19350#endif /* FREECIV_JSON_CONNECTION */
19351
19352#ifdef FREECIV_DELTA_PROTOCOL
19353#ifdef FREECIV_JSON_CONNECTION
19354 field_addr.name = "fields";
19355#endif /* FREECIV_JSON_CONNECTION */
19356 DIO_BV_GET(&din, &field_addr, fields);
19357
19358#else /* FREECIV_DELTA_PROTOCOL */
19359#ifdef FREECIV_JSON_CONNECTION
19360 field_addr.name = "city_id";
19361#endif /* FREECIV_JSON_CONNECTION */
19362 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19363 RECEIVE_PACKET_FIELD_ERROR(city_id);
19364 }
19365#ifdef FREECIV_JSON_CONNECTION
19366 field_addr.name = "tile_id";
19367#endif /* FREECIV_JSON_CONNECTION */
19368 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
19369 RECEIVE_PACKET_FIELD_ERROR(tile_id);
19370 }
19371#endif
19372 log_packet_detailed("packet_city_make_specialist_100: got info about ()");
19373
19374#ifdef FREECIV_DELTA_PROTOCOL
19375 if (nullptr == *hash) {
19376 *hash = genhash_new_full(hash_packet_city_make_specialist_100, cmp_packet_city_make_specialist_100,
19377 nullptr, nullptr, nullptr, destroy_packet_city_make_specialist);
19378 }
19379
19380 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19381 *real_packet = *old;
19382 } else {
19383 /* packet is already initialized empty */
19384 log_packet_detailed(" no old info");
19385 }
19386
19387 if (BV_ISSET(fields, 0)) {
19388 log_packet_detailed(" got field 'city_id'");
19389#ifdef FREECIV_JSON_CONNECTION
19390 field_addr.name = "city_id";
19391#endif /* FREECIV_JSON_CONNECTION */
19392 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19393 RECEIVE_PACKET_FIELD_ERROR(city_id);
19394 }
19395 }
19396 if (BV_ISSET(fields, 1)) {
19397 log_packet_detailed(" got field 'tile_id'");
19398#ifdef FREECIV_JSON_CONNECTION
19399 field_addr.name = "tile_id";
19400#endif /* FREECIV_JSON_CONNECTION */
19401 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
19402 RECEIVE_PACKET_FIELD_ERROR(tile_id);
19403 }
19404 }
19405
19406 if (nullptr == old) {
19407 old = fc_malloc(sizeof(*old));
19408 init_packet_city_make_specialist(old);
19409 *old = *real_packet;
19410 genhash_insert(*hash, old, old);
19411 } else {
19412 *old = *real_packet;
19413 }
19414
19415#endif /* FREECIV_DELTA_PROTOCOL */
19416 RECEIVE_PACKET_END(real_packet);
19417#undef FREE_PACKET_STRUCT
19418}
19419
19420 static int send_packet_city_make_specialist_100(struct connection *pc, const struct packet_city_make_specialist *packet)
19421{
19422 const struct packet_city_make_specialist *real_packet = packet;
19423 int e;
19424#ifdef FREECIV_DELTA_PROTOCOL
19425 packet_city_make_specialist_100_fields fields;
19426 struct packet_city_make_specialist *old;
19427 bool differ;
19428 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_SPECIALIST;
19429#endif /* FREECIV_DELTA_PROTOCOL */
19430 SEND_PACKET_START(PACKET_CITY_MAKE_SPECIALIST);
19431#ifdef FREECIV_JSON_CONNECTION
19432 struct plocation field_addr;
19433 {
19434 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19435 field_addr = *field_addr_tmp;
19436 FC_FREE(field_addr_tmp);
19437 }
19438#endif /* FREECIV_JSON_CONNECTION */
19439
19440 log_packet_detailed("packet_city_make_specialist_100: sending info about ()");
19441
19442#ifdef FREECIV_DELTA_PROTOCOL
19443 if (nullptr == *hash) {
19444 *hash = genhash_new_full(hash_packet_city_make_specialist_100, cmp_packet_city_make_specialist_100,
19445 nullptr, nullptr, nullptr, destroy_packet_city_make_specialist);
19446 }
19447 BV_CLR_ALL(fields);
19448
19449 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19450 old = fc_malloc(sizeof(*old));
19451 /* temporary bitcopy just to insert correctly */
19452 *old = *real_packet;
19453 genhash_insert(*hash, old, old);
19454 init_packet_city_make_specialist(old);
19455 }
19456 differ = (old->city_id != real_packet->city_id);
19457 if (differ) {
19458 BV_SET(fields, 0);
19459 }
19460
19461 differ = (old->tile_id != real_packet->tile_id);
19462 if (differ) {
19463 BV_SET(fields, 1);
19464 }
19465
19466
19467#ifdef FREECIV_JSON_CONNECTION
19468 field_addr.name = "fields";
19469#endif /* FREECIV_JSON_CONNECTION */
19470 e = 0;
19471 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19472 if (e) {
19473 log_packet_detailed("fields bitvector error detected");
19474 }
19475
19476 if (BV_ISSET(fields, 0)) {
19477 log_packet_detailed(" field 'city_id' has changed");
19478#ifdef FREECIV_JSON_CONNECTION
19479 field_addr.name = "city_id";
19480#endif /* FREECIV_JSON_CONNECTION */
19481 e = 0;
19482 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19483 if (e) {
19484 log_packet_detailed("'city_id' field error detected");
19485 }
19486 }
19487 if (BV_ISSET(fields, 1)) {
19488 log_packet_detailed(" field 'tile_id' has changed");
19489#ifdef FREECIV_JSON_CONNECTION
19490 field_addr.name = "tile_id";
19491#endif /* FREECIV_JSON_CONNECTION */
19492 e = 0;
19493 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19494 if (e) {
19495 log_packet_detailed("'tile_id' field error detected");
19496 }
19497 }
19498
19499 *old = *real_packet;
19500#endif /* FREECIV_DELTA_PROTOCOL */
19501#ifndef FREECIV_DELTA_PROTOCOL
19502#ifdef FREECIV_JSON_CONNECTION
19503 field_addr.name = "city_id";
19504#endif /* FREECIV_JSON_CONNECTION */
19505 e = 0;
19506 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19507 if (e) {
19508 log_packet_detailed("'city_id' field error detected");
19509 }
19510#ifdef FREECIV_JSON_CONNECTION
19511 field_addr.name = "tile_id";
19512#endif /* FREECIV_JSON_CONNECTION */
19513 e = 0;
19514 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19515 if (e) {
19516 log_packet_detailed("'tile_id' field error detected");
19517 }
19518
19519#endif
19520 SEND_PACKET_END(PACKET_CITY_MAKE_SPECIALIST);
19521}
19522
19523 int send_packet_city_make_specialist(struct connection *pc, const struct packet_city_make_specialist *packet)
19524{
19525 if (!pc->used) {
19526 log_error("WARNING: trying to send data to the closed connection %s",
19527 conn_description(pc));
19528 return -1;
19529 }
19530 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_MAKE_SPECIALIST].packet != nullptr, -1,
19531 "Handler for PACKET_CITY_MAKE_SPECIALIST not installed");
19532 return pc->phs.handlers->send[PACKET_CITY_MAKE_SPECIALIST].packet(pc, packet);
19533}
19534
19535 int dsend_packet_city_make_specialist(struct connection *pc, int city_id, int tile_id)
19536{
19537 struct packet_city_make_specialist packet, *real_packet = &packet;
19538
19539 real_packet->city_id = city_id;
19540 real_packet->tile_id = tile_id;
19541
19542 return send_packet_city_make_specialist(pc, real_packet);
19543}
19544
19545 static inline void init_packet_city_make_worker(struct packet_city_make_worker *packet)
19546{
19547 memset(packet, 0, sizeof(*packet));
19548}
19549
19550#define free_packet_city_make_worker(_packet) (void) 0
19551#define destroy_packet_city_make_worker free
19552
19553#ifdef FREECIV_DELTA_PROTOCOL
19554#define hash_packet_city_make_worker_100 hash_const
19555
19556#define cmp_packet_city_make_worker_100 cmp_const
19557
19558 BV_DEFINE(packet_city_make_worker_100_fields, 2);
19559#endif /* FREECIV_DELTA_PROTOCOL */
19560
19561 static struct packet_city_make_worker *receive_packet_city_make_worker_100(struct connection *pc)
19562{
19563#define FREE_PACKET_STRUCT(_packet) free_packet_city_make_worker(_packet)
19564#ifdef FREECIV_DELTA_PROTOCOL
19565 packet_city_make_worker_100_fields fields;
19566 struct packet_city_make_worker *old;
19567 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_WORKER;
19568#endif /* FREECIV_DELTA_PROTOCOL */
19569 RECEIVE_PACKET_START(packet_city_make_worker, real_packet);
19570#ifdef FREECIV_JSON_CONNECTION
19571 struct plocation field_addr;
19572 {
19573 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19574 field_addr = *field_addr_tmp;
19575 FC_FREE(field_addr_tmp);
19576 }
19577#endif /* FREECIV_JSON_CONNECTION */
19578
19579#ifdef FREECIV_DELTA_PROTOCOL
19580#ifdef FREECIV_JSON_CONNECTION
19581 field_addr.name = "fields";
19582#endif /* FREECIV_JSON_CONNECTION */
19583 DIO_BV_GET(&din, &field_addr, fields);
19584
19585#else /* FREECIV_DELTA_PROTOCOL */
19586#ifdef FREECIV_JSON_CONNECTION
19587 field_addr.name = "city_id";
19588#endif /* FREECIV_JSON_CONNECTION */
19589 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19590 RECEIVE_PACKET_FIELD_ERROR(city_id);
19591 }
19592#ifdef FREECIV_JSON_CONNECTION
19593 field_addr.name = "tile_id";
19594#endif /* FREECIV_JSON_CONNECTION */
19595 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
19596 RECEIVE_PACKET_FIELD_ERROR(tile_id);
19597 }
19598#endif
19599 log_packet_detailed("packet_city_make_worker_100: got info about ()");
19600
19601#ifdef FREECIV_DELTA_PROTOCOL
19602 if (nullptr == *hash) {
19603 *hash = genhash_new_full(hash_packet_city_make_worker_100, cmp_packet_city_make_worker_100,
19604 nullptr, nullptr, nullptr, destroy_packet_city_make_worker);
19605 }
19606
19607 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19608 *real_packet = *old;
19609 } else {
19610 /* packet is already initialized empty */
19611 log_packet_detailed(" no old info");
19612 }
19613
19614 if (BV_ISSET(fields, 0)) {
19615 log_packet_detailed(" got field 'city_id'");
19616#ifdef FREECIV_JSON_CONNECTION
19617 field_addr.name = "city_id";
19618#endif /* FREECIV_JSON_CONNECTION */
19619 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19620 RECEIVE_PACKET_FIELD_ERROR(city_id);
19621 }
19622 }
19623 if (BV_ISSET(fields, 1)) {
19624 log_packet_detailed(" got field 'tile_id'");
19625#ifdef FREECIV_JSON_CONNECTION
19626 field_addr.name = "tile_id";
19627#endif /* FREECIV_JSON_CONNECTION */
19628 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
19629 RECEIVE_PACKET_FIELD_ERROR(tile_id);
19630 }
19631 }
19632
19633 if (nullptr == old) {
19634 old = fc_malloc(sizeof(*old));
19635 init_packet_city_make_worker(old);
19636 *old = *real_packet;
19637 genhash_insert(*hash, old, old);
19638 } else {
19639 *old = *real_packet;
19640 }
19641
19642#endif /* FREECIV_DELTA_PROTOCOL */
19643 RECEIVE_PACKET_END(real_packet);
19644#undef FREE_PACKET_STRUCT
19645}
19646
19647 static int send_packet_city_make_worker_100(struct connection *pc, const struct packet_city_make_worker *packet)
19648{
19649 const struct packet_city_make_worker *real_packet = packet;
19650 int e;
19651#ifdef FREECIV_DELTA_PROTOCOL
19652 packet_city_make_worker_100_fields fields;
19653 struct packet_city_make_worker *old;
19654 bool differ;
19655 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_WORKER;
19656#endif /* FREECIV_DELTA_PROTOCOL */
19657 SEND_PACKET_START(PACKET_CITY_MAKE_WORKER);
19658#ifdef FREECIV_JSON_CONNECTION
19659 struct plocation field_addr;
19660 {
19661 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19662 field_addr = *field_addr_tmp;
19663 FC_FREE(field_addr_tmp);
19664 }
19665#endif /* FREECIV_JSON_CONNECTION */
19666
19667 log_packet_detailed("packet_city_make_worker_100: sending info about ()");
19668
19669#ifdef FREECIV_DELTA_PROTOCOL
19670 if (nullptr == *hash) {
19671 *hash = genhash_new_full(hash_packet_city_make_worker_100, cmp_packet_city_make_worker_100,
19672 nullptr, nullptr, nullptr, destroy_packet_city_make_worker);
19673 }
19674 BV_CLR_ALL(fields);
19675
19676 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19677 old = fc_malloc(sizeof(*old));
19678 /* temporary bitcopy just to insert correctly */
19679 *old = *real_packet;
19680 genhash_insert(*hash, old, old);
19681 init_packet_city_make_worker(old);
19682 }
19683 differ = (old->city_id != real_packet->city_id);
19684 if (differ) {
19685 BV_SET(fields, 0);
19686 }
19687
19688 differ = (old->tile_id != real_packet->tile_id);
19689 if (differ) {
19690 BV_SET(fields, 1);
19691 }
19692
19693
19694#ifdef FREECIV_JSON_CONNECTION
19695 field_addr.name = "fields";
19696#endif /* FREECIV_JSON_CONNECTION */
19697 e = 0;
19698 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19699 if (e) {
19700 log_packet_detailed("fields bitvector error detected");
19701 }
19702
19703 if (BV_ISSET(fields, 0)) {
19704 log_packet_detailed(" field 'city_id' has changed");
19705#ifdef FREECIV_JSON_CONNECTION
19706 field_addr.name = "city_id";
19707#endif /* FREECIV_JSON_CONNECTION */
19708 e = 0;
19709 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19710 if (e) {
19711 log_packet_detailed("'city_id' field error detected");
19712 }
19713 }
19714 if (BV_ISSET(fields, 1)) {
19715 log_packet_detailed(" field 'tile_id' has changed");
19716#ifdef FREECIV_JSON_CONNECTION
19717 field_addr.name = "tile_id";
19718#endif /* FREECIV_JSON_CONNECTION */
19719 e = 0;
19720 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19721 if (e) {
19722 log_packet_detailed("'tile_id' field error detected");
19723 }
19724 }
19725
19726 *old = *real_packet;
19727#endif /* FREECIV_DELTA_PROTOCOL */
19728#ifndef FREECIV_DELTA_PROTOCOL
19729#ifdef FREECIV_JSON_CONNECTION
19730 field_addr.name = "city_id";
19731#endif /* FREECIV_JSON_CONNECTION */
19732 e = 0;
19733 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19734 if (e) {
19735 log_packet_detailed("'city_id' field error detected");
19736 }
19737#ifdef FREECIV_JSON_CONNECTION
19738 field_addr.name = "tile_id";
19739#endif /* FREECIV_JSON_CONNECTION */
19740 e = 0;
19741 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19742 if (e) {
19743 log_packet_detailed("'tile_id' field error detected");
19744 }
19745
19746#endif
19747 SEND_PACKET_END(PACKET_CITY_MAKE_WORKER);
19748}
19749
19750 int send_packet_city_make_worker(struct connection *pc, const struct packet_city_make_worker *packet)
19751{
19752 if (!pc->used) {
19753 log_error("WARNING: trying to send data to the closed connection %s",
19754 conn_description(pc));
19755 return -1;
19756 }
19757 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_MAKE_WORKER].packet != nullptr, -1,
19758 "Handler for PACKET_CITY_MAKE_WORKER not installed");
19759 return pc->phs.handlers->send[PACKET_CITY_MAKE_WORKER].packet(pc, packet);
19760}
19761
19762 int dsend_packet_city_make_worker(struct connection *pc, int city_id, int tile_id)
19763{
19764 struct packet_city_make_worker packet, *real_packet = &packet;
19765
19766 real_packet->city_id = city_id;
19767 real_packet->tile_id = tile_id;
19768
19769 return send_packet_city_make_worker(pc, real_packet);
19770}
19771
19772 static inline void init_packet_city_change_specialist(struct packet_city_change_specialist *packet)
19773{
19774 memset(packet, 0, sizeof(*packet));
19775}
19776
19777#define free_packet_city_change_specialist(_packet) (void) 0
19778#define destroy_packet_city_change_specialist free
19779
19780#ifdef FREECIV_DELTA_PROTOCOL
19781#define hash_packet_city_change_specialist_100 hash_const
19782
19783#define cmp_packet_city_change_specialist_100 cmp_const
19784
19785 BV_DEFINE(packet_city_change_specialist_100_fields, 3);
19786#endif /* FREECIV_DELTA_PROTOCOL */
19787
19788 static struct packet_city_change_specialist *receive_packet_city_change_specialist_100(struct connection *pc)
19789{
19790#define FREE_PACKET_STRUCT(_packet) free_packet_city_change_specialist(_packet)
19791#ifdef FREECIV_DELTA_PROTOCOL
19792 packet_city_change_specialist_100_fields fields;
19793 struct packet_city_change_specialist *old;
19794 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE_SPECIALIST;
19795#endif /* FREECIV_DELTA_PROTOCOL */
19796 RECEIVE_PACKET_START(packet_city_change_specialist, real_packet);
19797#ifdef FREECIV_JSON_CONNECTION
19798 struct plocation field_addr;
19799 {
19800 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19801 field_addr = *field_addr_tmp;
19802 FC_FREE(field_addr_tmp);
19803 }
19804#endif /* FREECIV_JSON_CONNECTION */
19805
19806#ifdef FREECIV_DELTA_PROTOCOL
19807#ifdef FREECIV_JSON_CONNECTION
19808 field_addr.name = "fields";
19809#endif /* FREECIV_JSON_CONNECTION */
19810 DIO_BV_GET(&din, &field_addr, fields);
19811
19812#else /* FREECIV_DELTA_PROTOCOL */
19813#ifdef FREECIV_JSON_CONNECTION
19814 field_addr.name = "city_id";
19815#endif /* FREECIV_JSON_CONNECTION */
19816 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19817 RECEIVE_PACKET_FIELD_ERROR(city_id);
19818 }
19819#ifdef FREECIV_JSON_CONNECTION
19820 field_addr.name = "from";
19821#endif /* FREECIV_JSON_CONNECTION */
19822 {
19823 int readin;
19824
19825 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19826 RECEIVE_PACKET_FIELD_ERROR(from);
19827 }
19828 real_packet->from = readin;
19829 }
19830#ifdef FREECIV_JSON_CONNECTION
19831 field_addr.name = "to";
19832#endif /* FREECIV_JSON_CONNECTION */
19833 {
19834 int readin;
19835
19836 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19837 RECEIVE_PACKET_FIELD_ERROR(to);
19838 }
19839 real_packet->to = readin;
19840 }
19841#endif
19842 log_packet_detailed("packet_city_change_specialist_100: got info about ()");
19843
19844#ifdef FREECIV_DELTA_PROTOCOL
19845 if (nullptr == *hash) {
19846 *hash = genhash_new_full(hash_packet_city_change_specialist_100, cmp_packet_city_change_specialist_100,
19847 nullptr, nullptr, nullptr, destroy_packet_city_change_specialist);
19848 }
19849
19850 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19851 *real_packet = *old;
19852 } else {
19853 /* packet is already initialized empty */
19854 log_packet_detailed(" no old info");
19855 }
19856
19857 if (BV_ISSET(fields, 0)) {
19858 log_packet_detailed(" got field 'city_id'");
19859#ifdef FREECIV_JSON_CONNECTION
19860 field_addr.name = "city_id";
19861#endif /* FREECIV_JSON_CONNECTION */
19862 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19863 RECEIVE_PACKET_FIELD_ERROR(city_id);
19864 }
19865 }
19866 if (BV_ISSET(fields, 1)) {
19867 log_packet_detailed(" got field 'from'");
19868#ifdef FREECIV_JSON_CONNECTION
19869 field_addr.name = "from";
19870#endif /* FREECIV_JSON_CONNECTION */
19871 {
19872 int readin;
19873
19874 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19875 RECEIVE_PACKET_FIELD_ERROR(from);
19876 }
19877 real_packet->from = readin;
19878 }
19879 }
19880 if (BV_ISSET(fields, 2)) {
19881 log_packet_detailed(" got field 'to'");
19882#ifdef FREECIV_JSON_CONNECTION
19883 field_addr.name = "to";
19884#endif /* FREECIV_JSON_CONNECTION */
19885 {
19886 int readin;
19887
19888 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19889 RECEIVE_PACKET_FIELD_ERROR(to);
19890 }
19891 real_packet->to = readin;
19892 }
19893 }
19894
19895 if (nullptr == old) {
19896 old = fc_malloc(sizeof(*old));
19897 init_packet_city_change_specialist(old);
19898 *old = *real_packet;
19899 genhash_insert(*hash, old, old);
19900 } else {
19901 *old = *real_packet;
19902 }
19903
19904#endif /* FREECIV_DELTA_PROTOCOL */
19905 RECEIVE_PACKET_END(real_packet);
19906#undef FREE_PACKET_STRUCT
19907}
19908
19909 static int send_packet_city_change_specialist_100(struct connection *pc, const struct packet_city_change_specialist *packet)
19910{
19911 const struct packet_city_change_specialist *real_packet = packet;
19912 int e;
19913#ifdef FREECIV_DELTA_PROTOCOL
19914 packet_city_change_specialist_100_fields fields;
19915 struct packet_city_change_specialist *old;
19916 bool differ;
19917 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE_SPECIALIST;
19918#endif /* FREECIV_DELTA_PROTOCOL */
19919 SEND_PACKET_START(PACKET_CITY_CHANGE_SPECIALIST);
19920#ifdef FREECIV_JSON_CONNECTION
19921 struct plocation field_addr;
19922 {
19923 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
19924 field_addr = *field_addr_tmp;
19925 FC_FREE(field_addr_tmp);
19926 }
19927#endif /* FREECIV_JSON_CONNECTION */
19928
19929 log_packet_detailed("packet_city_change_specialist_100: sending info about ()");
19930
19931#ifdef FREECIV_DELTA_PROTOCOL
19932 if (nullptr == *hash) {
19933 *hash = genhash_new_full(hash_packet_city_change_specialist_100, cmp_packet_city_change_specialist_100,
19934 nullptr, nullptr, nullptr, destroy_packet_city_change_specialist);
19935 }
19936 BV_CLR_ALL(fields);
19937
19938 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19939 old = fc_malloc(sizeof(*old));
19940 /* temporary bitcopy just to insert correctly */
19941 *old = *real_packet;
19942 genhash_insert(*hash, old, old);
19943 init_packet_city_change_specialist(old);
19944 }
19945 differ = (old->city_id != real_packet->city_id);
19946 if (differ) {
19947 BV_SET(fields, 0);
19948 }
19949
19950 differ = (old->from != real_packet->from);
19951 if (differ) {
19952 BV_SET(fields, 1);
19953 }
19954
19955 differ = (old->to != real_packet->to);
19956 if (differ) {
19957 BV_SET(fields, 2);
19958 }
19959
19960
19961#ifdef FREECIV_JSON_CONNECTION
19962 field_addr.name = "fields";
19963#endif /* FREECIV_JSON_CONNECTION */
19964 e = 0;
19965 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19966 if (e) {
19967 log_packet_detailed("fields bitvector error detected");
19968 }
19969
19970 if (BV_ISSET(fields, 0)) {
19971 log_packet_detailed(" field 'city_id' has changed");
19972#ifdef FREECIV_JSON_CONNECTION
19973 field_addr.name = "city_id";
19974#endif /* FREECIV_JSON_CONNECTION */
19975 e = 0;
19976 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19977 if (e) {
19978 log_packet_detailed("'city_id' field error detected");
19979 }
19980 }
19981 if (BV_ISSET(fields, 1)) {
19982 log_packet_detailed(" field 'from' has changed");
19983#ifdef FREECIV_JSON_CONNECTION
19984 field_addr.name = "from";
19985#endif /* FREECIV_JSON_CONNECTION */
19986 e = 0;
19987 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
19988 if (e) {
19989 log_packet_detailed("'from' field error detected");
19990 }
19991 }
19992 if (BV_ISSET(fields, 2)) {
19993 log_packet_detailed(" field 'to' has changed");
19994#ifdef FREECIV_JSON_CONNECTION
19995 field_addr.name = "to";
19996#endif /* FREECIV_JSON_CONNECTION */
19997 e = 0;
19998 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
19999 if (e) {
20000 log_packet_detailed("'to' field error detected");
20001 }
20002 }
20003
20004 *old = *real_packet;
20005#endif /* FREECIV_DELTA_PROTOCOL */
20006#ifndef FREECIV_DELTA_PROTOCOL
20007#ifdef FREECIV_JSON_CONNECTION
20008 field_addr.name = "city_id";
20009#endif /* FREECIV_JSON_CONNECTION */
20010 e = 0;
20011 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20012 if (e) {
20013 log_packet_detailed("'city_id' field error detected");
20014 }
20015#ifdef FREECIV_JSON_CONNECTION
20016 field_addr.name = "from";
20017#endif /* FREECIV_JSON_CONNECTION */
20018 e = 0;
20019 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
20020 if (e) {
20021 log_packet_detailed("'from' field error detected");
20022 }
20023#ifdef FREECIV_JSON_CONNECTION
20024 field_addr.name = "to";
20025#endif /* FREECIV_JSON_CONNECTION */
20026 e = 0;
20027 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
20028 if (e) {
20029 log_packet_detailed("'to' field error detected");
20030 }
20031
20032#endif
20033 SEND_PACKET_END(PACKET_CITY_CHANGE_SPECIALIST);
20034}
20035
20036 int send_packet_city_change_specialist(struct connection *pc, const struct packet_city_change_specialist *packet)
20037{
20038 if (!pc->used) {
20039 log_error("WARNING: trying to send data to the closed connection %s",
20040 conn_description(pc));
20041 return -1;
20042 }
20043 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet != nullptr, -1,
20044 "Handler for PACKET_CITY_CHANGE_SPECIALIST not installed");
20045 return pc->phs.handlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet(pc, packet);
20046}
20047
20048 int dsend_packet_city_change_specialist(struct connection *pc, int city_id, Specialist_type_id from, Specialist_type_id to)
20049{
20050 struct packet_city_change_specialist packet, *real_packet = &packet;
20051
20052 real_packet->city_id = city_id;
20053 real_packet->from = from;
20054 real_packet->to = to;
20055
20056 return send_packet_city_change_specialist(pc, real_packet);
20057}
20058
20059 static inline void init_packet_city_rename(struct packet_city_rename *packet)
20060{
20061 memset(packet, 0, sizeof(*packet));
20062}
20063
20064#define free_packet_city_rename(_packet) (void) 0
20065#define destroy_packet_city_rename free
20066
20067#ifdef FREECIV_DELTA_PROTOCOL
20068#define hash_packet_city_rename_100 hash_const
20069
20070#define cmp_packet_city_rename_100 cmp_const
20071
20072 BV_DEFINE(packet_city_rename_100_fields, 2);
20073#endif /* FREECIV_DELTA_PROTOCOL */
20074
20075 static struct packet_city_rename *receive_packet_city_rename_100(struct connection *pc)
20076{
20077#define FREE_PACKET_STRUCT(_packet) free_packet_city_rename(_packet)
20078#ifdef FREECIV_DELTA_PROTOCOL
20079 packet_city_rename_100_fields fields;
20080 struct packet_city_rename *old;
20081 struct genhash **hash = pc->phs.received + PACKET_CITY_RENAME;
20082#endif /* FREECIV_DELTA_PROTOCOL */
20083 RECEIVE_PACKET_START(packet_city_rename, real_packet);
20084#ifdef FREECIV_JSON_CONNECTION
20085 struct plocation field_addr;
20086 {
20087 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20088 field_addr = *field_addr_tmp;
20089 FC_FREE(field_addr_tmp);
20090 }
20091#endif /* FREECIV_JSON_CONNECTION */
20092
20093#ifdef FREECIV_DELTA_PROTOCOL
20094#ifdef FREECIV_JSON_CONNECTION
20095 field_addr.name = "fields";
20096#endif /* FREECIV_JSON_CONNECTION */
20097 DIO_BV_GET(&din, &field_addr, fields);
20098
20099#else /* FREECIV_DELTA_PROTOCOL */
20100#ifdef FREECIV_JSON_CONNECTION
20101 field_addr.name = "city_id";
20102#endif /* FREECIV_JSON_CONNECTION */
20103 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20104 RECEIVE_PACKET_FIELD_ERROR(city_id);
20105 }
20106#ifdef FREECIV_JSON_CONNECTION
20107 field_addr.name = "name";
20108#endif /* FREECIV_JSON_CONNECTION */
20109 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
20110 RECEIVE_PACKET_FIELD_ERROR(name);
20111 }
20112#endif
20113 log_packet_detailed("packet_city_rename_100: got info about ()");
20114
20115#ifdef FREECIV_DELTA_PROTOCOL
20116 if (nullptr == *hash) {
20117 *hash = genhash_new_full(hash_packet_city_rename_100, cmp_packet_city_rename_100,
20118 nullptr, nullptr, nullptr, destroy_packet_city_rename);
20119 }
20120
20121 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20122 *real_packet = *old;
20123 } else {
20124 /* packet is already initialized empty */
20125 log_packet_detailed(" no old info");
20126 }
20127
20128 if (BV_ISSET(fields, 0)) {
20129 log_packet_detailed(" got field 'city_id'");
20130#ifdef FREECIV_JSON_CONNECTION
20131 field_addr.name = "city_id";
20132#endif /* FREECIV_JSON_CONNECTION */
20133 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20134 RECEIVE_PACKET_FIELD_ERROR(city_id);
20135 }
20136 }
20137 if (BV_ISSET(fields, 1)) {
20138 log_packet_detailed(" got field 'name'");
20139#ifdef FREECIV_JSON_CONNECTION
20140 field_addr.name = "name";
20141#endif /* FREECIV_JSON_CONNECTION */
20142 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
20143 RECEIVE_PACKET_FIELD_ERROR(name);
20144 }
20145 }
20146
20147 if (nullptr == old) {
20148 old = fc_malloc(sizeof(*old));
20149 init_packet_city_rename(old);
20150 *old = *real_packet;
20151 genhash_insert(*hash, old, old);
20152 } else {
20153 *old = *real_packet;
20154 }
20155
20156#endif /* FREECIV_DELTA_PROTOCOL */
20157 RECEIVE_PACKET_END(real_packet);
20158#undef FREE_PACKET_STRUCT
20159}
20160
20161 static int send_packet_city_rename_100(struct connection *pc, const struct packet_city_rename *packet)
20162{
20163 const struct packet_city_rename *real_packet = packet;
20164 int e;
20165#ifdef FREECIV_DELTA_PROTOCOL
20166 packet_city_rename_100_fields fields;
20167 struct packet_city_rename *old;
20168 bool differ;
20169 struct genhash **hash = pc->phs.sent + PACKET_CITY_RENAME;
20170#endif /* FREECIV_DELTA_PROTOCOL */
20171 SEND_PACKET_START(PACKET_CITY_RENAME);
20172#ifdef FREECIV_JSON_CONNECTION
20173 struct plocation field_addr;
20174 {
20175 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20176 field_addr = *field_addr_tmp;
20177 FC_FREE(field_addr_tmp);
20178 }
20179#endif /* FREECIV_JSON_CONNECTION */
20180
20181 log_packet_detailed("packet_city_rename_100: sending info about ()");
20182
20183#ifdef FREECIV_DELTA_PROTOCOL
20184 if (nullptr == *hash) {
20185 *hash = genhash_new_full(hash_packet_city_rename_100, cmp_packet_city_rename_100,
20186 nullptr, nullptr, nullptr, destroy_packet_city_rename);
20187 }
20188 BV_CLR_ALL(fields);
20189
20190 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20191 old = fc_malloc(sizeof(*old));
20192 /* temporary bitcopy just to insert correctly */
20193 *old = *real_packet;
20194 genhash_insert(*hash, old, old);
20195 init_packet_city_rename(old);
20196 }
20197 differ = (old->city_id != real_packet->city_id);
20198 if (differ) {
20199 BV_SET(fields, 0);
20200 }
20201
20202 differ = (strcmp(old->name, real_packet->name) != 0);
20203 if (differ) {
20204 BV_SET(fields, 1);
20205 }
20206
20207
20208#ifdef FREECIV_JSON_CONNECTION
20209 field_addr.name = "fields";
20210#endif /* FREECIV_JSON_CONNECTION */
20211 e = 0;
20212 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20213 if (e) {
20214 log_packet_detailed("fields bitvector error detected");
20215 }
20216
20217 if (BV_ISSET(fields, 0)) {
20218 log_packet_detailed(" field 'city_id' has changed");
20219#ifdef FREECIV_JSON_CONNECTION
20220 field_addr.name = "city_id";
20221#endif /* FREECIV_JSON_CONNECTION */
20222 e = 0;
20223 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20224 if (e) {
20225 log_packet_detailed("'city_id' field error detected");
20226 }
20227 }
20228 if (BV_ISSET(fields, 1)) {
20229 log_packet_detailed(" field 'name' has changed");
20230#ifdef FREECIV_JSON_CONNECTION
20231 field_addr.name = "name";
20232#endif /* FREECIV_JSON_CONNECTION */
20233 e = 0;
20234 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
20235 if (e) {
20236 log_packet_detailed("'name' field error detected");
20237 }
20238 }
20239
20240 *old = *real_packet;
20241#endif /* FREECIV_DELTA_PROTOCOL */
20242#ifndef FREECIV_DELTA_PROTOCOL
20243#ifdef FREECIV_JSON_CONNECTION
20244 field_addr.name = "city_id";
20245#endif /* FREECIV_JSON_CONNECTION */
20246 e = 0;
20247 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20248 if (e) {
20249 log_packet_detailed("'city_id' field error detected");
20250 }
20251#ifdef FREECIV_JSON_CONNECTION
20252 field_addr.name = "name";
20253#endif /* FREECIV_JSON_CONNECTION */
20254 e = 0;
20255 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
20256 if (e) {
20257 log_packet_detailed("'name' field error detected");
20258 }
20259
20260#endif
20261 SEND_PACKET_END(PACKET_CITY_RENAME);
20262}
20263
20264 int send_packet_city_rename(struct connection *pc, const struct packet_city_rename *packet)
20265{
20266 if (!pc->used) {
20267 log_error("WARNING: trying to send data to the closed connection %s",
20268 conn_description(pc));
20269 return -1;
20270 }
20271 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_RENAME].packet != nullptr, -1,
20272 "Handler for PACKET_CITY_RENAME not installed");
20273 return pc->phs.handlers->send[PACKET_CITY_RENAME].packet(pc, packet);
20274}
20275
20276 int dsend_packet_city_rename(struct connection *pc, int city_id, const char *name)
20277{
20278 struct packet_city_rename packet, *real_packet = &packet;
20279
20280 real_packet->city_id = city_id;
20281 sz_strlcpy(real_packet->name, name);
20282
20283 return send_packet_city_rename(pc, real_packet);
20284}
20285
20286 static inline void init_packet_city_options_req(struct packet_city_options_req *packet)
20287{
20288 memset(packet, 0, sizeof(*packet));
20289}
20290
20291#define free_packet_city_options_req(_packet) (void) 0
20292#define destroy_packet_city_options_req free
20293
20294#ifdef FREECIV_DELTA_PROTOCOL
20295#define hash_packet_city_options_req_100 hash_const
20296
20297#define cmp_packet_city_options_req_100 cmp_const
20298
20299 BV_DEFINE(packet_city_options_req_100_fields, 2);
20300#endif /* FREECIV_DELTA_PROTOCOL */
20301
20302 static struct packet_city_options_req *receive_packet_city_options_req_100(struct connection *pc)
20303{
20304#define FREE_PACKET_STRUCT(_packet) free_packet_city_options_req(_packet)
20305#ifdef FREECIV_DELTA_PROTOCOL
20306 packet_city_options_req_100_fields fields;
20307 struct packet_city_options_req *old;
20308 struct genhash **hash = pc->phs.received + PACKET_CITY_OPTIONS_REQ;
20309#endif /* FREECIV_DELTA_PROTOCOL */
20310 RECEIVE_PACKET_START(packet_city_options_req, real_packet);
20311#ifdef FREECIV_JSON_CONNECTION
20312 struct plocation field_addr;
20313 {
20314 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20315 field_addr = *field_addr_tmp;
20316 FC_FREE(field_addr_tmp);
20317 }
20318#endif /* FREECIV_JSON_CONNECTION */
20319
20320#ifdef FREECIV_DELTA_PROTOCOL
20321#ifdef FREECIV_JSON_CONNECTION
20322 field_addr.name = "fields";
20323#endif /* FREECIV_JSON_CONNECTION */
20324 DIO_BV_GET(&din, &field_addr, fields);
20325
20326#else /* FREECIV_DELTA_PROTOCOL */
20327#ifdef FREECIV_JSON_CONNECTION
20328 field_addr.name = "city_id";
20329#endif /* FREECIV_JSON_CONNECTION */
20330 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20331 RECEIVE_PACKET_FIELD_ERROR(city_id);
20332 }
20333#ifdef FREECIV_JSON_CONNECTION
20334 field_addr.name = "options";
20335#endif /* FREECIV_JSON_CONNECTION */
20336 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
20337 RECEIVE_PACKET_FIELD_ERROR(options);
20338 }
20339#endif
20340 log_packet_detailed("packet_city_options_req_100: got info about ()");
20341
20342#ifdef FREECIV_DELTA_PROTOCOL
20343 if (nullptr == *hash) {
20344 *hash = genhash_new_full(hash_packet_city_options_req_100, cmp_packet_city_options_req_100,
20345 nullptr, nullptr, nullptr, destroy_packet_city_options_req);
20346 }
20347
20348 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20349 *real_packet = *old;
20350 } else {
20351 /* packet is already initialized empty */
20352 log_packet_detailed(" no old info");
20353 }
20354
20355 if (BV_ISSET(fields, 0)) {
20356 log_packet_detailed(" got field 'city_id'");
20357#ifdef FREECIV_JSON_CONNECTION
20358 field_addr.name = "city_id";
20359#endif /* FREECIV_JSON_CONNECTION */
20360 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20361 RECEIVE_PACKET_FIELD_ERROR(city_id);
20362 }
20363 }
20364 if (BV_ISSET(fields, 1)) {
20365 log_packet_detailed(" got field 'options'");
20366#ifdef FREECIV_JSON_CONNECTION
20367 field_addr.name = "options";
20368#endif /* FREECIV_JSON_CONNECTION */
20369 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
20370 RECEIVE_PACKET_FIELD_ERROR(options);
20371 }
20372 }
20373
20374 if (nullptr == old) {
20375 old = fc_malloc(sizeof(*old));
20376 init_packet_city_options_req(old);
20377 *old = *real_packet;
20378 genhash_insert(*hash, old, old);
20379 } else {
20380 *old = *real_packet;
20381 }
20382
20383#endif /* FREECIV_DELTA_PROTOCOL */
20384 RECEIVE_PACKET_END(real_packet);
20385#undef FREE_PACKET_STRUCT
20386}
20387
20388 static int send_packet_city_options_req_100(struct connection *pc, const struct packet_city_options_req *packet)
20389{
20390 const struct packet_city_options_req *real_packet = packet;
20391 int e;
20392#ifdef FREECIV_DELTA_PROTOCOL
20393 packet_city_options_req_100_fields fields;
20394 struct packet_city_options_req *old;
20395 bool differ;
20396 struct genhash **hash = pc->phs.sent + PACKET_CITY_OPTIONS_REQ;
20397#endif /* FREECIV_DELTA_PROTOCOL */
20398 SEND_PACKET_START(PACKET_CITY_OPTIONS_REQ);
20399#ifdef FREECIV_JSON_CONNECTION
20400 struct plocation field_addr;
20401 {
20402 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20403 field_addr = *field_addr_tmp;
20404 FC_FREE(field_addr_tmp);
20405 }
20406#endif /* FREECIV_JSON_CONNECTION */
20407
20408 log_packet_detailed("packet_city_options_req_100: sending info about ()");
20409
20410#ifdef FREECIV_DELTA_PROTOCOL
20411 if (nullptr == *hash) {
20412 *hash = genhash_new_full(hash_packet_city_options_req_100, cmp_packet_city_options_req_100,
20413 nullptr, nullptr, nullptr, destroy_packet_city_options_req);
20414 }
20415 BV_CLR_ALL(fields);
20416
20417 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20418 old = fc_malloc(sizeof(*old));
20419 /* temporary bitcopy just to insert correctly */
20420 *old = *real_packet;
20421 genhash_insert(*hash, old, old);
20422 init_packet_city_options_req(old);
20423 }
20424 differ = (old->city_id != real_packet->city_id);
20425 if (differ) {
20426 BV_SET(fields, 0);
20427 }
20428
20429 differ = !BV_ARE_EQUAL(old->options, real_packet->options);
20430 if (differ) {
20431 BV_SET(fields, 1);
20432 }
20433
20434
20435#ifdef FREECIV_JSON_CONNECTION
20436 field_addr.name = "fields";
20437#endif /* FREECIV_JSON_CONNECTION */
20438 e = 0;
20439 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20440 if (e) {
20441 log_packet_detailed("fields bitvector error detected");
20442 }
20443
20444 if (BV_ISSET(fields, 0)) {
20445 log_packet_detailed(" field 'city_id' has changed");
20446#ifdef FREECIV_JSON_CONNECTION
20447 field_addr.name = "city_id";
20448#endif /* FREECIV_JSON_CONNECTION */
20449 e = 0;
20450 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20451 if (e) {
20452 log_packet_detailed("'city_id' field error detected");
20453 }
20454 }
20455 if (BV_ISSET(fields, 1)) {
20456 log_packet_detailed(" field 'options' has changed");
20457#ifdef FREECIV_JSON_CONNECTION
20458 field_addr.name = "options";
20459#endif /* FREECIV_JSON_CONNECTION */
20460 e = 0;
20461 e |= DIO_BV_PUT(&dout, &field_addr, packet->options);
20462 if (e) {
20463 log_packet_detailed("'options' field error detected");
20464 }
20465 }
20466
20467 *old = *real_packet;
20468#endif /* FREECIV_DELTA_PROTOCOL */
20469#ifndef FREECIV_DELTA_PROTOCOL
20470#ifdef FREECIV_JSON_CONNECTION
20471 field_addr.name = "city_id";
20472#endif /* FREECIV_JSON_CONNECTION */
20473 e = 0;
20474 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20475 if (e) {
20476 log_packet_detailed("'city_id' field error detected");
20477 }
20478#ifdef FREECIV_JSON_CONNECTION
20479 field_addr.name = "options";
20480#endif /* FREECIV_JSON_CONNECTION */
20481 e = 0;
20482 e |= DIO_BV_PUT(&dout, &field_addr, packet->options);
20483 if (e) {
20484 log_packet_detailed("'options' field error detected");
20485 }
20486
20487#endif
20488 SEND_PACKET_END(PACKET_CITY_OPTIONS_REQ);
20489}
20490
20491 int send_packet_city_options_req(struct connection *pc, const struct packet_city_options_req *packet)
20492{
20493 if (!pc->used) {
20494 log_error("WARNING: trying to send data to the closed connection %s",
20495 conn_description(pc));
20496 return -1;
20497 }
20498 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_OPTIONS_REQ].packet != nullptr, -1,
20499 "Handler for PACKET_CITY_OPTIONS_REQ not installed");
20500 return pc->phs.handlers->send[PACKET_CITY_OPTIONS_REQ].packet(pc, packet);
20501}
20502
20503 int dsend_packet_city_options_req(struct connection *pc, int city_id, bv_city_options options)
20504{
20505 struct packet_city_options_req packet, *real_packet = &packet;
20506
20507 real_packet->city_id = city_id;
20508 real_packet->options = options;
20509
20510 return send_packet_city_options_req(pc, real_packet);
20511}
20512
20513 static inline void init_packet_city_refresh(struct packet_city_refresh *packet)
20514{
20515 memset(packet, 0, sizeof(*packet));
20516}
20517
20518#define free_packet_city_refresh(_packet) (void) 0
20519#define destroy_packet_city_refresh free
20520
20521#ifdef FREECIV_DELTA_PROTOCOL
20522#define hash_packet_city_refresh_100 hash_const
20523
20524#define cmp_packet_city_refresh_100 cmp_const
20525
20526 BV_DEFINE(packet_city_refresh_100_fields, 1);
20527#endif /* FREECIV_DELTA_PROTOCOL */
20528
20529 static struct packet_city_refresh *receive_packet_city_refresh_100(struct connection *pc)
20530{
20531#define FREE_PACKET_STRUCT(_packet) free_packet_city_refresh(_packet)
20532#ifdef FREECIV_DELTA_PROTOCOL
20533 packet_city_refresh_100_fields fields;
20534 struct packet_city_refresh *old;
20535 struct genhash **hash = pc->phs.received + PACKET_CITY_REFRESH;
20536#endif /* FREECIV_DELTA_PROTOCOL */
20537 RECEIVE_PACKET_START(packet_city_refresh, real_packet);
20538#ifdef FREECIV_JSON_CONNECTION
20539 struct plocation field_addr;
20540 {
20541 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20542 field_addr = *field_addr_tmp;
20543 FC_FREE(field_addr_tmp);
20544 }
20545#endif /* FREECIV_JSON_CONNECTION */
20546
20547#ifdef FREECIV_DELTA_PROTOCOL
20548#ifdef FREECIV_JSON_CONNECTION
20549 field_addr.name = "fields";
20550#endif /* FREECIV_JSON_CONNECTION */
20551 DIO_BV_GET(&din, &field_addr, fields);
20552
20553#else /* FREECIV_DELTA_PROTOCOL */
20554#ifdef FREECIV_JSON_CONNECTION
20555 field_addr.name = "city_id";
20556#endif /* FREECIV_JSON_CONNECTION */
20557 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20558 RECEIVE_PACKET_FIELD_ERROR(city_id);
20559 }
20560#endif
20561 log_packet_detailed("packet_city_refresh_100: got info about ()");
20562
20563#ifdef FREECIV_DELTA_PROTOCOL
20564 if (nullptr == *hash) {
20565 *hash = genhash_new_full(hash_packet_city_refresh_100, cmp_packet_city_refresh_100,
20566 nullptr, nullptr, nullptr, destroy_packet_city_refresh);
20567 }
20568
20569 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20570 *real_packet = *old;
20571 } else {
20572 /* packet is already initialized empty */
20573 log_packet_detailed(" no old info");
20574 }
20575
20576 if (BV_ISSET(fields, 0)) {
20577 log_packet_detailed(" got field 'city_id'");
20578#ifdef FREECIV_JSON_CONNECTION
20579 field_addr.name = "city_id";
20580#endif /* FREECIV_JSON_CONNECTION */
20581 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20582 RECEIVE_PACKET_FIELD_ERROR(city_id);
20583 }
20584 }
20585
20586 if (nullptr == old) {
20587 old = fc_malloc(sizeof(*old));
20588 init_packet_city_refresh(old);
20589 *old = *real_packet;
20590 genhash_insert(*hash, old, old);
20591 } else {
20592 *old = *real_packet;
20593 }
20594
20595#endif /* FREECIV_DELTA_PROTOCOL */
20596 RECEIVE_PACKET_END(real_packet);
20597#undef FREE_PACKET_STRUCT
20598}
20599
20600 static int send_packet_city_refresh_100(struct connection *pc, const struct packet_city_refresh *packet)
20601{
20602 const struct packet_city_refresh *real_packet = packet;
20603 int e;
20604#ifdef FREECIV_DELTA_PROTOCOL
20605 packet_city_refresh_100_fields fields;
20606 struct packet_city_refresh *old;
20607 bool differ;
20608 struct genhash **hash = pc->phs.sent + PACKET_CITY_REFRESH;
20609#endif /* FREECIV_DELTA_PROTOCOL */
20610 SEND_PACKET_START(PACKET_CITY_REFRESH);
20611#ifdef FREECIV_JSON_CONNECTION
20612 struct plocation field_addr;
20613 {
20614 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20615 field_addr = *field_addr_tmp;
20616 FC_FREE(field_addr_tmp);
20617 }
20618#endif /* FREECIV_JSON_CONNECTION */
20619
20620 log_packet_detailed("packet_city_refresh_100: sending info about ()");
20621
20622#ifdef FREECIV_DELTA_PROTOCOL
20623 if (nullptr == *hash) {
20624 *hash = genhash_new_full(hash_packet_city_refresh_100, cmp_packet_city_refresh_100,
20625 nullptr, nullptr, nullptr, destroy_packet_city_refresh);
20626 }
20627 BV_CLR_ALL(fields);
20628
20629 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20630 old = fc_malloc(sizeof(*old));
20631 /* temporary bitcopy just to insert correctly */
20632 *old = *real_packet;
20633 genhash_insert(*hash, old, old);
20634 init_packet_city_refresh(old);
20635 }
20636 differ = (old->city_id != real_packet->city_id);
20637 if (differ) {
20638 BV_SET(fields, 0);
20639 }
20640
20641
20642#ifdef FREECIV_JSON_CONNECTION
20643 field_addr.name = "fields";
20644#endif /* FREECIV_JSON_CONNECTION */
20645 e = 0;
20646 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20647 if (e) {
20648 log_packet_detailed("fields bitvector error detected");
20649 }
20650
20651 if (BV_ISSET(fields, 0)) {
20652 log_packet_detailed(" field 'city_id' has changed");
20653#ifdef FREECIV_JSON_CONNECTION
20654 field_addr.name = "city_id";
20655#endif /* FREECIV_JSON_CONNECTION */
20656 e = 0;
20657 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20658 if (e) {
20659 log_packet_detailed("'city_id' field error detected");
20660 }
20661 }
20662
20663 *old = *real_packet;
20664#endif /* FREECIV_DELTA_PROTOCOL */
20665#ifndef FREECIV_DELTA_PROTOCOL
20666#ifdef FREECIV_JSON_CONNECTION
20667 field_addr.name = "city_id";
20668#endif /* FREECIV_JSON_CONNECTION */
20669 e = 0;
20670 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20671 if (e) {
20672 log_packet_detailed("'city_id' field error detected");
20673 }
20674
20675#endif
20676 SEND_PACKET_END(PACKET_CITY_REFRESH);
20677}
20678
20679 int send_packet_city_refresh(struct connection *pc, const struct packet_city_refresh *packet)
20680{
20681 if (!pc->used) {
20682 log_error("WARNING: trying to send data to the closed connection %s",
20683 conn_description(pc));
20684 return -1;
20685 }
20686 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_REFRESH].packet != nullptr, -1,
20687 "Handler for PACKET_CITY_REFRESH not installed");
20688 return pc->phs.handlers->send[PACKET_CITY_REFRESH].packet(pc, packet);
20689}
20690
20691 int dsend_packet_city_refresh(struct connection *pc, int city_id)
20692{
20693 struct packet_city_refresh packet, *real_packet = &packet;
20694
20695 real_packet->city_id = city_id;
20696
20697 return send_packet_city_refresh(pc, real_packet);
20698}
20699
20700 static inline void init_packet_city_name_suggestion_req(struct packet_city_name_suggestion_req *packet)
20701{
20702 memset(packet, 0, sizeof(*packet));
20703}
20704
20705#define free_packet_city_name_suggestion_req(_packet) (void) 0
20706#define destroy_packet_city_name_suggestion_req free
20707
20708#ifdef FREECIV_DELTA_PROTOCOL
20709#define hash_packet_city_name_suggestion_req_100 hash_const
20710
20711#define cmp_packet_city_name_suggestion_req_100 cmp_const
20712
20713 BV_DEFINE(packet_city_name_suggestion_req_100_fields, 1);
20714#endif /* FREECIV_DELTA_PROTOCOL */
20715
20716 static struct packet_city_name_suggestion_req *receive_packet_city_name_suggestion_req_100(struct connection *pc)
20717{
20718#define FREE_PACKET_STRUCT(_packet) free_packet_city_name_suggestion_req(_packet)
20719#ifdef FREECIV_DELTA_PROTOCOL
20720 packet_city_name_suggestion_req_100_fields fields;
20721 struct packet_city_name_suggestion_req *old;
20722 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_REQ;
20723#endif /* FREECIV_DELTA_PROTOCOL */
20724 RECEIVE_PACKET_START(packet_city_name_suggestion_req, real_packet);
20725#ifdef FREECIV_JSON_CONNECTION
20726 struct plocation field_addr;
20727 {
20728 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20729 field_addr = *field_addr_tmp;
20730 FC_FREE(field_addr_tmp);
20731 }
20732#endif /* FREECIV_JSON_CONNECTION */
20733
20734#ifdef FREECIV_DELTA_PROTOCOL
20735#ifdef FREECIV_JSON_CONNECTION
20736 field_addr.name = "fields";
20737#endif /* FREECIV_JSON_CONNECTION */
20738 DIO_BV_GET(&din, &field_addr, fields);
20739
20740#else /* FREECIV_DELTA_PROTOCOL */
20741#ifdef FREECIV_JSON_CONNECTION
20742 field_addr.name = "unit_id";
20743#endif /* FREECIV_JSON_CONNECTION */
20744 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20745 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20746 }
20747#endif
20748 log_packet_detailed("packet_city_name_suggestion_req_100: got info about ()");
20749
20750#ifdef FREECIV_DELTA_PROTOCOL
20751 if (nullptr == *hash) {
20752 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_100, cmp_packet_city_name_suggestion_req_100,
20753 nullptr, nullptr, nullptr, destroy_packet_city_name_suggestion_req);
20754 }
20755
20756 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20757 *real_packet = *old;
20758 } else {
20759 /* packet is already initialized empty */
20760 log_packet_detailed(" no old info");
20761 }
20762
20763 if (BV_ISSET(fields, 0)) {
20764 log_packet_detailed(" got field 'unit_id'");
20765#ifdef FREECIV_JSON_CONNECTION
20766 field_addr.name = "unit_id";
20767#endif /* FREECIV_JSON_CONNECTION */
20768 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20769 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20770 }
20771 }
20772
20773 if (nullptr == old) {
20774 old = fc_malloc(sizeof(*old));
20775 init_packet_city_name_suggestion_req(old);
20776 *old = *real_packet;
20777 genhash_insert(*hash, old, old);
20778 } else {
20779 *old = *real_packet;
20780 }
20781
20782#endif /* FREECIV_DELTA_PROTOCOL */
20783 RECEIVE_PACKET_END(real_packet);
20784#undef FREE_PACKET_STRUCT
20785}
20786
20787 static int send_packet_city_name_suggestion_req_100(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
20788{
20789 const struct packet_city_name_suggestion_req *real_packet = packet;
20790 int e;
20791#ifdef FREECIV_DELTA_PROTOCOL
20792 packet_city_name_suggestion_req_100_fields fields;
20793 struct packet_city_name_suggestion_req *old;
20794 bool differ;
20795 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_REQ;
20796#endif /* FREECIV_DELTA_PROTOCOL */
20797 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_REQ);
20798#ifdef FREECIV_JSON_CONNECTION
20799 struct plocation field_addr;
20800 {
20801 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20802 field_addr = *field_addr_tmp;
20803 FC_FREE(field_addr_tmp);
20804 }
20805#endif /* FREECIV_JSON_CONNECTION */
20806
20807 log_packet_detailed("packet_city_name_suggestion_req_100: sending info about ()");
20808
20809#ifdef FREECIV_DELTA_PROTOCOL
20810 if (nullptr == *hash) {
20811 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_100, cmp_packet_city_name_suggestion_req_100,
20812 nullptr, nullptr, nullptr, destroy_packet_city_name_suggestion_req);
20813 }
20814 BV_CLR_ALL(fields);
20815
20816 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20817 old = fc_malloc(sizeof(*old));
20818 /* temporary bitcopy just to insert correctly */
20819 *old = *real_packet;
20820 genhash_insert(*hash, old, old);
20821 init_packet_city_name_suggestion_req(old);
20822 }
20823 differ = (old->unit_id != real_packet->unit_id);
20824 if (differ) {
20825 BV_SET(fields, 0);
20826 }
20827
20828
20829#ifdef FREECIV_JSON_CONNECTION
20830 field_addr.name = "fields";
20831#endif /* FREECIV_JSON_CONNECTION */
20832 e = 0;
20833 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20834 if (e) {
20835 log_packet_detailed("fields bitvector error detected");
20836 }
20837
20838 if (BV_ISSET(fields, 0)) {
20839 log_packet_detailed(" field 'unit_id' has changed");
20840#ifdef FREECIV_JSON_CONNECTION
20841 field_addr.name = "unit_id";
20842#endif /* FREECIV_JSON_CONNECTION */
20843 e = 0;
20844 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
20845 if (e) {
20846 log_packet_detailed("'unit_id' field error detected");
20847 }
20848 }
20849
20850 *old = *real_packet;
20851#endif /* FREECIV_DELTA_PROTOCOL */
20852#ifndef FREECIV_DELTA_PROTOCOL
20853#ifdef FREECIV_JSON_CONNECTION
20854 field_addr.name = "unit_id";
20855#endif /* FREECIV_JSON_CONNECTION */
20856 e = 0;
20857 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
20858 if (e) {
20859 log_packet_detailed("'unit_id' field error detected");
20860 }
20861
20862#endif
20863 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_REQ);
20864}
20865
20866 int send_packet_city_name_suggestion_req(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
20867{
20868 if (!pc->used) {
20869 log_error("WARNING: trying to send data to the closed connection %s",
20870 conn_description(pc));
20871 return -1;
20872 }
20873 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet != nullptr, -1,
20874 "Handler for PACKET_CITY_NAME_SUGGESTION_REQ not installed");
20875 return pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet(pc, packet);
20876}
20877
20878 int dsend_packet_city_name_suggestion_req(struct connection *pc, int unit_id)
20879{
20880 struct packet_city_name_suggestion_req packet, *real_packet = &packet;
20881
20882 real_packet->unit_id = unit_id;
20883
20884 return send_packet_city_name_suggestion_req(pc, real_packet);
20885}
20886
20887 static inline void init_packet_city_name_suggestion_info(struct packet_city_name_suggestion_info *packet)
20888{
20889 memset(packet, 0, sizeof(*packet));
20890}
20891
20892#define free_packet_city_name_suggestion_info(_packet) (void) 0
20893#define destroy_packet_city_name_suggestion_info free
20894
20895#ifdef FREECIV_DELTA_PROTOCOL
20896#define hash_packet_city_name_suggestion_info_100 hash_const
20897
20898#define cmp_packet_city_name_suggestion_info_100 cmp_const
20899
20900 BV_DEFINE(packet_city_name_suggestion_info_100_fields, 2);
20901#endif /* FREECIV_DELTA_PROTOCOL */
20902
20903 static struct packet_city_name_suggestion_info *receive_packet_city_name_suggestion_info_100(struct connection *pc)
20904{
20905#define FREE_PACKET_STRUCT(_packet) free_packet_city_name_suggestion_info(_packet)
20906#ifdef FREECIV_DELTA_PROTOCOL
20907 packet_city_name_suggestion_info_100_fields fields;
20908 struct packet_city_name_suggestion_info *old;
20909 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_INFO;
20910#endif /* FREECIV_DELTA_PROTOCOL */
20911 RECEIVE_PACKET_START(packet_city_name_suggestion_info, real_packet);
20912#ifdef FREECIV_JSON_CONNECTION
20913 struct plocation field_addr;
20914 {
20915 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
20916 field_addr = *field_addr_tmp;
20917 FC_FREE(field_addr_tmp);
20918 }
20919#endif /* FREECIV_JSON_CONNECTION */
20920
20921#ifdef FREECIV_DELTA_PROTOCOL
20922#ifdef FREECIV_JSON_CONNECTION
20923 field_addr.name = "fields";
20924#endif /* FREECIV_JSON_CONNECTION */
20925 DIO_BV_GET(&din, &field_addr, fields);
20926
20927#else /* FREECIV_DELTA_PROTOCOL */
20928#ifdef FREECIV_JSON_CONNECTION
20929 field_addr.name = "unit_id";
20930#endif /* FREECIV_JSON_CONNECTION */
20931 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20932 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20933 }
20934#ifdef FREECIV_JSON_CONNECTION
20935 field_addr.name = "name";
20936#endif /* FREECIV_JSON_CONNECTION */
20937 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
20938 RECEIVE_PACKET_FIELD_ERROR(name);
20939 }
20940#endif
20941 log_packet_detailed("packet_city_name_suggestion_info_100: got info about ()");
20942
20943#ifdef FREECIV_DELTA_PROTOCOL
20944 if (nullptr == *hash) {
20945 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_100, cmp_packet_city_name_suggestion_info_100,
20946 nullptr, nullptr, nullptr, destroy_packet_city_name_suggestion_info);
20947 }
20948
20949 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20950 *real_packet = *old;
20951 } else {
20952 /* packet is already initialized empty */
20953 log_packet_detailed(" no old info");
20954 }
20955
20956 if (BV_ISSET(fields, 0)) {
20957 log_packet_detailed(" got field 'unit_id'");
20958#ifdef FREECIV_JSON_CONNECTION
20959 field_addr.name = "unit_id";
20960#endif /* FREECIV_JSON_CONNECTION */
20961 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20962 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20963 }
20964 }
20965 if (BV_ISSET(fields, 1)) {
20966 log_packet_detailed(" got field 'name'");
20967#ifdef FREECIV_JSON_CONNECTION
20968 field_addr.name = "name";
20969#endif /* FREECIV_JSON_CONNECTION */
20970 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
20971 RECEIVE_PACKET_FIELD_ERROR(name);
20972 }
20973 }
20974
20975 if (nullptr == old) {
20976 old = fc_malloc(sizeof(*old));
20977 init_packet_city_name_suggestion_info(old);
20978 *old = *real_packet;
20979 genhash_insert(*hash, old, old);
20980 } else {
20981 *old = *real_packet;
20982 }
20983
20984#endif /* FREECIV_DELTA_PROTOCOL */
20985 RECEIVE_PACKET_END(real_packet);
20986#undef FREE_PACKET_STRUCT
20987}
20988
20989 static int send_packet_city_name_suggestion_info_100(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
20990{
20991 const struct packet_city_name_suggestion_info *real_packet = packet;
20992 int e;
20993#ifdef FREECIV_DELTA_PROTOCOL
20994 packet_city_name_suggestion_info_100_fields fields;
20995 struct packet_city_name_suggestion_info *old;
20996 bool differ;
20997 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_INFO;
20998#endif /* FREECIV_DELTA_PROTOCOL */
20999 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_INFO);
21000#ifdef FREECIV_JSON_CONNECTION
21001 struct plocation field_addr;
21002 {
21003 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
21004 field_addr = *field_addr_tmp;
21005 FC_FREE(field_addr_tmp);
21006 }
21007#endif /* FREECIV_JSON_CONNECTION */
21008
21009 log_packet_detailed("packet_city_name_suggestion_info_100: sending info about ()");
21010
21011#ifdef FREECIV_DELTA_PROTOCOL
21012 if (nullptr == *hash) {
21013 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_100, cmp_packet_city_name_suggestion_info_100,
21014 nullptr, nullptr, nullptr, destroy_packet_city_name_suggestion_info);
21015 }
21016 BV_CLR_ALL(fields);
21017
21018 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
21019 old = fc_malloc(sizeof(*old));
21020 /* temporary bitcopy just to insert correctly */
21021 *old = *real_packet;
21022 genhash_insert(*hash, old, old);
21023 init_packet_city_name_suggestion_info(old);
21024 }
21025 differ = (old->unit_id != real_packet->unit_id);
21026 if (differ) {
21027 BV_SET(fields, 0);
21028 }
21029
21030 differ = (strcmp(old->name, real_packet->name) != 0);
21031 if (differ) {
21032 BV_SET(fields, 1);
21033 }
21034
21035
21036#ifdef FREECIV_JSON_CONNECTION
21037 field_addr.name = "fields";
21038#endif /* FREECIV_JSON_CONNECTION */
21039 e = 0;
21040 e |= DIO_BV_PUT(&dout, &field_addr, fields);
21041 if (e) {
21042 log_packet_detailed("fields bitvector error detected");
21043 }
21044
21045 if (BV_ISSET(fields, 0)) {
21046 log_packet_detailed(" field 'unit_id' has changed");
21047#ifdef FREECIV_JSON_CONNECTION
21048 field_addr.name = "unit_id";
21049#endif /* FREECIV_JSON_CONNECTION */
21050 e = 0;
21051 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
21052 if (e) {
21053 log_packet_detailed("'unit_id' field error detected");
21054 }
21055 }
21056 if (BV_ISSET(fields, 1)) {
21057 log_packet_detailed(" field 'name' has changed");
21058#ifdef FREECIV_JSON_CONNECTION
21059 field_addr.name = "name";
21060#endif /* FREECIV_JSON_CONNECTION */
21061 e = 0;
21062 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
21063 if (e) {
21064 log_packet_detailed("'name' field error detected");
21065 }
21066 }
21067
21068 *old = *real_packet;
21069#endif /* FREECIV_DELTA_PROTOCOL */
21070#ifndef FREECIV_DELTA_PROTOCOL
21071#ifdef FREECIV_JSON_CONNECTION
21072 field_addr.name = "unit_id";
21073#endif /* FREECIV_JSON_CONNECTION */
21074 e = 0;
21075 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
21076 if (e) {
21077 log_packet_detailed("'unit_id' field error detected");
21078 }
21079#ifdef FREECIV_JSON_CONNECTION
21080 field_addr.name = "name";
21081#endif /* FREECIV_JSON_CONNECTION */
21082 e = 0;
21083 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
21084 if (e) {
21085 log_packet_detailed("'name' field error detected");
21086 }
21087
21088#endif
21089 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_INFO);
21090}
21091
21092 int send_packet_city_name_suggestion_info(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
21093{
21094 if (!pc->used) {
21095 log_error("WARNING: trying to send data to the closed connection %s",
21096 conn_description(pc));
21097 return -1;
21098 }
21099 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet != nullptr, -1,
21100 "Handler for PACKET_CITY_NAME_SUGGESTION_INFO not installed");
21101 return pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet(pc, packet);
21102}
21103
21104 void lsend_packet_city_name_suggestion_info(struct conn_list *dest, const struct packet_city_name_suggestion_info *packet)
21105{
21106 conn_list_iterate(dest, pconn) {
21107 send_packet_city_name_suggestion_info(pconn, packet);
21108 } conn_list_iterate_end;
21109}
21110
21111 int dsend_packet_city_name_suggestion_info(struct connection *pc, int unit_id, const char *name)
21112{
21113 struct packet_city_name_suggestion_info packet, *real_packet = &packet;
21114
21115 real_packet->unit_id = unit_id;
21116 sz_strlcpy(real_packet->name, name);
21117
21118 return send_packet_city_name_suggestion_info(pc, real_packet);
21119}
21120
21121 void dlsend_packet_city_name_suggestion_info(struct conn_list *dest, int unit_id, const char *name)
21122{
21123 struct packet_city_name_suggestion_info packet, *real_packet = &packet;
21124
21125 real_packet->unit_id = unit_id;
21126 sz_strlcpy(real_packet->name, name);
21127
21128 lsend_packet_city_name_suggestion_info(dest, real_packet);
21129}
21130
21131 static inline void init_packet_city_sabotage_list(struct packet_city_sabotage_list *packet)
21132{
21133 memset(packet, 0, sizeof(*packet));
21134}
21135
21136#define free_packet_city_sabotage_list(_packet) (void) 0
21137#define destroy_packet_city_sabotage_list free
21138
21139#ifdef FREECIV_DELTA_PROTOCOL
21140#define hash_packet_city_sabotage_list_100 hash_const
21141
21142#define cmp_packet_city_sabotage_list_100 cmp_const
21143
21144 BV_DEFINE(packet_city_sabotage_list_100_fields, 5);
21145#endif /* FREECIV_DELTA_PROTOCOL */
21146
21147 static struct packet_city_sabotage_list *receive_packet_city_sabotage_list_100(struct connection *pc)
21148{
21149#define FREE_PACKET_STRUCT(_packet) free_packet_city_sabotage_list(_packet)
21150#ifdef FREECIV_DELTA_PROTOCOL
21151 packet_city_sabotage_list_100_fields fields;
21152 struct packet_city_sabotage_list *old;
21153 struct genhash **hash = pc->phs.received + PACKET_CITY_SABOTAGE_LIST;
21154#endif /* FREECIV_DELTA_PROTOCOL */
21155 RECEIVE_PACKET_START(packet_city_sabotage_list, real_packet);
21156#ifdef FREECIV_JSON_CONNECTION
21157 struct plocation field_addr;
21158 {
21159 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
21160 field_addr = *field_addr_tmp;
21161 FC_FREE(field_addr_tmp);
21162 }
21163#endif /* FREECIV_JSON_CONNECTION */
21164
21165#ifdef FREECIV_DELTA_PROTOCOL
21166#ifdef FREECIV_JSON_CONNECTION
21167 field_addr.name = "fields";
21168#endif /* FREECIV_JSON_CONNECTION */
21169 DIO_BV_GET(&din, &field_addr, fields);
21170
21171#else /* FREECIV_DELTA_PROTOCOL */
21172#ifdef FREECIV_JSON_CONNECTION
21173 field_addr.name = "actor_id";
21174#endif /* FREECIV_JSON_CONNECTION */
21175 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
21176 RECEIVE_PACKET_FIELD_ERROR(actor_id);
21177 }
21178#ifdef FREECIV_JSON_CONNECTION
21179 field_addr.name = "city_id";
21180#endif /* FREECIV_JSON_CONNECTION */
21181 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
21182 RECEIVE_PACKET_FIELD_ERROR(city_id);
21183 }
21184#ifdef FREECIV_JSON_CONNECTION
21185 field_addr.name = "improvements";
21186#endif /* FREECIV_JSON_CONNECTION */
21187 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
21188 RECEIVE_PACKET_FIELD_ERROR(improvements);
21189 }
21190#ifdef FREECIV_JSON_CONNECTION
21191 field_addr.name = "act_id";
21192#endif /* FREECIV_JSON_CONNECTION */
21193 {
21194 int readin;
21195
21196 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
21197 RECEIVE_PACKET_FIELD_ERROR(act_id);
21198 }
21199 real_packet->act_id = readin;
21200 }
21201#ifdef FREECIV_JSON_CONNECTION
21202 field_addr.name = "request_kind";
21203#endif /* FREECIV_JSON_CONNECTION */
21204 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
21205 RECEIVE_PACKET_FIELD_ERROR(request_kind);
21206 }
21207#endif
21208 log_packet_detailed("packet_city_sabotage_list_100: got info about ()");
21209
21210#ifdef FREECIV_DELTA_PROTOCOL
21211 if (nullptr == *hash) {
21212 *hash = genhash_new_full(hash_packet_city_sabotage_list_100, cmp_packet_city_sabotage_list_100,
21213 nullptr, nullptr, nullptr, destroy_packet_city_sabotage_list);
21214 }
21215
21216 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
21217 *real_packet = *old;
21218 } else {
21219 /* packet is already initialized empty */
21220 log_packet_detailed(" no old info");
21221 }
21222
21223 if (BV_ISSET(fields, 0)) {
21224 log_packet_detailed(" got field 'actor_id'");
21225#ifdef FREECIV_JSON_CONNECTION
21226 field_addr.name = "actor_id";
21227#endif /* FREECIV_JSON_CONNECTION */
21228 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
21229 RECEIVE_PACKET_FIELD_ERROR(actor_id);
21230 }
21231 }
21232 if (BV_ISSET(fields, 1)) {
21233 log_packet_detailed(" got field 'city_id'");
21234#ifdef FREECIV_JSON_CONNECTION
21235 field_addr.name = "city_id";
21236#endif /* FREECIV_JSON_CONNECTION */
21237 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
21238 RECEIVE_PACKET_FIELD_ERROR(city_id);
21239 }
21240 }
21241 if (BV_ISSET(fields, 2)) {
21242 log_packet_detailed(" got field 'improvements'");
21243#ifdef FREECIV_JSON_CONNECTION
21244 field_addr.name = "improvements";
21245#endif /* FREECIV_JSON_CONNECTION */
21246 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
21247 RECEIVE_PACKET_FIELD_ERROR(improvements);
21248 }
21249 }
21250 if (BV_ISSET(fields, 3)) {
21251 log_packet_detailed(" got field 'act_id'");
21252#ifdef FREECIV_JSON_CONNECTION
21253 field_addr.name = "act_id";
21254#endif /* FREECIV_JSON_CONNECTION */
21255 {
21256 int readin;
21257
21258 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
21259 RECEIVE_PACKET_FIELD_ERROR(act_id);
21260 }
21261 real_packet->act_id = readin;
21262 }
21263 }
21264 if (BV_ISSET(fields, 4)) {
21265 log_packet_detailed(" got field 'request_kind'");
21266#ifdef FREECIV_JSON_CONNECTION
21267 field_addr.name = "request_kind";
21268#endif /* FREECIV_JSON_CONNECTION */
21269 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
21270 RECEIVE_PACKET_FIELD_ERROR(request_kind);
21271 }
21272 }
21273
21274 if (nullptr == old) {
21275 old = fc_malloc(sizeof(*old));
21276 init_packet_city_sabotage_list(old);
21277 *old = *real_packet;
21278 genhash_insert(*hash, old, old);
21279 } else {
21280 *old = *real_packet;
21281 }
21282
21283#endif /* FREECIV_DELTA_PROTOCOL */
21284 RECEIVE_PACKET_END(real_packet);
21285#undef FREE_PACKET_STRUCT
21286}
21287
21288 static int send_packet_city_sabotage_list_100(struct connection *pc, const struct packet_city_sabotage_list *packet)
21289{
21290 const struct packet_city_sabotage_list *real_packet = packet;
21291 int e;
21292#ifdef FREECIV_DELTA_PROTOCOL
21293 packet_city_sabotage_list_100_fields fields;
21294 struct packet_city_sabotage_list *old;
21295 bool differ;
21296 struct genhash **hash = pc->phs.sent + PACKET_CITY_SABOTAGE_LIST;
21297#endif /* FREECIV_DELTA_PROTOCOL */
21298 SEND_PACKET_START(PACKET_CITY_SABOTAGE_LIST);
21299#ifdef FREECIV_JSON_CONNECTION
21300 struct plocation field_addr;
21301 {
21302 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
21303 field_addr = *field_addr_tmp;
21304 FC_FREE(field_addr_tmp);
21305 }
21306#endif /* FREECIV_JSON_CONNECTION */
21307
21308 log_packet_detailed("packet_city_sabotage_list_100: sending info about ()");
21309
21310#ifdef FREECIV_DELTA_PROTOCOL
21311 if (nullptr == *hash) {
21312 *hash = genhash_new_full(hash_packet_city_sabotage_list_100, cmp_packet_city_sabotage_list_100,
21313 nullptr, nullptr, nullptr, destroy_packet_city_sabotage_list);
21314 }
21315 BV_CLR_ALL(fields);
21316
21317 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
21318 old = fc_malloc(sizeof(*old));
21319 /* temporary bitcopy just to insert correctly */
21320 *old = *real_packet;
21321 genhash_insert(*hash, old, old);
21322 init_packet_city_sabotage_list(old);
21323 }
21324 differ = (old->actor_id != real_packet->actor_id);
21325 if (differ) {
21326 BV_SET(fields, 0);
21327 }
21328
21329 differ = (old->city_id != real_packet->city_id);
21330 if (differ) {
21331 BV_SET(fields, 1);
21332 }
21333
21334 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
21335 if (differ) {
21336 BV_SET(fields, 2);
21337 }
21338
21339 differ = (old->act_id != real_packet->act_id);
21340 if (differ) {
21341 BV_SET(fields, 3);
21342 }
21343
21344 differ = (old->request_kind != real_packet->request_kind);
21345 if (differ) {
21346 BV_SET(fields, 4);
21347 }
21348
21349
21350#ifdef FREECIV_JSON_CONNECTION
21351 field_addr.name = "fields";
21352#endif /* FREECIV_JSON_CONNECTION */
21353 e = 0;
21354 e |= DIO_BV_PUT(&dout, &field_addr, fields);
21355 if (e) {
21356 log_packet_detailed("fields bitvector error detected");
21357 }
21358
21359 if (BV_ISSET(fields, 0)) {
21360 log_packet_detailed(" field 'actor_id' has changed");
21361#ifdef FREECIV_JSON_CONNECTION
21362 field_addr.name = "actor_id";
21363#endif /* FREECIV_JSON_CONNECTION */
21364 e = 0;
21365 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
21366 if (e) {
21367 log_packet_detailed("'actor_id' field error detected");
21368 }
21369 }
21370 if (BV_ISSET(fields, 1)) {
21371 log_packet_detailed(" field 'city_id' has changed");
21372#ifdef FREECIV_JSON_CONNECTION
21373 field_addr.name = "city_id";
21374#endif /* FREECIV_JSON_CONNECTION */
21375 e = 0;
21376 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
21377 if (e) {
21378 log_packet_detailed("'city_id' field error detected");
21379 }
21380 }
21381 if (BV_ISSET(fields, 2)) {
21382 log_packet_detailed(" field 'improvements' has changed");
21383#ifdef FREECIV_JSON_CONNECTION
21384 field_addr.name = "improvements";
21385#endif /* FREECIV_JSON_CONNECTION */
21386 e = 0;
21387 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
21388 if (e) {
21389 log_packet_detailed("'improvements' field error detected");
21390 }
21391 }
21392 if (BV_ISSET(fields, 3)) {
21393 log_packet_detailed(" field 'act_id' has changed");
21394#ifdef FREECIV_JSON_CONNECTION
21395 field_addr.name = "act_id";
21396#endif /* FREECIV_JSON_CONNECTION */
21397 e = 0;
21398 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
21399 if (e) {
21400 log_packet_detailed("'act_id' field error detected");
21401 }
21402 }
21403 if (BV_ISSET(fields, 4)) {
21404 log_packet_detailed(" field 'request_kind' has changed");
21405#ifdef FREECIV_JSON_CONNECTION
21406 field_addr.name = "request_kind";
21407#endif /* FREECIV_JSON_CONNECTION */
21408 e = 0;
21409 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
21410 if (e) {
21411 log_packet_detailed("'request_kind' field error detected");
21412 }
21413 }
21414
21415 *old = *real_packet;
21416#endif /* FREECIV_DELTA_PROTOCOL */
21417#ifndef FREECIV_DELTA_PROTOCOL
21418#ifdef FREECIV_JSON_CONNECTION
21419 field_addr.name = "actor_id";
21420#endif /* FREECIV_JSON_CONNECTION */
21421 e = 0;
21422 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
21423 if (e) {
21424 log_packet_detailed("'actor_id' field error detected");
21425 }
21426#ifdef FREECIV_JSON_CONNECTION
21427 field_addr.name = "city_id";
21428#endif /* FREECIV_JSON_CONNECTION */
21429 e = 0;
21430 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
21431 if (e) {
21432 log_packet_detailed("'city_id' field error detected");
21433 }
21434#ifdef FREECIV_JSON_CONNECTION
21435 field_addr.name = "improvements";
21436#endif /* FREECIV_JSON_CONNECTION */
21437 e = 0;
21438 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
21439 if (e) {
21440 log_packet_detailed("'improvements' field error detected");
21441 }
21442#ifdef FREECIV_JSON_CONNECTION
21443 field_addr.name = "act_id";
21444#endif /* FREECIV_JSON_CONNECTION */
21445 e = 0;
21446 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
21447 if (e) {
21448 log_packet_detailed("'act_id' field error detected");
21449 }
21450#ifdef FREECIV_JSON_CONNECTION
21451 field_addr.name = "request_kind";
21452#endif /* FREECIV_JSON_CONNECTION */
21453 e = 0;
21454 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
21455 if (e) {
21456 log_packet_detailed("'request_kind' field error detected");
21457 }
21458
21459#endif
21460 SEND_PACKET_END(PACKET_CITY_SABOTAGE_LIST);
21461}
21462
21463 int send_packet_city_sabotage_list(struct connection *pc, const struct packet_city_sabotage_list *packet)
21464{
21465 if (!pc->used) {
21466 log_error("WARNING: trying to send data to the closed connection %s",
21467 conn_description(pc));
21468 return -1;
21469 }
21470 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SABOTAGE_LIST].packet != nullptr, -1,
21471 "Handler for PACKET_CITY_SABOTAGE_LIST not installed");
21472 return pc->phs.handlers->send[PACKET_CITY_SABOTAGE_LIST].packet(pc, packet);
21473}
21474
21475 void lsend_packet_city_sabotage_list(struct conn_list *dest, const struct packet_city_sabotage_list *packet)
21476{
21477 conn_list_iterate(dest, pconn) {
21478 send_packet_city_sabotage_list(pconn, packet);
21479 } conn_list_iterate_end;
21480}
21481
21482 static inline void init_packet_city_rally_point(struct packet_city_rally_point *packet)
21483{
21484 memset(packet, 0, sizeof(*packet));
21485}
21486
21487#define free_packet_city_rally_point(_packet) (void) 0
21488#define destroy_packet_city_rally_point free
21489
21490#ifdef FREECIV_DELTA_PROTOCOL
21491#define hash_packet_city_rally_point_100 hash_const
21492
21493#define cmp_packet_city_rally_point_100 cmp_const
21494
21495 BV_DEFINE(packet_city_rally_point_100_fields, 5);
21496#endif /* FREECIV_DELTA_PROTOCOL */
21497
21498 static struct packet_city_rally_point *receive_packet_city_rally_point_100(struct connection *pc)
21499{
21500#define FREE_PACKET_STRUCT(_packet) free_packet_city_rally_point(_packet)
21501#ifdef FREECIV_DELTA_PROTOCOL
21502 packet_city_rally_point_100_fields fields;
21503 struct packet_city_rally_point *old;
21504 struct genhash **hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
21505#endif /* FREECIV_DELTA_PROTOCOL */
21506 RECEIVE_PACKET_START(packet_city_rally_point, real_packet);
21507#ifdef FREECIV_JSON_CONNECTION
21508 struct plocation field_addr;
21509 {
21510 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
21511 field_addr = *field_addr_tmp;
21512 FC_FREE(field_addr_tmp);
21513 }
21514#endif /* FREECIV_JSON_CONNECTION */
21515
21516#ifdef FREECIV_DELTA_PROTOCOL
21517#ifdef FREECIV_JSON_CONNECTION
21518 field_addr.name = "fields";
21519#endif /* FREECIV_JSON_CONNECTION */
21520 DIO_BV_GET(&din, &field_addr, fields);
21521
21522#else /* FREECIV_DELTA_PROTOCOL */
21523#ifdef FREECIV_JSON_CONNECTION
21524 field_addr.name = "id";
21525#endif /* FREECIV_JSON_CONNECTION */
21526 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
21527 RECEIVE_PACKET_FIELD_ERROR(id);
21528 }
21529#ifdef FREECIV_JSON_CONNECTION
21530 field_addr.name = "length";
21531#endif /* FREECIV_JSON_CONNECTION */
21532 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
21533 RECEIVE_PACKET_FIELD_ERROR(length);
21534 }
21535#ifdef FREECIV_JSON_CONNECTION
21536 field_addr.name = "persistent";
21537#endif /* FREECIV_JSON_CONNECTION */
21538 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->persistent)) {
21539 RECEIVE_PACKET_FIELD_ERROR(persistent);
21540 }
21541#ifdef FREECIV_JSON_CONNECTION
21542 field_addr.name = "vigilant";
21543#endif /* FREECIV_JSON_CONNECTION */
21544 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
21545 RECEIVE_PACKET_FIELD_ERROR(vigilant);
21546 }
21547#ifdef FREECIV_JSON_CONNECTION
21548 field_addr.name = "orders";
21549#endif /* FREECIV_JSON_CONNECTION */
21550 {
21551 int i;
21552
21553#ifdef FREECIV_JSON_CONNECTION
21554 /* Enter array. */
21555 field_addr.sub_location = plocation_elem_new(0);
21556#endif /* FREECIV_JSON_CONNECTION */
21557
21558 if (real_packet->length > MAX_LEN_ROUTE) {
21559 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
21560 }
21561 for (i = 0; i < real_packet->length; i++) {
21562#ifdef FREECIV_JSON_CONNECTION
21563 field_addr.sub_location->number = i;
21564#endif /* FREECIV_JSON_CONNECTION */
21565 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
21566 RECEIVE_PACKET_FIELD_ERROR(orders);
21567 }
21568 }
21569
21570#ifdef FREECIV_JSON_CONNECTION
21571 /* Exit array. */
21572 FC_FREE(field_addr.sub_location);
21573#endif /* FREECIV_JSON_CONNECTION */
21574 }
21575#endif
21576 log_packet_detailed("packet_city_rally_point_100: got info about ()");
21577
21578#ifdef FREECIV_DELTA_PROTOCOL
21579 if (nullptr == *hash) {
21580 *hash = genhash_new_full(hash_packet_city_rally_point_100, cmp_packet_city_rally_point_100,
21581 nullptr, nullptr, nullptr, destroy_packet_city_rally_point);
21582 }
21583
21584 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
21585 *real_packet = *old;
21586 } else {
21587 /* packet is already initialized empty */
21588 log_packet_detailed(" no old info");
21589 }
21590
21591 if (BV_ISSET(fields, 0)) {
21592 log_packet_detailed(" got field 'id'");
21593#ifdef FREECIV_JSON_CONNECTION
21594 field_addr.name = "id";
21595#endif /* FREECIV_JSON_CONNECTION */
21596 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
21597 RECEIVE_PACKET_FIELD_ERROR(id);
21598 }
21599 }
21600 if (BV_ISSET(fields, 1)) {
21601 log_packet_detailed(" got field 'length'");
21602#ifdef FREECIV_JSON_CONNECTION
21603 field_addr.name = "length";
21604#endif /* FREECIV_JSON_CONNECTION */
21605 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
21606 RECEIVE_PACKET_FIELD_ERROR(length);
21607 }
21608 }
21609 real_packet->persistent = BV_ISSET(fields, 2);
21610 real_packet->vigilant = BV_ISSET(fields, 3);
21611 if (BV_ISSET(fields, 4)) {
21612 log_packet_detailed(" got field 'orders'");
21613#ifdef FREECIV_JSON_CONNECTION
21614 field_addr.name = "orders";
21615#endif /* FREECIV_JSON_CONNECTION */
21616 {
21617 int i;
21618
21619#ifdef FREECIV_JSON_CONNECTION
21620 /* Enter array. */
21621 field_addr.sub_location = plocation_elem_new(0);
21622#endif /* FREECIV_JSON_CONNECTION */
21623
21624 if (real_packet->length > MAX_LEN_ROUTE) {
21625 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
21626 }
21627 for (i = 0; i < real_packet->length; i++) {
21628#ifdef FREECIV_JSON_CONNECTION
21629 field_addr.sub_location->number = i;
21630#endif /* FREECIV_JSON_CONNECTION */
21631 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
21632 RECEIVE_PACKET_FIELD_ERROR(orders);
21633 }
21634 }
21635
21636#ifdef FREECIV_JSON_CONNECTION
21637 /* Exit array. */
21638 FC_FREE(field_addr.sub_location);
21639#endif /* FREECIV_JSON_CONNECTION */
21640 }
21641 }
21642
21643 if (nullptr == old) {
21644 old = fc_malloc(sizeof(*old));
21645 init_packet_city_rally_point(old);
21646 *old = *real_packet;
21647 genhash_insert(*hash, old, old);
21648 } else {
21649 *old = *real_packet;
21650 }
21651
21652#endif /* FREECIV_DELTA_PROTOCOL */
21653 RECEIVE_PACKET_END(real_packet);
21654#undef FREE_PACKET_STRUCT
21655}
21656
21657 static int send_packet_city_rally_point_100(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
21658{
21659 const struct packet_city_rally_point *real_packet = packet;
21660 int e;
21661#ifdef FREECIV_DELTA_PROTOCOL
21662 packet_city_rally_point_100_fields fields;
21663 struct packet_city_rally_point *old;
21664 bool differ;
21665 struct genhash **hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
21666 int different = force_to_send;
21667#endif /* FREECIV_DELTA_PROTOCOL */
21668 SEND_PACKET_START(PACKET_CITY_RALLY_POINT);
21669#ifdef FREECIV_JSON_CONNECTION
21670 struct plocation field_addr;
21671 {
21672 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
21673 field_addr = *field_addr_tmp;
21674 FC_FREE(field_addr_tmp);
21675 }
21676#endif /* FREECIV_JSON_CONNECTION */
21677
21678 log_packet_detailed("packet_city_rally_point_100: sending info about ()");
21679
21680#ifdef FREECIV_DELTA_PROTOCOL
21681 if (nullptr == *hash) {
21682 *hash = genhash_new_full(hash_packet_city_rally_point_100, cmp_packet_city_rally_point_100,
21683 nullptr, nullptr, nullptr, destroy_packet_city_rally_point);
21684 }
21685 BV_CLR_ALL(fields);
21686
21687 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
21688 old = fc_malloc(sizeof(*old));
21689 /* temporary bitcopy just to insert correctly */
21690 *old = *real_packet;
21691 genhash_insert(*hash, old, old);
21692 init_packet_city_rally_point(old);
21693 different = 1; /* Force to send. */
21694 }
21695 differ = (old->id != real_packet->id);
21696 if (differ) {
21697 different++;
21698 BV_SET(fields, 0);
21699 }
21700
21701 differ = (old->length != real_packet->length);
21702 if (differ) {
21703 different++;
21704 BV_SET(fields, 1);
21705 }
21706
21707 differ = (old->persistent != real_packet->persistent);
21708 if (differ) {
21709 different++;
21710 }
21711 if (packet->persistent) {
21712 BV_SET(fields, 2);
21713 }
21714
21715 differ = (old->vigilant != real_packet->vigilant);
21716 if (differ) {
21717 different++;
21718 }
21719 if (packet->vigilant) {
21720 BV_SET(fields, 3);
21721 }
21722
21723 differ = (old->length != real_packet->length);
21724 if (!differ) {
21725 int i;
21726
21727 for (i = 0; i < real_packet->length; i++) {
21728 differ = !are_unit_orders_equal(&old->orders[i], &real_packet->orders[i]);
21729 if (differ) {
21730 break;
21731 }
21732 }
21733 }
21734 if (differ) {
21735 different++;
21736 BV_SET(fields, 4);
21737 }
21738
21739 if (different == 0) {
21740 log_packet_detailed(" no change -> discard");
21741 return 0;
21742 }
21743
21744#ifdef FREECIV_JSON_CONNECTION
21745 field_addr.name = "fields";
21746#endif /* FREECIV_JSON_CONNECTION */
21747 e = 0;
21748 e |= DIO_BV_PUT(&dout, &field_addr, fields);
21749 if (e) {
21750 log_packet_detailed("fields bitvector error detected");
21751 }
21752
21753 if (BV_ISSET(fields, 0)) {
21754 log_packet_detailed(" field 'id' has changed");
21755#ifdef FREECIV_JSON_CONNECTION
21756 field_addr.name = "id";
21757#endif /* FREECIV_JSON_CONNECTION */
21758 e = 0;
21759 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
21760 if (e) {
21761 log_packet_detailed("'id' field error detected");
21762 }
21763 }
21764 if (BV_ISSET(fields, 1)) {
21765 log_packet_detailed(" field 'length' has changed");
21766#ifdef FREECIV_JSON_CONNECTION
21767 field_addr.name = "length";
21768#endif /* FREECIV_JSON_CONNECTION */
21769 e = 0;
21770 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
21771 if (e) {
21772 log_packet_detailed("'length' field error detected");
21773 }
21774 }
21775 /* field 2 is folded into the header */
21776 /* field 3 is folded into the header */
21777 if (BV_ISSET(fields, 4)) {
21778 log_packet_detailed(" field 'orders' has changed");
21779#ifdef FREECIV_JSON_CONNECTION
21780 field_addr.name = "orders";
21781#endif /* FREECIV_JSON_CONNECTION */
21782 e = 0;
21783 {
21784 int i;
21785
21786#ifdef FREECIV_JSON_CONNECTION
21787 /* Create the array. */
21788 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
21789
21790 /* Enter the array. */
21791 field_addr.sub_location = plocation_elem_new(0);
21792#endif /* FREECIV_JSON_CONNECTION */
21793
21794 for (i = 0; i < real_packet->length; i++) {
21795#ifdef FREECIV_JSON_CONNECTION
21796 /* Next array element. */
21797 field_addr.sub_location->number = i;
21798#endif /* FREECIV_JSON_CONNECTION */
21799 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
21800 }
21801
21802#ifdef FREECIV_JSON_CONNECTION
21803 /* Exit array. */
21804 FC_FREE(field_addr.sub_location);
21805#endif /* FREECIV_JSON_CONNECTION */
21806 }
21807 if (e) {
21808 log_packet_detailed("'orders' field error detected");
21809 }
21810 }
21811
21812 *old = *real_packet;
21813#endif /* FREECIV_DELTA_PROTOCOL */
21814#ifndef FREECIV_DELTA_PROTOCOL
21815#ifdef FREECIV_JSON_CONNECTION
21816 field_addr.name = "id";
21817#endif /* FREECIV_JSON_CONNECTION */
21818 e = 0;
21819 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
21820 if (e) {
21821 log_packet_detailed("'id' field error detected");
21822 }
21823#ifdef FREECIV_JSON_CONNECTION
21824 field_addr.name = "length";
21825#endif /* FREECIV_JSON_CONNECTION */
21826 e = 0;
21827 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
21828 if (e) {
21829 log_packet_detailed("'length' field error detected");
21830 }
21831#ifdef FREECIV_JSON_CONNECTION
21832 field_addr.name = "persistent";
21833#endif /* FREECIV_JSON_CONNECTION */
21834 e = 0;
21835 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->persistent);
21836 if (e) {
21837 log_packet_detailed("'persistent' field error detected");
21838 }
21839#ifdef FREECIV_JSON_CONNECTION
21840 field_addr.name = "vigilant";
21841#endif /* FREECIV_JSON_CONNECTION */
21842 e = 0;
21843 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
21844 if (e) {
21845 log_packet_detailed("'vigilant' field error detected");
21846 }
21847#ifdef FREECIV_JSON_CONNECTION
21848 field_addr.name = "orders";
21849#endif /* FREECIV_JSON_CONNECTION */
21850 e = 0;
21851 {
21852 int i;
21853
21854#ifdef FREECIV_JSON_CONNECTION
21855 /* Create the array. */
21856 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
21857
21858 /* Enter the array. */
21859 field_addr.sub_location = plocation_elem_new(0);
21860#endif /* FREECIV_JSON_CONNECTION */
21861
21862 for (i = 0; i < real_packet->length; i++) {
21863#ifdef FREECIV_JSON_CONNECTION
21864 /* Next array element. */
21865 field_addr.sub_location->number = i;
21866#endif /* FREECIV_JSON_CONNECTION */
21867 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
21868 }
21869
21870#ifdef FREECIV_JSON_CONNECTION
21871 /* Exit array. */
21872 FC_FREE(field_addr.sub_location);
21873#endif /* FREECIV_JSON_CONNECTION */
21874 }
21875 if (e) {
21876 log_packet_detailed("'orders' field error detected");
21877 }
21878
21879#endif
21880 SEND_PACKET_END(PACKET_CITY_RALLY_POINT);
21881}
21882
21883 int send_packet_city_rally_point(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
21884{
21885 if (!pc->used) {
21886 log_error("WARNING: trying to send data to the closed connection %s",
21887 conn_description(pc));
21888 return -1;
21889 }
21890 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_RALLY_POINT].force_to_send != nullptr, -1,
21891 "Handler for PACKET_CITY_RALLY_POINT not installed");
21892 return pc->phs.handlers->send[PACKET_CITY_RALLY_POINT].force_to_send(pc, packet, force_to_send);
21893}
21894
21895 void lsend_packet_city_rally_point(struct conn_list *dest, const struct packet_city_rally_point *packet, bool force_to_send)
21896{
21897 conn_list_iterate(dest, pconn) {
21898 send_packet_city_rally_point(pconn, packet, force_to_send);
21899 } conn_list_iterate_end;
21900}
21901
21902 static inline void init_packet_worker_task(struct packet_worker_task *packet)
21903{
21904 memset(packet, 0, sizeof(*packet));
21905}
21906
21907#define free_packet_worker_task(_packet) (void) 0
21908#define destroy_packet_worker_task free
21909
21910#ifdef FREECIV_DELTA_PROTOCOL
21911#define hash_packet_worker_task_100 hash_const
21912
21913#define cmp_packet_worker_task_100 cmp_const
21914
21915 BV_DEFINE(packet_worker_task_100_fields, 5);
21916#endif /* FREECIV_DELTA_PROTOCOL */
21917
21918 static struct packet_worker_task *receive_packet_worker_task_100(struct connection *pc)
21919{
21920#define FREE_PACKET_STRUCT(_packet) free_packet_worker_task(_packet)
21921#ifdef FREECIV_DELTA_PROTOCOL
21922 packet_worker_task_100_fields fields;
21923 struct packet_worker_task *old;
21924 struct genhash **hash = pc->phs.received + PACKET_WORKER_TASK;
21925#endif /* FREECIV_DELTA_PROTOCOL */
21926 RECEIVE_PACKET_START(packet_worker_task, real_packet);
21927#ifdef FREECIV_JSON_CONNECTION
21928 struct plocation field_addr;
21929 {
21930 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
21931 field_addr = *field_addr_tmp;
21932 FC_FREE(field_addr_tmp);
21933 }
21934#endif /* FREECIV_JSON_CONNECTION */
21935
21936#ifdef FREECIV_DELTA_PROTOCOL
21937#ifdef FREECIV_JSON_CONNECTION
21938 field_addr.name = "fields";
21939#endif /* FREECIV_JSON_CONNECTION */
21940 DIO_BV_GET(&din, &field_addr, fields);
21941
21942#else /* FREECIV_DELTA_PROTOCOL */
21943#ifdef FREECIV_JSON_CONNECTION
21944 field_addr.name = "city_id";
21945#endif /* FREECIV_JSON_CONNECTION */
21946 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
21947 RECEIVE_PACKET_FIELD_ERROR(city_id);
21948 }
21949#ifdef FREECIV_JSON_CONNECTION
21950 field_addr.name = "tile_id";
21951#endif /* FREECIV_JSON_CONNECTION */
21952 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
21953 RECEIVE_PACKET_FIELD_ERROR(tile_id);
21954 }
21955#ifdef FREECIV_JSON_CONNECTION
21956 field_addr.name = "activity";
21957#endif /* FREECIV_JSON_CONNECTION */
21958 {
21959 int readin;
21960
21961 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
21962 RECEIVE_PACKET_FIELD_ERROR(activity);
21963 }
21964 real_packet->activity = readin;
21965 }
21966#ifdef FREECIV_JSON_CONNECTION
21967 field_addr.name = "tgt";
21968#endif /* FREECIV_JSON_CONNECTION */
21969 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
21970 RECEIVE_PACKET_FIELD_ERROR(tgt);
21971 }
21972#ifdef FREECIV_JSON_CONNECTION
21973 field_addr.name = "want";
21974#endif /* FREECIV_JSON_CONNECTION */
21975 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
21976 RECEIVE_PACKET_FIELD_ERROR(want);
21977 }
21978#endif
21979 log_packet_detailed("packet_worker_task_100: got info about ()");
21980
21981#ifdef FREECIV_DELTA_PROTOCOL
21982 if (nullptr == *hash) {
21983 *hash = genhash_new_full(hash_packet_worker_task_100, cmp_packet_worker_task_100,
21984 nullptr, nullptr, nullptr, destroy_packet_worker_task);
21985 }
21986
21987 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
21988 *real_packet = *old;
21989 } else {
21990 /* packet is already initialized empty */
21991 log_packet_detailed(" no old info");
21992 }
21993
21994 if (BV_ISSET(fields, 0)) {
21995 log_packet_detailed(" got field 'city_id'");
21996#ifdef FREECIV_JSON_CONNECTION
21997 field_addr.name = "city_id";
21998#endif /* FREECIV_JSON_CONNECTION */
21999 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
22000 RECEIVE_PACKET_FIELD_ERROR(city_id);
22001 }
22002 }
22003 if (BV_ISSET(fields, 1)) {
22004 log_packet_detailed(" got field 'tile_id'");
22005#ifdef FREECIV_JSON_CONNECTION
22006 field_addr.name = "tile_id";
22007#endif /* FREECIV_JSON_CONNECTION */
22008 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
22009 RECEIVE_PACKET_FIELD_ERROR(tile_id);
22010 }
22011 }
22012 if (BV_ISSET(fields, 2)) {
22013 log_packet_detailed(" got field 'activity'");
22014#ifdef FREECIV_JSON_CONNECTION
22015 field_addr.name = "activity";
22016#endif /* FREECIV_JSON_CONNECTION */
22017 {
22018 int readin;
22019
22020 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22021 RECEIVE_PACKET_FIELD_ERROR(activity);
22022 }
22023 real_packet->activity = readin;
22024 }
22025 }
22026 if (BV_ISSET(fields, 3)) {
22027 log_packet_detailed(" got field 'tgt'");
22028#ifdef FREECIV_JSON_CONNECTION
22029 field_addr.name = "tgt";
22030#endif /* FREECIV_JSON_CONNECTION */
22031 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
22032 RECEIVE_PACKET_FIELD_ERROR(tgt);
22033 }
22034 }
22035 if (BV_ISSET(fields, 4)) {
22036 log_packet_detailed(" got field 'want'");
22037#ifdef FREECIV_JSON_CONNECTION
22038 field_addr.name = "want";
22039#endif /* FREECIV_JSON_CONNECTION */
22040 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
22041 RECEIVE_PACKET_FIELD_ERROR(want);
22042 }
22043 }
22044
22045 if (nullptr == old) {
22046 old = fc_malloc(sizeof(*old));
22047 init_packet_worker_task(old);
22048 *old = *real_packet;
22049 genhash_insert(*hash, old, old);
22050 } else {
22051 *old = *real_packet;
22052 }
22053
22054#endif /* FREECIV_DELTA_PROTOCOL */
22055 RECEIVE_PACKET_END(real_packet);
22056#undef FREE_PACKET_STRUCT
22057}
22058
22059 static int send_packet_worker_task_100(struct connection *pc, const struct packet_worker_task *packet)
22060{
22061 const struct packet_worker_task *real_packet = packet;
22062 int e;
22063#ifdef FREECIV_DELTA_PROTOCOL
22064 packet_worker_task_100_fields fields;
22065 struct packet_worker_task *old;
22066 bool differ;
22067 struct genhash **hash = pc->phs.sent + PACKET_WORKER_TASK;
22068#endif /* FREECIV_DELTA_PROTOCOL */
22069 SEND_PACKET_START(PACKET_WORKER_TASK);
22070#ifdef FREECIV_JSON_CONNECTION
22071 struct plocation field_addr;
22072 {
22073 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
22074 field_addr = *field_addr_tmp;
22075 FC_FREE(field_addr_tmp);
22076 }
22077#endif /* FREECIV_JSON_CONNECTION */
22078
22079 log_packet_detailed("packet_worker_task_100: sending info about ()");
22080
22081#ifdef FREECIV_DELTA_PROTOCOL
22082 if (nullptr == *hash) {
22083 *hash = genhash_new_full(hash_packet_worker_task_100, cmp_packet_worker_task_100,
22084 nullptr, nullptr, nullptr, destroy_packet_worker_task);
22085 }
22086 BV_CLR_ALL(fields);
22087
22088 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
22089 old = fc_malloc(sizeof(*old));
22090 /* temporary bitcopy just to insert correctly */
22091 *old = *real_packet;
22092 genhash_insert(*hash, old, old);
22093 init_packet_worker_task(old);
22094 }
22095 differ = (old->city_id != real_packet->city_id);
22096 if (differ) {
22097 BV_SET(fields, 0);
22098 }
22099
22100 differ = (old->tile_id != real_packet->tile_id);
22101 if (differ) {
22102 BV_SET(fields, 1);
22103 }
22104
22105 differ = (old->activity != real_packet->activity);
22106 if (differ) {
22107 BV_SET(fields, 2);
22108 }
22109
22110 differ = (old->tgt != real_packet->tgt);
22111 if (differ) {
22112 BV_SET(fields, 3);
22113 }
22114
22115 differ = (old->want != real_packet->want);
22116 if (differ) {
22117 BV_SET(fields, 4);
22118 }
22119
22120
22121#ifdef FREECIV_JSON_CONNECTION
22122 field_addr.name = "fields";
22123#endif /* FREECIV_JSON_CONNECTION */
22124 e = 0;
22125 e |= DIO_BV_PUT(&dout, &field_addr, fields);
22126 if (e) {
22127 log_packet_detailed("fields bitvector error detected");
22128 }
22129
22130 if (BV_ISSET(fields, 0)) {
22131 log_packet_detailed(" field 'city_id' has changed");
22132#ifdef FREECIV_JSON_CONNECTION
22133 field_addr.name = "city_id";
22134#endif /* FREECIV_JSON_CONNECTION */
22135 e = 0;
22136 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
22137 if (e) {
22138 log_packet_detailed("'city_id' field error detected");
22139 }
22140 }
22141 if (BV_ISSET(fields, 1)) {
22142 log_packet_detailed(" field 'tile_id' has changed");
22143#ifdef FREECIV_JSON_CONNECTION
22144 field_addr.name = "tile_id";
22145#endif /* FREECIV_JSON_CONNECTION */
22146 e = 0;
22147 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
22148 if (e) {
22149 log_packet_detailed("'tile_id' field error detected");
22150 }
22151 }
22152 if (BV_ISSET(fields, 2)) {
22153 log_packet_detailed(" field 'activity' has changed");
22154#ifdef FREECIV_JSON_CONNECTION
22155 field_addr.name = "activity";
22156#endif /* FREECIV_JSON_CONNECTION */
22157 e = 0;
22158 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
22159 if (e) {
22160 log_packet_detailed("'activity' field error detected");
22161 }
22162 }
22163 if (BV_ISSET(fields, 3)) {
22164 log_packet_detailed(" field 'tgt' has changed");
22165#ifdef FREECIV_JSON_CONNECTION
22166 field_addr.name = "tgt";
22167#endif /* FREECIV_JSON_CONNECTION */
22168 e = 0;
22169 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
22170 if (e) {
22171 log_packet_detailed("'tgt' field error detected");
22172 }
22173 }
22174 if (BV_ISSET(fields, 4)) {
22175 log_packet_detailed(" field 'want' has changed");
22176#ifdef FREECIV_JSON_CONNECTION
22177 field_addr.name = "want";
22178#endif /* FREECIV_JSON_CONNECTION */
22179 e = 0;
22180 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
22181 if (e) {
22182 log_packet_detailed("'want' field error detected");
22183 }
22184 }
22185
22186 *old = *real_packet;
22187#endif /* FREECIV_DELTA_PROTOCOL */
22188#ifndef FREECIV_DELTA_PROTOCOL
22189#ifdef FREECIV_JSON_CONNECTION
22190 field_addr.name = "city_id";
22191#endif /* FREECIV_JSON_CONNECTION */
22192 e = 0;
22193 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
22194 if (e) {
22195 log_packet_detailed("'city_id' field error detected");
22196 }
22197#ifdef FREECIV_JSON_CONNECTION
22198 field_addr.name = "tile_id";
22199#endif /* FREECIV_JSON_CONNECTION */
22200 e = 0;
22201 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
22202 if (e) {
22203 log_packet_detailed("'tile_id' field error detected");
22204 }
22205#ifdef FREECIV_JSON_CONNECTION
22206 field_addr.name = "activity";
22207#endif /* FREECIV_JSON_CONNECTION */
22208 e = 0;
22209 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
22210 if (e) {
22211 log_packet_detailed("'activity' field error detected");
22212 }
22213#ifdef FREECIV_JSON_CONNECTION
22214 field_addr.name = "tgt";
22215#endif /* FREECIV_JSON_CONNECTION */
22216 e = 0;
22217 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
22218 if (e) {
22219 log_packet_detailed("'tgt' field error detected");
22220 }
22221#ifdef FREECIV_JSON_CONNECTION
22222 field_addr.name = "want";
22223#endif /* FREECIV_JSON_CONNECTION */
22224 e = 0;
22225 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
22226 if (e) {
22227 log_packet_detailed("'want' field error detected");
22228 }
22229
22230#endif
22231 SEND_PACKET_END(PACKET_WORKER_TASK);
22232}
22233
22234 int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
22235{
22236 if (!pc->used) {
22237 log_error("WARNING: trying to send data to the closed connection %s",
22238 conn_description(pc));
22239 return -1;
22240 }
22241 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WORKER_TASK].packet != nullptr, -1,
22242 "Handler for PACKET_WORKER_TASK not installed");
22243 return pc->phs.handlers->send[PACKET_WORKER_TASK].packet(pc, packet);
22244}
22245
22246 void lsend_packet_worker_task(struct conn_list *dest, const struct packet_worker_task *packet)
22247{
22248 conn_list_iterate(dest, pconn) {
22249 send_packet_worker_task(pconn, packet);
22250 } conn_list_iterate_end;
22251}
22252
22253 static inline void init_packet_player_remove(struct packet_player_remove *packet)
22254{
22255 memset(packet, 0, sizeof(*packet));
22256}
22257
22258#define free_packet_player_remove(_packet) (void) 0
22259#define destroy_packet_player_remove free
22260
22261#ifdef FREECIV_DELTA_PROTOCOL
22262#define hash_packet_player_remove_100 hash_const
22263
22264#define cmp_packet_player_remove_100 cmp_const
22265
22266 BV_DEFINE(packet_player_remove_100_fields, 1);
22267#endif /* FREECIV_DELTA_PROTOCOL */
22268
22269 static struct packet_player_remove *receive_packet_player_remove_100(struct connection *pc)
22270{
22271#define FREE_PACKET_STRUCT(_packet) free_packet_player_remove(_packet)
22272#ifdef FREECIV_DELTA_PROTOCOL
22273 packet_player_remove_100_fields fields;
22274 struct packet_player_remove *old;
22275 struct genhash **hash = pc->phs.received + PACKET_PLAYER_REMOVE;
22276#endif /* FREECIV_DELTA_PROTOCOL */
22277 RECEIVE_PACKET_START(packet_player_remove, real_packet);
22278#ifdef FREECIV_JSON_CONNECTION
22279 struct plocation field_addr;
22280 {
22281 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
22282 field_addr = *field_addr_tmp;
22283 FC_FREE(field_addr_tmp);
22284 }
22285#endif /* FREECIV_JSON_CONNECTION */
22286
22287#ifdef FREECIV_DELTA_PROTOCOL
22288#ifdef FREECIV_JSON_CONNECTION
22289 field_addr.name = "fields";
22290#endif /* FREECIV_JSON_CONNECTION */
22291 DIO_BV_GET(&din, &field_addr, fields);
22292
22293#else /* FREECIV_DELTA_PROTOCOL */
22294#ifdef FREECIV_JSON_CONNECTION
22295 field_addr.name = "playerno";
22296#endif /* FREECIV_JSON_CONNECTION */
22297 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->playerno)) {
22298 RECEIVE_PACKET_FIELD_ERROR(playerno);
22299 }
22300#endif
22301 log_packet_detailed("packet_player_remove_100: got info about ()");
22302
22303#ifdef FREECIV_DELTA_PROTOCOL
22304 if (nullptr == *hash) {
22305 *hash = genhash_new_full(hash_packet_player_remove_100, cmp_packet_player_remove_100,
22306 nullptr, nullptr, nullptr, destroy_packet_player_remove);
22307 }
22308
22309 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
22310 *real_packet = *old;
22311 } else {
22312 /* packet is already initialized empty */
22313 log_packet_detailed(" no old info");
22314 }
22315
22316 if (BV_ISSET(fields, 0)) {
22317 log_packet_detailed(" got field 'playerno'");
22318#ifdef FREECIV_JSON_CONNECTION
22319 field_addr.name = "playerno";
22320#endif /* FREECIV_JSON_CONNECTION */
22321 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->playerno)) {
22322 RECEIVE_PACKET_FIELD_ERROR(playerno);
22323 }
22324 }
22325
22326 if (nullptr == old) {
22327 old = fc_malloc(sizeof(*old));
22328 init_packet_player_remove(old);
22329 *old = *real_packet;
22330 genhash_insert(*hash, old, old);
22331 } else {
22332 *old = *real_packet;
22333 }
22334
22335 hash = pc->phs.received + PACKET_PLAYER_INFO;
22336 if (nullptr != *hash) {
22337 genhash_remove(*hash, real_packet);
22338 }
22339
22340#endif /* FREECIV_DELTA_PROTOCOL */
22341 RECEIVE_PACKET_END(real_packet);
22342#undef FREE_PACKET_STRUCT
22343}
22344
22345 static int send_packet_player_remove_100(struct connection *pc, const struct packet_player_remove *packet)
22346{
22347 const struct packet_player_remove *real_packet = packet;
22348 int e;
22349#ifdef FREECIV_DELTA_PROTOCOL
22350 packet_player_remove_100_fields fields;
22351 struct packet_player_remove *old;
22352 bool differ;
22353 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_REMOVE;
22354#endif /* FREECIV_DELTA_PROTOCOL */
22355 SEND_PACKET_START(PACKET_PLAYER_REMOVE);
22356#ifdef FREECIV_JSON_CONNECTION
22357 struct plocation field_addr;
22358 {
22359 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
22360 field_addr = *field_addr_tmp;
22361 FC_FREE(field_addr_tmp);
22362 }
22363#endif /* FREECIV_JSON_CONNECTION */
22364
22365 log_packet_detailed("packet_player_remove_100: sending info about ()");
22366
22367#ifdef FREECIV_DELTA_PROTOCOL
22368 if (nullptr == *hash) {
22369 *hash = genhash_new_full(hash_packet_player_remove_100, cmp_packet_player_remove_100,
22370 nullptr, nullptr, nullptr, destroy_packet_player_remove);
22371 }
22372 BV_CLR_ALL(fields);
22373
22374 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
22375 old = fc_malloc(sizeof(*old));
22376 /* temporary bitcopy just to insert correctly */
22377 *old = *real_packet;
22378 genhash_insert(*hash, old, old);
22379 init_packet_player_remove(old);
22380 }
22381 differ = (old->playerno != real_packet->playerno);
22382 if (differ) {
22383 BV_SET(fields, 0);
22384 }
22385
22386
22387#ifdef FREECIV_JSON_CONNECTION
22388 field_addr.name = "fields";
22389#endif /* FREECIV_JSON_CONNECTION */
22390 e = 0;
22391 e |= DIO_BV_PUT(&dout, &field_addr, fields);
22392 if (e) {
22393 log_packet_detailed("fields bitvector error detected");
22394 }
22395
22396 if (BV_ISSET(fields, 0)) {
22397 log_packet_detailed(" field 'playerno' has changed");
22398#ifdef FREECIV_JSON_CONNECTION
22399 field_addr.name = "playerno";
22400#endif /* FREECIV_JSON_CONNECTION */
22401 e = 0;
22402 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->playerno);
22403 if (e) {
22404 log_packet_detailed("'playerno' field error detected");
22405 }
22406 }
22407
22408 *old = *real_packet;
22409
22410 hash = pc->phs.sent + PACKET_PLAYER_INFO;
22411 if (nullptr != *hash) {
22412 genhash_remove(*hash, real_packet);
22413 }
22414#endif /* FREECIV_DELTA_PROTOCOL */
22415#ifndef FREECIV_DELTA_PROTOCOL
22416#ifdef FREECIV_JSON_CONNECTION
22417 field_addr.name = "playerno";
22418#endif /* FREECIV_JSON_CONNECTION */
22419 e = 0;
22420 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->playerno);
22421 if (e) {
22422 log_packet_detailed("'playerno' field error detected");
22423 }
22424
22425#endif
22426 SEND_PACKET_END(PACKET_PLAYER_REMOVE);
22427}
22428
22429 int send_packet_player_remove(struct connection *pc, const struct packet_player_remove *packet)
22430{
22431 if (!pc->used) {
22432 log_error("WARNING: trying to send data to the closed connection %s",
22433 conn_description(pc));
22434 return -1;
22435 }
22436 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_REMOVE].packet != nullptr, -1,
22437 "Handler for PACKET_PLAYER_REMOVE not installed");
22438 return pc->phs.handlers->send[PACKET_PLAYER_REMOVE].packet(pc, packet);
22439}
22440
22441 int dsend_packet_player_remove(struct connection *pc, int playerno)
22442{
22443 struct packet_player_remove packet, *real_packet = &packet;
22444
22445 real_packet->playerno = playerno;
22446
22447 return send_packet_player_remove(pc, real_packet);
22448}
22449
22450 static inline void init_packet_player_info(struct packet_player_info *packet)
22451{
22452 memset(packet, 0, sizeof(*packet));
22453}
22454
22455#define free_packet_player_info(_packet) (void) 0
22456#define destroy_packet_player_info free
22457
22458#ifdef FREECIV_DELTA_PROTOCOL
22459static genhash_val_t hash_packet_player_info_100(const void *vkey)
22460{
22461 const struct packet_player_info *key = (const struct packet_player_info *) vkey;
22462 genhash_val_t result = 0;
22463
22464 result += key->playerno;
22465
22466 result &= 0xFFFFFFFF;
22467 return result;
22468}
22469
22470static bool cmp_packet_player_info_100(const void *vkey1, const void *vkey2)
22471{
22472 const struct packet_player_info *old = (const struct packet_player_info *) vkey1;
22473 const struct packet_player_info *real_packet = (const struct packet_player_info *) vkey2;
22474 bool differ;
22475
22476 differ = (old->playerno != real_packet->playerno);
22477
22478 return !differ;
22479}
22480 BV_DEFINE(packet_player_info_100_fields, 47);
22481#endif /* FREECIV_DELTA_PROTOCOL */
22482
22483 static struct packet_player_info *receive_packet_player_info_100(struct connection *pc)
22484{
22485#define FREE_PACKET_STRUCT(_packet) free_packet_player_info(_packet)
22486#ifdef FREECIV_DELTA_PROTOCOL
22487 packet_player_info_100_fields fields;
22488 struct packet_player_info *old;
22489 struct genhash **hash = pc->phs.received + PACKET_PLAYER_INFO;
22490#endif /* FREECIV_DELTA_PROTOCOL */
22491 RECEIVE_PACKET_START(packet_player_info, real_packet);
22492#ifdef FREECIV_JSON_CONNECTION
22493 struct plocation field_addr;
22494 {
22495 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
22496 field_addr = *field_addr_tmp;
22497 FC_FREE(field_addr_tmp);
22498 }
22499#endif /* FREECIV_JSON_CONNECTION */
22500
22501#ifdef FREECIV_DELTA_PROTOCOL
22502#ifdef FREECIV_JSON_CONNECTION
22503 field_addr.name = "fields";
22504#endif /* FREECIV_JSON_CONNECTION */
22505 DIO_BV_GET(&din, &field_addr, fields);
22506#ifdef FREECIV_JSON_CONNECTION
22507 field_addr.name = "playerno";
22508#endif /* FREECIV_JSON_CONNECTION */
22509 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->playerno)) {
22510 RECEIVE_PACKET_FIELD_ERROR(playerno);
22511 }
22512
22513#else /* FREECIV_DELTA_PROTOCOL */
22514#ifdef FREECIV_JSON_CONNECTION
22515 field_addr.name = "playerno";
22516#endif /* FREECIV_JSON_CONNECTION */
22517 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->playerno)) {
22518 RECEIVE_PACKET_FIELD_ERROR(playerno);
22519 }
22520#ifdef FREECIV_JSON_CONNECTION
22521 field_addr.name = "name";
22522#endif /* FREECIV_JSON_CONNECTION */
22523 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
22524 RECEIVE_PACKET_FIELD_ERROR(name);
22525 }
22526#ifdef FREECIV_JSON_CONNECTION
22527 field_addr.name = "username";
22528#endif /* FREECIV_JSON_CONNECTION */
22529 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
22530 RECEIVE_PACKET_FIELD_ERROR(username);
22531 }
22532#ifdef FREECIV_JSON_CONNECTION
22533 field_addr.name = "unassigned_user";
22534#endif /* FREECIV_JSON_CONNECTION */
22535 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unassigned_user)) {
22536 RECEIVE_PACKET_FIELD_ERROR(unassigned_user);
22537 }
22538#ifdef FREECIV_JSON_CONNECTION
22539 field_addr.name = "score";
22540#endif /* FREECIV_JSON_CONNECTION */
22541 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
22542 RECEIVE_PACKET_FIELD_ERROR(score);
22543 }
22544#ifdef FREECIV_JSON_CONNECTION
22545 field_addr.name = "is_male";
22546#endif /* FREECIV_JSON_CONNECTION */
22547 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
22548 RECEIVE_PACKET_FIELD_ERROR(is_male);
22549 }
22550#ifdef FREECIV_JSON_CONNECTION
22551 field_addr.name = "was_created";
22552#endif /* FREECIV_JSON_CONNECTION */
22553 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_created)) {
22554 RECEIVE_PACKET_FIELD_ERROR(was_created);
22555 }
22556#ifdef FREECIV_JSON_CONNECTION
22557 field_addr.name = "government";
22558#endif /* FREECIV_JSON_CONNECTION */
22559 {
22560 int readin;
22561
22562 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
22563 RECEIVE_PACKET_FIELD_ERROR(government);
22564 }
22565 real_packet->government = readin;
22566 }
22567#ifdef FREECIV_JSON_CONNECTION
22568 field_addr.name = "target_government";
22569#endif /* FREECIV_JSON_CONNECTION */
22570 {
22571 int readin;
22572
22573 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
22574 RECEIVE_PACKET_FIELD_ERROR(target_government);
22575 }
22576 real_packet->target_government = readin;
22577 }
22578#ifdef FREECIV_JSON_CONNECTION
22579 field_addr.name = "real_embassy";
22580#endif /* FREECIV_JSON_CONNECTION */
22581 if (!DIO_BV_GET(&din, &field_addr, real_packet->real_embassy)) {
22582 RECEIVE_PACKET_FIELD_ERROR(real_embassy);
22583 }
22584#ifdef FREECIV_JSON_CONNECTION
22585 field_addr.name = "mood";
22586#endif /* FREECIV_JSON_CONNECTION */
22587 {
22588 int readin;
22589
22590 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22591 RECEIVE_PACKET_FIELD_ERROR(mood);
22592 }
22593 real_packet->mood = readin;
22594 }
22595#ifdef FREECIV_JSON_CONNECTION
22596 field_addr.name = "style";
22597#endif /* FREECIV_JSON_CONNECTION */
22598 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
22599 RECEIVE_PACKET_FIELD_ERROR(style);
22600 }
22601#ifdef FREECIV_JSON_CONNECTION
22602 field_addr.name = "music_style";
22603#endif /* FREECIV_JSON_CONNECTION */
22604 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->music_style)) {
22605 RECEIVE_PACKET_FIELD_ERROR(music_style);
22606 }
22607#ifdef FREECIV_JSON_CONNECTION
22608 field_addr.name = "nation";
22609#endif /* FREECIV_JSON_CONNECTION */
22610 {
22611 int readin;
22612
22613 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
22614 RECEIVE_PACKET_FIELD_ERROR(nation);
22615 }
22616 real_packet->nation = readin;
22617 }
22618#ifdef FREECIV_JSON_CONNECTION
22619 field_addr.name = "team";
22620#endif /* FREECIV_JSON_CONNECTION */
22621 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->team)) {
22622 RECEIVE_PACKET_FIELD_ERROR(team);
22623 }
22624#ifdef FREECIV_JSON_CONNECTION
22625 field_addr.name = "is_ready";
22626#endif /* FREECIV_JSON_CONNECTION */
22627 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_ready)) {
22628 RECEIVE_PACKET_FIELD_ERROR(is_ready);
22629 }
22630#ifdef FREECIV_JSON_CONNECTION
22631 field_addr.name = "phase_done";
22632#endif /* FREECIV_JSON_CONNECTION */
22633 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->phase_done)) {
22634 RECEIVE_PACKET_FIELD_ERROR(phase_done);
22635 }
22636#ifdef FREECIV_JSON_CONNECTION
22637 field_addr.name = "nturns_idle";
22638#endif /* FREECIV_JSON_CONNECTION */
22639 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
22640 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
22641 }
22642#ifdef FREECIV_JSON_CONNECTION
22643 field_addr.name = "turns_alive";
22644#endif /* FREECIV_JSON_CONNECTION */
22645 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turns_alive)) {
22646 RECEIVE_PACKET_FIELD_ERROR(turns_alive);
22647 }
22648#ifdef FREECIV_JSON_CONNECTION
22649 field_addr.name = "is_alive";
22650#endif /* FREECIV_JSON_CONNECTION */
22651 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_alive)) {
22652 RECEIVE_PACKET_FIELD_ERROR(is_alive);
22653 }
22654#ifdef FREECIV_JSON_CONNECTION
22655 field_addr.name = "autoselect_weight";
22656#endif /* FREECIV_JSON_CONNECTION */
22657 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
22658 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
22659 }
22660#ifdef FREECIV_JSON_CONNECTION
22661 field_addr.name = "gold";
22662#endif /* FREECIV_JSON_CONNECTION */
22663 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
22664 RECEIVE_PACKET_FIELD_ERROR(gold);
22665 }
22666#ifdef FREECIV_JSON_CONNECTION
22667 field_addr.name = "tax";
22668#endif /* FREECIV_JSON_CONNECTION */
22669 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
22670 RECEIVE_PACKET_FIELD_ERROR(tax);
22671 }
22672#ifdef FREECIV_JSON_CONNECTION
22673 field_addr.name = "science";
22674#endif /* FREECIV_JSON_CONNECTION */
22675 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
22676 RECEIVE_PACKET_FIELD_ERROR(science);
22677 }
22678#ifdef FREECIV_JSON_CONNECTION
22679 field_addr.name = "luxury";
22680#endif /* FREECIV_JSON_CONNECTION */
22681 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
22682 RECEIVE_PACKET_FIELD_ERROR(luxury);
22683 }
22684#ifdef FREECIV_JSON_CONNECTION
22685 field_addr.name = "infrapoints";
22686#endif /* FREECIV_JSON_CONNECTION */
22687 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
22688 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
22689 }
22690#ifdef FREECIV_JSON_CONNECTION
22691 field_addr.name = "tech_upkeep";
22692#endif /* FREECIV_JSON_CONNECTION */
22693 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep)) {
22694 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep);
22695 }
22696#ifdef FREECIV_JSON_CONNECTION
22697 field_addr.name = "science_cost";
22698#endif /* FREECIV_JSON_CONNECTION */
22699 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->science_cost)) {
22700 RECEIVE_PACKET_FIELD_ERROR(science_cost);
22701 }
22702#ifdef FREECIV_JSON_CONNECTION
22703 field_addr.name = "is_connected";
22704#endif /* FREECIV_JSON_CONNECTION */
22705 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_connected)) {
22706 RECEIVE_PACKET_FIELD_ERROR(is_connected);
22707 }
22708#ifdef FREECIV_JSON_CONNECTION
22709 field_addr.name = "revolution_finishes";
22710#endif /* FREECIV_JSON_CONNECTION */
22711 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
22712 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
22713 }
22714#ifdef FREECIV_JSON_CONNECTION
22715 field_addr.name = "ai_skill_level";
22716#endif /* FREECIV_JSON_CONNECTION */
22717 {
22718 int readin;
22719
22720 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22721 RECEIVE_PACKET_FIELD_ERROR(ai_skill_level);
22722 }
22723 real_packet->ai_skill_level = readin;
22724 }
22725#ifdef FREECIV_JSON_CONNECTION
22726 field_addr.name = "barbarian_type";
22727#endif /* FREECIV_JSON_CONNECTION */
22728 {
22729 int readin;
22730
22731 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22732 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
22733 }
22734 real_packet->barbarian_type = readin;
22735 }
22736#ifdef FREECIV_JSON_CONNECTION
22737 field_addr.name = "gives_shared_vision";
22738#endif /* FREECIV_JSON_CONNECTION */
22739 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_vision)) {
22740 RECEIVE_PACKET_FIELD_ERROR(gives_shared_vision);
22741 }
22742#ifdef FREECIV_JSON_CONNECTION
22743 field_addr.name = "gives_shared_tiles";
22744#endif /* FREECIV_JSON_CONNECTION */
22745 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_tiles)) {
22746 RECEIVE_PACKET_FIELD_ERROR(gives_shared_tiles);
22747 }
22748#ifdef FREECIV_JSON_CONNECTION
22749 field_addr.name = "history";
22750#endif /* FREECIV_JSON_CONNECTION */
22751 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
22752 RECEIVE_PACKET_FIELD_ERROR(history);
22753 }
22754#ifdef FREECIV_JSON_CONNECTION
22755 field_addr.name = "culture";
22756#endif /* FREECIV_JSON_CONNECTION */
22757 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
22758 RECEIVE_PACKET_FIELD_ERROR(culture);
22759 }
22760#ifdef FREECIV_JSON_CONNECTION
22761 field_addr.name = "love";
22762#endif /* FREECIV_JSON_CONNECTION */
22763 {
22764 int i;
22765
22766#ifdef FREECIV_JSON_CONNECTION
22767 /* Enter array. */
22768 field_addr.sub_location = plocation_elem_new(0);
22769#endif /* FREECIV_JSON_CONNECTION */
22770
22771 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
22772#ifdef FREECIV_JSON_CONNECTION
22773 field_addr.sub_location->number = i;
22774#endif /* FREECIV_JSON_CONNECTION */
22775 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->love[i])) {
22776 RECEIVE_PACKET_FIELD_ERROR(love);
22777 }
22778 }
22779
22780#ifdef FREECIV_JSON_CONNECTION
22781 /* Exit array. */
22782 FC_FREE(field_addr.sub_location);
22783#endif /* FREECIV_JSON_CONNECTION */
22784 }
22785#ifdef FREECIV_JSON_CONNECTION
22786 field_addr.name = "color_valid";
22787#endif /* FREECIV_JSON_CONNECTION */
22788 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->color_valid)) {
22789 RECEIVE_PACKET_FIELD_ERROR(color_valid);
22790 }
22791#ifdef FREECIV_JSON_CONNECTION
22792 field_addr.name = "color_changeable";
22793#endif /* FREECIV_JSON_CONNECTION */
22794 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->color_changeable)) {
22795 RECEIVE_PACKET_FIELD_ERROR(color_changeable);
22796 }
22797#ifdef FREECIV_JSON_CONNECTION
22798 field_addr.name = "color_red";
22799#endif /* FREECIV_JSON_CONNECTION */
22800 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
22801 RECEIVE_PACKET_FIELD_ERROR(color_red);
22802 }
22803#ifdef FREECIV_JSON_CONNECTION
22804 field_addr.name = "color_green";
22805#endif /* FREECIV_JSON_CONNECTION */
22806 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
22807 RECEIVE_PACKET_FIELD_ERROR(color_green);
22808 }
22809#ifdef FREECIV_JSON_CONNECTION
22810 field_addr.name = "color_blue";
22811#endif /* FREECIV_JSON_CONNECTION */
22812 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
22813 RECEIVE_PACKET_FIELD_ERROR(color_blue);
22814 }
22815#ifdef FREECIV_JSON_CONNECTION
22816 field_addr.name = "flags";
22817#endif /* FREECIV_JSON_CONNECTION */
22818 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
22819 RECEIVE_PACKET_FIELD_ERROR(flags);
22820 }
22821#ifdef FREECIV_JSON_CONNECTION
22822 field_addr.name = "wonders";
22823#endif /* FREECIV_JSON_CONNECTION */
22824 {
22825 int i;
22826
22827#ifdef FREECIV_JSON_CONNECTION
22828 /* Enter array. */
22829 field_addr.sub_location = plocation_elem_new(0);
22830#endif /* FREECIV_JSON_CONNECTION */
22831
22832 for (i = 0; i < B_LAST; i++) {
22833#ifdef FREECIV_JSON_CONNECTION
22834 field_addr.sub_location->number = i;
22835#endif /* FREECIV_JSON_CONNECTION */
22836 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->wonders[i])) {
22837 RECEIVE_PACKET_FIELD_ERROR(wonders);
22838 }
22839 }
22840
22841#ifdef FREECIV_JSON_CONNECTION
22842 /* Exit array. */
22843 FC_FREE(field_addr.sub_location);
22844#endif /* FREECIV_JSON_CONNECTION */
22845 }
22846#ifdef FREECIV_JSON_CONNECTION
22847 field_addr.name = "multip_count";
22848#endif /* FREECIV_JSON_CONNECTION */
22849 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->multip_count)) {
22850 RECEIVE_PACKET_FIELD_ERROR(multip_count);
22851 }
22852#ifdef FREECIV_JSON_CONNECTION
22853 field_addr.name = "multiplier";
22854#endif /* FREECIV_JSON_CONNECTION */
22855 {
22856 int i;
22857
22858#ifdef FREECIV_JSON_CONNECTION
22859 /* Enter array. */
22860 field_addr.sub_location = plocation_elem_new(0);
22861#endif /* FREECIV_JSON_CONNECTION */
22862
22863 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22864 RECEIVE_PACKET_FIELD_ERROR(multiplier, ": truncation array");
22865 }
22866 for (i = 0; i < real_packet->multip_count; i++) {
22867#ifdef FREECIV_JSON_CONNECTION
22868 field_addr.sub_location->number = i;
22869#endif /* FREECIV_JSON_CONNECTION */
22870 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier[i])) {
22871 RECEIVE_PACKET_FIELD_ERROR(multiplier);
22872 }
22873 }
22874
22875#ifdef FREECIV_JSON_CONNECTION
22876 /* Exit array. */
22877 FC_FREE(field_addr.sub_location);
22878#endif /* FREECIV_JSON_CONNECTION */
22879 }
22880#ifdef FREECIV_JSON_CONNECTION
22881 field_addr.name = "multiplier_target";
22882#endif /* FREECIV_JSON_CONNECTION */
22883 {
22884 int i;
22885
22886#ifdef FREECIV_JSON_CONNECTION
22887 /* Enter array. */
22888 field_addr.sub_location = plocation_elem_new(0);
22889#endif /* FREECIV_JSON_CONNECTION */
22890
22891 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22892 RECEIVE_PACKET_FIELD_ERROR(multiplier_target, ": truncation array");
22893 }
22894 for (i = 0; i < real_packet->multip_count; i++) {
22895#ifdef FREECIV_JSON_CONNECTION
22896 field_addr.sub_location->number = i;
22897#endif /* FREECIV_JSON_CONNECTION */
22898 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier_target[i])) {
22899 RECEIVE_PACKET_FIELD_ERROR(multiplier_target);
22900 }
22901 }
22902
22903#ifdef FREECIV_JSON_CONNECTION
22904 /* Exit array. */
22905 FC_FREE(field_addr.sub_location);
22906#endif /* FREECIV_JSON_CONNECTION */
22907 }
22908#ifdef FREECIV_JSON_CONNECTION
22909 field_addr.name = "multiplier_changed";
22910#endif /* FREECIV_JSON_CONNECTION */
22911 {
22912 int i;
22913
22914#ifdef FREECIV_JSON_CONNECTION
22915 /* Enter array. */
22916 field_addr.sub_location = plocation_elem_new(0);
22917#endif /* FREECIV_JSON_CONNECTION */
22918
22919 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22920 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed, ": truncation array");
22921 }
22922 for (i = 0; i < real_packet->multip_count; i++) {
22923#ifdef FREECIV_JSON_CONNECTION
22924 field_addr.sub_location->number = i;
22925#endif /* FREECIV_JSON_CONNECTION */
22926 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->multiplier_changed[i])) {
22927 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed);
22928 }
22929 }
22930
22931#ifdef FREECIV_JSON_CONNECTION
22932 /* Exit array. */
22933 FC_FREE(field_addr.sub_location);
22934#endif /* FREECIV_JSON_CONNECTION */
22935 }
22936#endif
22937 log_packet_detailed("packet_player_info_100: got info about (%d)",
22938 real_packet->playerno);
22939
22940#ifdef FREECIV_DELTA_PROTOCOL
22941 if (nullptr == *hash) {
22942 *hash = genhash_new_full(hash_packet_player_info_100, cmp_packet_player_info_100,
22943 nullptr, nullptr, nullptr, destroy_packet_player_info);
22944 }
22945
22946 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
22947 *real_packet = *old;
22948 } else {
22949 /* packet is already initialized empty */
22950 log_packet_detailed(" no old info");
22951 }
22952
22953 if (BV_ISSET(fields, 0)) {
22954 log_packet_detailed(" got field 'name'");
22955#ifdef FREECIV_JSON_CONNECTION
22956 field_addr.name = "name";
22957#endif /* FREECIV_JSON_CONNECTION */
22958 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
22959 RECEIVE_PACKET_FIELD_ERROR(name);
22960 }
22961 }
22962 if (BV_ISSET(fields, 1)) {
22963 log_packet_detailed(" got field 'username'");
22964#ifdef FREECIV_JSON_CONNECTION
22965 field_addr.name = "username";
22966#endif /* FREECIV_JSON_CONNECTION */
22967 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
22968 RECEIVE_PACKET_FIELD_ERROR(username);
22969 }
22970 }
22971 real_packet->unassigned_user = BV_ISSET(fields, 2);
22972 if (BV_ISSET(fields, 3)) {
22973 log_packet_detailed(" got field 'score'");
22974#ifdef FREECIV_JSON_CONNECTION
22975 field_addr.name = "score";
22976#endif /* FREECIV_JSON_CONNECTION */
22977 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
22978 RECEIVE_PACKET_FIELD_ERROR(score);
22979 }
22980 }
22981 real_packet->is_male = BV_ISSET(fields, 4);
22982 real_packet->was_created = BV_ISSET(fields, 5);
22983 if (BV_ISSET(fields, 6)) {
22984 log_packet_detailed(" got field 'government'");
22985#ifdef FREECIV_JSON_CONNECTION
22986 field_addr.name = "government";
22987#endif /* FREECIV_JSON_CONNECTION */
22988 {
22989 int readin;
22990
22991 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
22992 RECEIVE_PACKET_FIELD_ERROR(government);
22993 }
22994 real_packet->government = readin;
22995 }
22996 }
22997 if (BV_ISSET(fields, 7)) {
22998 log_packet_detailed(" got field 'target_government'");
22999#ifdef FREECIV_JSON_CONNECTION
23000 field_addr.name = "target_government";
23001#endif /* FREECIV_JSON_CONNECTION */
23002 {
23003 int readin;
23004
23005 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
23006 RECEIVE_PACKET_FIELD_ERROR(target_government);
23007 }
23008 real_packet->target_government = readin;
23009 }
23010 }
23011 if (BV_ISSET(fields, 8)) {
23012 log_packet_detailed(" got field 'real_embassy'");
23013#ifdef FREECIV_JSON_CONNECTION
23014 field_addr.name = "real_embassy";
23015#endif /* FREECIV_JSON_CONNECTION */
23016 if (!DIO_BV_GET(&din, &field_addr, real_packet->real_embassy)) {
23017 RECEIVE_PACKET_FIELD_ERROR(real_embassy);
23018 }
23019 }
23020 if (BV_ISSET(fields, 9)) {
23021 log_packet_detailed(" got field 'mood'");
23022#ifdef FREECIV_JSON_CONNECTION
23023 field_addr.name = "mood";
23024#endif /* FREECIV_JSON_CONNECTION */
23025 {
23026 int readin;
23027
23028 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
23029 RECEIVE_PACKET_FIELD_ERROR(mood);
23030 }
23031 real_packet->mood = readin;
23032 }
23033 }
23034 if (BV_ISSET(fields, 10)) {
23035 log_packet_detailed(" got field 'style'");
23036#ifdef FREECIV_JSON_CONNECTION
23037 field_addr.name = "style";
23038#endif /* FREECIV_JSON_CONNECTION */
23039 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
23040 RECEIVE_PACKET_FIELD_ERROR(style);
23041 }
23042 }
23043 if (BV_ISSET(fields, 11)) {
23044 log_packet_detailed(" got field 'music_style'");
23045#ifdef FREECIV_JSON_CONNECTION
23046 field_addr.name = "music_style";
23047#endif /* FREECIV_JSON_CONNECTION */
23048 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->music_style)) {
23049 RECEIVE_PACKET_FIELD_ERROR(music_style);
23050 }
23051 }
23052 if (BV_ISSET(fields, 12)) {
23053 log_packet_detailed(" got field 'nation'");
23054#ifdef FREECIV_JSON_CONNECTION
23055 field_addr.name = "nation";
23056#endif /* FREECIV_JSON_CONNECTION */
23057 {
23058 int readin;
23059
23060 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
23061 RECEIVE_PACKET_FIELD_ERROR(nation);
23062 }
23063 real_packet->nation = readin;
23064 }
23065 }
23066 if (BV_ISSET(fields, 13)) {
23067 log_packet_detailed(" got field 'team'");
23068#ifdef FREECIV_JSON_CONNECTION
23069 field_addr.name = "team";
23070#endif /* FREECIV_JSON_CONNECTION */
23071 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->team)) {
23072 RECEIVE_PACKET_FIELD_ERROR(team);
23073 }
23074 }
23075 real_packet->is_ready = BV_ISSET(fields, 14);
23076 real_packet->phase_done = BV_ISSET(fields, 15);
23077 if (BV_ISSET(fields, 16)) {
23078 log_packet_detailed(" got field 'nturns_idle'");
23079#ifdef FREECIV_JSON_CONNECTION
23080 field_addr.name = "nturns_idle";
23081#endif /* FREECIV_JSON_CONNECTION */
23082 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
23083 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
23084 }
23085 }
23086 if (BV_ISSET(fields, 17)) {
23087 log_packet_detailed(" got field 'turns_alive'");
23088#ifdef FREECIV_JSON_CONNECTION
23089 field_addr.name = "turns_alive";
23090#endif /* FREECIV_JSON_CONNECTION */
23091 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turns_alive)) {
23092 RECEIVE_PACKET_FIELD_ERROR(turns_alive);
23093 }
23094 }
23095 real_packet->is_alive = BV_ISSET(fields, 18);
23096 if (BV_ISSET(fields, 19)) {
23097 log_packet_detailed(" got field 'autoselect_weight'");
23098#ifdef FREECIV_JSON_CONNECTION
23099 field_addr.name = "autoselect_weight";
23100#endif /* FREECIV_JSON_CONNECTION */
23101 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
23102 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
23103 }
23104 }
23105 if (BV_ISSET(fields, 20)) {
23106 log_packet_detailed(" got field 'gold'");
23107#ifdef FREECIV_JSON_CONNECTION
23108 field_addr.name = "gold";
23109#endif /* FREECIV_JSON_CONNECTION */
23110 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
23111 RECEIVE_PACKET_FIELD_ERROR(gold);
23112 }
23113 }
23114 if (BV_ISSET(fields, 21)) {
23115 log_packet_detailed(" got field 'tax'");
23116#ifdef FREECIV_JSON_CONNECTION
23117 field_addr.name = "tax";
23118#endif /* FREECIV_JSON_CONNECTION */
23119 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
23120 RECEIVE_PACKET_FIELD_ERROR(tax);
23121 }
23122 }
23123 if (BV_ISSET(fields, 22)) {
23124 log_packet_detailed(" got field 'science'");
23125#ifdef FREECIV_JSON_CONNECTION
23126 field_addr.name = "science";
23127#endif /* FREECIV_JSON_CONNECTION */
23128 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
23129 RECEIVE_PACKET_FIELD_ERROR(science);
23130 }
23131 }
23132 if (BV_ISSET(fields, 23)) {
23133 log_packet_detailed(" got field 'luxury'");
23134#ifdef FREECIV_JSON_CONNECTION
23135 field_addr.name = "luxury";
23136#endif /* FREECIV_JSON_CONNECTION */
23137 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
23138 RECEIVE_PACKET_FIELD_ERROR(luxury);
23139 }
23140 }
23141 if (BV_ISSET(fields, 24)) {
23142 log_packet_detailed(" got field 'infrapoints'");
23143#ifdef FREECIV_JSON_CONNECTION
23144 field_addr.name = "infrapoints";
23145#endif /* FREECIV_JSON_CONNECTION */
23146 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
23147 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
23148 }
23149 }
23150 if (BV_ISSET(fields, 25)) {
23151 log_packet_detailed(" got field 'tech_upkeep'");
23152#ifdef FREECIV_JSON_CONNECTION
23153 field_addr.name = "tech_upkeep";
23154#endif /* FREECIV_JSON_CONNECTION */
23155 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep)) {
23156 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep);
23157 }
23158 }
23159 if (BV_ISSET(fields, 26)) {
23160 log_packet_detailed(" got field 'science_cost'");
23161#ifdef FREECIV_JSON_CONNECTION
23162 field_addr.name = "science_cost";
23163#endif /* FREECIV_JSON_CONNECTION */
23164 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->science_cost)) {
23165 RECEIVE_PACKET_FIELD_ERROR(science_cost);
23166 }
23167 }
23168 real_packet->is_connected = BV_ISSET(fields, 27);
23169 if (BV_ISSET(fields, 28)) {
23170 log_packet_detailed(" got field 'revolution_finishes'");
23171#ifdef FREECIV_JSON_CONNECTION
23172 field_addr.name = "revolution_finishes";
23173#endif /* FREECIV_JSON_CONNECTION */
23174 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
23175 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
23176 }
23177 }
23178 if (BV_ISSET(fields, 29)) {
23179 log_packet_detailed(" got field 'ai_skill_level'");
23180#ifdef FREECIV_JSON_CONNECTION
23181 field_addr.name = "ai_skill_level";
23182#endif /* FREECIV_JSON_CONNECTION */
23183 {
23184 int readin;
23185
23186 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
23187 RECEIVE_PACKET_FIELD_ERROR(ai_skill_level);
23188 }
23189 real_packet->ai_skill_level = readin;
23190 }
23191 }
23192 if (BV_ISSET(fields, 30)) {
23193 log_packet_detailed(" got field 'barbarian_type'");
23194#ifdef FREECIV_JSON_CONNECTION
23195 field_addr.name = "barbarian_type";
23196#endif /* FREECIV_JSON_CONNECTION */
23197 {
23198 int readin;
23199
23200 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
23201 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
23202 }
23203 real_packet->barbarian_type = readin;
23204 }
23205 }
23206 if (BV_ISSET(fields, 31)) {
23207 log_packet_detailed(" got field 'gives_shared_vision'");
23208#ifdef FREECIV_JSON_CONNECTION
23209 field_addr.name = "gives_shared_vision";
23210#endif /* FREECIV_JSON_CONNECTION */
23211 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_vision)) {
23212 RECEIVE_PACKET_FIELD_ERROR(gives_shared_vision);
23213 }
23214 }
23215 if (BV_ISSET(fields, 32)) {
23216 log_packet_detailed(" got field 'gives_shared_tiles'");
23217#ifdef FREECIV_JSON_CONNECTION
23218 field_addr.name = "gives_shared_tiles";
23219#endif /* FREECIV_JSON_CONNECTION */
23220 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_tiles)) {
23221 RECEIVE_PACKET_FIELD_ERROR(gives_shared_tiles);
23222 }
23223 }
23224 if (BV_ISSET(fields, 33)) {
23225 log_packet_detailed(" got field 'history'");
23226#ifdef FREECIV_JSON_CONNECTION
23227 field_addr.name = "history";
23228#endif /* FREECIV_JSON_CONNECTION */
23229 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
23230 RECEIVE_PACKET_FIELD_ERROR(history);
23231 }
23232 }
23233 if (BV_ISSET(fields, 34)) {
23234 log_packet_detailed(" got field 'culture'");
23235#ifdef FREECIV_JSON_CONNECTION
23236 field_addr.name = "culture";
23237#endif /* FREECIV_JSON_CONNECTION */
23238 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
23239 RECEIVE_PACKET_FIELD_ERROR(culture);
23240 }
23241 }
23242 if (BV_ISSET(fields, 35)) {
23243 log_packet_detailed(" got field 'love'");
23244#ifdef FREECIV_JSON_CONNECTION
23245 field_addr.name = "love";
23246#endif /* FREECIV_JSON_CONNECTION */
23247 {
23248 int i;
23249
23250#ifdef FREECIV_JSON_CONNECTION
23251 /* Enter array. */
23252 field_addr.sub_location = plocation_elem_new(0);
23253#endif /* FREECIV_JSON_CONNECTION */
23254
23255 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
23256#ifdef FREECIV_JSON_CONNECTION
23257 field_addr.sub_location->number = i;
23258#endif /* FREECIV_JSON_CONNECTION */
23259 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->love[i])) {
23260 RECEIVE_PACKET_FIELD_ERROR(love);
23261 }
23262 }
23263
23264#ifdef FREECIV_JSON_CONNECTION
23265 /* Exit array. */
23266 FC_FREE(field_addr.sub_location);
23267#endif /* FREECIV_JSON_CONNECTION */
23268 }
23269 }
23270 real_packet->color_valid = BV_ISSET(fields, 36);
23271 real_packet->color_changeable = BV_ISSET(fields, 37);
23272 if (BV_ISSET(fields, 38)) {
23273 log_packet_detailed(" got field 'color_red'");
23274#ifdef FREECIV_JSON_CONNECTION
23275 field_addr.name = "color_red";
23276#endif /* FREECIV_JSON_CONNECTION */
23277 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
23278 RECEIVE_PACKET_FIELD_ERROR(color_red);
23279 }
23280 }
23281 if (BV_ISSET(fields, 39)) {
23282 log_packet_detailed(" got field 'color_green'");
23283#ifdef FREECIV_JSON_CONNECTION
23284 field_addr.name = "color_green";
23285#endif /* FREECIV_JSON_CONNECTION */
23286 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
23287 RECEIVE_PACKET_FIELD_ERROR(color_green);
23288 }
23289 }
23290 if (BV_ISSET(fields, 40)) {
23291 log_packet_detailed(" got field 'color_blue'");
23292#ifdef FREECIV_JSON_CONNECTION
23293 field_addr.name = "color_blue";
23294#endif /* FREECIV_JSON_CONNECTION */
23295 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
23296 RECEIVE_PACKET_FIELD_ERROR(color_blue);
23297 }
23298 }
23299 if (BV_ISSET(fields, 41)) {
23300 log_packet_detailed(" got field 'flags'");
23301#ifdef FREECIV_JSON_CONNECTION
23302 field_addr.name = "flags";
23303#endif /* FREECIV_JSON_CONNECTION */
23304 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
23305 RECEIVE_PACKET_FIELD_ERROR(flags);
23306 }
23307 }
23308 if (BV_ISSET(fields, 42)) {
23309 log_packet_detailed(" got field 'wonders'");
23310#ifdef FREECIV_JSON_CONNECTION
23311 field_addr.name = "wonders";
23312#endif /* FREECIV_JSON_CONNECTION */
23313 {
23314#ifdef FREECIV_JSON_CONNECTION
23315 int count_i;
23316
23317 /* Enter array. */
23318 field_addr.sub_location = plocation_elem_new(0);
23319
23320 for (count_i = 0;; count_i++) {
23321 int i;
23322
23323 field_addr.sub_location->number = count_i;
23324
23325 /* Enter diff array element (start at the index address). */
23326 field_addr.sub_location->sub_location = plocation_elem_new(0);
23327#else /* FREECIV_JSON_CONNECTION */
23328 while (TRUE) {
23329 int i;
23330#endif /* FREECIV_JSON_CONNECTION */
23331
23332 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
23333 RECEIVE_PACKET_FIELD_ERROR(wonders);
23334 }
23335 if (i == MAX_UINT16) {
23336#ifdef FREECIV_JSON_CONNECTION
23337 /* Exit diff array element. */
23338 FC_FREE(field_addr.sub_location->sub_location);
23339
23340 /* Exit diff array. */
23341 FC_FREE(field_addr.sub_location);
23342#endif /* FREECIV_JSON_CONNECTION */
23343
23344 break;
23345 }
23346 if (i > B_LAST) {
23347 RECEIVE_PACKET_FIELD_ERROR(wonders,
23348 ": unexpected value %d "
23349 "(> B_LAST) in array diff",
23350 i);
23351 } else {
23352#ifdef FREECIV_JSON_CONNECTION
23353 /* Content address. */
23354 field_addr.sub_location->sub_location->number = 1;
23355#endif /* FREECIV_JSON_CONNECTION */
23356 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->wonders[i])) {
23357 RECEIVE_PACKET_FIELD_ERROR(wonders);
23358 }
23359 }
23360
23361#ifdef FREECIV_JSON_CONNECTION
23362 /* Exit diff array element. */
23363 FC_FREE(field_addr.sub_location->sub_location);
23364#endif /* FREECIV_JSON_CONNECTION */
23365 }
23366
23367#ifdef FREECIV_JSON_CONNECTION
23368 /* Exit array. */
23369 FC_FREE(field_addr.sub_location);
23370#endif /* FREECIV_JSON_CONNECTION */
23371 }
23372 }
23373 if (BV_ISSET(fields, 43)) {
23374 log_packet_detailed(" got field 'multip_count'");
23375#ifdef FREECIV_JSON_CONNECTION
23376 field_addr.name = "multip_count";
23377#endif /* FREECIV_JSON_CONNECTION */
23378 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->multip_count)) {
23379 RECEIVE_PACKET_FIELD_ERROR(multip_count);
23380 }
23381 }
23382 if (BV_ISSET(fields, 44)) {
23383 log_packet_detailed(" got field 'multiplier'");
23384#ifdef FREECIV_JSON_CONNECTION
23385 field_addr.name = "multiplier";
23386#endif /* FREECIV_JSON_CONNECTION */
23387 {
23388 int i;
23389
23390#ifdef FREECIV_JSON_CONNECTION
23391 /* Enter array. */
23392 field_addr.sub_location = plocation_elem_new(0);
23393#endif /* FREECIV_JSON_CONNECTION */
23394
23395 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
23396 RECEIVE_PACKET_FIELD_ERROR(multiplier, ": truncation array");
23397 }
23398 for (i = 0; i < real_packet->multip_count; i++) {
23399#ifdef FREECIV_JSON_CONNECTION
23400 field_addr.sub_location->number = i;
23401#endif /* FREECIV_JSON_CONNECTION */
23402 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier[i])) {
23403 RECEIVE_PACKET_FIELD_ERROR(multiplier);
23404 }
23405 }
23406
23407#ifdef FREECIV_JSON_CONNECTION
23408 /* Exit array. */
23409 FC_FREE(field_addr.sub_location);
23410#endif /* FREECIV_JSON_CONNECTION */
23411 }
23412 }
23413 if (BV_ISSET(fields, 45)) {
23414 log_packet_detailed(" got field 'multiplier_target'");
23415#ifdef FREECIV_JSON_CONNECTION
23416 field_addr.name = "multiplier_target";
23417#endif /* FREECIV_JSON_CONNECTION */
23418 {
23419 int i;
23420
23421#ifdef FREECIV_JSON_CONNECTION
23422 /* Enter array. */
23423 field_addr.sub_location = plocation_elem_new(0);
23424#endif /* FREECIV_JSON_CONNECTION */
23425
23426 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
23427 RECEIVE_PACKET_FIELD_ERROR(multiplier_target, ": truncation array");
23428 }
23429 for (i = 0; i < real_packet->multip_count; i++) {
23430#ifdef FREECIV_JSON_CONNECTION
23431 field_addr.sub_location->number = i;
23432#endif /* FREECIV_JSON_CONNECTION */
23433 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier_target[i])) {
23434 RECEIVE_PACKET_FIELD_ERROR(multiplier_target);
23435 }
23436 }
23437
23438#ifdef FREECIV_JSON_CONNECTION
23439 /* Exit array. */
23440 FC_FREE(field_addr.sub_location);
23441#endif /* FREECIV_JSON_CONNECTION */
23442 }
23443 }
23444 if (BV_ISSET(fields, 46)) {
23445 log_packet_detailed(" got field 'multiplier_changed'");
23446#ifdef FREECIV_JSON_CONNECTION
23447 field_addr.name = "multiplier_changed";
23448#endif /* FREECIV_JSON_CONNECTION */
23449 {
23450 int i;
23451
23452#ifdef FREECIV_JSON_CONNECTION
23453 /* Enter array. */
23454 field_addr.sub_location = plocation_elem_new(0);
23455#endif /* FREECIV_JSON_CONNECTION */
23456
23457 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
23458 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed, ": truncation array");
23459 }
23460 for (i = 0; i < real_packet->multip_count; i++) {
23461#ifdef FREECIV_JSON_CONNECTION
23462 field_addr.sub_location->number = i;
23463#endif /* FREECIV_JSON_CONNECTION */
23464 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->multiplier_changed[i])) {
23465 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed);
23466 }
23467 }
23468
23469#ifdef FREECIV_JSON_CONNECTION
23470 /* Exit array. */
23471 FC_FREE(field_addr.sub_location);
23472#endif /* FREECIV_JSON_CONNECTION */
23473 }
23474 }
23475
23476 if (nullptr == old) {
23477 old = fc_malloc(sizeof(*old));
23478 init_packet_player_info(old);
23479 *old = *real_packet;
23480 genhash_insert(*hash, old, old);
23481 } else {
23482 *old = *real_packet;
23483 }
23484
23485#endif /* FREECIV_DELTA_PROTOCOL */
23486 RECEIVE_PACKET_END(real_packet);
23487#undef FREE_PACKET_STRUCT
23488}
23489
23490 static int send_packet_player_info_100(struct connection *pc, const struct packet_player_info *packet)
23491{
23492 const struct packet_player_info *real_packet = packet;
23493 int e;
23494#ifdef FREECIV_DELTA_PROTOCOL
23495 packet_player_info_100_fields fields;
23496 struct packet_player_info *old;
23497 bool differ;
23498 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_INFO;
23499 int different = 0;
23500#endif /* FREECIV_DELTA_PROTOCOL */
23501 SEND_PACKET_START(PACKET_PLAYER_INFO);
23502#ifdef FREECIV_JSON_CONNECTION
23503 struct plocation field_addr;
23504 {
23505 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
23506 field_addr = *field_addr_tmp;
23507 FC_FREE(field_addr_tmp);
23508 }
23509#endif /* FREECIV_JSON_CONNECTION */
23510
23511 log_packet_detailed("packet_player_info_100: sending info about (%d)",
23512 real_packet->playerno);
23513
23514#ifdef FREECIV_DELTA_PROTOCOL
23515 if (nullptr == *hash) {
23516 *hash = genhash_new_full(hash_packet_player_info_100, cmp_packet_player_info_100,
23517 nullptr, nullptr, nullptr, destroy_packet_player_info);
23518 }
23519 BV_CLR_ALL(fields);
23520
23521 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
23522 old = fc_malloc(sizeof(*old));
23523 /* temporary bitcopy just to insert correctly */
23524 *old = *real_packet;
23525 genhash_insert(*hash, old, old);
23526 init_packet_player_info(old);
23527 different = 1; /* Force to send. */
23528 }
23529 differ = (strcmp(old->name, real_packet->name) != 0);
23530 if (differ) {
23531 different++;
23532 BV_SET(fields, 0);
23533 }
23534
23535 differ = (strcmp(old->username, real_packet->username) != 0);
23536 if (differ) {
23537 different++;
23538 BV_SET(fields, 1);
23539 }
23540
23541 differ = (old->unassigned_user != real_packet->unassigned_user);
23542 if (differ) {
23543 different++;
23544 }
23545 if (packet->unassigned_user) {
23546 BV_SET(fields, 2);
23547 }
23548
23549 differ = (old->score != real_packet->score);
23550 if (differ) {
23551 different++;
23552 BV_SET(fields, 3);
23553 }
23554
23555 differ = (old->is_male != real_packet->is_male);
23556 if (differ) {
23557 different++;
23558 }
23559 if (packet->is_male) {
23560 BV_SET(fields, 4);
23561 }
23562
23563 differ = (old->was_created != real_packet->was_created);
23564 if (differ) {
23565 different++;
23566 }
23567 if (packet->was_created) {
23568 BV_SET(fields, 5);
23569 }
23570
23571 differ = (old->government != real_packet->government);
23572 if (differ) {
23573 different++;
23574 BV_SET(fields, 6);
23575 }
23576
23577 differ = (old->target_government != real_packet->target_government);
23578 if (differ) {
23579 different++;
23580 BV_SET(fields, 7);
23581 }
23582
23583 differ = !BV_ARE_EQUAL(old->real_embassy, real_packet->real_embassy);
23584 if (differ) {
23585 different++;
23586 BV_SET(fields, 8);
23587 }
23588
23589 differ = (old->mood != real_packet->mood);
23590 if (differ) {
23591 different++;
23592 BV_SET(fields, 9);
23593 }
23594
23595 differ = (old->style != real_packet->style);
23596 if (differ) {
23597 different++;
23598 BV_SET(fields, 10);
23599 }
23600
23601 differ = (old->music_style != real_packet->music_style);
23602 if (differ) {
23603 different++;
23604 BV_SET(fields, 11);
23605 }
23606
23607 differ = (old->nation != real_packet->nation);
23608 if (differ) {
23609 different++;
23610 BV_SET(fields, 12);
23611 }
23612
23613 differ = (old->team != real_packet->team);
23614 if (differ) {
23615 different++;
23616 BV_SET(fields, 13);
23617 }
23618
23619 differ = (old->is_ready != real_packet->is_ready);
23620 if (differ) {
23621 different++;
23622 }
23623 if (packet->is_ready) {
23624 BV_SET(fields, 14);
23625 }
23626
23627 differ = (old->phase_done != real_packet->phase_done);
23628 if (differ) {
23629 different++;
23630 }
23631 if (packet->phase_done) {
23632 BV_SET(fields, 15);
23633 }
23634
23635 differ = (old->nturns_idle != real_packet->nturns_idle);
23636 if (differ) {
23637 different++;
23638 BV_SET(fields, 16);
23639 }
23640
23641 differ = (old->turns_alive != real_packet->turns_alive);
23642 if (differ) {
23643 different++;
23644 BV_SET(fields, 17);
23645 }
23646
23647 differ = (old->is_alive != real_packet->is_alive);
23648 if (differ) {
23649 different++;
23650 }
23651 if (packet->is_alive) {
23652 BV_SET(fields, 18);
23653 }
23654
23655 differ = (old->autoselect_weight != real_packet->autoselect_weight);
23656 if (differ) {
23657 different++;
23658 BV_SET(fields, 19);
23659 }
23660
23661 differ = (old->gold != real_packet->gold);
23662 if (differ) {
23663 different++;
23664 BV_SET(fields, 20);
23665 }
23666
23667 differ = (old->tax != real_packet->tax);
23668 if (differ) {
23669 different++;
23670 BV_SET(fields, 21);
23671 }
23672
23673 differ = (old->science != real_packet->science);
23674 if (differ) {
23675 different++;
23676 BV_SET(fields, 22);
23677 }
23678
23679 differ = (old->luxury != real_packet->luxury);
23680 if (differ) {
23681 different++;
23682 BV_SET(fields, 23);
23683 }
23684
23685 differ = (old->infrapoints != real_packet->infrapoints);
23686 if (differ) {
23687 different++;
23688 BV_SET(fields, 24);
23689 }
23690
23691 differ = (old->tech_upkeep != real_packet->tech_upkeep);
23692 if (differ) {
23693 different++;
23694 BV_SET(fields, 25);
23695 }
23696
23697 differ = (old->science_cost != real_packet->science_cost);
23698 if (differ) {
23699 different++;
23700 BV_SET(fields, 26);
23701 }
23702
23703 differ = (old->is_connected != real_packet->is_connected);
23704 if (differ) {
23705 different++;
23706 }
23707 if (packet->is_connected) {
23708 BV_SET(fields, 27);
23709 }
23710
23711 differ = (old->revolution_finishes != real_packet->revolution_finishes);
23712 if (differ) {
23713 different++;
23714 BV_SET(fields, 28);
23715 }
23716
23717 differ = (old->ai_skill_level != real_packet->ai_skill_level);
23718 if (differ) {
23719 different++;
23720 BV_SET(fields, 29);
23721 }
23722
23723 differ = (old->barbarian_type != real_packet->barbarian_type);
23724 if (differ) {
23725 different++;
23726 BV_SET(fields, 30);
23727 }
23728
23729 differ = !BV_ARE_EQUAL(old->gives_shared_vision, real_packet->gives_shared_vision);
23730 if (differ) {
23731 different++;
23732 BV_SET(fields, 31);
23733 }
23734
23735 differ = !BV_ARE_EQUAL(old->gives_shared_tiles, real_packet->gives_shared_tiles);
23736 if (differ) {
23737 different++;
23738 BV_SET(fields, 32);
23739 }
23740
23741 differ = (old->history != real_packet->history);
23742 if (differ) {
23743 different++;
23744 BV_SET(fields, 33);
23745 }
23746
23747 differ = (old->culture != real_packet->culture);
23748 if (differ) {
23749 different++;
23750 BV_SET(fields, 34);
23751 }
23752
23753 differ = FALSE;
23754 {
23755 int i;
23756
23757 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
23758 differ = (old->love[i] != real_packet->love[i]);
23759 if (differ) {
23760 break;
23761 }
23762 }
23763 }
23764 if (differ) {
23765 different++;
23766 BV_SET(fields, 35);
23767 }
23768
23769 differ = (old->color_valid != real_packet->color_valid);
23770 if (differ) {
23771 different++;
23772 }
23773 if (packet->color_valid) {
23774 BV_SET(fields, 36);
23775 }
23776
23777 differ = (old->color_changeable != real_packet->color_changeable);
23778 if (differ) {
23779 different++;
23780 }
23781 if (packet->color_changeable) {
23782 BV_SET(fields, 37);
23783 }
23784
23785 differ = (old->color_red != real_packet->color_red);
23786 if (differ) {
23787 different++;
23788 BV_SET(fields, 38);
23789 }
23790
23791 differ = (old->color_green != real_packet->color_green);
23792 if (differ) {
23793 different++;
23794 BV_SET(fields, 39);
23795 }
23796
23797 differ = (old->color_blue != real_packet->color_blue);
23798 if (differ) {
23799 different++;
23800 BV_SET(fields, 40);
23801 }
23802
23803 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
23804 if (differ) {
23805 different++;
23806 BV_SET(fields, 41);
23807 }
23808
23809 differ = FALSE;
23810 {
23811 int i;
23812
23813 for (i = 0; i < B_LAST; i++) {
23814 differ = (old->wonders[i] != real_packet->wonders[i]);
23815 if (differ) {
23816 break;
23817 }
23818 }
23819 }
23820 if (differ) {
23821 different++;
23822 BV_SET(fields, 42);
23823 }
23824
23825 differ = (old->multip_count != real_packet->multip_count);
23826 if (differ) {
23827 different++;
23828 BV_SET(fields, 43);
23829 }
23830
23831 differ = (old->multip_count != real_packet->multip_count);
23832 if (!differ) {
23833 int i;
23834
23835 for (i = 0; i < real_packet->multip_count; i++) {
23836 differ = (old->multiplier[i] != real_packet->multiplier[i]);
23837 if (differ) {
23838 break;
23839 }
23840 }
23841 }
23842 if (differ) {
23843 different++;
23844 BV_SET(fields, 44);
23845 }
23846
23847 differ = (old->multip_count != real_packet->multip_count);
23848 if (!differ) {
23849 int i;
23850
23851 for (i = 0; i < real_packet->multip_count; i++) {
23852 differ = (old->multiplier_target[i] != real_packet->multiplier_target[i]);
23853 if (differ) {
23854 break;
23855 }
23856 }
23857 }
23858 if (differ) {
23859 different++;
23860 BV_SET(fields, 45);
23861 }
23862
23863 differ = (old->multip_count != real_packet->multip_count);
23864 if (!differ) {
23865 int i;
23866
23867 for (i = 0; i < real_packet->multip_count; i++) {
23868 differ = (old->multiplier_changed[i] != real_packet->multiplier_changed[i]);
23869 if (differ) {
23870 break;
23871 }
23872 }
23873 }
23874 if (differ) {
23875 different++;
23876 BV_SET(fields, 46);
23877 }
23878
23879 if (different == 0) {
23880 log_packet_detailed(" no change -> discard");
23881 return 0;
23882 }
23883
23884#ifdef FREECIV_JSON_CONNECTION
23885 field_addr.name = "fields";
23886#endif /* FREECIV_JSON_CONNECTION */
23887 e = 0;
23888 e |= DIO_BV_PUT(&dout, &field_addr, fields);
23889 if (e) {
23890 log_packet_detailed("fields bitvector error detected");
23891 }
23892#ifdef FREECIV_JSON_CONNECTION
23893 field_addr.name = "playerno";
23894#endif /* FREECIV_JSON_CONNECTION */
23895 e = 0;
23896 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->playerno);
23897 if (e) {
23898 log_packet_detailed("'playerno' field error detected");
23899 }
23900
23901 if (BV_ISSET(fields, 0)) {
23902 log_packet_detailed(" field 'name' has changed");
23903#ifdef FREECIV_JSON_CONNECTION
23904 field_addr.name = "name";
23905#endif /* FREECIV_JSON_CONNECTION */
23906 e = 0;
23907 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
23908 if (e) {
23909 log_packet_detailed("'name' field error detected");
23910 }
23911 }
23912 if (BV_ISSET(fields, 1)) {
23913 log_packet_detailed(" field 'username' has changed");
23914#ifdef FREECIV_JSON_CONNECTION
23915 field_addr.name = "username";
23916#endif /* FREECIV_JSON_CONNECTION */
23917 e = 0;
23918 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
23919 if (e) {
23920 log_packet_detailed("'username' field error detected");
23921 }
23922 }
23923 /* field 2 is folded into the header */
23924 if (BV_ISSET(fields, 3)) {
23925 log_packet_detailed(" field 'score' has changed");
23926#ifdef FREECIV_JSON_CONNECTION
23927 field_addr.name = "score";
23928#endif /* FREECIV_JSON_CONNECTION */
23929 e = 0;
23930 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
23931 if (e) {
23932 log_packet_detailed("'score' field error detected");
23933 }
23934 }
23935 /* field 4 is folded into the header */
23936 /* field 5 is folded into the header */
23937 if (BV_ISSET(fields, 6)) {
23938 log_packet_detailed(" field 'government' has changed");
23939#ifdef FREECIV_JSON_CONNECTION
23940 field_addr.name = "government";
23941#endif /* FREECIV_JSON_CONNECTION */
23942 e = 0;
23943 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
23944 if (e) {
23945 log_packet_detailed("'government' field error detected");
23946 }
23947 }
23948 if (BV_ISSET(fields, 7)) {
23949 log_packet_detailed(" field 'target_government' has changed");
23950#ifdef FREECIV_JSON_CONNECTION
23951 field_addr.name = "target_government";
23952#endif /* FREECIV_JSON_CONNECTION */
23953 e = 0;
23954 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
23955 if (e) {
23956 log_packet_detailed("'target_government' field error detected");
23957 }
23958 }
23959 if (BV_ISSET(fields, 8)) {
23960 log_packet_detailed(" field 'real_embassy' has changed");
23961#ifdef FREECIV_JSON_CONNECTION
23962 field_addr.name = "real_embassy";
23963#endif /* FREECIV_JSON_CONNECTION */
23964 e = 0;
23965 e |= DIO_BV_PUT(&dout, &field_addr, packet->real_embassy);
23966 if (e) {
23967 log_packet_detailed("'real_embassy' field error detected");
23968 }
23969 }
23970 if (BV_ISSET(fields, 9)) {
23971 log_packet_detailed(" field 'mood' has changed");
23972#ifdef FREECIV_JSON_CONNECTION
23973 field_addr.name = "mood";
23974#endif /* FREECIV_JSON_CONNECTION */
23975 e = 0;
23976 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mood);
23977 if (e) {
23978 log_packet_detailed("'mood' field error detected");
23979 }
23980 }
23981 if (BV_ISSET(fields, 10)) {
23982 log_packet_detailed(" field 'style' has changed");
23983#ifdef FREECIV_JSON_CONNECTION
23984 field_addr.name = "style";
23985#endif /* FREECIV_JSON_CONNECTION */
23986 e = 0;
23987 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
23988 if (e) {
23989 log_packet_detailed("'style' field error detected");
23990 }
23991 }
23992 if (BV_ISSET(fields, 11)) {
23993 log_packet_detailed(" field 'music_style' has changed");
23994#ifdef FREECIV_JSON_CONNECTION
23995 field_addr.name = "music_style";
23996#endif /* FREECIV_JSON_CONNECTION */
23997 e = 0;
23998 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->music_style);
23999 if (e) {
24000 log_packet_detailed("'music_style' field error detected");
24001 }
24002 }
24003 if (BV_ISSET(fields, 12)) {
24004 log_packet_detailed(" field 'nation' has changed");
24005#ifdef FREECIV_JSON_CONNECTION
24006 field_addr.name = "nation";
24007#endif /* FREECIV_JSON_CONNECTION */
24008 e = 0;
24009 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
24010 if (e) {
24011 log_packet_detailed("'nation' field error detected");
24012 }
24013 }
24014 if (BV_ISSET(fields, 13)) {
24015 log_packet_detailed(" field 'team' has changed");
24016#ifdef FREECIV_JSON_CONNECTION
24017 field_addr.name = "team";
24018#endif /* FREECIV_JSON_CONNECTION */
24019 e = 0;
24020 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->team);
24021 if (e) {
24022 log_packet_detailed("'team' field error detected");
24023 }
24024 }
24025 /* field 14 is folded into the header */
24026 /* field 15 is folded into the header */
24027 if (BV_ISSET(fields, 16)) {
24028 log_packet_detailed(" field 'nturns_idle' has changed");
24029#ifdef FREECIV_JSON_CONNECTION
24030 field_addr.name = "nturns_idle";
24031#endif /* FREECIV_JSON_CONNECTION */
24032 e = 0;
24033 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
24034 if (e) {
24035 log_packet_detailed("'nturns_idle' field error detected");
24036 }
24037 }
24038 if (BV_ISSET(fields, 17)) {
24039 log_packet_detailed(" field 'turns_alive' has changed");
24040#ifdef FREECIV_JSON_CONNECTION
24041 field_addr.name = "turns_alive";
24042#endif /* FREECIV_JSON_CONNECTION */
24043 e = 0;
24044 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turns_alive);
24045 if (e) {
24046 log_packet_detailed("'turns_alive' field error detected");
24047 }
24048 }
24049 /* field 18 is folded into the header */
24050 if (BV_ISSET(fields, 19)) {
24051 log_packet_detailed(" field 'autoselect_weight' has changed");
24052#ifdef FREECIV_JSON_CONNECTION
24053 field_addr.name = "autoselect_weight";
24054#endif /* FREECIV_JSON_CONNECTION */
24055 e = 0;
24056 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
24057 if (e) {
24058 log_packet_detailed("'autoselect_weight' field error detected");
24059 }
24060 }
24061 if (BV_ISSET(fields, 20)) {
24062 log_packet_detailed(" field 'gold' has changed");
24063#ifdef FREECIV_JSON_CONNECTION
24064 field_addr.name = "gold";
24065#endif /* FREECIV_JSON_CONNECTION */
24066 e = 0;
24067 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
24068 if (e) {
24069 log_packet_detailed("'gold' field error detected");
24070 }
24071 }
24072 if (BV_ISSET(fields, 21)) {
24073 log_packet_detailed(" field 'tax' has changed");
24074#ifdef FREECIV_JSON_CONNECTION
24075 field_addr.name = "tax";
24076#endif /* FREECIV_JSON_CONNECTION */
24077 e = 0;
24078 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
24079 if (e) {
24080 log_packet_detailed("'tax' field error detected");
24081 }
24082 }
24083 if (BV_ISSET(fields, 22)) {
24084 log_packet_detailed(" field 'science' has changed");
24085#ifdef FREECIV_JSON_CONNECTION
24086 field_addr.name = "science";
24087#endif /* FREECIV_JSON_CONNECTION */
24088 e = 0;
24089 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
24090 if (e) {
24091 log_packet_detailed("'science' field error detected");
24092 }
24093 }
24094 if (BV_ISSET(fields, 23)) {
24095 log_packet_detailed(" field 'luxury' has changed");
24096#ifdef FREECIV_JSON_CONNECTION
24097 field_addr.name = "luxury";
24098#endif /* FREECIV_JSON_CONNECTION */
24099 e = 0;
24100 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
24101 if (e) {
24102 log_packet_detailed("'luxury' field error detected");
24103 }
24104 }
24105 if (BV_ISSET(fields, 24)) {
24106 log_packet_detailed(" field 'infrapoints' has changed");
24107#ifdef FREECIV_JSON_CONNECTION
24108 field_addr.name = "infrapoints";
24109#endif /* FREECIV_JSON_CONNECTION */
24110 e = 0;
24111 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
24112 if (e) {
24113 log_packet_detailed("'infrapoints' field error detected");
24114 }
24115 }
24116 if (BV_ISSET(fields, 25)) {
24117 log_packet_detailed(" field 'tech_upkeep' has changed");
24118#ifdef FREECIV_JSON_CONNECTION
24119 field_addr.name = "tech_upkeep";
24120#endif /* FREECIV_JSON_CONNECTION */
24121 e = 0;
24122 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep);
24123 if (e) {
24124 log_packet_detailed("'tech_upkeep' field error detected");
24125 }
24126 }
24127 if (BV_ISSET(fields, 26)) {
24128 log_packet_detailed(" field 'science_cost' has changed");
24129#ifdef FREECIV_JSON_CONNECTION
24130 field_addr.name = "science_cost";
24131#endif /* FREECIV_JSON_CONNECTION */
24132 e = 0;
24133 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->science_cost);
24134 if (e) {
24135 log_packet_detailed("'science_cost' field error detected");
24136 }
24137 }
24138 /* field 27 is folded into the header */
24139 if (BV_ISSET(fields, 28)) {
24140 log_packet_detailed(" field 'revolution_finishes' has changed");
24141#ifdef FREECIV_JSON_CONNECTION
24142 field_addr.name = "revolution_finishes";
24143#endif /* FREECIV_JSON_CONNECTION */
24144 e = 0;
24145 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
24146 if (e) {
24147 log_packet_detailed("'revolution_finishes' field error detected");
24148 }
24149 }
24150 if (BV_ISSET(fields, 29)) {
24151 log_packet_detailed(" field 'ai_skill_level' has changed");
24152#ifdef FREECIV_JSON_CONNECTION
24153 field_addr.name = "ai_skill_level";
24154#endif /* FREECIV_JSON_CONNECTION */
24155 e = 0;
24156 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ai_skill_level);
24157 if (e) {
24158 log_packet_detailed("'ai_skill_level' field error detected");
24159 }
24160 }
24161 if (BV_ISSET(fields, 30)) {
24162 log_packet_detailed(" field 'barbarian_type' has changed");
24163#ifdef FREECIV_JSON_CONNECTION
24164 field_addr.name = "barbarian_type";
24165#endif /* FREECIV_JSON_CONNECTION */
24166 e = 0;
24167 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
24168 if (e) {
24169 log_packet_detailed("'barbarian_type' field error detected");
24170 }
24171 }
24172 if (BV_ISSET(fields, 31)) {
24173 log_packet_detailed(" field 'gives_shared_vision' has changed");
24174#ifdef FREECIV_JSON_CONNECTION
24175 field_addr.name = "gives_shared_vision";
24176#endif /* FREECIV_JSON_CONNECTION */
24177 e = 0;
24178 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_vision);
24179 if (e) {
24180 log_packet_detailed("'gives_shared_vision' field error detected");
24181 }
24182 }
24183 if (BV_ISSET(fields, 32)) {
24184 log_packet_detailed(" field 'gives_shared_tiles' has changed");
24185#ifdef FREECIV_JSON_CONNECTION
24186 field_addr.name = "gives_shared_tiles";
24187#endif /* FREECIV_JSON_CONNECTION */
24188 e = 0;
24189 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_tiles);
24190 if (e) {
24191 log_packet_detailed("'gives_shared_tiles' field error detected");
24192 }
24193 }
24194 if (BV_ISSET(fields, 33)) {
24195 log_packet_detailed(" field 'history' has changed");
24196#ifdef FREECIV_JSON_CONNECTION
24197 field_addr.name = "history";
24198#endif /* FREECIV_JSON_CONNECTION */
24199 e = 0;
24200 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
24201 if (e) {
24202 log_packet_detailed("'history' field error detected");
24203 }
24204 }
24205 if (BV_ISSET(fields, 34)) {
24206 log_packet_detailed(" field 'culture' has changed");
24207#ifdef FREECIV_JSON_CONNECTION
24208 field_addr.name = "culture";
24209#endif /* FREECIV_JSON_CONNECTION */
24210 e = 0;
24211 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
24212 if (e) {
24213 log_packet_detailed("'culture' field error detected");
24214 }
24215 }
24216 if (BV_ISSET(fields, 35)) {
24217 log_packet_detailed(" field 'love' has changed");
24218#ifdef FREECIV_JSON_CONNECTION
24219 field_addr.name = "love";
24220#endif /* FREECIV_JSON_CONNECTION */
24221 e = 0;
24222 {
24223 int i;
24224
24225#ifdef FREECIV_JSON_CONNECTION
24226 /* Create the array. */
24227 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
24228
24229 /* Enter the array. */
24230 field_addr.sub_location = plocation_elem_new(0);
24231#endif /* FREECIV_JSON_CONNECTION */
24232
24233 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
24234#ifdef FREECIV_JSON_CONNECTION
24235 /* Next array element. */
24236 field_addr.sub_location->number = i;
24237#endif /* FREECIV_JSON_CONNECTION */
24238 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->love[i]);
24239 }
24240
24241#ifdef FREECIV_JSON_CONNECTION
24242 /* Exit array. */
24243 FC_FREE(field_addr.sub_location);
24244#endif /* FREECIV_JSON_CONNECTION */
24245 }
24246 if (e) {
24247 log_packet_detailed("'love' field error detected");
24248 }
24249 }
24250 /* field 36 is folded into the header */
24251 /* field 37 is folded into the header */
24252 if (BV_ISSET(fields, 38)) {
24253 log_packet_detailed(" field 'color_red' has changed");
24254#ifdef FREECIV_JSON_CONNECTION
24255 field_addr.name = "color_red";
24256#endif /* FREECIV_JSON_CONNECTION */
24257 e = 0;
24258 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
24259 if (e) {
24260 log_packet_detailed("'color_red' field error detected");
24261 }
24262 }
24263 if (BV_ISSET(fields, 39)) {
24264 log_packet_detailed(" field 'color_green' has changed");
24265#ifdef FREECIV_JSON_CONNECTION
24266 field_addr.name = "color_green";
24267#endif /* FREECIV_JSON_CONNECTION */
24268 e = 0;
24269 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
24270 if (e) {
24271 log_packet_detailed("'color_green' field error detected");
24272 }
24273 }
24274 if (BV_ISSET(fields, 40)) {
24275 log_packet_detailed(" field 'color_blue' has changed");
24276#ifdef FREECIV_JSON_CONNECTION
24277 field_addr.name = "color_blue";
24278#endif /* FREECIV_JSON_CONNECTION */
24279 e = 0;
24280 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
24281 if (e) {
24282 log_packet_detailed("'color_blue' field error detected");
24283 }
24284 }
24285 if (BV_ISSET(fields, 41)) {
24286 log_packet_detailed(" field 'flags' has changed");
24287#ifdef FREECIV_JSON_CONNECTION
24288 field_addr.name = "flags";
24289#endif /* FREECIV_JSON_CONNECTION */
24290 e = 0;
24291 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
24292 if (e) {
24293 log_packet_detailed("'flags' field error detected");
24294 }
24295 }
24296 if (BV_ISSET(fields, 42)) {
24297 log_packet_detailed(" field 'wonders' has changed");
24298#ifdef FREECIV_JSON_CONNECTION
24299 field_addr.name = "wonders";
24300#endif /* FREECIV_JSON_CONNECTION */
24301 e = 0;
24302 {
24303 int i;
24304
24305#ifdef FREECIV_JSON_CONNECTION
24306 size_t count_i = 0;
24307
24308 /* Create the array. */
24309 e |= DIO_PUT(farray, &dout, &field_addr, 0);
24310
24311 /* Enter array. */
24312 field_addr.sub_location = plocation_elem_new(0);
24313#endif /* FREECIV_JSON_CONNECTION */
24314
24315 fc_assert(B_LAST < MAX_UINT16);
24316
24317 for (i = 0; i < B_LAST; i++) {
24318 differ = (old->wonders[i] != real_packet->wonders[i]);
24319
24320 if (differ) {
24321#ifdef FREECIV_JSON_CONNECTION
24322 /* Append next diff array element. */
24323 field_addr.sub_location->number = -1;
24324
24325 /* Create the diff array element. */
24326 e |= DIO_PUT(farray, &dout, &field_addr, 2);
24327
24328 /* Enter diff array element (start at the index address). */
24329 field_addr.sub_location->number = count_i++;
24330 field_addr.sub_location->sub_location = plocation_elem_new(0);
24331#endif /* FREECIV_JSON_CONNECTION */
24332 e |= DIO_PUT(uint16, &dout, &field_addr, i);
24333
24334#ifdef FREECIV_JSON_CONNECTION
24335 /* Content address. */
24336 field_addr.sub_location->sub_location->number = 1;
24337#endif /* FREECIV_JSON_CONNECTION */
24338 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->wonders[i]);
24339
24340#ifdef FREECIV_JSON_CONNECTION
24341 /* Exit diff array element. */
24342 FC_FREE(field_addr.sub_location->sub_location);
24343#endif /* FREECIV_JSON_CONNECTION */
24344 }
24345 }
24346#ifdef FREECIV_JSON_CONNECTION
24347 /* Append diff array element. */
24348 field_addr.sub_location->number = -1;
24349
24350 /* Create the terminating diff array element. */
24351 e |= DIO_PUT(farray, &dout, &field_addr, 1);
24352
24353 /* Enter diff array element (start at the index address). */
24354 field_addr.sub_location->number = count_i;
24355 field_addr.sub_location->sub_location = plocation_elem_new(0);
24356#endif /* FREECIV_JSON_CONNECTION */
24357 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
24358
24359#ifdef FREECIV_JSON_CONNECTION
24360 /* Exit diff array element. */
24361 FC_FREE(field_addr.sub_location->sub_location);
24362
24363 /* Exit array. */
24364 FC_FREE(field_addr.sub_location);
24365#endif /* FREECIV_JSON_CONNECTION */
24366 }
24367 if (e) {
24368 log_packet_detailed("'wonders' field error detected");
24369 }
24370 }
24371 if (BV_ISSET(fields, 43)) {
24372 log_packet_detailed(" field 'multip_count' has changed");
24373#ifdef FREECIV_JSON_CONNECTION
24374 field_addr.name = "multip_count";
24375#endif /* FREECIV_JSON_CONNECTION */
24376 e = 0;
24377 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multip_count);
24378 if (e) {
24379 log_packet_detailed("'multip_count' field error detected");
24380 }
24381 }
24382 if (BV_ISSET(fields, 44)) {
24383 log_packet_detailed(" field 'multiplier' has changed");
24384#ifdef FREECIV_JSON_CONNECTION
24385 field_addr.name = "multiplier";
24386#endif /* FREECIV_JSON_CONNECTION */
24387 e = 0;
24388 {
24389 int i;
24390
24391#ifdef FREECIV_JSON_CONNECTION
24392 /* Create the array. */
24393 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24394
24395 /* Enter the array. */
24396 field_addr.sub_location = plocation_elem_new(0);
24397#endif /* FREECIV_JSON_CONNECTION */
24398
24399 for (i = 0; i < real_packet->multip_count; i++) {
24400#ifdef FREECIV_JSON_CONNECTION
24401 /* Next array element. */
24402 field_addr.sub_location->number = i;
24403#endif /* FREECIV_JSON_CONNECTION */
24404 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier[i]);
24405 }
24406
24407#ifdef FREECIV_JSON_CONNECTION
24408 /* Exit array. */
24409 FC_FREE(field_addr.sub_location);
24410#endif /* FREECIV_JSON_CONNECTION */
24411 }
24412 if (e) {
24413 log_packet_detailed("'multiplier' field error detected");
24414 }
24415 }
24416 if (BV_ISSET(fields, 45)) {
24417 log_packet_detailed(" field 'multiplier_target' has changed");
24418#ifdef FREECIV_JSON_CONNECTION
24419 field_addr.name = "multiplier_target";
24420#endif /* FREECIV_JSON_CONNECTION */
24421 e = 0;
24422 {
24423 int i;
24424
24425#ifdef FREECIV_JSON_CONNECTION
24426 /* Create the array. */
24427 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24428
24429 /* Enter the array. */
24430 field_addr.sub_location = plocation_elem_new(0);
24431#endif /* FREECIV_JSON_CONNECTION */
24432
24433 for (i = 0; i < real_packet->multip_count; i++) {
24434#ifdef FREECIV_JSON_CONNECTION
24435 /* Next array element. */
24436 field_addr.sub_location->number = i;
24437#endif /* FREECIV_JSON_CONNECTION */
24438 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier_target[i]);
24439 }
24440
24441#ifdef FREECIV_JSON_CONNECTION
24442 /* Exit array. */
24443 FC_FREE(field_addr.sub_location);
24444#endif /* FREECIV_JSON_CONNECTION */
24445 }
24446 if (e) {
24447 log_packet_detailed("'multiplier_target' field error detected");
24448 }
24449 }
24450 if (BV_ISSET(fields, 46)) {
24451 log_packet_detailed(" field 'multiplier_changed' has changed");
24452#ifdef FREECIV_JSON_CONNECTION
24453 field_addr.name = "multiplier_changed";
24454#endif /* FREECIV_JSON_CONNECTION */
24455 e = 0;
24456 {
24457 int i;
24458
24459#ifdef FREECIV_JSON_CONNECTION
24460 /* Create the array. */
24461 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24462
24463 /* Enter the array. */
24464 field_addr.sub_location = plocation_elem_new(0);
24465#endif /* FREECIV_JSON_CONNECTION */
24466
24467 for (i = 0; i < real_packet->multip_count; i++) {
24468#ifdef FREECIV_JSON_CONNECTION
24469 /* Next array element. */
24470 field_addr.sub_location->number = i;
24471#endif /* FREECIV_JSON_CONNECTION */
24472 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->multiplier_changed[i]);
24473 }
24474
24475#ifdef FREECIV_JSON_CONNECTION
24476 /* Exit array. */
24477 FC_FREE(field_addr.sub_location);
24478#endif /* FREECIV_JSON_CONNECTION */
24479 }
24480 if (e) {
24481 log_packet_detailed("'multiplier_changed' field error detected");
24482 }
24483 }
24484
24485 *old = *real_packet;
24486#endif /* FREECIV_DELTA_PROTOCOL */
24487#ifndef FREECIV_DELTA_PROTOCOL
24488#ifdef FREECIV_JSON_CONNECTION
24489 field_addr.name = "playerno";
24490#endif /* FREECIV_JSON_CONNECTION */
24491 e = 0;
24492 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->playerno);
24493 if (e) {
24494 log_packet_detailed("'playerno' field error detected");
24495 }
24496#ifdef FREECIV_JSON_CONNECTION
24497 field_addr.name = "name";
24498#endif /* FREECIV_JSON_CONNECTION */
24499 e = 0;
24500 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
24501 if (e) {
24502 log_packet_detailed("'name' field error detected");
24503 }
24504#ifdef FREECIV_JSON_CONNECTION
24505 field_addr.name = "username";
24506#endif /* FREECIV_JSON_CONNECTION */
24507 e = 0;
24508 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
24509 if (e) {
24510 log_packet_detailed("'username' field error detected");
24511 }
24512#ifdef FREECIV_JSON_CONNECTION
24513 field_addr.name = "unassigned_user";
24514#endif /* FREECIV_JSON_CONNECTION */
24515 e = 0;
24516 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unassigned_user);
24517 if (e) {
24518 log_packet_detailed("'unassigned_user' field error detected");
24519 }
24520#ifdef FREECIV_JSON_CONNECTION
24521 field_addr.name = "score";
24522#endif /* FREECIV_JSON_CONNECTION */
24523 e = 0;
24524 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
24525 if (e) {
24526 log_packet_detailed("'score' field error detected");
24527 }
24528#ifdef FREECIV_JSON_CONNECTION
24529 field_addr.name = "is_male";
24530#endif /* FREECIV_JSON_CONNECTION */
24531 e = 0;
24532 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
24533 if (e) {
24534 log_packet_detailed("'is_male' field error detected");
24535 }
24536#ifdef FREECIV_JSON_CONNECTION
24537 field_addr.name = "was_created";
24538#endif /* FREECIV_JSON_CONNECTION */
24539 e = 0;
24540 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->was_created);
24541 if (e) {
24542 log_packet_detailed("'was_created' field error detected");
24543 }
24544#ifdef FREECIV_JSON_CONNECTION
24545 field_addr.name = "government";
24546#endif /* FREECIV_JSON_CONNECTION */
24547 e = 0;
24548 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
24549 if (e) {
24550 log_packet_detailed("'government' field error detected");
24551 }
24552#ifdef FREECIV_JSON_CONNECTION
24553 field_addr.name = "target_government";
24554#endif /* FREECIV_JSON_CONNECTION */
24555 e = 0;
24556 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
24557 if (e) {
24558 log_packet_detailed("'target_government' field error detected");
24559 }
24560#ifdef FREECIV_JSON_CONNECTION
24561 field_addr.name = "real_embassy";
24562#endif /* FREECIV_JSON_CONNECTION */
24563 e = 0;
24564 e |= DIO_BV_PUT(&dout, &field_addr, packet->real_embassy);
24565 if (e) {
24566 log_packet_detailed("'real_embassy' field error detected");
24567 }
24568#ifdef FREECIV_JSON_CONNECTION
24569 field_addr.name = "mood";
24570#endif /* FREECIV_JSON_CONNECTION */
24571 e = 0;
24572 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mood);
24573 if (e) {
24574 log_packet_detailed("'mood' field error detected");
24575 }
24576#ifdef FREECIV_JSON_CONNECTION
24577 field_addr.name = "style";
24578#endif /* FREECIV_JSON_CONNECTION */
24579 e = 0;
24580 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
24581 if (e) {
24582 log_packet_detailed("'style' field error detected");
24583 }
24584#ifdef FREECIV_JSON_CONNECTION
24585 field_addr.name = "music_style";
24586#endif /* FREECIV_JSON_CONNECTION */
24587 e = 0;
24588 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->music_style);
24589 if (e) {
24590 log_packet_detailed("'music_style' field error detected");
24591 }
24592#ifdef FREECIV_JSON_CONNECTION
24593 field_addr.name = "nation";
24594#endif /* FREECIV_JSON_CONNECTION */
24595 e = 0;
24596 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
24597 if (e) {
24598 log_packet_detailed("'nation' field error detected");
24599 }
24600#ifdef FREECIV_JSON_CONNECTION
24601 field_addr.name = "team";
24602#endif /* FREECIV_JSON_CONNECTION */
24603 e = 0;
24604 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->team);
24605 if (e) {
24606 log_packet_detailed("'team' field error detected");
24607 }
24608#ifdef FREECIV_JSON_CONNECTION
24609 field_addr.name = "is_ready";
24610#endif /* FREECIV_JSON_CONNECTION */
24611 e = 0;
24612 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_ready);
24613 if (e) {
24614 log_packet_detailed("'is_ready' field error detected");
24615 }
24616#ifdef FREECIV_JSON_CONNECTION
24617 field_addr.name = "phase_done";
24618#endif /* FREECIV_JSON_CONNECTION */
24619 e = 0;
24620 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->phase_done);
24621 if (e) {
24622 log_packet_detailed("'phase_done' field error detected");
24623 }
24624#ifdef FREECIV_JSON_CONNECTION
24625 field_addr.name = "nturns_idle";
24626#endif /* FREECIV_JSON_CONNECTION */
24627 e = 0;
24628 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
24629 if (e) {
24630 log_packet_detailed("'nturns_idle' field error detected");
24631 }
24632#ifdef FREECIV_JSON_CONNECTION
24633 field_addr.name = "turns_alive";
24634#endif /* FREECIV_JSON_CONNECTION */
24635 e = 0;
24636 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turns_alive);
24637 if (e) {
24638 log_packet_detailed("'turns_alive' field error detected");
24639 }
24640#ifdef FREECIV_JSON_CONNECTION
24641 field_addr.name = "is_alive";
24642#endif /* FREECIV_JSON_CONNECTION */
24643 e = 0;
24644 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_alive);
24645 if (e) {
24646 log_packet_detailed("'is_alive' field error detected");
24647 }
24648#ifdef FREECIV_JSON_CONNECTION
24649 field_addr.name = "autoselect_weight";
24650#endif /* FREECIV_JSON_CONNECTION */
24651 e = 0;
24652 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
24653 if (e) {
24654 log_packet_detailed("'autoselect_weight' field error detected");
24655 }
24656#ifdef FREECIV_JSON_CONNECTION
24657 field_addr.name = "gold";
24658#endif /* FREECIV_JSON_CONNECTION */
24659 e = 0;
24660 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
24661 if (e) {
24662 log_packet_detailed("'gold' field error detected");
24663 }
24664#ifdef FREECIV_JSON_CONNECTION
24665 field_addr.name = "tax";
24666#endif /* FREECIV_JSON_CONNECTION */
24667 e = 0;
24668 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
24669 if (e) {
24670 log_packet_detailed("'tax' field error detected");
24671 }
24672#ifdef FREECIV_JSON_CONNECTION
24673 field_addr.name = "science";
24674#endif /* FREECIV_JSON_CONNECTION */
24675 e = 0;
24676 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
24677 if (e) {
24678 log_packet_detailed("'science' field error detected");
24679 }
24680#ifdef FREECIV_JSON_CONNECTION
24681 field_addr.name = "luxury";
24682#endif /* FREECIV_JSON_CONNECTION */
24683 e = 0;
24684 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
24685 if (e) {
24686 log_packet_detailed("'luxury' field error detected");
24687 }
24688#ifdef FREECIV_JSON_CONNECTION
24689 field_addr.name = "infrapoints";
24690#endif /* FREECIV_JSON_CONNECTION */
24691 e = 0;
24692 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
24693 if (e) {
24694 log_packet_detailed("'infrapoints' field error detected");
24695 }
24696#ifdef FREECIV_JSON_CONNECTION
24697 field_addr.name = "tech_upkeep";
24698#endif /* FREECIV_JSON_CONNECTION */
24699 e = 0;
24700 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep);
24701 if (e) {
24702 log_packet_detailed("'tech_upkeep' field error detected");
24703 }
24704#ifdef FREECIV_JSON_CONNECTION
24705 field_addr.name = "science_cost";
24706#endif /* FREECIV_JSON_CONNECTION */
24707 e = 0;
24708 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->science_cost);
24709 if (e) {
24710 log_packet_detailed("'science_cost' field error detected");
24711 }
24712#ifdef FREECIV_JSON_CONNECTION
24713 field_addr.name = "is_connected";
24714#endif /* FREECIV_JSON_CONNECTION */
24715 e = 0;
24716 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_connected);
24717 if (e) {
24718 log_packet_detailed("'is_connected' field error detected");
24719 }
24720#ifdef FREECIV_JSON_CONNECTION
24721 field_addr.name = "revolution_finishes";
24722#endif /* FREECIV_JSON_CONNECTION */
24723 e = 0;
24724 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
24725 if (e) {
24726 log_packet_detailed("'revolution_finishes' field error detected");
24727 }
24728#ifdef FREECIV_JSON_CONNECTION
24729 field_addr.name = "ai_skill_level";
24730#endif /* FREECIV_JSON_CONNECTION */
24731 e = 0;
24732 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ai_skill_level);
24733 if (e) {
24734 log_packet_detailed("'ai_skill_level' field error detected");
24735 }
24736#ifdef FREECIV_JSON_CONNECTION
24737 field_addr.name = "barbarian_type";
24738#endif /* FREECIV_JSON_CONNECTION */
24739 e = 0;
24740 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
24741 if (e) {
24742 log_packet_detailed("'barbarian_type' field error detected");
24743 }
24744#ifdef FREECIV_JSON_CONNECTION
24745 field_addr.name = "gives_shared_vision";
24746#endif /* FREECIV_JSON_CONNECTION */
24747 e = 0;
24748 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_vision);
24749 if (e) {
24750 log_packet_detailed("'gives_shared_vision' field error detected");
24751 }
24752#ifdef FREECIV_JSON_CONNECTION
24753 field_addr.name = "gives_shared_tiles";
24754#endif /* FREECIV_JSON_CONNECTION */
24755 e = 0;
24756 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_tiles);
24757 if (e) {
24758 log_packet_detailed("'gives_shared_tiles' field error detected");
24759 }
24760#ifdef FREECIV_JSON_CONNECTION
24761 field_addr.name = "history";
24762#endif /* FREECIV_JSON_CONNECTION */
24763 e = 0;
24764 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
24765 if (e) {
24766 log_packet_detailed("'history' field error detected");
24767 }
24768#ifdef FREECIV_JSON_CONNECTION
24769 field_addr.name = "culture";
24770#endif /* FREECIV_JSON_CONNECTION */
24771 e = 0;
24772 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
24773 if (e) {
24774 log_packet_detailed("'culture' field error detected");
24775 }
24776#ifdef FREECIV_JSON_CONNECTION
24777 field_addr.name = "love";
24778#endif /* FREECIV_JSON_CONNECTION */
24779 e = 0;
24780 {
24781 int i;
24782
24783#ifdef FREECIV_JSON_CONNECTION
24784 /* Create the array. */
24785 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
24786
24787 /* Enter the array. */
24788 field_addr.sub_location = plocation_elem_new(0);
24789#endif /* FREECIV_JSON_CONNECTION */
24790
24791 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
24792#ifdef FREECIV_JSON_CONNECTION
24793 /* Next array element. */
24794 field_addr.sub_location->number = i;
24795#endif /* FREECIV_JSON_CONNECTION */
24796 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->love[i]);
24797 }
24798
24799#ifdef FREECIV_JSON_CONNECTION
24800 /* Exit array. */
24801 FC_FREE(field_addr.sub_location);
24802#endif /* FREECIV_JSON_CONNECTION */
24803 }
24804 if (e) {
24805 log_packet_detailed("'love' field error detected");
24806 }
24807#ifdef FREECIV_JSON_CONNECTION
24808 field_addr.name = "color_valid";
24809#endif /* FREECIV_JSON_CONNECTION */
24810 e = 0;
24811 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->color_valid);
24812 if (e) {
24813 log_packet_detailed("'color_valid' field error detected");
24814 }
24815#ifdef FREECIV_JSON_CONNECTION
24816 field_addr.name = "color_changeable";
24817#endif /* FREECIV_JSON_CONNECTION */
24818 e = 0;
24819 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->color_changeable);
24820 if (e) {
24821 log_packet_detailed("'color_changeable' field error detected");
24822 }
24823#ifdef FREECIV_JSON_CONNECTION
24824 field_addr.name = "color_red";
24825#endif /* FREECIV_JSON_CONNECTION */
24826 e = 0;
24827 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
24828 if (e) {
24829 log_packet_detailed("'color_red' field error detected");
24830 }
24831#ifdef FREECIV_JSON_CONNECTION
24832 field_addr.name = "color_green";
24833#endif /* FREECIV_JSON_CONNECTION */
24834 e = 0;
24835 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
24836 if (e) {
24837 log_packet_detailed("'color_green' field error detected");
24838 }
24839#ifdef FREECIV_JSON_CONNECTION
24840 field_addr.name = "color_blue";
24841#endif /* FREECIV_JSON_CONNECTION */
24842 e = 0;
24843 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
24844 if (e) {
24845 log_packet_detailed("'color_blue' field error detected");
24846 }
24847#ifdef FREECIV_JSON_CONNECTION
24848 field_addr.name = "flags";
24849#endif /* FREECIV_JSON_CONNECTION */
24850 e = 0;
24851 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
24852 if (e) {
24853 log_packet_detailed("'flags' field error detected");
24854 }
24855#ifdef FREECIV_JSON_CONNECTION
24856 field_addr.name = "wonders";
24857#endif /* FREECIV_JSON_CONNECTION */
24858 e = 0;
24859 {
24860 int i;
24861
24862#ifdef FREECIV_JSON_CONNECTION
24863 /* Create the array. */
24864 e |= DIO_PUT(farray, &dout, &field_addr, B_LAST);
24865
24866 /* Enter the array. */
24867 field_addr.sub_location = plocation_elem_new(0);
24868#endif /* FREECIV_JSON_CONNECTION */
24869
24870 for (i = 0; i < B_LAST; i++) {
24871#ifdef FREECIV_JSON_CONNECTION
24872 /* Next array element. */
24873 field_addr.sub_location->number = i;
24874#endif /* FREECIV_JSON_CONNECTION */
24875 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->wonders[i]);
24876 }
24877
24878#ifdef FREECIV_JSON_CONNECTION
24879 /* Exit array. */
24880 FC_FREE(field_addr.sub_location);
24881#endif /* FREECIV_JSON_CONNECTION */
24882 }
24883 if (e) {
24884 log_packet_detailed("'wonders' field error detected");
24885 }
24886#ifdef FREECIV_JSON_CONNECTION
24887 field_addr.name = "multip_count";
24888#endif /* FREECIV_JSON_CONNECTION */
24889 e = 0;
24890 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multip_count);
24891 if (e) {
24892 log_packet_detailed("'multip_count' field error detected");
24893 }
24894#ifdef FREECIV_JSON_CONNECTION
24895 field_addr.name = "multiplier";
24896#endif /* FREECIV_JSON_CONNECTION */
24897 e = 0;
24898 {
24899 int i;
24900
24901#ifdef FREECIV_JSON_CONNECTION
24902 /* Create the array. */
24903 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24904
24905 /* Enter the array. */
24906 field_addr.sub_location = plocation_elem_new(0);
24907#endif /* FREECIV_JSON_CONNECTION */
24908
24909 for (i = 0; i < real_packet->multip_count; i++) {
24910#ifdef FREECIV_JSON_CONNECTION
24911 /* Next array element. */
24912 field_addr.sub_location->number = i;
24913#endif /* FREECIV_JSON_CONNECTION */
24914 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier[i]);
24915 }
24916
24917#ifdef FREECIV_JSON_CONNECTION
24918 /* Exit array. */
24919 FC_FREE(field_addr.sub_location);
24920#endif /* FREECIV_JSON_CONNECTION */
24921 }
24922 if (e) {
24923 log_packet_detailed("'multiplier' field error detected");
24924 }
24925#ifdef FREECIV_JSON_CONNECTION
24926 field_addr.name = "multiplier_target";
24927#endif /* FREECIV_JSON_CONNECTION */
24928 e = 0;
24929 {
24930 int i;
24931
24932#ifdef FREECIV_JSON_CONNECTION
24933 /* Create the array. */
24934 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24935
24936 /* Enter the array. */
24937 field_addr.sub_location = plocation_elem_new(0);
24938#endif /* FREECIV_JSON_CONNECTION */
24939
24940 for (i = 0; i < real_packet->multip_count; i++) {
24941#ifdef FREECIV_JSON_CONNECTION
24942 /* Next array element. */
24943 field_addr.sub_location->number = i;
24944#endif /* FREECIV_JSON_CONNECTION */
24945 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier_target[i]);
24946 }
24947
24948#ifdef FREECIV_JSON_CONNECTION
24949 /* Exit array. */
24950 FC_FREE(field_addr.sub_location);
24951#endif /* FREECIV_JSON_CONNECTION */
24952 }
24953 if (e) {
24954 log_packet_detailed("'multiplier_target' field error detected");
24955 }
24956#ifdef FREECIV_JSON_CONNECTION
24957 field_addr.name = "multiplier_changed";
24958#endif /* FREECIV_JSON_CONNECTION */
24959 e = 0;
24960 {
24961 int i;
24962
24963#ifdef FREECIV_JSON_CONNECTION
24964 /* Create the array. */
24965 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24966
24967 /* Enter the array. */
24968 field_addr.sub_location = plocation_elem_new(0);
24969#endif /* FREECIV_JSON_CONNECTION */
24970
24971 for (i = 0; i < real_packet->multip_count; i++) {
24972#ifdef FREECIV_JSON_CONNECTION
24973 /* Next array element. */
24974 field_addr.sub_location->number = i;
24975#endif /* FREECIV_JSON_CONNECTION */
24976 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->multiplier_changed[i]);
24977 }
24978
24979#ifdef FREECIV_JSON_CONNECTION
24980 /* Exit array. */
24981 FC_FREE(field_addr.sub_location);
24982#endif /* FREECIV_JSON_CONNECTION */
24983 }
24984 if (e) {
24985 log_packet_detailed("'multiplier_changed' field error detected");
24986 }
24987
24988#endif
24989 SEND_PACKET_END(PACKET_PLAYER_INFO);
24990}
24991
24992 int send_packet_player_info(struct connection *pc, const struct packet_player_info *packet)
24993{
24994 if (!pc->used) {
24995 log_error("WARNING: trying to send data to the closed connection %s",
24996 conn_description(pc));
24997 return -1;
24998 }
24999 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_INFO].packet != nullptr, -1,
25000 "Handler for PACKET_PLAYER_INFO not installed");
25001 return pc->phs.handlers->send[PACKET_PLAYER_INFO].packet(pc, packet);
25002}
25003
25004 static inline void init_packet_player_phase_done(struct packet_player_phase_done *packet)
25005{
25006 memset(packet, 0, sizeof(*packet));
25007}
25008
25009#define free_packet_player_phase_done(_packet) (void) 0
25010#define destroy_packet_player_phase_done free
25011
25012#ifdef FREECIV_DELTA_PROTOCOL
25013#define hash_packet_player_phase_done_100 hash_const
25014
25015#define cmp_packet_player_phase_done_100 cmp_const
25016
25017 BV_DEFINE(packet_player_phase_done_100_fields, 1);
25018#endif /* FREECIV_DELTA_PROTOCOL */
25019
25020 static struct packet_player_phase_done *receive_packet_player_phase_done_100(struct connection *pc)
25021{
25022#define FREE_PACKET_STRUCT(_packet) free_packet_player_phase_done(_packet)
25023#ifdef FREECIV_DELTA_PROTOCOL
25024 packet_player_phase_done_100_fields fields;
25025 struct packet_player_phase_done *old;
25026 struct genhash **hash = pc->phs.received + PACKET_PLAYER_PHASE_DONE;
25027#endif /* FREECIV_DELTA_PROTOCOL */
25028 RECEIVE_PACKET_START(packet_player_phase_done, real_packet);
25029#ifdef FREECIV_JSON_CONNECTION
25030 struct plocation field_addr;
25031 {
25032 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25033 field_addr = *field_addr_tmp;
25034 FC_FREE(field_addr_tmp);
25035 }
25036#endif /* FREECIV_JSON_CONNECTION */
25037
25038#ifdef FREECIV_DELTA_PROTOCOL
25039#ifdef FREECIV_JSON_CONNECTION
25040 field_addr.name = "fields";
25041#endif /* FREECIV_JSON_CONNECTION */
25042 DIO_BV_GET(&din, &field_addr, fields);
25043
25044#else /* FREECIV_DELTA_PROTOCOL */
25045#ifdef FREECIV_JSON_CONNECTION
25046 field_addr.name = "turn";
25047#endif /* FREECIV_JSON_CONNECTION */
25048 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
25049 RECEIVE_PACKET_FIELD_ERROR(turn);
25050 }
25051#endif
25052 log_packet_detailed("packet_player_phase_done_100: got info about ()");
25053
25054#ifdef FREECIV_DELTA_PROTOCOL
25055 if (nullptr == *hash) {
25056 *hash = genhash_new_full(hash_packet_player_phase_done_100, cmp_packet_player_phase_done_100,
25057 nullptr, nullptr, nullptr, destroy_packet_player_phase_done);
25058 }
25059
25060 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25061 *real_packet = *old;
25062 } else {
25063 /* packet is already initialized empty */
25064 log_packet_detailed(" no old info");
25065 }
25066
25067 if (BV_ISSET(fields, 0)) {
25068 log_packet_detailed(" got field 'turn'");
25069#ifdef FREECIV_JSON_CONNECTION
25070 field_addr.name = "turn";
25071#endif /* FREECIV_JSON_CONNECTION */
25072 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
25073 RECEIVE_PACKET_FIELD_ERROR(turn);
25074 }
25075 }
25076
25077 if (nullptr == old) {
25078 old = fc_malloc(sizeof(*old));
25079 init_packet_player_phase_done(old);
25080 *old = *real_packet;
25081 genhash_insert(*hash, old, old);
25082 } else {
25083 *old = *real_packet;
25084 }
25085
25086#endif /* FREECIV_DELTA_PROTOCOL */
25087 RECEIVE_PACKET_END(real_packet);
25088#undef FREE_PACKET_STRUCT
25089}
25090
25091 static int send_packet_player_phase_done_100(struct connection *pc, const struct packet_player_phase_done *packet)
25092{
25093 const struct packet_player_phase_done *real_packet = packet;
25094 int e;
25095#ifdef FREECIV_DELTA_PROTOCOL
25096 packet_player_phase_done_100_fields fields;
25097 struct packet_player_phase_done *old;
25098 bool differ;
25099 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_PHASE_DONE;
25100#endif /* FREECIV_DELTA_PROTOCOL */
25101 SEND_PACKET_START(PACKET_PLAYER_PHASE_DONE);
25102#ifdef FREECIV_JSON_CONNECTION
25103 struct plocation field_addr;
25104 {
25105 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25106 field_addr = *field_addr_tmp;
25107 FC_FREE(field_addr_tmp);
25108 }
25109#endif /* FREECIV_JSON_CONNECTION */
25110
25111 log_packet_detailed("packet_player_phase_done_100: sending info about ()");
25112
25113#ifdef FREECIV_DELTA_PROTOCOL
25114 if (nullptr == *hash) {
25115 *hash = genhash_new_full(hash_packet_player_phase_done_100, cmp_packet_player_phase_done_100,
25116 nullptr, nullptr, nullptr, destroy_packet_player_phase_done);
25117 }
25118 BV_CLR_ALL(fields);
25119
25120 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25121 old = fc_malloc(sizeof(*old));
25122 /* temporary bitcopy just to insert correctly */
25123 *old = *real_packet;
25124 genhash_insert(*hash, old, old);
25125 init_packet_player_phase_done(old);
25126 }
25127 differ = (old->turn != real_packet->turn);
25128 if (differ) {
25129 BV_SET(fields, 0);
25130 }
25131
25132
25133#ifdef FREECIV_JSON_CONNECTION
25134 field_addr.name = "fields";
25135#endif /* FREECIV_JSON_CONNECTION */
25136 e = 0;
25137 e |= DIO_BV_PUT(&dout, &field_addr, fields);
25138 if (e) {
25139 log_packet_detailed("fields bitvector error detected");
25140 }
25141
25142 if (BV_ISSET(fields, 0)) {
25143 log_packet_detailed(" field 'turn' has changed");
25144#ifdef FREECIV_JSON_CONNECTION
25145 field_addr.name = "turn";
25146#endif /* FREECIV_JSON_CONNECTION */
25147 e = 0;
25148 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
25149 if (e) {
25150 log_packet_detailed("'turn' field error detected");
25151 }
25152 }
25153
25154 *old = *real_packet;
25155#endif /* FREECIV_DELTA_PROTOCOL */
25156#ifndef FREECIV_DELTA_PROTOCOL
25157#ifdef FREECIV_JSON_CONNECTION
25158 field_addr.name = "turn";
25159#endif /* FREECIV_JSON_CONNECTION */
25160 e = 0;
25161 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
25162 if (e) {
25163 log_packet_detailed("'turn' field error detected");
25164 }
25165
25166#endif
25167 SEND_PACKET_END(PACKET_PLAYER_PHASE_DONE);
25168}
25169
25170 int send_packet_player_phase_done(struct connection *pc, const struct packet_player_phase_done *packet)
25171{
25172 if (!pc->used) {
25173 log_error("WARNING: trying to send data to the closed connection %s",
25174 conn_description(pc));
25175 return -1;
25176 }
25177 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_PHASE_DONE].packet != nullptr, -1,
25178 "Handler for PACKET_PLAYER_PHASE_DONE not installed");
25179 return pc->phs.handlers->send[PACKET_PLAYER_PHASE_DONE].packet(pc, packet);
25180}
25181
25182 int dsend_packet_player_phase_done(struct connection *pc, int turn)
25183{
25184 struct packet_player_phase_done packet, *real_packet = &packet;
25185
25186 real_packet->turn = turn;
25187
25188 return send_packet_player_phase_done(pc, real_packet);
25189}
25190
25191 static inline void init_packet_player_rates(struct packet_player_rates *packet)
25192{
25193 memset(packet, 0, sizeof(*packet));
25194}
25195
25196#define free_packet_player_rates(_packet) (void) 0
25197#define destroy_packet_player_rates free
25198
25199#ifdef FREECIV_DELTA_PROTOCOL
25200#define hash_packet_player_rates_100 hash_const
25201
25202#define cmp_packet_player_rates_100 cmp_const
25203
25204 BV_DEFINE(packet_player_rates_100_fields, 3);
25205#endif /* FREECIV_DELTA_PROTOCOL */
25206
25207 static struct packet_player_rates *receive_packet_player_rates_100(struct connection *pc)
25208{
25209#define FREE_PACKET_STRUCT(_packet) free_packet_player_rates(_packet)
25210#ifdef FREECIV_DELTA_PROTOCOL
25211 packet_player_rates_100_fields fields;
25212 struct packet_player_rates *old;
25213 struct genhash **hash = pc->phs.received + PACKET_PLAYER_RATES;
25214#endif /* FREECIV_DELTA_PROTOCOL */
25215 RECEIVE_PACKET_START(packet_player_rates, real_packet);
25216#ifdef FREECIV_JSON_CONNECTION
25217 struct plocation field_addr;
25218 {
25219 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25220 field_addr = *field_addr_tmp;
25221 FC_FREE(field_addr_tmp);
25222 }
25223#endif /* FREECIV_JSON_CONNECTION */
25224
25225#ifdef FREECIV_DELTA_PROTOCOL
25226#ifdef FREECIV_JSON_CONNECTION
25227 field_addr.name = "fields";
25228#endif /* FREECIV_JSON_CONNECTION */
25229 DIO_BV_GET(&din, &field_addr, fields);
25230
25231#else /* FREECIV_DELTA_PROTOCOL */
25232#ifdef FREECIV_JSON_CONNECTION
25233 field_addr.name = "tax";
25234#endif /* FREECIV_JSON_CONNECTION */
25235 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
25236 RECEIVE_PACKET_FIELD_ERROR(tax);
25237 }
25238#ifdef FREECIV_JSON_CONNECTION
25239 field_addr.name = "luxury";
25240#endif /* FREECIV_JSON_CONNECTION */
25241 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
25242 RECEIVE_PACKET_FIELD_ERROR(luxury);
25243 }
25244#ifdef FREECIV_JSON_CONNECTION
25245 field_addr.name = "science";
25246#endif /* FREECIV_JSON_CONNECTION */
25247 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
25248 RECEIVE_PACKET_FIELD_ERROR(science);
25249 }
25250#endif
25251 log_packet_detailed("packet_player_rates_100: got info about ()");
25252
25253#ifdef FREECIV_DELTA_PROTOCOL
25254 if (nullptr == *hash) {
25255 *hash = genhash_new_full(hash_packet_player_rates_100, cmp_packet_player_rates_100,
25256 nullptr, nullptr, nullptr, destroy_packet_player_rates);
25257 }
25258
25259 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25260 *real_packet = *old;
25261 } else {
25262 /* packet is already initialized empty */
25263 log_packet_detailed(" no old info");
25264 }
25265
25266 if (BV_ISSET(fields, 0)) {
25267 log_packet_detailed(" got field 'tax'");
25268#ifdef FREECIV_JSON_CONNECTION
25269 field_addr.name = "tax";
25270#endif /* FREECIV_JSON_CONNECTION */
25271 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
25272 RECEIVE_PACKET_FIELD_ERROR(tax);
25273 }
25274 }
25275 if (BV_ISSET(fields, 1)) {
25276 log_packet_detailed(" got field 'luxury'");
25277#ifdef FREECIV_JSON_CONNECTION
25278 field_addr.name = "luxury";
25279#endif /* FREECIV_JSON_CONNECTION */
25280 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
25281 RECEIVE_PACKET_FIELD_ERROR(luxury);
25282 }
25283 }
25284 if (BV_ISSET(fields, 2)) {
25285 log_packet_detailed(" got field 'science'");
25286#ifdef FREECIV_JSON_CONNECTION
25287 field_addr.name = "science";
25288#endif /* FREECIV_JSON_CONNECTION */
25289 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
25290 RECEIVE_PACKET_FIELD_ERROR(science);
25291 }
25292 }
25293
25294 if (nullptr == old) {
25295 old = fc_malloc(sizeof(*old));
25296 init_packet_player_rates(old);
25297 *old = *real_packet;
25298 genhash_insert(*hash, old, old);
25299 } else {
25300 *old = *real_packet;
25301 }
25302
25303#endif /* FREECIV_DELTA_PROTOCOL */
25304 RECEIVE_PACKET_END(real_packet);
25305#undef FREE_PACKET_STRUCT
25306}
25307
25308 static int send_packet_player_rates_100(struct connection *pc, const struct packet_player_rates *packet)
25309{
25310 const struct packet_player_rates *real_packet = packet;
25311 int e;
25312#ifdef FREECIV_DELTA_PROTOCOL
25313 packet_player_rates_100_fields fields;
25314 struct packet_player_rates *old;
25315 bool differ;
25316 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_RATES;
25317#endif /* FREECIV_DELTA_PROTOCOL */
25318 SEND_PACKET_START(PACKET_PLAYER_RATES);
25319#ifdef FREECIV_JSON_CONNECTION
25320 struct plocation field_addr;
25321 {
25322 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25323 field_addr = *field_addr_tmp;
25324 FC_FREE(field_addr_tmp);
25325 }
25326#endif /* FREECIV_JSON_CONNECTION */
25327
25328 log_packet_detailed("packet_player_rates_100: sending info about ()");
25329
25330#ifdef FREECIV_DELTA_PROTOCOL
25331 if (nullptr == *hash) {
25332 *hash = genhash_new_full(hash_packet_player_rates_100, cmp_packet_player_rates_100,
25333 nullptr, nullptr, nullptr, destroy_packet_player_rates);
25334 }
25335 BV_CLR_ALL(fields);
25336
25337 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25338 old = fc_malloc(sizeof(*old));
25339 /* temporary bitcopy just to insert correctly */
25340 *old = *real_packet;
25341 genhash_insert(*hash, old, old);
25342 init_packet_player_rates(old);
25343 }
25344 differ = (old->tax != real_packet->tax);
25345 if (differ) {
25346 BV_SET(fields, 0);
25347 }
25348
25349 differ = (old->luxury != real_packet->luxury);
25350 if (differ) {
25351 BV_SET(fields, 1);
25352 }
25353
25354 differ = (old->science != real_packet->science);
25355 if (differ) {
25356 BV_SET(fields, 2);
25357 }
25358
25359
25360#ifdef FREECIV_JSON_CONNECTION
25361 field_addr.name = "fields";
25362#endif /* FREECIV_JSON_CONNECTION */
25363 e = 0;
25364 e |= DIO_BV_PUT(&dout, &field_addr, fields);
25365 if (e) {
25366 log_packet_detailed("fields bitvector error detected");
25367 }
25368
25369 if (BV_ISSET(fields, 0)) {
25370 log_packet_detailed(" field 'tax' has changed");
25371#ifdef FREECIV_JSON_CONNECTION
25372 field_addr.name = "tax";
25373#endif /* FREECIV_JSON_CONNECTION */
25374 e = 0;
25375 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
25376 if (e) {
25377 log_packet_detailed("'tax' field error detected");
25378 }
25379 }
25380 if (BV_ISSET(fields, 1)) {
25381 log_packet_detailed(" field 'luxury' has changed");
25382#ifdef FREECIV_JSON_CONNECTION
25383 field_addr.name = "luxury";
25384#endif /* FREECIV_JSON_CONNECTION */
25385 e = 0;
25386 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
25387 if (e) {
25388 log_packet_detailed("'luxury' field error detected");
25389 }
25390 }
25391 if (BV_ISSET(fields, 2)) {
25392 log_packet_detailed(" field 'science' has changed");
25393#ifdef FREECIV_JSON_CONNECTION
25394 field_addr.name = "science";
25395#endif /* FREECIV_JSON_CONNECTION */
25396 e = 0;
25397 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
25398 if (e) {
25399 log_packet_detailed("'science' field error detected");
25400 }
25401 }
25402
25403 *old = *real_packet;
25404#endif /* FREECIV_DELTA_PROTOCOL */
25405#ifndef FREECIV_DELTA_PROTOCOL
25406#ifdef FREECIV_JSON_CONNECTION
25407 field_addr.name = "tax";
25408#endif /* FREECIV_JSON_CONNECTION */
25409 e = 0;
25410 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
25411 if (e) {
25412 log_packet_detailed("'tax' field error detected");
25413 }
25414#ifdef FREECIV_JSON_CONNECTION
25415 field_addr.name = "luxury";
25416#endif /* FREECIV_JSON_CONNECTION */
25417 e = 0;
25418 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
25419 if (e) {
25420 log_packet_detailed("'luxury' field error detected");
25421 }
25422#ifdef FREECIV_JSON_CONNECTION
25423 field_addr.name = "science";
25424#endif /* FREECIV_JSON_CONNECTION */
25425 e = 0;
25426 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
25427 if (e) {
25428 log_packet_detailed("'science' field error detected");
25429 }
25430
25431#endif
25432 SEND_PACKET_END(PACKET_PLAYER_RATES);
25433}
25434
25435 int send_packet_player_rates(struct connection *pc, const struct packet_player_rates *packet)
25436{
25437 if (!pc->used) {
25438 log_error("WARNING: trying to send data to the closed connection %s",
25439 conn_description(pc));
25440 return -1;
25441 }
25442 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_RATES].packet != nullptr, -1,
25443 "Handler for PACKET_PLAYER_RATES not installed");
25444 return pc->phs.handlers->send[PACKET_PLAYER_RATES].packet(pc, packet);
25445}
25446
25447 int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
25448{
25449 struct packet_player_rates packet, *real_packet = &packet;
25450
25451 real_packet->tax = tax;
25452 real_packet->luxury = luxury;
25453 real_packet->science = science;
25454
25455 return send_packet_player_rates(pc, real_packet);
25456}
25457
25458 static inline void init_packet_player_change_government(struct packet_player_change_government *packet)
25459{
25460 memset(packet, 0, sizeof(*packet));
25461}
25462
25463#define free_packet_player_change_government(_packet) (void) 0
25464#define destroy_packet_player_change_government free
25465
25466#ifdef FREECIV_DELTA_PROTOCOL
25467#define hash_packet_player_change_government_100 hash_const
25468
25469#define cmp_packet_player_change_government_100 cmp_const
25470
25471 BV_DEFINE(packet_player_change_government_100_fields, 1);
25472#endif /* FREECIV_DELTA_PROTOCOL */
25473
25474 static struct packet_player_change_government *receive_packet_player_change_government_100(struct connection *pc)
25475{
25476#define FREE_PACKET_STRUCT(_packet) free_packet_player_change_government(_packet)
25477#ifdef FREECIV_DELTA_PROTOCOL
25478 packet_player_change_government_100_fields fields;
25479 struct packet_player_change_government *old;
25480 struct genhash **hash = pc->phs.received + PACKET_PLAYER_CHANGE_GOVERNMENT;
25481#endif /* FREECIV_DELTA_PROTOCOL */
25482 RECEIVE_PACKET_START(packet_player_change_government, real_packet);
25483#ifdef FREECIV_JSON_CONNECTION
25484 struct plocation field_addr;
25485 {
25486 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25487 field_addr = *field_addr_tmp;
25488 FC_FREE(field_addr_tmp);
25489 }
25490#endif /* FREECIV_JSON_CONNECTION */
25491
25492#ifdef FREECIV_DELTA_PROTOCOL
25493#ifdef FREECIV_JSON_CONNECTION
25494 field_addr.name = "fields";
25495#endif /* FREECIV_JSON_CONNECTION */
25496 DIO_BV_GET(&din, &field_addr, fields);
25497
25498#else /* FREECIV_DELTA_PROTOCOL */
25499#ifdef FREECIV_JSON_CONNECTION
25500 field_addr.name = "government";
25501#endif /* FREECIV_JSON_CONNECTION */
25502 {
25503 int readin;
25504
25505 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
25506 RECEIVE_PACKET_FIELD_ERROR(government);
25507 }
25508 real_packet->government = readin;
25509 }
25510#endif
25511 log_packet_detailed("packet_player_change_government_100: got info about ()");
25512
25513#ifdef FREECIV_DELTA_PROTOCOL
25514 if (nullptr == *hash) {
25515 *hash = genhash_new_full(hash_packet_player_change_government_100, cmp_packet_player_change_government_100,
25516 nullptr, nullptr, nullptr, destroy_packet_player_change_government);
25517 }
25518
25519 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25520 *real_packet = *old;
25521 } else {
25522 /* packet is already initialized empty */
25523 log_packet_detailed(" no old info");
25524 }
25525
25526 if (BV_ISSET(fields, 0)) {
25527 log_packet_detailed(" got field 'government'");
25528#ifdef FREECIV_JSON_CONNECTION
25529 field_addr.name = "government";
25530#endif /* FREECIV_JSON_CONNECTION */
25531 {
25532 int readin;
25533
25534 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
25535 RECEIVE_PACKET_FIELD_ERROR(government);
25536 }
25537 real_packet->government = readin;
25538 }
25539 }
25540
25541 if (nullptr == old) {
25542 old = fc_malloc(sizeof(*old));
25543 init_packet_player_change_government(old);
25544 *old = *real_packet;
25545 genhash_insert(*hash, old, old);
25546 } else {
25547 *old = *real_packet;
25548 }
25549
25550#endif /* FREECIV_DELTA_PROTOCOL */
25551 RECEIVE_PACKET_END(real_packet);
25552#undef FREE_PACKET_STRUCT
25553}
25554
25555 static int send_packet_player_change_government_100(struct connection *pc, const struct packet_player_change_government *packet)
25556{
25557 const struct packet_player_change_government *real_packet = packet;
25558 int e;
25559#ifdef FREECIV_DELTA_PROTOCOL
25560 packet_player_change_government_100_fields fields;
25561 struct packet_player_change_government *old;
25562 bool differ;
25563 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_CHANGE_GOVERNMENT;
25564#endif /* FREECIV_DELTA_PROTOCOL */
25565 SEND_PACKET_START(PACKET_PLAYER_CHANGE_GOVERNMENT);
25566#ifdef FREECIV_JSON_CONNECTION
25567 struct plocation field_addr;
25568 {
25569 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25570 field_addr = *field_addr_tmp;
25571 FC_FREE(field_addr_tmp);
25572 }
25573#endif /* FREECIV_JSON_CONNECTION */
25574
25575 log_packet_detailed("packet_player_change_government_100: sending info about ()");
25576
25577#ifdef FREECIV_DELTA_PROTOCOL
25578 if (nullptr == *hash) {
25579 *hash = genhash_new_full(hash_packet_player_change_government_100, cmp_packet_player_change_government_100,
25580 nullptr, nullptr, nullptr, destroy_packet_player_change_government);
25581 }
25582 BV_CLR_ALL(fields);
25583
25584 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25585 old = fc_malloc(sizeof(*old));
25586 /* temporary bitcopy just to insert correctly */
25587 *old = *real_packet;
25588 genhash_insert(*hash, old, old);
25589 init_packet_player_change_government(old);
25590 }
25591 differ = (old->government != real_packet->government);
25592 if (differ) {
25593 BV_SET(fields, 0);
25594 }
25595
25596
25597#ifdef FREECIV_JSON_CONNECTION
25598 field_addr.name = "fields";
25599#endif /* FREECIV_JSON_CONNECTION */
25600 e = 0;
25601 e |= DIO_BV_PUT(&dout, &field_addr, fields);
25602 if (e) {
25603 log_packet_detailed("fields bitvector error detected");
25604 }
25605
25606 if (BV_ISSET(fields, 0)) {
25607 log_packet_detailed(" field 'government' has changed");
25608#ifdef FREECIV_JSON_CONNECTION
25609 field_addr.name = "government";
25610#endif /* FREECIV_JSON_CONNECTION */
25611 e = 0;
25612 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
25613 if (e) {
25614 log_packet_detailed("'government' field error detected");
25615 }
25616 }
25617
25618 *old = *real_packet;
25619#endif /* FREECIV_DELTA_PROTOCOL */
25620#ifndef FREECIV_DELTA_PROTOCOL
25621#ifdef FREECIV_JSON_CONNECTION
25622 field_addr.name = "government";
25623#endif /* FREECIV_JSON_CONNECTION */
25624 e = 0;
25625 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
25626 if (e) {
25627 log_packet_detailed("'government' field error detected");
25628 }
25629
25630#endif
25631 SEND_PACKET_END(PACKET_PLAYER_CHANGE_GOVERNMENT);
25632}
25633
25634 int send_packet_player_change_government(struct connection *pc, const struct packet_player_change_government *packet)
25635{
25636 if (!pc->used) {
25637 log_error("WARNING: trying to send data to the closed connection %s",
25638 conn_description(pc));
25639 return -1;
25640 }
25641 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet != nullptr, -1,
25642 "Handler for PACKET_PLAYER_CHANGE_GOVERNMENT not installed");
25643 return pc->phs.handlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet(pc, packet);
25644}
25645
25646 int dsend_packet_player_change_government(struct connection *pc, Government_type_id government)
25647{
25648 struct packet_player_change_government packet, *real_packet = &packet;
25649
25650 real_packet->government = government;
25651
25652 return send_packet_player_change_government(pc, real_packet);
25653}
25654
25655 static inline void init_packet_player_place_infra(struct packet_player_place_infra *packet)
25656{
25657 memset(packet, 0, sizeof(*packet));
25658}
25659
25660#define free_packet_player_place_infra(_packet) (void) 0
25661#define destroy_packet_player_place_infra free
25662
25663#ifdef FREECIV_DELTA_PROTOCOL
25664#define hash_packet_player_place_infra_100 hash_const
25665
25666#define cmp_packet_player_place_infra_100 cmp_const
25667
25668 BV_DEFINE(packet_player_place_infra_100_fields, 2);
25669#endif /* FREECIV_DELTA_PROTOCOL */
25670
25671 static struct packet_player_place_infra *receive_packet_player_place_infra_100(struct connection *pc)
25672{
25673#define FREE_PACKET_STRUCT(_packet) free_packet_player_place_infra(_packet)
25674#ifdef FREECIV_DELTA_PROTOCOL
25675 packet_player_place_infra_100_fields fields;
25676 struct packet_player_place_infra *old;
25677 struct genhash **hash = pc->phs.received + PACKET_PLAYER_PLACE_INFRA;
25678#endif /* FREECIV_DELTA_PROTOCOL */
25679 RECEIVE_PACKET_START(packet_player_place_infra, real_packet);
25680#ifdef FREECIV_JSON_CONNECTION
25681 struct plocation field_addr;
25682 {
25683 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25684 field_addr = *field_addr_tmp;
25685 FC_FREE(field_addr_tmp);
25686 }
25687#endif /* FREECIV_JSON_CONNECTION */
25688
25689#ifdef FREECIV_DELTA_PROTOCOL
25690#ifdef FREECIV_JSON_CONNECTION
25691 field_addr.name = "fields";
25692#endif /* FREECIV_JSON_CONNECTION */
25693 DIO_BV_GET(&din, &field_addr, fields);
25694
25695#else /* FREECIV_DELTA_PROTOCOL */
25696#ifdef FREECIV_JSON_CONNECTION
25697 field_addr.name = "tile";
25698#endif /* FREECIV_JSON_CONNECTION */
25699 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
25700 RECEIVE_PACKET_FIELD_ERROR(tile);
25701 }
25702#ifdef FREECIV_JSON_CONNECTION
25703 field_addr.name = "extra";
25704#endif /* FREECIV_JSON_CONNECTION */
25705 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra)) {
25706 RECEIVE_PACKET_FIELD_ERROR(extra);
25707 }
25708#endif
25709 log_packet_detailed("packet_player_place_infra_100: got info about ()");
25710
25711#ifdef FREECIV_DELTA_PROTOCOL
25712 if (nullptr == *hash) {
25713 *hash = genhash_new_full(hash_packet_player_place_infra_100, cmp_packet_player_place_infra_100,
25714 nullptr, nullptr, nullptr, destroy_packet_player_place_infra);
25715 }
25716
25717 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25718 *real_packet = *old;
25719 } else {
25720 /* packet is already initialized empty */
25721 log_packet_detailed(" no old info");
25722 }
25723
25724 if (BV_ISSET(fields, 0)) {
25725 log_packet_detailed(" got field 'tile'");
25726#ifdef FREECIV_JSON_CONNECTION
25727 field_addr.name = "tile";
25728#endif /* FREECIV_JSON_CONNECTION */
25729 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
25730 RECEIVE_PACKET_FIELD_ERROR(tile);
25731 }
25732 }
25733 if (BV_ISSET(fields, 1)) {
25734 log_packet_detailed(" got field 'extra'");
25735#ifdef FREECIV_JSON_CONNECTION
25736 field_addr.name = "extra";
25737#endif /* FREECIV_JSON_CONNECTION */
25738 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra)) {
25739 RECEIVE_PACKET_FIELD_ERROR(extra);
25740 }
25741 }
25742
25743 if (nullptr == old) {
25744 old = fc_malloc(sizeof(*old));
25745 init_packet_player_place_infra(old);
25746 *old = *real_packet;
25747 genhash_insert(*hash, old, old);
25748 } else {
25749 *old = *real_packet;
25750 }
25751
25752#endif /* FREECIV_DELTA_PROTOCOL */
25753 RECEIVE_PACKET_END(real_packet);
25754#undef FREE_PACKET_STRUCT
25755}
25756
25757 static int send_packet_player_place_infra_100(struct connection *pc, const struct packet_player_place_infra *packet)
25758{
25759 const struct packet_player_place_infra *real_packet = packet;
25760 int e;
25761#ifdef FREECIV_DELTA_PROTOCOL
25762 packet_player_place_infra_100_fields fields;
25763 struct packet_player_place_infra *old;
25764 bool differ;
25765 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_PLACE_INFRA;
25766#endif /* FREECIV_DELTA_PROTOCOL */
25767 SEND_PACKET_START(PACKET_PLAYER_PLACE_INFRA);
25768#ifdef FREECIV_JSON_CONNECTION
25769 struct plocation field_addr;
25770 {
25771 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25772 field_addr = *field_addr_tmp;
25773 FC_FREE(field_addr_tmp);
25774 }
25775#endif /* FREECIV_JSON_CONNECTION */
25776
25777 log_packet_detailed("packet_player_place_infra_100: sending info about ()");
25778
25779#ifdef FREECIV_DELTA_PROTOCOL
25780 if (nullptr == *hash) {
25781 *hash = genhash_new_full(hash_packet_player_place_infra_100, cmp_packet_player_place_infra_100,
25782 nullptr, nullptr, nullptr, destroy_packet_player_place_infra);
25783 }
25784 BV_CLR_ALL(fields);
25785
25786 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25787 old = fc_malloc(sizeof(*old));
25788 /* temporary bitcopy just to insert correctly */
25789 *old = *real_packet;
25790 genhash_insert(*hash, old, old);
25791 init_packet_player_place_infra(old);
25792 }
25793 differ = (old->tile != real_packet->tile);
25794 if (differ) {
25795 BV_SET(fields, 0);
25796 }
25797
25798 differ = (old->extra != real_packet->extra);
25799 if (differ) {
25800 BV_SET(fields, 1);
25801 }
25802
25803
25804#ifdef FREECIV_JSON_CONNECTION
25805 field_addr.name = "fields";
25806#endif /* FREECIV_JSON_CONNECTION */
25807 e = 0;
25808 e |= DIO_BV_PUT(&dout, &field_addr, fields);
25809 if (e) {
25810 log_packet_detailed("fields bitvector error detected");
25811 }
25812
25813 if (BV_ISSET(fields, 0)) {
25814 log_packet_detailed(" field 'tile' has changed");
25815#ifdef FREECIV_JSON_CONNECTION
25816 field_addr.name = "tile";
25817#endif /* FREECIV_JSON_CONNECTION */
25818 e = 0;
25819 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
25820 if (e) {
25821 log_packet_detailed("'tile' field error detected");
25822 }
25823 }
25824 if (BV_ISSET(fields, 1)) {
25825 log_packet_detailed(" field 'extra' has changed");
25826#ifdef FREECIV_JSON_CONNECTION
25827 field_addr.name = "extra";
25828#endif /* FREECIV_JSON_CONNECTION */
25829 e = 0;
25830 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra);
25831 if (e) {
25832 log_packet_detailed("'extra' field error detected");
25833 }
25834 }
25835
25836 *old = *real_packet;
25837#endif /* FREECIV_DELTA_PROTOCOL */
25838#ifndef FREECIV_DELTA_PROTOCOL
25839#ifdef FREECIV_JSON_CONNECTION
25840 field_addr.name = "tile";
25841#endif /* FREECIV_JSON_CONNECTION */
25842 e = 0;
25843 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
25844 if (e) {
25845 log_packet_detailed("'tile' field error detected");
25846 }
25847#ifdef FREECIV_JSON_CONNECTION
25848 field_addr.name = "extra";
25849#endif /* FREECIV_JSON_CONNECTION */
25850 e = 0;
25851 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra);
25852 if (e) {
25853 log_packet_detailed("'extra' field error detected");
25854 }
25855
25856#endif
25857 SEND_PACKET_END(PACKET_PLAYER_PLACE_INFRA);
25858}
25859
25860 int send_packet_player_place_infra(struct connection *pc, const struct packet_player_place_infra *packet)
25861{
25862 if (!pc->used) {
25863 log_error("WARNING: trying to send data to the closed connection %s",
25864 conn_description(pc));
25865 return -1;
25866 }
25867 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_PLACE_INFRA].packet != nullptr, -1,
25868 "Handler for PACKET_PLAYER_PLACE_INFRA not installed");
25869 return pc->phs.handlers->send[PACKET_PLAYER_PLACE_INFRA].packet(pc, packet);
25870}
25871
25872 int dsend_packet_player_place_infra(struct connection *pc, int tile, int extra)
25873{
25874 struct packet_player_place_infra packet, *real_packet = &packet;
25875
25876 real_packet->tile = tile;
25877 real_packet->extra = extra;
25878
25879 return send_packet_player_place_infra(pc, real_packet);
25880}
25881
25882 static inline void init_packet_player_attribute_block(struct packet_player_attribute_block *packet)
25883{
25884 memset(packet, 0, sizeof(*packet));
25885}
25886
25887#define free_packet_player_attribute_block(_packet) (void) 0
25888#define destroy_packet_player_attribute_block free
25889
25890 static struct packet_player_attribute_block *receive_packet_player_attribute_block_100(struct connection *pc)
25891{
25892#define FREE_PACKET_STRUCT(_packet) free_packet_player_attribute_block(_packet)
25893 RECEIVE_PACKET_START(packet_player_attribute_block, real_packet);
25894#if 1 /* To match endif */
25895 real_packet->__dummy = 0xff;
25896#endif
25897 log_packet_detailed("packet_player_attribute_block_100: got info about ()");
25898 RECEIVE_PACKET_END(real_packet);
25899#undef FREE_PACKET_STRUCT
25900}
25901
25902 static int send_packet_player_attribute_block_100(struct connection *pc)
25903{
25904 SEND_PACKET_START(PACKET_PLAYER_ATTRIBUTE_BLOCK);
25905
25906 log_packet_detailed("packet_player_attribute_block_100: sending info about ()");
25907 SEND_PACKET_END(PACKET_PLAYER_ATTRIBUTE_BLOCK);
25908}
25909
25910 int send_packet_player_attribute_block(struct connection *pc)
25911{
25912 if (!pc->used) {
25913 log_error("WARNING: trying to send data to the closed connection %s",
25914 conn_description(pc));
25915 return -1;
25916 }
25917 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet != nullptr, -1,
25918 "Handler for PACKET_PLAYER_ATTRIBUTE_BLOCK not installed");
25919 return pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet(pc);
25920}
25921
25922 static inline void init_packet_player_attribute_chunk(struct packet_player_attribute_chunk *packet)
25923{
25924 memset(packet, 0, sizeof(*packet));
25925}
25926
25927#define free_packet_player_attribute_chunk(_packet) (void) 0
25928#define destroy_packet_player_attribute_chunk free
25929
25930#ifdef FREECIV_DELTA_PROTOCOL
25931static genhash_val_t hash_packet_player_attribute_chunk_100(const void *vkey)
25932{
25933 const struct packet_player_attribute_chunk *key = (const struct packet_player_attribute_chunk *) vkey;
25934 genhash_val_t result = 0;
25935
25936 result += key->offset;
25937
25938 result &= 0xFFFFFFFF;
25939 return result;
25940}
25941
25942static bool cmp_packet_player_attribute_chunk_100(const void *vkey1, const void *vkey2)
25943{
25944 const struct packet_player_attribute_chunk *old = (const struct packet_player_attribute_chunk *) vkey1;
25945 const struct packet_player_attribute_chunk *real_packet = (const struct packet_player_attribute_chunk *) vkey2;
25946 bool differ;
25947
25948 differ = (old->offset != real_packet->offset);
25949
25950 return !differ;
25951}
25952 BV_DEFINE(packet_player_attribute_chunk_100_fields, 3);
25953#endif /* FREECIV_DELTA_PROTOCOL */
25954
25955 static struct packet_player_attribute_chunk *receive_packet_player_attribute_chunk_100(struct connection *pc)
25956{
25957#define FREE_PACKET_STRUCT(_packet) free_packet_player_attribute_chunk(_packet)
25958#ifdef FREECIV_DELTA_PROTOCOL
25959 packet_player_attribute_chunk_100_fields fields;
25960 struct packet_player_attribute_chunk *old;
25961 struct genhash **hash = pc->phs.received + PACKET_PLAYER_ATTRIBUTE_CHUNK;
25962#endif /* FREECIV_DELTA_PROTOCOL */
25963 RECEIVE_PACKET_START(packet_player_attribute_chunk, real_packet);
25964#ifdef FREECIV_JSON_CONNECTION
25965 struct plocation field_addr;
25966 {
25967 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
25968 field_addr = *field_addr_tmp;
25969 FC_FREE(field_addr_tmp);
25970 }
25971#endif /* FREECIV_JSON_CONNECTION */
25972
25973#ifdef FREECIV_DELTA_PROTOCOL
25974#ifdef FREECIV_JSON_CONNECTION
25975 field_addr.name = "fields";
25976#endif /* FREECIV_JSON_CONNECTION */
25977 DIO_BV_GET(&din, &field_addr, fields);
25978#ifdef FREECIV_JSON_CONNECTION
25979 field_addr.name = "offset";
25980#endif /* FREECIV_JSON_CONNECTION */
25981 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->offset)) {
25982 RECEIVE_PACKET_FIELD_ERROR(offset);
25983 }
25984
25985#else /* FREECIV_DELTA_PROTOCOL */
25986#ifdef FREECIV_JSON_CONNECTION
25987 field_addr.name = "offset";
25988#endif /* FREECIV_JSON_CONNECTION */
25989 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->offset)) {
25990 RECEIVE_PACKET_FIELD_ERROR(offset);
25991 }
25992#ifdef FREECIV_JSON_CONNECTION
25993 field_addr.name = "total_length";
25994#endif /* FREECIV_JSON_CONNECTION */
25995 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->total_length)) {
25996 RECEIVE_PACKET_FIELD_ERROR(total_length);
25997 }
25998#ifdef FREECIV_JSON_CONNECTION
25999 field_addr.name = "chunk_length";
26000#endif /* FREECIV_JSON_CONNECTION */
26001 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->chunk_length)) {
26002 RECEIVE_PACKET_FIELD_ERROR(chunk_length);
26003 }
26004#ifdef FREECIV_JSON_CONNECTION
26005 field_addr.name = "data";
26006#endif /* FREECIV_JSON_CONNECTION */
26007
26008 if (real_packet->chunk_length > ATTRIBUTE_CHUNK_SIZE) {
26009 RECEIVE_PACKET_FIELD_ERROR(data, ": truncation array");
26010 }
26011 if (!DIO_GET(memory, &din, &field_addr, real_packet->data, real_packet->chunk_length)) {
26012 RECEIVE_PACKET_FIELD_ERROR(data);
26013 }
26014#endif
26015 log_packet_detailed("packet_player_attribute_chunk_100: got info about (%d)",
26016 real_packet->offset);
26017
26018#ifdef FREECIV_DELTA_PROTOCOL
26019 if (nullptr == *hash) {
26020 *hash = genhash_new_full(hash_packet_player_attribute_chunk_100, cmp_packet_player_attribute_chunk_100,
26021 nullptr, nullptr, nullptr, destroy_packet_player_attribute_chunk);
26022 }
26023
26024 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26025 *real_packet = *old;
26026 } else {
26027 /* packet is already initialized empty */
26028 log_packet_detailed(" no old info");
26029 }
26030
26031 if (BV_ISSET(fields, 0)) {
26032 log_packet_detailed(" got field 'total_length'");
26033#ifdef FREECIV_JSON_CONNECTION
26034 field_addr.name = "total_length";
26035#endif /* FREECIV_JSON_CONNECTION */
26036 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->total_length)) {
26037 RECEIVE_PACKET_FIELD_ERROR(total_length);
26038 }
26039 }
26040 if (BV_ISSET(fields, 1)) {
26041 log_packet_detailed(" got field 'chunk_length'");
26042#ifdef FREECIV_JSON_CONNECTION
26043 field_addr.name = "chunk_length";
26044#endif /* FREECIV_JSON_CONNECTION */
26045 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->chunk_length)) {
26046 RECEIVE_PACKET_FIELD_ERROR(chunk_length);
26047 }
26048 }
26049 if (BV_ISSET(fields, 2)) {
26050 log_packet_detailed(" got field 'data'");
26051#ifdef FREECIV_JSON_CONNECTION
26052 field_addr.name = "data";
26053#endif /* FREECIV_JSON_CONNECTION */
26054
26055 if (real_packet->chunk_length > ATTRIBUTE_CHUNK_SIZE) {
26056 RECEIVE_PACKET_FIELD_ERROR(data, ": truncation array");
26057 }
26058 if (!DIO_GET(memory, &din, &field_addr, real_packet->data, real_packet->chunk_length)) {
26059 RECEIVE_PACKET_FIELD_ERROR(data);
26060 }
26061 }
26062
26063 if (nullptr == old) {
26064 old = fc_malloc(sizeof(*old));
26065 init_packet_player_attribute_chunk(old);
26066 *old = *real_packet;
26067 genhash_insert(*hash, old, old);
26068 } else {
26069 *old = *real_packet;
26070 }
26071
26072#endif /* FREECIV_DELTA_PROTOCOL */
26073 RECEIVE_PACKET_END(real_packet);
26074#undef FREE_PACKET_STRUCT
26075}
26076
26077 static int send_packet_player_attribute_chunk_100(struct connection *pc, const struct packet_player_attribute_chunk *packet)
26078{
26079 /* copy packet for pre-send */
26080 struct packet_player_attribute_chunk packet_buf = *packet;
26081 const struct packet_player_attribute_chunk *real_packet = &packet_buf;
26082 int e;
26083#ifdef FREECIV_DELTA_PROTOCOL
26084 packet_player_attribute_chunk_100_fields fields;
26085 struct packet_player_attribute_chunk *old;
26086 bool differ;
26087 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_ATTRIBUTE_CHUNK;
26088#endif /* FREECIV_DELTA_PROTOCOL */
26089 SEND_PACKET_START(PACKET_PLAYER_ATTRIBUTE_CHUNK);
26090#ifdef FREECIV_JSON_CONNECTION
26091 struct plocation field_addr;
26092 {
26093 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
26094 field_addr = *field_addr_tmp;
26095 FC_FREE(field_addr_tmp);
26096 }
26097#endif /* FREECIV_JSON_CONNECTION */
26098
26099 log_packet_detailed("packet_player_attribute_chunk_100: sending info about (%d)",
26100 real_packet->offset);
26101
26102 pre_send_packet_player_attribute_chunk(pc, &packet_buf);
26103
26104#ifdef FREECIV_DELTA_PROTOCOL
26105 if (nullptr == *hash) {
26106 *hash = genhash_new_full(hash_packet_player_attribute_chunk_100, cmp_packet_player_attribute_chunk_100,
26107 nullptr, nullptr, nullptr, destroy_packet_player_attribute_chunk);
26108 }
26109 BV_CLR_ALL(fields);
26110
26111 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26112 old = fc_malloc(sizeof(*old));
26113 /* temporary bitcopy just to insert correctly */
26114 *old = *real_packet;
26115 genhash_insert(*hash, old, old);
26116 init_packet_player_attribute_chunk(old);
26117 }
26118 differ = (old->total_length != real_packet->total_length);
26119 if (differ) {
26120 BV_SET(fields, 0);
26121 }
26122
26123 differ = (old->chunk_length != real_packet->chunk_length);
26124 if (differ) {
26125 BV_SET(fields, 1);
26126 }
26127
26128 differ = ((old->chunk_length != real_packet->chunk_length)
26129 || (memcmp(old->data, real_packet->data, real_packet->chunk_length) != 0));
26130 if (differ) {
26131 BV_SET(fields, 2);
26132 }
26133
26134
26135#ifdef FREECIV_JSON_CONNECTION
26136 field_addr.name = "fields";
26137#endif /* FREECIV_JSON_CONNECTION */
26138 e = 0;
26139 e |= DIO_BV_PUT(&dout, &field_addr, fields);
26140 if (e) {
26141 log_packet_detailed("fields bitvector error detected");
26142 }
26143#ifdef FREECIV_JSON_CONNECTION
26144 field_addr.name = "offset";
26145#endif /* FREECIV_JSON_CONNECTION */
26146 e = 0;
26147 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->offset);
26148 if (e) {
26149 log_packet_detailed("'offset' field error detected");
26150 }
26151
26152 if (BV_ISSET(fields, 0)) {
26153 log_packet_detailed(" field 'total_length' has changed");
26154#ifdef FREECIV_JSON_CONNECTION
26155 field_addr.name = "total_length";
26156#endif /* FREECIV_JSON_CONNECTION */
26157 e = 0;
26158 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->total_length);
26159 if (e) {
26160 log_packet_detailed("'total_length' field error detected");
26161 }
26162 }
26163 if (BV_ISSET(fields, 1)) {
26164 log_packet_detailed(" field 'chunk_length' has changed");
26165#ifdef FREECIV_JSON_CONNECTION
26166 field_addr.name = "chunk_length";
26167#endif /* FREECIV_JSON_CONNECTION */
26168 e = 0;
26169 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->chunk_length);
26170 if (e) {
26171 log_packet_detailed("'chunk_length' field error detected");
26172 }
26173 }
26174 if (BV_ISSET(fields, 2)) {
26175 log_packet_detailed(" field 'data' has changed");
26176#ifdef FREECIV_JSON_CONNECTION
26177 field_addr.name = "data";
26178#endif /* FREECIV_JSON_CONNECTION */
26179 e = 0;
26180 e |= DIO_PUT(memory, &dout, &field_addr, &real_packet->data, real_packet->chunk_length);
26181 if (e) {
26182 log_packet_detailed("'data' field error detected");
26183 }
26184 }
26185
26186 *old = *real_packet;
26187#endif /* FREECIV_DELTA_PROTOCOL */
26188#ifndef FREECIV_DELTA_PROTOCOL
26189#ifdef FREECIV_JSON_CONNECTION
26190 field_addr.name = "offset";
26191#endif /* FREECIV_JSON_CONNECTION */
26192 e = 0;
26193 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->offset);
26194 if (e) {
26195 log_packet_detailed("'offset' field error detected");
26196 }
26197#ifdef FREECIV_JSON_CONNECTION
26198 field_addr.name = "total_length";
26199#endif /* FREECIV_JSON_CONNECTION */
26200 e = 0;
26201 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->total_length);
26202 if (e) {
26203 log_packet_detailed("'total_length' field error detected");
26204 }
26205#ifdef FREECIV_JSON_CONNECTION
26206 field_addr.name = "chunk_length";
26207#endif /* FREECIV_JSON_CONNECTION */
26208 e = 0;
26209 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->chunk_length);
26210 if (e) {
26211 log_packet_detailed("'chunk_length' field error detected");
26212 }
26213#ifdef FREECIV_JSON_CONNECTION
26214 field_addr.name = "data";
26215#endif /* FREECIV_JSON_CONNECTION */
26216 e = 0;
26217 e |= DIO_PUT(memory, &dout, &field_addr, &real_packet->data, real_packet->chunk_length);
26218 if (e) {
26219 log_packet_detailed("'data' field error detected");
26220 }
26221
26222#endif
26223 SEND_PACKET_END(PACKET_PLAYER_ATTRIBUTE_CHUNK);
26224}
26225
26226 int send_packet_player_attribute_chunk(struct connection *pc, const struct packet_player_attribute_chunk *packet)
26227{
26228 if (!pc->used) {
26229 log_error("WARNING: trying to send data to the closed connection %s",
26230 conn_description(pc));
26231 return -1;
26232 }
26233 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet != nullptr, -1,
26234 "Handler for PACKET_PLAYER_ATTRIBUTE_CHUNK not installed");
26235 return pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet(pc, packet);
26236}
26237
26238 static inline void init_packet_player_diplstate(struct packet_player_diplstate *packet)
26239{
26240 memset(packet, 0, sizeof(*packet));
26241}
26242
26243#define free_packet_player_diplstate(_packet) (void) 0
26244#define destroy_packet_player_diplstate free
26245
26246#ifdef FREECIV_DELTA_PROTOCOL
26247static genhash_val_t hash_packet_player_diplstate_100(const void *vkey)
26248{
26249 const struct packet_player_diplstate *key = (const struct packet_player_diplstate *) vkey;
26250 genhash_val_t result = 0;
26251
26252 result += key->diplstate_id;
26253
26254 result &= 0xFFFFFFFF;
26255 return result;
26256}
26257
26258static bool cmp_packet_player_diplstate_100(const void *vkey1, const void *vkey2)
26259{
26260 const struct packet_player_diplstate *old = (const struct packet_player_diplstate *) vkey1;
26261 const struct packet_player_diplstate *real_packet = (const struct packet_player_diplstate *) vkey2;
26262 bool differ;
26263
26264 differ = (old->diplstate_id != real_packet->diplstate_id);
26265
26266 return !differ;
26267}
26268 BV_DEFINE(packet_player_diplstate_100_fields, 6);
26269#endif /* FREECIV_DELTA_PROTOCOL */
26270
26271 static struct packet_player_diplstate *receive_packet_player_diplstate_100(struct connection *pc)
26272{
26273#define FREE_PACKET_STRUCT(_packet) free_packet_player_diplstate(_packet)
26274#ifdef FREECIV_DELTA_PROTOCOL
26275 packet_player_diplstate_100_fields fields;
26276 struct packet_player_diplstate *old;
26277 struct genhash **hash = pc->phs.received + PACKET_PLAYER_DIPLSTATE;
26278#endif /* FREECIV_DELTA_PROTOCOL */
26279 RECEIVE_PACKET_START(packet_player_diplstate, real_packet);
26280#ifdef FREECIV_JSON_CONNECTION
26281 struct plocation field_addr;
26282 {
26283 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
26284 field_addr = *field_addr_tmp;
26285 FC_FREE(field_addr_tmp);
26286 }
26287#endif /* FREECIV_JSON_CONNECTION */
26288
26289#ifdef FREECIV_DELTA_PROTOCOL
26290#ifdef FREECIV_JSON_CONNECTION
26291 field_addr.name = "fields";
26292#endif /* FREECIV_JSON_CONNECTION */
26293 DIO_BV_GET(&din, &field_addr, fields);
26294#ifdef FREECIV_JSON_CONNECTION
26295 field_addr.name = "diplstate_id";
26296#endif /* FREECIV_JSON_CONNECTION */
26297 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->diplstate_id)) {
26298 RECEIVE_PACKET_FIELD_ERROR(diplstate_id);
26299 }
26300
26301#else /* FREECIV_DELTA_PROTOCOL */
26302#ifdef FREECIV_JSON_CONNECTION
26303 field_addr.name = "diplstate_id";
26304#endif /* FREECIV_JSON_CONNECTION */
26305 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->diplstate_id)) {
26306 RECEIVE_PACKET_FIELD_ERROR(diplstate_id);
26307 }
26308#ifdef FREECIV_JSON_CONNECTION
26309 field_addr.name = "plr1";
26310#endif /* FREECIV_JSON_CONNECTION */
26311 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->plr1)) {
26312 RECEIVE_PACKET_FIELD_ERROR(plr1);
26313 }
26314#ifdef FREECIV_JSON_CONNECTION
26315 field_addr.name = "plr2";
26316#endif /* FREECIV_JSON_CONNECTION */
26317 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->plr2)) {
26318 RECEIVE_PACKET_FIELD_ERROR(plr2);
26319 }
26320#ifdef FREECIV_JSON_CONNECTION
26321 field_addr.name = "type";
26322#endif /* FREECIV_JSON_CONNECTION */
26323 {
26324 int readin;
26325
26326 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
26327 RECEIVE_PACKET_FIELD_ERROR(type);
26328 }
26329 real_packet->type = readin;
26330 }
26331#ifdef FREECIV_JSON_CONNECTION
26332 field_addr.name = "turns_left";
26333#endif /* FREECIV_JSON_CONNECTION */
26334 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->turns_left)) {
26335 RECEIVE_PACKET_FIELD_ERROR(turns_left);
26336 }
26337#ifdef FREECIV_JSON_CONNECTION
26338 field_addr.name = "has_reason_to_cancel";
26339#endif /* FREECIV_JSON_CONNECTION */
26340 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->has_reason_to_cancel)) {
26341 RECEIVE_PACKET_FIELD_ERROR(has_reason_to_cancel);
26342 }
26343#ifdef FREECIV_JSON_CONNECTION
26344 field_addr.name = "contact_turns_left";
26345#endif /* FREECIV_JSON_CONNECTION */
26346 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->contact_turns_left)) {
26347 RECEIVE_PACKET_FIELD_ERROR(contact_turns_left);
26348 }
26349#endif
26350 log_packet_detailed("packet_player_diplstate_100: got info about (%d)",
26351 real_packet->diplstate_id);
26352
26353#ifdef FREECIV_DELTA_PROTOCOL
26354 if (nullptr == *hash) {
26355 *hash = genhash_new_full(hash_packet_player_diplstate_100, cmp_packet_player_diplstate_100,
26356 nullptr, nullptr, nullptr, destroy_packet_player_diplstate);
26357 }
26358
26359 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26360 *real_packet = *old;
26361 } else {
26362 /* packet is already initialized empty */
26363 log_packet_detailed(" no old info");
26364 }
26365
26366 if (BV_ISSET(fields, 0)) {
26367 log_packet_detailed(" got field 'plr1'");
26368#ifdef FREECIV_JSON_CONNECTION
26369 field_addr.name = "plr1";
26370#endif /* FREECIV_JSON_CONNECTION */
26371 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->plr1)) {
26372 RECEIVE_PACKET_FIELD_ERROR(plr1);
26373 }
26374 }
26375 if (BV_ISSET(fields, 1)) {
26376 log_packet_detailed(" got field 'plr2'");
26377#ifdef FREECIV_JSON_CONNECTION
26378 field_addr.name = "plr2";
26379#endif /* FREECIV_JSON_CONNECTION */
26380 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->plr2)) {
26381 RECEIVE_PACKET_FIELD_ERROR(plr2);
26382 }
26383 }
26384 if (BV_ISSET(fields, 2)) {
26385 log_packet_detailed(" got field 'type'");
26386#ifdef FREECIV_JSON_CONNECTION
26387 field_addr.name = "type";
26388#endif /* FREECIV_JSON_CONNECTION */
26389 {
26390 int readin;
26391
26392 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
26393 RECEIVE_PACKET_FIELD_ERROR(type);
26394 }
26395 real_packet->type = readin;
26396 }
26397 }
26398 if (BV_ISSET(fields, 3)) {
26399 log_packet_detailed(" got field 'turns_left'");
26400#ifdef FREECIV_JSON_CONNECTION
26401 field_addr.name = "turns_left";
26402#endif /* FREECIV_JSON_CONNECTION */
26403 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->turns_left)) {
26404 RECEIVE_PACKET_FIELD_ERROR(turns_left);
26405 }
26406 }
26407 if (BV_ISSET(fields, 4)) {
26408 log_packet_detailed(" got field 'has_reason_to_cancel'");
26409#ifdef FREECIV_JSON_CONNECTION
26410 field_addr.name = "has_reason_to_cancel";
26411#endif /* FREECIV_JSON_CONNECTION */
26412 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->has_reason_to_cancel)) {
26413 RECEIVE_PACKET_FIELD_ERROR(has_reason_to_cancel);
26414 }
26415 }
26416 if (BV_ISSET(fields, 5)) {
26417 log_packet_detailed(" got field 'contact_turns_left'");
26418#ifdef FREECIV_JSON_CONNECTION
26419 field_addr.name = "contact_turns_left";
26420#endif /* FREECIV_JSON_CONNECTION */
26421 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->contact_turns_left)) {
26422 RECEIVE_PACKET_FIELD_ERROR(contact_turns_left);
26423 }
26424 }
26425
26426 if (nullptr == old) {
26427 old = fc_malloc(sizeof(*old));
26428 init_packet_player_diplstate(old);
26429 *old = *real_packet;
26430 genhash_insert(*hash, old, old);
26431 } else {
26432 *old = *real_packet;
26433 }
26434
26435#endif /* FREECIV_DELTA_PROTOCOL */
26436 RECEIVE_PACKET_END(real_packet);
26437#undef FREE_PACKET_STRUCT
26438}
26439
26440 static int send_packet_player_diplstate_100(struct connection *pc, const struct packet_player_diplstate *packet)
26441{
26442 const struct packet_player_diplstate *real_packet = packet;
26443 int e;
26444#ifdef FREECIV_DELTA_PROTOCOL
26445 packet_player_diplstate_100_fields fields;
26446 struct packet_player_diplstate *old;
26447 bool differ;
26448 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_DIPLSTATE;
26449#endif /* FREECIV_DELTA_PROTOCOL */
26450 SEND_PACKET_START(PACKET_PLAYER_DIPLSTATE);
26451#ifdef FREECIV_JSON_CONNECTION
26452 struct plocation field_addr;
26453 {
26454 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
26455 field_addr = *field_addr_tmp;
26456 FC_FREE(field_addr_tmp);
26457 }
26458#endif /* FREECIV_JSON_CONNECTION */
26459
26460 log_packet_detailed("packet_player_diplstate_100: sending info about (%d)",
26461 real_packet->diplstate_id);
26462
26463#ifdef FREECIV_DELTA_PROTOCOL
26464 if (nullptr == *hash) {
26465 *hash = genhash_new_full(hash_packet_player_diplstate_100, cmp_packet_player_diplstate_100,
26466 nullptr, nullptr, nullptr, destroy_packet_player_diplstate);
26467 }
26468 BV_CLR_ALL(fields);
26469
26470 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26471 old = fc_malloc(sizeof(*old));
26472 /* temporary bitcopy just to insert correctly */
26473 *old = *real_packet;
26474 genhash_insert(*hash, old, old);
26475 init_packet_player_diplstate(old);
26476 }
26477 differ = (old->plr1 != real_packet->plr1);
26478 if (differ) {
26479 BV_SET(fields, 0);
26480 }
26481
26482 differ = (old->plr2 != real_packet->plr2);
26483 if (differ) {
26484 BV_SET(fields, 1);
26485 }
26486
26487 differ = (old->type != real_packet->type);
26488 if (differ) {
26489 BV_SET(fields, 2);
26490 }
26491
26492 differ = (old->turns_left != real_packet->turns_left);
26493 if (differ) {
26494 BV_SET(fields, 3);
26495 }
26496
26497 differ = (old->has_reason_to_cancel != real_packet->has_reason_to_cancel);
26498 if (differ) {
26499 BV_SET(fields, 4);
26500 }
26501
26502 differ = (old->contact_turns_left != real_packet->contact_turns_left);
26503 if (differ) {
26504 BV_SET(fields, 5);
26505 }
26506
26507
26508#ifdef FREECIV_JSON_CONNECTION
26509 field_addr.name = "fields";
26510#endif /* FREECIV_JSON_CONNECTION */
26511 e = 0;
26512 e |= DIO_BV_PUT(&dout, &field_addr, fields);
26513 if (e) {
26514 log_packet_detailed("fields bitvector error detected");
26515 }
26516#ifdef FREECIV_JSON_CONNECTION
26517 field_addr.name = "diplstate_id";
26518#endif /* FREECIV_JSON_CONNECTION */
26519 e = 0;
26520 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->diplstate_id);
26521 if (e) {
26522 log_packet_detailed("'diplstate_id' field error detected");
26523 }
26524
26525 if (BV_ISSET(fields, 0)) {
26526 log_packet_detailed(" field 'plr1' has changed");
26527#ifdef FREECIV_JSON_CONNECTION
26528 field_addr.name = "plr1";
26529#endif /* FREECIV_JSON_CONNECTION */
26530 e = 0;
26531 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->plr1);
26532 if (e) {
26533 log_packet_detailed("'plr1' field error detected");
26534 }
26535 }
26536 if (BV_ISSET(fields, 1)) {
26537 log_packet_detailed(" field 'plr2' has changed");
26538#ifdef FREECIV_JSON_CONNECTION
26539 field_addr.name = "plr2";
26540#endif /* FREECIV_JSON_CONNECTION */
26541 e = 0;
26542 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->plr2);
26543 if (e) {
26544 log_packet_detailed("'plr2' field error detected");
26545 }
26546 }
26547 if (BV_ISSET(fields, 2)) {
26548 log_packet_detailed(" field 'type' has changed");
26549#ifdef FREECIV_JSON_CONNECTION
26550 field_addr.name = "type";
26551#endif /* FREECIV_JSON_CONNECTION */
26552 e = 0;
26553 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
26554 if (e) {
26555 log_packet_detailed("'type' field error detected");
26556 }
26557 }
26558 if (BV_ISSET(fields, 3)) {
26559 log_packet_detailed(" field 'turns_left' has changed");
26560#ifdef FREECIV_JSON_CONNECTION
26561 field_addr.name = "turns_left";
26562#endif /* FREECIV_JSON_CONNECTION */
26563 e = 0;
26564 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->turns_left);
26565 if (e) {
26566 log_packet_detailed("'turns_left' field error detected");
26567 }
26568 }
26569 if (BV_ISSET(fields, 4)) {
26570 log_packet_detailed(" field 'has_reason_to_cancel' has changed");
26571#ifdef FREECIV_JSON_CONNECTION
26572 field_addr.name = "has_reason_to_cancel";
26573#endif /* FREECIV_JSON_CONNECTION */
26574 e = 0;
26575 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->has_reason_to_cancel);
26576 if (e) {
26577 log_packet_detailed("'has_reason_to_cancel' field error detected");
26578 }
26579 }
26580 if (BV_ISSET(fields, 5)) {
26581 log_packet_detailed(" field 'contact_turns_left' has changed");
26582#ifdef FREECIV_JSON_CONNECTION
26583 field_addr.name = "contact_turns_left";
26584#endif /* FREECIV_JSON_CONNECTION */
26585 e = 0;
26586 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->contact_turns_left);
26587 if (e) {
26588 log_packet_detailed("'contact_turns_left' field error detected");
26589 }
26590 }
26591
26592 *old = *real_packet;
26593#endif /* FREECIV_DELTA_PROTOCOL */
26594#ifndef FREECIV_DELTA_PROTOCOL
26595#ifdef FREECIV_JSON_CONNECTION
26596 field_addr.name = "diplstate_id";
26597#endif /* FREECIV_JSON_CONNECTION */
26598 e = 0;
26599 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->diplstate_id);
26600 if (e) {
26601 log_packet_detailed("'diplstate_id' field error detected");
26602 }
26603#ifdef FREECIV_JSON_CONNECTION
26604 field_addr.name = "plr1";
26605#endif /* FREECIV_JSON_CONNECTION */
26606 e = 0;
26607 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->plr1);
26608 if (e) {
26609 log_packet_detailed("'plr1' field error detected");
26610 }
26611#ifdef FREECIV_JSON_CONNECTION
26612 field_addr.name = "plr2";
26613#endif /* FREECIV_JSON_CONNECTION */
26614 e = 0;
26615 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->plr2);
26616 if (e) {
26617 log_packet_detailed("'plr2' field error detected");
26618 }
26619#ifdef FREECIV_JSON_CONNECTION
26620 field_addr.name = "type";
26621#endif /* FREECIV_JSON_CONNECTION */
26622 e = 0;
26623 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
26624 if (e) {
26625 log_packet_detailed("'type' field error detected");
26626 }
26627#ifdef FREECIV_JSON_CONNECTION
26628 field_addr.name = "turns_left";
26629#endif /* FREECIV_JSON_CONNECTION */
26630 e = 0;
26631 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->turns_left);
26632 if (e) {
26633 log_packet_detailed("'turns_left' field error detected");
26634 }
26635#ifdef FREECIV_JSON_CONNECTION
26636 field_addr.name = "has_reason_to_cancel";
26637#endif /* FREECIV_JSON_CONNECTION */
26638 e = 0;
26639 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->has_reason_to_cancel);
26640 if (e) {
26641 log_packet_detailed("'has_reason_to_cancel' field error detected");
26642 }
26643#ifdef FREECIV_JSON_CONNECTION
26644 field_addr.name = "contact_turns_left";
26645#endif /* FREECIV_JSON_CONNECTION */
26646 e = 0;
26647 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->contact_turns_left);
26648 if (e) {
26649 log_packet_detailed("'contact_turns_left' field error detected");
26650 }
26651
26652#endif
26653 SEND_PACKET_END(PACKET_PLAYER_DIPLSTATE);
26654}
26655
26656 int send_packet_player_diplstate(struct connection *pc, const struct packet_player_diplstate *packet)
26657{
26658 if (!pc->used) {
26659 log_error("WARNING: trying to send data to the closed connection %s",
26660 conn_description(pc));
26661 return -1;
26662 }
26663 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_DIPLSTATE].packet != nullptr, -1,
26664 "Handler for PACKET_PLAYER_DIPLSTATE not installed");
26665 return pc->phs.handlers->send[PACKET_PLAYER_DIPLSTATE].packet(pc, packet);
26666}
26667
26668 static inline void init_packet_player_multiplier(struct packet_player_multiplier *packet)
26669{
26670 memset(packet, 0, sizeof(*packet));
26671}
26672
26673#define free_packet_player_multiplier(_packet) (void) 0
26674#define destroy_packet_player_multiplier free
26675
26676#ifdef FREECIV_DELTA_PROTOCOL
26677#define hash_packet_player_multiplier_100 hash_const
26678
26679#define cmp_packet_player_multiplier_100 cmp_const
26680
26681 BV_DEFINE(packet_player_multiplier_100_fields, 2);
26682#endif /* FREECIV_DELTA_PROTOCOL */
26683
26684 static struct packet_player_multiplier *receive_packet_player_multiplier_100(struct connection *pc)
26685{
26686#define FREE_PACKET_STRUCT(_packet) free_packet_player_multiplier(_packet)
26687#ifdef FREECIV_DELTA_PROTOCOL
26688 packet_player_multiplier_100_fields fields;
26689 struct packet_player_multiplier *old;
26690 struct genhash **hash = pc->phs.received + PACKET_PLAYER_MULTIPLIER;
26691#endif /* FREECIV_DELTA_PROTOCOL */
26692 RECEIVE_PACKET_START(packet_player_multiplier, real_packet);
26693#ifdef FREECIV_JSON_CONNECTION
26694 struct plocation field_addr;
26695 {
26696 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
26697 field_addr = *field_addr_tmp;
26698 FC_FREE(field_addr_tmp);
26699 }
26700#endif /* FREECIV_JSON_CONNECTION */
26701
26702#ifdef FREECIV_DELTA_PROTOCOL
26703#ifdef FREECIV_JSON_CONNECTION
26704 field_addr.name = "fields";
26705#endif /* FREECIV_JSON_CONNECTION */
26706 DIO_BV_GET(&din, &field_addr, fields);
26707
26708#else /* FREECIV_DELTA_PROTOCOL */
26709#ifdef FREECIV_JSON_CONNECTION
26710 field_addr.name = "count";
26711#endif /* FREECIV_JSON_CONNECTION */
26712 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->count)) {
26713 RECEIVE_PACKET_FIELD_ERROR(count);
26714 }
26715#ifdef FREECIV_JSON_CONNECTION
26716 field_addr.name = "multipliers";
26717#endif /* FREECIV_JSON_CONNECTION */
26718 {
26719 int i;
26720
26721#ifdef FREECIV_JSON_CONNECTION
26722 /* Enter array. */
26723 field_addr.sub_location = plocation_elem_new(0);
26724#endif /* FREECIV_JSON_CONNECTION */
26725
26726 if (real_packet->count > MAX_NUM_MULTIPLIERS) {
26727 RECEIVE_PACKET_FIELD_ERROR(multipliers, ": truncation array");
26728 }
26729 for (i = 0; i < real_packet->count; i++) {
26730#ifdef FREECIV_JSON_CONNECTION
26731 field_addr.sub_location->number = i;
26732#endif /* FREECIV_JSON_CONNECTION */
26733 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multipliers[i])) {
26734 RECEIVE_PACKET_FIELD_ERROR(multipliers);
26735 }
26736 }
26737
26738#ifdef FREECIV_JSON_CONNECTION
26739 /* Exit array. */
26740 FC_FREE(field_addr.sub_location);
26741#endif /* FREECIV_JSON_CONNECTION */
26742 }
26743#endif
26744 log_packet_detailed("packet_player_multiplier_100: got info about ()");
26745
26746#ifdef FREECIV_DELTA_PROTOCOL
26747 if (nullptr == *hash) {
26748 *hash = genhash_new_full(hash_packet_player_multiplier_100, cmp_packet_player_multiplier_100,
26749 nullptr, nullptr, nullptr, destroy_packet_player_multiplier);
26750 }
26751
26752 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26753 *real_packet = *old;
26754 } else {
26755 /* packet is already initialized empty */
26756 log_packet_detailed(" no old info");
26757 }
26758
26759 if (BV_ISSET(fields, 0)) {
26760 log_packet_detailed(" got field 'count'");
26761#ifdef FREECIV_JSON_CONNECTION
26762 field_addr.name = "count";
26763#endif /* FREECIV_JSON_CONNECTION */
26764 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->count)) {
26765 RECEIVE_PACKET_FIELD_ERROR(count);
26766 }
26767 }
26768 if (BV_ISSET(fields, 1)) {
26769 log_packet_detailed(" got field 'multipliers'");
26770#ifdef FREECIV_JSON_CONNECTION
26771 field_addr.name = "multipliers";
26772#endif /* FREECIV_JSON_CONNECTION */
26773 {
26774 int i;
26775
26776#ifdef FREECIV_JSON_CONNECTION
26777 /* Enter array. */
26778 field_addr.sub_location = plocation_elem_new(0);
26779#endif /* FREECIV_JSON_CONNECTION */
26780
26781 if (real_packet->count > MAX_NUM_MULTIPLIERS) {
26782 RECEIVE_PACKET_FIELD_ERROR(multipliers, ": truncation array");
26783 }
26784 for (i = 0; i < real_packet->count; i++) {
26785#ifdef FREECIV_JSON_CONNECTION
26786 field_addr.sub_location->number = i;
26787#endif /* FREECIV_JSON_CONNECTION */
26788 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multipliers[i])) {
26789 RECEIVE_PACKET_FIELD_ERROR(multipliers);
26790 }
26791 }
26792
26793#ifdef FREECIV_JSON_CONNECTION
26794 /* Exit array. */
26795 FC_FREE(field_addr.sub_location);
26796#endif /* FREECIV_JSON_CONNECTION */
26797 }
26798 }
26799
26800 if (nullptr == old) {
26801 old = fc_malloc(sizeof(*old));
26802 init_packet_player_multiplier(old);
26803 *old = *real_packet;
26804 genhash_insert(*hash, old, old);
26805 } else {
26806 *old = *real_packet;
26807 }
26808
26809#endif /* FREECIV_DELTA_PROTOCOL */
26810 RECEIVE_PACKET_END(real_packet);
26811#undef FREE_PACKET_STRUCT
26812}
26813
26814 static int send_packet_player_multiplier_100(struct connection *pc, const struct packet_player_multiplier *packet)
26815{
26816 const struct packet_player_multiplier *real_packet = packet;
26817 int e;
26818#ifdef FREECIV_DELTA_PROTOCOL
26819 packet_player_multiplier_100_fields fields;
26820 struct packet_player_multiplier *old;
26821 bool differ;
26822 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_MULTIPLIER;
26823#endif /* FREECIV_DELTA_PROTOCOL */
26824 SEND_PACKET_START(PACKET_PLAYER_MULTIPLIER);
26825#ifdef FREECIV_JSON_CONNECTION
26826 struct plocation field_addr;
26827 {
26828 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
26829 field_addr = *field_addr_tmp;
26830 FC_FREE(field_addr_tmp);
26831 }
26832#endif /* FREECIV_JSON_CONNECTION */
26833
26834 log_packet_detailed("packet_player_multiplier_100: sending info about ()");
26835
26836#ifdef FREECIV_DELTA_PROTOCOL
26837 if (nullptr == *hash) {
26838 *hash = genhash_new_full(hash_packet_player_multiplier_100, cmp_packet_player_multiplier_100,
26839 nullptr, nullptr, nullptr, destroy_packet_player_multiplier);
26840 }
26841 BV_CLR_ALL(fields);
26842
26843 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26844 old = fc_malloc(sizeof(*old));
26845 /* temporary bitcopy just to insert correctly */
26846 *old = *real_packet;
26847 genhash_insert(*hash, old, old);
26848 init_packet_player_multiplier(old);
26849 }
26850 differ = (old->count != real_packet->count);
26851 if (differ) {
26852 BV_SET(fields, 0);
26853 }
26854
26855 differ = (old->count != real_packet->count);
26856 if (!differ) {
26857 int i;
26858
26859 for (i = 0; i < real_packet->count; i++) {
26860 differ = (old->multipliers[i] != real_packet->multipliers[i]);
26861 if (differ) {
26862 break;
26863 }
26864 }
26865 }
26866 if (differ) {
26867 BV_SET(fields, 1);
26868 }
26869
26870
26871#ifdef FREECIV_JSON_CONNECTION
26872 field_addr.name = "fields";
26873#endif /* FREECIV_JSON_CONNECTION */
26874 e = 0;
26875 e |= DIO_BV_PUT(&dout, &field_addr, fields);
26876 if (e) {
26877 log_packet_detailed("fields bitvector error detected");
26878 }
26879
26880 if (BV_ISSET(fields, 0)) {
26881 log_packet_detailed(" field 'count' has changed");
26882#ifdef FREECIV_JSON_CONNECTION
26883 field_addr.name = "count";
26884#endif /* FREECIV_JSON_CONNECTION */
26885 e = 0;
26886 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->count);
26887 if (e) {
26888 log_packet_detailed("'count' field error detected");
26889 }
26890 }
26891 if (BV_ISSET(fields, 1)) {
26892 log_packet_detailed(" field 'multipliers' has changed");
26893#ifdef FREECIV_JSON_CONNECTION
26894 field_addr.name = "multipliers";
26895#endif /* FREECIV_JSON_CONNECTION */
26896 e = 0;
26897 {
26898 int i;
26899
26900#ifdef FREECIV_JSON_CONNECTION
26901 /* Create the array. */
26902 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
26903
26904 /* Enter the array. */
26905 field_addr.sub_location = plocation_elem_new(0);
26906#endif /* FREECIV_JSON_CONNECTION */
26907
26908 for (i = 0; i < real_packet->count; i++) {
26909#ifdef FREECIV_JSON_CONNECTION
26910 /* Next array element. */
26911 field_addr.sub_location->number = i;
26912#endif /* FREECIV_JSON_CONNECTION */
26913 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multipliers[i]);
26914 }
26915
26916#ifdef FREECIV_JSON_CONNECTION
26917 /* Exit array. */
26918 FC_FREE(field_addr.sub_location);
26919#endif /* FREECIV_JSON_CONNECTION */
26920 }
26921 if (e) {
26922 log_packet_detailed("'multipliers' field error detected");
26923 }
26924 }
26925
26926 *old = *real_packet;
26927#endif /* FREECIV_DELTA_PROTOCOL */
26928#ifndef FREECIV_DELTA_PROTOCOL
26929#ifdef FREECIV_JSON_CONNECTION
26930 field_addr.name = "count";
26931#endif /* FREECIV_JSON_CONNECTION */
26932 e = 0;
26933 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->count);
26934 if (e) {
26935 log_packet_detailed("'count' field error detected");
26936 }
26937#ifdef FREECIV_JSON_CONNECTION
26938 field_addr.name = "multipliers";
26939#endif /* FREECIV_JSON_CONNECTION */
26940 e = 0;
26941 {
26942 int i;
26943
26944#ifdef FREECIV_JSON_CONNECTION
26945 /* Create the array. */
26946 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
26947
26948 /* Enter the array. */
26949 field_addr.sub_location = plocation_elem_new(0);
26950#endif /* FREECIV_JSON_CONNECTION */
26951
26952 for (i = 0; i < real_packet->count; i++) {
26953#ifdef FREECIV_JSON_CONNECTION
26954 /* Next array element. */
26955 field_addr.sub_location->number = i;
26956#endif /* FREECIV_JSON_CONNECTION */
26957 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multipliers[i]);
26958 }
26959
26960#ifdef FREECIV_JSON_CONNECTION
26961 /* Exit array. */
26962 FC_FREE(field_addr.sub_location);
26963#endif /* FREECIV_JSON_CONNECTION */
26964 }
26965 if (e) {
26966 log_packet_detailed("'multipliers' field error detected");
26967 }
26968
26969#endif
26970 SEND_PACKET_END(PACKET_PLAYER_MULTIPLIER);
26971}
26972
26973 int send_packet_player_multiplier(struct connection *pc, const struct packet_player_multiplier *packet)
26974{
26975 if (!pc->used) {
26976 log_error("WARNING: trying to send data to the closed connection %s",
26977 conn_description(pc));
26978 return -1;
26979 }
26980 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_MULTIPLIER].packet != nullptr, -1,
26981 "Handler for PACKET_PLAYER_MULTIPLIER not installed");
26982 return pc->phs.handlers->send[PACKET_PLAYER_MULTIPLIER].packet(pc, packet);
26983}
26984
26985 static inline void init_packet_research_info(struct packet_research_info *packet)
26986{
26987 memset(packet, 0, sizeof(*packet));
26988}
26989
26990#define free_packet_research_info(_packet) (void) 0
26991#define destroy_packet_research_info free
26992
26993#ifdef FREECIV_DELTA_PROTOCOL
26994static genhash_val_t hash_packet_research_info_100(const void *vkey)
26995{
26996 const struct packet_research_info *key = (const struct packet_research_info *) vkey;
26997 genhash_val_t result = 0;
26998
26999 result += key->id;
27000
27001 result &= 0xFFFFFFFF;
27002 return result;
27003}
27004
27005static bool cmp_packet_research_info_100(const void *vkey1, const void *vkey2)
27006{
27007 const struct packet_research_info *old = (const struct packet_research_info *) vkey1;
27008 const struct packet_research_info *real_packet = (const struct packet_research_info *) vkey2;
27009 bool differ;
27010
27011 differ = (old->id != real_packet->id);
27012
27013 return !differ;
27014}
27015 BV_DEFINE(packet_research_info_100_fields, 8);
27016#endif /* FREECIV_DELTA_PROTOCOL */
27017
27018 static struct packet_research_info *receive_packet_research_info_100(struct connection *pc)
27019{
27020#define FREE_PACKET_STRUCT(_packet) free_packet_research_info(_packet)
27021#ifdef FREECIV_DELTA_PROTOCOL
27022 packet_research_info_100_fields fields;
27023 struct packet_research_info *old;
27024 struct genhash **hash = pc->phs.received + PACKET_RESEARCH_INFO;
27025#endif /* FREECIV_DELTA_PROTOCOL */
27026 RECEIVE_PACKET_START(packet_research_info, real_packet);
27027#ifdef FREECIV_JSON_CONNECTION
27028 struct plocation field_addr;
27029 {
27030 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27031 field_addr = *field_addr_tmp;
27032 FC_FREE(field_addr_tmp);
27033 }
27034#endif /* FREECIV_JSON_CONNECTION */
27035
27036#ifdef FREECIV_DELTA_PROTOCOL
27037#ifdef FREECIV_JSON_CONNECTION
27038 field_addr.name = "fields";
27039#endif /* FREECIV_JSON_CONNECTION */
27040 DIO_BV_GET(&din, &field_addr, fields);
27041#ifdef FREECIV_JSON_CONNECTION
27042 field_addr.name = "id";
27043#endif /* FREECIV_JSON_CONNECTION */
27044 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
27045 RECEIVE_PACKET_FIELD_ERROR(id);
27046 }
27047
27048#else /* FREECIV_DELTA_PROTOCOL */
27049#ifdef FREECIV_JSON_CONNECTION
27050 field_addr.name = "id";
27051#endif /* FREECIV_JSON_CONNECTION */
27052 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
27053 RECEIVE_PACKET_FIELD_ERROR(id);
27054 }
27055#ifdef FREECIV_JSON_CONNECTION
27056 field_addr.name = "techs_researched";
27057#endif /* FREECIV_JSON_CONNECTION */
27058 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->techs_researched)) {
27059 RECEIVE_PACKET_FIELD_ERROR(techs_researched);
27060 }
27061#ifdef FREECIV_JSON_CONNECTION
27062 field_addr.name = "future_tech";
27063#endif /* FREECIV_JSON_CONNECTION */
27064 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
27065 RECEIVE_PACKET_FIELD_ERROR(future_tech);
27066 }
27067#ifdef FREECIV_JSON_CONNECTION
27068 field_addr.name = "researching";
27069#endif /* FREECIV_JSON_CONNECTION */
27070 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
27071 RECEIVE_PACKET_FIELD_ERROR(researching);
27072 }
27073#ifdef FREECIV_JSON_CONNECTION
27074 field_addr.name = "researching_cost";
27075#endif /* FREECIV_JSON_CONNECTION */
27076 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->researching_cost)) {
27077 RECEIVE_PACKET_FIELD_ERROR(researching_cost);
27078 }
27079#ifdef FREECIV_JSON_CONNECTION
27080 field_addr.name = "bulbs_researched";
27081#endif /* FREECIV_JSON_CONNECTION */
27082 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
27083 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
27084 }
27085#ifdef FREECIV_JSON_CONNECTION
27086 field_addr.name = "tech_goal";
27087#endif /* FREECIV_JSON_CONNECTION */
27088 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_goal)) {
27089 RECEIVE_PACKET_FIELD_ERROR(tech_goal);
27090 }
27091#ifdef FREECIV_JSON_CONNECTION
27092 field_addr.name = "total_bulbs_prod";
27093#endif /* FREECIV_JSON_CONNECTION */
27094 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->total_bulbs_prod)) {
27095 RECEIVE_PACKET_FIELD_ERROR(total_bulbs_prod);
27096 }
27097#ifdef FREECIV_JSON_CONNECTION
27098 field_addr.name = "inventions";
27099#endif /* FREECIV_JSON_CONNECTION */
27100 if (!DIO_GET(string, &din, &field_addr, real_packet->inventions, sizeof(real_packet->inventions))) {
27101 RECEIVE_PACKET_FIELD_ERROR(inventions);
27102 }
27103#endif
27104 log_packet_detailed("packet_research_info_100: got info about (%d)",
27105 real_packet->id);
27106
27107#ifdef FREECIV_DELTA_PROTOCOL
27108 if (nullptr == *hash) {
27109 *hash = genhash_new_full(hash_packet_research_info_100, cmp_packet_research_info_100,
27110 nullptr, nullptr, nullptr, destroy_packet_research_info);
27111 }
27112
27113 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27114 *real_packet = *old;
27115 } else {
27116 /* packet is already initialized empty */
27117 log_packet_detailed(" no old info");
27118 }
27119
27120 if (BV_ISSET(fields, 0)) {
27121 log_packet_detailed(" got field 'techs_researched'");
27122#ifdef FREECIV_JSON_CONNECTION
27123 field_addr.name = "techs_researched";
27124#endif /* FREECIV_JSON_CONNECTION */
27125 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->techs_researched)) {
27126 RECEIVE_PACKET_FIELD_ERROR(techs_researched);
27127 }
27128 }
27129 if (BV_ISSET(fields, 1)) {
27130 log_packet_detailed(" got field 'future_tech'");
27131#ifdef FREECIV_JSON_CONNECTION
27132 field_addr.name = "future_tech";
27133#endif /* FREECIV_JSON_CONNECTION */
27134 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
27135 RECEIVE_PACKET_FIELD_ERROR(future_tech);
27136 }
27137 }
27138 if (BV_ISSET(fields, 2)) {
27139 log_packet_detailed(" got field 'researching'");
27140#ifdef FREECIV_JSON_CONNECTION
27141 field_addr.name = "researching";
27142#endif /* FREECIV_JSON_CONNECTION */
27143 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
27144 RECEIVE_PACKET_FIELD_ERROR(researching);
27145 }
27146 }
27147 if (BV_ISSET(fields, 3)) {
27148 log_packet_detailed(" got field 'researching_cost'");
27149#ifdef FREECIV_JSON_CONNECTION
27150 field_addr.name = "researching_cost";
27151#endif /* FREECIV_JSON_CONNECTION */
27152 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->researching_cost)) {
27153 RECEIVE_PACKET_FIELD_ERROR(researching_cost);
27154 }
27155 }
27156 if (BV_ISSET(fields, 4)) {
27157 log_packet_detailed(" got field 'bulbs_researched'");
27158#ifdef FREECIV_JSON_CONNECTION
27159 field_addr.name = "bulbs_researched";
27160#endif /* FREECIV_JSON_CONNECTION */
27161 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
27162 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
27163 }
27164 }
27165 if (BV_ISSET(fields, 5)) {
27166 log_packet_detailed(" got field 'tech_goal'");
27167#ifdef FREECIV_JSON_CONNECTION
27168 field_addr.name = "tech_goal";
27169#endif /* FREECIV_JSON_CONNECTION */
27170 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_goal)) {
27171 RECEIVE_PACKET_FIELD_ERROR(tech_goal);
27172 }
27173 }
27174 if (BV_ISSET(fields, 6)) {
27175 log_packet_detailed(" got field 'total_bulbs_prod'");
27176#ifdef FREECIV_JSON_CONNECTION
27177 field_addr.name = "total_bulbs_prod";
27178#endif /* FREECIV_JSON_CONNECTION */
27179 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->total_bulbs_prod)) {
27180 RECEIVE_PACKET_FIELD_ERROR(total_bulbs_prod);
27181 }
27182 }
27183 if (BV_ISSET(fields, 7)) {
27184 log_packet_detailed(" got field 'inventions'");
27185#ifdef FREECIV_JSON_CONNECTION
27186 field_addr.name = "inventions";
27187#endif /* FREECIV_JSON_CONNECTION */
27188 if (!DIO_GET(string, &din, &field_addr, real_packet->inventions, sizeof(real_packet->inventions))) {
27189 RECEIVE_PACKET_FIELD_ERROR(inventions);
27190 }
27191 }
27192
27193 if (nullptr == old) {
27194 old = fc_malloc(sizeof(*old));
27195 init_packet_research_info(old);
27196 *old = *real_packet;
27197 genhash_insert(*hash, old, old);
27198 } else {
27199 *old = *real_packet;
27200 }
27201
27202#endif /* FREECIV_DELTA_PROTOCOL */
27203 RECEIVE_PACKET_END(real_packet);
27204#undef FREE_PACKET_STRUCT
27205}
27206
27207 static int send_packet_research_info_100(struct connection *pc, const struct packet_research_info *packet)
27208{
27209 const struct packet_research_info *real_packet = packet;
27210 int e;
27211#ifdef FREECIV_DELTA_PROTOCOL
27212 packet_research_info_100_fields fields;
27213 struct packet_research_info *old;
27214 bool differ;
27215 struct genhash **hash = pc->phs.sent + PACKET_RESEARCH_INFO;
27216 int different = 0;
27217#endif /* FREECIV_DELTA_PROTOCOL */
27218 SEND_PACKET_START(PACKET_RESEARCH_INFO);
27219#ifdef FREECIV_JSON_CONNECTION
27220 struct plocation field_addr;
27221 {
27222 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27223 field_addr = *field_addr_tmp;
27224 FC_FREE(field_addr_tmp);
27225 }
27226#endif /* FREECIV_JSON_CONNECTION */
27227
27228 log_packet_detailed("packet_research_info_100: sending info about (%d)",
27229 real_packet->id);
27230
27231#ifdef FREECIV_DELTA_PROTOCOL
27232 if (nullptr == *hash) {
27233 *hash = genhash_new_full(hash_packet_research_info_100, cmp_packet_research_info_100,
27234 nullptr, nullptr, nullptr, destroy_packet_research_info);
27235 }
27236 BV_CLR_ALL(fields);
27237
27238 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27239 old = fc_malloc(sizeof(*old));
27240 /* temporary bitcopy just to insert correctly */
27241 *old = *real_packet;
27242 genhash_insert(*hash, old, old);
27243 init_packet_research_info(old);
27244 different = 1; /* Force to send. */
27245 }
27246 differ = (old->techs_researched != real_packet->techs_researched);
27247 if (differ) {
27248 different++;
27249 BV_SET(fields, 0);
27250 }
27251
27252 differ = (old->future_tech != real_packet->future_tech);
27253 if (differ) {
27254 different++;
27255 BV_SET(fields, 1);
27256 }
27257
27258 differ = (old->researching != real_packet->researching);
27259 if (differ) {
27260 different++;
27261 BV_SET(fields, 2);
27262 }
27263
27264 differ = (old->researching_cost != real_packet->researching_cost);
27265 if (differ) {
27266 different++;
27267 BV_SET(fields, 3);
27268 }
27269
27270 differ = (old->bulbs_researched != real_packet->bulbs_researched);
27271 if (differ) {
27272 different++;
27273 BV_SET(fields, 4);
27274 }
27275
27276 differ = (old->tech_goal != real_packet->tech_goal);
27277 if (differ) {
27278 different++;
27279 BV_SET(fields, 5);
27280 }
27281
27282 differ = (old->total_bulbs_prod != real_packet->total_bulbs_prod);
27283 if (differ) {
27284 different++;
27285 BV_SET(fields, 6);
27286 }
27287
27288 differ = (strcmp(old->inventions, real_packet->inventions) != 0);
27289 if (differ) {
27290 different++;
27291 BV_SET(fields, 7);
27292 }
27293
27294 if (different == 0) {
27295 log_packet_detailed(" no change -> discard");
27296 return 0;
27297 }
27298
27299#ifdef FREECIV_JSON_CONNECTION
27300 field_addr.name = "fields";
27301#endif /* FREECIV_JSON_CONNECTION */
27302 e = 0;
27303 e |= DIO_BV_PUT(&dout, &field_addr, fields);
27304 if (e) {
27305 log_packet_detailed("fields bitvector error detected");
27306 }
27307#ifdef FREECIV_JSON_CONNECTION
27308 field_addr.name = "id";
27309#endif /* FREECIV_JSON_CONNECTION */
27310 e = 0;
27311 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
27312 if (e) {
27313 log_packet_detailed("'id' field error detected");
27314 }
27315
27316 if (BV_ISSET(fields, 0)) {
27317 log_packet_detailed(" field 'techs_researched' has changed");
27318#ifdef FREECIV_JSON_CONNECTION
27319 field_addr.name = "techs_researched";
27320#endif /* FREECIV_JSON_CONNECTION */
27321 e = 0;
27322 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->techs_researched);
27323 if (e) {
27324 log_packet_detailed("'techs_researched' field error detected");
27325 }
27326 }
27327 if (BV_ISSET(fields, 1)) {
27328 log_packet_detailed(" field 'future_tech' has changed");
27329#ifdef FREECIV_JSON_CONNECTION
27330 field_addr.name = "future_tech";
27331#endif /* FREECIV_JSON_CONNECTION */
27332 e = 0;
27333 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
27334 if (e) {
27335 log_packet_detailed("'future_tech' field error detected");
27336 }
27337 }
27338 if (BV_ISSET(fields, 2)) {
27339 log_packet_detailed(" field 'researching' has changed");
27340#ifdef FREECIV_JSON_CONNECTION
27341 field_addr.name = "researching";
27342#endif /* FREECIV_JSON_CONNECTION */
27343 e = 0;
27344 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
27345 if (e) {
27346 log_packet_detailed("'researching' field error detected");
27347 }
27348 }
27349 if (BV_ISSET(fields, 3)) {
27350 log_packet_detailed(" field 'researching_cost' has changed");
27351#ifdef FREECIV_JSON_CONNECTION
27352 field_addr.name = "researching_cost";
27353#endif /* FREECIV_JSON_CONNECTION */
27354 e = 0;
27355 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->researching_cost);
27356 if (e) {
27357 log_packet_detailed("'researching_cost' field error detected");
27358 }
27359 }
27360 if (BV_ISSET(fields, 4)) {
27361 log_packet_detailed(" field 'bulbs_researched' has changed");
27362#ifdef FREECIV_JSON_CONNECTION
27363 field_addr.name = "bulbs_researched";
27364#endif /* FREECIV_JSON_CONNECTION */
27365 e = 0;
27366 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
27367 if (e) {
27368 log_packet_detailed("'bulbs_researched' field error detected");
27369 }
27370 }
27371 if (BV_ISSET(fields, 5)) {
27372 log_packet_detailed(" field 'tech_goal' has changed");
27373#ifdef FREECIV_JSON_CONNECTION
27374 field_addr.name = "tech_goal";
27375#endif /* FREECIV_JSON_CONNECTION */
27376 e = 0;
27377 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_goal);
27378 if (e) {
27379 log_packet_detailed("'tech_goal' field error detected");
27380 }
27381 }
27382 if (BV_ISSET(fields, 6)) {
27383 log_packet_detailed(" field 'total_bulbs_prod' has changed");
27384#ifdef FREECIV_JSON_CONNECTION
27385 field_addr.name = "total_bulbs_prod";
27386#endif /* FREECIV_JSON_CONNECTION */
27387 e = 0;
27388 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->total_bulbs_prod);
27389 if (e) {
27390 log_packet_detailed("'total_bulbs_prod' field error detected");
27391 }
27392 }
27393 if (BV_ISSET(fields, 7)) {
27394 log_packet_detailed(" field 'inventions' has changed");
27395#ifdef FREECIV_JSON_CONNECTION
27396 field_addr.name = "inventions";
27397#endif /* FREECIV_JSON_CONNECTION */
27398 e = 0;
27399 e |= DIO_PUT(string, &dout, &field_addr, real_packet->inventions);
27400 if (e) {
27401 log_packet_detailed("'inventions' field error detected");
27402 }
27403 }
27404
27405 *old = *real_packet;
27406#endif /* FREECIV_DELTA_PROTOCOL */
27407#ifndef FREECIV_DELTA_PROTOCOL
27408#ifdef FREECIV_JSON_CONNECTION
27409 field_addr.name = "id";
27410#endif /* FREECIV_JSON_CONNECTION */
27411 e = 0;
27412 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
27413 if (e) {
27414 log_packet_detailed("'id' field error detected");
27415 }
27416#ifdef FREECIV_JSON_CONNECTION
27417 field_addr.name = "techs_researched";
27418#endif /* FREECIV_JSON_CONNECTION */
27419 e = 0;
27420 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->techs_researched);
27421 if (e) {
27422 log_packet_detailed("'techs_researched' field error detected");
27423 }
27424#ifdef FREECIV_JSON_CONNECTION
27425 field_addr.name = "future_tech";
27426#endif /* FREECIV_JSON_CONNECTION */
27427 e = 0;
27428 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
27429 if (e) {
27430 log_packet_detailed("'future_tech' field error detected");
27431 }
27432#ifdef FREECIV_JSON_CONNECTION
27433 field_addr.name = "researching";
27434#endif /* FREECIV_JSON_CONNECTION */
27435 e = 0;
27436 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
27437 if (e) {
27438 log_packet_detailed("'researching' field error detected");
27439 }
27440#ifdef FREECIV_JSON_CONNECTION
27441 field_addr.name = "researching_cost";
27442#endif /* FREECIV_JSON_CONNECTION */
27443 e = 0;
27444 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->researching_cost);
27445 if (e) {
27446 log_packet_detailed("'researching_cost' field error detected");
27447 }
27448#ifdef FREECIV_JSON_CONNECTION
27449 field_addr.name = "bulbs_researched";
27450#endif /* FREECIV_JSON_CONNECTION */
27451 e = 0;
27452 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
27453 if (e) {
27454 log_packet_detailed("'bulbs_researched' field error detected");
27455 }
27456#ifdef FREECIV_JSON_CONNECTION
27457 field_addr.name = "tech_goal";
27458#endif /* FREECIV_JSON_CONNECTION */
27459 e = 0;
27460 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_goal);
27461 if (e) {
27462 log_packet_detailed("'tech_goal' field error detected");
27463 }
27464#ifdef FREECIV_JSON_CONNECTION
27465 field_addr.name = "total_bulbs_prod";
27466#endif /* FREECIV_JSON_CONNECTION */
27467 e = 0;
27468 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->total_bulbs_prod);
27469 if (e) {
27470 log_packet_detailed("'total_bulbs_prod' field error detected");
27471 }
27472#ifdef FREECIV_JSON_CONNECTION
27473 field_addr.name = "inventions";
27474#endif /* FREECIV_JSON_CONNECTION */
27475 e = 0;
27476 e |= DIO_PUT(string, &dout, &field_addr, real_packet->inventions);
27477 if (e) {
27478 log_packet_detailed("'inventions' field error detected");
27479 }
27480
27481#endif
27482 SEND_PACKET_END(PACKET_RESEARCH_INFO);
27483}
27484
27485 int send_packet_research_info(struct connection *pc, const struct packet_research_info *packet)
27486{
27487 if (!pc->used) {
27488 log_error("WARNING: trying to send data to the closed connection %s",
27489 conn_description(pc));
27490 return -1;
27491 }
27492 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RESEARCH_INFO].packet != nullptr, -1,
27493 "Handler for PACKET_RESEARCH_INFO not installed");
27494 return pc->phs.handlers->send[PACKET_RESEARCH_INFO].packet(pc, packet);
27495}
27496
27497 void lsend_packet_research_info(struct conn_list *dest, const struct packet_research_info *packet)
27498{
27499 conn_list_iterate(dest, pconn) {
27500 send_packet_research_info(pconn, packet);
27501 } conn_list_iterate_end;
27502}
27503
27504 static inline void init_packet_unknown_research(struct packet_unknown_research *packet)
27505{
27506 memset(packet, 0, sizeof(*packet));
27507}
27508
27509#define free_packet_unknown_research(_packet) (void) 0
27510#define destroy_packet_unknown_research free
27511
27512#ifdef FREECIV_DELTA_PROTOCOL
27513#define hash_packet_unknown_research_100 hash_const
27514
27515#define cmp_packet_unknown_research_100 cmp_const
27516
27517 BV_DEFINE(packet_unknown_research_100_fields, 1);
27518#endif /* FREECIV_DELTA_PROTOCOL */
27519
27520 static struct packet_unknown_research *receive_packet_unknown_research_100(struct connection *pc)
27521{
27522#define FREE_PACKET_STRUCT(_packet) free_packet_unknown_research(_packet)
27523#ifdef FREECIV_DELTA_PROTOCOL
27524 packet_unknown_research_100_fields fields;
27525 struct packet_unknown_research *old;
27526 struct genhash **hash = pc->phs.received + PACKET_UNKNOWN_RESEARCH;
27527#endif /* FREECIV_DELTA_PROTOCOL */
27528 RECEIVE_PACKET_START(packet_unknown_research, real_packet);
27529#ifdef FREECIV_JSON_CONNECTION
27530 struct plocation field_addr;
27531 {
27532 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27533 field_addr = *field_addr_tmp;
27534 FC_FREE(field_addr_tmp);
27535 }
27536#endif /* FREECIV_JSON_CONNECTION */
27537
27538#ifdef FREECIV_DELTA_PROTOCOL
27539#ifdef FREECIV_JSON_CONNECTION
27540 field_addr.name = "fields";
27541#endif /* FREECIV_JSON_CONNECTION */
27542 DIO_BV_GET(&din, &field_addr, fields);
27543
27544#else /* FREECIV_DELTA_PROTOCOL */
27545#ifdef FREECIV_JSON_CONNECTION
27546 field_addr.name = "id";
27547#endif /* FREECIV_JSON_CONNECTION */
27548 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
27549 RECEIVE_PACKET_FIELD_ERROR(id);
27550 }
27551#endif
27552 log_packet_detailed("packet_unknown_research_100: got info about ()");
27553
27554#ifdef FREECIV_DELTA_PROTOCOL
27555 if (nullptr == *hash) {
27556 *hash = genhash_new_full(hash_packet_unknown_research_100, cmp_packet_unknown_research_100,
27557 nullptr, nullptr, nullptr, destroy_packet_unknown_research);
27558 }
27559
27560 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27561 *real_packet = *old;
27562 } else {
27563 /* packet is already initialized empty */
27564 log_packet_detailed(" no old info");
27565 }
27566
27567 if (BV_ISSET(fields, 0)) {
27568 log_packet_detailed(" got field 'id'");
27569#ifdef FREECIV_JSON_CONNECTION
27570 field_addr.name = "id";
27571#endif /* FREECIV_JSON_CONNECTION */
27572 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
27573 RECEIVE_PACKET_FIELD_ERROR(id);
27574 }
27575 }
27576
27577 if (nullptr == old) {
27578 old = fc_malloc(sizeof(*old));
27579 init_packet_unknown_research(old);
27580 *old = *real_packet;
27581 genhash_insert(*hash, old, old);
27582 } else {
27583 *old = *real_packet;
27584 }
27585
27586 hash = pc->phs.received + PACKET_RESEARCH_INFO;
27587 if (nullptr != *hash) {
27588 genhash_remove(*hash, real_packet);
27589 }
27590
27591#endif /* FREECIV_DELTA_PROTOCOL */
27592 RECEIVE_PACKET_END(real_packet);
27593#undef FREE_PACKET_STRUCT
27594}
27595
27596 static int send_packet_unknown_research_100(struct connection *pc, const struct packet_unknown_research *packet)
27597{
27598 const struct packet_unknown_research *real_packet = packet;
27599 int e;
27600#ifdef FREECIV_DELTA_PROTOCOL
27601 packet_unknown_research_100_fields fields;
27602 struct packet_unknown_research *old;
27603 bool differ;
27604 struct genhash **hash = pc->phs.sent + PACKET_UNKNOWN_RESEARCH;
27605 int different = 0;
27606#endif /* FREECIV_DELTA_PROTOCOL */
27607 SEND_PACKET_START(PACKET_UNKNOWN_RESEARCH);
27608#ifdef FREECIV_JSON_CONNECTION
27609 struct plocation field_addr;
27610 {
27611 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27612 field_addr = *field_addr_tmp;
27613 FC_FREE(field_addr_tmp);
27614 }
27615#endif /* FREECIV_JSON_CONNECTION */
27616
27617 log_packet_detailed("packet_unknown_research_100: sending info about ()");
27618
27619#ifdef FREECIV_DELTA_PROTOCOL
27620 if (nullptr == *hash) {
27621 *hash = genhash_new_full(hash_packet_unknown_research_100, cmp_packet_unknown_research_100,
27622 nullptr, nullptr, nullptr, destroy_packet_unknown_research);
27623 }
27624 BV_CLR_ALL(fields);
27625
27626 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27627 old = fc_malloc(sizeof(*old));
27628 /* temporary bitcopy just to insert correctly */
27629 *old = *real_packet;
27630 genhash_insert(*hash, old, old);
27631 init_packet_unknown_research(old);
27632 different = 1; /* Force to send. */
27633 }
27634 differ = (old->id != real_packet->id);
27635 if (differ) {
27636 different++;
27637 BV_SET(fields, 0);
27638 }
27639
27640 if (different == 0) {
27641 log_packet_detailed(" no change -> discard");
27642 return 0;
27643 }
27644
27645#ifdef FREECIV_JSON_CONNECTION
27646 field_addr.name = "fields";
27647#endif /* FREECIV_JSON_CONNECTION */
27648 e = 0;
27649 e |= DIO_BV_PUT(&dout, &field_addr, fields);
27650 if (e) {
27651 log_packet_detailed("fields bitvector error detected");
27652 }
27653
27654 if (BV_ISSET(fields, 0)) {
27655 log_packet_detailed(" field 'id' has changed");
27656#ifdef FREECIV_JSON_CONNECTION
27657 field_addr.name = "id";
27658#endif /* FREECIV_JSON_CONNECTION */
27659 e = 0;
27660 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
27661 if (e) {
27662 log_packet_detailed("'id' field error detected");
27663 }
27664 }
27665
27666 *old = *real_packet;
27667
27668 hash = pc->phs.sent + PACKET_RESEARCH_INFO;
27669 if (nullptr != *hash) {
27670 genhash_remove(*hash, real_packet);
27671 }
27672#endif /* FREECIV_DELTA_PROTOCOL */
27673#ifndef FREECIV_DELTA_PROTOCOL
27674#ifdef FREECIV_JSON_CONNECTION
27675 field_addr.name = "id";
27676#endif /* FREECIV_JSON_CONNECTION */
27677 e = 0;
27678 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
27679 if (e) {
27680 log_packet_detailed("'id' field error detected");
27681 }
27682
27683#endif
27684 SEND_PACKET_END(PACKET_UNKNOWN_RESEARCH);
27685}
27686
27687 int send_packet_unknown_research(struct connection *pc, const struct packet_unknown_research *packet)
27688{
27689 if (!pc->used) {
27690 log_error("WARNING: trying to send data to the closed connection %s",
27691 conn_description(pc));
27692 return -1;
27693 }
27694 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNKNOWN_RESEARCH].packet != nullptr, -1,
27695 "Handler for PACKET_UNKNOWN_RESEARCH not installed");
27696 return pc->phs.handlers->send[PACKET_UNKNOWN_RESEARCH].packet(pc, packet);
27697}
27698
27699 static inline void init_packet_player_research(struct packet_player_research *packet)
27700{
27701 memset(packet, 0, sizeof(*packet));
27702}
27703
27704#define free_packet_player_research(_packet) (void) 0
27705#define destroy_packet_player_research free
27706
27707#ifdef FREECIV_DELTA_PROTOCOL
27708#define hash_packet_player_research_100 hash_const
27709
27710#define cmp_packet_player_research_100 cmp_const
27711
27712 BV_DEFINE(packet_player_research_100_fields, 1);
27713#endif /* FREECIV_DELTA_PROTOCOL */
27714
27715 static struct packet_player_research *receive_packet_player_research_100(struct connection *pc)
27716{
27717#define FREE_PACKET_STRUCT(_packet) free_packet_player_research(_packet)
27718#ifdef FREECIV_DELTA_PROTOCOL
27719 packet_player_research_100_fields fields;
27720 struct packet_player_research *old;
27721 struct genhash **hash = pc->phs.received + PACKET_PLAYER_RESEARCH;
27722#endif /* FREECIV_DELTA_PROTOCOL */
27723 RECEIVE_PACKET_START(packet_player_research, real_packet);
27724#ifdef FREECIV_JSON_CONNECTION
27725 struct plocation field_addr;
27726 {
27727 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27728 field_addr = *field_addr_tmp;
27729 FC_FREE(field_addr_tmp);
27730 }
27731#endif /* FREECIV_JSON_CONNECTION */
27732
27733#ifdef FREECIV_DELTA_PROTOCOL
27734#ifdef FREECIV_JSON_CONNECTION
27735 field_addr.name = "fields";
27736#endif /* FREECIV_JSON_CONNECTION */
27737 DIO_BV_GET(&din, &field_addr, fields);
27738
27739#else /* FREECIV_DELTA_PROTOCOL */
27740#ifdef FREECIV_JSON_CONNECTION
27741 field_addr.name = "tech";
27742#endif /* FREECIV_JSON_CONNECTION */
27743 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27744 RECEIVE_PACKET_FIELD_ERROR(tech);
27745 }
27746#endif
27747 log_packet_detailed("packet_player_research_100: got info about ()");
27748
27749#ifdef FREECIV_DELTA_PROTOCOL
27750 if (nullptr == *hash) {
27751 *hash = genhash_new_full(hash_packet_player_research_100, cmp_packet_player_research_100,
27752 nullptr, nullptr, nullptr, destroy_packet_player_research);
27753 }
27754
27755 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27756 *real_packet = *old;
27757 } else {
27758 /* packet is already initialized empty */
27759 log_packet_detailed(" no old info");
27760 }
27761
27762 if (BV_ISSET(fields, 0)) {
27763 log_packet_detailed(" got field 'tech'");
27764#ifdef FREECIV_JSON_CONNECTION
27765 field_addr.name = "tech";
27766#endif /* FREECIV_JSON_CONNECTION */
27767 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27768 RECEIVE_PACKET_FIELD_ERROR(tech);
27769 }
27770 }
27771
27772 if (nullptr == old) {
27773 old = fc_malloc(sizeof(*old));
27774 init_packet_player_research(old);
27775 *old = *real_packet;
27776 genhash_insert(*hash, old, old);
27777 } else {
27778 *old = *real_packet;
27779 }
27780
27781#endif /* FREECIV_DELTA_PROTOCOL */
27782 RECEIVE_PACKET_END(real_packet);
27783#undef FREE_PACKET_STRUCT
27784}
27785
27786 static int send_packet_player_research_100(struct connection *pc, const struct packet_player_research *packet)
27787{
27788 const struct packet_player_research *real_packet = packet;
27789 int e;
27790#ifdef FREECIV_DELTA_PROTOCOL
27791 packet_player_research_100_fields fields;
27792 struct packet_player_research *old;
27793 bool differ;
27794 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_RESEARCH;
27795#endif /* FREECIV_DELTA_PROTOCOL */
27796 SEND_PACKET_START(PACKET_PLAYER_RESEARCH);
27797#ifdef FREECIV_JSON_CONNECTION
27798 struct plocation field_addr;
27799 {
27800 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27801 field_addr = *field_addr_tmp;
27802 FC_FREE(field_addr_tmp);
27803 }
27804#endif /* FREECIV_JSON_CONNECTION */
27805
27806 log_packet_detailed("packet_player_research_100: sending info about ()");
27807
27808#ifdef FREECIV_DELTA_PROTOCOL
27809 if (nullptr == *hash) {
27810 *hash = genhash_new_full(hash_packet_player_research_100, cmp_packet_player_research_100,
27811 nullptr, nullptr, nullptr, destroy_packet_player_research);
27812 }
27813 BV_CLR_ALL(fields);
27814
27815 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27816 old = fc_malloc(sizeof(*old));
27817 /* temporary bitcopy just to insert correctly */
27818 *old = *real_packet;
27819 genhash_insert(*hash, old, old);
27820 init_packet_player_research(old);
27821 }
27822 differ = (old->tech != real_packet->tech);
27823 if (differ) {
27824 BV_SET(fields, 0);
27825 }
27826
27827
27828#ifdef FREECIV_JSON_CONNECTION
27829 field_addr.name = "fields";
27830#endif /* FREECIV_JSON_CONNECTION */
27831 e = 0;
27832 e |= DIO_BV_PUT(&dout, &field_addr, fields);
27833 if (e) {
27834 log_packet_detailed("fields bitvector error detected");
27835 }
27836
27837 if (BV_ISSET(fields, 0)) {
27838 log_packet_detailed(" field 'tech' has changed");
27839#ifdef FREECIV_JSON_CONNECTION
27840 field_addr.name = "tech";
27841#endif /* FREECIV_JSON_CONNECTION */
27842 e = 0;
27843 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
27844 if (e) {
27845 log_packet_detailed("'tech' field error detected");
27846 }
27847 }
27848
27849 *old = *real_packet;
27850#endif /* FREECIV_DELTA_PROTOCOL */
27851#ifndef FREECIV_DELTA_PROTOCOL
27852#ifdef FREECIV_JSON_CONNECTION
27853 field_addr.name = "tech";
27854#endif /* FREECIV_JSON_CONNECTION */
27855 e = 0;
27856 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
27857 if (e) {
27858 log_packet_detailed("'tech' field error detected");
27859 }
27860
27861#endif
27862 SEND_PACKET_END(PACKET_PLAYER_RESEARCH);
27863}
27864
27865 int send_packet_player_research(struct connection *pc, const struct packet_player_research *packet)
27866{
27867 if (!pc->used) {
27868 log_error("WARNING: trying to send data to the closed connection %s",
27869 conn_description(pc));
27870 return -1;
27871 }
27872 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_RESEARCH].packet != nullptr, -1,
27873 "Handler for PACKET_PLAYER_RESEARCH not installed");
27874 return pc->phs.handlers->send[PACKET_PLAYER_RESEARCH].packet(pc, packet);
27875}
27876
27877 int dsend_packet_player_research(struct connection *pc, int tech)
27878{
27879 struct packet_player_research packet, *real_packet = &packet;
27880
27881 real_packet->tech = tech;
27882
27883 return send_packet_player_research(pc, real_packet);
27884}
27885
27886 static inline void init_packet_player_tech_goal(struct packet_player_tech_goal *packet)
27887{
27888 memset(packet, 0, sizeof(*packet));
27889}
27890
27891#define free_packet_player_tech_goal(_packet) (void) 0
27892#define destroy_packet_player_tech_goal free
27893
27894#ifdef FREECIV_DELTA_PROTOCOL
27895#define hash_packet_player_tech_goal_100 hash_const
27896
27897#define cmp_packet_player_tech_goal_100 cmp_const
27898
27899 BV_DEFINE(packet_player_tech_goal_100_fields, 1);
27900#endif /* FREECIV_DELTA_PROTOCOL */
27901
27902 static struct packet_player_tech_goal *receive_packet_player_tech_goal_100(struct connection *pc)
27903{
27904#define FREE_PACKET_STRUCT(_packet) free_packet_player_tech_goal(_packet)
27905#ifdef FREECIV_DELTA_PROTOCOL
27906 packet_player_tech_goal_100_fields fields;
27907 struct packet_player_tech_goal *old;
27908 struct genhash **hash = pc->phs.received + PACKET_PLAYER_TECH_GOAL;
27909#endif /* FREECIV_DELTA_PROTOCOL */
27910 RECEIVE_PACKET_START(packet_player_tech_goal, real_packet);
27911#ifdef FREECIV_JSON_CONNECTION
27912 struct plocation field_addr;
27913 {
27914 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27915 field_addr = *field_addr_tmp;
27916 FC_FREE(field_addr_tmp);
27917 }
27918#endif /* FREECIV_JSON_CONNECTION */
27919
27920#ifdef FREECIV_DELTA_PROTOCOL
27921#ifdef FREECIV_JSON_CONNECTION
27922 field_addr.name = "fields";
27923#endif /* FREECIV_JSON_CONNECTION */
27924 DIO_BV_GET(&din, &field_addr, fields);
27925
27926#else /* FREECIV_DELTA_PROTOCOL */
27927#ifdef FREECIV_JSON_CONNECTION
27928 field_addr.name = "tech";
27929#endif /* FREECIV_JSON_CONNECTION */
27930 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27931 RECEIVE_PACKET_FIELD_ERROR(tech);
27932 }
27933#endif
27934 log_packet_detailed("packet_player_tech_goal_100: got info about ()");
27935
27936#ifdef FREECIV_DELTA_PROTOCOL
27937 if (nullptr == *hash) {
27938 *hash = genhash_new_full(hash_packet_player_tech_goal_100, cmp_packet_player_tech_goal_100,
27939 nullptr, nullptr, nullptr, destroy_packet_player_tech_goal);
27940 }
27941
27942 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27943 *real_packet = *old;
27944 } else {
27945 /* packet is already initialized empty */
27946 log_packet_detailed(" no old info");
27947 }
27948
27949 if (BV_ISSET(fields, 0)) {
27950 log_packet_detailed(" got field 'tech'");
27951#ifdef FREECIV_JSON_CONNECTION
27952 field_addr.name = "tech";
27953#endif /* FREECIV_JSON_CONNECTION */
27954 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27955 RECEIVE_PACKET_FIELD_ERROR(tech);
27956 }
27957 }
27958
27959 if (nullptr == old) {
27960 old = fc_malloc(sizeof(*old));
27961 init_packet_player_tech_goal(old);
27962 *old = *real_packet;
27963 genhash_insert(*hash, old, old);
27964 } else {
27965 *old = *real_packet;
27966 }
27967
27968#endif /* FREECIV_DELTA_PROTOCOL */
27969 RECEIVE_PACKET_END(real_packet);
27970#undef FREE_PACKET_STRUCT
27971}
27972
27973 static int send_packet_player_tech_goal_100(struct connection *pc, const struct packet_player_tech_goal *packet)
27974{
27975 const struct packet_player_tech_goal *real_packet = packet;
27976 int e;
27977#ifdef FREECIV_DELTA_PROTOCOL
27978 packet_player_tech_goal_100_fields fields;
27979 struct packet_player_tech_goal *old;
27980 bool differ;
27981 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_TECH_GOAL;
27982#endif /* FREECIV_DELTA_PROTOCOL */
27983 SEND_PACKET_START(PACKET_PLAYER_TECH_GOAL);
27984#ifdef FREECIV_JSON_CONNECTION
27985 struct plocation field_addr;
27986 {
27987 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
27988 field_addr = *field_addr_tmp;
27989 FC_FREE(field_addr_tmp);
27990 }
27991#endif /* FREECIV_JSON_CONNECTION */
27992
27993 log_packet_detailed("packet_player_tech_goal_100: sending info about ()");
27994
27995#ifdef FREECIV_DELTA_PROTOCOL
27996 if (nullptr == *hash) {
27997 *hash = genhash_new_full(hash_packet_player_tech_goal_100, cmp_packet_player_tech_goal_100,
27998 nullptr, nullptr, nullptr, destroy_packet_player_tech_goal);
27999 }
28000 BV_CLR_ALL(fields);
28001
28002 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28003 old = fc_malloc(sizeof(*old));
28004 /* temporary bitcopy just to insert correctly */
28005 *old = *real_packet;
28006 genhash_insert(*hash, old, old);
28007 init_packet_player_tech_goal(old);
28008 }
28009 differ = (old->tech != real_packet->tech);
28010 if (differ) {
28011 BV_SET(fields, 0);
28012 }
28013
28014
28015#ifdef FREECIV_JSON_CONNECTION
28016 field_addr.name = "fields";
28017#endif /* FREECIV_JSON_CONNECTION */
28018 e = 0;
28019 e |= DIO_BV_PUT(&dout, &field_addr, fields);
28020 if (e) {
28021 log_packet_detailed("fields bitvector error detected");
28022 }
28023
28024 if (BV_ISSET(fields, 0)) {
28025 log_packet_detailed(" field 'tech' has changed");
28026#ifdef FREECIV_JSON_CONNECTION
28027 field_addr.name = "tech";
28028#endif /* FREECIV_JSON_CONNECTION */
28029 e = 0;
28030 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
28031 if (e) {
28032 log_packet_detailed("'tech' field error detected");
28033 }
28034 }
28035
28036 *old = *real_packet;
28037#endif /* FREECIV_DELTA_PROTOCOL */
28038#ifndef FREECIV_DELTA_PROTOCOL
28039#ifdef FREECIV_JSON_CONNECTION
28040 field_addr.name = "tech";
28041#endif /* FREECIV_JSON_CONNECTION */
28042 e = 0;
28043 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
28044 if (e) {
28045 log_packet_detailed("'tech' field error detected");
28046 }
28047
28048#endif
28049 SEND_PACKET_END(PACKET_PLAYER_TECH_GOAL);
28050}
28051
28052 int send_packet_player_tech_goal(struct connection *pc, const struct packet_player_tech_goal *packet)
28053{
28054 if (!pc->used) {
28055 log_error("WARNING: trying to send data to the closed connection %s",
28056 conn_description(pc));
28057 return -1;
28058 }
28059 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_TECH_GOAL].packet != nullptr, -1,
28060 "Handler for PACKET_PLAYER_TECH_GOAL not installed");
28061 return pc->phs.handlers->send[PACKET_PLAYER_TECH_GOAL].packet(pc, packet);
28062}
28063
28064 int dsend_packet_player_tech_goal(struct connection *pc, int tech)
28065{
28066 struct packet_player_tech_goal packet, *real_packet = &packet;
28067
28068 real_packet->tech = tech;
28069
28070 return send_packet_player_tech_goal(pc, real_packet);
28071}
28072
28073 static inline void init_packet_unit_remove(struct packet_unit_remove *packet)
28074{
28075 memset(packet, 0, sizeof(*packet));
28076}
28077
28078#define free_packet_unit_remove(_packet) (void) 0
28079#define destroy_packet_unit_remove free
28080
28081#ifdef FREECIV_DELTA_PROTOCOL
28082#define hash_packet_unit_remove_100 hash_const
28083
28084#define cmp_packet_unit_remove_100 cmp_const
28085
28086 BV_DEFINE(packet_unit_remove_100_fields, 1);
28087#endif /* FREECIV_DELTA_PROTOCOL */
28088
28089 static struct packet_unit_remove *receive_packet_unit_remove_100(struct connection *pc)
28090{
28091#define FREE_PACKET_STRUCT(_packet) free_packet_unit_remove(_packet)
28092#ifdef FREECIV_DELTA_PROTOCOL
28093 packet_unit_remove_100_fields fields;
28094 struct packet_unit_remove *old;
28095 struct genhash **hash = pc->phs.received + PACKET_UNIT_REMOVE;
28096#endif /* FREECIV_DELTA_PROTOCOL */
28097 RECEIVE_PACKET_START(packet_unit_remove, real_packet);
28098#ifdef FREECIV_JSON_CONNECTION
28099 struct plocation field_addr;
28100 {
28101 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
28102 field_addr = *field_addr_tmp;
28103 FC_FREE(field_addr_tmp);
28104 }
28105#endif /* FREECIV_JSON_CONNECTION */
28106
28107#ifdef FREECIV_DELTA_PROTOCOL
28108#ifdef FREECIV_JSON_CONNECTION
28109 field_addr.name = "fields";
28110#endif /* FREECIV_JSON_CONNECTION */
28111 DIO_BV_GET(&din, &field_addr, fields);
28112
28113#else /* FREECIV_DELTA_PROTOCOL */
28114#ifdef FREECIV_JSON_CONNECTION
28115 field_addr.name = "unit_id";
28116#endif /* FREECIV_JSON_CONNECTION */
28117 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
28118 RECEIVE_PACKET_FIELD_ERROR(unit_id);
28119 }
28120#endif
28121 log_packet_detailed("packet_unit_remove_100: got info about ()");
28122
28123#ifdef FREECIV_DELTA_PROTOCOL
28124 if (nullptr == *hash) {
28125 *hash = genhash_new_full(hash_packet_unit_remove_100, cmp_packet_unit_remove_100,
28126 nullptr, nullptr, nullptr, destroy_packet_unit_remove);
28127 }
28128
28129 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
28130 *real_packet = *old;
28131 } else {
28132 /* packet is already initialized empty */
28133 log_packet_detailed(" no old info");
28134 }
28135
28136 if (BV_ISSET(fields, 0)) {
28137 log_packet_detailed(" got field 'unit_id'");
28138#ifdef FREECIV_JSON_CONNECTION
28139 field_addr.name = "unit_id";
28140#endif /* FREECIV_JSON_CONNECTION */
28141 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
28142 RECEIVE_PACKET_FIELD_ERROR(unit_id);
28143 }
28144 }
28145
28146 if (nullptr == old) {
28147 old = fc_malloc(sizeof(*old));
28148 init_packet_unit_remove(old);
28149 *old = *real_packet;
28150 genhash_insert(*hash, old, old);
28151 } else {
28152 *old = *real_packet;
28153 }
28154
28155 hash = pc->phs.received + PACKET_UNIT_INFO;
28156 if (nullptr != *hash) {
28157 genhash_remove(*hash, real_packet);
28158 }
28159
28160 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
28161 if (nullptr != *hash) {
28162 genhash_remove(*hash, real_packet);
28163 }
28164
28165#endif /* FREECIV_DELTA_PROTOCOL */
28166 RECEIVE_PACKET_END(real_packet);
28167#undef FREE_PACKET_STRUCT
28168}
28169
28170 static int send_packet_unit_remove_100(struct connection *pc, const struct packet_unit_remove *packet)
28171{
28172 const struct packet_unit_remove *real_packet = packet;
28173 int e;
28174#ifdef FREECIV_DELTA_PROTOCOL
28175 packet_unit_remove_100_fields fields;
28176 struct packet_unit_remove *old;
28177 bool differ;
28178 struct genhash **hash = pc->phs.sent + PACKET_UNIT_REMOVE;
28179#endif /* FREECIV_DELTA_PROTOCOL */
28180 SEND_PACKET_START(PACKET_UNIT_REMOVE);
28181#ifdef FREECIV_JSON_CONNECTION
28182 struct plocation field_addr;
28183 {
28184 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
28185 field_addr = *field_addr_tmp;
28186 FC_FREE(field_addr_tmp);
28187 }
28188#endif /* FREECIV_JSON_CONNECTION */
28189
28190 log_packet_detailed("packet_unit_remove_100: sending info about ()");
28191
28192#ifdef FREECIV_DELTA_PROTOCOL
28193 if (nullptr == *hash) {
28194 *hash = genhash_new_full(hash_packet_unit_remove_100, cmp_packet_unit_remove_100,
28195 nullptr, nullptr, nullptr, destroy_packet_unit_remove);
28196 }
28197 BV_CLR_ALL(fields);
28198
28199 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28200 old = fc_malloc(sizeof(*old));
28201 /* temporary bitcopy just to insert correctly */
28202 *old = *real_packet;
28203 genhash_insert(*hash, old, old);
28204 init_packet_unit_remove(old);
28205 }
28206 differ = (old->unit_id != real_packet->unit_id);
28207 if (differ) {
28208 BV_SET(fields, 0);
28209 }
28210
28211
28212#ifdef FREECIV_JSON_CONNECTION
28213 field_addr.name = "fields";
28214#endif /* FREECIV_JSON_CONNECTION */
28215 e = 0;
28216 e |= DIO_BV_PUT(&dout, &field_addr, fields);
28217 if (e) {
28218 log_packet_detailed("fields bitvector error detected");
28219 }
28220
28221 if (BV_ISSET(fields, 0)) {
28222 log_packet_detailed(" field 'unit_id' has changed");
28223#ifdef FREECIV_JSON_CONNECTION
28224 field_addr.name = "unit_id";
28225#endif /* FREECIV_JSON_CONNECTION */
28226 e = 0;
28227 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
28228 if (e) {
28229 log_packet_detailed("'unit_id' field error detected");
28230 }
28231 }
28232
28233 *old = *real_packet;
28234
28235 hash = pc->phs.sent + PACKET_UNIT_INFO;
28236 if (nullptr != *hash) {
28237 genhash_remove(*hash, real_packet);
28238 }
28239
28240 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
28241 if (nullptr != *hash) {
28242 genhash_remove(*hash, real_packet);
28243 }
28244#endif /* FREECIV_DELTA_PROTOCOL */
28245#ifndef FREECIV_DELTA_PROTOCOL
28246#ifdef FREECIV_JSON_CONNECTION
28247 field_addr.name = "unit_id";
28248#endif /* FREECIV_JSON_CONNECTION */
28249 e = 0;
28250 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
28251 if (e) {
28252 log_packet_detailed("'unit_id' field error detected");
28253 }
28254
28255#endif
28256 SEND_PACKET_END(PACKET_UNIT_REMOVE);
28257}
28258
28259 int send_packet_unit_remove(struct connection *pc, const struct packet_unit_remove *packet)
28260{
28261 if (!pc->used) {
28262 log_error("WARNING: trying to send data to the closed connection %s",
28263 conn_description(pc));
28264 return -1;
28265 }
28266 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_REMOVE].packet != nullptr, -1,
28267 "Handler for PACKET_UNIT_REMOVE not installed");
28268 return pc->phs.handlers->send[PACKET_UNIT_REMOVE].packet(pc, packet);
28269}
28270
28271 void lsend_packet_unit_remove(struct conn_list *dest, const struct packet_unit_remove *packet)
28272{
28273 conn_list_iterate(dest, pconn) {
28274 send_packet_unit_remove(pconn, packet);
28275 } conn_list_iterate_end;
28276}
28277
28278 int dsend_packet_unit_remove(struct connection *pc, int unit_id)
28279{
28280 struct packet_unit_remove packet, *real_packet = &packet;
28281
28282 real_packet->unit_id = unit_id;
28283
28284 return send_packet_unit_remove(pc, real_packet);
28285}
28286
28287 void dlsend_packet_unit_remove(struct conn_list *dest, int unit_id)
28288{
28289 struct packet_unit_remove packet, *real_packet = &packet;
28290
28291 real_packet->unit_id = unit_id;
28292
28293 lsend_packet_unit_remove(dest, real_packet);
28294}
28295
28296 static inline void init_packet_unit_info(struct packet_unit_info *packet)
28297{
28298 memset(packet, 0, sizeof(*packet));
28299}
28300
28301#define free_packet_unit_info(_packet) (void) 0
28302#define destroy_packet_unit_info free
28303
28304#ifdef FREECIV_DELTA_PROTOCOL
28305static genhash_val_t hash_packet_unit_info_100(const void *vkey)
28306{
28307 const struct packet_unit_info *key = (const struct packet_unit_info *) vkey;
28308 genhash_val_t result = 0;
28309
28310 result += key->id;
28311
28312 result &= 0xFFFFFFFF;
28313 return result;
28314}
28315
28316static bool cmp_packet_unit_info_100(const void *vkey1, const void *vkey2)
28317{
28318 const struct packet_unit_info *old = (const struct packet_unit_info *) vkey1;
28319 const struct packet_unit_info *real_packet = (const struct packet_unit_info *) vkey2;
28320 bool differ;
28321
28322 differ = (old->id != real_packet->id);
28323
28324 return !differ;
28325}
28326 BV_DEFINE(packet_unit_info_100_fields, 37);
28327#endif /* FREECIV_DELTA_PROTOCOL */
28328
28329 static struct packet_unit_info *receive_packet_unit_info_100(struct connection *pc)
28330{
28331#define FREE_PACKET_STRUCT(_packet) free_packet_unit_info(_packet)
28332#ifdef FREECIV_DELTA_PROTOCOL
28333 packet_unit_info_100_fields fields;
28334 struct packet_unit_info *old;
28335 struct genhash **hash = pc->phs.received + PACKET_UNIT_INFO;
28336#endif /* FREECIV_DELTA_PROTOCOL */
28337 RECEIVE_PACKET_START(packet_unit_info, real_packet);
28338#ifdef FREECIV_JSON_CONNECTION
28339 struct plocation field_addr;
28340 {
28341 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
28342 field_addr = *field_addr_tmp;
28343 FC_FREE(field_addr_tmp);
28344 }
28345#endif /* FREECIV_JSON_CONNECTION */
28346
28347#ifdef FREECIV_DELTA_PROTOCOL
28348#ifdef FREECIV_JSON_CONNECTION
28349 field_addr.name = "fields";
28350#endif /* FREECIV_JSON_CONNECTION */
28351 DIO_BV_GET(&din, &field_addr, fields);
28352#ifdef FREECIV_JSON_CONNECTION
28353 field_addr.name = "id";
28354#endif /* FREECIV_JSON_CONNECTION */
28355 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
28356 RECEIVE_PACKET_FIELD_ERROR(id);
28357 }
28358
28359#else /* FREECIV_DELTA_PROTOCOL */
28360#ifdef FREECIV_JSON_CONNECTION
28361 field_addr.name = "id";
28362#endif /* FREECIV_JSON_CONNECTION */
28363 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
28364 RECEIVE_PACKET_FIELD_ERROR(id);
28365 }
28366#ifdef FREECIV_JSON_CONNECTION
28367 field_addr.name = "owner";
28368#endif /* FREECIV_JSON_CONNECTION */
28369 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
28370 RECEIVE_PACKET_FIELD_ERROR(owner);
28371 }
28372#ifdef FREECIV_JSON_CONNECTION
28373 field_addr.name = "nationality";
28374#endif /* FREECIV_JSON_CONNECTION */
28375 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nationality)) {
28376 RECEIVE_PACKET_FIELD_ERROR(nationality);
28377 }
28378#ifdef FREECIV_JSON_CONNECTION
28379 field_addr.name = "tile";
28380#endif /* FREECIV_JSON_CONNECTION */
28381 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
28382 RECEIVE_PACKET_FIELD_ERROR(tile);
28383 }
28384#ifdef FREECIV_JSON_CONNECTION
28385 field_addr.name = "facing";
28386#endif /* FREECIV_JSON_CONNECTION */
28387 {
28388 int readin;
28389
28390 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
28391 RECEIVE_PACKET_FIELD_ERROR(facing);
28392 }
28393 real_packet->facing = readin;
28394 }
28395#ifdef FREECIV_JSON_CONNECTION
28396 field_addr.name = "homecity";
28397#endif /* FREECIV_JSON_CONNECTION */
28398 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
28399 RECEIVE_PACKET_FIELD_ERROR(homecity);
28400 }
28401#ifdef FREECIV_JSON_CONNECTION
28402 field_addr.name = "upkeep";
28403#endif /* FREECIV_JSON_CONNECTION */
28404 {
28405 int i;
28406
28407#ifdef FREECIV_JSON_CONNECTION
28408 /* Enter array. */
28409 field_addr.sub_location = plocation_elem_new(0);
28410#endif /* FREECIV_JSON_CONNECTION */
28411
28412 for (i = 0; i < O_LAST; i++) {
28413#ifdef FREECIV_JSON_CONNECTION
28414 field_addr.sub_location->number = i;
28415#endif /* FREECIV_JSON_CONNECTION */
28416 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
28417 RECEIVE_PACKET_FIELD_ERROR(upkeep);
28418 }
28419 }
28420
28421#ifdef FREECIV_JSON_CONNECTION
28422 /* Exit array. */
28423 FC_FREE(field_addr.sub_location);
28424#endif /* FREECIV_JSON_CONNECTION */
28425 }
28426#ifdef FREECIV_JSON_CONNECTION
28427 field_addr.name = "veteran";
28428#endif /* FREECIV_JSON_CONNECTION */
28429 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
28430 RECEIVE_PACKET_FIELD_ERROR(veteran);
28431 }
28432#ifdef FREECIV_JSON_CONNECTION
28433 field_addr.name = "ssa_controller";
28434#endif /* FREECIV_JSON_CONNECTION */
28435 {
28436 int readin;
28437
28438 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28439 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
28440 }
28441 real_packet->ssa_controller = readin;
28442 }
28443#ifdef FREECIV_JSON_CONNECTION
28444 field_addr.name = "paradropped";
28445#endif /* FREECIV_JSON_CONNECTION */
28446 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
28447 RECEIVE_PACKET_FIELD_ERROR(paradropped);
28448 }
28449#ifdef FREECIV_JSON_CONNECTION
28450 field_addr.name = "occupied";
28451#endif /* FREECIV_JSON_CONNECTION */
28452 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
28453 RECEIVE_PACKET_FIELD_ERROR(occupied);
28454 }
28455#ifdef FREECIV_JSON_CONNECTION
28456 field_addr.name = "transported";
28457#endif /* FREECIV_JSON_CONNECTION */
28458 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
28459 RECEIVE_PACKET_FIELD_ERROR(transported);
28460 }
28461#ifdef FREECIV_JSON_CONNECTION
28462 field_addr.name = "done_moving";
28463#endif /* FREECIV_JSON_CONNECTION */
28464 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
28465 RECEIVE_PACKET_FIELD_ERROR(done_moving);
28466 }
28467#ifdef FREECIV_JSON_CONNECTION
28468 field_addr.name = "stay";
28469#endif /* FREECIV_JSON_CONNECTION */
28470 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
28471 RECEIVE_PACKET_FIELD_ERROR(stay);
28472 }
28473#ifdef FREECIV_JSON_CONNECTION
28474 field_addr.name = "birth_turn";
28475#endif /* FREECIV_JSON_CONNECTION */
28476 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->birth_turn)) {
28477 RECEIVE_PACKET_FIELD_ERROR(birth_turn);
28478 }
28479#ifdef FREECIV_JSON_CONNECTION
28480 field_addr.name = "current_form_turn";
28481#endif /* FREECIV_JSON_CONNECTION */
28482 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->current_form_turn)) {
28483 RECEIVE_PACKET_FIELD_ERROR(current_form_turn);
28484 }
28485#ifdef FREECIV_JSON_CONNECTION
28486 field_addr.name = "type";
28487#endif /* FREECIV_JSON_CONNECTION */
28488 {
28489 int readin;
28490
28491 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
28492 RECEIVE_PACKET_FIELD_ERROR(type);
28493 }
28494 real_packet->type = readin;
28495 }
28496#ifdef FREECIV_JSON_CONNECTION
28497 field_addr.name = "transported_by";
28498#endif /* FREECIV_JSON_CONNECTION */
28499 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
28500 RECEIVE_PACKET_FIELD_ERROR(transported_by);
28501 }
28502#ifdef FREECIV_JSON_CONNECTION
28503 field_addr.name = "carrying";
28504#endif /* FREECIV_JSON_CONNECTION */
28505 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
28506 RECEIVE_PACKET_FIELD_ERROR(carrying);
28507 }
28508#ifdef FREECIV_JSON_CONNECTION
28509 field_addr.name = "movesleft";
28510#endif /* FREECIV_JSON_CONNECTION */
28511 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
28512 RECEIVE_PACKET_FIELD_ERROR(movesleft);
28513 }
28514#ifdef FREECIV_JSON_CONNECTION
28515 field_addr.name = "hp";
28516#endif /* FREECIV_JSON_CONNECTION */
28517 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
28518 RECEIVE_PACKET_FIELD_ERROR(hp);
28519 }
28520#ifdef FREECIV_JSON_CONNECTION
28521 field_addr.name = "fuel";
28522#endif /* FREECIV_JSON_CONNECTION */
28523 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
28524 RECEIVE_PACKET_FIELD_ERROR(fuel);
28525 }
28526#ifdef FREECIV_JSON_CONNECTION
28527 field_addr.name = "activity_count";
28528#endif /* FREECIV_JSON_CONNECTION */
28529 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
28530 RECEIVE_PACKET_FIELD_ERROR(activity_count);
28531 }
28532#ifdef FREECIV_JSON_CONNECTION
28533 field_addr.name = "changed_from_count";
28534#endif /* FREECIV_JSON_CONNECTION */
28535 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
28536 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
28537 }
28538#ifdef FREECIV_JSON_CONNECTION
28539 field_addr.name = "goto_tile";
28540#endif /* FREECIV_JSON_CONNECTION */
28541 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
28542 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
28543 }
28544#ifdef FREECIV_JSON_CONNECTION
28545 field_addr.name = "activity";
28546#endif /* FREECIV_JSON_CONNECTION */
28547 {
28548 int readin;
28549
28550 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28551 RECEIVE_PACKET_FIELD_ERROR(activity);
28552 }
28553 real_packet->activity = readin;
28554 }
28555#ifdef FREECIV_JSON_CONNECTION
28556 field_addr.name = "activity_tgt";
28557#endif /* FREECIV_JSON_CONNECTION */
28558 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
28559 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
28560 }
28561#ifdef FREECIV_JSON_CONNECTION
28562 field_addr.name = "changed_from";
28563#endif /* FREECIV_JSON_CONNECTION */
28564 {
28565 int readin;
28566
28567 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28568 RECEIVE_PACKET_FIELD_ERROR(changed_from);
28569 }
28570 real_packet->changed_from = readin;
28571 }
28572#ifdef FREECIV_JSON_CONNECTION
28573 field_addr.name = "changed_from_tgt";
28574#endif /* FREECIV_JSON_CONNECTION */
28575 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
28576 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
28577 }
28578#ifdef FREECIV_JSON_CONNECTION
28579 field_addr.name = "battlegroup";
28580#endif /* FREECIV_JSON_CONNECTION */
28581 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
28582 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
28583 }
28584#ifdef FREECIV_JSON_CONNECTION
28585 field_addr.name = "has_orders";
28586#endif /* FREECIV_JSON_CONNECTION */
28587 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->has_orders)) {
28588 RECEIVE_PACKET_FIELD_ERROR(has_orders);
28589 }
28590#ifdef FREECIV_JSON_CONNECTION
28591 field_addr.name = "orders_length";
28592#endif /* FREECIV_JSON_CONNECTION */
28593 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
28594 RECEIVE_PACKET_FIELD_ERROR(orders_length);
28595 }
28596#ifdef FREECIV_JSON_CONNECTION
28597 field_addr.name = "orders_index";
28598#endif /* FREECIV_JSON_CONNECTION */
28599 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
28600 RECEIVE_PACKET_FIELD_ERROR(orders_index);
28601 }
28602#ifdef FREECIV_JSON_CONNECTION
28603 field_addr.name = "orders_repeat";
28604#endif /* FREECIV_JSON_CONNECTION */
28605 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_repeat)) {
28606 RECEIVE_PACKET_FIELD_ERROR(orders_repeat);
28607 }
28608#ifdef FREECIV_JSON_CONNECTION
28609 field_addr.name = "orders_vigilant";
28610#endif /* FREECIV_JSON_CONNECTION */
28611 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_vigilant)) {
28612 RECEIVE_PACKET_FIELD_ERROR(orders_vigilant);
28613 }
28614#ifdef FREECIV_JSON_CONNECTION
28615 field_addr.name = "orders";
28616#endif /* FREECIV_JSON_CONNECTION */
28617 {
28618 int i;
28619
28620#ifdef FREECIV_JSON_CONNECTION
28621 /* Enter array. */
28622 field_addr.sub_location = plocation_elem_new(0);
28623#endif /* FREECIV_JSON_CONNECTION */
28624
28625 if (real_packet->orders_length > MAX_LEN_ROUTE) {
28626 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
28627 }
28628 for (i = 0; i < real_packet->orders_length; i++) {
28629#ifdef FREECIV_JSON_CONNECTION
28630 field_addr.sub_location->number = i;
28631#endif /* FREECIV_JSON_CONNECTION */
28632 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
28633 RECEIVE_PACKET_FIELD_ERROR(orders);
28634 }
28635 }
28636
28637#ifdef FREECIV_JSON_CONNECTION
28638 /* Exit array. */
28639 FC_FREE(field_addr.sub_location);
28640#endif /* FREECIV_JSON_CONNECTION */
28641 }
28642#ifdef FREECIV_JSON_CONNECTION
28643 field_addr.name = "action_decision_want";
28644#endif /* FREECIV_JSON_CONNECTION */
28645 {
28646 int readin;
28647
28648 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28649 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
28650 }
28651 real_packet->action_decision_want = readin;
28652 }
28653#ifdef FREECIV_JSON_CONNECTION
28654 field_addr.name = "action_decision_tile";
28655#endif /* FREECIV_JSON_CONNECTION */
28656 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
28657 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
28658 }
28659#endif
28660 log_packet_detailed("packet_unit_info_100: got info about (%d)",
28661 real_packet->id);
28662
28663#ifdef FREECIV_DELTA_PROTOCOL
28664 if (nullptr == *hash) {
28665 *hash = genhash_new_full(hash_packet_unit_info_100, cmp_packet_unit_info_100,
28666 nullptr, nullptr, nullptr, destroy_packet_unit_info);
28667 }
28668
28669 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
28670 *real_packet = *old;
28671 } else {
28672 /* packet is already initialized empty */
28673 log_packet_detailed(" no old info");
28674 }
28675
28676 if (BV_ISSET(fields, 0)) {
28677 log_packet_detailed(" got field 'owner'");
28678#ifdef FREECIV_JSON_CONNECTION
28679 field_addr.name = "owner";
28680#endif /* FREECIV_JSON_CONNECTION */
28681 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
28682 RECEIVE_PACKET_FIELD_ERROR(owner);
28683 }
28684 }
28685 if (BV_ISSET(fields, 1)) {
28686 log_packet_detailed(" got field 'nationality'");
28687#ifdef FREECIV_JSON_CONNECTION
28688 field_addr.name = "nationality";
28689#endif /* FREECIV_JSON_CONNECTION */
28690 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nationality)) {
28691 RECEIVE_PACKET_FIELD_ERROR(nationality);
28692 }
28693 }
28694 if (BV_ISSET(fields, 2)) {
28695 log_packet_detailed(" got field 'tile'");
28696#ifdef FREECIV_JSON_CONNECTION
28697 field_addr.name = "tile";
28698#endif /* FREECIV_JSON_CONNECTION */
28699 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
28700 RECEIVE_PACKET_FIELD_ERROR(tile);
28701 }
28702 }
28703 if (BV_ISSET(fields, 3)) {
28704 log_packet_detailed(" got field 'facing'");
28705#ifdef FREECIV_JSON_CONNECTION
28706 field_addr.name = "facing";
28707#endif /* FREECIV_JSON_CONNECTION */
28708 {
28709 int readin;
28710
28711 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
28712 RECEIVE_PACKET_FIELD_ERROR(facing);
28713 }
28714 real_packet->facing = readin;
28715 }
28716 }
28717 if (BV_ISSET(fields, 4)) {
28718 log_packet_detailed(" got field 'homecity'");
28719#ifdef FREECIV_JSON_CONNECTION
28720 field_addr.name = "homecity";
28721#endif /* FREECIV_JSON_CONNECTION */
28722 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
28723 RECEIVE_PACKET_FIELD_ERROR(homecity);
28724 }
28725 }
28726 if (BV_ISSET(fields, 5)) {
28727 log_packet_detailed(" got field 'upkeep'");
28728#ifdef FREECIV_JSON_CONNECTION
28729 field_addr.name = "upkeep";
28730#endif /* FREECIV_JSON_CONNECTION */
28731 {
28732 int i;
28733
28734#ifdef FREECIV_JSON_CONNECTION
28735 /* Enter array. */
28736 field_addr.sub_location = plocation_elem_new(0);
28737#endif /* FREECIV_JSON_CONNECTION */
28738
28739 for (i = 0; i < O_LAST; i++) {
28740#ifdef FREECIV_JSON_CONNECTION
28741 field_addr.sub_location->number = i;
28742#endif /* FREECIV_JSON_CONNECTION */
28743 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
28744 RECEIVE_PACKET_FIELD_ERROR(upkeep);
28745 }
28746 }
28747
28748#ifdef FREECIV_JSON_CONNECTION
28749 /* Exit array. */
28750 FC_FREE(field_addr.sub_location);
28751#endif /* FREECIV_JSON_CONNECTION */
28752 }
28753 }
28754 if (BV_ISSET(fields, 6)) {
28755 log_packet_detailed(" got field 'veteran'");
28756#ifdef FREECIV_JSON_CONNECTION
28757 field_addr.name = "veteran";
28758#endif /* FREECIV_JSON_CONNECTION */
28759 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
28760 RECEIVE_PACKET_FIELD_ERROR(veteran);
28761 }
28762 }
28763 if (BV_ISSET(fields, 7)) {
28764 log_packet_detailed(" got field 'ssa_controller'");
28765#ifdef FREECIV_JSON_CONNECTION
28766 field_addr.name = "ssa_controller";
28767#endif /* FREECIV_JSON_CONNECTION */
28768 {
28769 int readin;
28770
28771 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28772 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
28773 }
28774 real_packet->ssa_controller = readin;
28775 }
28776 }
28777 real_packet->paradropped = BV_ISSET(fields, 8);
28778 real_packet->occupied = BV_ISSET(fields, 9);
28779 real_packet->transported = BV_ISSET(fields, 10);
28780 real_packet->done_moving = BV_ISSET(fields, 11);
28781 real_packet->stay = BV_ISSET(fields, 12);
28782 if (BV_ISSET(fields, 13)) {
28783 log_packet_detailed(" got field 'birth_turn'");
28784#ifdef FREECIV_JSON_CONNECTION
28785 field_addr.name = "birth_turn";
28786#endif /* FREECIV_JSON_CONNECTION */
28787 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->birth_turn)) {
28788 RECEIVE_PACKET_FIELD_ERROR(birth_turn);
28789 }
28790 }
28791 if (BV_ISSET(fields, 14)) {
28792 log_packet_detailed(" got field 'current_form_turn'");
28793#ifdef FREECIV_JSON_CONNECTION
28794 field_addr.name = "current_form_turn";
28795#endif /* FREECIV_JSON_CONNECTION */
28796 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->current_form_turn)) {
28797 RECEIVE_PACKET_FIELD_ERROR(current_form_turn);
28798 }
28799 }
28800 if (BV_ISSET(fields, 15)) {
28801 log_packet_detailed(" got field 'type'");
28802#ifdef FREECIV_JSON_CONNECTION
28803 field_addr.name = "type";
28804#endif /* FREECIV_JSON_CONNECTION */
28805 {
28806 int readin;
28807
28808 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
28809 RECEIVE_PACKET_FIELD_ERROR(type);
28810 }
28811 real_packet->type = readin;
28812 }
28813 }
28814 if (BV_ISSET(fields, 16)) {
28815 log_packet_detailed(" got field 'transported_by'");
28816#ifdef FREECIV_JSON_CONNECTION
28817 field_addr.name = "transported_by";
28818#endif /* FREECIV_JSON_CONNECTION */
28819 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
28820 RECEIVE_PACKET_FIELD_ERROR(transported_by);
28821 }
28822 }
28823 if (BV_ISSET(fields, 17)) {
28824 log_packet_detailed(" got field 'carrying'");
28825#ifdef FREECIV_JSON_CONNECTION
28826 field_addr.name = "carrying";
28827#endif /* FREECIV_JSON_CONNECTION */
28828 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
28829 RECEIVE_PACKET_FIELD_ERROR(carrying);
28830 }
28831 }
28832 if (BV_ISSET(fields, 18)) {
28833 log_packet_detailed(" got field 'movesleft'");
28834#ifdef FREECIV_JSON_CONNECTION
28835 field_addr.name = "movesleft";
28836#endif /* FREECIV_JSON_CONNECTION */
28837 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
28838 RECEIVE_PACKET_FIELD_ERROR(movesleft);
28839 }
28840 }
28841 if (BV_ISSET(fields, 19)) {
28842 log_packet_detailed(" got field 'hp'");
28843#ifdef FREECIV_JSON_CONNECTION
28844 field_addr.name = "hp";
28845#endif /* FREECIV_JSON_CONNECTION */
28846 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
28847 RECEIVE_PACKET_FIELD_ERROR(hp);
28848 }
28849 }
28850 if (BV_ISSET(fields, 20)) {
28851 log_packet_detailed(" got field 'fuel'");
28852#ifdef FREECIV_JSON_CONNECTION
28853 field_addr.name = "fuel";
28854#endif /* FREECIV_JSON_CONNECTION */
28855 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
28856 RECEIVE_PACKET_FIELD_ERROR(fuel);
28857 }
28858 }
28859 if (BV_ISSET(fields, 21)) {
28860 log_packet_detailed(" got field 'activity_count'");
28861#ifdef FREECIV_JSON_CONNECTION
28862 field_addr.name = "activity_count";
28863#endif /* FREECIV_JSON_CONNECTION */
28864 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
28865 RECEIVE_PACKET_FIELD_ERROR(activity_count);
28866 }
28867 }
28868 if (BV_ISSET(fields, 22)) {
28869 log_packet_detailed(" got field 'changed_from_count'");
28870#ifdef FREECIV_JSON_CONNECTION
28871 field_addr.name = "changed_from_count";
28872#endif /* FREECIV_JSON_CONNECTION */
28873 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
28874 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
28875 }
28876 }
28877 if (BV_ISSET(fields, 23)) {
28878 log_packet_detailed(" got field 'goto_tile'");
28879#ifdef FREECIV_JSON_CONNECTION
28880 field_addr.name = "goto_tile";
28881#endif /* FREECIV_JSON_CONNECTION */
28882 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
28883 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
28884 }
28885 }
28886 if (BV_ISSET(fields, 24)) {
28887 log_packet_detailed(" got field 'activity'");
28888#ifdef FREECIV_JSON_CONNECTION
28889 field_addr.name = "activity";
28890#endif /* FREECIV_JSON_CONNECTION */
28891 {
28892 int readin;
28893
28894 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28895 RECEIVE_PACKET_FIELD_ERROR(activity);
28896 }
28897 real_packet->activity = readin;
28898 }
28899 }
28900 if (BV_ISSET(fields, 25)) {
28901 log_packet_detailed(" got field 'activity_tgt'");
28902#ifdef FREECIV_JSON_CONNECTION
28903 field_addr.name = "activity_tgt";
28904#endif /* FREECIV_JSON_CONNECTION */
28905 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
28906 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
28907 }
28908 }
28909 if (BV_ISSET(fields, 26)) {
28910 log_packet_detailed(" got field 'changed_from'");
28911#ifdef FREECIV_JSON_CONNECTION
28912 field_addr.name = "changed_from";
28913#endif /* FREECIV_JSON_CONNECTION */
28914 {
28915 int readin;
28916
28917 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28918 RECEIVE_PACKET_FIELD_ERROR(changed_from);
28919 }
28920 real_packet->changed_from = readin;
28921 }
28922 }
28923 if (BV_ISSET(fields, 27)) {
28924 log_packet_detailed(" got field 'changed_from_tgt'");
28925#ifdef FREECIV_JSON_CONNECTION
28926 field_addr.name = "changed_from_tgt";
28927#endif /* FREECIV_JSON_CONNECTION */
28928 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
28929 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
28930 }
28931 }
28932 if (BV_ISSET(fields, 28)) {
28933 log_packet_detailed(" got field 'battlegroup'");
28934#ifdef FREECIV_JSON_CONNECTION
28935 field_addr.name = "battlegroup";
28936#endif /* FREECIV_JSON_CONNECTION */
28937 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
28938 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
28939 }
28940 }
28941 real_packet->has_orders = BV_ISSET(fields, 29);
28942 if (BV_ISSET(fields, 30)) {
28943 log_packet_detailed(" got field 'orders_length'");
28944#ifdef FREECIV_JSON_CONNECTION
28945 field_addr.name = "orders_length";
28946#endif /* FREECIV_JSON_CONNECTION */
28947 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
28948 RECEIVE_PACKET_FIELD_ERROR(orders_length);
28949 }
28950 }
28951 if (BV_ISSET(fields, 31)) {
28952 log_packet_detailed(" got field 'orders_index'");
28953#ifdef FREECIV_JSON_CONNECTION
28954 field_addr.name = "orders_index";
28955#endif /* FREECIV_JSON_CONNECTION */
28956 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
28957 RECEIVE_PACKET_FIELD_ERROR(orders_index);
28958 }
28959 }
28960 real_packet->orders_repeat = BV_ISSET(fields, 32);
28961 real_packet->orders_vigilant = BV_ISSET(fields, 33);
28962 if (BV_ISSET(fields, 34)) {
28963 log_packet_detailed(" got field 'orders'");
28964#ifdef FREECIV_JSON_CONNECTION
28965 field_addr.name = "orders";
28966#endif /* FREECIV_JSON_CONNECTION */
28967 {
28968 int i;
28969
28970#ifdef FREECIV_JSON_CONNECTION
28971 /* Enter array. */
28972 field_addr.sub_location = plocation_elem_new(0);
28973#endif /* FREECIV_JSON_CONNECTION */
28974
28975 if (real_packet->orders_length > MAX_LEN_ROUTE) {
28976 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
28977 }
28978 for (i = 0; i < real_packet->orders_length; i++) {
28979#ifdef FREECIV_JSON_CONNECTION
28980 field_addr.sub_location->number = i;
28981#endif /* FREECIV_JSON_CONNECTION */
28982 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
28983 RECEIVE_PACKET_FIELD_ERROR(orders);
28984 }
28985 }
28986
28987#ifdef FREECIV_JSON_CONNECTION
28988 /* Exit array. */
28989 FC_FREE(field_addr.sub_location);
28990#endif /* FREECIV_JSON_CONNECTION */
28991 }
28992 }
28993 if (BV_ISSET(fields, 35)) {
28994 log_packet_detailed(" got field 'action_decision_want'");
28995#ifdef FREECIV_JSON_CONNECTION
28996 field_addr.name = "action_decision_want";
28997#endif /* FREECIV_JSON_CONNECTION */
28998 {
28999 int readin;
29000
29001 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
29002 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
29003 }
29004 real_packet->action_decision_want = readin;
29005 }
29006 }
29007 if (BV_ISSET(fields, 36)) {
29008 log_packet_detailed(" got field 'action_decision_tile'");
29009#ifdef FREECIV_JSON_CONNECTION
29010 field_addr.name = "action_decision_tile";
29011#endif /* FREECIV_JSON_CONNECTION */
29012 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
29013 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
29014 }
29015 }
29016
29017 if (nullptr == old) {
29018 old = fc_malloc(sizeof(*old));
29019 init_packet_unit_info(old);
29020 *old = *real_packet;
29021 genhash_insert(*hash, old, old);
29022 } else {
29023 *old = *real_packet;
29024 }
29025
29026 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
29027 if (nullptr != *hash) {
29028 genhash_remove(*hash, real_packet);
29029 }
29030
29031#endif /* FREECIV_DELTA_PROTOCOL */
29032 RECEIVE_PACKET_END(real_packet);
29033#undef FREE_PACKET_STRUCT
29034}
29035
29036 static int send_packet_unit_info_100(struct connection *pc, const struct packet_unit_info *packet)
29037{
29038 const struct packet_unit_info *real_packet = packet;
29039 int e;
29040#ifdef FREECIV_DELTA_PROTOCOL
29041 packet_unit_info_100_fields fields;
29042 struct packet_unit_info *old;
29043 bool differ;
29044 struct genhash **hash = pc->phs.sent + PACKET_UNIT_INFO;
29045 int different = 0;
29046#endif /* FREECIV_DELTA_PROTOCOL */
29047 SEND_PACKET_START(PACKET_UNIT_INFO);
29048#ifdef FREECIV_JSON_CONNECTION
29049 struct plocation field_addr;
29050 {
29051 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
29052 field_addr = *field_addr_tmp;
29053 FC_FREE(field_addr_tmp);
29054 }
29055#endif /* FREECIV_JSON_CONNECTION */
29056
29057 log_packet_detailed("packet_unit_info_100: sending info about (%d)",
29058 real_packet->id);
29059
29060#ifdef FREECIV_DELTA_PROTOCOL
29061 if (nullptr == *hash) {
29062 *hash = genhash_new_full(hash_packet_unit_info_100, cmp_packet_unit_info_100,
29063 nullptr, nullptr, nullptr, destroy_packet_unit_info);
29064 }
29065 BV_CLR_ALL(fields);
29066
29067 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29068 old = fc_malloc(sizeof(*old));
29069 /* temporary bitcopy just to insert correctly */
29070 *old = *real_packet;
29071 genhash_insert(*hash, old, old);
29072 init_packet_unit_info(old);
29073 different = 1; /* Force to send. */
29074 }
29075 differ = (old->owner != real_packet->owner);
29076 if (differ) {
29077 different++;
29078 BV_SET(fields, 0);
29079 }
29080
29081 differ = (old->nationality != real_packet->nationality);
29082 if (differ) {
29083 different++;
29084 BV_SET(fields, 1);
29085 }
29086
29087 differ = (old->tile != real_packet->tile);
29088 if (differ) {
29089 different++;
29090 BV_SET(fields, 2);
29091 }
29092
29093 differ = (old->facing != real_packet->facing);
29094 if (differ) {
29095 different++;
29096 BV_SET(fields, 3);
29097 }
29098
29099 differ = (old->homecity != real_packet->homecity);
29100 if (differ) {
29101 different++;
29102 BV_SET(fields, 4);
29103 }
29104
29105 differ = FALSE;
29106 {
29107 int i;
29108
29109 for (i = 0; i < O_LAST; i++) {
29110 differ = (old->upkeep[i] != real_packet->upkeep[i]);
29111 if (differ) {
29112 break;
29113 }
29114 }
29115 }
29116 if (differ) {
29117 different++;
29118 BV_SET(fields, 5);
29119 }
29120
29121 differ = (old->veteran != real_packet->veteran);
29122 if (differ) {
29123 different++;
29124 BV_SET(fields, 6);
29125 }
29126
29127 differ = (old->ssa_controller != real_packet->ssa_controller);
29128 if (differ) {
29129 different++;
29130 BV_SET(fields, 7);
29131 }
29132
29133 differ = (old->paradropped != real_packet->paradropped);
29134 if (differ) {
29135 different++;
29136 }
29137 if (packet->paradropped) {
29138 BV_SET(fields, 8);
29139 }
29140
29141 differ = (old->occupied != real_packet->occupied);
29142 if (differ) {
29143 different++;
29144 }
29145 if (packet->occupied) {
29146 BV_SET(fields, 9);
29147 }
29148
29149 differ = (old->transported != real_packet->transported);
29150 if (differ) {
29151 different++;
29152 }
29153 if (packet->transported) {
29154 BV_SET(fields, 10);
29155 }
29156
29157 differ = (old->done_moving != real_packet->done_moving);
29158 if (differ) {
29159 different++;
29160 }
29161 if (packet->done_moving) {
29162 BV_SET(fields, 11);
29163 }
29164
29165 differ = (old->stay != real_packet->stay);
29166 if (differ) {
29167 different++;
29168 }
29169 if (packet->stay) {
29170 BV_SET(fields, 12);
29171 }
29172
29173 differ = (old->birth_turn != real_packet->birth_turn);
29174 if (differ) {
29175 different++;
29176 BV_SET(fields, 13);
29177 }
29178
29179 differ = (old->current_form_turn != real_packet->current_form_turn);
29180 if (differ) {
29181 different++;
29182 BV_SET(fields, 14);
29183 }
29184
29185 differ = (old->type != real_packet->type);
29186 if (differ) {
29187 different++;
29188 BV_SET(fields, 15);
29189 }
29190
29191 differ = (old->transported_by != real_packet->transported_by);
29192 if (differ) {
29193 different++;
29194 BV_SET(fields, 16);
29195 }
29196
29197 differ = (old->carrying != real_packet->carrying);
29198 if (differ) {
29199 different++;
29200 BV_SET(fields, 17);
29201 }
29202
29203 differ = (old->movesleft != real_packet->movesleft);
29204 if (differ) {
29205 different++;
29206 BV_SET(fields, 18);
29207 }
29208
29209 differ = (old->hp != real_packet->hp);
29210 if (differ) {
29211 different++;
29212 BV_SET(fields, 19);
29213 }
29214
29215 differ = (old->fuel != real_packet->fuel);
29216 if (differ) {
29217 different++;
29218 BV_SET(fields, 20);
29219 }
29220
29221 differ = (old->activity_count != real_packet->activity_count);
29222 if (differ) {
29223 different++;
29224 BV_SET(fields, 21);
29225 }
29226
29227 differ = (old->changed_from_count != real_packet->changed_from_count);
29228 if (differ) {
29229 different++;
29230 BV_SET(fields, 22);
29231 }
29232
29233 differ = (old->goto_tile != real_packet->goto_tile);
29234 if (differ) {
29235 different++;
29236 BV_SET(fields, 23);
29237 }
29238
29239 differ = (old->activity != real_packet->activity);
29240 if (differ) {
29241 different++;
29242 BV_SET(fields, 24);
29243 }
29244
29245 differ = (old->activity_tgt != real_packet->activity_tgt);
29246 if (differ) {
29247 different++;
29248 BV_SET(fields, 25);
29249 }
29250
29251 differ = (old->changed_from != real_packet->changed_from);
29252 if (differ) {
29253 different++;
29254 BV_SET(fields, 26);
29255 }
29256
29257 differ = (old->changed_from_tgt != real_packet->changed_from_tgt);
29258 if (differ) {
29259 different++;
29260 BV_SET(fields, 27);
29261 }
29262
29263 differ = (old->battlegroup != real_packet->battlegroup);
29264 if (differ) {
29265 different++;
29266 BV_SET(fields, 28);
29267 }
29268
29269 differ = (old->has_orders != real_packet->has_orders);
29270 if (differ) {
29271 different++;
29272 }
29273 if (packet->has_orders) {
29274 BV_SET(fields, 29);
29275 }
29276
29277 differ = (old->orders_length != real_packet->orders_length);
29278 if (differ) {
29279 different++;
29280 BV_SET(fields, 30);
29281 }
29282
29283 differ = (old->orders_index != real_packet->orders_index);
29284 if (differ) {
29285 different++;
29286 BV_SET(fields, 31);
29287 }
29288
29289 differ = (old->orders_repeat != real_packet->orders_repeat);
29290 if (differ) {
29291 different++;
29292 }
29293 if (packet->orders_repeat) {
29294 BV_SET(fields, 32);
29295 }
29296
29297 differ = (old->orders_vigilant != real_packet->orders_vigilant);
29298 if (differ) {
29299 different++;
29300 }
29301 if (packet->orders_vigilant) {
29302 BV_SET(fields, 33);
29303 }
29304
29305 differ = (old->orders_length != real_packet->orders_length);
29306 if (!differ) {
29307 int i;
29308
29309 for (i = 0; i < real_packet->orders_length; i++) {
29310 differ = !are_unit_orders_equal(&old->orders[i], &real_packet->orders[i]);
29311 if (differ) {
29312 break;
29313 }
29314 }
29315 }
29316 if (differ) {
29317 different++;
29318 BV_SET(fields, 34);
29319 }
29320
29321 differ = (old->action_decision_want != real_packet->action_decision_want);
29322 if (differ) {
29323 different++;
29324 BV_SET(fields, 35);
29325 }
29326
29327 differ = (old->action_decision_tile != real_packet->action_decision_tile);
29328 if (differ) {
29329 different++;
29330 BV_SET(fields, 36);
29331 }
29332
29333 if (different == 0) {
29334 log_packet_detailed(" no change -> discard");
29335 return 0;
29336 }
29337
29338#ifdef FREECIV_JSON_CONNECTION
29339 field_addr.name = "fields";
29340#endif /* FREECIV_JSON_CONNECTION */
29341 e = 0;
29342 e |= DIO_BV_PUT(&dout, &field_addr, fields);
29343 if (e) {
29344 log_packet_detailed("fields bitvector error detected");
29345 }
29346#ifdef FREECIV_JSON_CONNECTION
29347 field_addr.name = "id";
29348#endif /* FREECIV_JSON_CONNECTION */
29349 e = 0;
29350 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
29351 if (e) {
29352 log_packet_detailed("'id' field error detected");
29353 }
29354
29355 if (BV_ISSET(fields, 0)) {
29356 log_packet_detailed(" field 'owner' has changed");
29357#ifdef FREECIV_JSON_CONNECTION
29358 field_addr.name = "owner";
29359#endif /* FREECIV_JSON_CONNECTION */
29360 e = 0;
29361 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
29362 if (e) {
29363 log_packet_detailed("'owner' field error detected");
29364 }
29365 }
29366 if (BV_ISSET(fields, 1)) {
29367 log_packet_detailed(" field 'nationality' has changed");
29368#ifdef FREECIV_JSON_CONNECTION
29369 field_addr.name = "nationality";
29370#endif /* FREECIV_JSON_CONNECTION */
29371 e = 0;
29372 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nationality);
29373 if (e) {
29374 log_packet_detailed("'nationality' field error detected");
29375 }
29376 }
29377 if (BV_ISSET(fields, 2)) {
29378 log_packet_detailed(" field 'tile' has changed");
29379#ifdef FREECIV_JSON_CONNECTION
29380 field_addr.name = "tile";
29381#endif /* FREECIV_JSON_CONNECTION */
29382 e = 0;
29383 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
29384 if (e) {
29385 log_packet_detailed("'tile' field error detected");
29386 }
29387 }
29388 if (BV_ISSET(fields, 3)) {
29389 log_packet_detailed(" field 'facing' has changed");
29390#ifdef FREECIV_JSON_CONNECTION
29391 field_addr.name = "facing";
29392#endif /* FREECIV_JSON_CONNECTION */
29393 e = 0;
29394 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
29395 if (e) {
29396 log_packet_detailed("'facing' field error detected");
29397 }
29398 }
29399 if (BV_ISSET(fields, 4)) {
29400 log_packet_detailed(" field 'homecity' has changed");
29401#ifdef FREECIV_JSON_CONNECTION
29402 field_addr.name = "homecity";
29403#endif /* FREECIV_JSON_CONNECTION */
29404 e = 0;
29405 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
29406 if (e) {
29407 log_packet_detailed("'homecity' field error detected");
29408 }
29409 }
29410 if (BV_ISSET(fields, 5)) {
29411 log_packet_detailed(" field 'upkeep' has changed");
29412#ifdef FREECIV_JSON_CONNECTION
29413 field_addr.name = "upkeep";
29414#endif /* FREECIV_JSON_CONNECTION */
29415 e = 0;
29416 {
29417 int i;
29418
29419#ifdef FREECIV_JSON_CONNECTION
29420 /* Create the array. */
29421 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
29422
29423 /* Enter the array. */
29424 field_addr.sub_location = plocation_elem_new(0);
29425#endif /* FREECIV_JSON_CONNECTION */
29426
29427 for (i = 0; i < O_LAST; i++) {
29428#ifdef FREECIV_JSON_CONNECTION
29429 /* Next array element. */
29430 field_addr.sub_location->number = i;
29431#endif /* FREECIV_JSON_CONNECTION */
29432 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
29433 }
29434
29435#ifdef FREECIV_JSON_CONNECTION
29436 /* Exit array. */
29437 FC_FREE(field_addr.sub_location);
29438#endif /* FREECIV_JSON_CONNECTION */
29439 }
29440 if (e) {
29441 log_packet_detailed("'upkeep' field error detected");
29442 }
29443 }
29444 if (BV_ISSET(fields, 6)) {
29445 log_packet_detailed(" field 'veteran' has changed");
29446#ifdef FREECIV_JSON_CONNECTION
29447 field_addr.name = "veteran";
29448#endif /* FREECIV_JSON_CONNECTION */
29449 e = 0;
29450 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
29451 if (e) {
29452 log_packet_detailed("'veteran' field error detected");
29453 }
29454 }
29455 if (BV_ISSET(fields, 7)) {
29456 log_packet_detailed(" field 'ssa_controller' has changed");
29457#ifdef FREECIV_JSON_CONNECTION
29458 field_addr.name = "ssa_controller";
29459#endif /* FREECIV_JSON_CONNECTION */
29460 e = 0;
29461 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
29462 if (e) {
29463 log_packet_detailed("'ssa_controller' field error detected");
29464 }
29465 }
29466 /* field 8 is folded into the header */
29467 /* field 9 is folded into the header */
29468 /* field 10 is folded into the header */
29469 /* field 11 is folded into the header */
29470 /* field 12 is folded into the header */
29471 if (BV_ISSET(fields, 13)) {
29472 log_packet_detailed(" field 'birth_turn' has changed");
29473#ifdef FREECIV_JSON_CONNECTION
29474 field_addr.name = "birth_turn";
29475#endif /* FREECIV_JSON_CONNECTION */
29476 e = 0;
29477 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->birth_turn);
29478 if (e) {
29479 log_packet_detailed("'birth_turn' field error detected");
29480 }
29481 }
29482 if (BV_ISSET(fields, 14)) {
29483 log_packet_detailed(" field 'current_form_turn' has changed");
29484#ifdef FREECIV_JSON_CONNECTION
29485 field_addr.name = "current_form_turn";
29486#endif /* FREECIV_JSON_CONNECTION */
29487 e = 0;
29488 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->current_form_turn);
29489 if (e) {
29490 log_packet_detailed("'current_form_turn' field error detected");
29491 }
29492 }
29493 if (BV_ISSET(fields, 15)) {
29494 log_packet_detailed(" field 'type' has changed");
29495#ifdef FREECIV_JSON_CONNECTION
29496 field_addr.name = "type";
29497#endif /* FREECIV_JSON_CONNECTION */
29498 e = 0;
29499 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
29500 if (e) {
29501 log_packet_detailed("'type' field error detected");
29502 }
29503 }
29504 if (BV_ISSET(fields, 16)) {
29505 log_packet_detailed(" field 'transported_by' has changed");
29506#ifdef FREECIV_JSON_CONNECTION
29507 field_addr.name = "transported_by";
29508#endif /* FREECIV_JSON_CONNECTION */
29509 e = 0;
29510 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
29511 if (e) {
29512 log_packet_detailed("'transported_by' field error detected");
29513 }
29514 }
29515 if (BV_ISSET(fields, 17)) {
29516 log_packet_detailed(" field 'carrying' has changed");
29517#ifdef FREECIV_JSON_CONNECTION
29518 field_addr.name = "carrying";
29519#endif /* FREECIV_JSON_CONNECTION */
29520 e = 0;
29521 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
29522 if (e) {
29523 log_packet_detailed("'carrying' field error detected");
29524 }
29525 }
29526 if (BV_ISSET(fields, 18)) {
29527 log_packet_detailed(" field 'movesleft' has changed");
29528#ifdef FREECIV_JSON_CONNECTION
29529 field_addr.name = "movesleft";
29530#endif /* FREECIV_JSON_CONNECTION */
29531 e = 0;
29532 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
29533 if (e) {
29534 log_packet_detailed("'movesleft' field error detected");
29535 }
29536 }
29537 if (BV_ISSET(fields, 19)) {
29538 log_packet_detailed(" field 'hp' has changed");
29539#ifdef FREECIV_JSON_CONNECTION
29540 field_addr.name = "hp";
29541#endif /* FREECIV_JSON_CONNECTION */
29542 e = 0;
29543 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
29544 if (e) {
29545 log_packet_detailed("'hp' field error detected");
29546 }
29547 }
29548 if (BV_ISSET(fields, 20)) {
29549 log_packet_detailed(" field 'fuel' has changed");
29550#ifdef FREECIV_JSON_CONNECTION
29551 field_addr.name = "fuel";
29552#endif /* FREECIV_JSON_CONNECTION */
29553 e = 0;
29554 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
29555 if (e) {
29556 log_packet_detailed("'fuel' field error detected");
29557 }
29558 }
29559 if (BV_ISSET(fields, 21)) {
29560 log_packet_detailed(" field 'activity_count' has changed");
29561#ifdef FREECIV_JSON_CONNECTION
29562 field_addr.name = "activity_count";
29563#endif /* FREECIV_JSON_CONNECTION */
29564 e = 0;
29565 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
29566 if (e) {
29567 log_packet_detailed("'activity_count' field error detected");
29568 }
29569 }
29570 if (BV_ISSET(fields, 22)) {
29571 log_packet_detailed(" field 'changed_from_count' has changed");
29572#ifdef FREECIV_JSON_CONNECTION
29573 field_addr.name = "changed_from_count";
29574#endif /* FREECIV_JSON_CONNECTION */
29575 e = 0;
29576 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
29577 if (e) {
29578 log_packet_detailed("'changed_from_count' field error detected");
29579 }
29580 }
29581 if (BV_ISSET(fields, 23)) {
29582 log_packet_detailed(" field 'goto_tile' has changed");
29583#ifdef FREECIV_JSON_CONNECTION
29584 field_addr.name = "goto_tile";
29585#endif /* FREECIV_JSON_CONNECTION */
29586 e = 0;
29587 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
29588 if (e) {
29589 log_packet_detailed("'goto_tile' field error detected");
29590 }
29591 }
29592 if (BV_ISSET(fields, 24)) {
29593 log_packet_detailed(" field 'activity' has changed");
29594#ifdef FREECIV_JSON_CONNECTION
29595 field_addr.name = "activity";
29596#endif /* FREECIV_JSON_CONNECTION */
29597 e = 0;
29598 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
29599 if (e) {
29600 log_packet_detailed("'activity' field error detected");
29601 }
29602 }
29603 if (BV_ISSET(fields, 25)) {
29604 log_packet_detailed(" field 'activity_tgt' has changed");
29605#ifdef FREECIV_JSON_CONNECTION
29606 field_addr.name = "activity_tgt";
29607#endif /* FREECIV_JSON_CONNECTION */
29608 e = 0;
29609 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
29610 if (e) {
29611 log_packet_detailed("'activity_tgt' field error detected");
29612 }
29613 }
29614 if (BV_ISSET(fields, 26)) {
29615 log_packet_detailed(" field 'changed_from' has changed");
29616#ifdef FREECIV_JSON_CONNECTION
29617 field_addr.name = "changed_from";
29618#endif /* FREECIV_JSON_CONNECTION */
29619 e = 0;
29620 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
29621 if (e) {
29622 log_packet_detailed("'changed_from' field error detected");
29623 }
29624 }
29625 if (BV_ISSET(fields, 27)) {
29626 log_packet_detailed(" field 'changed_from_tgt' has changed");
29627#ifdef FREECIV_JSON_CONNECTION
29628 field_addr.name = "changed_from_tgt";
29629#endif /* FREECIV_JSON_CONNECTION */
29630 e = 0;
29631 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
29632 if (e) {
29633 log_packet_detailed("'changed_from_tgt' field error detected");
29634 }
29635 }
29636 if (BV_ISSET(fields, 28)) {
29637 log_packet_detailed(" field 'battlegroup' has changed");
29638#ifdef FREECIV_JSON_CONNECTION
29639 field_addr.name = "battlegroup";
29640#endif /* FREECIV_JSON_CONNECTION */
29641 e = 0;
29642 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
29643 if (e) {
29644 log_packet_detailed("'battlegroup' field error detected");
29645 }
29646 }
29647 /* field 29 is folded into the header */
29648 if (BV_ISSET(fields, 30)) {
29649 log_packet_detailed(" field 'orders_length' has changed");
29650#ifdef FREECIV_JSON_CONNECTION
29651 field_addr.name = "orders_length";
29652#endif /* FREECIV_JSON_CONNECTION */
29653 e = 0;
29654 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
29655 if (e) {
29656 log_packet_detailed("'orders_length' field error detected");
29657 }
29658 }
29659 if (BV_ISSET(fields, 31)) {
29660 log_packet_detailed(" field 'orders_index' has changed");
29661#ifdef FREECIV_JSON_CONNECTION
29662 field_addr.name = "orders_index";
29663#endif /* FREECIV_JSON_CONNECTION */
29664 e = 0;
29665 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
29666 if (e) {
29667 log_packet_detailed("'orders_index' field error detected");
29668 }
29669 }
29670 /* field 32 is folded into the header */
29671 /* field 33 is folded into the header */
29672 if (BV_ISSET(fields, 34)) {
29673 log_packet_detailed(" field 'orders' has changed");
29674#ifdef FREECIV_JSON_CONNECTION
29675 field_addr.name = "orders";
29676#endif /* FREECIV_JSON_CONNECTION */
29677 e = 0;
29678 {
29679 int i;
29680
29681#ifdef FREECIV_JSON_CONNECTION
29682 /* Create the array. */
29683 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
29684
29685 /* Enter the array. */
29686 field_addr.sub_location = plocation_elem_new(0);
29687#endif /* FREECIV_JSON_CONNECTION */
29688
29689 for (i = 0; i < real_packet->orders_length; i++) {
29690#ifdef FREECIV_JSON_CONNECTION
29691 /* Next array element. */
29692 field_addr.sub_location->number = i;
29693#endif /* FREECIV_JSON_CONNECTION */
29694 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
29695 }
29696
29697#ifdef FREECIV_JSON_CONNECTION
29698 /* Exit array. */
29699 FC_FREE(field_addr.sub_location);
29700#endif /* FREECIV_JSON_CONNECTION */
29701 }
29702 if (e) {
29703 log_packet_detailed("'orders' field error detected");
29704 }
29705 }
29706 if (BV_ISSET(fields, 35)) {
29707 log_packet_detailed(" field 'action_decision_want' has changed");
29708#ifdef FREECIV_JSON_CONNECTION
29709 field_addr.name = "action_decision_want";
29710#endif /* FREECIV_JSON_CONNECTION */
29711 e = 0;
29712 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
29713 if (e) {
29714 log_packet_detailed("'action_decision_want' field error detected");
29715 }
29716 }
29717 if (BV_ISSET(fields, 36)) {
29718 log_packet_detailed(" field 'action_decision_tile' has changed");
29719#ifdef FREECIV_JSON_CONNECTION
29720 field_addr.name = "action_decision_tile";
29721#endif /* FREECIV_JSON_CONNECTION */
29722 e = 0;
29723 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
29724 if (e) {
29725 log_packet_detailed("'action_decision_tile' field error detected");
29726 }
29727 }
29728
29729 *old = *real_packet;
29730
29731 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
29732 if (nullptr != *hash) {
29733 genhash_remove(*hash, real_packet);
29734 }
29735#endif /* FREECIV_DELTA_PROTOCOL */
29736#ifndef FREECIV_DELTA_PROTOCOL
29737#ifdef FREECIV_JSON_CONNECTION
29738 field_addr.name = "id";
29739#endif /* FREECIV_JSON_CONNECTION */
29740 e = 0;
29741 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
29742 if (e) {
29743 log_packet_detailed("'id' field error detected");
29744 }
29745#ifdef FREECIV_JSON_CONNECTION
29746 field_addr.name = "owner";
29747#endif /* FREECIV_JSON_CONNECTION */
29748 e = 0;
29749 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
29750 if (e) {
29751 log_packet_detailed("'owner' field error detected");
29752 }
29753#ifdef FREECIV_JSON_CONNECTION
29754 field_addr.name = "nationality";
29755#endif /* FREECIV_JSON_CONNECTION */
29756 e = 0;
29757 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nationality);
29758 if (e) {
29759 log_packet_detailed("'nationality' field error detected");
29760 }
29761#ifdef FREECIV_JSON_CONNECTION
29762 field_addr.name = "tile";
29763#endif /* FREECIV_JSON_CONNECTION */
29764 e = 0;
29765 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
29766 if (e) {
29767 log_packet_detailed("'tile' field error detected");
29768 }
29769#ifdef FREECIV_JSON_CONNECTION
29770 field_addr.name = "facing";
29771#endif /* FREECIV_JSON_CONNECTION */
29772 e = 0;
29773 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
29774 if (e) {
29775 log_packet_detailed("'facing' field error detected");
29776 }
29777#ifdef FREECIV_JSON_CONNECTION
29778 field_addr.name = "homecity";
29779#endif /* FREECIV_JSON_CONNECTION */
29780 e = 0;
29781 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
29782 if (e) {
29783 log_packet_detailed("'homecity' field error detected");
29784 }
29785#ifdef FREECIV_JSON_CONNECTION
29786 field_addr.name = "upkeep";
29787#endif /* FREECIV_JSON_CONNECTION */
29788 e = 0;
29789 {
29790 int i;
29791
29792#ifdef FREECIV_JSON_CONNECTION
29793 /* Create the array. */
29794 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
29795
29796 /* Enter the array. */
29797 field_addr.sub_location = plocation_elem_new(0);
29798#endif /* FREECIV_JSON_CONNECTION */
29799
29800 for (i = 0; i < O_LAST; i++) {
29801#ifdef FREECIV_JSON_CONNECTION
29802 /* Next array element. */
29803 field_addr.sub_location->number = i;
29804#endif /* FREECIV_JSON_CONNECTION */
29805 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
29806 }
29807
29808#ifdef FREECIV_JSON_CONNECTION
29809 /* Exit array. */
29810 FC_FREE(field_addr.sub_location);
29811#endif /* FREECIV_JSON_CONNECTION */
29812 }
29813 if (e) {
29814 log_packet_detailed("'upkeep' field error detected");
29815 }
29816#ifdef FREECIV_JSON_CONNECTION
29817 field_addr.name = "veteran";
29818#endif /* FREECIV_JSON_CONNECTION */
29819 e = 0;
29820 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
29821 if (e) {
29822 log_packet_detailed("'veteran' field error detected");
29823 }
29824#ifdef FREECIV_JSON_CONNECTION
29825 field_addr.name = "ssa_controller";
29826#endif /* FREECIV_JSON_CONNECTION */
29827 e = 0;
29828 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
29829 if (e) {
29830 log_packet_detailed("'ssa_controller' field error detected");
29831 }
29832#ifdef FREECIV_JSON_CONNECTION
29833 field_addr.name = "paradropped";
29834#endif /* FREECIV_JSON_CONNECTION */
29835 e = 0;
29836 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
29837 if (e) {
29838 log_packet_detailed("'paradropped' field error detected");
29839 }
29840#ifdef FREECIV_JSON_CONNECTION
29841 field_addr.name = "occupied";
29842#endif /* FREECIV_JSON_CONNECTION */
29843 e = 0;
29844 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
29845 if (e) {
29846 log_packet_detailed("'occupied' field error detected");
29847 }
29848#ifdef FREECIV_JSON_CONNECTION
29849 field_addr.name = "transported";
29850#endif /* FREECIV_JSON_CONNECTION */
29851 e = 0;
29852 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
29853 if (e) {
29854 log_packet_detailed("'transported' field error detected");
29855 }
29856#ifdef FREECIV_JSON_CONNECTION
29857 field_addr.name = "done_moving";
29858#endif /* FREECIV_JSON_CONNECTION */
29859 e = 0;
29860 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
29861 if (e) {
29862 log_packet_detailed("'done_moving' field error detected");
29863 }
29864#ifdef FREECIV_JSON_CONNECTION
29865 field_addr.name = "stay";
29866#endif /* FREECIV_JSON_CONNECTION */
29867 e = 0;
29868 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
29869 if (e) {
29870 log_packet_detailed("'stay' field error detected");
29871 }
29872#ifdef FREECIV_JSON_CONNECTION
29873 field_addr.name = "birth_turn";
29874#endif /* FREECIV_JSON_CONNECTION */
29875 e = 0;
29876 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->birth_turn);
29877 if (e) {
29878 log_packet_detailed("'birth_turn' field error detected");
29879 }
29880#ifdef FREECIV_JSON_CONNECTION
29881 field_addr.name = "current_form_turn";
29882#endif /* FREECIV_JSON_CONNECTION */
29883 e = 0;
29884 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->current_form_turn);
29885 if (e) {
29886 log_packet_detailed("'current_form_turn' field error detected");
29887 }
29888#ifdef FREECIV_JSON_CONNECTION
29889 field_addr.name = "type";
29890#endif /* FREECIV_JSON_CONNECTION */
29891 e = 0;
29892 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
29893 if (e) {
29894 log_packet_detailed("'type' field error detected");
29895 }
29896#ifdef FREECIV_JSON_CONNECTION
29897 field_addr.name = "transported_by";
29898#endif /* FREECIV_JSON_CONNECTION */
29899 e = 0;
29900 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
29901 if (e) {
29902 log_packet_detailed("'transported_by' field error detected");
29903 }
29904#ifdef FREECIV_JSON_CONNECTION
29905 field_addr.name = "carrying";
29906#endif /* FREECIV_JSON_CONNECTION */
29907 e = 0;
29908 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
29909 if (e) {
29910 log_packet_detailed("'carrying' field error detected");
29911 }
29912#ifdef FREECIV_JSON_CONNECTION
29913 field_addr.name = "movesleft";
29914#endif /* FREECIV_JSON_CONNECTION */
29915 e = 0;
29916 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
29917 if (e) {
29918 log_packet_detailed("'movesleft' field error detected");
29919 }
29920#ifdef FREECIV_JSON_CONNECTION
29921 field_addr.name = "hp";
29922#endif /* FREECIV_JSON_CONNECTION */
29923 e = 0;
29924 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
29925 if (e) {
29926 log_packet_detailed("'hp' field error detected");
29927 }
29928#ifdef FREECIV_JSON_CONNECTION
29929 field_addr.name = "fuel";
29930#endif /* FREECIV_JSON_CONNECTION */
29931 e = 0;
29932 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
29933 if (e) {
29934 log_packet_detailed("'fuel' field error detected");
29935 }
29936#ifdef FREECIV_JSON_CONNECTION
29937 field_addr.name = "activity_count";
29938#endif /* FREECIV_JSON_CONNECTION */
29939 e = 0;
29940 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
29941 if (e) {
29942 log_packet_detailed("'activity_count' field error detected");
29943 }
29944#ifdef FREECIV_JSON_CONNECTION
29945 field_addr.name = "changed_from_count";
29946#endif /* FREECIV_JSON_CONNECTION */
29947 e = 0;
29948 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
29949 if (e) {
29950 log_packet_detailed("'changed_from_count' field error detected");
29951 }
29952#ifdef FREECIV_JSON_CONNECTION
29953 field_addr.name = "goto_tile";
29954#endif /* FREECIV_JSON_CONNECTION */
29955 e = 0;
29956 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
29957 if (e) {
29958 log_packet_detailed("'goto_tile' field error detected");
29959 }
29960#ifdef FREECIV_JSON_CONNECTION
29961 field_addr.name = "activity";
29962#endif /* FREECIV_JSON_CONNECTION */
29963 e = 0;
29964 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
29965 if (e) {
29966 log_packet_detailed("'activity' field error detected");
29967 }
29968#ifdef FREECIV_JSON_CONNECTION
29969 field_addr.name = "activity_tgt";
29970#endif /* FREECIV_JSON_CONNECTION */
29971 e = 0;
29972 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
29973 if (e) {
29974 log_packet_detailed("'activity_tgt' field error detected");
29975 }
29976#ifdef FREECIV_JSON_CONNECTION
29977 field_addr.name = "changed_from";
29978#endif /* FREECIV_JSON_CONNECTION */
29979 e = 0;
29980 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
29981 if (e) {
29982 log_packet_detailed("'changed_from' field error detected");
29983 }
29984#ifdef FREECIV_JSON_CONNECTION
29985 field_addr.name = "changed_from_tgt";
29986#endif /* FREECIV_JSON_CONNECTION */
29987 e = 0;
29988 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
29989 if (e) {
29990 log_packet_detailed("'changed_from_tgt' field error detected");
29991 }
29992#ifdef FREECIV_JSON_CONNECTION
29993 field_addr.name = "battlegroup";
29994#endif /* FREECIV_JSON_CONNECTION */
29995 e = 0;
29996 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
29997 if (e) {
29998 log_packet_detailed("'battlegroup' field error detected");
29999 }
30000#ifdef FREECIV_JSON_CONNECTION
30001 field_addr.name = "has_orders";
30002#endif /* FREECIV_JSON_CONNECTION */
30003 e = 0;
30004 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->has_orders);
30005 if (e) {
30006 log_packet_detailed("'has_orders' field error detected");
30007 }
30008#ifdef FREECIV_JSON_CONNECTION
30009 field_addr.name = "orders_length";
30010#endif /* FREECIV_JSON_CONNECTION */
30011 e = 0;
30012 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
30013 if (e) {
30014 log_packet_detailed("'orders_length' field error detected");
30015 }
30016#ifdef FREECIV_JSON_CONNECTION
30017 field_addr.name = "orders_index";
30018#endif /* FREECIV_JSON_CONNECTION */
30019 e = 0;
30020 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
30021 if (e) {
30022 log_packet_detailed("'orders_index' field error detected");
30023 }
30024#ifdef FREECIV_JSON_CONNECTION
30025 field_addr.name = "orders_repeat";
30026#endif /* FREECIV_JSON_CONNECTION */
30027 e = 0;
30028 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_repeat);
30029 if (e) {
30030 log_packet_detailed("'orders_repeat' field error detected");
30031 }
30032#ifdef FREECIV_JSON_CONNECTION
30033 field_addr.name = "orders_vigilant";
30034#endif /* FREECIV_JSON_CONNECTION */
30035 e = 0;
30036 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_vigilant);
30037 if (e) {
30038 log_packet_detailed("'orders_vigilant' field error detected");
30039 }
30040#ifdef FREECIV_JSON_CONNECTION
30041 field_addr.name = "orders";
30042#endif /* FREECIV_JSON_CONNECTION */
30043 e = 0;
30044 {
30045 int i;
30046
30047#ifdef FREECIV_JSON_CONNECTION
30048 /* Create the array. */
30049 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
30050
30051 /* Enter the array. */
30052 field_addr.sub_location = plocation_elem_new(0);
30053#endif /* FREECIV_JSON_CONNECTION */
30054
30055 for (i = 0; i < real_packet->orders_length; i++) {
30056#ifdef FREECIV_JSON_CONNECTION
30057 /* Next array element. */
30058 field_addr.sub_location->number = i;
30059#endif /* FREECIV_JSON_CONNECTION */
30060 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
30061 }
30062
30063#ifdef FREECIV_JSON_CONNECTION
30064 /* Exit array. */
30065 FC_FREE(field_addr.sub_location);
30066#endif /* FREECIV_JSON_CONNECTION */
30067 }
30068 if (e) {
30069 log_packet_detailed("'orders' field error detected");
30070 }
30071#ifdef FREECIV_JSON_CONNECTION
30072 field_addr.name = "action_decision_want";
30073#endif /* FREECIV_JSON_CONNECTION */
30074 e = 0;
30075 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
30076 if (e) {
30077 log_packet_detailed("'action_decision_want' field error detected");
30078 }
30079#ifdef FREECIV_JSON_CONNECTION
30080 field_addr.name = "action_decision_tile";
30081#endif /* FREECIV_JSON_CONNECTION */
30082 e = 0;
30083 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
30084 if (e) {
30085 log_packet_detailed("'action_decision_tile' field error detected");
30086 }
30087
30088#endif
30089 SEND_PACKET_END(PACKET_UNIT_INFO);
30090}
30091
30092 int send_packet_unit_info(struct connection *pc, const struct packet_unit_info *packet)
30093{
30094 if (!pc->used) {
30095 log_error("WARNING: trying to send data to the closed connection %s",
30096 conn_description(pc));
30097 return -1;
30098 }
30099 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_INFO].packet != nullptr, -1,
30100 "Handler for PACKET_UNIT_INFO not installed");
30101 return pc->phs.handlers->send[PACKET_UNIT_INFO].packet(pc, packet);
30102}
30103
30104 void lsend_packet_unit_info(struct conn_list *dest, const struct packet_unit_info *packet)
30105{
30106 conn_list_iterate(dest, pconn) {
30107 send_packet_unit_info(pconn, packet);
30108 } conn_list_iterate_end;
30109}
30110
30111 static inline void init_packet_unit_short_info(struct packet_unit_short_info *packet)
30112{
30113 memset(packet, 0, sizeof(*packet));
30114}
30115
30116#define free_packet_unit_short_info(_packet) (void) 0
30117#define destroy_packet_unit_short_info free
30118
30119#ifdef FREECIV_DELTA_PROTOCOL
30120static genhash_val_t hash_packet_unit_short_info_100(const void *vkey)
30121{
30122 const struct packet_unit_short_info *key = (const struct packet_unit_short_info *) vkey;
30123 genhash_val_t result = 0;
30124
30125 result += key->id;
30126
30127 result &= 0xFFFFFFFF;
30128 return result;
30129}
30130
30131static bool cmp_packet_unit_short_info_100(const void *vkey1, const void *vkey2)
30132{
30133 const struct packet_unit_short_info *old = (const struct packet_unit_short_info *) vkey1;
30134 const struct packet_unit_short_info *real_packet = (const struct packet_unit_short_info *) vkey2;
30135 bool differ;
30136
30137 differ = (old->id != real_packet->id);
30138
30139 return !differ;
30140}
30141 BV_DEFINE(packet_unit_short_info_100_fields, 13);
30142#endif /* FREECIV_DELTA_PROTOCOL */
30143
30144 static struct packet_unit_short_info *receive_packet_unit_short_info_100(struct connection *pc)
30145{
30146#define FREE_PACKET_STRUCT(_packet) free_packet_unit_short_info(_packet)
30147#ifdef FREECIV_DELTA_PROTOCOL
30148 packet_unit_short_info_100_fields fields;
30149 struct packet_unit_short_info *old;
30150 struct genhash **hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
30151#endif /* FREECIV_DELTA_PROTOCOL */
30152 RECEIVE_PACKET_START(packet_unit_short_info, real_packet);
30153#ifdef FREECIV_JSON_CONNECTION
30154 struct plocation field_addr;
30155 {
30156 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
30157 field_addr = *field_addr_tmp;
30158 FC_FREE(field_addr_tmp);
30159 }
30160#endif /* FREECIV_JSON_CONNECTION */
30161
30162#ifdef FREECIV_DELTA_PROTOCOL
30163#ifdef FREECIV_JSON_CONNECTION
30164 field_addr.name = "fields";
30165#endif /* FREECIV_JSON_CONNECTION */
30166 DIO_BV_GET(&din, &field_addr, fields);
30167#ifdef FREECIV_JSON_CONNECTION
30168 field_addr.name = "id";
30169#endif /* FREECIV_JSON_CONNECTION */
30170 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
30171 RECEIVE_PACKET_FIELD_ERROR(id);
30172 }
30173
30174#else /* FREECIV_DELTA_PROTOCOL */
30175#ifdef FREECIV_JSON_CONNECTION
30176 field_addr.name = "id";
30177#endif /* FREECIV_JSON_CONNECTION */
30178 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
30179 RECEIVE_PACKET_FIELD_ERROR(id);
30180 }
30181#ifdef FREECIV_JSON_CONNECTION
30182 field_addr.name = "owner";
30183#endif /* FREECIV_JSON_CONNECTION */
30184 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
30185 RECEIVE_PACKET_FIELD_ERROR(owner);
30186 }
30187#ifdef FREECIV_JSON_CONNECTION
30188 field_addr.name = "tile";
30189#endif /* FREECIV_JSON_CONNECTION */
30190 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
30191 RECEIVE_PACKET_FIELD_ERROR(tile);
30192 }
30193#ifdef FREECIV_JSON_CONNECTION
30194 field_addr.name = "facing";
30195#endif /* FREECIV_JSON_CONNECTION */
30196 {
30197 int readin;
30198
30199 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
30200 RECEIVE_PACKET_FIELD_ERROR(facing);
30201 }
30202 real_packet->facing = readin;
30203 }
30204#ifdef FREECIV_JSON_CONNECTION
30205 field_addr.name = "type";
30206#endif /* FREECIV_JSON_CONNECTION */
30207 {
30208 int readin;
30209
30210 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
30211 RECEIVE_PACKET_FIELD_ERROR(type);
30212 }
30213 real_packet->type = readin;
30214 }
30215#ifdef FREECIV_JSON_CONNECTION
30216 field_addr.name = "veteran";
30217#endif /* FREECIV_JSON_CONNECTION */
30218 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
30219 RECEIVE_PACKET_FIELD_ERROR(veteran);
30220 }
30221#ifdef FREECIV_JSON_CONNECTION
30222 field_addr.name = "occupied";
30223#endif /* FREECIV_JSON_CONNECTION */
30224 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
30225 RECEIVE_PACKET_FIELD_ERROR(occupied);
30226 }
30227#ifdef FREECIV_JSON_CONNECTION
30228 field_addr.name = "transported";
30229#endif /* FREECIV_JSON_CONNECTION */
30230 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
30231 RECEIVE_PACKET_FIELD_ERROR(transported);
30232 }
30233#ifdef FREECIV_JSON_CONNECTION
30234 field_addr.name = "hp";
30235#endif /* FREECIV_JSON_CONNECTION */
30236 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
30237 RECEIVE_PACKET_FIELD_ERROR(hp);
30238 }
30239#ifdef FREECIV_JSON_CONNECTION
30240 field_addr.name = "activity";
30241#endif /* FREECIV_JSON_CONNECTION */
30242 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
30243 RECEIVE_PACKET_FIELD_ERROR(activity);
30244 }
30245#ifdef FREECIV_JSON_CONNECTION
30246 field_addr.name = "activity_tgt";
30247#endif /* FREECIV_JSON_CONNECTION */
30248 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
30249 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
30250 }
30251#ifdef FREECIV_JSON_CONNECTION
30252 field_addr.name = "transported_by";
30253#endif /* FREECIV_JSON_CONNECTION */
30254 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
30255 RECEIVE_PACKET_FIELD_ERROR(transported_by);
30256 }
30257#ifdef FREECIV_JSON_CONNECTION
30258 field_addr.name = "packet_use";
30259#endif /* FREECIV_JSON_CONNECTION */
30260 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
30261 RECEIVE_PACKET_FIELD_ERROR(packet_use);
30262 }
30263#ifdef FREECIV_JSON_CONNECTION
30264 field_addr.name = "info_city_id";
30265#endif /* FREECIV_JSON_CONNECTION */
30266 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->info_city_id)) {
30267 RECEIVE_PACKET_FIELD_ERROR(info_city_id);
30268 }
30269#endif
30270 log_packet_detailed("packet_unit_short_info_100: got info about (%d)",
30271 real_packet->id);
30272
30273#ifdef FREECIV_DELTA_PROTOCOL
30274 if (nullptr == *hash) {
30275 *hash = genhash_new_full(hash_packet_unit_short_info_100, cmp_packet_unit_short_info_100,
30276 nullptr, nullptr, nullptr, destroy_packet_unit_short_info);
30277 }
30278
30279 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30280 *real_packet = *old;
30281 } else {
30282 /* packet is already initialized empty */
30283 log_packet_detailed(" no old info");
30284 }
30285
30286 if (BV_ISSET(fields, 0)) {
30287 log_packet_detailed(" got field 'owner'");
30288#ifdef FREECIV_JSON_CONNECTION
30289 field_addr.name = "owner";
30290#endif /* FREECIV_JSON_CONNECTION */
30291 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
30292 RECEIVE_PACKET_FIELD_ERROR(owner);
30293 }
30294 }
30295 if (BV_ISSET(fields, 1)) {
30296 log_packet_detailed(" got field 'tile'");
30297#ifdef FREECIV_JSON_CONNECTION
30298 field_addr.name = "tile";
30299#endif /* FREECIV_JSON_CONNECTION */
30300 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
30301 RECEIVE_PACKET_FIELD_ERROR(tile);
30302 }
30303 }
30304 if (BV_ISSET(fields, 2)) {
30305 log_packet_detailed(" got field 'facing'");
30306#ifdef FREECIV_JSON_CONNECTION
30307 field_addr.name = "facing";
30308#endif /* FREECIV_JSON_CONNECTION */
30309 {
30310 int readin;
30311
30312 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
30313 RECEIVE_PACKET_FIELD_ERROR(facing);
30314 }
30315 real_packet->facing = readin;
30316 }
30317 }
30318 if (BV_ISSET(fields, 3)) {
30319 log_packet_detailed(" got field 'type'");
30320#ifdef FREECIV_JSON_CONNECTION
30321 field_addr.name = "type";
30322#endif /* FREECIV_JSON_CONNECTION */
30323 {
30324 int readin;
30325
30326 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
30327 RECEIVE_PACKET_FIELD_ERROR(type);
30328 }
30329 real_packet->type = readin;
30330 }
30331 }
30332 if (BV_ISSET(fields, 4)) {
30333 log_packet_detailed(" got field 'veteran'");
30334#ifdef FREECIV_JSON_CONNECTION
30335 field_addr.name = "veteran";
30336#endif /* FREECIV_JSON_CONNECTION */
30337 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
30338 RECEIVE_PACKET_FIELD_ERROR(veteran);
30339 }
30340 }
30341 real_packet->occupied = BV_ISSET(fields, 5);
30342 real_packet->transported = BV_ISSET(fields, 6);
30343 if (BV_ISSET(fields, 7)) {
30344 log_packet_detailed(" got field 'hp'");
30345#ifdef FREECIV_JSON_CONNECTION
30346 field_addr.name = "hp";
30347#endif /* FREECIV_JSON_CONNECTION */
30348 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
30349 RECEIVE_PACKET_FIELD_ERROR(hp);
30350 }
30351 }
30352 if (BV_ISSET(fields, 8)) {
30353 log_packet_detailed(" got field 'activity'");
30354#ifdef FREECIV_JSON_CONNECTION
30355 field_addr.name = "activity";
30356#endif /* FREECIV_JSON_CONNECTION */
30357 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
30358 RECEIVE_PACKET_FIELD_ERROR(activity);
30359 }
30360 }
30361 if (BV_ISSET(fields, 9)) {
30362 log_packet_detailed(" got field 'activity_tgt'");
30363#ifdef FREECIV_JSON_CONNECTION
30364 field_addr.name = "activity_tgt";
30365#endif /* FREECIV_JSON_CONNECTION */
30366 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
30367 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
30368 }
30369 }
30370 if (BV_ISSET(fields, 10)) {
30371 log_packet_detailed(" got field 'transported_by'");
30372#ifdef FREECIV_JSON_CONNECTION
30373 field_addr.name = "transported_by";
30374#endif /* FREECIV_JSON_CONNECTION */
30375 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
30376 RECEIVE_PACKET_FIELD_ERROR(transported_by);
30377 }
30378 }
30379 if (BV_ISSET(fields, 11)) {
30380 log_packet_detailed(" got field 'packet_use'");
30381#ifdef FREECIV_JSON_CONNECTION
30382 field_addr.name = "packet_use";
30383#endif /* FREECIV_JSON_CONNECTION */
30384 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
30385 RECEIVE_PACKET_FIELD_ERROR(packet_use);
30386 }
30387 }
30388 if (BV_ISSET(fields, 12)) {
30389 log_packet_detailed(" got field 'info_city_id'");
30390#ifdef FREECIV_JSON_CONNECTION
30391 field_addr.name = "info_city_id";
30392#endif /* FREECIV_JSON_CONNECTION */
30393 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->info_city_id)) {
30394 RECEIVE_PACKET_FIELD_ERROR(info_city_id);
30395 }
30396 }
30397
30398 if (nullptr == old) {
30399 old = fc_malloc(sizeof(*old));
30400 init_packet_unit_short_info(old);
30401 *old = *real_packet;
30402 genhash_insert(*hash, old, old);
30403 } else {
30404 *old = *real_packet;
30405 }
30406
30407 hash = pc->phs.received + PACKET_UNIT_INFO;
30408 if (nullptr != *hash) {
30409 genhash_remove(*hash, real_packet);
30410 }
30411
30412#endif /* FREECIV_DELTA_PROTOCOL */
30413 RECEIVE_PACKET_END(real_packet);
30414#undef FREE_PACKET_STRUCT
30415}
30416
30417 static int send_packet_unit_short_info_100(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
30418{
30419 const struct packet_unit_short_info *real_packet = packet;
30420 int e;
30421#ifdef FREECIV_DELTA_PROTOCOL
30422 packet_unit_short_info_100_fields fields;
30423 struct packet_unit_short_info *old;
30424 bool differ;
30425 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
30426 int different = force_to_send;
30427#endif /* FREECIV_DELTA_PROTOCOL */
30428 SEND_PACKET_START(PACKET_UNIT_SHORT_INFO);
30429#ifdef FREECIV_JSON_CONNECTION
30430 struct plocation field_addr;
30431 {
30432 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
30433 field_addr = *field_addr_tmp;
30434 FC_FREE(field_addr_tmp);
30435 }
30436#endif /* FREECIV_JSON_CONNECTION */
30437
30438 log_packet_detailed("packet_unit_short_info_100: sending info about (%d)",
30439 real_packet->id);
30440
30441#ifdef FREECIV_DELTA_PROTOCOL
30442 if (nullptr == *hash) {
30443 *hash = genhash_new_full(hash_packet_unit_short_info_100, cmp_packet_unit_short_info_100,
30444 nullptr, nullptr, nullptr, destroy_packet_unit_short_info);
30445 }
30446 BV_CLR_ALL(fields);
30447
30448 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30449 old = fc_malloc(sizeof(*old));
30450 /* temporary bitcopy just to insert correctly */
30451 *old = *real_packet;
30452 genhash_insert(*hash, old, old);
30453 init_packet_unit_short_info(old);
30454 different = 1; /* Force to send. */
30455 }
30456 differ = (old->owner != real_packet->owner);
30457 if (differ) {
30458 different++;
30459 BV_SET(fields, 0);
30460 }
30461
30462 differ = (old->tile != real_packet->tile);
30463 if (differ) {
30464 different++;
30465 BV_SET(fields, 1);
30466 }
30467
30468 differ = (old->facing != real_packet->facing);
30469 if (differ) {
30470 different++;
30471 BV_SET(fields, 2);
30472 }
30473
30474 differ = (old->type != real_packet->type);
30475 if (differ) {
30476 different++;
30477 BV_SET(fields, 3);
30478 }
30479
30480 differ = (old->veteran != real_packet->veteran);
30481 if (differ) {
30482 different++;
30483 BV_SET(fields, 4);
30484 }
30485
30486 differ = (old->occupied != real_packet->occupied);
30487 if (differ) {
30488 different++;
30489 }
30490 if (packet->occupied) {
30491 BV_SET(fields, 5);
30492 }
30493
30494 differ = (old->transported != real_packet->transported);
30495 if (differ) {
30496 different++;
30497 }
30498 if (packet->transported) {
30499 BV_SET(fields, 6);
30500 }
30501
30502 differ = (old->hp != real_packet->hp);
30503 if (differ) {
30504 different++;
30505 BV_SET(fields, 7);
30506 }
30507
30508 differ = (old->activity != real_packet->activity);
30509 if (differ) {
30510 different++;
30511 BV_SET(fields, 8);
30512 }
30513
30514 differ = (old->activity_tgt != real_packet->activity_tgt);
30515 if (differ) {
30516 different++;
30517 BV_SET(fields, 9);
30518 }
30519
30520 differ = (old->transported_by != real_packet->transported_by);
30521 if (differ) {
30522 different++;
30523 BV_SET(fields, 10);
30524 }
30525
30526 differ = (old->packet_use != real_packet->packet_use);
30527 if (differ) {
30528 different++;
30529 BV_SET(fields, 11);
30530 }
30531
30532 differ = (old->info_city_id != real_packet->info_city_id);
30533 if (differ) {
30534 different++;
30535 BV_SET(fields, 12);
30536 }
30537
30538 if (different == 0) {
30539 log_packet_detailed(" no change -> discard");
30540 return 0;
30541 }
30542
30543#ifdef FREECIV_JSON_CONNECTION
30544 field_addr.name = "fields";
30545#endif /* FREECIV_JSON_CONNECTION */
30546 e = 0;
30547 e |= DIO_BV_PUT(&dout, &field_addr, fields);
30548 if (e) {
30549 log_packet_detailed("fields bitvector error detected");
30550 }
30551#ifdef FREECIV_JSON_CONNECTION
30552 field_addr.name = "id";
30553#endif /* FREECIV_JSON_CONNECTION */
30554 e = 0;
30555 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
30556 if (e) {
30557 log_packet_detailed("'id' field error detected");
30558 }
30559
30560 if (BV_ISSET(fields, 0)) {
30561 log_packet_detailed(" field 'owner' has changed");
30562#ifdef FREECIV_JSON_CONNECTION
30563 field_addr.name = "owner";
30564#endif /* FREECIV_JSON_CONNECTION */
30565 e = 0;
30566 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
30567 if (e) {
30568 log_packet_detailed("'owner' field error detected");
30569 }
30570 }
30571 if (BV_ISSET(fields, 1)) {
30572 log_packet_detailed(" field 'tile' has changed");
30573#ifdef FREECIV_JSON_CONNECTION
30574 field_addr.name = "tile";
30575#endif /* FREECIV_JSON_CONNECTION */
30576 e = 0;
30577 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
30578 if (e) {
30579 log_packet_detailed("'tile' field error detected");
30580 }
30581 }
30582 if (BV_ISSET(fields, 2)) {
30583 log_packet_detailed(" field 'facing' has changed");
30584#ifdef FREECIV_JSON_CONNECTION
30585 field_addr.name = "facing";
30586#endif /* FREECIV_JSON_CONNECTION */
30587 e = 0;
30588 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
30589 if (e) {
30590 log_packet_detailed("'facing' field error detected");
30591 }
30592 }
30593 if (BV_ISSET(fields, 3)) {
30594 log_packet_detailed(" field 'type' has changed");
30595#ifdef FREECIV_JSON_CONNECTION
30596 field_addr.name = "type";
30597#endif /* FREECIV_JSON_CONNECTION */
30598 e = 0;
30599 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
30600 if (e) {
30601 log_packet_detailed("'type' field error detected");
30602 }
30603 }
30604 if (BV_ISSET(fields, 4)) {
30605 log_packet_detailed(" field 'veteran' has changed");
30606#ifdef FREECIV_JSON_CONNECTION
30607 field_addr.name = "veteran";
30608#endif /* FREECIV_JSON_CONNECTION */
30609 e = 0;
30610 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
30611 if (e) {
30612 log_packet_detailed("'veteran' field error detected");
30613 }
30614 }
30615 /* field 5 is folded into the header */
30616 /* field 6 is folded into the header */
30617 if (BV_ISSET(fields, 7)) {
30618 log_packet_detailed(" field 'hp' has changed");
30619#ifdef FREECIV_JSON_CONNECTION
30620 field_addr.name = "hp";
30621#endif /* FREECIV_JSON_CONNECTION */
30622 e = 0;
30623 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
30624 if (e) {
30625 log_packet_detailed("'hp' field error detected");
30626 }
30627 }
30628 if (BV_ISSET(fields, 8)) {
30629 log_packet_detailed(" field 'activity' has changed");
30630#ifdef FREECIV_JSON_CONNECTION
30631 field_addr.name = "activity";
30632#endif /* FREECIV_JSON_CONNECTION */
30633 e = 0;
30634 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
30635 if (e) {
30636 log_packet_detailed("'activity' field error detected");
30637 }
30638 }
30639 if (BV_ISSET(fields, 9)) {
30640 log_packet_detailed(" field 'activity_tgt' has changed");
30641#ifdef FREECIV_JSON_CONNECTION
30642 field_addr.name = "activity_tgt";
30643#endif /* FREECIV_JSON_CONNECTION */
30644 e = 0;
30645 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
30646 if (e) {
30647 log_packet_detailed("'activity_tgt' field error detected");
30648 }
30649 }
30650 if (BV_ISSET(fields, 10)) {
30651 log_packet_detailed(" field 'transported_by' has changed");
30652#ifdef FREECIV_JSON_CONNECTION
30653 field_addr.name = "transported_by";
30654#endif /* FREECIV_JSON_CONNECTION */
30655 e = 0;
30656 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
30657 if (e) {
30658 log_packet_detailed("'transported_by' field error detected");
30659 }
30660 }
30661 if (BV_ISSET(fields, 11)) {
30662 log_packet_detailed(" field 'packet_use' has changed");
30663#ifdef FREECIV_JSON_CONNECTION
30664 field_addr.name = "packet_use";
30665#endif /* FREECIV_JSON_CONNECTION */
30666 e = 0;
30667 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
30668 if (e) {
30669 log_packet_detailed("'packet_use' field error detected");
30670 }
30671 }
30672 if (BV_ISSET(fields, 12)) {
30673 log_packet_detailed(" field 'info_city_id' has changed");
30674#ifdef FREECIV_JSON_CONNECTION
30675 field_addr.name = "info_city_id";
30676#endif /* FREECIV_JSON_CONNECTION */
30677 e = 0;
30678 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->info_city_id);
30679 if (e) {
30680 log_packet_detailed("'info_city_id' field error detected");
30681 }
30682 }
30683
30684 *old = *real_packet;
30685
30686 hash = pc->phs.sent + PACKET_UNIT_INFO;
30687 if (nullptr != *hash) {
30688 genhash_remove(*hash, real_packet);
30689 }
30690#endif /* FREECIV_DELTA_PROTOCOL */
30691#ifndef FREECIV_DELTA_PROTOCOL
30692#ifdef FREECIV_JSON_CONNECTION
30693 field_addr.name = "id";
30694#endif /* FREECIV_JSON_CONNECTION */
30695 e = 0;
30696 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
30697 if (e) {
30698 log_packet_detailed("'id' field error detected");
30699 }
30700#ifdef FREECIV_JSON_CONNECTION
30701 field_addr.name = "owner";
30702#endif /* FREECIV_JSON_CONNECTION */
30703 e = 0;
30704 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
30705 if (e) {
30706 log_packet_detailed("'owner' field error detected");
30707 }
30708#ifdef FREECIV_JSON_CONNECTION
30709 field_addr.name = "tile";
30710#endif /* FREECIV_JSON_CONNECTION */
30711 e = 0;
30712 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
30713 if (e) {
30714 log_packet_detailed("'tile' field error detected");
30715 }
30716#ifdef FREECIV_JSON_CONNECTION
30717 field_addr.name = "facing";
30718#endif /* FREECIV_JSON_CONNECTION */
30719 e = 0;
30720 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
30721 if (e) {
30722 log_packet_detailed("'facing' field error detected");
30723 }
30724#ifdef FREECIV_JSON_CONNECTION
30725 field_addr.name = "type";
30726#endif /* FREECIV_JSON_CONNECTION */
30727 e = 0;
30728 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
30729 if (e) {
30730 log_packet_detailed("'type' field error detected");
30731 }
30732#ifdef FREECIV_JSON_CONNECTION
30733 field_addr.name = "veteran";
30734#endif /* FREECIV_JSON_CONNECTION */
30735 e = 0;
30736 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
30737 if (e) {
30738 log_packet_detailed("'veteran' field error detected");
30739 }
30740#ifdef FREECIV_JSON_CONNECTION
30741 field_addr.name = "occupied";
30742#endif /* FREECIV_JSON_CONNECTION */
30743 e = 0;
30744 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
30745 if (e) {
30746 log_packet_detailed("'occupied' field error detected");
30747 }
30748#ifdef FREECIV_JSON_CONNECTION
30749 field_addr.name = "transported";
30750#endif /* FREECIV_JSON_CONNECTION */
30751 e = 0;
30752 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
30753 if (e) {
30754 log_packet_detailed("'transported' field error detected");
30755 }
30756#ifdef FREECIV_JSON_CONNECTION
30757 field_addr.name = "hp";
30758#endif /* FREECIV_JSON_CONNECTION */
30759 e = 0;
30760 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
30761 if (e) {
30762 log_packet_detailed("'hp' field error detected");
30763 }
30764#ifdef FREECIV_JSON_CONNECTION
30765 field_addr.name = "activity";
30766#endif /* FREECIV_JSON_CONNECTION */
30767 e = 0;
30768 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
30769 if (e) {
30770 log_packet_detailed("'activity' field error detected");
30771 }
30772#ifdef FREECIV_JSON_CONNECTION
30773 field_addr.name = "activity_tgt";
30774#endif /* FREECIV_JSON_CONNECTION */
30775 e = 0;
30776 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
30777 if (e) {
30778 log_packet_detailed("'activity_tgt' field error detected");
30779 }
30780#ifdef FREECIV_JSON_CONNECTION
30781 field_addr.name = "transported_by";
30782#endif /* FREECIV_JSON_CONNECTION */
30783 e = 0;
30784 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
30785 if (e) {
30786 log_packet_detailed("'transported_by' field error detected");
30787 }
30788#ifdef FREECIV_JSON_CONNECTION
30789 field_addr.name = "packet_use";
30790#endif /* FREECIV_JSON_CONNECTION */
30791 e = 0;
30792 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
30793 if (e) {
30794 log_packet_detailed("'packet_use' field error detected");
30795 }
30796#ifdef FREECIV_JSON_CONNECTION
30797 field_addr.name = "info_city_id";
30798#endif /* FREECIV_JSON_CONNECTION */
30799 e = 0;
30800 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->info_city_id);
30801 if (e) {
30802 log_packet_detailed("'info_city_id' field error detected");
30803 }
30804
30805#endif
30806 SEND_PACKET_END(PACKET_UNIT_SHORT_INFO);
30807}
30808
30809 int send_packet_unit_short_info(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
30810{
30811 if (!pc->used) {
30812 log_error("WARNING: trying to send data to the closed connection %s",
30813 conn_description(pc));
30814 return -1;
30815 }
30816 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SHORT_INFO].force_to_send != nullptr, -1,
30817 "Handler for PACKET_UNIT_SHORT_INFO not installed");
30818 return pc->phs.handlers->send[PACKET_UNIT_SHORT_INFO].force_to_send(pc, packet, force_to_send);
30819}
30820
30821 void lsend_packet_unit_short_info(struct conn_list *dest, const struct packet_unit_short_info *packet, bool force_to_send)
30822{
30823 conn_list_iterate(dest, pconn) {
30824 send_packet_unit_short_info(pconn, packet, force_to_send);
30825 } conn_list_iterate_end;
30826}
30827
30828 static inline void init_packet_unit_combat_info(struct packet_unit_combat_info *packet)
30829{
30830 memset(packet, 0, sizeof(*packet));
30831}
30832
30833#define free_packet_unit_combat_info(_packet) (void) 0
30834#define destroy_packet_unit_combat_info free
30835
30836#ifdef FREECIV_DELTA_PROTOCOL
30837#define hash_packet_unit_combat_info_100 hash_const
30838
30839#define cmp_packet_unit_combat_info_100 cmp_const
30840
30841 BV_DEFINE(packet_unit_combat_info_100_fields, 6);
30842#endif /* FREECIV_DELTA_PROTOCOL */
30843
30844 static struct packet_unit_combat_info *receive_packet_unit_combat_info_100(struct connection *pc)
30845{
30846#define FREE_PACKET_STRUCT(_packet) free_packet_unit_combat_info(_packet)
30847#ifdef FREECIV_DELTA_PROTOCOL
30848 packet_unit_combat_info_100_fields fields;
30849 struct packet_unit_combat_info *old;
30850 struct genhash **hash = pc->phs.received + PACKET_UNIT_COMBAT_INFO;
30851#endif /* FREECIV_DELTA_PROTOCOL */
30852 RECEIVE_PACKET_START(packet_unit_combat_info, real_packet);
30853#ifdef FREECIV_JSON_CONNECTION
30854 struct plocation field_addr;
30855 {
30856 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
30857 field_addr = *field_addr_tmp;
30858 FC_FREE(field_addr_tmp);
30859 }
30860#endif /* FREECIV_JSON_CONNECTION */
30861
30862#ifdef FREECIV_DELTA_PROTOCOL
30863#ifdef FREECIV_JSON_CONNECTION
30864 field_addr.name = "fields";
30865#endif /* FREECIV_JSON_CONNECTION */
30866 DIO_BV_GET(&din, &field_addr, fields);
30867
30868#else /* FREECIV_DELTA_PROTOCOL */
30869#ifdef FREECIV_JSON_CONNECTION
30870 field_addr.name = "attacker_unit_id";
30871#endif /* FREECIV_JSON_CONNECTION */
30872 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->attacker_unit_id)) {
30873 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id);
30874 }
30875#ifdef FREECIV_JSON_CONNECTION
30876 field_addr.name = "defender_unit_id";
30877#endif /* FREECIV_JSON_CONNECTION */
30878 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->defender_unit_id)) {
30879 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id);
30880 }
30881#ifdef FREECIV_JSON_CONNECTION
30882 field_addr.name = "attacker_hp";
30883#endif /* FREECIV_JSON_CONNECTION */
30884 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
30885 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
30886 }
30887#ifdef FREECIV_JSON_CONNECTION
30888 field_addr.name = "defender_hp";
30889#endif /* FREECIV_JSON_CONNECTION */
30890 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
30891 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
30892 }
30893#ifdef FREECIV_JSON_CONNECTION
30894 field_addr.name = "make_att_veteran";
30895#endif /* FREECIV_JSON_CONNECTION */
30896 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_att_veteran)) {
30897 RECEIVE_PACKET_FIELD_ERROR(make_att_veteran);
30898 }
30899#ifdef FREECIV_JSON_CONNECTION
30900 field_addr.name = "make_def_veteran";
30901#endif /* FREECIV_JSON_CONNECTION */
30902 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_def_veteran)) {
30903 RECEIVE_PACKET_FIELD_ERROR(make_def_veteran);
30904 }
30905#endif
30906 log_packet_detailed("packet_unit_combat_info_100: got info about ()");
30907
30908#ifdef FREECIV_DELTA_PROTOCOL
30909 if (nullptr == *hash) {
30910 *hash = genhash_new_full(hash_packet_unit_combat_info_100, cmp_packet_unit_combat_info_100,
30911 nullptr, nullptr, nullptr, destroy_packet_unit_combat_info);
30912 }
30913
30914 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30915 *real_packet = *old;
30916 } else {
30917 /* packet is already initialized empty */
30918 log_packet_detailed(" no old info");
30919 }
30920
30921 if (BV_ISSET(fields, 0)) {
30922 log_packet_detailed(" got field 'attacker_unit_id'");
30923#ifdef FREECIV_JSON_CONNECTION
30924 field_addr.name = "attacker_unit_id";
30925#endif /* FREECIV_JSON_CONNECTION */
30926 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->attacker_unit_id)) {
30927 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id);
30928 }
30929 }
30930 if (BV_ISSET(fields, 1)) {
30931 log_packet_detailed(" got field 'defender_unit_id'");
30932#ifdef FREECIV_JSON_CONNECTION
30933 field_addr.name = "defender_unit_id";
30934#endif /* FREECIV_JSON_CONNECTION */
30935 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->defender_unit_id)) {
30936 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id);
30937 }
30938 }
30939 if (BV_ISSET(fields, 2)) {
30940 log_packet_detailed(" got field 'attacker_hp'");
30941#ifdef FREECIV_JSON_CONNECTION
30942 field_addr.name = "attacker_hp";
30943#endif /* FREECIV_JSON_CONNECTION */
30944 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
30945 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
30946 }
30947 }
30948 if (BV_ISSET(fields, 3)) {
30949 log_packet_detailed(" got field 'defender_hp'");
30950#ifdef FREECIV_JSON_CONNECTION
30951 field_addr.name = "defender_hp";
30952#endif /* FREECIV_JSON_CONNECTION */
30953 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
30954 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
30955 }
30956 }
30957 real_packet->make_att_veteran = BV_ISSET(fields, 4);
30958 real_packet->make_def_veteran = BV_ISSET(fields, 5);
30959
30960 if (nullptr == old) {
30961 old = fc_malloc(sizeof(*old));
30962 init_packet_unit_combat_info(old);
30963 *old = *real_packet;
30964 genhash_insert(*hash, old, old);
30965 } else {
30966 *old = *real_packet;
30967 }
30968
30969#endif /* FREECIV_DELTA_PROTOCOL */
30970 RECEIVE_PACKET_END(real_packet);
30971#undef FREE_PACKET_STRUCT
30972}
30973
30974 static int send_packet_unit_combat_info_100(struct connection *pc, const struct packet_unit_combat_info *packet)
30975{
30976 const struct packet_unit_combat_info *real_packet = packet;
30977 int e;
30978#ifdef FREECIV_DELTA_PROTOCOL
30979 packet_unit_combat_info_100_fields fields;
30980 struct packet_unit_combat_info *old;
30981 bool differ;
30982 struct genhash **hash = pc->phs.sent + PACKET_UNIT_COMBAT_INFO;
30983#endif /* FREECIV_DELTA_PROTOCOL */
30984 SEND_PACKET_START(PACKET_UNIT_COMBAT_INFO);
30985#ifdef FREECIV_JSON_CONNECTION
30986 struct plocation field_addr;
30987 {
30988 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
30989 field_addr = *field_addr_tmp;
30990 FC_FREE(field_addr_tmp);
30991 }
30992#endif /* FREECIV_JSON_CONNECTION */
30993
30994 log_packet_detailed("packet_unit_combat_info_100: sending info about ()");
30995
30996#ifdef FREECIV_DELTA_PROTOCOL
30997 if (nullptr == *hash) {
30998 *hash = genhash_new_full(hash_packet_unit_combat_info_100, cmp_packet_unit_combat_info_100,
30999 nullptr, nullptr, nullptr, destroy_packet_unit_combat_info);
31000 }
31001 BV_CLR_ALL(fields);
31002
31003 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31004 old = fc_malloc(sizeof(*old));
31005 /* temporary bitcopy just to insert correctly */
31006 *old = *real_packet;
31007 genhash_insert(*hash, old, old);
31008 init_packet_unit_combat_info(old);
31009 }
31010 differ = (old->attacker_unit_id != real_packet->attacker_unit_id);
31011 if (differ) {
31012 BV_SET(fields, 0);
31013 }
31014
31015 differ = (old->defender_unit_id != real_packet->defender_unit_id);
31016 if (differ) {
31017 BV_SET(fields, 1);
31018 }
31019
31020 differ = (old->attacker_hp != real_packet->attacker_hp);
31021 if (differ) {
31022 BV_SET(fields, 2);
31023 }
31024
31025 differ = (old->defender_hp != real_packet->defender_hp);
31026 if (differ) {
31027 BV_SET(fields, 3);
31028 }
31029
31030 if (packet->make_att_veteran) {
31031 BV_SET(fields, 4);
31032 }
31033
31034 if (packet->make_def_veteran) {
31035 BV_SET(fields, 5);
31036 }
31037
31038
31039#ifdef FREECIV_JSON_CONNECTION
31040 field_addr.name = "fields";
31041#endif /* FREECIV_JSON_CONNECTION */
31042 e = 0;
31043 e |= DIO_BV_PUT(&dout, &field_addr, fields);
31044 if (e) {
31045 log_packet_detailed("fields bitvector error detected");
31046 }
31047
31048 if (BV_ISSET(fields, 0)) {
31049 log_packet_detailed(" field 'attacker_unit_id' has changed");
31050#ifdef FREECIV_JSON_CONNECTION
31051 field_addr.name = "attacker_unit_id";
31052#endif /* FREECIV_JSON_CONNECTION */
31053 e = 0;
31054 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->attacker_unit_id);
31055 if (e) {
31056 log_packet_detailed("'attacker_unit_id' field error detected");
31057 }
31058 }
31059 if (BV_ISSET(fields, 1)) {
31060 log_packet_detailed(" field 'defender_unit_id' has changed");
31061#ifdef FREECIV_JSON_CONNECTION
31062 field_addr.name = "defender_unit_id";
31063#endif /* FREECIV_JSON_CONNECTION */
31064 e = 0;
31065 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->defender_unit_id);
31066 if (e) {
31067 log_packet_detailed("'defender_unit_id' field error detected");
31068 }
31069 }
31070 if (BV_ISSET(fields, 2)) {
31071 log_packet_detailed(" field 'attacker_hp' has changed");
31072#ifdef FREECIV_JSON_CONNECTION
31073 field_addr.name = "attacker_hp";
31074#endif /* FREECIV_JSON_CONNECTION */
31075 e = 0;
31076 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
31077 if (e) {
31078 log_packet_detailed("'attacker_hp' field error detected");
31079 }
31080 }
31081 if (BV_ISSET(fields, 3)) {
31082 log_packet_detailed(" field 'defender_hp' has changed");
31083#ifdef FREECIV_JSON_CONNECTION
31084 field_addr.name = "defender_hp";
31085#endif /* FREECIV_JSON_CONNECTION */
31086 e = 0;
31087 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
31088 if (e) {
31089 log_packet_detailed("'defender_hp' field error detected");
31090 }
31091 }
31092 /* field 4 is folded into the header */
31093 /* field 5 is folded into the header */
31094
31095 *old = *real_packet;
31096#endif /* FREECIV_DELTA_PROTOCOL */
31097#ifndef FREECIV_DELTA_PROTOCOL
31098#ifdef FREECIV_JSON_CONNECTION
31099 field_addr.name = "attacker_unit_id";
31100#endif /* FREECIV_JSON_CONNECTION */
31101 e = 0;
31102 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->attacker_unit_id);
31103 if (e) {
31104 log_packet_detailed("'attacker_unit_id' field error detected");
31105 }
31106#ifdef FREECIV_JSON_CONNECTION
31107 field_addr.name = "defender_unit_id";
31108#endif /* FREECIV_JSON_CONNECTION */
31109 e = 0;
31110 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->defender_unit_id);
31111 if (e) {
31112 log_packet_detailed("'defender_unit_id' field error detected");
31113 }
31114#ifdef FREECIV_JSON_CONNECTION
31115 field_addr.name = "attacker_hp";
31116#endif /* FREECIV_JSON_CONNECTION */
31117 e = 0;
31118 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
31119 if (e) {
31120 log_packet_detailed("'attacker_hp' field error detected");
31121 }
31122#ifdef FREECIV_JSON_CONNECTION
31123 field_addr.name = "defender_hp";
31124#endif /* FREECIV_JSON_CONNECTION */
31125 e = 0;
31126 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
31127 if (e) {
31128 log_packet_detailed("'defender_hp' field error detected");
31129 }
31130#ifdef FREECIV_JSON_CONNECTION
31131 field_addr.name = "make_att_veteran";
31132#endif /* FREECIV_JSON_CONNECTION */
31133 e = 0;
31134 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->make_att_veteran);
31135 if (e) {
31136 log_packet_detailed("'make_att_veteran' field error detected");
31137 }
31138#ifdef FREECIV_JSON_CONNECTION
31139 field_addr.name = "make_def_veteran";
31140#endif /* FREECIV_JSON_CONNECTION */
31141 e = 0;
31142 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->make_def_veteran);
31143 if (e) {
31144 log_packet_detailed("'make_def_veteran' field error detected");
31145 }
31146
31147#endif
31148 SEND_PACKET_END(PACKET_UNIT_COMBAT_INFO);
31149}
31150
31151 int send_packet_unit_combat_info(struct connection *pc, const struct packet_unit_combat_info *packet)
31152{
31153 if (!pc->used) {
31154 log_error("WARNING: trying to send data to the closed connection %s",
31155 conn_description(pc));
31156 return -1;
31157 }
31158 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_COMBAT_INFO].packet != nullptr, -1,
31159 "Handler for PACKET_UNIT_COMBAT_INFO not installed");
31160 return pc->phs.handlers->send[PACKET_UNIT_COMBAT_INFO].packet(pc, packet);
31161}
31162
31163 void lsend_packet_unit_combat_info(struct conn_list *dest, const struct packet_unit_combat_info *packet)
31164{
31165 conn_list_iterate(dest, pconn) {
31166 send_packet_unit_combat_info(pconn, packet);
31167 } conn_list_iterate_end;
31168}
31169
31170 static inline void init_packet_unit_sscs_set(struct packet_unit_sscs_set *packet)
31171{
31172 memset(packet, 0, sizeof(*packet));
31173}
31174
31175#define free_packet_unit_sscs_set(_packet) (void) 0
31176#define destroy_packet_unit_sscs_set free
31177
31178#ifdef FREECIV_DELTA_PROTOCOL
31179#define hash_packet_unit_sscs_set_100 hash_const
31180
31181#define cmp_packet_unit_sscs_set_100 cmp_const
31182
31183 BV_DEFINE(packet_unit_sscs_set_100_fields, 3);
31184#endif /* FREECIV_DELTA_PROTOCOL */
31185
31186 static struct packet_unit_sscs_set *receive_packet_unit_sscs_set_100(struct connection *pc)
31187{
31188#define FREE_PACKET_STRUCT(_packet) free_packet_unit_sscs_set(_packet)
31189#ifdef FREECIV_DELTA_PROTOCOL
31190 packet_unit_sscs_set_100_fields fields;
31191 struct packet_unit_sscs_set *old;
31192 struct genhash **hash = pc->phs.received + PACKET_UNIT_SSCS_SET;
31193#endif /* FREECIV_DELTA_PROTOCOL */
31194 RECEIVE_PACKET_START(packet_unit_sscs_set, real_packet);
31195#ifdef FREECIV_JSON_CONNECTION
31196 struct plocation field_addr;
31197 {
31198 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
31199 field_addr = *field_addr_tmp;
31200 FC_FREE(field_addr_tmp);
31201 }
31202#endif /* FREECIV_JSON_CONNECTION */
31203
31204#ifdef FREECIV_DELTA_PROTOCOL
31205#ifdef FREECIV_JSON_CONNECTION
31206 field_addr.name = "fields";
31207#endif /* FREECIV_JSON_CONNECTION */
31208 DIO_BV_GET(&din, &field_addr, fields);
31209
31210#else /* FREECIV_DELTA_PROTOCOL */
31211#ifdef FREECIV_JSON_CONNECTION
31212 field_addr.name = "unit_id";
31213#endif /* FREECIV_JSON_CONNECTION */
31214 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
31215 RECEIVE_PACKET_FIELD_ERROR(unit_id);
31216 }
31217#ifdef FREECIV_JSON_CONNECTION
31218 field_addr.name = "type";
31219#endif /* FREECIV_JSON_CONNECTION */
31220 {
31221 int readin;
31222
31223 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31224 RECEIVE_PACKET_FIELD_ERROR(type);
31225 }
31226 real_packet->type = readin;
31227 }
31228#ifdef FREECIV_JSON_CONNECTION
31229 field_addr.name = "value";
31230#endif /* FREECIV_JSON_CONNECTION */
31231 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
31232 RECEIVE_PACKET_FIELD_ERROR(value);
31233 }
31234#endif
31235 log_packet_detailed("packet_unit_sscs_set_100: got info about ()");
31236
31237#ifdef FREECIV_DELTA_PROTOCOL
31238 if (nullptr == *hash) {
31239 *hash = genhash_new_full(hash_packet_unit_sscs_set_100, cmp_packet_unit_sscs_set_100,
31240 nullptr, nullptr, nullptr, destroy_packet_unit_sscs_set);
31241 }
31242
31243 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31244 *real_packet = *old;
31245 } else {
31246 /* packet is already initialized empty */
31247 log_packet_detailed(" no old info");
31248 }
31249
31250 if (BV_ISSET(fields, 0)) {
31251 log_packet_detailed(" got field 'unit_id'");
31252#ifdef FREECIV_JSON_CONNECTION
31253 field_addr.name = "unit_id";
31254#endif /* FREECIV_JSON_CONNECTION */
31255 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
31256 RECEIVE_PACKET_FIELD_ERROR(unit_id);
31257 }
31258 }
31259 if (BV_ISSET(fields, 1)) {
31260 log_packet_detailed(" got field 'type'");
31261#ifdef FREECIV_JSON_CONNECTION
31262 field_addr.name = "type";
31263#endif /* FREECIV_JSON_CONNECTION */
31264 {
31265 int readin;
31266
31267 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31268 RECEIVE_PACKET_FIELD_ERROR(type);
31269 }
31270 real_packet->type = readin;
31271 }
31272 }
31273 if (BV_ISSET(fields, 2)) {
31274 log_packet_detailed(" got field 'value'");
31275#ifdef FREECIV_JSON_CONNECTION
31276 field_addr.name = "value";
31277#endif /* FREECIV_JSON_CONNECTION */
31278 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
31279 RECEIVE_PACKET_FIELD_ERROR(value);
31280 }
31281 }
31282
31283 if (nullptr == old) {
31284 old = fc_malloc(sizeof(*old));
31285 init_packet_unit_sscs_set(old);
31286 *old = *real_packet;
31287 genhash_insert(*hash, old, old);
31288 } else {
31289 *old = *real_packet;
31290 }
31291
31292#endif /* FREECIV_DELTA_PROTOCOL */
31293 RECEIVE_PACKET_END(real_packet);
31294#undef FREE_PACKET_STRUCT
31295}
31296
31297 static int send_packet_unit_sscs_set_100(struct connection *pc, const struct packet_unit_sscs_set *packet)
31298{
31299 const struct packet_unit_sscs_set *real_packet = packet;
31300 int e;
31301#ifdef FREECIV_DELTA_PROTOCOL
31302 packet_unit_sscs_set_100_fields fields;
31303 struct packet_unit_sscs_set *old;
31304 bool differ;
31305 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SSCS_SET;
31306#endif /* FREECIV_DELTA_PROTOCOL */
31307 SEND_PACKET_START(PACKET_UNIT_SSCS_SET);
31308#ifdef FREECIV_JSON_CONNECTION
31309 struct plocation field_addr;
31310 {
31311 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
31312 field_addr = *field_addr_tmp;
31313 FC_FREE(field_addr_tmp);
31314 }
31315#endif /* FREECIV_JSON_CONNECTION */
31316
31317 log_packet_detailed("packet_unit_sscs_set_100: sending info about ()");
31318
31319#ifdef FREECIV_DELTA_PROTOCOL
31320 if (nullptr == *hash) {
31321 *hash = genhash_new_full(hash_packet_unit_sscs_set_100, cmp_packet_unit_sscs_set_100,
31322 nullptr, nullptr, nullptr, destroy_packet_unit_sscs_set);
31323 }
31324 BV_CLR_ALL(fields);
31325
31326 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31327 old = fc_malloc(sizeof(*old));
31328 /* temporary bitcopy just to insert correctly */
31329 *old = *real_packet;
31330 genhash_insert(*hash, old, old);
31331 init_packet_unit_sscs_set(old);
31332 }
31333 differ = (old->unit_id != real_packet->unit_id);
31334 if (differ) {
31335 BV_SET(fields, 0);
31336 }
31337
31338 differ = (old->type != real_packet->type);
31339 if (differ) {
31340 BV_SET(fields, 1);
31341 }
31342
31343 differ = (old->value != real_packet->value);
31344 if (differ) {
31345 BV_SET(fields, 2);
31346 }
31347
31348
31349#ifdef FREECIV_JSON_CONNECTION
31350 field_addr.name = "fields";
31351#endif /* FREECIV_JSON_CONNECTION */
31352 e = 0;
31353 e |= DIO_BV_PUT(&dout, &field_addr, fields);
31354 if (e) {
31355 log_packet_detailed("fields bitvector error detected");
31356 }
31357
31358 if (BV_ISSET(fields, 0)) {
31359 log_packet_detailed(" field 'unit_id' has changed");
31360#ifdef FREECIV_JSON_CONNECTION
31361 field_addr.name = "unit_id";
31362#endif /* FREECIV_JSON_CONNECTION */
31363 e = 0;
31364 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
31365 if (e) {
31366 log_packet_detailed("'unit_id' field error detected");
31367 }
31368 }
31369 if (BV_ISSET(fields, 1)) {
31370 log_packet_detailed(" field 'type' has changed");
31371#ifdef FREECIV_JSON_CONNECTION
31372 field_addr.name = "type";
31373#endif /* FREECIV_JSON_CONNECTION */
31374 e = 0;
31375 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
31376 if (e) {
31377 log_packet_detailed("'type' field error detected");
31378 }
31379 }
31380 if (BV_ISSET(fields, 2)) {
31381 log_packet_detailed(" field 'value' has changed");
31382#ifdef FREECIV_JSON_CONNECTION
31383 field_addr.name = "value";
31384#endif /* FREECIV_JSON_CONNECTION */
31385 e = 0;
31386 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
31387 if (e) {
31388 log_packet_detailed("'value' field error detected");
31389 }
31390 }
31391
31392 *old = *real_packet;
31393#endif /* FREECIV_DELTA_PROTOCOL */
31394#ifndef FREECIV_DELTA_PROTOCOL
31395#ifdef FREECIV_JSON_CONNECTION
31396 field_addr.name = "unit_id";
31397#endif /* FREECIV_JSON_CONNECTION */
31398 e = 0;
31399 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
31400 if (e) {
31401 log_packet_detailed("'unit_id' field error detected");
31402 }
31403#ifdef FREECIV_JSON_CONNECTION
31404 field_addr.name = "type";
31405#endif /* FREECIV_JSON_CONNECTION */
31406 e = 0;
31407 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
31408 if (e) {
31409 log_packet_detailed("'type' field error detected");
31410 }
31411#ifdef FREECIV_JSON_CONNECTION
31412 field_addr.name = "value";
31413#endif /* FREECIV_JSON_CONNECTION */
31414 e = 0;
31415 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
31416 if (e) {
31417 log_packet_detailed("'value' field error detected");
31418 }
31419
31420#endif
31421 SEND_PACKET_END(PACKET_UNIT_SSCS_SET);
31422}
31423
31424 int send_packet_unit_sscs_set(struct connection *pc, const struct packet_unit_sscs_set *packet)
31425{
31426 if (!pc->used) {
31427 log_error("WARNING: trying to send data to the closed connection %s",
31428 conn_description(pc));
31429 return -1;
31430 }
31431 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SSCS_SET].packet != nullptr, -1,
31432 "Handler for PACKET_UNIT_SSCS_SET not installed");
31433 return pc->phs.handlers->send[PACKET_UNIT_SSCS_SET].packet(pc, packet);
31434}
31435
31436 int dsend_packet_unit_sscs_set(struct connection *pc, int unit_id, enum unit_ss_data_type type, int value)
31437{
31438 struct packet_unit_sscs_set packet, *real_packet = &packet;
31439
31440 real_packet->unit_id = unit_id;
31441 real_packet->type = type;
31442 real_packet->value = value;
31443
31444 return send_packet_unit_sscs_set(pc, real_packet);
31445}
31446
31447 static inline void init_packet_unit_orders(struct packet_unit_orders *packet)
31448{
31449 memset(packet, 0, sizeof(*packet));
31450}
31451
31452#define free_packet_unit_orders(_packet) (void) 0
31453#define destroy_packet_unit_orders free
31454
31455#ifdef FREECIV_DELTA_PROTOCOL
31456#define hash_packet_unit_orders_100 hash_const
31457
31458#define cmp_packet_unit_orders_100 cmp_const
31459
31460 BV_DEFINE(packet_unit_orders_100_fields, 7);
31461#endif /* FREECIV_DELTA_PROTOCOL */
31462
31463 static struct packet_unit_orders *receive_packet_unit_orders_100(struct connection *pc)
31464{
31465#define FREE_PACKET_STRUCT(_packet) free_packet_unit_orders(_packet)
31466#ifdef FREECIV_DELTA_PROTOCOL
31467 packet_unit_orders_100_fields fields;
31468 struct packet_unit_orders *old;
31469 struct genhash **hash = pc->phs.received + PACKET_UNIT_ORDERS;
31470#endif /* FREECIV_DELTA_PROTOCOL */
31471 RECEIVE_PACKET_START(packet_unit_orders, real_packet);
31472#ifdef FREECIV_JSON_CONNECTION
31473 struct plocation field_addr;
31474 {
31475 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
31476 field_addr = *field_addr_tmp;
31477 FC_FREE(field_addr_tmp);
31478 }
31479#endif /* FREECIV_JSON_CONNECTION */
31480
31481#ifdef FREECIV_DELTA_PROTOCOL
31482#ifdef FREECIV_JSON_CONNECTION
31483 field_addr.name = "fields";
31484#endif /* FREECIV_JSON_CONNECTION */
31485 DIO_BV_GET(&din, &field_addr, fields);
31486
31487#else /* FREECIV_DELTA_PROTOCOL */
31488#ifdef FREECIV_JSON_CONNECTION
31489 field_addr.name = "unit_id";
31490#endif /* FREECIV_JSON_CONNECTION */
31491 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
31492 RECEIVE_PACKET_FIELD_ERROR(unit_id);
31493 }
31494#ifdef FREECIV_JSON_CONNECTION
31495 field_addr.name = "src_tile";
31496#endif /* FREECIV_JSON_CONNECTION */
31497 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
31498 RECEIVE_PACKET_FIELD_ERROR(src_tile);
31499 }
31500#ifdef FREECIV_JSON_CONNECTION
31501 field_addr.name = "length";
31502#endif /* FREECIV_JSON_CONNECTION */
31503 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
31504 RECEIVE_PACKET_FIELD_ERROR(length);
31505 }
31506#ifdef FREECIV_JSON_CONNECTION
31507 field_addr.name = "repeat";
31508#endif /* FREECIV_JSON_CONNECTION */
31509 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->repeat)) {
31510 RECEIVE_PACKET_FIELD_ERROR(repeat);
31511 }
31512#ifdef FREECIV_JSON_CONNECTION
31513 field_addr.name = "vigilant";
31514#endif /* FREECIV_JSON_CONNECTION */
31515 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
31516 RECEIVE_PACKET_FIELD_ERROR(vigilant);
31517 }
31518#ifdef FREECIV_JSON_CONNECTION
31519 field_addr.name = "orders";
31520#endif /* FREECIV_JSON_CONNECTION */
31521 {
31522 int i;
31523
31524#ifdef FREECIV_JSON_CONNECTION
31525 /* Enter array. */
31526 field_addr.sub_location = plocation_elem_new(0);
31527#endif /* FREECIV_JSON_CONNECTION */
31528
31529 if (real_packet->length > MAX_LEN_ROUTE) {
31530 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
31531 }
31532 for (i = 0; i < real_packet->length; i++) {
31533#ifdef FREECIV_JSON_CONNECTION
31534 field_addr.sub_location->number = i;
31535#endif /* FREECIV_JSON_CONNECTION */
31536 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
31537 RECEIVE_PACKET_FIELD_ERROR(orders);
31538 }
31539 }
31540
31541#ifdef FREECIV_JSON_CONNECTION
31542 /* Exit array. */
31543 FC_FREE(field_addr.sub_location);
31544#endif /* FREECIV_JSON_CONNECTION */
31545 }
31546#ifdef FREECIV_JSON_CONNECTION
31547 field_addr.name = "dest_tile";
31548#endif /* FREECIV_JSON_CONNECTION */
31549 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
31550 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
31551 }
31552#endif
31553 log_packet_detailed("packet_unit_orders_100: got info about ()");
31554
31555#ifdef FREECIV_DELTA_PROTOCOL
31556 if (nullptr == *hash) {
31557 *hash = genhash_new_full(hash_packet_unit_orders_100, cmp_packet_unit_orders_100,
31558 nullptr, nullptr, nullptr, destroy_packet_unit_orders);
31559 }
31560
31561 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31562 *real_packet = *old;
31563 } else {
31564 /* packet is already initialized empty */
31565 log_packet_detailed(" no old info");
31566 }
31567
31568 if (BV_ISSET(fields, 0)) {
31569 log_packet_detailed(" got field 'unit_id'");
31570#ifdef FREECIV_JSON_CONNECTION
31571 field_addr.name = "unit_id";
31572#endif /* FREECIV_JSON_CONNECTION */
31573 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
31574 RECEIVE_PACKET_FIELD_ERROR(unit_id);
31575 }
31576 }
31577 if (BV_ISSET(fields, 1)) {
31578 log_packet_detailed(" got field 'src_tile'");
31579#ifdef FREECIV_JSON_CONNECTION
31580 field_addr.name = "src_tile";
31581#endif /* FREECIV_JSON_CONNECTION */
31582 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
31583 RECEIVE_PACKET_FIELD_ERROR(src_tile);
31584 }
31585 }
31586 if (BV_ISSET(fields, 2)) {
31587 log_packet_detailed(" got field 'length'");
31588#ifdef FREECIV_JSON_CONNECTION
31589 field_addr.name = "length";
31590#endif /* FREECIV_JSON_CONNECTION */
31591 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
31592 RECEIVE_PACKET_FIELD_ERROR(length);
31593 }
31594 }
31595 real_packet->repeat = BV_ISSET(fields, 3);
31596 real_packet->vigilant = BV_ISSET(fields, 4);
31597 if (BV_ISSET(fields, 5)) {
31598 log_packet_detailed(" got field 'orders'");
31599#ifdef FREECIV_JSON_CONNECTION
31600 field_addr.name = "orders";
31601#endif /* FREECIV_JSON_CONNECTION */
31602 {
31603 int i;
31604
31605#ifdef FREECIV_JSON_CONNECTION
31606 /* Enter array. */
31607 field_addr.sub_location = plocation_elem_new(0);
31608#endif /* FREECIV_JSON_CONNECTION */
31609
31610 if (real_packet->length > MAX_LEN_ROUTE) {
31611 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
31612 }
31613 for (i = 0; i < real_packet->length; i++) {
31614#ifdef FREECIV_JSON_CONNECTION
31615 field_addr.sub_location->number = i;
31616#endif /* FREECIV_JSON_CONNECTION */
31617 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
31618 RECEIVE_PACKET_FIELD_ERROR(orders);
31619 }
31620 }
31621
31622#ifdef FREECIV_JSON_CONNECTION
31623 /* Exit array. */
31624 FC_FREE(field_addr.sub_location);
31625#endif /* FREECIV_JSON_CONNECTION */
31626 }
31627 }
31628 if (BV_ISSET(fields, 6)) {
31629 log_packet_detailed(" got field 'dest_tile'");
31630#ifdef FREECIV_JSON_CONNECTION
31631 field_addr.name = "dest_tile";
31632#endif /* FREECIV_JSON_CONNECTION */
31633 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
31634 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
31635 }
31636 }
31637
31638 if (nullptr == old) {
31639 old = fc_malloc(sizeof(*old));
31640 init_packet_unit_orders(old);
31641 *old = *real_packet;
31642 genhash_insert(*hash, old, old);
31643 } else {
31644 *old = *real_packet;
31645 }
31646
31647#endif /* FREECIV_DELTA_PROTOCOL */
31648 RECEIVE_PACKET_END(real_packet);
31649#undef FREE_PACKET_STRUCT
31650}
31651
31652 static int send_packet_unit_orders_100(struct connection *pc, const struct packet_unit_orders *packet)
31653{
31654 const struct packet_unit_orders *real_packet = packet;
31655 int e;
31656#ifdef FREECIV_DELTA_PROTOCOL
31657 packet_unit_orders_100_fields fields;
31658 struct packet_unit_orders *old;
31659 bool differ;
31660 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ORDERS;
31661#endif /* FREECIV_DELTA_PROTOCOL */
31662 SEND_PACKET_START(PACKET_UNIT_ORDERS);
31663#ifdef FREECIV_JSON_CONNECTION
31664 struct plocation field_addr;
31665 {
31666 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
31667 field_addr = *field_addr_tmp;
31668 FC_FREE(field_addr_tmp);
31669 }
31670#endif /* FREECIV_JSON_CONNECTION */
31671
31672 log_packet_detailed("packet_unit_orders_100: sending info about ()");
31673
31674#ifdef FREECIV_DELTA_PROTOCOL
31675 if (nullptr == *hash) {
31676 *hash = genhash_new_full(hash_packet_unit_orders_100, cmp_packet_unit_orders_100,
31677 nullptr, nullptr, nullptr, destroy_packet_unit_orders);
31678 }
31679 BV_CLR_ALL(fields);
31680
31681 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31682 old = fc_malloc(sizeof(*old));
31683 /* temporary bitcopy just to insert correctly */
31684 *old = *real_packet;
31685 genhash_insert(*hash, old, old);
31686 init_packet_unit_orders(old);
31687 }
31688 differ = (old->unit_id != real_packet->unit_id);
31689 if (differ) {
31690 BV_SET(fields, 0);
31691 }
31692
31693 differ = (old->src_tile != real_packet->src_tile);
31694 if (differ) {
31695 BV_SET(fields, 1);
31696 }
31697
31698 differ = (old->length != real_packet->length);
31699 if (differ) {
31700 BV_SET(fields, 2);
31701 }
31702
31703 if (packet->repeat) {
31704 BV_SET(fields, 3);
31705 }
31706
31707 if (packet->vigilant) {
31708 BV_SET(fields, 4);
31709 }
31710
31711 differ = (old->length != real_packet->length);
31712 if (!differ) {
31713 int i;
31714
31715 for (i = 0; i < real_packet->length; i++) {
31716 differ = !are_unit_orders_equal(&old->orders[i], &real_packet->orders[i]);
31717 if (differ) {
31718 break;
31719 }
31720 }
31721 }
31722 if (differ) {
31723 BV_SET(fields, 5);
31724 }
31725
31726 differ = (old->dest_tile != real_packet->dest_tile);
31727 if (differ) {
31728 BV_SET(fields, 6);
31729 }
31730
31731
31732#ifdef FREECIV_JSON_CONNECTION
31733 field_addr.name = "fields";
31734#endif /* FREECIV_JSON_CONNECTION */
31735 e = 0;
31736 e |= DIO_BV_PUT(&dout, &field_addr, fields);
31737 if (e) {
31738 log_packet_detailed("fields bitvector error detected");
31739 }
31740
31741 if (BV_ISSET(fields, 0)) {
31742 log_packet_detailed(" field 'unit_id' has changed");
31743#ifdef FREECIV_JSON_CONNECTION
31744 field_addr.name = "unit_id";
31745#endif /* FREECIV_JSON_CONNECTION */
31746 e = 0;
31747 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
31748 if (e) {
31749 log_packet_detailed("'unit_id' field error detected");
31750 }
31751 }
31752 if (BV_ISSET(fields, 1)) {
31753 log_packet_detailed(" field 'src_tile' has changed");
31754#ifdef FREECIV_JSON_CONNECTION
31755 field_addr.name = "src_tile";
31756#endif /* FREECIV_JSON_CONNECTION */
31757 e = 0;
31758 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
31759 if (e) {
31760 log_packet_detailed("'src_tile' field error detected");
31761 }
31762 }
31763 if (BV_ISSET(fields, 2)) {
31764 log_packet_detailed(" field 'length' has changed");
31765#ifdef FREECIV_JSON_CONNECTION
31766 field_addr.name = "length";
31767#endif /* FREECIV_JSON_CONNECTION */
31768 e = 0;
31769 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
31770 if (e) {
31771 log_packet_detailed("'length' field error detected");
31772 }
31773 }
31774 /* field 3 is folded into the header */
31775 /* field 4 is folded into the header */
31776 if (BV_ISSET(fields, 5)) {
31777 log_packet_detailed(" field 'orders' has changed");
31778#ifdef FREECIV_JSON_CONNECTION
31779 field_addr.name = "orders";
31780#endif /* FREECIV_JSON_CONNECTION */
31781 e = 0;
31782 {
31783 int i;
31784
31785#ifdef FREECIV_JSON_CONNECTION
31786 /* Create the array. */
31787 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
31788
31789 /* Enter the array. */
31790 field_addr.sub_location = plocation_elem_new(0);
31791#endif /* FREECIV_JSON_CONNECTION */
31792
31793 for (i = 0; i < real_packet->length; i++) {
31794#ifdef FREECIV_JSON_CONNECTION
31795 /* Next array element. */
31796 field_addr.sub_location->number = i;
31797#endif /* FREECIV_JSON_CONNECTION */
31798 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
31799 }
31800
31801#ifdef FREECIV_JSON_CONNECTION
31802 /* Exit array. */
31803 FC_FREE(field_addr.sub_location);
31804#endif /* FREECIV_JSON_CONNECTION */
31805 }
31806 if (e) {
31807 log_packet_detailed("'orders' field error detected");
31808 }
31809 }
31810 if (BV_ISSET(fields, 6)) {
31811 log_packet_detailed(" field 'dest_tile' has changed");
31812#ifdef FREECIV_JSON_CONNECTION
31813 field_addr.name = "dest_tile";
31814#endif /* FREECIV_JSON_CONNECTION */
31815 e = 0;
31816 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
31817 if (e) {
31818 log_packet_detailed("'dest_tile' field error detected");
31819 }
31820 }
31821
31822 *old = *real_packet;
31823#endif /* FREECIV_DELTA_PROTOCOL */
31824#ifndef FREECIV_DELTA_PROTOCOL
31825#ifdef FREECIV_JSON_CONNECTION
31826 field_addr.name = "unit_id";
31827#endif /* FREECIV_JSON_CONNECTION */
31828 e = 0;
31829 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
31830 if (e) {
31831 log_packet_detailed("'unit_id' field error detected");
31832 }
31833#ifdef FREECIV_JSON_CONNECTION
31834 field_addr.name = "src_tile";
31835#endif /* FREECIV_JSON_CONNECTION */
31836 e = 0;
31837 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
31838 if (e) {
31839 log_packet_detailed("'src_tile' field error detected");
31840 }
31841#ifdef FREECIV_JSON_CONNECTION
31842 field_addr.name = "length";
31843#endif /* FREECIV_JSON_CONNECTION */
31844 e = 0;
31845 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
31846 if (e) {
31847 log_packet_detailed("'length' field error detected");
31848 }
31849#ifdef FREECIV_JSON_CONNECTION
31850 field_addr.name = "repeat";
31851#endif /* FREECIV_JSON_CONNECTION */
31852 e = 0;
31853 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->repeat);
31854 if (e) {
31855 log_packet_detailed("'repeat' field error detected");
31856 }
31857#ifdef FREECIV_JSON_CONNECTION
31858 field_addr.name = "vigilant";
31859#endif /* FREECIV_JSON_CONNECTION */
31860 e = 0;
31861 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
31862 if (e) {
31863 log_packet_detailed("'vigilant' field error detected");
31864 }
31865#ifdef FREECIV_JSON_CONNECTION
31866 field_addr.name = "orders";
31867#endif /* FREECIV_JSON_CONNECTION */
31868 e = 0;
31869 {
31870 int i;
31871
31872#ifdef FREECIV_JSON_CONNECTION
31873 /* Create the array. */
31874 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
31875
31876 /* Enter the array. */
31877 field_addr.sub_location = plocation_elem_new(0);
31878#endif /* FREECIV_JSON_CONNECTION */
31879
31880 for (i = 0; i < real_packet->length; i++) {
31881#ifdef FREECIV_JSON_CONNECTION
31882 /* Next array element. */
31883 field_addr.sub_location->number = i;
31884#endif /* FREECIV_JSON_CONNECTION */
31885 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
31886 }
31887
31888#ifdef FREECIV_JSON_CONNECTION
31889 /* Exit array. */
31890 FC_FREE(field_addr.sub_location);
31891#endif /* FREECIV_JSON_CONNECTION */
31892 }
31893 if (e) {
31894 log_packet_detailed("'orders' field error detected");
31895 }
31896#ifdef FREECIV_JSON_CONNECTION
31897 field_addr.name = "dest_tile";
31898#endif /* FREECIV_JSON_CONNECTION */
31899 e = 0;
31900 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
31901 if (e) {
31902 log_packet_detailed("'dest_tile' field error detected");
31903 }
31904
31905#endif
31906 SEND_PACKET_END(PACKET_UNIT_ORDERS);
31907}
31908
31909 int send_packet_unit_orders(struct connection *pc, const struct packet_unit_orders *packet)
31910{
31911 if (!pc->used) {
31912 log_error("WARNING: trying to send data to the closed connection %s",
31913 conn_description(pc));
31914 return -1;
31915 }
31916 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ORDERS].packet != nullptr, -1,
31917 "Handler for PACKET_UNIT_ORDERS not installed");
31918 return pc->phs.handlers->send[PACKET_UNIT_ORDERS].packet(pc, packet);
31919}
31920
31921 static inline void init_packet_unit_server_side_agent_set(struct packet_unit_server_side_agent_set *packet)
31922{
31923 memset(packet, 0, sizeof(*packet));
31924}
31925
31926#define free_packet_unit_server_side_agent_set(_packet) (void) 0
31927#define destroy_packet_unit_server_side_agent_set free
31928
31929#ifdef FREECIV_DELTA_PROTOCOL
31930#define hash_packet_unit_server_side_agent_set_100 hash_const
31931
31932#define cmp_packet_unit_server_side_agent_set_100 cmp_const
31933
31934 BV_DEFINE(packet_unit_server_side_agent_set_100_fields, 2);
31935#endif /* FREECIV_DELTA_PROTOCOL */
31936
31937 static struct packet_unit_server_side_agent_set *receive_packet_unit_server_side_agent_set_100(struct connection *pc)
31938{
31939#define FREE_PACKET_STRUCT(_packet) free_packet_unit_server_side_agent_set(_packet)
31940#ifdef FREECIV_DELTA_PROTOCOL
31941 packet_unit_server_side_agent_set_100_fields fields;
31942 struct packet_unit_server_side_agent_set *old;
31943 struct genhash **hash = pc->phs.received + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
31944#endif /* FREECIV_DELTA_PROTOCOL */
31945 RECEIVE_PACKET_START(packet_unit_server_side_agent_set, real_packet);
31946#ifdef FREECIV_JSON_CONNECTION
31947 struct plocation field_addr;
31948 {
31949 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
31950 field_addr = *field_addr_tmp;
31951 FC_FREE(field_addr_tmp);
31952 }
31953#endif /* FREECIV_JSON_CONNECTION */
31954
31955#ifdef FREECIV_DELTA_PROTOCOL
31956#ifdef FREECIV_JSON_CONNECTION
31957 field_addr.name = "fields";
31958#endif /* FREECIV_JSON_CONNECTION */
31959 DIO_BV_GET(&din, &field_addr, fields);
31960
31961#else /* FREECIV_DELTA_PROTOCOL */
31962#ifdef FREECIV_JSON_CONNECTION
31963 field_addr.name = "unit_id";
31964#endif /* FREECIV_JSON_CONNECTION */
31965 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
31966 RECEIVE_PACKET_FIELD_ERROR(unit_id);
31967 }
31968#ifdef FREECIV_JSON_CONNECTION
31969 field_addr.name = "agent";
31970#endif /* FREECIV_JSON_CONNECTION */
31971 {
31972 int readin;
31973
31974 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31975 RECEIVE_PACKET_FIELD_ERROR(agent);
31976 }
31977 real_packet->agent = readin;
31978 }
31979#endif
31980 log_packet_detailed("packet_unit_server_side_agent_set_100: got info about ()");
31981
31982#ifdef FREECIV_DELTA_PROTOCOL
31983 if (nullptr == *hash) {
31984 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_100, cmp_packet_unit_server_side_agent_set_100,
31985 nullptr, nullptr, nullptr, destroy_packet_unit_server_side_agent_set);
31986 }
31987
31988 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31989 *real_packet = *old;
31990 } else {
31991 /* packet is already initialized empty */
31992 log_packet_detailed(" no old info");
31993 }
31994
31995 if (BV_ISSET(fields, 0)) {
31996 log_packet_detailed(" got field 'unit_id'");
31997#ifdef FREECIV_JSON_CONNECTION
31998 field_addr.name = "unit_id";
31999#endif /* FREECIV_JSON_CONNECTION */
32000 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
32001 RECEIVE_PACKET_FIELD_ERROR(unit_id);
32002 }
32003 }
32004 if (BV_ISSET(fields, 1)) {
32005 log_packet_detailed(" got field 'agent'");
32006#ifdef FREECIV_JSON_CONNECTION
32007 field_addr.name = "agent";
32008#endif /* FREECIV_JSON_CONNECTION */
32009 {
32010 int readin;
32011
32012 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32013 RECEIVE_PACKET_FIELD_ERROR(agent);
32014 }
32015 real_packet->agent = readin;
32016 }
32017 }
32018
32019 if (nullptr == old) {
32020 old = fc_malloc(sizeof(*old));
32021 init_packet_unit_server_side_agent_set(old);
32022 *old = *real_packet;
32023 genhash_insert(*hash, old, old);
32024 } else {
32025 *old = *real_packet;
32026 }
32027
32028#endif /* FREECIV_DELTA_PROTOCOL */
32029 RECEIVE_PACKET_END(real_packet);
32030#undef FREE_PACKET_STRUCT
32031}
32032
32033 static int send_packet_unit_server_side_agent_set_100(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
32034{
32035 const struct packet_unit_server_side_agent_set *real_packet = packet;
32036 int e;
32037#ifdef FREECIV_DELTA_PROTOCOL
32038 packet_unit_server_side_agent_set_100_fields fields;
32039 struct packet_unit_server_side_agent_set *old;
32040 bool differ;
32041 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
32042#endif /* FREECIV_DELTA_PROTOCOL */
32043 SEND_PACKET_START(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
32044#ifdef FREECIV_JSON_CONNECTION
32045 struct plocation field_addr;
32046 {
32047 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
32048 field_addr = *field_addr_tmp;
32049 FC_FREE(field_addr_tmp);
32050 }
32051#endif /* FREECIV_JSON_CONNECTION */
32052
32053 log_packet_detailed("packet_unit_server_side_agent_set_100: sending info about ()");
32054
32055#ifdef FREECIV_DELTA_PROTOCOL
32056 if (nullptr == *hash) {
32057 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_100, cmp_packet_unit_server_side_agent_set_100,
32058 nullptr, nullptr, nullptr, destroy_packet_unit_server_side_agent_set);
32059 }
32060 BV_CLR_ALL(fields);
32061
32062 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32063 old = fc_malloc(sizeof(*old));
32064 /* temporary bitcopy just to insert correctly */
32065 *old = *real_packet;
32066 genhash_insert(*hash, old, old);
32067 init_packet_unit_server_side_agent_set(old);
32068 }
32069 differ = (old->unit_id != real_packet->unit_id);
32070 if (differ) {
32071 BV_SET(fields, 0);
32072 }
32073
32074 differ = (old->agent != real_packet->agent);
32075 if (differ) {
32076 BV_SET(fields, 1);
32077 }
32078
32079
32080#ifdef FREECIV_JSON_CONNECTION
32081 field_addr.name = "fields";
32082#endif /* FREECIV_JSON_CONNECTION */
32083 e = 0;
32084 e |= DIO_BV_PUT(&dout, &field_addr, fields);
32085 if (e) {
32086 log_packet_detailed("fields bitvector error detected");
32087 }
32088
32089 if (BV_ISSET(fields, 0)) {
32090 log_packet_detailed(" field 'unit_id' has changed");
32091#ifdef FREECIV_JSON_CONNECTION
32092 field_addr.name = "unit_id";
32093#endif /* FREECIV_JSON_CONNECTION */
32094 e = 0;
32095 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
32096 if (e) {
32097 log_packet_detailed("'unit_id' field error detected");
32098 }
32099 }
32100 if (BV_ISSET(fields, 1)) {
32101 log_packet_detailed(" field 'agent' has changed");
32102#ifdef FREECIV_JSON_CONNECTION
32103 field_addr.name = "agent";
32104#endif /* FREECIV_JSON_CONNECTION */
32105 e = 0;
32106 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
32107 if (e) {
32108 log_packet_detailed("'agent' field error detected");
32109 }
32110 }
32111
32112 *old = *real_packet;
32113#endif /* FREECIV_DELTA_PROTOCOL */
32114#ifndef FREECIV_DELTA_PROTOCOL
32115#ifdef FREECIV_JSON_CONNECTION
32116 field_addr.name = "unit_id";
32117#endif /* FREECIV_JSON_CONNECTION */
32118 e = 0;
32119 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
32120 if (e) {
32121 log_packet_detailed("'unit_id' field error detected");
32122 }
32123#ifdef FREECIV_JSON_CONNECTION
32124 field_addr.name = "agent";
32125#endif /* FREECIV_JSON_CONNECTION */
32126 e = 0;
32127 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
32128 if (e) {
32129 log_packet_detailed("'agent' field error detected");
32130 }
32131
32132#endif
32133 SEND_PACKET_END(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
32134}
32135
32136 int send_packet_unit_server_side_agent_set(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
32137{
32138 if (!pc->used) {
32139 log_error("WARNING: trying to send data to the closed connection %s",
32140 conn_description(pc));
32141 return -1;
32142 }
32143 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet != nullptr, -1,
32144 "Handler for PACKET_UNIT_SERVER_SIDE_AGENT_SET not installed");
32145 return pc->phs.handlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet(pc, packet);
32146}
32147
32148 int dsend_packet_unit_server_side_agent_set(struct connection *pc, int unit_id, enum server_side_agent agent)
32149{
32150 struct packet_unit_server_side_agent_set packet, *real_packet = &packet;
32151
32152 real_packet->unit_id = unit_id;
32153 real_packet->agent = agent;
32154
32155 return send_packet_unit_server_side_agent_set(pc, real_packet);
32156}
32157
32158 static inline void init_packet_unit_action_query(struct packet_unit_action_query *packet)
32159{
32160 memset(packet, 0, sizeof(*packet));
32161}
32162
32163#define free_packet_unit_action_query(_packet) (void) 0
32164#define destroy_packet_unit_action_query free
32165
32166#ifdef FREECIV_DELTA_PROTOCOL
32167#define hash_packet_unit_action_query_100 hash_const
32168
32169#define cmp_packet_unit_action_query_100 cmp_const
32170
32171 BV_DEFINE(packet_unit_action_query_100_fields, 4);
32172#endif /* FREECIV_DELTA_PROTOCOL */
32173
32174 static struct packet_unit_action_query *receive_packet_unit_action_query_100(struct connection *pc)
32175{
32176#define FREE_PACKET_STRUCT(_packet) free_packet_unit_action_query(_packet)
32177#ifdef FREECIV_DELTA_PROTOCOL
32178 packet_unit_action_query_100_fields fields;
32179 struct packet_unit_action_query *old;
32180 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_QUERY;
32181#endif /* FREECIV_DELTA_PROTOCOL */
32182 RECEIVE_PACKET_START(packet_unit_action_query, real_packet);
32183#ifdef FREECIV_JSON_CONNECTION
32184 struct plocation field_addr;
32185 {
32186 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
32187 field_addr = *field_addr_tmp;
32188 FC_FREE(field_addr_tmp);
32189 }
32190#endif /* FREECIV_JSON_CONNECTION */
32191
32192#ifdef FREECIV_DELTA_PROTOCOL
32193#ifdef FREECIV_JSON_CONNECTION
32194 field_addr.name = "fields";
32195#endif /* FREECIV_JSON_CONNECTION */
32196 DIO_BV_GET(&din, &field_addr, fields);
32197
32198#else /* FREECIV_DELTA_PROTOCOL */
32199#ifdef FREECIV_JSON_CONNECTION
32200 field_addr.name = "actor_id";
32201#endif /* FREECIV_JSON_CONNECTION */
32202 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
32203 RECEIVE_PACKET_FIELD_ERROR(actor_id);
32204 }
32205#ifdef FREECIV_JSON_CONNECTION
32206 field_addr.name = "target_id";
32207#endif /* FREECIV_JSON_CONNECTION */
32208 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
32209 RECEIVE_PACKET_FIELD_ERROR(target_id);
32210 }
32211#ifdef FREECIV_JSON_CONNECTION
32212 field_addr.name = "action_type";
32213#endif /* FREECIV_JSON_CONNECTION */
32214 {
32215 int readin;
32216
32217 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32218 RECEIVE_PACKET_FIELD_ERROR(action_type);
32219 }
32220 real_packet->action_type = readin;
32221 }
32222#ifdef FREECIV_JSON_CONNECTION
32223 field_addr.name = "request_kind";
32224#endif /* FREECIV_JSON_CONNECTION */
32225 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
32226 RECEIVE_PACKET_FIELD_ERROR(request_kind);
32227 }
32228#endif
32229 log_packet_detailed("packet_unit_action_query_100: got info about ()");
32230
32231#ifdef FREECIV_DELTA_PROTOCOL
32232 if (nullptr == *hash) {
32233 *hash = genhash_new_full(hash_packet_unit_action_query_100, cmp_packet_unit_action_query_100,
32234 nullptr, nullptr, nullptr, destroy_packet_unit_action_query);
32235 }
32236
32237 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32238 *real_packet = *old;
32239 } else {
32240 /* packet is already initialized empty */
32241 log_packet_detailed(" no old info");
32242 }
32243
32244 if (BV_ISSET(fields, 0)) {
32245 log_packet_detailed(" got field 'actor_id'");
32246#ifdef FREECIV_JSON_CONNECTION
32247 field_addr.name = "actor_id";
32248#endif /* FREECIV_JSON_CONNECTION */
32249 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
32250 RECEIVE_PACKET_FIELD_ERROR(actor_id);
32251 }
32252 }
32253 if (BV_ISSET(fields, 1)) {
32254 log_packet_detailed(" got field 'target_id'");
32255#ifdef FREECIV_JSON_CONNECTION
32256 field_addr.name = "target_id";
32257#endif /* FREECIV_JSON_CONNECTION */
32258 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
32259 RECEIVE_PACKET_FIELD_ERROR(target_id);
32260 }
32261 }
32262 if (BV_ISSET(fields, 2)) {
32263 log_packet_detailed(" got field 'action_type'");
32264#ifdef FREECIV_JSON_CONNECTION
32265 field_addr.name = "action_type";
32266#endif /* FREECIV_JSON_CONNECTION */
32267 {
32268 int readin;
32269
32270 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32271 RECEIVE_PACKET_FIELD_ERROR(action_type);
32272 }
32273 real_packet->action_type = readin;
32274 }
32275 }
32276 if (BV_ISSET(fields, 3)) {
32277 log_packet_detailed(" got field 'request_kind'");
32278#ifdef FREECIV_JSON_CONNECTION
32279 field_addr.name = "request_kind";
32280#endif /* FREECIV_JSON_CONNECTION */
32281 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
32282 RECEIVE_PACKET_FIELD_ERROR(request_kind);
32283 }
32284 }
32285
32286 if (nullptr == old) {
32287 old = fc_malloc(sizeof(*old));
32288 init_packet_unit_action_query(old);
32289 *old = *real_packet;
32290 genhash_insert(*hash, old, old);
32291 } else {
32292 *old = *real_packet;
32293 }
32294
32295#endif /* FREECIV_DELTA_PROTOCOL */
32296 RECEIVE_PACKET_END(real_packet);
32297#undef FREE_PACKET_STRUCT
32298}
32299
32300 static int send_packet_unit_action_query_100(struct connection *pc, const struct packet_unit_action_query *packet)
32301{
32302 const struct packet_unit_action_query *real_packet = packet;
32303 int e;
32304#ifdef FREECIV_DELTA_PROTOCOL
32305 packet_unit_action_query_100_fields fields;
32306 struct packet_unit_action_query *old;
32307 bool differ;
32308 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_QUERY;
32309#endif /* FREECIV_DELTA_PROTOCOL */
32310 SEND_PACKET_START(PACKET_UNIT_ACTION_QUERY);
32311#ifdef FREECIV_JSON_CONNECTION
32312 struct plocation field_addr;
32313 {
32314 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
32315 field_addr = *field_addr_tmp;
32316 FC_FREE(field_addr_tmp);
32317 }
32318#endif /* FREECIV_JSON_CONNECTION */
32319
32320 log_packet_detailed("packet_unit_action_query_100: sending info about ()");
32321
32322#ifdef FREECIV_DELTA_PROTOCOL
32323 if (nullptr == *hash) {
32324 *hash = genhash_new_full(hash_packet_unit_action_query_100, cmp_packet_unit_action_query_100,
32325 nullptr, nullptr, nullptr, destroy_packet_unit_action_query);
32326 }
32327 BV_CLR_ALL(fields);
32328
32329 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32330 old = fc_malloc(sizeof(*old));
32331 /* temporary bitcopy just to insert correctly */
32332 *old = *real_packet;
32333 genhash_insert(*hash, old, old);
32334 init_packet_unit_action_query(old);
32335 }
32336 differ = (old->actor_id != real_packet->actor_id);
32337 if (differ) {
32338 BV_SET(fields, 0);
32339 }
32340
32341 differ = (old->target_id != real_packet->target_id);
32342 if (differ) {
32343 BV_SET(fields, 1);
32344 }
32345
32346 differ = (old->action_type != real_packet->action_type);
32347 if (differ) {
32348 BV_SET(fields, 2);
32349 }
32350
32351 differ = (old->request_kind != real_packet->request_kind);
32352 if (differ) {
32353 BV_SET(fields, 3);
32354 }
32355
32356
32357#ifdef FREECIV_JSON_CONNECTION
32358 field_addr.name = "fields";
32359#endif /* FREECIV_JSON_CONNECTION */
32360 e = 0;
32361 e |= DIO_BV_PUT(&dout, &field_addr, fields);
32362 if (e) {
32363 log_packet_detailed("fields bitvector error detected");
32364 }
32365
32366 if (BV_ISSET(fields, 0)) {
32367 log_packet_detailed(" field 'actor_id' has changed");
32368#ifdef FREECIV_JSON_CONNECTION
32369 field_addr.name = "actor_id";
32370#endif /* FREECIV_JSON_CONNECTION */
32371 e = 0;
32372 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32373 if (e) {
32374 log_packet_detailed("'actor_id' field error detected");
32375 }
32376 }
32377 if (BV_ISSET(fields, 1)) {
32378 log_packet_detailed(" field 'target_id' has changed");
32379#ifdef FREECIV_JSON_CONNECTION
32380 field_addr.name = "target_id";
32381#endif /* FREECIV_JSON_CONNECTION */
32382 e = 0;
32383 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32384 if (e) {
32385 log_packet_detailed("'target_id' field error detected");
32386 }
32387 }
32388 if (BV_ISSET(fields, 2)) {
32389 log_packet_detailed(" field 'action_type' has changed");
32390#ifdef FREECIV_JSON_CONNECTION
32391 field_addr.name = "action_type";
32392#endif /* FREECIV_JSON_CONNECTION */
32393 e = 0;
32394 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32395 if (e) {
32396 log_packet_detailed("'action_type' field error detected");
32397 }
32398 }
32399 if (BV_ISSET(fields, 3)) {
32400 log_packet_detailed(" field 'request_kind' has changed");
32401#ifdef FREECIV_JSON_CONNECTION
32402 field_addr.name = "request_kind";
32403#endif /* FREECIV_JSON_CONNECTION */
32404 e = 0;
32405 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
32406 if (e) {
32407 log_packet_detailed("'request_kind' field error detected");
32408 }
32409 }
32410
32411 *old = *real_packet;
32412#endif /* FREECIV_DELTA_PROTOCOL */
32413#ifndef FREECIV_DELTA_PROTOCOL
32414#ifdef FREECIV_JSON_CONNECTION
32415 field_addr.name = "actor_id";
32416#endif /* FREECIV_JSON_CONNECTION */
32417 e = 0;
32418 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32419 if (e) {
32420 log_packet_detailed("'actor_id' field error detected");
32421 }
32422#ifdef FREECIV_JSON_CONNECTION
32423 field_addr.name = "target_id";
32424#endif /* FREECIV_JSON_CONNECTION */
32425 e = 0;
32426 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32427 if (e) {
32428 log_packet_detailed("'target_id' field error detected");
32429 }
32430#ifdef FREECIV_JSON_CONNECTION
32431 field_addr.name = "action_type";
32432#endif /* FREECIV_JSON_CONNECTION */
32433 e = 0;
32434 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32435 if (e) {
32436 log_packet_detailed("'action_type' field error detected");
32437 }
32438#ifdef FREECIV_JSON_CONNECTION
32439 field_addr.name = "request_kind";
32440#endif /* FREECIV_JSON_CONNECTION */
32441 e = 0;
32442 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
32443 if (e) {
32444 log_packet_detailed("'request_kind' field error detected");
32445 }
32446
32447#endif
32448 SEND_PACKET_END(PACKET_UNIT_ACTION_QUERY);
32449}
32450
32451 int send_packet_unit_action_query(struct connection *pc, const struct packet_unit_action_query *packet)
32452{
32453 if (!pc->used) {
32454 log_error("WARNING: trying to send data to the closed connection %s",
32455 conn_description(pc));
32456 return -1;
32457 }
32458 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTION_QUERY].packet != nullptr, -1,
32459 "Handler for PACKET_UNIT_ACTION_QUERY not installed");
32460 return pc->phs.handlers->send[PACKET_UNIT_ACTION_QUERY].packet(pc, packet);
32461}
32462
32463 int dsend_packet_unit_action_query(struct connection *pc, int actor_id, int target_id, action_id action_type, int request_kind)
32464{
32465 struct packet_unit_action_query packet, *real_packet = &packet;
32466
32467 real_packet->actor_id = actor_id;
32468 real_packet->target_id = target_id;
32469 real_packet->action_type = action_type;
32470 real_packet->request_kind = request_kind;
32471
32472 return send_packet_unit_action_query(pc, real_packet);
32473}
32474
32475 static inline void init_packet_unit_type_upgrade(struct packet_unit_type_upgrade *packet)
32476{
32477 memset(packet, 0, sizeof(*packet));
32478}
32479
32480#define free_packet_unit_type_upgrade(_packet) (void) 0
32481#define destroy_packet_unit_type_upgrade free
32482
32483#ifdef FREECIV_DELTA_PROTOCOL
32484#define hash_packet_unit_type_upgrade_100 hash_const
32485
32486#define cmp_packet_unit_type_upgrade_100 cmp_const
32487
32488 BV_DEFINE(packet_unit_type_upgrade_100_fields, 1);
32489#endif /* FREECIV_DELTA_PROTOCOL */
32490
32491 static struct packet_unit_type_upgrade *receive_packet_unit_type_upgrade_100(struct connection *pc)
32492{
32493#define FREE_PACKET_STRUCT(_packet) free_packet_unit_type_upgrade(_packet)
32494#ifdef FREECIV_DELTA_PROTOCOL
32495 packet_unit_type_upgrade_100_fields fields;
32496 struct packet_unit_type_upgrade *old;
32497 struct genhash **hash = pc->phs.received + PACKET_UNIT_TYPE_UPGRADE;
32498#endif /* FREECIV_DELTA_PROTOCOL */
32499 RECEIVE_PACKET_START(packet_unit_type_upgrade, real_packet);
32500#ifdef FREECIV_JSON_CONNECTION
32501 struct plocation field_addr;
32502 {
32503 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
32504 field_addr = *field_addr_tmp;
32505 FC_FREE(field_addr_tmp);
32506 }
32507#endif /* FREECIV_JSON_CONNECTION */
32508
32509#ifdef FREECIV_DELTA_PROTOCOL
32510#ifdef FREECIV_JSON_CONNECTION
32511 field_addr.name = "fields";
32512#endif /* FREECIV_JSON_CONNECTION */
32513 DIO_BV_GET(&din, &field_addr, fields);
32514
32515#else /* FREECIV_DELTA_PROTOCOL */
32516#ifdef FREECIV_JSON_CONNECTION
32517 field_addr.name = "type";
32518#endif /* FREECIV_JSON_CONNECTION */
32519 {
32520 int readin;
32521
32522 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
32523 RECEIVE_PACKET_FIELD_ERROR(type);
32524 }
32525 real_packet->type = readin;
32526 }
32527#endif
32528 log_packet_detailed("packet_unit_type_upgrade_100: got info about ()");
32529
32530#ifdef FREECIV_DELTA_PROTOCOL
32531 if (nullptr == *hash) {
32532 *hash = genhash_new_full(hash_packet_unit_type_upgrade_100, cmp_packet_unit_type_upgrade_100,
32533 nullptr, nullptr, nullptr, destroy_packet_unit_type_upgrade);
32534 }
32535
32536 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32537 *real_packet = *old;
32538 } else {
32539 /* packet is already initialized empty */
32540 log_packet_detailed(" no old info");
32541 }
32542
32543 if (BV_ISSET(fields, 0)) {
32544 log_packet_detailed(" got field 'type'");
32545#ifdef FREECIV_JSON_CONNECTION
32546 field_addr.name = "type";
32547#endif /* FREECIV_JSON_CONNECTION */
32548 {
32549 int readin;
32550
32551 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
32552 RECEIVE_PACKET_FIELD_ERROR(type);
32553 }
32554 real_packet->type = readin;
32555 }
32556 }
32557
32558 if (nullptr == old) {
32559 old = fc_malloc(sizeof(*old));
32560 init_packet_unit_type_upgrade(old);
32561 *old = *real_packet;
32562 genhash_insert(*hash, old, old);
32563 } else {
32564 *old = *real_packet;
32565 }
32566
32567#endif /* FREECIV_DELTA_PROTOCOL */
32568 RECEIVE_PACKET_END(real_packet);
32569#undef FREE_PACKET_STRUCT
32570}
32571
32572 static int send_packet_unit_type_upgrade_100(struct connection *pc, const struct packet_unit_type_upgrade *packet)
32573{
32574 const struct packet_unit_type_upgrade *real_packet = packet;
32575 int e;
32576#ifdef FREECIV_DELTA_PROTOCOL
32577 packet_unit_type_upgrade_100_fields fields;
32578 struct packet_unit_type_upgrade *old;
32579 bool differ;
32580 struct genhash **hash = pc->phs.sent + PACKET_UNIT_TYPE_UPGRADE;
32581#endif /* FREECIV_DELTA_PROTOCOL */
32582 SEND_PACKET_START(PACKET_UNIT_TYPE_UPGRADE);
32583#ifdef FREECIV_JSON_CONNECTION
32584 struct plocation field_addr;
32585 {
32586 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
32587 field_addr = *field_addr_tmp;
32588 FC_FREE(field_addr_tmp);
32589 }
32590#endif /* FREECIV_JSON_CONNECTION */
32591
32592 log_packet_detailed("packet_unit_type_upgrade_100: sending info about ()");
32593
32594#ifdef FREECIV_DELTA_PROTOCOL
32595 if (nullptr == *hash) {
32596 *hash = genhash_new_full(hash_packet_unit_type_upgrade_100, cmp_packet_unit_type_upgrade_100,
32597 nullptr, nullptr, nullptr, destroy_packet_unit_type_upgrade);
32598 }
32599 BV_CLR_ALL(fields);
32600
32601 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32602 old = fc_malloc(sizeof(*old));
32603 /* temporary bitcopy just to insert correctly */
32604 *old = *real_packet;
32605 genhash_insert(*hash, old, old);
32606 init_packet_unit_type_upgrade(old);
32607 }
32608 differ = (old->type != real_packet->type);
32609 if (differ) {
32610 BV_SET(fields, 0);
32611 }
32612
32613
32614#ifdef FREECIV_JSON_CONNECTION
32615 field_addr.name = "fields";
32616#endif /* FREECIV_JSON_CONNECTION */
32617 e = 0;
32618 e |= DIO_BV_PUT(&dout, &field_addr, fields);
32619 if (e) {
32620 log_packet_detailed("fields bitvector error detected");
32621 }
32622
32623 if (BV_ISSET(fields, 0)) {
32624 log_packet_detailed(" field 'type' has changed");
32625#ifdef FREECIV_JSON_CONNECTION
32626 field_addr.name = "type";
32627#endif /* FREECIV_JSON_CONNECTION */
32628 e = 0;
32629 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
32630 if (e) {
32631 log_packet_detailed("'type' field error detected");
32632 }
32633 }
32634
32635 *old = *real_packet;
32636#endif /* FREECIV_DELTA_PROTOCOL */
32637#ifndef FREECIV_DELTA_PROTOCOL
32638#ifdef FREECIV_JSON_CONNECTION
32639 field_addr.name = "type";
32640#endif /* FREECIV_JSON_CONNECTION */
32641 e = 0;
32642 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
32643 if (e) {
32644 log_packet_detailed("'type' field error detected");
32645 }
32646
32647#endif
32648 SEND_PACKET_END(PACKET_UNIT_TYPE_UPGRADE);
32649}
32650
32651 int send_packet_unit_type_upgrade(struct connection *pc, const struct packet_unit_type_upgrade *packet)
32652{
32653 if (!pc->used) {
32654 log_error("WARNING: trying to send data to the closed connection %s",
32655 conn_description(pc));
32656 return -1;
32657 }
32658 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_TYPE_UPGRADE].packet != nullptr, -1,
32659 "Handler for PACKET_UNIT_TYPE_UPGRADE not installed");
32660 return pc->phs.handlers->send[PACKET_UNIT_TYPE_UPGRADE].packet(pc, packet);
32661}
32662
32663 int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
32664{
32665 struct packet_unit_type_upgrade packet, *real_packet = &packet;
32666
32667 real_packet->type = type;
32668
32669 return send_packet_unit_type_upgrade(pc, real_packet);
32670}
32671
32672 static inline void init_packet_unit_do_action(struct packet_unit_do_action *packet)
32673{
32674 memset(packet, 0, sizeof(*packet));
32675}
32676
32677#define free_packet_unit_do_action(_packet) (void) 0
32678#define destroy_packet_unit_do_action free
32679
32680#ifdef FREECIV_DELTA_PROTOCOL
32681#define hash_packet_unit_do_action_100 hash_const
32682
32683#define cmp_packet_unit_do_action_100 cmp_const
32684
32685 BV_DEFINE(packet_unit_do_action_100_fields, 5);
32686#endif /* FREECIV_DELTA_PROTOCOL */
32687
32688 static struct packet_unit_do_action *receive_packet_unit_do_action_100(struct connection *pc)
32689{
32690#define FREE_PACKET_STRUCT(_packet) free_packet_unit_do_action(_packet)
32691#ifdef FREECIV_DELTA_PROTOCOL
32692 packet_unit_do_action_100_fields fields;
32693 struct packet_unit_do_action *old;
32694 struct genhash **hash = pc->phs.received + PACKET_UNIT_DO_ACTION;
32695#endif /* FREECIV_DELTA_PROTOCOL */
32696 RECEIVE_PACKET_START(packet_unit_do_action, real_packet);
32697#ifdef FREECIV_JSON_CONNECTION
32698 struct plocation field_addr;
32699 {
32700 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
32701 field_addr = *field_addr_tmp;
32702 FC_FREE(field_addr_tmp);
32703 }
32704#endif /* FREECIV_JSON_CONNECTION */
32705
32706#ifdef FREECIV_DELTA_PROTOCOL
32707#ifdef FREECIV_JSON_CONNECTION
32708 field_addr.name = "fields";
32709#endif /* FREECIV_JSON_CONNECTION */
32710 DIO_BV_GET(&din, &field_addr, fields);
32711
32712#else /* FREECIV_DELTA_PROTOCOL */
32713#ifdef FREECIV_JSON_CONNECTION
32714 field_addr.name = "actor_id";
32715#endif /* FREECIV_JSON_CONNECTION */
32716 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
32717 RECEIVE_PACKET_FIELD_ERROR(actor_id);
32718 }
32719#ifdef FREECIV_JSON_CONNECTION
32720 field_addr.name = "target_id";
32721#endif /* FREECIV_JSON_CONNECTION */
32722 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
32723 RECEIVE_PACKET_FIELD_ERROR(target_id);
32724 }
32725#ifdef FREECIV_JSON_CONNECTION
32726 field_addr.name = "sub_tgt_id";
32727#endif /* FREECIV_JSON_CONNECTION */
32728 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
32729 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
32730 }
32731#ifdef FREECIV_JSON_CONNECTION
32732 field_addr.name = "name";
32733#endif /* FREECIV_JSON_CONNECTION */
32734 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
32735 RECEIVE_PACKET_FIELD_ERROR(name);
32736 }
32737#ifdef FREECIV_JSON_CONNECTION
32738 field_addr.name = "action_type";
32739#endif /* FREECIV_JSON_CONNECTION */
32740 {
32741 int readin;
32742
32743 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32744 RECEIVE_PACKET_FIELD_ERROR(action_type);
32745 }
32746 real_packet->action_type = readin;
32747 }
32748#endif
32749 log_packet_detailed("packet_unit_do_action_100: got info about ()");
32750
32751#ifdef FREECIV_DELTA_PROTOCOL
32752 if (nullptr == *hash) {
32753 *hash = genhash_new_full(hash_packet_unit_do_action_100, cmp_packet_unit_do_action_100,
32754 nullptr, nullptr, nullptr, destroy_packet_unit_do_action);
32755 }
32756
32757 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32758 *real_packet = *old;
32759 } else {
32760 /* packet is already initialized empty */
32761 log_packet_detailed(" no old info");
32762 }
32763
32764 if (BV_ISSET(fields, 0)) {
32765 log_packet_detailed(" got field 'actor_id'");
32766#ifdef FREECIV_JSON_CONNECTION
32767 field_addr.name = "actor_id";
32768#endif /* FREECIV_JSON_CONNECTION */
32769 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
32770 RECEIVE_PACKET_FIELD_ERROR(actor_id);
32771 }
32772 }
32773 if (BV_ISSET(fields, 1)) {
32774 log_packet_detailed(" got field 'target_id'");
32775#ifdef FREECIV_JSON_CONNECTION
32776 field_addr.name = "target_id";
32777#endif /* FREECIV_JSON_CONNECTION */
32778 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
32779 RECEIVE_PACKET_FIELD_ERROR(target_id);
32780 }
32781 }
32782 if (BV_ISSET(fields, 2)) {
32783 log_packet_detailed(" got field 'sub_tgt_id'");
32784#ifdef FREECIV_JSON_CONNECTION
32785 field_addr.name = "sub_tgt_id";
32786#endif /* FREECIV_JSON_CONNECTION */
32787 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
32788 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
32789 }
32790 }
32791 if (BV_ISSET(fields, 3)) {
32792 log_packet_detailed(" got field 'name'");
32793#ifdef FREECIV_JSON_CONNECTION
32794 field_addr.name = "name";
32795#endif /* FREECIV_JSON_CONNECTION */
32796 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
32797 RECEIVE_PACKET_FIELD_ERROR(name);
32798 }
32799 }
32800 if (BV_ISSET(fields, 4)) {
32801 log_packet_detailed(" got field 'action_type'");
32802#ifdef FREECIV_JSON_CONNECTION
32803 field_addr.name = "action_type";
32804#endif /* FREECIV_JSON_CONNECTION */
32805 {
32806 int readin;
32807
32808 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32809 RECEIVE_PACKET_FIELD_ERROR(action_type);
32810 }
32811 real_packet->action_type = readin;
32812 }
32813 }
32814
32815 if (nullptr == old) {
32816 old = fc_malloc(sizeof(*old));
32817 init_packet_unit_do_action(old);
32818 *old = *real_packet;
32819 genhash_insert(*hash, old, old);
32820 } else {
32821 *old = *real_packet;
32822 }
32823
32824#endif /* FREECIV_DELTA_PROTOCOL */
32825 RECEIVE_PACKET_END(real_packet);
32826#undef FREE_PACKET_STRUCT
32827}
32828
32829 static int send_packet_unit_do_action_100(struct connection *pc, const struct packet_unit_do_action *packet)
32830{
32831 const struct packet_unit_do_action *real_packet = packet;
32832 int e;
32833#ifdef FREECIV_DELTA_PROTOCOL
32834 packet_unit_do_action_100_fields fields;
32835 struct packet_unit_do_action *old;
32836 bool differ;
32837 struct genhash **hash = pc->phs.sent + PACKET_UNIT_DO_ACTION;
32838#endif /* FREECIV_DELTA_PROTOCOL */
32839 SEND_PACKET_START(PACKET_UNIT_DO_ACTION);
32840#ifdef FREECIV_JSON_CONNECTION
32841 struct plocation field_addr;
32842 {
32843 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
32844 field_addr = *field_addr_tmp;
32845 FC_FREE(field_addr_tmp);
32846 }
32847#endif /* FREECIV_JSON_CONNECTION */
32848
32849 log_packet_detailed("packet_unit_do_action_100: sending info about ()");
32850
32851#ifdef FREECIV_DELTA_PROTOCOL
32852 if (nullptr == *hash) {
32853 *hash = genhash_new_full(hash_packet_unit_do_action_100, cmp_packet_unit_do_action_100,
32854 nullptr, nullptr, nullptr, destroy_packet_unit_do_action);
32855 }
32856 BV_CLR_ALL(fields);
32857
32858 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32859 old = fc_malloc(sizeof(*old));
32860 /* temporary bitcopy just to insert correctly */
32861 *old = *real_packet;
32862 genhash_insert(*hash, old, old);
32863 init_packet_unit_do_action(old);
32864 }
32865 differ = (old->actor_id != real_packet->actor_id);
32866 if (differ) {
32867 BV_SET(fields, 0);
32868 }
32869
32870 differ = (old->target_id != real_packet->target_id);
32871 if (differ) {
32872 BV_SET(fields, 1);
32873 }
32874
32875 differ = (old->sub_tgt_id != real_packet->sub_tgt_id);
32876 if (differ) {
32877 BV_SET(fields, 2);
32878 }
32879
32880 differ = (strcmp(old->name, real_packet->name) != 0);
32881 if (differ) {
32882 BV_SET(fields, 3);
32883 }
32884
32885 differ = (old->action_type != real_packet->action_type);
32886 if (differ) {
32887 BV_SET(fields, 4);
32888 }
32889
32890
32891#ifdef FREECIV_JSON_CONNECTION
32892 field_addr.name = "fields";
32893#endif /* FREECIV_JSON_CONNECTION */
32894 e = 0;
32895 e |= DIO_BV_PUT(&dout, &field_addr, fields);
32896 if (e) {
32897 log_packet_detailed("fields bitvector error detected");
32898 }
32899
32900 if (BV_ISSET(fields, 0)) {
32901 log_packet_detailed(" field 'actor_id' has changed");
32902#ifdef FREECIV_JSON_CONNECTION
32903 field_addr.name = "actor_id";
32904#endif /* FREECIV_JSON_CONNECTION */
32905 e = 0;
32906 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32907 if (e) {
32908 log_packet_detailed("'actor_id' field error detected");
32909 }
32910 }
32911 if (BV_ISSET(fields, 1)) {
32912 log_packet_detailed(" field 'target_id' has changed");
32913#ifdef FREECIV_JSON_CONNECTION
32914 field_addr.name = "target_id";
32915#endif /* FREECIV_JSON_CONNECTION */
32916 e = 0;
32917 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32918 if (e) {
32919 log_packet_detailed("'target_id' field error detected");
32920 }
32921 }
32922 if (BV_ISSET(fields, 2)) {
32923 log_packet_detailed(" field 'sub_tgt_id' has changed");
32924#ifdef FREECIV_JSON_CONNECTION
32925 field_addr.name = "sub_tgt_id";
32926#endif /* FREECIV_JSON_CONNECTION */
32927 e = 0;
32928 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
32929 if (e) {
32930 log_packet_detailed("'sub_tgt_id' field error detected");
32931 }
32932 }
32933 if (BV_ISSET(fields, 3)) {
32934 log_packet_detailed(" field 'name' has changed");
32935#ifdef FREECIV_JSON_CONNECTION
32936 field_addr.name = "name";
32937#endif /* FREECIV_JSON_CONNECTION */
32938 e = 0;
32939 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
32940 if (e) {
32941 log_packet_detailed("'name' field error detected");
32942 }
32943 }
32944 if (BV_ISSET(fields, 4)) {
32945 log_packet_detailed(" field 'action_type' has changed");
32946#ifdef FREECIV_JSON_CONNECTION
32947 field_addr.name = "action_type";
32948#endif /* FREECIV_JSON_CONNECTION */
32949 e = 0;
32950 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32951 if (e) {
32952 log_packet_detailed("'action_type' field error detected");
32953 }
32954 }
32955
32956 *old = *real_packet;
32957#endif /* FREECIV_DELTA_PROTOCOL */
32958#ifndef FREECIV_DELTA_PROTOCOL
32959#ifdef FREECIV_JSON_CONNECTION
32960 field_addr.name = "actor_id";
32961#endif /* FREECIV_JSON_CONNECTION */
32962 e = 0;
32963 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32964 if (e) {
32965 log_packet_detailed("'actor_id' field error detected");
32966 }
32967#ifdef FREECIV_JSON_CONNECTION
32968 field_addr.name = "target_id";
32969#endif /* FREECIV_JSON_CONNECTION */
32970 e = 0;
32971 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32972 if (e) {
32973 log_packet_detailed("'target_id' field error detected");
32974 }
32975#ifdef FREECIV_JSON_CONNECTION
32976 field_addr.name = "sub_tgt_id";
32977#endif /* FREECIV_JSON_CONNECTION */
32978 e = 0;
32979 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
32980 if (e) {
32981 log_packet_detailed("'sub_tgt_id' field error detected");
32982 }
32983#ifdef FREECIV_JSON_CONNECTION
32984 field_addr.name = "name";
32985#endif /* FREECIV_JSON_CONNECTION */
32986 e = 0;
32987 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
32988 if (e) {
32989 log_packet_detailed("'name' field error detected");
32990 }
32991#ifdef FREECIV_JSON_CONNECTION
32992 field_addr.name = "action_type";
32993#endif /* FREECIV_JSON_CONNECTION */
32994 e = 0;
32995 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32996 if (e) {
32997 log_packet_detailed("'action_type' field error detected");
32998 }
32999
33000#endif
33001 SEND_PACKET_END(PACKET_UNIT_DO_ACTION);
33002}
33003
33004 int send_packet_unit_do_action(struct connection *pc, const struct packet_unit_do_action *packet)
33005{
33006 if (!pc->used) {
33007 log_error("WARNING: trying to send data to the closed connection %s",
33008 conn_description(pc));
33009 return -1;
33010 }
33011 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_DO_ACTION].packet != nullptr, -1,
33012 "Handler for PACKET_UNIT_DO_ACTION not installed");
33013 return pc->phs.handlers->send[PACKET_UNIT_DO_ACTION].packet(pc, packet);
33014}
33015
33016 int dsend_packet_unit_do_action(struct connection *pc, int actor_id, int target_id, int sub_tgt_id, const char *name, action_id action_type)
33017{
33018 struct packet_unit_do_action packet, *real_packet = &packet;
33019
33020 real_packet->actor_id = actor_id;
33021 real_packet->target_id = target_id;
33022 real_packet->sub_tgt_id = sub_tgt_id;
33023 sz_strlcpy(real_packet->name, name);
33024 real_packet->action_type = action_type;
33025
33026 return send_packet_unit_do_action(pc, real_packet);
33027}
33028
33029 static inline void init_packet_unit_action_answer(struct packet_unit_action_answer *packet)
33030{
33031 memset(packet, 0, sizeof(*packet));
33032}
33033
33034#define free_packet_unit_action_answer(_packet) (void) 0
33035#define destroy_packet_unit_action_answer free
33036
33037#ifdef FREECIV_DELTA_PROTOCOL
33038#define hash_packet_unit_action_answer_100 hash_const
33039
33040#define cmp_packet_unit_action_answer_100 cmp_const
33041
33042 BV_DEFINE(packet_unit_action_answer_100_fields, 5);
33043#endif /* FREECIV_DELTA_PROTOCOL */
33044
33045 static struct packet_unit_action_answer *receive_packet_unit_action_answer_100(struct connection *pc)
33046{
33047#define FREE_PACKET_STRUCT(_packet) free_packet_unit_action_answer(_packet)
33048#ifdef FREECIV_DELTA_PROTOCOL
33049 packet_unit_action_answer_100_fields fields;
33050 struct packet_unit_action_answer *old;
33051 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_ANSWER;
33052#endif /* FREECIV_DELTA_PROTOCOL */
33053 RECEIVE_PACKET_START(packet_unit_action_answer, real_packet);
33054#ifdef FREECIV_JSON_CONNECTION
33055 struct plocation field_addr;
33056 {
33057 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
33058 field_addr = *field_addr_tmp;
33059 FC_FREE(field_addr_tmp);
33060 }
33061#endif /* FREECIV_JSON_CONNECTION */
33062
33063#ifdef FREECIV_DELTA_PROTOCOL
33064#ifdef FREECIV_JSON_CONNECTION
33065 field_addr.name = "fields";
33066#endif /* FREECIV_JSON_CONNECTION */
33067 DIO_BV_GET(&din, &field_addr, fields);
33068
33069#else /* FREECIV_DELTA_PROTOCOL */
33070#ifdef FREECIV_JSON_CONNECTION
33071 field_addr.name = "actor_id";
33072#endif /* FREECIV_JSON_CONNECTION */
33073 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
33074 RECEIVE_PACKET_FIELD_ERROR(actor_id);
33075 }
33076#ifdef FREECIV_JSON_CONNECTION
33077 field_addr.name = "target_id";
33078#endif /* FREECIV_JSON_CONNECTION */
33079 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
33080 RECEIVE_PACKET_FIELD_ERROR(target_id);
33081 }
33082#ifdef FREECIV_JSON_CONNECTION
33083 field_addr.name = "cost";
33084#endif /* FREECIV_JSON_CONNECTION */
33085 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
33086 RECEIVE_PACKET_FIELD_ERROR(cost);
33087 }
33088#ifdef FREECIV_JSON_CONNECTION
33089 field_addr.name = "action_type";
33090#endif /* FREECIV_JSON_CONNECTION */
33091 {
33092 int readin;
33093
33094 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33095 RECEIVE_PACKET_FIELD_ERROR(action_type);
33096 }
33097 real_packet->action_type = readin;
33098 }
33099#ifdef FREECIV_JSON_CONNECTION
33100 field_addr.name = "request_kind";
33101#endif /* FREECIV_JSON_CONNECTION */
33102 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
33103 RECEIVE_PACKET_FIELD_ERROR(request_kind);
33104 }
33105#endif
33106 log_packet_detailed("packet_unit_action_answer_100: got info about ()");
33107
33108#ifdef FREECIV_DELTA_PROTOCOL
33109 if (nullptr == *hash) {
33110 *hash = genhash_new_full(hash_packet_unit_action_answer_100, cmp_packet_unit_action_answer_100,
33111 nullptr, nullptr, nullptr, destroy_packet_unit_action_answer);
33112 }
33113
33114 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
33115 *real_packet = *old;
33116 } else {
33117 /* packet is already initialized empty */
33118 log_packet_detailed(" no old info");
33119 }
33120
33121 if (BV_ISSET(fields, 0)) {
33122 log_packet_detailed(" got field 'actor_id'");
33123#ifdef FREECIV_JSON_CONNECTION
33124 field_addr.name = "actor_id";
33125#endif /* FREECIV_JSON_CONNECTION */
33126 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
33127 RECEIVE_PACKET_FIELD_ERROR(actor_id);
33128 }
33129 }
33130 if (BV_ISSET(fields, 1)) {
33131 log_packet_detailed(" got field 'target_id'");
33132#ifdef FREECIV_JSON_CONNECTION
33133 field_addr.name = "target_id";
33134#endif /* FREECIV_JSON_CONNECTION */
33135 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
33136 RECEIVE_PACKET_FIELD_ERROR(target_id);
33137 }
33138 }
33139 if (BV_ISSET(fields, 2)) {
33140 log_packet_detailed(" got field 'cost'");
33141#ifdef FREECIV_JSON_CONNECTION
33142 field_addr.name = "cost";
33143#endif /* FREECIV_JSON_CONNECTION */
33144 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
33145 RECEIVE_PACKET_FIELD_ERROR(cost);
33146 }
33147 }
33148 if (BV_ISSET(fields, 3)) {
33149 log_packet_detailed(" got field 'action_type'");
33150#ifdef FREECIV_JSON_CONNECTION
33151 field_addr.name = "action_type";
33152#endif /* FREECIV_JSON_CONNECTION */
33153 {
33154 int readin;
33155
33156 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33157 RECEIVE_PACKET_FIELD_ERROR(action_type);
33158 }
33159 real_packet->action_type = readin;
33160 }
33161 }
33162 if (BV_ISSET(fields, 4)) {
33163 log_packet_detailed(" got field 'request_kind'");
33164#ifdef FREECIV_JSON_CONNECTION
33165 field_addr.name = "request_kind";
33166#endif /* FREECIV_JSON_CONNECTION */
33167 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
33168 RECEIVE_PACKET_FIELD_ERROR(request_kind);
33169 }
33170 }
33171
33172 if (nullptr == old) {
33173 old = fc_malloc(sizeof(*old));
33174 init_packet_unit_action_answer(old);
33175 *old = *real_packet;
33176 genhash_insert(*hash, old, old);
33177 } else {
33178 *old = *real_packet;
33179 }
33180
33181#endif /* FREECIV_DELTA_PROTOCOL */
33182 RECEIVE_PACKET_END(real_packet);
33183#undef FREE_PACKET_STRUCT
33184}
33185
33186 static int send_packet_unit_action_answer_100(struct connection *pc, const struct packet_unit_action_answer *packet)
33187{
33188 const struct packet_unit_action_answer *real_packet = packet;
33189 int e;
33190#ifdef FREECIV_DELTA_PROTOCOL
33191 packet_unit_action_answer_100_fields fields;
33192 struct packet_unit_action_answer *old;
33193 bool differ;
33194 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_ANSWER;
33195#endif /* FREECIV_DELTA_PROTOCOL */
33196 SEND_PACKET_START(PACKET_UNIT_ACTION_ANSWER);
33197#ifdef FREECIV_JSON_CONNECTION
33198 struct plocation field_addr;
33199 {
33200 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
33201 field_addr = *field_addr_tmp;
33202 FC_FREE(field_addr_tmp);
33203 }
33204#endif /* FREECIV_JSON_CONNECTION */
33205
33206 log_packet_detailed("packet_unit_action_answer_100: sending info about ()");
33207
33208#ifdef FREECIV_DELTA_PROTOCOL
33209 if (nullptr == *hash) {
33210 *hash = genhash_new_full(hash_packet_unit_action_answer_100, cmp_packet_unit_action_answer_100,
33211 nullptr, nullptr, nullptr, destroy_packet_unit_action_answer);
33212 }
33213 BV_CLR_ALL(fields);
33214
33215 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33216 old = fc_malloc(sizeof(*old));
33217 /* temporary bitcopy just to insert correctly */
33218 *old = *real_packet;
33219 genhash_insert(*hash, old, old);
33220 init_packet_unit_action_answer(old);
33221 }
33222 differ = (old->actor_id != real_packet->actor_id);
33223 if (differ) {
33224 BV_SET(fields, 0);
33225 }
33226
33227 differ = (old->target_id != real_packet->target_id);
33228 if (differ) {
33229 BV_SET(fields, 1);
33230 }
33231
33232 differ = (old->cost != real_packet->cost);
33233 if (differ) {
33234 BV_SET(fields, 2);
33235 }
33236
33237 differ = (old->action_type != real_packet->action_type);
33238 if (differ) {
33239 BV_SET(fields, 3);
33240 }
33241
33242 differ = (old->request_kind != real_packet->request_kind);
33243 if (differ) {
33244 BV_SET(fields, 4);
33245 }
33246
33247
33248#ifdef FREECIV_JSON_CONNECTION
33249 field_addr.name = "fields";
33250#endif /* FREECIV_JSON_CONNECTION */
33251 e = 0;
33252 e |= DIO_BV_PUT(&dout, &field_addr, fields);
33253 if (e) {
33254 log_packet_detailed("fields bitvector error detected");
33255 }
33256
33257 if (BV_ISSET(fields, 0)) {
33258 log_packet_detailed(" field 'actor_id' has changed");
33259#ifdef FREECIV_JSON_CONNECTION
33260 field_addr.name = "actor_id";
33261#endif /* FREECIV_JSON_CONNECTION */
33262 e = 0;
33263 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
33264 if (e) {
33265 log_packet_detailed("'actor_id' field error detected");
33266 }
33267 }
33268 if (BV_ISSET(fields, 1)) {
33269 log_packet_detailed(" field 'target_id' has changed");
33270#ifdef FREECIV_JSON_CONNECTION
33271 field_addr.name = "target_id";
33272#endif /* FREECIV_JSON_CONNECTION */
33273 e = 0;
33274 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
33275 if (e) {
33276 log_packet_detailed("'target_id' field error detected");
33277 }
33278 }
33279 if (BV_ISSET(fields, 2)) {
33280 log_packet_detailed(" field 'cost' has changed");
33281#ifdef FREECIV_JSON_CONNECTION
33282 field_addr.name = "cost";
33283#endif /* FREECIV_JSON_CONNECTION */
33284 e = 0;
33285 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
33286 if (e) {
33287 log_packet_detailed("'cost' field error detected");
33288 }
33289 }
33290 if (BV_ISSET(fields, 3)) {
33291 log_packet_detailed(" field 'action_type' has changed");
33292#ifdef FREECIV_JSON_CONNECTION
33293 field_addr.name = "action_type";
33294#endif /* FREECIV_JSON_CONNECTION */
33295 e = 0;
33296 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
33297 if (e) {
33298 log_packet_detailed("'action_type' field error detected");
33299 }
33300 }
33301 if (BV_ISSET(fields, 4)) {
33302 log_packet_detailed(" field 'request_kind' has changed");
33303#ifdef FREECIV_JSON_CONNECTION
33304 field_addr.name = "request_kind";
33305#endif /* FREECIV_JSON_CONNECTION */
33306 e = 0;
33307 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
33308 if (e) {
33309 log_packet_detailed("'request_kind' field error detected");
33310 }
33311 }
33312
33313 *old = *real_packet;
33314#endif /* FREECIV_DELTA_PROTOCOL */
33315#ifndef FREECIV_DELTA_PROTOCOL
33316#ifdef FREECIV_JSON_CONNECTION
33317 field_addr.name = "actor_id";
33318#endif /* FREECIV_JSON_CONNECTION */
33319 e = 0;
33320 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
33321 if (e) {
33322 log_packet_detailed("'actor_id' field error detected");
33323 }
33324#ifdef FREECIV_JSON_CONNECTION
33325 field_addr.name = "target_id";
33326#endif /* FREECIV_JSON_CONNECTION */
33327 e = 0;
33328 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
33329 if (e) {
33330 log_packet_detailed("'target_id' field error detected");
33331 }
33332#ifdef FREECIV_JSON_CONNECTION
33333 field_addr.name = "cost";
33334#endif /* FREECIV_JSON_CONNECTION */
33335 e = 0;
33336 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
33337 if (e) {
33338 log_packet_detailed("'cost' field error detected");
33339 }
33340#ifdef FREECIV_JSON_CONNECTION
33341 field_addr.name = "action_type";
33342#endif /* FREECIV_JSON_CONNECTION */
33343 e = 0;
33344 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
33345 if (e) {
33346 log_packet_detailed("'action_type' field error detected");
33347 }
33348#ifdef FREECIV_JSON_CONNECTION
33349 field_addr.name = "request_kind";
33350#endif /* FREECIV_JSON_CONNECTION */
33351 e = 0;
33352 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
33353 if (e) {
33354 log_packet_detailed("'request_kind' field error detected");
33355 }
33356
33357#endif
33358 SEND_PACKET_END(PACKET_UNIT_ACTION_ANSWER);
33359}
33360
33361 int send_packet_unit_action_answer(struct connection *pc, const struct packet_unit_action_answer *packet)
33362{
33363 if (!pc->used) {
33364 log_error("WARNING: trying to send data to the closed connection %s",
33365 conn_description(pc));
33366 return -1;
33367 }
33368 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTION_ANSWER].packet != nullptr, -1,
33369 "Handler for PACKET_UNIT_ACTION_ANSWER not installed");
33370 return pc->phs.handlers->send[PACKET_UNIT_ACTION_ANSWER].packet(pc, packet);
33371}
33372
33373 int dsend_packet_unit_action_answer(struct connection *pc, int actor_id, int target_id, int cost, action_id action_type, int request_kind)
33374{
33375 struct packet_unit_action_answer packet, *real_packet = &packet;
33376
33377 real_packet->actor_id = actor_id;
33378 real_packet->target_id = target_id;
33379 real_packet->cost = cost;
33380 real_packet->action_type = action_type;
33381 real_packet->request_kind = request_kind;
33382
33383 return send_packet_unit_action_answer(pc, real_packet);
33384}
33385
33386 static inline void init_packet_unit_get_actions(struct packet_unit_get_actions *packet)
33387{
33388 memset(packet, 0, sizeof(*packet));
33389}
33390
33391#define free_packet_unit_get_actions(_packet) (void) 0
33392#define destroy_packet_unit_get_actions free
33393
33394#ifdef FREECIV_DELTA_PROTOCOL
33395#define hash_packet_unit_get_actions_100 hash_const
33396
33397#define cmp_packet_unit_get_actions_100 cmp_const
33398
33399 BV_DEFINE(packet_unit_get_actions_100_fields, 5);
33400#endif /* FREECIV_DELTA_PROTOCOL */
33401
33402 static struct packet_unit_get_actions *receive_packet_unit_get_actions_100(struct connection *pc)
33403{
33404#define FREE_PACKET_STRUCT(_packet) free_packet_unit_get_actions(_packet)
33405#ifdef FREECIV_DELTA_PROTOCOL
33406 packet_unit_get_actions_100_fields fields;
33407 struct packet_unit_get_actions *old;
33408 struct genhash **hash = pc->phs.received + PACKET_UNIT_GET_ACTIONS;
33409#endif /* FREECIV_DELTA_PROTOCOL */
33410 RECEIVE_PACKET_START(packet_unit_get_actions, real_packet);
33411#ifdef FREECIV_JSON_CONNECTION
33412 struct plocation field_addr;
33413 {
33414 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
33415 field_addr = *field_addr_tmp;
33416 FC_FREE(field_addr_tmp);
33417 }
33418#endif /* FREECIV_JSON_CONNECTION */
33419
33420#ifdef FREECIV_DELTA_PROTOCOL
33421#ifdef FREECIV_JSON_CONNECTION
33422 field_addr.name = "fields";
33423#endif /* FREECIV_JSON_CONNECTION */
33424 DIO_BV_GET(&din, &field_addr, fields);
33425
33426#else /* FREECIV_DELTA_PROTOCOL */
33427#ifdef FREECIV_JSON_CONNECTION
33428 field_addr.name = "actor_unit_id";
33429#endif /* FREECIV_JSON_CONNECTION */
33430 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
33431 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
33432 }
33433#ifdef FREECIV_JSON_CONNECTION
33434 field_addr.name = "target_unit_id";
33435#endif /* FREECIV_JSON_CONNECTION */
33436 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
33437 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
33438 }
33439#ifdef FREECIV_JSON_CONNECTION
33440 field_addr.name = "target_tile_id";
33441#endif /* FREECIV_JSON_CONNECTION */
33442 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
33443 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
33444 }
33445#ifdef FREECIV_JSON_CONNECTION
33446 field_addr.name = "target_extra_id";
33447#endif /* FREECIV_JSON_CONNECTION */
33448 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
33449 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
33450 }
33451#ifdef FREECIV_JSON_CONNECTION
33452 field_addr.name = "request_kind";
33453#endif /* FREECIV_JSON_CONNECTION */
33454 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
33455 RECEIVE_PACKET_FIELD_ERROR(request_kind);
33456 }
33457#endif
33458 log_packet_detailed("packet_unit_get_actions_100: got info about ()");
33459
33460#ifdef FREECIV_DELTA_PROTOCOL
33461 if (nullptr == *hash) {
33462 *hash = genhash_new_full(hash_packet_unit_get_actions_100, cmp_packet_unit_get_actions_100,
33463 nullptr, nullptr, nullptr, destroy_packet_unit_get_actions);
33464 }
33465
33466 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
33467 *real_packet = *old;
33468 } else {
33469 /* packet is already initialized empty */
33470 log_packet_detailed(" no old info");
33471 }
33472
33473 if (BV_ISSET(fields, 0)) {
33474 log_packet_detailed(" got field 'actor_unit_id'");
33475#ifdef FREECIV_JSON_CONNECTION
33476 field_addr.name = "actor_unit_id";
33477#endif /* FREECIV_JSON_CONNECTION */
33478 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
33479 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
33480 }
33481 }
33482 if (BV_ISSET(fields, 1)) {
33483 log_packet_detailed(" got field 'target_unit_id'");
33484#ifdef FREECIV_JSON_CONNECTION
33485 field_addr.name = "target_unit_id";
33486#endif /* FREECIV_JSON_CONNECTION */
33487 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
33488 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
33489 }
33490 }
33491 if (BV_ISSET(fields, 2)) {
33492 log_packet_detailed(" got field 'target_tile_id'");
33493#ifdef FREECIV_JSON_CONNECTION
33494 field_addr.name = "target_tile_id";
33495#endif /* FREECIV_JSON_CONNECTION */
33496 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
33497 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
33498 }
33499 }
33500 if (BV_ISSET(fields, 3)) {
33501 log_packet_detailed(" got field 'target_extra_id'");
33502#ifdef FREECIV_JSON_CONNECTION
33503 field_addr.name = "target_extra_id";
33504#endif /* FREECIV_JSON_CONNECTION */
33505 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
33506 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
33507 }
33508 }
33509 if (BV_ISSET(fields, 4)) {
33510 log_packet_detailed(" got field 'request_kind'");
33511#ifdef FREECIV_JSON_CONNECTION
33512 field_addr.name = "request_kind";
33513#endif /* FREECIV_JSON_CONNECTION */
33514 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
33515 RECEIVE_PACKET_FIELD_ERROR(request_kind);
33516 }
33517 }
33518
33519 if (nullptr == old) {
33520 old = fc_malloc(sizeof(*old));
33521 init_packet_unit_get_actions(old);
33522 *old = *real_packet;
33523 genhash_insert(*hash, old, old);
33524 } else {
33525 *old = *real_packet;
33526 }
33527
33528#endif /* FREECIV_DELTA_PROTOCOL */
33529 RECEIVE_PACKET_END(real_packet);
33530#undef FREE_PACKET_STRUCT
33531}
33532
33533 static int send_packet_unit_get_actions_100(struct connection *pc, const struct packet_unit_get_actions *packet)
33534{
33535 const struct packet_unit_get_actions *real_packet = packet;
33536 int e;
33537#ifdef FREECIV_DELTA_PROTOCOL
33538 packet_unit_get_actions_100_fields fields;
33539 struct packet_unit_get_actions *old;
33540 bool differ;
33541 struct genhash **hash = pc->phs.sent + PACKET_UNIT_GET_ACTIONS;
33542#endif /* FREECIV_DELTA_PROTOCOL */
33543 SEND_PACKET_START(PACKET_UNIT_GET_ACTIONS);
33544#ifdef FREECIV_JSON_CONNECTION
33545 struct plocation field_addr;
33546 {
33547 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
33548 field_addr = *field_addr_tmp;
33549 FC_FREE(field_addr_tmp);
33550 }
33551#endif /* FREECIV_JSON_CONNECTION */
33552
33553 log_packet_detailed("packet_unit_get_actions_100: sending info about ()");
33554
33555#ifdef FREECIV_DELTA_PROTOCOL
33556 if (nullptr == *hash) {
33557 *hash = genhash_new_full(hash_packet_unit_get_actions_100, cmp_packet_unit_get_actions_100,
33558 nullptr, nullptr, nullptr, destroy_packet_unit_get_actions);
33559 }
33560 BV_CLR_ALL(fields);
33561
33562 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33563 old = fc_malloc(sizeof(*old));
33564 /* temporary bitcopy just to insert correctly */
33565 *old = *real_packet;
33566 genhash_insert(*hash, old, old);
33567 init_packet_unit_get_actions(old);
33568 }
33569 differ = (old->actor_unit_id != real_packet->actor_unit_id);
33570 if (differ) {
33571 BV_SET(fields, 0);
33572 }
33573
33574 differ = (old->target_unit_id != real_packet->target_unit_id);
33575 if (differ) {
33576 BV_SET(fields, 1);
33577 }
33578
33579 differ = (old->target_tile_id != real_packet->target_tile_id);
33580 if (differ) {
33581 BV_SET(fields, 2);
33582 }
33583
33584 differ = (old->target_extra_id != real_packet->target_extra_id);
33585 if (differ) {
33586 BV_SET(fields, 3);
33587 }
33588
33589 differ = (old->request_kind != real_packet->request_kind);
33590 if (differ) {
33591 BV_SET(fields, 4);
33592 }
33593
33594
33595#ifdef FREECIV_JSON_CONNECTION
33596 field_addr.name = "fields";
33597#endif /* FREECIV_JSON_CONNECTION */
33598 e = 0;
33599 e |= DIO_BV_PUT(&dout, &field_addr, fields);
33600 if (e) {
33601 log_packet_detailed("fields bitvector error detected");
33602 }
33603
33604 if (BV_ISSET(fields, 0)) {
33605 log_packet_detailed(" field 'actor_unit_id' has changed");
33606#ifdef FREECIV_JSON_CONNECTION
33607 field_addr.name = "actor_unit_id";
33608#endif /* FREECIV_JSON_CONNECTION */
33609 e = 0;
33610 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
33611 if (e) {
33612 log_packet_detailed("'actor_unit_id' field error detected");
33613 }
33614 }
33615 if (BV_ISSET(fields, 1)) {
33616 log_packet_detailed(" field 'target_unit_id' has changed");
33617#ifdef FREECIV_JSON_CONNECTION
33618 field_addr.name = "target_unit_id";
33619#endif /* FREECIV_JSON_CONNECTION */
33620 e = 0;
33621 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
33622 if (e) {
33623 log_packet_detailed("'target_unit_id' field error detected");
33624 }
33625 }
33626 if (BV_ISSET(fields, 2)) {
33627 log_packet_detailed(" field 'target_tile_id' has changed");
33628#ifdef FREECIV_JSON_CONNECTION
33629 field_addr.name = "target_tile_id";
33630#endif /* FREECIV_JSON_CONNECTION */
33631 e = 0;
33632 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
33633 if (e) {
33634 log_packet_detailed("'target_tile_id' field error detected");
33635 }
33636 }
33637 if (BV_ISSET(fields, 3)) {
33638 log_packet_detailed(" field 'target_extra_id' has changed");
33639#ifdef FREECIV_JSON_CONNECTION
33640 field_addr.name = "target_extra_id";
33641#endif /* FREECIV_JSON_CONNECTION */
33642 e = 0;
33643 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
33644 if (e) {
33645 log_packet_detailed("'target_extra_id' field error detected");
33646 }
33647 }
33648 if (BV_ISSET(fields, 4)) {
33649 log_packet_detailed(" field 'request_kind' has changed");
33650#ifdef FREECIV_JSON_CONNECTION
33651 field_addr.name = "request_kind";
33652#endif /* FREECIV_JSON_CONNECTION */
33653 e = 0;
33654 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
33655 if (e) {
33656 log_packet_detailed("'request_kind' field error detected");
33657 }
33658 }
33659
33660 *old = *real_packet;
33661#endif /* FREECIV_DELTA_PROTOCOL */
33662#ifndef FREECIV_DELTA_PROTOCOL
33663#ifdef FREECIV_JSON_CONNECTION
33664 field_addr.name = "actor_unit_id";
33665#endif /* FREECIV_JSON_CONNECTION */
33666 e = 0;
33667 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
33668 if (e) {
33669 log_packet_detailed("'actor_unit_id' field error detected");
33670 }
33671#ifdef FREECIV_JSON_CONNECTION
33672 field_addr.name = "target_unit_id";
33673#endif /* FREECIV_JSON_CONNECTION */
33674 e = 0;
33675 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
33676 if (e) {
33677 log_packet_detailed("'target_unit_id' field error detected");
33678 }
33679#ifdef FREECIV_JSON_CONNECTION
33680 field_addr.name = "target_tile_id";
33681#endif /* FREECIV_JSON_CONNECTION */
33682 e = 0;
33683 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
33684 if (e) {
33685 log_packet_detailed("'target_tile_id' field error detected");
33686 }
33687#ifdef FREECIV_JSON_CONNECTION
33688 field_addr.name = "target_extra_id";
33689#endif /* FREECIV_JSON_CONNECTION */
33690 e = 0;
33691 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
33692 if (e) {
33693 log_packet_detailed("'target_extra_id' field error detected");
33694 }
33695#ifdef FREECIV_JSON_CONNECTION
33696 field_addr.name = "request_kind";
33697#endif /* FREECIV_JSON_CONNECTION */
33698 e = 0;
33699 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
33700 if (e) {
33701 log_packet_detailed("'request_kind' field error detected");
33702 }
33703
33704#endif
33705 SEND_PACKET_END(PACKET_UNIT_GET_ACTIONS);
33706}
33707
33708 int send_packet_unit_get_actions(struct connection *pc, const struct packet_unit_get_actions *packet)
33709{
33710 if (!pc->used) {
33711 log_error("WARNING: trying to send data to the closed connection %s",
33712 conn_description(pc));
33713 return -1;
33714 }
33715 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_GET_ACTIONS].packet != nullptr, -1,
33716 "Handler for PACKET_UNIT_GET_ACTIONS not installed");
33717 return pc->phs.handlers->send[PACKET_UNIT_GET_ACTIONS].packet(pc, packet);
33718}
33719
33720 int dsend_packet_unit_get_actions(struct connection *pc, int actor_unit_id, int target_unit_id, int target_tile_id, int target_extra_id, int request_kind)
33721{
33722 struct packet_unit_get_actions packet, *real_packet = &packet;
33723
33724 real_packet->actor_unit_id = actor_unit_id;
33725 real_packet->target_unit_id = target_unit_id;
33726 real_packet->target_tile_id = target_tile_id;
33727 real_packet->target_extra_id = target_extra_id;
33728 real_packet->request_kind = request_kind;
33729
33730 return send_packet_unit_get_actions(pc, real_packet);
33731}
33732
33733 static inline void init_packet_unit_actions(struct packet_unit_actions *packet)
33734{
33735 memset(packet, 0, sizeof(*packet));
33736}
33737
33738#define free_packet_unit_actions(_packet) (void) 0
33739#define destroy_packet_unit_actions free
33740
33741#ifdef FREECIV_DELTA_PROTOCOL
33742#define hash_packet_unit_actions_100 hash_const
33743
33744#define cmp_packet_unit_actions_100 cmp_const
33745
33746 BV_DEFINE(packet_unit_actions_100_fields, 7);
33747#endif /* FREECIV_DELTA_PROTOCOL */
33748
33749 static struct packet_unit_actions *receive_packet_unit_actions_100(struct connection *pc)
33750{
33751#define FREE_PACKET_STRUCT(_packet) free_packet_unit_actions(_packet)
33752#ifdef FREECIV_DELTA_PROTOCOL
33753 packet_unit_actions_100_fields fields;
33754 struct packet_unit_actions *old;
33755 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTIONS;
33756#endif /* FREECIV_DELTA_PROTOCOL */
33757 RECEIVE_PACKET_START(packet_unit_actions, real_packet);
33758#ifdef FREECIV_JSON_CONNECTION
33759 struct plocation field_addr;
33760 {
33761 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
33762 field_addr = *field_addr_tmp;
33763 FC_FREE(field_addr_tmp);
33764 }
33765#endif /* FREECIV_JSON_CONNECTION */
33766
33767#ifdef FREECIV_DELTA_PROTOCOL
33768#ifdef FREECIV_JSON_CONNECTION
33769 field_addr.name = "fields";
33770#endif /* FREECIV_JSON_CONNECTION */
33771 DIO_BV_GET(&din, &field_addr, fields);
33772
33773#else /* FREECIV_DELTA_PROTOCOL */
33774#ifdef FREECIV_JSON_CONNECTION
33775 field_addr.name = "actor_unit_id";
33776#endif /* FREECIV_JSON_CONNECTION */
33777 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
33778 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
33779 }
33780#ifdef FREECIV_JSON_CONNECTION
33781 field_addr.name = "target_unit_id";
33782#endif /* FREECIV_JSON_CONNECTION */
33783 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
33784 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
33785 }
33786#ifdef FREECIV_JSON_CONNECTION
33787 field_addr.name = "target_city_id";
33788#endif /* FREECIV_JSON_CONNECTION */
33789 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_city_id)) {
33790 RECEIVE_PACKET_FIELD_ERROR(target_city_id);
33791 }
33792#ifdef FREECIV_JSON_CONNECTION
33793 field_addr.name = "target_tile_id";
33794#endif /* FREECIV_JSON_CONNECTION */
33795 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
33796 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
33797 }
33798#ifdef FREECIV_JSON_CONNECTION
33799 field_addr.name = "target_extra_id";
33800#endif /* FREECIV_JSON_CONNECTION */
33801 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
33802 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
33803 }
33804#ifdef FREECIV_JSON_CONNECTION
33805 field_addr.name = "request_kind";
33806#endif /* FREECIV_JSON_CONNECTION */
33807 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
33808 RECEIVE_PACKET_FIELD_ERROR(request_kind);
33809 }
33810#ifdef FREECIV_JSON_CONNECTION
33811 field_addr.name = "action_probabilities";
33812#endif /* FREECIV_JSON_CONNECTION */
33813 {
33814 int i;
33815
33816#ifdef FREECIV_JSON_CONNECTION
33817 /* Enter array. */
33818 field_addr.sub_location = plocation_elem_new(0);
33819#endif /* FREECIV_JSON_CONNECTION */
33820
33821 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
33822#ifdef FREECIV_JSON_CONNECTION
33823 field_addr.sub_location->number = i;
33824#endif /* FREECIV_JSON_CONNECTION */
33825 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
33826 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
33827 }
33828 }
33829
33830#ifdef FREECIV_JSON_CONNECTION
33831 /* Exit array. */
33832 FC_FREE(field_addr.sub_location);
33833#endif /* FREECIV_JSON_CONNECTION */
33834 }
33835#endif
33836 log_packet_detailed("packet_unit_actions_100: got info about ()");
33837
33838#ifdef FREECIV_DELTA_PROTOCOL
33839 if (nullptr == *hash) {
33840 *hash = genhash_new_full(hash_packet_unit_actions_100, cmp_packet_unit_actions_100,
33841 nullptr, nullptr, nullptr, destroy_packet_unit_actions);
33842 }
33843
33844 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
33845 *real_packet = *old;
33846 } else {
33847 /* packet is already initialized empty */
33848 log_packet_detailed(" no old info");
33849 }
33850
33851 if (BV_ISSET(fields, 0)) {
33852 log_packet_detailed(" got field 'actor_unit_id'");
33853#ifdef FREECIV_JSON_CONNECTION
33854 field_addr.name = "actor_unit_id";
33855#endif /* FREECIV_JSON_CONNECTION */
33856 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
33857 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
33858 }
33859 }
33860 if (BV_ISSET(fields, 1)) {
33861 log_packet_detailed(" got field 'target_unit_id'");
33862#ifdef FREECIV_JSON_CONNECTION
33863 field_addr.name = "target_unit_id";
33864#endif /* FREECIV_JSON_CONNECTION */
33865 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
33866 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
33867 }
33868 }
33869 if (BV_ISSET(fields, 2)) {
33870 log_packet_detailed(" got field 'target_city_id'");
33871#ifdef FREECIV_JSON_CONNECTION
33872 field_addr.name = "target_city_id";
33873#endif /* FREECIV_JSON_CONNECTION */
33874 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_city_id)) {
33875 RECEIVE_PACKET_FIELD_ERROR(target_city_id);
33876 }
33877 }
33878 if (BV_ISSET(fields, 3)) {
33879 log_packet_detailed(" got field 'target_tile_id'");
33880#ifdef FREECIV_JSON_CONNECTION
33881 field_addr.name = "target_tile_id";
33882#endif /* FREECIV_JSON_CONNECTION */
33883 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
33884 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
33885 }
33886 }
33887 if (BV_ISSET(fields, 4)) {
33888 log_packet_detailed(" got field 'target_extra_id'");
33889#ifdef FREECIV_JSON_CONNECTION
33890 field_addr.name = "target_extra_id";
33891#endif /* FREECIV_JSON_CONNECTION */
33892 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
33893 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
33894 }
33895 }
33896 if (BV_ISSET(fields, 5)) {
33897 log_packet_detailed(" got field 'request_kind'");
33898#ifdef FREECIV_JSON_CONNECTION
33899 field_addr.name = "request_kind";
33900#endif /* FREECIV_JSON_CONNECTION */
33901 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
33902 RECEIVE_PACKET_FIELD_ERROR(request_kind);
33903 }
33904 }
33905 if (BV_ISSET(fields, 6)) {
33906 log_packet_detailed(" got field 'action_probabilities'");
33907#ifdef FREECIV_JSON_CONNECTION
33908 field_addr.name = "action_probabilities";
33909#endif /* FREECIV_JSON_CONNECTION */
33910 {
33911 int i;
33912
33913#ifdef FREECIV_JSON_CONNECTION
33914 /* Enter array. */
33915 field_addr.sub_location = plocation_elem_new(0);
33916#endif /* FREECIV_JSON_CONNECTION */
33917
33918 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
33919#ifdef FREECIV_JSON_CONNECTION
33920 field_addr.sub_location->number = i;
33921#endif /* FREECIV_JSON_CONNECTION */
33922 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
33923 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
33924 }
33925 }
33926
33927#ifdef FREECIV_JSON_CONNECTION
33928 /* Exit array. */
33929 FC_FREE(field_addr.sub_location);
33930#endif /* FREECIV_JSON_CONNECTION */
33931 }
33932 }
33933
33934 if (nullptr == old) {
33935 old = fc_malloc(sizeof(*old));
33936 init_packet_unit_actions(old);
33937 *old = *real_packet;
33938 genhash_insert(*hash, old, old);
33939 } else {
33940 *old = *real_packet;
33941 }
33942
33943#endif /* FREECIV_DELTA_PROTOCOL */
33944 RECEIVE_PACKET_END(real_packet);
33945#undef FREE_PACKET_STRUCT
33946}
33947
33948 static int send_packet_unit_actions_100(struct connection *pc, const struct packet_unit_actions *packet)
33949{
33950 const struct packet_unit_actions *real_packet = packet;
33951 int e;
33952#ifdef FREECIV_DELTA_PROTOCOL
33953 packet_unit_actions_100_fields fields;
33954 struct packet_unit_actions *old;
33955 bool differ;
33956 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTIONS;
33957#endif /* FREECIV_DELTA_PROTOCOL */
33958 SEND_PACKET_START(PACKET_UNIT_ACTIONS);
33959#ifdef FREECIV_JSON_CONNECTION
33960 struct plocation field_addr;
33961 {
33962 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
33963 field_addr = *field_addr_tmp;
33964 FC_FREE(field_addr_tmp);
33965 }
33966#endif /* FREECIV_JSON_CONNECTION */
33967
33968 log_packet_detailed("packet_unit_actions_100: sending info about ()");
33969
33970#ifdef FREECIV_DELTA_PROTOCOL
33971 if (nullptr == *hash) {
33972 *hash = genhash_new_full(hash_packet_unit_actions_100, cmp_packet_unit_actions_100,
33973 nullptr, nullptr, nullptr, destroy_packet_unit_actions);
33974 }
33975 BV_CLR_ALL(fields);
33976
33977 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33978 old = fc_malloc(sizeof(*old));
33979 /* temporary bitcopy just to insert correctly */
33980 *old = *real_packet;
33981 genhash_insert(*hash, old, old);
33982 init_packet_unit_actions(old);
33983 }
33984 differ = (old->actor_unit_id != real_packet->actor_unit_id);
33985 if (differ) {
33986 BV_SET(fields, 0);
33987 }
33988
33989 differ = (old->target_unit_id != real_packet->target_unit_id);
33990 if (differ) {
33991 BV_SET(fields, 1);
33992 }
33993
33994 differ = (old->target_city_id != real_packet->target_city_id);
33995 if (differ) {
33996 BV_SET(fields, 2);
33997 }
33998
33999 differ = (old->target_tile_id != real_packet->target_tile_id);
34000 if (differ) {
34001 BV_SET(fields, 3);
34002 }
34003
34004 differ = (old->target_extra_id != real_packet->target_extra_id);
34005 if (differ) {
34006 BV_SET(fields, 4);
34007 }
34008
34009 differ = (old->request_kind != real_packet->request_kind);
34010 if (differ) {
34011 BV_SET(fields, 5);
34012 }
34013
34014 differ = FALSE;
34015 {
34016 int i;
34017
34018 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
34019 differ = !are_action_probabilitys_equal(&old->action_probabilities[i], &real_packet->action_probabilities[i]);
34020 if (differ) {
34021 break;
34022 }
34023 }
34024 }
34025 if (differ) {
34026 BV_SET(fields, 6);
34027 }
34028
34029
34030#ifdef FREECIV_JSON_CONNECTION
34031 field_addr.name = "fields";
34032#endif /* FREECIV_JSON_CONNECTION */
34033 e = 0;
34034 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34035 if (e) {
34036 log_packet_detailed("fields bitvector error detected");
34037 }
34038
34039 if (BV_ISSET(fields, 0)) {
34040 log_packet_detailed(" field 'actor_unit_id' has changed");
34041#ifdef FREECIV_JSON_CONNECTION
34042 field_addr.name = "actor_unit_id";
34043#endif /* FREECIV_JSON_CONNECTION */
34044 e = 0;
34045 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
34046 if (e) {
34047 log_packet_detailed("'actor_unit_id' field error detected");
34048 }
34049 }
34050 if (BV_ISSET(fields, 1)) {
34051 log_packet_detailed(" field 'target_unit_id' has changed");
34052#ifdef FREECIV_JSON_CONNECTION
34053 field_addr.name = "target_unit_id";
34054#endif /* FREECIV_JSON_CONNECTION */
34055 e = 0;
34056 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
34057 if (e) {
34058 log_packet_detailed("'target_unit_id' field error detected");
34059 }
34060 }
34061 if (BV_ISSET(fields, 2)) {
34062 log_packet_detailed(" field 'target_city_id' has changed");
34063#ifdef FREECIV_JSON_CONNECTION
34064 field_addr.name = "target_city_id";
34065#endif /* FREECIV_JSON_CONNECTION */
34066 e = 0;
34067 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_city_id);
34068 if (e) {
34069 log_packet_detailed("'target_city_id' field error detected");
34070 }
34071 }
34072 if (BV_ISSET(fields, 3)) {
34073 log_packet_detailed(" field 'target_tile_id' has changed");
34074#ifdef FREECIV_JSON_CONNECTION
34075 field_addr.name = "target_tile_id";
34076#endif /* FREECIV_JSON_CONNECTION */
34077 e = 0;
34078 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
34079 if (e) {
34080 log_packet_detailed("'target_tile_id' field error detected");
34081 }
34082 }
34083 if (BV_ISSET(fields, 4)) {
34084 log_packet_detailed(" field 'target_extra_id' has changed");
34085#ifdef FREECIV_JSON_CONNECTION
34086 field_addr.name = "target_extra_id";
34087#endif /* FREECIV_JSON_CONNECTION */
34088 e = 0;
34089 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
34090 if (e) {
34091 log_packet_detailed("'target_extra_id' field error detected");
34092 }
34093 }
34094 if (BV_ISSET(fields, 5)) {
34095 log_packet_detailed(" field 'request_kind' has changed");
34096#ifdef FREECIV_JSON_CONNECTION
34097 field_addr.name = "request_kind";
34098#endif /* FREECIV_JSON_CONNECTION */
34099 e = 0;
34100 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
34101 if (e) {
34102 log_packet_detailed("'request_kind' field error detected");
34103 }
34104 }
34105 if (BV_ISSET(fields, 6)) {
34106 log_packet_detailed(" field 'action_probabilities' has changed");
34107#ifdef FREECIV_JSON_CONNECTION
34108 field_addr.name = "action_probabilities";
34109#endif /* FREECIV_JSON_CONNECTION */
34110 e = 0;
34111 {
34112 int i;
34113
34114#ifdef FREECIV_JSON_CONNECTION
34115 /* Create the array. */
34116 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
34117
34118 /* Enter the array. */
34119 field_addr.sub_location = plocation_elem_new(0);
34120#endif /* FREECIV_JSON_CONNECTION */
34121
34122 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
34123#ifdef FREECIV_JSON_CONNECTION
34124 /* Next array element. */
34125 field_addr.sub_location->number = i;
34126#endif /* FREECIV_JSON_CONNECTION */
34127 e |= DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
34128 }
34129
34130#ifdef FREECIV_JSON_CONNECTION
34131 /* Exit array. */
34132 FC_FREE(field_addr.sub_location);
34133#endif /* FREECIV_JSON_CONNECTION */
34134 }
34135 if (e) {
34136 log_packet_detailed("'action_probabilities' field error detected");
34137 }
34138 }
34139
34140 *old = *real_packet;
34141#endif /* FREECIV_DELTA_PROTOCOL */
34142#ifndef FREECIV_DELTA_PROTOCOL
34143#ifdef FREECIV_JSON_CONNECTION
34144 field_addr.name = "actor_unit_id";
34145#endif /* FREECIV_JSON_CONNECTION */
34146 e = 0;
34147 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
34148 if (e) {
34149 log_packet_detailed("'actor_unit_id' field error detected");
34150 }
34151#ifdef FREECIV_JSON_CONNECTION
34152 field_addr.name = "target_unit_id";
34153#endif /* FREECIV_JSON_CONNECTION */
34154 e = 0;
34155 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
34156 if (e) {
34157 log_packet_detailed("'target_unit_id' field error detected");
34158 }
34159#ifdef FREECIV_JSON_CONNECTION
34160 field_addr.name = "target_city_id";
34161#endif /* FREECIV_JSON_CONNECTION */
34162 e = 0;
34163 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_city_id);
34164 if (e) {
34165 log_packet_detailed("'target_city_id' field error detected");
34166 }
34167#ifdef FREECIV_JSON_CONNECTION
34168 field_addr.name = "target_tile_id";
34169#endif /* FREECIV_JSON_CONNECTION */
34170 e = 0;
34171 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
34172 if (e) {
34173 log_packet_detailed("'target_tile_id' field error detected");
34174 }
34175#ifdef FREECIV_JSON_CONNECTION
34176 field_addr.name = "target_extra_id";
34177#endif /* FREECIV_JSON_CONNECTION */
34178 e = 0;
34179 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
34180 if (e) {
34181 log_packet_detailed("'target_extra_id' field error detected");
34182 }
34183#ifdef FREECIV_JSON_CONNECTION
34184 field_addr.name = "request_kind";
34185#endif /* FREECIV_JSON_CONNECTION */
34186 e = 0;
34187 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
34188 if (e) {
34189 log_packet_detailed("'request_kind' field error detected");
34190 }
34191#ifdef FREECIV_JSON_CONNECTION
34192 field_addr.name = "action_probabilities";
34193#endif /* FREECIV_JSON_CONNECTION */
34194 e = 0;
34195 {
34196 int i;
34197
34198#ifdef FREECIV_JSON_CONNECTION
34199 /* Create the array. */
34200 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
34201
34202 /* Enter the array. */
34203 field_addr.sub_location = plocation_elem_new(0);
34204#endif /* FREECIV_JSON_CONNECTION */
34205
34206 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
34207#ifdef FREECIV_JSON_CONNECTION
34208 /* Next array element. */
34209 field_addr.sub_location->number = i;
34210#endif /* FREECIV_JSON_CONNECTION */
34211 e |= DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
34212 }
34213
34214#ifdef FREECIV_JSON_CONNECTION
34215 /* Exit array. */
34216 FC_FREE(field_addr.sub_location);
34217#endif /* FREECIV_JSON_CONNECTION */
34218 }
34219 if (e) {
34220 log_packet_detailed("'action_probabilities' field error detected");
34221 }
34222
34223#endif
34224 SEND_PACKET_END(PACKET_UNIT_ACTIONS);
34225}
34226
34227 int send_packet_unit_actions(struct connection *pc, const struct packet_unit_actions *packet)
34228{
34229 if (!pc->used) {
34230 log_error("WARNING: trying to send data to the closed connection %s",
34231 conn_description(pc));
34232 return -1;
34233 }
34234 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTIONS].packet != nullptr, -1,
34235 "Handler for PACKET_UNIT_ACTIONS not installed");
34236 return pc->phs.handlers->send[PACKET_UNIT_ACTIONS].packet(pc, packet);
34237}
34238
34239 int dsend_packet_unit_actions(struct connection *pc, int actor_unit_id, int target_unit_id, int target_city_id, int target_tile_id, int target_extra_id, int request_kind, const struct act_prob *action_probabilities)
34240{
34241 struct packet_unit_actions packet, *real_packet = &packet;
34242
34243 real_packet->actor_unit_id = actor_unit_id;
34244 real_packet->target_unit_id = target_unit_id;
34245 real_packet->target_city_id = target_city_id;
34246 real_packet->target_tile_id = target_tile_id;
34247 real_packet->target_extra_id = target_extra_id;
34248 real_packet->request_kind = request_kind;
34249 {
34250 int i;
34251
34252 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
34253 real_packet->action_probabilities[i] = action_probabilities[i];
34254 }
34255 }
34256
34257 return send_packet_unit_actions(pc, real_packet);
34258}
34259
34260 static inline void init_packet_unit_change_activity(struct packet_unit_change_activity *packet)
34261{
34262 memset(packet, 0, sizeof(*packet));
34263}
34264
34265#define free_packet_unit_change_activity(_packet) (void) 0
34266#define destroy_packet_unit_change_activity free
34267
34268#ifdef FREECIV_DELTA_PROTOCOL
34269#define hash_packet_unit_change_activity_100 hash_const
34270
34271#define cmp_packet_unit_change_activity_100 cmp_const
34272
34273 BV_DEFINE(packet_unit_change_activity_100_fields, 3);
34274#endif /* FREECIV_DELTA_PROTOCOL */
34275
34276 static struct packet_unit_change_activity *receive_packet_unit_change_activity_100(struct connection *pc)
34277{
34278#define FREE_PACKET_STRUCT(_packet) free_packet_unit_change_activity(_packet)
34279#ifdef FREECIV_DELTA_PROTOCOL
34280 packet_unit_change_activity_100_fields fields;
34281 struct packet_unit_change_activity *old;
34282 struct genhash **hash = pc->phs.received + PACKET_UNIT_CHANGE_ACTIVITY;
34283#endif /* FREECIV_DELTA_PROTOCOL */
34284 RECEIVE_PACKET_START(packet_unit_change_activity, real_packet);
34285#ifdef FREECIV_JSON_CONNECTION
34286 struct plocation field_addr;
34287 {
34288 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
34289 field_addr = *field_addr_tmp;
34290 FC_FREE(field_addr_tmp);
34291 }
34292#endif /* FREECIV_JSON_CONNECTION */
34293
34294#ifdef FREECIV_DELTA_PROTOCOL
34295#ifdef FREECIV_JSON_CONNECTION
34296 field_addr.name = "fields";
34297#endif /* FREECIV_JSON_CONNECTION */
34298 DIO_BV_GET(&din, &field_addr, fields);
34299
34300#else /* FREECIV_DELTA_PROTOCOL */
34301#ifdef FREECIV_JSON_CONNECTION
34302 field_addr.name = "unit_id";
34303#endif /* FREECIV_JSON_CONNECTION */
34304 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
34305 RECEIVE_PACKET_FIELD_ERROR(unit_id);
34306 }
34307#ifdef FREECIV_JSON_CONNECTION
34308 field_addr.name = "activity";
34309#endif /* FREECIV_JSON_CONNECTION */
34310 {
34311 int readin;
34312
34313 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
34314 RECEIVE_PACKET_FIELD_ERROR(activity);
34315 }
34316 real_packet->activity = readin;
34317 }
34318#ifdef FREECIV_JSON_CONNECTION
34319 field_addr.name = "target";
34320#endif /* FREECIV_JSON_CONNECTION */
34321 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
34322 RECEIVE_PACKET_FIELD_ERROR(target);
34323 }
34324#endif
34325 log_packet_detailed("packet_unit_change_activity_100: got info about ()");
34326
34327#ifdef FREECIV_DELTA_PROTOCOL
34328 if (nullptr == *hash) {
34329 *hash = genhash_new_full(hash_packet_unit_change_activity_100, cmp_packet_unit_change_activity_100,
34330 nullptr, nullptr, nullptr, destroy_packet_unit_change_activity);
34331 }
34332
34333 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
34334 *real_packet = *old;
34335 } else {
34336 /* packet is already initialized empty */
34337 log_packet_detailed(" no old info");
34338 }
34339
34340 if (BV_ISSET(fields, 0)) {
34341 log_packet_detailed(" got field 'unit_id'");
34342#ifdef FREECIV_JSON_CONNECTION
34343 field_addr.name = "unit_id";
34344#endif /* FREECIV_JSON_CONNECTION */
34345 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
34346 RECEIVE_PACKET_FIELD_ERROR(unit_id);
34347 }
34348 }
34349 if (BV_ISSET(fields, 1)) {
34350 log_packet_detailed(" got field 'activity'");
34351#ifdef FREECIV_JSON_CONNECTION
34352 field_addr.name = "activity";
34353#endif /* FREECIV_JSON_CONNECTION */
34354 {
34355 int readin;
34356
34357 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
34358 RECEIVE_PACKET_FIELD_ERROR(activity);
34359 }
34360 real_packet->activity = readin;
34361 }
34362 }
34363 if (BV_ISSET(fields, 2)) {
34364 log_packet_detailed(" got field 'target'");
34365#ifdef FREECIV_JSON_CONNECTION
34366 field_addr.name = "target";
34367#endif /* FREECIV_JSON_CONNECTION */
34368 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
34369 RECEIVE_PACKET_FIELD_ERROR(target);
34370 }
34371 }
34372
34373 if (nullptr == old) {
34374 old = fc_malloc(sizeof(*old));
34375 init_packet_unit_change_activity(old);
34376 *old = *real_packet;
34377 genhash_insert(*hash, old, old);
34378 } else {
34379 *old = *real_packet;
34380 }
34381
34382#endif /* FREECIV_DELTA_PROTOCOL */
34383 RECEIVE_PACKET_END(real_packet);
34384#undef FREE_PACKET_STRUCT
34385}
34386
34387 static int send_packet_unit_change_activity_100(struct connection *pc, const struct packet_unit_change_activity *packet)
34388{
34389 const struct packet_unit_change_activity *real_packet = packet;
34390 int e;
34391#ifdef FREECIV_DELTA_PROTOCOL
34392 packet_unit_change_activity_100_fields fields;
34393 struct packet_unit_change_activity *old;
34394 bool differ;
34395 struct genhash **hash = pc->phs.sent + PACKET_UNIT_CHANGE_ACTIVITY;
34396#endif /* FREECIV_DELTA_PROTOCOL */
34397 SEND_PACKET_START(PACKET_UNIT_CHANGE_ACTIVITY);
34398#ifdef FREECIV_JSON_CONNECTION
34399 struct plocation field_addr;
34400 {
34401 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
34402 field_addr = *field_addr_tmp;
34403 FC_FREE(field_addr_tmp);
34404 }
34405#endif /* FREECIV_JSON_CONNECTION */
34406
34407 log_packet_detailed("packet_unit_change_activity_100: sending info about ()");
34408
34409#ifdef FREECIV_DELTA_PROTOCOL
34410 if (nullptr == *hash) {
34411 *hash = genhash_new_full(hash_packet_unit_change_activity_100, cmp_packet_unit_change_activity_100,
34412 nullptr, nullptr, nullptr, destroy_packet_unit_change_activity);
34413 }
34414 BV_CLR_ALL(fields);
34415
34416 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
34417 old = fc_malloc(sizeof(*old));
34418 /* temporary bitcopy just to insert correctly */
34419 *old = *real_packet;
34420 genhash_insert(*hash, old, old);
34421 init_packet_unit_change_activity(old);
34422 }
34423 differ = (old->unit_id != real_packet->unit_id);
34424 if (differ) {
34425 BV_SET(fields, 0);
34426 }
34427
34428 differ = (old->activity != real_packet->activity);
34429 if (differ) {
34430 BV_SET(fields, 1);
34431 }
34432
34433 differ = (old->target != real_packet->target);
34434 if (differ) {
34435 BV_SET(fields, 2);
34436 }
34437
34438
34439#ifdef FREECIV_JSON_CONNECTION
34440 field_addr.name = "fields";
34441#endif /* FREECIV_JSON_CONNECTION */
34442 e = 0;
34443 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34444 if (e) {
34445 log_packet_detailed("fields bitvector error detected");
34446 }
34447
34448 if (BV_ISSET(fields, 0)) {
34449 log_packet_detailed(" field 'unit_id' has changed");
34450#ifdef FREECIV_JSON_CONNECTION
34451 field_addr.name = "unit_id";
34452#endif /* FREECIV_JSON_CONNECTION */
34453 e = 0;
34454 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
34455 if (e) {
34456 log_packet_detailed("'unit_id' field error detected");
34457 }
34458 }
34459 if (BV_ISSET(fields, 1)) {
34460 log_packet_detailed(" field 'activity' has changed");
34461#ifdef FREECIV_JSON_CONNECTION
34462 field_addr.name = "activity";
34463#endif /* FREECIV_JSON_CONNECTION */
34464 e = 0;
34465 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
34466 if (e) {
34467 log_packet_detailed("'activity' field error detected");
34468 }
34469 }
34470 if (BV_ISSET(fields, 2)) {
34471 log_packet_detailed(" field 'target' has changed");
34472#ifdef FREECIV_JSON_CONNECTION
34473 field_addr.name = "target";
34474#endif /* FREECIV_JSON_CONNECTION */
34475 e = 0;
34476 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
34477 if (e) {
34478 log_packet_detailed("'target' field error detected");
34479 }
34480 }
34481
34482 *old = *real_packet;
34483#endif /* FREECIV_DELTA_PROTOCOL */
34484#ifndef FREECIV_DELTA_PROTOCOL
34485#ifdef FREECIV_JSON_CONNECTION
34486 field_addr.name = "unit_id";
34487#endif /* FREECIV_JSON_CONNECTION */
34488 e = 0;
34489 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
34490 if (e) {
34491 log_packet_detailed("'unit_id' field error detected");
34492 }
34493#ifdef FREECIV_JSON_CONNECTION
34494 field_addr.name = "activity";
34495#endif /* FREECIV_JSON_CONNECTION */
34496 e = 0;
34497 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
34498 if (e) {
34499 log_packet_detailed("'activity' field error detected");
34500 }
34501#ifdef FREECIV_JSON_CONNECTION
34502 field_addr.name = "target";
34503#endif /* FREECIV_JSON_CONNECTION */
34504 e = 0;
34505 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
34506 if (e) {
34507 log_packet_detailed("'target' field error detected");
34508 }
34509
34510#endif
34511 SEND_PACKET_END(PACKET_UNIT_CHANGE_ACTIVITY);
34512}
34513
34514 int send_packet_unit_change_activity(struct connection *pc, const struct packet_unit_change_activity *packet)
34515{
34516 if (!pc->used) {
34517 log_error("WARNING: trying to send data to the closed connection %s",
34518 conn_description(pc));
34519 return -1;
34520 }
34521 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet != nullptr, -1,
34522 "Handler for PACKET_UNIT_CHANGE_ACTIVITY not installed");
34523 return pc->phs.handlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet(pc, packet);
34524}
34525
34526 int dsend_packet_unit_change_activity(struct connection *pc, int unit_id, enum unit_activity activity, int target)
34527{
34528 struct packet_unit_change_activity packet, *real_packet = &packet;
34529
34530 real_packet->unit_id = unit_id;
34531 real_packet->activity = activity;
34532 real_packet->target = target;
34533
34534 return send_packet_unit_change_activity(pc, real_packet);
34535}
34536
34537 static inline void init_packet_diplomacy_init_meeting_req(struct packet_diplomacy_init_meeting_req *packet)
34538{
34539 memset(packet, 0, sizeof(*packet));
34540}
34541
34542#define free_packet_diplomacy_init_meeting_req(_packet) (void) 0
34543#define destroy_packet_diplomacy_init_meeting_req free
34544
34545#ifdef FREECIV_DELTA_PROTOCOL
34546#define hash_packet_diplomacy_init_meeting_req_100 hash_const
34547
34548#define cmp_packet_diplomacy_init_meeting_req_100 cmp_const
34549
34550 BV_DEFINE(packet_diplomacy_init_meeting_req_100_fields, 1);
34551#endif /* FREECIV_DELTA_PROTOCOL */
34552
34553 static struct packet_diplomacy_init_meeting_req *receive_packet_diplomacy_init_meeting_req_100(struct connection *pc)
34554{
34555#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_init_meeting_req(_packet)
34556#ifdef FREECIV_DELTA_PROTOCOL
34557 packet_diplomacy_init_meeting_req_100_fields fields;
34558 struct packet_diplomacy_init_meeting_req *old;
34559 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_INIT_MEETING_REQ;
34560#endif /* FREECIV_DELTA_PROTOCOL */
34561 RECEIVE_PACKET_START(packet_diplomacy_init_meeting_req, real_packet);
34562#ifdef FREECIV_JSON_CONNECTION
34563 struct plocation field_addr;
34564 {
34565 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
34566 field_addr = *field_addr_tmp;
34567 FC_FREE(field_addr_tmp);
34568 }
34569#endif /* FREECIV_JSON_CONNECTION */
34570
34571#ifdef FREECIV_DELTA_PROTOCOL
34572#ifdef FREECIV_JSON_CONNECTION
34573 field_addr.name = "fields";
34574#endif /* FREECIV_JSON_CONNECTION */
34575 DIO_BV_GET(&din, &field_addr, fields);
34576
34577#else /* FREECIV_DELTA_PROTOCOL */
34578#ifdef FREECIV_JSON_CONNECTION
34579 field_addr.name = "counterpart";
34580#endif /* FREECIV_JSON_CONNECTION */
34581 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
34582 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34583 }
34584#endif
34585 log_packet_detailed("packet_diplomacy_init_meeting_req_100: got info about ()");
34586
34587#ifdef FREECIV_DELTA_PROTOCOL
34588 if (nullptr == *hash) {
34589 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_req_100, cmp_packet_diplomacy_init_meeting_req_100,
34590 nullptr, nullptr, nullptr, destroy_packet_diplomacy_init_meeting_req);
34591 }
34592
34593 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
34594 *real_packet = *old;
34595 } else {
34596 /* packet is already initialized empty */
34597 log_packet_detailed(" no old info");
34598 }
34599
34600 if (BV_ISSET(fields, 0)) {
34601 log_packet_detailed(" got field 'counterpart'");
34602#ifdef FREECIV_JSON_CONNECTION
34603 field_addr.name = "counterpart";
34604#endif /* FREECIV_JSON_CONNECTION */
34605 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
34606 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34607 }
34608 }
34609
34610 if (nullptr == old) {
34611 old = fc_malloc(sizeof(*old));
34612 init_packet_diplomacy_init_meeting_req(old);
34613 *old = *real_packet;
34614 genhash_insert(*hash, old, old);
34615 } else {
34616 *old = *real_packet;
34617 }
34618
34619#endif /* FREECIV_DELTA_PROTOCOL */
34620 RECEIVE_PACKET_END(real_packet);
34621#undef FREE_PACKET_STRUCT
34622}
34623
34624 static int send_packet_diplomacy_init_meeting_req_100(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
34625{
34626 const struct packet_diplomacy_init_meeting_req *real_packet = packet;
34627 int e;
34628#ifdef FREECIV_DELTA_PROTOCOL
34629 packet_diplomacy_init_meeting_req_100_fields fields;
34630 struct packet_diplomacy_init_meeting_req *old;
34631 bool differ;
34632 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_INIT_MEETING_REQ;
34633#endif /* FREECIV_DELTA_PROTOCOL */
34634 SEND_PACKET_START(PACKET_DIPLOMACY_INIT_MEETING_REQ);
34635#ifdef FREECIV_JSON_CONNECTION
34636 struct plocation field_addr;
34637 {
34638 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
34639 field_addr = *field_addr_tmp;
34640 FC_FREE(field_addr_tmp);
34641 }
34642#endif /* FREECIV_JSON_CONNECTION */
34643
34644 log_packet_detailed("packet_diplomacy_init_meeting_req_100: sending info about ()");
34645
34646#ifdef FREECIV_DELTA_PROTOCOL
34647 if (nullptr == *hash) {
34648 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_req_100, cmp_packet_diplomacy_init_meeting_req_100,
34649 nullptr, nullptr, nullptr, destroy_packet_diplomacy_init_meeting_req);
34650 }
34651 BV_CLR_ALL(fields);
34652
34653 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
34654 old = fc_malloc(sizeof(*old));
34655 /* temporary bitcopy just to insert correctly */
34656 *old = *real_packet;
34657 genhash_insert(*hash, old, old);
34658 init_packet_diplomacy_init_meeting_req(old);
34659 }
34660 differ = (old->counterpart != real_packet->counterpart);
34661 if (differ) {
34662 BV_SET(fields, 0);
34663 }
34664
34665
34666#ifdef FREECIV_JSON_CONNECTION
34667 field_addr.name = "fields";
34668#endif /* FREECIV_JSON_CONNECTION */
34669 e = 0;
34670 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34671 if (e) {
34672 log_packet_detailed("fields bitvector error detected");
34673 }
34674
34675 if (BV_ISSET(fields, 0)) {
34676 log_packet_detailed(" field 'counterpart' has changed");
34677#ifdef FREECIV_JSON_CONNECTION
34678 field_addr.name = "counterpart";
34679#endif /* FREECIV_JSON_CONNECTION */
34680 e = 0;
34681 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
34682 if (e) {
34683 log_packet_detailed("'counterpart' field error detected");
34684 }
34685 }
34686
34687 *old = *real_packet;
34688#endif /* FREECIV_DELTA_PROTOCOL */
34689#ifndef FREECIV_DELTA_PROTOCOL
34690#ifdef FREECIV_JSON_CONNECTION
34691 field_addr.name = "counterpart";
34692#endif /* FREECIV_JSON_CONNECTION */
34693 e = 0;
34694 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
34695 if (e) {
34696 log_packet_detailed("'counterpart' field error detected");
34697 }
34698
34699#endif
34700 SEND_PACKET_END(PACKET_DIPLOMACY_INIT_MEETING_REQ);
34701}
34702
34703 int send_packet_diplomacy_init_meeting_req(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
34704{
34705 if (!pc->used) {
34706 log_error("WARNING: trying to send data to the closed connection %s",
34707 conn_description(pc));
34708 return -1;
34709 }
34710 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet != nullptr, -1,
34711 "Handler for PACKET_DIPLOMACY_INIT_MEETING_REQ not installed");
34712 return pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet(pc, packet);
34713}
34714
34715 int dsend_packet_diplomacy_init_meeting_req(struct connection *pc, int counterpart)
34716{
34717 struct packet_diplomacy_init_meeting_req packet, *real_packet = &packet;
34718
34719 real_packet->counterpart = counterpart;
34720
34721 return send_packet_diplomacy_init_meeting_req(pc, real_packet);
34722}
34723
34724 static inline void init_packet_diplomacy_init_meeting(struct packet_diplomacy_init_meeting *packet)
34725{
34726 memset(packet, 0, sizeof(*packet));
34727}
34728
34729#define free_packet_diplomacy_init_meeting(_packet) (void) 0
34730#define destroy_packet_diplomacy_init_meeting free
34731
34732#ifdef FREECIV_DELTA_PROTOCOL
34733#define hash_packet_diplomacy_init_meeting_100 hash_const
34734
34735#define cmp_packet_diplomacy_init_meeting_100 cmp_const
34736
34737 BV_DEFINE(packet_diplomacy_init_meeting_100_fields, 2);
34738#endif /* FREECIV_DELTA_PROTOCOL */
34739
34740 static struct packet_diplomacy_init_meeting *receive_packet_diplomacy_init_meeting_100(struct connection *pc)
34741{
34742#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_init_meeting(_packet)
34743#ifdef FREECIV_DELTA_PROTOCOL
34744 packet_diplomacy_init_meeting_100_fields fields;
34745 struct packet_diplomacy_init_meeting *old;
34746 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_INIT_MEETING;
34747#endif /* FREECIV_DELTA_PROTOCOL */
34748 RECEIVE_PACKET_START(packet_diplomacy_init_meeting, real_packet);
34749#ifdef FREECIV_JSON_CONNECTION
34750 struct plocation field_addr;
34751 {
34752 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
34753 field_addr = *field_addr_tmp;
34754 FC_FREE(field_addr_tmp);
34755 }
34756#endif /* FREECIV_JSON_CONNECTION */
34757
34758#ifdef FREECIV_DELTA_PROTOCOL
34759#ifdef FREECIV_JSON_CONNECTION
34760 field_addr.name = "fields";
34761#endif /* FREECIV_JSON_CONNECTION */
34762 DIO_BV_GET(&din, &field_addr, fields);
34763
34764#else /* FREECIV_DELTA_PROTOCOL */
34765#ifdef FREECIV_JSON_CONNECTION
34766 field_addr.name = "counterpart";
34767#endif /* FREECIV_JSON_CONNECTION */
34768 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
34769 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34770 }
34771#ifdef FREECIV_JSON_CONNECTION
34772 field_addr.name = "initiated_from";
34773#endif /* FREECIV_JSON_CONNECTION */
34774 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->initiated_from)) {
34775 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
34776 }
34777#endif
34778 log_packet_detailed("packet_diplomacy_init_meeting_100: got info about ()");
34779
34780#ifdef FREECIV_DELTA_PROTOCOL
34781 if (nullptr == *hash) {
34782 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_100, cmp_packet_diplomacy_init_meeting_100,
34783 nullptr, nullptr, nullptr, destroy_packet_diplomacy_init_meeting);
34784 }
34785
34786 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
34787 *real_packet = *old;
34788 } else {
34789 /* packet is already initialized empty */
34790 log_packet_detailed(" no old info");
34791 }
34792
34793 if (BV_ISSET(fields, 0)) {
34794 log_packet_detailed(" got field 'counterpart'");
34795#ifdef FREECIV_JSON_CONNECTION
34796 field_addr.name = "counterpart";
34797#endif /* FREECIV_JSON_CONNECTION */
34798 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
34799 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34800 }
34801 }
34802 if (BV_ISSET(fields, 1)) {
34803 log_packet_detailed(" got field 'initiated_from'");
34804#ifdef FREECIV_JSON_CONNECTION
34805 field_addr.name = "initiated_from";
34806#endif /* FREECIV_JSON_CONNECTION */
34807 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->initiated_from)) {
34808 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
34809 }
34810 }
34811
34812 if (nullptr == old) {
34813 old = fc_malloc(sizeof(*old));
34814 init_packet_diplomacy_init_meeting(old);
34815 *old = *real_packet;
34816 genhash_insert(*hash, old, old);
34817 } else {
34818 *old = *real_packet;
34819 }
34820
34821#endif /* FREECIV_DELTA_PROTOCOL */
34822 RECEIVE_PACKET_END(real_packet);
34823#undef FREE_PACKET_STRUCT
34824}
34825
34826 static int send_packet_diplomacy_init_meeting_100(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
34827{
34828 const struct packet_diplomacy_init_meeting *real_packet = packet;
34829 int e;
34830#ifdef FREECIV_DELTA_PROTOCOL
34831 packet_diplomacy_init_meeting_100_fields fields;
34832 struct packet_diplomacy_init_meeting *old;
34833 bool differ;
34834 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_INIT_MEETING;
34835#endif /* FREECIV_DELTA_PROTOCOL */
34836 SEND_PACKET_START(PACKET_DIPLOMACY_INIT_MEETING);
34837#ifdef FREECIV_JSON_CONNECTION
34838 struct plocation field_addr;
34839 {
34840 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
34841 field_addr = *field_addr_tmp;
34842 FC_FREE(field_addr_tmp);
34843 }
34844#endif /* FREECIV_JSON_CONNECTION */
34845
34846 log_packet_detailed("packet_diplomacy_init_meeting_100: sending info about ()");
34847
34848#ifdef FREECIV_DELTA_PROTOCOL
34849 if (nullptr == *hash) {
34850 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_100, cmp_packet_diplomacy_init_meeting_100,
34851 nullptr, nullptr, nullptr, destroy_packet_diplomacy_init_meeting);
34852 }
34853 BV_CLR_ALL(fields);
34854
34855 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
34856 old = fc_malloc(sizeof(*old));
34857 /* temporary bitcopy just to insert correctly */
34858 *old = *real_packet;
34859 genhash_insert(*hash, old, old);
34860 init_packet_diplomacy_init_meeting(old);
34861 }
34862 differ = (old->counterpart != real_packet->counterpart);
34863 if (differ) {
34864 BV_SET(fields, 0);
34865 }
34866
34867 differ = (old->initiated_from != real_packet->initiated_from);
34868 if (differ) {
34869 BV_SET(fields, 1);
34870 }
34871
34872
34873#ifdef FREECIV_JSON_CONNECTION
34874 field_addr.name = "fields";
34875#endif /* FREECIV_JSON_CONNECTION */
34876 e = 0;
34877 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34878 if (e) {
34879 log_packet_detailed("fields bitvector error detected");
34880 }
34881
34882 if (BV_ISSET(fields, 0)) {
34883 log_packet_detailed(" field 'counterpart' has changed");
34884#ifdef FREECIV_JSON_CONNECTION
34885 field_addr.name = "counterpart";
34886#endif /* FREECIV_JSON_CONNECTION */
34887 e = 0;
34888 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
34889 if (e) {
34890 log_packet_detailed("'counterpart' field error detected");
34891 }
34892 }
34893 if (BV_ISSET(fields, 1)) {
34894 log_packet_detailed(" field 'initiated_from' has changed");
34895#ifdef FREECIV_JSON_CONNECTION
34896 field_addr.name = "initiated_from";
34897#endif /* FREECIV_JSON_CONNECTION */
34898 e = 0;
34899 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->initiated_from);
34900 if (e) {
34901 log_packet_detailed("'initiated_from' field error detected");
34902 }
34903 }
34904
34905 *old = *real_packet;
34906#endif /* FREECIV_DELTA_PROTOCOL */
34907#ifndef FREECIV_DELTA_PROTOCOL
34908#ifdef FREECIV_JSON_CONNECTION
34909 field_addr.name = "counterpart";
34910#endif /* FREECIV_JSON_CONNECTION */
34911 e = 0;
34912 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
34913 if (e) {
34914 log_packet_detailed("'counterpart' field error detected");
34915 }
34916#ifdef FREECIV_JSON_CONNECTION
34917 field_addr.name = "initiated_from";
34918#endif /* FREECIV_JSON_CONNECTION */
34919 e = 0;
34920 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->initiated_from);
34921 if (e) {
34922 log_packet_detailed("'initiated_from' field error detected");
34923 }
34924
34925#endif
34926 SEND_PACKET_END(PACKET_DIPLOMACY_INIT_MEETING);
34927}
34928
34929 int send_packet_diplomacy_init_meeting(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
34930{
34931 if (!pc->used) {
34932 log_error("WARNING: trying to send data to the closed connection %s",
34933 conn_description(pc));
34934 return -1;
34935 }
34936 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet != nullptr, -1,
34937 "Handler for PACKET_DIPLOMACY_INIT_MEETING not installed");
34938 return pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet(pc, packet);
34939}
34940
34941 void lsend_packet_diplomacy_init_meeting(struct conn_list *dest, const struct packet_diplomacy_init_meeting *packet)
34942{
34943 conn_list_iterate(dest, pconn) {
34944 send_packet_diplomacy_init_meeting(pconn, packet);
34945 } conn_list_iterate_end;
34946}
34947
34948 int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
34949{
34950 struct packet_diplomacy_init_meeting packet, *real_packet = &packet;
34951
34952 real_packet->counterpart = counterpart;
34953 real_packet->initiated_from = initiated_from;
34954
34955 return send_packet_diplomacy_init_meeting(pc, real_packet);
34956}
34957
34958 void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
34959{
34960 struct packet_diplomacy_init_meeting packet, *real_packet = &packet;
34961
34962 real_packet->counterpart = counterpart;
34963 real_packet->initiated_from = initiated_from;
34964
34965 lsend_packet_diplomacy_init_meeting(dest, real_packet);
34966}
34967
34968 static inline void init_packet_diplomacy_cancel_meeting_req(struct packet_diplomacy_cancel_meeting_req *packet)
34969{
34970 memset(packet, 0, sizeof(*packet));
34971}
34972
34973#define free_packet_diplomacy_cancel_meeting_req(_packet) (void) 0
34974#define destroy_packet_diplomacy_cancel_meeting_req free
34975
34976#ifdef FREECIV_DELTA_PROTOCOL
34977#define hash_packet_diplomacy_cancel_meeting_req_100 hash_const
34978
34979#define cmp_packet_diplomacy_cancel_meeting_req_100 cmp_const
34980
34981 BV_DEFINE(packet_diplomacy_cancel_meeting_req_100_fields, 1);
34982#endif /* FREECIV_DELTA_PROTOCOL */
34983
34984 static struct packet_diplomacy_cancel_meeting_req *receive_packet_diplomacy_cancel_meeting_req_100(struct connection *pc)
34985{
34986#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_cancel_meeting_req(_packet)
34987#ifdef FREECIV_DELTA_PROTOCOL
34988 packet_diplomacy_cancel_meeting_req_100_fields fields;
34989 struct packet_diplomacy_cancel_meeting_req *old;
34990 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_MEETING_REQ;
34991#endif /* FREECIV_DELTA_PROTOCOL */
34992 RECEIVE_PACKET_START(packet_diplomacy_cancel_meeting_req, real_packet);
34993#ifdef FREECIV_JSON_CONNECTION
34994 struct plocation field_addr;
34995 {
34996 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
34997 field_addr = *field_addr_tmp;
34998 FC_FREE(field_addr_tmp);
34999 }
35000#endif /* FREECIV_JSON_CONNECTION */
35001
35002#ifdef FREECIV_DELTA_PROTOCOL
35003#ifdef FREECIV_JSON_CONNECTION
35004 field_addr.name = "fields";
35005#endif /* FREECIV_JSON_CONNECTION */
35006 DIO_BV_GET(&din, &field_addr, fields);
35007
35008#else /* FREECIV_DELTA_PROTOCOL */
35009#ifdef FREECIV_JSON_CONNECTION
35010 field_addr.name = "counterpart";
35011#endif /* FREECIV_JSON_CONNECTION */
35012 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35013 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35014 }
35015#endif
35016 log_packet_detailed("packet_diplomacy_cancel_meeting_req_100: got info about ()");
35017
35018#ifdef FREECIV_DELTA_PROTOCOL
35019 if (nullptr == *hash) {
35020 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_req_100, cmp_packet_diplomacy_cancel_meeting_req_100,
35021 nullptr, nullptr, nullptr, destroy_packet_diplomacy_cancel_meeting_req);
35022 }
35023
35024 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35025 *real_packet = *old;
35026 } else {
35027 /* packet is already initialized empty */
35028 log_packet_detailed(" no old info");
35029 }
35030
35031 if (BV_ISSET(fields, 0)) {
35032 log_packet_detailed(" got field 'counterpart'");
35033#ifdef FREECIV_JSON_CONNECTION
35034 field_addr.name = "counterpart";
35035#endif /* FREECIV_JSON_CONNECTION */
35036 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35037 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35038 }
35039 }
35040
35041 if (nullptr == old) {
35042 old = fc_malloc(sizeof(*old));
35043 init_packet_diplomacy_cancel_meeting_req(old);
35044 *old = *real_packet;
35045 genhash_insert(*hash, old, old);
35046 } else {
35047 *old = *real_packet;
35048 }
35049
35050#endif /* FREECIV_DELTA_PROTOCOL */
35051 RECEIVE_PACKET_END(real_packet);
35052#undef FREE_PACKET_STRUCT
35053}
35054
35055 static int send_packet_diplomacy_cancel_meeting_req_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
35056{
35057 const struct packet_diplomacy_cancel_meeting_req *real_packet = packet;
35058 int e;
35059#ifdef FREECIV_DELTA_PROTOCOL
35060 packet_diplomacy_cancel_meeting_req_100_fields fields;
35061 struct packet_diplomacy_cancel_meeting_req *old;
35062 bool differ;
35063 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_MEETING_REQ;
35064#endif /* FREECIV_DELTA_PROTOCOL */
35065 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_MEETING_REQ);
35066#ifdef FREECIV_JSON_CONNECTION
35067 struct plocation field_addr;
35068 {
35069 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
35070 field_addr = *field_addr_tmp;
35071 FC_FREE(field_addr_tmp);
35072 }
35073#endif /* FREECIV_JSON_CONNECTION */
35074
35075 log_packet_detailed("packet_diplomacy_cancel_meeting_req_100: sending info about ()");
35076
35077#ifdef FREECIV_DELTA_PROTOCOL
35078 if (nullptr == *hash) {
35079 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_req_100, cmp_packet_diplomacy_cancel_meeting_req_100,
35080 nullptr, nullptr, nullptr, destroy_packet_diplomacy_cancel_meeting_req);
35081 }
35082 BV_CLR_ALL(fields);
35083
35084 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35085 old = fc_malloc(sizeof(*old));
35086 /* temporary bitcopy just to insert correctly */
35087 *old = *real_packet;
35088 genhash_insert(*hash, old, old);
35089 init_packet_diplomacy_cancel_meeting_req(old);
35090 }
35091 differ = (old->counterpart != real_packet->counterpart);
35092 if (differ) {
35093 BV_SET(fields, 0);
35094 }
35095
35096
35097#ifdef FREECIV_JSON_CONNECTION
35098 field_addr.name = "fields";
35099#endif /* FREECIV_JSON_CONNECTION */
35100 e = 0;
35101 e |= DIO_BV_PUT(&dout, &field_addr, fields);
35102 if (e) {
35103 log_packet_detailed("fields bitvector error detected");
35104 }
35105
35106 if (BV_ISSET(fields, 0)) {
35107 log_packet_detailed(" field 'counterpart' has changed");
35108#ifdef FREECIV_JSON_CONNECTION
35109 field_addr.name = "counterpart";
35110#endif /* FREECIV_JSON_CONNECTION */
35111 e = 0;
35112 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35113 if (e) {
35114 log_packet_detailed("'counterpart' field error detected");
35115 }
35116 }
35117
35118 *old = *real_packet;
35119#endif /* FREECIV_DELTA_PROTOCOL */
35120#ifndef FREECIV_DELTA_PROTOCOL
35121#ifdef FREECIV_JSON_CONNECTION
35122 field_addr.name = "counterpart";
35123#endif /* FREECIV_JSON_CONNECTION */
35124 e = 0;
35125 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35126 if (e) {
35127 log_packet_detailed("'counterpart' field error detected");
35128 }
35129
35130#endif
35131 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_MEETING_REQ);
35132}
35133
35134 int send_packet_diplomacy_cancel_meeting_req(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
35135{
35136 if (!pc->used) {
35137 log_error("WARNING: trying to send data to the closed connection %s",
35138 conn_description(pc));
35139 return -1;
35140 }
35141 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet != nullptr, -1,
35142 "Handler for PACKET_DIPLOMACY_CANCEL_MEETING_REQ not installed");
35143 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet(pc, packet);
35144}
35145
35146 int dsend_packet_diplomacy_cancel_meeting_req(struct connection *pc, int counterpart)
35147{
35148 struct packet_diplomacy_cancel_meeting_req packet, *real_packet = &packet;
35149
35150 real_packet->counterpart = counterpart;
35151
35152 return send_packet_diplomacy_cancel_meeting_req(pc, real_packet);
35153}
35154
35155 static inline void init_packet_diplomacy_cancel_meeting(struct packet_diplomacy_cancel_meeting *packet)
35156{
35157 memset(packet, 0, sizeof(*packet));
35158}
35159
35160#define free_packet_diplomacy_cancel_meeting(_packet) (void) 0
35161#define destroy_packet_diplomacy_cancel_meeting free
35162
35163#ifdef FREECIV_DELTA_PROTOCOL
35164#define hash_packet_diplomacy_cancel_meeting_100 hash_const
35165
35166#define cmp_packet_diplomacy_cancel_meeting_100 cmp_const
35167
35168 BV_DEFINE(packet_diplomacy_cancel_meeting_100_fields, 2);
35169#endif /* FREECIV_DELTA_PROTOCOL */
35170
35171 static struct packet_diplomacy_cancel_meeting *receive_packet_diplomacy_cancel_meeting_100(struct connection *pc)
35172{
35173#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_cancel_meeting(_packet)
35174#ifdef FREECIV_DELTA_PROTOCOL
35175 packet_diplomacy_cancel_meeting_100_fields fields;
35176 struct packet_diplomacy_cancel_meeting *old;
35177 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_MEETING;
35178#endif /* FREECIV_DELTA_PROTOCOL */
35179 RECEIVE_PACKET_START(packet_diplomacy_cancel_meeting, real_packet);
35180#ifdef FREECIV_JSON_CONNECTION
35181 struct plocation field_addr;
35182 {
35183 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
35184 field_addr = *field_addr_tmp;
35185 FC_FREE(field_addr_tmp);
35186 }
35187#endif /* FREECIV_JSON_CONNECTION */
35188
35189#ifdef FREECIV_DELTA_PROTOCOL
35190#ifdef FREECIV_JSON_CONNECTION
35191 field_addr.name = "fields";
35192#endif /* FREECIV_JSON_CONNECTION */
35193 DIO_BV_GET(&din, &field_addr, fields);
35194
35195#else /* FREECIV_DELTA_PROTOCOL */
35196#ifdef FREECIV_JSON_CONNECTION
35197 field_addr.name = "counterpart";
35198#endif /* FREECIV_JSON_CONNECTION */
35199 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35200 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35201 }
35202#ifdef FREECIV_JSON_CONNECTION
35203 field_addr.name = "initiated_from";
35204#endif /* FREECIV_JSON_CONNECTION */
35205 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->initiated_from)) {
35206 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
35207 }
35208#endif
35209 log_packet_detailed("packet_diplomacy_cancel_meeting_100: got info about ()");
35210
35211#ifdef FREECIV_DELTA_PROTOCOL
35212 if (nullptr == *hash) {
35213 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_100, cmp_packet_diplomacy_cancel_meeting_100,
35214 nullptr, nullptr, nullptr, destroy_packet_diplomacy_cancel_meeting);
35215 }
35216
35217 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35218 *real_packet = *old;
35219 } else {
35220 /* packet is already initialized empty */
35221 log_packet_detailed(" no old info");
35222 }
35223
35224 if (BV_ISSET(fields, 0)) {
35225 log_packet_detailed(" got field 'counterpart'");
35226#ifdef FREECIV_JSON_CONNECTION
35227 field_addr.name = "counterpart";
35228#endif /* FREECIV_JSON_CONNECTION */
35229 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35230 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35231 }
35232 }
35233 if (BV_ISSET(fields, 1)) {
35234 log_packet_detailed(" got field 'initiated_from'");
35235#ifdef FREECIV_JSON_CONNECTION
35236 field_addr.name = "initiated_from";
35237#endif /* FREECIV_JSON_CONNECTION */
35238 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->initiated_from)) {
35239 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
35240 }
35241 }
35242
35243 if (nullptr == old) {
35244 old = fc_malloc(sizeof(*old));
35245 init_packet_diplomacy_cancel_meeting(old);
35246 *old = *real_packet;
35247 genhash_insert(*hash, old, old);
35248 } else {
35249 *old = *real_packet;
35250 }
35251
35252#endif /* FREECIV_DELTA_PROTOCOL */
35253 RECEIVE_PACKET_END(real_packet);
35254#undef FREE_PACKET_STRUCT
35255}
35256
35257 static int send_packet_diplomacy_cancel_meeting_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
35258{
35259 const struct packet_diplomacy_cancel_meeting *real_packet = packet;
35260 int e;
35261#ifdef FREECIV_DELTA_PROTOCOL
35262 packet_diplomacy_cancel_meeting_100_fields fields;
35263 struct packet_diplomacy_cancel_meeting *old;
35264 bool differ;
35265 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_MEETING;
35266#endif /* FREECIV_DELTA_PROTOCOL */
35267 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_MEETING);
35268#ifdef FREECIV_JSON_CONNECTION
35269 struct plocation field_addr;
35270 {
35271 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
35272 field_addr = *field_addr_tmp;
35273 FC_FREE(field_addr_tmp);
35274 }
35275#endif /* FREECIV_JSON_CONNECTION */
35276
35277 log_packet_detailed("packet_diplomacy_cancel_meeting_100: sending info about ()");
35278
35279#ifdef FREECIV_DELTA_PROTOCOL
35280 if (nullptr == *hash) {
35281 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_100, cmp_packet_diplomacy_cancel_meeting_100,
35282 nullptr, nullptr, nullptr, destroy_packet_diplomacy_cancel_meeting);
35283 }
35284 BV_CLR_ALL(fields);
35285
35286 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35287 old = fc_malloc(sizeof(*old));
35288 /* temporary bitcopy just to insert correctly */
35289 *old = *real_packet;
35290 genhash_insert(*hash, old, old);
35291 init_packet_diplomacy_cancel_meeting(old);
35292 }
35293 differ = (old->counterpart != real_packet->counterpart);
35294 if (differ) {
35295 BV_SET(fields, 0);
35296 }
35297
35298 differ = (old->initiated_from != real_packet->initiated_from);
35299 if (differ) {
35300 BV_SET(fields, 1);
35301 }
35302
35303
35304#ifdef FREECIV_JSON_CONNECTION
35305 field_addr.name = "fields";
35306#endif /* FREECIV_JSON_CONNECTION */
35307 e = 0;
35308 e |= DIO_BV_PUT(&dout, &field_addr, fields);
35309 if (e) {
35310 log_packet_detailed("fields bitvector error detected");
35311 }
35312
35313 if (BV_ISSET(fields, 0)) {
35314 log_packet_detailed(" field 'counterpart' has changed");
35315#ifdef FREECIV_JSON_CONNECTION
35316 field_addr.name = "counterpart";
35317#endif /* FREECIV_JSON_CONNECTION */
35318 e = 0;
35319 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35320 if (e) {
35321 log_packet_detailed("'counterpart' field error detected");
35322 }
35323 }
35324 if (BV_ISSET(fields, 1)) {
35325 log_packet_detailed(" field 'initiated_from' has changed");
35326#ifdef FREECIV_JSON_CONNECTION
35327 field_addr.name = "initiated_from";
35328#endif /* FREECIV_JSON_CONNECTION */
35329 e = 0;
35330 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->initiated_from);
35331 if (e) {
35332 log_packet_detailed("'initiated_from' field error detected");
35333 }
35334 }
35335
35336 *old = *real_packet;
35337#endif /* FREECIV_DELTA_PROTOCOL */
35338#ifndef FREECIV_DELTA_PROTOCOL
35339#ifdef FREECIV_JSON_CONNECTION
35340 field_addr.name = "counterpart";
35341#endif /* FREECIV_JSON_CONNECTION */
35342 e = 0;
35343 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35344 if (e) {
35345 log_packet_detailed("'counterpart' field error detected");
35346 }
35347#ifdef FREECIV_JSON_CONNECTION
35348 field_addr.name = "initiated_from";
35349#endif /* FREECIV_JSON_CONNECTION */
35350 e = 0;
35351 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->initiated_from);
35352 if (e) {
35353 log_packet_detailed("'initiated_from' field error detected");
35354 }
35355
35356#endif
35357 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_MEETING);
35358}
35359
35360 int send_packet_diplomacy_cancel_meeting(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
35361{
35362 if (!pc->used) {
35363 log_error("WARNING: trying to send data to the closed connection %s",
35364 conn_description(pc));
35365 return -1;
35366 }
35367 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet != nullptr, -1,
35368 "Handler for PACKET_DIPLOMACY_CANCEL_MEETING not installed");
35369 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet(pc, packet);
35370}
35371
35372 void lsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, const struct packet_diplomacy_cancel_meeting *packet)
35373{
35374 conn_list_iterate(dest, pconn) {
35375 send_packet_diplomacy_cancel_meeting(pconn, packet);
35376 } conn_list_iterate_end;
35377}
35378
35379 int dsend_packet_diplomacy_cancel_meeting(struct connection *pc, int counterpart, int initiated_from)
35380{
35381 struct packet_diplomacy_cancel_meeting packet, *real_packet = &packet;
35382
35383 real_packet->counterpart = counterpart;
35384 real_packet->initiated_from = initiated_from;
35385
35386 return send_packet_diplomacy_cancel_meeting(pc, real_packet);
35387}
35388
35389 void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
35390{
35391 struct packet_diplomacy_cancel_meeting packet, *real_packet = &packet;
35392
35393 real_packet->counterpart = counterpart;
35394 real_packet->initiated_from = initiated_from;
35395
35396 lsend_packet_diplomacy_cancel_meeting(dest, real_packet);
35397}
35398
35399 static inline void init_packet_diplomacy_create_clause_req(struct packet_diplomacy_create_clause_req *packet)
35400{
35401 memset(packet, 0, sizeof(*packet));
35402}
35403
35404#define free_packet_diplomacy_create_clause_req(_packet) (void) 0
35405#define destroy_packet_diplomacy_create_clause_req free
35406
35407#ifdef FREECIV_DELTA_PROTOCOL
35408#define hash_packet_diplomacy_create_clause_req_100 hash_const
35409
35410#define cmp_packet_diplomacy_create_clause_req_100 cmp_const
35411
35412 BV_DEFINE(packet_diplomacy_create_clause_req_100_fields, 4);
35413#endif /* FREECIV_DELTA_PROTOCOL */
35414
35415 static struct packet_diplomacy_create_clause_req *receive_packet_diplomacy_create_clause_req_100(struct connection *pc)
35416{
35417#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_create_clause_req(_packet)
35418#ifdef FREECIV_DELTA_PROTOCOL
35419 packet_diplomacy_create_clause_req_100_fields fields;
35420 struct packet_diplomacy_create_clause_req *old;
35421 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CREATE_CLAUSE_REQ;
35422#endif /* FREECIV_DELTA_PROTOCOL */
35423 RECEIVE_PACKET_START(packet_diplomacy_create_clause_req, real_packet);
35424#ifdef FREECIV_JSON_CONNECTION
35425 struct plocation field_addr;
35426 {
35427 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
35428 field_addr = *field_addr_tmp;
35429 FC_FREE(field_addr_tmp);
35430 }
35431#endif /* FREECIV_JSON_CONNECTION */
35432
35433#ifdef FREECIV_DELTA_PROTOCOL
35434#ifdef FREECIV_JSON_CONNECTION
35435 field_addr.name = "fields";
35436#endif /* FREECIV_JSON_CONNECTION */
35437 DIO_BV_GET(&din, &field_addr, fields);
35438
35439#else /* FREECIV_DELTA_PROTOCOL */
35440#ifdef FREECIV_JSON_CONNECTION
35441 field_addr.name = "counterpart";
35442#endif /* FREECIV_JSON_CONNECTION */
35443 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35444 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35445 }
35446#ifdef FREECIV_JSON_CONNECTION
35447 field_addr.name = "giver";
35448#endif /* FREECIV_JSON_CONNECTION */
35449 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
35450 RECEIVE_PACKET_FIELD_ERROR(giver);
35451 }
35452#ifdef FREECIV_JSON_CONNECTION
35453 field_addr.name = "type";
35454#endif /* FREECIV_JSON_CONNECTION */
35455 {
35456 int readin;
35457
35458 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35459 RECEIVE_PACKET_FIELD_ERROR(type);
35460 }
35461 real_packet->type = readin;
35462 }
35463#ifdef FREECIV_JSON_CONNECTION
35464 field_addr.name = "value";
35465#endif /* FREECIV_JSON_CONNECTION */
35466 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35467 RECEIVE_PACKET_FIELD_ERROR(value);
35468 }
35469#endif
35470 log_packet_detailed("packet_diplomacy_create_clause_req_100: got info about ()");
35471
35472#ifdef FREECIV_DELTA_PROTOCOL
35473 if (nullptr == *hash) {
35474 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_req_100, cmp_packet_diplomacy_create_clause_req_100,
35475 nullptr, nullptr, nullptr, destroy_packet_diplomacy_create_clause_req);
35476 }
35477
35478 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35479 *real_packet = *old;
35480 } else {
35481 /* packet is already initialized empty */
35482 log_packet_detailed(" no old info");
35483 }
35484
35485 if (BV_ISSET(fields, 0)) {
35486 log_packet_detailed(" got field 'counterpart'");
35487#ifdef FREECIV_JSON_CONNECTION
35488 field_addr.name = "counterpart";
35489#endif /* FREECIV_JSON_CONNECTION */
35490 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35491 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35492 }
35493 }
35494 if (BV_ISSET(fields, 1)) {
35495 log_packet_detailed(" got field 'giver'");
35496#ifdef FREECIV_JSON_CONNECTION
35497 field_addr.name = "giver";
35498#endif /* FREECIV_JSON_CONNECTION */
35499 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
35500 RECEIVE_PACKET_FIELD_ERROR(giver);
35501 }
35502 }
35503 if (BV_ISSET(fields, 2)) {
35504 log_packet_detailed(" got field 'type'");
35505#ifdef FREECIV_JSON_CONNECTION
35506 field_addr.name = "type";
35507#endif /* FREECIV_JSON_CONNECTION */
35508 {
35509 int readin;
35510
35511 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35512 RECEIVE_PACKET_FIELD_ERROR(type);
35513 }
35514 real_packet->type = readin;
35515 }
35516 }
35517 if (BV_ISSET(fields, 3)) {
35518 log_packet_detailed(" got field 'value'");
35519#ifdef FREECIV_JSON_CONNECTION
35520 field_addr.name = "value";
35521#endif /* FREECIV_JSON_CONNECTION */
35522 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35523 RECEIVE_PACKET_FIELD_ERROR(value);
35524 }
35525 }
35526
35527 if (nullptr == old) {
35528 old = fc_malloc(sizeof(*old));
35529 init_packet_diplomacy_create_clause_req(old);
35530 *old = *real_packet;
35531 genhash_insert(*hash, old, old);
35532 } else {
35533 *old = *real_packet;
35534 }
35535
35536#endif /* FREECIV_DELTA_PROTOCOL */
35537 RECEIVE_PACKET_END(real_packet);
35538#undef FREE_PACKET_STRUCT
35539}
35540
35541 static int send_packet_diplomacy_create_clause_req_100(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
35542{
35543 const struct packet_diplomacy_create_clause_req *real_packet = packet;
35544 int e;
35545#ifdef FREECIV_DELTA_PROTOCOL
35546 packet_diplomacy_create_clause_req_100_fields fields;
35547 struct packet_diplomacy_create_clause_req *old;
35548 bool differ;
35549 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CREATE_CLAUSE_REQ;
35550#endif /* FREECIV_DELTA_PROTOCOL */
35551 SEND_PACKET_START(PACKET_DIPLOMACY_CREATE_CLAUSE_REQ);
35552#ifdef FREECIV_JSON_CONNECTION
35553 struct plocation field_addr;
35554 {
35555 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
35556 field_addr = *field_addr_tmp;
35557 FC_FREE(field_addr_tmp);
35558 }
35559#endif /* FREECIV_JSON_CONNECTION */
35560
35561 log_packet_detailed("packet_diplomacy_create_clause_req_100: sending info about ()");
35562
35563#ifdef FREECIV_DELTA_PROTOCOL
35564 if (nullptr == *hash) {
35565 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_req_100, cmp_packet_diplomacy_create_clause_req_100,
35566 nullptr, nullptr, nullptr, destroy_packet_diplomacy_create_clause_req);
35567 }
35568 BV_CLR_ALL(fields);
35569
35570 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35571 old = fc_malloc(sizeof(*old));
35572 /* temporary bitcopy just to insert correctly */
35573 *old = *real_packet;
35574 genhash_insert(*hash, old, old);
35575 init_packet_diplomacy_create_clause_req(old);
35576 }
35577 differ = (old->counterpart != real_packet->counterpart);
35578 if (differ) {
35579 BV_SET(fields, 0);
35580 }
35581
35582 differ = (old->giver != real_packet->giver);
35583 if (differ) {
35584 BV_SET(fields, 1);
35585 }
35586
35587 differ = (old->type != real_packet->type);
35588 if (differ) {
35589 BV_SET(fields, 2);
35590 }
35591
35592 differ = (old->value != real_packet->value);
35593 if (differ) {
35594 BV_SET(fields, 3);
35595 }
35596
35597
35598#ifdef FREECIV_JSON_CONNECTION
35599 field_addr.name = "fields";
35600#endif /* FREECIV_JSON_CONNECTION */
35601 e = 0;
35602 e |= DIO_BV_PUT(&dout, &field_addr, fields);
35603 if (e) {
35604 log_packet_detailed("fields bitvector error detected");
35605 }
35606
35607 if (BV_ISSET(fields, 0)) {
35608 log_packet_detailed(" field 'counterpart' has changed");
35609#ifdef FREECIV_JSON_CONNECTION
35610 field_addr.name = "counterpart";
35611#endif /* FREECIV_JSON_CONNECTION */
35612 e = 0;
35613 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35614 if (e) {
35615 log_packet_detailed("'counterpart' field error detected");
35616 }
35617 }
35618 if (BV_ISSET(fields, 1)) {
35619 log_packet_detailed(" field 'giver' has changed");
35620#ifdef FREECIV_JSON_CONNECTION
35621 field_addr.name = "giver";
35622#endif /* FREECIV_JSON_CONNECTION */
35623 e = 0;
35624 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
35625 if (e) {
35626 log_packet_detailed("'giver' field error detected");
35627 }
35628 }
35629 if (BV_ISSET(fields, 2)) {
35630 log_packet_detailed(" field 'type' has changed");
35631#ifdef FREECIV_JSON_CONNECTION
35632 field_addr.name = "type";
35633#endif /* FREECIV_JSON_CONNECTION */
35634 e = 0;
35635 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35636 if (e) {
35637 log_packet_detailed("'type' field error detected");
35638 }
35639 }
35640 if (BV_ISSET(fields, 3)) {
35641 log_packet_detailed(" field 'value' has changed");
35642#ifdef FREECIV_JSON_CONNECTION
35643 field_addr.name = "value";
35644#endif /* FREECIV_JSON_CONNECTION */
35645 e = 0;
35646 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35647 if (e) {
35648 log_packet_detailed("'value' field error detected");
35649 }
35650 }
35651
35652 *old = *real_packet;
35653#endif /* FREECIV_DELTA_PROTOCOL */
35654#ifndef FREECIV_DELTA_PROTOCOL
35655#ifdef FREECIV_JSON_CONNECTION
35656 field_addr.name = "counterpart";
35657#endif /* FREECIV_JSON_CONNECTION */
35658 e = 0;
35659 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35660 if (e) {
35661 log_packet_detailed("'counterpart' field error detected");
35662 }
35663#ifdef FREECIV_JSON_CONNECTION
35664 field_addr.name = "giver";
35665#endif /* FREECIV_JSON_CONNECTION */
35666 e = 0;
35667 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
35668 if (e) {
35669 log_packet_detailed("'giver' field error detected");
35670 }
35671#ifdef FREECIV_JSON_CONNECTION
35672 field_addr.name = "type";
35673#endif /* FREECIV_JSON_CONNECTION */
35674 e = 0;
35675 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35676 if (e) {
35677 log_packet_detailed("'type' field error detected");
35678 }
35679#ifdef FREECIV_JSON_CONNECTION
35680 field_addr.name = "value";
35681#endif /* FREECIV_JSON_CONNECTION */
35682 e = 0;
35683 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35684 if (e) {
35685 log_packet_detailed("'value' field error detected");
35686 }
35687
35688#endif
35689 SEND_PACKET_END(PACKET_DIPLOMACY_CREATE_CLAUSE_REQ);
35690}
35691
35692 int send_packet_diplomacy_create_clause_req(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
35693{
35694 if (!pc->used) {
35695 log_error("WARNING: trying to send data to the closed connection %s",
35696 conn_description(pc));
35697 return -1;
35698 }
35699 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet != nullptr, -1,
35700 "Handler for PACKET_DIPLOMACY_CREATE_CLAUSE_REQ not installed");
35701 return pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet(pc, packet);
35702}
35703
35704 int dsend_packet_diplomacy_create_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
35705{
35706 struct packet_diplomacy_create_clause_req packet, *real_packet = &packet;
35707
35708 real_packet->counterpart = counterpart;
35709 real_packet->giver = giver;
35710 real_packet->type = type;
35711 real_packet->value = value;
35712
35713 return send_packet_diplomacy_create_clause_req(pc, real_packet);
35714}
35715
35716 static inline void init_packet_diplomacy_create_clause(struct packet_diplomacy_create_clause *packet)
35717{
35718 memset(packet, 0, sizeof(*packet));
35719}
35720
35721#define free_packet_diplomacy_create_clause(_packet) (void) 0
35722#define destroy_packet_diplomacy_create_clause free
35723
35724#ifdef FREECIV_DELTA_PROTOCOL
35725#define hash_packet_diplomacy_create_clause_100 hash_const
35726
35727#define cmp_packet_diplomacy_create_clause_100 cmp_const
35728
35729 BV_DEFINE(packet_diplomacy_create_clause_100_fields, 4);
35730#endif /* FREECIV_DELTA_PROTOCOL */
35731
35732 static struct packet_diplomacy_create_clause *receive_packet_diplomacy_create_clause_100(struct connection *pc)
35733{
35734#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_create_clause(_packet)
35735#ifdef FREECIV_DELTA_PROTOCOL
35736 packet_diplomacy_create_clause_100_fields fields;
35737 struct packet_diplomacy_create_clause *old;
35738 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CREATE_CLAUSE;
35739#endif /* FREECIV_DELTA_PROTOCOL */
35740 RECEIVE_PACKET_START(packet_diplomacy_create_clause, real_packet);
35741#ifdef FREECIV_JSON_CONNECTION
35742 struct plocation field_addr;
35743 {
35744 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
35745 field_addr = *field_addr_tmp;
35746 FC_FREE(field_addr_tmp);
35747 }
35748#endif /* FREECIV_JSON_CONNECTION */
35749
35750#ifdef FREECIV_DELTA_PROTOCOL
35751#ifdef FREECIV_JSON_CONNECTION
35752 field_addr.name = "fields";
35753#endif /* FREECIV_JSON_CONNECTION */
35754 DIO_BV_GET(&din, &field_addr, fields);
35755
35756#else /* FREECIV_DELTA_PROTOCOL */
35757#ifdef FREECIV_JSON_CONNECTION
35758 field_addr.name = "counterpart";
35759#endif /* FREECIV_JSON_CONNECTION */
35760 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35761 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35762 }
35763#ifdef FREECIV_JSON_CONNECTION
35764 field_addr.name = "giver";
35765#endif /* FREECIV_JSON_CONNECTION */
35766 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
35767 RECEIVE_PACKET_FIELD_ERROR(giver);
35768 }
35769#ifdef FREECIV_JSON_CONNECTION
35770 field_addr.name = "type";
35771#endif /* FREECIV_JSON_CONNECTION */
35772 {
35773 int readin;
35774
35775 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35776 RECEIVE_PACKET_FIELD_ERROR(type);
35777 }
35778 real_packet->type = readin;
35779 }
35780#ifdef FREECIV_JSON_CONNECTION
35781 field_addr.name = "value";
35782#endif /* FREECIV_JSON_CONNECTION */
35783 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35784 RECEIVE_PACKET_FIELD_ERROR(value);
35785 }
35786#endif
35787 log_packet_detailed("packet_diplomacy_create_clause_100: got info about ()");
35788
35789#ifdef FREECIV_DELTA_PROTOCOL
35790 if (nullptr == *hash) {
35791 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_100, cmp_packet_diplomacy_create_clause_100,
35792 nullptr, nullptr, nullptr, destroy_packet_diplomacy_create_clause);
35793 }
35794
35795 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35796 *real_packet = *old;
35797 } else {
35798 /* packet is already initialized empty */
35799 log_packet_detailed(" no old info");
35800 }
35801
35802 if (BV_ISSET(fields, 0)) {
35803 log_packet_detailed(" got field 'counterpart'");
35804#ifdef FREECIV_JSON_CONNECTION
35805 field_addr.name = "counterpart";
35806#endif /* FREECIV_JSON_CONNECTION */
35807 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
35808 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35809 }
35810 }
35811 if (BV_ISSET(fields, 1)) {
35812 log_packet_detailed(" got field 'giver'");
35813#ifdef FREECIV_JSON_CONNECTION
35814 field_addr.name = "giver";
35815#endif /* FREECIV_JSON_CONNECTION */
35816 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
35817 RECEIVE_PACKET_FIELD_ERROR(giver);
35818 }
35819 }
35820 if (BV_ISSET(fields, 2)) {
35821 log_packet_detailed(" got field 'type'");
35822#ifdef FREECIV_JSON_CONNECTION
35823 field_addr.name = "type";
35824#endif /* FREECIV_JSON_CONNECTION */
35825 {
35826 int readin;
35827
35828 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35829 RECEIVE_PACKET_FIELD_ERROR(type);
35830 }
35831 real_packet->type = readin;
35832 }
35833 }
35834 if (BV_ISSET(fields, 3)) {
35835 log_packet_detailed(" got field 'value'");
35836#ifdef FREECIV_JSON_CONNECTION
35837 field_addr.name = "value";
35838#endif /* FREECIV_JSON_CONNECTION */
35839 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35840 RECEIVE_PACKET_FIELD_ERROR(value);
35841 }
35842 }
35843
35844 if (nullptr == old) {
35845 old = fc_malloc(sizeof(*old));
35846 init_packet_diplomacy_create_clause(old);
35847 *old = *real_packet;
35848 genhash_insert(*hash, old, old);
35849 } else {
35850 *old = *real_packet;
35851 }
35852
35853#endif /* FREECIV_DELTA_PROTOCOL */
35854 RECEIVE_PACKET_END(real_packet);
35855#undef FREE_PACKET_STRUCT
35856}
35857
35858 static int send_packet_diplomacy_create_clause_100(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
35859{
35860 const struct packet_diplomacy_create_clause *real_packet = packet;
35861 int e;
35862#ifdef FREECIV_DELTA_PROTOCOL
35863 packet_diplomacy_create_clause_100_fields fields;
35864 struct packet_diplomacy_create_clause *old;
35865 bool differ;
35866 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CREATE_CLAUSE;
35867#endif /* FREECIV_DELTA_PROTOCOL */
35868 SEND_PACKET_START(PACKET_DIPLOMACY_CREATE_CLAUSE);
35869#ifdef FREECIV_JSON_CONNECTION
35870 struct plocation field_addr;
35871 {
35872 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
35873 field_addr = *field_addr_tmp;
35874 FC_FREE(field_addr_tmp);
35875 }
35876#endif /* FREECIV_JSON_CONNECTION */
35877
35878 log_packet_detailed("packet_diplomacy_create_clause_100: sending info about ()");
35879
35880#ifdef FREECIV_DELTA_PROTOCOL
35881 if (nullptr == *hash) {
35882 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_100, cmp_packet_diplomacy_create_clause_100,
35883 nullptr, nullptr, nullptr, destroy_packet_diplomacy_create_clause);
35884 }
35885 BV_CLR_ALL(fields);
35886
35887 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35888 old = fc_malloc(sizeof(*old));
35889 /* temporary bitcopy just to insert correctly */
35890 *old = *real_packet;
35891 genhash_insert(*hash, old, old);
35892 init_packet_diplomacy_create_clause(old);
35893 }
35894 differ = (old->counterpart != real_packet->counterpart);
35895 if (differ) {
35896 BV_SET(fields, 0);
35897 }
35898
35899 differ = (old->giver != real_packet->giver);
35900 if (differ) {
35901 BV_SET(fields, 1);
35902 }
35903
35904 differ = (old->type != real_packet->type);
35905 if (differ) {
35906 BV_SET(fields, 2);
35907 }
35908
35909 differ = (old->value != real_packet->value);
35910 if (differ) {
35911 BV_SET(fields, 3);
35912 }
35913
35914
35915#ifdef FREECIV_JSON_CONNECTION
35916 field_addr.name = "fields";
35917#endif /* FREECIV_JSON_CONNECTION */
35918 e = 0;
35919 e |= DIO_BV_PUT(&dout, &field_addr, fields);
35920 if (e) {
35921 log_packet_detailed("fields bitvector error detected");
35922 }
35923
35924 if (BV_ISSET(fields, 0)) {
35925 log_packet_detailed(" field 'counterpart' has changed");
35926#ifdef FREECIV_JSON_CONNECTION
35927 field_addr.name = "counterpart";
35928#endif /* FREECIV_JSON_CONNECTION */
35929 e = 0;
35930 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35931 if (e) {
35932 log_packet_detailed("'counterpart' field error detected");
35933 }
35934 }
35935 if (BV_ISSET(fields, 1)) {
35936 log_packet_detailed(" field 'giver' has changed");
35937#ifdef FREECIV_JSON_CONNECTION
35938 field_addr.name = "giver";
35939#endif /* FREECIV_JSON_CONNECTION */
35940 e = 0;
35941 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
35942 if (e) {
35943 log_packet_detailed("'giver' field error detected");
35944 }
35945 }
35946 if (BV_ISSET(fields, 2)) {
35947 log_packet_detailed(" field 'type' has changed");
35948#ifdef FREECIV_JSON_CONNECTION
35949 field_addr.name = "type";
35950#endif /* FREECIV_JSON_CONNECTION */
35951 e = 0;
35952 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35953 if (e) {
35954 log_packet_detailed("'type' field error detected");
35955 }
35956 }
35957 if (BV_ISSET(fields, 3)) {
35958 log_packet_detailed(" field 'value' has changed");
35959#ifdef FREECIV_JSON_CONNECTION
35960 field_addr.name = "value";
35961#endif /* FREECIV_JSON_CONNECTION */
35962 e = 0;
35963 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35964 if (e) {
35965 log_packet_detailed("'value' field error detected");
35966 }
35967 }
35968
35969 *old = *real_packet;
35970#endif /* FREECIV_DELTA_PROTOCOL */
35971#ifndef FREECIV_DELTA_PROTOCOL
35972#ifdef FREECIV_JSON_CONNECTION
35973 field_addr.name = "counterpart";
35974#endif /* FREECIV_JSON_CONNECTION */
35975 e = 0;
35976 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
35977 if (e) {
35978 log_packet_detailed("'counterpart' field error detected");
35979 }
35980#ifdef FREECIV_JSON_CONNECTION
35981 field_addr.name = "giver";
35982#endif /* FREECIV_JSON_CONNECTION */
35983 e = 0;
35984 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
35985 if (e) {
35986 log_packet_detailed("'giver' field error detected");
35987 }
35988#ifdef FREECIV_JSON_CONNECTION
35989 field_addr.name = "type";
35990#endif /* FREECIV_JSON_CONNECTION */
35991 e = 0;
35992 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35993 if (e) {
35994 log_packet_detailed("'type' field error detected");
35995 }
35996#ifdef FREECIV_JSON_CONNECTION
35997 field_addr.name = "value";
35998#endif /* FREECIV_JSON_CONNECTION */
35999 e = 0;
36000 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
36001 if (e) {
36002 log_packet_detailed("'value' field error detected");
36003 }
36004
36005#endif
36006 SEND_PACKET_END(PACKET_DIPLOMACY_CREATE_CLAUSE);
36007}
36008
36009 int send_packet_diplomacy_create_clause(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
36010{
36011 if (!pc->used) {
36012 log_error("WARNING: trying to send data to the closed connection %s",
36013 conn_description(pc));
36014 return -1;
36015 }
36016 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet != nullptr, -1,
36017 "Handler for PACKET_DIPLOMACY_CREATE_CLAUSE not installed");
36018 return pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet(pc, packet);
36019}
36020
36021 void lsend_packet_diplomacy_create_clause(struct conn_list *dest, const struct packet_diplomacy_create_clause *packet)
36022{
36023 conn_list_iterate(dest, pconn) {
36024 send_packet_diplomacy_create_clause(pconn, packet);
36025 } conn_list_iterate_end;
36026}
36027
36028 int dsend_packet_diplomacy_create_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
36029{
36030 struct packet_diplomacy_create_clause packet, *real_packet = &packet;
36031
36032 real_packet->counterpart = counterpart;
36033 real_packet->giver = giver;
36034 real_packet->type = type;
36035 real_packet->value = value;
36036
36037 return send_packet_diplomacy_create_clause(pc, real_packet);
36038}
36039
36040 void dlsend_packet_diplomacy_create_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
36041{
36042 struct packet_diplomacy_create_clause packet, *real_packet = &packet;
36043
36044 real_packet->counterpart = counterpart;
36045 real_packet->giver = giver;
36046 real_packet->type = type;
36047 real_packet->value = value;
36048
36049 lsend_packet_diplomacy_create_clause(dest, real_packet);
36050}
36051
36052 static inline void init_packet_diplomacy_remove_clause_req(struct packet_diplomacy_remove_clause_req *packet)
36053{
36054 memset(packet, 0, sizeof(*packet));
36055}
36056
36057#define free_packet_diplomacy_remove_clause_req(_packet) (void) 0
36058#define destroy_packet_diplomacy_remove_clause_req free
36059
36060#ifdef FREECIV_DELTA_PROTOCOL
36061#define hash_packet_diplomacy_remove_clause_req_100 hash_const
36062
36063#define cmp_packet_diplomacy_remove_clause_req_100 cmp_const
36064
36065 BV_DEFINE(packet_diplomacy_remove_clause_req_100_fields, 4);
36066#endif /* FREECIV_DELTA_PROTOCOL */
36067
36068 static struct packet_diplomacy_remove_clause_req *receive_packet_diplomacy_remove_clause_req_100(struct connection *pc)
36069{
36070#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_remove_clause_req(_packet)
36071#ifdef FREECIV_DELTA_PROTOCOL
36072 packet_diplomacy_remove_clause_req_100_fields fields;
36073 struct packet_diplomacy_remove_clause_req *old;
36074 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ;
36075#endif /* FREECIV_DELTA_PROTOCOL */
36076 RECEIVE_PACKET_START(packet_diplomacy_remove_clause_req, real_packet);
36077#ifdef FREECIV_JSON_CONNECTION
36078 struct plocation field_addr;
36079 {
36080 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
36081 field_addr = *field_addr_tmp;
36082 FC_FREE(field_addr_tmp);
36083 }
36084#endif /* FREECIV_JSON_CONNECTION */
36085
36086#ifdef FREECIV_DELTA_PROTOCOL
36087#ifdef FREECIV_JSON_CONNECTION
36088 field_addr.name = "fields";
36089#endif /* FREECIV_JSON_CONNECTION */
36090 DIO_BV_GET(&din, &field_addr, fields);
36091
36092#else /* FREECIV_DELTA_PROTOCOL */
36093#ifdef FREECIV_JSON_CONNECTION
36094 field_addr.name = "counterpart";
36095#endif /* FREECIV_JSON_CONNECTION */
36096 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36097 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36098 }
36099#ifdef FREECIV_JSON_CONNECTION
36100 field_addr.name = "giver";
36101#endif /* FREECIV_JSON_CONNECTION */
36102 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
36103 RECEIVE_PACKET_FIELD_ERROR(giver);
36104 }
36105#ifdef FREECIV_JSON_CONNECTION
36106 field_addr.name = "type";
36107#endif /* FREECIV_JSON_CONNECTION */
36108 {
36109 int readin;
36110
36111 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36112 RECEIVE_PACKET_FIELD_ERROR(type);
36113 }
36114 real_packet->type = readin;
36115 }
36116#ifdef FREECIV_JSON_CONNECTION
36117 field_addr.name = "value";
36118#endif /* FREECIV_JSON_CONNECTION */
36119 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
36120 RECEIVE_PACKET_FIELD_ERROR(value);
36121 }
36122#endif
36123 log_packet_detailed("packet_diplomacy_remove_clause_req_100: got info about ()");
36124
36125#ifdef FREECIV_DELTA_PROTOCOL
36126 if (nullptr == *hash) {
36127 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_req_100, cmp_packet_diplomacy_remove_clause_req_100,
36128 nullptr, nullptr, nullptr, destroy_packet_diplomacy_remove_clause_req);
36129 }
36130
36131 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36132 *real_packet = *old;
36133 } else {
36134 /* packet is already initialized empty */
36135 log_packet_detailed(" no old info");
36136 }
36137
36138 if (BV_ISSET(fields, 0)) {
36139 log_packet_detailed(" got field 'counterpart'");
36140#ifdef FREECIV_JSON_CONNECTION
36141 field_addr.name = "counterpart";
36142#endif /* FREECIV_JSON_CONNECTION */
36143 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36144 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36145 }
36146 }
36147 if (BV_ISSET(fields, 1)) {
36148 log_packet_detailed(" got field 'giver'");
36149#ifdef FREECIV_JSON_CONNECTION
36150 field_addr.name = "giver";
36151#endif /* FREECIV_JSON_CONNECTION */
36152 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
36153 RECEIVE_PACKET_FIELD_ERROR(giver);
36154 }
36155 }
36156 if (BV_ISSET(fields, 2)) {
36157 log_packet_detailed(" got field 'type'");
36158#ifdef FREECIV_JSON_CONNECTION
36159 field_addr.name = "type";
36160#endif /* FREECIV_JSON_CONNECTION */
36161 {
36162 int readin;
36163
36164 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36165 RECEIVE_PACKET_FIELD_ERROR(type);
36166 }
36167 real_packet->type = readin;
36168 }
36169 }
36170 if (BV_ISSET(fields, 3)) {
36171 log_packet_detailed(" got field 'value'");
36172#ifdef FREECIV_JSON_CONNECTION
36173 field_addr.name = "value";
36174#endif /* FREECIV_JSON_CONNECTION */
36175 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
36176 RECEIVE_PACKET_FIELD_ERROR(value);
36177 }
36178 }
36179
36180 if (nullptr == old) {
36181 old = fc_malloc(sizeof(*old));
36182 init_packet_diplomacy_remove_clause_req(old);
36183 *old = *real_packet;
36184 genhash_insert(*hash, old, old);
36185 } else {
36186 *old = *real_packet;
36187 }
36188
36189#endif /* FREECIV_DELTA_PROTOCOL */
36190 RECEIVE_PACKET_END(real_packet);
36191#undef FREE_PACKET_STRUCT
36192}
36193
36194 static int send_packet_diplomacy_remove_clause_req_100(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
36195{
36196 const struct packet_diplomacy_remove_clause_req *real_packet = packet;
36197 int e;
36198#ifdef FREECIV_DELTA_PROTOCOL
36199 packet_diplomacy_remove_clause_req_100_fields fields;
36200 struct packet_diplomacy_remove_clause_req *old;
36201 bool differ;
36202 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ;
36203#endif /* FREECIV_DELTA_PROTOCOL */
36204 SEND_PACKET_START(PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ);
36205#ifdef FREECIV_JSON_CONNECTION
36206 struct plocation field_addr;
36207 {
36208 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
36209 field_addr = *field_addr_tmp;
36210 FC_FREE(field_addr_tmp);
36211 }
36212#endif /* FREECIV_JSON_CONNECTION */
36213
36214 log_packet_detailed("packet_diplomacy_remove_clause_req_100: sending info about ()");
36215
36216#ifdef FREECIV_DELTA_PROTOCOL
36217 if (nullptr == *hash) {
36218 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_req_100, cmp_packet_diplomacy_remove_clause_req_100,
36219 nullptr, nullptr, nullptr, destroy_packet_diplomacy_remove_clause_req);
36220 }
36221 BV_CLR_ALL(fields);
36222
36223 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36224 old = fc_malloc(sizeof(*old));
36225 /* temporary bitcopy just to insert correctly */
36226 *old = *real_packet;
36227 genhash_insert(*hash, old, old);
36228 init_packet_diplomacy_remove_clause_req(old);
36229 }
36230 differ = (old->counterpart != real_packet->counterpart);
36231 if (differ) {
36232 BV_SET(fields, 0);
36233 }
36234
36235 differ = (old->giver != real_packet->giver);
36236 if (differ) {
36237 BV_SET(fields, 1);
36238 }
36239
36240 differ = (old->type != real_packet->type);
36241 if (differ) {
36242 BV_SET(fields, 2);
36243 }
36244
36245 differ = (old->value != real_packet->value);
36246 if (differ) {
36247 BV_SET(fields, 3);
36248 }
36249
36250
36251#ifdef FREECIV_JSON_CONNECTION
36252 field_addr.name = "fields";
36253#endif /* FREECIV_JSON_CONNECTION */
36254 e = 0;
36255 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36256 if (e) {
36257 log_packet_detailed("fields bitvector error detected");
36258 }
36259
36260 if (BV_ISSET(fields, 0)) {
36261 log_packet_detailed(" field 'counterpart' has changed");
36262#ifdef FREECIV_JSON_CONNECTION
36263 field_addr.name = "counterpart";
36264#endif /* FREECIV_JSON_CONNECTION */
36265 e = 0;
36266 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
36267 if (e) {
36268 log_packet_detailed("'counterpart' field error detected");
36269 }
36270 }
36271 if (BV_ISSET(fields, 1)) {
36272 log_packet_detailed(" field 'giver' has changed");
36273#ifdef FREECIV_JSON_CONNECTION
36274 field_addr.name = "giver";
36275#endif /* FREECIV_JSON_CONNECTION */
36276 e = 0;
36277 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
36278 if (e) {
36279 log_packet_detailed("'giver' field error detected");
36280 }
36281 }
36282 if (BV_ISSET(fields, 2)) {
36283 log_packet_detailed(" field 'type' has changed");
36284#ifdef FREECIV_JSON_CONNECTION
36285 field_addr.name = "type";
36286#endif /* FREECIV_JSON_CONNECTION */
36287 e = 0;
36288 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
36289 if (e) {
36290 log_packet_detailed("'type' field error detected");
36291 }
36292 }
36293 if (BV_ISSET(fields, 3)) {
36294 log_packet_detailed(" field 'value' has changed");
36295#ifdef FREECIV_JSON_CONNECTION
36296 field_addr.name = "value";
36297#endif /* FREECIV_JSON_CONNECTION */
36298 e = 0;
36299 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
36300 if (e) {
36301 log_packet_detailed("'value' field error detected");
36302 }
36303 }
36304
36305 *old = *real_packet;
36306#endif /* FREECIV_DELTA_PROTOCOL */
36307#ifndef FREECIV_DELTA_PROTOCOL
36308#ifdef FREECIV_JSON_CONNECTION
36309 field_addr.name = "counterpart";
36310#endif /* FREECIV_JSON_CONNECTION */
36311 e = 0;
36312 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
36313 if (e) {
36314 log_packet_detailed("'counterpart' field error detected");
36315 }
36316#ifdef FREECIV_JSON_CONNECTION
36317 field_addr.name = "giver";
36318#endif /* FREECIV_JSON_CONNECTION */
36319 e = 0;
36320 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
36321 if (e) {
36322 log_packet_detailed("'giver' field error detected");
36323 }
36324#ifdef FREECIV_JSON_CONNECTION
36325 field_addr.name = "type";
36326#endif /* FREECIV_JSON_CONNECTION */
36327 e = 0;
36328 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
36329 if (e) {
36330 log_packet_detailed("'type' field error detected");
36331 }
36332#ifdef FREECIV_JSON_CONNECTION
36333 field_addr.name = "value";
36334#endif /* FREECIV_JSON_CONNECTION */
36335 e = 0;
36336 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
36337 if (e) {
36338 log_packet_detailed("'value' field error detected");
36339 }
36340
36341#endif
36342 SEND_PACKET_END(PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ);
36343}
36344
36345 int send_packet_diplomacy_remove_clause_req(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
36346{
36347 if (!pc->used) {
36348 log_error("WARNING: trying to send data to the closed connection %s",
36349 conn_description(pc));
36350 return -1;
36351 }
36352 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet != nullptr, -1,
36353 "Handler for PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ not installed");
36354 return pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet(pc, packet);
36355}
36356
36357 int dsend_packet_diplomacy_remove_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
36358{
36359 struct packet_diplomacy_remove_clause_req packet, *real_packet = &packet;
36360
36361 real_packet->counterpart = counterpart;
36362 real_packet->giver = giver;
36363 real_packet->type = type;
36364 real_packet->value = value;
36365
36366 return send_packet_diplomacy_remove_clause_req(pc, real_packet);
36367}
36368
36369 static inline void init_packet_diplomacy_remove_clause(struct packet_diplomacy_remove_clause *packet)
36370{
36371 memset(packet, 0, sizeof(*packet));
36372}
36373
36374#define free_packet_diplomacy_remove_clause(_packet) (void) 0
36375#define destroy_packet_diplomacy_remove_clause free
36376
36377#ifdef FREECIV_DELTA_PROTOCOL
36378#define hash_packet_diplomacy_remove_clause_100 hash_const
36379
36380#define cmp_packet_diplomacy_remove_clause_100 cmp_const
36381
36382 BV_DEFINE(packet_diplomacy_remove_clause_100_fields, 4);
36383#endif /* FREECIV_DELTA_PROTOCOL */
36384
36385 static struct packet_diplomacy_remove_clause *receive_packet_diplomacy_remove_clause_100(struct connection *pc)
36386{
36387#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_remove_clause(_packet)
36388#ifdef FREECIV_DELTA_PROTOCOL
36389 packet_diplomacy_remove_clause_100_fields fields;
36390 struct packet_diplomacy_remove_clause *old;
36391 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_REMOVE_CLAUSE;
36392#endif /* FREECIV_DELTA_PROTOCOL */
36393 RECEIVE_PACKET_START(packet_diplomacy_remove_clause, real_packet);
36394#ifdef FREECIV_JSON_CONNECTION
36395 struct plocation field_addr;
36396 {
36397 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
36398 field_addr = *field_addr_tmp;
36399 FC_FREE(field_addr_tmp);
36400 }
36401#endif /* FREECIV_JSON_CONNECTION */
36402
36403#ifdef FREECIV_DELTA_PROTOCOL
36404#ifdef FREECIV_JSON_CONNECTION
36405 field_addr.name = "fields";
36406#endif /* FREECIV_JSON_CONNECTION */
36407 DIO_BV_GET(&din, &field_addr, fields);
36408
36409#else /* FREECIV_DELTA_PROTOCOL */
36410#ifdef FREECIV_JSON_CONNECTION
36411 field_addr.name = "counterpart";
36412#endif /* FREECIV_JSON_CONNECTION */
36413 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36414 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36415 }
36416#ifdef FREECIV_JSON_CONNECTION
36417 field_addr.name = "giver";
36418#endif /* FREECIV_JSON_CONNECTION */
36419 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
36420 RECEIVE_PACKET_FIELD_ERROR(giver);
36421 }
36422#ifdef FREECIV_JSON_CONNECTION
36423 field_addr.name = "type";
36424#endif /* FREECIV_JSON_CONNECTION */
36425 {
36426 int readin;
36427
36428 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36429 RECEIVE_PACKET_FIELD_ERROR(type);
36430 }
36431 real_packet->type = readin;
36432 }
36433#ifdef FREECIV_JSON_CONNECTION
36434 field_addr.name = "value";
36435#endif /* FREECIV_JSON_CONNECTION */
36436 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
36437 RECEIVE_PACKET_FIELD_ERROR(value);
36438 }
36439#endif
36440 log_packet_detailed("packet_diplomacy_remove_clause_100: got info about ()");
36441
36442#ifdef FREECIV_DELTA_PROTOCOL
36443 if (nullptr == *hash) {
36444 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_100, cmp_packet_diplomacy_remove_clause_100,
36445 nullptr, nullptr, nullptr, destroy_packet_diplomacy_remove_clause);
36446 }
36447
36448 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36449 *real_packet = *old;
36450 } else {
36451 /* packet is already initialized empty */
36452 log_packet_detailed(" no old info");
36453 }
36454
36455 if (BV_ISSET(fields, 0)) {
36456 log_packet_detailed(" got field 'counterpart'");
36457#ifdef FREECIV_JSON_CONNECTION
36458 field_addr.name = "counterpart";
36459#endif /* FREECIV_JSON_CONNECTION */
36460 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36461 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36462 }
36463 }
36464 if (BV_ISSET(fields, 1)) {
36465 log_packet_detailed(" got field 'giver'");
36466#ifdef FREECIV_JSON_CONNECTION
36467 field_addr.name = "giver";
36468#endif /* FREECIV_JSON_CONNECTION */
36469 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->giver)) {
36470 RECEIVE_PACKET_FIELD_ERROR(giver);
36471 }
36472 }
36473 if (BV_ISSET(fields, 2)) {
36474 log_packet_detailed(" got field 'type'");
36475#ifdef FREECIV_JSON_CONNECTION
36476 field_addr.name = "type";
36477#endif /* FREECIV_JSON_CONNECTION */
36478 {
36479 int readin;
36480
36481 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36482 RECEIVE_PACKET_FIELD_ERROR(type);
36483 }
36484 real_packet->type = readin;
36485 }
36486 }
36487 if (BV_ISSET(fields, 3)) {
36488 log_packet_detailed(" got field 'value'");
36489#ifdef FREECIV_JSON_CONNECTION
36490 field_addr.name = "value";
36491#endif /* FREECIV_JSON_CONNECTION */
36492 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
36493 RECEIVE_PACKET_FIELD_ERROR(value);
36494 }
36495 }
36496
36497 if (nullptr == old) {
36498 old = fc_malloc(sizeof(*old));
36499 init_packet_diplomacy_remove_clause(old);
36500 *old = *real_packet;
36501 genhash_insert(*hash, old, old);
36502 } else {
36503 *old = *real_packet;
36504 }
36505
36506#endif /* FREECIV_DELTA_PROTOCOL */
36507 RECEIVE_PACKET_END(real_packet);
36508#undef FREE_PACKET_STRUCT
36509}
36510
36511 static int send_packet_diplomacy_remove_clause_100(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
36512{
36513 const struct packet_diplomacy_remove_clause *real_packet = packet;
36514 int e;
36515#ifdef FREECIV_DELTA_PROTOCOL
36516 packet_diplomacy_remove_clause_100_fields fields;
36517 struct packet_diplomacy_remove_clause *old;
36518 bool differ;
36519 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_REMOVE_CLAUSE;
36520#endif /* FREECIV_DELTA_PROTOCOL */
36521 SEND_PACKET_START(PACKET_DIPLOMACY_REMOVE_CLAUSE);
36522#ifdef FREECIV_JSON_CONNECTION
36523 struct plocation field_addr;
36524 {
36525 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
36526 field_addr = *field_addr_tmp;
36527 FC_FREE(field_addr_tmp);
36528 }
36529#endif /* FREECIV_JSON_CONNECTION */
36530
36531 log_packet_detailed("packet_diplomacy_remove_clause_100: sending info about ()");
36532
36533#ifdef FREECIV_DELTA_PROTOCOL
36534 if (nullptr == *hash) {
36535 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_100, cmp_packet_diplomacy_remove_clause_100,
36536 nullptr, nullptr, nullptr, destroy_packet_diplomacy_remove_clause);
36537 }
36538 BV_CLR_ALL(fields);
36539
36540 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36541 old = fc_malloc(sizeof(*old));
36542 /* temporary bitcopy just to insert correctly */
36543 *old = *real_packet;
36544 genhash_insert(*hash, old, old);
36545 init_packet_diplomacy_remove_clause(old);
36546 }
36547 differ = (old->counterpart != real_packet->counterpart);
36548 if (differ) {
36549 BV_SET(fields, 0);
36550 }
36551
36552 differ = (old->giver != real_packet->giver);
36553 if (differ) {
36554 BV_SET(fields, 1);
36555 }
36556
36557 differ = (old->type != real_packet->type);
36558 if (differ) {
36559 BV_SET(fields, 2);
36560 }
36561
36562 differ = (old->value != real_packet->value);
36563 if (differ) {
36564 BV_SET(fields, 3);
36565 }
36566
36567
36568#ifdef FREECIV_JSON_CONNECTION
36569 field_addr.name = "fields";
36570#endif /* FREECIV_JSON_CONNECTION */
36571 e = 0;
36572 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36573 if (e) {
36574 log_packet_detailed("fields bitvector error detected");
36575 }
36576
36577 if (BV_ISSET(fields, 0)) {
36578 log_packet_detailed(" field 'counterpart' has changed");
36579#ifdef FREECIV_JSON_CONNECTION
36580 field_addr.name = "counterpart";
36581#endif /* FREECIV_JSON_CONNECTION */
36582 e = 0;
36583 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
36584 if (e) {
36585 log_packet_detailed("'counterpart' field error detected");
36586 }
36587 }
36588 if (BV_ISSET(fields, 1)) {
36589 log_packet_detailed(" field 'giver' has changed");
36590#ifdef FREECIV_JSON_CONNECTION
36591 field_addr.name = "giver";
36592#endif /* FREECIV_JSON_CONNECTION */
36593 e = 0;
36594 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
36595 if (e) {
36596 log_packet_detailed("'giver' field error detected");
36597 }
36598 }
36599 if (BV_ISSET(fields, 2)) {
36600 log_packet_detailed(" field 'type' has changed");
36601#ifdef FREECIV_JSON_CONNECTION
36602 field_addr.name = "type";
36603#endif /* FREECIV_JSON_CONNECTION */
36604 e = 0;
36605 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
36606 if (e) {
36607 log_packet_detailed("'type' field error detected");
36608 }
36609 }
36610 if (BV_ISSET(fields, 3)) {
36611 log_packet_detailed(" field 'value' has changed");
36612#ifdef FREECIV_JSON_CONNECTION
36613 field_addr.name = "value";
36614#endif /* FREECIV_JSON_CONNECTION */
36615 e = 0;
36616 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
36617 if (e) {
36618 log_packet_detailed("'value' field error detected");
36619 }
36620 }
36621
36622 *old = *real_packet;
36623#endif /* FREECIV_DELTA_PROTOCOL */
36624#ifndef FREECIV_DELTA_PROTOCOL
36625#ifdef FREECIV_JSON_CONNECTION
36626 field_addr.name = "counterpart";
36627#endif /* FREECIV_JSON_CONNECTION */
36628 e = 0;
36629 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
36630 if (e) {
36631 log_packet_detailed("'counterpart' field error detected");
36632 }
36633#ifdef FREECIV_JSON_CONNECTION
36634 field_addr.name = "giver";
36635#endif /* FREECIV_JSON_CONNECTION */
36636 e = 0;
36637 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->giver);
36638 if (e) {
36639 log_packet_detailed("'giver' field error detected");
36640 }
36641#ifdef FREECIV_JSON_CONNECTION
36642 field_addr.name = "type";
36643#endif /* FREECIV_JSON_CONNECTION */
36644 e = 0;
36645 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
36646 if (e) {
36647 log_packet_detailed("'type' field error detected");
36648 }
36649#ifdef FREECIV_JSON_CONNECTION
36650 field_addr.name = "value";
36651#endif /* FREECIV_JSON_CONNECTION */
36652 e = 0;
36653 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
36654 if (e) {
36655 log_packet_detailed("'value' field error detected");
36656 }
36657
36658#endif
36659 SEND_PACKET_END(PACKET_DIPLOMACY_REMOVE_CLAUSE);
36660}
36661
36662 int send_packet_diplomacy_remove_clause(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
36663{
36664 if (!pc->used) {
36665 log_error("WARNING: trying to send data to the closed connection %s",
36666 conn_description(pc));
36667 return -1;
36668 }
36669 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet != nullptr, -1,
36670 "Handler for PACKET_DIPLOMACY_REMOVE_CLAUSE not installed");
36671 return pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet(pc, packet);
36672}
36673
36674 void lsend_packet_diplomacy_remove_clause(struct conn_list *dest, const struct packet_diplomacy_remove_clause *packet)
36675{
36676 conn_list_iterate(dest, pconn) {
36677 send_packet_diplomacy_remove_clause(pconn, packet);
36678 } conn_list_iterate_end;
36679}
36680
36681 int dsend_packet_diplomacy_remove_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
36682{
36683 struct packet_diplomacy_remove_clause packet, *real_packet = &packet;
36684
36685 real_packet->counterpart = counterpart;
36686 real_packet->giver = giver;
36687 real_packet->type = type;
36688 real_packet->value = value;
36689
36690 return send_packet_diplomacy_remove_clause(pc, real_packet);
36691}
36692
36693 void dlsend_packet_diplomacy_remove_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
36694{
36695 struct packet_diplomacy_remove_clause packet, *real_packet = &packet;
36696
36697 real_packet->counterpart = counterpart;
36698 real_packet->giver = giver;
36699 real_packet->type = type;
36700 real_packet->value = value;
36701
36702 lsend_packet_diplomacy_remove_clause(dest, real_packet);
36703}
36704
36705 static inline void init_packet_diplomacy_accept_treaty_req(struct packet_diplomacy_accept_treaty_req *packet)
36706{
36707 memset(packet, 0, sizeof(*packet));
36708}
36709
36710#define free_packet_diplomacy_accept_treaty_req(_packet) (void) 0
36711#define destroy_packet_diplomacy_accept_treaty_req free
36712
36713#ifdef FREECIV_DELTA_PROTOCOL
36714#define hash_packet_diplomacy_accept_treaty_req_100 hash_const
36715
36716#define cmp_packet_diplomacy_accept_treaty_req_100 cmp_const
36717
36718 BV_DEFINE(packet_diplomacy_accept_treaty_req_100_fields, 1);
36719#endif /* FREECIV_DELTA_PROTOCOL */
36720
36721 static struct packet_diplomacy_accept_treaty_req *receive_packet_diplomacy_accept_treaty_req_100(struct connection *pc)
36722{
36723#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_accept_treaty_req(_packet)
36724#ifdef FREECIV_DELTA_PROTOCOL
36725 packet_diplomacy_accept_treaty_req_100_fields fields;
36726 struct packet_diplomacy_accept_treaty_req *old;
36727 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_ACCEPT_TREATY_REQ;
36728#endif /* FREECIV_DELTA_PROTOCOL */
36729 RECEIVE_PACKET_START(packet_diplomacy_accept_treaty_req, real_packet);
36730#ifdef FREECIV_JSON_CONNECTION
36731 struct plocation field_addr;
36732 {
36733 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
36734 field_addr = *field_addr_tmp;
36735 FC_FREE(field_addr_tmp);
36736 }
36737#endif /* FREECIV_JSON_CONNECTION */
36738
36739#ifdef FREECIV_DELTA_PROTOCOL
36740#ifdef FREECIV_JSON_CONNECTION
36741 field_addr.name = "fields";
36742#endif /* FREECIV_JSON_CONNECTION */
36743 DIO_BV_GET(&din, &field_addr, fields);
36744
36745#else /* FREECIV_DELTA_PROTOCOL */
36746#ifdef FREECIV_JSON_CONNECTION
36747 field_addr.name = "counterpart";
36748#endif /* FREECIV_JSON_CONNECTION */
36749 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36750 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36751 }
36752#endif
36753 log_packet_detailed("packet_diplomacy_accept_treaty_req_100: got info about ()");
36754
36755#ifdef FREECIV_DELTA_PROTOCOL
36756 if (nullptr == *hash) {
36757 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_req_100, cmp_packet_diplomacy_accept_treaty_req_100,
36758 nullptr, nullptr, nullptr, destroy_packet_diplomacy_accept_treaty_req);
36759 }
36760
36761 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36762 *real_packet = *old;
36763 } else {
36764 /* packet is already initialized empty */
36765 log_packet_detailed(" no old info");
36766 }
36767
36768 if (BV_ISSET(fields, 0)) {
36769 log_packet_detailed(" got field 'counterpart'");
36770#ifdef FREECIV_JSON_CONNECTION
36771 field_addr.name = "counterpart";
36772#endif /* FREECIV_JSON_CONNECTION */
36773 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36774 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36775 }
36776 }
36777
36778 if (nullptr == old) {
36779 old = fc_malloc(sizeof(*old));
36780 init_packet_diplomacy_accept_treaty_req(old);
36781 *old = *real_packet;
36782 genhash_insert(*hash, old, old);
36783 } else {
36784 *old = *real_packet;
36785 }
36786
36787#endif /* FREECIV_DELTA_PROTOCOL */
36788 RECEIVE_PACKET_END(real_packet);
36789#undef FREE_PACKET_STRUCT
36790}
36791
36792 static int send_packet_diplomacy_accept_treaty_req_100(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
36793{
36794 const struct packet_diplomacy_accept_treaty_req *real_packet = packet;
36795 int e;
36796#ifdef FREECIV_DELTA_PROTOCOL
36797 packet_diplomacy_accept_treaty_req_100_fields fields;
36798 struct packet_diplomacy_accept_treaty_req *old;
36799 bool differ;
36800 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_ACCEPT_TREATY_REQ;
36801#endif /* FREECIV_DELTA_PROTOCOL */
36802 SEND_PACKET_START(PACKET_DIPLOMACY_ACCEPT_TREATY_REQ);
36803#ifdef FREECIV_JSON_CONNECTION
36804 struct plocation field_addr;
36805 {
36806 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
36807 field_addr = *field_addr_tmp;
36808 FC_FREE(field_addr_tmp);
36809 }
36810#endif /* FREECIV_JSON_CONNECTION */
36811
36812 log_packet_detailed("packet_diplomacy_accept_treaty_req_100: sending info about ()");
36813
36814#ifdef FREECIV_DELTA_PROTOCOL
36815 if (nullptr == *hash) {
36816 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_req_100, cmp_packet_diplomacy_accept_treaty_req_100,
36817 nullptr, nullptr, nullptr, destroy_packet_diplomacy_accept_treaty_req);
36818 }
36819 BV_CLR_ALL(fields);
36820
36821 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36822 old = fc_malloc(sizeof(*old));
36823 /* temporary bitcopy just to insert correctly */
36824 *old = *real_packet;
36825 genhash_insert(*hash, old, old);
36826 init_packet_diplomacy_accept_treaty_req(old);
36827 }
36828 differ = (old->counterpart != real_packet->counterpart);
36829 if (differ) {
36830 BV_SET(fields, 0);
36831 }
36832
36833
36834#ifdef FREECIV_JSON_CONNECTION
36835 field_addr.name = "fields";
36836#endif /* FREECIV_JSON_CONNECTION */
36837 e = 0;
36838 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36839 if (e) {
36840 log_packet_detailed("fields bitvector error detected");
36841 }
36842
36843 if (BV_ISSET(fields, 0)) {
36844 log_packet_detailed(" field 'counterpart' has changed");
36845#ifdef FREECIV_JSON_CONNECTION
36846 field_addr.name = "counterpart";
36847#endif /* FREECIV_JSON_CONNECTION */
36848 e = 0;
36849 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
36850 if (e) {
36851 log_packet_detailed("'counterpart' field error detected");
36852 }
36853 }
36854
36855 *old = *real_packet;
36856#endif /* FREECIV_DELTA_PROTOCOL */
36857#ifndef FREECIV_DELTA_PROTOCOL
36858#ifdef FREECIV_JSON_CONNECTION
36859 field_addr.name = "counterpart";
36860#endif /* FREECIV_JSON_CONNECTION */
36861 e = 0;
36862 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
36863 if (e) {
36864 log_packet_detailed("'counterpart' field error detected");
36865 }
36866
36867#endif
36868 SEND_PACKET_END(PACKET_DIPLOMACY_ACCEPT_TREATY_REQ);
36869}
36870
36871 int send_packet_diplomacy_accept_treaty_req(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
36872{
36873 if (!pc->used) {
36874 log_error("WARNING: trying to send data to the closed connection %s",
36875 conn_description(pc));
36876 return -1;
36877 }
36878 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet != nullptr, -1,
36879 "Handler for PACKET_DIPLOMACY_ACCEPT_TREATY_REQ not installed");
36880 return pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet(pc, packet);
36881}
36882
36883 int dsend_packet_diplomacy_accept_treaty_req(struct connection *pc, int counterpart)
36884{
36885 struct packet_diplomacy_accept_treaty_req packet, *real_packet = &packet;
36886
36887 real_packet->counterpart = counterpart;
36888
36889 return send_packet_diplomacy_accept_treaty_req(pc, real_packet);
36890}
36891
36892 static inline void init_packet_diplomacy_accept_treaty(struct packet_diplomacy_accept_treaty *packet)
36893{
36894 memset(packet, 0, sizeof(*packet));
36895}
36896
36897#define free_packet_diplomacy_accept_treaty(_packet) (void) 0
36898#define destroy_packet_diplomacy_accept_treaty free
36899
36900#ifdef FREECIV_DELTA_PROTOCOL
36901#define hash_packet_diplomacy_accept_treaty_100 hash_const
36902
36903#define cmp_packet_diplomacy_accept_treaty_100 cmp_const
36904
36905 BV_DEFINE(packet_diplomacy_accept_treaty_100_fields, 3);
36906#endif /* FREECIV_DELTA_PROTOCOL */
36907
36908 static struct packet_diplomacy_accept_treaty *receive_packet_diplomacy_accept_treaty_100(struct connection *pc)
36909{
36910#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_accept_treaty(_packet)
36911#ifdef FREECIV_DELTA_PROTOCOL
36912 packet_diplomacy_accept_treaty_100_fields fields;
36913 struct packet_diplomacy_accept_treaty *old;
36914 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_ACCEPT_TREATY;
36915#endif /* FREECIV_DELTA_PROTOCOL */
36916 RECEIVE_PACKET_START(packet_diplomacy_accept_treaty, real_packet);
36917#ifdef FREECIV_JSON_CONNECTION
36918 struct plocation field_addr;
36919 {
36920 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
36921 field_addr = *field_addr_tmp;
36922 FC_FREE(field_addr_tmp);
36923 }
36924#endif /* FREECIV_JSON_CONNECTION */
36925
36926#ifdef FREECIV_DELTA_PROTOCOL
36927#ifdef FREECIV_JSON_CONNECTION
36928 field_addr.name = "fields";
36929#endif /* FREECIV_JSON_CONNECTION */
36930 DIO_BV_GET(&din, &field_addr, fields);
36931
36932#else /* FREECIV_DELTA_PROTOCOL */
36933#ifdef FREECIV_JSON_CONNECTION
36934 field_addr.name = "counterpart";
36935#endif /* FREECIV_JSON_CONNECTION */
36936 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36937 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36938 }
36939#ifdef FREECIV_JSON_CONNECTION
36940 field_addr.name = "I_accepted";
36941#endif /* FREECIV_JSON_CONNECTION */
36942 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->I_accepted)) {
36943 RECEIVE_PACKET_FIELD_ERROR(I_accepted);
36944 }
36945#ifdef FREECIV_JSON_CONNECTION
36946 field_addr.name = "other_accepted";
36947#endif /* FREECIV_JSON_CONNECTION */
36948 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->other_accepted)) {
36949 RECEIVE_PACKET_FIELD_ERROR(other_accepted);
36950 }
36951#endif
36952 log_packet_detailed("packet_diplomacy_accept_treaty_100: got info about ()");
36953
36954#ifdef FREECIV_DELTA_PROTOCOL
36955 if (nullptr == *hash) {
36956 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_100, cmp_packet_diplomacy_accept_treaty_100,
36957 nullptr, nullptr, nullptr, destroy_packet_diplomacy_accept_treaty);
36958 }
36959
36960 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36961 *real_packet = *old;
36962 } else {
36963 /* packet is already initialized empty */
36964 log_packet_detailed(" no old info");
36965 }
36966
36967 if (BV_ISSET(fields, 0)) {
36968 log_packet_detailed(" got field 'counterpart'");
36969#ifdef FREECIV_JSON_CONNECTION
36970 field_addr.name = "counterpart";
36971#endif /* FREECIV_JSON_CONNECTION */
36972 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->counterpart)) {
36973 RECEIVE_PACKET_FIELD_ERROR(counterpart);
36974 }
36975 }
36976 real_packet->I_accepted = BV_ISSET(fields, 1);
36977 real_packet->other_accepted = BV_ISSET(fields, 2);
36978
36979 if (nullptr == old) {
36980 old = fc_malloc(sizeof(*old));
36981 init_packet_diplomacy_accept_treaty(old);
36982 *old = *real_packet;
36983 genhash_insert(*hash, old, old);
36984 } else {
36985 *old = *real_packet;
36986 }
36987
36988#endif /* FREECIV_DELTA_PROTOCOL */
36989 RECEIVE_PACKET_END(real_packet);
36990#undef FREE_PACKET_STRUCT
36991}
36992
36993 static int send_packet_diplomacy_accept_treaty_100(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
36994{
36995 const struct packet_diplomacy_accept_treaty *real_packet = packet;
36996 int e;
36997#ifdef FREECIV_DELTA_PROTOCOL
36998 packet_diplomacy_accept_treaty_100_fields fields;
36999 struct packet_diplomacy_accept_treaty *old;
37000 bool differ;
37001 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_ACCEPT_TREATY;
37002#endif /* FREECIV_DELTA_PROTOCOL */
37003 SEND_PACKET_START(PACKET_DIPLOMACY_ACCEPT_TREATY);
37004#ifdef FREECIV_JSON_CONNECTION
37005 struct plocation field_addr;
37006 {
37007 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37008 field_addr = *field_addr_tmp;
37009 FC_FREE(field_addr_tmp);
37010 }
37011#endif /* FREECIV_JSON_CONNECTION */
37012
37013 log_packet_detailed("packet_diplomacy_accept_treaty_100: sending info about ()");
37014
37015#ifdef FREECIV_DELTA_PROTOCOL
37016 if (nullptr == *hash) {
37017 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_100, cmp_packet_diplomacy_accept_treaty_100,
37018 nullptr, nullptr, nullptr, destroy_packet_diplomacy_accept_treaty);
37019 }
37020 BV_CLR_ALL(fields);
37021
37022 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37023 old = fc_malloc(sizeof(*old));
37024 /* temporary bitcopy just to insert correctly */
37025 *old = *real_packet;
37026 genhash_insert(*hash, old, old);
37027 init_packet_diplomacy_accept_treaty(old);
37028 }
37029 differ = (old->counterpart != real_packet->counterpart);
37030 if (differ) {
37031 BV_SET(fields, 0);
37032 }
37033
37034 if (packet->I_accepted) {
37035 BV_SET(fields, 1);
37036 }
37037
37038 if (packet->other_accepted) {
37039 BV_SET(fields, 2);
37040 }
37041
37042
37043#ifdef FREECIV_JSON_CONNECTION
37044 field_addr.name = "fields";
37045#endif /* FREECIV_JSON_CONNECTION */
37046 e = 0;
37047 e |= DIO_BV_PUT(&dout, &field_addr, fields);
37048 if (e) {
37049 log_packet_detailed("fields bitvector error detected");
37050 }
37051
37052 if (BV_ISSET(fields, 0)) {
37053 log_packet_detailed(" field 'counterpart' has changed");
37054#ifdef FREECIV_JSON_CONNECTION
37055 field_addr.name = "counterpart";
37056#endif /* FREECIV_JSON_CONNECTION */
37057 e = 0;
37058 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
37059 if (e) {
37060 log_packet_detailed("'counterpart' field error detected");
37061 }
37062 }
37063 /* field 1 is folded into the header */
37064 /* field 2 is folded into the header */
37065
37066 *old = *real_packet;
37067#endif /* FREECIV_DELTA_PROTOCOL */
37068#ifndef FREECIV_DELTA_PROTOCOL
37069#ifdef FREECIV_JSON_CONNECTION
37070 field_addr.name = "counterpart";
37071#endif /* FREECIV_JSON_CONNECTION */
37072 e = 0;
37073 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->counterpart);
37074 if (e) {
37075 log_packet_detailed("'counterpart' field error detected");
37076 }
37077#ifdef FREECIV_JSON_CONNECTION
37078 field_addr.name = "I_accepted";
37079#endif /* FREECIV_JSON_CONNECTION */
37080 e = 0;
37081 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->I_accepted);
37082 if (e) {
37083 log_packet_detailed("'I_accepted' field error detected");
37084 }
37085#ifdef FREECIV_JSON_CONNECTION
37086 field_addr.name = "other_accepted";
37087#endif /* FREECIV_JSON_CONNECTION */
37088 e = 0;
37089 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->other_accepted);
37090 if (e) {
37091 log_packet_detailed("'other_accepted' field error detected");
37092 }
37093
37094#endif
37095 SEND_PACKET_END(PACKET_DIPLOMACY_ACCEPT_TREATY);
37096}
37097
37098 int send_packet_diplomacy_accept_treaty(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
37099{
37100 if (!pc->used) {
37101 log_error("WARNING: trying to send data to the closed connection %s",
37102 conn_description(pc));
37103 return -1;
37104 }
37105 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet != nullptr, -1,
37106 "Handler for PACKET_DIPLOMACY_ACCEPT_TREATY not installed");
37107 return pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet(pc, packet);
37108}
37109
37110 void lsend_packet_diplomacy_accept_treaty(struct conn_list *dest, const struct packet_diplomacy_accept_treaty *packet)
37111{
37112 conn_list_iterate(dest, pconn) {
37113 send_packet_diplomacy_accept_treaty(pconn, packet);
37114 } conn_list_iterate_end;
37115}
37116
37117 int dsend_packet_diplomacy_accept_treaty(struct connection *pc, int counterpart, bool I_accepted, bool other_accepted)
37118{
37119 struct packet_diplomacy_accept_treaty packet, *real_packet = &packet;
37120
37121 real_packet->counterpart = counterpart;
37122 real_packet->I_accepted = I_accepted;
37123 real_packet->other_accepted = other_accepted;
37124
37125 return send_packet_diplomacy_accept_treaty(pc, real_packet);
37126}
37127
37128 void dlsend_packet_diplomacy_accept_treaty(struct conn_list *dest, int counterpart, bool I_accepted, bool other_accepted)
37129{
37130 struct packet_diplomacy_accept_treaty packet, *real_packet = &packet;
37131
37132 real_packet->counterpart = counterpart;
37133 real_packet->I_accepted = I_accepted;
37134 real_packet->other_accepted = other_accepted;
37135
37136 lsend_packet_diplomacy_accept_treaty(dest, real_packet);
37137}
37138
37139 static inline void init_packet_diplomacy_cancel_pact(struct packet_diplomacy_cancel_pact *packet)
37140{
37141 memset(packet, 0, sizeof(*packet));
37142}
37143
37144#define free_packet_diplomacy_cancel_pact(_packet) (void) 0
37145#define destroy_packet_diplomacy_cancel_pact free
37146
37147#ifdef FREECIV_DELTA_PROTOCOL
37148#define hash_packet_diplomacy_cancel_pact_100 hash_const
37149
37150#define cmp_packet_diplomacy_cancel_pact_100 cmp_const
37151
37152 BV_DEFINE(packet_diplomacy_cancel_pact_100_fields, 2);
37153#endif /* FREECIV_DELTA_PROTOCOL */
37154
37155 static struct packet_diplomacy_cancel_pact *receive_packet_diplomacy_cancel_pact_100(struct connection *pc)
37156{
37157#define FREE_PACKET_STRUCT(_packet) free_packet_diplomacy_cancel_pact(_packet)
37158#ifdef FREECIV_DELTA_PROTOCOL
37159 packet_diplomacy_cancel_pact_100_fields fields;
37160 struct packet_diplomacy_cancel_pact *old;
37161 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_PACT;
37162#endif /* FREECIV_DELTA_PROTOCOL */
37163 RECEIVE_PACKET_START(packet_diplomacy_cancel_pact, real_packet);
37164#ifdef FREECIV_JSON_CONNECTION
37165 struct plocation field_addr;
37166 {
37167 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37168 field_addr = *field_addr_tmp;
37169 FC_FREE(field_addr_tmp);
37170 }
37171#endif /* FREECIV_JSON_CONNECTION */
37172
37173#ifdef FREECIV_DELTA_PROTOCOL
37174#ifdef FREECIV_JSON_CONNECTION
37175 field_addr.name = "fields";
37176#endif /* FREECIV_JSON_CONNECTION */
37177 DIO_BV_GET(&din, &field_addr, fields);
37178
37179#else /* FREECIV_DELTA_PROTOCOL */
37180#ifdef FREECIV_JSON_CONNECTION
37181 field_addr.name = "other_player_id";
37182#endif /* FREECIV_JSON_CONNECTION */
37183 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->other_player_id)) {
37184 RECEIVE_PACKET_FIELD_ERROR(other_player_id);
37185 }
37186#ifdef FREECIV_JSON_CONNECTION
37187 field_addr.name = "clause";
37188#endif /* FREECIV_JSON_CONNECTION */
37189 {
37190 int readin;
37191
37192 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
37193 RECEIVE_PACKET_FIELD_ERROR(clause);
37194 }
37195 real_packet->clause = readin;
37196 }
37197#endif
37198 log_packet_detailed("packet_diplomacy_cancel_pact_100: got info about ()");
37199
37200#ifdef FREECIV_DELTA_PROTOCOL
37201 if (nullptr == *hash) {
37202 *hash = genhash_new_full(hash_packet_diplomacy_cancel_pact_100, cmp_packet_diplomacy_cancel_pact_100,
37203 nullptr, nullptr, nullptr, destroy_packet_diplomacy_cancel_pact);
37204 }
37205
37206 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37207 *real_packet = *old;
37208 } else {
37209 /* packet is already initialized empty */
37210 log_packet_detailed(" no old info");
37211 }
37212
37213 if (BV_ISSET(fields, 0)) {
37214 log_packet_detailed(" got field 'other_player_id'");
37215#ifdef FREECIV_JSON_CONNECTION
37216 field_addr.name = "other_player_id";
37217#endif /* FREECIV_JSON_CONNECTION */
37218 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->other_player_id)) {
37219 RECEIVE_PACKET_FIELD_ERROR(other_player_id);
37220 }
37221 }
37222 if (BV_ISSET(fields, 1)) {
37223 log_packet_detailed(" got field 'clause'");
37224#ifdef FREECIV_JSON_CONNECTION
37225 field_addr.name = "clause";
37226#endif /* FREECIV_JSON_CONNECTION */
37227 {
37228 int readin;
37229
37230 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
37231 RECEIVE_PACKET_FIELD_ERROR(clause);
37232 }
37233 real_packet->clause = readin;
37234 }
37235 }
37236
37237 if (nullptr == old) {
37238 old = fc_malloc(sizeof(*old));
37239 init_packet_diplomacy_cancel_pact(old);
37240 *old = *real_packet;
37241 genhash_insert(*hash, old, old);
37242 } else {
37243 *old = *real_packet;
37244 }
37245
37246#endif /* FREECIV_DELTA_PROTOCOL */
37247 RECEIVE_PACKET_END(real_packet);
37248#undef FREE_PACKET_STRUCT
37249}
37250
37251 static int send_packet_diplomacy_cancel_pact_100(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
37252{
37253 const struct packet_diplomacy_cancel_pact *real_packet = packet;
37254 int e;
37255#ifdef FREECIV_DELTA_PROTOCOL
37256 packet_diplomacy_cancel_pact_100_fields fields;
37257 struct packet_diplomacy_cancel_pact *old;
37258 bool differ;
37259 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_PACT;
37260#endif /* FREECIV_DELTA_PROTOCOL */
37261 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_PACT);
37262#ifdef FREECIV_JSON_CONNECTION
37263 struct plocation field_addr;
37264 {
37265 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37266 field_addr = *field_addr_tmp;
37267 FC_FREE(field_addr_tmp);
37268 }
37269#endif /* FREECIV_JSON_CONNECTION */
37270
37271 log_packet_detailed("packet_diplomacy_cancel_pact_100: sending info about ()");
37272
37273#ifdef FREECIV_DELTA_PROTOCOL
37274 if (nullptr == *hash) {
37275 *hash = genhash_new_full(hash_packet_diplomacy_cancel_pact_100, cmp_packet_diplomacy_cancel_pact_100,
37276 nullptr, nullptr, nullptr, destroy_packet_diplomacy_cancel_pact);
37277 }
37278 BV_CLR_ALL(fields);
37279
37280 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37281 old = fc_malloc(sizeof(*old));
37282 /* temporary bitcopy just to insert correctly */
37283 *old = *real_packet;
37284 genhash_insert(*hash, old, old);
37285 init_packet_diplomacy_cancel_pact(old);
37286 }
37287 differ = (old->other_player_id != real_packet->other_player_id);
37288 if (differ) {
37289 BV_SET(fields, 0);
37290 }
37291
37292 differ = (old->clause != real_packet->clause);
37293 if (differ) {
37294 BV_SET(fields, 1);
37295 }
37296
37297
37298#ifdef FREECIV_JSON_CONNECTION
37299 field_addr.name = "fields";
37300#endif /* FREECIV_JSON_CONNECTION */
37301 e = 0;
37302 e |= DIO_BV_PUT(&dout, &field_addr, fields);
37303 if (e) {
37304 log_packet_detailed("fields bitvector error detected");
37305 }
37306
37307 if (BV_ISSET(fields, 0)) {
37308 log_packet_detailed(" field 'other_player_id' has changed");
37309#ifdef FREECIV_JSON_CONNECTION
37310 field_addr.name = "other_player_id";
37311#endif /* FREECIV_JSON_CONNECTION */
37312 e = 0;
37313 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->other_player_id);
37314 if (e) {
37315 log_packet_detailed("'other_player_id' field error detected");
37316 }
37317 }
37318 if (BV_ISSET(fields, 1)) {
37319 log_packet_detailed(" field 'clause' has changed");
37320#ifdef FREECIV_JSON_CONNECTION
37321 field_addr.name = "clause";
37322#endif /* FREECIV_JSON_CONNECTION */
37323 e = 0;
37324 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->clause);
37325 if (e) {
37326 log_packet_detailed("'clause' field error detected");
37327 }
37328 }
37329
37330 *old = *real_packet;
37331#endif /* FREECIV_DELTA_PROTOCOL */
37332#ifndef FREECIV_DELTA_PROTOCOL
37333#ifdef FREECIV_JSON_CONNECTION
37334 field_addr.name = "other_player_id";
37335#endif /* FREECIV_JSON_CONNECTION */
37336 e = 0;
37337 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->other_player_id);
37338 if (e) {
37339 log_packet_detailed("'other_player_id' field error detected");
37340 }
37341#ifdef FREECIV_JSON_CONNECTION
37342 field_addr.name = "clause";
37343#endif /* FREECIV_JSON_CONNECTION */
37344 e = 0;
37345 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->clause);
37346 if (e) {
37347 log_packet_detailed("'clause' field error detected");
37348 }
37349
37350#endif
37351 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_PACT);
37352}
37353
37354 int send_packet_diplomacy_cancel_pact(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
37355{
37356 if (!pc->used) {
37357 log_error("WARNING: trying to send data to the closed connection %s",
37358 conn_description(pc));
37359 return -1;
37360 }
37361 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet != nullptr, -1,
37362 "Handler for PACKET_DIPLOMACY_CANCEL_PACT not installed");
37363 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet(pc, packet);
37364}
37365
37366 int dsend_packet_diplomacy_cancel_pact(struct connection *pc, int other_player_id, enum clause_type clause)
37367{
37368 struct packet_diplomacy_cancel_pact packet, *real_packet = &packet;
37369
37370 real_packet->other_player_id = other_player_id;
37371 real_packet->clause = clause;
37372
37373 return send_packet_diplomacy_cancel_pact(pc, real_packet);
37374}
37375
37376 static inline void init_packet_page_msg(struct packet_page_msg *packet)
37377{
37378 memset(packet, 0, sizeof(*packet));
37379}
37380
37381#define free_packet_page_msg(_packet) (void) 0
37382#define destroy_packet_page_msg free
37383
37384#ifdef FREECIV_DELTA_PROTOCOL
37385#define hash_packet_page_msg_100 hash_const
37386
37387#define cmp_packet_page_msg_100 cmp_const
37388
37389 BV_DEFINE(packet_page_msg_100_fields, 5);
37390#endif /* FREECIV_DELTA_PROTOCOL */
37391
37392 static struct packet_page_msg *receive_packet_page_msg_100(struct connection *pc)
37393{
37394#define FREE_PACKET_STRUCT(_packet) free_packet_page_msg(_packet)
37395#ifdef FREECIV_DELTA_PROTOCOL
37396 packet_page_msg_100_fields fields;
37397 struct packet_page_msg *old;
37398 struct genhash **hash = pc->phs.received + PACKET_PAGE_MSG;
37399#endif /* FREECIV_DELTA_PROTOCOL */
37400 RECEIVE_PACKET_START(packet_page_msg, real_packet);
37401#ifdef FREECIV_JSON_CONNECTION
37402 struct plocation field_addr;
37403 {
37404 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37405 field_addr = *field_addr_tmp;
37406 FC_FREE(field_addr_tmp);
37407 }
37408#endif /* FREECIV_JSON_CONNECTION */
37409
37410#ifdef FREECIV_DELTA_PROTOCOL
37411#ifdef FREECIV_JSON_CONNECTION
37412 field_addr.name = "fields";
37413#endif /* FREECIV_JSON_CONNECTION */
37414 DIO_BV_GET(&din, &field_addr, fields);
37415
37416#else /* FREECIV_DELTA_PROTOCOL */
37417#ifdef FREECIV_JSON_CONNECTION
37418 field_addr.name = "caption";
37419#endif /* FREECIV_JSON_CONNECTION */
37420 if (!DIO_GET(string, &din, &field_addr, real_packet->caption, sizeof(real_packet->caption))) {
37421 RECEIVE_PACKET_FIELD_ERROR(caption);
37422 }
37423#ifdef FREECIV_JSON_CONNECTION
37424 field_addr.name = "headline";
37425#endif /* FREECIV_JSON_CONNECTION */
37426 if (!DIO_GET(string, &din, &field_addr, real_packet->headline, sizeof(real_packet->headline))) {
37427 RECEIVE_PACKET_FIELD_ERROR(headline);
37428 }
37429#ifdef FREECIV_JSON_CONNECTION
37430 field_addr.name = "event";
37431#endif /* FREECIV_JSON_CONNECTION */
37432 {
37433 int readin;
37434
37435 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
37436 RECEIVE_PACKET_FIELD_ERROR(event);
37437 }
37438 real_packet->event = readin;
37439 }
37440#ifdef FREECIV_JSON_CONNECTION
37441 field_addr.name = "len";
37442#endif /* FREECIV_JSON_CONNECTION */
37443 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->len)) {
37444 RECEIVE_PACKET_FIELD_ERROR(len);
37445 }
37446#ifdef FREECIV_JSON_CONNECTION
37447 field_addr.name = "parts";
37448#endif /* FREECIV_JSON_CONNECTION */
37449 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->parts)) {
37450 RECEIVE_PACKET_FIELD_ERROR(parts);
37451 }
37452#endif
37453 log_packet_detailed("packet_page_msg_100: got info about ()");
37454
37455#ifdef FREECIV_DELTA_PROTOCOL
37456 if (nullptr == *hash) {
37457 *hash = genhash_new_full(hash_packet_page_msg_100, cmp_packet_page_msg_100,
37458 nullptr, nullptr, nullptr, destroy_packet_page_msg);
37459 }
37460
37461 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37462 *real_packet = *old;
37463 } else {
37464 /* packet is already initialized empty */
37465 log_packet_detailed(" no old info");
37466 }
37467
37468 if (BV_ISSET(fields, 0)) {
37469 log_packet_detailed(" got field 'caption'");
37470#ifdef FREECIV_JSON_CONNECTION
37471 field_addr.name = "caption";
37472#endif /* FREECIV_JSON_CONNECTION */
37473 if (!DIO_GET(string, &din, &field_addr, real_packet->caption, sizeof(real_packet->caption))) {
37474 RECEIVE_PACKET_FIELD_ERROR(caption);
37475 }
37476 }
37477 if (BV_ISSET(fields, 1)) {
37478 log_packet_detailed(" got field 'headline'");
37479#ifdef FREECIV_JSON_CONNECTION
37480 field_addr.name = "headline";
37481#endif /* FREECIV_JSON_CONNECTION */
37482 if (!DIO_GET(string, &din, &field_addr, real_packet->headline, sizeof(real_packet->headline))) {
37483 RECEIVE_PACKET_FIELD_ERROR(headline);
37484 }
37485 }
37486 if (BV_ISSET(fields, 2)) {
37487 log_packet_detailed(" got field 'event'");
37488#ifdef FREECIV_JSON_CONNECTION
37489 field_addr.name = "event";
37490#endif /* FREECIV_JSON_CONNECTION */
37491 {
37492 int readin;
37493
37494 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
37495 RECEIVE_PACKET_FIELD_ERROR(event);
37496 }
37497 real_packet->event = readin;
37498 }
37499 }
37500 if (BV_ISSET(fields, 3)) {
37501 log_packet_detailed(" got field 'len'");
37502#ifdef FREECIV_JSON_CONNECTION
37503 field_addr.name = "len";
37504#endif /* FREECIV_JSON_CONNECTION */
37505 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->len)) {
37506 RECEIVE_PACKET_FIELD_ERROR(len);
37507 }
37508 }
37509 if (BV_ISSET(fields, 4)) {
37510 log_packet_detailed(" got field 'parts'");
37511#ifdef FREECIV_JSON_CONNECTION
37512 field_addr.name = "parts";
37513#endif /* FREECIV_JSON_CONNECTION */
37514 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->parts)) {
37515 RECEIVE_PACKET_FIELD_ERROR(parts);
37516 }
37517 }
37518
37519 if (nullptr == old) {
37520 old = fc_malloc(sizeof(*old));
37521 init_packet_page_msg(old);
37522 *old = *real_packet;
37523 genhash_insert(*hash, old, old);
37524 } else {
37525 *old = *real_packet;
37526 }
37527
37528#endif /* FREECIV_DELTA_PROTOCOL */
37529 RECEIVE_PACKET_END(real_packet);
37530#undef FREE_PACKET_STRUCT
37531}
37532
37533 static int send_packet_page_msg_100(struct connection *pc, const struct packet_page_msg *packet)
37534{
37535 const struct packet_page_msg *real_packet = packet;
37536 int e;
37537#ifdef FREECIV_DELTA_PROTOCOL
37538 packet_page_msg_100_fields fields;
37539 struct packet_page_msg *old;
37540 bool differ;
37541 struct genhash **hash = pc->phs.sent + PACKET_PAGE_MSG;
37542#endif /* FREECIV_DELTA_PROTOCOL */
37543 SEND_PACKET_START(PACKET_PAGE_MSG);
37544#ifdef FREECIV_JSON_CONNECTION
37545 struct plocation field_addr;
37546 {
37547 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37548 field_addr = *field_addr_tmp;
37549 FC_FREE(field_addr_tmp);
37550 }
37551#endif /* FREECIV_JSON_CONNECTION */
37552
37553 log_packet_detailed("packet_page_msg_100: sending info about ()");
37554
37555#ifdef FREECIV_DELTA_PROTOCOL
37556 if (nullptr == *hash) {
37557 *hash = genhash_new_full(hash_packet_page_msg_100, cmp_packet_page_msg_100,
37558 nullptr, nullptr, nullptr, destroy_packet_page_msg);
37559 }
37560 BV_CLR_ALL(fields);
37561
37562 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37563 old = fc_malloc(sizeof(*old));
37564 /* temporary bitcopy just to insert correctly */
37565 *old = *real_packet;
37566 genhash_insert(*hash, old, old);
37567 init_packet_page_msg(old);
37568 }
37569 differ = (strcmp(old->caption, real_packet->caption) != 0);
37570 if (differ) {
37571 BV_SET(fields, 0);
37572 }
37573
37574 differ = (strcmp(old->headline, real_packet->headline) != 0);
37575 if (differ) {
37576 BV_SET(fields, 1);
37577 }
37578
37579 differ = (old->event != real_packet->event);
37580 if (differ) {
37581 BV_SET(fields, 2);
37582 }
37583
37584 differ = (old->len != real_packet->len);
37585 if (differ) {
37586 BV_SET(fields, 3);
37587 }
37588
37589 differ = (old->parts != real_packet->parts);
37590 if (differ) {
37591 BV_SET(fields, 4);
37592 }
37593
37594
37595#ifdef FREECIV_JSON_CONNECTION
37596 field_addr.name = "fields";
37597#endif /* FREECIV_JSON_CONNECTION */
37598 e = 0;
37599 e |= DIO_BV_PUT(&dout, &field_addr, fields);
37600 if (e) {
37601 log_packet_detailed("fields bitvector error detected");
37602 }
37603
37604 if (BV_ISSET(fields, 0)) {
37605 log_packet_detailed(" field 'caption' has changed");
37606#ifdef FREECIV_JSON_CONNECTION
37607 field_addr.name = "caption";
37608#endif /* FREECIV_JSON_CONNECTION */
37609 e = 0;
37610 e |= DIO_PUT(string, &dout, &field_addr, real_packet->caption);
37611 if (e) {
37612 log_packet_detailed("'caption' field error detected");
37613 }
37614 }
37615 if (BV_ISSET(fields, 1)) {
37616 log_packet_detailed(" field 'headline' has changed");
37617#ifdef FREECIV_JSON_CONNECTION
37618 field_addr.name = "headline";
37619#endif /* FREECIV_JSON_CONNECTION */
37620 e = 0;
37621 e |= DIO_PUT(string, &dout, &field_addr, real_packet->headline);
37622 if (e) {
37623 log_packet_detailed("'headline' field error detected");
37624 }
37625 }
37626 if (BV_ISSET(fields, 2)) {
37627 log_packet_detailed(" field 'event' has changed");
37628#ifdef FREECIV_JSON_CONNECTION
37629 field_addr.name = "event";
37630#endif /* FREECIV_JSON_CONNECTION */
37631 e = 0;
37632 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
37633 if (e) {
37634 log_packet_detailed("'event' field error detected");
37635 }
37636 }
37637 if (BV_ISSET(fields, 3)) {
37638 log_packet_detailed(" field 'len' has changed");
37639#ifdef FREECIV_JSON_CONNECTION
37640 field_addr.name = "len";
37641#endif /* FREECIV_JSON_CONNECTION */
37642 e = 0;
37643 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->len);
37644 if (e) {
37645 log_packet_detailed("'len' field error detected");
37646 }
37647 }
37648 if (BV_ISSET(fields, 4)) {
37649 log_packet_detailed(" field 'parts' has changed");
37650#ifdef FREECIV_JSON_CONNECTION
37651 field_addr.name = "parts";
37652#endif /* FREECIV_JSON_CONNECTION */
37653 e = 0;
37654 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->parts);
37655 if (e) {
37656 log_packet_detailed("'parts' field error detected");
37657 }
37658 }
37659
37660 *old = *real_packet;
37661#endif /* FREECIV_DELTA_PROTOCOL */
37662#ifndef FREECIV_DELTA_PROTOCOL
37663#ifdef FREECIV_JSON_CONNECTION
37664 field_addr.name = "caption";
37665#endif /* FREECIV_JSON_CONNECTION */
37666 e = 0;
37667 e |= DIO_PUT(string, &dout, &field_addr, real_packet->caption);
37668 if (e) {
37669 log_packet_detailed("'caption' field error detected");
37670 }
37671#ifdef FREECIV_JSON_CONNECTION
37672 field_addr.name = "headline";
37673#endif /* FREECIV_JSON_CONNECTION */
37674 e = 0;
37675 e |= DIO_PUT(string, &dout, &field_addr, real_packet->headline);
37676 if (e) {
37677 log_packet_detailed("'headline' field error detected");
37678 }
37679#ifdef FREECIV_JSON_CONNECTION
37680 field_addr.name = "event";
37681#endif /* FREECIV_JSON_CONNECTION */
37682 e = 0;
37683 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
37684 if (e) {
37685 log_packet_detailed("'event' field error detected");
37686 }
37687#ifdef FREECIV_JSON_CONNECTION
37688 field_addr.name = "len";
37689#endif /* FREECIV_JSON_CONNECTION */
37690 e = 0;
37691 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->len);
37692 if (e) {
37693 log_packet_detailed("'len' field error detected");
37694 }
37695#ifdef FREECIV_JSON_CONNECTION
37696 field_addr.name = "parts";
37697#endif /* FREECIV_JSON_CONNECTION */
37698 e = 0;
37699 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->parts);
37700 if (e) {
37701 log_packet_detailed("'parts' field error detected");
37702 }
37703
37704#endif
37705 SEND_PACKET_END(PACKET_PAGE_MSG);
37706}
37707
37708 int send_packet_page_msg(struct connection *pc, const struct packet_page_msg *packet)
37709{
37710 if (!pc->used) {
37711 log_error("WARNING: trying to send data to the closed connection %s",
37712 conn_description(pc));
37713 return -1;
37714 }
37715 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PAGE_MSG].packet != nullptr, -1,
37716 "Handler for PACKET_PAGE_MSG not installed");
37717 return pc->phs.handlers->send[PACKET_PAGE_MSG].packet(pc, packet);
37718}
37719
37720 void lsend_packet_page_msg(struct conn_list *dest, const struct packet_page_msg *packet)
37721{
37722 conn_list_iterate(dest, pconn) {
37723 send_packet_page_msg(pconn, packet);
37724 } conn_list_iterate_end;
37725}
37726
37727 static inline void init_packet_page_msg_part(struct packet_page_msg_part *packet)
37728{
37729 memset(packet, 0, sizeof(*packet));
37730}
37731
37732#define free_packet_page_msg_part(_packet) (void) 0
37733#define destroy_packet_page_msg_part free
37734
37735#ifdef FREECIV_DELTA_PROTOCOL
37736#define hash_packet_page_msg_part_100 hash_const
37737
37738#define cmp_packet_page_msg_part_100 cmp_const
37739
37740 BV_DEFINE(packet_page_msg_part_100_fields, 1);
37741#endif /* FREECIV_DELTA_PROTOCOL */
37742
37743 static struct packet_page_msg_part *receive_packet_page_msg_part_100(struct connection *pc)
37744{
37745#define FREE_PACKET_STRUCT(_packet) free_packet_page_msg_part(_packet)
37746#ifdef FREECIV_DELTA_PROTOCOL
37747 packet_page_msg_part_100_fields fields;
37748 struct packet_page_msg_part *old;
37749 struct genhash **hash = pc->phs.received + PACKET_PAGE_MSG_PART;
37750#endif /* FREECIV_DELTA_PROTOCOL */
37751 RECEIVE_PACKET_START(packet_page_msg_part, real_packet);
37752#ifdef FREECIV_JSON_CONNECTION
37753 struct plocation field_addr;
37754 {
37755 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37756 field_addr = *field_addr_tmp;
37757 FC_FREE(field_addr_tmp);
37758 }
37759#endif /* FREECIV_JSON_CONNECTION */
37760
37761#ifdef FREECIV_DELTA_PROTOCOL
37762#ifdef FREECIV_JSON_CONNECTION
37763 field_addr.name = "fields";
37764#endif /* FREECIV_JSON_CONNECTION */
37765 DIO_BV_GET(&din, &field_addr, fields);
37766
37767#else /* FREECIV_DELTA_PROTOCOL */
37768#ifdef FREECIV_JSON_CONNECTION
37769 field_addr.name = "lines";
37770#endif /* FREECIV_JSON_CONNECTION */
37771 if (!DIO_GET(string, &din, &field_addr, real_packet->lines, sizeof(real_packet->lines))) {
37772 RECEIVE_PACKET_FIELD_ERROR(lines);
37773 }
37774#endif
37775 log_packet_detailed("packet_page_msg_part_100: got info about ()");
37776
37777#ifdef FREECIV_DELTA_PROTOCOL
37778 if (nullptr == *hash) {
37779 *hash = genhash_new_full(hash_packet_page_msg_part_100, cmp_packet_page_msg_part_100,
37780 nullptr, nullptr, nullptr, destroy_packet_page_msg_part);
37781 }
37782
37783 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37784 *real_packet = *old;
37785 } else {
37786 /* packet is already initialized empty */
37787 log_packet_detailed(" no old info");
37788 }
37789
37790 if (BV_ISSET(fields, 0)) {
37791 log_packet_detailed(" got field 'lines'");
37792#ifdef FREECIV_JSON_CONNECTION
37793 field_addr.name = "lines";
37794#endif /* FREECIV_JSON_CONNECTION */
37795 if (!DIO_GET(string, &din, &field_addr, real_packet->lines, sizeof(real_packet->lines))) {
37796 RECEIVE_PACKET_FIELD_ERROR(lines);
37797 }
37798 }
37799
37800 if (nullptr == old) {
37801 old = fc_malloc(sizeof(*old));
37802 init_packet_page_msg_part(old);
37803 *old = *real_packet;
37804 genhash_insert(*hash, old, old);
37805 } else {
37806 *old = *real_packet;
37807 }
37808
37809#endif /* FREECIV_DELTA_PROTOCOL */
37810 RECEIVE_PACKET_END(real_packet);
37811#undef FREE_PACKET_STRUCT
37812}
37813
37814 static int send_packet_page_msg_part_100(struct connection *pc, const struct packet_page_msg_part *packet)
37815{
37816 const struct packet_page_msg_part *real_packet = packet;
37817 int e;
37818#ifdef FREECIV_DELTA_PROTOCOL
37819 packet_page_msg_part_100_fields fields;
37820 struct packet_page_msg_part *old;
37821 bool differ;
37822 struct genhash **hash = pc->phs.sent + PACKET_PAGE_MSG_PART;
37823#endif /* FREECIV_DELTA_PROTOCOL */
37824 SEND_PACKET_START(PACKET_PAGE_MSG_PART);
37825#ifdef FREECIV_JSON_CONNECTION
37826 struct plocation field_addr;
37827 {
37828 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37829 field_addr = *field_addr_tmp;
37830 FC_FREE(field_addr_tmp);
37831 }
37832#endif /* FREECIV_JSON_CONNECTION */
37833
37834 log_packet_detailed("packet_page_msg_part_100: sending info about ()");
37835
37836#ifdef FREECIV_DELTA_PROTOCOL
37837 if (nullptr == *hash) {
37838 *hash = genhash_new_full(hash_packet_page_msg_part_100, cmp_packet_page_msg_part_100,
37839 nullptr, nullptr, nullptr, destroy_packet_page_msg_part);
37840 }
37841 BV_CLR_ALL(fields);
37842
37843 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37844 old = fc_malloc(sizeof(*old));
37845 /* temporary bitcopy just to insert correctly */
37846 *old = *real_packet;
37847 genhash_insert(*hash, old, old);
37848 init_packet_page_msg_part(old);
37849 }
37850 differ = (strcmp(old->lines, real_packet->lines) != 0);
37851 if (differ) {
37852 BV_SET(fields, 0);
37853 }
37854
37855
37856#ifdef FREECIV_JSON_CONNECTION
37857 field_addr.name = "fields";
37858#endif /* FREECIV_JSON_CONNECTION */
37859 e = 0;
37860 e |= DIO_BV_PUT(&dout, &field_addr, fields);
37861 if (e) {
37862 log_packet_detailed("fields bitvector error detected");
37863 }
37864
37865 if (BV_ISSET(fields, 0)) {
37866 log_packet_detailed(" field 'lines' has changed");
37867#ifdef FREECIV_JSON_CONNECTION
37868 field_addr.name = "lines";
37869#endif /* FREECIV_JSON_CONNECTION */
37870 e = 0;
37871 e |= DIO_PUT(string, &dout, &field_addr, real_packet->lines);
37872 if (e) {
37873 log_packet_detailed("'lines' field error detected");
37874 }
37875 }
37876
37877 *old = *real_packet;
37878#endif /* FREECIV_DELTA_PROTOCOL */
37879#ifndef FREECIV_DELTA_PROTOCOL
37880#ifdef FREECIV_JSON_CONNECTION
37881 field_addr.name = "lines";
37882#endif /* FREECIV_JSON_CONNECTION */
37883 e = 0;
37884 e |= DIO_PUT(string, &dout, &field_addr, real_packet->lines);
37885 if (e) {
37886 log_packet_detailed("'lines' field error detected");
37887 }
37888
37889#endif
37890 SEND_PACKET_END(PACKET_PAGE_MSG_PART);
37891}
37892
37893 int send_packet_page_msg_part(struct connection *pc, const struct packet_page_msg_part *packet)
37894{
37895 if (!pc->used) {
37896 log_error("WARNING: trying to send data to the closed connection %s",
37897 conn_description(pc));
37898 return -1;
37899 }
37900 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PAGE_MSG_PART].packet != nullptr, -1,
37901 "Handler for PACKET_PAGE_MSG_PART not installed");
37902 return pc->phs.handlers->send[PACKET_PAGE_MSG_PART].packet(pc, packet);
37903}
37904
37905 void lsend_packet_page_msg_part(struct conn_list *dest, const struct packet_page_msg_part *packet)
37906{
37907 conn_list_iterate(dest, pconn) {
37908 send_packet_page_msg_part(pconn, packet);
37909 } conn_list_iterate_end;
37910}
37911
37912 static inline void init_packet_report_req(struct packet_report_req *packet)
37913{
37914 memset(packet, 0, sizeof(*packet));
37915}
37916
37917#define free_packet_report_req(_packet) (void) 0
37918#define destroy_packet_report_req free
37919
37920#ifdef FREECIV_DELTA_PROTOCOL
37921#define hash_packet_report_req_100 hash_const
37922
37923#define cmp_packet_report_req_100 cmp_const
37924
37925 BV_DEFINE(packet_report_req_100_fields, 1);
37926#endif /* FREECIV_DELTA_PROTOCOL */
37927
37928 static struct packet_report_req *receive_packet_report_req_100(struct connection *pc)
37929{
37930#define FREE_PACKET_STRUCT(_packet) free_packet_report_req(_packet)
37931#ifdef FREECIV_DELTA_PROTOCOL
37932 packet_report_req_100_fields fields;
37933 struct packet_report_req *old;
37934 struct genhash **hash = pc->phs.received + PACKET_REPORT_REQ;
37935#endif /* FREECIV_DELTA_PROTOCOL */
37936 RECEIVE_PACKET_START(packet_report_req, real_packet);
37937#ifdef FREECIV_JSON_CONNECTION
37938 struct plocation field_addr;
37939 {
37940 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
37941 field_addr = *field_addr_tmp;
37942 FC_FREE(field_addr_tmp);
37943 }
37944#endif /* FREECIV_JSON_CONNECTION */
37945
37946#ifdef FREECIV_DELTA_PROTOCOL
37947#ifdef FREECIV_JSON_CONNECTION
37948 field_addr.name = "fields";
37949#endif /* FREECIV_JSON_CONNECTION */
37950 DIO_BV_GET(&din, &field_addr, fields);
37951
37952#else /* FREECIV_DELTA_PROTOCOL */
37953#ifdef FREECIV_JSON_CONNECTION
37954 field_addr.name = "type";
37955#endif /* FREECIV_JSON_CONNECTION */
37956 {
37957 int readin;
37958
37959 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
37960 RECEIVE_PACKET_FIELD_ERROR(type);
37961 }
37962 real_packet->type = readin;
37963 }
37964#endif
37965 log_packet_detailed("packet_report_req_100: got info about ()");
37966
37967#ifdef FREECIV_DELTA_PROTOCOL
37968 if (nullptr == *hash) {
37969 *hash = genhash_new_full(hash_packet_report_req_100, cmp_packet_report_req_100,
37970 nullptr, nullptr, nullptr, destroy_packet_report_req);
37971 }
37972
37973 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37974 *real_packet = *old;
37975 } else {
37976 /* packet is already initialized empty */
37977 log_packet_detailed(" no old info");
37978 }
37979
37980 if (BV_ISSET(fields, 0)) {
37981 log_packet_detailed(" got field 'type'");
37982#ifdef FREECIV_JSON_CONNECTION
37983 field_addr.name = "type";
37984#endif /* FREECIV_JSON_CONNECTION */
37985 {
37986 int readin;
37987
37988 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
37989 RECEIVE_PACKET_FIELD_ERROR(type);
37990 }
37991 real_packet->type = readin;
37992 }
37993 }
37994
37995 if (nullptr == old) {
37996 old = fc_malloc(sizeof(*old));
37997 init_packet_report_req(old);
37998 *old = *real_packet;
37999 genhash_insert(*hash, old, old);
38000 } else {
38001 *old = *real_packet;
38002 }
38003
38004#endif /* FREECIV_DELTA_PROTOCOL */
38005 RECEIVE_PACKET_END(real_packet);
38006#undef FREE_PACKET_STRUCT
38007}
38008
38009 static int send_packet_report_req_100(struct connection *pc, const struct packet_report_req *packet)
38010{
38011 const struct packet_report_req *real_packet = packet;
38012 int e;
38013#ifdef FREECIV_DELTA_PROTOCOL
38014 packet_report_req_100_fields fields;
38015 struct packet_report_req *old;
38016 bool differ;
38017 struct genhash **hash = pc->phs.sent + PACKET_REPORT_REQ;
38018#endif /* FREECIV_DELTA_PROTOCOL */
38019 SEND_PACKET_START(PACKET_REPORT_REQ);
38020#ifdef FREECIV_JSON_CONNECTION
38021 struct plocation field_addr;
38022 {
38023 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
38024 field_addr = *field_addr_tmp;
38025 FC_FREE(field_addr_tmp);
38026 }
38027#endif /* FREECIV_JSON_CONNECTION */
38028
38029 log_packet_detailed("packet_report_req_100: sending info about ()");
38030
38031#ifdef FREECIV_DELTA_PROTOCOL
38032 if (nullptr == *hash) {
38033 *hash = genhash_new_full(hash_packet_report_req_100, cmp_packet_report_req_100,
38034 nullptr, nullptr, nullptr, destroy_packet_report_req);
38035 }
38036 BV_CLR_ALL(fields);
38037
38038 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
38039 old = fc_malloc(sizeof(*old));
38040 /* temporary bitcopy just to insert correctly */
38041 *old = *real_packet;
38042 genhash_insert(*hash, old, old);
38043 init_packet_report_req(old);
38044 }
38045 differ = (old->type != real_packet->type);
38046 if (differ) {
38047 BV_SET(fields, 0);
38048 }
38049
38050
38051#ifdef FREECIV_JSON_CONNECTION
38052 field_addr.name = "fields";
38053#endif /* FREECIV_JSON_CONNECTION */
38054 e = 0;
38055 e |= DIO_BV_PUT(&dout, &field_addr, fields);
38056 if (e) {
38057 log_packet_detailed("fields bitvector error detected");
38058 }
38059
38060 if (BV_ISSET(fields, 0)) {
38061 log_packet_detailed(" field 'type' has changed");
38062#ifdef FREECIV_JSON_CONNECTION
38063 field_addr.name = "type";
38064#endif /* FREECIV_JSON_CONNECTION */
38065 e = 0;
38066 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
38067 if (e) {
38068 log_packet_detailed("'type' field error detected");
38069 }
38070 }
38071
38072 *old = *real_packet;
38073#endif /* FREECIV_DELTA_PROTOCOL */
38074#ifndef FREECIV_DELTA_PROTOCOL
38075#ifdef FREECIV_JSON_CONNECTION
38076 field_addr.name = "type";
38077#endif /* FREECIV_JSON_CONNECTION */
38078 e = 0;
38079 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
38080 if (e) {
38081 log_packet_detailed("'type' field error detected");
38082 }
38083
38084#endif
38085 SEND_PACKET_END(PACKET_REPORT_REQ);
38086}
38087
38088 int send_packet_report_req(struct connection *pc, const struct packet_report_req *packet)
38089{
38090 if (!pc->used) {
38091 log_error("WARNING: trying to send data to the closed connection %s",
38092 conn_description(pc));
38093 return -1;
38094 }
38095 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_REPORT_REQ].packet != nullptr, -1,
38096 "Handler for PACKET_REPORT_REQ not installed");
38097 return pc->phs.handlers->send[PACKET_REPORT_REQ].packet(pc, packet);
38098}
38099
38100 int dsend_packet_report_req(struct connection *pc, enum report_type type)
38101{
38102 struct packet_report_req packet, *real_packet = &packet;
38103
38104 real_packet->type = type;
38105
38106 return send_packet_report_req(pc, real_packet);
38107}
38108
38109 static inline void init_packet_conn_info(struct packet_conn_info *packet)
38110{
38111 memset(packet, 0, sizeof(*packet));
38112}
38113
38114#define free_packet_conn_info(_packet) (void) 0
38115#define destroy_packet_conn_info free
38116
38117#ifdef FREECIV_DELTA_PROTOCOL
38118static genhash_val_t hash_packet_conn_info_100(const void *vkey)
38119{
38120 const struct packet_conn_info *key = (const struct packet_conn_info *) vkey;
38121 genhash_val_t result = 0;
38122
38123 result += key->id;
38124
38125 result &= 0xFFFFFFFF;
38126 return result;
38127}
38128
38129static bool cmp_packet_conn_info_100(const void *vkey1, const void *vkey2)
38130{
38131 const struct packet_conn_info *old = (const struct packet_conn_info *) vkey1;
38132 const struct packet_conn_info *real_packet = (const struct packet_conn_info *) vkey2;
38133 bool differ;
38134
38135 differ = (old->id != real_packet->id);
38136
38137 return !differ;
38138}
38139 BV_DEFINE(packet_conn_info_100_fields, 8);
38140#endif /* FREECIV_DELTA_PROTOCOL */
38141
38142 static struct packet_conn_info *receive_packet_conn_info_100(struct connection *pc)
38143{
38144#define FREE_PACKET_STRUCT(_packet) free_packet_conn_info(_packet)
38145#ifdef FREECIV_DELTA_PROTOCOL
38146 packet_conn_info_100_fields fields;
38147 struct packet_conn_info *old;
38148 struct genhash **hash = pc->phs.received + PACKET_CONN_INFO;
38149#endif /* FREECIV_DELTA_PROTOCOL */
38150 RECEIVE_PACKET_START(packet_conn_info, real_packet);
38151#ifdef FREECIV_JSON_CONNECTION
38152 struct plocation field_addr;
38153 {
38154 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
38155 field_addr = *field_addr_tmp;
38156 FC_FREE(field_addr_tmp);
38157 }
38158#endif /* FREECIV_JSON_CONNECTION */
38159
38160#ifdef FREECIV_DELTA_PROTOCOL
38161#ifdef FREECIV_JSON_CONNECTION
38162 field_addr.name = "fields";
38163#endif /* FREECIV_JSON_CONNECTION */
38164 DIO_BV_GET(&din, &field_addr, fields);
38165#ifdef FREECIV_JSON_CONNECTION
38166 field_addr.name = "id";
38167#endif /* FREECIV_JSON_CONNECTION */
38168 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
38169 RECEIVE_PACKET_FIELD_ERROR(id);
38170 }
38171
38172#else /* FREECIV_DELTA_PROTOCOL */
38173#ifdef FREECIV_JSON_CONNECTION
38174 field_addr.name = "id";
38175#endif /* FREECIV_JSON_CONNECTION */
38176 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
38177 RECEIVE_PACKET_FIELD_ERROR(id);
38178 }
38179#ifdef FREECIV_JSON_CONNECTION
38180 field_addr.name = "used";
38181#endif /* FREECIV_JSON_CONNECTION */
38182 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->used)) {
38183 RECEIVE_PACKET_FIELD_ERROR(used);
38184 }
38185#ifdef FREECIV_JSON_CONNECTION
38186 field_addr.name = "established";
38187#endif /* FREECIV_JSON_CONNECTION */
38188 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->established)) {
38189 RECEIVE_PACKET_FIELD_ERROR(established);
38190 }
38191#ifdef FREECIV_JSON_CONNECTION
38192 field_addr.name = "observer";
38193#endif /* FREECIV_JSON_CONNECTION */
38194 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->observer)) {
38195 RECEIVE_PACKET_FIELD_ERROR(observer);
38196 }
38197#ifdef FREECIV_JSON_CONNECTION
38198 field_addr.name = "player_num";
38199#endif /* FREECIV_JSON_CONNECTION */
38200 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_num)) {
38201 RECEIVE_PACKET_FIELD_ERROR(player_num);
38202 }
38203#ifdef FREECIV_JSON_CONNECTION
38204 field_addr.name = "access_level";
38205#endif /* FREECIV_JSON_CONNECTION */
38206 {
38207 int readin;
38208
38209 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38210 RECEIVE_PACKET_FIELD_ERROR(access_level);
38211 }
38212 real_packet->access_level = readin;
38213 }
38214#ifdef FREECIV_JSON_CONNECTION
38215 field_addr.name = "username";
38216#endif /* FREECIV_JSON_CONNECTION */
38217 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
38218 RECEIVE_PACKET_FIELD_ERROR(username);
38219 }
38220#ifdef FREECIV_JSON_CONNECTION
38221 field_addr.name = "addr";
38222#endif /* FREECIV_JSON_CONNECTION */
38223 if (!DIO_GET(string, &din, &field_addr, real_packet->addr, sizeof(real_packet->addr))) {
38224 RECEIVE_PACKET_FIELD_ERROR(addr);
38225 }
38226#ifdef FREECIV_JSON_CONNECTION
38227 field_addr.name = "capability";
38228#endif /* FREECIV_JSON_CONNECTION */
38229 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
38230 RECEIVE_PACKET_FIELD_ERROR(capability);
38231 }
38232#endif
38233 log_packet_detailed("packet_conn_info_100: got info about (%d)",
38234 real_packet->id);
38235
38236#ifdef FREECIV_DELTA_PROTOCOL
38237 if (nullptr == *hash) {
38238 *hash = genhash_new_full(hash_packet_conn_info_100, cmp_packet_conn_info_100,
38239 nullptr, nullptr, nullptr, destroy_packet_conn_info);
38240 }
38241
38242 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
38243 *real_packet = *old;
38244 } else {
38245 /* packet is already initialized empty */
38246 log_packet_detailed(" no old info");
38247 }
38248
38249 real_packet->used = BV_ISSET(fields, 0);
38250 real_packet->established = BV_ISSET(fields, 1);
38251 real_packet->observer = BV_ISSET(fields, 2);
38252 if (BV_ISSET(fields, 3)) {
38253 log_packet_detailed(" got field 'player_num'");
38254#ifdef FREECIV_JSON_CONNECTION
38255 field_addr.name = "player_num";
38256#endif /* FREECIV_JSON_CONNECTION */
38257 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_num)) {
38258 RECEIVE_PACKET_FIELD_ERROR(player_num);
38259 }
38260 }
38261 if (BV_ISSET(fields, 4)) {
38262 log_packet_detailed(" got field 'access_level'");
38263#ifdef FREECIV_JSON_CONNECTION
38264 field_addr.name = "access_level";
38265#endif /* FREECIV_JSON_CONNECTION */
38266 {
38267 int readin;
38268
38269 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38270 RECEIVE_PACKET_FIELD_ERROR(access_level);
38271 }
38272 real_packet->access_level = readin;
38273 }
38274 }
38275 if (BV_ISSET(fields, 5)) {
38276 log_packet_detailed(" got field 'username'");
38277#ifdef FREECIV_JSON_CONNECTION
38278 field_addr.name = "username";
38279#endif /* FREECIV_JSON_CONNECTION */
38280 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
38281 RECEIVE_PACKET_FIELD_ERROR(username);
38282 }
38283 }
38284 if (BV_ISSET(fields, 6)) {
38285 log_packet_detailed(" got field 'addr'");
38286#ifdef FREECIV_JSON_CONNECTION
38287 field_addr.name = "addr";
38288#endif /* FREECIV_JSON_CONNECTION */
38289 if (!DIO_GET(string, &din, &field_addr, real_packet->addr, sizeof(real_packet->addr))) {
38290 RECEIVE_PACKET_FIELD_ERROR(addr);
38291 }
38292 }
38293 if (BV_ISSET(fields, 7)) {
38294 log_packet_detailed(" got field 'capability'");
38295#ifdef FREECIV_JSON_CONNECTION
38296 field_addr.name = "capability";
38297#endif /* FREECIV_JSON_CONNECTION */
38298 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
38299 RECEIVE_PACKET_FIELD_ERROR(capability);
38300 }
38301 }
38302
38303 if (nullptr == old) {
38304 old = fc_malloc(sizeof(*old));
38305 init_packet_conn_info(old);
38306 *old = *real_packet;
38307 genhash_insert(*hash, old, old);
38308 } else {
38309 *old = *real_packet;
38310 }
38311
38312#endif /* FREECIV_DELTA_PROTOCOL */
38313 RECEIVE_PACKET_END(real_packet);
38314#undef FREE_PACKET_STRUCT
38315}
38316
38317 static int send_packet_conn_info_100(struct connection *pc, const struct packet_conn_info *packet)
38318{
38319 const struct packet_conn_info *real_packet = packet;
38320 int e;
38321#ifdef FREECIV_DELTA_PROTOCOL
38322 packet_conn_info_100_fields fields;
38323 struct packet_conn_info *old;
38324 bool differ;
38325 struct genhash **hash = pc->phs.sent + PACKET_CONN_INFO;
38326 int different = 0;
38327#endif /* FREECIV_DELTA_PROTOCOL */
38328 SEND_PACKET_START(PACKET_CONN_INFO);
38329#ifdef FREECIV_JSON_CONNECTION
38330 struct plocation field_addr;
38331 {
38332 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
38333 field_addr = *field_addr_tmp;
38334 FC_FREE(field_addr_tmp);
38335 }
38336#endif /* FREECIV_JSON_CONNECTION */
38337
38338 log_packet_detailed("packet_conn_info_100: sending info about (%d)",
38339 real_packet->id);
38340
38341#ifdef FREECIV_DELTA_PROTOCOL
38342 if (nullptr == *hash) {
38343 *hash = genhash_new_full(hash_packet_conn_info_100, cmp_packet_conn_info_100,
38344 nullptr, nullptr, nullptr, destroy_packet_conn_info);
38345 }
38346 BV_CLR_ALL(fields);
38347
38348 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
38349 old = fc_malloc(sizeof(*old));
38350 /* temporary bitcopy just to insert correctly */
38351 *old = *real_packet;
38352 genhash_insert(*hash, old, old);
38353 init_packet_conn_info(old);
38354 different = 1; /* Force to send. */
38355 }
38356 differ = (old->used != real_packet->used);
38357 if (differ) {
38358 different++;
38359 }
38360 if (packet->used) {
38361 BV_SET(fields, 0);
38362 }
38363
38364 differ = (old->established != real_packet->established);
38365 if (differ) {
38366 different++;
38367 }
38368 if (packet->established) {
38369 BV_SET(fields, 1);
38370 }
38371
38372 differ = (old->observer != real_packet->observer);
38373 if (differ) {
38374 different++;
38375 }
38376 if (packet->observer) {
38377 BV_SET(fields, 2);
38378 }
38379
38380 differ = (old->player_num != real_packet->player_num);
38381 if (differ) {
38382 different++;
38383 BV_SET(fields, 3);
38384 }
38385
38386 differ = (old->access_level != real_packet->access_level);
38387 if (differ) {
38388 different++;
38389 BV_SET(fields, 4);
38390 }
38391
38392 differ = (strcmp(old->username, real_packet->username) != 0);
38393 if (differ) {
38394 different++;
38395 BV_SET(fields, 5);
38396 }
38397
38398 differ = (strcmp(old->addr, real_packet->addr) != 0);
38399 if (differ) {
38400 different++;
38401 BV_SET(fields, 6);
38402 }
38403
38404 differ = (strcmp(old->capability, real_packet->capability) != 0);
38405 if (differ) {
38406 different++;
38407 BV_SET(fields, 7);
38408 }
38409
38410 if (different == 0) {
38411 log_packet_detailed(" no change -> discard");
38412 return 0;
38413 }
38414
38415#ifdef FREECIV_JSON_CONNECTION
38416 field_addr.name = "fields";
38417#endif /* FREECIV_JSON_CONNECTION */
38418 e = 0;
38419 e |= DIO_BV_PUT(&dout, &field_addr, fields);
38420 if (e) {
38421 log_packet_detailed("fields bitvector error detected");
38422 }
38423#ifdef FREECIV_JSON_CONNECTION
38424 field_addr.name = "id";
38425#endif /* FREECIV_JSON_CONNECTION */
38426 e = 0;
38427 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
38428 if (e) {
38429 log_packet_detailed("'id' field error detected");
38430 }
38431
38432 /* field 0 is folded into the header */
38433 /* field 1 is folded into the header */
38434 /* field 2 is folded into the header */
38435 if (BV_ISSET(fields, 3)) {
38436 log_packet_detailed(" field 'player_num' has changed");
38437#ifdef FREECIV_JSON_CONNECTION
38438 field_addr.name = "player_num";
38439#endif /* FREECIV_JSON_CONNECTION */
38440 e = 0;
38441 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_num);
38442 if (e) {
38443 log_packet_detailed("'player_num' field error detected");
38444 }
38445 }
38446 if (BV_ISSET(fields, 4)) {
38447 log_packet_detailed(" field 'access_level' has changed");
38448#ifdef FREECIV_JSON_CONNECTION
38449 field_addr.name = "access_level";
38450#endif /* FREECIV_JSON_CONNECTION */
38451 e = 0;
38452 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->access_level);
38453 if (e) {
38454 log_packet_detailed("'access_level' field error detected");
38455 }
38456 }
38457 if (BV_ISSET(fields, 5)) {
38458 log_packet_detailed(" field 'username' has changed");
38459#ifdef FREECIV_JSON_CONNECTION
38460 field_addr.name = "username";
38461#endif /* FREECIV_JSON_CONNECTION */
38462 e = 0;
38463 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
38464 if (e) {
38465 log_packet_detailed("'username' field error detected");
38466 }
38467 }
38468 if (BV_ISSET(fields, 6)) {
38469 log_packet_detailed(" field 'addr' has changed");
38470#ifdef FREECIV_JSON_CONNECTION
38471 field_addr.name = "addr";
38472#endif /* FREECIV_JSON_CONNECTION */
38473 e = 0;
38474 e |= DIO_PUT(string, &dout, &field_addr, real_packet->addr);
38475 if (e) {
38476 log_packet_detailed("'addr' field error detected");
38477 }
38478 }
38479 if (BV_ISSET(fields, 7)) {
38480 log_packet_detailed(" field 'capability' has changed");
38481#ifdef FREECIV_JSON_CONNECTION
38482 field_addr.name = "capability";
38483#endif /* FREECIV_JSON_CONNECTION */
38484 e = 0;
38485 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
38486 if (e) {
38487 log_packet_detailed("'capability' field error detected");
38488 }
38489 }
38490
38491 *old = *real_packet;
38492#endif /* FREECIV_DELTA_PROTOCOL */
38493#ifndef FREECIV_DELTA_PROTOCOL
38494#ifdef FREECIV_JSON_CONNECTION
38495 field_addr.name = "id";
38496#endif /* FREECIV_JSON_CONNECTION */
38497 e = 0;
38498 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
38499 if (e) {
38500 log_packet_detailed("'id' field error detected");
38501 }
38502#ifdef FREECIV_JSON_CONNECTION
38503 field_addr.name = "used";
38504#endif /* FREECIV_JSON_CONNECTION */
38505 e = 0;
38506 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->used);
38507 if (e) {
38508 log_packet_detailed("'used' field error detected");
38509 }
38510#ifdef FREECIV_JSON_CONNECTION
38511 field_addr.name = "established";
38512#endif /* FREECIV_JSON_CONNECTION */
38513 e = 0;
38514 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->established);
38515 if (e) {
38516 log_packet_detailed("'established' field error detected");
38517 }
38518#ifdef FREECIV_JSON_CONNECTION
38519 field_addr.name = "observer";
38520#endif /* FREECIV_JSON_CONNECTION */
38521 e = 0;
38522 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->observer);
38523 if (e) {
38524 log_packet_detailed("'observer' field error detected");
38525 }
38526#ifdef FREECIV_JSON_CONNECTION
38527 field_addr.name = "player_num";
38528#endif /* FREECIV_JSON_CONNECTION */
38529 e = 0;
38530 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_num);
38531 if (e) {
38532 log_packet_detailed("'player_num' field error detected");
38533 }
38534#ifdef FREECIV_JSON_CONNECTION
38535 field_addr.name = "access_level";
38536#endif /* FREECIV_JSON_CONNECTION */
38537 e = 0;
38538 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->access_level);
38539 if (e) {
38540 log_packet_detailed("'access_level' field error detected");
38541 }
38542#ifdef FREECIV_JSON_CONNECTION
38543 field_addr.name = "username";
38544#endif /* FREECIV_JSON_CONNECTION */
38545 e = 0;
38546 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
38547 if (e) {
38548 log_packet_detailed("'username' field error detected");
38549 }
38550#ifdef FREECIV_JSON_CONNECTION
38551 field_addr.name = "addr";
38552#endif /* FREECIV_JSON_CONNECTION */
38553 e = 0;
38554 e |= DIO_PUT(string, &dout, &field_addr, real_packet->addr);
38555 if (e) {
38556 log_packet_detailed("'addr' field error detected");
38557 }
38558#ifdef FREECIV_JSON_CONNECTION
38559 field_addr.name = "capability";
38560#endif /* FREECIV_JSON_CONNECTION */
38561 e = 0;
38562 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
38563 if (e) {
38564 log_packet_detailed("'capability' field error detected");
38565 }
38566
38567#endif
38568 SEND_PACKET_END(PACKET_CONN_INFO);
38569}
38570
38571 int send_packet_conn_info(struct connection *pc, const struct packet_conn_info *packet)
38572{
38573 if (!pc->used) {
38574 log_error("WARNING: trying to send data to the closed connection %s",
38575 conn_description(pc));
38576 return -1;
38577 }
38578 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_INFO].packet != nullptr, -1,
38579 "Handler for PACKET_CONN_INFO not installed");
38580 return pc->phs.handlers->send[PACKET_CONN_INFO].packet(pc, packet);
38581}
38582
38583 void lsend_packet_conn_info(struct conn_list *dest, const struct packet_conn_info *packet)
38584{
38585 conn_list_iterate(dest, pconn) {
38586 send_packet_conn_info(pconn, packet);
38587 } conn_list_iterate_end;
38588}
38589
38590 static inline void init_packet_conn_ping_info(struct packet_conn_ping_info *packet)
38591{
38592 memset(packet, 0, sizeof(*packet));
38593}
38594
38595#define free_packet_conn_ping_info(_packet) (void) 0
38596#define destroy_packet_conn_ping_info free
38597
38598#ifdef FREECIV_DELTA_PROTOCOL
38599#define hash_packet_conn_ping_info_100 hash_const
38600
38601#define cmp_packet_conn_ping_info_100 cmp_const
38602
38603 BV_DEFINE(packet_conn_ping_info_100_fields, 3);
38604#endif /* FREECIV_DELTA_PROTOCOL */
38605
38606 static struct packet_conn_ping_info *receive_packet_conn_ping_info_100(struct connection *pc)
38607{
38608#define FREE_PACKET_STRUCT(_packet) free_packet_conn_ping_info(_packet)
38609#ifdef FREECIV_DELTA_PROTOCOL
38610 packet_conn_ping_info_100_fields fields;
38611 struct packet_conn_ping_info *old;
38612 struct genhash **hash = pc->phs.received + PACKET_CONN_PING_INFO;
38613#endif /* FREECIV_DELTA_PROTOCOL */
38614 RECEIVE_PACKET_START(packet_conn_ping_info, real_packet);
38615#ifdef FREECIV_JSON_CONNECTION
38616 struct plocation field_addr;
38617 {
38618 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
38619 field_addr = *field_addr_tmp;
38620 FC_FREE(field_addr_tmp);
38621 }
38622#endif /* FREECIV_JSON_CONNECTION */
38623
38624#ifdef FREECIV_DELTA_PROTOCOL
38625#ifdef FREECIV_JSON_CONNECTION
38626 field_addr.name = "fields";
38627#endif /* FREECIV_JSON_CONNECTION */
38628 DIO_BV_GET(&din, &field_addr, fields);
38629
38630#else /* FREECIV_DELTA_PROTOCOL */
38631#ifdef FREECIV_JSON_CONNECTION
38632 field_addr.name = "connections";
38633#endif /* FREECIV_JSON_CONNECTION */
38634 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->connections)) {
38635 RECEIVE_PACKET_FIELD_ERROR(connections);
38636 }
38637#ifdef FREECIV_JSON_CONNECTION
38638 field_addr.name = "conn_id";
38639#endif /* FREECIV_JSON_CONNECTION */
38640 {
38641 int i;
38642
38643#ifdef FREECIV_JSON_CONNECTION
38644 /* Enter array. */
38645 field_addr.sub_location = plocation_elem_new(0);
38646#endif /* FREECIV_JSON_CONNECTION */
38647
38648 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
38649 RECEIVE_PACKET_FIELD_ERROR(conn_id, ": truncation array");
38650 }
38651 for (i = 0; i < real_packet->connections; i++) {
38652#ifdef FREECIV_JSON_CONNECTION
38653 field_addr.sub_location->number = i;
38654#endif /* FREECIV_JSON_CONNECTION */
38655 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id[i])) {
38656 RECEIVE_PACKET_FIELD_ERROR(conn_id);
38657 }
38658 }
38659
38660#ifdef FREECIV_JSON_CONNECTION
38661 /* Exit array. */
38662 FC_FREE(field_addr.sub_location);
38663#endif /* FREECIV_JSON_CONNECTION */
38664 }
38665#ifdef FREECIV_JSON_CONNECTION
38666 field_addr.name = "ping_time";
38667#endif /* FREECIV_JSON_CONNECTION */
38668 {
38669 int i;
38670
38671#ifdef FREECIV_JSON_CONNECTION
38672 /* Enter array. */
38673 field_addr.sub_location = plocation_elem_new(0);
38674#endif /* FREECIV_JSON_CONNECTION */
38675
38676 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
38677 RECEIVE_PACKET_FIELD_ERROR(ping_time, ": truncation array");
38678 }
38679 for (i = 0; i < real_packet->connections; i++) {
38680#ifdef FREECIV_JSON_CONNECTION
38681 field_addr.sub_location->number = i;
38682#endif /* FREECIV_JSON_CONNECTION */
38683 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->ping_time[i], 100000)) {
38684 RECEIVE_PACKET_FIELD_ERROR(ping_time);
38685 }
38686 }
38687
38688#ifdef FREECIV_JSON_CONNECTION
38689 /* Exit array. */
38690 FC_FREE(field_addr.sub_location);
38691#endif /* FREECIV_JSON_CONNECTION */
38692 }
38693#endif
38694 log_packet_detailed("packet_conn_ping_info_100: got info about ()");
38695
38696#ifdef FREECIV_DELTA_PROTOCOL
38697 if (nullptr == *hash) {
38698 *hash = genhash_new_full(hash_packet_conn_ping_info_100, cmp_packet_conn_ping_info_100,
38699 nullptr, nullptr, nullptr, destroy_packet_conn_ping_info);
38700 }
38701
38702 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
38703 *real_packet = *old;
38704 } else {
38705 /* packet is already initialized empty */
38706 log_packet_detailed(" no old info");
38707 }
38708
38709 if (BV_ISSET(fields, 0)) {
38710 log_packet_detailed(" got field 'connections'");
38711#ifdef FREECIV_JSON_CONNECTION
38712 field_addr.name = "connections";
38713#endif /* FREECIV_JSON_CONNECTION */
38714 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->connections)) {
38715 RECEIVE_PACKET_FIELD_ERROR(connections);
38716 }
38717 }
38718 if (BV_ISSET(fields, 1)) {
38719 log_packet_detailed(" got field 'conn_id'");
38720#ifdef FREECIV_JSON_CONNECTION
38721 field_addr.name = "conn_id";
38722#endif /* FREECIV_JSON_CONNECTION */
38723 {
38724 int i;
38725
38726#ifdef FREECIV_JSON_CONNECTION
38727 /* Enter array. */
38728 field_addr.sub_location = plocation_elem_new(0);
38729#endif /* FREECIV_JSON_CONNECTION */
38730
38731 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
38732 RECEIVE_PACKET_FIELD_ERROR(conn_id, ": truncation array");
38733 }
38734 for (i = 0; i < real_packet->connections; i++) {
38735#ifdef FREECIV_JSON_CONNECTION
38736 field_addr.sub_location->number = i;
38737#endif /* FREECIV_JSON_CONNECTION */
38738 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id[i])) {
38739 RECEIVE_PACKET_FIELD_ERROR(conn_id);
38740 }
38741 }
38742
38743#ifdef FREECIV_JSON_CONNECTION
38744 /* Exit array. */
38745 FC_FREE(field_addr.sub_location);
38746#endif /* FREECIV_JSON_CONNECTION */
38747 }
38748 }
38749 if (BV_ISSET(fields, 2)) {
38750 log_packet_detailed(" got field 'ping_time'");
38751#ifdef FREECIV_JSON_CONNECTION
38752 field_addr.name = "ping_time";
38753#endif /* FREECIV_JSON_CONNECTION */
38754 {
38755 int i;
38756
38757#ifdef FREECIV_JSON_CONNECTION
38758 /* Enter array. */
38759 field_addr.sub_location = plocation_elem_new(0);
38760#endif /* FREECIV_JSON_CONNECTION */
38761
38762 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
38763 RECEIVE_PACKET_FIELD_ERROR(ping_time, ": truncation array");
38764 }
38765 for (i = 0; i < real_packet->connections; i++) {
38766#ifdef FREECIV_JSON_CONNECTION
38767 field_addr.sub_location->number = i;
38768#endif /* FREECIV_JSON_CONNECTION */
38769 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->ping_time[i], 100000)) {
38770 RECEIVE_PACKET_FIELD_ERROR(ping_time);
38771 }
38772 }
38773
38774#ifdef FREECIV_JSON_CONNECTION
38775 /* Exit array. */
38776 FC_FREE(field_addr.sub_location);
38777#endif /* FREECIV_JSON_CONNECTION */
38778 }
38779 }
38780
38781 if (nullptr == old) {
38782 old = fc_malloc(sizeof(*old));
38783 init_packet_conn_ping_info(old);
38784 *old = *real_packet;
38785 genhash_insert(*hash, old, old);
38786 } else {
38787 *old = *real_packet;
38788 }
38789
38790#endif /* FREECIV_DELTA_PROTOCOL */
38791 RECEIVE_PACKET_END(real_packet);
38792#undef FREE_PACKET_STRUCT
38793}
38794
38795 static int send_packet_conn_ping_info_100(struct connection *pc, const struct packet_conn_ping_info *packet)
38796{
38797 const struct packet_conn_ping_info *real_packet = packet;
38798 int e;
38799#ifdef FREECIV_DELTA_PROTOCOL
38800 packet_conn_ping_info_100_fields fields;
38801 struct packet_conn_ping_info *old;
38802 bool differ;
38803 struct genhash **hash = pc->phs.sent + PACKET_CONN_PING_INFO;
38804#endif /* FREECIV_DELTA_PROTOCOL */
38805 SEND_PACKET_START(PACKET_CONN_PING_INFO);
38806#ifdef FREECIV_JSON_CONNECTION
38807 struct plocation field_addr;
38808 {
38809 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
38810 field_addr = *field_addr_tmp;
38811 FC_FREE(field_addr_tmp);
38812 }
38813#endif /* FREECIV_JSON_CONNECTION */
38814
38815 log_packet_detailed("packet_conn_ping_info_100: sending info about ()");
38816
38817#ifdef FREECIV_DELTA_PROTOCOL
38818 if (nullptr == *hash) {
38819 *hash = genhash_new_full(hash_packet_conn_ping_info_100, cmp_packet_conn_ping_info_100,
38820 nullptr, nullptr, nullptr, destroy_packet_conn_ping_info);
38821 }
38822 BV_CLR_ALL(fields);
38823
38824 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
38825 old = fc_malloc(sizeof(*old));
38826 /* temporary bitcopy just to insert correctly */
38827 *old = *real_packet;
38828 genhash_insert(*hash, old, old);
38829 init_packet_conn_ping_info(old);
38830 }
38831 differ = (old->connections != real_packet->connections);
38832 if (differ) {
38833 BV_SET(fields, 0);
38834 }
38835
38836 differ = (old->connections != real_packet->connections);
38837 if (!differ) {
38838 int i;
38839
38840 for (i = 0; i < real_packet->connections; i++) {
38841 differ = (old->conn_id[i] != real_packet->conn_id[i]);
38842 if (differ) {
38843 break;
38844 }
38845 }
38846 }
38847 if (differ) {
38848 BV_SET(fields, 1);
38849 }
38850
38851 differ = (old->connections != real_packet->connections);
38852 if (!differ) {
38853 int i;
38854
38855 for (i = 0; i < real_packet->connections; i++) {
38856 differ = ((int) (old->ping_time[i] * 100000) != (int) (real_packet->ping_time[i] * 100000));
38857 if (differ) {
38858 break;
38859 }
38860 }
38861 }
38862 if (differ) {
38863 BV_SET(fields, 2);
38864 }
38865
38866
38867#ifdef FREECIV_JSON_CONNECTION
38868 field_addr.name = "fields";
38869#endif /* FREECIV_JSON_CONNECTION */
38870 e = 0;
38871 e |= DIO_BV_PUT(&dout, &field_addr, fields);
38872 if (e) {
38873 log_packet_detailed("fields bitvector error detected");
38874 }
38875
38876 if (BV_ISSET(fields, 0)) {
38877 log_packet_detailed(" field 'connections' has changed");
38878#ifdef FREECIV_JSON_CONNECTION
38879 field_addr.name = "connections";
38880#endif /* FREECIV_JSON_CONNECTION */
38881 e = 0;
38882 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->connections);
38883 if (e) {
38884 log_packet_detailed("'connections' field error detected");
38885 }
38886 }
38887 if (BV_ISSET(fields, 1)) {
38888 log_packet_detailed(" field 'conn_id' has changed");
38889#ifdef FREECIV_JSON_CONNECTION
38890 field_addr.name = "conn_id";
38891#endif /* FREECIV_JSON_CONNECTION */
38892 e = 0;
38893 {
38894 int i;
38895
38896#ifdef FREECIV_JSON_CONNECTION
38897 /* Create the array. */
38898 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
38899
38900 /* Enter the array. */
38901 field_addr.sub_location = plocation_elem_new(0);
38902#endif /* FREECIV_JSON_CONNECTION */
38903
38904 for (i = 0; i < real_packet->connections; i++) {
38905#ifdef FREECIV_JSON_CONNECTION
38906 /* Next array element. */
38907 field_addr.sub_location->number = i;
38908#endif /* FREECIV_JSON_CONNECTION */
38909 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id[i]);
38910 }
38911
38912#ifdef FREECIV_JSON_CONNECTION
38913 /* Exit array. */
38914 FC_FREE(field_addr.sub_location);
38915#endif /* FREECIV_JSON_CONNECTION */
38916 }
38917 if (e) {
38918 log_packet_detailed("'conn_id' field error detected");
38919 }
38920 }
38921 if (BV_ISSET(fields, 2)) {
38922 log_packet_detailed(" field 'ping_time' has changed");
38923#ifdef FREECIV_JSON_CONNECTION
38924 field_addr.name = "ping_time";
38925#endif /* FREECIV_JSON_CONNECTION */
38926 e = 0;
38927 {
38928 int i;
38929
38930#ifdef FREECIV_JSON_CONNECTION
38931 /* Create the array. */
38932 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
38933
38934 /* Enter the array. */
38935 field_addr.sub_location = plocation_elem_new(0);
38936#endif /* FREECIV_JSON_CONNECTION */
38937
38938 for (i = 0; i < real_packet->connections; i++) {
38939#ifdef FREECIV_JSON_CONNECTION
38940 /* Next array element. */
38941 field_addr.sub_location->number = i;
38942#endif /* FREECIV_JSON_CONNECTION */
38943 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->ping_time[i], 100000);
38944 }
38945
38946#ifdef FREECIV_JSON_CONNECTION
38947 /* Exit array. */
38948 FC_FREE(field_addr.sub_location);
38949#endif /* FREECIV_JSON_CONNECTION */
38950 }
38951 if (e) {
38952 log_packet_detailed("'ping_time' field error detected");
38953 }
38954 }
38955
38956 *old = *real_packet;
38957#endif /* FREECIV_DELTA_PROTOCOL */
38958#ifndef FREECIV_DELTA_PROTOCOL
38959#ifdef FREECIV_JSON_CONNECTION
38960 field_addr.name = "connections";
38961#endif /* FREECIV_JSON_CONNECTION */
38962 e = 0;
38963 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->connections);
38964 if (e) {
38965 log_packet_detailed("'connections' field error detected");
38966 }
38967#ifdef FREECIV_JSON_CONNECTION
38968 field_addr.name = "conn_id";
38969#endif /* FREECIV_JSON_CONNECTION */
38970 e = 0;
38971 {
38972 int i;
38973
38974#ifdef FREECIV_JSON_CONNECTION
38975 /* Create the array. */
38976 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
38977
38978 /* Enter the array. */
38979 field_addr.sub_location = plocation_elem_new(0);
38980#endif /* FREECIV_JSON_CONNECTION */
38981
38982 for (i = 0; i < real_packet->connections; i++) {
38983#ifdef FREECIV_JSON_CONNECTION
38984 /* Next array element. */
38985 field_addr.sub_location->number = i;
38986#endif /* FREECIV_JSON_CONNECTION */
38987 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id[i]);
38988 }
38989
38990#ifdef FREECIV_JSON_CONNECTION
38991 /* Exit array. */
38992 FC_FREE(field_addr.sub_location);
38993#endif /* FREECIV_JSON_CONNECTION */
38994 }
38995 if (e) {
38996 log_packet_detailed("'conn_id' field error detected");
38997 }
38998#ifdef FREECIV_JSON_CONNECTION
38999 field_addr.name = "ping_time";
39000#endif /* FREECIV_JSON_CONNECTION */
39001 e = 0;
39002 {
39003 int i;
39004
39005#ifdef FREECIV_JSON_CONNECTION
39006 /* Create the array. */
39007 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
39008
39009 /* Enter the array. */
39010 field_addr.sub_location = plocation_elem_new(0);
39011#endif /* FREECIV_JSON_CONNECTION */
39012
39013 for (i = 0; i < real_packet->connections; i++) {
39014#ifdef FREECIV_JSON_CONNECTION
39015 /* Next array element. */
39016 field_addr.sub_location->number = i;
39017#endif /* FREECIV_JSON_CONNECTION */
39018 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->ping_time[i], 100000);
39019 }
39020
39021#ifdef FREECIV_JSON_CONNECTION
39022 /* Exit array. */
39023 FC_FREE(field_addr.sub_location);
39024#endif /* FREECIV_JSON_CONNECTION */
39025 }
39026 if (e) {
39027 log_packet_detailed("'ping_time' field error detected");
39028 }
39029
39030#endif
39031 SEND_PACKET_END(PACKET_CONN_PING_INFO);
39032}
39033
39034 int send_packet_conn_ping_info(struct connection *pc, const struct packet_conn_ping_info *packet)
39035{
39036 if (!pc->used) {
39037 log_error("WARNING: trying to send data to the closed connection %s",
39038 conn_description(pc));
39039 return -1;
39040 }
39041 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PING_INFO].packet != nullptr, -1,
39042 "Handler for PACKET_CONN_PING_INFO not installed");
39043 return pc->phs.handlers->send[PACKET_CONN_PING_INFO].packet(pc, packet);
39044}
39045
39046 void lsend_packet_conn_ping_info(struct conn_list *dest, const struct packet_conn_ping_info *packet)
39047{
39048 conn_list_iterate(dest, pconn) {
39049 send_packet_conn_ping_info(pconn, packet);
39050 } conn_list_iterate_end;
39051}
39052
39053 static inline void init_packet_conn_ping(struct packet_conn_ping *packet)
39054{
39055 memset(packet, 0, sizeof(*packet));
39056}
39057
39058#define free_packet_conn_ping(_packet) (void) 0
39059#define destroy_packet_conn_ping free
39060
39061 static struct packet_conn_ping *receive_packet_conn_ping_100(struct connection *pc)
39062{
39063#define FREE_PACKET_STRUCT(_packet) free_packet_conn_ping(_packet)
39064 RECEIVE_PACKET_START(packet_conn_ping, real_packet);
39065#if 1 /* To match endif */
39066 real_packet->__dummy = 0xff;
39067#endif
39068 log_packet_detailed("packet_conn_ping_100: got info about ()");
39069 RECEIVE_PACKET_END(real_packet);
39070#undef FREE_PACKET_STRUCT
39071}
39072
39073 static int send_packet_conn_ping_100(struct connection *pc)
39074{
39075 SEND_PACKET_START(PACKET_CONN_PING);
39076
39077 log_packet_detailed("packet_conn_ping_100: sending info about ()");
39078 SEND_PACKET_END(PACKET_CONN_PING);
39079}
39080
39081 int send_packet_conn_ping(struct connection *pc)
39082{
39083 if (!pc->used) {
39084 log_error("WARNING: trying to send data to the closed connection %s",
39085 conn_description(pc));
39086 return -1;
39087 }
39088 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PING].no_packet != nullptr, -1,
39089 "Handler for PACKET_CONN_PING not installed");
39090 return pc->phs.handlers->send[PACKET_CONN_PING].no_packet(pc);
39091}
39092
39093 static inline void init_packet_conn_pong(struct packet_conn_pong *packet)
39094{
39095 memset(packet, 0, sizeof(*packet));
39096}
39097
39098#define free_packet_conn_pong(_packet) (void) 0
39099#define destroy_packet_conn_pong free
39100
39101 static struct packet_conn_pong *receive_packet_conn_pong_100(struct connection *pc)
39102{
39103#define FREE_PACKET_STRUCT(_packet) free_packet_conn_pong(_packet)
39104 RECEIVE_PACKET_START(packet_conn_pong, real_packet);
39105#if 1 /* To match endif */
39106 real_packet->__dummy = 0xff;
39107#endif
39108 log_packet_detailed("packet_conn_pong_100: got info about ()");
39109 RECEIVE_PACKET_END(real_packet);
39110#undef FREE_PACKET_STRUCT
39111}
39112
39113 static int send_packet_conn_pong_100(struct connection *pc)
39114{
39115 SEND_PACKET_START(PACKET_CONN_PONG);
39116
39117 log_packet_detailed("packet_conn_pong_100: sending info about ()");
39118 SEND_PACKET_END(PACKET_CONN_PONG);
39119}
39120
39121 int send_packet_conn_pong(struct connection *pc)
39122{
39123 if (!pc->used) {
39124 log_error("WARNING: trying to send data to the closed connection %s",
39125 conn_description(pc));
39126 return -1;
39127 }
39128 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PONG].no_packet != nullptr, -1,
39129 "Handler for PACKET_CONN_PONG not installed");
39130 return pc->phs.handlers->send[PACKET_CONN_PONG].no_packet(pc);
39131}
39132
39133 static inline void init_packet_client_heartbeat(struct packet_client_heartbeat *packet)
39134{
39135 memset(packet, 0, sizeof(*packet));
39136}
39137
39138#define free_packet_client_heartbeat(_packet) (void) 0
39139#define destroy_packet_client_heartbeat free
39140
39141 static struct packet_client_heartbeat *receive_packet_client_heartbeat_100(struct connection *pc)
39142{
39143#define FREE_PACKET_STRUCT(_packet) free_packet_client_heartbeat(_packet)
39144 RECEIVE_PACKET_START(packet_client_heartbeat, real_packet);
39145#if 1 /* To match endif */
39146 real_packet->__dummy = 0xff;
39147#endif
39148 log_packet_detailed("packet_client_heartbeat_100: got info about ()");
39149 RECEIVE_PACKET_END(real_packet);
39150#undef FREE_PACKET_STRUCT
39151}
39152
39153 static int send_packet_client_heartbeat_100(struct connection *pc)
39154{
39155 SEND_PACKET_START(PACKET_CLIENT_HEARTBEAT);
39156
39157 log_packet_detailed("packet_client_heartbeat_100: sending info about ()");
39158 SEND_PACKET_END(PACKET_CLIENT_HEARTBEAT);
39159}
39160
39161 int send_packet_client_heartbeat(struct connection *pc)
39162{
39163 if (!pc->used) {
39164 log_error("WARNING: trying to send data to the closed connection %s",
39165 conn_description(pc));
39166 return -1;
39167 }
39168 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CLIENT_HEARTBEAT].no_packet != nullptr, -1,
39169 "Handler for PACKET_CLIENT_HEARTBEAT not installed");
39170 return pc->phs.handlers->send[PACKET_CLIENT_HEARTBEAT].no_packet(pc);
39171}
39172
39173 static inline void init_packet_client_info(struct packet_client_info *packet)
39174{
39175 memset(packet, 0, sizeof(*packet));
39176}
39177
39178#define free_packet_client_info(_packet) (void) 0
39179#define destroy_packet_client_info free
39180
39181#ifdef FREECIV_DELTA_PROTOCOL
39182#define hash_packet_client_info_100 hash_const
39183
39184#define cmp_packet_client_info_100 cmp_const
39185
39186 BV_DEFINE(packet_client_info_100_fields, 3);
39187#endif /* FREECIV_DELTA_PROTOCOL */
39188
39189 static struct packet_client_info *receive_packet_client_info_100(struct connection *pc)
39190{
39191#define FREE_PACKET_STRUCT(_packet) free_packet_client_info(_packet)
39192#ifdef FREECIV_DELTA_PROTOCOL
39193 packet_client_info_100_fields fields;
39194 struct packet_client_info *old;
39195 struct genhash **hash = pc->phs.received + PACKET_CLIENT_INFO;
39196#endif /* FREECIV_DELTA_PROTOCOL */
39197 RECEIVE_PACKET_START(packet_client_info, real_packet);
39198#ifdef FREECIV_JSON_CONNECTION
39199 struct plocation field_addr;
39200 {
39201 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
39202 field_addr = *field_addr_tmp;
39203 FC_FREE(field_addr_tmp);
39204 }
39205#endif /* FREECIV_JSON_CONNECTION */
39206
39207#ifdef FREECIV_DELTA_PROTOCOL
39208#ifdef FREECIV_JSON_CONNECTION
39209 field_addr.name = "fields";
39210#endif /* FREECIV_JSON_CONNECTION */
39211 DIO_BV_GET(&din, &field_addr, fields);
39212
39213#else /* FREECIV_DELTA_PROTOCOL */
39214#ifdef FREECIV_JSON_CONNECTION
39215 field_addr.name = "gui";
39216#endif /* FREECIV_JSON_CONNECTION */
39217 {
39218 int readin;
39219
39220 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39221 RECEIVE_PACKET_FIELD_ERROR(gui);
39222 }
39223 real_packet->gui = readin;
39224 }
39225#ifdef FREECIV_JSON_CONNECTION
39226 field_addr.name = "emerg_version";
39227#endif /* FREECIV_JSON_CONNECTION */
39228 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
39229 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
39230 }
39231#ifdef FREECIV_JSON_CONNECTION
39232 field_addr.name = "distribution";
39233#endif /* FREECIV_JSON_CONNECTION */
39234 if (!DIO_GET(string, &din, &field_addr, real_packet->distribution, sizeof(real_packet->distribution))) {
39235 RECEIVE_PACKET_FIELD_ERROR(distribution);
39236 }
39237#endif
39238 log_packet_detailed("packet_client_info_100: got info about ()");
39239
39240#ifdef FREECIV_DELTA_PROTOCOL
39241 if (nullptr == *hash) {
39242 *hash = genhash_new_full(hash_packet_client_info_100, cmp_packet_client_info_100,
39243 nullptr, nullptr, nullptr, destroy_packet_client_info);
39244 }
39245
39246 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
39247 *real_packet = *old;
39248 } else {
39249 /* packet is already initialized empty */
39250 log_packet_detailed(" no old info");
39251 }
39252
39253 if (BV_ISSET(fields, 0)) {
39254 log_packet_detailed(" got field 'gui'");
39255#ifdef FREECIV_JSON_CONNECTION
39256 field_addr.name = "gui";
39257#endif /* FREECIV_JSON_CONNECTION */
39258 {
39259 int readin;
39260
39261 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39262 RECEIVE_PACKET_FIELD_ERROR(gui);
39263 }
39264 real_packet->gui = readin;
39265 }
39266 }
39267 if (BV_ISSET(fields, 1)) {
39268 log_packet_detailed(" got field 'emerg_version'");
39269#ifdef FREECIV_JSON_CONNECTION
39270 field_addr.name = "emerg_version";
39271#endif /* FREECIV_JSON_CONNECTION */
39272 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
39273 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
39274 }
39275 }
39276 if (BV_ISSET(fields, 2)) {
39277 log_packet_detailed(" got field 'distribution'");
39278#ifdef FREECIV_JSON_CONNECTION
39279 field_addr.name = "distribution";
39280#endif /* FREECIV_JSON_CONNECTION */
39281 if (!DIO_GET(string, &din, &field_addr, real_packet->distribution, sizeof(real_packet->distribution))) {
39282 RECEIVE_PACKET_FIELD_ERROR(distribution);
39283 }
39284 }
39285
39286 if (nullptr == old) {
39287 old = fc_malloc(sizeof(*old));
39288 init_packet_client_info(old);
39289 *old = *real_packet;
39290 genhash_insert(*hash, old, old);
39291 } else {
39292 *old = *real_packet;
39293 }
39294
39295#endif /* FREECIV_DELTA_PROTOCOL */
39296 RECEIVE_PACKET_END(real_packet);
39297#undef FREE_PACKET_STRUCT
39298}
39299
39300 static int send_packet_client_info_100(struct connection *pc, const struct packet_client_info *packet)
39301{
39302 const struct packet_client_info *real_packet = packet;
39303 int e;
39304#ifdef FREECIV_DELTA_PROTOCOL
39305 packet_client_info_100_fields fields;
39306 struct packet_client_info *old;
39307 bool differ;
39308 struct genhash **hash = pc->phs.sent + PACKET_CLIENT_INFO;
39309#endif /* FREECIV_DELTA_PROTOCOL */
39310 SEND_PACKET_START(PACKET_CLIENT_INFO);
39311#ifdef FREECIV_JSON_CONNECTION
39312 struct plocation field_addr;
39313 {
39314 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
39315 field_addr = *field_addr_tmp;
39316 FC_FREE(field_addr_tmp);
39317 }
39318#endif /* FREECIV_JSON_CONNECTION */
39319
39320 log_packet_detailed("packet_client_info_100: sending info about ()");
39321
39322#ifdef FREECIV_DELTA_PROTOCOL
39323 if (nullptr == *hash) {
39324 *hash = genhash_new_full(hash_packet_client_info_100, cmp_packet_client_info_100,
39325 nullptr, nullptr, nullptr, destroy_packet_client_info);
39326 }
39327 BV_CLR_ALL(fields);
39328
39329 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
39330 old = fc_malloc(sizeof(*old));
39331 /* temporary bitcopy just to insert correctly */
39332 *old = *real_packet;
39333 genhash_insert(*hash, old, old);
39334 init_packet_client_info(old);
39335 }
39336 differ = (old->gui != real_packet->gui);
39337 if (differ) {
39338 BV_SET(fields, 0);
39339 }
39340
39341 differ = (old->emerg_version != real_packet->emerg_version);
39342 if (differ) {
39343 BV_SET(fields, 1);
39344 }
39345
39346 differ = (strcmp(old->distribution, real_packet->distribution) != 0);
39347 if (differ) {
39348 BV_SET(fields, 2);
39349 }
39350
39351
39352#ifdef FREECIV_JSON_CONNECTION
39353 field_addr.name = "fields";
39354#endif /* FREECIV_JSON_CONNECTION */
39355 e = 0;
39356 e |= DIO_BV_PUT(&dout, &field_addr, fields);
39357 if (e) {
39358 log_packet_detailed("fields bitvector error detected");
39359 }
39360
39361 if (BV_ISSET(fields, 0)) {
39362 log_packet_detailed(" field 'gui' has changed");
39363#ifdef FREECIV_JSON_CONNECTION
39364 field_addr.name = "gui";
39365#endif /* FREECIV_JSON_CONNECTION */
39366 e = 0;
39367 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui);
39368 if (e) {
39369 log_packet_detailed("'gui' field error detected");
39370 }
39371 }
39372 if (BV_ISSET(fields, 1)) {
39373 log_packet_detailed(" field 'emerg_version' has changed");
39374#ifdef FREECIV_JSON_CONNECTION
39375 field_addr.name = "emerg_version";
39376#endif /* FREECIV_JSON_CONNECTION */
39377 e = 0;
39378 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
39379 if (e) {
39380 log_packet_detailed("'emerg_version' field error detected");
39381 }
39382 }
39383 if (BV_ISSET(fields, 2)) {
39384 log_packet_detailed(" field 'distribution' has changed");
39385#ifdef FREECIV_JSON_CONNECTION
39386 field_addr.name = "distribution";
39387#endif /* FREECIV_JSON_CONNECTION */
39388 e = 0;
39389 e |= DIO_PUT(string, &dout, &field_addr, real_packet->distribution);
39390 if (e) {
39391 log_packet_detailed("'distribution' field error detected");
39392 }
39393 }
39394
39395 *old = *real_packet;
39396#endif /* FREECIV_DELTA_PROTOCOL */
39397#ifndef FREECIV_DELTA_PROTOCOL
39398#ifdef FREECIV_JSON_CONNECTION
39399 field_addr.name = "gui";
39400#endif /* FREECIV_JSON_CONNECTION */
39401 e = 0;
39402 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui);
39403 if (e) {
39404 log_packet_detailed("'gui' field error detected");
39405 }
39406#ifdef FREECIV_JSON_CONNECTION
39407 field_addr.name = "emerg_version";
39408#endif /* FREECIV_JSON_CONNECTION */
39409 e = 0;
39410 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
39411 if (e) {
39412 log_packet_detailed("'emerg_version' field error detected");
39413 }
39414#ifdef FREECIV_JSON_CONNECTION
39415 field_addr.name = "distribution";
39416#endif /* FREECIV_JSON_CONNECTION */
39417 e = 0;
39418 e |= DIO_PUT(string, &dout, &field_addr, real_packet->distribution);
39419 if (e) {
39420 log_packet_detailed("'distribution' field error detected");
39421 }
39422
39423#endif
39424 SEND_PACKET_END(PACKET_CLIENT_INFO);
39425}
39426
39427 int send_packet_client_info(struct connection *pc, const struct packet_client_info *packet)
39428{
39429 if (!pc->used) {
39430 log_error("WARNING: trying to send data to the closed connection %s",
39431 conn_description(pc));
39432 return -1;
39433 }
39434 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CLIENT_INFO].packet != nullptr, -1,
39435 "Handler for PACKET_CLIENT_INFO not installed");
39436 return pc->phs.handlers->send[PACKET_CLIENT_INFO].packet(pc, packet);
39437}
39438
39439 static inline void init_packet_end_phase(struct packet_end_phase *packet)
39440{
39441 memset(packet, 0, sizeof(*packet));
39442}
39443
39444#define free_packet_end_phase(_packet) (void) 0
39445#define destroy_packet_end_phase free
39446
39447 static struct packet_end_phase *receive_packet_end_phase_100(struct connection *pc)
39448{
39449#define FREE_PACKET_STRUCT(_packet) free_packet_end_phase(_packet)
39450 RECEIVE_PACKET_START(packet_end_phase, real_packet);
39451#if 1 /* To match endif */
39452 real_packet->__dummy = 0xff;
39453#endif
39454 log_packet_detailed("packet_end_phase_100: got info about ()");
39455 RECEIVE_PACKET_END(real_packet);
39456#undef FREE_PACKET_STRUCT
39457}
39458
39459 static int send_packet_end_phase_100(struct connection *pc)
39460{
39461 SEND_PACKET_START(PACKET_END_PHASE);
39462
39463 log_packet_detailed("packet_end_phase_100: sending info about ()");
39464 SEND_PACKET_END(PACKET_END_PHASE);
39465}
39466
39467 int send_packet_end_phase(struct connection *pc)
39468{
39469 if (!pc->used) {
39470 log_error("WARNING: trying to send data to the closed connection %s",
39471 conn_description(pc));
39472 return -1;
39473 }
39474 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_END_PHASE].no_packet != nullptr, -1,
39475 "Handler for PACKET_END_PHASE not installed");
39476 return pc->phs.handlers->send[PACKET_END_PHASE].no_packet(pc);
39477}
39478
39479 void lsend_packet_end_phase(struct conn_list *dest)
39480{
39481 conn_list_iterate(dest, pconn) {
39482 send_packet_end_phase(pconn);
39483 } conn_list_iterate_end;
39484}
39485
39486 static inline void init_packet_start_phase(struct packet_start_phase *packet)
39487{
39488 memset(packet, 0, sizeof(*packet));
39489}
39490
39491#define free_packet_start_phase(_packet) (void) 0
39492#define destroy_packet_start_phase free
39493
39494#ifdef FREECIV_DELTA_PROTOCOL
39495#define hash_packet_start_phase_100 hash_const
39496
39497#define cmp_packet_start_phase_100 cmp_const
39498
39499 BV_DEFINE(packet_start_phase_100_fields, 1);
39500#endif /* FREECIV_DELTA_PROTOCOL */
39501
39502 static struct packet_start_phase *receive_packet_start_phase_100(struct connection *pc)
39503{
39504#define FREE_PACKET_STRUCT(_packet) free_packet_start_phase(_packet)
39505#ifdef FREECIV_DELTA_PROTOCOL
39506 packet_start_phase_100_fields fields;
39507 struct packet_start_phase *old;
39508 struct genhash **hash = pc->phs.received + PACKET_START_PHASE;
39509#endif /* FREECIV_DELTA_PROTOCOL */
39510 RECEIVE_PACKET_START(packet_start_phase, real_packet);
39511#ifdef FREECIV_JSON_CONNECTION
39512 struct plocation field_addr;
39513 {
39514 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
39515 field_addr = *field_addr_tmp;
39516 FC_FREE(field_addr_tmp);
39517 }
39518#endif /* FREECIV_JSON_CONNECTION */
39519
39520#ifdef FREECIV_DELTA_PROTOCOL
39521#ifdef FREECIV_JSON_CONNECTION
39522 field_addr.name = "fields";
39523#endif /* FREECIV_JSON_CONNECTION */
39524 DIO_BV_GET(&din, &field_addr, fields);
39525
39526#else /* FREECIV_DELTA_PROTOCOL */
39527#ifdef FREECIV_JSON_CONNECTION
39528 field_addr.name = "phase";
39529#endif /* FREECIV_JSON_CONNECTION */
39530 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
39531 RECEIVE_PACKET_FIELD_ERROR(phase);
39532 }
39533#endif
39534 log_packet_detailed("packet_start_phase_100: got info about ()");
39535
39536#ifdef FREECIV_DELTA_PROTOCOL
39537 if (nullptr == *hash) {
39538 *hash = genhash_new_full(hash_packet_start_phase_100, cmp_packet_start_phase_100,
39539 nullptr, nullptr, nullptr, destroy_packet_start_phase);
39540 }
39541
39542 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
39543 *real_packet = *old;
39544 } else {
39545 /* packet is already initialized empty */
39546 log_packet_detailed(" no old info");
39547 }
39548
39549 if (BV_ISSET(fields, 0)) {
39550 log_packet_detailed(" got field 'phase'");
39551#ifdef FREECIV_JSON_CONNECTION
39552 field_addr.name = "phase";
39553#endif /* FREECIV_JSON_CONNECTION */
39554 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
39555 RECEIVE_PACKET_FIELD_ERROR(phase);
39556 }
39557 }
39558
39559 if (nullptr == old) {
39560 old = fc_malloc(sizeof(*old));
39561 init_packet_start_phase(old);
39562 *old = *real_packet;
39563 genhash_insert(*hash, old, old);
39564 } else {
39565 *old = *real_packet;
39566 }
39567
39568#endif /* FREECIV_DELTA_PROTOCOL */
39569 RECEIVE_PACKET_END(real_packet);
39570#undef FREE_PACKET_STRUCT
39571}
39572
39573 static int send_packet_start_phase_100(struct connection *pc, const struct packet_start_phase *packet)
39574{
39575 const struct packet_start_phase *real_packet = packet;
39576 int e;
39577#ifdef FREECIV_DELTA_PROTOCOL
39578 packet_start_phase_100_fields fields;
39579 struct packet_start_phase *old;
39580 bool differ;
39581 struct genhash **hash = pc->phs.sent + PACKET_START_PHASE;
39582#endif /* FREECIV_DELTA_PROTOCOL */
39583 SEND_PACKET_START(PACKET_START_PHASE);
39584#ifdef FREECIV_JSON_CONNECTION
39585 struct plocation field_addr;
39586 {
39587 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
39588 field_addr = *field_addr_tmp;
39589 FC_FREE(field_addr_tmp);
39590 }
39591#endif /* FREECIV_JSON_CONNECTION */
39592
39593 log_packet_detailed("packet_start_phase_100: sending info about ()");
39594
39595#ifdef FREECIV_DELTA_PROTOCOL
39596 if (nullptr == *hash) {
39597 *hash = genhash_new_full(hash_packet_start_phase_100, cmp_packet_start_phase_100,
39598 nullptr, nullptr, nullptr, destroy_packet_start_phase);
39599 }
39600 BV_CLR_ALL(fields);
39601
39602 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
39603 old = fc_malloc(sizeof(*old));
39604 /* temporary bitcopy just to insert correctly */
39605 *old = *real_packet;
39606 genhash_insert(*hash, old, old);
39607 init_packet_start_phase(old);
39608 }
39609 differ = (old->phase != real_packet->phase);
39610 if (differ) {
39611 BV_SET(fields, 0);
39612 }
39613
39614
39615#ifdef FREECIV_JSON_CONNECTION
39616 field_addr.name = "fields";
39617#endif /* FREECIV_JSON_CONNECTION */
39618 e = 0;
39619 e |= DIO_BV_PUT(&dout, &field_addr, fields);
39620 if (e) {
39621 log_packet_detailed("fields bitvector error detected");
39622 }
39623
39624 if (BV_ISSET(fields, 0)) {
39625 log_packet_detailed(" field 'phase' has changed");
39626#ifdef FREECIV_JSON_CONNECTION
39627 field_addr.name = "phase";
39628#endif /* FREECIV_JSON_CONNECTION */
39629 e = 0;
39630 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
39631 if (e) {
39632 log_packet_detailed("'phase' field error detected");
39633 }
39634 }
39635
39636 *old = *real_packet;
39637#endif /* FREECIV_DELTA_PROTOCOL */
39638#ifndef FREECIV_DELTA_PROTOCOL
39639#ifdef FREECIV_JSON_CONNECTION
39640 field_addr.name = "phase";
39641#endif /* FREECIV_JSON_CONNECTION */
39642 e = 0;
39643 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
39644 if (e) {
39645 log_packet_detailed("'phase' field error detected");
39646 }
39647
39648#endif
39649 SEND_PACKET_END(PACKET_START_PHASE);
39650}
39651
39652 int send_packet_start_phase(struct connection *pc, const struct packet_start_phase *packet)
39653{
39654 if (!pc->used) {
39655 log_error("WARNING: trying to send data to the closed connection %s",
39656 conn_description(pc));
39657 return -1;
39658 }
39659 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_START_PHASE].packet != nullptr, -1,
39660 "Handler for PACKET_START_PHASE not installed");
39661 return pc->phs.handlers->send[PACKET_START_PHASE].packet(pc, packet);
39662}
39663
39664 void lsend_packet_start_phase(struct conn_list *dest, const struct packet_start_phase *packet)
39665{
39666 conn_list_iterate(dest, pconn) {
39667 send_packet_start_phase(pconn, packet);
39668 } conn_list_iterate_end;
39669}
39670
39671 int dsend_packet_start_phase(struct connection *pc, int phase)
39672{
39673 struct packet_start_phase packet, *real_packet = &packet;
39674
39675 real_packet->phase = phase;
39676
39677 return send_packet_start_phase(pc, real_packet);
39678}
39679
39680 void dlsend_packet_start_phase(struct conn_list *dest, int phase)
39681{
39682 struct packet_start_phase packet, *real_packet = &packet;
39683
39684 real_packet->phase = phase;
39685
39686 lsend_packet_start_phase(dest, real_packet);
39687}
39688
39689 static inline void init_packet_new_year(struct packet_new_year *packet)
39690{
39691 memset(packet, 0, sizeof(*packet));
39692}
39693
39694#define free_packet_new_year(_packet) (void) 0
39695#define destroy_packet_new_year free
39696
39697#ifdef FREECIV_DELTA_PROTOCOL
39698#define hash_packet_new_year_100 hash_const
39699
39700#define cmp_packet_new_year_100 cmp_const
39701
39702 BV_DEFINE(packet_new_year_100_fields, 3);
39703#endif /* FREECIV_DELTA_PROTOCOL */
39704
39705 static struct packet_new_year *receive_packet_new_year_100(struct connection *pc)
39706{
39707#define FREE_PACKET_STRUCT(_packet) free_packet_new_year(_packet)
39708#ifdef FREECIV_DELTA_PROTOCOL
39709 packet_new_year_100_fields fields;
39710 struct packet_new_year *old;
39711 struct genhash **hash = pc->phs.received + PACKET_NEW_YEAR;
39712#endif /* FREECIV_DELTA_PROTOCOL */
39713 RECEIVE_PACKET_START(packet_new_year, real_packet);
39714#ifdef FREECIV_JSON_CONNECTION
39715 struct plocation field_addr;
39716 {
39717 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
39718 field_addr = *field_addr_tmp;
39719 FC_FREE(field_addr_tmp);
39720 }
39721#endif /* FREECIV_JSON_CONNECTION */
39722
39723#ifdef FREECIV_DELTA_PROTOCOL
39724#ifdef FREECIV_JSON_CONNECTION
39725 field_addr.name = "fields";
39726#endif /* FREECIV_JSON_CONNECTION */
39727 DIO_BV_GET(&din, &field_addr, fields);
39728
39729#else /* FREECIV_DELTA_PROTOCOL */
39730#ifdef FREECIV_JSON_CONNECTION
39731 field_addr.name = "year";
39732#endif /* FREECIV_JSON_CONNECTION */
39733 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
39734 RECEIVE_PACKET_FIELD_ERROR(year);
39735 }
39736#ifdef FREECIV_JSON_CONNECTION
39737 field_addr.name = "fragments";
39738#endif /* FREECIV_JSON_CONNECTION */
39739 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragments)) {
39740 RECEIVE_PACKET_FIELD_ERROR(fragments);
39741 }
39742#ifdef FREECIV_JSON_CONNECTION
39743 field_addr.name = "turn";
39744#endif /* FREECIV_JSON_CONNECTION */
39745 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
39746 RECEIVE_PACKET_FIELD_ERROR(turn);
39747 }
39748#endif
39749 log_packet_detailed("packet_new_year_100: got info about ()");
39750
39751#ifdef FREECIV_DELTA_PROTOCOL
39752 if (nullptr == *hash) {
39753 *hash = genhash_new_full(hash_packet_new_year_100, cmp_packet_new_year_100,
39754 nullptr, nullptr, nullptr, destroy_packet_new_year);
39755 }
39756
39757 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
39758 *real_packet = *old;
39759 } else {
39760 /* packet is already initialized empty */
39761 log_packet_detailed(" no old info");
39762 }
39763
39764 if (BV_ISSET(fields, 0)) {
39765 log_packet_detailed(" got field 'year'");
39766#ifdef FREECIV_JSON_CONNECTION
39767 field_addr.name = "year";
39768#endif /* FREECIV_JSON_CONNECTION */
39769 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
39770 RECEIVE_PACKET_FIELD_ERROR(year);
39771 }
39772 }
39773 if (BV_ISSET(fields, 1)) {
39774 log_packet_detailed(" got field 'fragments'");
39775#ifdef FREECIV_JSON_CONNECTION
39776 field_addr.name = "fragments";
39777#endif /* FREECIV_JSON_CONNECTION */
39778 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragments)) {
39779 RECEIVE_PACKET_FIELD_ERROR(fragments);
39780 }
39781 }
39782 if (BV_ISSET(fields, 2)) {
39783 log_packet_detailed(" got field 'turn'");
39784#ifdef FREECIV_JSON_CONNECTION
39785 field_addr.name = "turn";
39786#endif /* FREECIV_JSON_CONNECTION */
39787 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
39788 RECEIVE_PACKET_FIELD_ERROR(turn);
39789 }
39790 }
39791
39792 if (nullptr == old) {
39793 old = fc_malloc(sizeof(*old));
39794 init_packet_new_year(old);
39795 *old = *real_packet;
39796 genhash_insert(*hash, old, old);
39797 } else {
39798 *old = *real_packet;
39799 }
39800
39801#endif /* FREECIV_DELTA_PROTOCOL */
39802 RECEIVE_PACKET_END(real_packet);
39803#undef FREE_PACKET_STRUCT
39804}
39805
39806 static int send_packet_new_year_100(struct connection *pc, const struct packet_new_year *packet)
39807{
39808 const struct packet_new_year *real_packet = packet;
39809 int e;
39810#ifdef FREECIV_DELTA_PROTOCOL
39811 packet_new_year_100_fields fields;
39812 struct packet_new_year *old;
39813 bool differ;
39814 struct genhash **hash = pc->phs.sent + PACKET_NEW_YEAR;
39815#endif /* FREECIV_DELTA_PROTOCOL */
39816 SEND_PACKET_START(PACKET_NEW_YEAR);
39817#ifdef FREECIV_JSON_CONNECTION
39818 struct plocation field_addr;
39819 {
39820 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
39821 field_addr = *field_addr_tmp;
39822 FC_FREE(field_addr_tmp);
39823 }
39824#endif /* FREECIV_JSON_CONNECTION */
39825
39826 log_packet_detailed("packet_new_year_100: sending info about ()");
39827
39828#ifdef FREECIV_DELTA_PROTOCOL
39829 if (nullptr == *hash) {
39830 *hash = genhash_new_full(hash_packet_new_year_100, cmp_packet_new_year_100,
39831 nullptr, nullptr, nullptr, destroy_packet_new_year);
39832 }
39833 BV_CLR_ALL(fields);
39834
39835 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
39836 old = fc_malloc(sizeof(*old));
39837 /* temporary bitcopy just to insert correctly */
39838 *old = *real_packet;
39839 genhash_insert(*hash, old, old);
39840 init_packet_new_year(old);
39841 }
39842 differ = (old->year != real_packet->year);
39843 if (differ) {
39844 BV_SET(fields, 0);
39845 }
39846
39847 differ = (old->fragments != real_packet->fragments);
39848 if (differ) {
39849 BV_SET(fields, 1);
39850 }
39851
39852 differ = (old->turn != real_packet->turn);
39853 if (differ) {
39854 BV_SET(fields, 2);
39855 }
39856
39857
39858#ifdef FREECIV_JSON_CONNECTION
39859 field_addr.name = "fields";
39860#endif /* FREECIV_JSON_CONNECTION */
39861 e = 0;
39862 e |= DIO_BV_PUT(&dout, &field_addr, fields);
39863 if (e) {
39864 log_packet_detailed("fields bitvector error detected");
39865 }
39866
39867 if (BV_ISSET(fields, 0)) {
39868 log_packet_detailed(" field 'year' has changed");
39869#ifdef FREECIV_JSON_CONNECTION
39870 field_addr.name = "year";
39871#endif /* FREECIV_JSON_CONNECTION */
39872 e = 0;
39873 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
39874 if (e) {
39875 log_packet_detailed("'year' field error detected");
39876 }
39877 }
39878 if (BV_ISSET(fields, 1)) {
39879 log_packet_detailed(" field 'fragments' has changed");
39880#ifdef FREECIV_JSON_CONNECTION
39881 field_addr.name = "fragments";
39882#endif /* FREECIV_JSON_CONNECTION */
39883 e = 0;
39884 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragments);
39885 if (e) {
39886 log_packet_detailed("'fragments' field error detected");
39887 }
39888 }
39889 if (BV_ISSET(fields, 2)) {
39890 log_packet_detailed(" field 'turn' has changed");
39891#ifdef FREECIV_JSON_CONNECTION
39892 field_addr.name = "turn";
39893#endif /* FREECIV_JSON_CONNECTION */
39894 e = 0;
39895 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
39896 if (e) {
39897 log_packet_detailed("'turn' field error detected");
39898 }
39899 }
39900
39901 *old = *real_packet;
39902#endif /* FREECIV_DELTA_PROTOCOL */
39903#ifndef FREECIV_DELTA_PROTOCOL
39904#ifdef FREECIV_JSON_CONNECTION
39905 field_addr.name = "year";
39906#endif /* FREECIV_JSON_CONNECTION */
39907 e = 0;
39908 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
39909 if (e) {
39910 log_packet_detailed("'year' field error detected");
39911 }
39912#ifdef FREECIV_JSON_CONNECTION
39913 field_addr.name = "fragments";
39914#endif /* FREECIV_JSON_CONNECTION */
39915 e = 0;
39916 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragments);
39917 if (e) {
39918 log_packet_detailed("'fragments' field error detected");
39919 }
39920#ifdef FREECIV_JSON_CONNECTION
39921 field_addr.name = "turn";
39922#endif /* FREECIV_JSON_CONNECTION */
39923 e = 0;
39924 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
39925 if (e) {
39926 log_packet_detailed("'turn' field error detected");
39927 }
39928
39929#endif
39930 SEND_PACKET_END(PACKET_NEW_YEAR);
39931}
39932
39933 int send_packet_new_year(struct connection *pc, const struct packet_new_year *packet)
39934{
39935 if (!pc->used) {
39936 log_error("WARNING: trying to send data to the closed connection %s",
39937 conn_description(pc));
39938 return -1;
39939 }
39940 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NEW_YEAR].packet != nullptr, -1,
39941 "Handler for PACKET_NEW_YEAR not installed");
39942 return pc->phs.handlers->send[PACKET_NEW_YEAR].packet(pc, packet);
39943}
39944
39945 void lsend_packet_new_year(struct conn_list *dest, const struct packet_new_year *packet)
39946{
39947 conn_list_iterate(dest, pconn) {
39948 send_packet_new_year(pconn, packet);
39949 } conn_list_iterate_end;
39950}
39951
39952 static inline void init_packet_begin_turn(struct packet_begin_turn *packet)
39953{
39954 memset(packet, 0, sizeof(*packet));
39955}
39956
39957#define free_packet_begin_turn(_packet) (void) 0
39958#define destroy_packet_begin_turn free
39959
39960 static struct packet_begin_turn *receive_packet_begin_turn_100(struct connection *pc)
39961{
39962#define FREE_PACKET_STRUCT(_packet) free_packet_begin_turn(_packet)
39963 RECEIVE_PACKET_START(packet_begin_turn, real_packet);
39964#if 1 /* To match endif */
39965 real_packet->__dummy = 0xff;
39966#endif
39967 log_packet_detailed("packet_begin_turn_100: got info about ()");
39968 RECEIVE_PACKET_END(real_packet);
39969#undef FREE_PACKET_STRUCT
39970}
39971
39972 static int send_packet_begin_turn_100(struct connection *pc)
39973{
39974 SEND_PACKET_START(PACKET_BEGIN_TURN);
39975
39976 log_packet_detailed("packet_begin_turn_100: sending info about ()");
39977 SEND_PACKET_END(PACKET_BEGIN_TURN);
39978}
39979
39980 int send_packet_begin_turn(struct connection *pc)
39981{
39982 if (!pc->used) {
39983 log_error("WARNING: trying to send data to the closed connection %s",
39984 conn_description(pc));
39985 return -1;
39986 }
39987 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_BEGIN_TURN].no_packet != nullptr, -1,
39988 "Handler for PACKET_BEGIN_TURN not installed");
39989 return pc->phs.handlers->send[PACKET_BEGIN_TURN].no_packet(pc);
39990}
39991
39992 void lsend_packet_begin_turn(struct conn_list *dest)
39993{
39994 conn_list_iterate(dest, pconn) {
39995 send_packet_begin_turn(pconn);
39996 } conn_list_iterate_end;
39997}
39998
39999 static inline void init_packet_end_turn(struct packet_end_turn *packet)
40000{
40001 memset(packet, 0, sizeof(*packet));
40002}
40003
40004#define free_packet_end_turn(_packet) (void) 0
40005#define destroy_packet_end_turn free
40006
40007 static struct packet_end_turn *receive_packet_end_turn_100(struct connection *pc)
40008{
40009#define FREE_PACKET_STRUCT(_packet) free_packet_end_turn(_packet)
40010 RECEIVE_PACKET_START(packet_end_turn, real_packet);
40011#if 1 /* To match endif */
40012 real_packet->__dummy = 0xff;
40013#endif
40014 log_packet_detailed("packet_end_turn_100: got info about ()");
40015 RECEIVE_PACKET_END(real_packet);
40016#undef FREE_PACKET_STRUCT
40017}
40018
40019 static int send_packet_end_turn_100(struct connection *pc)
40020{
40021 SEND_PACKET_START(PACKET_END_TURN);
40022
40023 log_packet_detailed("packet_end_turn_100: sending info about ()");
40024 SEND_PACKET_END(PACKET_END_TURN);
40025}
40026
40027 int send_packet_end_turn(struct connection *pc)
40028{
40029 if (!pc->used) {
40030 log_error("WARNING: trying to send data to the closed connection %s",
40031 conn_description(pc));
40032 return -1;
40033 }
40034 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_END_TURN].no_packet != nullptr, -1,
40035 "Handler for PACKET_END_TURN not installed");
40036 return pc->phs.handlers->send[PACKET_END_TURN].no_packet(pc);
40037}
40038
40039 void lsend_packet_end_turn(struct conn_list *dest)
40040{
40041 conn_list_iterate(dest, pconn) {
40042 send_packet_end_turn(pconn);
40043 } conn_list_iterate_end;
40044}
40045
40046 static inline void init_packet_freeze_client(struct packet_freeze_client *packet)
40047{
40048 memset(packet, 0, sizeof(*packet));
40049}
40050
40051#define free_packet_freeze_client(_packet) (void) 0
40052#define destroy_packet_freeze_client free
40053
40054 static struct packet_freeze_client *receive_packet_freeze_client_100(struct connection *pc)
40055{
40056#define FREE_PACKET_STRUCT(_packet) free_packet_freeze_client(_packet)
40057 RECEIVE_PACKET_START(packet_freeze_client, real_packet);
40058#if 1 /* To match endif */
40059 real_packet->__dummy = 0xff;
40060#endif
40061 log_packet_detailed("packet_freeze_client_100: got info about ()");
40062 RECEIVE_PACKET_END(real_packet);
40063#undef FREE_PACKET_STRUCT
40064}
40065
40066 static int send_packet_freeze_client_100(struct connection *pc)
40067{
40068 SEND_PACKET_START(PACKET_FREEZE_CLIENT);
40069
40070 log_packet_detailed("packet_freeze_client_100: sending info about ()");
40071 SEND_PACKET_END(PACKET_FREEZE_CLIENT);
40072}
40073
40074 int send_packet_freeze_client(struct connection *pc)
40075{
40076 if (!pc->used) {
40077 log_error("WARNING: trying to send data to the closed connection %s",
40078 conn_description(pc));
40079 return -1;
40080 }
40081 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_FREEZE_CLIENT].no_packet != nullptr, -1,
40082 "Handler for PACKET_FREEZE_CLIENT not installed");
40083 return pc->phs.handlers->send[PACKET_FREEZE_CLIENT].no_packet(pc);
40084}
40085
40086 void lsend_packet_freeze_client(struct conn_list *dest)
40087{
40088 conn_list_iterate(dest, pconn) {
40089 send_packet_freeze_client(pconn);
40090 } conn_list_iterate_end;
40091}
40092
40093 static inline void init_packet_thaw_client(struct packet_thaw_client *packet)
40094{
40095 memset(packet, 0, sizeof(*packet));
40096}
40097
40098#define free_packet_thaw_client(_packet) (void) 0
40099#define destroy_packet_thaw_client free
40100
40101 static struct packet_thaw_client *receive_packet_thaw_client_100(struct connection *pc)
40102{
40103#define FREE_PACKET_STRUCT(_packet) free_packet_thaw_client(_packet)
40104 RECEIVE_PACKET_START(packet_thaw_client, real_packet);
40105#if 1 /* To match endif */
40106 real_packet->__dummy = 0xff;
40107#endif
40108 log_packet_detailed("packet_thaw_client_100: got info about ()");
40109 RECEIVE_PACKET_END(real_packet);
40110#undef FREE_PACKET_STRUCT
40111}
40112
40113 static int send_packet_thaw_client_100(struct connection *pc)
40114{
40115 SEND_PACKET_START(PACKET_THAW_CLIENT);
40116
40117 log_packet_detailed("packet_thaw_client_100: sending info about ()");
40118 SEND_PACKET_END(PACKET_THAW_CLIENT);
40119}
40120
40121 int send_packet_thaw_client(struct connection *pc)
40122{
40123 if (!pc->used) {
40124 log_error("WARNING: trying to send data to the closed connection %s",
40125 conn_description(pc));
40126 return -1;
40127 }
40128 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_THAW_CLIENT].no_packet != nullptr, -1,
40129 "Handler for PACKET_THAW_CLIENT not installed");
40130 return pc->phs.handlers->send[PACKET_THAW_CLIENT].no_packet(pc);
40131}
40132
40133 void lsend_packet_thaw_client(struct conn_list *dest)
40134{
40135 conn_list_iterate(dest, pconn) {
40136 send_packet_thaw_client(pconn);
40137 } conn_list_iterate_end;
40138}
40139
40140 static inline void init_packet_spaceship_launch(struct packet_spaceship_launch *packet)
40141{
40142 memset(packet, 0, sizeof(*packet));
40143}
40144
40145#define free_packet_spaceship_launch(_packet) (void) 0
40146#define destroy_packet_spaceship_launch free
40147
40148 static struct packet_spaceship_launch *receive_packet_spaceship_launch_100(struct connection *pc)
40149{
40150#define FREE_PACKET_STRUCT(_packet) free_packet_spaceship_launch(_packet)
40151 RECEIVE_PACKET_START(packet_spaceship_launch, real_packet);
40152#if 1 /* To match endif */
40153 real_packet->__dummy = 0xff;
40154#endif
40155 log_packet_detailed("packet_spaceship_launch_100: got info about ()");
40156 RECEIVE_PACKET_END(real_packet);
40157#undef FREE_PACKET_STRUCT
40158}
40159
40160 static int send_packet_spaceship_launch_100(struct connection *pc)
40161{
40162 SEND_PACKET_START(PACKET_SPACESHIP_LAUNCH);
40163
40164 log_packet_detailed("packet_spaceship_launch_100: sending info about ()");
40165 SEND_PACKET_END(PACKET_SPACESHIP_LAUNCH);
40166}
40167
40168 int send_packet_spaceship_launch(struct connection *pc)
40169{
40170 if (!pc->used) {
40171 log_error("WARNING: trying to send data to the closed connection %s",
40172 conn_description(pc));
40173 return -1;
40174 }
40175 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_LAUNCH].no_packet != nullptr, -1,
40176 "Handler for PACKET_SPACESHIP_LAUNCH not installed");
40177 return pc->phs.handlers->send[PACKET_SPACESHIP_LAUNCH].no_packet(pc);
40178}
40179
40180 static inline void init_packet_spaceship_place(struct packet_spaceship_place *packet)
40181{
40182 memset(packet, 0, sizeof(*packet));
40183}
40184
40185#define free_packet_spaceship_place(_packet) (void) 0
40186#define destroy_packet_spaceship_place free
40187
40188#ifdef FREECIV_DELTA_PROTOCOL
40189#define hash_packet_spaceship_place_100 hash_const
40190
40191#define cmp_packet_spaceship_place_100 cmp_const
40192
40193 BV_DEFINE(packet_spaceship_place_100_fields, 2);
40194#endif /* FREECIV_DELTA_PROTOCOL */
40195
40196 static struct packet_spaceship_place *receive_packet_spaceship_place_100(struct connection *pc)
40197{
40198#define FREE_PACKET_STRUCT(_packet) free_packet_spaceship_place(_packet)
40199#ifdef FREECIV_DELTA_PROTOCOL
40200 packet_spaceship_place_100_fields fields;
40201 struct packet_spaceship_place *old;
40202 struct genhash **hash = pc->phs.received + PACKET_SPACESHIP_PLACE;
40203#endif /* FREECIV_DELTA_PROTOCOL */
40204 RECEIVE_PACKET_START(packet_spaceship_place, real_packet);
40205#ifdef FREECIV_JSON_CONNECTION
40206 struct plocation field_addr;
40207 {
40208 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
40209 field_addr = *field_addr_tmp;
40210 FC_FREE(field_addr_tmp);
40211 }
40212#endif /* FREECIV_JSON_CONNECTION */
40213
40214#ifdef FREECIV_DELTA_PROTOCOL
40215#ifdef FREECIV_JSON_CONNECTION
40216 field_addr.name = "fields";
40217#endif /* FREECIV_JSON_CONNECTION */
40218 DIO_BV_GET(&din, &field_addr, fields);
40219
40220#else /* FREECIV_DELTA_PROTOCOL */
40221#ifdef FREECIV_JSON_CONNECTION
40222 field_addr.name = "type";
40223#endif /* FREECIV_JSON_CONNECTION */
40224 {
40225 int readin;
40226
40227 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40228 RECEIVE_PACKET_FIELD_ERROR(type);
40229 }
40230 real_packet->type = readin;
40231 }
40232#ifdef FREECIV_JSON_CONNECTION
40233 field_addr.name = "num";
40234#endif /* FREECIV_JSON_CONNECTION */
40235 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num)) {
40236 RECEIVE_PACKET_FIELD_ERROR(num);
40237 }
40238#endif
40239 log_packet_detailed("packet_spaceship_place_100: got info about ()");
40240
40241#ifdef FREECIV_DELTA_PROTOCOL
40242 if (nullptr == *hash) {
40243 *hash = genhash_new_full(hash_packet_spaceship_place_100, cmp_packet_spaceship_place_100,
40244 nullptr, nullptr, nullptr, destroy_packet_spaceship_place);
40245 }
40246
40247 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
40248 *real_packet = *old;
40249 } else {
40250 /* packet is already initialized empty */
40251 log_packet_detailed(" no old info");
40252 }
40253
40254 if (BV_ISSET(fields, 0)) {
40255 log_packet_detailed(" got field 'type'");
40256#ifdef FREECIV_JSON_CONNECTION
40257 field_addr.name = "type";
40258#endif /* FREECIV_JSON_CONNECTION */
40259 {
40260 int readin;
40261
40262 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40263 RECEIVE_PACKET_FIELD_ERROR(type);
40264 }
40265 real_packet->type = readin;
40266 }
40267 }
40268 if (BV_ISSET(fields, 1)) {
40269 log_packet_detailed(" got field 'num'");
40270#ifdef FREECIV_JSON_CONNECTION
40271 field_addr.name = "num";
40272#endif /* FREECIV_JSON_CONNECTION */
40273 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num)) {
40274 RECEIVE_PACKET_FIELD_ERROR(num);
40275 }
40276 }
40277
40278 if (nullptr == old) {
40279 old = fc_malloc(sizeof(*old));
40280 init_packet_spaceship_place(old);
40281 *old = *real_packet;
40282 genhash_insert(*hash, old, old);
40283 } else {
40284 *old = *real_packet;
40285 }
40286
40287#endif /* FREECIV_DELTA_PROTOCOL */
40288 RECEIVE_PACKET_END(real_packet);
40289#undef FREE_PACKET_STRUCT
40290}
40291
40292 static int send_packet_spaceship_place_100(struct connection *pc, const struct packet_spaceship_place *packet)
40293{
40294 const struct packet_spaceship_place *real_packet = packet;
40295 int e;
40296#ifdef FREECIV_DELTA_PROTOCOL
40297 packet_spaceship_place_100_fields fields;
40298 struct packet_spaceship_place *old;
40299 bool differ;
40300 struct genhash **hash = pc->phs.sent + PACKET_SPACESHIP_PLACE;
40301#endif /* FREECIV_DELTA_PROTOCOL */
40302 SEND_PACKET_START(PACKET_SPACESHIP_PLACE);
40303#ifdef FREECIV_JSON_CONNECTION
40304 struct plocation field_addr;
40305 {
40306 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
40307 field_addr = *field_addr_tmp;
40308 FC_FREE(field_addr_tmp);
40309 }
40310#endif /* FREECIV_JSON_CONNECTION */
40311
40312 log_packet_detailed("packet_spaceship_place_100: sending info about ()");
40313
40314#ifdef FREECIV_DELTA_PROTOCOL
40315 if (nullptr == *hash) {
40316 *hash = genhash_new_full(hash_packet_spaceship_place_100, cmp_packet_spaceship_place_100,
40317 nullptr, nullptr, nullptr, destroy_packet_spaceship_place);
40318 }
40319 BV_CLR_ALL(fields);
40320
40321 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
40322 old = fc_malloc(sizeof(*old));
40323 /* temporary bitcopy just to insert correctly */
40324 *old = *real_packet;
40325 genhash_insert(*hash, old, old);
40326 init_packet_spaceship_place(old);
40327 }
40328 differ = (old->type != real_packet->type);
40329 if (differ) {
40330 BV_SET(fields, 0);
40331 }
40332
40333 differ = (old->num != real_packet->num);
40334 if (differ) {
40335 BV_SET(fields, 1);
40336 }
40337
40338
40339#ifdef FREECIV_JSON_CONNECTION
40340 field_addr.name = "fields";
40341#endif /* FREECIV_JSON_CONNECTION */
40342 e = 0;
40343 e |= DIO_BV_PUT(&dout, &field_addr, fields);
40344 if (e) {
40345 log_packet_detailed("fields bitvector error detected");
40346 }
40347
40348 if (BV_ISSET(fields, 0)) {
40349 log_packet_detailed(" field 'type' has changed");
40350#ifdef FREECIV_JSON_CONNECTION
40351 field_addr.name = "type";
40352#endif /* FREECIV_JSON_CONNECTION */
40353 e = 0;
40354 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
40355 if (e) {
40356 log_packet_detailed("'type' field error detected");
40357 }
40358 }
40359 if (BV_ISSET(fields, 1)) {
40360 log_packet_detailed(" field 'num' has changed");
40361#ifdef FREECIV_JSON_CONNECTION
40362 field_addr.name = "num";
40363#endif /* FREECIV_JSON_CONNECTION */
40364 e = 0;
40365 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num);
40366 if (e) {
40367 log_packet_detailed("'num' field error detected");
40368 }
40369 }
40370
40371 *old = *real_packet;
40372#endif /* FREECIV_DELTA_PROTOCOL */
40373#ifndef FREECIV_DELTA_PROTOCOL
40374#ifdef FREECIV_JSON_CONNECTION
40375 field_addr.name = "type";
40376#endif /* FREECIV_JSON_CONNECTION */
40377 e = 0;
40378 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
40379 if (e) {
40380 log_packet_detailed("'type' field error detected");
40381 }
40382#ifdef FREECIV_JSON_CONNECTION
40383 field_addr.name = "num";
40384#endif /* FREECIV_JSON_CONNECTION */
40385 e = 0;
40386 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num);
40387 if (e) {
40388 log_packet_detailed("'num' field error detected");
40389 }
40390
40391#endif
40392 SEND_PACKET_END(PACKET_SPACESHIP_PLACE);
40393}
40394
40395 int send_packet_spaceship_place(struct connection *pc, const struct packet_spaceship_place *packet)
40396{
40397 if (!pc->used) {
40398 log_error("WARNING: trying to send data to the closed connection %s",
40399 conn_description(pc));
40400 return -1;
40401 }
40402 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_PLACE].packet != nullptr, -1,
40403 "Handler for PACKET_SPACESHIP_PLACE not installed");
40404 return pc->phs.handlers->send[PACKET_SPACESHIP_PLACE].packet(pc, packet);
40405}
40406
40407 int dsend_packet_spaceship_place(struct connection *pc, enum spaceship_place_type type, int num)
40408{
40409 struct packet_spaceship_place packet, *real_packet = &packet;
40410
40411 real_packet->type = type;
40412 real_packet->num = num;
40413
40414 return send_packet_spaceship_place(pc, real_packet);
40415}
40416
40417 static inline void init_packet_spaceship_info(struct packet_spaceship_info *packet)
40418{
40419 memset(packet, 0, sizeof(*packet));
40420}
40421
40422#define free_packet_spaceship_info(_packet) (void) 0
40423#define destroy_packet_spaceship_info free
40424
40425#ifdef FREECIV_DELTA_PROTOCOL
40426static genhash_val_t hash_packet_spaceship_info_100(const void *vkey)
40427{
40428 const struct packet_spaceship_info *key = (const struct packet_spaceship_info *) vkey;
40429 genhash_val_t result = 0;
40430
40431 result += key->player_num;
40432
40433 result &= 0xFFFFFFFF;
40434 return result;
40435}
40436
40437static bool cmp_packet_spaceship_info_100(const void *vkey1, const void *vkey2)
40438{
40439 const struct packet_spaceship_info *old = (const struct packet_spaceship_info *) vkey1;
40440 const struct packet_spaceship_info *real_packet = (const struct packet_spaceship_info *) vkey2;
40441 bool differ;
40442
40443 differ = (old->player_num != real_packet->player_num);
40444
40445 return !differ;
40446}
40447 BV_DEFINE(packet_spaceship_info_100_fields, 17);
40448#endif /* FREECIV_DELTA_PROTOCOL */
40449
40450 static struct packet_spaceship_info *receive_packet_spaceship_info_100(struct connection *pc)
40451{
40452#define FREE_PACKET_STRUCT(_packet) free_packet_spaceship_info(_packet)
40453#ifdef FREECIV_DELTA_PROTOCOL
40454 packet_spaceship_info_100_fields fields;
40455 struct packet_spaceship_info *old;
40456 struct genhash **hash = pc->phs.received + PACKET_SPACESHIP_INFO;
40457#endif /* FREECIV_DELTA_PROTOCOL */
40458 RECEIVE_PACKET_START(packet_spaceship_info, real_packet);
40459#ifdef FREECIV_JSON_CONNECTION
40460 struct plocation field_addr;
40461 {
40462 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
40463 field_addr = *field_addr_tmp;
40464 FC_FREE(field_addr_tmp);
40465 }
40466#endif /* FREECIV_JSON_CONNECTION */
40467
40468#ifdef FREECIV_DELTA_PROTOCOL
40469#ifdef FREECIV_JSON_CONNECTION
40470 field_addr.name = "fields";
40471#endif /* FREECIV_JSON_CONNECTION */
40472 DIO_BV_GET(&din, &field_addr, fields);
40473#ifdef FREECIV_JSON_CONNECTION
40474 field_addr.name = "player_num";
40475#endif /* FREECIV_JSON_CONNECTION */
40476 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_num)) {
40477 RECEIVE_PACKET_FIELD_ERROR(player_num);
40478 }
40479
40480#else /* FREECIV_DELTA_PROTOCOL */
40481#ifdef FREECIV_JSON_CONNECTION
40482 field_addr.name = "player_num";
40483#endif /* FREECIV_JSON_CONNECTION */
40484 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player_num)) {
40485 RECEIVE_PACKET_FIELD_ERROR(player_num);
40486 }
40487#ifdef FREECIV_JSON_CONNECTION
40488 field_addr.name = "sship_state";
40489#endif /* FREECIV_JSON_CONNECTION */
40490 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sship_state)) {
40491 RECEIVE_PACKET_FIELD_ERROR(sship_state);
40492 }
40493#ifdef FREECIV_JSON_CONNECTION
40494 field_addr.name = "structurals";
40495#endif /* FREECIV_JSON_CONNECTION */
40496 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->structurals)) {
40497 RECEIVE_PACKET_FIELD_ERROR(structurals);
40498 }
40499#ifdef FREECIV_JSON_CONNECTION
40500 field_addr.name = "components";
40501#endif /* FREECIV_JSON_CONNECTION */
40502 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->components)) {
40503 RECEIVE_PACKET_FIELD_ERROR(components);
40504 }
40505#ifdef FREECIV_JSON_CONNECTION
40506 field_addr.name = "modules";
40507#endif /* FREECIV_JSON_CONNECTION */
40508 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->modules)) {
40509 RECEIVE_PACKET_FIELD_ERROR(modules);
40510 }
40511#ifdef FREECIV_JSON_CONNECTION
40512 field_addr.name = "fuel";
40513#endif /* FREECIV_JSON_CONNECTION */
40514 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
40515 RECEIVE_PACKET_FIELD_ERROR(fuel);
40516 }
40517#ifdef FREECIV_JSON_CONNECTION
40518 field_addr.name = "propulsion";
40519#endif /* FREECIV_JSON_CONNECTION */
40520 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->propulsion)) {
40521 RECEIVE_PACKET_FIELD_ERROR(propulsion);
40522 }
40523#ifdef FREECIV_JSON_CONNECTION
40524 field_addr.name = "habitation";
40525#endif /* FREECIV_JSON_CONNECTION */
40526 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->habitation)) {
40527 RECEIVE_PACKET_FIELD_ERROR(habitation);
40528 }
40529#ifdef FREECIV_JSON_CONNECTION
40530 field_addr.name = "life_support";
40531#endif /* FREECIV_JSON_CONNECTION */
40532 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->life_support)) {
40533 RECEIVE_PACKET_FIELD_ERROR(life_support);
40534 }
40535#ifdef FREECIV_JSON_CONNECTION
40536 field_addr.name = "solar_panels";
40537#endif /* FREECIV_JSON_CONNECTION */
40538 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->solar_panels)) {
40539 RECEIVE_PACKET_FIELD_ERROR(solar_panels);
40540 }
40541#ifdef FREECIV_JSON_CONNECTION
40542 field_addr.name = "launch_year";
40543#endif /* FREECIV_JSON_CONNECTION */
40544 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->launch_year)) {
40545 RECEIVE_PACKET_FIELD_ERROR(launch_year);
40546 }
40547#ifdef FREECIV_JSON_CONNECTION
40548 field_addr.name = "population";
40549#endif /* FREECIV_JSON_CONNECTION */
40550 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->population)) {
40551 RECEIVE_PACKET_FIELD_ERROR(population);
40552 }
40553#ifdef FREECIV_JSON_CONNECTION
40554 field_addr.name = "mass";
40555#endif /* FREECIV_JSON_CONNECTION */
40556 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->mass)) {
40557 RECEIVE_PACKET_FIELD_ERROR(mass);
40558 }
40559#ifdef FREECIV_JSON_CONNECTION
40560 field_addr.name = "structure";
40561#endif /* FREECIV_JSON_CONNECTION */
40562 if (!DIO_BV_GET(&din, &field_addr, real_packet->structure)) {
40563 RECEIVE_PACKET_FIELD_ERROR(structure);
40564 }
40565#ifdef FREECIV_JSON_CONNECTION
40566 field_addr.name = "support_rate";
40567#endif /* FREECIV_JSON_CONNECTION */
40568 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->support_rate, 10000)) {
40569 RECEIVE_PACKET_FIELD_ERROR(support_rate);
40570 }
40571#ifdef FREECIV_JSON_CONNECTION
40572 field_addr.name = "energy_rate";
40573#endif /* FREECIV_JSON_CONNECTION */
40574 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->energy_rate, 10000)) {
40575 RECEIVE_PACKET_FIELD_ERROR(energy_rate);
40576 }
40577#ifdef FREECIV_JSON_CONNECTION
40578 field_addr.name = "success_rate";
40579#endif /* FREECIV_JSON_CONNECTION */
40580 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->success_rate, 10000)) {
40581 RECEIVE_PACKET_FIELD_ERROR(success_rate);
40582 }
40583#ifdef FREECIV_JSON_CONNECTION
40584 field_addr.name = "travel_time";
40585#endif /* FREECIV_JSON_CONNECTION */
40586 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->travel_time, 10000)) {
40587 RECEIVE_PACKET_FIELD_ERROR(travel_time);
40588 }
40589#endif
40590 log_packet_detailed("packet_spaceship_info_100: got info about (%d)",
40591 real_packet->player_num);
40592
40593#ifdef FREECIV_DELTA_PROTOCOL
40594 if (nullptr == *hash) {
40595 *hash = genhash_new_full(hash_packet_spaceship_info_100, cmp_packet_spaceship_info_100,
40596 nullptr, nullptr, nullptr, destroy_packet_spaceship_info);
40597 }
40598
40599 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
40600 *real_packet = *old;
40601 } else {
40602 /* packet is already initialized empty */
40603 log_packet_detailed(" no old info");
40604 }
40605
40606 if (BV_ISSET(fields, 0)) {
40607 log_packet_detailed(" got field 'sship_state'");
40608#ifdef FREECIV_JSON_CONNECTION
40609 field_addr.name = "sship_state";
40610#endif /* FREECIV_JSON_CONNECTION */
40611 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sship_state)) {
40612 RECEIVE_PACKET_FIELD_ERROR(sship_state);
40613 }
40614 }
40615 if (BV_ISSET(fields, 1)) {
40616 log_packet_detailed(" got field 'structurals'");
40617#ifdef FREECIV_JSON_CONNECTION
40618 field_addr.name = "structurals";
40619#endif /* FREECIV_JSON_CONNECTION */
40620 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->structurals)) {
40621 RECEIVE_PACKET_FIELD_ERROR(structurals);
40622 }
40623 }
40624 if (BV_ISSET(fields, 2)) {
40625 log_packet_detailed(" got field 'components'");
40626#ifdef FREECIV_JSON_CONNECTION
40627 field_addr.name = "components";
40628#endif /* FREECIV_JSON_CONNECTION */
40629 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->components)) {
40630 RECEIVE_PACKET_FIELD_ERROR(components);
40631 }
40632 }
40633 if (BV_ISSET(fields, 3)) {
40634 log_packet_detailed(" got field 'modules'");
40635#ifdef FREECIV_JSON_CONNECTION
40636 field_addr.name = "modules";
40637#endif /* FREECIV_JSON_CONNECTION */
40638 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->modules)) {
40639 RECEIVE_PACKET_FIELD_ERROR(modules);
40640 }
40641 }
40642 if (BV_ISSET(fields, 4)) {
40643 log_packet_detailed(" got field 'fuel'");
40644#ifdef FREECIV_JSON_CONNECTION
40645 field_addr.name = "fuel";
40646#endif /* FREECIV_JSON_CONNECTION */
40647 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
40648 RECEIVE_PACKET_FIELD_ERROR(fuel);
40649 }
40650 }
40651 if (BV_ISSET(fields, 5)) {
40652 log_packet_detailed(" got field 'propulsion'");
40653#ifdef FREECIV_JSON_CONNECTION
40654 field_addr.name = "propulsion";
40655#endif /* FREECIV_JSON_CONNECTION */
40656 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->propulsion)) {
40657 RECEIVE_PACKET_FIELD_ERROR(propulsion);
40658 }
40659 }
40660 if (BV_ISSET(fields, 6)) {
40661 log_packet_detailed(" got field 'habitation'");
40662#ifdef FREECIV_JSON_CONNECTION
40663 field_addr.name = "habitation";
40664#endif /* FREECIV_JSON_CONNECTION */
40665 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->habitation)) {
40666 RECEIVE_PACKET_FIELD_ERROR(habitation);
40667 }
40668 }
40669 if (BV_ISSET(fields, 7)) {
40670 log_packet_detailed(" got field 'life_support'");
40671#ifdef FREECIV_JSON_CONNECTION
40672 field_addr.name = "life_support";
40673#endif /* FREECIV_JSON_CONNECTION */
40674 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->life_support)) {
40675 RECEIVE_PACKET_FIELD_ERROR(life_support);
40676 }
40677 }
40678 if (BV_ISSET(fields, 8)) {
40679 log_packet_detailed(" got field 'solar_panels'");
40680#ifdef FREECIV_JSON_CONNECTION
40681 field_addr.name = "solar_panels";
40682#endif /* FREECIV_JSON_CONNECTION */
40683 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->solar_panels)) {
40684 RECEIVE_PACKET_FIELD_ERROR(solar_panels);
40685 }
40686 }
40687 if (BV_ISSET(fields, 9)) {
40688 log_packet_detailed(" got field 'launch_year'");
40689#ifdef FREECIV_JSON_CONNECTION
40690 field_addr.name = "launch_year";
40691#endif /* FREECIV_JSON_CONNECTION */
40692 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->launch_year)) {
40693 RECEIVE_PACKET_FIELD_ERROR(launch_year);
40694 }
40695 }
40696 if (BV_ISSET(fields, 10)) {
40697 log_packet_detailed(" got field 'population'");
40698#ifdef FREECIV_JSON_CONNECTION
40699 field_addr.name = "population";
40700#endif /* FREECIV_JSON_CONNECTION */
40701 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->population)) {
40702 RECEIVE_PACKET_FIELD_ERROR(population);
40703 }
40704 }
40705 if (BV_ISSET(fields, 11)) {
40706 log_packet_detailed(" got field 'mass'");
40707#ifdef FREECIV_JSON_CONNECTION
40708 field_addr.name = "mass";
40709#endif /* FREECIV_JSON_CONNECTION */
40710 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->mass)) {
40711 RECEIVE_PACKET_FIELD_ERROR(mass);
40712 }
40713 }
40714 if (BV_ISSET(fields, 12)) {
40715 log_packet_detailed(" got field 'structure'");
40716#ifdef FREECIV_JSON_CONNECTION
40717 field_addr.name = "structure";
40718#endif /* FREECIV_JSON_CONNECTION */
40719 if (!DIO_BV_GET(&din, &field_addr, real_packet->structure)) {
40720 RECEIVE_PACKET_FIELD_ERROR(structure);
40721 }
40722 }
40723 if (BV_ISSET(fields, 13)) {
40724 log_packet_detailed(" got field 'support_rate'");
40725#ifdef FREECIV_JSON_CONNECTION
40726 field_addr.name = "support_rate";
40727#endif /* FREECIV_JSON_CONNECTION */
40728 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->support_rate, 10000)) {
40729 RECEIVE_PACKET_FIELD_ERROR(support_rate);
40730 }
40731 }
40732 if (BV_ISSET(fields, 14)) {
40733 log_packet_detailed(" got field 'energy_rate'");
40734#ifdef FREECIV_JSON_CONNECTION
40735 field_addr.name = "energy_rate";
40736#endif /* FREECIV_JSON_CONNECTION */
40737 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->energy_rate, 10000)) {
40738 RECEIVE_PACKET_FIELD_ERROR(energy_rate);
40739 }
40740 }
40741 if (BV_ISSET(fields, 15)) {
40742 log_packet_detailed(" got field 'success_rate'");
40743#ifdef FREECIV_JSON_CONNECTION
40744 field_addr.name = "success_rate";
40745#endif /* FREECIV_JSON_CONNECTION */
40746 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->success_rate, 10000)) {
40747 RECEIVE_PACKET_FIELD_ERROR(success_rate);
40748 }
40749 }
40750 if (BV_ISSET(fields, 16)) {
40751 log_packet_detailed(" got field 'travel_time'");
40752#ifdef FREECIV_JSON_CONNECTION
40753 field_addr.name = "travel_time";
40754#endif /* FREECIV_JSON_CONNECTION */
40755 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->travel_time, 10000)) {
40756 RECEIVE_PACKET_FIELD_ERROR(travel_time);
40757 }
40758 }
40759
40760 if (nullptr == old) {
40761 old = fc_malloc(sizeof(*old));
40762 init_packet_spaceship_info(old);
40763 *old = *real_packet;
40764 genhash_insert(*hash, old, old);
40765 } else {
40766 *old = *real_packet;
40767 }
40768
40769#endif /* FREECIV_DELTA_PROTOCOL */
40770 RECEIVE_PACKET_END(real_packet);
40771#undef FREE_PACKET_STRUCT
40772}
40773
40774 static int send_packet_spaceship_info_100(struct connection *pc, const struct packet_spaceship_info *packet)
40775{
40776 const struct packet_spaceship_info *real_packet = packet;
40777 int e;
40778#ifdef FREECIV_DELTA_PROTOCOL
40779 packet_spaceship_info_100_fields fields;
40780 struct packet_spaceship_info *old;
40781 bool differ;
40782 struct genhash **hash = pc->phs.sent + PACKET_SPACESHIP_INFO;
40783 int different = 0;
40784#endif /* FREECIV_DELTA_PROTOCOL */
40785 SEND_PACKET_START(PACKET_SPACESHIP_INFO);
40786#ifdef FREECIV_JSON_CONNECTION
40787 struct plocation field_addr;
40788 {
40789 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
40790 field_addr = *field_addr_tmp;
40791 FC_FREE(field_addr_tmp);
40792 }
40793#endif /* FREECIV_JSON_CONNECTION */
40794
40795 log_packet_detailed("packet_spaceship_info_100: sending info about (%d)",
40796 real_packet->player_num);
40797
40798#ifdef FREECIV_DELTA_PROTOCOL
40799 if (nullptr == *hash) {
40800 *hash = genhash_new_full(hash_packet_spaceship_info_100, cmp_packet_spaceship_info_100,
40801 nullptr, nullptr, nullptr, destroy_packet_spaceship_info);
40802 }
40803 BV_CLR_ALL(fields);
40804
40805 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
40806 old = fc_malloc(sizeof(*old));
40807 /* temporary bitcopy just to insert correctly */
40808 *old = *real_packet;
40809 genhash_insert(*hash, old, old);
40810 init_packet_spaceship_info(old);
40811 different = 1; /* Force to send. */
40812 }
40813 differ = (old->sship_state != real_packet->sship_state);
40814 if (differ) {
40815 different++;
40816 BV_SET(fields, 0);
40817 }
40818
40819 differ = (old->structurals != real_packet->structurals);
40820 if (differ) {
40821 different++;
40822 BV_SET(fields, 1);
40823 }
40824
40825 differ = (old->components != real_packet->components);
40826 if (differ) {
40827 different++;
40828 BV_SET(fields, 2);
40829 }
40830
40831 differ = (old->modules != real_packet->modules);
40832 if (differ) {
40833 different++;
40834 BV_SET(fields, 3);
40835 }
40836
40837 differ = (old->fuel != real_packet->fuel);
40838 if (differ) {
40839 different++;
40840 BV_SET(fields, 4);
40841 }
40842
40843 differ = (old->propulsion != real_packet->propulsion);
40844 if (differ) {
40845 different++;
40846 BV_SET(fields, 5);
40847 }
40848
40849 differ = (old->habitation != real_packet->habitation);
40850 if (differ) {
40851 different++;
40852 BV_SET(fields, 6);
40853 }
40854
40855 differ = (old->life_support != real_packet->life_support);
40856 if (differ) {
40857 different++;
40858 BV_SET(fields, 7);
40859 }
40860
40861 differ = (old->solar_panels != real_packet->solar_panels);
40862 if (differ) {
40863 different++;
40864 BV_SET(fields, 8);
40865 }
40866
40867 differ = (old->launch_year != real_packet->launch_year);
40868 if (differ) {
40869 different++;
40870 BV_SET(fields, 9);
40871 }
40872
40873 differ = (old->population != real_packet->population);
40874 if (differ) {
40875 different++;
40876 BV_SET(fields, 10);
40877 }
40878
40879 differ = (old->mass != real_packet->mass);
40880 if (differ) {
40881 different++;
40882 BV_SET(fields, 11);
40883 }
40884
40885 differ = !BV_ARE_EQUAL(old->structure, real_packet->structure);
40886 if (differ) {
40887 different++;
40888 BV_SET(fields, 12);
40889 }
40890
40891 differ = ((int) (old->support_rate * 10000) != (int) (real_packet->support_rate * 10000));
40892 if (differ) {
40893 different++;
40894 BV_SET(fields, 13);
40895 }
40896
40897 differ = ((int) (old->energy_rate * 10000) != (int) (real_packet->energy_rate * 10000));
40898 if (differ) {
40899 different++;
40900 BV_SET(fields, 14);
40901 }
40902
40903 differ = ((int) (old->success_rate * 10000) != (int) (real_packet->success_rate * 10000));
40904 if (differ) {
40905 different++;
40906 BV_SET(fields, 15);
40907 }
40908
40909 differ = ((int) (old->travel_time * 10000) != (int) (real_packet->travel_time * 10000));
40910 if (differ) {
40911 different++;
40912 BV_SET(fields, 16);
40913 }
40914
40915 if (different == 0) {
40916 log_packet_detailed(" no change -> discard");
40917 return 0;
40918 }
40919
40920#ifdef FREECIV_JSON_CONNECTION
40921 field_addr.name = "fields";
40922#endif /* FREECIV_JSON_CONNECTION */
40923 e = 0;
40924 e |= DIO_BV_PUT(&dout, &field_addr, fields);
40925 if (e) {
40926 log_packet_detailed("fields bitvector error detected");
40927 }
40928#ifdef FREECIV_JSON_CONNECTION
40929 field_addr.name = "player_num";
40930#endif /* FREECIV_JSON_CONNECTION */
40931 e = 0;
40932 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_num);
40933 if (e) {
40934 log_packet_detailed("'player_num' field error detected");
40935 }
40936
40937 if (BV_ISSET(fields, 0)) {
40938 log_packet_detailed(" field 'sship_state' has changed");
40939#ifdef FREECIV_JSON_CONNECTION
40940 field_addr.name = "sship_state";
40941#endif /* FREECIV_JSON_CONNECTION */
40942 e = 0;
40943 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sship_state);
40944 if (e) {
40945 log_packet_detailed("'sship_state' field error detected");
40946 }
40947 }
40948 if (BV_ISSET(fields, 1)) {
40949 log_packet_detailed(" field 'structurals' has changed");
40950#ifdef FREECIV_JSON_CONNECTION
40951 field_addr.name = "structurals";
40952#endif /* FREECIV_JSON_CONNECTION */
40953 e = 0;
40954 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->structurals);
40955 if (e) {
40956 log_packet_detailed("'structurals' field error detected");
40957 }
40958 }
40959 if (BV_ISSET(fields, 2)) {
40960 log_packet_detailed(" field 'components' has changed");
40961#ifdef FREECIV_JSON_CONNECTION
40962 field_addr.name = "components";
40963#endif /* FREECIV_JSON_CONNECTION */
40964 e = 0;
40965 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->components);
40966 if (e) {
40967 log_packet_detailed("'components' field error detected");
40968 }
40969 }
40970 if (BV_ISSET(fields, 3)) {
40971 log_packet_detailed(" field 'modules' has changed");
40972#ifdef FREECIV_JSON_CONNECTION
40973 field_addr.name = "modules";
40974#endif /* FREECIV_JSON_CONNECTION */
40975 e = 0;
40976 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->modules);
40977 if (e) {
40978 log_packet_detailed("'modules' field error detected");
40979 }
40980 }
40981 if (BV_ISSET(fields, 4)) {
40982 log_packet_detailed(" field 'fuel' has changed");
40983#ifdef FREECIV_JSON_CONNECTION
40984 field_addr.name = "fuel";
40985#endif /* FREECIV_JSON_CONNECTION */
40986 e = 0;
40987 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
40988 if (e) {
40989 log_packet_detailed("'fuel' field error detected");
40990 }
40991 }
40992 if (BV_ISSET(fields, 5)) {
40993 log_packet_detailed(" field 'propulsion' has changed");
40994#ifdef FREECIV_JSON_CONNECTION
40995 field_addr.name = "propulsion";
40996#endif /* FREECIV_JSON_CONNECTION */
40997 e = 0;
40998 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->propulsion);
40999 if (e) {
41000 log_packet_detailed("'propulsion' field error detected");
41001 }
41002 }
41003 if (BV_ISSET(fields, 6)) {
41004 log_packet_detailed(" field 'habitation' has changed");
41005#ifdef FREECIV_JSON_CONNECTION
41006 field_addr.name = "habitation";
41007#endif /* FREECIV_JSON_CONNECTION */
41008 e = 0;
41009 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->habitation);
41010 if (e) {
41011 log_packet_detailed("'habitation' field error detected");
41012 }
41013 }
41014 if (BV_ISSET(fields, 7)) {
41015 log_packet_detailed(" field 'life_support' has changed");
41016#ifdef FREECIV_JSON_CONNECTION
41017 field_addr.name = "life_support";
41018#endif /* FREECIV_JSON_CONNECTION */
41019 e = 0;
41020 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->life_support);
41021 if (e) {
41022 log_packet_detailed("'life_support' field error detected");
41023 }
41024 }
41025 if (BV_ISSET(fields, 8)) {
41026 log_packet_detailed(" field 'solar_panels' has changed");
41027#ifdef FREECIV_JSON_CONNECTION
41028 field_addr.name = "solar_panels";
41029#endif /* FREECIV_JSON_CONNECTION */
41030 e = 0;
41031 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->solar_panels);
41032 if (e) {
41033 log_packet_detailed("'solar_panels' field error detected");
41034 }
41035 }
41036 if (BV_ISSET(fields, 9)) {
41037 log_packet_detailed(" field 'launch_year' has changed");
41038#ifdef FREECIV_JSON_CONNECTION
41039 field_addr.name = "launch_year";
41040#endif /* FREECIV_JSON_CONNECTION */
41041 e = 0;
41042 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->launch_year);
41043 if (e) {
41044 log_packet_detailed("'launch_year' field error detected");
41045 }
41046 }
41047 if (BV_ISSET(fields, 10)) {
41048 log_packet_detailed(" field 'population' has changed");
41049#ifdef FREECIV_JSON_CONNECTION
41050 field_addr.name = "population";
41051#endif /* FREECIV_JSON_CONNECTION */
41052 e = 0;
41053 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->population);
41054 if (e) {
41055 log_packet_detailed("'population' field error detected");
41056 }
41057 }
41058 if (BV_ISSET(fields, 11)) {
41059 log_packet_detailed(" field 'mass' has changed");
41060#ifdef FREECIV_JSON_CONNECTION
41061 field_addr.name = "mass";
41062#endif /* FREECIV_JSON_CONNECTION */
41063 e = 0;
41064 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->mass);
41065 if (e) {
41066 log_packet_detailed("'mass' field error detected");
41067 }
41068 }
41069 if (BV_ISSET(fields, 12)) {
41070 log_packet_detailed(" field 'structure' has changed");
41071#ifdef FREECIV_JSON_CONNECTION
41072 field_addr.name = "structure";
41073#endif /* FREECIV_JSON_CONNECTION */
41074 e = 0;
41075 e |= DIO_BV_PUT(&dout, &field_addr, packet->structure);
41076 if (e) {
41077 log_packet_detailed("'structure' field error detected");
41078 }
41079 }
41080 if (BV_ISSET(fields, 13)) {
41081 log_packet_detailed(" field 'support_rate' has changed");
41082#ifdef FREECIV_JSON_CONNECTION
41083 field_addr.name = "support_rate";
41084#endif /* FREECIV_JSON_CONNECTION */
41085 e = 0;
41086 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->support_rate, 10000);
41087 if (e) {
41088 log_packet_detailed("'support_rate' field error detected");
41089 }
41090 }
41091 if (BV_ISSET(fields, 14)) {
41092 log_packet_detailed(" field 'energy_rate' has changed");
41093#ifdef FREECIV_JSON_CONNECTION
41094 field_addr.name = "energy_rate";
41095#endif /* FREECIV_JSON_CONNECTION */
41096 e = 0;
41097 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->energy_rate, 10000);
41098 if (e) {
41099 log_packet_detailed("'energy_rate' field error detected");
41100 }
41101 }
41102 if (BV_ISSET(fields, 15)) {
41103 log_packet_detailed(" field 'success_rate' has changed");
41104#ifdef FREECIV_JSON_CONNECTION
41105 field_addr.name = "success_rate";
41106#endif /* FREECIV_JSON_CONNECTION */
41107 e = 0;
41108 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->success_rate, 10000);
41109 if (e) {
41110 log_packet_detailed("'success_rate' field error detected");
41111 }
41112 }
41113 if (BV_ISSET(fields, 16)) {
41114 log_packet_detailed(" field 'travel_time' has changed");
41115#ifdef FREECIV_JSON_CONNECTION
41116 field_addr.name = "travel_time";
41117#endif /* FREECIV_JSON_CONNECTION */
41118 e = 0;
41119 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->travel_time, 10000);
41120 if (e) {
41121 log_packet_detailed("'travel_time' field error detected");
41122 }
41123 }
41124
41125 *old = *real_packet;
41126#endif /* FREECIV_DELTA_PROTOCOL */
41127#ifndef FREECIV_DELTA_PROTOCOL
41128#ifdef FREECIV_JSON_CONNECTION
41129 field_addr.name = "player_num";
41130#endif /* FREECIV_JSON_CONNECTION */
41131 e = 0;
41132 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player_num);
41133 if (e) {
41134 log_packet_detailed("'player_num' field error detected");
41135 }
41136#ifdef FREECIV_JSON_CONNECTION
41137 field_addr.name = "sship_state";
41138#endif /* FREECIV_JSON_CONNECTION */
41139 e = 0;
41140 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sship_state);
41141 if (e) {
41142 log_packet_detailed("'sship_state' field error detected");
41143 }
41144#ifdef FREECIV_JSON_CONNECTION
41145 field_addr.name = "structurals";
41146#endif /* FREECIV_JSON_CONNECTION */
41147 e = 0;
41148 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->structurals);
41149 if (e) {
41150 log_packet_detailed("'structurals' field error detected");
41151 }
41152#ifdef FREECIV_JSON_CONNECTION
41153 field_addr.name = "components";
41154#endif /* FREECIV_JSON_CONNECTION */
41155 e = 0;
41156 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->components);
41157 if (e) {
41158 log_packet_detailed("'components' field error detected");
41159 }
41160#ifdef FREECIV_JSON_CONNECTION
41161 field_addr.name = "modules";
41162#endif /* FREECIV_JSON_CONNECTION */
41163 e = 0;
41164 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->modules);
41165 if (e) {
41166 log_packet_detailed("'modules' field error detected");
41167 }
41168#ifdef FREECIV_JSON_CONNECTION
41169 field_addr.name = "fuel";
41170#endif /* FREECIV_JSON_CONNECTION */
41171 e = 0;
41172 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
41173 if (e) {
41174 log_packet_detailed("'fuel' field error detected");
41175 }
41176#ifdef FREECIV_JSON_CONNECTION
41177 field_addr.name = "propulsion";
41178#endif /* FREECIV_JSON_CONNECTION */
41179 e = 0;
41180 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->propulsion);
41181 if (e) {
41182 log_packet_detailed("'propulsion' field error detected");
41183 }
41184#ifdef FREECIV_JSON_CONNECTION
41185 field_addr.name = "habitation";
41186#endif /* FREECIV_JSON_CONNECTION */
41187 e = 0;
41188 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->habitation);
41189 if (e) {
41190 log_packet_detailed("'habitation' field error detected");
41191 }
41192#ifdef FREECIV_JSON_CONNECTION
41193 field_addr.name = "life_support";
41194#endif /* FREECIV_JSON_CONNECTION */
41195 e = 0;
41196 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->life_support);
41197 if (e) {
41198 log_packet_detailed("'life_support' field error detected");
41199 }
41200#ifdef FREECIV_JSON_CONNECTION
41201 field_addr.name = "solar_panels";
41202#endif /* FREECIV_JSON_CONNECTION */
41203 e = 0;
41204 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->solar_panels);
41205 if (e) {
41206 log_packet_detailed("'solar_panels' field error detected");
41207 }
41208#ifdef FREECIV_JSON_CONNECTION
41209 field_addr.name = "launch_year";
41210#endif /* FREECIV_JSON_CONNECTION */
41211 e = 0;
41212 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->launch_year);
41213 if (e) {
41214 log_packet_detailed("'launch_year' field error detected");
41215 }
41216#ifdef FREECIV_JSON_CONNECTION
41217 field_addr.name = "population";
41218#endif /* FREECIV_JSON_CONNECTION */
41219 e = 0;
41220 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->population);
41221 if (e) {
41222 log_packet_detailed("'population' field error detected");
41223 }
41224#ifdef FREECIV_JSON_CONNECTION
41225 field_addr.name = "mass";
41226#endif /* FREECIV_JSON_CONNECTION */
41227 e = 0;
41228 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->mass);
41229 if (e) {
41230 log_packet_detailed("'mass' field error detected");
41231 }
41232#ifdef FREECIV_JSON_CONNECTION
41233 field_addr.name = "structure";
41234#endif /* FREECIV_JSON_CONNECTION */
41235 e = 0;
41236 e |= DIO_BV_PUT(&dout, &field_addr, packet->structure);
41237 if (e) {
41238 log_packet_detailed("'structure' field error detected");
41239 }
41240#ifdef FREECIV_JSON_CONNECTION
41241 field_addr.name = "support_rate";
41242#endif /* FREECIV_JSON_CONNECTION */
41243 e = 0;
41244 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->support_rate, 10000);
41245 if (e) {
41246 log_packet_detailed("'support_rate' field error detected");
41247 }
41248#ifdef FREECIV_JSON_CONNECTION
41249 field_addr.name = "energy_rate";
41250#endif /* FREECIV_JSON_CONNECTION */
41251 e = 0;
41252 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->energy_rate, 10000);
41253 if (e) {
41254 log_packet_detailed("'energy_rate' field error detected");
41255 }
41256#ifdef FREECIV_JSON_CONNECTION
41257 field_addr.name = "success_rate";
41258#endif /* FREECIV_JSON_CONNECTION */
41259 e = 0;
41260 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->success_rate, 10000);
41261 if (e) {
41262 log_packet_detailed("'success_rate' field error detected");
41263 }
41264#ifdef FREECIV_JSON_CONNECTION
41265 field_addr.name = "travel_time";
41266#endif /* FREECIV_JSON_CONNECTION */
41267 e = 0;
41268 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->travel_time, 10000);
41269 if (e) {
41270 log_packet_detailed("'travel_time' field error detected");
41271 }
41272
41273#endif
41274 SEND_PACKET_END(PACKET_SPACESHIP_INFO);
41275}
41276
41277 int send_packet_spaceship_info(struct connection *pc, const struct packet_spaceship_info *packet)
41278{
41279 if (!pc->used) {
41280 log_error("WARNING: trying to send data to the closed connection %s",
41281 conn_description(pc));
41282 return -1;
41283 }
41284 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_INFO].packet != nullptr, -1,
41285 "Handler for PACKET_SPACESHIP_INFO not installed");
41286 return pc->phs.handlers->send[PACKET_SPACESHIP_INFO].packet(pc, packet);
41287}
41288
41289 void lsend_packet_spaceship_info(struct conn_list *dest, const struct packet_spaceship_info *packet)
41290{
41291 conn_list_iterate(dest, pconn) {
41292 send_packet_spaceship_info(pconn, packet);
41293 } conn_list_iterate_end;
41294}
41295
41296 static inline void init_packet_ruleset_unit(struct packet_ruleset_unit *packet)
41297{
41298 memset(packet, 0, sizeof(*packet));
41299
41300 /* no work needed for packet->id */
41301 /* no work needed for packet->name */
41302 /* no work needed for packet->rule_name */
41303 /* no work needed for packet->graphic_str */
41304 /* no work needed for packet->graphic_alt */
41305 /* no work needed for packet->graphic_alt2 */
41306 /* no work needed for packet->sound_move */
41307 /* no work needed for packet->sound_move_alt */
41308 /* no work needed for packet->sound_fight */
41309 /* no work needed for packet->sound_fight_alt */
41310 /* no work needed for packet->unit_class_id */
41311 /* no work needed for packet->build_cost */
41312 /* no work needed for packet->pop_cost */
41313 /* no work needed for packet->attack_strength */
41314 /* no work needed for packet->defense_strength */
41315 /* no work needed for packet->move_rate */
41316 /* no work needed for packet->build_reqs_count */
41317 /* no work needed for packet->build_reqs */
41318 /* no work needed for packet->vision_radius_sq */
41319 /* no work needed for packet->transport_capacity */
41320 /* no work needed for packet->hp */
41321 /* no work needed for packet->firepower */
41322 /* no work needed for packet->obsoleted_by */
41323 /* no work needed for packet->converted_to */
41324 /* no work needed for packet->convert_time */
41325 /* no work needed for packet->fuel */
41326 /* no work needed for packet->happy_cost */
41327 /* no work needed for packet->upkeep */
41328 /* no work needed for packet->paratroopers_range */
41329 /* no work needed for packet->veteran_levels */
41330 /* no work needed for packet->veteran_name */
41331 /* no work needed for packet->power_fact */
41332 /* no work needed for packet->move_bonus */
41333 /* no work needed for packet->base_raise_chance */
41334 /* no work needed for packet->work_raise_chance */
41335 /* no work needed for packet->bombard_rate */
41336 /* no work needed for packet->city_size */
41337 /* no work needed for packet->city_slots */
41338 /* no work needed for packet->tp_defense */
41339 /* no work needed for packet->cargo */
41340 /* no work needed for packet->targets */
41341 /* no work needed for packet->embarks */
41342 /* no work needed for packet->disembarks */
41343 /* no work needed for packet->vlayer */
41344 packet->helptext = strvec_new();
41345 /* no work needed for packet->flags */
41346 /* no work needed for packet->roles */
41347 /* no work needed for packet->worker */
41348}
41349
41350 static inline void free_packet_ruleset_unit(struct packet_ruleset_unit *packet)
41351{
41352 /* no work needed for packet->worker */
41353 /* no work needed for packet->roles */
41354 /* no work needed for packet->flags */
41355 if (packet->helptext) {
41356 strvec_destroy(packet->helptext);
41357 packet->helptext = nullptr;
41358 }
41359 /* no work needed for packet->vlayer */
41360 /* no work needed for packet->disembarks */
41361 /* no work needed for packet->embarks */
41362 /* no work needed for packet->targets */
41363 /* no work needed for packet->cargo */
41364 /* no work needed for packet->tp_defense */
41365 /* no work needed for packet->city_slots */
41366 /* no work needed for packet->city_size */
41367 /* no work needed for packet->bombard_rate */
41368 /* no work needed for packet->work_raise_chance */
41369 /* no work needed for packet->base_raise_chance */
41370 /* no work needed for packet->move_bonus */
41371 /* no work needed for packet->power_fact */
41372 /* no work needed for packet->veteran_name */
41373 /* no work needed for packet->veteran_levels */
41374 /* no work needed for packet->paratroopers_range */
41375 /* no work needed for packet->upkeep */
41376 /* no work needed for packet->happy_cost */
41377 /* no work needed for packet->fuel */
41378 /* no work needed for packet->convert_time */
41379 /* no work needed for packet->converted_to */
41380 /* no work needed for packet->obsoleted_by */
41381 /* no work needed for packet->firepower */
41382 /* no work needed for packet->hp */
41383 /* no work needed for packet->transport_capacity */
41384 /* no work needed for packet->vision_radius_sq */
41385 /* no work needed for packet->build_reqs */
41386 /* no work needed for packet->build_reqs_count */
41387 /* no work needed for packet->move_rate */
41388 /* no work needed for packet->defense_strength */
41389 /* no work needed for packet->attack_strength */
41390 /* no work needed for packet->pop_cost */
41391 /* no work needed for packet->build_cost */
41392 /* no work needed for packet->unit_class_id */
41393 /* no work needed for packet->sound_fight_alt */
41394 /* no work needed for packet->sound_fight */
41395 /* no work needed for packet->sound_move_alt */
41396 /* no work needed for packet->sound_move */
41397 /* no work needed for packet->graphic_alt2 */
41398 /* no work needed for packet->graphic_alt */
41399 /* no work needed for packet->graphic_str */
41400 /* no work needed for packet->rule_name */
41401 /* no work needed for packet->name */
41402 /* no work needed for packet->id */
41403}
41404
41405 static inline void destroy_packet_ruleset_unit(void *packet)
41406{
41407 free_packet_ruleset_unit((struct packet_ruleset_unit *) packet);
41408 free(packet);
41409}
41410
41411#ifdef FREECIV_DELTA_PROTOCOL
41412#define hash_packet_ruleset_unit_100 hash_const
41413
41414#define cmp_packet_ruleset_unit_100 cmp_const
41415
41416 BV_DEFINE(packet_ruleset_unit_100_fields, 48);
41417#endif /* FREECIV_DELTA_PROTOCOL */
41418
41419 static struct packet_ruleset_unit *receive_packet_ruleset_unit_100(struct connection *pc)
41420{
41421#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_unit(_packet)
41422#ifdef FREECIV_DELTA_PROTOCOL
41423 packet_ruleset_unit_100_fields fields;
41424 struct packet_ruleset_unit *old;
41425 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT;
41426#endif /* FREECIV_DELTA_PROTOCOL */
41427 RECEIVE_PACKET_START(packet_ruleset_unit, real_packet);
41428#ifdef FREECIV_JSON_CONNECTION
41429 struct plocation field_addr;
41430 {
41431 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
41432 field_addr = *field_addr_tmp;
41433 FC_FREE(field_addr_tmp);
41434 }
41435#endif /* FREECIV_JSON_CONNECTION */
41436
41437#ifdef FREECIV_DELTA_PROTOCOL
41438#ifdef FREECIV_JSON_CONNECTION
41439 field_addr.name = "fields";
41440#endif /* FREECIV_JSON_CONNECTION */
41441 DIO_BV_GET(&din, &field_addr, fields);
41442
41443#else /* FREECIV_DELTA_PROTOCOL */
41444#ifdef FREECIV_JSON_CONNECTION
41445 field_addr.name = "id";
41446#endif /* FREECIV_JSON_CONNECTION */
41447 {
41448 int readin;
41449
41450 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
41451 RECEIVE_PACKET_FIELD_ERROR(id);
41452 }
41453 real_packet->id = readin;
41454 }
41455#ifdef FREECIV_JSON_CONNECTION
41456 field_addr.name = "name";
41457#endif /* FREECIV_JSON_CONNECTION */
41458 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
41459 RECEIVE_PACKET_FIELD_ERROR(name);
41460 }
41461#ifdef FREECIV_JSON_CONNECTION
41462 field_addr.name = "rule_name";
41463#endif /* FREECIV_JSON_CONNECTION */
41464 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
41465 RECEIVE_PACKET_FIELD_ERROR(rule_name);
41466 }
41467#ifdef FREECIV_JSON_CONNECTION
41468 field_addr.name = "graphic_str";
41469#endif /* FREECIV_JSON_CONNECTION */
41470 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
41471 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
41472 }
41473#ifdef FREECIV_JSON_CONNECTION
41474 field_addr.name = "graphic_alt";
41475#endif /* FREECIV_JSON_CONNECTION */
41476 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
41477 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
41478 }
41479#ifdef FREECIV_JSON_CONNECTION
41480 field_addr.name = "graphic_alt2";
41481#endif /* FREECIV_JSON_CONNECTION */
41482 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
41483 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
41484 }
41485#ifdef FREECIV_JSON_CONNECTION
41486 field_addr.name = "sound_move";
41487#endif /* FREECIV_JSON_CONNECTION */
41488 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move, sizeof(real_packet->sound_move))) {
41489 RECEIVE_PACKET_FIELD_ERROR(sound_move);
41490 }
41491#ifdef FREECIV_JSON_CONNECTION
41492 field_addr.name = "sound_move_alt";
41493#endif /* FREECIV_JSON_CONNECTION */
41494 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move_alt, sizeof(real_packet->sound_move_alt))) {
41495 RECEIVE_PACKET_FIELD_ERROR(sound_move_alt);
41496 }
41497#ifdef FREECIV_JSON_CONNECTION
41498 field_addr.name = "sound_fight";
41499#endif /* FREECIV_JSON_CONNECTION */
41500 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight, sizeof(real_packet->sound_fight))) {
41501 RECEIVE_PACKET_FIELD_ERROR(sound_fight);
41502 }
41503#ifdef FREECIV_JSON_CONNECTION
41504 field_addr.name = "sound_fight_alt";
41505#endif /* FREECIV_JSON_CONNECTION */
41506 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight_alt, sizeof(real_packet->sound_fight_alt))) {
41507 RECEIVE_PACKET_FIELD_ERROR(sound_fight_alt);
41508 }
41509#ifdef FREECIV_JSON_CONNECTION
41510 field_addr.name = "unit_class_id";
41511#endif /* FREECIV_JSON_CONNECTION */
41512 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->unit_class_id)) {
41513 RECEIVE_PACKET_FIELD_ERROR(unit_class_id);
41514 }
41515#ifdef FREECIV_JSON_CONNECTION
41516 field_addr.name = "build_cost";
41517#endif /* FREECIV_JSON_CONNECTION */
41518 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
41519 RECEIVE_PACKET_FIELD_ERROR(build_cost);
41520 }
41521#ifdef FREECIV_JSON_CONNECTION
41522 field_addr.name = "pop_cost";
41523#endif /* FREECIV_JSON_CONNECTION */
41524 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_cost)) {
41525 RECEIVE_PACKET_FIELD_ERROR(pop_cost);
41526 }
41527#ifdef FREECIV_JSON_CONNECTION
41528 field_addr.name = "attack_strength";
41529#endif /* FREECIV_JSON_CONNECTION */
41530 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attack_strength)) {
41531 RECEIVE_PACKET_FIELD_ERROR(attack_strength);
41532 }
41533#ifdef FREECIV_JSON_CONNECTION
41534 field_addr.name = "defense_strength";
41535#endif /* FREECIV_JSON_CONNECTION */
41536 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_strength)) {
41537 RECEIVE_PACKET_FIELD_ERROR(defense_strength);
41538 }
41539#ifdef FREECIV_JSON_CONNECTION
41540 field_addr.name = "move_rate";
41541#endif /* FREECIV_JSON_CONNECTION */
41542 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_rate)) {
41543 RECEIVE_PACKET_FIELD_ERROR(move_rate);
41544 }
41545#ifdef FREECIV_JSON_CONNECTION
41546 field_addr.name = "build_reqs_count";
41547#endif /* FREECIV_JSON_CONNECTION */
41548 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_reqs_count)) {
41549 RECEIVE_PACKET_FIELD_ERROR(build_reqs_count);
41550 }
41551#ifdef FREECIV_JSON_CONNECTION
41552 field_addr.name = "build_reqs";
41553#endif /* FREECIV_JSON_CONNECTION */
41554 {
41555 int i;
41556
41557#ifdef FREECIV_JSON_CONNECTION
41558 /* Enter array. */
41559 field_addr.sub_location = plocation_elem_new(0);
41560#endif /* FREECIV_JSON_CONNECTION */
41561
41562 if (real_packet->build_reqs_count > MAX_NUM_REQS) {
41563 RECEIVE_PACKET_FIELD_ERROR(build_reqs, ": truncation array");
41564 }
41565 for (i = 0; i < real_packet->build_reqs_count; i++) {
41566#ifdef FREECIV_JSON_CONNECTION
41567 field_addr.sub_location->number = i;
41568#endif /* FREECIV_JSON_CONNECTION */
41569 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->build_reqs[i])) {
41570 RECEIVE_PACKET_FIELD_ERROR(build_reqs);
41571 }
41572 }
41573
41574#ifdef FREECIV_JSON_CONNECTION
41575 /* Exit array. */
41576 FC_FREE(field_addr.sub_location);
41577#endif /* FREECIV_JSON_CONNECTION */
41578 }
41579#ifdef FREECIV_JSON_CONNECTION
41580 field_addr.name = "vision_radius_sq";
41581#endif /* FREECIV_JSON_CONNECTION */
41582 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->vision_radius_sq)) {
41583 RECEIVE_PACKET_FIELD_ERROR(vision_radius_sq);
41584 }
41585#ifdef FREECIV_JSON_CONNECTION
41586 field_addr.name = "transport_capacity";
41587#endif /* FREECIV_JSON_CONNECTION */
41588 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transport_capacity)) {
41589 RECEIVE_PACKET_FIELD_ERROR(transport_capacity);
41590 }
41591#ifdef FREECIV_JSON_CONNECTION
41592 field_addr.name = "hp";
41593#endif /* FREECIV_JSON_CONNECTION */
41594 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
41595 RECEIVE_PACKET_FIELD_ERROR(hp);
41596 }
41597#ifdef FREECIV_JSON_CONNECTION
41598 field_addr.name = "firepower";
41599#endif /* FREECIV_JSON_CONNECTION */
41600 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->firepower)) {
41601 RECEIVE_PACKET_FIELD_ERROR(firepower);
41602 }
41603#ifdef FREECIV_JSON_CONNECTION
41604 field_addr.name = "obsoleted_by";
41605#endif /* FREECIV_JSON_CONNECTION */
41606 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obsoleted_by)) {
41607 RECEIVE_PACKET_FIELD_ERROR(obsoleted_by);
41608 }
41609#ifdef FREECIV_JSON_CONNECTION
41610 field_addr.name = "converted_to";
41611#endif /* FREECIV_JSON_CONNECTION */
41612 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->converted_to)) {
41613 RECEIVE_PACKET_FIELD_ERROR(converted_to);
41614 }
41615#ifdef FREECIV_JSON_CONNECTION
41616 field_addr.name = "convert_time";
41617#endif /* FREECIV_JSON_CONNECTION */
41618 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->convert_time)) {
41619 RECEIVE_PACKET_FIELD_ERROR(convert_time);
41620 }
41621#ifdef FREECIV_JSON_CONNECTION
41622 field_addr.name = "fuel";
41623#endif /* FREECIV_JSON_CONNECTION */
41624 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
41625 RECEIVE_PACKET_FIELD_ERROR(fuel);
41626 }
41627#ifdef FREECIV_JSON_CONNECTION
41628 field_addr.name = "happy_cost";
41629#endif /* FREECIV_JSON_CONNECTION */
41630 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->happy_cost)) {
41631 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
41632 }
41633#ifdef FREECIV_JSON_CONNECTION
41634 field_addr.name = "upkeep";
41635#endif /* FREECIV_JSON_CONNECTION */
41636 {
41637 int i;
41638
41639#ifdef FREECIV_JSON_CONNECTION
41640 /* Enter array. */
41641 field_addr.sub_location = plocation_elem_new(0);
41642#endif /* FREECIV_JSON_CONNECTION */
41643
41644 for (i = 0; i < O_LAST; i++) {
41645#ifdef FREECIV_JSON_CONNECTION
41646 field_addr.sub_location->number = i;
41647#endif /* FREECIV_JSON_CONNECTION */
41648 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
41649 RECEIVE_PACKET_FIELD_ERROR(upkeep);
41650 }
41651 }
41652
41653#ifdef FREECIV_JSON_CONNECTION
41654 /* Exit array. */
41655 FC_FREE(field_addr.sub_location);
41656#endif /* FREECIV_JSON_CONNECTION */
41657 }
41658#ifdef FREECIV_JSON_CONNECTION
41659 field_addr.name = "paratroopers_range";
41660#endif /* FREECIV_JSON_CONNECTION */
41661 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->paratroopers_range)) {
41662 RECEIVE_PACKET_FIELD_ERROR(paratroopers_range);
41663 }
41664#ifdef FREECIV_JSON_CONNECTION
41665 field_addr.name = "veteran_levels";
41666#endif /* FREECIV_JSON_CONNECTION */
41667 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
41668 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
41669 }
41670#ifdef FREECIV_JSON_CONNECTION
41671 field_addr.name = "veteran_name";
41672#endif /* FREECIV_JSON_CONNECTION */
41673 {
41674 int i;
41675
41676#ifdef FREECIV_JSON_CONNECTION
41677 /* Enter array. */
41678 field_addr.sub_location = plocation_elem_new(0);
41679#endif /* FREECIV_JSON_CONNECTION */
41680
41681 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
41682 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
41683 }
41684 for (i = 0; i < real_packet->veteran_levels; i++) {
41685#ifdef FREECIV_JSON_CONNECTION
41686 field_addr.sub_location->number = i;
41687#endif /* FREECIV_JSON_CONNECTION */
41688 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
41689 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
41690 }
41691 }
41692
41693#ifdef FREECIV_JSON_CONNECTION
41694 /* Exit array. */
41695 FC_FREE(field_addr.sub_location);
41696#endif /* FREECIV_JSON_CONNECTION */
41697 }
41698#ifdef FREECIV_JSON_CONNECTION
41699 field_addr.name = "power_fact";
41700#endif /* FREECIV_JSON_CONNECTION */
41701 {
41702 int i;
41703
41704#ifdef FREECIV_JSON_CONNECTION
41705 /* Enter array. */
41706 field_addr.sub_location = plocation_elem_new(0);
41707#endif /* FREECIV_JSON_CONNECTION */
41708
41709 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
41710 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
41711 }
41712 for (i = 0; i < real_packet->veteran_levels; i++) {
41713#ifdef FREECIV_JSON_CONNECTION
41714 field_addr.sub_location->number = i;
41715#endif /* FREECIV_JSON_CONNECTION */
41716 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
41717 RECEIVE_PACKET_FIELD_ERROR(power_fact);
41718 }
41719 }
41720
41721#ifdef FREECIV_JSON_CONNECTION
41722 /* Exit array. */
41723 FC_FREE(field_addr.sub_location);
41724#endif /* FREECIV_JSON_CONNECTION */
41725 }
41726#ifdef FREECIV_JSON_CONNECTION
41727 field_addr.name = "move_bonus";
41728#endif /* FREECIV_JSON_CONNECTION */
41729 {
41730 int i;
41731
41732#ifdef FREECIV_JSON_CONNECTION
41733 /* Enter array. */
41734 field_addr.sub_location = plocation_elem_new(0);
41735#endif /* FREECIV_JSON_CONNECTION */
41736
41737 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
41738 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
41739 }
41740 for (i = 0; i < real_packet->veteran_levels; i++) {
41741#ifdef FREECIV_JSON_CONNECTION
41742 field_addr.sub_location->number = i;
41743#endif /* FREECIV_JSON_CONNECTION */
41744 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
41745 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
41746 }
41747 }
41748
41749#ifdef FREECIV_JSON_CONNECTION
41750 /* Exit array. */
41751 FC_FREE(field_addr.sub_location);
41752#endif /* FREECIV_JSON_CONNECTION */
41753 }
41754#ifdef FREECIV_JSON_CONNECTION
41755 field_addr.name = "base_raise_chance";
41756#endif /* FREECIV_JSON_CONNECTION */
41757 {
41758 int i;
41759
41760#ifdef FREECIV_JSON_CONNECTION
41761 /* Enter array. */
41762 field_addr.sub_location = plocation_elem_new(0);
41763#endif /* FREECIV_JSON_CONNECTION */
41764
41765 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
41766 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
41767 }
41768 for (i = 0; i < real_packet->veteran_levels; i++) {
41769#ifdef FREECIV_JSON_CONNECTION
41770 field_addr.sub_location->number = i;
41771#endif /* FREECIV_JSON_CONNECTION */
41772 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
41773 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
41774 }
41775 }
41776
41777#ifdef FREECIV_JSON_CONNECTION
41778 /* Exit array. */
41779 FC_FREE(field_addr.sub_location);
41780#endif /* FREECIV_JSON_CONNECTION */
41781 }
41782#ifdef FREECIV_JSON_CONNECTION
41783 field_addr.name = "work_raise_chance";
41784#endif /* FREECIV_JSON_CONNECTION */
41785 {
41786 int i;
41787
41788#ifdef FREECIV_JSON_CONNECTION
41789 /* Enter array. */
41790 field_addr.sub_location = plocation_elem_new(0);
41791#endif /* FREECIV_JSON_CONNECTION */
41792
41793 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
41794 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
41795 }
41796 for (i = 0; i < real_packet->veteran_levels; i++) {
41797#ifdef FREECIV_JSON_CONNECTION
41798 field_addr.sub_location->number = i;
41799#endif /* FREECIV_JSON_CONNECTION */
41800 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
41801 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
41802 }
41803 }
41804
41805#ifdef FREECIV_JSON_CONNECTION
41806 /* Exit array. */
41807 FC_FREE(field_addr.sub_location);
41808#endif /* FREECIV_JSON_CONNECTION */
41809 }
41810#ifdef FREECIV_JSON_CONNECTION
41811 field_addr.name = "bombard_rate";
41812#endif /* FREECIV_JSON_CONNECTION */
41813 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bombard_rate)) {
41814 RECEIVE_PACKET_FIELD_ERROR(bombard_rate);
41815 }
41816#ifdef FREECIV_JSON_CONNECTION
41817 field_addr.name = "city_size";
41818#endif /* FREECIV_JSON_CONNECTION */
41819 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_size)) {
41820 RECEIVE_PACKET_FIELD_ERROR(city_size);
41821 }
41822#ifdef FREECIV_JSON_CONNECTION
41823 field_addr.name = "city_slots";
41824#endif /* FREECIV_JSON_CONNECTION */
41825 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_slots)) {
41826 RECEIVE_PACKET_FIELD_ERROR(city_slots);
41827 }
41828#ifdef FREECIV_JSON_CONNECTION
41829 field_addr.name = "tp_defense";
41830#endif /* FREECIV_JSON_CONNECTION */
41831 {
41832 int readin;
41833
41834 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41835 RECEIVE_PACKET_FIELD_ERROR(tp_defense);
41836 }
41837 real_packet->tp_defense = readin;
41838 }
41839#ifdef FREECIV_JSON_CONNECTION
41840 field_addr.name = "cargo";
41841#endif /* FREECIV_JSON_CONNECTION */
41842 if (!DIO_BV_GET(&din, &field_addr, real_packet->cargo)) {
41843 RECEIVE_PACKET_FIELD_ERROR(cargo);
41844 }
41845#ifdef FREECIV_JSON_CONNECTION
41846 field_addr.name = "targets";
41847#endif /* FREECIV_JSON_CONNECTION */
41848 if (!DIO_BV_GET(&din, &field_addr, real_packet->targets)) {
41849 RECEIVE_PACKET_FIELD_ERROR(targets);
41850 }
41851#ifdef FREECIV_JSON_CONNECTION
41852 field_addr.name = "embarks";
41853#endif /* FREECIV_JSON_CONNECTION */
41854 if (!DIO_BV_GET(&din, &field_addr, real_packet->embarks)) {
41855 RECEIVE_PACKET_FIELD_ERROR(embarks);
41856 }
41857#ifdef FREECIV_JSON_CONNECTION
41858 field_addr.name = "disembarks";
41859#endif /* FREECIV_JSON_CONNECTION */
41860 if (!DIO_BV_GET(&din, &field_addr, real_packet->disembarks)) {
41861 RECEIVE_PACKET_FIELD_ERROR(disembarks);
41862 }
41863#ifdef FREECIV_JSON_CONNECTION
41864 field_addr.name = "vlayer";
41865#endif /* FREECIV_JSON_CONNECTION */
41866 {
41867 int readin;
41868
41869 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41870 RECEIVE_PACKET_FIELD_ERROR(vlayer);
41871 }
41872 real_packet->vlayer = readin;
41873 }
41874#ifdef FREECIV_JSON_CONNECTION
41875 field_addr.name = "helptext";
41876#endif /* FREECIV_JSON_CONNECTION */
41877 {
41878 int i;
41879
41880 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
41881 RECEIVE_PACKET_FIELD_ERROR(helptext);
41882 }
41883 strvec_reserve(real_packet->helptext, i);
41884
41885#ifdef FREECIV_JSON_CONNECTION
41886 field_addr.sub_location = plocation_elem_new(0);
41887#endif /* FREECIV_JSON_CONNECTION */
41888
41889 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
41890 char readin[MAX_LEN_PACKET];
41891
41892#ifdef FREECIV_JSON_CONNECTION
41893 /* Next array element */
41894 field_addr.sub_location->number = i;
41895#endif /* FREECIV_JSON_CONNECTION */
41896
41897 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
41898 || !strvec_set(real_packet->helptext, i, readin)) {
41899 RECEIVE_PACKET_FIELD_ERROR(helptext);
41900 }
41901 }
41902
41903#ifdef FREECIV_JSON_CONNECTION
41904 FC_FREE(field_addr.sub_location);
41905#endif /* FREECIV_JSON_CONNECTION */
41906 }
41907#ifdef FREECIV_JSON_CONNECTION
41908 field_addr.name = "flags";
41909#endif /* FREECIV_JSON_CONNECTION */
41910 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
41911 RECEIVE_PACKET_FIELD_ERROR(flags);
41912 }
41913#ifdef FREECIV_JSON_CONNECTION
41914 field_addr.name = "roles";
41915#endif /* FREECIV_JSON_CONNECTION */
41916 if (!DIO_BV_GET(&din, &field_addr, real_packet->roles)) {
41917 RECEIVE_PACKET_FIELD_ERROR(roles);
41918 }
41919#ifdef FREECIV_JSON_CONNECTION
41920 field_addr.name = "worker";
41921#endif /* FREECIV_JSON_CONNECTION */
41922 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->worker)) {
41923 RECEIVE_PACKET_FIELD_ERROR(worker);
41924 }
41925#endif
41926 log_packet_detailed("packet_ruleset_unit_100: got info about ()");
41927
41928#ifdef FREECIV_DELTA_PROTOCOL
41929 if (nullptr == *hash) {
41930 *hash = genhash_new_full(hash_packet_ruleset_unit_100, cmp_packet_ruleset_unit_100,
41931 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit);
41932 }
41933
41934 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
41935 real_packet->id = old->id;
41936 sz_strlcpy(real_packet->name, old->name);
41937 sz_strlcpy(real_packet->rule_name, old->rule_name);
41938 sz_strlcpy(real_packet->graphic_str, old->graphic_str);
41939 sz_strlcpy(real_packet->graphic_alt, old->graphic_alt);
41940 sz_strlcpy(real_packet->graphic_alt2, old->graphic_alt2);
41941 sz_strlcpy(real_packet->sound_move, old->sound_move);
41942 sz_strlcpy(real_packet->sound_move_alt, old->sound_move_alt);
41943 sz_strlcpy(real_packet->sound_fight, old->sound_fight);
41944 sz_strlcpy(real_packet->sound_fight_alt, old->sound_fight_alt);
41945 real_packet->unit_class_id = old->unit_class_id;
41946 real_packet->build_cost = old->build_cost;
41947 real_packet->pop_cost = old->pop_cost;
41948 real_packet->attack_strength = old->attack_strength;
41949 real_packet->defense_strength = old->defense_strength;
41950 real_packet->move_rate = old->move_rate;
41951 real_packet->build_reqs_count = old->build_reqs_count;
41952 {
41953 int i;
41954
41955 for (i = 0; i < old->build_reqs_count; i++) {
41956 real_packet->build_reqs[i] = old->build_reqs[i];
41957 }
41958 }
41959 real_packet->vision_radius_sq = old->vision_radius_sq;
41960 real_packet->transport_capacity = old->transport_capacity;
41961 real_packet->hp = old->hp;
41962 real_packet->firepower = old->firepower;
41963 real_packet->obsoleted_by = old->obsoleted_by;
41964 real_packet->converted_to = old->converted_to;
41965 real_packet->convert_time = old->convert_time;
41966 real_packet->fuel = old->fuel;
41967 real_packet->happy_cost = old->happy_cost;
41968 {
41969 int i;
41970
41971 for (i = 0; i < O_LAST; i++) {
41972 real_packet->upkeep[i] = old->upkeep[i];
41973 }
41974 }
41975 real_packet->paratroopers_range = old->paratroopers_range;
41976 real_packet->veteran_levels = old->veteran_levels;
41977 {
41978 int i;
41979
41980 for (i = 0; i < old->veteran_levels; i++) {
41981 sz_strlcpy(real_packet->veteran_name[i], old->veteran_name[i]);
41982 }
41983 }
41984 {
41985 int i;
41986
41987 for (i = 0; i < old->veteran_levels; i++) {
41988 real_packet->power_fact[i] = old->power_fact[i];
41989 }
41990 }
41991 {
41992 int i;
41993
41994 for (i = 0; i < old->veteran_levels; i++) {
41995 real_packet->move_bonus[i] = old->move_bonus[i];
41996 }
41997 }
41998 {
41999 int i;
42000
42001 for (i = 0; i < old->veteran_levels; i++) {
42002 real_packet->base_raise_chance[i] = old->base_raise_chance[i];
42003 }
42004 }
42005 {
42006 int i;
42007
42008 for (i = 0; i < old->veteran_levels; i++) {
42009 real_packet->work_raise_chance[i] = old->work_raise_chance[i];
42010 }
42011 }
42012 real_packet->bombard_rate = old->bombard_rate;
42013 real_packet->city_size = old->city_size;
42014 real_packet->city_slots = old->city_slots;
42015 real_packet->tp_defense = old->tp_defense;
42016 real_packet->cargo = old->cargo;
42017 real_packet->targets = old->targets;
42018 real_packet->embarks = old->embarks;
42019 real_packet->disembarks = old->disembarks;
42020 real_packet->vlayer = old->vlayer;
42021 if (old->helptext) {
42022 strvec_copy(real_packet->helptext, old->helptext);
42023 } else {
42024 strvec_clear(real_packet->helptext);
42025 }
42026 real_packet->flags = old->flags;
42027 real_packet->roles = old->roles;
42028 real_packet->worker = old->worker;
42029 } else {
42030 /* packet is already initialized empty */
42031 log_packet_detailed(" no old info");
42032 }
42033
42034 if (BV_ISSET(fields, 0)) {
42035 log_packet_detailed(" got field 'id'");
42036#ifdef FREECIV_JSON_CONNECTION
42037 field_addr.name = "id";
42038#endif /* FREECIV_JSON_CONNECTION */
42039 {
42040 int readin;
42041
42042 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
42043 RECEIVE_PACKET_FIELD_ERROR(id);
42044 }
42045 real_packet->id = readin;
42046 }
42047 }
42048 if (BV_ISSET(fields, 1)) {
42049 log_packet_detailed(" got field 'name'");
42050#ifdef FREECIV_JSON_CONNECTION
42051 field_addr.name = "name";
42052#endif /* FREECIV_JSON_CONNECTION */
42053 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
42054 RECEIVE_PACKET_FIELD_ERROR(name);
42055 }
42056 }
42057 if (BV_ISSET(fields, 2)) {
42058 log_packet_detailed(" got field 'rule_name'");
42059#ifdef FREECIV_JSON_CONNECTION
42060 field_addr.name = "rule_name";
42061#endif /* FREECIV_JSON_CONNECTION */
42062 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
42063 RECEIVE_PACKET_FIELD_ERROR(rule_name);
42064 }
42065 }
42066 if (BV_ISSET(fields, 3)) {
42067 log_packet_detailed(" got field 'graphic_str'");
42068#ifdef FREECIV_JSON_CONNECTION
42069 field_addr.name = "graphic_str";
42070#endif /* FREECIV_JSON_CONNECTION */
42071 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
42072 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
42073 }
42074 }
42075 if (BV_ISSET(fields, 4)) {
42076 log_packet_detailed(" got field 'graphic_alt'");
42077#ifdef FREECIV_JSON_CONNECTION
42078 field_addr.name = "graphic_alt";
42079#endif /* FREECIV_JSON_CONNECTION */
42080 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
42081 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
42082 }
42083 }
42084 if (BV_ISSET(fields, 5)) {
42085 log_packet_detailed(" got field 'graphic_alt2'");
42086#ifdef FREECIV_JSON_CONNECTION
42087 field_addr.name = "graphic_alt2";
42088#endif /* FREECIV_JSON_CONNECTION */
42089 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
42090 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
42091 }
42092 }
42093 if (BV_ISSET(fields, 6)) {
42094 log_packet_detailed(" got field 'sound_move'");
42095#ifdef FREECIV_JSON_CONNECTION
42096 field_addr.name = "sound_move";
42097#endif /* FREECIV_JSON_CONNECTION */
42098 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move, sizeof(real_packet->sound_move))) {
42099 RECEIVE_PACKET_FIELD_ERROR(sound_move);
42100 }
42101 }
42102 if (BV_ISSET(fields, 7)) {
42103 log_packet_detailed(" got field 'sound_move_alt'");
42104#ifdef FREECIV_JSON_CONNECTION
42105 field_addr.name = "sound_move_alt";
42106#endif /* FREECIV_JSON_CONNECTION */
42107 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move_alt, sizeof(real_packet->sound_move_alt))) {
42108 RECEIVE_PACKET_FIELD_ERROR(sound_move_alt);
42109 }
42110 }
42111 if (BV_ISSET(fields, 8)) {
42112 log_packet_detailed(" got field 'sound_fight'");
42113#ifdef FREECIV_JSON_CONNECTION
42114 field_addr.name = "sound_fight";
42115#endif /* FREECIV_JSON_CONNECTION */
42116 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight, sizeof(real_packet->sound_fight))) {
42117 RECEIVE_PACKET_FIELD_ERROR(sound_fight);
42118 }
42119 }
42120 if (BV_ISSET(fields, 9)) {
42121 log_packet_detailed(" got field 'sound_fight_alt'");
42122#ifdef FREECIV_JSON_CONNECTION
42123 field_addr.name = "sound_fight_alt";
42124#endif /* FREECIV_JSON_CONNECTION */
42125 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight_alt, sizeof(real_packet->sound_fight_alt))) {
42126 RECEIVE_PACKET_FIELD_ERROR(sound_fight_alt);
42127 }
42128 }
42129 if (BV_ISSET(fields, 10)) {
42130 log_packet_detailed(" got field 'unit_class_id'");
42131#ifdef FREECIV_JSON_CONNECTION
42132 field_addr.name = "unit_class_id";
42133#endif /* FREECIV_JSON_CONNECTION */
42134 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->unit_class_id)) {
42135 RECEIVE_PACKET_FIELD_ERROR(unit_class_id);
42136 }
42137 }
42138 if (BV_ISSET(fields, 11)) {
42139 log_packet_detailed(" got field 'build_cost'");
42140#ifdef FREECIV_JSON_CONNECTION
42141 field_addr.name = "build_cost";
42142#endif /* FREECIV_JSON_CONNECTION */
42143 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
42144 RECEIVE_PACKET_FIELD_ERROR(build_cost);
42145 }
42146 }
42147 if (BV_ISSET(fields, 12)) {
42148 log_packet_detailed(" got field 'pop_cost'");
42149#ifdef FREECIV_JSON_CONNECTION
42150 field_addr.name = "pop_cost";
42151#endif /* FREECIV_JSON_CONNECTION */
42152 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_cost)) {
42153 RECEIVE_PACKET_FIELD_ERROR(pop_cost);
42154 }
42155 }
42156 if (BV_ISSET(fields, 13)) {
42157 log_packet_detailed(" got field 'attack_strength'");
42158#ifdef FREECIV_JSON_CONNECTION
42159 field_addr.name = "attack_strength";
42160#endif /* FREECIV_JSON_CONNECTION */
42161 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attack_strength)) {
42162 RECEIVE_PACKET_FIELD_ERROR(attack_strength);
42163 }
42164 }
42165 if (BV_ISSET(fields, 14)) {
42166 log_packet_detailed(" got field 'defense_strength'");
42167#ifdef FREECIV_JSON_CONNECTION
42168 field_addr.name = "defense_strength";
42169#endif /* FREECIV_JSON_CONNECTION */
42170 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_strength)) {
42171 RECEIVE_PACKET_FIELD_ERROR(defense_strength);
42172 }
42173 }
42174 if (BV_ISSET(fields, 15)) {
42175 log_packet_detailed(" got field 'move_rate'");
42176#ifdef FREECIV_JSON_CONNECTION
42177 field_addr.name = "move_rate";
42178#endif /* FREECIV_JSON_CONNECTION */
42179 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_rate)) {
42180 RECEIVE_PACKET_FIELD_ERROR(move_rate);
42181 }
42182 }
42183 if (BV_ISSET(fields, 16)) {
42184 log_packet_detailed(" got field 'build_reqs_count'");
42185#ifdef FREECIV_JSON_CONNECTION
42186 field_addr.name = "build_reqs_count";
42187#endif /* FREECIV_JSON_CONNECTION */
42188 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_reqs_count)) {
42189 RECEIVE_PACKET_FIELD_ERROR(build_reqs_count);
42190 }
42191 }
42192 if (BV_ISSET(fields, 17)) {
42193 log_packet_detailed(" got field 'build_reqs'");
42194#ifdef FREECIV_JSON_CONNECTION
42195 field_addr.name = "build_reqs";
42196#endif /* FREECIV_JSON_CONNECTION */
42197 {
42198 int i;
42199
42200#ifdef FREECIV_JSON_CONNECTION
42201 /* Enter array. */
42202 field_addr.sub_location = plocation_elem_new(0);
42203#endif /* FREECIV_JSON_CONNECTION */
42204
42205 if (real_packet->build_reqs_count > MAX_NUM_REQS) {
42206 RECEIVE_PACKET_FIELD_ERROR(build_reqs, ": truncation array");
42207 }
42208 for (i = 0; i < real_packet->build_reqs_count; i++) {
42209#ifdef FREECIV_JSON_CONNECTION
42210 field_addr.sub_location->number = i;
42211#endif /* FREECIV_JSON_CONNECTION */
42212 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->build_reqs[i])) {
42213 RECEIVE_PACKET_FIELD_ERROR(build_reqs);
42214 }
42215 }
42216
42217#ifdef FREECIV_JSON_CONNECTION
42218 /* Exit array. */
42219 FC_FREE(field_addr.sub_location);
42220#endif /* FREECIV_JSON_CONNECTION */
42221 }
42222 }
42223 if (BV_ISSET(fields, 18)) {
42224 log_packet_detailed(" got field 'vision_radius_sq'");
42225#ifdef FREECIV_JSON_CONNECTION
42226 field_addr.name = "vision_radius_sq";
42227#endif /* FREECIV_JSON_CONNECTION */
42228 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->vision_radius_sq)) {
42229 RECEIVE_PACKET_FIELD_ERROR(vision_radius_sq);
42230 }
42231 }
42232 if (BV_ISSET(fields, 19)) {
42233 log_packet_detailed(" got field 'transport_capacity'");
42234#ifdef FREECIV_JSON_CONNECTION
42235 field_addr.name = "transport_capacity";
42236#endif /* FREECIV_JSON_CONNECTION */
42237 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transport_capacity)) {
42238 RECEIVE_PACKET_FIELD_ERROR(transport_capacity);
42239 }
42240 }
42241 if (BV_ISSET(fields, 20)) {
42242 log_packet_detailed(" got field 'hp'");
42243#ifdef FREECIV_JSON_CONNECTION
42244 field_addr.name = "hp";
42245#endif /* FREECIV_JSON_CONNECTION */
42246 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
42247 RECEIVE_PACKET_FIELD_ERROR(hp);
42248 }
42249 }
42250 if (BV_ISSET(fields, 21)) {
42251 log_packet_detailed(" got field 'firepower'");
42252#ifdef FREECIV_JSON_CONNECTION
42253 field_addr.name = "firepower";
42254#endif /* FREECIV_JSON_CONNECTION */
42255 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->firepower)) {
42256 RECEIVE_PACKET_FIELD_ERROR(firepower);
42257 }
42258 }
42259 if (BV_ISSET(fields, 22)) {
42260 log_packet_detailed(" got field 'obsoleted_by'");
42261#ifdef FREECIV_JSON_CONNECTION
42262 field_addr.name = "obsoleted_by";
42263#endif /* FREECIV_JSON_CONNECTION */
42264 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obsoleted_by)) {
42265 RECEIVE_PACKET_FIELD_ERROR(obsoleted_by);
42266 }
42267 }
42268 if (BV_ISSET(fields, 23)) {
42269 log_packet_detailed(" got field 'converted_to'");
42270#ifdef FREECIV_JSON_CONNECTION
42271 field_addr.name = "converted_to";
42272#endif /* FREECIV_JSON_CONNECTION */
42273 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->converted_to)) {
42274 RECEIVE_PACKET_FIELD_ERROR(converted_to);
42275 }
42276 }
42277 if (BV_ISSET(fields, 24)) {
42278 log_packet_detailed(" got field 'convert_time'");
42279#ifdef FREECIV_JSON_CONNECTION
42280 field_addr.name = "convert_time";
42281#endif /* FREECIV_JSON_CONNECTION */
42282 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->convert_time)) {
42283 RECEIVE_PACKET_FIELD_ERROR(convert_time);
42284 }
42285 }
42286 if (BV_ISSET(fields, 25)) {
42287 log_packet_detailed(" got field 'fuel'");
42288#ifdef FREECIV_JSON_CONNECTION
42289 field_addr.name = "fuel";
42290#endif /* FREECIV_JSON_CONNECTION */
42291 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
42292 RECEIVE_PACKET_FIELD_ERROR(fuel);
42293 }
42294 }
42295 if (BV_ISSET(fields, 26)) {
42296 log_packet_detailed(" got field 'happy_cost'");
42297#ifdef FREECIV_JSON_CONNECTION
42298 field_addr.name = "happy_cost";
42299#endif /* FREECIV_JSON_CONNECTION */
42300 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->happy_cost)) {
42301 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
42302 }
42303 }
42304 if (BV_ISSET(fields, 27)) {
42305 log_packet_detailed(" got field 'upkeep'");
42306#ifdef FREECIV_JSON_CONNECTION
42307 field_addr.name = "upkeep";
42308#endif /* FREECIV_JSON_CONNECTION */
42309 {
42310 int i;
42311
42312#ifdef FREECIV_JSON_CONNECTION
42313 /* Enter array. */
42314 field_addr.sub_location = plocation_elem_new(0);
42315#endif /* FREECIV_JSON_CONNECTION */
42316
42317 for (i = 0; i < O_LAST; i++) {
42318#ifdef FREECIV_JSON_CONNECTION
42319 field_addr.sub_location->number = i;
42320#endif /* FREECIV_JSON_CONNECTION */
42321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
42322 RECEIVE_PACKET_FIELD_ERROR(upkeep);
42323 }
42324 }
42325
42326#ifdef FREECIV_JSON_CONNECTION
42327 /* Exit array. */
42328 FC_FREE(field_addr.sub_location);
42329#endif /* FREECIV_JSON_CONNECTION */
42330 }
42331 }
42332 if (BV_ISSET(fields, 28)) {
42333 log_packet_detailed(" got field 'paratroopers_range'");
42334#ifdef FREECIV_JSON_CONNECTION
42335 field_addr.name = "paratroopers_range";
42336#endif /* FREECIV_JSON_CONNECTION */
42337 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->paratroopers_range)) {
42338 RECEIVE_PACKET_FIELD_ERROR(paratroopers_range);
42339 }
42340 }
42341 if (BV_ISSET(fields, 29)) {
42342 log_packet_detailed(" got field 'veteran_levels'");
42343#ifdef FREECIV_JSON_CONNECTION
42344 field_addr.name = "veteran_levels";
42345#endif /* FREECIV_JSON_CONNECTION */
42346 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
42347 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
42348 }
42349 }
42350 if (BV_ISSET(fields, 30)) {
42351 log_packet_detailed(" got field 'veteran_name'");
42352#ifdef FREECIV_JSON_CONNECTION
42353 field_addr.name = "veteran_name";
42354#endif /* FREECIV_JSON_CONNECTION */
42355 {
42356 int i;
42357
42358#ifdef FREECIV_JSON_CONNECTION
42359 /* Enter array. */
42360 field_addr.sub_location = plocation_elem_new(0);
42361#endif /* FREECIV_JSON_CONNECTION */
42362
42363 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
42364 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
42365 }
42366 for (i = 0; i < real_packet->veteran_levels; i++) {
42367#ifdef FREECIV_JSON_CONNECTION
42368 field_addr.sub_location->number = i;
42369#endif /* FREECIV_JSON_CONNECTION */
42370 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
42371 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
42372 }
42373 }
42374
42375#ifdef FREECIV_JSON_CONNECTION
42376 /* Exit array. */
42377 FC_FREE(field_addr.sub_location);
42378#endif /* FREECIV_JSON_CONNECTION */
42379 }
42380 }
42381 if (BV_ISSET(fields, 31)) {
42382 log_packet_detailed(" got field 'power_fact'");
42383#ifdef FREECIV_JSON_CONNECTION
42384 field_addr.name = "power_fact";
42385#endif /* FREECIV_JSON_CONNECTION */
42386 {
42387 int i;
42388
42389#ifdef FREECIV_JSON_CONNECTION
42390 /* Enter array. */
42391 field_addr.sub_location = plocation_elem_new(0);
42392#endif /* FREECIV_JSON_CONNECTION */
42393
42394 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
42395 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
42396 }
42397 for (i = 0; i < real_packet->veteran_levels; i++) {
42398#ifdef FREECIV_JSON_CONNECTION
42399 field_addr.sub_location->number = i;
42400#endif /* FREECIV_JSON_CONNECTION */
42401 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
42402 RECEIVE_PACKET_FIELD_ERROR(power_fact);
42403 }
42404 }
42405
42406#ifdef FREECIV_JSON_CONNECTION
42407 /* Exit array. */
42408 FC_FREE(field_addr.sub_location);
42409#endif /* FREECIV_JSON_CONNECTION */
42410 }
42411 }
42412 if (BV_ISSET(fields, 32)) {
42413 log_packet_detailed(" got field 'move_bonus'");
42414#ifdef FREECIV_JSON_CONNECTION
42415 field_addr.name = "move_bonus";
42416#endif /* FREECIV_JSON_CONNECTION */
42417 {
42418 int i;
42419
42420#ifdef FREECIV_JSON_CONNECTION
42421 /* Enter array. */
42422 field_addr.sub_location = plocation_elem_new(0);
42423#endif /* FREECIV_JSON_CONNECTION */
42424
42425 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
42426 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
42427 }
42428 for (i = 0; i < real_packet->veteran_levels; i++) {
42429#ifdef FREECIV_JSON_CONNECTION
42430 field_addr.sub_location->number = i;
42431#endif /* FREECIV_JSON_CONNECTION */
42432 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
42433 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
42434 }
42435 }
42436
42437#ifdef FREECIV_JSON_CONNECTION
42438 /* Exit array. */
42439 FC_FREE(field_addr.sub_location);
42440#endif /* FREECIV_JSON_CONNECTION */
42441 }
42442 }
42443 if (BV_ISSET(fields, 33)) {
42444 log_packet_detailed(" got field 'base_raise_chance'");
42445#ifdef FREECIV_JSON_CONNECTION
42446 field_addr.name = "base_raise_chance";
42447#endif /* FREECIV_JSON_CONNECTION */
42448 {
42449 int i;
42450
42451#ifdef FREECIV_JSON_CONNECTION
42452 /* Enter array. */
42453 field_addr.sub_location = plocation_elem_new(0);
42454#endif /* FREECIV_JSON_CONNECTION */
42455
42456 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
42457 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
42458 }
42459 for (i = 0; i < real_packet->veteran_levels; i++) {
42460#ifdef FREECIV_JSON_CONNECTION
42461 field_addr.sub_location->number = i;
42462#endif /* FREECIV_JSON_CONNECTION */
42463 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
42464 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
42465 }
42466 }
42467
42468#ifdef FREECIV_JSON_CONNECTION
42469 /* Exit array. */
42470 FC_FREE(field_addr.sub_location);
42471#endif /* FREECIV_JSON_CONNECTION */
42472 }
42473 }
42474 if (BV_ISSET(fields, 34)) {
42475 log_packet_detailed(" got field 'work_raise_chance'");
42476#ifdef FREECIV_JSON_CONNECTION
42477 field_addr.name = "work_raise_chance";
42478#endif /* FREECIV_JSON_CONNECTION */
42479 {
42480 int i;
42481
42482#ifdef FREECIV_JSON_CONNECTION
42483 /* Enter array. */
42484 field_addr.sub_location = plocation_elem_new(0);
42485#endif /* FREECIV_JSON_CONNECTION */
42486
42487 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
42488 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
42489 }
42490 for (i = 0; i < real_packet->veteran_levels; i++) {
42491#ifdef FREECIV_JSON_CONNECTION
42492 field_addr.sub_location->number = i;
42493#endif /* FREECIV_JSON_CONNECTION */
42494 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
42495 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
42496 }
42497 }
42498
42499#ifdef FREECIV_JSON_CONNECTION
42500 /* Exit array. */
42501 FC_FREE(field_addr.sub_location);
42502#endif /* FREECIV_JSON_CONNECTION */
42503 }
42504 }
42505 if (BV_ISSET(fields, 35)) {
42506 log_packet_detailed(" got field 'bombard_rate'");
42507#ifdef FREECIV_JSON_CONNECTION
42508 field_addr.name = "bombard_rate";
42509#endif /* FREECIV_JSON_CONNECTION */
42510 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bombard_rate)) {
42511 RECEIVE_PACKET_FIELD_ERROR(bombard_rate);
42512 }
42513 }
42514 if (BV_ISSET(fields, 36)) {
42515 log_packet_detailed(" got field 'city_size'");
42516#ifdef FREECIV_JSON_CONNECTION
42517 field_addr.name = "city_size";
42518#endif /* FREECIV_JSON_CONNECTION */
42519 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_size)) {
42520 RECEIVE_PACKET_FIELD_ERROR(city_size);
42521 }
42522 }
42523 if (BV_ISSET(fields, 37)) {
42524 log_packet_detailed(" got field 'city_slots'");
42525#ifdef FREECIV_JSON_CONNECTION
42526 field_addr.name = "city_slots";
42527#endif /* FREECIV_JSON_CONNECTION */
42528 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_slots)) {
42529 RECEIVE_PACKET_FIELD_ERROR(city_slots);
42530 }
42531 }
42532 if (BV_ISSET(fields, 38)) {
42533 log_packet_detailed(" got field 'tp_defense'");
42534#ifdef FREECIV_JSON_CONNECTION
42535 field_addr.name = "tp_defense";
42536#endif /* FREECIV_JSON_CONNECTION */
42537 {
42538 int readin;
42539
42540 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42541 RECEIVE_PACKET_FIELD_ERROR(tp_defense);
42542 }
42543 real_packet->tp_defense = readin;
42544 }
42545 }
42546 if (BV_ISSET(fields, 39)) {
42547 log_packet_detailed(" got field 'cargo'");
42548#ifdef FREECIV_JSON_CONNECTION
42549 field_addr.name = "cargo";
42550#endif /* FREECIV_JSON_CONNECTION */
42551 if (!DIO_BV_GET(&din, &field_addr, real_packet->cargo)) {
42552 RECEIVE_PACKET_FIELD_ERROR(cargo);
42553 }
42554 }
42555 if (BV_ISSET(fields, 40)) {
42556 log_packet_detailed(" got field 'targets'");
42557#ifdef FREECIV_JSON_CONNECTION
42558 field_addr.name = "targets";
42559#endif /* FREECIV_JSON_CONNECTION */
42560 if (!DIO_BV_GET(&din, &field_addr, real_packet->targets)) {
42561 RECEIVE_PACKET_FIELD_ERROR(targets);
42562 }
42563 }
42564 if (BV_ISSET(fields, 41)) {
42565 log_packet_detailed(" got field 'embarks'");
42566#ifdef FREECIV_JSON_CONNECTION
42567 field_addr.name = "embarks";
42568#endif /* FREECIV_JSON_CONNECTION */
42569 if (!DIO_BV_GET(&din, &field_addr, real_packet->embarks)) {
42570 RECEIVE_PACKET_FIELD_ERROR(embarks);
42571 }
42572 }
42573 if (BV_ISSET(fields, 42)) {
42574 log_packet_detailed(" got field 'disembarks'");
42575#ifdef FREECIV_JSON_CONNECTION
42576 field_addr.name = "disembarks";
42577#endif /* FREECIV_JSON_CONNECTION */
42578 if (!DIO_BV_GET(&din, &field_addr, real_packet->disembarks)) {
42579 RECEIVE_PACKET_FIELD_ERROR(disembarks);
42580 }
42581 }
42582 if (BV_ISSET(fields, 43)) {
42583 log_packet_detailed(" got field 'vlayer'");
42584#ifdef FREECIV_JSON_CONNECTION
42585 field_addr.name = "vlayer";
42586#endif /* FREECIV_JSON_CONNECTION */
42587 {
42588 int readin;
42589
42590 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42591 RECEIVE_PACKET_FIELD_ERROR(vlayer);
42592 }
42593 real_packet->vlayer = readin;
42594 }
42595 }
42596 if (BV_ISSET(fields, 44)) {
42597 log_packet_detailed(" got field 'helptext'");
42598#ifdef FREECIV_JSON_CONNECTION
42599 field_addr.name = "helptext";
42600#endif /* FREECIV_JSON_CONNECTION */
42601 {
42602 int i;
42603
42604 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
42605 RECEIVE_PACKET_FIELD_ERROR(helptext);
42606 }
42607 strvec_reserve(real_packet->helptext, i);
42608
42609#ifdef FREECIV_JSON_CONNECTION
42610 field_addr.sub_location = plocation_elem_new(0);
42611#endif /* FREECIV_JSON_CONNECTION */
42612
42613 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
42614 char readin[MAX_LEN_PACKET];
42615
42616#ifdef FREECIV_JSON_CONNECTION
42617 /* Next array element */
42618 field_addr.sub_location->number = i;
42619#endif /* FREECIV_JSON_CONNECTION */
42620
42621 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
42622 || !strvec_set(real_packet->helptext, i, readin)) {
42623 RECEIVE_PACKET_FIELD_ERROR(helptext);
42624 }
42625 }
42626
42627#ifdef FREECIV_JSON_CONNECTION
42628 FC_FREE(field_addr.sub_location);
42629#endif /* FREECIV_JSON_CONNECTION */
42630 }
42631 }
42632 if (BV_ISSET(fields, 45)) {
42633 log_packet_detailed(" got field 'flags'");
42634#ifdef FREECIV_JSON_CONNECTION
42635 field_addr.name = "flags";
42636#endif /* FREECIV_JSON_CONNECTION */
42637 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
42638 RECEIVE_PACKET_FIELD_ERROR(flags);
42639 }
42640 }
42641 if (BV_ISSET(fields, 46)) {
42642 log_packet_detailed(" got field 'roles'");
42643#ifdef FREECIV_JSON_CONNECTION
42644 field_addr.name = "roles";
42645#endif /* FREECIV_JSON_CONNECTION */
42646 if (!DIO_BV_GET(&din, &field_addr, real_packet->roles)) {
42647 RECEIVE_PACKET_FIELD_ERROR(roles);
42648 }
42649 }
42650 real_packet->worker = BV_ISSET(fields, 47);
42651
42652 if (nullptr == old) {
42653 old = fc_malloc(sizeof(*old));
42654 init_packet_ruleset_unit(old);
42655 old->id = real_packet->id;
42656 sz_strlcpy(old->name, real_packet->name);
42657 sz_strlcpy(old->rule_name, real_packet->rule_name);
42658 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
42659 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
42660 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
42661 sz_strlcpy(old->sound_move, real_packet->sound_move);
42662 sz_strlcpy(old->sound_move_alt, real_packet->sound_move_alt);
42663 sz_strlcpy(old->sound_fight, real_packet->sound_fight);
42664 sz_strlcpy(old->sound_fight_alt, real_packet->sound_fight_alt);
42665 old->unit_class_id = real_packet->unit_class_id;
42666 old->build_cost = real_packet->build_cost;
42667 old->pop_cost = real_packet->pop_cost;
42668 old->attack_strength = real_packet->attack_strength;
42669 old->defense_strength = real_packet->defense_strength;
42670 old->move_rate = real_packet->move_rate;
42671 old->build_reqs_count = real_packet->build_reqs_count;
42672 {
42673 int i;
42674
42675 for (i = 0; i < real_packet->build_reqs_count; i++) {
42676 old->build_reqs[i] = real_packet->build_reqs[i];
42677 }
42678 }
42679 old->vision_radius_sq = real_packet->vision_radius_sq;
42680 old->transport_capacity = real_packet->transport_capacity;
42681 old->hp = real_packet->hp;
42682 old->firepower = real_packet->firepower;
42683 old->obsoleted_by = real_packet->obsoleted_by;
42684 old->converted_to = real_packet->converted_to;
42685 old->convert_time = real_packet->convert_time;
42686 old->fuel = real_packet->fuel;
42687 old->happy_cost = real_packet->happy_cost;
42688 {
42689 int i;
42690
42691 for (i = 0; i < O_LAST; i++) {
42692 old->upkeep[i] = real_packet->upkeep[i];
42693 }
42694 }
42695 old->paratroopers_range = real_packet->paratroopers_range;
42696 old->veteran_levels = real_packet->veteran_levels;
42697 {
42698 int i;
42699
42700 for (i = 0; i < real_packet->veteran_levels; i++) {
42701 sz_strlcpy(old->veteran_name[i], real_packet->veteran_name[i]);
42702 }
42703 }
42704 {
42705 int i;
42706
42707 for (i = 0; i < real_packet->veteran_levels; i++) {
42708 old->power_fact[i] = real_packet->power_fact[i];
42709 }
42710 }
42711 {
42712 int i;
42713
42714 for (i = 0; i < real_packet->veteran_levels; i++) {
42715 old->move_bonus[i] = real_packet->move_bonus[i];
42716 }
42717 }
42718 {
42719 int i;
42720
42721 for (i = 0; i < real_packet->veteran_levels; i++) {
42722 old->base_raise_chance[i] = real_packet->base_raise_chance[i];
42723 }
42724 }
42725 {
42726 int i;
42727
42728 for (i = 0; i < real_packet->veteran_levels; i++) {
42729 old->work_raise_chance[i] = real_packet->work_raise_chance[i];
42730 }
42731 }
42732 old->bombard_rate = real_packet->bombard_rate;
42733 old->city_size = real_packet->city_size;
42734 old->city_slots = real_packet->city_slots;
42735 old->tp_defense = real_packet->tp_defense;
42736 old->cargo = real_packet->cargo;
42737 old->targets = real_packet->targets;
42738 old->embarks = real_packet->embarks;
42739 old->disembarks = real_packet->disembarks;
42740 old->vlayer = real_packet->vlayer;
42741 if (real_packet->helptext) {
42742 strvec_copy(old->helptext, real_packet->helptext);
42743 } else {
42744 strvec_clear(old->helptext);
42745 }
42746 old->flags = real_packet->flags;
42747 old->roles = real_packet->roles;
42748 old->worker = real_packet->worker;
42749 genhash_insert(*hash, old, old);
42750 } else {
42751 old->id = real_packet->id;
42752 sz_strlcpy(old->name, real_packet->name);
42753 sz_strlcpy(old->rule_name, real_packet->rule_name);
42754 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
42755 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
42756 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
42757 sz_strlcpy(old->sound_move, real_packet->sound_move);
42758 sz_strlcpy(old->sound_move_alt, real_packet->sound_move_alt);
42759 sz_strlcpy(old->sound_fight, real_packet->sound_fight);
42760 sz_strlcpy(old->sound_fight_alt, real_packet->sound_fight_alt);
42761 old->unit_class_id = real_packet->unit_class_id;
42762 old->build_cost = real_packet->build_cost;
42763 old->pop_cost = real_packet->pop_cost;
42764 old->attack_strength = real_packet->attack_strength;
42765 old->defense_strength = real_packet->defense_strength;
42766 old->move_rate = real_packet->move_rate;
42767 old->build_reqs_count = real_packet->build_reqs_count;
42768 {
42769 int i;
42770
42771 for (i = 0; i < real_packet->build_reqs_count; i++) {
42772 old->build_reqs[i] = real_packet->build_reqs[i];
42773 }
42774 }
42775 old->vision_radius_sq = real_packet->vision_radius_sq;
42776 old->transport_capacity = real_packet->transport_capacity;
42777 old->hp = real_packet->hp;
42778 old->firepower = real_packet->firepower;
42779 old->obsoleted_by = real_packet->obsoleted_by;
42780 old->converted_to = real_packet->converted_to;
42781 old->convert_time = real_packet->convert_time;
42782 old->fuel = real_packet->fuel;
42783 old->happy_cost = real_packet->happy_cost;
42784 {
42785 int i;
42786
42787 for (i = 0; i < O_LAST; i++) {
42788 old->upkeep[i] = real_packet->upkeep[i];
42789 }
42790 }
42791 old->paratroopers_range = real_packet->paratroopers_range;
42792 old->veteran_levels = real_packet->veteran_levels;
42793 {
42794 int i;
42795
42796 for (i = 0; i < real_packet->veteran_levels; i++) {
42797 sz_strlcpy(old->veteran_name[i], real_packet->veteran_name[i]);
42798 }
42799 }
42800 {
42801 int i;
42802
42803 for (i = 0; i < real_packet->veteran_levels; i++) {
42804 old->power_fact[i] = real_packet->power_fact[i];
42805 }
42806 }
42807 {
42808 int i;
42809
42810 for (i = 0; i < real_packet->veteran_levels; i++) {
42811 old->move_bonus[i] = real_packet->move_bonus[i];
42812 }
42813 }
42814 {
42815 int i;
42816
42817 for (i = 0; i < real_packet->veteran_levels; i++) {
42818 old->base_raise_chance[i] = real_packet->base_raise_chance[i];
42819 }
42820 }
42821 {
42822 int i;
42823
42824 for (i = 0; i < real_packet->veteran_levels; i++) {
42825 old->work_raise_chance[i] = real_packet->work_raise_chance[i];
42826 }
42827 }
42828 old->bombard_rate = real_packet->bombard_rate;
42829 old->city_size = real_packet->city_size;
42830 old->city_slots = real_packet->city_slots;
42831 old->tp_defense = real_packet->tp_defense;
42832 old->cargo = real_packet->cargo;
42833 old->targets = real_packet->targets;
42834 old->embarks = real_packet->embarks;
42835 old->disembarks = real_packet->disembarks;
42836 old->vlayer = real_packet->vlayer;
42837 if (real_packet->helptext) {
42838 strvec_copy(old->helptext, real_packet->helptext);
42839 } else {
42840 strvec_clear(old->helptext);
42841 }
42842 old->flags = real_packet->flags;
42843 old->roles = real_packet->roles;
42844 old->worker = real_packet->worker;
42845 }
42846
42847#endif /* FREECIV_DELTA_PROTOCOL */
42848 RECEIVE_PACKET_END(real_packet);
42849#undef FREE_PACKET_STRUCT
42850}
42851
42852 static int send_packet_ruleset_unit_100(struct connection *pc, const struct packet_ruleset_unit *packet)
42853{
42854 const struct packet_ruleset_unit *real_packet = packet;
42855 int e;
42856#ifdef FREECIV_DELTA_PROTOCOL
42857 packet_ruleset_unit_100_fields fields;
42858 struct packet_ruleset_unit *old;
42859 bool differ;
42860 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT;
42861#endif /* FREECIV_DELTA_PROTOCOL */
42862 SEND_PACKET_START(PACKET_RULESET_UNIT);
42863#ifdef FREECIV_JSON_CONNECTION
42864 struct plocation field_addr;
42865 {
42866 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
42867 field_addr = *field_addr_tmp;
42868 FC_FREE(field_addr_tmp);
42869 }
42870#endif /* FREECIV_JSON_CONNECTION */
42871
42872 log_packet_detailed("packet_ruleset_unit_100: sending info about ()");
42873
42874#ifdef FREECIV_DELTA_PROTOCOL
42875 if (nullptr == *hash) {
42876 *hash = genhash_new_full(hash_packet_ruleset_unit_100, cmp_packet_ruleset_unit_100,
42877 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit);
42878 }
42879 BV_CLR_ALL(fields);
42880
42881 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
42882 old = fc_malloc(sizeof(*old));
42883 /* temporary bitcopy just to insert correctly */
42884 *old = *real_packet;
42885 genhash_insert(*hash, old, old);
42886 init_packet_ruleset_unit(old);
42887 }
42888 differ = (old->id != real_packet->id);
42889 if (differ) {
42890 BV_SET(fields, 0);
42891 }
42892
42893 differ = (strcmp(old->name, real_packet->name) != 0);
42894 if (differ) {
42895 BV_SET(fields, 1);
42896 }
42897
42898 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
42899 if (differ) {
42900 BV_SET(fields, 2);
42901 }
42902
42903 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
42904 if (differ) {
42905 BV_SET(fields, 3);
42906 }
42907
42908 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
42909 if (differ) {
42910 BV_SET(fields, 4);
42911 }
42912
42913 differ = (strcmp(old->graphic_alt2, real_packet->graphic_alt2) != 0);
42914 if (differ) {
42915 BV_SET(fields, 5);
42916 }
42917
42918 differ = (strcmp(old->sound_move, real_packet->sound_move) != 0);
42919 if (differ) {
42920 BV_SET(fields, 6);
42921 }
42922
42923 differ = (strcmp(old->sound_move_alt, real_packet->sound_move_alt) != 0);
42924 if (differ) {
42925 BV_SET(fields, 7);
42926 }
42927
42928 differ = (strcmp(old->sound_fight, real_packet->sound_fight) != 0);
42929 if (differ) {
42930 BV_SET(fields, 8);
42931 }
42932
42933 differ = (strcmp(old->sound_fight_alt, real_packet->sound_fight_alt) != 0);
42934 if (differ) {
42935 BV_SET(fields, 9);
42936 }
42937
42938 differ = (old->unit_class_id != real_packet->unit_class_id);
42939 if (differ) {
42940 BV_SET(fields, 10);
42941 }
42942
42943 differ = (old->build_cost != real_packet->build_cost);
42944 if (differ) {
42945 BV_SET(fields, 11);
42946 }
42947
42948 differ = (old->pop_cost != real_packet->pop_cost);
42949 if (differ) {
42950 BV_SET(fields, 12);
42951 }
42952
42953 differ = (old->attack_strength != real_packet->attack_strength);
42954 if (differ) {
42955 BV_SET(fields, 13);
42956 }
42957
42958 differ = (old->defense_strength != real_packet->defense_strength);
42959 if (differ) {
42960 BV_SET(fields, 14);
42961 }
42962
42963 differ = (old->move_rate != real_packet->move_rate);
42964 if (differ) {
42965 BV_SET(fields, 15);
42966 }
42967
42968 differ = (old->build_reqs_count != real_packet->build_reqs_count);
42969 if (differ) {
42970 BV_SET(fields, 16);
42971 }
42972
42973 differ = (old->build_reqs_count != real_packet->build_reqs_count);
42974 if (!differ) {
42975 int i;
42976
42977 for (i = 0; i < real_packet->build_reqs_count; i++) {
42978 differ = !are_requirements_equal(&old->build_reqs[i], &real_packet->build_reqs[i]);
42979 if (differ) {
42980 break;
42981 }
42982 }
42983 }
42984 if (differ) {
42985 BV_SET(fields, 17);
42986 }
42987
42988 differ = (old->vision_radius_sq != real_packet->vision_radius_sq);
42989 if (differ) {
42990 BV_SET(fields, 18);
42991 }
42992
42993 differ = (old->transport_capacity != real_packet->transport_capacity);
42994 if (differ) {
42995 BV_SET(fields, 19);
42996 }
42997
42998 differ = (old->hp != real_packet->hp);
42999 if (differ) {
43000 BV_SET(fields, 20);
43001 }
43002
43003 differ = (old->firepower != real_packet->firepower);
43004 if (differ) {
43005 BV_SET(fields, 21);
43006 }
43007
43008 differ = (old->obsoleted_by != real_packet->obsoleted_by);
43009 if (differ) {
43010 BV_SET(fields, 22);
43011 }
43012
43013 differ = (old->converted_to != real_packet->converted_to);
43014 if (differ) {
43015 BV_SET(fields, 23);
43016 }
43017
43018 differ = (old->convert_time != real_packet->convert_time);
43019 if (differ) {
43020 BV_SET(fields, 24);
43021 }
43022
43023 differ = (old->fuel != real_packet->fuel);
43024 if (differ) {
43025 BV_SET(fields, 25);
43026 }
43027
43028 differ = (old->happy_cost != real_packet->happy_cost);
43029 if (differ) {
43030 BV_SET(fields, 26);
43031 }
43032
43033 differ = FALSE;
43034 {
43035 int i;
43036
43037 for (i = 0; i < O_LAST; i++) {
43038 differ = (old->upkeep[i] != real_packet->upkeep[i]);
43039 if (differ) {
43040 break;
43041 }
43042 }
43043 }
43044 if (differ) {
43045 BV_SET(fields, 27);
43046 }
43047
43048 differ = (old->paratroopers_range != real_packet->paratroopers_range);
43049 if (differ) {
43050 BV_SET(fields, 28);
43051 }
43052
43053 differ = (old->veteran_levels != real_packet->veteran_levels);
43054 if (differ) {
43055 BV_SET(fields, 29);
43056 }
43057
43058 differ = (old->veteran_levels != real_packet->veteran_levels);
43059 if (!differ) {
43060 int i;
43061
43062 for (i = 0; i < real_packet->veteran_levels; i++) {
43063 differ = (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0);
43064 if (differ) {
43065 break;
43066 }
43067 }
43068 }
43069 if (differ) {
43070 BV_SET(fields, 30);
43071 }
43072
43073 differ = (old->veteran_levels != real_packet->veteran_levels);
43074 if (!differ) {
43075 int i;
43076
43077 for (i = 0; i < real_packet->veteran_levels; i++) {
43078 differ = (old->power_fact[i] != real_packet->power_fact[i]);
43079 if (differ) {
43080 break;
43081 }
43082 }
43083 }
43084 if (differ) {
43085 BV_SET(fields, 31);
43086 }
43087
43088 differ = (old->veteran_levels != real_packet->veteran_levels);
43089 if (!differ) {
43090 int i;
43091
43092 for (i = 0; i < real_packet->veteran_levels; i++) {
43093 differ = (old->move_bonus[i] != real_packet->move_bonus[i]);
43094 if (differ) {
43095 break;
43096 }
43097 }
43098 }
43099 if (differ) {
43100 BV_SET(fields, 32);
43101 }
43102
43103 differ = (old->veteran_levels != real_packet->veteran_levels);
43104 if (!differ) {
43105 int i;
43106
43107 for (i = 0; i < real_packet->veteran_levels; i++) {
43108 differ = (old->base_raise_chance[i] != real_packet->base_raise_chance[i]);
43109 if (differ) {
43110 break;
43111 }
43112 }
43113 }
43114 if (differ) {
43115 BV_SET(fields, 33);
43116 }
43117
43118 differ = (old->veteran_levels != real_packet->veteran_levels);
43119 if (!differ) {
43120 int i;
43121
43122 for (i = 0; i < real_packet->veteran_levels; i++) {
43123 differ = (old->work_raise_chance[i] != real_packet->work_raise_chance[i]);
43124 if (differ) {
43125 break;
43126 }
43127 }
43128 }
43129 if (differ) {
43130 BV_SET(fields, 34);
43131 }
43132
43133 differ = (old->bombard_rate != real_packet->bombard_rate);
43134 if (differ) {
43135 BV_SET(fields, 35);
43136 }
43137
43138 differ = (old->city_size != real_packet->city_size);
43139 if (differ) {
43140 BV_SET(fields, 36);
43141 }
43142
43143 differ = (old->city_slots != real_packet->city_slots);
43144 if (differ) {
43145 BV_SET(fields, 37);
43146 }
43147
43148 differ = (old->tp_defense != real_packet->tp_defense);
43149 if (differ) {
43150 BV_SET(fields, 38);
43151 }
43152
43153 differ = !BV_ARE_EQUAL(old->cargo, real_packet->cargo);
43154 if (differ) {
43155 BV_SET(fields, 39);
43156 }
43157
43158 differ = !BV_ARE_EQUAL(old->targets, real_packet->targets);
43159 if (differ) {
43160 BV_SET(fields, 40);
43161 }
43162
43163 differ = !BV_ARE_EQUAL(old->embarks, real_packet->embarks);
43164 if (differ) {
43165 BV_SET(fields, 41);
43166 }
43167
43168 differ = !BV_ARE_EQUAL(old->disembarks, real_packet->disembarks);
43169 if (differ) {
43170 BV_SET(fields, 42);
43171 }
43172
43173 differ = (old->vlayer != real_packet->vlayer);
43174 if (differ) {
43175 BV_SET(fields, 43);
43176 }
43177
43178 if (real_packet->helptext) {
43179 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
43180 } else {
43181 differ = (strvec_size(old->helptext) > 0);
43182 }
43183 if (differ) {
43184 BV_SET(fields, 44);
43185 }
43186
43187 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
43188 if (differ) {
43189 BV_SET(fields, 45);
43190 }
43191
43192 differ = !BV_ARE_EQUAL(old->roles, real_packet->roles);
43193 if (differ) {
43194 BV_SET(fields, 46);
43195 }
43196
43197 if (packet->worker) {
43198 BV_SET(fields, 47);
43199 }
43200
43201
43202#ifdef FREECIV_JSON_CONNECTION
43203 field_addr.name = "fields";
43204#endif /* FREECIV_JSON_CONNECTION */
43205 e = 0;
43206 e |= DIO_BV_PUT(&dout, &field_addr, fields);
43207 if (e) {
43208 log_packet_detailed("fields bitvector error detected");
43209 }
43210
43211 if (BV_ISSET(fields, 0)) {
43212 log_packet_detailed(" field 'id' has changed");
43213#ifdef FREECIV_JSON_CONNECTION
43214 field_addr.name = "id";
43215#endif /* FREECIV_JSON_CONNECTION */
43216 e = 0;
43217 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
43218 if (e) {
43219 log_packet_detailed("'id' field error detected");
43220 }
43221 }
43222 if (BV_ISSET(fields, 1)) {
43223 log_packet_detailed(" field 'name' has changed");
43224#ifdef FREECIV_JSON_CONNECTION
43225 field_addr.name = "name";
43226#endif /* FREECIV_JSON_CONNECTION */
43227 e = 0;
43228 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
43229 if (e) {
43230 log_packet_detailed("'name' field error detected");
43231 }
43232 }
43233 if (BV_ISSET(fields, 2)) {
43234 log_packet_detailed(" field 'rule_name' has changed");
43235#ifdef FREECIV_JSON_CONNECTION
43236 field_addr.name = "rule_name";
43237#endif /* FREECIV_JSON_CONNECTION */
43238 e = 0;
43239 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
43240 if (e) {
43241 log_packet_detailed("'rule_name' field error detected");
43242 }
43243 }
43244 if (BV_ISSET(fields, 3)) {
43245 log_packet_detailed(" field 'graphic_str' has changed");
43246#ifdef FREECIV_JSON_CONNECTION
43247 field_addr.name = "graphic_str";
43248#endif /* FREECIV_JSON_CONNECTION */
43249 e = 0;
43250 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
43251 if (e) {
43252 log_packet_detailed("'graphic_str' field error detected");
43253 }
43254 }
43255 if (BV_ISSET(fields, 4)) {
43256 log_packet_detailed(" field 'graphic_alt' has changed");
43257#ifdef FREECIV_JSON_CONNECTION
43258 field_addr.name = "graphic_alt";
43259#endif /* FREECIV_JSON_CONNECTION */
43260 e = 0;
43261 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
43262 if (e) {
43263 log_packet_detailed("'graphic_alt' field error detected");
43264 }
43265 }
43266 if (BV_ISSET(fields, 5)) {
43267 log_packet_detailed(" field 'graphic_alt2' has changed");
43268#ifdef FREECIV_JSON_CONNECTION
43269 field_addr.name = "graphic_alt2";
43270#endif /* FREECIV_JSON_CONNECTION */
43271 e = 0;
43272 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
43273 if (e) {
43274 log_packet_detailed("'graphic_alt2' field error detected");
43275 }
43276 }
43277 if (BV_ISSET(fields, 6)) {
43278 log_packet_detailed(" field 'sound_move' has changed");
43279#ifdef FREECIV_JSON_CONNECTION
43280 field_addr.name = "sound_move";
43281#endif /* FREECIV_JSON_CONNECTION */
43282 e = 0;
43283 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move);
43284 if (e) {
43285 log_packet_detailed("'sound_move' field error detected");
43286 }
43287 }
43288 if (BV_ISSET(fields, 7)) {
43289 log_packet_detailed(" field 'sound_move_alt' has changed");
43290#ifdef FREECIV_JSON_CONNECTION
43291 field_addr.name = "sound_move_alt";
43292#endif /* FREECIV_JSON_CONNECTION */
43293 e = 0;
43294 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move_alt);
43295 if (e) {
43296 log_packet_detailed("'sound_move_alt' field error detected");
43297 }
43298 }
43299 if (BV_ISSET(fields, 8)) {
43300 log_packet_detailed(" field 'sound_fight' has changed");
43301#ifdef FREECIV_JSON_CONNECTION
43302 field_addr.name = "sound_fight";
43303#endif /* FREECIV_JSON_CONNECTION */
43304 e = 0;
43305 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight);
43306 if (e) {
43307 log_packet_detailed("'sound_fight' field error detected");
43308 }
43309 }
43310 if (BV_ISSET(fields, 9)) {
43311 log_packet_detailed(" field 'sound_fight_alt' has changed");
43312#ifdef FREECIV_JSON_CONNECTION
43313 field_addr.name = "sound_fight_alt";
43314#endif /* FREECIV_JSON_CONNECTION */
43315 e = 0;
43316 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight_alt);
43317 if (e) {
43318 log_packet_detailed("'sound_fight_alt' field error detected");
43319 }
43320 }
43321 if (BV_ISSET(fields, 10)) {
43322 log_packet_detailed(" field 'unit_class_id' has changed");
43323#ifdef FREECIV_JSON_CONNECTION
43324 field_addr.name = "unit_class_id";
43325#endif /* FREECIV_JSON_CONNECTION */
43326 e = 0;
43327 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->unit_class_id);
43328 if (e) {
43329 log_packet_detailed("'unit_class_id' field error detected");
43330 }
43331 }
43332 if (BV_ISSET(fields, 11)) {
43333 log_packet_detailed(" field 'build_cost' has changed");
43334#ifdef FREECIV_JSON_CONNECTION
43335 field_addr.name = "build_cost";
43336#endif /* FREECIV_JSON_CONNECTION */
43337 e = 0;
43338 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
43339 if (e) {
43340 log_packet_detailed("'build_cost' field error detected");
43341 }
43342 }
43343 if (BV_ISSET(fields, 12)) {
43344 log_packet_detailed(" field 'pop_cost' has changed");
43345#ifdef FREECIV_JSON_CONNECTION
43346 field_addr.name = "pop_cost";
43347#endif /* FREECIV_JSON_CONNECTION */
43348 e = 0;
43349 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_cost);
43350 if (e) {
43351 log_packet_detailed("'pop_cost' field error detected");
43352 }
43353 }
43354 if (BV_ISSET(fields, 13)) {
43355 log_packet_detailed(" field 'attack_strength' has changed");
43356#ifdef FREECIV_JSON_CONNECTION
43357 field_addr.name = "attack_strength";
43358#endif /* FREECIV_JSON_CONNECTION */
43359 e = 0;
43360 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attack_strength);
43361 if (e) {
43362 log_packet_detailed("'attack_strength' field error detected");
43363 }
43364 }
43365 if (BV_ISSET(fields, 14)) {
43366 log_packet_detailed(" field 'defense_strength' has changed");
43367#ifdef FREECIV_JSON_CONNECTION
43368 field_addr.name = "defense_strength";
43369#endif /* FREECIV_JSON_CONNECTION */
43370 e = 0;
43371 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_strength);
43372 if (e) {
43373 log_packet_detailed("'defense_strength' field error detected");
43374 }
43375 }
43376 if (BV_ISSET(fields, 15)) {
43377 log_packet_detailed(" field 'move_rate' has changed");
43378#ifdef FREECIV_JSON_CONNECTION
43379 field_addr.name = "move_rate";
43380#endif /* FREECIV_JSON_CONNECTION */
43381 e = 0;
43382 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_rate);
43383 if (e) {
43384 log_packet_detailed("'move_rate' field error detected");
43385 }
43386 }
43387 if (BV_ISSET(fields, 16)) {
43388 log_packet_detailed(" field 'build_reqs_count' has changed");
43389#ifdef FREECIV_JSON_CONNECTION
43390 field_addr.name = "build_reqs_count";
43391#endif /* FREECIV_JSON_CONNECTION */
43392 e = 0;
43393 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_reqs_count);
43394 if (e) {
43395 log_packet_detailed("'build_reqs_count' field error detected");
43396 }
43397 }
43398 if (BV_ISSET(fields, 17)) {
43399 log_packet_detailed(" field 'build_reqs' has changed");
43400#ifdef FREECIV_JSON_CONNECTION
43401 field_addr.name = "build_reqs";
43402#endif /* FREECIV_JSON_CONNECTION */
43403 e = 0;
43404 {
43405 int i;
43406
43407#ifdef FREECIV_JSON_CONNECTION
43408 /* Create the array. */
43409 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->build_reqs_count);
43410
43411 /* Enter the array. */
43412 field_addr.sub_location = plocation_elem_new(0);
43413#endif /* FREECIV_JSON_CONNECTION */
43414
43415 for (i = 0; i < real_packet->build_reqs_count; i++) {
43416#ifdef FREECIV_JSON_CONNECTION
43417 /* Next array element. */
43418 field_addr.sub_location->number = i;
43419#endif /* FREECIV_JSON_CONNECTION */
43420 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->build_reqs[i]);
43421 }
43422
43423#ifdef FREECIV_JSON_CONNECTION
43424 /* Exit array. */
43425 FC_FREE(field_addr.sub_location);
43426#endif /* FREECIV_JSON_CONNECTION */
43427 }
43428 if (e) {
43429 log_packet_detailed("'build_reqs' field error detected");
43430 }
43431 }
43432 if (BV_ISSET(fields, 18)) {
43433 log_packet_detailed(" field 'vision_radius_sq' has changed");
43434#ifdef FREECIV_JSON_CONNECTION
43435 field_addr.name = "vision_radius_sq";
43436#endif /* FREECIV_JSON_CONNECTION */
43437 e = 0;
43438 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->vision_radius_sq);
43439 if (e) {
43440 log_packet_detailed("'vision_radius_sq' field error detected");
43441 }
43442 }
43443 if (BV_ISSET(fields, 19)) {
43444 log_packet_detailed(" field 'transport_capacity' has changed");
43445#ifdef FREECIV_JSON_CONNECTION
43446 field_addr.name = "transport_capacity";
43447#endif /* FREECIV_JSON_CONNECTION */
43448 e = 0;
43449 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transport_capacity);
43450 if (e) {
43451 log_packet_detailed("'transport_capacity' field error detected");
43452 }
43453 }
43454 if (BV_ISSET(fields, 20)) {
43455 log_packet_detailed(" field 'hp' has changed");
43456#ifdef FREECIV_JSON_CONNECTION
43457 field_addr.name = "hp";
43458#endif /* FREECIV_JSON_CONNECTION */
43459 e = 0;
43460 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
43461 if (e) {
43462 log_packet_detailed("'hp' field error detected");
43463 }
43464 }
43465 if (BV_ISSET(fields, 21)) {
43466 log_packet_detailed(" field 'firepower' has changed");
43467#ifdef FREECIV_JSON_CONNECTION
43468 field_addr.name = "firepower";
43469#endif /* FREECIV_JSON_CONNECTION */
43470 e = 0;
43471 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->firepower);
43472 if (e) {
43473 log_packet_detailed("'firepower' field error detected");
43474 }
43475 }
43476 if (BV_ISSET(fields, 22)) {
43477 log_packet_detailed(" field 'obsoleted_by' has changed");
43478#ifdef FREECIV_JSON_CONNECTION
43479 field_addr.name = "obsoleted_by";
43480#endif /* FREECIV_JSON_CONNECTION */
43481 e = 0;
43482 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obsoleted_by);
43483 if (e) {
43484 log_packet_detailed("'obsoleted_by' field error detected");
43485 }
43486 }
43487 if (BV_ISSET(fields, 23)) {
43488 log_packet_detailed(" field 'converted_to' has changed");
43489#ifdef FREECIV_JSON_CONNECTION
43490 field_addr.name = "converted_to";
43491#endif /* FREECIV_JSON_CONNECTION */
43492 e = 0;
43493 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->converted_to);
43494 if (e) {
43495 log_packet_detailed("'converted_to' field error detected");
43496 }
43497 }
43498 if (BV_ISSET(fields, 24)) {
43499 log_packet_detailed(" field 'convert_time' has changed");
43500#ifdef FREECIV_JSON_CONNECTION
43501 field_addr.name = "convert_time";
43502#endif /* FREECIV_JSON_CONNECTION */
43503 e = 0;
43504 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->convert_time);
43505 if (e) {
43506 log_packet_detailed("'convert_time' field error detected");
43507 }
43508 }
43509 if (BV_ISSET(fields, 25)) {
43510 log_packet_detailed(" field 'fuel' has changed");
43511#ifdef FREECIV_JSON_CONNECTION
43512 field_addr.name = "fuel";
43513#endif /* FREECIV_JSON_CONNECTION */
43514 e = 0;
43515 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
43516 if (e) {
43517 log_packet_detailed("'fuel' field error detected");
43518 }
43519 }
43520 if (BV_ISSET(fields, 26)) {
43521 log_packet_detailed(" field 'happy_cost' has changed");
43522#ifdef FREECIV_JSON_CONNECTION
43523 field_addr.name = "happy_cost";
43524#endif /* FREECIV_JSON_CONNECTION */
43525 e = 0;
43526 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happy_cost);
43527 if (e) {
43528 log_packet_detailed("'happy_cost' field error detected");
43529 }
43530 }
43531 if (BV_ISSET(fields, 27)) {
43532 log_packet_detailed(" field 'upkeep' has changed");
43533#ifdef FREECIV_JSON_CONNECTION
43534 field_addr.name = "upkeep";
43535#endif /* FREECIV_JSON_CONNECTION */
43536 e = 0;
43537 {
43538 int i;
43539
43540#ifdef FREECIV_JSON_CONNECTION
43541 /* Create the array. */
43542 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
43543
43544 /* Enter the array. */
43545 field_addr.sub_location = plocation_elem_new(0);
43546#endif /* FREECIV_JSON_CONNECTION */
43547
43548 for (i = 0; i < O_LAST; i++) {
43549#ifdef FREECIV_JSON_CONNECTION
43550 /* Next array element. */
43551 field_addr.sub_location->number = i;
43552#endif /* FREECIV_JSON_CONNECTION */
43553 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
43554 }
43555
43556#ifdef FREECIV_JSON_CONNECTION
43557 /* Exit array. */
43558 FC_FREE(field_addr.sub_location);
43559#endif /* FREECIV_JSON_CONNECTION */
43560 }
43561 if (e) {
43562 log_packet_detailed("'upkeep' field error detected");
43563 }
43564 }
43565 if (BV_ISSET(fields, 28)) {
43566 log_packet_detailed(" field 'paratroopers_range' has changed");
43567#ifdef FREECIV_JSON_CONNECTION
43568 field_addr.name = "paratroopers_range";
43569#endif /* FREECIV_JSON_CONNECTION */
43570 e = 0;
43571 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->paratroopers_range);
43572 if (e) {
43573 log_packet_detailed("'paratroopers_range' field error detected");
43574 }
43575 }
43576 if (BV_ISSET(fields, 29)) {
43577 log_packet_detailed(" field 'veteran_levels' has changed");
43578#ifdef FREECIV_JSON_CONNECTION
43579 field_addr.name = "veteran_levels";
43580#endif /* FREECIV_JSON_CONNECTION */
43581 e = 0;
43582 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
43583 if (e) {
43584 log_packet_detailed("'veteran_levels' field error detected");
43585 }
43586 }
43587 if (BV_ISSET(fields, 30)) {
43588 log_packet_detailed(" field 'veteran_name' has changed");
43589#ifdef FREECIV_JSON_CONNECTION
43590 field_addr.name = "veteran_name";
43591#endif /* FREECIV_JSON_CONNECTION */
43592 e = 0;
43593 {
43594 int i;
43595
43596#ifdef FREECIV_JSON_CONNECTION
43597 /* Create the array. */
43598 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
43599
43600 /* Enter the array. */
43601 field_addr.sub_location = plocation_elem_new(0);
43602#endif /* FREECIV_JSON_CONNECTION */
43603
43604 for (i = 0; i < real_packet->veteran_levels; i++) {
43605#ifdef FREECIV_JSON_CONNECTION
43606 /* Next array element. */
43607 field_addr.sub_location->number = i;
43608#endif /* FREECIV_JSON_CONNECTION */
43609 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
43610 }
43611
43612#ifdef FREECIV_JSON_CONNECTION
43613 /* Exit array. */
43614 FC_FREE(field_addr.sub_location);
43615#endif /* FREECIV_JSON_CONNECTION */
43616 }
43617 if (e) {
43618 log_packet_detailed("'veteran_name' field error detected");
43619 }
43620 }
43621 if (BV_ISSET(fields, 31)) {
43622 log_packet_detailed(" field 'power_fact' has changed");
43623#ifdef FREECIV_JSON_CONNECTION
43624 field_addr.name = "power_fact";
43625#endif /* FREECIV_JSON_CONNECTION */
43626 e = 0;
43627 {
43628 int i;
43629
43630#ifdef FREECIV_JSON_CONNECTION
43631 /* Create the array. */
43632 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
43633
43634 /* Enter the array. */
43635 field_addr.sub_location = plocation_elem_new(0);
43636#endif /* FREECIV_JSON_CONNECTION */
43637
43638 for (i = 0; i < real_packet->veteran_levels; i++) {
43639#ifdef FREECIV_JSON_CONNECTION
43640 /* Next array element. */
43641 field_addr.sub_location->number = i;
43642#endif /* FREECIV_JSON_CONNECTION */
43643 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
43644 }
43645
43646#ifdef FREECIV_JSON_CONNECTION
43647 /* Exit array. */
43648 FC_FREE(field_addr.sub_location);
43649#endif /* FREECIV_JSON_CONNECTION */
43650 }
43651 if (e) {
43652 log_packet_detailed("'power_fact' field error detected");
43653 }
43654 }
43655 if (BV_ISSET(fields, 32)) {
43656 log_packet_detailed(" field 'move_bonus' has changed");
43657#ifdef FREECIV_JSON_CONNECTION
43658 field_addr.name = "move_bonus";
43659#endif /* FREECIV_JSON_CONNECTION */
43660 e = 0;
43661 {
43662 int i;
43663
43664#ifdef FREECIV_JSON_CONNECTION
43665 /* Create the array. */
43666 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
43667
43668 /* Enter the array. */
43669 field_addr.sub_location = plocation_elem_new(0);
43670#endif /* FREECIV_JSON_CONNECTION */
43671
43672 for (i = 0; i < real_packet->veteran_levels; i++) {
43673#ifdef FREECIV_JSON_CONNECTION
43674 /* Next array element. */
43675 field_addr.sub_location->number = i;
43676#endif /* FREECIV_JSON_CONNECTION */
43677 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
43678 }
43679
43680#ifdef FREECIV_JSON_CONNECTION
43681 /* Exit array. */
43682 FC_FREE(field_addr.sub_location);
43683#endif /* FREECIV_JSON_CONNECTION */
43684 }
43685 if (e) {
43686 log_packet_detailed("'move_bonus' field error detected");
43687 }
43688 }
43689 if (BV_ISSET(fields, 33)) {
43690 log_packet_detailed(" field 'base_raise_chance' has changed");
43691#ifdef FREECIV_JSON_CONNECTION
43692 field_addr.name = "base_raise_chance";
43693#endif /* FREECIV_JSON_CONNECTION */
43694 e = 0;
43695 {
43696 int i;
43697
43698#ifdef FREECIV_JSON_CONNECTION
43699 /* Create the array. */
43700 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
43701
43702 /* Enter the array. */
43703 field_addr.sub_location = plocation_elem_new(0);
43704#endif /* FREECIV_JSON_CONNECTION */
43705
43706 for (i = 0; i < real_packet->veteran_levels; i++) {
43707#ifdef FREECIV_JSON_CONNECTION
43708 /* Next array element. */
43709 field_addr.sub_location->number = i;
43710#endif /* FREECIV_JSON_CONNECTION */
43711 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
43712 }
43713
43714#ifdef FREECIV_JSON_CONNECTION
43715 /* Exit array. */
43716 FC_FREE(field_addr.sub_location);
43717#endif /* FREECIV_JSON_CONNECTION */
43718 }
43719 if (e) {
43720 log_packet_detailed("'base_raise_chance' field error detected");
43721 }
43722 }
43723 if (BV_ISSET(fields, 34)) {
43724 log_packet_detailed(" field 'work_raise_chance' has changed");
43725#ifdef FREECIV_JSON_CONNECTION
43726 field_addr.name = "work_raise_chance";
43727#endif /* FREECIV_JSON_CONNECTION */
43728 e = 0;
43729 {
43730 int i;
43731
43732#ifdef FREECIV_JSON_CONNECTION
43733 /* Create the array. */
43734 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
43735
43736 /* Enter the array. */
43737 field_addr.sub_location = plocation_elem_new(0);
43738#endif /* FREECIV_JSON_CONNECTION */
43739
43740 for (i = 0; i < real_packet->veteran_levels; i++) {
43741#ifdef FREECIV_JSON_CONNECTION
43742 /* Next array element. */
43743 field_addr.sub_location->number = i;
43744#endif /* FREECIV_JSON_CONNECTION */
43745 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
43746 }
43747
43748#ifdef FREECIV_JSON_CONNECTION
43749 /* Exit array. */
43750 FC_FREE(field_addr.sub_location);
43751#endif /* FREECIV_JSON_CONNECTION */
43752 }
43753 if (e) {
43754 log_packet_detailed("'work_raise_chance' field error detected");
43755 }
43756 }
43757 if (BV_ISSET(fields, 35)) {
43758 log_packet_detailed(" field 'bombard_rate' has changed");
43759#ifdef FREECIV_JSON_CONNECTION
43760 field_addr.name = "bombard_rate";
43761#endif /* FREECIV_JSON_CONNECTION */
43762 e = 0;
43763 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bombard_rate);
43764 if (e) {
43765 log_packet_detailed("'bombard_rate' field error detected");
43766 }
43767 }
43768 if (BV_ISSET(fields, 36)) {
43769 log_packet_detailed(" field 'city_size' has changed");
43770#ifdef FREECIV_JSON_CONNECTION
43771 field_addr.name = "city_size";
43772#endif /* FREECIV_JSON_CONNECTION */
43773 e = 0;
43774 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_size);
43775 if (e) {
43776 log_packet_detailed("'city_size' field error detected");
43777 }
43778 }
43779 if (BV_ISSET(fields, 37)) {
43780 log_packet_detailed(" field 'city_slots' has changed");
43781#ifdef FREECIV_JSON_CONNECTION
43782 field_addr.name = "city_slots";
43783#endif /* FREECIV_JSON_CONNECTION */
43784 e = 0;
43785 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_slots);
43786 if (e) {
43787 log_packet_detailed("'city_slots' field error detected");
43788 }
43789 }
43790 if (BV_ISSET(fields, 38)) {
43791 log_packet_detailed(" field 'tp_defense' has changed");
43792#ifdef FREECIV_JSON_CONNECTION
43793 field_addr.name = "tp_defense";
43794#endif /* FREECIV_JSON_CONNECTION */
43795 e = 0;
43796 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tp_defense);
43797 if (e) {
43798 log_packet_detailed("'tp_defense' field error detected");
43799 }
43800 }
43801 if (BV_ISSET(fields, 39)) {
43802 log_packet_detailed(" field 'cargo' has changed");
43803#ifdef FREECIV_JSON_CONNECTION
43804 field_addr.name = "cargo";
43805#endif /* FREECIV_JSON_CONNECTION */
43806 e = 0;
43807 e |= DIO_BV_PUT(&dout, &field_addr, packet->cargo);
43808 if (e) {
43809 log_packet_detailed("'cargo' field error detected");
43810 }
43811 }
43812 if (BV_ISSET(fields, 40)) {
43813 log_packet_detailed(" field 'targets' has changed");
43814#ifdef FREECIV_JSON_CONNECTION
43815 field_addr.name = "targets";
43816#endif /* FREECIV_JSON_CONNECTION */
43817 e = 0;
43818 e |= DIO_BV_PUT(&dout, &field_addr, packet->targets);
43819 if (e) {
43820 log_packet_detailed("'targets' field error detected");
43821 }
43822 }
43823 if (BV_ISSET(fields, 41)) {
43824 log_packet_detailed(" field 'embarks' has changed");
43825#ifdef FREECIV_JSON_CONNECTION
43826 field_addr.name = "embarks";
43827#endif /* FREECIV_JSON_CONNECTION */
43828 e = 0;
43829 e |= DIO_BV_PUT(&dout, &field_addr, packet->embarks);
43830 if (e) {
43831 log_packet_detailed("'embarks' field error detected");
43832 }
43833 }
43834 if (BV_ISSET(fields, 42)) {
43835 log_packet_detailed(" field 'disembarks' has changed");
43836#ifdef FREECIV_JSON_CONNECTION
43837 field_addr.name = "disembarks";
43838#endif /* FREECIV_JSON_CONNECTION */
43839 e = 0;
43840 e |= DIO_BV_PUT(&dout, &field_addr, packet->disembarks);
43841 if (e) {
43842 log_packet_detailed("'disembarks' field error detected");
43843 }
43844 }
43845 if (BV_ISSET(fields, 43)) {
43846 log_packet_detailed(" field 'vlayer' has changed");
43847#ifdef FREECIV_JSON_CONNECTION
43848 field_addr.name = "vlayer";
43849#endif /* FREECIV_JSON_CONNECTION */
43850 e = 0;
43851 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->vlayer);
43852 if (e) {
43853 log_packet_detailed("'vlayer' field error detected");
43854 }
43855 }
43856 if (BV_ISSET(fields, 44)) {
43857 log_packet_detailed(" field 'helptext' has changed");
43858#ifdef FREECIV_JSON_CONNECTION
43859 field_addr.name = "helptext";
43860#endif /* FREECIV_JSON_CONNECTION */
43861 e = 0;
43862 if (!real_packet->helptext) {
43863 /* Transmit null vector as empty vector */
43864 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
43865 } else {
43866 int i;
43867
43868 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
43869 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
43870
43871#ifdef FREECIV_JSON_CONNECTION
43872 field_addr.sub_location = plocation_elem_new(0);
43873#endif /* FREECIV_JSON_CONNECTION */
43874
43875 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
43876 const char *pstr = strvec_get(real_packet->helptext, i);
43877
43878 if (!pstr) {
43879 /* Transmit null strings as empty strings */
43880 pstr = "";
43881 }
43882
43883#ifdef FREECIV_JSON_CONNECTION
43884 /* Next array element */
43885 field_addr.sub_location->number = i;
43886#endif /* FREECIV_JSON_CONNECTION */
43887
43888 e |= DIO_PUT(string, &dout, &field_addr, pstr);
43889 }
43890
43891#ifdef FREECIV_JSON_CONNECTION
43892 FC_FREE(field_addr.sub_location);
43893#endif /* FREECIV_JSON_CONNECTION */
43894 }
43895 if (e) {
43896 log_packet_detailed("'helptext' field error detected");
43897 }
43898 }
43899 if (BV_ISSET(fields, 45)) {
43900 log_packet_detailed(" field 'flags' has changed");
43901#ifdef FREECIV_JSON_CONNECTION
43902 field_addr.name = "flags";
43903#endif /* FREECIV_JSON_CONNECTION */
43904 e = 0;
43905 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
43906 if (e) {
43907 log_packet_detailed("'flags' field error detected");
43908 }
43909 }
43910 if (BV_ISSET(fields, 46)) {
43911 log_packet_detailed(" field 'roles' has changed");
43912#ifdef FREECIV_JSON_CONNECTION
43913 field_addr.name = "roles";
43914#endif /* FREECIV_JSON_CONNECTION */
43915 e = 0;
43916 e |= DIO_BV_PUT(&dout, &field_addr, packet->roles);
43917 if (e) {
43918 log_packet_detailed("'roles' field error detected");
43919 }
43920 }
43921 /* field 47 is folded into the header */
43922
43923 old->id = real_packet->id;
43924 sz_strlcpy(old->name, real_packet->name);
43925 sz_strlcpy(old->rule_name, real_packet->rule_name);
43926 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
43927 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
43928 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
43929 sz_strlcpy(old->sound_move, real_packet->sound_move);
43930 sz_strlcpy(old->sound_move_alt, real_packet->sound_move_alt);
43931 sz_strlcpy(old->sound_fight, real_packet->sound_fight);
43932 sz_strlcpy(old->sound_fight_alt, real_packet->sound_fight_alt);
43933 old->unit_class_id = real_packet->unit_class_id;
43934 old->build_cost = real_packet->build_cost;
43935 old->pop_cost = real_packet->pop_cost;
43936 old->attack_strength = real_packet->attack_strength;
43937 old->defense_strength = real_packet->defense_strength;
43938 old->move_rate = real_packet->move_rate;
43939 old->build_reqs_count = real_packet->build_reqs_count;
43940 {
43941 int i;
43942
43943 for (i = 0; i < real_packet->build_reqs_count; i++) {
43944 old->build_reqs[i] = real_packet->build_reqs[i];
43945 }
43946 }
43947 old->vision_radius_sq = real_packet->vision_radius_sq;
43948 old->transport_capacity = real_packet->transport_capacity;
43949 old->hp = real_packet->hp;
43950 old->firepower = real_packet->firepower;
43951 old->obsoleted_by = real_packet->obsoleted_by;
43952 old->converted_to = real_packet->converted_to;
43953 old->convert_time = real_packet->convert_time;
43954 old->fuel = real_packet->fuel;
43955 old->happy_cost = real_packet->happy_cost;
43956 {
43957 int i;
43958
43959 for (i = 0; i < O_LAST; i++) {
43960 old->upkeep[i] = real_packet->upkeep[i];
43961 }
43962 }
43963 old->paratroopers_range = real_packet->paratroopers_range;
43964 old->veteran_levels = real_packet->veteran_levels;
43965 {
43966 int i;
43967
43968 for (i = 0; i < real_packet->veteran_levels; i++) {
43969 sz_strlcpy(old->veteran_name[i], real_packet->veteran_name[i]);
43970 }
43971 }
43972 {
43973 int i;
43974
43975 for (i = 0; i < real_packet->veteran_levels; i++) {
43976 old->power_fact[i] = real_packet->power_fact[i];
43977 }
43978 }
43979 {
43980 int i;
43981
43982 for (i = 0; i < real_packet->veteran_levels; i++) {
43983 old->move_bonus[i] = real_packet->move_bonus[i];
43984 }
43985 }
43986 {
43987 int i;
43988
43989 for (i = 0; i < real_packet->veteran_levels; i++) {
43990 old->base_raise_chance[i] = real_packet->base_raise_chance[i];
43991 }
43992 }
43993 {
43994 int i;
43995
43996 for (i = 0; i < real_packet->veteran_levels; i++) {
43997 old->work_raise_chance[i] = real_packet->work_raise_chance[i];
43998 }
43999 }
44000 old->bombard_rate = real_packet->bombard_rate;
44001 old->city_size = real_packet->city_size;
44002 old->city_slots = real_packet->city_slots;
44003 old->tp_defense = real_packet->tp_defense;
44004 old->cargo = real_packet->cargo;
44005 old->targets = real_packet->targets;
44006 old->embarks = real_packet->embarks;
44007 old->disembarks = real_packet->disembarks;
44008 old->vlayer = real_packet->vlayer;
44009 if (real_packet->helptext) {
44010 strvec_copy(old->helptext, real_packet->helptext);
44011 } else {
44012 strvec_clear(old->helptext);
44013 }
44014 old->flags = real_packet->flags;
44015 old->roles = real_packet->roles;
44016 old->worker = real_packet->worker;
44017#endif /* FREECIV_DELTA_PROTOCOL */
44018#ifndef FREECIV_DELTA_PROTOCOL
44019#ifdef FREECIV_JSON_CONNECTION
44020 field_addr.name = "id";
44021#endif /* FREECIV_JSON_CONNECTION */
44022 e = 0;
44023 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
44024 if (e) {
44025 log_packet_detailed("'id' field error detected");
44026 }
44027#ifdef FREECIV_JSON_CONNECTION
44028 field_addr.name = "name";
44029#endif /* FREECIV_JSON_CONNECTION */
44030 e = 0;
44031 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
44032 if (e) {
44033 log_packet_detailed("'name' field error detected");
44034 }
44035#ifdef FREECIV_JSON_CONNECTION
44036 field_addr.name = "rule_name";
44037#endif /* FREECIV_JSON_CONNECTION */
44038 e = 0;
44039 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
44040 if (e) {
44041 log_packet_detailed("'rule_name' field error detected");
44042 }
44043#ifdef FREECIV_JSON_CONNECTION
44044 field_addr.name = "graphic_str";
44045#endif /* FREECIV_JSON_CONNECTION */
44046 e = 0;
44047 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
44048 if (e) {
44049 log_packet_detailed("'graphic_str' field error detected");
44050 }
44051#ifdef FREECIV_JSON_CONNECTION
44052 field_addr.name = "graphic_alt";
44053#endif /* FREECIV_JSON_CONNECTION */
44054 e = 0;
44055 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
44056 if (e) {
44057 log_packet_detailed("'graphic_alt' field error detected");
44058 }
44059#ifdef FREECIV_JSON_CONNECTION
44060 field_addr.name = "graphic_alt2";
44061#endif /* FREECIV_JSON_CONNECTION */
44062 e = 0;
44063 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
44064 if (e) {
44065 log_packet_detailed("'graphic_alt2' field error detected");
44066 }
44067#ifdef FREECIV_JSON_CONNECTION
44068 field_addr.name = "sound_move";
44069#endif /* FREECIV_JSON_CONNECTION */
44070 e = 0;
44071 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move);
44072 if (e) {
44073 log_packet_detailed("'sound_move' field error detected");
44074 }
44075#ifdef FREECIV_JSON_CONNECTION
44076 field_addr.name = "sound_move_alt";
44077#endif /* FREECIV_JSON_CONNECTION */
44078 e = 0;
44079 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move_alt);
44080 if (e) {
44081 log_packet_detailed("'sound_move_alt' field error detected");
44082 }
44083#ifdef FREECIV_JSON_CONNECTION
44084 field_addr.name = "sound_fight";
44085#endif /* FREECIV_JSON_CONNECTION */
44086 e = 0;
44087 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight);
44088 if (e) {
44089 log_packet_detailed("'sound_fight' field error detected");
44090 }
44091#ifdef FREECIV_JSON_CONNECTION
44092 field_addr.name = "sound_fight_alt";
44093#endif /* FREECIV_JSON_CONNECTION */
44094 e = 0;
44095 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight_alt);
44096 if (e) {
44097 log_packet_detailed("'sound_fight_alt' field error detected");
44098 }
44099#ifdef FREECIV_JSON_CONNECTION
44100 field_addr.name = "unit_class_id";
44101#endif /* FREECIV_JSON_CONNECTION */
44102 e = 0;
44103 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->unit_class_id);
44104 if (e) {
44105 log_packet_detailed("'unit_class_id' field error detected");
44106 }
44107#ifdef FREECIV_JSON_CONNECTION
44108 field_addr.name = "build_cost";
44109#endif /* FREECIV_JSON_CONNECTION */
44110 e = 0;
44111 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
44112 if (e) {
44113 log_packet_detailed("'build_cost' field error detected");
44114 }
44115#ifdef FREECIV_JSON_CONNECTION
44116 field_addr.name = "pop_cost";
44117#endif /* FREECIV_JSON_CONNECTION */
44118 e = 0;
44119 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_cost);
44120 if (e) {
44121 log_packet_detailed("'pop_cost' field error detected");
44122 }
44123#ifdef FREECIV_JSON_CONNECTION
44124 field_addr.name = "attack_strength";
44125#endif /* FREECIV_JSON_CONNECTION */
44126 e = 0;
44127 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attack_strength);
44128 if (e) {
44129 log_packet_detailed("'attack_strength' field error detected");
44130 }
44131#ifdef FREECIV_JSON_CONNECTION
44132 field_addr.name = "defense_strength";
44133#endif /* FREECIV_JSON_CONNECTION */
44134 e = 0;
44135 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_strength);
44136 if (e) {
44137 log_packet_detailed("'defense_strength' field error detected");
44138 }
44139#ifdef FREECIV_JSON_CONNECTION
44140 field_addr.name = "move_rate";
44141#endif /* FREECIV_JSON_CONNECTION */
44142 e = 0;
44143 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_rate);
44144 if (e) {
44145 log_packet_detailed("'move_rate' field error detected");
44146 }
44147#ifdef FREECIV_JSON_CONNECTION
44148 field_addr.name = "build_reqs_count";
44149#endif /* FREECIV_JSON_CONNECTION */
44150 e = 0;
44151 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_reqs_count);
44152 if (e) {
44153 log_packet_detailed("'build_reqs_count' field error detected");
44154 }
44155#ifdef FREECIV_JSON_CONNECTION
44156 field_addr.name = "build_reqs";
44157#endif /* FREECIV_JSON_CONNECTION */
44158 e = 0;
44159 {
44160 int i;
44161
44162#ifdef FREECIV_JSON_CONNECTION
44163 /* Create the array. */
44164 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->build_reqs_count);
44165
44166 /* Enter the array. */
44167 field_addr.sub_location = plocation_elem_new(0);
44168#endif /* FREECIV_JSON_CONNECTION */
44169
44170 for (i = 0; i < real_packet->build_reqs_count; i++) {
44171#ifdef FREECIV_JSON_CONNECTION
44172 /* Next array element. */
44173 field_addr.sub_location->number = i;
44174#endif /* FREECIV_JSON_CONNECTION */
44175 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->build_reqs[i]);
44176 }
44177
44178#ifdef FREECIV_JSON_CONNECTION
44179 /* Exit array. */
44180 FC_FREE(field_addr.sub_location);
44181#endif /* FREECIV_JSON_CONNECTION */
44182 }
44183 if (e) {
44184 log_packet_detailed("'build_reqs' field error detected");
44185 }
44186#ifdef FREECIV_JSON_CONNECTION
44187 field_addr.name = "vision_radius_sq";
44188#endif /* FREECIV_JSON_CONNECTION */
44189 e = 0;
44190 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->vision_radius_sq);
44191 if (e) {
44192 log_packet_detailed("'vision_radius_sq' field error detected");
44193 }
44194#ifdef FREECIV_JSON_CONNECTION
44195 field_addr.name = "transport_capacity";
44196#endif /* FREECIV_JSON_CONNECTION */
44197 e = 0;
44198 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transport_capacity);
44199 if (e) {
44200 log_packet_detailed("'transport_capacity' field error detected");
44201 }
44202#ifdef FREECIV_JSON_CONNECTION
44203 field_addr.name = "hp";
44204#endif /* FREECIV_JSON_CONNECTION */
44205 e = 0;
44206 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
44207 if (e) {
44208 log_packet_detailed("'hp' field error detected");
44209 }
44210#ifdef FREECIV_JSON_CONNECTION
44211 field_addr.name = "firepower";
44212#endif /* FREECIV_JSON_CONNECTION */
44213 e = 0;
44214 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->firepower);
44215 if (e) {
44216 log_packet_detailed("'firepower' field error detected");
44217 }
44218#ifdef FREECIV_JSON_CONNECTION
44219 field_addr.name = "obsoleted_by";
44220#endif /* FREECIV_JSON_CONNECTION */
44221 e = 0;
44222 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obsoleted_by);
44223 if (e) {
44224 log_packet_detailed("'obsoleted_by' field error detected");
44225 }
44226#ifdef FREECIV_JSON_CONNECTION
44227 field_addr.name = "converted_to";
44228#endif /* FREECIV_JSON_CONNECTION */
44229 e = 0;
44230 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->converted_to);
44231 if (e) {
44232 log_packet_detailed("'converted_to' field error detected");
44233 }
44234#ifdef FREECIV_JSON_CONNECTION
44235 field_addr.name = "convert_time";
44236#endif /* FREECIV_JSON_CONNECTION */
44237 e = 0;
44238 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->convert_time);
44239 if (e) {
44240 log_packet_detailed("'convert_time' field error detected");
44241 }
44242#ifdef FREECIV_JSON_CONNECTION
44243 field_addr.name = "fuel";
44244#endif /* FREECIV_JSON_CONNECTION */
44245 e = 0;
44246 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
44247 if (e) {
44248 log_packet_detailed("'fuel' field error detected");
44249 }
44250#ifdef FREECIV_JSON_CONNECTION
44251 field_addr.name = "happy_cost";
44252#endif /* FREECIV_JSON_CONNECTION */
44253 e = 0;
44254 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happy_cost);
44255 if (e) {
44256 log_packet_detailed("'happy_cost' field error detected");
44257 }
44258#ifdef FREECIV_JSON_CONNECTION
44259 field_addr.name = "upkeep";
44260#endif /* FREECIV_JSON_CONNECTION */
44261 e = 0;
44262 {
44263 int i;
44264
44265#ifdef FREECIV_JSON_CONNECTION
44266 /* Create the array. */
44267 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
44268
44269 /* Enter the array. */
44270 field_addr.sub_location = plocation_elem_new(0);
44271#endif /* FREECIV_JSON_CONNECTION */
44272
44273 for (i = 0; i < O_LAST; i++) {
44274#ifdef FREECIV_JSON_CONNECTION
44275 /* Next array element. */
44276 field_addr.sub_location->number = i;
44277#endif /* FREECIV_JSON_CONNECTION */
44278 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
44279 }
44280
44281#ifdef FREECIV_JSON_CONNECTION
44282 /* Exit array. */
44283 FC_FREE(field_addr.sub_location);
44284#endif /* FREECIV_JSON_CONNECTION */
44285 }
44286 if (e) {
44287 log_packet_detailed("'upkeep' field error detected");
44288 }
44289#ifdef FREECIV_JSON_CONNECTION
44290 field_addr.name = "paratroopers_range";
44291#endif /* FREECIV_JSON_CONNECTION */
44292 e = 0;
44293 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->paratroopers_range);
44294 if (e) {
44295 log_packet_detailed("'paratroopers_range' field error detected");
44296 }
44297#ifdef FREECIV_JSON_CONNECTION
44298 field_addr.name = "veteran_levels";
44299#endif /* FREECIV_JSON_CONNECTION */
44300 e = 0;
44301 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
44302 if (e) {
44303 log_packet_detailed("'veteran_levels' field error detected");
44304 }
44305#ifdef FREECIV_JSON_CONNECTION
44306 field_addr.name = "veteran_name";
44307#endif /* FREECIV_JSON_CONNECTION */
44308 e = 0;
44309 {
44310 int i;
44311
44312#ifdef FREECIV_JSON_CONNECTION
44313 /* Create the array. */
44314 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44315
44316 /* Enter the array. */
44317 field_addr.sub_location = plocation_elem_new(0);
44318#endif /* FREECIV_JSON_CONNECTION */
44319
44320 for (i = 0; i < real_packet->veteran_levels; i++) {
44321#ifdef FREECIV_JSON_CONNECTION
44322 /* Next array element. */
44323 field_addr.sub_location->number = i;
44324#endif /* FREECIV_JSON_CONNECTION */
44325 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
44326 }
44327
44328#ifdef FREECIV_JSON_CONNECTION
44329 /* Exit array. */
44330 FC_FREE(field_addr.sub_location);
44331#endif /* FREECIV_JSON_CONNECTION */
44332 }
44333 if (e) {
44334 log_packet_detailed("'veteran_name' field error detected");
44335 }
44336#ifdef FREECIV_JSON_CONNECTION
44337 field_addr.name = "power_fact";
44338#endif /* FREECIV_JSON_CONNECTION */
44339 e = 0;
44340 {
44341 int i;
44342
44343#ifdef FREECIV_JSON_CONNECTION
44344 /* Create the array. */
44345 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44346
44347 /* Enter the array. */
44348 field_addr.sub_location = plocation_elem_new(0);
44349#endif /* FREECIV_JSON_CONNECTION */
44350
44351 for (i = 0; i < real_packet->veteran_levels; i++) {
44352#ifdef FREECIV_JSON_CONNECTION
44353 /* Next array element. */
44354 field_addr.sub_location->number = i;
44355#endif /* FREECIV_JSON_CONNECTION */
44356 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
44357 }
44358
44359#ifdef FREECIV_JSON_CONNECTION
44360 /* Exit array. */
44361 FC_FREE(field_addr.sub_location);
44362#endif /* FREECIV_JSON_CONNECTION */
44363 }
44364 if (e) {
44365 log_packet_detailed("'power_fact' field error detected");
44366 }
44367#ifdef FREECIV_JSON_CONNECTION
44368 field_addr.name = "move_bonus";
44369#endif /* FREECIV_JSON_CONNECTION */
44370 e = 0;
44371 {
44372 int i;
44373
44374#ifdef FREECIV_JSON_CONNECTION
44375 /* Create the array. */
44376 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44377
44378 /* Enter the array. */
44379 field_addr.sub_location = plocation_elem_new(0);
44380#endif /* FREECIV_JSON_CONNECTION */
44381
44382 for (i = 0; i < real_packet->veteran_levels; i++) {
44383#ifdef FREECIV_JSON_CONNECTION
44384 /* Next array element. */
44385 field_addr.sub_location->number = i;
44386#endif /* FREECIV_JSON_CONNECTION */
44387 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
44388 }
44389
44390#ifdef FREECIV_JSON_CONNECTION
44391 /* Exit array. */
44392 FC_FREE(field_addr.sub_location);
44393#endif /* FREECIV_JSON_CONNECTION */
44394 }
44395 if (e) {
44396 log_packet_detailed("'move_bonus' field error detected");
44397 }
44398#ifdef FREECIV_JSON_CONNECTION
44399 field_addr.name = "base_raise_chance";
44400#endif /* FREECIV_JSON_CONNECTION */
44401 e = 0;
44402 {
44403 int i;
44404
44405#ifdef FREECIV_JSON_CONNECTION
44406 /* Create the array. */
44407 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44408
44409 /* Enter the array. */
44410 field_addr.sub_location = plocation_elem_new(0);
44411#endif /* FREECIV_JSON_CONNECTION */
44412
44413 for (i = 0; i < real_packet->veteran_levels; i++) {
44414#ifdef FREECIV_JSON_CONNECTION
44415 /* Next array element. */
44416 field_addr.sub_location->number = i;
44417#endif /* FREECIV_JSON_CONNECTION */
44418 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
44419 }
44420
44421#ifdef FREECIV_JSON_CONNECTION
44422 /* Exit array. */
44423 FC_FREE(field_addr.sub_location);
44424#endif /* FREECIV_JSON_CONNECTION */
44425 }
44426 if (e) {
44427 log_packet_detailed("'base_raise_chance' field error detected");
44428 }
44429#ifdef FREECIV_JSON_CONNECTION
44430 field_addr.name = "work_raise_chance";
44431#endif /* FREECIV_JSON_CONNECTION */
44432 e = 0;
44433 {
44434 int i;
44435
44436#ifdef FREECIV_JSON_CONNECTION
44437 /* Create the array. */
44438 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44439
44440 /* Enter the array. */
44441 field_addr.sub_location = plocation_elem_new(0);
44442#endif /* FREECIV_JSON_CONNECTION */
44443
44444 for (i = 0; i < real_packet->veteran_levels; i++) {
44445#ifdef FREECIV_JSON_CONNECTION
44446 /* Next array element. */
44447 field_addr.sub_location->number = i;
44448#endif /* FREECIV_JSON_CONNECTION */
44449 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
44450 }
44451
44452#ifdef FREECIV_JSON_CONNECTION
44453 /* Exit array. */
44454 FC_FREE(field_addr.sub_location);
44455#endif /* FREECIV_JSON_CONNECTION */
44456 }
44457 if (e) {
44458 log_packet_detailed("'work_raise_chance' field error detected");
44459 }
44460#ifdef FREECIV_JSON_CONNECTION
44461 field_addr.name = "bombard_rate";
44462#endif /* FREECIV_JSON_CONNECTION */
44463 e = 0;
44464 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bombard_rate);
44465 if (e) {
44466 log_packet_detailed("'bombard_rate' field error detected");
44467 }
44468#ifdef FREECIV_JSON_CONNECTION
44469 field_addr.name = "city_size";
44470#endif /* FREECIV_JSON_CONNECTION */
44471 e = 0;
44472 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_size);
44473 if (e) {
44474 log_packet_detailed("'city_size' field error detected");
44475 }
44476#ifdef FREECIV_JSON_CONNECTION
44477 field_addr.name = "city_slots";
44478#endif /* FREECIV_JSON_CONNECTION */
44479 e = 0;
44480 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_slots);
44481 if (e) {
44482 log_packet_detailed("'city_slots' field error detected");
44483 }
44484#ifdef FREECIV_JSON_CONNECTION
44485 field_addr.name = "tp_defense";
44486#endif /* FREECIV_JSON_CONNECTION */
44487 e = 0;
44488 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tp_defense);
44489 if (e) {
44490 log_packet_detailed("'tp_defense' field error detected");
44491 }
44492#ifdef FREECIV_JSON_CONNECTION
44493 field_addr.name = "cargo";
44494#endif /* FREECIV_JSON_CONNECTION */
44495 e = 0;
44496 e |= DIO_BV_PUT(&dout, &field_addr, packet->cargo);
44497 if (e) {
44498 log_packet_detailed("'cargo' field error detected");
44499 }
44500#ifdef FREECIV_JSON_CONNECTION
44501 field_addr.name = "targets";
44502#endif /* FREECIV_JSON_CONNECTION */
44503 e = 0;
44504 e |= DIO_BV_PUT(&dout, &field_addr, packet->targets);
44505 if (e) {
44506 log_packet_detailed("'targets' field error detected");
44507 }
44508#ifdef FREECIV_JSON_CONNECTION
44509 field_addr.name = "embarks";
44510#endif /* FREECIV_JSON_CONNECTION */
44511 e = 0;
44512 e |= DIO_BV_PUT(&dout, &field_addr, packet->embarks);
44513 if (e) {
44514 log_packet_detailed("'embarks' field error detected");
44515 }
44516#ifdef FREECIV_JSON_CONNECTION
44517 field_addr.name = "disembarks";
44518#endif /* FREECIV_JSON_CONNECTION */
44519 e = 0;
44520 e |= DIO_BV_PUT(&dout, &field_addr, packet->disembarks);
44521 if (e) {
44522 log_packet_detailed("'disembarks' field error detected");
44523 }
44524#ifdef FREECIV_JSON_CONNECTION
44525 field_addr.name = "vlayer";
44526#endif /* FREECIV_JSON_CONNECTION */
44527 e = 0;
44528 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->vlayer);
44529 if (e) {
44530 log_packet_detailed("'vlayer' field error detected");
44531 }
44532#ifdef FREECIV_JSON_CONNECTION
44533 field_addr.name = "helptext";
44534#endif /* FREECIV_JSON_CONNECTION */
44535 e = 0;
44536 if (!real_packet->helptext) {
44537 /* Transmit null vector as empty vector */
44538 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
44539 } else {
44540 int i;
44541
44542 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
44543 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
44544
44545#ifdef FREECIV_JSON_CONNECTION
44546 field_addr.sub_location = plocation_elem_new(0);
44547#endif /* FREECIV_JSON_CONNECTION */
44548
44549 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
44550 const char *pstr = strvec_get(real_packet->helptext, i);
44551
44552 if (!pstr) {
44553 /* Transmit null strings as empty strings */
44554 pstr = "";
44555 }
44556
44557#ifdef FREECIV_JSON_CONNECTION
44558 /* Next array element */
44559 field_addr.sub_location->number = i;
44560#endif /* FREECIV_JSON_CONNECTION */
44561
44562 e |= DIO_PUT(string, &dout, &field_addr, pstr);
44563 }
44564
44565#ifdef FREECIV_JSON_CONNECTION
44566 FC_FREE(field_addr.sub_location);
44567#endif /* FREECIV_JSON_CONNECTION */
44568 }
44569 if (e) {
44570 log_packet_detailed("'helptext' field error detected");
44571 }
44572#ifdef FREECIV_JSON_CONNECTION
44573 field_addr.name = "flags";
44574#endif /* FREECIV_JSON_CONNECTION */
44575 e = 0;
44576 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
44577 if (e) {
44578 log_packet_detailed("'flags' field error detected");
44579 }
44580#ifdef FREECIV_JSON_CONNECTION
44581 field_addr.name = "roles";
44582#endif /* FREECIV_JSON_CONNECTION */
44583 e = 0;
44584 e |= DIO_BV_PUT(&dout, &field_addr, packet->roles);
44585 if (e) {
44586 log_packet_detailed("'roles' field error detected");
44587 }
44588#ifdef FREECIV_JSON_CONNECTION
44589 field_addr.name = "worker";
44590#endif /* FREECIV_JSON_CONNECTION */
44591 e = 0;
44592 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->worker);
44593 if (e) {
44594 log_packet_detailed("'worker' field error detected");
44595 }
44596
44597#endif
44598 SEND_PACKET_END(PACKET_RULESET_UNIT);
44599}
44600
44601 int send_packet_ruleset_unit(struct connection *pc, const struct packet_ruleset_unit *packet)
44602{
44603 if (!pc->used) {
44604 log_error("WARNING: trying to send data to the closed connection %s",
44605 conn_description(pc));
44606 return -1;
44607 }
44608 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT].packet != nullptr, -1,
44609 "Handler for PACKET_RULESET_UNIT not installed");
44610 return pc->phs.handlers->send[PACKET_RULESET_UNIT].packet(pc, packet);
44611}
44612
44613 void lsend_packet_ruleset_unit(struct conn_list *dest, const struct packet_ruleset_unit *packet)
44614{
44615 conn_list_iterate(dest, pconn) {
44616 send_packet_ruleset_unit(pconn, packet);
44617 } conn_list_iterate_end;
44618}
44619
44620 static inline void init_packet_ruleset_unit_bonus(struct packet_ruleset_unit_bonus *packet)
44621{
44622 memset(packet, 0, sizeof(*packet));
44623}
44624
44625#define free_packet_ruleset_unit_bonus(_packet) (void) 0
44626#define destroy_packet_ruleset_unit_bonus free
44627
44628#ifdef FREECIV_DELTA_PROTOCOL
44629#define hash_packet_ruleset_unit_bonus_100 hash_const
44630
44631#define cmp_packet_ruleset_unit_bonus_100 cmp_const
44632
44633 BV_DEFINE(packet_ruleset_unit_bonus_100_fields, 5);
44634#endif /* FREECIV_DELTA_PROTOCOL */
44635
44636 static struct packet_ruleset_unit_bonus *receive_packet_ruleset_unit_bonus_100(struct connection *pc)
44637{
44638#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_unit_bonus(_packet)
44639#ifdef FREECIV_DELTA_PROTOCOL
44640 packet_ruleset_unit_bonus_100_fields fields;
44641 struct packet_ruleset_unit_bonus *old;
44642 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_BONUS;
44643#endif /* FREECIV_DELTA_PROTOCOL */
44644 RECEIVE_PACKET_START(packet_ruleset_unit_bonus, real_packet);
44645#ifdef FREECIV_JSON_CONNECTION
44646 struct plocation field_addr;
44647 {
44648 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
44649 field_addr = *field_addr_tmp;
44650 FC_FREE(field_addr_tmp);
44651 }
44652#endif /* FREECIV_JSON_CONNECTION */
44653
44654#ifdef FREECIV_DELTA_PROTOCOL
44655#ifdef FREECIV_JSON_CONNECTION
44656 field_addr.name = "fields";
44657#endif /* FREECIV_JSON_CONNECTION */
44658 DIO_BV_GET(&din, &field_addr, fields);
44659
44660#else /* FREECIV_DELTA_PROTOCOL */
44661#ifdef FREECIV_JSON_CONNECTION
44662 field_addr.name = "unit";
44663#endif /* FREECIV_JSON_CONNECTION */
44664 {
44665 int readin;
44666
44667 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
44668 RECEIVE_PACKET_FIELD_ERROR(unit);
44669 }
44670 real_packet->unit = readin;
44671 }
44672#ifdef FREECIV_JSON_CONNECTION
44673 field_addr.name = "flag";
44674#endif /* FREECIV_JSON_CONNECTION */
44675 {
44676 int readin;
44677
44678 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44679 RECEIVE_PACKET_FIELD_ERROR(flag);
44680 }
44681 real_packet->flag = readin;
44682 }
44683#ifdef FREECIV_JSON_CONNECTION
44684 field_addr.name = "type";
44685#endif /* FREECIV_JSON_CONNECTION */
44686 {
44687 int readin;
44688
44689 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44690 RECEIVE_PACKET_FIELD_ERROR(type);
44691 }
44692 real_packet->type = readin;
44693 }
44694#ifdef FREECIV_JSON_CONNECTION
44695 field_addr.name = "value";
44696#endif /* FREECIV_JSON_CONNECTION */
44697 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->value)) {
44698 RECEIVE_PACKET_FIELD_ERROR(value);
44699 }
44700#ifdef FREECIV_JSON_CONNECTION
44701 field_addr.name = "quiet";
44702#endif /* FREECIV_JSON_CONNECTION */
44703 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->quiet)) {
44704 RECEIVE_PACKET_FIELD_ERROR(quiet);
44705 }
44706#endif
44707 log_packet_detailed("packet_ruleset_unit_bonus_100: got info about ()");
44708
44709#ifdef FREECIV_DELTA_PROTOCOL
44710 if (nullptr == *hash) {
44711 *hash = genhash_new_full(hash_packet_ruleset_unit_bonus_100, cmp_packet_ruleset_unit_bonus_100,
44712 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_bonus);
44713 }
44714
44715 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
44716 *real_packet = *old;
44717 } else {
44718 /* packet is already initialized empty */
44719 log_packet_detailed(" no old info");
44720 }
44721
44722 if (BV_ISSET(fields, 0)) {
44723 log_packet_detailed(" got field 'unit'");
44724#ifdef FREECIV_JSON_CONNECTION
44725 field_addr.name = "unit";
44726#endif /* FREECIV_JSON_CONNECTION */
44727 {
44728 int readin;
44729
44730 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
44731 RECEIVE_PACKET_FIELD_ERROR(unit);
44732 }
44733 real_packet->unit = readin;
44734 }
44735 }
44736 if (BV_ISSET(fields, 1)) {
44737 log_packet_detailed(" got field 'flag'");
44738#ifdef FREECIV_JSON_CONNECTION
44739 field_addr.name = "flag";
44740#endif /* FREECIV_JSON_CONNECTION */
44741 {
44742 int readin;
44743
44744 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44745 RECEIVE_PACKET_FIELD_ERROR(flag);
44746 }
44747 real_packet->flag = readin;
44748 }
44749 }
44750 if (BV_ISSET(fields, 2)) {
44751 log_packet_detailed(" got field 'type'");
44752#ifdef FREECIV_JSON_CONNECTION
44753 field_addr.name = "type";
44754#endif /* FREECIV_JSON_CONNECTION */
44755 {
44756 int readin;
44757
44758 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
44759 RECEIVE_PACKET_FIELD_ERROR(type);
44760 }
44761 real_packet->type = readin;
44762 }
44763 }
44764 if (BV_ISSET(fields, 3)) {
44765 log_packet_detailed(" got field 'value'");
44766#ifdef FREECIV_JSON_CONNECTION
44767 field_addr.name = "value";
44768#endif /* FREECIV_JSON_CONNECTION */
44769 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->value)) {
44770 RECEIVE_PACKET_FIELD_ERROR(value);
44771 }
44772 }
44773 real_packet->quiet = BV_ISSET(fields, 4);
44774
44775 if (nullptr == old) {
44776 old = fc_malloc(sizeof(*old));
44777 init_packet_ruleset_unit_bonus(old);
44778 *old = *real_packet;
44779 genhash_insert(*hash, old, old);
44780 } else {
44781 *old = *real_packet;
44782 }
44783
44784#endif /* FREECIV_DELTA_PROTOCOL */
44785 RECEIVE_PACKET_END(real_packet);
44786#undef FREE_PACKET_STRUCT
44787}
44788
44789 static int send_packet_ruleset_unit_bonus_100(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
44790{
44791 const struct packet_ruleset_unit_bonus *real_packet = packet;
44792 int e;
44793#ifdef FREECIV_DELTA_PROTOCOL
44794 packet_ruleset_unit_bonus_100_fields fields;
44795 struct packet_ruleset_unit_bonus *old;
44796 bool differ;
44797 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_BONUS;
44798#endif /* FREECIV_DELTA_PROTOCOL */
44799 SEND_PACKET_START(PACKET_RULESET_UNIT_BONUS);
44800#ifdef FREECIV_JSON_CONNECTION
44801 struct plocation field_addr;
44802 {
44803 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
44804 field_addr = *field_addr_tmp;
44805 FC_FREE(field_addr_tmp);
44806 }
44807#endif /* FREECIV_JSON_CONNECTION */
44808
44809 log_packet_detailed("packet_ruleset_unit_bonus_100: sending info about ()");
44810
44811#ifdef FREECIV_DELTA_PROTOCOL
44812 if (nullptr == *hash) {
44813 *hash = genhash_new_full(hash_packet_ruleset_unit_bonus_100, cmp_packet_ruleset_unit_bonus_100,
44814 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_bonus);
44815 }
44816 BV_CLR_ALL(fields);
44817
44818 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
44819 old = fc_malloc(sizeof(*old));
44820 /* temporary bitcopy just to insert correctly */
44821 *old = *real_packet;
44822 genhash_insert(*hash, old, old);
44823 init_packet_ruleset_unit_bonus(old);
44824 }
44825 differ = (old->unit != real_packet->unit);
44826 if (differ) {
44827 BV_SET(fields, 0);
44828 }
44829
44830 differ = (old->flag != real_packet->flag);
44831 if (differ) {
44832 BV_SET(fields, 1);
44833 }
44834
44835 differ = (old->type != real_packet->type);
44836 if (differ) {
44837 BV_SET(fields, 2);
44838 }
44839
44840 differ = (old->value != real_packet->value);
44841 if (differ) {
44842 BV_SET(fields, 3);
44843 }
44844
44845 if (packet->quiet) {
44846 BV_SET(fields, 4);
44847 }
44848
44849
44850#ifdef FREECIV_JSON_CONNECTION
44851 field_addr.name = "fields";
44852#endif /* FREECIV_JSON_CONNECTION */
44853 e = 0;
44854 e |= DIO_BV_PUT(&dout, &field_addr, fields);
44855 if (e) {
44856 log_packet_detailed("fields bitvector error detected");
44857 }
44858
44859 if (BV_ISSET(fields, 0)) {
44860 log_packet_detailed(" field 'unit' has changed");
44861#ifdef FREECIV_JSON_CONNECTION
44862 field_addr.name = "unit";
44863#endif /* FREECIV_JSON_CONNECTION */
44864 e = 0;
44865 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->unit);
44866 if (e) {
44867 log_packet_detailed("'unit' field error detected");
44868 }
44869 }
44870 if (BV_ISSET(fields, 1)) {
44871 log_packet_detailed(" field 'flag' has changed");
44872#ifdef FREECIV_JSON_CONNECTION
44873 field_addr.name = "flag";
44874#endif /* FREECIV_JSON_CONNECTION */
44875 e = 0;
44876 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->flag);
44877 if (e) {
44878 log_packet_detailed("'flag' field error detected");
44879 }
44880 }
44881 if (BV_ISSET(fields, 2)) {
44882 log_packet_detailed(" field 'type' has changed");
44883#ifdef FREECIV_JSON_CONNECTION
44884 field_addr.name = "type";
44885#endif /* FREECIV_JSON_CONNECTION */
44886 e = 0;
44887 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
44888 if (e) {
44889 log_packet_detailed("'type' field error detected");
44890 }
44891 }
44892 if (BV_ISSET(fields, 3)) {
44893 log_packet_detailed(" field 'value' has changed");
44894#ifdef FREECIV_JSON_CONNECTION
44895 field_addr.name = "value";
44896#endif /* FREECIV_JSON_CONNECTION */
44897 e = 0;
44898 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->value);
44899 if (e) {
44900 log_packet_detailed("'value' field error detected");
44901 }
44902 }
44903 /* field 4 is folded into the header */
44904
44905 *old = *real_packet;
44906#endif /* FREECIV_DELTA_PROTOCOL */
44907#ifndef FREECIV_DELTA_PROTOCOL
44908#ifdef FREECIV_JSON_CONNECTION
44909 field_addr.name = "unit";
44910#endif /* FREECIV_JSON_CONNECTION */
44911 e = 0;
44912 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->unit);
44913 if (e) {
44914 log_packet_detailed("'unit' field error detected");
44915 }
44916#ifdef FREECIV_JSON_CONNECTION
44917 field_addr.name = "flag";
44918#endif /* FREECIV_JSON_CONNECTION */
44919 e = 0;
44920 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->flag);
44921 if (e) {
44922 log_packet_detailed("'flag' field error detected");
44923 }
44924#ifdef FREECIV_JSON_CONNECTION
44925 field_addr.name = "type";
44926#endif /* FREECIV_JSON_CONNECTION */
44927 e = 0;
44928 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
44929 if (e) {
44930 log_packet_detailed("'type' field error detected");
44931 }
44932#ifdef FREECIV_JSON_CONNECTION
44933 field_addr.name = "value";
44934#endif /* FREECIV_JSON_CONNECTION */
44935 e = 0;
44936 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->value);
44937 if (e) {
44938 log_packet_detailed("'value' field error detected");
44939 }
44940#ifdef FREECIV_JSON_CONNECTION
44941 field_addr.name = "quiet";
44942#endif /* FREECIV_JSON_CONNECTION */
44943 e = 0;
44944 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->quiet);
44945 if (e) {
44946 log_packet_detailed("'quiet' field error detected");
44947 }
44948
44949#endif
44950 SEND_PACKET_END(PACKET_RULESET_UNIT_BONUS);
44951}
44952
44953 int send_packet_ruleset_unit_bonus(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
44954{
44955 if (!pc->used) {
44956 log_error("WARNING: trying to send data to the closed connection %s",
44957 conn_description(pc));
44958 return -1;
44959 }
44960 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_BONUS].packet != nullptr, -1,
44961 "Handler for PACKET_RULESET_UNIT_BONUS not installed");
44962 return pc->phs.handlers->send[PACKET_RULESET_UNIT_BONUS].packet(pc, packet);
44963}
44964
44965 void lsend_packet_ruleset_unit_bonus(struct conn_list *dest, const struct packet_ruleset_unit_bonus *packet)
44966{
44967 conn_list_iterate(dest, pconn) {
44968 send_packet_ruleset_unit_bonus(pconn, packet);
44969 } conn_list_iterate_end;
44970}
44971
44972 static inline void init_packet_ruleset_unit_flag(struct packet_ruleset_unit_flag *packet)
44973{
44974 memset(packet, 0, sizeof(*packet));
44975}
44976
44977#define free_packet_ruleset_unit_flag(_packet) (void) 0
44978#define destroy_packet_ruleset_unit_flag free
44979
44980#ifdef FREECIV_DELTA_PROTOCOL
44981#define hash_packet_ruleset_unit_flag_100 hash_const
44982
44983#define cmp_packet_ruleset_unit_flag_100 cmp_const
44984
44985 BV_DEFINE(packet_ruleset_unit_flag_100_fields, 3);
44986#endif /* FREECIV_DELTA_PROTOCOL */
44987
44988 static struct packet_ruleset_unit_flag *receive_packet_ruleset_unit_flag_100(struct connection *pc)
44989{
44990#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_unit_flag(_packet)
44991#ifdef FREECIV_DELTA_PROTOCOL
44992 packet_ruleset_unit_flag_100_fields fields;
44993 struct packet_ruleset_unit_flag *old;
44994 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_FLAG;
44995#endif /* FREECIV_DELTA_PROTOCOL */
44996 RECEIVE_PACKET_START(packet_ruleset_unit_flag, real_packet);
44997#ifdef FREECIV_JSON_CONNECTION
44998 struct plocation field_addr;
44999 {
45000 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
45001 field_addr = *field_addr_tmp;
45002 FC_FREE(field_addr_tmp);
45003 }
45004#endif /* FREECIV_JSON_CONNECTION */
45005
45006#ifdef FREECIV_DELTA_PROTOCOL
45007#ifdef FREECIV_JSON_CONNECTION
45008 field_addr.name = "fields";
45009#endif /* FREECIV_JSON_CONNECTION */
45010 DIO_BV_GET(&din, &field_addr, fields);
45011
45012#else /* FREECIV_DELTA_PROTOCOL */
45013#ifdef FREECIV_JSON_CONNECTION
45014 field_addr.name = "id";
45015#endif /* FREECIV_JSON_CONNECTION */
45016 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
45017 RECEIVE_PACKET_FIELD_ERROR(id);
45018 }
45019#ifdef FREECIV_JSON_CONNECTION
45020 field_addr.name = "name";
45021#endif /* FREECIV_JSON_CONNECTION */
45022 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45023 RECEIVE_PACKET_FIELD_ERROR(name);
45024 }
45025#ifdef FREECIV_JSON_CONNECTION
45026 field_addr.name = "helptxt";
45027#endif /* FREECIV_JSON_CONNECTION */
45028 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
45029 RECEIVE_PACKET_FIELD_ERROR(helptxt);
45030 }
45031#endif
45032 log_packet_detailed("packet_ruleset_unit_flag_100: got info about ()");
45033
45034#ifdef FREECIV_DELTA_PROTOCOL
45035 if (nullptr == *hash) {
45036 *hash = genhash_new_full(hash_packet_ruleset_unit_flag_100, cmp_packet_ruleset_unit_flag_100,
45037 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_flag);
45038 }
45039
45040 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45041 *real_packet = *old;
45042 } else {
45043 /* packet is already initialized empty */
45044 log_packet_detailed(" no old info");
45045 }
45046
45047 if (BV_ISSET(fields, 0)) {
45048 log_packet_detailed(" got field 'id'");
45049#ifdef FREECIV_JSON_CONNECTION
45050 field_addr.name = "id";
45051#endif /* FREECIV_JSON_CONNECTION */
45052 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
45053 RECEIVE_PACKET_FIELD_ERROR(id);
45054 }
45055 }
45056 if (BV_ISSET(fields, 1)) {
45057 log_packet_detailed(" got field 'name'");
45058#ifdef FREECIV_JSON_CONNECTION
45059 field_addr.name = "name";
45060#endif /* FREECIV_JSON_CONNECTION */
45061 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45062 RECEIVE_PACKET_FIELD_ERROR(name);
45063 }
45064 }
45065 if (BV_ISSET(fields, 2)) {
45066 log_packet_detailed(" got field 'helptxt'");
45067#ifdef FREECIV_JSON_CONNECTION
45068 field_addr.name = "helptxt";
45069#endif /* FREECIV_JSON_CONNECTION */
45070 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
45071 RECEIVE_PACKET_FIELD_ERROR(helptxt);
45072 }
45073 }
45074
45075 if (nullptr == old) {
45076 old = fc_malloc(sizeof(*old));
45077 init_packet_ruleset_unit_flag(old);
45078 *old = *real_packet;
45079 genhash_insert(*hash, old, old);
45080 } else {
45081 *old = *real_packet;
45082 }
45083
45084#endif /* FREECIV_DELTA_PROTOCOL */
45085 RECEIVE_PACKET_END(real_packet);
45086#undef FREE_PACKET_STRUCT
45087}
45088
45089 static int send_packet_ruleset_unit_flag_100(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
45090{
45091 const struct packet_ruleset_unit_flag *real_packet = packet;
45092 int e;
45093#ifdef FREECIV_DELTA_PROTOCOL
45094 packet_ruleset_unit_flag_100_fields fields;
45095 struct packet_ruleset_unit_flag *old;
45096 bool differ;
45097 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_FLAG;
45098#endif /* FREECIV_DELTA_PROTOCOL */
45099 SEND_PACKET_START(PACKET_RULESET_UNIT_FLAG);
45100#ifdef FREECIV_JSON_CONNECTION
45101 struct plocation field_addr;
45102 {
45103 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
45104 field_addr = *field_addr_tmp;
45105 FC_FREE(field_addr_tmp);
45106 }
45107#endif /* FREECIV_JSON_CONNECTION */
45108
45109 log_packet_detailed("packet_ruleset_unit_flag_100: sending info about ()");
45110
45111#ifdef FREECIV_DELTA_PROTOCOL
45112 if (nullptr == *hash) {
45113 *hash = genhash_new_full(hash_packet_ruleset_unit_flag_100, cmp_packet_ruleset_unit_flag_100,
45114 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_flag);
45115 }
45116 BV_CLR_ALL(fields);
45117
45118 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
45119 old = fc_malloc(sizeof(*old));
45120 /* temporary bitcopy just to insert correctly */
45121 *old = *real_packet;
45122 genhash_insert(*hash, old, old);
45123 init_packet_ruleset_unit_flag(old);
45124 }
45125 differ = (old->id != real_packet->id);
45126 if (differ) {
45127 BV_SET(fields, 0);
45128 }
45129
45130 differ = (strcmp(old->name, real_packet->name) != 0);
45131 if (differ) {
45132 BV_SET(fields, 1);
45133 }
45134
45135 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
45136 if (differ) {
45137 BV_SET(fields, 2);
45138 }
45139
45140
45141#ifdef FREECIV_JSON_CONNECTION
45142 field_addr.name = "fields";
45143#endif /* FREECIV_JSON_CONNECTION */
45144 e = 0;
45145 e |= DIO_BV_PUT(&dout, &field_addr, fields);
45146 if (e) {
45147 log_packet_detailed("fields bitvector error detected");
45148 }
45149
45150 if (BV_ISSET(fields, 0)) {
45151 log_packet_detailed(" field 'id' has changed");
45152#ifdef FREECIV_JSON_CONNECTION
45153 field_addr.name = "id";
45154#endif /* FREECIV_JSON_CONNECTION */
45155 e = 0;
45156 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
45157 if (e) {
45158 log_packet_detailed("'id' field error detected");
45159 }
45160 }
45161 if (BV_ISSET(fields, 1)) {
45162 log_packet_detailed(" field 'name' has changed");
45163#ifdef FREECIV_JSON_CONNECTION
45164 field_addr.name = "name";
45165#endif /* FREECIV_JSON_CONNECTION */
45166 e = 0;
45167 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
45168 if (e) {
45169 log_packet_detailed("'name' field error detected");
45170 }
45171 }
45172 if (BV_ISSET(fields, 2)) {
45173 log_packet_detailed(" field 'helptxt' has changed");
45174#ifdef FREECIV_JSON_CONNECTION
45175 field_addr.name = "helptxt";
45176#endif /* FREECIV_JSON_CONNECTION */
45177 e = 0;
45178 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
45179 if (e) {
45180 log_packet_detailed("'helptxt' field error detected");
45181 }
45182 }
45183
45184 *old = *real_packet;
45185#endif /* FREECIV_DELTA_PROTOCOL */
45186#ifndef FREECIV_DELTA_PROTOCOL
45187#ifdef FREECIV_JSON_CONNECTION
45188 field_addr.name = "id";
45189#endif /* FREECIV_JSON_CONNECTION */
45190 e = 0;
45191 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
45192 if (e) {
45193 log_packet_detailed("'id' field error detected");
45194 }
45195#ifdef FREECIV_JSON_CONNECTION
45196 field_addr.name = "name";
45197#endif /* FREECIV_JSON_CONNECTION */
45198 e = 0;
45199 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
45200 if (e) {
45201 log_packet_detailed("'name' field error detected");
45202 }
45203#ifdef FREECIV_JSON_CONNECTION
45204 field_addr.name = "helptxt";
45205#endif /* FREECIV_JSON_CONNECTION */
45206 e = 0;
45207 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
45208 if (e) {
45209 log_packet_detailed("'helptxt' field error detected");
45210 }
45211
45212#endif
45213 SEND_PACKET_END(PACKET_RULESET_UNIT_FLAG);
45214}
45215
45216 int send_packet_ruleset_unit_flag(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
45217{
45218 if (!pc->used) {
45219 log_error("WARNING: trying to send data to the closed connection %s",
45220 conn_description(pc));
45221 return -1;
45222 }
45223 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_FLAG].packet != nullptr, -1,
45224 "Handler for PACKET_RULESET_UNIT_FLAG not installed");
45225 return pc->phs.handlers->send[PACKET_RULESET_UNIT_FLAG].packet(pc, packet);
45226}
45227
45228 void lsend_packet_ruleset_unit_flag(struct conn_list *dest, const struct packet_ruleset_unit_flag *packet)
45229{
45230 conn_list_iterate(dest, pconn) {
45231 send_packet_ruleset_unit_flag(pconn, packet);
45232 } conn_list_iterate_end;
45233}
45234
45235 static inline void init_packet_ruleset_unit_class_flag(struct packet_ruleset_unit_class_flag *packet)
45236{
45237 memset(packet, 0, sizeof(*packet));
45238}
45239
45240#define free_packet_ruleset_unit_class_flag(_packet) (void) 0
45241#define destroy_packet_ruleset_unit_class_flag free
45242
45243#ifdef FREECIV_DELTA_PROTOCOL
45244#define hash_packet_ruleset_unit_class_flag_100 hash_const
45245
45246#define cmp_packet_ruleset_unit_class_flag_100 cmp_const
45247
45248 BV_DEFINE(packet_ruleset_unit_class_flag_100_fields, 3);
45249#endif /* FREECIV_DELTA_PROTOCOL */
45250
45251 static struct packet_ruleset_unit_class_flag *receive_packet_ruleset_unit_class_flag_100(struct connection *pc)
45252{
45253#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_unit_class_flag(_packet)
45254#ifdef FREECIV_DELTA_PROTOCOL
45255 packet_ruleset_unit_class_flag_100_fields fields;
45256 struct packet_ruleset_unit_class_flag *old;
45257 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_CLASS_FLAG;
45258#endif /* FREECIV_DELTA_PROTOCOL */
45259 RECEIVE_PACKET_START(packet_ruleset_unit_class_flag, real_packet);
45260#ifdef FREECIV_JSON_CONNECTION
45261 struct plocation field_addr;
45262 {
45263 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
45264 field_addr = *field_addr_tmp;
45265 FC_FREE(field_addr_tmp);
45266 }
45267#endif /* FREECIV_JSON_CONNECTION */
45268
45269#ifdef FREECIV_DELTA_PROTOCOL
45270#ifdef FREECIV_JSON_CONNECTION
45271 field_addr.name = "fields";
45272#endif /* FREECIV_JSON_CONNECTION */
45273 DIO_BV_GET(&din, &field_addr, fields);
45274
45275#else /* FREECIV_DELTA_PROTOCOL */
45276#ifdef FREECIV_JSON_CONNECTION
45277 field_addr.name = "id";
45278#endif /* FREECIV_JSON_CONNECTION */
45279 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
45280 RECEIVE_PACKET_FIELD_ERROR(id);
45281 }
45282#ifdef FREECIV_JSON_CONNECTION
45283 field_addr.name = "name";
45284#endif /* FREECIV_JSON_CONNECTION */
45285 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45286 RECEIVE_PACKET_FIELD_ERROR(name);
45287 }
45288#ifdef FREECIV_JSON_CONNECTION
45289 field_addr.name = "helptxt";
45290#endif /* FREECIV_JSON_CONNECTION */
45291 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
45292 RECEIVE_PACKET_FIELD_ERROR(helptxt);
45293 }
45294#endif
45295 log_packet_detailed("packet_ruleset_unit_class_flag_100: got info about ()");
45296
45297#ifdef FREECIV_DELTA_PROTOCOL
45298 if (nullptr == *hash) {
45299 *hash = genhash_new_full(hash_packet_ruleset_unit_class_flag_100, cmp_packet_ruleset_unit_class_flag_100,
45300 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_class_flag);
45301 }
45302
45303 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45304 *real_packet = *old;
45305 } else {
45306 /* packet is already initialized empty */
45307 log_packet_detailed(" no old info");
45308 }
45309
45310 if (BV_ISSET(fields, 0)) {
45311 log_packet_detailed(" got field 'id'");
45312#ifdef FREECIV_JSON_CONNECTION
45313 field_addr.name = "id";
45314#endif /* FREECIV_JSON_CONNECTION */
45315 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
45316 RECEIVE_PACKET_FIELD_ERROR(id);
45317 }
45318 }
45319 if (BV_ISSET(fields, 1)) {
45320 log_packet_detailed(" got field 'name'");
45321#ifdef FREECIV_JSON_CONNECTION
45322 field_addr.name = "name";
45323#endif /* FREECIV_JSON_CONNECTION */
45324 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
45325 RECEIVE_PACKET_FIELD_ERROR(name);
45326 }
45327 }
45328 if (BV_ISSET(fields, 2)) {
45329 log_packet_detailed(" got field 'helptxt'");
45330#ifdef FREECIV_JSON_CONNECTION
45331 field_addr.name = "helptxt";
45332#endif /* FREECIV_JSON_CONNECTION */
45333 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
45334 RECEIVE_PACKET_FIELD_ERROR(helptxt);
45335 }
45336 }
45337
45338 if (nullptr == old) {
45339 old = fc_malloc(sizeof(*old));
45340 init_packet_ruleset_unit_class_flag(old);
45341 *old = *real_packet;
45342 genhash_insert(*hash, old, old);
45343 } else {
45344 *old = *real_packet;
45345 }
45346
45347#endif /* FREECIV_DELTA_PROTOCOL */
45348 RECEIVE_PACKET_END(real_packet);
45349#undef FREE_PACKET_STRUCT
45350}
45351
45352 static int send_packet_ruleset_unit_class_flag_100(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
45353{
45354 const struct packet_ruleset_unit_class_flag *real_packet = packet;
45355 int e;
45356#ifdef FREECIV_DELTA_PROTOCOL
45357 packet_ruleset_unit_class_flag_100_fields fields;
45358 struct packet_ruleset_unit_class_flag *old;
45359 bool differ;
45360 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_CLASS_FLAG;
45361#endif /* FREECIV_DELTA_PROTOCOL */
45362 SEND_PACKET_START(PACKET_RULESET_UNIT_CLASS_FLAG);
45363#ifdef FREECIV_JSON_CONNECTION
45364 struct plocation field_addr;
45365 {
45366 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
45367 field_addr = *field_addr_tmp;
45368 FC_FREE(field_addr_tmp);
45369 }
45370#endif /* FREECIV_JSON_CONNECTION */
45371
45372 log_packet_detailed("packet_ruleset_unit_class_flag_100: sending info about ()");
45373
45374#ifdef FREECIV_DELTA_PROTOCOL
45375 if (nullptr == *hash) {
45376 *hash = genhash_new_full(hash_packet_ruleset_unit_class_flag_100, cmp_packet_ruleset_unit_class_flag_100,
45377 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_class_flag);
45378 }
45379 BV_CLR_ALL(fields);
45380
45381 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
45382 old = fc_malloc(sizeof(*old));
45383 /* temporary bitcopy just to insert correctly */
45384 *old = *real_packet;
45385 genhash_insert(*hash, old, old);
45386 init_packet_ruleset_unit_class_flag(old);
45387 }
45388 differ = (old->id != real_packet->id);
45389 if (differ) {
45390 BV_SET(fields, 0);
45391 }
45392
45393 differ = (strcmp(old->name, real_packet->name) != 0);
45394 if (differ) {
45395 BV_SET(fields, 1);
45396 }
45397
45398 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
45399 if (differ) {
45400 BV_SET(fields, 2);
45401 }
45402
45403
45404#ifdef FREECIV_JSON_CONNECTION
45405 field_addr.name = "fields";
45406#endif /* FREECIV_JSON_CONNECTION */
45407 e = 0;
45408 e |= DIO_BV_PUT(&dout, &field_addr, fields);
45409 if (e) {
45410 log_packet_detailed("fields bitvector error detected");
45411 }
45412
45413 if (BV_ISSET(fields, 0)) {
45414 log_packet_detailed(" field 'id' has changed");
45415#ifdef FREECIV_JSON_CONNECTION
45416 field_addr.name = "id";
45417#endif /* FREECIV_JSON_CONNECTION */
45418 e = 0;
45419 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
45420 if (e) {
45421 log_packet_detailed("'id' field error detected");
45422 }
45423 }
45424 if (BV_ISSET(fields, 1)) {
45425 log_packet_detailed(" field 'name' has changed");
45426#ifdef FREECIV_JSON_CONNECTION
45427 field_addr.name = "name";
45428#endif /* FREECIV_JSON_CONNECTION */
45429 e = 0;
45430 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
45431 if (e) {
45432 log_packet_detailed("'name' field error detected");
45433 }
45434 }
45435 if (BV_ISSET(fields, 2)) {
45436 log_packet_detailed(" field 'helptxt' has changed");
45437#ifdef FREECIV_JSON_CONNECTION
45438 field_addr.name = "helptxt";
45439#endif /* FREECIV_JSON_CONNECTION */
45440 e = 0;
45441 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
45442 if (e) {
45443 log_packet_detailed("'helptxt' field error detected");
45444 }
45445 }
45446
45447 *old = *real_packet;
45448#endif /* FREECIV_DELTA_PROTOCOL */
45449#ifndef FREECIV_DELTA_PROTOCOL
45450#ifdef FREECIV_JSON_CONNECTION
45451 field_addr.name = "id";
45452#endif /* FREECIV_JSON_CONNECTION */
45453 e = 0;
45454 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
45455 if (e) {
45456 log_packet_detailed("'id' field error detected");
45457 }
45458#ifdef FREECIV_JSON_CONNECTION
45459 field_addr.name = "name";
45460#endif /* FREECIV_JSON_CONNECTION */
45461 e = 0;
45462 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
45463 if (e) {
45464 log_packet_detailed("'name' field error detected");
45465 }
45466#ifdef FREECIV_JSON_CONNECTION
45467 field_addr.name = "helptxt";
45468#endif /* FREECIV_JSON_CONNECTION */
45469 e = 0;
45470 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
45471 if (e) {
45472 log_packet_detailed("'helptxt' field error detected");
45473 }
45474
45475#endif
45476 SEND_PACKET_END(PACKET_RULESET_UNIT_CLASS_FLAG);
45477}
45478
45479 int send_packet_ruleset_unit_class_flag(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
45480{
45481 if (!pc->used) {
45482 log_error("WARNING: trying to send data to the closed connection %s",
45483 conn_description(pc));
45484 return -1;
45485 }
45486 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet != nullptr, -1,
45487 "Handler for PACKET_RULESET_UNIT_CLASS_FLAG not installed");
45488 return pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet(pc, packet);
45489}
45490
45491 void lsend_packet_ruleset_unit_class_flag(struct conn_list *dest, const struct packet_ruleset_unit_class_flag *packet)
45492{
45493 conn_list_iterate(dest, pconn) {
45494 send_packet_ruleset_unit_class_flag(pconn, packet);
45495 } conn_list_iterate_end;
45496}
45497
45498 static inline void init_packet_ruleset_game(struct packet_ruleset_game *packet)
45499{
45500 memset(packet, 0, sizeof(*packet));
45501}
45502
45503#define free_packet_ruleset_game(_packet) (void) 0
45504#define destroy_packet_ruleset_game free
45505
45506#ifdef FREECIV_DELTA_PROTOCOL
45507#define hash_packet_ruleset_game_100 hash_const
45508
45509#define cmp_packet_ruleset_game_100 cmp_const
45510
45511 BV_DEFINE(packet_ruleset_game_100_fields, 14);
45512#endif /* FREECIV_DELTA_PROTOCOL */
45513
45514 static struct packet_ruleset_game *receive_packet_ruleset_game_100(struct connection *pc)
45515{
45516#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_game(_packet)
45517#ifdef FREECIV_DELTA_PROTOCOL
45518 packet_ruleset_game_100_fields fields;
45519 struct packet_ruleset_game *old;
45520 struct genhash **hash = pc->phs.received + PACKET_RULESET_GAME;
45521#endif /* FREECIV_DELTA_PROTOCOL */
45522 RECEIVE_PACKET_START(packet_ruleset_game, real_packet);
45523#ifdef FREECIV_JSON_CONNECTION
45524 struct plocation field_addr;
45525 {
45526 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
45527 field_addr = *field_addr_tmp;
45528 FC_FREE(field_addr_tmp);
45529 }
45530#endif /* FREECIV_JSON_CONNECTION */
45531
45532#ifdef FREECIV_DELTA_PROTOCOL
45533#ifdef FREECIV_JSON_CONNECTION
45534 field_addr.name = "fields";
45535#endif /* FREECIV_JSON_CONNECTION */
45536 DIO_BV_GET(&din, &field_addr, fields);
45537
45538#else /* FREECIV_DELTA_PROTOCOL */
45539#ifdef FREECIV_JSON_CONNECTION
45540 field_addr.name = "default_specialist";
45541#endif /* FREECIV_JSON_CONNECTION */
45542 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->default_specialist)) {
45543 RECEIVE_PACKET_FIELD_ERROR(default_specialist);
45544 }
45545#ifdef FREECIV_JSON_CONNECTION
45546 field_addr.name = "global_init_techs_count";
45547#endif /* FREECIV_JSON_CONNECTION */
45548 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs_count)) {
45549 RECEIVE_PACKET_FIELD_ERROR(global_init_techs_count);
45550 }
45551#ifdef FREECIV_JSON_CONNECTION
45552 field_addr.name = "global_init_techs";
45553#endif /* FREECIV_JSON_CONNECTION */
45554 {
45555 int i;
45556
45557#ifdef FREECIV_JSON_CONNECTION
45558 /* Enter array. */
45559 field_addr.sub_location = plocation_elem_new(0);
45560#endif /* FREECIV_JSON_CONNECTION */
45561
45562 if (real_packet->global_init_techs_count > MAX_NUM_TECH_LIST) {
45563 RECEIVE_PACKET_FIELD_ERROR(global_init_techs, ": truncation array");
45564 }
45565 for (i = 0; i < real_packet->global_init_techs_count; i++) {
45566#ifdef FREECIV_JSON_CONNECTION
45567 field_addr.sub_location->number = i;
45568#endif /* FREECIV_JSON_CONNECTION */
45569 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_init_techs[i])) {
45570 RECEIVE_PACKET_FIELD_ERROR(global_init_techs);
45571 }
45572 }
45573
45574#ifdef FREECIV_JSON_CONNECTION
45575 /* Exit array. */
45576 FC_FREE(field_addr.sub_location);
45577#endif /* FREECIV_JSON_CONNECTION */
45578 }
45579#ifdef FREECIV_JSON_CONNECTION
45580 field_addr.name = "global_init_buildings_count";
45581#endif /* FREECIV_JSON_CONNECTION */
45582 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_buildings_count)) {
45583 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings_count);
45584 }
45585#ifdef FREECIV_JSON_CONNECTION
45586 field_addr.name = "global_init_buildings";
45587#endif /* FREECIV_JSON_CONNECTION */
45588 {
45589 int i;
45590
45591#ifdef FREECIV_JSON_CONNECTION
45592 /* Enter array. */
45593 field_addr.sub_location = plocation_elem_new(0);
45594#endif /* FREECIV_JSON_CONNECTION */
45595
45596 if (real_packet->global_init_buildings_count > MAX_NUM_BUILDING_LIST) {
45597 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings, ": truncation array");
45598 }
45599 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
45600#ifdef FREECIV_JSON_CONNECTION
45601 field_addr.sub_location->number = i;
45602#endif /* FREECIV_JSON_CONNECTION */
45603 {
45604 int readin;
45605
45606 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45607 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings);
45608 }
45609 real_packet->global_init_buildings[i] = readin;
45610 }
45611 }
45612
45613#ifdef FREECIV_JSON_CONNECTION
45614 /* Exit array. */
45615 FC_FREE(field_addr.sub_location);
45616#endif /* FREECIV_JSON_CONNECTION */
45617 }
45618#ifdef FREECIV_JSON_CONNECTION
45619 field_addr.name = "veteran_levels";
45620#endif /* FREECIV_JSON_CONNECTION */
45621 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
45622 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
45623 }
45624#ifdef FREECIV_JSON_CONNECTION
45625 field_addr.name = "veteran_name";
45626#endif /* FREECIV_JSON_CONNECTION */
45627 {
45628 int i;
45629
45630#ifdef FREECIV_JSON_CONNECTION
45631 /* Enter array. */
45632 field_addr.sub_location = plocation_elem_new(0);
45633#endif /* FREECIV_JSON_CONNECTION */
45634
45635 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45636 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
45637 }
45638 for (i = 0; i < real_packet->veteran_levels; i++) {
45639#ifdef FREECIV_JSON_CONNECTION
45640 field_addr.sub_location->number = i;
45641#endif /* FREECIV_JSON_CONNECTION */
45642 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
45643 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
45644 }
45645 }
45646
45647#ifdef FREECIV_JSON_CONNECTION
45648 /* Exit array. */
45649 FC_FREE(field_addr.sub_location);
45650#endif /* FREECIV_JSON_CONNECTION */
45651 }
45652#ifdef FREECIV_JSON_CONNECTION
45653 field_addr.name = "power_fact";
45654#endif /* FREECIV_JSON_CONNECTION */
45655 {
45656 int i;
45657
45658#ifdef FREECIV_JSON_CONNECTION
45659 /* Enter array. */
45660 field_addr.sub_location = plocation_elem_new(0);
45661#endif /* FREECIV_JSON_CONNECTION */
45662
45663 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45664 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
45665 }
45666 for (i = 0; i < real_packet->veteran_levels; i++) {
45667#ifdef FREECIV_JSON_CONNECTION
45668 field_addr.sub_location->number = i;
45669#endif /* FREECIV_JSON_CONNECTION */
45670 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
45671 RECEIVE_PACKET_FIELD_ERROR(power_fact);
45672 }
45673 }
45674
45675#ifdef FREECIV_JSON_CONNECTION
45676 /* Exit array. */
45677 FC_FREE(field_addr.sub_location);
45678#endif /* FREECIV_JSON_CONNECTION */
45679 }
45680#ifdef FREECIV_JSON_CONNECTION
45681 field_addr.name = "move_bonus";
45682#endif /* FREECIV_JSON_CONNECTION */
45683 {
45684 int i;
45685
45686#ifdef FREECIV_JSON_CONNECTION
45687 /* Enter array. */
45688 field_addr.sub_location = plocation_elem_new(0);
45689#endif /* FREECIV_JSON_CONNECTION */
45690
45691 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45692 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
45693 }
45694 for (i = 0; i < real_packet->veteran_levels; i++) {
45695#ifdef FREECIV_JSON_CONNECTION
45696 field_addr.sub_location->number = i;
45697#endif /* FREECIV_JSON_CONNECTION */
45698 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
45699 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
45700 }
45701 }
45702
45703#ifdef FREECIV_JSON_CONNECTION
45704 /* Exit array. */
45705 FC_FREE(field_addr.sub_location);
45706#endif /* FREECIV_JSON_CONNECTION */
45707 }
45708#ifdef FREECIV_JSON_CONNECTION
45709 field_addr.name = "base_raise_chance";
45710#endif /* FREECIV_JSON_CONNECTION */
45711 {
45712 int i;
45713
45714#ifdef FREECIV_JSON_CONNECTION
45715 /* Enter array. */
45716 field_addr.sub_location = plocation_elem_new(0);
45717#endif /* FREECIV_JSON_CONNECTION */
45718
45719 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45720 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
45721 }
45722 for (i = 0; i < real_packet->veteran_levels; i++) {
45723#ifdef FREECIV_JSON_CONNECTION
45724 field_addr.sub_location->number = i;
45725#endif /* FREECIV_JSON_CONNECTION */
45726 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
45727 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
45728 }
45729 }
45730
45731#ifdef FREECIV_JSON_CONNECTION
45732 /* Exit array. */
45733 FC_FREE(field_addr.sub_location);
45734#endif /* FREECIV_JSON_CONNECTION */
45735 }
45736#ifdef FREECIV_JSON_CONNECTION
45737 field_addr.name = "work_raise_chance";
45738#endif /* FREECIV_JSON_CONNECTION */
45739 {
45740 int i;
45741
45742#ifdef FREECIV_JSON_CONNECTION
45743 /* Enter array. */
45744 field_addr.sub_location = plocation_elem_new(0);
45745#endif /* FREECIV_JSON_CONNECTION */
45746
45747 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45748 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
45749 }
45750 for (i = 0; i < real_packet->veteran_levels; i++) {
45751#ifdef FREECIV_JSON_CONNECTION
45752 field_addr.sub_location->number = i;
45753#endif /* FREECIV_JSON_CONNECTION */
45754 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
45755 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
45756 }
45757 }
45758
45759#ifdef FREECIV_JSON_CONNECTION
45760 /* Exit array. */
45761 FC_FREE(field_addr.sub_location);
45762#endif /* FREECIV_JSON_CONNECTION */
45763 }
45764#ifdef FREECIV_JSON_CONNECTION
45765 field_addr.name = "background_red";
45766#endif /* FREECIV_JSON_CONNECTION */
45767 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_red)) {
45768 RECEIVE_PACKET_FIELD_ERROR(background_red);
45769 }
45770#ifdef FREECIV_JSON_CONNECTION
45771 field_addr.name = "background_green";
45772#endif /* FREECIV_JSON_CONNECTION */
45773 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_green)) {
45774 RECEIVE_PACKET_FIELD_ERROR(background_green);
45775 }
45776#ifdef FREECIV_JSON_CONNECTION
45777 field_addr.name = "background_blue";
45778#endif /* FREECIV_JSON_CONNECTION */
45779 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_blue)) {
45780 RECEIVE_PACKET_FIELD_ERROR(background_blue);
45781 }
45782#endif
45783 log_packet_detailed("packet_ruleset_game_100: got info about ()");
45784
45785#ifdef FREECIV_DELTA_PROTOCOL
45786 if (nullptr == *hash) {
45787 *hash = genhash_new_full(hash_packet_ruleset_game_100, cmp_packet_ruleset_game_100,
45788 nullptr, nullptr, nullptr, destroy_packet_ruleset_game);
45789 }
45790
45791 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45792 *real_packet = *old;
45793 } else {
45794 /* packet is already initialized empty */
45795 log_packet_detailed(" no old info");
45796 }
45797
45798 if (BV_ISSET(fields, 0)) {
45799 log_packet_detailed(" got field 'default_specialist'");
45800#ifdef FREECIV_JSON_CONNECTION
45801 field_addr.name = "default_specialist";
45802#endif /* FREECIV_JSON_CONNECTION */
45803 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->default_specialist)) {
45804 RECEIVE_PACKET_FIELD_ERROR(default_specialist);
45805 }
45806 }
45807 if (BV_ISSET(fields, 1)) {
45808 log_packet_detailed(" got field 'global_init_techs_count'");
45809#ifdef FREECIV_JSON_CONNECTION
45810 field_addr.name = "global_init_techs_count";
45811#endif /* FREECIV_JSON_CONNECTION */
45812 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs_count)) {
45813 RECEIVE_PACKET_FIELD_ERROR(global_init_techs_count);
45814 }
45815 }
45816 if (BV_ISSET(fields, 2)) {
45817 log_packet_detailed(" got field 'global_init_techs'");
45818#ifdef FREECIV_JSON_CONNECTION
45819 field_addr.name = "global_init_techs";
45820#endif /* FREECIV_JSON_CONNECTION */
45821 {
45822 int i;
45823
45824#ifdef FREECIV_JSON_CONNECTION
45825 /* Enter array. */
45826 field_addr.sub_location = plocation_elem_new(0);
45827#endif /* FREECIV_JSON_CONNECTION */
45828
45829 if (real_packet->global_init_techs_count > MAX_NUM_TECH_LIST) {
45830 RECEIVE_PACKET_FIELD_ERROR(global_init_techs, ": truncation array");
45831 }
45832 for (i = 0; i < real_packet->global_init_techs_count; i++) {
45833#ifdef FREECIV_JSON_CONNECTION
45834 field_addr.sub_location->number = i;
45835#endif /* FREECIV_JSON_CONNECTION */
45836 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_init_techs[i])) {
45837 RECEIVE_PACKET_FIELD_ERROR(global_init_techs);
45838 }
45839 }
45840
45841#ifdef FREECIV_JSON_CONNECTION
45842 /* Exit array. */
45843 FC_FREE(field_addr.sub_location);
45844#endif /* FREECIV_JSON_CONNECTION */
45845 }
45846 }
45847 if (BV_ISSET(fields, 3)) {
45848 log_packet_detailed(" got field 'global_init_buildings_count'");
45849#ifdef FREECIV_JSON_CONNECTION
45850 field_addr.name = "global_init_buildings_count";
45851#endif /* FREECIV_JSON_CONNECTION */
45852 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_buildings_count)) {
45853 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings_count);
45854 }
45855 }
45856 if (BV_ISSET(fields, 4)) {
45857 log_packet_detailed(" got field 'global_init_buildings'");
45858#ifdef FREECIV_JSON_CONNECTION
45859 field_addr.name = "global_init_buildings";
45860#endif /* FREECIV_JSON_CONNECTION */
45861 {
45862 int i;
45863
45864#ifdef FREECIV_JSON_CONNECTION
45865 /* Enter array. */
45866 field_addr.sub_location = plocation_elem_new(0);
45867#endif /* FREECIV_JSON_CONNECTION */
45868
45869 if (real_packet->global_init_buildings_count > MAX_NUM_BUILDING_LIST) {
45870 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings, ": truncation array");
45871 }
45872 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
45873#ifdef FREECIV_JSON_CONNECTION
45874 field_addr.sub_location->number = i;
45875#endif /* FREECIV_JSON_CONNECTION */
45876 {
45877 int readin;
45878
45879 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45880 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings);
45881 }
45882 real_packet->global_init_buildings[i] = readin;
45883 }
45884 }
45885
45886#ifdef FREECIV_JSON_CONNECTION
45887 /* Exit array. */
45888 FC_FREE(field_addr.sub_location);
45889#endif /* FREECIV_JSON_CONNECTION */
45890 }
45891 }
45892 if (BV_ISSET(fields, 5)) {
45893 log_packet_detailed(" got field 'veteran_levels'");
45894#ifdef FREECIV_JSON_CONNECTION
45895 field_addr.name = "veteran_levels";
45896#endif /* FREECIV_JSON_CONNECTION */
45897 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
45898 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
45899 }
45900 }
45901 if (BV_ISSET(fields, 6)) {
45902 log_packet_detailed(" got field 'veteran_name'");
45903#ifdef FREECIV_JSON_CONNECTION
45904 field_addr.name = "veteran_name";
45905#endif /* FREECIV_JSON_CONNECTION */
45906 {
45907 int i;
45908
45909#ifdef FREECIV_JSON_CONNECTION
45910 /* Enter array. */
45911 field_addr.sub_location = plocation_elem_new(0);
45912#endif /* FREECIV_JSON_CONNECTION */
45913
45914 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45915 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
45916 }
45917 for (i = 0; i < real_packet->veteran_levels; i++) {
45918#ifdef FREECIV_JSON_CONNECTION
45919 field_addr.sub_location->number = i;
45920#endif /* FREECIV_JSON_CONNECTION */
45921 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
45922 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
45923 }
45924 }
45925
45926#ifdef FREECIV_JSON_CONNECTION
45927 /* Exit array. */
45928 FC_FREE(field_addr.sub_location);
45929#endif /* FREECIV_JSON_CONNECTION */
45930 }
45931 }
45932 if (BV_ISSET(fields, 7)) {
45933 log_packet_detailed(" got field 'power_fact'");
45934#ifdef FREECIV_JSON_CONNECTION
45935 field_addr.name = "power_fact";
45936#endif /* FREECIV_JSON_CONNECTION */
45937 {
45938 int i;
45939
45940#ifdef FREECIV_JSON_CONNECTION
45941 /* Enter array. */
45942 field_addr.sub_location = plocation_elem_new(0);
45943#endif /* FREECIV_JSON_CONNECTION */
45944
45945 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45946 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
45947 }
45948 for (i = 0; i < real_packet->veteran_levels; i++) {
45949#ifdef FREECIV_JSON_CONNECTION
45950 field_addr.sub_location->number = i;
45951#endif /* FREECIV_JSON_CONNECTION */
45952 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
45953 RECEIVE_PACKET_FIELD_ERROR(power_fact);
45954 }
45955 }
45956
45957#ifdef FREECIV_JSON_CONNECTION
45958 /* Exit array. */
45959 FC_FREE(field_addr.sub_location);
45960#endif /* FREECIV_JSON_CONNECTION */
45961 }
45962 }
45963 if (BV_ISSET(fields, 8)) {
45964 log_packet_detailed(" got field 'move_bonus'");
45965#ifdef FREECIV_JSON_CONNECTION
45966 field_addr.name = "move_bonus";
45967#endif /* FREECIV_JSON_CONNECTION */
45968 {
45969 int i;
45970
45971#ifdef FREECIV_JSON_CONNECTION
45972 /* Enter array. */
45973 field_addr.sub_location = plocation_elem_new(0);
45974#endif /* FREECIV_JSON_CONNECTION */
45975
45976 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
45977 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
45978 }
45979 for (i = 0; i < real_packet->veteran_levels; i++) {
45980#ifdef FREECIV_JSON_CONNECTION
45981 field_addr.sub_location->number = i;
45982#endif /* FREECIV_JSON_CONNECTION */
45983 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
45984 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
45985 }
45986 }
45987
45988#ifdef FREECIV_JSON_CONNECTION
45989 /* Exit array. */
45990 FC_FREE(field_addr.sub_location);
45991#endif /* FREECIV_JSON_CONNECTION */
45992 }
45993 }
45994 if (BV_ISSET(fields, 9)) {
45995 log_packet_detailed(" got field 'base_raise_chance'");
45996#ifdef FREECIV_JSON_CONNECTION
45997 field_addr.name = "base_raise_chance";
45998#endif /* FREECIV_JSON_CONNECTION */
45999 {
46000 int i;
46001
46002#ifdef FREECIV_JSON_CONNECTION
46003 /* Enter array. */
46004 field_addr.sub_location = plocation_elem_new(0);
46005#endif /* FREECIV_JSON_CONNECTION */
46006
46007 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
46008 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
46009 }
46010 for (i = 0; i < real_packet->veteran_levels; i++) {
46011#ifdef FREECIV_JSON_CONNECTION
46012 field_addr.sub_location->number = i;
46013#endif /* FREECIV_JSON_CONNECTION */
46014 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
46015 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
46016 }
46017 }
46018
46019#ifdef FREECIV_JSON_CONNECTION
46020 /* Exit array. */
46021 FC_FREE(field_addr.sub_location);
46022#endif /* FREECIV_JSON_CONNECTION */
46023 }
46024 }
46025 if (BV_ISSET(fields, 10)) {
46026 log_packet_detailed(" got field 'work_raise_chance'");
46027#ifdef FREECIV_JSON_CONNECTION
46028 field_addr.name = "work_raise_chance";
46029#endif /* FREECIV_JSON_CONNECTION */
46030 {
46031 int i;
46032
46033#ifdef FREECIV_JSON_CONNECTION
46034 /* Enter array. */
46035 field_addr.sub_location = plocation_elem_new(0);
46036#endif /* FREECIV_JSON_CONNECTION */
46037
46038 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
46039 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
46040 }
46041 for (i = 0; i < real_packet->veteran_levels; i++) {
46042#ifdef FREECIV_JSON_CONNECTION
46043 field_addr.sub_location->number = i;
46044#endif /* FREECIV_JSON_CONNECTION */
46045 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
46046 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
46047 }
46048 }
46049
46050#ifdef FREECIV_JSON_CONNECTION
46051 /* Exit array. */
46052 FC_FREE(field_addr.sub_location);
46053#endif /* FREECIV_JSON_CONNECTION */
46054 }
46055 }
46056 if (BV_ISSET(fields, 11)) {
46057 log_packet_detailed(" got field 'background_red'");
46058#ifdef FREECIV_JSON_CONNECTION
46059 field_addr.name = "background_red";
46060#endif /* FREECIV_JSON_CONNECTION */
46061 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_red)) {
46062 RECEIVE_PACKET_FIELD_ERROR(background_red);
46063 }
46064 }
46065 if (BV_ISSET(fields, 12)) {
46066 log_packet_detailed(" got field 'background_green'");
46067#ifdef FREECIV_JSON_CONNECTION
46068 field_addr.name = "background_green";
46069#endif /* FREECIV_JSON_CONNECTION */
46070 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_green)) {
46071 RECEIVE_PACKET_FIELD_ERROR(background_green);
46072 }
46073 }
46074 if (BV_ISSET(fields, 13)) {
46075 log_packet_detailed(" got field 'background_blue'");
46076#ifdef FREECIV_JSON_CONNECTION
46077 field_addr.name = "background_blue";
46078#endif /* FREECIV_JSON_CONNECTION */
46079 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_blue)) {
46080 RECEIVE_PACKET_FIELD_ERROR(background_blue);
46081 }
46082 }
46083
46084 if (nullptr == old) {
46085 old = fc_malloc(sizeof(*old));
46086 init_packet_ruleset_game(old);
46087 *old = *real_packet;
46088 genhash_insert(*hash, old, old);
46089 } else {
46090 *old = *real_packet;
46091 }
46092
46093#endif /* FREECIV_DELTA_PROTOCOL */
46094 RECEIVE_PACKET_END(real_packet);
46095#undef FREE_PACKET_STRUCT
46096}
46097
46098 static int send_packet_ruleset_game_100(struct connection *pc, const struct packet_ruleset_game *packet)
46099{
46100 const struct packet_ruleset_game *real_packet = packet;
46101 int e;
46102#ifdef FREECIV_DELTA_PROTOCOL
46103 packet_ruleset_game_100_fields fields;
46104 struct packet_ruleset_game *old;
46105 bool differ;
46106 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GAME;
46107#endif /* FREECIV_DELTA_PROTOCOL */
46108 SEND_PACKET_START(PACKET_RULESET_GAME);
46109#ifdef FREECIV_JSON_CONNECTION
46110 struct plocation field_addr;
46111 {
46112 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
46113 field_addr = *field_addr_tmp;
46114 FC_FREE(field_addr_tmp);
46115 }
46116#endif /* FREECIV_JSON_CONNECTION */
46117
46118 log_packet_detailed("packet_ruleset_game_100: sending info about ()");
46119
46120#ifdef FREECIV_DELTA_PROTOCOL
46121 if (nullptr == *hash) {
46122 *hash = genhash_new_full(hash_packet_ruleset_game_100, cmp_packet_ruleset_game_100,
46123 nullptr, nullptr, nullptr, destroy_packet_ruleset_game);
46124 }
46125 BV_CLR_ALL(fields);
46126
46127 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
46128 old = fc_malloc(sizeof(*old));
46129 /* temporary bitcopy just to insert correctly */
46130 *old = *real_packet;
46131 genhash_insert(*hash, old, old);
46132 init_packet_ruleset_game(old);
46133 }
46134 differ = (old->default_specialist != real_packet->default_specialist);
46135 if (differ) {
46136 BV_SET(fields, 0);
46137 }
46138
46139 differ = (old->global_init_techs_count != real_packet->global_init_techs_count);
46140 if (differ) {
46141 BV_SET(fields, 1);
46142 }
46143
46144 differ = (old->global_init_techs_count != real_packet->global_init_techs_count);
46145 if (!differ) {
46146 int i;
46147
46148 for (i = 0; i < real_packet->global_init_techs_count; i++) {
46149 differ = (old->global_init_techs[i] != real_packet->global_init_techs[i]);
46150 if (differ) {
46151 break;
46152 }
46153 }
46154 }
46155 if (differ) {
46156 BV_SET(fields, 2);
46157 }
46158
46159 differ = (old->global_init_buildings_count != real_packet->global_init_buildings_count);
46160 if (differ) {
46161 BV_SET(fields, 3);
46162 }
46163
46164 differ = (old->global_init_buildings_count != real_packet->global_init_buildings_count);
46165 if (!differ) {
46166 int i;
46167
46168 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
46169 differ = (old->global_init_buildings[i] != real_packet->global_init_buildings[i]);
46170 if (differ) {
46171 break;
46172 }
46173 }
46174 }
46175 if (differ) {
46176 BV_SET(fields, 4);
46177 }
46178
46179 differ = (old->veteran_levels != real_packet->veteran_levels);
46180 if (differ) {
46181 BV_SET(fields, 5);
46182 }
46183
46184 differ = (old->veteran_levels != real_packet->veteran_levels);
46185 if (!differ) {
46186 int i;
46187
46188 for (i = 0; i < real_packet->veteran_levels; i++) {
46189 differ = (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0);
46190 if (differ) {
46191 break;
46192 }
46193 }
46194 }
46195 if (differ) {
46196 BV_SET(fields, 6);
46197 }
46198
46199 differ = (old->veteran_levels != real_packet->veteran_levels);
46200 if (!differ) {
46201 int i;
46202
46203 for (i = 0; i < real_packet->veteran_levels; i++) {
46204 differ = (old->power_fact[i] != real_packet->power_fact[i]);
46205 if (differ) {
46206 break;
46207 }
46208 }
46209 }
46210 if (differ) {
46211 BV_SET(fields, 7);
46212 }
46213
46214 differ = (old->veteran_levels != real_packet->veteran_levels);
46215 if (!differ) {
46216 int i;
46217
46218 for (i = 0; i < real_packet->veteran_levels; i++) {
46219 differ = (old->move_bonus[i] != real_packet->move_bonus[i]);
46220 if (differ) {
46221 break;
46222 }
46223 }
46224 }
46225 if (differ) {
46226 BV_SET(fields, 8);
46227 }
46228
46229 differ = (old->veteran_levels != real_packet->veteran_levels);
46230 if (!differ) {
46231 int i;
46232
46233 for (i = 0; i < real_packet->veteran_levels; i++) {
46234 differ = (old->base_raise_chance[i] != real_packet->base_raise_chance[i]);
46235 if (differ) {
46236 break;
46237 }
46238 }
46239 }
46240 if (differ) {
46241 BV_SET(fields, 9);
46242 }
46243
46244 differ = (old->veteran_levels != real_packet->veteran_levels);
46245 if (!differ) {
46246 int i;
46247
46248 for (i = 0; i < real_packet->veteran_levels; i++) {
46249 differ = (old->work_raise_chance[i] != real_packet->work_raise_chance[i]);
46250 if (differ) {
46251 break;
46252 }
46253 }
46254 }
46255 if (differ) {
46256 BV_SET(fields, 10);
46257 }
46258
46259 differ = (old->background_red != real_packet->background_red);
46260 if (differ) {
46261 BV_SET(fields, 11);
46262 }
46263
46264 differ = (old->background_green != real_packet->background_green);
46265 if (differ) {
46266 BV_SET(fields, 12);
46267 }
46268
46269 differ = (old->background_blue != real_packet->background_blue);
46270 if (differ) {
46271 BV_SET(fields, 13);
46272 }
46273
46274
46275#ifdef FREECIV_JSON_CONNECTION
46276 field_addr.name = "fields";
46277#endif /* FREECIV_JSON_CONNECTION */
46278 e = 0;
46279 e |= DIO_BV_PUT(&dout, &field_addr, fields);
46280 if (e) {
46281 log_packet_detailed("fields bitvector error detected");
46282 }
46283
46284 if (BV_ISSET(fields, 0)) {
46285 log_packet_detailed(" field 'default_specialist' has changed");
46286#ifdef FREECIV_JSON_CONNECTION
46287 field_addr.name = "default_specialist";
46288#endif /* FREECIV_JSON_CONNECTION */
46289 e = 0;
46290 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->default_specialist);
46291 if (e) {
46292 log_packet_detailed("'default_specialist' field error detected");
46293 }
46294 }
46295 if (BV_ISSET(fields, 1)) {
46296 log_packet_detailed(" field 'global_init_techs_count' has changed");
46297#ifdef FREECIV_JSON_CONNECTION
46298 field_addr.name = "global_init_techs_count";
46299#endif /* FREECIV_JSON_CONNECTION */
46300 e = 0;
46301 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs_count);
46302 if (e) {
46303 log_packet_detailed("'global_init_techs_count' field error detected");
46304 }
46305 }
46306 if (BV_ISSET(fields, 2)) {
46307 log_packet_detailed(" field 'global_init_techs' has changed");
46308#ifdef FREECIV_JSON_CONNECTION
46309 field_addr.name = "global_init_techs";
46310#endif /* FREECIV_JSON_CONNECTION */
46311 e = 0;
46312 {
46313 int i;
46314
46315#ifdef FREECIV_JSON_CONNECTION
46316 /* Create the array. */
46317 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_techs_count);
46318
46319 /* Enter the array. */
46320 field_addr.sub_location = plocation_elem_new(0);
46321#endif /* FREECIV_JSON_CONNECTION */
46322
46323 for (i = 0; i < real_packet->global_init_techs_count; i++) {
46324#ifdef FREECIV_JSON_CONNECTION
46325 /* Next array element. */
46326 field_addr.sub_location->number = i;
46327#endif /* FREECIV_JSON_CONNECTION */
46328 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_init_techs[i]);
46329 }
46330
46331#ifdef FREECIV_JSON_CONNECTION
46332 /* Exit array. */
46333 FC_FREE(field_addr.sub_location);
46334#endif /* FREECIV_JSON_CONNECTION */
46335 }
46336 if (e) {
46337 log_packet_detailed("'global_init_techs' field error detected");
46338 }
46339 }
46340 if (BV_ISSET(fields, 3)) {
46341 log_packet_detailed(" field 'global_init_buildings_count' has changed");
46342#ifdef FREECIV_JSON_CONNECTION
46343 field_addr.name = "global_init_buildings_count";
46344#endif /* FREECIV_JSON_CONNECTION */
46345 e = 0;
46346 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings_count);
46347 if (e) {
46348 log_packet_detailed("'global_init_buildings_count' field error detected");
46349 }
46350 }
46351 if (BV_ISSET(fields, 4)) {
46352 log_packet_detailed(" field 'global_init_buildings' has changed");
46353#ifdef FREECIV_JSON_CONNECTION
46354 field_addr.name = "global_init_buildings";
46355#endif /* FREECIV_JSON_CONNECTION */
46356 e = 0;
46357 {
46358 int i;
46359
46360#ifdef FREECIV_JSON_CONNECTION
46361 /* Create the array. */
46362 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_buildings_count);
46363
46364 /* Enter the array. */
46365 field_addr.sub_location = plocation_elem_new(0);
46366#endif /* FREECIV_JSON_CONNECTION */
46367
46368 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
46369#ifdef FREECIV_JSON_CONNECTION
46370 /* Next array element. */
46371 field_addr.sub_location->number = i;
46372#endif /* FREECIV_JSON_CONNECTION */
46373 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings[i]);
46374 }
46375
46376#ifdef FREECIV_JSON_CONNECTION
46377 /* Exit array. */
46378 FC_FREE(field_addr.sub_location);
46379#endif /* FREECIV_JSON_CONNECTION */
46380 }
46381 if (e) {
46382 log_packet_detailed("'global_init_buildings' field error detected");
46383 }
46384 }
46385 if (BV_ISSET(fields, 5)) {
46386 log_packet_detailed(" field 'veteran_levels' has changed");
46387#ifdef FREECIV_JSON_CONNECTION
46388 field_addr.name = "veteran_levels";
46389#endif /* FREECIV_JSON_CONNECTION */
46390 e = 0;
46391 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
46392 if (e) {
46393 log_packet_detailed("'veteran_levels' field error detected");
46394 }
46395 }
46396 if (BV_ISSET(fields, 6)) {
46397 log_packet_detailed(" field 'veteran_name' has changed");
46398#ifdef FREECIV_JSON_CONNECTION
46399 field_addr.name = "veteran_name";
46400#endif /* FREECIV_JSON_CONNECTION */
46401 e = 0;
46402 {
46403 int i;
46404
46405#ifdef FREECIV_JSON_CONNECTION
46406 /* Create the array. */
46407 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46408
46409 /* Enter the array. */
46410 field_addr.sub_location = plocation_elem_new(0);
46411#endif /* FREECIV_JSON_CONNECTION */
46412
46413 for (i = 0; i < real_packet->veteran_levels; i++) {
46414#ifdef FREECIV_JSON_CONNECTION
46415 /* Next array element. */
46416 field_addr.sub_location->number = i;
46417#endif /* FREECIV_JSON_CONNECTION */
46418 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
46419 }
46420
46421#ifdef FREECIV_JSON_CONNECTION
46422 /* Exit array. */
46423 FC_FREE(field_addr.sub_location);
46424#endif /* FREECIV_JSON_CONNECTION */
46425 }
46426 if (e) {
46427 log_packet_detailed("'veteran_name' field error detected");
46428 }
46429 }
46430 if (BV_ISSET(fields, 7)) {
46431 log_packet_detailed(" field 'power_fact' has changed");
46432#ifdef FREECIV_JSON_CONNECTION
46433 field_addr.name = "power_fact";
46434#endif /* FREECIV_JSON_CONNECTION */
46435 e = 0;
46436 {
46437 int i;
46438
46439#ifdef FREECIV_JSON_CONNECTION
46440 /* Create the array. */
46441 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46442
46443 /* Enter the array. */
46444 field_addr.sub_location = plocation_elem_new(0);
46445#endif /* FREECIV_JSON_CONNECTION */
46446
46447 for (i = 0; i < real_packet->veteran_levels; i++) {
46448#ifdef FREECIV_JSON_CONNECTION
46449 /* Next array element. */
46450 field_addr.sub_location->number = i;
46451#endif /* FREECIV_JSON_CONNECTION */
46452 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
46453 }
46454
46455#ifdef FREECIV_JSON_CONNECTION
46456 /* Exit array. */
46457 FC_FREE(field_addr.sub_location);
46458#endif /* FREECIV_JSON_CONNECTION */
46459 }
46460 if (e) {
46461 log_packet_detailed("'power_fact' field error detected");
46462 }
46463 }
46464 if (BV_ISSET(fields, 8)) {
46465 log_packet_detailed(" field 'move_bonus' has changed");
46466#ifdef FREECIV_JSON_CONNECTION
46467 field_addr.name = "move_bonus";
46468#endif /* FREECIV_JSON_CONNECTION */
46469 e = 0;
46470 {
46471 int i;
46472
46473#ifdef FREECIV_JSON_CONNECTION
46474 /* Create the array. */
46475 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46476
46477 /* Enter the array. */
46478 field_addr.sub_location = plocation_elem_new(0);
46479#endif /* FREECIV_JSON_CONNECTION */
46480
46481 for (i = 0; i < real_packet->veteran_levels; i++) {
46482#ifdef FREECIV_JSON_CONNECTION
46483 /* Next array element. */
46484 field_addr.sub_location->number = i;
46485#endif /* FREECIV_JSON_CONNECTION */
46486 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
46487 }
46488
46489#ifdef FREECIV_JSON_CONNECTION
46490 /* Exit array. */
46491 FC_FREE(field_addr.sub_location);
46492#endif /* FREECIV_JSON_CONNECTION */
46493 }
46494 if (e) {
46495 log_packet_detailed("'move_bonus' field error detected");
46496 }
46497 }
46498 if (BV_ISSET(fields, 9)) {
46499 log_packet_detailed(" field 'base_raise_chance' has changed");
46500#ifdef FREECIV_JSON_CONNECTION
46501 field_addr.name = "base_raise_chance";
46502#endif /* FREECIV_JSON_CONNECTION */
46503 e = 0;
46504 {
46505 int i;
46506
46507#ifdef FREECIV_JSON_CONNECTION
46508 /* Create the array. */
46509 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46510
46511 /* Enter the array. */
46512 field_addr.sub_location = plocation_elem_new(0);
46513#endif /* FREECIV_JSON_CONNECTION */
46514
46515 for (i = 0; i < real_packet->veteran_levels; i++) {
46516#ifdef FREECIV_JSON_CONNECTION
46517 /* Next array element. */
46518 field_addr.sub_location->number = i;
46519#endif /* FREECIV_JSON_CONNECTION */
46520 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
46521 }
46522
46523#ifdef FREECIV_JSON_CONNECTION
46524 /* Exit array. */
46525 FC_FREE(field_addr.sub_location);
46526#endif /* FREECIV_JSON_CONNECTION */
46527 }
46528 if (e) {
46529 log_packet_detailed("'base_raise_chance' field error detected");
46530 }
46531 }
46532 if (BV_ISSET(fields, 10)) {
46533 log_packet_detailed(" field 'work_raise_chance' has changed");
46534#ifdef FREECIV_JSON_CONNECTION
46535 field_addr.name = "work_raise_chance";
46536#endif /* FREECIV_JSON_CONNECTION */
46537 e = 0;
46538 {
46539 int i;
46540
46541#ifdef FREECIV_JSON_CONNECTION
46542 /* Create the array. */
46543 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46544
46545 /* Enter the array. */
46546 field_addr.sub_location = plocation_elem_new(0);
46547#endif /* FREECIV_JSON_CONNECTION */
46548
46549 for (i = 0; i < real_packet->veteran_levels; i++) {
46550#ifdef FREECIV_JSON_CONNECTION
46551 /* Next array element. */
46552 field_addr.sub_location->number = i;
46553#endif /* FREECIV_JSON_CONNECTION */
46554 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
46555 }
46556
46557#ifdef FREECIV_JSON_CONNECTION
46558 /* Exit array. */
46559 FC_FREE(field_addr.sub_location);
46560#endif /* FREECIV_JSON_CONNECTION */
46561 }
46562 if (e) {
46563 log_packet_detailed("'work_raise_chance' field error detected");
46564 }
46565 }
46566 if (BV_ISSET(fields, 11)) {
46567 log_packet_detailed(" field 'background_red' has changed");
46568#ifdef FREECIV_JSON_CONNECTION
46569 field_addr.name = "background_red";
46570#endif /* FREECIV_JSON_CONNECTION */
46571 e = 0;
46572 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_red);
46573 if (e) {
46574 log_packet_detailed("'background_red' field error detected");
46575 }
46576 }
46577 if (BV_ISSET(fields, 12)) {
46578 log_packet_detailed(" field 'background_green' has changed");
46579#ifdef FREECIV_JSON_CONNECTION
46580 field_addr.name = "background_green";
46581#endif /* FREECIV_JSON_CONNECTION */
46582 e = 0;
46583 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_green);
46584 if (e) {
46585 log_packet_detailed("'background_green' field error detected");
46586 }
46587 }
46588 if (BV_ISSET(fields, 13)) {
46589 log_packet_detailed(" field 'background_blue' has changed");
46590#ifdef FREECIV_JSON_CONNECTION
46591 field_addr.name = "background_blue";
46592#endif /* FREECIV_JSON_CONNECTION */
46593 e = 0;
46594 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_blue);
46595 if (e) {
46596 log_packet_detailed("'background_blue' field error detected");
46597 }
46598 }
46599
46600 *old = *real_packet;
46601#endif /* FREECIV_DELTA_PROTOCOL */
46602#ifndef FREECIV_DELTA_PROTOCOL
46603#ifdef FREECIV_JSON_CONNECTION
46604 field_addr.name = "default_specialist";
46605#endif /* FREECIV_JSON_CONNECTION */
46606 e = 0;
46607 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->default_specialist);
46608 if (e) {
46609 log_packet_detailed("'default_specialist' field error detected");
46610 }
46611#ifdef FREECIV_JSON_CONNECTION
46612 field_addr.name = "global_init_techs_count";
46613#endif /* FREECIV_JSON_CONNECTION */
46614 e = 0;
46615 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs_count);
46616 if (e) {
46617 log_packet_detailed("'global_init_techs_count' field error detected");
46618 }
46619#ifdef FREECIV_JSON_CONNECTION
46620 field_addr.name = "global_init_techs";
46621#endif /* FREECIV_JSON_CONNECTION */
46622 e = 0;
46623 {
46624 int i;
46625
46626#ifdef FREECIV_JSON_CONNECTION
46627 /* Create the array. */
46628 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_techs_count);
46629
46630 /* Enter the array. */
46631 field_addr.sub_location = plocation_elem_new(0);
46632#endif /* FREECIV_JSON_CONNECTION */
46633
46634 for (i = 0; i < real_packet->global_init_techs_count; i++) {
46635#ifdef FREECIV_JSON_CONNECTION
46636 /* Next array element. */
46637 field_addr.sub_location->number = i;
46638#endif /* FREECIV_JSON_CONNECTION */
46639 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_init_techs[i]);
46640 }
46641
46642#ifdef FREECIV_JSON_CONNECTION
46643 /* Exit array. */
46644 FC_FREE(field_addr.sub_location);
46645#endif /* FREECIV_JSON_CONNECTION */
46646 }
46647 if (e) {
46648 log_packet_detailed("'global_init_techs' field error detected");
46649 }
46650#ifdef FREECIV_JSON_CONNECTION
46651 field_addr.name = "global_init_buildings_count";
46652#endif /* FREECIV_JSON_CONNECTION */
46653 e = 0;
46654 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings_count);
46655 if (e) {
46656 log_packet_detailed("'global_init_buildings_count' field error detected");
46657 }
46658#ifdef FREECIV_JSON_CONNECTION
46659 field_addr.name = "global_init_buildings";
46660#endif /* FREECIV_JSON_CONNECTION */
46661 e = 0;
46662 {
46663 int i;
46664
46665#ifdef FREECIV_JSON_CONNECTION
46666 /* Create the array. */
46667 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_buildings_count);
46668
46669 /* Enter the array. */
46670 field_addr.sub_location = plocation_elem_new(0);
46671#endif /* FREECIV_JSON_CONNECTION */
46672
46673 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
46674#ifdef FREECIV_JSON_CONNECTION
46675 /* Next array element. */
46676 field_addr.sub_location->number = i;
46677#endif /* FREECIV_JSON_CONNECTION */
46678 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings[i]);
46679 }
46680
46681#ifdef FREECIV_JSON_CONNECTION
46682 /* Exit array. */
46683 FC_FREE(field_addr.sub_location);
46684#endif /* FREECIV_JSON_CONNECTION */
46685 }
46686 if (e) {
46687 log_packet_detailed("'global_init_buildings' field error detected");
46688 }
46689#ifdef FREECIV_JSON_CONNECTION
46690 field_addr.name = "veteran_levels";
46691#endif /* FREECIV_JSON_CONNECTION */
46692 e = 0;
46693 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
46694 if (e) {
46695 log_packet_detailed("'veteran_levels' field error detected");
46696 }
46697#ifdef FREECIV_JSON_CONNECTION
46698 field_addr.name = "veteran_name";
46699#endif /* FREECIV_JSON_CONNECTION */
46700 e = 0;
46701 {
46702 int i;
46703
46704#ifdef FREECIV_JSON_CONNECTION
46705 /* Create the array. */
46706 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46707
46708 /* Enter the array. */
46709 field_addr.sub_location = plocation_elem_new(0);
46710#endif /* FREECIV_JSON_CONNECTION */
46711
46712 for (i = 0; i < real_packet->veteran_levels; i++) {
46713#ifdef FREECIV_JSON_CONNECTION
46714 /* Next array element. */
46715 field_addr.sub_location->number = i;
46716#endif /* FREECIV_JSON_CONNECTION */
46717 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
46718 }
46719
46720#ifdef FREECIV_JSON_CONNECTION
46721 /* Exit array. */
46722 FC_FREE(field_addr.sub_location);
46723#endif /* FREECIV_JSON_CONNECTION */
46724 }
46725 if (e) {
46726 log_packet_detailed("'veteran_name' field error detected");
46727 }
46728#ifdef FREECIV_JSON_CONNECTION
46729 field_addr.name = "power_fact";
46730#endif /* FREECIV_JSON_CONNECTION */
46731 e = 0;
46732 {
46733 int i;
46734
46735#ifdef FREECIV_JSON_CONNECTION
46736 /* Create the array. */
46737 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46738
46739 /* Enter the array. */
46740 field_addr.sub_location = plocation_elem_new(0);
46741#endif /* FREECIV_JSON_CONNECTION */
46742
46743 for (i = 0; i < real_packet->veteran_levels; i++) {
46744#ifdef FREECIV_JSON_CONNECTION
46745 /* Next array element. */
46746 field_addr.sub_location->number = i;
46747#endif /* FREECIV_JSON_CONNECTION */
46748 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
46749 }
46750
46751#ifdef FREECIV_JSON_CONNECTION
46752 /* Exit array. */
46753 FC_FREE(field_addr.sub_location);
46754#endif /* FREECIV_JSON_CONNECTION */
46755 }
46756 if (e) {
46757 log_packet_detailed("'power_fact' field error detected");
46758 }
46759#ifdef FREECIV_JSON_CONNECTION
46760 field_addr.name = "move_bonus";
46761#endif /* FREECIV_JSON_CONNECTION */
46762 e = 0;
46763 {
46764 int i;
46765
46766#ifdef FREECIV_JSON_CONNECTION
46767 /* Create the array. */
46768 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46769
46770 /* Enter the array. */
46771 field_addr.sub_location = plocation_elem_new(0);
46772#endif /* FREECIV_JSON_CONNECTION */
46773
46774 for (i = 0; i < real_packet->veteran_levels; i++) {
46775#ifdef FREECIV_JSON_CONNECTION
46776 /* Next array element. */
46777 field_addr.sub_location->number = i;
46778#endif /* FREECIV_JSON_CONNECTION */
46779 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
46780 }
46781
46782#ifdef FREECIV_JSON_CONNECTION
46783 /* Exit array. */
46784 FC_FREE(field_addr.sub_location);
46785#endif /* FREECIV_JSON_CONNECTION */
46786 }
46787 if (e) {
46788 log_packet_detailed("'move_bonus' field error detected");
46789 }
46790#ifdef FREECIV_JSON_CONNECTION
46791 field_addr.name = "base_raise_chance";
46792#endif /* FREECIV_JSON_CONNECTION */
46793 e = 0;
46794 {
46795 int i;
46796
46797#ifdef FREECIV_JSON_CONNECTION
46798 /* Create the array. */
46799 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46800
46801 /* Enter the array. */
46802 field_addr.sub_location = plocation_elem_new(0);
46803#endif /* FREECIV_JSON_CONNECTION */
46804
46805 for (i = 0; i < real_packet->veteran_levels; i++) {
46806#ifdef FREECIV_JSON_CONNECTION
46807 /* Next array element. */
46808 field_addr.sub_location->number = i;
46809#endif /* FREECIV_JSON_CONNECTION */
46810 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
46811 }
46812
46813#ifdef FREECIV_JSON_CONNECTION
46814 /* Exit array. */
46815 FC_FREE(field_addr.sub_location);
46816#endif /* FREECIV_JSON_CONNECTION */
46817 }
46818 if (e) {
46819 log_packet_detailed("'base_raise_chance' field error detected");
46820 }
46821#ifdef FREECIV_JSON_CONNECTION
46822 field_addr.name = "work_raise_chance";
46823#endif /* FREECIV_JSON_CONNECTION */
46824 e = 0;
46825 {
46826 int i;
46827
46828#ifdef FREECIV_JSON_CONNECTION
46829 /* Create the array. */
46830 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
46831
46832 /* Enter the array. */
46833 field_addr.sub_location = plocation_elem_new(0);
46834#endif /* FREECIV_JSON_CONNECTION */
46835
46836 for (i = 0; i < real_packet->veteran_levels; i++) {
46837#ifdef FREECIV_JSON_CONNECTION
46838 /* Next array element. */
46839 field_addr.sub_location->number = i;
46840#endif /* FREECIV_JSON_CONNECTION */
46841 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
46842 }
46843
46844#ifdef FREECIV_JSON_CONNECTION
46845 /* Exit array. */
46846 FC_FREE(field_addr.sub_location);
46847#endif /* FREECIV_JSON_CONNECTION */
46848 }
46849 if (e) {
46850 log_packet_detailed("'work_raise_chance' field error detected");
46851 }
46852#ifdef FREECIV_JSON_CONNECTION
46853 field_addr.name = "background_red";
46854#endif /* FREECIV_JSON_CONNECTION */
46855 e = 0;
46856 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_red);
46857 if (e) {
46858 log_packet_detailed("'background_red' field error detected");
46859 }
46860#ifdef FREECIV_JSON_CONNECTION
46861 field_addr.name = "background_green";
46862#endif /* FREECIV_JSON_CONNECTION */
46863 e = 0;
46864 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_green);
46865 if (e) {
46866 log_packet_detailed("'background_green' field error detected");
46867 }
46868#ifdef FREECIV_JSON_CONNECTION
46869 field_addr.name = "background_blue";
46870#endif /* FREECIV_JSON_CONNECTION */
46871 e = 0;
46872 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_blue);
46873 if (e) {
46874 log_packet_detailed("'background_blue' field error detected");
46875 }
46876
46877#endif
46878 SEND_PACKET_END(PACKET_RULESET_GAME);
46879}
46880
46881 int send_packet_ruleset_game(struct connection *pc, const struct packet_ruleset_game *packet)
46882{
46883 if (!pc->used) {
46884 log_error("WARNING: trying to send data to the closed connection %s",
46885 conn_description(pc));
46886 return -1;
46887 }
46888 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GAME].packet != nullptr, -1,
46889 "Handler for PACKET_RULESET_GAME not installed");
46890 return pc->phs.handlers->send[PACKET_RULESET_GAME].packet(pc, packet);
46891}
46892
46893 void lsend_packet_ruleset_game(struct conn_list *dest, const struct packet_ruleset_game *packet)
46894{
46895 conn_list_iterate(dest, pconn) {
46896 send_packet_ruleset_game(pconn, packet);
46897 } conn_list_iterate_end;
46898}
46899
46900 static inline void init_packet_ruleset_specialist(struct packet_ruleset_specialist *packet)
46901{
46902 memset(packet, 0, sizeof(*packet));
46903
46904 /* no work needed for packet->id */
46905 /* no work needed for packet->plural_name */
46906 /* no work needed for packet->rule_name */
46907 /* no work needed for packet->short_name */
46908 /* no work needed for packet->graphic_str */
46909 /* no work needed for packet->graphic_alt */
46910 /* no work needed for packet->reqs_count */
46911 /* no work needed for packet->reqs */
46912 packet->helptext = strvec_new();
46913}
46914
46915 static inline void free_packet_ruleset_specialist(struct packet_ruleset_specialist *packet)
46916{
46917 if (packet->helptext) {
46918 strvec_destroy(packet->helptext);
46919 packet->helptext = nullptr;
46920 }
46921 /* no work needed for packet->reqs */
46922 /* no work needed for packet->reqs_count */
46923 /* no work needed for packet->graphic_alt */
46924 /* no work needed for packet->graphic_str */
46925 /* no work needed for packet->short_name */
46926 /* no work needed for packet->rule_name */
46927 /* no work needed for packet->plural_name */
46928 /* no work needed for packet->id */
46929}
46930
46931 static inline void destroy_packet_ruleset_specialist(void *packet)
46932{
46933 free_packet_ruleset_specialist((struct packet_ruleset_specialist *) packet);
46934 free(packet);
46935}
46936
46937#ifdef FREECIV_DELTA_PROTOCOL
46938#define hash_packet_ruleset_specialist_100 hash_const
46939
46940#define cmp_packet_ruleset_specialist_100 cmp_const
46941
46942 BV_DEFINE(packet_ruleset_specialist_100_fields, 9);
46943#endif /* FREECIV_DELTA_PROTOCOL */
46944
46945 static struct packet_ruleset_specialist *receive_packet_ruleset_specialist_100(struct connection *pc)
46946{
46947#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_specialist(_packet)
46948#ifdef FREECIV_DELTA_PROTOCOL
46949 packet_ruleset_specialist_100_fields fields;
46950 struct packet_ruleset_specialist *old;
46951 struct genhash **hash = pc->phs.received + PACKET_RULESET_SPECIALIST;
46952#endif /* FREECIV_DELTA_PROTOCOL */
46953 RECEIVE_PACKET_START(packet_ruleset_specialist, real_packet);
46954#ifdef FREECIV_JSON_CONNECTION
46955 struct plocation field_addr;
46956 {
46957 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
46958 field_addr = *field_addr_tmp;
46959 FC_FREE(field_addr_tmp);
46960 }
46961#endif /* FREECIV_JSON_CONNECTION */
46962
46963#ifdef FREECIV_DELTA_PROTOCOL
46964#ifdef FREECIV_JSON_CONNECTION
46965 field_addr.name = "fields";
46966#endif /* FREECIV_JSON_CONNECTION */
46967 DIO_BV_GET(&din, &field_addr, fields);
46968
46969#else /* FREECIV_DELTA_PROTOCOL */
46970#ifdef FREECIV_JSON_CONNECTION
46971 field_addr.name = "id";
46972#endif /* FREECIV_JSON_CONNECTION */
46973 {
46974 int readin;
46975
46976 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
46977 RECEIVE_PACKET_FIELD_ERROR(id);
46978 }
46979 real_packet->id = readin;
46980 }
46981#ifdef FREECIV_JSON_CONNECTION
46982 field_addr.name = "plural_name";
46983#endif /* FREECIV_JSON_CONNECTION */
46984 if (!DIO_GET(string, &din, &field_addr, real_packet->plural_name, sizeof(real_packet->plural_name))) {
46985 RECEIVE_PACKET_FIELD_ERROR(plural_name);
46986 }
46987#ifdef FREECIV_JSON_CONNECTION
46988 field_addr.name = "rule_name";
46989#endif /* FREECIV_JSON_CONNECTION */
46990 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
46991 RECEIVE_PACKET_FIELD_ERROR(rule_name);
46992 }
46993#ifdef FREECIV_JSON_CONNECTION
46994 field_addr.name = "short_name";
46995#endif /* FREECIV_JSON_CONNECTION */
46996 if (!DIO_GET(string, &din, &field_addr, real_packet->short_name, sizeof(real_packet->short_name))) {
46997 RECEIVE_PACKET_FIELD_ERROR(short_name);
46998 }
46999#ifdef FREECIV_JSON_CONNECTION
47000 field_addr.name = "graphic_str";
47001#endif /* FREECIV_JSON_CONNECTION */
47002 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
47003 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
47004 }
47005#ifdef FREECIV_JSON_CONNECTION
47006 field_addr.name = "graphic_alt";
47007#endif /* FREECIV_JSON_CONNECTION */
47008 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
47009 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
47010 }
47011#ifdef FREECIV_JSON_CONNECTION
47012 field_addr.name = "reqs_count";
47013#endif /* FREECIV_JSON_CONNECTION */
47014 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
47015 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
47016 }
47017#ifdef FREECIV_JSON_CONNECTION
47018 field_addr.name = "reqs";
47019#endif /* FREECIV_JSON_CONNECTION */
47020 {
47021 int i;
47022
47023#ifdef FREECIV_JSON_CONNECTION
47024 /* Enter array. */
47025 field_addr.sub_location = plocation_elem_new(0);
47026#endif /* FREECIV_JSON_CONNECTION */
47027
47028 if (real_packet->reqs_count > MAX_NUM_REQS) {
47029 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
47030 }
47031 for (i = 0; i < real_packet->reqs_count; i++) {
47032#ifdef FREECIV_JSON_CONNECTION
47033 field_addr.sub_location->number = i;
47034#endif /* FREECIV_JSON_CONNECTION */
47035 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
47036 RECEIVE_PACKET_FIELD_ERROR(reqs);
47037 }
47038 }
47039
47040#ifdef FREECIV_JSON_CONNECTION
47041 /* Exit array. */
47042 FC_FREE(field_addr.sub_location);
47043#endif /* FREECIV_JSON_CONNECTION */
47044 }
47045#ifdef FREECIV_JSON_CONNECTION
47046 field_addr.name = "helptext";
47047#endif /* FREECIV_JSON_CONNECTION */
47048 {
47049 int i;
47050
47051 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
47052 RECEIVE_PACKET_FIELD_ERROR(helptext);
47053 }
47054 strvec_reserve(real_packet->helptext, i);
47055
47056#ifdef FREECIV_JSON_CONNECTION
47057 field_addr.sub_location = plocation_elem_new(0);
47058#endif /* FREECIV_JSON_CONNECTION */
47059
47060 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
47061 char readin[MAX_LEN_PACKET];
47062
47063#ifdef FREECIV_JSON_CONNECTION
47064 /* Next array element */
47065 field_addr.sub_location->number = i;
47066#endif /* FREECIV_JSON_CONNECTION */
47067
47068 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
47069 || !strvec_set(real_packet->helptext, i, readin)) {
47070 RECEIVE_PACKET_FIELD_ERROR(helptext);
47071 }
47072 }
47073
47074#ifdef FREECIV_JSON_CONNECTION
47075 FC_FREE(field_addr.sub_location);
47076#endif /* FREECIV_JSON_CONNECTION */
47077 }
47078#endif
47079 log_packet_detailed("packet_ruleset_specialist_100: got info about ()");
47080
47081#ifdef FREECIV_DELTA_PROTOCOL
47082 if (nullptr == *hash) {
47083 *hash = genhash_new_full(hash_packet_ruleset_specialist_100, cmp_packet_ruleset_specialist_100,
47084 nullptr, nullptr, nullptr, destroy_packet_ruleset_specialist);
47085 }
47086
47087 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47088 real_packet->id = old->id;
47089 sz_strlcpy(real_packet->plural_name, old->plural_name);
47090 sz_strlcpy(real_packet->rule_name, old->rule_name);
47091 sz_strlcpy(real_packet->short_name, old->short_name);
47092 sz_strlcpy(real_packet->graphic_str, old->graphic_str);
47093 sz_strlcpy(real_packet->graphic_alt, old->graphic_alt);
47094 real_packet->reqs_count = old->reqs_count;
47095 {
47096 int i;
47097
47098 for (i = 0; i < old->reqs_count; i++) {
47099 real_packet->reqs[i] = old->reqs[i];
47100 }
47101 }
47102 if (old->helptext) {
47103 strvec_copy(real_packet->helptext, old->helptext);
47104 } else {
47105 strvec_clear(real_packet->helptext);
47106 }
47107 } else {
47108 /* packet is already initialized empty */
47109 log_packet_detailed(" no old info");
47110 }
47111
47112 if (BV_ISSET(fields, 0)) {
47113 log_packet_detailed(" got field 'id'");
47114#ifdef FREECIV_JSON_CONNECTION
47115 field_addr.name = "id";
47116#endif /* FREECIV_JSON_CONNECTION */
47117 {
47118 int readin;
47119
47120 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
47121 RECEIVE_PACKET_FIELD_ERROR(id);
47122 }
47123 real_packet->id = readin;
47124 }
47125 }
47126 if (BV_ISSET(fields, 1)) {
47127 log_packet_detailed(" got field 'plural_name'");
47128#ifdef FREECIV_JSON_CONNECTION
47129 field_addr.name = "plural_name";
47130#endif /* FREECIV_JSON_CONNECTION */
47131 if (!DIO_GET(string, &din, &field_addr, real_packet->plural_name, sizeof(real_packet->plural_name))) {
47132 RECEIVE_PACKET_FIELD_ERROR(plural_name);
47133 }
47134 }
47135 if (BV_ISSET(fields, 2)) {
47136 log_packet_detailed(" got field 'rule_name'");
47137#ifdef FREECIV_JSON_CONNECTION
47138 field_addr.name = "rule_name";
47139#endif /* FREECIV_JSON_CONNECTION */
47140 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
47141 RECEIVE_PACKET_FIELD_ERROR(rule_name);
47142 }
47143 }
47144 if (BV_ISSET(fields, 3)) {
47145 log_packet_detailed(" got field 'short_name'");
47146#ifdef FREECIV_JSON_CONNECTION
47147 field_addr.name = "short_name";
47148#endif /* FREECIV_JSON_CONNECTION */
47149 if (!DIO_GET(string, &din, &field_addr, real_packet->short_name, sizeof(real_packet->short_name))) {
47150 RECEIVE_PACKET_FIELD_ERROR(short_name);
47151 }
47152 }
47153 if (BV_ISSET(fields, 4)) {
47154 log_packet_detailed(" got field 'graphic_str'");
47155#ifdef FREECIV_JSON_CONNECTION
47156 field_addr.name = "graphic_str";
47157#endif /* FREECIV_JSON_CONNECTION */
47158 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
47159 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
47160 }
47161 }
47162 if (BV_ISSET(fields, 5)) {
47163 log_packet_detailed(" got field 'graphic_alt'");
47164#ifdef FREECIV_JSON_CONNECTION
47165 field_addr.name = "graphic_alt";
47166#endif /* FREECIV_JSON_CONNECTION */
47167 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
47168 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
47169 }
47170 }
47171 if (BV_ISSET(fields, 6)) {
47172 log_packet_detailed(" got field 'reqs_count'");
47173#ifdef FREECIV_JSON_CONNECTION
47174 field_addr.name = "reqs_count";
47175#endif /* FREECIV_JSON_CONNECTION */
47176 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
47177 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
47178 }
47179 }
47180 if (BV_ISSET(fields, 7)) {
47181 log_packet_detailed(" got field 'reqs'");
47182#ifdef FREECIV_JSON_CONNECTION
47183 field_addr.name = "reqs";
47184#endif /* FREECIV_JSON_CONNECTION */
47185 {
47186 int i;
47187
47188#ifdef FREECIV_JSON_CONNECTION
47189 /* Enter array. */
47190 field_addr.sub_location = plocation_elem_new(0);
47191#endif /* FREECIV_JSON_CONNECTION */
47192
47193 if (real_packet->reqs_count > MAX_NUM_REQS) {
47194 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
47195 }
47196 for (i = 0; i < real_packet->reqs_count; i++) {
47197#ifdef FREECIV_JSON_CONNECTION
47198 field_addr.sub_location->number = i;
47199#endif /* FREECIV_JSON_CONNECTION */
47200 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
47201 RECEIVE_PACKET_FIELD_ERROR(reqs);
47202 }
47203 }
47204
47205#ifdef FREECIV_JSON_CONNECTION
47206 /* Exit array. */
47207 FC_FREE(field_addr.sub_location);
47208#endif /* FREECIV_JSON_CONNECTION */
47209 }
47210 }
47211 if (BV_ISSET(fields, 8)) {
47212 log_packet_detailed(" got field 'helptext'");
47213#ifdef FREECIV_JSON_CONNECTION
47214 field_addr.name = "helptext";
47215#endif /* FREECIV_JSON_CONNECTION */
47216 {
47217 int i;
47218
47219 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
47220 RECEIVE_PACKET_FIELD_ERROR(helptext);
47221 }
47222 strvec_reserve(real_packet->helptext, i);
47223
47224#ifdef FREECIV_JSON_CONNECTION
47225 field_addr.sub_location = plocation_elem_new(0);
47226#endif /* FREECIV_JSON_CONNECTION */
47227
47228 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
47229 char readin[MAX_LEN_PACKET];
47230
47231#ifdef FREECIV_JSON_CONNECTION
47232 /* Next array element */
47233 field_addr.sub_location->number = i;
47234#endif /* FREECIV_JSON_CONNECTION */
47235
47236 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
47237 || !strvec_set(real_packet->helptext, i, readin)) {
47238 RECEIVE_PACKET_FIELD_ERROR(helptext);
47239 }
47240 }
47241
47242#ifdef FREECIV_JSON_CONNECTION
47243 FC_FREE(field_addr.sub_location);
47244#endif /* FREECIV_JSON_CONNECTION */
47245 }
47246 }
47247
47248 if (nullptr == old) {
47249 old = fc_malloc(sizeof(*old));
47250 init_packet_ruleset_specialist(old);
47251 old->id = real_packet->id;
47252 sz_strlcpy(old->plural_name, real_packet->plural_name);
47253 sz_strlcpy(old->rule_name, real_packet->rule_name);
47254 sz_strlcpy(old->short_name, real_packet->short_name);
47255 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
47256 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
47257 old->reqs_count = real_packet->reqs_count;
47258 {
47259 int i;
47260
47261 for (i = 0; i < real_packet->reqs_count; i++) {
47262 old->reqs[i] = real_packet->reqs[i];
47263 }
47264 }
47265 if (real_packet->helptext) {
47266 strvec_copy(old->helptext, real_packet->helptext);
47267 } else {
47268 strvec_clear(old->helptext);
47269 }
47270 genhash_insert(*hash, old, old);
47271 } else {
47272 old->id = real_packet->id;
47273 sz_strlcpy(old->plural_name, real_packet->plural_name);
47274 sz_strlcpy(old->rule_name, real_packet->rule_name);
47275 sz_strlcpy(old->short_name, real_packet->short_name);
47276 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
47277 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
47278 old->reqs_count = real_packet->reqs_count;
47279 {
47280 int i;
47281
47282 for (i = 0; i < real_packet->reqs_count; i++) {
47283 old->reqs[i] = real_packet->reqs[i];
47284 }
47285 }
47286 if (real_packet->helptext) {
47287 strvec_copy(old->helptext, real_packet->helptext);
47288 } else {
47289 strvec_clear(old->helptext);
47290 }
47291 }
47292
47293#endif /* FREECIV_DELTA_PROTOCOL */
47294 RECEIVE_PACKET_END(real_packet);
47295#undef FREE_PACKET_STRUCT
47296}
47297
47298 static int send_packet_ruleset_specialist_100(struct connection *pc, const struct packet_ruleset_specialist *packet)
47299{
47300 const struct packet_ruleset_specialist *real_packet = packet;
47301 int e;
47302#ifdef FREECIV_DELTA_PROTOCOL
47303 packet_ruleset_specialist_100_fields fields;
47304 struct packet_ruleset_specialist *old;
47305 bool differ;
47306 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SPECIALIST;
47307#endif /* FREECIV_DELTA_PROTOCOL */
47308 SEND_PACKET_START(PACKET_RULESET_SPECIALIST);
47309#ifdef FREECIV_JSON_CONNECTION
47310 struct plocation field_addr;
47311 {
47312 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
47313 field_addr = *field_addr_tmp;
47314 FC_FREE(field_addr_tmp);
47315 }
47316#endif /* FREECIV_JSON_CONNECTION */
47317
47318 log_packet_detailed("packet_ruleset_specialist_100: sending info about ()");
47319
47320#ifdef FREECIV_DELTA_PROTOCOL
47321 if (nullptr == *hash) {
47322 *hash = genhash_new_full(hash_packet_ruleset_specialist_100, cmp_packet_ruleset_specialist_100,
47323 nullptr, nullptr, nullptr, destroy_packet_ruleset_specialist);
47324 }
47325 BV_CLR_ALL(fields);
47326
47327 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
47328 old = fc_malloc(sizeof(*old));
47329 /* temporary bitcopy just to insert correctly */
47330 *old = *real_packet;
47331 genhash_insert(*hash, old, old);
47332 init_packet_ruleset_specialist(old);
47333 }
47334 differ = (old->id != real_packet->id);
47335 if (differ) {
47336 BV_SET(fields, 0);
47337 }
47338
47339 differ = (strcmp(old->plural_name, real_packet->plural_name) != 0);
47340 if (differ) {
47341 BV_SET(fields, 1);
47342 }
47343
47344 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
47345 if (differ) {
47346 BV_SET(fields, 2);
47347 }
47348
47349 differ = (strcmp(old->short_name, real_packet->short_name) != 0);
47350 if (differ) {
47351 BV_SET(fields, 3);
47352 }
47353
47354 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
47355 if (differ) {
47356 BV_SET(fields, 4);
47357 }
47358
47359 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
47360 if (differ) {
47361 BV_SET(fields, 5);
47362 }
47363
47364 differ = (old->reqs_count != real_packet->reqs_count);
47365 if (differ) {
47366 BV_SET(fields, 6);
47367 }
47368
47369 differ = (old->reqs_count != real_packet->reqs_count);
47370 if (!differ) {
47371 int i;
47372
47373 for (i = 0; i < real_packet->reqs_count; i++) {
47374 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
47375 if (differ) {
47376 break;
47377 }
47378 }
47379 }
47380 if (differ) {
47381 BV_SET(fields, 7);
47382 }
47383
47384 if (real_packet->helptext) {
47385 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
47386 } else {
47387 differ = (strvec_size(old->helptext) > 0);
47388 }
47389 if (differ) {
47390 BV_SET(fields, 8);
47391 }
47392
47393
47394#ifdef FREECIV_JSON_CONNECTION
47395 field_addr.name = "fields";
47396#endif /* FREECIV_JSON_CONNECTION */
47397 e = 0;
47398 e |= DIO_BV_PUT(&dout, &field_addr, fields);
47399 if (e) {
47400 log_packet_detailed("fields bitvector error detected");
47401 }
47402
47403 if (BV_ISSET(fields, 0)) {
47404 log_packet_detailed(" field 'id' has changed");
47405#ifdef FREECIV_JSON_CONNECTION
47406 field_addr.name = "id";
47407#endif /* FREECIV_JSON_CONNECTION */
47408 e = 0;
47409 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
47410 if (e) {
47411 log_packet_detailed("'id' field error detected");
47412 }
47413 }
47414 if (BV_ISSET(fields, 1)) {
47415 log_packet_detailed(" field 'plural_name' has changed");
47416#ifdef FREECIV_JSON_CONNECTION
47417 field_addr.name = "plural_name";
47418#endif /* FREECIV_JSON_CONNECTION */
47419 e = 0;
47420 e |= DIO_PUT(string, &dout, &field_addr, real_packet->plural_name);
47421 if (e) {
47422 log_packet_detailed("'plural_name' field error detected");
47423 }
47424 }
47425 if (BV_ISSET(fields, 2)) {
47426 log_packet_detailed(" field 'rule_name' has changed");
47427#ifdef FREECIV_JSON_CONNECTION
47428 field_addr.name = "rule_name";
47429#endif /* FREECIV_JSON_CONNECTION */
47430 e = 0;
47431 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
47432 if (e) {
47433 log_packet_detailed("'rule_name' field error detected");
47434 }
47435 }
47436 if (BV_ISSET(fields, 3)) {
47437 log_packet_detailed(" field 'short_name' has changed");
47438#ifdef FREECIV_JSON_CONNECTION
47439 field_addr.name = "short_name";
47440#endif /* FREECIV_JSON_CONNECTION */
47441 e = 0;
47442 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_name);
47443 if (e) {
47444 log_packet_detailed("'short_name' field error detected");
47445 }
47446 }
47447 if (BV_ISSET(fields, 4)) {
47448 log_packet_detailed(" field 'graphic_str' has changed");
47449#ifdef FREECIV_JSON_CONNECTION
47450 field_addr.name = "graphic_str";
47451#endif /* FREECIV_JSON_CONNECTION */
47452 e = 0;
47453 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
47454 if (e) {
47455 log_packet_detailed("'graphic_str' field error detected");
47456 }
47457 }
47458 if (BV_ISSET(fields, 5)) {
47459 log_packet_detailed(" field 'graphic_alt' has changed");
47460#ifdef FREECIV_JSON_CONNECTION
47461 field_addr.name = "graphic_alt";
47462#endif /* FREECIV_JSON_CONNECTION */
47463 e = 0;
47464 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
47465 if (e) {
47466 log_packet_detailed("'graphic_alt' field error detected");
47467 }
47468 }
47469 if (BV_ISSET(fields, 6)) {
47470 log_packet_detailed(" field 'reqs_count' has changed");
47471#ifdef FREECIV_JSON_CONNECTION
47472 field_addr.name = "reqs_count";
47473#endif /* FREECIV_JSON_CONNECTION */
47474 e = 0;
47475 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
47476 if (e) {
47477 log_packet_detailed("'reqs_count' field error detected");
47478 }
47479 }
47480 if (BV_ISSET(fields, 7)) {
47481 log_packet_detailed(" field 'reqs' has changed");
47482#ifdef FREECIV_JSON_CONNECTION
47483 field_addr.name = "reqs";
47484#endif /* FREECIV_JSON_CONNECTION */
47485 e = 0;
47486 {
47487 int i;
47488
47489#ifdef FREECIV_JSON_CONNECTION
47490 /* Create the array. */
47491 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
47492
47493 /* Enter the array. */
47494 field_addr.sub_location = plocation_elem_new(0);
47495#endif /* FREECIV_JSON_CONNECTION */
47496
47497 for (i = 0; i < real_packet->reqs_count; i++) {
47498#ifdef FREECIV_JSON_CONNECTION
47499 /* Next array element. */
47500 field_addr.sub_location->number = i;
47501#endif /* FREECIV_JSON_CONNECTION */
47502 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
47503 }
47504
47505#ifdef FREECIV_JSON_CONNECTION
47506 /* Exit array. */
47507 FC_FREE(field_addr.sub_location);
47508#endif /* FREECIV_JSON_CONNECTION */
47509 }
47510 if (e) {
47511 log_packet_detailed("'reqs' field error detected");
47512 }
47513 }
47514 if (BV_ISSET(fields, 8)) {
47515 log_packet_detailed(" field 'helptext' has changed");
47516#ifdef FREECIV_JSON_CONNECTION
47517 field_addr.name = "helptext";
47518#endif /* FREECIV_JSON_CONNECTION */
47519 e = 0;
47520 if (!real_packet->helptext) {
47521 /* Transmit null vector as empty vector */
47522 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
47523 } else {
47524 int i;
47525
47526 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
47527 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
47528
47529#ifdef FREECIV_JSON_CONNECTION
47530 field_addr.sub_location = plocation_elem_new(0);
47531#endif /* FREECIV_JSON_CONNECTION */
47532
47533 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
47534 const char *pstr = strvec_get(real_packet->helptext, i);
47535
47536 if (!pstr) {
47537 /* Transmit null strings as empty strings */
47538 pstr = "";
47539 }
47540
47541#ifdef FREECIV_JSON_CONNECTION
47542 /* Next array element */
47543 field_addr.sub_location->number = i;
47544#endif /* FREECIV_JSON_CONNECTION */
47545
47546 e |= DIO_PUT(string, &dout, &field_addr, pstr);
47547 }
47548
47549#ifdef FREECIV_JSON_CONNECTION
47550 FC_FREE(field_addr.sub_location);
47551#endif /* FREECIV_JSON_CONNECTION */
47552 }
47553 if (e) {
47554 log_packet_detailed("'helptext' field error detected");
47555 }
47556 }
47557
47558 old->id = real_packet->id;
47559 sz_strlcpy(old->plural_name, real_packet->plural_name);
47560 sz_strlcpy(old->rule_name, real_packet->rule_name);
47561 sz_strlcpy(old->short_name, real_packet->short_name);
47562 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
47563 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
47564 old->reqs_count = real_packet->reqs_count;
47565 {
47566 int i;
47567
47568 for (i = 0; i < real_packet->reqs_count; i++) {
47569 old->reqs[i] = real_packet->reqs[i];
47570 }
47571 }
47572 if (real_packet->helptext) {
47573 strvec_copy(old->helptext, real_packet->helptext);
47574 } else {
47575 strvec_clear(old->helptext);
47576 }
47577#endif /* FREECIV_DELTA_PROTOCOL */
47578#ifndef FREECIV_DELTA_PROTOCOL
47579#ifdef FREECIV_JSON_CONNECTION
47580 field_addr.name = "id";
47581#endif /* FREECIV_JSON_CONNECTION */
47582 e = 0;
47583 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
47584 if (e) {
47585 log_packet_detailed("'id' field error detected");
47586 }
47587#ifdef FREECIV_JSON_CONNECTION
47588 field_addr.name = "plural_name";
47589#endif /* FREECIV_JSON_CONNECTION */
47590 e = 0;
47591 e |= DIO_PUT(string, &dout, &field_addr, real_packet->plural_name);
47592 if (e) {
47593 log_packet_detailed("'plural_name' field error detected");
47594 }
47595#ifdef FREECIV_JSON_CONNECTION
47596 field_addr.name = "rule_name";
47597#endif /* FREECIV_JSON_CONNECTION */
47598 e = 0;
47599 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
47600 if (e) {
47601 log_packet_detailed("'rule_name' field error detected");
47602 }
47603#ifdef FREECIV_JSON_CONNECTION
47604 field_addr.name = "short_name";
47605#endif /* FREECIV_JSON_CONNECTION */
47606 e = 0;
47607 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_name);
47608 if (e) {
47609 log_packet_detailed("'short_name' field error detected");
47610 }
47611#ifdef FREECIV_JSON_CONNECTION
47612 field_addr.name = "graphic_str";
47613#endif /* FREECIV_JSON_CONNECTION */
47614 e = 0;
47615 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
47616 if (e) {
47617 log_packet_detailed("'graphic_str' field error detected");
47618 }
47619#ifdef FREECIV_JSON_CONNECTION
47620 field_addr.name = "graphic_alt";
47621#endif /* FREECIV_JSON_CONNECTION */
47622 e = 0;
47623 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
47624 if (e) {
47625 log_packet_detailed("'graphic_alt' field error detected");
47626 }
47627#ifdef FREECIV_JSON_CONNECTION
47628 field_addr.name = "reqs_count";
47629#endif /* FREECIV_JSON_CONNECTION */
47630 e = 0;
47631 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
47632 if (e) {
47633 log_packet_detailed("'reqs_count' field error detected");
47634 }
47635#ifdef FREECIV_JSON_CONNECTION
47636 field_addr.name = "reqs";
47637#endif /* FREECIV_JSON_CONNECTION */
47638 e = 0;
47639 {
47640 int i;
47641
47642#ifdef FREECIV_JSON_CONNECTION
47643 /* Create the array. */
47644 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
47645
47646 /* Enter the array. */
47647 field_addr.sub_location = plocation_elem_new(0);
47648#endif /* FREECIV_JSON_CONNECTION */
47649
47650 for (i = 0; i < real_packet->reqs_count; i++) {
47651#ifdef FREECIV_JSON_CONNECTION
47652 /* Next array element. */
47653 field_addr.sub_location->number = i;
47654#endif /* FREECIV_JSON_CONNECTION */
47655 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
47656 }
47657
47658#ifdef FREECIV_JSON_CONNECTION
47659 /* Exit array. */
47660 FC_FREE(field_addr.sub_location);
47661#endif /* FREECIV_JSON_CONNECTION */
47662 }
47663 if (e) {
47664 log_packet_detailed("'reqs' field error detected");
47665 }
47666#ifdef FREECIV_JSON_CONNECTION
47667 field_addr.name = "helptext";
47668#endif /* FREECIV_JSON_CONNECTION */
47669 e = 0;
47670 if (!real_packet->helptext) {
47671 /* Transmit null vector as empty vector */
47672 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
47673 } else {
47674 int i;
47675
47676 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
47677 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
47678
47679#ifdef FREECIV_JSON_CONNECTION
47680 field_addr.sub_location = plocation_elem_new(0);
47681#endif /* FREECIV_JSON_CONNECTION */
47682
47683 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
47684 const char *pstr = strvec_get(real_packet->helptext, i);
47685
47686 if (!pstr) {
47687 /* Transmit null strings as empty strings */
47688 pstr = "";
47689 }
47690
47691#ifdef FREECIV_JSON_CONNECTION
47692 /* Next array element */
47693 field_addr.sub_location->number = i;
47694#endif /* FREECIV_JSON_CONNECTION */
47695
47696 e |= DIO_PUT(string, &dout, &field_addr, pstr);
47697 }
47698
47699#ifdef FREECIV_JSON_CONNECTION
47700 FC_FREE(field_addr.sub_location);
47701#endif /* FREECIV_JSON_CONNECTION */
47702 }
47703 if (e) {
47704 log_packet_detailed("'helptext' field error detected");
47705 }
47706
47707#endif
47708 SEND_PACKET_END(PACKET_RULESET_SPECIALIST);
47709}
47710
47711 int send_packet_ruleset_specialist(struct connection *pc, const struct packet_ruleset_specialist *packet)
47712{
47713 if (!pc->used) {
47714 log_error("WARNING: trying to send data to the closed connection %s",
47715 conn_description(pc));
47716 return -1;
47717 }
47718 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SPECIALIST].packet != nullptr, -1,
47719 "Handler for PACKET_RULESET_SPECIALIST not installed");
47720 return pc->phs.handlers->send[PACKET_RULESET_SPECIALIST].packet(pc, packet);
47721}
47722
47723 void lsend_packet_ruleset_specialist(struct conn_list *dest, const struct packet_ruleset_specialist *packet)
47724{
47725 conn_list_iterate(dest, pconn) {
47726 send_packet_ruleset_specialist(pconn, packet);
47727 } conn_list_iterate_end;
47728}
47729
47730 static inline void init_packet_ruleset_government_ruler_title(struct packet_ruleset_government_ruler_title *packet)
47731{
47732 memset(packet, 0, sizeof(*packet));
47733}
47734
47735#define free_packet_ruleset_government_ruler_title(_packet) (void) 0
47736#define destroy_packet_ruleset_government_ruler_title free
47737
47738#ifdef FREECIV_DELTA_PROTOCOL
47739#define hash_packet_ruleset_government_ruler_title_100 hash_const
47740
47741#define cmp_packet_ruleset_government_ruler_title_100 cmp_const
47742
47743 BV_DEFINE(packet_ruleset_government_ruler_title_100_fields, 4);
47744#endif /* FREECIV_DELTA_PROTOCOL */
47745
47746 static struct packet_ruleset_government_ruler_title *receive_packet_ruleset_government_ruler_title_100(struct connection *pc)
47747{
47748#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_government_ruler_title(_packet)
47749#ifdef FREECIV_DELTA_PROTOCOL
47750 packet_ruleset_government_ruler_title_100_fields fields;
47751 struct packet_ruleset_government_ruler_title *old;
47752 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOVERNMENT_RULER_TITLE;
47753#endif /* FREECIV_DELTA_PROTOCOL */
47754 RECEIVE_PACKET_START(packet_ruleset_government_ruler_title, real_packet);
47755#ifdef FREECIV_JSON_CONNECTION
47756 struct plocation field_addr;
47757 {
47758 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
47759 field_addr = *field_addr_tmp;
47760 FC_FREE(field_addr_tmp);
47761 }
47762#endif /* FREECIV_JSON_CONNECTION */
47763
47764#ifdef FREECIV_DELTA_PROTOCOL
47765#ifdef FREECIV_JSON_CONNECTION
47766 field_addr.name = "fields";
47767#endif /* FREECIV_JSON_CONNECTION */
47768 DIO_BV_GET(&din, &field_addr, fields);
47769
47770#else /* FREECIV_DELTA_PROTOCOL */
47771#ifdef FREECIV_JSON_CONNECTION
47772 field_addr.name = "gov";
47773#endif /* FREECIV_JSON_CONNECTION */
47774 {
47775 int readin;
47776
47777 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
47778 RECEIVE_PACKET_FIELD_ERROR(gov);
47779 }
47780 real_packet->gov = readin;
47781 }
47782#ifdef FREECIV_JSON_CONNECTION
47783 field_addr.name = "nation";
47784#endif /* FREECIV_JSON_CONNECTION */
47785 {
47786 int readin;
47787
47788 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
47789 RECEIVE_PACKET_FIELD_ERROR(nation);
47790 }
47791 real_packet->nation = readin;
47792 }
47793#ifdef FREECIV_JSON_CONNECTION
47794 field_addr.name = "male_title";
47795#endif /* FREECIV_JSON_CONNECTION */
47796 if (!DIO_GET(string, &din, &field_addr, real_packet->male_title, sizeof(real_packet->male_title))) {
47797 RECEIVE_PACKET_FIELD_ERROR(male_title);
47798 }
47799#ifdef FREECIV_JSON_CONNECTION
47800 field_addr.name = "female_title";
47801#endif /* FREECIV_JSON_CONNECTION */
47802 if (!DIO_GET(string, &din, &field_addr, real_packet->female_title, sizeof(real_packet->female_title))) {
47803 RECEIVE_PACKET_FIELD_ERROR(female_title);
47804 }
47805#endif
47806 log_packet_detailed("packet_ruleset_government_ruler_title_100: got info about ()");
47807
47808#ifdef FREECIV_DELTA_PROTOCOL
47809 if (nullptr == *hash) {
47810 *hash = genhash_new_full(hash_packet_ruleset_government_ruler_title_100, cmp_packet_ruleset_government_ruler_title_100,
47811 nullptr, nullptr, nullptr, destroy_packet_ruleset_government_ruler_title);
47812 }
47813
47814 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47815 *real_packet = *old;
47816 } else {
47817 /* packet is already initialized empty */
47818 log_packet_detailed(" no old info");
47819 }
47820
47821 if (BV_ISSET(fields, 0)) {
47822 log_packet_detailed(" got field 'gov'");
47823#ifdef FREECIV_JSON_CONNECTION
47824 field_addr.name = "gov";
47825#endif /* FREECIV_JSON_CONNECTION */
47826 {
47827 int readin;
47828
47829 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
47830 RECEIVE_PACKET_FIELD_ERROR(gov);
47831 }
47832 real_packet->gov = readin;
47833 }
47834 }
47835 if (BV_ISSET(fields, 1)) {
47836 log_packet_detailed(" got field 'nation'");
47837#ifdef FREECIV_JSON_CONNECTION
47838 field_addr.name = "nation";
47839#endif /* FREECIV_JSON_CONNECTION */
47840 {
47841 int readin;
47842
47843 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
47844 RECEIVE_PACKET_FIELD_ERROR(nation);
47845 }
47846 real_packet->nation = readin;
47847 }
47848 }
47849 if (BV_ISSET(fields, 2)) {
47850 log_packet_detailed(" got field 'male_title'");
47851#ifdef FREECIV_JSON_CONNECTION
47852 field_addr.name = "male_title";
47853#endif /* FREECIV_JSON_CONNECTION */
47854 if (!DIO_GET(string, &din, &field_addr, real_packet->male_title, sizeof(real_packet->male_title))) {
47855 RECEIVE_PACKET_FIELD_ERROR(male_title);
47856 }
47857 }
47858 if (BV_ISSET(fields, 3)) {
47859 log_packet_detailed(" got field 'female_title'");
47860#ifdef FREECIV_JSON_CONNECTION
47861 field_addr.name = "female_title";
47862#endif /* FREECIV_JSON_CONNECTION */
47863 if (!DIO_GET(string, &din, &field_addr, real_packet->female_title, sizeof(real_packet->female_title))) {
47864 RECEIVE_PACKET_FIELD_ERROR(female_title);
47865 }
47866 }
47867
47868 if (nullptr == old) {
47869 old = fc_malloc(sizeof(*old));
47870 init_packet_ruleset_government_ruler_title(old);
47871 *old = *real_packet;
47872 genhash_insert(*hash, old, old);
47873 } else {
47874 *old = *real_packet;
47875 }
47876
47877#endif /* FREECIV_DELTA_PROTOCOL */
47878 RECEIVE_PACKET_END(real_packet);
47879#undef FREE_PACKET_STRUCT
47880}
47881
47882 static int send_packet_ruleset_government_ruler_title_100(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
47883{
47884 const struct packet_ruleset_government_ruler_title *real_packet = packet;
47885 int e;
47886#ifdef FREECIV_DELTA_PROTOCOL
47887 packet_ruleset_government_ruler_title_100_fields fields;
47888 struct packet_ruleset_government_ruler_title *old;
47889 bool differ;
47890 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOVERNMENT_RULER_TITLE;
47891#endif /* FREECIV_DELTA_PROTOCOL */
47892 SEND_PACKET_START(PACKET_RULESET_GOVERNMENT_RULER_TITLE);
47893#ifdef FREECIV_JSON_CONNECTION
47894 struct plocation field_addr;
47895 {
47896 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
47897 field_addr = *field_addr_tmp;
47898 FC_FREE(field_addr_tmp);
47899 }
47900#endif /* FREECIV_JSON_CONNECTION */
47901
47902 log_packet_detailed("packet_ruleset_government_ruler_title_100: sending info about ()");
47903
47904#ifdef FREECIV_DELTA_PROTOCOL
47905 if (nullptr == *hash) {
47906 *hash = genhash_new_full(hash_packet_ruleset_government_ruler_title_100, cmp_packet_ruleset_government_ruler_title_100,
47907 nullptr, nullptr, nullptr, destroy_packet_ruleset_government_ruler_title);
47908 }
47909 BV_CLR_ALL(fields);
47910
47911 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
47912 old = fc_malloc(sizeof(*old));
47913 /* temporary bitcopy just to insert correctly */
47914 *old = *real_packet;
47915 genhash_insert(*hash, old, old);
47916 init_packet_ruleset_government_ruler_title(old);
47917 }
47918 differ = (old->gov != real_packet->gov);
47919 if (differ) {
47920 BV_SET(fields, 0);
47921 }
47922
47923 differ = (old->nation != real_packet->nation);
47924 if (differ) {
47925 BV_SET(fields, 1);
47926 }
47927
47928 differ = (strcmp(old->male_title, real_packet->male_title) != 0);
47929 if (differ) {
47930 BV_SET(fields, 2);
47931 }
47932
47933 differ = (strcmp(old->female_title, real_packet->female_title) != 0);
47934 if (differ) {
47935 BV_SET(fields, 3);
47936 }
47937
47938
47939#ifdef FREECIV_JSON_CONNECTION
47940 field_addr.name = "fields";
47941#endif /* FREECIV_JSON_CONNECTION */
47942 e = 0;
47943 e |= DIO_BV_PUT(&dout, &field_addr, fields);
47944 if (e) {
47945 log_packet_detailed("fields bitvector error detected");
47946 }
47947
47948 if (BV_ISSET(fields, 0)) {
47949 log_packet_detailed(" field 'gov' has changed");
47950#ifdef FREECIV_JSON_CONNECTION
47951 field_addr.name = "gov";
47952#endif /* FREECIV_JSON_CONNECTION */
47953 e = 0;
47954 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->gov);
47955 if (e) {
47956 log_packet_detailed("'gov' field error detected");
47957 }
47958 }
47959 if (BV_ISSET(fields, 1)) {
47960 log_packet_detailed(" field 'nation' has changed");
47961#ifdef FREECIV_JSON_CONNECTION
47962 field_addr.name = "nation";
47963#endif /* FREECIV_JSON_CONNECTION */
47964 e = 0;
47965 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
47966 if (e) {
47967 log_packet_detailed("'nation' field error detected");
47968 }
47969 }
47970 if (BV_ISSET(fields, 2)) {
47971 log_packet_detailed(" field 'male_title' has changed");
47972#ifdef FREECIV_JSON_CONNECTION
47973 field_addr.name = "male_title";
47974#endif /* FREECIV_JSON_CONNECTION */
47975 e = 0;
47976 e |= DIO_PUT(string, &dout, &field_addr, real_packet->male_title);
47977 if (e) {
47978 log_packet_detailed("'male_title' field error detected");
47979 }
47980 }
47981 if (BV_ISSET(fields, 3)) {
47982 log_packet_detailed(" field 'female_title' has changed");
47983#ifdef FREECIV_JSON_CONNECTION
47984 field_addr.name = "female_title";
47985#endif /* FREECIV_JSON_CONNECTION */
47986 e = 0;
47987 e |= DIO_PUT(string, &dout, &field_addr, real_packet->female_title);
47988 if (e) {
47989 log_packet_detailed("'female_title' field error detected");
47990 }
47991 }
47992
47993 *old = *real_packet;
47994#endif /* FREECIV_DELTA_PROTOCOL */
47995#ifndef FREECIV_DELTA_PROTOCOL
47996#ifdef FREECIV_JSON_CONNECTION
47997 field_addr.name = "gov";
47998#endif /* FREECIV_JSON_CONNECTION */
47999 e = 0;
48000 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->gov);
48001 if (e) {
48002 log_packet_detailed("'gov' field error detected");
48003 }
48004#ifdef FREECIV_JSON_CONNECTION
48005 field_addr.name = "nation";
48006#endif /* FREECIV_JSON_CONNECTION */
48007 e = 0;
48008 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
48009 if (e) {
48010 log_packet_detailed("'nation' field error detected");
48011 }
48012#ifdef FREECIV_JSON_CONNECTION
48013 field_addr.name = "male_title";
48014#endif /* FREECIV_JSON_CONNECTION */
48015 e = 0;
48016 e |= DIO_PUT(string, &dout, &field_addr, real_packet->male_title);
48017 if (e) {
48018 log_packet_detailed("'male_title' field error detected");
48019 }
48020#ifdef FREECIV_JSON_CONNECTION
48021 field_addr.name = "female_title";
48022#endif /* FREECIV_JSON_CONNECTION */
48023 e = 0;
48024 e |= DIO_PUT(string, &dout, &field_addr, real_packet->female_title);
48025 if (e) {
48026 log_packet_detailed("'female_title' field error detected");
48027 }
48028
48029#endif
48030 SEND_PACKET_END(PACKET_RULESET_GOVERNMENT_RULER_TITLE);
48031}
48032
48033 int send_packet_ruleset_government_ruler_title(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
48034{
48035 if (!pc->used) {
48036 log_error("WARNING: trying to send data to the closed connection %s",
48037 conn_description(pc));
48038 return -1;
48039 }
48040 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet != nullptr, -1,
48041 "Handler for PACKET_RULESET_GOVERNMENT_RULER_TITLE not installed");
48042 return pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet(pc, packet);
48043}
48044
48045 void lsend_packet_ruleset_government_ruler_title(struct conn_list *dest, const struct packet_ruleset_government_ruler_title *packet)
48046{
48047 conn_list_iterate(dest, pconn) {
48048 send_packet_ruleset_government_ruler_title(pconn, packet);
48049 } conn_list_iterate_end;
48050}
48051
48052 static inline void init_packet_ruleset_tech(struct packet_ruleset_tech *packet)
48053{
48054 memset(packet, 0, sizeof(*packet));
48055
48056 /* no work needed for packet->id */
48057 /* no work needed for packet->root_req */
48058 /* no work needed for packet->research_reqs_count */
48059 /* no work needed for packet->research_reqs */
48060 /* no work needed for packet->tclass */
48061 /* no work needed for packet->removed */
48062 /* no work needed for packet->flags */
48063 /* no work needed for packet->cost */
48064 /* no work needed for packet->num_reqs */
48065 /* no work needed for packet->name */
48066 /* no work needed for packet->rule_name */
48067 packet->helptext = strvec_new();
48068 /* no work needed for packet->graphic_str */
48069 /* no work needed for packet->graphic_alt */
48070}
48071
48072 static inline void free_packet_ruleset_tech(struct packet_ruleset_tech *packet)
48073{
48074 /* no work needed for packet->graphic_alt */
48075 /* no work needed for packet->graphic_str */
48076 if (packet->helptext) {
48077 strvec_destroy(packet->helptext);
48078 packet->helptext = nullptr;
48079 }
48080 /* no work needed for packet->rule_name */
48081 /* no work needed for packet->name */
48082 /* no work needed for packet->num_reqs */
48083 /* no work needed for packet->cost */
48084 /* no work needed for packet->flags */
48085 /* no work needed for packet->removed */
48086 /* no work needed for packet->tclass */
48087 /* no work needed for packet->research_reqs */
48088 /* no work needed for packet->research_reqs_count */
48089 /* no work needed for packet->root_req */
48090 /* no work needed for packet->id */
48091}
48092
48093 static inline void destroy_packet_ruleset_tech(void *packet)
48094{
48095 free_packet_ruleset_tech((struct packet_ruleset_tech *) packet);
48096 free(packet);
48097}
48098
48099#ifdef FREECIV_DELTA_PROTOCOL
48100#define hash_packet_ruleset_tech_100 hash_const
48101
48102#define cmp_packet_ruleset_tech_100 cmp_const
48103
48104 BV_DEFINE(packet_ruleset_tech_100_fields, 14);
48105#endif /* FREECIV_DELTA_PROTOCOL */
48106
48107 static struct packet_ruleset_tech *receive_packet_ruleset_tech_100(struct connection *pc)
48108{
48109#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_tech(_packet)
48110#ifdef FREECIV_DELTA_PROTOCOL
48111 packet_ruleset_tech_100_fields fields;
48112 struct packet_ruleset_tech *old;
48113 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH;
48114#endif /* FREECIV_DELTA_PROTOCOL */
48115 RECEIVE_PACKET_START(packet_ruleset_tech, real_packet);
48116#ifdef FREECIV_JSON_CONNECTION
48117 struct plocation field_addr;
48118 {
48119 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
48120 field_addr = *field_addr_tmp;
48121 FC_FREE(field_addr_tmp);
48122 }
48123#endif /* FREECIV_JSON_CONNECTION */
48124
48125#ifdef FREECIV_DELTA_PROTOCOL
48126#ifdef FREECIV_JSON_CONNECTION
48127 field_addr.name = "fields";
48128#endif /* FREECIV_JSON_CONNECTION */
48129 DIO_BV_GET(&din, &field_addr, fields);
48130
48131#else /* FREECIV_DELTA_PROTOCOL */
48132#ifdef FREECIV_JSON_CONNECTION
48133 field_addr.name = "id";
48134#endif /* FREECIV_JSON_CONNECTION */
48135 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
48136 RECEIVE_PACKET_FIELD_ERROR(id);
48137 }
48138#ifdef FREECIV_JSON_CONNECTION
48139 field_addr.name = "root_req";
48140#endif /* FREECIV_JSON_CONNECTION */
48141 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->root_req)) {
48142 RECEIVE_PACKET_FIELD_ERROR(root_req);
48143 }
48144#ifdef FREECIV_JSON_CONNECTION
48145 field_addr.name = "research_reqs_count";
48146#endif /* FREECIV_JSON_CONNECTION */
48147 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->research_reqs_count)) {
48148 RECEIVE_PACKET_FIELD_ERROR(research_reqs_count);
48149 }
48150#ifdef FREECIV_JSON_CONNECTION
48151 field_addr.name = "research_reqs";
48152#endif /* FREECIV_JSON_CONNECTION */
48153 {
48154 int i;
48155
48156#ifdef FREECIV_JSON_CONNECTION
48157 /* Enter array. */
48158 field_addr.sub_location = plocation_elem_new(0);
48159#endif /* FREECIV_JSON_CONNECTION */
48160
48161 if (real_packet->research_reqs_count > MAX_NUM_REQS) {
48162 RECEIVE_PACKET_FIELD_ERROR(research_reqs, ": truncation array");
48163 }
48164 for (i = 0; i < real_packet->research_reqs_count; i++) {
48165#ifdef FREECIV_JSON_CONNECTION
48166 field_addr.sub_location->number = i;
48167#endif /* FREECIV_JSON_CONNECTION */
48168 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->research_reqs[i])) {
48169 RECEIVE_PACKET_FIELD_ERROR(research_reqs);
48170 }
48171 }
48172
48173#ifdef FREECIV_JSON_CONNECTION
48174 /* Exit array. */
48175 FC_FREE(field_addr.sub_location);
48176#endif /* FREECIV_JSON_CONNECTION */
48177 }
48178#ifdef FREECIV_JSON_CONNECTION
48179 field_addr.name = "tclass";
48180#endif /* FREECIV_JSON_CONNECTION */
48181 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
48182 RECEIVE_PACKET_FIELD_ERROR(tclass);
48183 }
48184#ifdef FREECIV_JSON_CONNECTION
48185 field_addr.name = "removed";
48186#endif /* FREECIV_JSON_CONNECTION */
48187 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removed)) {
48188 RECEIVE_PACKET_FIELD_ERROR(removed);
48189 }
48190#ifdef FREECIV_JSON_CONNECTION
48191 field_addr.name = "flags";
48192#endif /* FREECIV_JSON_CONNECTION */
48193 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
48194 RECEIVE_PACKET_FIELD_ERROR(flags);
48195 }
48196#ifdef FREECIV_JSON_CONNECTION
48197 field_addr.name = "cost";
48198#endif /* FREECIV_JSON_CONNECTION */
48199 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->cost, 100)) {
48200 RECEIVE_PACKET_FIELD_ERROR(cost);
48201 }
48202#ifdef FREECIV_JSON_CONNECTION
48203 field_addr.name = "num_reqs";
48204#endif /* FREECIV_JSON_CONNECTION */
48205 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->num_reqs)) {
48206 RECEIVE_PACKET_FIELD_ERROR(num_reqs);
48207 }
48208#ifdef FREECIV_JSON_CONNECTION
48209 field_addr.name = "name";
48210#endif /* FREECIV_JSON_CONNECTION */
48211 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
48212 RECEIVE_PACKET_FIELD_ERROR(name);
48213 }
48214#ifdef FREECIV_JSON_CONNECTION
48215 field_addr.name = "rule_name";
48216#endif /* FREECIV_JSON_CONNECTION */
48217 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
48218 RECEIVE_PACKET_FIELD_ERROR(rule_name);
48219 }
48220#ifdef FREECIV_JSON_CONNECTION
48221 field_addr.name = "helptext";
48222#endif /* FREECIV_JSON_CONNECTION */
48223 {
48224 int i;
48225
48226 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
48227 RECEIVE_PACKET_FIELD_ERROR(helptext);
48228 }
48229 strvec_reserve(real_packet->helptext, i);
48230
48231#ifdef FREECIV_JSON_CONNECTION
48232 field_addr.sub_location = plocation_elem_new(0);
48233#endif /* FREECIV_JSON_CONNECTION */
48234
48235 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
48236 char readin[MAX_LEN_PACKET];
48237
48238#ifdef FREECIV_JSON_CONNECTION
48239 /* Next array element */
48240 field_addr.sub_location->number = i;
48241#endif /* FREECIV_JSON_CONNECTION */
48242
48243 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
48244 || !strvec_set(real_packet->helptext, i, readin)) {
48245 RECEIVE_PACKET_FIELD_ERROR(helptext);
48246 }
48247 }
48248
48249#ifdef FREECIV_JSON_CONNECTION
48250 FC_FREE(field_addr.sub_location);
48251#endif /* FREECIV_JSON_CONNECTION */
48252 }
48253#ifdef FREECIV_JSON_CONNECTION
48254 field_addr.name = "graphic_str";
48255#endif /* FREECIV_JSON_CONNECTION */
48256 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
48257 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
48258 }
48259#ifdef FREECIV_JSON_CONNECTION
48260 field_addr.name = "graphic_alt";
48261#endif /* FREECIV_JSON_CONNECTION */
48262 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
48263 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
48264 }
48265#endif
48266 log_packet_detailed("packet_ruleset_tech_100: got info about ()");
48267
48268#ifdef FREECIV_DELTA_PROTOCOL
48269 if (nullptr == *hash) {
48270 *hash = genhash_new_full(hash_packet_ruleset_tech_100, cmp_packet_ruleset_tech_100,
48271 nullptr, nullptr, nullptr, destroy_packet_ruleset_tech);
48272 }
48273
48274 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
48275 real_packet->id = old->id;
48276 real_packet->root_req = old->root_req;
48277 real_packet->research_reqs_count = old->research_reqs_count;
48278 {
48279 int i;
48280
48281 for (i = 0; i < old->research_reqs_count; i++) {
48282 real_packet->research_reqs[i] = old->research_reqs[i];
48283 }
48284 }
48285 real_packet->tclass = old->tclass;
48286 real_packet->removed = old->removed;
48287 real_packet->flags = old->flags;
48288 real_packet->cost = old->cost;
48289 real_packet->num_reqs = old->num_reqs;
48290 sz_strlcpy(real_packet->name, old->name);
48291 sz_strlcpy(real_packet->rule_name, old->rule_name);
48292 if (old->helptext) {
48293 strvec_copy(real_packet->helptext, old->helptext);
48294 } else {
48295 strvec_clear(real_packet->helptext);
48296 }
48297 sz_strlcpy(real_packet->graphic_str, old->graphic_str);
48298 sz_strlcpy(real_packet->graphic_alt, old->graphic_alt);
48299 } else {
48300 /* packet is already initialized empty */
48301 log_packet_detailed(" no old info");
48302 }
48303
48304 if (BV_ISSET(fields, 0)) {
48305 log_packet_detailed(" got field 'id'");
48306#ifdef FREECIV_JSON_CONNECTION
48307 field_addr.name = "id";
48308#endif /* FREECIV_JSON_CONNECTION */
48309 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
48310 RECEIVE_PACKET_FIELD_ERROR(id);
48311 }
48312 }
48313 if (BV_ISSET(fields, 1)) {
48314 log_packet_detailed(" got field 'root_req'");
48315#ifdef FREECIV_JSON_CONNECTION
48316 field_addr.name = "root_req";
48317#endif /* FREECIV_JSON_CONNECTION */
48318 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->root_req)) {
48319 RECEIVE_PACKET_FIELD_ERROR(root_req);
48320 }
48321 }
48322 if (BV_ISSET(fields, 2)) {
48323 log_packet_detailed(" got field 'research_reqs_count'");
48324#ifdef FREECIV_JSON_CONNECTION
48325 field_addr.name = "research_reqs_count";
48326#endif /* FREECIV_JSON_CONNECTION */
48327 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->research_reqs_count)) {
48328 RECEIVE_PACKET_FIELD_ERROR(research_reqs_count);
48329 }
48330 }
48331 if (BV_ISSET(fields, 3)) {
48332 log_packet_detailed(" got field 'research_reqs'");
48333#ifdef FREECIV_JSON_CONNECTION
48334 field_addr.name = "research_reqs";
48335#endif /* FREECIV_JSON_CONNECTION */
48336 {
48337 int i;
48338
48339#ifdef FREECIV_JSON_CONNECTION
48340 /* Enter array. */
48341 field_addr.sub_location = plocation_elem_new(0);
48342#endif /* FREECIV_JSON_CONNECTION */
48343
48344 if (real_packet->research_reqs_count > MAX_NUM_REQS) {
48345 RECEIVE_PACKET_FIELD_ERROR(research_reqs, ": truncation array");
48346 }
48347 for (i = 0; i < real_packet->research_reqs_count; i++) {
48348#ifdef FREECIV_JSON_CONNECTION
48349 field_addr.sub_location->number = i;
48350#endif /* FREECIV_JSON_CONNECTION */
48351 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->research_reqs[i])) {
48352 RECEIVE_PACKET_FIELD_ERROR(research_reqs);
48353 }
48354 }
48355
48356#ifdef FREECIV_JSON_CONNECTION
48357 /* Exit array. */
48358 FC_FREE(field_addr.sub_location);
48359#endif /* FREECIV_JSON_CONNECTION */
48360 }
48361 }
48362 if (BV_ISSET(fields, 4)) {
48363 log_packet_detailed(" got field 'tclass'");
48364#ifdef FREECIV_JSON_CONNECTION
48365 field_addr.name = "tclass";
48366#endif /* FREECIV_JSON_CONNECTION */
48367 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
48368 RECEIVE_PACKET_FIELD_ERROR(tclass);
48369 }
48370 }
48371 real_packet->removed = BV_ISSET(fields, 5);
48372 if (BV_ISSET(fields, 6)) {
48373 log_packet_detailed(" got field 'flags'");
48374#ifdef FREECIV_JSON_CONNECTION
48375 field_addr.name = "flags";
48376#endif /* FREECIV_JSON_CONNECTION */
48377 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
48378 RECEIVE_PACKET_FIELD_ERROR(flags);
48379 }
48380 }
48381 if (BV_ISSET(fields, 7)) {
48382 log_packet_detailed(" got field 'cost'");
48383#ifdef FREECIV_JSON_CONNECTION
48384 field_addr.name = "cost";
48385#endif /* FREECIV_JSON_CONNECTION */
48386 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->cost, 100)) {
48387 RECEIVE_PACKET_FIELD_ERROR(cost);
48388 }
48389 }
48390 if (BV_ISSET(fields, 8)) {
48391 log_packet_detailed(" got field 'num_reqs'");
48392#ifdef FREECIV_JSON_CONNECTION
48393 field_addr.name = "num_reqs";
48394#endif /* FREECIV_JSON_CONNECTION */
48395 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->num_reqs)) {
48396 RECEIVE_PACKET_FIELD_ERROR(num_reqs);
48397 }
48398 }
48399 if (BV_ISSET(fields, 9)) {
48400 log_packet_detailed(" got field 'name'");
48401#ifdef FREECIV_JSON_CONNECTION
48402 field_addr.name = "name";
48403#endif /* FREECIV_JSON_CONNECTION */
48404 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
48405 RECEIVE_PACKET_FIELD_ERROR(name);
48406 }
48407 }
48408 if (BV_ISSET(fields, 10)) {
48409 log_packet_detailed(" got field 'rule_name'");
48410#ifdef FREECIV_JSON_CONNECTION
48411 field_addr.name = "rule_name";
48412#endif /* FREECIV_JSON_CONNECTION */
48413 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
48414 RECEIVE_PACKET_FIELD_ERROR(rule_name);
48415 }
48416 }
48417 if (BV_ISSET(fields, 11)) {
48418 log_packet_detailed(" got field 'helptext'");
48419#ifdef FREECIV_JSON_CONNECTION
48420 field_addr.name = "helptext";
48421#endif /* FREECIV_JSON_CONNECTION */
48422 {
48423 int i;
48424
48425 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
48426 RECEIVE_PACKET_FIELD_ERROR(helptext);
48427 }
48428 strvec_reserve(real_packet->helptext, i);
48429
48430#ifdef FREECIV_JSON_CONNECTION
48431 field_addr.sub_location = plocation_elem_new(0);
48432#endif /* FREECIV_JSON_CONNECTION */
48433
48434 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
48435 char readin[MAX_LEN_PACKET];
48436
48437#ifdef FREECIV_JSON_CONNECTION
48438 /* Next array element */
48439 field_addr.sub_location->number = i;
48440#endif /* FREECIV_JSON_CONNECTION */
48441
48442 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
48443 || !strvec_set(real_packet->helptext, i, readin)) {
48444 RECEIVE_PACKET_FIELD_ERROR(helptext);
48445 }
48446 }
48447
48448#ifdef FREECIV_JSON_CONNECTION
48449 FC_FREE(field_addr.sub_location);
48450#endif /* FREECIV_JSON_CONNECTION */
48451 }
48452 }
48453 if (BV_ISSET(fields, 12)) {
48454 log_packet_detailed(" got field 'graphic_str'");
48455#ifdef FREECIV_JSON_CONNECTION
48456 field_addr.name = "graphic_str";
48457#endif /* FREECIV_JSON_CONNECTION */
48458 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
48459 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
48460 }
48461 }
48462 if (BV_ISSET(fields, 13)) {
48463 log_packet_detailed(" got field 'graphic_alt'");
48464#ifdef FREECIV_JSON_CONNECTION
48465 field_addr.name = "graphic_alt";
48466#endif /* FREECIV_JSON_CONNECTION */
48467 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
48468 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
48469 }
48470 }
48471
48472 if (nullptr == old) {
48473 old = fc_malloc(sizeof(*old));
48474 init_packet_ruleset_tech(old);
48475 old->id = real_packet->id;
48476 old->root_req = real_packet->root_req;
48477 old->research_reqs_count = real_packet->research_reqs_count;
48478 {
48479 int i;
48480
48481 for (i = 0; i < real_packet->research_reqs_count; i++) {
48482 old->research_reqs[i] = real_packet->research_reqs[i];
48483 }
48484 }
48485 old->tclass = real_packet->tclass;
48486 old->removed = real_packet->removed;
48487 old->flags = real_packet->flags;
48488 old->cost = real_packet->cost;
48489 old->num_reqs = real_packet->num_reqs;
48490 sz_strlcpy(old->name, real_packet->name);
48491 sz_strlcpy(old->rule_name, real_packet->rule_name);
48492 if (real_packet->helptext) {
48493 strvec_copy(old->helptext, real_packet->helptext);
48494 } else {
48495 strvec_clear(old->helptext);
48496 }
48497 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
48498 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
48499 genhash_insert(*hash, old, old);
48500 } else {
48501 old->id = real_packet->id;
48502 old->root_req = real_packet->root_req;
48503 old->research_reqs_count = real_packet->research_reqs_count;
48504 {
48505 int i;
48506
48507 for (i = 0; i < real_packet->research_reqs_count; i++) {
48508 old->research_reqs[i] = real_packet->research_reqs[i];
48509 }
48510 }
48511 old->tclass = real_packet->tclass;
48512 old->removed = real_packet->removed;
48513 old->flags = real_packet->flags;
48514 old->cost = real_packet->cost;
48515 old->num_reqs = real_packet->num_reqs;
48516 sz_strlcpy(old->name, real_packet->name);
48517 sz_strlcpy(old->rule_name, real_packet->rule_name);
48518 if (real_packet->helptext) {
48519 strvec_copy(old->helptext, real_packet->helptext);
48520 } else {
48521 strvec_clear(old->helptext);
48522 }
48523 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
48524 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
48525 }
48526
48527#endif /* FREECIV_DELTA_PROTOCOL */
48528 RECEIVE_PACKET_END(real_packet);
48529#undef FREE_PACKET_STRUCT
48530}
48531
48532 static int send_packet_ruleset_tech_100(struct connection *pc, const struct packet_ruleset_tech *packet)
48533{
48534 const struct packet_ruleset_tech *real_packet = packet;
48535 int e;
48536#ifdef FREECIV_DELTA_PROTOCOL
48537 packet_ruleset_tech_100_fields fields;
48538 struct packet_ruleset_tech *old;
48539 bool differ;
48540 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH;
48541#endif /* FREECIV_DELTA_PROTOCOL */
48542 SEND_PACKET_START(PACKET_RULESET_TECH);
48543#ifdef FREECIV_JSON_CONNECTION
48544 struct plocation field_addr;
48545 {
48546 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
48547 field_addr = *field_addr_tmp;
48548 FC_FREE(field_addr_tmp);
48549 }
48550#endif /* FREECIV_JSON_CONNECTION */
48551
48552 log_packet_detailed("packet_ruleset_tech_100: sending info about ()");
48553
48554#ifdef FREECIV_DELTA_PROTOCOL
48555 if (nullptr == *hash) {
48556 *hash = genhash_new_full(hash_packet_ruleset_tech_100, cmp_packet_ruleset_tech_100,
48557 nullptr, nullptr, nullptr, destroy_packet_ruleset_tech);
48558 }
48559 BV_CLR_ALL(fields);
48560
48561 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48562 old = fc_malloc(sizeof(*old));
48563 /* temporary bitcopy just to insert correctly */
48564 *old = *real_packet;
48565 genhash_insert(*hash, old, old);
48566 init_packet_ruleset_tech(old);
48567 }
48568 differ = (old->id != real_packet->id);
48569 if (differ) {
48570 BV_SET(fields, 0);
48571 }
48572
48573 differ = (old->root_req != real_packet->root_req);
48574 if (differ) {
48575 BV_SET(fields, 1);
48576 }
48577
48578 differ = (old->research_reqs_count != real_packet->research_reqs_count);
48579 if (differ) {
48580 BV_SET(fields, 2);
48581 }
48582
48583 differ = (old->research_reqs_count != real_packet->research_reqs_count);
48584 if (!differ) {
48585 int i;
48586
48587 for (i = 0; i < real_packet->research_reqs_count; i++) {
48588 differ = !are_requirements_equal(&old->research_reqs[i], &real_packet->research_reqs[i]);
48589 if (differ) {
48590 break;
48591 }
48592 }
48593 }
48594 if (differ) {
48595 BV_SET(fields, 3);
48596 }
48597
48598 differ = (old->tclass != real_packet->tclass);
48599 if (differ) {
48600 BV_SET(fields, 4);
48601 }
48602
48603 if (packet->removed) {
48604 BV_SET(fields, 5);
48605 }
48606
48607 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
48608 if (differ) {
48609 BV_SET(fields, 6);
48610 }
48611
48612 differ = ((int) (old->cost * 100) != (int) (real_packet->cost * 100));
48613 if (differ) {
48614 BV_SET(fields, 7);
48615 }
48616
48617 differ = (old->num_reqs != real_packet->num_reqs);
48618 if (differ) {
48619 BV_SET(fields, 8);
48620 }
48621
48622 differ = (strcmp(old->name, real_packet->name) != 0);
48623 if (differ) {
48624 BV_SET(fields, 9);
48625 }
48626
48627 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
48628 if (differ) {
48629 BV_SET(fields, 10);
48630 }
48631
48632 if (real_packet->helptext) {
48633 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
48634 } else {
48635 differ = (strvec_size(old->helptext) > 0);
48636 }
48637 if (differ) {
48638 BV_SET(fields, 11);
48639 }
48640
48641 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
48642 if (differ) {
48643 BV_SET(fields, 12);
48644 }
48645
48646 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
48647 if (differ) {
48648 BV_SET(fields, 13);
48649 }
48650
48651
48652#ifdef FREECIV_JSON_CONNECTION
48653 field_addr.name = "fields";
48654#endif /* FREECIV_JSON_CONNECTION */
48655 e = 0;
48656 e |= DIO_BV_PUT(&dout, &field_addr, fields);
48657 if (e) {
48658 log_packet_detailed("fields bitvector error detected");
48659 }
48660
48661 if (BV_ISSET(fields, 0)) {
48662 log_packet_detailed(" field 'id' has changed");
48663#ifdef FREECIV_JSON_CONNECTION
48664 field_addr.name = "id";
48665#endif /* FREECIV_JSON_CONNECTION */
48666 e = 0;
48667 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
48668 if (e) {
48669 log_packet_detailed("'id' field error detected");
48670 }
48671 }
48672 if (BV_ISSET(fields, 1)) {
48673 log_packet_detailed(" field 'root_req' has changed");
48674#ifdef FREECIV_JSON_CONNECTION
48675 field_addr.name = "root_req";
48676#endif /* FREECIV_JSON_CONNECTION */
48677 e = 0;
48678 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->root_req);
48679 if (e) {
48680 log_packet_detailed("'root_req' field error detected");
48681 }
48682 }
48683 if (BV_ISSET(fields, 2)) {
48684 log_packet_detailed(" field 'research_reqs_count' has changed");
48685#ifdef FREECIV_JSON_CONNECTION
48686 field_addr.name = "research_reqs_count";
48687#endif /* FREECIV_JSON_CONNECTION */
48688 e = 0;
48689 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->research_reqs_count);
48690 if (e) {
48691 log_packet_detailed("'research_reqs_count' field error detected");
48692 }
48693 }
48694 if (BV_ISSET(fields, 3)) {
48695 log_packet_detailed(" field 'research_reqs' has changed");
48696#ifdef FREECIV_JSON_CONNECTION
48697 field_addr.name = "research_reqs";
48698#endif /* FREECIV_JSON_CONNECTION */
48699 e = 0;
48700 {
48701 int i;
48702
48703#ifdef FREECIV_JSON_CONNECTION
48704 /* Create the array. */
48705 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->research_reqs_count);
48706
48707 /* Enter the array. */
48708 field_addr.sub_location = plocation_elem_new(0);
48709#endif /* FREECIV_JSON_CONNECTION */
48710
48711 for (i = 0; i < real_packet->research_reqs_count; i++) {
48712#ifdef FREECIV_JSON_CONNECTION
48713 /* Next array element. */
48714 field_addr.sub_location->number = i;
48715#endif /* FREECIV_JSON_CONNECTION */
48716 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->research_reqs[i]);
48717 }
48718
48719#ifdef FREECIV_JSON_CONNECTION
48720 /* Exit array. */
48721 FC_FREE(field_addr.sub_location);
48722#endif /* FREECIV_JSON_CONNECTION */
48723 }
48724 if (e) {
48725 log_packet_detailed("'research_reqs' field error detected");
48726 }
48727 }
48728 if (BV_ISSET(fields, 4)) {
48729 log_packet_detailed(" field 'tclass' has changed");
48730#ifdef FREECIV_JSON_CONNECTION
48731 field_addr.name = "tclass";
48732#endif /* FREECIV_JSON_CONNECTION */
48733 e = 0;
48734 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
48735 if (e) {
48736 log_packet_detailed("'tclass' field error detected");
48737 }
48738 }
48739 /* field 5 is folded into the header */
48740 if (BV_ISSET(fields, 6)) {
48741 log_packet_detailed(" field 'flags' has changed");
48742#ifdef FREECIV_JSON_CONNECTION
48743 field_addr.name = "flags";
48744#endif /* FREECIV_JSON_CONNECTION */
48745 e = 0;
48746 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
48747 if (e) {
48748 log_packet_detailed("'flags' field error detected");
48749 }
48750 }
48751 if (BV_ISSET(fields, 7)) {
48752 log_packet_detailed(" field 'cost' has changed");
48753#ifdef FREECIV_JSON_CONNECTION
48754 field_addr.name = "cost";
48755#endif /* FREECIV_JSON_CONNECTION */
48756 e = 0;
48757 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->cost, 100);
48758 if (e) {
48759 log_packet_detailed("'cost' field error detected");
48760 }
48761 }
48762 if (BV_ISSET(fields, 8)) {
48763 log_packet_detailed(" field 'num_reqs' has changed");
48764#ifdef FREECIV_JSON_CONNECTION
48765 field_addr.name = "num_reqs";
48766#endif /* FREECIV_JSON_CONNECTION */
48767 e = 0;
48768 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->num_reqs);
48769 if (e) {
48770 log_packet_detailed("'num_reqs' field error detected");
48771 }
48772 }
48773 if (BV_ISSET(fields, 9)) {
48774 log_packet_detailed(" field 'name' has changed");
48775#ifdef FREECIV_JSON_CONNECTION
48776 field_addr.name = "name";
48777#endif /* FREECIV_JSON_CONNECTION */
48778 e = 0;
48779 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
48780 if (e) {
48781 log_packet_detailed("'name' field error detected");
48782 }
48783 }
48784 if (BV_ISSET(fields, 10)) {
48785 log_packet_detailed(" field 'rule_name' has changed");
48786#ifdef FREECIV_JSON_CONNECTION
48787 field_addr.name = "rule_name";
48788#endif /* FREECIV_JSON_CONNECTION */
48789 e = 0;
48790 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
48791 if (e) {
48792 log_packet_detailed("'rule_name' field error detected");
48793 }
48794 }
48795 if (BV_ISSET(fields, 11)) {
48796 log_packet_detailed(" field 'helptext' has changed");
48797#ifdef FREECIV_JSON_CONNECTION
48798 field_addr.name = "helptext";
48799#endif /* FREECIV_JSON_CONNECTION */
48800 e = 0;
48801 if (!real_packet->helptext) {
48802 /* Transmit null vector as empty vector */
48803 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
48804 } else {
48805 int i;
48806
48807 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
48808 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
48809
48810#ifdef FREECIV_JSON_CONNECTION
48811 field_addr.sub_location = plocation_elem_new(0);
48812#endif /* FREECIV_JSON_CONNECTION */
48813
48814 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
48815 const char *pstr = strvec_get(real_packet->helptext, i);
48816
48817 if (!pstr) {
48818 /* Transmit null strings as empty strings */
48819 pstr = "";
48820 }
48821
48822#ifdef FREECIV_JSON_CONNECTION
48823 /* Next array element */
48824 field_addr.sub_location->number = i;
48825#endif /* FREECIV_JSON_CONNECTION */
48826
48827 e |= DIO_PUT(string, &dout, &field_addr, pstr);
48828 }
48829
48830#ifdef FREECIV_JSON_CONNECTION
48831 FC_FREE(field_addr.sub_location);
48832#endif /* FREECIV_JSON_CONNECTION */
48833 }
48834 if (e) {
48835 log_packet_detailed("'helptext' field error detected");
48836 }
48837 }
48838 if (BV_ISSET(fields, 12)) {
48839 log_packet_detailed(" field 'graphic_str' has changed");
48840#ifdef FREECIV_JSON_CONNECTION
48841 field_addr.name = "graphic_str";
48842#endif /* FREECIV_JSON_CONNECTION */
48843 e = 0;
48844 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
48845 if (e) {
48846 log_packet_detailed("'graphic_str' field error detected");
48847 }
48848 }
48849 if (BV_ISSET(fields, 13)) {
48850 log_packet_detailed(" field 'graphic_alt' has changed");
48851#ifdef FREECIV_JSON_CONNECTION
48852 field_addr.name = "graphic_alt";
48853#endif /* FREECIV_JSON_CONNECTION */
48854 e = 0;
48855 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
48856 if (e) {
48857 log_packet_detailed("'graphic_alt' field error detected");
48858 }
48859 }
48860
48861 old->id = real_packet->id;
48862 old->root_req = real_packet->root_req;
48863 old->research_reqs_count = real_packet->research_reqs_count;
48864 {
48865 int i;
48866
48867 for (i = 0; i < real_packet->research_reqs_count; i++) {
48868 old->research_reqs[i] = real_packet->research_reqs[i];
48869 }
48870 }
48871 old->tclass = real_packet->tclass;
48872 old->removed = real_packet->removed;
48873 old->flags = real_packet->flags;
48874 old->cost = real_packet->cost;
48875 old->num_reqs = real_packet->num_reqs;
48876 sz_strlcpy(old->name, real_packet->name);
48877 sz_strlcpy(old->rule_name, real_packet->rule_name);
48878 if (real_packet->helptext) {
48879 strvec_copy(old->helptext, real_packet->helptext);
48880 } else {
48881 strvec_clear(old->helptext);
48882 }
48883 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
48884 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
48885#endif /* FREECIV_DELTA_PROTOCOL */
48886#ifndef FREECIV_DELTA_PROTOCOL
48887#ifdef FREECIV_JSON_CONNECTION
48888 field_addr.name = "id";
48889#endif /* FREECIV_JSON_CONNECTION */
48890 e = 0;
48891 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
48892 if (e) {
48893 log_packet_detailed("'id' field error detected");
48894 }
48895#ifdef FREECIV_JSON_CONNECTION
48896 field_addr.name = "root_req";
48897#endif /* FREECIV_JSON_CONNECTION */
48898 e = 0;
48899 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->root_req);
48900 if (e) {
48901 log_packet_detailed("'root_req' field error detected");
48902 }
48903#ifdef FREECIV_JSON_CONNECTION
48904 field_addr.name = "research_reqs_count";
48905#endif /* FREECIV_JSON_CONNECTION */
48906 e = 0;
48907 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->research_reqs_count);
48908 if (e) {
48909 log_packet_detailed("'research_reqs_count' field error detected");
48910 }
48911#ifdef FREECIV_JSON_CONNECTION
48912 field_addr.name = "research_reqs";
48913#endif /* FREECIV_JSON_CONNECTION */
48914 e = 0;
48915 {
48916 int i;
48917
48918#ifdef FREECIV_JSON_CONNECTION
48919 /* Create the array. */
48920 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->research_reqs_count);
48921
48922 /* Enter the array. */
48923 field_addr.sub_location = plocation_elem_new(0);
48924#endif /* FREECIV_JSON_CONNECTION */
48925
48926 for (i = 0; i < real_packet->research_reqs_count; i++) {
48927#ifdef FREECIV_JSON_CONNECTION
48928 /* Next array element. */
48929 field_addr.sub_location->number = i;
48930#endif /* FREECIV_JSON_CONNECTION */
48931 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->research_reqs[i]);
48932 }
48933
48934#ifdef FREECIV_JSON_CONNECTION
48935 /* Exit array. */
48936 FC_FREE(field_addr.sub_location);
48937#endif /* FREECIV_JSON_CONNECTION */
48938 }
48939 if (e) {
48940 log_packet_detailed("'research_reqs' field error detected");
48941 }
48942#ifdef FREECIV_JSON_CONNECTION
48943 field_addr.name = "tclass";
48944#endif /* FREECIV_JSON_CONNECTION */
48945 e = 0;
48946 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
48947 if (e) {
48948 log_packet_detailed("'tclass' field error detected");
48949 }
48950#ifdef FREECIV_JSON_CONNECTION
48951 field_addr.name = "removed";
48952#endif /* FREECIV_JSON_CONNECTION */
48953 e = 0;
48954 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->removed);
48955 if (e) {
48956 log_packet_detailed("'removed' field error detected");
48957 }
48958#ifdef FREECIV_JSON_CONNECTION
48959 field_addr.name = "flags";
48960#endif /* FREECIV_JSON_CONNECTION */
48961 e = 0;
48962 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
48963 if (e) {
48964 log_packet_detailed("'flags' field error detected");
48965 }
48966#ifdef FREECIV_JSON_CONNECTION
48967 field_addr.name = "cost";
48968#endif /* FREECIV_JSON_CONNECTION */
48969 e = 0;
48970 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->cost, 100);
48971 if (e) {
48972 log_packet_detailed("'cost' field error detected");
48973 }
48974#ifdef FREECIV_JSON_CONNECTION
48975 field_addr.name = "num_reqs";
48976#endif /* FREECIV_JSON_CONNECTION */
48977 e = 0;
48978 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->num_reqs);
48979 if (e) {
48980 log_packet_detailed("'num_reqs' field error detected");
48981 }
48982#ifdef FREECIV_JSON_CONNECTION
48983 field_addr.name = "name";
48984#endif /* FREECIV_JSON_CONNECTION */
48985 e = 0;
48986 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
48987 if (e) {
48988 log_packet_detailed("'name' field error detected");
48989 }
48990#ifdef FREECIV_JSON_CONNECTION
48991 field_addr.name = "rule_name";
48992#endif /* FREECIV_JSON_CONNECTION */
48993 e = 0;
48994 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
48995 if (e) {
48996 log_packet_detailed("'rule_name' field error detected");
48997 }
48998#ifdef FREECIV_JSON_CONNECTION
48999 field_addr.name = "helptext";
49000#endif /* FREECIV_JSON_CONNECTION */
49001 e = 0;
49002 if (!real_packet->helptext) {
49003 /* Transmit null vector as empty vector */
49004 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
49005 } else {
49006 int i;
49007
49008 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
49009 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
49010
49011#ifdef FREECIV_JSON_CONNECTION
49012 field_addr.sub_location = plocation_elem_new(0);
49013#endif /* FREECIV_JSON_CONNECTION */
49014
49015 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
49016 const char *pstr = strvec_get(real_packet->helptext, i);
49017
49018 if (!pstr) {
49019 /* Transmit null strings as empty strings */
49020 pstr = "";
49021 }
49022
49023#ifdef FREECIV_JSON_CONNECTION
49024 /* Next array element */
49025 field_addr.sub_location->number = i;
49026#endif /* FREECIV_JSON_CONNECTION */
49027
49028 e |= DIO_PUT(string, &dout, &field_addr, pstr);
49029 }
49030
49031#ifdef FREECIV_JSON_CONNECTION
49032 FC_FREE(field_addr.sub_location);
49033#endif /* FREECIV_JSON_CONNECTION */
49034 }
49035 if (e) {
49036 log_packet_detailed("'helptext' field error detected");
49037 }
49038#ifdef FREECIV_JSON_CONNECTION
49039 field_addr.name = "graphic_str";
49040#endif /* FREECIV_JSON_CONNECTION */
49041 e = 0;
49042 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
49043 if (e) {
49044 log_packet_detailed("'graphic_str' field error detected");
49045 }
49046#ifdef FREECIV_JSON_CONNECTION
49047 field_addr.name = "graphic_alt";
49048#endif /* FREECIV_JSON_CONNECTION */
49049 e = 0;
49050 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
49051 if (e) {
49052 log_packet_detailed("'graphic_alt' field error detected");
49053 }
49054
49055#endif
49056 SEND_PACKET_END(PACKET_RULESET_TECH);
49057}
49058
49059 int send_packet_ruleset_tech(struct connection *pc, const struct packet_ruleset_tech *packet)
49060{
49061 if (!pc->used) {
49062 log_error("WARNING: trying to send data to the closed connection %s",
49063 conn_description(pc));
49064 return -1;
49065 }
49066 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH].packet != nullptr, -1,
49067 "Handler for PACKET_RULESET_TECH not installed");
49068 return pc->phs.handlers->send[PACKET_RULESET_TECH].packet(pc, packet);
49069}
49070
49071 void lsend_packet_ruleset_tech(struct conn_list *dest, const struct packet_ruleset_tech *packet)
49072{
49073 conn_list_iterate(dest, pconn) {
49074 send_packet_ruleset_tech(pconn, packet);
49075 } conn_list_iterate_end;
49076}
49077
49078 static inline void init_packet_ruleset_tech_class(struct packet_ruleset_tech_class *packet)
49079{
49080 memset(packet, 0, sizeof(*packet));
49081}
49082
49083#define free_packet_ruleset_tech_class(_packet) (void) 0
49084#define destroy_packet_ruleset_tech_class free
49085
49086#ifdef FREECIV_DELTA_PROTOCOL
49087#define hash_packet_ruleset_tech_class_100 hash_const
49088
49089#define cmp_packet_ruleset_tech_class_100 cmp_const
49090
49091 BV_DEFINE(packet_ruleset_tech_class_100_fields, 4);
49092#endif /* FREECIV_DELTA_PROTOCOL */
49093
49094 static struct packet_ruleset_tech_class *receive_packet_ruleset_tech_class_100(struct connection *pc)
49095{
49096#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_tech_class(_packet)
49097#ifdef FREECIV_DELTA_PROTOCOL
49098 packet_ruleset_tech_class_100_fields fields;
49099 struct packet_ruleset_tech_class *old;
49100 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH_CLASS;
49101#endif /* FREECIV_DELTA_PROTOCOL */
49102 RECEIVE_PACKET_START(packet_ruleset_tech_class, real_packet);
49103#ifdef FREECIV_JSON_CONNECTION
49104 struct plocation field_addr;
49105 {
49106 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
49107 field_addr = *field_addr_tmp;
49108 FC_FREE(field_addr_tmp);
49109 }
49110#endif /* FREECIV_JSON_CONNECTION */
49111
49112#ifdef FREECIV_DELTA_PROTOCOL
49113#ifdef FREECIV_JSON_CONNECTION
49114 field_addr.name = "fields";
49115#endif /* FREECIV_JSON_CONNECTION */
49116 DIO_BV_GET(&din, &field_addr, fields);
49117
49118#else /* FREECIV_DELTA_PROTOCOL */
49119#ifdef FREECIV_JSON_CONNECTION
49120 field_addr.name = "id";
49121#endif /* FREECIV_JSON_CONNECTION */
49122 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
49123 RECEIVE_PACKET_FIELD_ERROR(id);
49124 }
49125#ifdef FREECIV_JSON_CONNECTION
49126 field_addr.name = "name";
49127#endif /* FREECIV_JSON_CONNECTION */
49128 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
49129 RECEIVE_PACKET_FIELD_ERROR(name);
49130 }
49131#ifdef FREECIV_JSON_CONNECTION
49132 field_addr.name = "rule_name";
49133#endif /* FREECIV_JSON_CONNECTION */
49134 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
49135 RECEIVE_PACKET_FIELD_ERROR(rule_name);
49136 }
49137#ifdef FREECIV_JSON_CONNECTION
49138 field_addr.name = "cost_pct";
49139#endif /* FREECIV_JSON_CONNECTION */
49140 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->cost_pct)) {
49141 RECEIVE_PACKET_FIELD_ERROR(cost_pct);
49142 }
49143#endif
49144 log_packet_detailed("packet_ruleset_tech_class_100: got info about ()");
49145
49146#ifdef FREECIV_DELTA_PROTOCOL
49147 if (nullptr == *hash) {
49148 *hash = genhash_new_full(hash_packet_ruleset_tech_class_100, cmp_packet_ruleset_tech_class_100,
49149 nullptr, nullptr, nullptr, destroy_packet_ruleset_tech_class);
49150 }
49151
49152 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49153 *real_packet = *old;
49154 } else {
49155 /* packet is already initialized empty */
49156 log_packet_detailed(" no old info");
49157 }
49158
49159 if (BV_ISSET(fields, 0)) {
49160 log_packet_detailed(" got field 'id'");
49161#ifdef FREECIV_JSON_CONNECTION
49162 field_addr.name = "id";
49163#endif /* FREECIV_JSON_CONNECTION */
49164 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
49165 RECEIVE_PACKET_FIELD_ERROR(id);
49166 }
49167 }
49168 if (BV_ISSET(fields, 1)) {
49169 log_packet_detailed(" got field 'name'");
49170#ifdef FREECIV_JSON_CONNECTION
49171 field_addr.name = "name";
49172#endif /* FREECIV_JSON_CONNECTION */
49173 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
49174 RECEIVE_PACKET_FIELD_ERROR(name);
49175 }
49176 }
49177 if (BV_ISSET(fields, 2)) {
49178 log_packet_detailed(" got field 'rule_name'");
49179#ifdef FREECIV_JSON_CONNECTION
49180 field_addr.name = "rule_name";
49181#endif /* FREECIV_JSON_CONNECTION */
49182 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
49183 RECEIVE_PACKET_FIELD_ERROR(rule_name);
49184 }
49185 }
49186 if (BV_ISSET(fields, 3)) {
49187 log_packet_detailed(" got field 'cost_pct'");
49188#ifdef FREECIV_JSON_CONNECTION
49189 field_addr.name = "cost_pct";
49190#endif /* FREECIV_JSON_CONNECTION */
49191 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->cost_pct)) {
49192 RECEIVE_PACKET_FIELD_ERROR(cost_pct);
49193 }
49194 }
49195
49196 if (nullptr == old) {
49197 old = fc_malloc(sizeof(*old));
49198 init_packet_ruleset_tech_class(old);
49199 *old = *real_packet;
49200 genhash_insert(*hash, old, old);
49201 } else {
49202 *old = *real_packet;
49203 }
49204
49205#endif /* FREECIV_DELTA_PROTOCOL */
49206 RECEIVE_PACKET_END(real_packet);
49207#undef FREE_PACKET_STRUCT
49208}
49209
49210 static int send_packet_ruleset_tech_class_100(struct connection *pc, const struct packet_ruleset_tech_class *packet)
49211{
49212 const struct packet_ruleset_tech_class *real_packet = packet;
49213 int e;
49214#ifdef FREECIV_DELTA_PROTOCOL
49215 packet_ruleset_tech_class_100_fields fields;
49216 struct packet_ruleset_tech_class *old;
49217 bool differ;
49218 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH_CLASS;
49219#endif /* FREECIV_DELTA_PROTOCOL */
49220 SEND_PACKET_START(PACKET_RULESET_TECH_CLASS);
49221#ifdef FREECIV_JSON_CONNECTION
49222 struct plocation field_addr;
49223 {
49224 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
49225 field_addr = *field_addr_tmp;
49226 FC_FREE(field_addr_tmp);
49227 }
49228#endif /* FREECIV_JSON_CONNECTION */
49229
49230 log_packet_detailed("packet_ruleset_tech_class_100: sending info about ()");
49231
49232#ifdef FREECIV_DELTA_PROTOCOL
49233 if (nullptr == *hash) {
49234 *hash = genhash_new_full(hash_packet_ruleset_tech_class_100, cmp_packet_ruleset_tech_class_100,
49235 nullptr, nullptr, nullptr, destroy_packet_ruleset_tech_class);
49236 }
49237 BV_CLR_ALL(fields);
49238
49239 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
49240 old = fc_malloc(sizeof(*old));
49241 /* temporary bitcopy just to insert correctly */
49242 *old = *real_packet;
49243 genhash_insert(*hash, old, old);
49244 init_packet_ruleset_tech_class(old);
49245 }
49246 differ = (old->id != real_packet->id);
49247 if (differ) {
49248 BV_SET(fields, 0);
49249 }
49250
49251 differ = (strcmp(old->name, real_packet->name) != 0);
49252 if (differ) {
49253 BV_SET(fields, 1);
49254 }
49255
49256 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
49257 if (differ) {
49258 BV_SET(fields, 2);
49259 }
49260
49261 differ = (old->cost_pct != real_packet->cost_pct);
49262 if (differ) {
49263 BV_SET(fields, 3);
49264 }
49265
49266
49267#ifdef FREECIV_JSON_CONNECTION
49268 field_addr.name = "fields";
49269#endif /* FREECIV_JSON_CONNECTION */
49270 e = 0;
49271 e |= DIO_BV_PUT(&dout, &field_addr, fields);
49272 if (e) {
49273 log_packet_detailed("fields bitvector error detected");
49274 }
49275
49276 if (BV_ISSET(fields, 0)) {
49277 log_packet_detailed(" field 'id' has changed");
49278#ifdef FREECIV_JSON_CONNECTION
49279 field_addr.name = "id";
49280#endif /* FREECIV_JSON_CONNECTION */
49281 e = 0;
49282 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
49283 if (e) {
49284 log_packet_detailed("'id' field error detected");
49285 }
49286 }
49287 if (BV_ISSET(fields, 1)) {
49288 log_packet_detailed(" field 'name' has changed");
49289#ifdef FREECIV_JSON_CONNECTION
49290 field_addr.name = "name";
49291#endif /* FREECIV_JSON_CONNECTION */
49292 e = 0;
49293 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
49294 if (e) {
49295 log_packet_detailed("'name' field error detected");
49296 }
49297 }
49298 if (BV_ISSET(fields, 2)) {
49299 log_packet_detailed(" field 'rule_name' has changed");
49300#ifdef FREECIV_JSON_CONNECTION
49301 field_addr.name = "rule_name";
49302#endif /* FREECIV_JSON_CONNECTION */
49303 e = 0;
49304 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
49305 if (e) {
49306 log_packet_detailed("'rule_name' field error detected");
49307 }
49308 }
49309 if (BV_ISSET(fields, 3)) {
49310 log_packet_detailed(" field 'cost_pct' has changed");
49311#ifdef FREECIV_JSON_CONNECTION
49312 field_addr.name = "cost_pct";
49313#endif /* FREECIV_JSON_CONNECTION */
49314 e = 0;
49315 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->cost_pct);
49316 if (e) {
49317 log_packet_detailed("'cost_pct' field error detected");
49318 }
49319 }
49320
49321 *old = *real_packet;
49322#endif /* FREECIV_DELTA_PROTOCOL */
49323#ifndef FREECIV_DELTA_PROTOCOL
49324#ifdef FREECIV_JSON_CONNECTION
49325 field_addr.name = "id";
49326#endif /* FREECIV_JSON_CONNECTION */
49327 e = 0;
49328 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
49329 if (e) {
49330 log_packet_detailed("'id' field error detected");
49331 }
49332#ifdef FREECIV_JSON_CONNECTION
49333 field_addr.name = "name";
49334#endif /* FREECIV_JSON_CONNECTION */
49335 e = 0;
49336 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
49337 if (e) {
49338 log_packet_detailed("'name' field error detected");
49339 }
49340#ifdef FREECIV_JSON_CONNECTION
49341 field_addr.name = "rule_name";
49342#endif /* FREECIV_JSON_CONNECTION */
49343 e = 0;
49344 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
49345 if (e) {
49346 log_packet_detailed("'rule_name' field error detected");
49347 }
49348#ifdef FREECIV_JSON_CONNECTION
49349 field_addr.name = "cost_pct";
49350#endif /* FREECIV_JSON_CONNECTION */
49351 e = 0;
49352 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->cost_pct);
49353 if (e) {
49354 log_packet_detailed("'cost_pct' field error detected");
49355 }
49356
49357#endif
49358 SEND_PACKET_END(PACKET_RULESET_TECH_CLASS);
49359}
49360
49361 int send_packet_ruleset_tech_class(struct connection *pc, const struct packet_ruleset_tech_class *packet)
49362{
49363 if (!pc->used) {
49364 log_error("WARNING: trying to send data to the closed connection %s",
49365 conn_description(pc));
49366 return -1;
49367 }
49368 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH_CLASS].packet != nullptr, -1,
49369 "Handler for PACKET_RULESET_TECH_CLASS not installed");
49370 return pc->phs.handlers->send[PACKET_RULESET_TECH_CLASS].packet(pc, packet);
49371}
49372
49373 void lsend_packet_ruleset_tech_class(struct conn_list *dest, const struct packet_ruleset_tech_class *packet)
49374{
49375 conn_list_iterate(dest, pconn) {
49376 send_packet_ruleset_tech_class(pconn, packet);
49377 } conn_list_iterate_end;
49378}
49379
49380 static inline void init_packet_ruleset_tech_flag(struct packet_ruleset_tech_flag *packet)
49381{
49382 memset(packet, 0, sizeof(*packet));
49383}
49384
49385#define free_packet_ruleset_tech_flag(_packet) (void) 0
49386#define destroy_packet_ruleset_tech_flag free
49387
49388#ifdef FREECIV_DELTA_PROTOCOL
49389#define hash_packet_ruleset_tech_flag_100 hash_const
49390
49391#define cmp_packet_ruleset_tech_flag_100 cmp_const
49392
49393 BV_DEFINE(packet_ruleset_tech_flag_100_fields, 3);
49394#endif /* FREECIV_DELTA_PROTOCOL */
49395
49396 static struct packet_ruleset_tech_flag *receive_packet_ruleset_tech_flag_100(struct connection *pc)
49397{
49398#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_tech_flag(_packet)
49399#ifdef FREECIV_DELTA_PROTOCOL
49400 packet_ruleset_tech_flag_100_fields fields;
49401 struct packet_ruleset_tech_flag *old;
49402 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH_FLAG;
49403#endif /* FREECIV_DELTA_PROTOCOL */
49404 RECEIVE_PACKET_START(packet_ruleset_tech_flag, real_packet);
49405#ifdef FREECIV_JSON_CONNECTION
49406 struct plocation field_addr;
49407 {
49408 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
49409 field_addr = *field_addr_tmp;
49410 FC_FREE(field_addr_tmp);
49411 }
49412#endif /* FREECIV_JSON_CONNECTION */
49413
49414#ifdef FREECIV_DELTA_PROTOCOL
49415#ifdef FREECIV_JSON_CONNECTION
49416 field_addr.name = "fields";
49417#endif /* FREECIV_JSON_CONNECTION */
49418 DIO_BV_GET(&din, &field_addr, fields);
49419
49420#else /* FREECIV_DELTA_PROTOCOL */
49421#ifdef FREECIV_JSON_CONNECTION
49422 field_addr.name = "id";
49423#endif /* FREECIV_JSON_CONNECTION */
49424 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
49425 RECEIVE_PACKET_FIELD_ERROR(id);
49426 }
49427#ifdef FREECIV_JSON_CONNECTION
49428 field_addr.name = "name";
49429#endif /* FREECIV_JSON_CONNECTION */
49430 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
49431 RECEIVE_PACKET_FIELD_ERROR(name);
49432 }
49433#ifdef FREECIV_JSON_CONNECTION
49434 field_addr.name = "helptxt";
49435#endif /* FREECIV_JSON_CONNECTION */
49436 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
49437 RECEIVE_PACKET_FIELD_ERROR(helptxt);
49438 }
49439#endif
49440 log_packet_detailed("packet_ruleset_tech_flag_100: got info about ()");
49441
49442#ifdef FREECIV_DELTA_PROTOCOL
49443 if (nullptr == *hash) {
49444 *hash = genhash_new_full(hash_packet_ruleset_tech_flag_100, cmp_packet_ruleset_tech_flag_100,
49445 nullptr, nullptr, nullptr, destroy_packet_ruleset_tech_flag);
49446 }
49447
49448 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49449 *real_packet = *old;
49450 } else {
49451 /* packet is already initialized empty */
49452 log_packet_detailed(" no old info");
49453 }
49454
49455 if (BV_ISSET(fields, 0)) {
49456 log_packet_detailed(" got field 'id'");
49457#ifdef FREECIV_JSON_CONNECTION
49458 field_addr.name = "id";
49459#endif /* FREECIV_JSON_CONNECTION */
49460 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
49461 RECEIVE_PACKET_FIELD_ERROR(id);
49462 }
49463 }
49464 if (BV_ISSET(fields, 1)) {
49465 log_packet_detailed(" got field 'name'");
49466#ifdef FREECIV_JSON_CONNECTION
49467 field_addr.name = "name";
49468#endif /* FREECIV_JSON_CONNECTION */
49469 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
49470 RECEIVE_PACKET_FIELD_ERROR(name);
49471 }
49472 }
49473 if (BV_ISSET(fields, 2)) {
49474 log_packet_detailed(" got field 'helptxt'");
49475#ifdef FREECIV_JSON_CONNECTION
49476 field_addr.name = "helptxt";
49477#endif /* FREECIV_JSON_CONNECTION */
49478 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
49479 RECEIVE_PACKET_FIELD_ERROR(helptxt);
49480 }
49481 }
49482
49483 if (nullptr == old) {
49484 old = fc_malloc(sizeof(*old));
49485 init_packet_ruleset_tech_flag(old);
49486 *old = *real_packet;
49487 genhash_insert(*hash, old, old);
49488 } else {
49489 *old = *real_packet;
49490 }
49491
49492#endif /* FREECIV_DELTA_PROTOCOL */
49493 RECEIVE_PACKET_END(real_packet);
49494#undef FREE_PACKET_STRUCT
49495}
49496
49497 static int send_packet_ruleset_tech_flag_100(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
49498{
49499 const struct packet_ruleset_tech_flag *real_packet = packet;
49500 int e;
49501#ifdef FREECIV_DELTA_PROTOCOL
49502 packet_ruleset_tech_flag_100_fields fields;
49503 struct packet_ruleset_tech_flag *old;
49504 bool differ;
49505 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH_FLAG;
49506#endif /* FREECIV_DELTA_PROTOCOL */
49507 SEND_PACKET_START(PACKET_RULESET_TECH_FLAG);
49508#ifdef FREECIV_JSON_CONNECTION
49509 struct plocation field_addr;
49510 {
49511 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
49512 field_addr = *field_addr_tmp;
49513 FC_FREE(field_addr_tmp);
49514 }
49515#endif /* FREECIV_JSON_CONNECTION */
49516
49517 log_packet_detailed("packet_ruleset_tech_flag_100: sending info about ()");
49518
49519#ifdef FREECIV_DELTA_PROTOCOL
49520 if (nullptr == *hash) {
49521 *hash = genhash_new_full(hash_packet_ruleset_tech_flag_100, cmp_packet_ruleset_tech_flag_100,
49522 nullptr, nullptr, nullptr, destroy_packet_ruleset_tech_flag);
49523 }
49524 BV_CLR_ALL(fields);
49525
49526 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
49527 old = fc_malloc(sizeof(*old));
49528 /* temporary bitcopy just to insert correctly */
49529 *old = *real_packet;
49530 genhash_insert(*hash, old, old);
49531 init_packet_ruleset_tech_flag(old);
49532 }
49533 differ = (old->id != real_packet->id);
49534 if (differ) {
49535 BV_SET(fields, 0);
49536 }
49537
49538 differ = (strcmp(old->name, real_packet->name) != 0);
49539 if (differ) {
49540 BV_SET(fields, 1);
49541 }
49542
49543 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
49544 if (differ) {
49545 BV_SET(fields, 2);
49546 }
49547
49548
49549#ifdef FREECIV_JSON_CONNECTION
49550 field_addr.name = "fields";
49551#endif /* FREECIV_JSON_CONNECTION */
49552 e = 0;
49553 e |= DIO_BV_PUT(&dout, &field_addr, fields);
49554 if (e) {
49555 log_packet_detailed("fields bitvector error detected");
49556 }
49557
49558 if (BV_ISSET(fields, 0)) {
49559 log_packet_detailed(" field 'id' has changed");
49560#ifdef FREECIV_JSON_CONNECTION
49561 field_addr.name = "id";
49562#endif /* FREECIV_JSON_CONNECTION */
49563 e = 0;
49564 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
49565 if (e) {
49566 log_packet_detailed("'id' field error detected");
49567 }
49568 }
49569 if (BV_ISSET(fields, 1)) {
49570 log_packet_detailed(" field 'name' has changed");
49571#ifdef FREECIV_JSON_CONNECTION
49572 field_addr.name = "name";
49573#endif /* FREECIV_JSON_CONNECTION */
49574 e = 0;
49575 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
49576 if (e) {
49577 log_packet_detailed("'name' field error detected");
49578 }
49579 }
49580 if (BV_ISSET(fields, 2)) {
49581 log_packet_detailed(" field 'helptxt' has changed");
49582#ifdef FREECIV_JSON_CONNECTION
49583 field_addr.name = "helptxt";
49584#endif /* FREECIV_JSON_CONNECTION */
49585 e = 0;
49586 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
49587 if (e) {
49588 log_packet_detailed("'helptxt' field error detected");
49589 }
49590 }
49591
49592 *old = *real_packet;
49593#endif /* FREECIV_DELTA_PROTOCOL */
49594#ifndef FREECIV_DELTA_PROTOCOL
49595#ifdef FREECIV_JSON_CONNECTION
49596 field_addr.name = "id";
49597#endif /* FREECIV_JSON_CONNECTION */
49598 e = 0;
49599 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
49600 if (e) {
49601 log_packet_detailed("'id' field error detected");
49602 }
49603#ifdef FREECIV_JSON_CONNECTION
49604 field_addr.name = "name";
49605#endif /* FREECIV_JSON_CONNECTION */
49606 e = 0;
49607 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
49608 if (e) {
49609 log_packet_detailed("'name' field error detected");
49610 }
49611#ifdef FREECIV_JSON_CONNECTION
49612 field_addr.name = "helptxt";
49613#endif /* FREECIV_JSON_CONNECTION */
49614 e = 0;
49615 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
49616 if (e) {
49617 log_packet_detailed("'helptxt' field error detected");
49618 }
49619
49620#endif
49621 SEND_PACKET_END(PACKET_RULESET_TECH_FLAG);
49622}
49623
49624 int send_packet_ruleset_tech_flag(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
49625{
49626 if (!pc->used) {
49627 log_error("WARNING: trying to send data to the closed connection %s",
49628 conn_description(pc));
49629 return -1;
49630 }
49631 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH_FLAG].packet != nullptr, -1,
49632 "Handler for PACKET_RULESET_TECH_FLAG not installed");
49633 return pc->phs.handlers->send[PACKET_RULESET_TECH_FLAG].packet(pc, packet);
49634}
49635
49636 void lsend_packet_ruleset_tech_flag(struct conn_list *dest, const struct packet_ruleset_tech_flag *packet)
49637{
49638 conn_list_iterate(dest, pconn) {
49639 send_packet_ruleset_tech_flag(pconn, packet);
49640 } conn_list_iterate_end;
49641}
49642
49643 static inline void init_packet_ruleset_government(struct packet_ruleset_government *packet)
49644{
49645 memset(packet, 0, sizeof(*packet));
49646
49647 /* no work needed for packet->id */
49648 /* no work needed for packet->reqs_count */
49649 /* no work needed for packet->reqs */
49650 /* no work needed for packet->name */
49651 /* no work needed for packet->rule_name */
49652 /* no work needed for packet->graphic_str */
49653 /* no work needed for packet->graphic_alt */
49654 packet->helptext = strvec_new();
49655}
49656
49657 static inline void free_packet_ruleset_government(struct packet_ruleset_government *packet)
49658{
49659 if (packet->helptext) {
49660 strvec_destroy(packet->helptext);
49661 packet->helptext = nullptr;
49662 }
49663 /* no work needed for packet->graphic_alt */
49664 /* no work needed for packet->graphic_str */
49665 /* no work needed for packet->rule_name */
49666 /* no work needed for packet->name */
49667 /* no work needed for packet->reqs */
49668 /* no work needed for packet->reqs_count */
49669 /* no work needed for packet->id */
49670}
49671
49672 static inline void destroy_packet_ruleset_government(void *packet)
49673{
49674 free_packet_ruleset_government((struct packet_ruleset_government *) packet);
49675 free(packet);
49676}
49677
49678#ifdef FREECIV_DELTA_PROTOCOL
49679#define hash_packet_ruleset_government_100 hash_const
49680
49681#define cmp_packet_ruleset_government_100 cmp_const
49682
49683 BV_DEFINE(packet_ruleset_government_100_fields, 8);
49684#endif /* FREECIV_DELTA_PROTOCOL */
49685
49686 static struct packet_ruleset_government *receive_packet_ruleset_government_100(struct connection *pc)
49687{
49688#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_government(_packet)
49689#ifdef FREECIV_DELTA_PROTOCOL
49690 packet_ruleset_government_100_fields fields;
49691 struct packet_ruleset_government *old;
49692 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOVERNMENT;
49693#endif /* FREECIV_DELTA_PROTOCOL */
49694 RECEIVE_PACKET_START(packet_ruleset_government, real_packet);
49695#ifdef FREECIV_JSON_CONNECTION
49696 struct plocation field_addr;
49697 {
49698 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
49699 field_addr = *field_addr_tmp;
49700 FC_FREE(field_addr_tmp);
49701 }
49702#endif /* FREECIV_JSON_CONNECTION */
49703
49704#ifdef FREECIV_DELTA_PROTOCOL
49705#ifdef FREECIV_JSON_CONNECTION
49706 field_addr.name = "fields";
49707#endif /* FREECIV_JSON_CONNECTION */
49708 DIO_BV_GET(&din, &field_addr, fields);
49709
49710#else /* FREECIV_DELTA_PROTOCOL */
49711#ifdef FREECIV_JSON_CONNECTION
49712 field_addr.name = "id";
49713#endif /* FREECIV_JSON_CONNECTION */
49714 {
49715 int readin;
49716
49717 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
49718 RECEIVE_PACKET_FIELD_ERROR(id);
49719 }
49720 real_packet->id = readin;
49721 }
49722#ifdef FREECIV_JSON_CONNECTION
49723 field_addr.name = "reqs_count";
49724#endif /* FREECIV_JSON_CONNECTION */
49725 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
49726 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
49727 }
49728#ifdef FREECIV_JSON_CONNECTION
49729 field_addr.name = "reqs";
49730#endif /* FREECIV_JSON_CONNECTION */
49731 {
49732 int i;
49733
49734#ifdef FREECIV_JSON_CONNECTION
49735 /* Enter array. */
49736 field_addr.sub_location = plocation_elem_new(0);
49737#endif /* FREECIV_JSON_CONNECTION */
49738
49739 if (real_packet->reqs_count > MAX_NUM_REQS) {
49740 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
49741 }
49742 for (i = 0; i < real_packet->reqs_count; i++) {
49743#ifdef FREECIV_JSON_CONNECTION
49744 field_addr.sub_location->number = i;
49745#endif /* FREECIV_JSON_CONNECTION */
49746 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
49747 RECEIVE_PACKET_FIELD_ERROR(reqs);
49748 }
49749 }
49750
49751#ifdef FREECIV_JSON_CONNECTION
49752 /* Exit array. */
49753 FC_FREE(field_addr.sub_location);
49754#endif /* FREECIV_JSON_CONNECTION */
49755 }
49756#ifdef FREECIV_JSON_CONNECTION
49757 field_addr.name = "name";
49758#endif /* FREECIV_JSON_CONNECTION */
49759 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
49760 RECEIVE_PACKET_FIELD_ERROR(name);
49761 }
49762#ifdef FREECIV_JSON_CONNECTION
49763 field_addr.name = "rule_name";
49764#endif /* FREECIV_JSON_CONNECTION */
49765 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
49766 RECEIVE_PACKET_FIELD_ERROR(rule_name);
49767 }
49768#ifdef FREECIV_JSON_CONNECTION
49769 field_addr.name = "graphic_str";
49770#endif /* FREECIV_JSON_CONNECTION */
49771 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
49772 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
49773 }
49774#ifdef FREECIV_JSON_CONNECTION
49775 field_addr.name = "graphic_alt";
49776#endif /* FREECIV_JSON_CONNECTION */
49777 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
49778 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
49779 }
49780#ifdef FREECIV_JSON_CONNECTION
49781 field_addr.name = "helptext";
49782#endif /* FREECIV_JSON_CONNECTION */
49783 {
49784 int i;
49785
49786 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
49787 RECEIVE_PACKET_FIELD_ERROR(helptext);
49788 }
49789 strvec_reserve(real_packet->helptext, i);
49790
49791#ifdef FREECIV_JSON_CONNECTION
49792 field_addr.sub_location = plocation_elem_new(0);
49793#endif /* FREECIV_JSON_CONNECTION */
49794
49795 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
49796 char readin[MAX_LEN_PACKET];
49797
49798#ifdef FREECIV_JSON_CONNECTION
49799 /* Next array element */
49800 field_addr.sub_location->number = i;
49801#endif /* FREECIV_JSON_CONNECTION */
49802
49803 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
49804 || !strvec_set(real_packet->helptext, i, readin)) {
49805 RECEIVE_PACKET_FIELD_ERROR(helptext);
49806 }
49807 }
49808
49809#ifdef FREECIV_JSON_CONNECTION
49810 FC_FREE(field_addr.sub_location);
49811#endif /* FREECIV_JSON_CONNECTION */
49812 }
49813#endif
49814 log_packet_detailed("packet_ruleset_government_100: got info about ()");
49815
49816#ifdef FREECIV_DELTA_PROTOCOL
49817 if (nullptr == *hash) {
49818 *hash = genhash_new_full(hash_packet_ruleset_government_100, cmp_packet_ruleset_government_100,
49819 nullptr, nullptr, nullptr, destroy_packet_ruleset_government);
49820 }
49821
49822 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49823 real_packet->id = old->id;
49824 real_packet->reqs_count = old->reqs_count;
49825 {
49826 int i;
49827
49828 for (i = 0; i < old->reqs_count; i++) {
49829 real_packet->reqs[i] = old->reqs[i];
49830 }
49831 }
49832 sz_strlcpy(real_packet->name, old->name);
49833 sz_strlcpy(real_packet->rule_name, old->rule_name);
49834 sz_strlcpy(real_packet->graphic_str, old->graphic_str);
49835 sz_strlcpy(real_packet->graphic_alt, old->graphic_alt);
49836 if (old->helptext) {
49837 strvec_copy(real_packet->helptext, old->helptext);
49838 } else {
49839 strvec_clear(real_packet->helptext);
49840 }
49841 } else {
49842 /* packet is already initialized empty */
49843 log_packet_detailed(" no old info");
49844 }
49845
49846 if (BV_ISSET(fields, 0)) {
49847 log_packet_detailed(" got field 'id'");
49848#ifdef FREECIV_JSON_CONNECTION
49849 field_addr.name = "id";
49850#endif /* FREECIV_JSON_CONNECTION */
49851 {
49852 int readin;
49853
49854 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
49855 RECEIVE_PACKET_FIELD_ERROR(id);
49856 }
49857 real_packet->id = readin;
49858 }
49859 }
49860 if (BV_ISSET(fields, 1)) {
49861 log_packet_detailed(" got field 'reqs_count'");
49862#ifdef FREECIV_JSON_CONNECTION
49863 field_addr.name = "reqs_count";
49864#endif /* FREECIV_JSON_CONNECTION */
49865 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
49866 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
49867 }
49868 }
49869 if (BV_ISSET(fields, 2)) {
49870 log_packet_detailed(" got field 'reqs'");
49871#ifdef FREECIV_JSON_CONNECTION
49872 field_addr.name = "reqs";
49873#endif /* FREECIV_JSON_CONNECTION */
49874 {
49875 int i;
49876
49877#ifdef FREECIV_JSON_CONNECTION
49878 /* Enter array. */
49879 field_addr.sub_location = plocation_elem_new(0);
49880#endif /* FREECIV_JSON_CONNECTION */
49881
49882 if (real_packet->reqs_count > MAX_NUM_REQS) {
49883 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
49884 }
49885 for (i = 0; i < real_packet->reqs_count; i++) {
49886#ifdef FREECIV_JSON_CONNECTION
49887 field_addr.sub_location->number = i;
49888#endif /* FREECIV_JSON_CONNECTION */
49889 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
49890 RECEIVE_PACKET_FIELD_ERROR(reqs);
49891 }
49892 }
49893
49894#ifdef FREECIV_JSON_CONNECTION
49895 /* Exit array. */
49896 FC_FREE(field_addr.sub_location);
49897#endif /* FREECIV_JSON_CONNECTION */
49898 }
49899 }
49900 if (BV_ISSET(fields, 3)) {
49901 log_packet_detailed(" got field 'name'");
49902#ifdef FREECIV_JSON_CONNECTION
49903 field_addr.name = "name";
49904#endif /* FREECIV_JSON_CONNECTION */
49905 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
49906 RECEIVE_PACKET_FIELD_ERROR(name);
49907 }
49908 }
49909 if (BV_ISSET(fields, 4)) {
49910 log_packet_detailed(" got field 'rule_name'");
49911#ifdef FREECIV_JSON_CONNECTION
49912 field_addr.name = "rule_name";
49913#endif /* FREECIV_JSON_CONNECTION */
49914 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
49915 RECEIVE_PACKET_FIELD_ERROR(rule_name);
49916 }
49917 }
49918 if (BV_ISSET(fields, 5)) {
49919 log_packet_detailed(" got field 'graphic_str'");
49920#ifdef FREECIV_JSON_CONNECTION
49921 field_addr.name = "graphic_str";
49922#endif /* FREECIV_JSON_CONNECTION */
49923 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
49924 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
49925 }
49926 }
49927 if (BV_ISSET(fields, 6)) {
49928 log_packet_detailed(" got field 'graphic_alt'");
49929#ifdef FREECIV_JSON_CONNECTION
49930 field_addr.name = "graphic_alt";
49931#endif /* FREECIV_JSON_CONNECTION */
49932 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
49933 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
49934 }
49935 }
49936 if (BV_ISSET(fields, 7)) {
49937 log_packet_detailed(" got field 'helptext'");
49938#ifdef FREECIV_JSON_CONNECTION
49939 field_addr.name = "helptext";
49940#endif /* FREECIV_JSON_CONNECTION */
49941 {
49942 int i;
49943
49944 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
49945 RECEIVE_PACKET_FIELD_ERROR(helptext);
49946 }
49947 strvec_reserve(real_packet->helptext, i);
49948
49949#ifdef FREECIV_JSON_CONNECTION
49950 field_addr.sub_location = plocation_elem_new(0);
49951#endif /* FREECIV_JSON_CONNECTION */
49952
49953 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
49954 char readin[MAX_LEN_PACKET];
49955
49956#ifdef FREECIV_JSON_CONNECTION
49957 /* Next array element */
49958 field_addr.sub_location->number = i;
49959#endif /* FREECIV_JSON_CONNECTION */
49960
49961 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
49962 || !strvec_set(real_packet->helptext, i, readin)) {
49963 RECEIVE_PACKET_FIELD_ERROR(helptext);
49964 }
49965 }
49966
49967#ifdef FREECIV_JSON_CONNECTION
49968 FC_FREE(field_addr.sub_location);
49969#endif /* FREECIV_JSON_CONNECTION */
49970 }
49971 }
49972
49973 if (nullptr == old) {
49974 old = fc_malloc(sizeof(*old));
49975 init_packet_ruleset_government(old);
49976 old->id = real_packet->id;
49977 old->reqs_count = real_packet->reqs_count;
49978 {
49979 int i;
49980
49981 for (i = 0; i < real_packet->reqs_count; i++) {
49982 old->reqs[i] = real_packet->reqs[i];
49983 }
49984 }
49985 sz_strlcpy(old->name, real_packet->name);
49986 sz_strlcpy(old->rule_name, real_packet->rule_name);
49987 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
49988 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
49989 if (real_packet->helptext) {
49990 strvec_copy(old->helptext, real_packet->helptext);
49991 } else {
49992 strvec_clear(old->helptext);
49993 }
49994 genhash_insert(*hash, old, old);
49995 } else {
49996 old->id = real_packet->id;
49997 old->reqs_count = real_packet->reqs_count;
49998 {
49999 int i;
50000
50001 for (i = 0; i < real_packet->reqs_count; i++) {
50002 old->reqs[i] = real_packet->reqs[i];
50003 }
50004 }
50005 sz_strlcpy(old->name, real_packet->name);
50006 sz_strlcpy(old->rule_name, real_packet->rule_name);
50007 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
50008 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
50009 if (real_packet->helptext) {
50010 strvec_copy(old->helptext, real_packet->helptext);
50011 } else {
50012 strvec_clear(old->helptext);
50013 }
50014 }
50015
50016#endif /* FREECIV_DELTA_PROTOCOL */
50017 RECEIVE_PACKET_END(real_packet);
50018#undef FREE_PACKET_STRUCT
50019}
50020
50021 static int send_packet_ruleset_government_100(struct connection *pc, const struct packet_ruleset_government *packet)
50022{
50023 const struct packet_ruleset_government *real_packet = packet;
50024 int e;
50025#ifdef FREECIV_DELTA_PROTOCOL
50026 packet_ruleset_government_100_fields fields;
50027 struct packet_ruleset_government *old;
50028 bool differ;
50029 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOVERNMENT;
50030#endif /* FREECIV_DELTA_PROTOCOL */
50031 SEND_PACKET_START(PACKET_RULESET_GOVERNMENT);
50032#ifdef FREECIV_JSON_CONNECTION
50033 struct plocation field_addr;
50034 {
50035 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
50036 field_addr = *field_addr_tmp;
50037 FC_FREE(field_addr_tmp);
50038 }
50039#endif /* FREECIV_JSON_CONNECTION */
50040
50041 log_packet_detailed("packet_ruleset_government_100: sending info about ()");
50042
50043#ifdef FREECIV_DELTA_PROTOCOL
50044 if (nullptr == *hash) {
50045 *hash = genhash_new_full(hash_packet_ruleset_government_100, cmp_packet_ruleset_government_100,
50046 nullptr, nullptr, nullptr, destroy_packet_ruleset_government);
50047 }
50048 BV_CLR_ALL(fields);
50049
50050 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50051 old = fc_malloc(sizeof(*old));
50052 /* temporary bitcopy just to insert correctly */
50053 *old = *real_packet;
50054 genhash_insert(*hash, old, old);
50055 init_packet_ruleset_government(old);
50056 }
50057 differ = (old->id != real_packet->id);
50058 if (differ) {
50059 BV_SET(fields, 0);
50060 }
50061
50062 differ = (old->reqs_count != real_packet->reqs_count);
50063 if (differ) {
50064 BV_SET(fields, 1);
50065 }
50066
50067 differ = (old->reqs_count != real_packet->reqs_count);
50068 if (!differ) {
50069 int i;
50070
50071 for (i = 0; i < real_packet->reqs_count; i++) {
50072 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
50073 if (differ) {
50074 break;
50075 }
50076 }
50077 }
50078 if (differ) {
50079 BV_SET(fields, 2);
50080 }
50081
50082 differ = (strcmp(old->name, real_packet->name) != 0);
50083 if (differ) {
50084 BV_SET(fields, 3);
50085 }
50086
50087 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
50088 if (differ) {
50089 BV_SET(fields, 4);
50090 }
50091
50092 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
50093 if (differ) {
50094 BV_SET(fields, 5);
50095 }
50096
50097 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
50098 if (differ) {
50099 BV_SET(fields, 6);
50100 }
50101
50102 if (real_packet->helptext) {
50103 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
50104 } else {
50105 differ = (strvec_size(old->helptext) > 0);
50106 }
50107 if (differ) {
50108 BV_SET(fields, 7);
50109 }
50110
50111
50112#ifdef FREECIV_JSON_CONNECTION
50113 field_addr.name = "fields";
50114#endif /* FREECIV_JSON_CONNECTION */
50115 e = 0;
50116 e |= DIO_BV_PUT(&dout, &field_addr, fields);
50117 if (e) {
50118 log_packet_detailed("fields bitvector error detected");
50119 }
50120
50121 if (BV_ISSET(fields, 0)) {
50122 log_packet_detailed(" field 'id' has changed");
50123#ifdef FREECIV_JSON_CONNECTION
50124 field_addr.name = "id";
50125#endif /* FREECIV_JSON_CONNECTION */
50126 e = 0;
50127 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->id);
50128 if (e) {
50129 log_packet_detailed("'id' field error detected");
50130 }
50131 }
50132 if (BV_ISSET(fields, 1)) {
50133 log_packet_detailed(" field 'reqs_count' has changed");
50134#ifdef FREECIV_JSON_CONNECTION
50135 field_addr.name = "reqs_count";
50136#endif /* FREECIV_JSON_CONNECTION */
50137 e = 0;
50138 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
50139 if (e) {
50140 log_packet_detailed("'reqs_count' field error detected");
50141 }
50142 }
50143 if (BV_ISSET(fields, 2)) {
50144 log_packet_detailed(" field 'reqs' has changed");
50145#ifdef FREECIV_JSON_CONNECTION
50146 field_addr.name = "reqs";
50147#endif /* FREECIV_JSON_CONNECTION */
50148 e = 0;
50149 {
50150 int i;
50151
50152#ifdef FREECIV_JSON_CONNECTION
50153 /* Create the array. */
50154 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
50155
50156 /* Enter the array. */
50157 field_addr.sub_location = plocation_elem_new(0);
50158#endif /* FREECIV_JSON_CONNECTION */
50159
50160 for (i = 0; i < real_packet->reqs_count; i++) {
50161#ifdef FREECIV_JSON_CONNECTION
50162 /* Next array element. */
50163 field_addr.sub_location->number = i;
50164#endif /* FREECIV_JSON_CONNECTION */
50165 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
50166 }
50167
50168#ifdef FREECIV_JSON_CONNECTION
50169 /* Exit array. */
50170 FC_FREE(field_addr.sub_location);
50171#endif /* FREECIV_JSON_CONNECTION */
50172 }
50173 if (e) {
50174 log_packet_detailed("'reqs' field error detected");
50175 }
50176 }
50177 if (BV_ISSET(fields, 3)) {
50178 log_packet_detailed(" field 'name' has changed");
50179#ifdef FREECIV_JSON_CONNECTION
50180 field_addr.name = "name";
50181#endif /* FREECIV_JSON_CONNECTION */
50182 e = 0;
50183 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
50184 if (e) {
50185 log_packet_detailed("'name' field error detected");
50186 }
50187 }
50188 if (BV_ISSET(fields, 4)) {
50189 log_packet_detailed(" field 'rule_name' has changed");
50190#ifdef FREECIV_JSON_CONNECTION
50191 field_addr.name = "rule_name";
50192#endif /* FREECIV_JSON_CONNECTION */
50193 e = 0;
50194 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
50195 if (e) {
50196 log_packet_detailed("'rule_name' field error detected");
50197 }
50198 }
50199 if (BV_ISSET(fields, 5)) {
50200 log_packet_detailed(" field 'graphic_str' has changed");
50201#ifdef FREECIV_JSON_CONNECTION
50202 field_addr.name = "graphic_str";
50203#endif /* FREECIV_JSON_CONNECTION */
50204 e = 0;
50205 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
50206 if (e) {
50207 log_packet_detailed("'graphic_str' field error detected");
50208 }
50209 }
50210 if (BV_ISSET(fields, 6)) {
50211 log_packet_detailed(" field 'graphic_alt' has changed");
50212#ifdef FREECIV_JSON_CONNECTION
50213 field_addr.name = "graphic_alt";
50214#endif /* FREECIV_JSON_CONNECTION */
50215 e = 0;
50216 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
50217 if (e) {
50218 log_packet_detailed("'graphic_alt' field error detected");
50219 }
50220 }
50221 if (BV_ISSET(fields, 7)) {
50222 log_packet_detailed(" field 'helptext' has changed");
50223#ifdef FREECIV_JSON_CONNECTION
50224 field_addr.name = "helptext";
50225#endif /* FREECIV_JSON_CONNECTION */
50226 e = 0;
50227 if (!real_packet->helptext) {
50228 /* Transmit null vector as empty vector */
50229 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
50230 } else {
50231 int i;
50232
50233 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
50234 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
50235
50236#ifdef FREECIV_JSON_CONNECTION
50237 field_addr.sub_location = plocation_elem_new(0);
50238#endif /* FREECIV_JSON_CONNECTION */
50239
50240 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
50241 const char *pstr = strvec_get(real_packet->helptext, i);
50242
50243 if (!pstr) {
50244 /* Transmit null strings as empty strings */
50245 pstr = "";
50246 }
50247
50248#ifdef FREECIV_JSON_CONNECTION
50249 /* Next array element */
50250 field_addr.sub_location->number = i;
50251#endif /* FREECIV_JSON_CONNECTION */
50252
50253 e |= DIO_PUT(string, &dout, &field_addr, pstr);
50254 }
50255
50256#ifdef FREECIV_JSON_CONNECTION
50257 FC_FREE(field_addr.sub_location);
50258#endif /* FREECIV_JSON_CONNECTION */
50259 }
50260 if (e) {
50261 log_packet_detailed("'helptext' field error detected");
50262 }
50263 }
50264
50265 old->id = real_packet->id;
50266 old->reqs_count = real_packet->reqs_count;
50267 {
50268 int i;
50269
50270 for (i = 0; i < real_packet->reqs_count; i++) {
50271 old->reqs[i] = real_packet->reqs[i];
50272 }
50273 }
50274 sz_strlcpy(old->name, real_packet->name);
50275 sz_strlcpy(old->rule_name, real_packet->rule_name);
50276 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
50277 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
50278 if (real_packet->helptext) {
50279 strvec_copy(old->helptext, real_packet->helptext);
50280 } else {
50281 strvec_clear(old->helptext);
50282 }
50283#endif /* FREECIV_DELTA_PROTOCOL */
50284#ifndef FREECIV_DELTA_PROTOCOL
50285#ifdef FREECIV_JSON_CONNECTION
50286 field_addr.name = "id";
50287#endif /* FREECIV_JSON_CONNECTION */
50288 e = 0;
50289 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->id);
50290 if (e) {
50291 log_packet_detailed("'id' field error detected");
50292 }
50293#ifdef FREECIV_JSON_CONNECTION
50294 field_addr.name = "reqs_count";
50295#endif /* FREECIV_JSON_CONNECTION */
50296 e = 0;
50297 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
50298 if (e) {
50299 log_packet_detailed("'reqs_count' field error detected");
50300 }
50301#ifdef FREECIV_JSON_CONNECTION
50302 field_addr.name = "reqs";
50303#endif /* FREECIV_JSON_CONNECTION */
50304 e = 0;
50305 {
50306 int i;
50307
50308#ifdef FREECIV_JSON_CONNECTION
50309 /* Create the array. */
50310 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
50311
50312 /* Enter the array. */
50313 field_addr.sub_location = plocation_elem_new(0);
50314#endif /* FREECIV_JSON_CONNECTION */
50315
50316 for (i = 0; i < real_packet->reqs_count; i++) {
50317#ifdef FREECIV_JSON_CONNECTION
50318 /* Next array element. */
50319 field_addr.sub_location->number = i;
50320#endif /* FREECIV_JSON_CONNECTION */
50321 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
50322 }
50323
50324#ifdef FREECIV_JSON_CONNECTION
50325 /* Exit array. */
50326 FC_FREE(field_addr.sub_location);
50327#endif /* FREECIV_JSON_CONNECTION */
50328 }
50329 if (e) {
50330 log_packet_detailed("'reqs' field error detected");
50331 }
50332#ifdef FREECIV_JSON_CONNECTION
50333 field_addr.name = "name";
50334#endif /* FREECIV_JSON_CONNECTION */
50335 e = 0;
50336 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
50337 if (e) {
50338 log_packet_detailed("'name' field error detected");
50339 }
50340#ifdef FREECIV_JSON_CONNECTION
50341 field_addr.name = "rule_name";
50342#endif /* FREECIV_JSON_CONNECTION */
50343 e = 0;
50344 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
50345 if (e) {
50346 log_packet_detailed("'rule_name' field error detected");
50347 }
50348#ifdef FREECIV_JSON_CONNECTION
50349 field_addr.name = "graphic_str";
50350#endif /* FREECIV_JSON_CONNECTION */
50351 e = 0;
50352 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
50353 if (e) {
50354 log_packet_detailed("'graphic_str' field error detected");
50355 }
50356#ifdef FREECIV_JSON_CONNECTION
50357 field_addr.name = "graphic_alt";
50358#endif /* FREECIV_JSON_CONNECTION */
50359 e = 0;
50360 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
50361 if (e) {
50362 log_packet_detailed("'graphic_alt' field error detected");
50363 }
50364#ifdef FREECIV_JSON_CONNECTION
50365 field_addr.name = "helptext";
50366#endif /* FREECIV_JSON_CONNECTION */
50367 e = 0;
50368 if (!real_packet->helptext) {
50369 /* Transmit null vector as empty vector */
50370 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
50371 } else {
50372 int i;
50373
50374 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
50375 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
50376
50377#ifdef FREECIV_JSON_CONNECTION
50378 field_addr.sub_location = plocation_elem_new(0);
50379#endif /* FREECIV_JSON_CONNECTION */
50380
50381 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
50382 const char *pstr = strvec_get(real_packet->helptext, i);
50383
50384 if (!pstr) {
50385 /* Transmit null strings as empty strings */
50386 pstr = "";
50387 }
50388
50389#ifdef FREECIV_JSON_CONNECTION
50390 /* Next array element */
50391 field_addr.sub_location->number = i;
50392#endif /* FREECIV_JSON_CONNECTION */
50393
50394 e |= DIO_PUT(string, &dout, &field_addr, pstr);
50395 }
50396
50397#ifdef FREECIV_JSON_CONNECTION
50398 FC_FREE(field_addr.sub_location);
50399#endif /* FREECIV_JSON_CONNECTION */
50400 }
50401 if (e) {
50402 log_packet_detailed("'helptext' field error detected");
50403 }
50404
50405#endif
50406 SEND_PACKET_END(PACKET_RULESET_GOVERNMENT);
50407}
50408
50409 int send_packet_ruleset_government(struct connection *pc, const struct packet_ruleset_government *packet)
50410{
50411 if (!pc->used) {
50412 log_error("WARNING: trying to send data to the closed connection %s",
50413 conn_description(pc));
50414 return -1;
50415 }
50416 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT].packet != nullptr, -1,
50417 "Handler for PACKET_RULESET_GOVERNMENT not installed");
50418 return pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT].packet(pc, packet);
50419}
50420
50421 void lsend_packet_ruleset_government(struct conn_list *dest, const struct packet_ruleset_government *packet)
50422{
50423 conn_list_iterate(dest, pconn) {
50424 send_packet_ruleset_government(pconn, packet);
50425 } conn_list_iterate_end;
50426}
50427
50428 static inline void init_packet_ruleset_terrain_control(struct packet_ruleset_terrain_control *packet)
50429{
50430 memset(packet, 0, sizeof(*packet));
50431}
50432
50433#define free_packet_ruleset_terrain_control(_packet) (void) 0
50434#define destroy_packet_ruleset_terrain_control free
50435
50436#ifdef FREECIV_DELTA_PROTOCOL
50437#define hash_packet_ruleset_terrain_control_100 hash_const
50438
50439#define cmp_packet_ruleset_terrain_control_100 cmp_const
50440
50441 BV_DEFINE(packet_ruleset_terrain_control_100_fields, 12);
50442#endif /* FREECIV_DELTA_PROTOCOL */
50443
50444 static struct packet_ruleset_terrain_control *receive_packet_ruleset_terrain_control_100(struct connection *pc)
50445{
50446#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_terrain_control(_packet)
50447#ifdef FREECIV_DELTA_PROTOCOL
50448 packet_ruleset_terrain_control_100_fields fields;
50449 struct packet_ruleset_terrain_control *old;
50450 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN_CONTROL;
50451#endif /* FREECIV_DELTA_PROTOCOL */
50452 RECEIVE_PACKET_START(packet_ruleset_terrain_control, real_packet);
50453#ifdef FREECIV_JSON_CONNECTION
50454 struct plocation field_addr;
50455 {
50456 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
50457 field_addr = *field_addr_tmp;
50458 FC_FREE(field_addr_tmp);
50459 }
50460#endif /* FREECIV_JSON_CONNECTION */
50461
50462#ifdef FREECIV_DELTA_PROTOCOL
50463#ifdef FREECIV_JSON_CONNECTION
50464 field_addr.name = "fields";
50465#endif /* FREECIV_JSON_CONNECTION */
50466 DIO_BV_GET(&din, &field_addr, fields);
50467
50468#else /* FREECIV_DELTA_PROTOCOL */
50469#ifdef FREECIV_JSON_CONNECTION
50470 field_addr.name = "ocean_reclaim_requirement_pct";
50471#endif /* FREECIV_JSON_CONNECTION */
50472 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ocean_reclaim_requirement_pct)) {
50473 RECEIVE_PACKET_FIELD_ERROR(ocean_reclaim_requirement_pct);
50474 }
50475#ifdef FREECIV_JSON_CONNECTION
50476 field_addr.name = "land_channel_requirement_pct";
50477#endif /* FREECIV_JSON_CONNECTION */
50478 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->land_channel_requirement_pct)) {
50479 RECEIVE_PACKET_FIELD_ERROR(land_channel_requirement_pct);
50480 }
50481#ifdef FREECIV_JSON_CONNECTION
50482 field_addr.name = "terrain_thaw_requirement_pct";
50483#endif /* FREECIV_JSON_CONNECTION */
50484 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_thaw_requirement_pct)) {
50485 RECEIVE_PACKET_FIELD_ERROR(terrain_thaw_requirement_pct);
50486 }
50487#ifdef FREECIV_JSON_CONNECTION
50488 field_addr.name = "terrain_freeze_requirement_pct";
50489#endif /* FREECIV_JSON_CONNECTION */
50490 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_freeze_requirement_pct)) {
50491 RECEIVE_PACKET_FIELD_ERROR(terrain_freeze_requirement_pct);
50492 }
50493#ifdef FREECIV_JSON_CONNECTION
50494 field_addr.name = "lake_max_size";
50495#endif /* FREECIV_JSON_CONNECTION */
50496 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->lake_max_size)) {
50497 RECEIVE_PACKET_FIELD_ERROR(lake_max_size);
50498 }
50499#ifdef FREECIV_JSON_CONNECTION
50500 field_addr.name = "min_start_native_area";
50501#endif /* FREECIV_JSON_CONNECTION */
50502 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_start_native_area)) {
50503 RECEIVE_PACKET_FIELD_ERROR(min_start_native_area);
50504 }
50505#ifdef FREECIV_JSON_CONNECTION
50506 field_addr.name = "move_fragments";
50507#endif /* FREECIV_JSON_CONNECTION */
50508 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_fragments)) {
50509 RECEIVE_PACKET_FIELD_ERROR(move_fragments);
50510 }
50511#ifdef FREECIV_JSON_CONNECTION
50512 field_addr.name = "igter_cost";
50513#endif /* FREECIV_JSON_CONNECTION */
50514 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->igter_cost)) {
50515 RECEIVE_PACKET_FIELD_ERROR(igter_cost);
50516 }
50517#ifdef FREECIV_JSON_CONNECTION
50518 field_addr.name = "pythagorean_diagonal";
50519#endif /* FREECIV_JSON_CONNECTION */
50520 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->pythagorean_diagonal)) {
50521 RECEIVE_PACKET_FIELD_ERROR(pythagorean_diagonal);
50522 }
50523#ifdef FREECIV_JSON_CONNECTION
50524 field_addr.name = "infrapoints";
50525#endif /* FREECIV_JSON_CONNECTION */
50526 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->infrapoints)) {
50527 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
50528 }
50529#ifdef FREECIV_JSON_CONNECTION
50530 field_addr.name = "gui_type_base0";
50531#endif /* FREECIV_JSON_CONNECTION */
50532 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base0, sizeof(real_packet->gui_type_base0))) {
50533 RECEIVE_PACKET_FIELD_ERROR(gui_type_base0);
50534 }
50535#ifdef FREECIV_JSON_CONNECTION
50536 field_addr.name = "gui_type_base1";
50537#endif /* FREECIV_JSON_CONNECTION */
50538 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base1, sizeof(real_packet->gui_type_base1))) {
50539 RECEIVE_PACKET_FIELD_ERROR(gui_type_base1);
50540 }
50541#endif
50542 log_packet_detailed("packet_ruleset_terrain_control_100: got info about ()");
50543
50544#ifdef FREECIV_DELTA_PROTOCOL
50545 if (nullptr == *hash) {
50546 *hash = genhash_new_full(hash_packet_ruleset_terrain_control_100, cmp_packet_ruleset_terrain_control_100,
50547 nullptr, nullptr, nullptr, destroy_packet_ruleset_terrain_control);
50548 }
50549
50550 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
50551 *real_packet = *old;
50552 } else {
50553 /* packet is already initialized empty */
50554 log_packet_detailed(" no old info");
50555 }
50556
50557 if (BV_ISSET(fields, 0)) {
50558 log_packet_detailed(" got field 'ocean_reclaim_requirement_pct'");
50559#ifdef FREECIV_JSON_CONNECTION
50560 field_addr.name = "ocean_reclaim_requirement_pct";
50561#endif /* FREECIV_JSON_CONNECTION */
50562 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ocean_reclaim_requirement_pct)) {
50563 RECEIVE_PACKET_FIELD_ERROR(ocean_reclaim_requirement_pct);
50564 }
50565 }
50566 if (BV_ISSET(fields, 1)) {
50567 log_packet_detailed(" got field 'land_channel_requirement_pct'");
50568#ifdef FREECIV_JSON_CONNECTION
50569 field_addr.name = "land_channel_requirement_pct";
50570#endif /* FREECIV_JSON_CONNECTION */
50571 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->land_channel_requirement_pct)) {
50572 RECEIVE_PACKET_FIELD_ERROR(land_channel_requirement_pct);
50573 }
50574 }
50575 if (BV_ISSET(fields, 2)) {
50576 log_packet_detailed(" got field 'terrain_thaw_requirement_pct'");
50577#ifdef FREECIV_JSON_CONNECTION
50578 field_addr.name = "terrain_thaw_requirement_pct";
50579#endif /* FREECIV_JSON_CONNECTION */
50580 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_thaw_requirement_pct)) {
50581 RECEIVE_PACKET_FIELD_ERROR(terrain_thaw_requirement_pct);
50582 }
50583 }
50584 if (BV_ISSET(fields, 3)) {
50585 log_packet_detailed(" got field 'terrain_freeze_requirement_pct'");
50586#ifdef FREECIV_JSON_CONNECTION
50587 field_addr.name = "terrain_freeze_requirement_pct";
50588#endif /* FREECIV_JSON_CONNECTION */
50589 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_freeze_requirement_pct)) {
50590 RECEIVE_PACKET_FIELD_ERROR(terrain_freeze_requirement_pct);
50591 }
50592 }
50593 if (BV_ISSET(fields, 4)) {
50594 log_packet_detailed(" got field 'lake_max_size'");
50595#ifdef FREECIV_JSON_CONNECTION
50596 field_addr.name = "lake_max_size";
50597#endif /* FREECIV_JSON_CONNECTION */
50598 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->lake_max_size)) {
50599 RECEIVE_PACKET_FIELD_ERROR(lake_max_size);
50600 }
50601 }
50602 if (BV_ISSET(fields, 5)) {
50603 log_packet_detailed(" got field 'min_start_native_area'");
50604#ifdef FREECIV_JSON_CONNECTION
50605 field_addr.name = "min_start_native_area";
50606#endif /* FREECIV_JSON_CONNECTION */
50607 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_start_native_area)) {
50608 RECEIVE_PACKET_FIELD_ERROR(min_start_native_area);
50609 }
50610 }
50611 if (BV_ISSET(fields, 6)) {
50612 log_packet_detailed(" got field 'move_fragments'");
50613#ifdef FREECIV_JSON_CONNECTION
50614 field_addr.name = "move_fragments";
50615#endif /* FREECIV_JSON_CONNECTION */
50616 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_fragments)) {
50617 RECEIVE_PACKET_FIELD_ERROR(move_fragments);
50618 }
50619 }
50620 if (BV_ISSET(fields, 7)) {
50621 log_packet_detailed(" got field 'igter_cost'");
50622#ifdef FREECIV_JSON_CONNECTION
50623 field_addr.name = "igter_cost";
50624#endif /* FREECIV_JSON_CONNECTION */
50625 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->igter_cost)) {
50626 RECEIVE_PACKET_FIELD_ERROR(igter_cost);
50627 }
50628 }
50629 real_packet->pythagorean_diagonal = BV_ISSET(fields, 8);
50630 real_packet->infrapoints = BV_ISSET(fields, 9);
50631 if (BV_ISSET(fields, 10)) {
50632 log_packet_detailed(" got field 'gui_type_base0'");
50633#ifdef FREECIV_JSON_CONNECTION
50634 field_addr.name = "gui_type_base0";
50635#endif /* FREECIV_JSON_CONNECTION */
50636 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base0, sizeof(real_packet->gui_type_base0))) {
50637 RECEIVE_PACKET_FIELD_ERROR(gui_type_base0);
50638 }
50639 }
50640 if (BV_ISSET(fields, 11)) {
50641 log_packet_detailed(" got field 'gui_type_base1'");
50642#ifdef FREECIV_JSON_CONNECTION
50643 field_addr.name = "gui_type_base1";
50644#endif /* FREECIV_JSON_CONNECTION */
50645 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base1, sizeof(real_packet->gui_type_base1))) {
50646 RECEIVE_PACKET_FIELD_ERROR(gui_type_base1);
50647 }
50648 }
50649
50650 if (nullptr == old) {
50651 old = fc_malloc(sizeof(*old));
50652 init_packet_ruleset_terrain_control(old);
50653 *old = *real_packet;
50654 genhash_insert(*hash, old, old);
50655 } else {
50656 *old = *real_packet;
50657 }
50658
50659#endif /* FREECIV_DELTA_PROTOCOL */
50660 RECEIVE_PACKET_END(real_packet);
50661#undef FREE_PACKET_STRUCT
50662}
50663
50664 static int send_packet_ruleset_terrain_control_100(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
50665{
50666 const struct packet_ruleset_terrain_control *real_packet = packet;
50667 int e;
50668#ifdef FREECIV_DELTA_PROTOCOL
50669 packet_ruleset_terrain_control_100_fields fields;
50670 struct packet_ruleset_terrain_control *old;
50671 bool differ;
50672 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN_CONTROL;
50673#endif /* FREECIV_DELTA_PROTOCOL */
50674 SEND_PACKET_START(PACKET_RULESET_TERRAIN_CONTROL);
50675#ifdef FREECIV_JSON_CONNECTION
50676 struct plocation field_addr;
50677 {
50678 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
50679 field_addr = *field_addr_tmp;
50680 FC_FREE(field_addr_tmp);
50681 }
50682#endif /* FREECIV_JSON_CONNECTION */
50683
50684 log_packet_detailed("packet_ruleset_terrain_control_100: sending info about ()");
50685
50686#ifdef FREECIV_DELTA_PROTOCOL
50687 if (nullptr == *hash) {
50688 *hash = genhash_new_full(hash_packet_ruleset_terrain_control_100, cmp_packet_ruleset_terrain_control_100,
50689 nullptr, nullptr, nullptr, destroy_packet_ruleset_terrain_control);
50690 }
50691 BV_CLR_ALL(fields);
50692
50693 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50694 old = fc_malloc(sizeof(*old));
50695 /* temporary bitcopy just to insert correctly */
50696 *old = *real_packet;
50697 genhash_insert(*hash, old, old);
50698 init_packet_ruleset_terrain_control(old);
50699 }
50700 differ = (old->ocean_reclaim_requirement_pct != real_packet->ocean_reclaim_requirement_pct);
50701 if (differ) {
50702 BV_SET(fields, 0);
50703 }
50704
50705 differ = (old->land_channel_requirement_pct != real_packet->land_channel_requirement_pct);
50706 if (differ) {
50707 BV_SET(fields, 1);
50708 }
50709
50710 differ = (old->terrain_thaw_requirement_pct != real_packet->terrain_thaw_requirement_pct);
50711 if (differ) {
50712 BV_SET(fields, 2);
50713 }
50714
50715 differ = (old->terrain_freeze_requirement_pct != real_packet->terrain_freeze_requirement_pct);
50716 if (differ) {
50717 BV_SET(fields, 3);
50718 }
50719
50720 differ = (old->lake_max_size != real_packet->lake_max_size);
50721 if (differ) {
50722 BV_SET(fields, 4);
50723 }
50724
50725 differ = (old->min_start_native_area != real_packet->min_start_native_area);
50726 if (differ) {
50727 BV_SET(fields, 5);
50728 }
50729
50730 differ = (old->move_fragments != real_packet->move_fragments);
50731 if (differ) {
50732 BV_SET(fields, 6);
50733 }
50734
50735 differ = (old->igter_cost != real_packet->igter_cost);
50736 if (differ) {
50737 BV_SET(fields, 7);
50738 }
50739
50740 if (packet->pythagorean_diagonal) {
50741 BV_SET(fields, 8);
50742 }
50743
50744 if (packet->infrapoints) {
50745 BV_SET(fields, 9);
50746 }
50747
50748 differ = (strcmp(old->gui_type_base0, real_packet->gui_type_base0) != 0);
50749 if (differ) {
50750 BV_SET(fields, 10);
50751 }
50752
50753 differ = (strcmp(old->gui_type_base1, real_packet->gui_type_base1) != 0);
50754 if (differ) {
50755 BV_SET(fields, 11);
50756 }
50757
50758
50759#ifdef FREECIV_JSON_CONNECTION
50760 field_addr.name = "fields";
50761#endif /* FREECIV_JSON_CONNECTION */
50762 e = 0;
50763 e |= DIO_BV_PUT(&dout, &field_addr, fields);
50764 if (e) {
50765 log_packet_detailed("fields bitvector error detected");
50766 }
50767
50768 if (BV_ISSET(fields, 0)) {
50769 log_packet_detailed(" field 'ocean_reclaim_requirement_pct' has changed");
50770#ifdef FREECIV_JSON_CONNECTION
50771 field_addr.name = "ocean_reclaim_requirement_pct";
50772#endif /* FREECIV_JSON_CONNECTION */
50773 e = 0;
50774 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ocean_reclaim_requirement_pct);
50775 if (e) {
50776 log_packet_detailed("'ocean_reclaim_requirement_pct' field error detected");
50777 }
50778 }
50779 if (BV_ISSET(fields, 1)) {
50780 log_packet_detailed(" field 'land_channel_requirement_pct' has changed");
50781#ifdef FREECIV_JSON_CONNECTION
50782 field_addr.name = "land_channel_requirement_pct";
50783#endif /* FREECIV_JSON_CONNECTION */
50784 e = 0;
50785 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->land_channel_requirement_pct);
50786 if (e) {
50787 log_packet_detailed("'land_channel_requirement_pct' field error detected");
50788 }
50789 }
50790 if (BV_ISSET(fields, 2)) {
50791 log_packet_detailed(" field 'terrain_thaw_requirement_pct' has changed");
50792#ifdef FREECIV_JSON_CONNECTION
50793 field_addr.name = "terrain_thaw_requirement_pct";
50794#endif /* FREECIV_JSON_CONNECTION */
50795 e = 0;
50796 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_thaw_requirement_pct);
50797 if (e) {
50798 log_packet_detailed("'terrain_thaw_requirement_pct' field error detected");
50799 }
50800 }
50801 if (BV_ISSET(fields, 3)) {
50802 log_packet_detailed(" field 'terrain_freeze_requirement_pct' has changed");
50803#ifdef FREECIV_JSON_CONNECTION
50804 field_addr.name = "terrain_freeze_requirement_pct";
50805#endif /* FREECIV_JSON_CONNECTION */
50806 e = 0;
50807 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_freeze_requirement_pct);
50808 if (e) {
50809 log_packet_detailed("'terrain_freeze_requirement_pct' field error detected");
50810 }
50811 }
50812 if (BV_ISSET(fields, 4)) {
50813 log_packet_detailed(" field 'lake_max_size' has changed");
50814#ifdef FREECIV_JSON_CONNECTION
50815 field_addr.name = "lake_max_size";
50816#endif /* FREECIV_JSON_CONNECTION */
50817 e = 0;
50818 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->lake_max_size);
50819 if (e) {
50820 log_packet_detailed("'lake_max_size' field error detected");
50821 }
50822 }
50823 if (BV_ISSET(fields, 5)) {
50824 log_packet_detailed(" field 'min_start_native_area' has changed");
50825#ifdef FREECIV_JSON_CONNECTION
50826 field_addr.name = "min_start_native_area";
50827#endif /* FREECIV_JSON_CONNECTION */
50828 e = 0;
50829 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_start_native_area);
50830 if (e) {
50831 log_packet_detailed("'min_start_native_area' field error detected");
50832 }
50833 }
50834 if (BV_ISSET(fields, 6)) {
50835 log_packet_detailed(" field 'move_fragments' has changed");
50836#ifdef FREECIV_JSON_CONNECTION
50837 field_addr.name = "move_fragments";
50838#endif /* FREECIV_JSON_CONNECTION */
50839 e = 0;
50840 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_fragments);
50841 if (e) {
50842 log_packet_detailed("'move_fragments' field error detected");
50843 }
50844 }
50845 if (BV_ISSET(fields, 7)) {
50846 log_packet_detailed(" field 'igter_cost' has changed");
50847#ifdef FREECIV_JSON_CONNECTION
50848 field_addr.name = "igter_cost";
50849#endif /* FREECIV_JSON_CONNECTION */
50850 e = 0;
50851 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->igter_cost);
50852 if (e) {
50853 log_packet_detailed("'igter_cost' field error detected");
50854 }
50855 }
50856 /* field 8 is folded into the header */
50857 /* field 9 is folded into the header */
50858 if (BV_ISSET(fields, 10)) {
50859 log_packet_detailed(" field 'gui_type_base0' has changed");
50860#ifdef FREECIV_JSON_CONNECTION
50861 field_addr.name = "gui_type_base0";
50862#endif /* FREECIV_JSON_CONNECTION */
50863 e = 0;
50864 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base0);
50865 if (e) {
50866 log_packet_detailed("'gui_type_base0' field error detected");
50867 }
50868 }
50869 if (BV_ISSET(fields, 11)) {
50870 log_packet_detailed(" field 'gui_type_base1' has changed");
50871#ifdef FREECIV_JSON_CONNECTION
50872 field_addr.name = "gui_type_base1";
50873#endif /* FREECIV_JSON_CONNECTION */
50874 e = 0;
50875 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base1);
50876 if (e) {
50877 log_packet_detailed("'gui_type_base1' field error detected");
50878 }
50879 }
50880
50881 *old = *real_packet;
50882#endif /* FREECIV_DELTA_PROTOCOL */
50883#ifndef FREECIV_DELTA_PROTOCOL
50884#ifdef FREECIV_JSON_CONNECTION
50885 field_addr.name = "ocean_reclaim_requirement_pct";
50886#endif /* FREECIV_JSON_CONNECTION */
50887 e = 0;
50888 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ocean_reclaim_requirement_pct);
50889 if (e) {
50890 log_packet_detailed("'ocean_reclaim_requirement_pct' field error detected");
50891 }
50892#ifdef FREECIV_JSON_CONNECTION
50893 field_addr.name = "land_channel_requirement_pct";
50894#endif /* FREECIV_JSON_CONNECTION */
50895 e = 0;
50896 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->land_channel_requirement_pct);
50897 if (e) {
50898 log_packet_detailed("'land_channel_requirement_pct' field error detected");
50899 }
50900#ifdef FREECIV_JSON_CONNECTION
50901 field_addr.name = "terrain_thaw_requirement_pct";
50902#endif /* FREECIV_JSON_CONNECTION */
50903 e = 0;
50904 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_thaw_requirement_pct);
50905 if (e) {
50906 log_packet_detailed("'terrain_thaw_requirement_pct' field error detected");
50907 }
50908#ifdef FREECIV_JSON_CONNECTION
50909 field_addr.name = "terrain_freeze_requirement_pct";
50910#endif /* FREECIV_JSON_CONNECTION */
50911 e = 0;
50912 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_freeze_requirement_pct);
50913 if (e) {
50914 log_packet_detailed("'terrain_freeze_requirement_pct' field error detected");
50915 }
50916#ifdef FREECIV_JSON_CONNECTION
50917 field_addr.name = "lake_max_size";
50918#endif /* FREECIV_JSON_CONNECTION */
50919 e = 0;
50920 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->lake_max_size);
50921 if (e) {
50922 log_packet_detailed("'lake_max_size' field error detected");
50923 }
50924#ifdef FREECIV_JSON_CONNECTION
50925 field_addr.name = "min_start_native_area";
50926#endif /* FREECIV_JSON_CONNECTION */
50927 e = 0;
50928 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_start_native_area);
50929 if (e) {
50930 log_packet_detailed("'min_start_native_area' field error detected");
50931 }
50932#ifdef FREECIV_JSON_CONNECTION
50933 field_addr.name = "move_fragments";
50934#endif /* FREECIV_JSON_CONNECTION */
50935 e = 0;
50936 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_fragments);
50937 if (e) {
50938 log_packet_detailed("'move_fragments' field error detected");
50939 }
50940#ifdef FREECIV_JSON_CONNECTION
50941 field_addr.name = "igter_cost";
50942#endif /* FREECIV_JSON_CONNECTION */
50943 e = 0;
50944 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->igter_cost);
50945 if (e) {
50946 log_packet_detailed("'igter_cost' field error detected");
50947 }
50948#ifdef FREECIV_JSON_CONNECTION
50949 field_addr.name = "pythagorean_diagonal";
50950#endif /* FREECIV_JSON_CONNECTION */
50951 e = 0;
50952 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->pythagorean_diagonal);
50953 if (e) {
50954 log_packet_detailed("'pythagorean_diagonal' field error detected");
50955 }
50956#ifdef FREECIV_JSON_CONNECTION
50957 field_addr.name = "infrapoints";
50958#endif /* FREECIV_JSON_CONNECTION */
50959 e = 0;
50960 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->infrapoints);
50961 if (e) {
50962 log_packet_detailed("'infrapoints' field error detected");
50963 }
50964#ifdef FREECIV_JSON_CONNECTION
50965 field_addr.name = "gui_type_base0";
50966#endif /* FREECIV_JSON_CONNECTION */
50967 e = 0;
50968 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base0);
50969 if (e) {
50970 log_packet_detailed("'gui_type_base0' field error detected");
50971 }
50972#ifdef FREECIV_JSON_CONNECTION
50973 field_addr.name = "gui_type_base1";
50974#endif /* FREECIV_JSON_CONNECTION */
50975 e = 0;
50976 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base1);
50977 if (e) {
50978 log_packet_detailed("'gui_type_base1' field error detected");
50979 }
50980
50981#endif
50982 SEND_PACKET_END(PACKET_RULESET_TERRAIN_CONTROL);
50983}
50984
50985 int send_packet_ruleset_terrain_control(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
50986{
50987 if (!pc->used) {
50988 log_error("WARNING: trying to send data to the closed connection %s",
50989 conn_description(pc));
50990 return -1;
50991 }
50992 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet != nullptr, -1,
50993 "Handler for PACKET_RULESET_TERRAIN_CONTROL not installed");
50994 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet(pc, packet);
50995}
50996
50997 void lsend_packet_ruleset_terrain_control(struct conn_list *dest, const struct packet_ruleset_terrain_control *packet)
50998{
50999 conn_list_iterate(dest, pconn) {
51000 send_packet_ruleset_terrain_control(pconn, packet);
51001 } conn_list_iterate_end;
51002}
51003
51004 static inline void init_packet_rulesets_ready(struct packet_rulesets_ready *packet)
51005{
51006 memset(packet, 0, sizeof(*packet));
51007}
51008
51009#define free_packet_rulesets_ready(_packet) (void) 0
51010#define destroy_packet_rulesets_ready free
51011
51012 static struct packet_rulesets_ready *receive_packet_rulesets_ready_100(struct connection *pc)
51013{
51014#define FREE_PACKET_STRUCT(_packet) free_packet_rulesets_ready(_packet)
51015 RECEIVE_PACKET_START(packet_rulesets_ready, real_packet);
51016#if 1 /* To match endif */
51017 real_packet->__dummy = 0xff;
51018#endif
51019 log_packet_detailed("packet_rulesets_ready_100: got info about ()");
51020 RECEIVE_PACKET_END(real_packet);
51021#undef FREE_PACKET_STRUCT
51022}
51023
51024 static int send_packet_rulesets_ready_100(struct connection *pc)
51025{
51026 SEND_PACKET_START(PACKET_RULESETS_READY);
51027
51028 log_packet_detailed("packet_rulesets_ready_100: sending info about ()");
51029 SEND_PACKET_END(PACKET_RULESETS_READY);
51030}
51031
51032 int send_packet_rulesets_ready(struct connection *pc)
51033{
51034 if (!pc->used) {
51035 log_error("WARNING: trying to send data to the closed connection %s",
51036 conn_description(pc));
51037 return -1;
51038 }
51039 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESETS_READY].no_packet != nullptr, -1,
51040 "Handler for PACKET_RULESETS_READY not installed");
51041 return pc->phs.handlers->send[PACKET_RULESETS_READY].no_packet(pc);
51042}
51043
51044 void lsend_packet_rulesets_ready(struct conn_list *dest)
51045{
51046 conn_list_iterate(dest, pconn) {
51047 send_packet_rulesets_ready(pconn);
51048 } conn_list_iterate_end;
51049}
51050
51051 static inline void init_packet_ruleset_nation_sets(struct packet_ruleset_nation_sets *packet)
51052{
51053 memset(packet, 0, sizeof(*packet));
51054}
51055
51056#define free_packet_ruleset_nation_sets(_packet) (void) 0
51057#define destroy_packet_ruleset_nation_sets free
51058
51059#ifdef FREECIV_DELTA_PROTOCOL
51060#define hash_packet_ruleset_nation_sets_100 hash_const
51061
51062#define cmp_packet_ruleset_nation_sets_100 cmp_const
51063
51064 BV_DEFINE(packet_ruleset_nation_sets_100_fields, 4);
51065#endif /* FREECIV_DELTA_PROTOCOL */
51066
51067 static struct packet_ruleset_nation_sets *receive_packet_ruleset_nation_sets_100(struct connection *pc)
51068{
51069#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_nation_sets(_packet)
51070#ifdef FREECIV_DELTA_PROTOCOL
51071 packet_ruleset_nation_sets_100_fields fields;
51072 struct packet_ruleset_nation_sets *old;
51073 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION_SETS;
51074#endif /* FREECIV_DELTA_PROTOCOL */
51075 RECEIVE_PACKET_START(packet_ruleset_nation_sets, real_packet);
51076#ifdef FREECIV_JSON_CONNECTION
51077 struct plocation field_addr;
51078 {
51079 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
51080 field_addr = *field_addr_tmp;
51081 FC_FREE(field_addr_tmp);
51082 }
51083#endif /* FREECIV_JSON_CONNECTION */
51084
51085#ifdef FREECIV_DELTA_PROTOCOL
51086#ifdef FREECIV_JSON_CONNECTION
51087 field_addr.name = "fields";
51088#endif /* FREECIV_JSON_CONNECTION */
51089 DIO_BV_GET(&din, &field_addr, fields);
51090
51091#else /* FREECIV_DELTA_PROTOCOL */
51092#ifdef FREECIV_JSON_CONNECTION
51093 field_addr.name = "nsets";
51094#endif /* FREECIV_JSON_CONNECTION */
51095 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
51096 RECEIVE_PACKET_FIELD_ERROR(nsets);
51097 }
51098#ifdef FREECIV_JSON_CONNECTION
51099 field_addr.name = "names";
51100#endif /* FREECIV_JSON_CONNECTION */
51101 {
51102 int i;
51103
51104#ifdef FREECIV_JSON_CONNECTION
51105 /* Enter array. */
51106 field_addr.sub_location = plocation_elem_new(0);
51107#endif /* FREECIV_JSON_CONNECTION */
51108
51109 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
51110 RECEIVE_PACKET_FIELD_ERROR(names, ": truncation array");
51111 }
51112 for (i = 0; i < real_packet->nsets; i++) {
51113#ifdef FREECIV_JSON_CONNECTION
51114 field_addr.sub_location->number = i;
51115#endif /* FREECIV_JSON_CONNECTION */
51116 if (!DIO_GET(string, &din, &field_addr, real_packet->names[i], sizeof(real_packet->names[i]))) {
51117 RECEIVE_PACKET_FIELD_ERROR(names);
51118 }
51119 }
51120
51121#ifdef FREECIV_JSON_CONNECTION
51122 /* Exit array. */
51123 FC_FREE(field_addr.sub_location);
51124#endif /* FREECIV_JSON_CONNECTION */
51125 }
51126#ifdef FREECIV_JSON_CONNECTION
51127 field_addr.name = "rule_names";
51128#endif /* FREECIV_JSON_CONNECTION */
51129 {
51130 int i;
51131
51132#ifdef FREECIV_JSON_CONNECTION
51133 /* Enter array. */
51134 field_addr.sub_location = plocation_elem_new(0);
51135#endif /* FREECIV_JSON_CONNECTION */
51136
51137 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
51138 RECEIVE_PACKET_FIELD_ERROR(rule_names, ": truncation array");
51139 }
51140 for (i = 0; i < real_packet->nsets; i++) {
51141#ifdef FREECIV_JSON_CONNECTION
51142 field_addr.sub_location->number = i;
51143#endif /* FREECIV_JSON_CONNECTION */
51144 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_names[i], sizeof(real_packet->rule_names[i]))) {
51145 RECEIVE_PACKET_FIELD_ERROR(rule_names);
51146 }
51147 }
51148
51149#ifdef FREECIV_JSON_CONNECTION
51150 /* Exit array. */
51151 FC_FREE(field_addr.sub_location);
51152#endif /* FREECIV_JSON_CONNECTION */
51153 }
51154#ifdef FREECIV_JSON_CONNECTION
51155 field_addr.name = "descriptions";
51156#endif /* FREECIV_JSON_CONNECTION */
51157 {
51158 int i;
51159
51160#ifdef FREECIV_JSON_CONNECTION
51161 /* Enter array. */
51162 field_addr.sub_location = plocation_elem_new(0);
51163#endif /* FREECIV_JSON_CONNECTION */
51164
51165 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
51166 RECEIVE_PACKET_FIELD_ERROR(descriptions, ": truncation array");
51167 }
51168 for (i = 0; i < real_packet->nsets; i++) {
51169#ifdef FREECIV_JSON_CONNECTION
51170 field_addr.sub_location->number = i;
51171#endif /* FREECIV_JSON_CONNECTION */
51172 if (!DIO_GET(string, &din, &field_addr, real_packet->descriptions[i], sizeof(real_packet->descriptions[i]))) {
51173 RECEIVE_PACKET_FIELD_ERROR(descriptions);
51174 }
51175 }
51176
51177#ifdef FREECIV_JSON_CONNECTION
51178 /* Exit array. */
51179 FC_FREE(field_addr.sub_location);
51180#endif /* FREECIV_JSON_CONNECTION */
51181 }
51182#endif
51183 log_packet_detailed("packet_ruleset_nation_sets_100: got info about ()");
51184
51185#ifdef FREECIV_DELTA_PROTOCOL
51186 if (nullptr == *hash) {
51187 *hash = genhash_new_full(hash_packet_ruleset_nation_sets_100, cmp_packet_ruleset_nation_sets_100,
51188 nullptr, nullptr, nullptr, destroy_packet_ruleset_nation_sets);
51189 }
51190
51191 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51192 *real_packet = *old;
51193 } else {
51194 /* packet is already initialized empty */
51195 log_packet_detailed(" no old info");
51196 }
51197
51198 if (BV_ISSET(fields, 0)) {
51199 log_packet_detailed(" got field 'nsets'");
51200#ifdef FREECIV_JSON_CONNECTION
51201 field_addr.name = "nsets";
51202#endif /* FREECIV_JSON_CONNECTION */
51203 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
51204 RECEIVE_PACKET_FIELD_ERROR(nsets);
51205 }
51206 }
51207 if (BV_ISSET(fields, 1)) {
51208 log_packet_detailed(" got field 'names'");
51209#ifdef FREECIV_JSON_CONNECTION
51210 field_addr.name = "names";
51211#endif /* FREECIV_JSON_CONNECTION */
51212 {
51213 int i;
51214
51215#ifdef FREECIV_JSON_CONNECTION
51216 /* Enter array. */
51217 field_addr.sub_location = plocation_elem_new(0);
51218#endif /* FREECIV_JSON_CONNECTION */
51219
51220 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
51221 RECEIVE_PACKET_FIELD_ERROR(names, ": truncation array");
51222 }
51223 for (i = 0; i < real_packet->nsets; i++) {
51224#ifdef FREECIV_JSON_CONNECTION
51225 field_addr.sub_location->number = i;
51226#endif /* FREECIV_JSON_CONNECTION */
51227 if (!DIO_GET(string, &din, &field_addr, real_packet->names[i], sizeof(real_packet->names[i]))) {
51228 RECEIVE_PACKET_FIELD_ERROR(names);
51229 }
51230 }
51231
51232#ifdef FREECIV_JSON_CONNECTION
51233 /* Exit array. */
51234 FC_FREE(field_addr.sub_location);
51235#endif /* FREECIV_JSON_CONNECTION */
51236 }
51237 }
51238 if (BV_ISSET(fields, 2)) {
51239 log_packet_detailed(" got field 'rule_names'");
51240#ifdef FREECIV_JSON_CONNECTION
51241 field_addr.name = "rule_names";
51242#endif /* FREECIV_JSON_CONNECTION */
51243 {
51244 int i;
51245
51246#ifdef FREECIV_JSON_CONNECTION
51247 /* Enter array. */
51248 field_addr.sub_location = plocation_elem_new(0);
51249#endif /* FREECIV_JSON_CONNECTION */
51250
51251 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
51252 RECEIVE_PACKET_FIELD_ERROR(rule_names, ": truncation array");
51253 }
51254 for (i = 0; i < real_packet->nsets; i++) {
51255#ifdef FREECIV_JSON_CONNECTION
51256 field_addr.sub_location->number = i;
51257#endif /* FREECIV_JSON_CONNECTION */
51258 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_names[i], sizeof(real_packet->rule_names[i]))) {
51259 RECEIVE_PACKET_FIELD_ERROR(rule_names);
51260 }
51261 }
51262
51263#ifdef FREECIV_JSON_CONNECTION
51264 /* Exit array. */
51265 FC_FREE(field_addr.sub_location);
51266#endif /* FREECIV_JSON_CONNECTION */
51267 }
51268 }
51269 if (BV_ISSET(fields, 3)) {
51270 log_packet_detailed(" got field 'descriptions'");
51271#ifdef FREECIV_JSON_CONNECTION
51272 field_addr.name = "descriptions";
51273#endif /* FREECIV_JSON_CONNECTION */
51274 {
51275 int i;
51276
51277#ifdef FREECIV_JSON_CONNECTION
51278 /* Enter array. */
51279 field_addr.sub_location = plocation_elem_new(0);
51280#endif /* FREECIV_JSON_CONNECTION */
51281
51282 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
51283 RECEIVE_PACKET_FIELD_ERROR(descriptions, ": truncation array");
51284 }
51285 for (i = 0; i < real_packet->nsets; i++) {
51286#ifdef FREECIV_JSON_CONNECTION
51287 field_addr.sub_location->number = i;
51288#endif /* FREECIV_JSON_CONNECTION */
51289 if (!DIO_GET(string, &din, &field_addr, real_packet->descriptions[i], sizeof(real_packet->descriptions[i]))) {
51290 RECEIVE_PACKET_FIELD_ERROR(descriptions);
51291 }
51292 }
51293
51294#ifdef FREECIV_JSON_CONNECTION
51295 /* Exit array. */
51296 FC_FREE(field_addr.sub_location);
51297#endif /* FREECIV_JSON_CONNECTION */
51298 }
51299 }
51300
51301 if (nullptr == old) {
51302 old = fc_malloc(sizeof(*old));
51303 init_packet_ruleset_nation_sets(old);
51304 *old = *real_packet;
51305 genhash_insert(*hash, old, old);
51306 } else {
51307 *old = *real_packet;
51308 }
51309
51310#endif /* FREECIV_DELTA_PROTOCOL */
51311 RECEIVE_PACKET_END(real_packet);
51312#undef FREE_PACKET_STRUCT
51313}
51314
51315 static int send_packet_ruleset_nation_sets_100(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
51316{
51317 const struct packet_ruleset_nation_sets *real_packet = packet;
51318 int e;
51319#ifdef FREECIV_DELTA_PROTOCOL
51320 packet_ruleset_nation_sets_100_fields fields;
51321 struct packet_ruleset_nation_sets *old;
51322 bool differ;
51323 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION_SETS;
51324#endif /* FREECIV_DELTA_PROTOCOL */
51325 SEND_PACKET_START(PACKET_RULESET_NATION_SETS);
51326#ifdef FREECIV_JSON_CONNECTION
51327 struct plocation field_addr;
51328 {
51329 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
51330 field_addr = *field_addr_tmp;
51331 FC_FREE(field_addr_tmp);
51332 }
51333#endif /* FREECIV_JSON_CONNECTION */
51334
51335 log_packet_detailed("packet_ruleset_nation_sets_100: sending info about ()");
51336
51337#ifdef FREECIV_DELTA_PROTOCOL
51338 if (nullptr == *hash) {
51339 *hash = genhash_new_full(hash_packet_ruleset_nation_sets_100, cmp_packet_ruleset_nation_sets_100,
51340 nullptr, nullptr, nullptr, destroy_packet_ruleset_nation_sets);
51341 }
51342 BV_CLR_ALL(fields);
51343
51344 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
51345 old = fc_malloc(sizeof(*old));
51346 /* temporary bitcopy just to insert correctly */
51347 *old = *real_packet;
51348 genhash_insert(*hash, old, old);
51349 init_packet_ruleset_nation_sets(old);
51350 }
51351 differ = (old->nsets != real_packet->nsets);
51352 if (differ) {
51353 BV_SET(fields, 0);
51354 }
51355
51356 differ = (old->nsets != real_packet->nsets);
51357 if (!differ) {
51358 int i;
51359
51360 for (i = 0; i < real_packet->nsets; i++) {
51361 differ = (strcmp(old->names[i], real_packet->names[i]) != 0);
51362 if (differ) {
51363 break;
51364 }
51365 }
51366 }
51367 if (differ) {
51368 BV_SET(fields, 1);
51369 }
51370
51371 differ = (old->nsets != real_packet->nsets);
51372 if (!differ) {
51373 int i;
51374
51375 for (i = 0; i < real_packet->nsets; i++) {
51376 differ = (strcmp(old->rule_names[i], real_packet->rule_names[i]) != 0);
51377 if (differ) {
51378 break;
51379 }
51380 }
51381 }
51382 if (differ) {
51383 BV_SET(fields, 2);
51384 }
51385
51386 differ = (old->nsets != real_packet->nsets);
51387 if (!differ) {
51388 int i;
51389
51390 for (i = 0; i < real_packet->nsets; i++) {
51391 differ = (strcmp(old->descriptions[i], real_packet->descriptions[i]) != 0);
51392 if (differ) {
51393 break;
51394 }
51395 }
51396 }
51397 if (differ) {
51398 BV_SET(fields, 3);
51399 }
51400
51401
51402#ifdef FREECIV_JSON_CONNECTION
51403 field_addr.name = "fields";
51404#endif /* FREECIV_JSON_CONNECTION */
51405 e = 0;
51406 e |= DIO_BV_PUT(&dout, &field_addr, fields);
51407 if (e) {
51408 log_packet_detailed("fields bitvector error detected");
51409 }
51410
51411 if (BV_ISSET(fields, 0)) {
51412 log_packet_detailed(" field 'nsets' has changed");
51413#ifdef FREECIV_JSON_CONNECTION
51414 field_addr.name = "nsets";
51415#endif /* FREECIV_JSON_CONNECTION */
51416 e = 0;
51417 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
51418 if (e) {
51419 log_packet_detailed("'nsets' field error detected");
51420 }
51421 }
51422 if (BV_ISSET(fields, 1)) {
51423 log_packet_detailed(" field 'names' has changed");
51424#ifdef FREECIV_JSON_CONNECTION
51425 field_addr.name = "names";
51426#endif /* FREECIV_JSON_CONNECTION */
51427 e = 0;
51428 {
51429 int i;
51430
51431#ifdef FREECIV_JSON_CONNECTION
51432 /* Create the array. */
51433 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
51434
51435 /* Enter the array. */
51436 field_addr.sub_location = plocation_elem_new(0);
51437#endif /* FREECIV_JSON_CONNECTION */
51438
51439 for (i = 0; i < real_packet->nsets; i++) {
51440#ifdef FREECIV_JSON_CONNECTION
51441 /* Next array element. */
51442 field_addr.sub_location->number = i;
51443#endif /* FREECIV_JSON_CONNECTION */
51444 e |= DIO_PUT(string, &dout, &field_addr, real_packet->names[i]);
51445 }
51446
51447#ifdef FREECIV_JSON_CONNECTION
51448 /* Exit array. */
51449 FC_FREE(field_addr.sub_location);
51450#endif /* FREECIV_JSON_CONNECTION */
51451 }
51452 if (e) {
51453 log_packet_detailed("'names' field error detected");
51454 }
51455 }
51456 if (BV_ISSET(fields, 2)) {
51457 log_packet_detailed(" field 'rule_names' has changed");
51458#ifdef FREECIV_JSON_CONNECTION
51459 field_addr.name = "rule_names";
51460#endif /* FREECIV_JSON_CONNECTION */
51461 e = 0;
51462 {
51463 int i;
51464
51465#ifdef FREECIV_JSON_CONNECTION
51466 /* Create the array. */
51467 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
51468
51469 /* Enter the array. */
51470 field_addr.sub_location = plocation_elem_new(0);
51471#endif /* FREECIV_JSON_CONNECTION */
51472
51473 for (i = 0; i < real_packet->nsets; i++) {
51474#ifdef FREECIV_JSON_CONNECTION
51475 /* Next array element. */
51476 field_addr.sub_location->number = i;
51477#endif /* FREECIV_JSON_CONNECTION */
51478 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_names[i]);
51479 }
51480
51481#ifdef FREECIV_JSON_CONNECTION
51482 /* Exit array. */
51483 FC_FREE(field_addr.sub_location);
51484#endif /* FREECIV_JSON_CONNECTION */
51485 }
51486 if (e) {
51487 log_packet_detailed("'rule_names' field error detected");
51488 }
51489 }
51490 if (BV_ISSET(fields, 3)) {
51491 log_packet_detailed(" field 'descriptions' has changed");
51492#ifdef FREECIV_JSON_CONNECTION
51493 field_addr.name = "descriptions";
51494#endif /* FREECIV_JSON_CONNECTION */
51495 e = 0;
51496 {
51497 int i;
51498
51499#ifdef FREECIV_JSON_CONNECTION
51500 /* Create the array. */
51501 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
51502
51503 /* Enter the array. */
51504 field_addr.sub_location = plocation_elem_new(0);
51505#endif /* FREECIV_JSON_CONNECTION */
51506
51507 for (i = 0; i < real_packet->nsets; i++) {
51508#ifdef FREECIV_JSON_CONNECTION
51509 /* Next array element. */
51510 field_addr.sub_location->number = i;
51511#endif /* FREECIV_JSON_CONNECTION */
51512 e |= DIO_PUT(string, &dout, &field_addr, real_packet->descriptions[i]);
51513 }
51514
51515#ifdef FREECIV_JSON_CONNECTION
51516 /* Exit array. */
51517 FC_FREE(field_addr.sub_location);
51518#endif /* FREECIV_JSON_CONNECTION */
51519 }
51520 if (e) {
51521 log_packet_detailed("'descriptions' field error detected");
51522 }
51523 }
51524
51525 *old = *real_packet;
51526#endif /* FREECIV_DELTA_PROTOCOL */
51527#ifndef FREECIV_DELTA_PROTOCOL
51528#ifdef FREECIV_JSON_CONNECTION
51529 field_addr.name = "nsets";
51530#endif /* FREECIV_JSON_CONNECTION */
51531 e = 0;
51532 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
51533 if (e) {
51534 log_packet_detailed("'nsets' field error detected");
51535 }
51536#ifdef FREECIV_JSON_CONNECTION
51537 field_addr.name = "names";
51538#endif /* FREECIV_JSON_CONNECTION */
51539 e = 0;
51540 {
51541 int i;
51542
51543#ifdef FREECIV_JSON_CONNECTION
51544 /* Create the array. */
51545 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
51546
51547 /* Enter the array. */
51548 field_addr.sub_location = plocation_elem_new(0);
51549#endif /* FREECIV_JSON_CONNECTION */
51550
51551 for (i = 0; i < real_packet->nsets; i++) {
51552#ifdef FREECIV_JSON_CONNECTION
51553 /* Next array element. */
51554 field_addr.sub_location->number = i;
51555#endif /* FREECIV_JSON_CONNECTION */
51556 e |= DIO_PUT(string, &dout, &field_addr, real_packet->names[i]);
51557 }
51558
51559#ifdef FREECIV_JSON_CONNECTION
51560 /* Exit array. */
51561 FC_FREE(field_addr.sub_location);
51562#endif /* FREECIV_JSON_CONNECTION */
51563 }
51564 if (e) {
51565 log_packet_detailed("'names' field error detected");
51566 }
51567#ifdef FREECIV_JSON_CONNECTION
51568 field_addr.name = "rule_names";
51569#endif /* FREECIV_JSON_CONNECTION */
51570 e = 0;
51571 {
51572 int i;
51573
51574#ifdef FREECIV_JSON_CONNECTION
51575 /* Create the array. */
51576 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
51577
51578 /* Enter the array. */
51579 field_addr.sub_location = plocation_elem_new(0);
51580#endif /* FREECIV_JSON_CONNECTION */
51581
51582 for (i = 0; i < real_packet->nsets; i++) {
51583#ifdef FREECIV_JSON_CONNECTION
51584 /* Next array element. */
51585 field_addr.sub_location->number = i;
51586#endif /* FREECIV_JSON_CONNECTION */
51587 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_names[i]);
51588 }
51589
51590#ifdef FREECIV_JSON_CONNECTION
51591 /* Exit array. */
51592 FC_FREE(field_addr.sub_location);
51593#endif /* FREECIV_JSON_CONNECTION */
51594 }
51595 if (e) {
51596 log_packet_detailed("'rule_names' field error detected");
51597 }
51598#ifdef FREECIV_JSON_CONNECTION
51599 field_addr.name = "descriptions";
51600#endif /* FREECIV_JSON_CONNECTION */
51601 e = 0;
51602 {
51603 int i;
51604
51605#ifdef FREECIV_JSON_CONNECTION
51606 /* Create the array. */
51607 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
51608
51609 /* Enter the array. */
51610 field_addr.sub_location = plocation_elem_new(0);
51611#endif /* FREECIV_JSON_CONNECTION */
51612
51613 for (i = 0; i < real_packet->nsets; i++) {
51614#ifdef FREECIV_JSON_CONNECTION
51615 /* Next array element. */
51616 field_addr.sub_location->number = i;
51617#endif /* FREECIV_JSON_CONNECTION */
51618 e |= DIO_PUT(string, &dout, &field_addr, real_packet->descriptions[i]);
51619 }
51620
51621#ifdef FREECIV_JSON_CONNECTION
51622 /* Exit array. */
51623 FC_FREE(field_addr.sub_location);
51624#endif /* FREECIV_JSON_CONNECTION */
51625 }
51626 if (e) {
51627 log_packet_detailed("'descriptions' field error detected");
51628 }
51629
51630#endif
51631 SEND_PACKET_END(PACKET_RULESET_NATION_SETS);
51632}
51633
51634 int send_packet_ruleset_nation_sets(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
51635{
51636 if (!pc->used) {
51637 log_error("WARNING: trying to send data to the closed connection %s",
51638 conn_description(pc));
51639 return -1;
51640 }
51641 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION_SETS].packet != nullptr, -1,
51642 "Handler for PACKET_RULESET_NATION_SETS not installed");
51643 return pc->phs.handlers->send[PACKET_RULESET_NATION_SETS].packet(pc, packet);
51644}
51645
51646 void lsend_packet_ruleset_nation_sets(struct conn_list *dest, const struct packet_ruleset_nation_sets *packet)
51647{
51648 conn_list_iterate(dest, pconn) {
51649 send_packet_ruleset_nation_sets(pconn, packet);
51650 } conn_list_iterate_end;
51651}
51652
51653 static inline void init_packet_ruleset_nation_groups(struct packet_ruleset_nation_groups *packet)
51654{
51655 memset(packet, 0, sizeof(*packet));
51656}
51657
51658#define free_packet_ruleset_nation_groups(_packet) (void) 0
51659#define destroy_packet_ruleset_nation_groups free
51660
51661#ifdef FREECIV_DELTA_PROTOCOL
51662#define hash_packet_ruleset_nation_groups_100 hash_const
51663
51664#define cmp_packet_ruleset_nation_groups_100 cmp_const
51665
51666 BV_DEFINE(packet_ruleset_nation_groups_100_fields, 3);
51667#endif /* FREECIV_DELTA_PROTOCOL */
51668
51669 static struct packet_ruleset_nation_groups *receive_packet_ruleset_nation_groups_100(struct connection *pc)
51670{
51671#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_nation_groups(_packet)
51672#ifdef FREECIV_DELTA_PROTOCOL
51673 packet_ruleset_nation_groups_100_fields fields;
51674 struct packet_ruleset_nation_groups *old;
51675 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION_GROUPS;
51676#endif /* FREECIV_DELTA_PROTOCOL */
51677 RECEIVE_PACKET_START(packet_ruleset_nation_groups, real_packet);
51678#ifdef FREECIV_JSON_CONNECTION
51679 struct plocation field_addr;
51680 {
51681 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
51682 field_addr = *field_addr_tmp;
51683 FC_FREE(field_addr_tmp);
51684 }
51685#endif /* FREECIV_JSON_CONNECTION */
51686
51687#ifdef FREECIV_DELTA_PROTOCOL
51688#ifdef FREECIV_JSON_CONNECTION
51689 field_addr.name = "fields";
51690#endif /* FREECIV_JSON_CONNECTION */
51691 DIO_BV_GET(&din, &field_addr, fields);
51692
51693#else /* FREECIV_DELTA_PROTOCOL */
51694#ifdef FREECIV_JSON_CONNECTION
51695 field_addr.name = "ngroups";
51696#endif /* FREECIV_JSON_CONNECTION */
51697 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
51698 RECEIVE_PACKET_FIELD_ERROR(ngroups);
51699 }
51700#ifdef FREECIV_JSON_CONNECTION
51701 field_addr.name = "groups";
51702#endif /* FREECIV_JSON_CONNECTION */
51703 {
51704 int i;
51705
51706#ifdef FREECIV_JSON_CONNECTION
51707 /* Enter array. */
51708 field_addr.sub_location = plocation_elem_new(0);
51709#endif /* FREECIV_JSON_CONNECTION */
51710
51711 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
51712 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
51713 }
51714 for (i = 0; i < real_packet->ngroups; i++) {
51715#ifdef FREECIV_JSON_CONNECTION
51716 field_addr.sub_location->number = i;
51717#endif /* FREECIV_JSON_CONNECTION */
51718 if (!DIO_GET(string, &din, &field_addr, real_packet->groups[i], sizeof(real_packet->groups[i]))) {
51719 RECEIVE_PACKET_FIELD_ERROR(groups);
51720 }
51721 }
51722
51723#ifdef FREECIV_JSON_CONNECTION
51724 /* Exit array. */
51725 FC_FREE(field_addr.sub_location);
51726#endif /* FREECIV_JSON_CONNECTION */
51727 }
51728#ifdef FREECIV_JSON_CONNECTION
51729 field_addr.name = "hidden";
51730#endif /* FREECIV_JSON_CONNECTION */
51731 {
51732 int i;
51733
51734#ifdef FREECIV_JSON_CONNECTION
51735 /* Enter array. */
51736 field_addr.sub_location = plocation_elem_new(0);
51737#endif /* FREECIV_JSON_CONNECTION */
51738
51739 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
51740 RECEIVE_PACKET_FIELD_ERROR(hidden, ": truncation array");
51741 }
51742 for (i = 0; i < real_packet->ngroups; i++) {
51743#ifdef FREECIV_JSON_CONNECTION
51744 field_addr.sub_location->number = i;
51745#endif /* FREECIV_JSON_CONNECTION */
51746 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->hidden[i])) {
51747 RECEIVE_PACKET_FIELD_ERROR(hidden);
51748 }
51749 }
51750
51751#ifdef FREECIV_JSON_CONNECTION
51752 /* Exit array. */
51753 FC_FREE(field_addr.sub_location);
51754#endif /* FREECIV_JSON_CONNECTION */
51755 }
51756#endif
51757 log_packet_detailed("packet_ruleset_nation_groups_100: got info about ()");
51758
51759#ifdef FREECIV_DELTA_PROTOCOL
51760 if (nullptr == *hash) {
51761 *hash = genhash_new_full(hash_packet_ruleset_nation_groups_100, cmp_packet_ruleset_nation_groups_100,
51762 nullptr, nullptr, nullptr, destroy_packet_ruleset_nation_groups);
51763 }
51764
51765 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51766 *real_packet = *old;
51767 } else {
51768 /* packet is already initialized empty */
51769 log_packet_detailed(" no old info");
51770 }
51771
51772 if (BV_ISSET(fields, 0)) {
51773 log_packet_detailed(" got field 'ngroups'");
51774#ifdef FREECIV_JSON_CONNECTION
51775 field_addr.name = "ngroups";
51776#endif /* FREECIV_JSON_CONNECTION */
51777 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
51778 RECEIVE_PACKET_FIELD_ERROR(ngroups);
51779 }
51780 }
51781 if (BV_ISSET(fields, 1)) {
51782 log_packet_detailed(" got field 'groups'");
51783#ifdef FREECIV_JSON_CONNECTION
51784 field_addr.name = "groups";
51785#endif /* FREECIV_JSON_CONNECTION */
51786 {
51787 int i;
51788
51789#ifdef FREECIV_JSON_CONNECTION
51790 /* Enter array. */
51791 field_addr.sub_location = plocation_elem_new(0);
51792#endif /* FREECIV_JSON_CONNECTION */
51793
51794 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
51795 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
51796 }
51797 for (i = 0; i < real_packet->ngroups; i++) {
51798#ifdef FREECIV_JSON_CONNECTION
51799 field_addr.sub_location->number = i;
51800#endif /* FREECIV_JSON_CONNECTION */
51801 if (!DIO_GET(string, &din, &field_addr, real_packet->groups[i], sizeof(real_packet->groups[i]))) {
51802 RECEIVE_PACKET_FIELD_ERROR(groups);
51803 }
51804 }
51805
51806#ifdef FREECIV_JSON_CONNECTION
51807 /* Exit array. */
51808 FC_FREE(field_addr.sub_location);
51809#endif /* FREECIV_JSON_CONNECTION */
51810 }
51811 }
51812 if (BV_ISSET(fields, 2)) {
51813 log_packet_detailed(" got field 'hidden'");
51814#ifdef FREECIV_JSON_CONNECTION
51815 field_addr.name = "hidden";
51816#endif /* FREECIV_JSON_CONNECTION */
51817 {
51818 int i;
51819
51820#ifdef FREECIV_JSON_CONNECTION
51821 /* Enter array. */
51822 field_addr.sub_location = plocation_elem_new(0);
51823#endif /* FREECIV_JSON_CONNECTION */
51824
51825 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
51826 RECEIVE_PACKET_FIELD_ERROR(hidden, ": truncation array");
51827 }
51828 for (i = 0; i < real_packet->ngroups; i++) {
51829#ifdef FREECIV_JSON_CONNECTION
51830 field_addr.sub_location->number = i;
51831#endif /* FREECIV_JSON_CONNECTION */
51832 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->hidden[i])) {
51833 RECEIVE_PACKET_FIELD_ERROR(hidden);
51834 }
51835 }
51836
51837#ifdef FREECIV_JSON_CONNECTION
51838 /* Exit array. */
51839 FC_FREE(field_addr.sub_location);
51840#endif /* FREECIV_JSON_CONNECTION */
51841 }
51842 }
51843
51844 if (nullptr == old) {
51845 old = fc_malloc(sizeof(*old));
51846 init_packet_ruleset_nation_groups(old);
51847 *old = *real_packet;
51848 genhash_insert(*hash, old, old);
51849 } else {
51850 *old = *real_packet;
51851 }
51852
51853#endif /* FREECIV_DELTA_PROTOCOL */
51854 RECEIVE_PACKET_END(real_packet);
51855#undef FREE_PACKET_STRUCT
51856}
51857
51858 static int send_packet_ruleset_nation_groups_100(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
51859{
51860 const struct packet_ruleset_nation_groups *real_packet = packet;
51861 int e;
51862#ifdef FREECIV_DELTA_PROTOCOL
51863 packet_ruleset_nation_groups_100_fields fields;
51864 struct packet_ruleset_nation_groups *old;
51865 bool differ;
51866 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION_GROUPS;
51867#endif /* FREECIV_DELTA_PROTOCOL */
51868 SEND_PACKET_START(PACKET_RULESET_NATION_GROUPS);
51869#ifdef FREECIV_JSON_CONNECTION
51870 struct plocation field_addr;
51871 {
51872 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
51873 field_addr = *field_addr_tmp;
51874 FC_FREE(field_addr_tmp);
51875 }
51876#endif /* FREECIV_JSON_CONNECTION */
51877
51878 log_packet_detailed("packet_ruleset_nation_groups_100: sending info about ()");
51879
51880#ifdef FREECIV_DELTA_PROTOCOL
51881 if (nullptr == *hash) {
51882 *hash = genhash_new_full(hash_packet_ruleset_nation_groups_100, cmp_packet_ruleset_nation_groups_100,
51883 nullptr, nullptr, nullptr, destroy_packet_ruleset_nation_groups);
51884 }
51885 BV_CLR_ALL(fields);
51886
51887 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
51888 old = fc_malloc(sizeof(*old));
51889 /* temporary bitcopy just to insert correctly */
51890 *old = *real_packet;
51891 genhash_insert(*hash, old, old);
51892 init_packet_ruleset_nation_groups(old);
51893 }
51894 differ = (old->ngroups != real_packet->ngroups);
51895 if (differ) {
51896 BV_SET(fields, 0);
51897 }
51898
51899 differ = (old->ngroups != real_packet->ngroups);
51900 if (!differ) {
51901 int i;
51902
51903 for (i = 0; i < real_packet->ngroups; i++) {
51904 differ = (strcmp(old->groups[i], real_packet->groups[i]) != 0);
51905 if (differ) {
51906 break;
51907 }
51908 }
51909 }
51910 if (differ) {
51911 BV_SET(fields, 1);
51912 }
51913
51914 differ = (old->ngroups != real_packet->ngroups);
51915 if (!differ) {
51916 int i;
51917
51918 for (i = 0; i < real_packet->ngroups; i++) {
51919 differ = (old->hidden[i] != real_packet->hidden[i]);
51920 if (differ) {
51921 break;
51922 }
51923 }
51924 }
51925 if (differ) {
51926 BV_SET(fields, 2);
51927 }
51928
51929
51930#ifdef FREECIV_JSON_CONNECTION
51931 field_addr.name = "fields";
51932#endif /* FREECIV_JSON_CONNECTION */
51933 e = 0;
51934 e |= DIO_BV_PUT(&dout, &field_addr, fields);
51935 if (e) {
51936 log_packet_detailed("fields bitvector error detected");
51937 }
51938
51939 if (BV_ISSET(fields, 0)) {
51940 log_packet_detailed(" field 'ngroups' has changed");
51941#ifdef FREECIV_JSON_CONNECTION
51942 field_addr.name = "ngroups";
51943#endif /* FREECIV_JSON_CONNECTION */
51944 e = 0;
51945 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
51946 if (e) {
51947 log_packet_detailed("'ngroups' field error detected");
51948 }
51949 }
51950 if (BV_ISSET(fields, 1)) {
51951 log_packet_detailed(" field 'groups' has changed");
51952#ifdef FREECIV_JSON_CONNECTION
51953 field_addr.name = "groups";
51954#endif /* FREECIV_JSON_CONNECTION */
51955 e = 0;
51956 {
51957 int i;
51958
51959#ifdef FREECIV_JSON_CONNECTION
51960 /* Create the array. */
51961 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
51962
51963 /* Enter the array. */
51964 field_addr.sub_location = plocation_elem_new(0);
51965#endif /* FREECIV_JSON_CONNECTION */
51966
51967 for (i = 0; i < real_packet->ngroups; i++) {
51968#ifdef FREECIV_JSON_CONNECTION
51969 /* Next array element. */
51970 field_addr.sub_location->number = i;
51971#endif /* FREECIV_JSON_CONNECTION */
51972 e |= DIO_PUT(string, &dout, &field_addr, real_packet->groups[i]);
51973 }
51974
51975#ifdef FREECIV_JSON_CONNECTION
51976 /* Exit array. */
51977 FC_FREE(field_addr.sub_location);
51978#endif /* FREECIV_JSON_CONNECTION */
51979 }
51980 if (e) {
51981 log_packet_detailed("'groups' field error detected");
51982 }
51983 }
51984 if (BV_ISSET(fields, 2)) {
51985 log_packet_detailed(" field 'hidden' has changed");
51986#ifdef FREECIV_JSON_CONNECTION
51987 field_addr.name = "hidden";
51988#endif /* FREECIV_JSON_CONNECTION */
51989 e = 0;
51990 {
51991 int i;
51992
51993#ifdef FREECIV_JSON_CONNECTION
51994 /* Create the array. */
51995 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
51996
51997 /* Enter the array. */
51998 field_addr.sub_location = plocation_elem_new(0);
51999#endif /* FREECIV_JSON_CONNECTION */
52000
52001 for (i = 0; i < real_packet->ngroups; i++) {
52002#ifdef FREECIV_JSON_CONNECTION
52003 /* Next array element. */
52004 field_addr.sub_location->number = i;
52005#endif /* FREECIV_JSON_CONNECTION */
52006 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->hidden[i]);
52007 }
52008
52009#ifdef FREECIV_JSON_CONNECTION
52010 /* Exit array. */
52011 FC_FREE(field_addr.sub_location);
52012#endif /* FREECIV_JSON_CONNECTION */
52013 }
52014 if (e) {
52015 log_packet_detailed("'hidden' field error detected");
52016 }
52017 }
52018
52019 *old = *real_packet;
52020#endif /* FREECIV_DELTA_PROTOCOL */
52021#ifndef FREECIV_DELTA_PROTOCOL
52022#ifdef FREECIV_JSON_CONNECTION
52023 field_addr.name = "ngroups";
52024#endif /* FREECIV_JSON_CONNECTION */
52025 e = 0;
52026 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
52027 if (e) {
52028 log_packet_detailed("'ngroups' field error detected");
52029 }
52030#ifdef FREECIV_JSON_CONNECTION
52031 field_addr.name = "groups";
52032#endif /* FREECIV_JSON_CONNECTION */
52033 e = 0;
52034 {
52035 int i;
52036
52037#ifdef FREECIV_JSON_CONNECTION
52038 /* Create the array. */
52039 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
52040
52041 /* Enter the array. */
52042 field_addr.sub_location = plocation_elem_new(0);
52043#endif /* FREECIV_JSON_CONNECTION */
52044
52045 for (i = 0; i < real_packet->ngroups; i++) {
52046#ifdef FREECIV_JSON_CONNECTION
52047 /* Next array element. */
52048 field_addr.sub_location->number = i;
52049#endif /* FREECIV_JSON_CONNECTION */
52050 e |= DIO_PUT(string, &dout, &field_addr, real_packet->groups[i]);
52051 }
52052
52053#ifdef FREECIV_JSON_CONNECTION
52054 /* Exit array. */
52055 FC_FREE(field_addr.sub_location);
52056#endif /* FREECIV_JSON_CONNECTION */
52057 }
52058 if (e) {
52059 log_packet_detailed("'groups' field error detected");
52060 }
52061#ifdef FREECIV_JSON_CONNECTION
52062 field_addr.name = "hidden";
52063#endif /* FREECIV_JSON_CONNECTION */
52064 e = 0;
52065 {
52066 int i;
52067
52068#ifdef FREECIV_JSON_CONNECTION
52069 /* Create the array. */
52070 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
52071
52072 /* Enter the array. */
52073 field_addr.sub_location = plocation_elem_new(0);
52074#endif /* FREECIV_JSON_CONNECTION */
52075
52076 for (i = 0; i < real_packet->ngroups; i++) {
52077#ifdef FREECIV_JSON_CONNECTION
52078 /* Next array element. */
52079 field_addr.sub_location->number = i;
52080#endif /* FREECIV_JSON_CONNECTION */
52081 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->hidden[i]);
52082 }
52083
52084#ifdef FREECIV_JSON_CONNECTION
52085 /* Exit array. */
52086 FC_FREE(field_addr.sub_location);
52087#endif /* FREECIV_JSON_CONNECTION */
52088 }
52089 if (e) {
52090 log_packet_detailed("'hidden' field error detected");
52091 }
52092
52093#endif
52094 SEND_PACKET_END(PACKET_RULESET_NATION_GROUPS);
52095}
52096
52097 int send_packet_ruleset_nation_groups(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
52098{
52099 if (!pc->used) {
52100 log_error("WARNING: trying to send data to the closed connection %s",
52101 conn_description(pc));
52102 return -1;
52103 }
52104 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION_GROUPS].packet != nullptr, -1,
52105 "Handler for PACKET_RULESET_NATION_GROUPS not installed");
52106 return pc->phs.handlers->send[PACKET_RULESET_NATION_GROUPS].packet(pc, packet);
52107}
52108
52109 void lsend_packet_ruleset_nation_groups(struct conn_list *dest, const struct packet_ruleset_nation_groups *packet)
52110{
52111 conn_list_iterate(dest, pconn) {
52112 send_packet_ruleset_nation_groups(pconn, packet);
52113 } conn_list_iterate_end;
52114}
52115
52116 static inline void init_packet_ruleset_nation(struct packet_ruleset_nation *packet)
52117{
52118 memset(packet, 0, sizeof(*packet));
52119}
52120
52121#define free_packet_ruleset_nation(_packet) (void) 0
52122#define destroy_packet_ruleset_nation free
52123
52124#ifdef FREECIV_DELTA_PROTOCOL
52125static genhash_val_t hash_packet_ruleset_nation_100(const void *vkey)
52126{
52127 const struct packet_ruleset_nation *key = (const struct packet_ruleset_nation *) vkey;
52128 genhash_val_t result = 0;
52129
52130 result += key->id;
52131
52132 result &= 0xFFFFFFFF;
52133 return result;
52134}
52135
52136static bool cmp_packet_ruleset_nation_100(const void *vkey1, const void *vkey2)
52137{
52138 const struct packet_ruleset_nation *old = (const struct packet_ruleset_nation *) vkey1;
52139 const struct packet_ruleset_nation *real_packet = (const struct packet_ruleset_nation *) vkey2;
52140 bool differ;
52141
52142 differ = (old->id != real_packet->id);
52143
52144 return !differ;
52145}
52146 BV_DEFINE(packet_ruleset_nation_100_fields, 24);
52147#endif /* FREECIV_DELTA_PROTOCOL */
52148
52149 static struct packet_ruleset_nation *receive_packet_ruleset_nation_100(struct connection *pc)
52150{
52151#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_nation(_packet)
52152#ifdef FREECIV_DELTA_PROTOCOL
52153 packet_ruleset_nation_100_fields fields;
52154 struct packet_ruleset_nation *old;
52155 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION;
52156#endif /* FREECIV_DELTA_PROTOCOL */
52157 RECEIVE_PACKET_START(packet_ruleset_nation, real_packet);
52158#ifdef FREECIV_JSON_CONNECTION
52159 struct plocation field_addr;
52160 {
52161 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
52162 field_addr = *field_addr_tmp;
52163 FC_FREE(field_addr_tmp);
52164 }
52165#endif /* FREECIV_JSON_CONNECTION */
52166
52167#ifdef FREECIV_DELTA_PROTOCOL
52168#ifdef FREECIV_JSON_CONNECTION
52169 field_addr.name = "fields";
52170#endif /* FREECIV_JSON_CONNECTION */
52171 DIO_BV_GET(&din, &field_addr, fields);
52172#ifdef FREECIV_JSON_CONNECTION
52173 field_addr.name = "id";
52174#endif /* FREECIV_JSON_CONNECTION */
52175 {
52176 int readin;
52177
52178 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
52179 RECEIVE_PACKET_FIELD_ERROR(id);
52180 }
52181 real_packet->id = readin;
52182 }
52183
52184#else /* FREECIV_DELTA_PROTOCOL */
52185#ifdef FREECIV_JSON_CONNECTION
52186 field_addr.name = "id";
52187#endif /* FREECIV_JSON_CONNECTION */
52188 {
52189 int readin;
52190
52191 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
52192 RECEIVE_PACKET_FIELD_ERROR(id);
52193 }
52194 real_packet->id = readin;
52195 }
52196#ifdef FREECIV_JSON_CONNECTION
52197 field_addr.name = "translation_domain";
52198#endif /* FREECIV_JSON_CONNECTION */
52199 if (!DIO_GET(string, &din, &field_addr, real_packet->translation_domain, sizeof(real_packet->translation_domain))) {
52200 RECEIVE_PACKET_FIELD_ERROR(translation_domain);
52201 }
52202#ifdef FREECIV_JSON_CONNECTION
52203 field_addr.name = "adjective";
52204#endif /* FREECIV_JSON_CONNECTION */
52205 if (!DIO_GET(string, &din, &field_addr, real_packet->adjective, sizeof(real_packet->adjective))) {
52206 RECEIVE_PACKET_FIELD_ERROR(adjective);
52207 }
52208#ifdef FREECIV_JSON_CONNECTION
52209 field_addr.name = "rule_name";
52210#endif /* FREECIV_JSON_CONNECTION */
52211 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
52212 RECEIVE_PACKET_FIELD_ERROR(rule_name);
52213 }
52214#ifdef FREECIV_JSON_CONNECTION
52215 field_addr.name = "noun_plural";
52216#endif /* FREECIV_JSON_CONNECTION */
52217 if (!DIO_GET(string, &din, &field_addr, real_packet->noun_plural, sizeof(real_packet->noun_plural))) {
52218 RECEIVE_PACKET_FIELD_ERROR(noun_plural);
52219 }
52220#ifdef FREECIV_JSON_CONNECTION
52221 field_addr.name = "graphic_str";
52222#endif /* FREECIV_JSON_CONNECTION */
52223 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
52224 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
52225 }
52226#ifdef FREECIV_JSON_CONNECTION
52227 field_addr.name = "graphic_alt";
52228#endif /* FREECIV_JSON_CONNECTION */
52229 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
52230 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
52231 }
52232#ifdef FREECIV_JSON_CONNECTION
52233 field_addr.name = "legend";
52234#endif /* FREECIV_JSON_CONNECTION */
52235 if (!DIO_GET(string, &din, &field_addr, real_packet->legend, sizeof(real_packet->legend))) {
52236 RECEIVE_PACKET_FIELD_ERROR(legend);
52237 }
52238#ifdef FREECIV_JSON_CONNECTION
52239 field_addr.name = "style";
52240#endif /* FREECIV_JSON_CONNECTION */
52241 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
52242 RECEIVE_PACKET_FIELD_ERROR(style);
52243 }
52244#ifdef FREECIV_JSON_CONNECTION
52245 field_addr.name = "leader_count";
52246#endif /* FREECIV_JSON_CONNECTION */
52247 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->leader_count)) {
52248 RECEIVE_PACKET_FIELD_ERROR(leader_count);
52249 }
52250#ifdef FREECIV_JSON_CONNECTION
52251 field_addr.name = "leader_name";
52252#endif /* FREECIV_JSON_CONNECTION */
52253 {
52254 int i;
52255
52256#ifdef FREECIV_JSON_CONNECTION
52257 /* Enter array. */
52258 field_addr.sub_location = plocation_elem_new(0);
52259#endif /* FREECIV_JSON_CONNECTION */
52260
52261 if (real_packet->leader_count > MAX_NUM_LEADERS) {
52262 RECEIVE_PACKET_FIELD_ERROR(leader_name, ": truncation array");
52263 }
52264 for (i = 0; i < real_packet->leader_count; i++) {
52265#ifdef FREECIV_JSON_CONNECTION
52266 field_addr.sub_location->number = i;
52267#endif /* FREECIV_JSON_CONNECTION */
52268 if (!DIO_GET(string, &din, &field_addr, real_packet->leader_name[i], sizeof(real_packet->leader_name[i]))) {
52269 RECEIVE_PACKET_FIELD_ERROR(leader_name);
52270 }
52271 }
52272
52273#ifdef FREECIV_JSON_CONNECTION
52274 /* Exit array. */
52275 FC_FREE(field_addr.sub_location);
52276#endif /* FREECIV_JSON_CONNECTION */
52277 }
52278#ifdef FREECIV_JSON_CONNECTION
52279 field_addr.name = "leader_is_male";
52280#endif /* FREECIV_JSON_CONNECTION */
52281 {
52282 int i;
52283
52284#ifdef FREECIV_JSON_CONNECTION
52285 /* Enter array. */
52286 field_addr.sub_location = plocation_elem_new(0);
52287#endif /* FREECIV_JSON_CONNECTION */
52288
52289 if (real_packet->leader_count > MAX_NUM_LEADERS) {
52290 RECEIVE_PACKET_FIELD_ERROR(leader_is_male, ": truncation array");
52291 }
52292 for (i = 0; i < real_packet->leader_count; i++) {
52293#ifdef FREECIV_JSON_CONNECTION
52294 field_addr.sub_location->number = i;
52295#endif /* FREECIV_JSON_CONNECTION */
52296 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->leader_is_male[i])) {
52297 RECEIVE_PACKET_FIELD_ERROR(leader_is_male);
52298 }
52299 }
52300
52301#ifdef FREECIV_JSON_CONNECTION
52302 /* Exit array. */
52303 FC_FREE(field_addr.sub_location);
52304#endif /* FREECIV_JSON_CONNECTION */
52305 }
52306#ifdef FREECIV_JSON_CONNECTION
52307 field_addr.name = "is_playable";
52308#endif /* FREECIV_JSON_CONNECTION */
52309 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_playable)) {
52310 RECEIVE_PACKET_FIELD_ERROR(is_playable);
52311 }
52312#ifdef FREECIV_JSON_CONNECTION
52313 field_addr.name = "barbarian_type";
52314#endif /* FREECIV_JSON_CONNECTION */
52315 {
52316 int readin;
52317
52318 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52319 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
52320 }
52321 real_packet->barbarian_type = readin;
52322 }
52323#ifdef FREECIV_JSON_CONNECTION
52324 field_addr.name = "nsets";
52325#endif /* FREECIV_JSON_CONNECTION */
52326 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
52327 RECEIVE_PACKET_FIELD_ERROR(nsets);
52328 }
52329#ifdef FREECIV_JSON_CONNECTION
52330 field_addr.name = "sets";
52331#endif /* FREECIV_JSON_CONNECTION */
52332 {
52333 int i;
52334
52335#ifdef FREECIV_JSON_CONNECTION
52336 /* Enter array. */
52337 field_addr.sub_location = plocation_elem_new(0);
52338#endif /* FREECIV_JSON_CONNECTION */
52339
52340 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
52341 RECEIVE_PACKET_FIELD_ERROR(sets, ": truncation array");
52342 }
52343 for (i = 0; i < real_packet->nsets; i++) {
52344#ifdef FREECIV_JSON_CONNECTION
52345 field_addr.sub_location->number = i;
52346#endif /* FREECIV_JSON_CONNECTION */
52347 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sets[i])) {
52348 RECEIVE_PACKET_FIELD_ERROR(sets);
52349 }
52350 }
52351
52352#ifdef FREECIV_JSON_CONNECTION
52353 /* Exit array. */
52354 FC_FREE(field_addr.sub_location);
52355#endif /* FREECIV_JSON_CONNECTION */
52356 }
52357#ifdef FREECIV_JSON_CONNECTION
52358 field_addr.name = "ngroups";
52359#endif /* FREECIV_JSON_CONNECTION */
52360 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
52361 RECEIVE_PACKET_FIELD_ERROR(ngroups);
52362 }
52363#ifdef FREECIV_JSON_CONNECTION
52364 field_addr.name = "groups";
52365#endif /* FREECIV_JSON_CONNECTION */
52366 {
52367 int i;
52368
52369#ifdef FREECIV_JSON_CONNECTION
52370 /* Enter array. */
52371 field_addr.sub_location = plocation_elem_new(0);
52372#endif /* FREECIV_JSON_CONNECTION */
52373
52374 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
52375 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
52376 }
52377 for (i = 0; i < real_packet->ngroups; i++) {
52378#ifdef FREECIV_JSON_CONNECTION
52379 field_addr.sub_location->number = i;
52380#endif /* FREECIV_JSON_CONNECTION */
52381 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->groups[i])) {
52382 RECEIVE_PACKET_FIELD_ERROR(groups);
52383 }
52384 }
52385
52386#ifdef FREECIV_JSON_CONNECTION
52387 /* Exit array. */
52388 FC_FREE(field_addr.sub_location);
52389#endif /* FREECIV_JSON_CONNECTION */
52390 }
52391#ifdef FREECIV_JSON_CONNECTION
52392 field_addr.name = "init_government_id";
52393#endif /* FREECIV_JSON_CONNECTION */
52394 {
52395 int readin;
52396
52397 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
52398 RECEIVE_PACKET_FIELD_ERROR(init_government_id);
52399 }
52400 real_packet->init_government_id = readin;
52401 }
52402#ifdef FREECIV_JSON_CONNECTION
52403 field_addr.name = "init_techs_count";
52404#endif /* FREECIV_JSON_CONNECTION */
52405 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs_count)) {
52406 RECEIVE_PACKET_FIELD_ERROR(init_techs_count);
52407 }
52408#ifdef FREECIV_JSON_CONNECTION
52409 field_addr.name = "init_techs";
52410#endif /* FREECIV_JSON_CONNECTION */
52411 {
52412 int i;
52413
52414#ifdef FREECIV_JSON_CONNECTION
52415 /* Enter array. */
52416 field_addr.sub_location = plocation_elem_new(0);
52417#endif /* FREECIV_JSON_CONNECTION */
52418
52419 if (real_packet->init_techs_count > MAX_NUM_TECH_LIST) {
52420 RECEIVE_PACKET_FIELD_ERROR(init_techs, ": truncation array");
52421 }
52422 for (i = 0; i < real_packet->init_techs_count; i++) {
52423#ifdef FREECIV_JSON_CONNECTION
52424 field_addr.sub_location->number = i;
52425#endif /* FREECIV_JSON_CONNECTION */
52426 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->init_techs[i])) {
52427 RECEIVE_PACKET_FIELD_ERROR(init_techs);
52428 }
52429 }
52430
52431#ifdef FREECIV_JSON_CONNECTION
52432 /* Exit array. */
52433 FC_FREE(field_addr.sub_location);
52434#endif /* FREECIV_JSON_CONNECTION */
52435 }
52436#ifdef FREECIV_JSON_CONNECTION
52437 field_addr.name = "init_units_count";
52438#endif /* FREECIV_JSON_CONNECTION */
52439 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_units_count)) {
52440 RECEIVE_PACKET_FIELD_ERROR(init_units_count);
52441 }
52442#ifdef FREECIV_JSON_CONNECTION
52443 field_addr.name = "init_units";
52444#endif /* FREECIV_JSON_CONNECTION */
52445 {
52446 int i;
52447
52448#ifdef FREECIV_JSON_CONNECTION
52449 /* Enter array. */
52450 field_addr.sub_location = plocation_elem_new(0);
52451#endif /* FREECIV_JSON_CONNECTION */
52452
52453 if (real_packet->init_units_count > MAX_NUM_UNIT_LIST) {
52454 RECEIVE_PACKET_FIELD_ERROR(init_units, ": truncation array");
52455 }
52456 for (i = 0; i < real_packet->init_units_count; i++) {
52457#ifdef FREECIV_JSON_CONNECTION
52458 field_addr.sub_location->number = i;
52459#endif /* FREECIV_JSON_CONNECTION */
52460 {
52461 int readin;
52462
52463 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
52464 RECEIVE_PACKET_FIELD_ERROR(init_units);
52465 }
52466 real_packet->init_units[i] = readin;
52467 }
52468 }
52469
52470#ifdef FREECIV_JSON_CONNECTION
52471 /* Exit array. */
52472 FC_FREE(field_addr.sub_location);
52473#endif /* FREECIV_JSON_CONNECTION */
52474 }
52475#ifdef FREECIV_JSON_CONNECTION
52476 field_addr.name = "init_buildings_count";
52477#endif /* FREECIV_JSON_CONNECTION */
52478 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_buildings_count)) {
52479 RECEIVE_PACKET_FIELD_ERROR(init_buildings_count);
52480 }
52481#ifdef FREECIV_JSON_CONNECTION
52482 field_addr.name = "init_buildings";
52483#endif /* FREECIV_JSON_CONNECTION */
52484 {
52485 int i;
52486
52487#ifdef FREECIV_JSON_CONNECTION
52488 /* Enter array. */
52489 field_addr.sub_location = plocation_elem_new(0);
52490#endif /* FREECIV_JSON_CONNECTION */
52491
52492 if (real_packet->init_buildings_count > MAX_NUM_BUILDING_LIST) {
52493 RECEIVE_PACKET_FIELD_ERROR(init_buildings, ": truncation array");
52494 }
52495 for (i = 0; i < real_packet->init_buildings_count; i++) {
52496#ifdef FREECIV_JSON_CONNECTION
52497 field_addr.sub_location->number = i;
52498#endif /* FREECIV_JSON_CONNECTION */
52499 {
52500 int readin;
52501
52502 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52503 RECEIVE_PACKET_FIELD_ERROR(init_buildings);
52504 }
52505 real_packet->init_buildings[i] = readin;
52506 }
52507 }
52508
52509#ifdef FREECIV_JSON_CONNECTION
52510 /* Exit array. */
52511 FC_FREE(field_addr.sub_location);
52512#endif /* FREECIV_JSON_CONNECTION */
52513 }
52514#endif
52515 log_packet_detailed("packet_ruleset_nation_100: got info about (%d)",
52516 real_packet->id);
52517
52518#ifdef FREECIV_DELTA_PROTOCOL
52519 if (nullptr == *hash) {
52520 *hash = genhash_new_full(hash_packet_ruleset_nation_100, cmp_packet_ruleset_nation_100,
52521 nullptr, nullptr, nullptr, destroy_packet_ruleset_nation);
52522 }
52523
52524 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
52525 *real_packet = *old;
52526 } else {
52527 /* packet is already initialized empty */
52528 log_packet_detailed(" no old info");
52529 }
52530
52531 if (BV_ISSET(fields, 0)) {
52532 log_packet_detailed(" got field 'translation_domain'");
52533#ifdef FREECIV_JSON_CONNECTION
52534 field_addr.name = "translation_domain";
52535#endif /* FREECIV_JSON_CONNECTION */
52536 if (!DIO_GET(string, &din, &field_addr, real_packet->translation_domain, sizeof(real_packet->translation_domain))) {
52537 RECEIVE_PACKET_FIELD_ERROR(translation_domain);
52538 }
52539 }
52540 if (BV_ISSET(fields, 1)) {
52541 log_packet_detailed(" got field 'adjective'");
52542#ifdef FREECIV_JSON_CONNECTION
52543 field_addr.name = "adjective";
52544#endif /* FREECIV_JSON_CONNECTION */
52545 if (!DIO_GET(string, &din, &field_addr, real_packet->adjective, sizeof(real_packet->adjective))) {
52546 RECEIVE_PACKET_FIELD_ERROR(adjective);
52547 }
52548 }
52549 if (BV_ISSET(fields, 2)) {
52550 log_packet_detailed(" got field 'rule_name'");
52551#ifdef FREECIV_JSON_CONNECTION
52552 field_addr.name = "rule_name";
52553#endif /* FREECIV_JSON_CONNECTION */
52554 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
52555 RECEIVE_PACKET_FIELD_ERROR(rule_name);
52556 }
52557 }
52558 if (BV_ISSET(fields, 3)) {
52559 log_packet_detailed(" got field 'noun_plural'");
52560#ifdef FREECIV_JSON_CONNECTION
52561 field_addr.name = "noun_plural";
52562#endif /* FREECIV_JSON_CONNECTION */
52563 if (!DIO_GET(string, &din, &field_addr, real_packet->noun_plural, sizeof(real_packet->noun_plural))) {
52564 RECEIVE_PACKET_FIELD_ERROR(noun_plural);
52565 }
52566 }
52567 if (BV_ISSET(fields, 4)) {
52568 log_packet_detailed(" got field 'graphic_str'");
52569#ifdef FREECIV_JSON_CONNECTION
52570 field_addr.name = "graphic_str";
52571#endif /* FREECIV_JSON_CONNECTION */
52572 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
52573 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
52574 }
52575 }
52576 if (BV_ISSET(fields, 5)) {
52577 log_packet_detailed(" got field 'graphic_alt'");
52578#ifdef FREECIV_JSON_CONNECTION
52579 field_addr.name = "graphic_alt";
52580#endif /* FREECIV_JSON_CONNECTION */
52581 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
52582 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
52583 }
52584 }
52585 if (BV_ISSET(fields, 6)) {
52586 log_packet_detailed(" got field 'legend'");
52587#ifdef FREECIV_JSON_CONNECTION
52588 field_addr.name = "legend";
52589#endif /* FREECIV_JSON_CONNECTION */
52590 if (!DIO_GET(string, &din, &field_addr, real_packet->legend, sizeof(real_packet->legend))) {
52591 RECEIVE_PACKET_FIELD_ERROR(legend);
52592 }
52593 }
52594 if (BV_ISSET(fields, 7)) {
52595 log_packet_detailed(" got field 'style'");
52596#ifdef FREECIV_JSON_CONNECTION
52597 field_addr.name = "style";
52598#endif /* FREECIV_JSON_CONNECTION */
52599 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
52600 RECEIVE_PACKET_FIELD_ERROR(style);
52601 }
52602 }
52603 if (BV_ISSET(fields, 8)) {
52604 log_packet_detailed(" got field 'leader_count'");
52605#ifdef FREECIV_JSON_CONNECTION
52606 field_addr.name = "leader_count";
52607#endif /* FREECIV_JSON_CONNECTION */
52608 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->leader_count)) {
52609 RECEIVE_PACKET_FIELD_ERROR(leader_count);
52610 }
52611 }
52612 if (BV_ISSET(fields, 9)) {
52613 log_packet_detailed(" got field 'leader_name'");
52614#ifdef FREECIV_JSON_CONNECTION
52615 field_addr.name = "leader_name";
52616#endif /* FREECIV_JSON_CONNECTION */
52617 {
52618 int i;
52619
52620#ifdef FREECIV_JSON_CONNECTION
52621 /* Enter array. */
52622 field_addr.sub_location = plocation_elem_new(0);
52623#endif /* FREECIV_JSON_CONNECTION */
52624
52625 if (real_packet->leader_count > MAX_NUM_LEADERS) {
52626 RECEIVE_PACKET_FIELD_ERROR(leader_name, ": truncation array");
52627 }
52628 for (i = 0; i < real_packet->leader_count; i++) {
52629#ifdef FREECIV_JSON_CONNECTION
52630 field_addr.sub_location->number = i;
52631#endif /* FREECIV_JSON_CONNECTION */
52632 if (!DIO_GET(string, &din, &field_addr, real_packet->leader_name[i], sizeof(real_packet->leader_name[i]))) {
52633 RECEIVE_PACKET_FIELD_ERROR(leader_name);
52634 }
52635 }
52636
52637#ifdef FREECIV_JSON_CONNECTION
52638 /* Exit array. */
52639 FC_FREE(field_addr.sub_location);
52640#endif /* FREECIV_JSON_CONNECTION */
52641 }
52642 }
52643 if (BV_ISSET(fields, 10)) {
52644 log_packet_detailed(" got field 'leader_is_male'");
52645#ifdef FREECIV_JSON_CONNECTION
52646 field_addr.name = "leader_is_male";
52647#endif /* FREECIV_JSON_CONNECTION */
52648 {
52649 int i;
52650
52651#ifdef FREECIV_JSON_CONNECTION
52652 /* Enter array. */
52653 field_addr.sub_location = plocation_elem_new(0);
52654#endif /* FREECIV_JSON_CONNECTION */
52655
52656 if (real_packet->leader_count > MAX_NUM_LEADERS) {
52657 RECEIVE_PACKET_FIELD_ERROR(leader_is_male, ": truncation array");
52658 }
52659 for (i = 0; i < real_packet->leader_count; i++) {
52660#ifdef FREECIV_JSON_CONNECTION
52661 field_addr.sub_location->number = i;
52662#endif /* FREECIV_JSON_CONNECTION */
52663 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->leader_is_male[i])) {
52664 RECEIVE_PACKET_FIELD_ERROR(leader_is_male);
52665 }
52666 }
52667
52668#ifdef FREECIV_JSON_CONNECTION
52669 /* Exit array. */
52670 FC_FREE(field_addr.sub_location);
52671#endif /* FREECIV_JSON_CONNECTION */
52672 }
52673 }
52674 real_packet->is_playable = BV_ISSET(fields, 11);
52675 if (BV_ISSET(fields, 12)) {
52676 log_packet_detailed(" got field 'barbarian_type'");
52677#ifdef FREECIV_JSON_CONNECTION
52678 field_addr.name = "barbarian_type";
52679#endif /* FREECIV_JSON_CONNECTION */
52680 {
52681 int readin;
52682
52683 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52684 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
52685 }
52686 real_packet->barbarian_type = readin;
52687 }
52688 }
52689 if (BV_ISSET(fields, 13)) {
52690 log_packet_detailed(" got field 'nsets'");
52691#ifdef FREECIV_JSON_CONNECTION
52692 field_addr.name = "nsets";
52693#endif /* FREECIV_JSON_CONNECTION */
52694 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
52695 RECEIVE_PACKET_FIELD_ERROR(nsets);
52696 }
52697 }
52698 if (BV_ISSET(fields, 14)) {
52699 log_packet_detailed(" got field 'sets'");
52700#ifdef FREECIV_JSON_CONNECTION
52701 field_addr.name = "sets";
52702#endif /* FREECIV_JSON_CONNECTION */
52703 {
52704 int i;
52705
52706#ifdef FREECIV_JSON_CONNECTION
52707 /* Enter array. */
52708 field_addr.sub_location = plocation_elem_new(0);
52709#endif /* FREECIV_JSON_CONNECTION */
52710
52711 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
52712 RECEIVE_PACKET_FIELD_ERROR(sets, ": truncation array");
52713 }
52714 for (i = 0; i < real_packet->nsets; i++) {
52715#ifdef FREECIV_JSON_CONNECTION
52716 field_addr.sub_location->number = i;
52717#endif /* FREECIV_JSON_CONNECTION */
52718 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sets[i])) {
52719 RECEIVE_PACKET_FIELD_ERROR(sets);
52720 }
52721 }
52722
52723#ifdef FREECIV_JSON_CONNECTION
52724 /* Exit array. */
52725 FC_FREE(field_addr.sub_location);
52726#endif /* FREECIV_JSON_CONNECTION */
52727 }
52728 }
52729 if (BV_ISSET(fields, 15)) {
52730 log_packet_detailed(" got field 'ngroups'");
52731#ifdef FREECIV_JSON_CONNECTION
52732 field_addr.name = "ngroups";
52733#endif /* FREECIV_JSON_CONNECTION */
52734 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
52735 RECEIVE_PACKET_FIELD_ERROR(ngroups);
52736 }
52737 }
52738 if (BV_ISSET(fields, 16)) {
52739 log_packet_detailed(" got field 'groups'");
52740#ifdef FREECIV_JSON_CONNECTION
52741 field_addr.name = "groups";
52742#endif /* FREECIV_JSON_CONNECTION */
52743 {
52744 int i;
52745
52746#ifdef FREECIV_JSON_CONNECTION
52747 /* Enter array. */
52748 field_addr.sub_location = plocation_elem_new(0);
52749#endif /* FREECIV_JSON_CONNECTION */
52750
52751 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
52752 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
52753 }
52754 for (i = 0; i < real_packet->ngroups; i++) {
52755#ifdef FREECIV_JSON_CONNECTION
52756 field_addr.sub_location->number = i;
52757#endif /* FREECIV_JSON_CONNECTION */
52758 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->groups[i])) {
52759 RECEIVE_PACKET_FIELD_ERROR(groups);
52760 }
52761 }
52762
52763#ifdef FREECIV_JSON_CONNECTION
52764 /* Exit array. */
52765 FC_FREE(field_addr.sub_location);
52766#endif /* FREECIV_JSON_CONNECTION */
52767 }
52768 }
52769 if (BV_ISSET(fields, 17)) {
52770 log_packet_detailed(" got field 'init_government_id'");
52771#ifdef FREECIV_JSON_CONNECTION
52772 field_addr.name = "init_government_id";
52773#endif /* FREECIV_JSON_CONNECTION */
52774 {
52775 int readin;
52776
52777 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
52778 RECEIVE_PACKET_FIELD_ERROR(init_government_id);
52779 }
52780 real_packet->init_government_id = readin;
52781 }
52782 }
52783 if (BV_ISSET(fields, 18)) {
52784 log_packet_detailed(" got field 'init_techs_count'");
52785#ifdef FREECIV_JSON_CONNECTION
52786 field_addr.name = "init_techs_count";
52787#endif /* FREECIV_JSON_CONNECTION */
52788 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs_count)) {
52789 RECEIVE_PACKET_FIELD_ERROR(init_techs_count);
52790 }
52791 }
52792 if (BV_ISSET(fields, 19)) {
52793 log_packet_detailed(" got field 'init_techs'");
52794#ifdef FREECIV_JSON_CONNECTION
52795 field_addr.name = "init_techs";
52796#endif /* FREECIV_JSON_CONNECTION */
52797 {
52798 int i;
52799
52800#ifdef FREECIV_JSON_CONNECTION
52801 /* Enter array. */
52802 field_addr.sub_location = plocation_elem_new(0);
52803#endif /* FREECIV_JSON_CONNECTION */
52804
52805 if (real_packet->init_techs_count > MAX_NUM_TECH_LIST) {
52806 RECEIVE_PACKET_FIELD_ERROR(init_techs, ": truncation array");
52807 }
52808 for (i = 0; i < real_packet->init_techs_count; i++) {
52809#ifdef FREECIV_JSON_CONNECTION
52810 field_addr.sub_location->number = i;
52811#endif /* FREECIV_JSON_CONNECTION */
52812 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->init_techs[i])) {
52813 RECEIVE_PACKET_FIELD_ERROR(init_techs);
52814 }
52815 }
52816
52817#ifdef FREECIV_JSON_CONNECTION
52818 /* Exit array. */
52819 FC_FREE(field_addr.sub_location);
52820#endif /* FREECIV_JSON_CONNECTION */
52821 }
52822 }
52823 if (BV_ISSET(fields, 20)) {
52824 log_packet_detailed(" got field 'init_units_count'");
52825#ifdef FREECIV_JSON_CONNECTION
52826 field_addr.name = "init_units_count";
52827#endif /* FREECIV_JSON_CONNECTION */
52828 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_units_count)) {
52829 RECEIVE_PACKET_FIELD_ERROR(init_units_count);
52830 }
52831 }
52832 if (BV_ISSET(fields, 21)) {
52833 log_packet_detailed(" got field 'init_units'");
52834#ifdef FREECIV_JSON_CONNECTION
52835 field_addr.name = "init_units";
52836#endif /* FREECIV_JSON_CONNECTION */
52837 {
52838 int i;
52839
52840#ifdef FREECIV_JSON_CONNECTION
52841 /* Enter array. */
52842 field_addr.sub_location = plocation_elem_new(0);
52843#endif /* FREECIV_JSON_CONNECTION */
52844
52845 if (real_packet->init_units_count > MAX_NUM_UNIT_LIST) {
52846 RECEIVE_PACKET_FIELD_ERROR(init_units, ": truncation array");
52847 }
52848 for (i = 0; i < real_packet->init_units_count; i++) {
52849#ifdef FREECIV_JSON_CONNECTION
52850 field_addr.sub_location->number = i;
52851#endif /* FREECIV_JSON_CONNECTION */
52852 {
52853 int readin;
52854
52855 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
52856 RECEIVE_PACKET_FIELD_ERROR(init_units);
52857 }
52858 real_packet->init_units[i] = readin;
52859 }
52860 }
52861
52862#ifdef FREECIV_JSON_CONNECTION
52863 /* Exit array. */
52864 FC_FREE(field_addr.sub_location);
52865#endif /* FREECIV_JSON_CONNECTION */
52866 }
52867 }
52868 if (BV_ISSET(fields, 22)) {
52869 log_packet_detailed(" got field 'init_buildings_count'");
52870#ifdef FREECIV_JSON_CONNECTION
52871 field_addr.name = "init_buildings_count";
52872#endif /* FREECIV_JSON_CONNECTION */
52873 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_buildings_count)) {
52874 RECEIVE_PACKET_FIELD_ERROR(init_buildings_count);
52875 }
52876 }
52877 if (BV_ISSET(fields, 23)) {
52878 log_packet_detailed(" got field 'init_buildings'");
52879#ifdef FREECIV_JSON_CONNECTION
52880 field_addr.name = "init_buildings";
52881#endif /* FREECIV_JSON_CONNECTION */
52882 {
52883 int i;
52884
52885#ifdef FREECIV_JSON_CONNECTION
52886 /* Enter array. */
52887 field_addr.sub_location = plocation_elem_new(0);
52888#endif /* FREECIV_JSON_CONNECTION */
52889
52890 if (real_packet->init_buildings_count > MAX_NUM_BUILDING_LIST) {
52891 RECEIVE_PACKET_FIELD_ERROR(init_buildings, ": truncation array");
52892 }
52893 for (i = 0; i < real_packet->init_buildings_count; i++) {
52894#ifdef FREECIV_JSON_CONNECTION
52895 field_addr.sub_location->number = i;
52896#endif /* FREECIV_JSON_CONNECTION */
52897 {
52898 int readin;
52899
52900 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52901 RECEIVE_PACKET_FIELD_ERROR(init_buildings);
52902 }
52903 real_packet->init_buildings[i] = readin;
52904 }
52905 }
52906
52907#ifdef FREECIV_JSON_CONNECTION
52908 /* Exit array. */
52909 FC_FREE(field_addr.sub_location);
52910#endif /* FREECIV_JSON_CONNECTION */
52911 }
52912 }
52913
52914 if (nullptr == old) {
52915 old = fc_malloc(sizeof(*old));
52916 init_packet_ruleset_nation(old);
52917 *old = *real_packet;
52918 genhash_insert(*hash, old, old);
52919 } else {
52920 *old = *real_packet;
52921 }
52922
52923#endif /* FREECIV_DELTA_PROTOCOL */
52924 RECEIVE_PACKET_END(real_packet);
52925#undef FREE_PACKET_STRUCT
52926}
52927
52928 static int send_packet_ruleset_nation_100(struct connection *pc, const struct packet_ruleset_nation *packet)
52929{
52930 const struct packet_ruleset_nation *real_packet = packet;
52931 int e;
52932#ifdef FREECIV_DELTA_PROTOCOL
52933 packet_ruleset_nation_100_fields fields;
52934 struct packet_ruleset_nation *old;
52935 bool differ;
52936 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION;
52937#endif /* FREECIV_DELTA_PROTOCOL */
52938 SEND_PACKET_START(PACKET_RULESET_NATION);
52939#ifdef FREECIV_JSON_CONNECTION
52940 struct plocation field_addr;
52941 {
52942 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
52943 field_addr = *field_addr_tmp;
52944 FC_FREE(field_addr_tmp);
52945 }
52946#endif /* FREECIV_JSON_CONNECTION */
52947
52948 log_packet_detailed("packet_ruleset_nation_100: sending info about (%d)",
52949 real_packet->id);
52950
52951#ifdef FREECIV_DELTA_PROTOCOL
52952 if (nullptr == *hash) {
52953 *hash = genhash_new_full(hash_packet_ruleset_nation_100, cmp_packet_ruleset_nation_100,
52954 nullptr, nullptr, nullptr, destroy_packet_ruleset_nation);
52955 }
52956 BV_CLR_ALL(fields);
52957
52958 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
52959 old = fc_malloc(sizeof(*old));
52960 /* temporary bitcopy just to insert correctly */
52961 *old = *real_packet;
52962 genhash_insert(*hash, old, old);
52963 init_packet_ruleset_nation(old);
52964 }
52965 differ = (strcmp(old->translation_domain, real_packet->translation_domain) != 0);
52966 if (differ) {
52967 BV_SET(fields, 0);
52968 }
52969
52970 differ = (strcmp(old->adjective, real_packet->adjective) != 0);
52971 if (differ) {
52972 BV_SET(fields, 1);
52973 }
52974
52975 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
52976 if (differ) {
52977 BV_SET(fields, 2);
52978 }
52979
52980 differ = (strcmp(old->noun_plural, real_packet->noun_plural) != 0);
52981 if (differ) {
52982 BV_SET(fields, 3);
52983 }
52984
52985 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
52986 if (differ) {
52987 BV_SET(fields, 4);
52988 }
52989
52990 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
52991 if (differ) {
52992 BV_SET(fields, 5);
52993 }
52994
52995 differ = (strcmp(old->legend, real_packet->legend) != 0);
52996 if (differ) {
52997 BV_SET(fields, 6);
52998 }
52999
53000 differ = (old->style != real_packet->style);
53001 if (differ) {
53002 BV_SET(fields, 7);
53003 }
53004
53005 differ = (old->leader_count != real_packet->leader_count);
53006 if (differ) {
53007 BV_SET(fields, 8);
53008 }
53009
53010 differ = (old->leader_count != real_packet->leader_count);
53011 if (!differ) {
53012 int i;
53013
53014 for (i = 0; i < real_packet->leader_count; i++) {
53015 differ = (strcmp(old->leader_name[i], real_packet->leader_name[i]) != 0);
53016 if (differ) {
53017 break;
53018 }
53019 }
53020 }
53021 if (differ) {
53022 BV_SET(fields, 9);
53023 }
53024
53025 differ = (old->leader_count != real_packet->leader_count);
53026 if (!differ) {
53027 int i;
53028
53029 for (i = 0; i < real_packet->leader_count; i++) {
53030 differ = (old->leader_is_male[i] != real_packet->leader_is_male[i]);
53031 if (differ) {
53032 break;
53033 }
53034 }
53035 }
53036 if (differ) {
53037 BV_SET(fields, 10);
53038 }
53039
53040 if (packet->is_playable) {
53041 BV_SET(fields, 11);
53042 }
53043
53044 differ = (old->barbarian_type != real_packet->barbarian_type);
53045 if (differ) {
53046 BV_SET(fields, 12);
53047 }
53048
53049 differ = (old->nsets != real_packet->nsets);
53050 if (differ) {
53051 BV_SET(fields, 13);
53052 }
53053
53054 differ = (old->nsets != real_packet->nsets);
53055 if (!differ) {
53056 int i;
53057
53058 for (i = 0; i < real_packet->nsets; i++) {
53059 differ = (old->sets[i] != real_packet->sets[i]);
53060 if (differ) {
53061 break;
53062 }
53063 }
53064 }
53065 if (differ) {
53066 BV_SET(fields, 14);
53067 }
53068
53069 differ = (old->ngroups != real_packet->ngroups);
53070 if (differ) {
53071 BV_SET(fields, 15);
53072 }
53073
53074 differ = (old->ngroups != real_packet->ngroups);
53075 if (!differ) {
53076 int i;
53077
53078 for (i = 0; i < real_packet->ngroups; i++) {
53079 differ = (old->groups[i] != real_packet->groups[i]);
53080 if (differ) {
53081 break;
53082 }
53083 }
53084 }
53085 if (differ) {
53086 BV_SET(fields, 16);
53087 }
53088
53089 differ = (old->init_government_id != real_packet->init_government_id);
53090 if (differ) {
53091 BV_SET(fields, 17);
53092 }
53093
53094 differ = (old->init_techs_count != real_packet->init_techs_count);
53095 if (differ) {
53096 BV_SET(fields, 18);
53097 }
53098
53099 differ = (old->init_techs_count != real_packet->init_techs_count);
53100 if (!differ) {
53101 int i;
53102
53103 for (i = 0; i < real_packet->init_techs_count; i++) {
53104 differ = (old->init_techs[i] != real_packet->init_techs[i]);
53105 if (differ) {
53106 break;
53107 }
53108 }
53109 }
53110 if (differ) {
53111 BV_SET(fields, 19);
53112 }
53113
53114 differ = (old->init_units_count != real_packet->init_units_count);
53115 if (differ) {
53116 BV_SET(fields, 20);
53117 }
53118
53119 differ = (old->init_units_count != real_packet->init_units_count);
53120 if (!differ) {
53121 int i;
53122
53123 for (i = 0; i < real_packet->init_units_count; i++) {
53124 differ = (old->init_units[i] != real_packet->init_units[i]);
53125 if (differ) {
53126 break;
53127 }
53128 }
53129 }
53130 if (differ) {
53131 BV_SET(fields, 21);
53132 }
53133
53134 differ = (old->init_buildings_count != real_packet->init_buildings_count);
53135 if (differ) {
53136 BV_SET(fields, 22);
53137 }
53138
53139 differ = (old->init_buildings_count != real_packet->init_buildings_count);
53140 if (!differ) {
53141 int i;
53142
53143 for (i = 0; i < real_packet->init_buildings_count; i++) {
53144 differ = (old->init_buildings[i] != real_packet->init_buildings[i]);
53145 if (differ) {
53146 break;
53147 }
53148 }
53149 }
53150 if (differ) {
53151 BV_SET(fields, 23);
53152 }
53153
53154
53155#ifdef FREECIV_JSON_CONNECTION
53156 field_addr.name = "fields";
53157#endif /* FREECIV_JSON_CONNECTION */
53158 e = 0;
53159 e |= DIO_BV_PUT(&dout, &field_addr, fields);
53160 if (e) {
53161 log_packet_detailed("fields bitvector error detected");
53162 }
53163#ifdef FREECIV_JSON_CONNECTION
53164 field_addr.name = "id";
53165#endif /* FREECIV_JSON_CONNECTION */
53166 e = 0;
53167 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
53168 if (e) {
53169 log_packet_detailed("'id' field error detected");
53170 }
53171
53172 if (BV_ISSET(fields, 0)) {
53173 log_packet_detailed(" field 'translation_domain' has changed");
53174#ifdef FREECIV_JSON_CONNECTION
53175 field_addr.name = "translation_domain";
53176#endif /* FREECIV_JSON_CONNECTION */
53177 e = 0;
53178 e |= DIO_PUT(string, &dout, &field_addr, real_packet->translation_domain);
53179 if (e) {
53180 log_packet_detailed("'translation_domain' field error detected");
53181 }
53182 }
53183 if (BV_ISSET(fields, 1)) {
53184 log_packet_detailed(" field 'adjective' has changed");
53185#ifdef FREECIV_JSON_CONNECTION
53186 field_addr.name = "adjective";
53187#endif /* FREECIV_JSON_CONNECTION */
53188 e = 0;
53189 e |= DIO_PUT(string, &dout, &field_addr, real_packet->adjective);
53190 if (e) {
53191 log_packet_detailed("'adjective' field error detected");
53192 }
53193 }
53194 if (BV_ISSET(fields, 2)) {
53195 log_packet_detailed(" field 'rule_name' has changed");
53196#ifdef FREECIV_JSON_CONNECTION
53197 field_addr.name = "rule_name";
53198#endif /* FREECIV_JSON_CONNECTION */
53199 e = 0;
53200 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
53201 if (e) {
53202 log_packet_detailed("'rule_name' field error detected");
53203 }
53204 }
53205 if (BV_ISSET(fields, 3)) {
53206 log_packet_detailed(" field 'noun_plural' has changed");
53207#ifdef FREECIV_JSON_CONNECTION
53208 field_addr.name = "noun_plural";
53209#endif /* FREECIV_JSON_CONNECTION */
53210 e = 0;
53211 e |= DIO_PUT(string, &dout, &field_addr, real_packet->noun_plural);
53212 if (e) {
53213 log_packet_detailed("'noun_plural' field error detected");
53214 }
53215 }
53216 if (BV_ISSET(fields, 4)) {
53217 log_packet_detailed(" field 'graphic_str' has changed");
53218#ifdef FREECIV_JSON_CONNECTION
53219 field_addr.name = "graphic_str";
53220#endif /* FREECIV_JSON_CONNECTION */
53221 e = 0;
53222 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
53223 if (e) {
53224 log_packet_detailed("'graphic_str' field error detected");
53225 }
53226 }
53227 if (BV_ISSET(fields, 5)) {
53228 log_packet_detailed(" field 'graphic_alt' has changed");
53229#ifdef FREECIV_JSON_CONNECTION
53230 field_addr.name = "graphic_alt";
53231#endif /* FREECIV_JSON_CONNECTION */
53232 e = 0;
53233 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
53234 if (e) {
53235 log_packet_detailed("'graphic_alt' field error detected");
53236 }
53237 }
53238 if (BV_ISSET(fields, 6)) {
53239 log_packet_detailed(" field 'legend' has changed");
53240#ifdef FREECIV_JSON_CONNECTION
53241 field_addr.name = "legend";
53242#endif /* FREECIV_JSON_CONNECTION */
53243 e = 0;
53244 e |= DIO_PUT(string, &dout, &field_addr, real_packet->legend);
53245 if (e) {
53246 log_packet_detailed("'legend' field error detected");
53247 }
53248 }
53249 if (BV_ISSET(fields, 7)) {
53250 log_packet_detailed(" field 'style' has changed");
53251#ifdef FREECIV_JSON_CONNECTION
53252 field_addr.name = "style";
53253#endif /* FREECIV_JSON_CONNECTION */
53254 e = 0;
53255 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
53256 if (e) {
53257 log_packet_detailed("'style' field error detected");
53258 }
53259 }
53260 if (BV_ISSET(fields, 8)) {
53261 log_packet_detailed(" field 'leader_count' has changed");
53262#ifdef FREECIV_JSON_CONNECTION
53263 field_addr.name = "leader_count";
53264#endif /* FREECIV_JSON_CONNECTION */
53265 e = 0;
53266 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->leader_count);
53267 if (e) {
53268 log_packet_detailed("'leader_count' field error detected");
53269 }
53270 }
53271 if (BV_ISSET(fields, 9)) {
53272 log_packet_detailed(" field 'leader_name' has changed");
53273#ifdef FREECIV_JSON_CONNECTION
53274 field_addr.name = "leader_name";
53275#endif /* FREECIV_JSON_CONNECTION */
53276 e = 0;
53277 {
53278 int i;
53279
53280#ifdef FREECIV_JSON_CONNECTION
53281 /* Create the array. */
53282 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
53283
53284 /* Enter the array. */
53285 field_addr.sub_location = plocation_elem_new(0);
53286#endif /* FREECIV_JSON_CONNECTION */
53287
53288 for (i = 0; i < real_packet->leader_count; i++) {
53289#ifdef FREECIV_JSON_CONNECTION
53290 /* Next array element. */
53291 field_addr.sub_location->number = i;
53292#endif /* FREECIV_JSON_CONNECTION */
53293 e |= DIO_PUT(string, &dout, &field_addr, real_packet->leader_name[i]);
53294 }
53295
53296#ifdef FREECIV_JSON_CONNECTION
53297 /* Exit array. */
53298 FC_FREE(field_addr.sub_location);
53299#endif /* FREECIV_JSON_CONNECTION */
53300 }
53301 if (e) {
53302 log_packet_detailed("'leader_name' field error detected");
53303 }
53304 }
53305 if (BV_ISSET(fields, 10)) {
53306 log_packet_detailed(" field 'leader_is_male' has changed");
53307#ifdef FREECIV_JSON_CONNECTION
53308 field_addr.name = "leader_is_male";
53309#endif /* FREECIV_JSON_CONNECTION */
53310 e = 0;
53311 {
53312 int i;
53313
53314#ifdef FREECIV_JSON_CONNECTION
53315 /* Create the array. */
53316 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
53317
53318 /* Enter the array. */
53319 field_addr.sub_location = plocation_elem_new(0);
53320#endif /* FREECIV_JSON_CONNECTION */
53321
53322 for (i = 0; i < real_packet->leader_count; i++) {
53323#ifdef FREECIV_JSON_CONNECTION
53324 /* Next array element. */
53325 field_addr.sub_location->number = i;
53326#endif /* FREECIV_JSON_CONNECTION */
53327 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->leader_is_male[i]);
53328 }
53329
53330#ifdef FREECIV_JSON_CONNECTION
53331 /* Exit array. */
53332 FC_FREE(field_addr.sub_location);
53333#endif /* FREECIV_JSON_CONNECTION */
53334 }
53335 if (e) {
53336 log_packet_detailed("'leader_is_male' field error detected");
53337 }
53338 }
53339 /* field 11 is folded into the header */
53340 if (BV_ISSET(fields, 12)) {
53341 log_packet_detailed(" field 'barbarian_type' has changed");
53342#ifdef FREECIV_JSON_CONNECTION
53343 field_addr.name = "barbarian_type";
53344#endif /* FREECIV_JSON_CONNECTION */
53345 e = 0;
53346 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
53347 if (e) {
53348 log_packet_detailed("'barbarian_type' field error detected");
53349 }
53350 }
53351 if (BV_ISSET(fields, 13)) {
53352 log_packet_detailed(" field 'nsets' has changed");
53353#ifdef FREECIV_JSON_CONNECTION
53354 field_addr.name = "nsets";
53355#endif /* FREECIV_JSON_CONNECTION */
53356 e = 0;
53357 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
53358 if (e) {
53359 log_packet_detailed("'nsets' field error detected");
53360 }
53361 }
53362 if (BV_ISSET(fields, 14)) {
53363 log_packet_detailed(" field 'sets' has changed");
53364#ifdef FREECIV_JSON_CONNECTION
53365 field_addr.name = "sets";
53366#endif /* FREECIV_JSON_CONNECTION */
53367 e = 0;
53368 {
53369 int i;
53370
53371#ifdef FREECIV_JSON_CONNECTION
53372 /* Create the array. */
53373 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
53374
53375 /* Enter the array. */
53376 field_addr.sub_location = plocation_elem_new(0);
53377#endif /* FREECIV_JSON_CONNECTION */
53378
53379 for (i = 0; i < real_packet->nsets; i++) {
53380#ifdef FREECIV_JSON_CONNECTION
53381 /* Next array element. */
53382 field_addr.sub_location->number = i;
53383#endif /* FREECIV_JSON_CONNECTION */
53384 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sets[i]);
53385 }
53386
53387#ifdef FREECIV_JSON_CONNECTION
53388 /* Exit array. */
53389 FC_FREE(field_addr.sub_location);
53390#endif /* FREECIV_JSON_CONNECTION */
53391 }
53392 if (e) {
53393 log_packet_detailed("'sets' field error detected");
53394 }
53395 }
53396 if (BV_ISSET(fields, 15)) {
53397 log_packet_detailed(" field 'ngroups' has changed");
53398#ifdef FREECIV_JSON_CONNECTION
53399 field_addr.name = "ngroups";
53400#endif /* FREECIV_JSON_CONNECTION */
53401 e = 0;
53402 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
53403 if (e) {
53404 log_packet_detailed("'ngroups' field error detected");
53405 }
53406 }
53407 if (BV_ISSET(fields, 16)) {
53408 log_packet_detailed(" field 'groups' has changed");
53409#ifdef FREECIV_JSON_CONNECTION
53410 field_addr.name = "groups";
53411#endif /* FREECIV_JSON_CONNECTION */
53412 e = 0;
53413 {
53414 int i;
53415
53416#ifdef FREECIV_JSON_CONNECTION
53417 /* Create the array. */
53418 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
53419
53420 /* Enter the array. */
53421 field_addr.sub_location = plocation_elem_new(0);
53422#endif /* FREECIV_JSON_CONNECTION */
53423
53424 for (i = 0; i < real_packet->ngroups; i++) {
53425#ifdef FREECIV_JSON_CONNECTION
53426 /* Next array element. */
53427 field_addr.sub_location->number = i;
53428#endif /* FREECIV_JSON_CONNECTION */
53429 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->groups[i]);
53430 }
53431
53432#ifdef FREECIV_JSON_CONNECTION
53433 /* Exit array. */
53434 FC_FREE(field_addr.sub_location);
53435#endif /* FREECIV_JSON_CONNECTION */
53436 }
53437 if (e) {
53438 log_packet_detailed("'groups' field error detected");
53439 }
53440 }
53441 if (BV_ISSET(fields, 17)) {
53442 log_packet_detailed(" field 'init_government_id' has changed");
53443#ifdef FREECIV_JSON_CONNECTION
53444 field_addr.name = "init_government_id";
53445#endif /* FREECIV_JSON_CONNECTION */
53446 e = 0;
53447 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->init_government_id);
53448 if (e) {
53449 log_packet_detailed("'init_government_id' field error detected");
53450 }
53451 }
53452 if (BV_ISSET(fields, 18)) {
53453 log_packet_detailed(" field 'init_techs_count' has changed");
53454#ifdef FREECIV_JSON_CONNECTION
53455 field_addr.name = "init_techs_count";
53456#endif /* FREECIV_JSON_CONNECTION */
53457 e = 0;
53458 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs_count);
53459 if (e) {
53460 log_packet_detailed("'init_techs_count' field error detected");
53461 }
53462 }
53463 if (BV_ISSET(fields, 19)) {
53464 log_packet_detailed(" field 'init_techs' has changed");
53465#ifdef FREECIV_JSON_CONNECTION
53466 field_addr.name = "init_techs";
53467#endif /* FREECIV_JSON_CONNECTION */
53468 e = 0;
53469 {
53470 int i;
53471
53472#ifdef FREECIV_JSON_CONNECTION
53473 /* Create the array. */
53474 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_techs_count);
53475
53476 /* Enter the array. */
53477 field_addr.sub_location = plocation_elem_new(0);
53478#endif /* FREECIV_JSON_CONNECTION */
53479
53480 for (i = 0; i < real_packet->init_techs_count; i++) {
53481#ifdef FREECIV_JSON_CONNECTION
53482 /* Next array element. */
53483 field_addr.sub_location->number = i;
53484#endif /* FREECIV_JSON_CONNECTION */
53485 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->init_techs[i]);
53486 }
53487
53488#ifdef FREECIV_JSON_CONNECTION
53489 /* Exit array. */
53490 FC_FREE(field_addr.sub_location);
53491#endif /* FREECIV_JSON_CONNECTION */
53492 }
53493 if (e) {
53494 log_packet_detailed("'init_techs' field error detected");
53495 }
53496 }
53497 if (BV_ISSET(fields, 20)) {
53498 log_packet_detailed(" field 'init_units_count' has changed");
53499#ifdef FREECIV_JSON_CONNECTION
53500 field_addr.name = "init_units_count";
53501#endif /* FREECIV_JSON_CONNECTION */
53502 e = 0;
53503 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units_count);
53504 if (e) {
53505 log_packet_detailed("'init_units_count' field error detected");
53506 }
53507 }
53508 if (BV_ISSET(fields, 21)) {
53509 log_packet_detailed(" field 'init_units' has changed");
53510#ifdef FREECIV_JSON_CONNECTION
53511 field_addr.name = "init_units";
53512#endif /* FREECIV_JSON_CONNECTION */
53513 e = 0;
53514 {
53515 int i;
53516
53517#ifdef FREECIV_JSON_CONNECTION
53518 /* Create the array. */
53519 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_units_count);
53520
53521 /* Enter the array. */
53522 field_addr.sub_location = plocation_elem_new(0);
53523#endif /* FREECIV_JSON_CONNECTION */
53524
53525 for (i = 0; i < real_packet->init_units_count; i++) {
53526#ifdef FREECIV_JSON_CONNECTION
53527 /* Next array element. */
53528 field_addr.sub_location->number = i;
53529#endif /* FREECIV_JSON_CONNECTION */
53530 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->init_units[i]);
53531 }
53532
53533#ifdef FREECIV_JSON_CONNECTION
53534 /* Exit array. */
53535 FC_FREE(field_addr.sub_location);
53536#endif /* FREECIV_JSON_CONNECTION */
53537 }
53538 if (e) {
53539 log_packet_detailed("'init_units' field error detected");
53540 }
53541 }
53542 if (BV_ISSET(fields, 22)) {
53543 log_packet_detailed(" field 'init_buildings_count' has changed");
53544#ifdef FREECIV_JSON_CONNECTION
53545 field_addr.name = "init_buildings_count";
53546#endif /* FREECIV_JSON_CONNECTION */
53547 e = 0;
53548 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings_count);
53549 if (e) {
53550 log_packet_detailed("'init_buildings_count' field error detected");
53551 }
53552 }
53553 if (BV_ISSET(fields, 23)) {
53554 log_packet_detailed(" field 'init_buildings' has changed");
53555#ifdef FREECIV_JSON_CONNECTION
53556 field_addr.name = "init_buildings";
53557#endif /* FREECIV_JSON_CONNECTION */
53558 e = 0;
53559 {
53560 int i;
53561
53562#ifdef FREECIV_JSON_CONNECTION
53563 /* Create the array. */
53564 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_buildings_count);
53565
53566 /* Enter the array. */
53567 field_addr.sub_location = plocation_elem_new(0);
53568#endif /* FREECIV_JSON_CONNECTION */
53569
53570 for (i = 0; i < real_packet->init_buildings_count; i++) {
53571#ifdef FREECIV_JSON_CONNECTION
53572 /* Next array element. */
53573 field_addr.sub_location->number = i;
53574#endif /* FREECIV_JSON_CONNECTION */
53575 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings[i]);
53576 }
53577
53578#ifdef FREECIV_JSON_CONNECTION
53579 /* Exit array. */
53580 FC_FREE(field_addr.sub_location);
53581#endif /* FREECIV_JSON_CONNECTION */
53582 }
53583 if (e) {
53584 log_packet_detailed("'init_buildings' field error detected");
53585 }
53586 }
53587
53588 *old = *real_packet;
53589#endif /* FREECIV_DELTA_PROTOCOL */
53590#ifndef FREECIV_DELTA_PROTOCOL
53591#ifdef FREECIV_JSON_CONNECTION
53592 field_addr.name = "id";
53593#endif /* FREECIV_JSON_CONNECTION */
53594 e = 0;
53595 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
53596 if (e) {
53597 log_packet_detailed("'id' field error detected");
53598 }
53599#ifdef FREECIV_JSON_CONNECTION
53600 field_addr.name = "translation_domain";
53601#endif /* FREECIV_JSON_CONNECTION */
53602 e = 0;
53603 e |= DIO_PUT(string, &dout, &field_addr, real_packet->translation_domain);
53604 if (e) {
53605 log_packet_detailed("'translation_domain' field error detected");
53606 }
53607#ifdef FREECIV_JSON_CONNECTION
53608 field_addr.name = "adjective";
53609#endif /* FREECIV_JSON_CONNECTION */
53610 e = 0;
53611 e |= DIO_PUT(string, &dout, &field_addr, real_packet->adjective);
53612 if (e) {
53613 log_packet_detailed("'adjective' field error detected");
53614 }
53615#ifdef FREECIV_JSON_CONNECTION
53616 field_addr.name = "rule_name";
53617#endif /* FREECIV_JSON_CONNECTION */
53618 e = 0;
53619 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
53620 if (e) {
53621 log_packet_detailed("'rule_name' field error detected");
53622 }
53623#ifdef FREECIV_JSON_CONNECTION
53624 field_addr.name = "noun_plural";
53625#endif /* FREECIV_JSON_CONNECTION */
53626 e = 0;
53627 e |= DIO_PUT(string, &dout, &field_addr, real_packet->noun_plural);
53628 if (e) {
53629 log_packet_detailed("'noun_plural' field error detected");
53630 }
53631#ifdef FREECIV_JSON_CONNECTION
53632 field_addr.name = "graphic_str";
53633#endif /* FREECIV_JSON_CONNECTION */
53634 e = 0;
53635 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
53636 if (e) {
53637 log_packet_detailed("'graphic_str' field error detected");
53638 }
53639#ifdef FREECIV_JSON_CONNECTION
53640 field_addr.name = "graphic_alt";
53641#endif /* FREECIV_JSON_CONNECTION */
53642 e = 0;
53643 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
53644 if (e) {
53645 log_packet_detailed("'graphic_alt' field error detected");
53646 }
53647#ifdef FREECIV_JSON_CONNECTION
53648 field_addr.name = "legend";
53649#endif /* FREECIV_JSON_CONNECTION */
53650 e = 0;
53651 e |= DIO_PUT(string, &dout, &field_addr, real_packet->legend);
53652 if (e) {
53653 log_packet_detailed("'legend' field error detected");
53654 }
53655#ifdef FREECIV_JSON_CONNECTION
53656 field_addr.name = "style";
53657#endif /* FREECIV_JSON_CONNECTION */
53658 e = 0;
53659 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
53660 if (e) {
53661 log_packet_detailed("'style' field error detected");
53662 }
53663#ifdef FREECIV_JSON_CONNECTION
53664 field_addr.name = "leader_count";
53665#endif /* FREECIV_JSON_CONNECTION */
53666 e = 0;
53667 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->leader_count);
53668 if (e) {
53669 log_packet_detailed("'leader_count' field error detected");
53670 }
53671#ifdef FREECIV_JSON_CONNECTION
53672 field_addr.name = "leader_name";
53673#endif /* FREECIV_JSON_CONNECTION */
53674 e = 0;
53675 {
53676 int i;
53677
53678#ifdef FREECIV_JSON_CONNECTION
53679 /* Create the array. */
53680 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
53681
53682 /* Enter the array. */
53683 field_addr.sub_location = plocation_elem_new(0);
53684#endif /* FREECIV_JSON_CONNECTION */
53685
53686 for (i = 0; i < real_packet->leader_count; i++) {
53687#ifdef FREECIV_JSON_CONNECTION
53688 /* Next array element. */
53689 field_addr.sub_location->number = i;
53690#endif /* FREECIV_JSON_CONNECTION */
53691 e |= DIO_PUT(string, &dout, &field_addr, real_packet->leader_name[i]);
53692 }
53693
53694#ifdef FREECIV_JSON_CONNECTION
53695 /* Exit array. */
53696 FC_FREE(field_addr.sub_location);
53697#endif /* FREECIV_JSON_CONNECTION */
53698 }
53699 if (e) {
53700 log_packet_detailed("'leader_name' field error detected");
53701 }
53702#ifdef FREECIV_JSON_CONNECTION
53703 field_addr.name = "leader_is_male";
53704#endif /* FREECIV_JSON_CONNECTION */
53705 e = 0;
53706 {
53707 int i;
53708
53709#ifdef FREECIV_JSON_CONNECTION
53710 /* Create the array. */
53711 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
53712
53713 /* Enter the array. */
53714 field_addr.sub_location = plocation_elem_new(0);
53715#endif /* FREECIV_JSON_CONNECTION */
53716
53717 for (i = 0; i < real_packet->leader_count; i++) {
53718#ifdef FREECIV_JSON_CONNECTION
53719 /* Next array element. */
53720 field_addr.sub_location->number = i;
53721#endif /* FREECIV_JSON_CONNECTION */
53722 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->leader_is_male[i]);
53723 }
53724
53725#ifdef FREECIV_JSON_CONNECTION
53726 /* Exit array. */
53727 FC_FREE(field_addr.sub_location);
53728#endif /* FREECIV_JSON_CONNECTION */
53729 }
53730 if (e) {
53731 log_packet_detailed("'leader_is_male' field error detected");
53732 }
53733#ifdef FREECIV_JSON_CONNECTION
53734 field_addr.name = "is_playable";
53735#endif /* FREECIV_JSON_CONNECTION */
53736 e = 0;
53737 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_playable);
53738 if (e) {
53739 log_packet_detailed("'is_playable' field error detected");
53740 }
53741#ifdef FREECIV_JSON_CONNECTION
53742 field_addr.name = "barbarian_type";
53743#endif /* FREECIV_JSON_CONNECTION */
53744 e = 0;
53745 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
53746 if (e) {
53747 log_packet_detailed("'barbarian_type' field error detected");
53748 }
53749#ifdef FREECIV_JSON_CONNECTION
53750 field_addr.name = "nsets";
53751#endif /* FREECIV_JSON_CONNECTION */
53752 e = 0;
53753 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
53754 if (e) {
53755 log_packet_detailed("'nsets' field error detected");
53756 }
53757#ifdef FREECIV_JSON_CONNECTION
53758 field_addr.name = "sets";
53759#endif /* FREECIV_JSON_CONNECTION */
53760 e = 0;
53761 {
53762 int i;
53763
53764#ifdef FREECIV_JSON_CONNECTION
53765 /* Create the array. */
53766 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
53767
53768 /* Enter the array. */
53769 field_addr.sub_location = plocation_elem_new(0);
53770#endif /* FREECIV_JSON_CONNECTION */
53771
53772 for (i = 0; i < real_packet->nsets; i++) {
53773#ifdef FREECIV_JSON_CONNECTION
53774 /* Next array element. */
53775 field_addr.sub_location->number = i;
53776#endif /* FREECIV_JSON_CONNECTION */
53777 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sets[i]);
53778 }
53779
53780#ifdef FREECIV_JSON_CONNECTION
53781 /* Exit array. */
53782 FC_FREE(field_addr.sub_location);
53783#endif /* FREECIV_JSON_CONNECTION */
53784 }
53785 if (e) {
53786 log_packet_detailed("'sets' field error detected");
53787 }
53788#ifdef FREECIV_JSON_CONNECTION
53789 field_addr.name = "ngroups";
53790#endif /* FREECIV_JSON_CONNECTION */
53791 e = 0;
53792 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
53793 if (e) {
53794 log_packet_detailed("'ngroups' field error detected");
53795 }
53796#ifdef FREECIV_JSON_CONNECTION
53797 field_addr.name = "groups";
53798#endif /* FREECIV_JSON_CONNECTION */
53799 e = 0;
53800 {
53801 int i;
53802
53803#ifdef FREECIV_JSON_CONNECTION
53804 /* Create the array. */
53805 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
53806
53807 /* Enter the array. */
53808 field_addr.sub_location = plocation_elem_new(0);
53809#endif /* FREECIV_JSON_CONNECTION */
53810
53811 for (i = 0; i < real_packet->ngroups; i++) {
53812#ifdef FREECIV_JSON_CONNECTION
53813 /* Next array element. */
53814 field_addr.sub_location->number = i;
53815#endif /* FREECIV_JSON_CONNECTION */
53816 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->groups[i]);
53817 }
53818
53819#ifdef FREECIV_JSON_CONNECTION
53820 /* Exit array. */
53821 FC_FREE(field_addr.sub_location);
53822#endif /* FREECIV_JSON_CONNECTION */
53823 }
53824 if (e) {
53825 log_packet_detailed("'groups' field error detected");
53826 }
53827#ifdef FREECIV_JSON_CONNECTION
53828 field_addr.name = "init_government_id";
53829#endif /* FREECIV_JSON_CONNECTION */
53830 e = 0;
53831 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->init_government_id);
53832 if (e) {
53833 log_packet_detailed("'init_government_id' field error detected");
53834 }
53835#ifdef FREECIV_JSON_CONNECTION
53836 field_addr.name = "init_techs_count";
53837#endif /* FREECIV_JSON_CONNECTION */
53838 e = 0;
53839 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs_count);
53840 if (e) {
53841 log_packet_detailed("'init_techs_count' field error detected");
53842 }
53843#ifdef FREECIV_JSON_CONNECTION
53844 field_addr.name = "init_techs";
53845#endif /* FREECIV_JSON_CONNECTION */
53846 e = 0;
53847 {
53848 int i;
53849
53850#ifdef FREECIV_JSON_CONNECTION
53851 /* Create the array. */
53852 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_techs_count);
53853
53854 /* Enter the array. */
53855 field_addr.sub_location = plocation_elem_new(0);
53856#endif /* FREECIV_JSON_CONNECTION */
53857
53858 for (i = 0; i < real_packet->init_techs_count; i++) {
53859#ifdef FREECIV_JSON_CONNECTION
53860 /* Next array element. */
53861 field_addr.sub_location->number = i;
53862#endif /* FREECIV_JSON_CONNECTION */
53863 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->init_techs[i]);
53864 }
53865
53866#ifdef FREECIV_JSON_CONNECTION
53867 /* Exit array. */
53868 FC_FREE(field_addr.sub_location);
53869#endif /* FREECIV_JSON_CONNECTION */
53870 }
53871 if (e) {
53872 log_packet_detailed("'init_techs' field error detected");
53873 }
53874#ifdef FREECIV_JSON_CONNECTION
53875 field_addr.name = "init_units_count";
53876#endif /* FREECIV_JSON_CONNECTION */
53877 e = 0;
53878 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units_count);
53879 if (e) {
53880 log_packet_detailed("'init_units_count' field error detected");
53881 }
53882#ifdef FREECIV_JSON_CONNECTION
53883 field_addr.name = "init_units";
53884#endif /* FREECIV_JSON_CONNECTION */
53885 e = 0;
53886 {
53887 int i;
53888
53889#ifdef FREECIV_JSON_CONNECTION
53890 /* Create the array. */
53891 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_units_count);
53892
53893 /* Enter the array. */
53894 field_addr.sub_location = plocation_elem_new(0);
53895#endif /* FREECIV_JSON_CONNECTION */
53896
53897 for (i = 0; i < real_packet->init_units_count; i++) {
53898#ifdef FREECIV_JSON_CONNECTION
53899 /* Next array element. */
53900 field_addr.sub_location->number = i;
53901#endif /* FREECIV_JSON_CONNECTION */
53902 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->init_units[i]);
53903 }
53904
53905#ifdef FREECIV_JSON_CONNECTION
53906 /* Exit array. */
53907 FC_FREE(field_addr.sub_location);
53908#endif /* FREECIV_JSON_CONNECTION */
53909 }
53910 if (e) {
53911 log_packet_detailed("'init_units' field error detected");
53912 }
53913#ifdef FREECIV_JSON_CONNECTION
53914 field_addr.name = "init_buildings_count";
53915#endif /* FREECIV_JSON_CONNECTION */
53916 e = 0;
53917 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings_count);
53918 if (e) {
53919 log_packet_detailed("'init_buildings_count' field error detected");
53920 }
53921#ifdef FREECIV_JSON_CONNECTION
53922 field_addr.name = "init_buildings";
53923#endif /* FREECIV_JSON_CONNECTION */
53924 e = 0;
53925 {
53926 int i;
53927
53928#ifdef FREECIV_JSON_CONNECTION
53929 /* Create the array. */
53930 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_buildings_count);
53931
53932 /* Enter the array. */
53933 field_addr.sub_location = plocation_elem_new(0);
53934#endif /* FREECIV_JSON_CONNECTION */
53935
53936 for (i = 0; i < real_packet->init_buildings_count; i++) {
53937#ifdef FREECIV_JSON_CONNECTION
53938 /* Next array element. */
53939 field_addr.sub_location->number = i;
53940#endif /* FREECIV_JSON_CONNECTION */
53941 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings[i]);
53942 }
53943
53944#ifdef FREECIV_JSON_CONNECTION
53945 /* Exit array. */
53946 FC_FREE(field_addr.sub_location);
53947#endif /* FREECIV_JSON_CONNECTION */
53948 }
53949 if (e) {
53950 log_packet_detailed("'init_buildings' field error detected");
53951 }
53952
53953#endif
53954 SEND_PACKET_END(PACKET_RULESET_NATION);
53955}
53956
53957 int send_packet_ruleset_nation(struct connection *pc, const struct packet_ruleset_nation *packet)
53958{
53959 if (!pc->used) {
53960 log_error("WARNING: trying to send data to the closed connection %s",
53961 conn_description(pc));
53962 return -1;
53963 }
53964 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION].packet != nullptr, -1,
53965 "Handler for PACKET_RULESET_NATION not installed");
53966 return pc->phs.handlers->send[PACKET_RULESET_NATION].packet(pc, packet);
53967}
53968
53969 void lsend_packet_ruleset_nation(struct conn_list *dest, const struct packet_ruleset_nation *packet)
53970{
53971 conn_list_iterate(dest, pconn) {
53972 send_packet_ruleset_nation(pconn, packet);
53973 } conn_list_iterate_end;
53974}
53975
53976 static inline void init_packet_nation_availability(struct packet_nation_availability *packet)
53977{
53978 memset(packet, 0, sizeof(*packet));
53979}
53980
53981#define free_packet_nation_availability(_packet) (void) 0
53982#define destroy_packet_nation_availability free
53983
53984#ifdef FREECIV_DELTA_PROTOCOL
53985#define hash_packet_nation_availability_100 hash_const
53986
53987#define cmp_packet_nation_availability_100 cmp_const
53988
53989 BV_DEFINE(packet_nation_availability_100_fields, 3);
53990#endif /* FREECIV_DELTA_PROTOCOL */
53991
53992 static struct packet_nation_availability *receive_packet_nation_availability_100(struct connection *pc)
53993{
53994#define FREE_PACKET_STRUCT(_packet) free_packet_nation_availability(_packet)
53995#ifdef FREECIV_DELTA_PROTOCOL
53996 packet_nation_availability_100_fields fields;
53997 struct packet_nation_availability *old;
53998 struct genhash **hash = pc->phs.received + PACKET_NATION_AVAILABILITY;
53999#endif /* FREECIV_DELTA_PROTOCOL */
54000 RECEIVE_PACKET_START(packet_nation_availability, real_packet);
54001#ifdef FREECIV_JSON_CONNECTION
54002 struct plocation field_addr;
54003 {
54004 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
54005 field_addr = *field_addr_tmp;
54006 FC_FREE(field_addr_tmp);
54007 }
54008#endif /* FREECIV_JSON_CONNECTION */
54009
54010#ifdef FREECIV_DELTA_PROTOCOL
54011#ifdef FREECIV_JSON_CONNECTION
54012 field_addr.name = "fields";
54013#endif /* FREECIV_JSON_CONNECTION */
54014 DIO_BV_GET(&din, &field_addr, fields);
54015
54016#else /* FREECIV_DELTA_PROTOCOL */
54017#ifdef FREECIV_JSON_CONNECTION
54018 field_addr.name = "ncount";
54019#endif /* FREECIV_JSON_CONNECTION */
54020 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ncount)) {
54021 RECEIVE_PACKET_FIELD_ERROR(ncount);
54022 }
54023#ifdef FREECIV_JSON_CONNECTION
54024 field_addr.name = "is_pickable";
54025#endif /* FREECIV_JSON_CONNECTION */
54026 {
54027 int i;
54028
54029#ifdef FREECIV_JSON_CONNECTION
54030 /* Enter array. */
54031 field_addr.sub_location = plocation_elem_new(0);
54032#endif /* FREECIV_JSON_CONNECTION */
54033
54034 if (real_packet->ncount > MAX_NUM_NATIONS) {
54035 RECEIVE_PACKET_FIELD_ERROR(is_pickable, ": truncation array");
54036 }
54037 for (i = 0; i < real_packet->ncount; i++) {
54038#ifdef FREECIV_JSON_CONNECTION
54039 field_addr.sub_location->number = i;
54040#endif /* FREECIV_JSON_CONNECTION */
54041 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_pickable[i])) {
54042 RECEIVE_PACKET_FIELD_ERROR(is_pickable);
54043 }
54044 }
54045
54046#ifdef FREECIV_JSON_CONNECTION
54047 /* Exit array. */
54048 FC_FREE(field_addr.sub_location);
54049#endif /* FREECIV_JSON_CONNECTION */
54050 }
54051#ifdef FREECIV_JSON_CONNECTION
54052 field_addr.name = "nationset_change";
54053#endif /* FREECIV_JSON_CONNECTION */
54054 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->nationset_change)) {
54055 RECEIVE_PACKET_FIELD_ERROR(nationset_change);
54056 }
54057#endif
54058 log_packet_detailed("packet_nation_availability_100: got info about ()");
54059
54060#ifdef FREECIV_DELTA_PROTOCOL
54061 if (nullptr == *hash) {
54062 *hash = genhash_new_full(hash_packet_nation_availability_100, cmp_packet_nation_availability_100,
54063 nullptr, nullptr, nullptr, destroy_packet_nation_availability);
54064 }
54065
54066 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
54067 *real_packet = *old;
54068 } else {
54069 /* packet is already initialized empty */
54070 log_packet_detailed(" no old info");
54071 }
54072
54073 if (BV_ISSET(fields, 0)) {
54074 log_packet_detailed(" got field 'ncount'");
54075#ifdef FREECIV_JSON_CONNECTION
54076 field_addr.name = "ncount";
54077#endif /* FREECIV_JSON_CONNECTION */
54078 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ncount)) {
54079 RECEIVE_PACKET_FIELD_ERROR(ncount);
54080 }
54081 }
54082 if (BV_ISSET(fields, 1)) {
54083 log_packet_detailed(" got field 'is_pickable'");
54084#ifdef FREECIV_JSON_CONNECTION
54085 field_addr.name = "is_pickable";
54086#endif /* FREECIV_JSON_CONNECTION */
54087 {
54088 int i;
54089
54090#ifdef FREECIV_JSON_CONNECTION
54091 /* Enter array. */
54092 field_addr.sub_location = plocation_elem_new(0);
54093#endif /* FREECIV_JSON_CONNECTION */
54094
54095 if (real_packet->ncount > MAX_NUM_NATIONS) {
54096 RECEIVE_PACKET_FIELD_ERROR(is_pickable, ": truncation array");
54097 }
54098 for (i = 0; i < real_packet->ncount; i++) {
54099#ifdef FREECIV_JSON_CONNECTION
54100 field_addr.sub_location->number = i;
54101#endif /* FREECIV_JSON_CONNECTION */
54102 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_pickable[i])) {
54103 RECEIVE_PACKET_FIELD_ERROR(is_pickable);
54104 }
54105 }
54106
54107#ifdef FREECIV_JSON_CONNECTION
54108 /* Exit array. */
54109 FC_FREE(field_addr.sub_location);
54110#endif /* FREECIV_JSON_CONNECTION */
54111 }
54112 }
54113 real_packet->nationset_change = BV_ISSET(fields, 2);
54114
54115 if (nullptr == old) {
54116 old = fc_malloc(sizeof(*old));
54117 init_packet_nation_availability(old);
54118 *old = *real_packet;
54119 genhash_insert(*hash, old, old);
54120 } else {
54121 *old = *real_packet;
54122 }
54123
54124#endif /* FREECIV_DELTA_PROTOCOL */
54125 RECEIVE_PACKET_END(real_packet);
54126#undef FREE_PACKET_STRUCT
54127}
54128
54129 static int send_packet_nation_availability_100(struct connection *pc, const struct packet_nation_availability *packet)
54130{
54131 const struct packet_nation_availability *real_packet = packet;
54132 int e;
54133#ifdef FREECIV_DELTA_PROTOCOL
54134 packet_nation_availability_100_fields fields;
54135 struct packet_nation_availability *old;
54136 bool differ;
54137 struct genhash **hash = pc->phs.sent + PACKET_NATION_AVAILABILITY;
54138#endif /* FREECIV_DELTA_PROTOCOL */
54139 SEND_PACKET_START(PACKET_NATION_AVAILABILITY);
54140#ifdef FREECIV_JSON_CONNECTION
54141 struct plocation field_addr;
54142 {
54143 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
54144 field_addr = *field_addr_tmp;
54145 FC_FREE(field_addr_tmp);
54146 }
54147#endif /* FREECIV_JSON_CONNECTION */
54148
54149 log_packet_detailed("packet_nation_availability_100: sending info about ()");
54150
54151#ifdef FREECIV_DELTA_PROTOCOL
54152 if (nullptr == *hash) {
54153 *hash = genhash_new_full(hash_packet_nation_availability_100, cmp_packet_nation_availability_100,
54154 nullptr, nullptr, nullptr, destroy_packet_nation_availability);
54155 }
54156 BV_CLR_ALL(fields);
54157
54158 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
54159 old = fc_malloc(sizeof(*old));
54160 /* temporary bitcopy just to insert correctly */
54161 *old = *real_packet;
54162 genhash_insert(*hash, old, old);
54163 init_packet_nation_availability(old);
54164 }
54165 differ = (old->ncount != real_packet->ncount);
54166 if (differ) {
54167 BV_SET(fields, 0);
54168 }
54169
54170 differ = (old->ncount != real_packet->ncount);
54171 if (!differ) {
54172 int i;
54173
54174 for (i = 0; i < real_packet->ncount; i++) {
54175 differ = (old->is_pickable[i] != real_packet->is_pickable[i]);
54176 if (differ) {
54177 break;
54178 }
54179 }
54180 }
54181 if (differ) {
54182 BV_SET(fields, 1);
54183 }
54184
54185 if (packet->nationset_change) {
54186 BV_SET(fields, 2);
54187 }
54188
54189
54190#ifdef FREECIV_JSON_CONNECTION
54191 field_addr.name = "fields";
54192#endif /* FREECIV_JSON_CONNECTION */
54193 e = 0;
54194 e |= DIO_BV_PUT(&dout, &field_addr, fields);
54195 if (e) {
54196 log_packet_detailed("fields bitvector error detected");
54197 }
54198
54199 if (BV_ISSET(fields, 0)) {
54200 log_packet_detailed(" field 'ncount' has changed");
54201#ifdef FREECIV_JSON_CONNECTION
54202 field_addr.name = "ncount";
54203#endif /* FREECIV_JSON_CONNECTION */
54204 e = 0;
54205 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ncount);
54206 if (e) {
54207 log_packet_detailed("'ncount' field error detected");
54208 }
54209 }
54210 if (BV_ISSET(fields, 1)) {
54211 log_packet_detailed(" field 'is_pickable' has changed");
54212#ifdef FREECIV_JSON_CONNECTION
54213 field_addr.name = "is_pickable";
54214#endif /* FREECIV_JSON_CONNECTION */
54215 e = 0;
54216 {
54217 int i;
54218
54219#ifdef FREECIV_JSON_CONNECTION
54220 /* Create the array. */
54221 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ncount);
54222
54223 /* Enter the array. */
54224 field_addr.sub_location = plocation_elem_new(0);
54225#endif /* FREECIV_JSON_CONNECTION */
54226
54227 for (i = 0; i < real_packet->ncount; i++) {
54228#ifdef FREECIV_JSON_CONNECTION
54229 /* Next array element. */
54230 field_addr.sub_location->number = i;
54231#endif /* FREECIV_JSON_CONNECTION */
54232 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_pickable[i]);
54233 }
54234
54235#ifdef FREECIV_JSON_CONNECTION
54236 /* Exit array. */
54237 FC_FREE(field_addr.sub_location);
54238#endif /* FREECIV_JSON_CONNECTION */
54239 }
54240 if (e) {
54241 log_packet_detailed("'is_pickable' field error detected");
54242 }
54243 }
54244 /* field 2 is folded into the header */
54245
54246 *old = *real_packet;
54247#endif /* FREECIV_DELTA_PROTOCOL */
54248#ifndef FREECIV_DELTA_PROTOCOL
54249#ifdef FREECIV_JSON_CONNECTION
54250 field_addr.name = "ncount";
54251#endif /* FREECIV_JSON_CONNECTION */
54252 e = 0;
54253 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ncount);
54254 if (e) {
54255 log_packet_detailed("'ncount' field error detected");
54256 }
54257#ifdef FREECIV_JSON_CONNECTION
54258 field_addr.name = "is_pickable";
54259#endif /* FREECIV_JSON_CONNECTION */
54260 e = 0;
54261 {
54262 int i;
54263
54264#ifdef FREECIV_JSON_CONNECTION
54265 /* Create the array. */
54266 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ncount);
54267
54268 /* Enter the array. */
54269 field_addr.sub_location = plocation_elem_new(0);
54270#endif /* FREECIV_JSON_CONNECTION */
54271
54272 for (i = 0; i < real_packet->ncount; i++) {
54273#ifdef FREECIV_JSON_CONNECTION
54274 /* Next array element. */
54275 field_addr.sub_location->number = i;
54276#endif /* FREECIV_JSON_CONNECTION */
54277 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_pickable[i]);
54278 }
54279
54280#ifdef FREECIV_JSON_CONNECTION
54281 /* Exit array. */
54282 FC_FREE(field_addr.sub_location);
54283#endif /* FREECIV_JSON_CONNECTION */
54284 }
54285 if (e) {
54286 log_packet_detailed("'is_pickable' field error detected");
54287 }
54288#ifdef FREECIV_JSON_CONNECTION
54289 field_addr.name = "nationset_change";
54290#endif /* FREECIV_JSON_CONNECTION */
54291 e = 0;
54292 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->nationset_change);
54293 if (e) {
54294 log_packet_detailed("'nationset_change' field error detected");
54295 }
54296
54297#endif
54298 SEND_PACKET_END(PACKET_NATION_AVAILABILITY);
54299}
54300
54301 int send_packet_nation_availability(struct connection *pc, const struct packet_nation_availability *packet)
54302{
54303 if (!pc->used) {
54304 log_error("WARNING: trying to send data to the closed connection %s",
54305 conn_description(pc));
54306 return -1;
54307 }
54308 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NATION_AVAILABILITY].packet != nullptr, -1,
54309 "Handler for PACKET_NATION_AVAILABILITY not installed");
54310 return pc->phs.handlers->send[PACKET_NATION_AVAILABILITY].packet(pc, packet);
54311}
54312
54313 void lsend_packet_nation_availability(struct conn_list *dest, const struct packet_nation_availability *packet)
54314{
54315 conn_list_iterate(dest, pconn) {
54316 send_packet_nation_availability(pconn, packet);
54317 } conn_list_iterate_end;
54318}
54319
54320 static inline void init_packet_ruleset_style(struct packet_ruleset_style *packet)
54321{
54322 memset(packet, 0, sizeof(*packet));
54323}
54324
54325#define free_packet_ruleset_style(_packet) (void) 0
54326#define destroy_packet_ruleset_style free
54327
54328#ifdef FREECIV_DELTA_PROTOCOL
54329#define hash_packet_ruleset_style_100 hash_const
54330
54331#define cmp_packet_ruleset_style_100 cmp_const
54332
54333 BV_DEFINE(packet_ruleset_style_100_fields, 3);
54334#endif /* FREECIV_DELTA_PROTOCOL */
54335
54336 static struct packet_ruleset_style *receive_packet_ruleset_style_100(struct connection *pc)
54337{
54338#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_style(_packet)
54339#ifdef FREECIV_DELTA_PROTOCOL
54340 packet_ruleset_style_100_fields fields;
54341 struct packet_ruleset_style *old;
54342 struct genhash **hash = pc->phs.received + PACKET_RULESET_STYLE;
54343#endif /* FREECIV_DELTA_PROTOCOL */
54344 RECEIVE_PACKET_START(packet_ruleset_style, real_packet);
54345#ifdef FREECIV_JSON_CONNECTION
54346 struct plocation field_addr;
54347 {
54348 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
54349 field_addr = *field_addr_tmp;
54350 FC_FREE(field_addr_tmp);
54351 }
54352#endif /* FREECIV_JSON_CONNECTION */
54353
54354#ifdef FREECIV_DELTA_PROTOCOL
54355#ifdef FREECIV_JSON_CONNECTION
54356 field_addr.name = "fields";
54357#endif /* FREECIV_JSON_CONNECTION */
54358 DIO_BV_GET(&din, &field_addr, fields);
54359
54360#else /* FREECIV_DELTA_PROTOCOL */
54361#ifdef FREECIV_JSON_CONNECTION
54362 field_addr.name = "id";
54363#endif /* FREECIV_JSON_CONNECTION */
54364 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
54365 RECEIVE_PACKET_FIELD_ERROR(id);
54366 }
54367#ifdef FREECIV_JSON_CONNECTION
54368 field_addr.name = "name";
54369#endif /* FREECIV_JSON_CONNECTION */
54370 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
54371 RECEIVE_PACKET_FIELD_ERROR(name);
54372 }
54373#ifdef FREECIV_JSON_CONNECTION
54374 field_addr.name = "rule_name";
54375#endif /* FREECIV_JSON_CONNECTION */
54376 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
54377 RECEIVE_PACKET_FIELD_ERROR(rule_name);
54378 }
54379#endif
54380 log_packet_detailed("packet_ruleset_style_100: got info about ()");
54381
54382#ifdef FREECIV_DELTA_PROTOCOL
54383 if (nullptr == *hash) {
54384 *hash = genhash_new_full(hash_packet_ruleset_style_100, cmp_packet_ruleset_style_100,
54385 nullptr, nullptr, nullptr, destroy_packet_ruleset_style);
54386 }
54387
54388 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
54389 *real_packet = *old;
54390 } else {
54391 /* packet is already initialized empty */
54392 log_packet_detailed(" no old info");
54393 }
54394
54395 if (BV_ISSET(fields, 0)) {
54396 log_packet_detailed(" got field 'id'");
54397#ifdef FREECIV_JSON_CONNECTION
54398 field_addr.name = "id";
54399#endif /* FREECIV_JSON_CONNECTION */
54400 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
54401 RECEIVE_PACKET_FIELD_ERROR(id);
54402 }
54403 }
54404 if (BV_ISSET(fields, 1)) {
54405 log_packet_detailed(" got field 'name'");
54406#ifdef FREECIV_JSON_CONNECTION
54407 field_addr.name = "name";
54408#endif /* FREECIV_JSON_CONNECTION */
54409 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
54410 RECEIVE_PACKET_FIELD_ERROR(name);
54411 }
54412 }
54413 if (BV_ISSET(fields, 2)) {
54414 log_packet_detailed(" got field 'rule_name'");
54415#ifdef FREECIV_JSON_CONNECTION
54416 field_addr.name = "rule_name";
54417#endif /* FREECIV_JSON_CONNECTION */
54418 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
54419 RECEIVE_PACKET_FIELD_ERROR(rule_name);
54420 }
54421 }
54422
54423 if (nullptr == old) {
54424 old = fc_malloc(sizeof(*old));
54425 init_packet_ruleset_style(old);
54426 *old = *real_packet;
54427 genhash_insert(*hash, old, old);
54428 } else {
54429 *old = *real_packet;
54430 }
54431
54432#endif /* FREECIV_DELTA_PROTOCOL */
54433 RECEIVE_PACKET_END(real_packet);
54434#undef FREE_PACKET_STRUCT
54435}
54436
54437 static int send_packet_ruleset_style_100(struct connection *pc, const struct packet_ruleset_style *packet)
54438{
54439 const struct packet_ruleset_style *real_packet = packet;
54440 int e;
54441#ifdef FREECIV_DELTA_PROTOCOL
54442 packet_ruleset_style_100_fields fields;
54443 struct packet_ruleset_style *old;
54444 bool differ;
54445 struct genhash **hash = pc->phs.sent + PACKET_RULESET_STYLE;
54446#endif /* FREECIV_DELTA_PROTOCOL */
54447 SEND_PACKET_START(PACKET_RULESET_STYLE);
54448#ifdef FREECIV_JSON_CONNECTION
54449 struct plocation field_addr;
54450 {
54451 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
54452 field_addr = *field_addr_tmp;
54453 FC_FREE(field_addr_tmp);
54454 }
54455#endif /* FREECIV_JSON_CONNECTION */
54456
54457 log_packet_detailed("packet_ruleset_style_100: sending info about ()");
54458
54459#ifdef FREECIV_DELTA_PROTOCOL
54460 if (nullptr == *hash) {
54461 *hash = genhash_new_full(hash_packet_ruleset_style_100, cmp_packet_ruleset_style_100,
54462 nullptr, nullptr, nullptr, destroy_packet_ruleset_style);
54463 }
54464 BV_CLR_ALL(fields);
54465
54466 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
54467 old = fc_malloc(sizeof(*old));
54468 /* temporary bitcopy just to insert correctly */
54469 *old = *real_packet;
54470 genhash_insert(*hash, old, old);
54471 init_packet_ruleset_style(old);
54472 }
54473 differ = (old->id != real_packet->id);
54474 if (differ) {
54475 BV_SET(fields, 0);
54476 }
54477
54478 differ = (strcmp(old->name, real_packet->name) != 0);
54479 if (differ) {
54480 BV_SET(fields, 1);
54481 }
54482
54483 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
54484 if (differ) {
54485 BV_SET(fields, 2);
54486 }
54487
54488
54489#ifdef FREECIV_JSON_CONNECTION
54490 field_addr.name = "fields";
54491#endif /* FREECIV_JSON_CONNECTION */
54492 e = 0;
54493 e |= DIO_BV_PUT(&dout, &field_addr, fields);
54494 if (e) {
54495 log_packet_detailed("fields bitvector error detected");
54496 }
54497
54498 if (BV_ISSET(fields, 0)) {
54499 log_packet_detailed(" field 'id' has changed");
54500#ifdef FREECIV_JSON_CONNECTION
54501 field_addr.name = "id";
54502#endif /* FREECIV_JSON_CONNECTION */
54503 e = 0;
54504 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
54505 if (e) {
54506 log_packet_detailed("'id' field error detected");
54507 }
54508 }
54509 if (BV_ISSET(fields, 1)) {
54510 log_packet_detailed(" field 'name' has changed");
54511#ifdef FREECIV_JSON_CONNECTION
54512 field_addr.name = "name";
54513#endif /* FREECIV_JSON_CONNECTION */
54514 e = 0;
54515 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
54516 if (e) {
54517 log_packet_detailed("'name' field error detected");
54518 }
54519 }
54520 if (BV_ISSET(fields, 2)) {
54521 log_packet_detailed(" field 'rule_name' has changed");
54522#ifdef FREECIV_JSON_CONNECTION
54523 field_addr.name = "rule_name";
54524#endif /* FREECIV_JSON_CONNECTION */
54525 e = 0;
54526 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
54527 if (e) {
54528 log_packet_detailed("'rule_name' field error detected");
54529 }
54530 }
54531
54532 *old = *real_packet;
54533#endif /* FREECIV_DELTA_PROTOCOL */
54534#ifndef FREECIV_DELTA_PROTOCOL
54535#ifdef FREECIV_JSON_CONNECTION
54536 field_addr.name = "id";
54537#endif /* FREECIV_JSON_CONNECTION */
54538 e = 0;
54539 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
54540 if (e) {
54541 log_packet_detailed("'id' field error detected");
54542 }
54543#ifdef FREECIV_JSON_CONNECTION
54544 field_addr.name = "name";
54545#endif /* FREECIV_JSON_CONNECTION */
54546 e = 0;
54547 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
54548 if (e) {
54549 log_packet_detailed("'name' field error detected");
54550 }
54551#ifdef FREECIV_JSON_CONNECTION
54552 field_addr.name = "rule_name";
54553#endif /* FREECIV_JSON_CONNECTION */
54554 e = 0;
54555 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
54556 if (e) {
54557 log_packet_detailed("'rule_name' field error detected");
54558 }
54559
54560#endif
54561 SEND_PACKET_END(PACKET_RULESET_STYLE);
54562}
54563
54564 int send_packet_ruleset_style(struct connection *pc, const struct packet_ruleset_style *packet)
54565{
54566 if (!pc->used) {
54567 log_error("WARNING: trying to send data to the closed connection %s",
54568 conn_description(pc));
54569 return -1;
54570 }
54571 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_STYLE].packet != nullptr, -1,
54572 "Handler for PACKET_RULESET_STYLE not installed");
54573 return pc->phs.handlers->send[PACKET_RULESET_STYLE].packet(pc, packet);
54574}
54575
54576 void lsend_packet_ruleset_style(struct conn_list *dest, const struct packet_ruleset_style *packet)
54577{
54578 conn_list_iterate(dest, pconn) {
54579 send_packet_ruleset_style(pconn, packet);
54580 } conn_list_iterate_end;
54581}
54582
54583 static inline void init_packet_ruleset_city(struct packet_ruleset_city *packet)
54584{
54585 memset(packet, 0, sizeof(*packet));
54586}
54587
54588#define free_packet_ruleset_city(_packet) (void) 0
54589#define destroy_packet_ruleset_city free
54590
54591#ifdef FREECIV_DELTA_PROTOCOL
54592#define hash_packet_ruleset_city_100 hash_const
54593
54594#define cmp_packet_ruleset_city_100 cmp_const
54595
54596 BV_DEFINE(packet_ruleset_city_100_fields, 8);
54597#endif /* FREECIV_DELTA_PROTOCOL */
54598
54599 static struct packet_ruleset_city *receive_packet_ruleset_city_100(struct connection *pc)
54600{
54601#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_city(_packet)
54602#ifdef FREECIV_DELTA_PROTOCOL
54603 packet_ruleset_city_100_fields fields;
54604 struct packet_ruleset_city *old;
54605 struct genhash **hash = pc->phs.received + PACKET_RULESET_CITY;
54606#endif /* FREECIV_DELTA_PROTOCOL */
54607 RECEIVE_PACKET_START(packet_ruleset_city, real_packet);
54608#ifdef FREECIV_JSON_CONNECTION
54609 struct plocation field_addr;
54610 {
54611 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
54612 field_addr = *field_addr_tmp;
54613 FC_FREE(field_addr_tmp);
54614 }
54615#endif /* FREECIV_JSON_CONNECTION */
54616
54617#ifdef FREECIV_DELTA_PROTOCOL
54618#ifdef FREECIV_JSON_CONNECTION
54619 field_addr.name = "fields";
54620#endif /* FREECIV_JSON_CONNECTION */
54621 DIO_BV_GET(&din, &field_addr, fields);
54622
54623#else /* FREECIV_DELTA_PROTOCOL */
54624#ifdef FREECIV_JSON_CONNECTION
54625 field_addr.name = "style_id";
54626#endif /* FREECIV_JSON_CONNECTION */
54627 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style_id)) {
54628 RECEIVE_PACKET_FIELD_ERROR(style_id);
54629 }
54630#ifdef FREECIV_JSON_CONNECTION
54631 field_addr.name = "name";
54632#endif /* FREECIV_JSON_CONNECTION */
54633 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
54634 RECEIVE_PACKET_FIELD_ERROR(name);
54635 }
54636#ifdef FREECIV_JSON_CONNECTION
54637 field_addr.name = "rule_name";
54638#endif /* FREECIV_JSON_CONNECTION */
54639 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
54640 RECEIVE_PACKET_FIELD_ERROR(rule_name);
54641 }
54642#ifdef FREECIV_JSON_CONNECTION
54643 field_addr.name = "citizens_graphic";
54644#endif /* FREECIV_JSON_CONNECTION */
54645 if (!DIO_GET(string, &din, &field_addr, real_packet->citizens_graphic, sizeof(real_packet->citizens_graphic))) {
54646 RECEIVE_PACKET_FIELD_ERROR(citizens_graphic);
54647 }
54648#ifdef FREECIV_JSON_CONNECTION
54649 field_addr.name = "reqs_count";
54650#endif /* FREECIV_JSON_CONNECTION */
54651 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
54652 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
54653 }
54654#ifdef FREECIV_JSON_CONNECTION
54655 field_addr.name = "reqs";
54656#endif /* FREECIV_JSON_CONNECTION */
54657 {
54658 int i;
54659
54660#ifdef FREECIV_JSON_CONNECTION
54661 /* Enter array. */
54662 field_addr.sub_location = plocation_elem_new(0);
54663#endif /* FREECIV_JSON_CONNECTION */
54664
54665 if (real_packet->reqs_count > MAX_NUM_REQS) {
54666 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
54667 }
54668 for (i = 0; i < real_packet->reqs_count; i++) {
54669#ifdef FREECIV_JSON_CONNECTION
54670 field_addr.sub_location->number = i;
54671#endif /* FREECIV_JSON_CONNECTION */
54672 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
54673 RECEIVE_PACKET_FIELD_ERROR(reqs);
54674 }
54675 }
54676
54677#ifdef FREECIV_JSON_CONNECTION
54678 /* Exit array. */
54679 FC_FREE(field_addr.sub_location);
54680#endif /* FREECIV_JSON_CONNECTION */
54681 }
54682#ifdef FREECIV_JSON_CONNECTION
54683 field_addr.name = "graphic";
54684#endif /* FREECIV_JSON_CONNECTION */
54685 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic, sizeof(real_packet->graphic))) {
54686 RECEIVE_PACKET_FIELD_ERROR(graphic);
54687 }
54688#ifdef FREECIV_JSON_CONNECTION
54689 field_addr.name = "graphic_alt";
54690#endif /* FREECIV_JSON_CONNECTION */
54691 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
54692 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
54693 }
54694#endif
54695 log_packet_detailed("packet_ruleset_city_100: got info about ()");
54696
54697#ifdef FREECIV_DELTA_PROTOCOL
54698 if (nullptr == *hash) {
54699 *hash = genhash_new_full(hash_packet_ruleset_city_100, cmp_packet_ruleset_city_100,
54700 nullptr, nullptr, nullptr, destroy_packet_ruleset_city);
54701 }
54702
54703 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
54704 *real_packet = *old;
54705 } else {
54706 /* packet is already initialized empty */
54707 log_packet_detailed(" no old info");
54708 }
54709
54710 if (BV_ISSET(fields, 0)) {
54711 log_packet_detailed(" got field 'style_id'");
54712#ifdef FREECIV_JSON_CONNECTION
54713 field_addr.name = "style_id";
54714#endif /* FREECIV_JSON_CONNECTION */
54715 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style_id)) {
54716 RECEIVE_PACKET_FIELD_ERROR(style_id);
54717 }
54718 }
54719 if (BV_ISSET(fields, 1)) {
54720 log_packet_detailed(" got field 'name'");
54721#ifdef FREECIV_JSON_CONNECTION
54722 field_addr.name = "name";
54723#endif /* FREECIV_JSON_CONNECTION */
54724 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
54725 RECEIVE_PACKET_FIELD_ERROR(name);
54726 }
54727 }
54728 if (BV_ISSET(fields, 2)) {
54729 log_packet_detailed(" got field 'rule_name'");
54730#ifdef FREECIV_JSON_CONNECTION
54731 field_addr.name = "rule_name";
54732#endif /* FREECIV_JSON_CONNECTION */
54733 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
54734 RECEIVE_PACKET_FIELD_ERROR(rule_name);
54735 }
54736 }
54737 if (BV_ISSET(fields, 3)) {
54738 log_packet_detailed(" got field 'citizens_graphic'");
54739#ifdef FREECIV_JSON_CONNECTION
54740 field_addr.name = "citizens_graphic";
54741#endif /* FREECIV_JSON_CONNECTION */
54742 if (!DIO_GET(string, &din, &field_addr, real_packet->citizens_graphic, sizeof(real_packet->citizens_graphic))) {
54743 RECEIVE_PACKET_FIELD_ERROR(citizens_graphic);
54744 }
54745 }
54746 if (BV_ISSET(fields, 4)) {
54747 log_packet_detailed(" got field 'reqs_count'");
54748#ifdef FREECIV_JSON_CONNECTION
54749 field_addr.name = "reqs_count";
54750#endif /* FREECIV_JSON_CONNECTION */
54751 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
54752 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
54753 }
54754 }
54755 if (BV_ISSET(fields, 5)) {
54756 log_packet_detailed(" got field 'reqs'");
54757#ifdef FREECIV_JSON_CONNECTION
54758 field_addr.name = "reqs";
54759#endif /* FREECIV_JSON_CONNECTION */
54760 {
54761 int i;
54762
54763#ifdef FREECIV_JSON_CONNECTION
54764 /* Enter array. */
54765 field_addr.sub_location = plocation_elem_new(0);
54766#endif /* FREECIV_JSON_CONNECTION */
54767
54768 if (real_packet->reqs_count > MAX_NUM_REQS) {
54769 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
54770 }
54771 for (i = 0; i < real_packet->reqs_count; i++) {
54772#ifdef FREECIV_JSON_CONNECTION
54773 field_addr.sub_location->number = i;
54774#endif /* FREECIV_JSON_CONNECTION */
54775 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
54776 RECEIVE_PACKET_FIELD_ERROR(reqs);
54777 }
54778 }
54779
54780#ifdef FREECIV_JSON_CONNECTION
54781 /* Exit array. */
54782 FC_FREE(field_addr.sub_location);
54783#endif /* FREECIV_JSON_CONNECTION */
54784 }
54785 }
54786 if (BV_ISSET(fields, 6)) {
54787 log_packet_detailed(" got field 'graphic'");
54788#ifdef FREECIV_JSON_CONNECTION
54789 field_addr.name = "graphic";
54790#endif /* FREECIV_JSON_CONNECTION */
54791 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic, sizeof(real_packet->graphic))) {
54792 RECEIVE_PACKET_FIELD_ERROR(graphic);
54793 }
54794 }
54795 if (BV_ISSET(fields, 7)) {
54796 log_packet_detailed(" got field 'graphic_alt'");
54797#ifdef FREECIV_JSON_CONNECTION
54798 field_addr.name = "graphic_alt";
54799#endif /* FREECIV_JSON_CONNECTION */
54800 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
54801 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
54802 }
54803 }
54804
54805 if (nullptr == old) {
54806 old = fc_malloc(sizeof(*old));
54807 init_packet_ruleset_city(old);
54808 *old = *real_packet;
54809 genhash_insert(*hash, old, old);
54810 } else {
54811 *old = *real_packet;
54812 }
54813
54814#endif /* FREECIV_DELTA_PROTOCOL */
54815 RECEIVE_PACKET_END(real_packet);
54816#undef FREE_PACKET_STRUCT
54817}
54818
54819 static int send_packet_ruleset_city_100(struct connection *pc, const struct packet_ruleset_city *packet)
54820{
54821 const struct packet_ruleset_city *real_packet = packet;
54822 int e;
54823#ifdef FREECIV_DELTA_PROTOCOL
54824 packet_ruleset_city_100_fields fields;
54825 struct packet_ruleset_city *old;
54826 bool differ;
54827 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CITY;
54828#endif /* FREECIV_DELTA_PROTOCOL */
54829 SEND_PACKET_START(PACKET_RULESET_CITY);
54830#ifdef FREECIV_JSON_CONNECTION
54831 struct plocation field_addr;
54832 {
54833 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
54834 field_addr = *field_addr_tmp;
54835 FC_FREE(field_addr_tmp);
54836 }
54837#endif /* FREECIV_JSON_CONNECTION */
54838
54839 log_packet_detailed("packet_ruleset_city_100: sending info about ()");
54840
54841#ifdef FREECIV_DELTA_PROTOCOL
54842 if (nullptr == *hash) {
54843 *hash = genhash_new_full(hash_packet_ruleset_city_100, cmp_packet_ruleset_city_100,
54844 nullptr, nullptr, nullptr, destroy_packet_ruleset_city);
54845 }
54846 BV_CLR_ALL(fields);
54847
54848 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
54849 old = fc_malloc(sizeof(*old));
54850 /* temporary bitcopy just to insert correctly */
54851 *old = *real_packet;
54852 genhash_insert(*hash, old, old);
54853 init_packet_ruleset_city(old);
54854 }
54855 differ = (old->style_id != real_packet->style_id);
54856 if (differ) {
54857 BV_SET(fields, 0);
54858 }
54859
54860 differ = (strcmp(old->name, real_packet->name) != 0);
54861 if (differ) {
54862 BV_SET(fields, 1);
54863 }
54864
54865 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
54866 if (differ) {
54867 BV_SET(fields, 2);
54868 }
54869
54870 differ = (strcmp(old->citizens_graphic, real_packet->citizens_graphic) != 0);
54871 if (differ) {
54872 BV_SET(fields, 3);
54873 }
54874
54875 differ = (old->reqs_count != real_packet->reqs_count);
54876 if (differ) {
54877 BV_SET(fields, 4);
54878 }
54879
54880 differ = (old->reqs_count != real_packet->reqs_count);
54881 if (!differ) {
54882 int i;
54883
54884 for (i = 0; i < real_packet->reqs_count; i++) {
54885 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
54886 if (differ) {
54887 break;
54888 }
54889 }
54890 }
54891 if (differ) {
54892 BV_SET(fields, 5);
54893 }
54894
54895 differ = (strcmp(old->graphic, real_packet->graphic) != 0);
54896 if (differ) {
54897 BV_SET(fields, 6);
54898 }
54899
54900 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
54901 if (differ) {
54902 BV_SET(fields, 7);
54903 }
54904
54905
54906#ifdef FREECIV_JSON_CONNECTION
54907 field_addr.name = "fields";
54908#endif /* FREECIV_JSON_CONNECTION */
54909 e = 0;
54910 e |= DIO_BV_PUT(&dout, &field_addr, fields);
54911 if (e) {
54912 log_packet_detailed("fields bitvector error detected");
54913 }
54914
54915 if (BV_ISSET(fields, 0)) {
54916 log_packet_detailed(" field 'style_id' has changed");
54917#ifdef FREECIV_JSON_CONNECTION
54918 field_addr.name = "style_id";
54919#endif /* FREECIV_JSON_CONNECTION */
54920 e = 0;
54921 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style_id);
54922 if (e) {
54923 log_packet_detailed("'style_id' field error detected");
54924 }
54925 }
54926 if (BV_ISSET(fields, 1)) {
54927 log_packet_detailed(" field 'name' has changed");
54928#ifdef FREECIV_JSON_CONNECTION
54929 field_addr.name = "name";
54930#endif /* FREECIV_JSON_CONNECTION */
54931 e = 0;
54932 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
54933 if (e) {
54934 log_packet_detailed("'name' field error detected");
54935 }
54936 }
54937 if (BV_ISSET(fields, 2)) {
54938 log_packet_detailed(" field 'rule_name' has changed");
54939#ifdef FREECIV_JSON_CONNECTION
54940 field_addr.name = "rule_name";
54941#endif /* FREECIV_JSON_CONNECTION */
54942 e = 0;
54943 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
54944 if (e) {
54945 log_packet_detailed("'rule_name' field error detected");
54946 }
54947 }
54948 if (BV_ISSET(fields, 3)) {
54949 log_packet_detailed(" field 'citizens_graphic' has changed");
54950#ifdef FREECIV_JSON_CONNECTION
54951 field_addr.name = "citizens_graphic";
54952#endif /* FREECIV_JSON_CONNECTION */
54953 e = 0;
54954 e |= DIO_PUT(string, &dout, &field_addr, real_packet->citizens_graphic);
54955 if (e) {
54956 log_packet_detailed("'citizens_graphic' field error detected");
54957 }
54958 }
54959 if (BV_ISSET(fields, 4)) {
54960 log_packet_detailed(" field 'reqs_count' has changed");
54961#ifdef FREECIV_JSON_CONNECTION
54962 field_addr.name = "reqs_count";
54963#endif /* FREECIV_JSON_CONNECTION */
54964 e = 0;
54965 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
54966 if (e) {
54967 log_packet_detailed("'reqs_count' field error detected");
54968 }
54969 }
54970 if (BV_ISSET(fields, 5)) {
54971 log_packet_detailed(" field 'reqs' has changed");
54972#ifdef FREECIV_JSON_CONNECTION
54973 field_addr.name = "reqs";
54974#endif /* FREECIV_JSON_CONNECTION */
54975 e = 0;
54976 {
54977 int i;
54978
54979#ifdef FREECIV_JSON_CONNECTION
54980 /* Create the array. */
54981 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
54982
54983 /* Enter the array. */
54984 field_addr.sub_location = plocation_elem_new(0);
54985#endif /* FREECIV_JSON_CONNECTION */
54986
54987 for (i = 0; i < real_packet->reqs_count; i++) {
54988#ifdef FREECIV_JSON_CONNECTION
54989 /* Next array element. */
54990 field_addr.sub_location->number = i;
54991#endif /* FREECIV_JSON_CONNECTION */
54992 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
54993 }
54994
54995#ifdef FREECIV_JSON_CONNECTION
54996 /* Exit array. */
54997 FC_FREE(field_addr.sub_location);
54998#endif /* FREECIV_JSON_CONNECTION */
54999 }
55000 if (e) {
55001 log_packet_detailed("'reqs' field error detected");
55002 }
55003 }
55004 if (BV_ISSET(fields, 6)) {
55005 log_packet_detailed(" field 'graphic' has changed");
55006#ifdef FREECIV_JSON_CONNECTION
55007 field_addr.name = "graphic";
55008#endif /* FREECIV_JSON_CONNECTION */
55009 e = 0;
55010 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic);
55011 if (e) {
55012 log_packet_detailed("'graphic' field error detected");
55013 }
55014 }
55015 if (BV_ISSET(fields, 7)) {
55016 log_packet_detailed(" field 'graphic_alt' has changed");
55017#ifdef FREECIV_JSON_CONNECTION
55018 field_addr.name = "graphic_alt";
55019#endif /* FREECIV_JSON_CONNECTION */
55020 e = 0;
55021 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
55022 if (e) {
55023 log_packet_detailed("'graphic_alt' field error detected");
55024 }
55025 }
55026
55027 *old = *real_packet;
55028#endif /* FREECIV_DELTA_PROTOCOL */
55029#ifndef FREECIV_DELTA_PROTOCOL
55030#ifdef FREECIV_JSON_CONNECTION
55031 field_addr.name = "style_id";
55032#endif /* FREECIV_JSON_CONNECTION */
55033 e = 0;
55034 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style_id);
55035 if (e) {
55036 log_packet_detailed("'style_id' field error detected");
55037 }
55038#ifdef FREECIV_JSON_CONNECTION
55039 field_addr.name = "name";
55040#endif /* FREECIV_JSON_CONNECTION */
55041 e = 0;
55042 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
55043 if (e) {
55044 log_packet_detailed("'name' field error detected");
55045 }
55046#ifdef FREECIV_JSON_CONNECTION
55047 field_addr.name = "rule_name";
55048#endif /* FREECIV_JSON_CONNECTION */
55049 e = 0;
55050 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
55051 if (e) {
55052 log_packet_detailed("'rule_name' field error detected");
55053 }
55054#ifdef FREECIV_JSON_CONNECTION
55055 field_addr.name = "citizens_graphic";
55056#endif /* FREECIV_JSON_CONNECTION */
55057 e = 0;
55058 e |= DIO_PUT(string, &dout, &field_addr, real_packet->citizens_graphic);
55059 if (e) {
55060 log_packet_detailed("'citizens_graphic' field error detected");
55061 }
55062#ifdef FREECIV_JSON_CONNECTION
55063 field_addr.name = "reqs_count";
55064#endif /* FREECIV_JSON_CONNECTION */
55065 e = 0;
55066 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
55067 if (e) {
55068 log_packet_detailed("'reqs_count' field error detected");
55069 }
55070#ifdef FREECIV_JSON_CONNECTION
55071 field_addr.name = "reqs";
55072#endif /* FREECIV_JSON_CONNECTION */
55073 e = 0;
55074 {
55075 int i;
55076
55077#ifdef FREECIV_JSON_CONNECTION
55078 /* Create the array. */
55079 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
55080
55081 /* Enter the array. */
55082 field_addr.sub_location = plocation_elem_new(0);
55083#endif /* FREECIV_JSON_CONNECTION */
55084
55085 for (i = 0; i < real_packet->reqs_count; i++) {
55086#ifdef FREECIV_JSON_CONNECTION
55087 /* Next array element. */
55088 field_addr.sub_location->number = i;
55089#endif /* FREECIV_JSON_CONNECTION */
55090 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
55091 }
55092
55093#ifdef FREECIV_JSON_CONNECTION
55094 /* Exit array. */
55095 FC_FREE(field_addr.sub_location);
55096#endif /* FREECIV_JSON_CONNECTION */
55097 }
55098 if (e) {
55099 log_packet_detailed("'reqs' field error detected");
55100 }
55101#ifdef FREECIV_JSON_CONNECTION
55102 field_addr.name = "graphic";
55103#endif /* FREECIV_JSON_CONNECTION */
55104 e = 0;
55105 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic);
55106 if (e) {
55107 log_packet_detailed("'graphic' field error detected");
55108 }
55109#ifdef FREECIV_JSON_CONNECTION
55110 field_addr.name = "graphic_alt";
55111#endif /* FREECIV_JSON_CONNECTION */
55112 e = 0;
55113 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
55114 if (e) {
55115 log_packet_detailed("'graphic_alt' field error detected");
55116 }
55117
55118#endif
55119 SEND_PACKET_END(PACKET_RULESET_CITY);
55120}
55121
55122 int send_packet_ruleset_city(struct connection *pc, const struct packet_ruleset_city *packet)
55123{
55124 if (!pc->used) {
55125 log_error("WARNING: trying to send data to the closed connection %s",
55126 conn_description(pc));
55127 return -1;
55128 }
55129 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CITY].packet != nullptr, -1,
55130 "Handler for PACKET_RULESET_CITY not installed");
55131 return pc->phs.handlers->send[PACKET_RULESET_CITY].packet(pc, packet);
55132}
55133
55134 void lsend_packet_ruleset_city(struct conn_list *dest, const struct packet_ruleset_city *packet)
55135{
55136 conn_list_iterate(dest, pconn) {
55137 send_packet_ruleset_city(pconn, packet);
55138 } conn_list_iterate_end;
55139}
55140
55141 static inline void init_packet_ruleset_building(struct packet_ruleset_building *packet)
55142{
55143 memset(packet, 0, sizeof(*packet));
55144
55145 /* no work needed for packet->id */
55146 /* no work needed for packet->genus */
55147 /* no work needed for packet->name */
55148 /* no work needed for packet->rule_name */
55149 /* no work needed for packet->graphic_str */
55150 /* no work needed for packet->graphic_alt */
55151 /* no work needed for packet->graphic_alt2 */
55152 /* no work needed for packet->reqs_count */
55153 /* no work needed for packet->reqs */
55154 /* no work needed for packet->obs_count */
55155 /* no work needed for packet->obs_reqs */
55156 /* no work needed for packet->build_cost */
55157 /* no work needed for packet->upkeep */
55158 /* no work needed for packet->sabotage */
55159 /* no work needed for packet->flags */
55160 /* no work needed for packet->soundtag */
55161 /* no work needed for packet->soundtag_alt */
55162 /* no work needed for packet->soundtag_alt2 */
55163 packet->helptext = strvec_new();
55164}
55165
55166 static inline void free_packet_ruleset_building(struct packet_ruleset_building *packet)
55167{
55168 if (packet->helptext) {
55169 strvec_destroy(packet->helptext);
55170 packet->helptext = nullptr;
55171 }
55172 /* no work needed for packet->soundtag_alt2 */
55173 /* no work needed for packet->soundtag_alt */
55174 /* no work needed for packet->soundtag */
55175 /* no work needed for packet->flags */
55176 /* no work needed for packet->sabotage */
55177 /* no work needed for packet->upkeep */
55178 /* no work needed for packet->build_cost */
55179 /* no work needed for packet->obs_reqs */
55180 /* no work needed for packet->obs_count */
55181 /* no work needed for packet->reqs */
55182 /* no work needed for packet->reqs_count */
55183 /* no work needed for packet->graphic_alt2 */
55184 /* no work needed for packet->graphic_alt */
55185 /* no work needed for packet->graphic_str */
55186 /* no work needed for packet->rule_name */
55187 /* no work needed for packet->name */
55188 /* no work needed for packet->genus */
55189 /* no work needed for packet->id */
55190}
55191
55192 static inline void destroy_packet_ruleset_building(void *packet)
55193{
55194 free_packet_ruleset_building((struct packet_ruleset_building *) packet);
55195 free(packet);
55196}
55197
55198#ifdef FREECIV_DELTA_PROTOCOL
55199#define hash_packet_ruleset_building_100 hash_const
55200
55201#define cmp_packet_ruleset_building_100 cmp_const
55202
55203 BV_DEFINE(packet_ruleset_building_100_fields, 19);
55204#endif /* FREECIV_DELTA_PROTOCOL */
55205
55206 static struct packet_ruleset_building *receive_packet_ruleset_building_100(struct connection *pc)
55207{
55208#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_building(_packet)
55209#ifdef FREECIV_DELTA_PROTOCOL
55210 packet_ruleset_building_100_fields fields;
55211 struct packet_ruleset_building *old;
55212 struct genhash **hash = pc->phs.received + PACKET_RULESET_BUILDING;
55213#endif /* FREECIV_DELTA_PROTOCOL */
55214 RECEIVE_PACKET_START(packet_ruleset_building, real_packet);
55215#ifdef FREECIV_JSON_CONNECTION
55216 struct plocation field_addr;
55217 {
55218 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
55219 field_addr = *field_addr_tmp;
55220 FC_FREE(field_addr_tmp);
55221 }
55222#endif /* FREECIV_JSON_CONNECTION */
55223
55224#ifdef FREECIV_DELTA_PROTOCOL
55225#ifdef FREECIV_JSON_CONNECTION
55226 field_addr.name = "fields";
55227#endif /* FREECIV_JSON_CONNECTION */
55228 DIO_BV_GET(&din, &field_addr, fields);
55229
55230#else /* FREECIV_DELTA_PROTOCOL */
55231#ifdef FREECIV_JSON_CONNECTION
55232 field_addr.name = "id";
55233#endif /* FREECIV_JSON_CONNECTION */
55234 {
55235 int readin;
55236
55237 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
55238 RECEIVE_PACKET_FIELD_ERROR(id);
55239 }
55240 real_packet->id = readin;
55241 }
55242#ifdef FREECIV_JSON_CONNECTION
55243 field_addr.name = "genus";
55244#endif /* FREECIV_JSON_CONNECTION */
55245 {
55246 int readin;
55247
55248 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
55249 RECEIVE_PACKET_FIELD_ERROR(genus);
55250 }
55251 real_packet->genus = readin;
55252 }
55253#ifdef FREECIV_JSON_CONNECTION
55254 field_addr.name = "name";
55255#endif /* FREECIV_JSON_CONNECTION */
55256 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
55257 RECEIVE_PACKET_FIELD_ERROR(name);
55258 }
55259#ifdef FREECIV_JSON_CONNECTION
55260 field_addr.name = "rule_name";
55261#endif /* FREECIV_JSON_CONNECTION */
55262 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
55263 RECEIVE_PACKET_FIELD_ERROR(rule_name);
55264 }
55265#ifdef FREECIV_JSON_CONNECTION
55266 field_addr.name = "graphic_str";
55267#endif /* FREECIV_JSON_CONNECTION */
55268 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
55269 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
55270 }
55271#ifdef FREECIV_JSON_CONNECTION
55272 field_addr.name = "graphic_alt";
55273#endif /* FREECIV_JSON_CONNECTION */
55274 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
55275 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
55276 }
55277#ifdef FREECIV_JSON_CONNECTION
55278 field_addr.name = "graphic_alt2";
55279#endif /* FREECIV_JSON_CONNECTION */
55280 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
55281 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
55282 }
55283#ifdef FREECIV_JSON_CONNECTION
55284 field_addr.name = "reqs_count";
55285#endif /* FREECIV_JSON_CONNECTION */
55286 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
55287 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
55288 }
55289#ifdef FREECIV_JSON_CONNECTION
55290 field_addr.name = "reqs";
55291#endif /* FREECIV_JSON_CONNECTION */
55292 {
55293 int i;
55294
55295#ifdef FREECIV_JSON_CONNECTION
55296 /* Enter array. */
55297 field_addr.sub_location = plocation_elem_new(0);
55298#endif /* FREECIV_JSON_CONNECTION */
55299
55300 if (real_packet->reqs_count > MAX_NUM_REQS) {
55301 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
55302 }
55303 for (i = 0; i < real_packet->reqs_count; i++) {
55304#ifdef FREECIV_JSON_CONNECTION
55305 field_addr.sub_location->number = i;
55306#endif /* FREECIV_JSON_CONNECTION */
55307 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
55308 RECEIVE_PACKET_FIELD_ERROR(reqs);
55309 }
55310 }
55311
55312#ifdef FREECIV_JSON_CONNECTION
55313 /* Exit array. */
55314 FC_FREE(field_addr.sub_location);
55315#endif /* FREECIV_JSON_CONNECTION */
55316 }
55317#ifdef FREECIV_JSON_CONNECTION
55318 field_addr.name = "obs_count";
55319#endif /* FREECIV_JSON_CONNECTION */
55320 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obs_count)) {
55321 RECEIVE_PACKET_FIELD_ERROR(obs_count);
55322 }
55323#ifdef FREECIV_JSON_CONNECTION
55324 field_addr.name = "obs_reqs";
55325#endif /* FREECIV_JSON_CONNECTION */
55326 {
55327 int i;
55328
55329#ifdef FREECIV_JSON_CONNECTION
55330 /* Enter array. */
55331 field_addr.sub_location = plocation_elem_new(0);
55332#endif /* FREECIV_JSON_CONNECTION */
55333
55334 if (real_packet->obs_count > MAX_NUM_REQS) {
55335 RECEIVE_PACKET_FIELD_ERROR(obs_reqs, ": truncation array");
55336 }
55337 for (i = 0; i < real_packet->obs_count; i++) {
55338#ifdef FREECIV_JSON_CONNECTION
55339 field_addr.sub_location->number = i;
55340#endif /* FREECIV_JSON_CONNECTION */
55341 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->obs_reqs[i])) {
55342 RECEIVE_PACKET_FIELD_ERROR(obs_reqs);
55343 }
55344 }
55345
55346#ifdef FREECIV_JSON_CONNECTION
55347 /* Exit array. */
55348 FC_FREE(field_addr.sub_location);
55349#endif /* FREECIV_JSON_CONNECTION */
55350 }
55351#ifdef FREECIV_JSON_CONNECTION
55352 field_addr.name = "build_cost";
55353#endif /* FREECIV_JSON_CONNECTION */
55354 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
55355 RECEIVE_PACKET_FIELD_ERROR(build_cost);
55356 }
55357#ifdef FREECIV_JSON_CONNECTION
55358 field_addr.name = "upkeep";
55359#endif /* FREECIV_JSON_CONNECTION */
55360 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep)) {
55361 RECEIVE_PACKET_FIELD_ERROR(upkeep);
55362 }
55363#ifdef FREECIV_JSON_CONNECTION
55364 field_addr.name = "sabotage";
55365#endif /* FREECIV_JSON_CONNECTION */
55366 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sabotage)) {
55367 RECEIVE_PACKET_FIELD_ERROR(sabotage);
55368 }
55369#ifdef FREECIV_JSON_CONNECTION
55370 field_addr.name = "flags";
55371#endif /* FREECIV_JSON_CONNECTION */
55372 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
55373 RECEIVE_PACKET_FIELD_ERROR(flags);
55374 }
55375#ifdef FREECIV_JSON_CONNECTION
55376 field_addr.name = "soundtag";
55377#endif /* FREECIV_JSON_CONNECTION */
55378 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag, sizeof(real_packet->soundtag))) {
55379 RECEIVE_PACKET_FIELD_ERROR(soundtag);
55380 }
55381#ifdef FREECIV_JSON_CONNECTION
55382 field_addr.name = "soundtag_alt";
55383#endif /* FREECIV_JSON_CONNECTION */
55384 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt, sizeof(real_packet->soundtag_alt))) {
55385 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt);
55386 }
55387#ifdef FREECIV_JSON_CONNECTION
55388 field_addr.name = "soundtag_alt2";
55389#endif /* FREECIV_JSON_CONNECTION */
55390 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt2, sizeof(real_packet->soundtag_alt2))) {
55391 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt2);
55392 }
55393#ifdef FREECIV_JSON_CONNECTION
55394 field_addr.name = "helptext";
55395#endif /* FREECIV_JSON_CONNECTION */
55396 {
55397 int i;
55398
55399 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
55400 RECEIVE_PACKET_FIELD_ERROR(helptext);
55401 }
55402 strvec_reserve(real_packet->helptext, i);
55403
55404#ifdef FREECIV_JSON_CONNECTION
55405 field_addr.sub_location = plocation_elem_new(0);
55406#endif /* FREECIV_JSON_CONNECTION */
55407
55408 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
55409 char readin[MAX_LEN_PACKET];
55410
55411#ifdef FREECIV_JSON_CONNECTION
55412 /* Next array element */
55413 field_addr.sub_location->number = i;
55414#endif /* FREECIV_JSON_CONNECTION */
55415
55416 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
55417 || !strvec_set(real_packet->helptext, i, readin)) {
55418 RECEIVE_PACKET_FIELD_ERROR(helptext);
55419 }
55420 }
55421
55422#ifdef FREECIV_JSON_CONNECTION
55423 FC_FREE(field_addr.sub_location);
55424#endif /* FREECIV_JSON_CONNECTION */
55425 }
55426#endif
55427 log_packet_detailed("packet_ruleset_building_100: got info about ()");
55428
55429#ifdef FREECIV_DELTA_PROTOCOL
55430 if (nullptr == *hash) {
55431 *hash = genhash_new_full(hash_packet_ruleset_building_100, cmp_packet_ruleset_building_100,
55432 nullptr, nullptr, nullptr, destroy_packet_ruleset_building);
55433 }
55434
55435 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
55436 real_packet->id = old->id;
55437 real_packet->genus = old->genus;
55438 sz_strlcpy(real_packet->name, old->name);
55439 sz_strlcpy(real_packet->rule_name, old->rule_name);
55440 sz_strlcpy(real_packet->graphic_str, old->graphic_str);
55441 sz_strlcpy(real_packet->graphic_alt, old->graphic_alt);
55442 sz_strlcpy(real_packet->graphic_alt2, old->graphic_alt2);
55443 real_packet->reqs_count = old->reqs_count;
55444 {
55445 int i;
55446
55447 for (i = 0; i < old->reqs_count; i++) {
55448 real_packet->reqs[i] = old->reqs[i];
55449 }
55450 }
55451 real_packet->obs_count = old->obs_count;
55452 {
55453 int i;
55454
55455 for (i = 0; i < old->obs_count; i++) {
55456 real_packet->obs_reqs[i] = old->obs_reqs[i];
55457 }
55458 }
55459 real_packet->build_cost = old->build_cost;
55460 real_packet->upkeep = old->upkeep;
55461 real_packet->sabotage = old->sabotage;
55462 real_packet->flags = old->flags;
55463 sz_strlcpy(real_packet->soundtag, old->soundtag);
55464 sz_strlcpy(real_packet->soundtag_alt, old->soundtag_alt);
55465 sz_strlcpy(real_packet->soundtag_alt2, old->soundtag_alt2);
55466 if (old->helptext) {
55467 strvec_copy(real_packet->helptext, old->helptext);
55468 } else {
55469 strvec_clear(real_packet->helptext);
55470 }
55471 } else {
55472 /* packet is already initialized empty */
55473 log_packet_detailed(" no old info");
55474 }
55475
55476 if (BV_ISSET(fields, 0)) {
55477 log_packet_detailed(" got field 'id'");
55478#ifdef FREECIV_JSON_CONNECTION
55479 field_addr.name = "id";
55480#endif /* FREECIV_JSON_CONNECTION */
55481 {
55482 int readin;
55483
55484 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
55485 RECEIVE_PACKET_FIELD_ERROR(id);
55486 }
55487 real_packet->id = readin;
55488 }
55489 }
55490 if (BV_ISSET(fields, 1)) {
55491 log_packet_detailed(" got field 'genus'");
55492#ifdef FREECIV_JSON_CONNECTION
55493 field_addr.name = "genus";
55494#endif /* FREECIV_JSON_CONNECTION */
55495 {
55496 int readin;
55497
55498 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
55499 RECEIVE_PACKET_FIELD_ERROR(genus);
55500 }
55501 real_packet->genus = readin;
55502 }
55503 }
55504 if (BV_ISSET(fields, 2)) {
55505 log_packet_detailed(" got field 'name'");
55506#ifdef FREECIV_JSON_CONNECTION
55507 field_addr.name = "name";
55508#endif /* FREECIV_JSON_CONNECTION */
55509 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
55510 RECEIVE_PACKET_FIELD_ERROR(name);
55511 }
55512 }
55513 if (BV_ISSET(fields, 3)) {
55514 log_packet_detailed(" got field 'rule_name'");
55515#ifdef FREECIV_JSON_CONNECTION
55516 field_addr.name = "rule_name";
55517#endif /* FREECIV_JSON_CONNECTION */
55518 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
55519 RECEIVE_PACKET_FIELD_ERROR(rule_name);
55520 }
55521 }
55522 if (BV_ISSET(fields, 4)) {
55523 log_packet_detailed(" got field 'graphic_str'");
55524#ifdef FREECIV_JSON_CONNECTION
55525 field_addr.name = "graphic_str";
55526#endif /* FREECIV_JSON_CONNECTION */
55527 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
55528 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
55529 }
55530 }
55531 if (BV_ISSET(fields, 5)) {
55532 log_packet_detailed(" got field 'graphic_alt'");
55533#ifdef FREECIV_JSON_CONNECTION
55534 field_addr.name = "graphic_alt";
55535#endif /* FREECIV_JSON_CONNECTION */
55536 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
55537 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
55538 }
55539 }
55540 if (BV_ISSET(fields, 6)) {
55541 log_packet_detailed(" got field 'graphic_alt2'");
55542#ifdef FREECIV_JSON_CONNECTION
55543 field_addr.name = "graphic_alt2";
55544#endif /* FREECIV_JSON_CONNECTION */
55545 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
55546 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
55547 }
55548 }
55549 if (BV_ISSET(fields, 7)) {
55550 log_packet_detailed(" got field 'reqs_count'");
55551#ifdef FREECIV_JSON_CONNECTION
55552 field_addr.name = "reqs_count";
55553#endif /* FREECIV_JSON_CONNECTION */
55554 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
55555 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
55556 }
55557 }
55558 if (BV_ISSET(fields, 8)) {
55559 log_packet_detailed(" got field 'reqs'");
55560#ifdef FREECIV_JSON_CONNECTION
55561 field_addr.name = "reqs";
55562#endif /* FREECIV_JSON_CONNECTION */
55563 {
55564 int i;
55565
55566#ifdef FREECIV_JSON_CONNECTION
55567 /* Enter array. */
55568 field_addr.sub_location = plocation_elem_new(0);
55569#endif /* FREECIV_JSON_CONNECTION */
55570
55571 if (real_packet->reqs_count > MAX_NUM_REQS) {
55572 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
55573 }
55574 for (i = 0; i < real_packet->reqs_count; i++) {
55575#ifdef FREECIV_JSON_CONNECTION
55576 field_addr.sub_location->number = i;
55577#endif /* FREECIV_JSON_CONNECTION */
55578 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
55579 RECEIVE_PACKET_FIELD_ERROR(reqs);
55580 }
55581 }
55582
55583#ifdef FREECIV_JSON_CONNECTION
55584 /* Exit array. */
55585 FC_FREE(field_addr.sub_location);
55586#endif /* FREECIV_JSON_CONNECTION */
55587 }
55588 }
55589 if (BV_ISSET(fields, 9)) {
55590 log_packet_detailed(" got field 'obs_count'");
55591#ifdef FREECIV_JSON_CONNECTION
55592 field_addr.name = "obs_count";
55593#endif /* FREECIV_JSON_CONNECTION */
55594 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obs_count)) {
55595 RECEIVE_PACKET_FIELD_ERROR(obs_count);
55596 }
55597 }
55598 if (BV_ISSET(fields, 10)) {
55599 log_packet_detailed(" got field 'obs_reqs'");
55600#ifdef FREECIV_JSON_CONNECTION
55601 field_addr.name = "obs_reqs";
55602#endif /* FREECIV_JSON_CONNECTION */
55603 {
55604 int i;
55605
55606#ifdef FREECIV_JSON_CONNECTION
55607 /* Enter array. */
55608 field_addr.sub_location = plocation_elem_new(0);
55609#endif /* FREECIV_JSON_CONNECTION */
55610
55611 if (real_packet->obs_count > MAX_NUM_REQS) {
55612 RECEIVE_PACKET_FIELD_ERROR(obs_reqs, ": truncation array");
55613 }
55614 for (i = 0; i < real_packet->obs_count; i++) {
55615#ifdef FREECIV_JSON_CONNECTION
55616 field_addr.sub_location->number = i;
55617#endif /* FREECIV_JSON_CONNECTION */
55618 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->obs_reqs[i])) {
55619 RECEIVE_PACKET_FIELD_ERROR(obs_reqs);
55620 }
55621 }
55622
55623#ifdef FREECIV_JSON_CONNECTION
55624 /* Exit array. */
55625 FC_FREE(field_addr.sub_location);
55626#endif /* FREECIV_JSON_CONNECTION */
55627 }
55628 }
55629 if (BV_ISSET(fields, 11)) {
55630 log_packet_detailed(" got field 'build_cost'");
55631#ifdef FREECIV_JSON_CONNECTION
55632 field_addr.name = "build_cost";
55633#endif /* FREECIV_JSON_CONNECTION */
55634 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
55635 RECEIVE_PACKET_FIELD_ERROR(build_cost);
55636 }
55637 }
55638 if (BV_ISSET(fields, 12)) {
55639 log_packet_detailed(" got field 'upkeep'");
55640#ifdef FREECIV_JSON_CONNECTION
55641 field_addr.name = "upkeep";
55642#endif /* FREECIV_JSON_CONNECTION */
55643 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep)) {
55644 RECEIVE_PACKET_FIELD_ERROR(upkeep);
55645 }
55646 }
55647 if (BV_ISSET(fields, 13)) {
55648 log_packet_detailed(" got field 'sabotage'");
55649#ifdef FREECIV_JSON_CONNECTION
55650 field_addr.name = "sabotage";
55651#endif /* FREECIV_JSON_CONNECTION */
55652 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sabotage)) {
55653 RECEIVE_PACKET_FIELD_ERROR(sabotage);
55654 }
55655 }
55656 if (BV_ISSET(fields, 14)) {
55657 log_packet_detailed(" got field 'flags'");
55658#ifdef FREECIV_JSON_CONNECTION
55659 field_addr.name = "flags";
55660#endif /* FREECIV_JSON_CONNECTION */
55661 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
55662 RECEIVE_PACKET_FIELD_ERROR(flags);
55663 }
55664 }
55665 if (BV_ISSET(fields, 15)) {
55666 log_packet_detailed(" got field 'soundtag'");
55667#ifdef FREECIV_JSON_CONNECTION
55668 field_addr.name = "soundtag";
55669#endif /* FREECIV_JSON_CONNECTION */
55670 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag, sizeof(real_packet->soundtag))) {
55671 RECEIVE_PACKET_FIELD_ERROR(soundtag);
55672 }
55673 }
55674 if (BV_ISSET(fields, 16)) {
55675 log_packet_detailed(" got field 'soundtag_alt'");
55676#ifdef FREECIV_JSON_CONNECTION
55677 field_addr.name = "soundtag_alt";
55678#endif /* FREECIV_JSON_CONNECTION */
55679 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt, sizeof(real_packet->soundtag_alt))) {
55680 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt);
55681 }
55682 }
55683 if (BV_ISSET(fields, 17)) {
55684 log_packet_detailed(" got field 'soundtag_alt2'");
55685#ifdef FREECIV_JSON_CONNECTION
55686 field_addr.name = "soundtag_alt2";
55687#endif /* FREECIV_JSON_CONNECTION */
55688 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt2, sizeof(real_packet->soundtag_alt2))) {
55689 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt2);
55690 }
55691 }
55692 if (BV_ISSET(fields, 18)) {
55693 log_packet_detailed(" got field 'helptext'");
55694#ifdef FREECIV_JSON_CONNECTION
55695 field_addr.name = "helptext";
55696#endif /* FREECIV_JSON_CONNECTION */
55697 {
55698 int i;
55699
55700 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
55701 RECEIVE_PACKET_FIELD_ERROR(helptext);
55702 }
55703 strvec_reserve(real_packet->helptext, i);
55704
55705#ifdef FREECIV_JSON_CONNECTION
55706 field_addr.sub_location = plocation_elem_new(0);
55707#endif /* FREECIV_JSON_CONNECTION */
55708
55709 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
55710 char readin[MAX_LEN_PACKET];
55711
55712#ifdef FREECIV_JSON_CONNECTION
55713 /* Next array element */
55714 field_addr.sub_location->number = i;
55715#endif /* FREECIV_JSON_CONNECTION */
55716
55717 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
55718 || !strvec_set(real_packet->helptext, i, readin)) {
55719 RECEIVE_PACKET_FIELD_ERROR(helptext);
55720 }
55721 }
55722
55723#ifdef FREECIV_JSON_CONNECTION
55724 FC_FREE(field_addr.sub_location);
55725#endif /* FREECIV_JSON_CONNECTION */
55726 }
55727 }
55728
55729 if (nullptr == old) {
55730 old = fc_malloc(sizeof(*old));
55731 init_packet_ruleset_building(old);
55732 old->id = real_packet->id;
55733 old->genus = real_packet->genus;
55734 sz_strlcpy(old->name, real_packet->name);
55735 sz_strlcpy(old->rule_name, real_packet->rule_name);
55736 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
55737 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
55738 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
55739 old->reqs_count = real_packet->reqs_count;
55740 {
55741 int i;
55742
55743 for (i = 0; i < real_packet->reqs_count; i++) {
55744 old->reqs[i] = real_packet->reqs[i];
55745 }
55746 }
55747 old->obs_count = real_packet->obs_count;
55748 {
55749 int i;
55750
55751 for (i = 0; i < real_packet->obs_count; i++) {
55752 old->obs_reqs[i] = real_packet->obs_reqs[i];
55753 }
55754 }
55755 old->build_cost = real_packet->build_cost;
55756 old->upkeep = real_packet->upkeep;
55757 old->sabotage = real_packet->sabotage;
55758 old->flags = real_packet->flags;
55759 sz_strlcpy(old->soundtag, real_packet->soundtag);
55760 sz_strlcpy(old->soundtag_alt, real_packet->soundtag_alt);
55761 sz_strlcpy(old->soundtag_alt2, real_packet->soundtag_alt2);
55762 if (real_packet->helptext) {
55763 strvec_copy(old->helptext, real_packet->helptext);
55764 } else {
55765 strvec_clear(old->helptext);
55766 }
55767 genhash_insert(*hash, old, old);
55768 } else {
55769 old->id = real_packet->id;
55770 old->genus = real_packet->genus;
55771 sz_strlcpy(old->name, real_packet->name);
55772 sz_strlcpy(old->rule_name, real_packet->rule_name);
55773 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
55774 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
55775 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
55776 old->reqs_count = real_packet->reqs_count;
55777 {
55778 int i;
55779
55780 for (i = 0; i < real_packet->reqs_count; i++) {
55781 old->reqs[i] = real_packet->reqs[i];
55782 }
55783 }
55784 old->obs_count = real_packet->obs_count;
55785 {
55786 int i;
55787
55788 for (i = 0; i < real_packet->obs_count; i++) {
55789 old->obs_reqs[i] = real_packet->obs_reqs[i];
55790 }
55791 }
55792 old->build_cost = real_packet->build_cost;
55793 old->upkeep = real_packet->upkeep;
55794 old->sabotage = real_packet->sabotage;
55795 old->flags = real_packet->flags;
55796 sz_strlcpy(old->soundtag, real_packet->soundtag);
55797 sz_strlcpy(old->soundtag_alt, real_packet->soundtag_alt);
55798 sz_strlcpy(old->soundtag_alt2, real_packet->soundtag_alt2);
55799 if (real_packet->helptext) {
55800 strvec_copy(old->helptext, real_packet->helptext);
55801 } else {
55802 strvec_clear(old->helptext);
55803 }
55804 }
55805
55806#endif /* FREECIV_DELTA_PROTOCOL */
55807 RECEIVE_PACKET_END(real_packet);
55808#undef FREE_PACKET_STRUCT
55809}
55810
55811 static int send_packet_ruleset_building_100(struct connection *pc, const struct packet_ruleset_building *packet)
55812{
55813 const struct packet_ruleset_building *real_packet = packet;
55814 int e;
55815#ifdef FREECIV_DELTA_PROTOCOL
55816 packet_ruleset_building_100_fields fields;
55817 struct packet_ruleset_building *old;
55818 bool differ;
55819 struct genhash **hash = pc->phs.sent + PACKET_RULESET_BUILDING;
55820#endif /* FREECIV_DELTA_PROTOCOL */
55821 SEND_PACKET_START(PACKET_RULESET_BUILDING);
55822#ifdef FREECIV_JSON_CONNECTION
55823 struct plocation field_addr;
55824 {
55825 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
55826 field_addr = *field_addr_tmp;
55827 FC_FREE(field_addr_tmp);
55828 }
55829#endif /* FREECIV_JSON_CONNECTION */
55830
55831 log_packet_detailed("packet_ruleset_building_100: sending info about ()");
55832
55833#ifdef FREECIV_DELTA_PROTOCOL
55834 if (nullptr == *hash) {
55835 *hash = genhash_new_full(hash_packet_ruleset_building_100, cmp_packet_ruleset_building_100,
55836 nullptr, nullptr, nullptr, destroy_packet_ruleset_building);
55837 }
55838 BV_CLR_ALL(fields);
55839
55840 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
55841 old = fc_malloc(sizeof(*old));
55842 /* temporary bitcopy just to insert correctly */
55843 *old = *real_packet;
55844 genhash_insert(*hash, old, old);
55845 init_packet_ruleset_building(old);
55846 }
55847 differ = (old->id != real_packet->id);
55848 if (differ) {
55849 BV_SET(fields, 0);
55850 }
55851
55852 differ = (old->genus != real_packet->genus);
55853 if (differ) {
55854 BV_SET(fields, 1);
55855 }
55856
55857 differ = (strcmp(old->name, real_packet->name) != 0);
55858 if (differ) {
55859 BV_SET(fields, 2);
55860 }
55861
55862 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
55863 if (differ) {
55864 BV_SET(fields, 3);
55865 }
55866
55867 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
55868 if (differ) {
55869 BV_SET(fields, 4);
55870 }
55871
55872 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
55873 if (differ) {
55874 BV_SET(fields, 5);
55875 }
55876
55877 differ = (strcmp(old->graphic_alt2, real_packet->graphic_alt2) != 0);
55878 if (differ) {
55879 BV_SET(fields, 6);
55880 }
55881
55882 differ = (old->reqs_count != real_packet->reqs_count);
55883 if (differ) {
55884 BV_SET(fields, 7);
55885 }
55886
55887 differ = (old->reqs_count != real_packet->reqs_count);
55888 if (!differ) {
55889 int i;
55890
55891 for (i = 0; i < real_packet->reqs_count; i++) {
55892 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
55893 if (differ) {
55894 break;
55895 }
55896 }
55897 }
55898 if (differ) {
55899 BV_SET(fields, 8);
55900 }
55901
55902 differ = (old->obs_count != real_packet->obs_count);
55903 if (differ) {
55904 BV_SET(fields, 9);
55905 }
55906
55907 differ = (old->obs_count != real_packet->obs_count);
55908 if (!differ) {
55909 int i;
55910
55911 for (i = 0; i < real_packet->obs_count; i++) {
55912 differ = !are_requirements_equal(&old->obs_reqs[i], &real_packet->obs_reqs[i]);
55913 if (differ) {
55914 break;
55915 }
55916 }
55917 }
55918 if (differ) {
55919 BV_SET(fields, 10);
55920 }
55921
55922 differ = (old->build_cost != real_packet->build_cost);
55923 if (differ) {
55924 BV_SET(fields, 11);
55925 }
55926
55927 differ = (old->upkeep != real_packet->upkeep);
55928 if (differ) {
55929 BV_SET(fields, 12);
55930 }
55931
55932 differ = (old->sabotage != real_packet->sabotage);
55933 if (differ) {
55934 BV_SET(fields, 13);
55935 }
55936
55937 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
55938 if (differ) {
55939 BV_SET(fields, 14);
55940 }
55941
55942 differ = (strcmp(old->soundtag, real_packet->soundtag) != 0);
55943 if (differ) {
55944 BV_SET(fields, 15);
55945 }
55946
55947 differ = (strcmp(old->soundtag_alt, real_packet->soundtag_alt) != 0);
55948 if (differ) {
55949 BV_SET(fields, 16);
55950 }
55951
55952 differ = (strcmp(old->soundtag_alt2, real_packet->soundtag_alt2) != 0);
55953 if (differ) {
55954 BV_SET(fields, 17);
55955 }
55956
55957 if (real_packet->helptext) {
55958 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
55959 } else {
55960 differ = (strvec_size(old->helptext) > 0);
55961 }
55962 if (differ) {
55963 BV_SET(fields, 18);
55964 }
55965
55966
55967#ifdef FREECIV_JSON_CONNECTION
55968 field_addr.name = "fields";
55969#endif /* FREECIV_JSON_CONNECTION */
55970 e = 0;
55971 e |= DIO_BV_PUT(&dout, &field_addr, fields);
55972 if (e) {
55973 log_packet_detailed("fields bitvector error detected");
55974 }
55975
55976 if (BV_ISSET(fields, 0)) {
55977 log_packet_detailed(" field 'id' has changed");
55978#ifdef FREECIV_JSON_CONNECTION
55979 field_addr.name = "id";
55980#endif /* FREECIV_JSON_CONNECTION */
55981 e = 0;
55982 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
55983 if (e) {
55984 log_packet_detailed("'id' field error detected");
55985 }
55986 }
55987 if (BV_ISSET(fields, 1)) {
55988 log_packet_detailed(" field 'genus' has changed");
55989#ifdef FREECIV_JSON_CONNECTION
55990 field_addr.name = "genus";
55991#endif /* FREECIV_JSON_CONNECTION */
55992 e = 0;
55993 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->genus);
55994 if (e) {
55995 log_packet_detailed("'genus' field error detected");
55996 }
55997 }
55998 if (BV_ISSET(fields, 2)) {
55999 log_packet_detailed(" field 'name' has changed");
56000#ifdef FREECIV_JSON_CONNECTION
56001 field_addr.name = "name";
56002#endif /* FREECIV_JSON_CONNECTION */
56003 e = 0;
56004 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56005 if (e) {
56006 log_packet_detailed("'name' field error detected");
56007 }
56008 }
56009 if (BV_ISSET(fields, 3)) {
56010 log_packet_detailed(" field 'rule_name' has changed");
56011#ifdef FREECIV_JSON_CONNECTION
56012 field_addr.name = "rule_name";
56013#endif /* FREECIV_JSON_CONNECTION */
56014 e = 0;
56015 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
56016 if (e) {
56017 log_packet_detailed("'rule_name' field error detected");
56018 }
56019 }
56020 if (BV_ISSET(fields, 4)) {
56021 log_packet_detailed(" field 'graphic_str' has changed");
56022#ifdef FREECIV_JSON_CONNECTION
56023 field_addr.name = "graphic_str";
56024#endif /* FREECIV_JSON_CONNECTION */
56025 e = 0;
56026 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
56027 if (e) {
56028 log_packet_detailed("'graphic_str' field error detected");
56029 }
56030 }
56031 if (BV_ISSET(fields, 5)) {
56032 log_packet_detailed(" field 'graphic_alt' has changed");
56033#ifdef FREECIV_JSON_CONNECTION
56034 field_addr.name = "graphic_alt";
56035#endif /* FREECIV_JSON_CONNECTION */
56036 e = 0;
56037 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
56038 if (e) {
56039 log_packet_detailed("'graphic_alt' field error detected");
56040 }
56041 }
56042 if (BV_ISSET(fields, 6)) {
56043 log_packet_detailed(" field 'graphic_alt2' has changed");
56044#ifdef FREECIV_JSON_CONNECTION
56045 field_addr.name = "graphic_alt2";
56046#endif /* FREECIV_JSON_CONNECTION */
56047 e = 0;
56048 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
56049 if (e) {
56050 log_packet_detailed("'graphic_alt2' field error detected");
56051 }
56052 }
56053 if (BV_ISSET(fields, 7)) {
56054 log_packet_detailed(" field 'reqs_count' has changed");
56055#ifdef FREECIV_JSON_CONNECTION
56056 field_addr.name = "reqs_count";
56057#endif /* FREECIV_JSON_CONNECTION */
56058 e = 0;
56059 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
56060 if (e) {
56061 log_packet_detailed("'reqs_count' field error detected");
56062 }
56063 }
56064 if (BV_ISSET(fields, 8)) {
56065 log_packet_detailed(" field 'reqs' has changed");
56066#ifdef FREECIV_JSON_CONNECTION
56067 field_addr.name = "reqs";
56068#endif /* FREECIV_JSON_CONNECTION */
56069 e = 0;
56070 {
56071 int i;
56072
56073#ifdef FREECIV_JSON_CONNECTION
56074 /* Create the array. */
56075 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
56076
56077 /* Enter the array. */
56078 field_addr.sub_location = plocation_elem_new(0);
56079#endif /* FREECIV_JSON_CONNECTION */
56080
56081 for (i = 0; i < real_packet->reqs_count; i++) {
56082#ifdef FREECIV_JSON_CONNECTION
56083 /* Next array element. */
56084 field_addr.sub_location->number = i;
56085#endif /* FREECIV_JSON_CONNECTION */
56086 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
56087 }
56088
56089#ifdef FREECIV_JSON_CONNECTION
56090 /* Exit array. */
56091 FC_FREE(field_addr.sub_location);
56092#endif /* FREECIV_JSON_CONNECTION */
56093 }
56094 if (e) {
56095 log_packet_detailed("'reqs' field error detected");
56096 }
56097 }
56098 if (BV_ISSET(fields, 9)) {
56099 log_packet_detailed(" field 'obs_count' has changed");
56100#ifdef FREECIV_JSON_CONNECTION
56101 field_addr.name = "obs_count";
56102#endif /* FREECIV_JSON_CONNECTION */
56103 e = 0;
56104 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obs_count);
56105 if (e) {
56106 log_packet_detailed("'obs_count' field error detected");
56107 }
56108 }
56109 if (BV_ISSET(fields, 10)) {
56110 log_packet_detailed(" field 'obs_reqs' has changed");
56111#ifdef FREECIV_JSON_CONNECTION
56112 field_addr.name = "obs_reqs";
56113#endif /* FREECIV_JSON_CONNECTION */
56114 e = 0;
56115 {
56116 int i;
56117
56118#ifdef FREECIV_JSON_CONNECTION
56119 /* Create the array. */
56120 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->obs_count);
56121
56122 /* Enter the array. */
56123 field_addr.sub_location = plocation_elem_new(0);
56124#endif /* FREECIV_JSON_CONNECTION */
56125
56126 for (i = 0; i < real_packet->obs_count; i++) {
56127#ifdef FREECIV_JSON_CONNECTION
56128 /* Next array element. */
56129 field_addr.sub_location->number = i;
56130#endif /* FREECIV_JSON_CONNECTION */
56131 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->obs_reqs[i]);
56132 }
56133
56134#ifdef FREECIV_JSON_CONNECTION
56135 /* Exit array. */
56136 FC_FREE(field_addr.sub_location);
56137#endif /* FREECIV_JSON_CONNECTION */
56138 }
56139 if (e) {
56140 log_packet_detailed("'obs_reqs' field error detected");
56141 }
56142 }
56143 if (BV_ISSET(fields, 11)) {
56144 log_packet_detailed(" field 'build_cost' has changed");
56145#ifdef FREECIV_JSON_CONNECTION
56146 field_addr.name = "build_cost";
56147#endif /* FREECIV_JSON_CONNECTION */
56148 e = 0;
56149 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
56150 if (e) {
56151 log_packet_detailed("'build_cost' field error detected");
56152 }
56153 }
56154 if (BV_ISSET(fields, 12)) {
56155 log_packet_detailed(" field 'upkeep' has changed");
56156#ifdef FREECIV_JSON_CONNECTION
56157 field_addr.name = "upkeep";
56158#endif /* FREECIV_JSON_CONNECTION */
56159 e = 0;
56160 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep);
56161 if (e) {
56162 log_packet_detailed("'upkeep' field error detected");
56163 }
56164 }
56165 if (BV_ISSET(fields, 13)) {
56166 log_packet_detailed(" field 'sabotage' has changed");
56167#ifdef FREECIV_JSON_CONNECTION
56168 field_addr.name = "sabotage";
56169#endif /* FREECIV_JSON_CONNECTION */
56170 e = 0;
56171 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sabotage);
56172 if (e) {
56173 log_packet_detailed("'sabotage' field error detected");
56174 }
56175 }
56176 if (BV_ISSET(fields, 14)) {
56177 log_packet_detailed(" field 'flags' has changed");
56178#ifdef FREECIV_JSON_CONNECTION
56179 field_addr.name = "flags";
56180#endif /* FREECIV_JSON_CONNECTION */
56181 e = 0;
56182 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
56183 if (e) {
56184 log_packet_detailed("'flags' field error detected");
56185 }
56186 }
56187 if (BV_ISSET(fields, 15)) {
56188 log_packet_detailed(" field 'soundtag' has changed");
56189#ifdef FREECIV_JSON_CONNECTION
56190 field_addr.name = "soundtag";
56191#endif /* FREECIV_JSON_CONNECTION */
56192 e = 0;
56193 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag);
56194 if (e) {
56195 log_packet_detailed("'soundtag' field error detected");
56196 }
56197 }
56198 if (BV_ISSET(fields, 16)) {
56199 log_packet_detailed(" field 'soundtag_alt' has changed");
56200#ifdef FREECIV_JSON_CONNECTION
56201 field_addr.name = "soundtag_alt";
56202#endif /* FREECIV_JSON_CONNECTION */
56203 e = 0;
56204 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt);
56205 if (e) {
56206 log_packet_detailed("'soundtag_alt' field error detected");
56207 }
56208 }
56209 if (BV_ISSET(fields, 17)) {
56210 log_packet_detailed(" field 'soundtag_alt2' has changed");
56211#ifdef FREECIV_JSON_CONNECTION
56212 field_addr.name = "soundtag_alt2";
56213#endif /* FREECIV_JSON_CONNECTION */
56214 e = 0;
56215 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt2);
56216 if (e) {
56217 log_packet_detailed("'soundtag_alt2' field error detected");
56218 }
56219 }
56220 if (BV_ISSET(fields, 18)) {
56221 log_packet_detailed(" field 'helptext' has changed");
56222#ifdef FREECIV_JSON_CONNECTION
56223 field_addr.name = "helptext";
56224#endif /* FREECIV_JSON_CONNECTION */
56225 e = 0;
56226 if (!real_packet->helptext) {
56227 /* Transmit null vector as empty vector */
56228 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
56229 } else {
56230 int i;
56231
56232 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
56233 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
56234
56235#ifdef FREECIV_JSON_CONNECTION
56236 field_addr.sub_location = plocation_elem_new(0);
56237#endif /* FREECIV_JSON_CONNECTION */
56238
56239 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
56240 const char *pstr = strvec_get(real_packet->helptext, i);
56241
56242 if (!pstr) {
56243 /* Transmit null strings as empty strings */
56244 pstr = "";
56245 }
56246
56247#ifdef FREECIV_JSON_CONNECTION
56248 /* Next array element */
56249 field_addr.sub_location->number = i;
56250#endif /* FREECIV_JSON_CONNECTION */
56251
56252 e |= DIO_PUT(string, &dout, &field_addr, pstr);
56253 }
56254
56255#ifdef FREECIV_JSON_CONNECTION
56256 FC_FREE(field_addr.sub_location);
56257#endif /* FREECIV_JSON_CONNECTION */
56258 }
56259 if (e) {
56260 log_packet_detailed("'helptext' field error detected");
56261 }
56262 }
56263
56264 old->id = real_packet->id;
56265 old->genus = real_packet->genus;
56266 sz_strlcpy(old->name, real_packet->name);
56267 sz_strlcpy(old->rule_name, real_packet->rule_name);
56268 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
56269 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
56270 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
56271 old->reqs_count = real_packet->reqs_count;
56272 {
56273 int i;
56274
56275 for (i = 0; i < real_packet->reqs_count; i++) {
56276 old->reqs[i] = real_packet->reqs[i];
56277 }
56278 }
56279 old->obs_count = real_packet->obs_count;
56280 {
56281 int i;
56282
56283 for (i = 0; i < real_packet->obs_count; i++) {
56284 old->obs_reqs[i] = real_packet->obs_reqs[i];
56285 }
56286 }
56287 old->build_cost = real_packet->build_cost;
56288 old->upkeep = real_packet->upkeep;
56289 old->sabotage = real_packet->sabotage;
56290 old->flags = real_packet->flags;
56291 sz_strlcpy(old->soundtag, real_packet->soundtag);
56292 sz_strlcpy(old->soundtag_alt, real_packet->soundtag_alt);
56293 sz_strlcpy(old->soundtag_alt2, real_packet->soundtag_alt2);
56294 if (real_packet->helptext) {
56295 strvec_copy(old->helptext, real_packet->helptext);
56296 } else {
56297 strvec_clear(old->helptext);
56298 }
56299#endif /* FREECIV_DELTA_PROTOCOL */
56300#ifndef FREECIV_DELTA_PROTOCOL
56301#ifdef FREECIV_JSON_CONNECTION
56302 field_addr.name = "id";
56303#endif /* FREECIV_JSON_CONNECTION */
56304 e = 0;
56305 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56306 if (e) {
56307 log_packet_detailed("'id' field error detected");
56308 }
56309#ifdef FREECIV_JSON_CONNECTION
56310 field_addr.name = "genus";
56311#endif /* FREECIV_JSON_CONNECTION */
56312 e = 0;
56313 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->genus);
56314 if (e) {
56315 log_packet_detailed("'genus' field error detected");
56316 }
56317#ifdef FREECIV_JSON_CONNECTION
56318 field_addr.name = "name";
56319#endif /* FREECIV_JSON_CONNECTION */
56320 e = 0;
56321 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56322 if (e) {
56323 log_packet_detailed("'name' field error detected");
56324 }
56325#ifdef FREECIV_JSON_CONNECTION
56326 field_addr.name = "rule_name";
56327#endif /* FREECIV_JSON_CONNECTION */
56328 e = 0;
56329 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
56330 if (e) {
56331 log_packet_detailed("'rule_name' field error detected");
56332 }
56333#ifdef FREECIV_JSON_CONNECTION
56334 field_addr.name = "graphic_str";
56335#endif /* FREECIV_JSON_CONNECTION */
56336 e = 0;
56337 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
56338 if (e) {
56339 log_packet_detailed("'graphic_str' field error detected");
56340 }
56341#ifdef FREECIV_JSON_CONNECTION
56342 field_addr.name = "graphic_alt";
56343#endif /* FREECIV_JSON_CONNECTION */
56344 e = 0;
56345 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
56346 if (e) {
56347 log_packet_detailed("'graphic_alt' field error detected");
56348 }
56349#ifdef FREECIV_JSON_CONNECTION
56350 field_addr.name = "graphic_alt2";
56351#endif /* FREECIV_JSON_CONNECTION */
56352 e = 0;
56353 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
56354 if (e) {
56355 log_packet_detailed("'graphic_alt2' field error detected");
56356 }
56357#ifdef FREECIV_JSON_CONNECTION
56358 field_addr.name = "reqs_count";
56359#endif /* FREECIV_JSON_CONNECTION */
56360 e = 0;
56361 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
56362 if (e) {
56363 log_packet_detailed("'reqs_count' field error detected");
56364 }
56365#ifdef FREECIV_JSON_CONNECTION
56366 field_addr.name = "reqs";
56367#endif /* FREECIV_JSON_CONNECTION */
56368 e = 0;
56369 {
56370 int i;
56371
56372#ifdef FREECIV_JSON_CONNECTION
56373 /* Create the array. */
56374 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
56375
56376 /* Enter the array. */
56377 field_addr.sub_location = plocation_elem_new(0);
56378#endif /* FREECIV_JSON_CONNECTION */
56379
56380 for (i = 0; i < real_packet->reqs_count; i++) {
56381#ifdef FREECIV_JSON_CONNECTION
56382 /* Next array element. */
56383 field_addr.sub_location->number = i;
56384#endif /* FREECIV_JSON_CONNECTION */
56385 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
56386 }
56387
56388#ifdef FREECIV_JSON_CONNECTION
56389 /* Exit array. */
56390 FC_FREE(field_addr.sub_location);
56391#endif /* FREECIV_JSON_CONNECTION */
56392 }
56393 if (e) {
56394 log_packet_detailed("'reqs' field error detected");
56395 }
56396#ifdef FREECIV_JSON_CONNECTION
56397 field_addr.name = "obs_count";
56398#endif /* FREECIV_JSON_CONNECTION */
56399 e = 0;
56400 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obs_count);
56401 if (e) {
56402 log_packet_detailed("'obs_count' field error detected");
56403 }
56404#ifdef FREECIV_JSON_CONNECTION
56405 field_addr.name = "obs_reqs";
56406#endif /* FREECIV_JSON_CONNECTION */
56407 e = 0;
56408 {
56409 int i;
56410
56411#ifdef FREECIV_JSON_CONNECTION
56412 /* Create the array. */
56413 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->obs_count);
56414
56415 /* Enter the array. */
56416 field_addr.sub_location = plocation_elem_new(0);
56417#endif /* FREECIV_JSON_CONNECTION */
56418
56419 for (i = 0; i < real_packet->obs_count; i++) {
56420#ifdef FREECIV_JSON_CONNECTION
56421 /* Next array element. */
56422 field_addr.sub_location->number = i;
56423#endif /* FREECIV_JSON_CONNECTION */
56424 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->obs_reqs[i]);
56425 }
56426
56427#ifdef FREECIV_JSON_CONNECTION
56428 /* Exit array. */
56429 FC_FREE(field_addr.sub_location);
56430#endif /* FREECIV_JSON_CONNECTION */
56431 }
56432 if (e) {
56433 log_packet_detailed("'obs_reqs' field error detected");
56434 }
56435#ifdef FREECIV_JSON_CONNECTION
56436 field_addr.name = "build_cost";
56437#endif /* FREECIV_JSON_CONNECTION */
56438 e = 0;
56439 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
56440 if (e) {
56441 log_packet_detailed("'build_cost' field error detected");
56442 }
56443#ifdef FREECIV_JSON_CONNECTION
56444 field_addr.name = "upkeep";
56445#endif /* FREECIV_JSON_CONNECTION */
56446 e = 0;
56447 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep);
56448 if (e) {
56449 log_packet_detailed("'upkeep' field error detected");
56450 }
56451#ifdef FREECIV_JSON_CONNECTION
56452 field_addr.name = "sabotage";
56453#endif /* FREECIV_JSON_CONNECTION */
56454 e = 0;
56455 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sabotage);
56456 if (e) {
56457 log_packet_detailed("'sabotage' field error detected");
56458 }
56459#ifdef FREECIV_JSON_CONNECTION
56460 field_addr.name = "flags";
56461#endif /* FREECIV_JSON_CONNECTION */
56462 e = 0;
56463 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
56464 if (e) {
56465 log_packet_detailed("'flags' field error detected");
56466 }
56467#ifdef FREECIV_JSON_CONNECTION
56468 field_addr.name = "soundtag";
56469#endif /* FREECIV_JSON_CONNECTION */
56470 e = 0;
56471 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag);
56472 if (e) {
56473 log_packet_detailed("'soundtag' field error detected");
56474 }
56475#ifdef FREECIV_JSON_CONNECTION
56476 field_addr.name = "soundtag_alt";
56477#endif /* FREECIV_JSON_CONNECTION */
56478 e = 0;
56479 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt);
56480 if (e) {
56481 log_packet_detailed("'soundtag_alt' field error detected");
56482 }
56483#ifdef FREECIV_JSON_CONNECTION
56484 field_addr.name = "soundtag_alt2";
56485#endif /* FREECIV_JSON_CONNECTION */
56486 e = 0;
56487 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt2);
56488 if (e) {
56489 log_packet_detailed("'soundtag_alt2' field error detected");
56490 }
56491#ifdef FREECIV_JSON_CONNECTION
56492 field_addr.name = "helptext";
56493#endif /* FREECIV_JSON_CONNECTION */
56494 e = 0;
56495 if (!real_packet->helptext) {
56496 /* Transmit null vector as empty vector */
56497 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
56498 } else {
56499 int i;
56500
56501 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
56502 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
56503
56504#ifdef FREECIV_JSON_CONNECTION
56505 field_addr.sub_location = plocation_elem_new(0);
56506#endif /* FREECIV_JSON_CONNECTION */
56507
56508 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
56509 const char *pstr = strvec_get(real_packet->helptext, i);
56510
56511 if (!pstr) {
56512 /* Transmit null strings as empty strings */
56513 pstr = "";
56514 }
56515
56516#ifdef FREECIV_JSON_CONNECTION
56517 /* Next array element */
56518 field_addr.sub_location->number = i;
56519#endif /* FREECIV_JSON_CONNECTION */
56520
56521 e |= DIO_PUT(string, &dout, &field_addr, pstr);
56522 }
56523
56524#ifdef FREECIV_JSON_CONNECTION
56525 FC_FREE(field_addr.sub_location);
56526#endif /* FREECIV_JSON_CONNECTION */
56527 }
56528 if (e) {
56529 log_packet_detailed("'helptext' field error detected");
56530 }
56531
56532#endif
56533 SEND_PACKET_END(PACKET_RULESET_BUILDING);
56534}
56535
56536 int send_packet_ruleset_building(struct connection *pc, const struct packet_ruleset_building *packet)
56537{
56538 if (!pc->used) {
56539 log_error("WARNING: trying to send data to the closed connection %s",
56540 conn_description(pc));
56541 return -1;
56542 }
56543 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_BUILDING].packet != nullptr, -1,
56544 "Handler for PACKET_RULESET_BUILDING not installed");
56545 return pc->phs.handlers->send[PACKET_RULESET_BUILDING].packet(pc, packet);
56546}
56547
56548 void lsend_packet_ruleset_building(struct conn_list *dest, const struct packet_ruleset_building *packet)
56549{
56550 conn_list_iterate(dest, pconn) {
56551 send_packet_ruleset_building(pconn, packet);
56552 } conn_list_iterate_end;
56553}
56554
56555 static inline void init_packet_ruleset_impr_flag(struct packet_ruleset_impr_flag *packet)
56556{
56557 memset(packet, 0, sizeof(*packet));
56558}
56559
56560#define free_packet_ruleset_impr_flag(_packet) (void) 0
56561#define destroy_packet_ruleset_impr_flag free
56562
56563#ifdef FREECIV_DELTA_PROTOCOL
56564#define hash_packet_ruleset_impr_flag_100 hash_const
56565
56566#define cmp_packet_ruleset_impr_flag_100 cmp_const
56567
56568 BV_DEFINE(packet_ruleset_impr_flag_100_fields, 3);
56569#endif /* FREECIV_DELTA_PROTOCOL */
56570
56571 static struct packet_ruleset_impr_flag *receive_packet_ruleset_impr_flag_100(struct connection *pc)
56572{
56573#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_impr_flag(_packet)
56574#ifdef FREECIV_DELTA_PROTOCOL
56575 packet_ruleset_impr_flag_100_fields fields;
56576 struct packet_ruleset_impr_flag *old;
56577 struct genhash **hash = pc->phs.received + PACKET_RULESET_IMPR_FLAG;
56578#endif /* FREECIV_DELTA_PROTOCOL */
56579 RECEIVE_PACKET_START(packet_ruleset_impr_flag, real_packet);
56580#ifdef FREECIV_JSON_CONNECTION
56581 struct plocation field_addr;
56582 {
56583 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
56584 field_addr = *field_addr_tmp;
56585 FC_FREE(field_addr_tmp);
56586 }
56587#endif /* FREECIV_JSON_CONNECTION */
56588
56589#ifdef FREECIV_DELTA_PROTOCOL
56590#ifdef FREECIV_JSON_CONNECTION
56591 field_addr.name = "fields";
56592#endif /* FREECIV_JSON_CONNECTION */
56593 DIO_BV_GET(&din, &field_addr, fields);
56594
56595#else /* FREECIV_DELTA_PROTOCOL */
56596#ifdef FREECIV_JSON_CONNECTION
56597 field_addr.name = "id";
56598#endif /* FREECIV_JSON_CONNECTION */
56599 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56600 RECEIVE_PACKET_FIELD_ERROR(id);
56601 }
56602#ifdef FREECIV_JSON_CONNECTION
56603 field_addr.name = "name";
56604#endif /* FREECIV_JSON_CONNECTION */
56605 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56606 RECEIVE_PACKET_FIELD_ERROR(name);
56607 }
56608#ifdef FREECIV_JSON_CONNECTION
56609 field_addr.name = "helptxt";
56610#endif /* FREECIV_JSON_CONNECTION */
56611 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
56612 RECEIVE_PACKET_FIELD_ERROR(helptxt);
56613 }
56614#endif
56615 log_packet_detailed("packet_ruleset_impr_flag_100: got info about ()");
56616
56617#ifdef FREECIV_DELTA_PROTOCOL
56618 if (nullptr == *hash) {
56619 *hash = genhash_new_full(hash_packet_ruleset_impr_flag_100, cmp_packet_ruleset_impr_flag_100,
56620 nullptr, nullptr, nullptr, destroy_packet_ruleset_impr_flag);
56621 }
56622
56623 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
56624 *real_packet = *old;
56625 } else {
56626 /* packet is already initialized empty */
56627 log_packet_detailed(" no old info");
56628 }
56629
56630 if (BV_ISSET(fields, 0)) {
56631 log_packet_detailed(" got field 'id'");
56632#ifdef FREECIV_JSON_CONNECTION
56633 field_addr.name = "id";
56634#endif /* FREECIV_JSON_CONNECTION */
56635 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56636 RECEIVE_PACKET_FIELD_ERROR(id);
56637 }
56638 }
56639 if (BV_ISSET(fields, 1)) {
56640 log_packet_detailed(" got field 'name'");
56641#ifdef FREECIV_JSON_CONNECTION
56642 field_addr.name = "name";
56643#endif /* FREECIV_JSON_CONNECTION */
56644 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56645 RECEIVE_PACKET_FIELD_ERROR(name);
56646 }
56647 }
56648 if (BV_ISSET(fields, 2)) {
56649 log_packet_detailed(" got field 'helptxt'");
56650#ifdef FREECIV_JSON_CONNECTION
56651 field_addr.name = "helptxt";
56652#endif /* FREECIV_JSON_CONNECTION */
56653 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
56654 RECEIVE_PACKET_FIELD_ERROR(helptxt);
56655 }
56656 }
56657
56658 if (nullptr == old) {
56659 old = fc_malloc(sizeof(*old));
56660 init_packet_ruleset_impr_flag(old);
56661 *old = *real_packet;
56662 genhash_insert(*hash, old, old);
56663 } else {
56664 *old = *real_packet;
56665 }
56666
56667#endif /* FREECIV_DELTA_PROTOCOL */
56668 RECEIVE_PACKET_END(real_packet);
56669#undef FREE_PACKET_STRUCT
56670}
56671
56672 static int send_packet_ruleset_impr_flag_100(struct connection *pc, const struct packet_ruleset_impr_flag *packet)
56673{
56674 const struct packet_ruleset_impr_flag *real_packet = packet;
56675 int e;
56676#ifdef FREECIV_DELTA_PROTOCOL
56677 packet_ruleset_impr_flag_100_fields fields;
56678 struct packet_ruleset_impr_flag *old;
56679 bool differ;
56680 struct genhash **hash = pc->phs.sent + PACKET_RULESET_IMPR_FLAG;
56681#endif /* FREECIV_DELTA_PROTOCOL */
56682 SEND_PACKET_START(PACKET_RULESET_IMPR_FLAG);
56683#ifdef FREECIV_JSON_CONNECTION
56684 struct plocation field_addr;
56685 {
56686 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
56687 field_addr = *field_addr_tmp;
56688 FC_FREE(field_addr_tmp);
56689 }
56690#endif /* FREECIV_JSON_CONNECTION */
56691
56692 log_packet_detailed("packet_ruleset_impr_flag_100: sending info about ()");
56693
56694#ifdef FREECIV_DELTA_PROTOCOL
56695 if (nullptr == *hash) {
56696 *hash = genhash_new_full(hash_packet_ruleset_impr_flag_100, cmp_packet_ruleset_impr_flag_100,
56697 nullptr, nullptr, nullptr, destroy_packet_ruleset_impr_flag);
56698 }
56699 BV_CLR_ALL(fields);
56700
56701 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
56702 old = fc_malloc(sizeof(*old));
56703 /* temporary bitcopy just to insert correctly */
56704 *old = *real_packet;
56705 genhash_insert(*hash, old, old);
56706 init_packet_ruleset_impr_flag(old);
56707 }
56708 differ = (old->id != real_packet->id);
56709 if (differ) {
56710 BV_SET(fields, 0);
56711 }
56712
56713 differ = (strcmp(old->name, real_packet->name) != 0);
56714 if (differ) {
56715 BV_SET(fields, 1);
56716 }
56717
56718 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
56719 if (differ) {
56720 BV_SET(fields, 2);
56721 }
56722
56723
56724#ifdef FREECIV_JSON_CONNECTION
56725 field_addr.name = "fields";
56726#endif /* FREECIV_JSON_CONNECTION */
56727 e = 0;
56728 e |= DIO_BV_PUT(&dout, &field_addr, fields);
56729 if (e) {
56730 log_packet_detailed("fields bitvector error detected");
56731 }
56732
56733 if (BV_ISSET(fields, 0)) {
56734 log_packet_detailed(" field 'id' has changed");
56735#ifdef FREECIV_JSON_CONNECTION
56736 field_addr.name = "id";
56737#endif /* FREECIV_JSON_CONNECTION */
56738 e = 0;
56739 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56740 if (e) {
56741 log_packet_detailed("'id' field error detected");
56742 }
56743 }
56744 if (BV_ISSET(fields, 1)) {
56745 log_packet_detailed(" field 'name' has changed");
56746#ifdef FREECIV_JSON_CONNECTION
56747 field_addr.name = "name";
56748#endif /* FREECIV_JSON_CONNECTION */
56749 e = 0;
56750 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56751 if (e) {
56752 log_packet_detailed("'name' field error detected");
56753 }
56754 }
56755 if (BV_ISSET(fields, 2)) {
56756 log_packet_detailed(" field 'helptxt' has changed");
56757#ifdef FREECIV_JSON_CONNECTION
56758 field_addr.name = "helptxt";
56759#endif /* FREECIV_JSON_CONNECTION */
56760 e = 0;
56761 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
56762 if (e) {
56763 log_packet_detailed("'helptxt' field error detected");
56764 }
56765 }
56766
56767 *old = *real_packet;
56768#endif /* FREECIV_DELTA_PROTOCOL */
56769#ifndef FREECIV_DELTA_PROTOCOL
56770#ifdef FREECIV_JSON_CONNECTION
56771 field_addr.name = "id";
56772#endif /* FREECIV_JSON_CONNECTION */
56773 e = 0;
56774 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56775 if (e) {
56776 log_packet_detailed("'id' field error detected");
56777 }
56778#ifdef FREECIV_JSON_CONNECTION
56779 field_addr.name = "name";
56780#endif /* FREECIV_JSON_CONNECTION */
56781 e = 0;
56782 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56783 if (e) {
56784 log_packet_detailed("'name' field error detected");
56785 }
56786#ifdef FREECIV_JSON_CONNECTION
56787 field_addr.name = "helptxt";
56788#endif /* FREECIV_JSON_CONNECTION */
56789 e = 0;
56790 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
56791 if (e) {
56792 log_packet_detailed("'helptxt' field error detected");
56793 }
56794
56795#endif
56796 SEND_PACKET_END(PACKET_RULESET_IMPR_FLAG);
56797}
56798
56799 int send_packet_ruleset_impr_flag(struct connection *pc, const struct packet_ruleset_impr_flag *packet)
56800{
56801 if (!pc->used) {
56802 log_error("WARNING: trying to send data to the closed connection %s",
56803 conn_description(pc));
56804 return -1;
56805 }
56806 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_IMPR_FLAG].packet != nullptr, -1,
56807 "Handler for PACKET_RULESET_IMPR_FLAG not installed");
56808 return pc->phs.handlers->send[PACKET_RULESET_IMPR_FLAG].packet(pc, packet);
56809}
56810
56811 void lsend_packet_ruleset_impr_flag(struct conn_list *dest, const struct packet_ruleset_impr_flag *packet)
56812{
56813 conn_list_iterate(dest, pconn) {
56814 send_packet_ruleset_impr_flag(pconn, packet);
56815 } conn_list_iterate_end;
56816}
56817
56818 static inline void init_packet_ruleset_terrain(struct packet_ruleset_terrain *packet)
56819{
56820 memset(packet, 0, sizeof(*packet));
56821
56822 /* no work needed for packet->id */
56823 /* no work needed for packet->tclass */
56824 /* no work needed for packet->flags */
56825 /* no work needed for packet->native_to */
56826 /* no work needed for packet->name */
56827 /* no work needed for packet->rule_name */
56828 /* no work needed for packet->graphic_str */
56829 /* no work needed for packet->graphic_alt */
56830 /* no work needed for packet->graphic_alt2 */
56831 /* no work needed for packet->movement_cost */
56832 /* no work needed for packet->defense_bonus */
56833 /* no work needed for packet->output */
56834 /* no work needed for packet->num_resources */
56835 /* no work needed for packet->resources */
56836 /* no work needed for packet->resource_freq */
56837 /* no work needed for packet->road_output_incr_pct */
56838 /* no work needed for packet->base_time */
56839 /* no work needed for packet->road_time */
56840 /* no work needed for packet->cultivate_result */
56841 /* no work needed for packet->cultivate_time */
56842 /* no work needed for packet->plant_result */
56843 /* no work needed for packet->plant_time */
56844 /* no work needed for packet->irrigation_food_incr */
56845 /* no work needed for packet->irrigation_time */
56846 /* no work needed for packet->mining_shield_incr */
56847 /* no work needed for packet->mining_time */
56848 /* no work needed for packet->animal */
56849 /* no work needed for packet->transform_result */
56850 /* no work needed for packet->transform_time */
56851 /* no work needed for packet->placing_time */
56852 /* no work needed for packet->pillage_time */
56853 /* no work needed for packet->extra_count */
56854 /* no work needed for packet->extra_removal_times */
56855 /* no work needed for packet->color_red */
56856 /* no work needed for packet->color_green */
56857 /* no work needed for packet->color_blue */
56858 packet->helptext = strvec_new();
56859}
56860
56861 static inline void free_packet_ruleset_terrain(struct packet_ruleset_terrain *packet)
56862{
56863 if (packet->helptext) {
56864 strvec_destroy(packet->helptext);
56865 packet->helptext = nullptr;
56866 }
56867 /* no work needed for packet->color_blue */
56868 /* no work needed for packet->color_green */
56869 /* no work needed for packet->color_red */
56870 /* no work needed for packet->extra_removal_times */
56871 /* no work needed for packet->extra_count */
56872 /* no work needed for packet->pillage_time */
56873 /* no work needed for packet->placing_time */
56874 /* no work needed for packet->transform_time */
56875 /* no work needed for packet->transform_result */
56876 /* no work needed for packet->animal */
56877 /* no work needed for packet->mining_time */
56878 /* no work needed for packet->mining_shield_incr */
56879 /* no work needed for packet->irrigation_time */
56880 /* no work needed for packet->irrigation_food_incr */
56881 /* no work needed for packet->plant_time */
56882 /* no work needed for packet->plant_result */
56883 /* no work needed for packet->cultivate_time */
56884 /* no work needed for packet->cultivate_result */
56885 /* no work needed for packet->road_time */
56886 /* no work needed for packet->base_time */
56887 /* no work needed for packet->road_output_incr_pct */
56888 /* no work needed for packet->resource_freq */
56889 /* no work needed for packet->resources */
56890 /* no work needed for packet->num_resources */
56891 /* no work needed for packet->output */
56892 /* no work needed for packet->defense_bonus */
56893 /* no work needed for packet->movement_cost */
56894 /* no work needed for packet->graphic_alt2 */
56895 /* no work needed for packet->graphic_alt */
56896 /* no work needed for packet->graphic_str */
56897 /* no work needed for packet->rule_name */
56898 /* no work needed for packet->name */
56899 /* no work needed for packet->native_to */
56900 /* no work needed for packet->flags */
56901 /* no work needed for packet->tclass */
56902 /* no work needed for packet->id */
56903}
56904
56905 static inline void destroy_packet_ruleset_terrain(void *packet)
56906{
56907 free_packet_ruleset_terrain((struct packet_ruleset_terrain *) packet);
56908 free(packet);
56909}
56910
56911#ifdef FREECIV_DELTA_PROTOCOL
56912#define hash_packet_ruleset_terrain_100 hash_const
56913
56914#define cmp_packet_ruleset_terrain_100 cmp_const
56915
56916 BV_DEFINE(packet_ruleset_terrain_100_fields, 37);
56917#endif /* FREECIV_DELTA_PROTOCOL */
56918
56919 static struct packet_ruleset_terrain *receive_packet_ruleset_terrain_100(struct connection *pc)
56920{
56921#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_terrain(_packet)
56922#ifdef FREECIV_DELTA_PROTOCOL
56923 packet_ruleset_terrain_100_fields fields;
56924 struct packet_ruleset_terrain *old;
56925 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN;
56926#endif /* FREECIV_DELTA_PROTOCOL */
56927 RECEIVE_PACKET_START(packet_ruleset_terrain, real_packet);
56928#ifdef FREECIV_JSON_CONNECTION
56929 struct plocation field_addr;
56930 {
56931 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
56932 field_addr = *field_addr_tmp;
56933 FC_FREE(field_addr_tmp);
56934 }
56935#endif /* FREECIV_JSON_CONNECTION */
56936
56937#ifdef FREECIV_DELTA_PROTOCOL
56938#ifdef FREECIV_JSON_CONNECTION
56939 field_addr.name = "fields";
56940#endif /* FREECIV_JSON_CONNECTION */
56941 DIO_BV_GET(&din, &field_addr, fields);
56942
56943#else /* FREECIV_DELTA_PROTOCOL */
56944#ifdef FREECIV_JSON_CONNECTION
56945 field_addr.name = "id";
56946#endif /* FREECIV_JSON_CONNECTION */
56947 {
56948 int readin;
56949
56950 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56951 RECEIVE_PACKET_FIELD_ERROR(id);
56952 }
56953 real_packet->id = readin;
56954 }
56955#ifdef FREECIV_JSON_CONNECTION
56956 field_addr.name = "tclass";
56957#endif /* FREECIV_JSON_CONNECTION */
56958 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
56959 RECEIVE_PACKET_FIELD_ERROR(tclass);
56960 }
56961#ifdef FREECIV_JSON_CONNECTION
56962 field_addr.name = "flags";
56963#endif /* FREECIV_JSON_CONNECTION */
56964 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
56965 RECEIVE_PACKET_FIELD_ERROR(flags);
56966 }
56967#ifdef FREECIV_JSON_CONNECTION
56968 field_addr.name = "native_to";
56969#endif /* FREECIV_JSON_CONNECTION */
56970 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
56971 RECEIVE_PACKET_FIELD_ERROR(native_to);
56972 }
56973#ifdef FREECIV_JSON_CONNECTION
56974 field_addr.name = "name";
56975#endif /* FREECIV_JSON_CONNECTION */
56976 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56977 RECEIVE_PACKET_FIELD_ERROR(name);
56978 }
56979#ifdef FREECIV_JSON_CONNECTION
56980 field_addr.name = "rule_name";
56981#endif /* FREECIV_JSON_CONNECTION */
56982 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
56983 RECEIVE_PACKET_FIELD_ERROR(rule_name);
56984 }
56985#ifdef FREECIV_JSON_CONNECTION
56986 field_addr.name = "graphic_str";
56987#endif /* FREECIV_JSON_CONNECTION */
56988 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
56989 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
56990 }
56991#ifdef FREECIV_JSON_CONNECTION
56992 field_addr.name = "graphic_alt";
56993#endif /* FREECIV_JSON_CONNECTION */
56994 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
56995 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
56996 }
56997#ifdef FREECIV_JSON_CONNECTION
56998 field_addr.name = "graphic_alt2";
56999#endif /* FREECIV_JSON_CONNECTION */
57000 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
57001 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
57002 }
57003#ifdef FREECIV_JSON_CONNECTION
57004 field_addr.name = "movement_cost";
57005#endif /* FREECIV_JSON_CONNECTION */
57006 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->movement_cost)) {
57007 RECEIVE_PACKET_FIELD_ERROR(movement_cost);
57008 }
57009#ifdef FREECIV_JSON_CONNECTION
57010 field_addr.name = "defense_bonus";
57011#endif /* FREECIV_JSON_CONNECTION */
57012 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->defense_bonus)) {
57013 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
57014 }
57015#ifdef FREECIV_JSON_CONNECTION
57016 field_addr.name = "output";
57017#endif /* FREECIV_JSON_CONNECTION */
57018 {
57019 int i;
57020
57021#ifdef FREECIV_JSON_CONNECTION
57022 /* Enter array. */
57023 field_addr.sub_location = plocation_elem_new(0);
57024#endif /* FREECIV_JSON_CONNECTION */
57025
57026 for (i = 0; i < O_LAST; i++) {
57027#ifdef FREECIV_JSON_CONNECTION
57028 field_addr.sub_location->number = i;
57029#endif /* FREECIV_JSON_CONNECTION */
57030 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
57031 RECEIVE_PACKET_FIELD_ERROR(output);
57032 }
57033 }
57034
57035#ifdef FREECIV_JSON_CONNECTION
57036 /* Exit array. */
57037 FC_FREE(field_addr.sub_location);
57038#endif /* FREECIV_JSON_CONNECTION */
57039 }
57040#ifdef FREECIV_JSON_CONNECTION
57041 field_addr.name = "num_resources";
57042#endif /* FREECIV_JSON_CONNECTION */
57043 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_resources)) {
57044 RECEIVE_PACKET_FIELD_ERROR(num_resources);
57045 }
57046#ifdef FREECIV_JSON_CONNECTION
57047 field_addr.name = "resources";
57048#endif /* FREECIV_JSON_CONNECTION */
57049 {
57050 int i;
57051
57052#ifdef FREECIV_JSON_CONNECTION
57053 /* Enter array. */
57054 field_addr.sub_location = plocation_elem_new(0);
57055#endif /* FREECIV_JSON_CONNECTION */
57056
57057 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
57058 RECEIVE_PACKET_FIELD_ERROR(resources, ": truncation array");
57059 }
57060 for (i = 0; i < real_packet->num_resources; i++) {
57061#ifdef FREECIV_JSON_CONNECTION
57062 field_addr.sub_location->number = i;
57063#endif /* FREECIV_JSON_CONNECTION */
57064 {
57065 int readin;
57066
57067 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57068 RECEIVE_PACKET_FIELD_ERROR(resources);
57069 }
57070 real_packet->resources[i] = readin;
57071 }
57072 }
57073
57074#ifdef FREECIV_JSON_CONNECTION
57075 /* Exit array. */
57076 FC_FREE(field_addr.sub_location);
57077#endif /* FREECIV_JSON_CONNECTION */
57078 }
57079#ifdef FREECIV_JSON_CONNECTION
57080 field_addr.name = "resource_freq";
57081#endif /* FREECIV_JSON_CONNECTION */
57082 {
57083 int i;
57084
57085#ifdef FREECIV_JSON_CONNECTION
57086 /* Enter array. */
57087 field_addr.sub_location = plocation_elem_new(0);
57088#endif /* FREECIV_JSON_CONNECTION */
57089
57090 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
57091 RECEIVE_PACKET_FIELD_ERROR(resource_freq, ": truncation array");
57092 }
57093 for (i = 0; i < real_packet->num_resources; i++) {
57094#ifdef FREECIV_JSON_CONNECTION
57095 field_addr.sub_location->number = i;
57096#endif /* FREECIV_JSON_CONNECTION */
57097 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->resource_freq[i])) {
57098 RECEIVE_PACKET_FIELD_ERROR(resource_freq);
57099 }
57100 }
57101
57102#ifdef FREECIV_JSON_CONNECTION
57103 /* Exit array. */
57104 FC_FREE(field_addr.sub_location);
57105#endif /* FREECIV_JSON_CONNECTION */
57106 }
57107#ifdef FREECIV_JSON_CONNECTION
57108 field_addr.name = "road_output_incr_pct";
57109#endif /* FREECIV_JSON_CONNECTION */
57110 {
57111 int i;
57112
57113#ifdef FREECIV_JSON_CONNECTION
57114 /* Enter array. */
57115 field_addr.sub_location = plocation_elem_new(0);
57116#endif /* FREECIV_JSON_CONNECTION */
57117
57118 for (i = 0; i < O_LAST; i++) {
57119#ifdef FREECIV_JSON_CONNECTION
57120 field_addr.sub_location->number = i;
57121#endif /* FREECIV_JSON_CONNECTION */
57122 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->road_output_incr_pct[i])) {
57123 RECEIVE_PACKET_FIELD_ERROR(road_output_incr_pct);
57124 }
57125 }
57126
57127#ifdef FREECIV_JSON_CONNECTION
57128 /* Exit array. */
57129 FC_FREE(field_addr.sub_location);
57130#endif /* FREECIV_JSON_CONNECTION */
57131 }
57132#ifdef FREECIV_JSON_CONNECTION
57133 field_addr.name = "base_time";
57134#endif /* FREECIV_JSON_CONNECTION */
57135 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_time)) {
57136 RECEIVE_PACKET_FIELD_ERROR(base_time);
57137 }
57138#ifdef FREECIV_JSON_CONNECTION
57139 field_addr.name = "road_time";
57140#endif /* FREECIV_JSON_CONNECTION */
57141 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->road_time)) {
57142 RECEIVE_PACKET_FIELD_ERROR(road_time);
57143 }
57144#ifdef FREECIV_JSON_CONNECTION
57145 field_addr.name = "cultivate_result";
57146#endif /* FREECIV_JSON_CONNECTION */
57147 {
57148 int readin;
57149
57150 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57151 RECEIVE_PACKET_FIELD_ERROR(cultivate_result);
57152 }
57153 real_packet->cultivate_result = readin;
57154 }
57155#ifdef FREECIV_JSON_CONNECTION
57156 field_addr.name = "cultivate_time";
57157#endif /* FREECIV_JSON_CONNECTION */
57158 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->cultivate_time)) {
57159 RECEIVE_PACKET_FIELD_ERROR(cultivate_time);
57160 }
57161#ifdef FREECIV_JSON_CONNECTION
57162 field_addr.name = "plant_result";
57163#endif /* FREECIV_JSON_CONNECTION */
57164 {
57165 int readin;
57166
57167 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57168 RECEIVE_PACKET_FIELD_ERROR(plant_result);
57169 }
57170 real_packet->plant_result = readin;
57171 }
57172#ifdef FREECIV_JSON_CONNECTION
57173 field_addr.name = "plant_time";
57174#endif /* FREECIV_JSON_CONNECTION */
57175 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->plant_time)) {
57176 RECEIVE_PACKET_FIELD_ERROR(plant_time);
57177 }
57178#ifdef FREECIV_JSON_CONNECTION
57179 field_addr.name = "irrigation_food_incr";
57180#endif /* FREECIV_JSON_CONNECTION */
57181 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_food_incr)) {
57182 RECEIVE_PACKET_FIELD_ERROR(irrigation_food_incr);
57183 }
57184#ifdef FREECIV_JSON_CONNECTION
57185 field_addr.name = "irrigation_time";
57186#endif /* FREECIV_JSON_CONNECTION */
57187 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_time)) {
57188 RECEIVE_PACKET_FIELD_ERROR(irrigation_time);
57189 }
57190#ifdef FREECIV_JSON_CONNECTION
57191 field_addr.name = "mining_shield_incr";
57192#endif /* FREECIV_JSON_CONNECTION */
57193 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_shield_incr)) {
57194 RECEIVE_PACKET_FIELD_ERROR(mining_shield_incr);
57195 }
57196#ifdef FREECIV_JSON_CONNECTION
57197 field_addr.name = "mining_time";
57198#endif /* FREECIV_JSON_CONNECTION */
57199 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_time)) {
57200 RECEIVE_PACKET_FIELD_ERROR(mining_time);
57201 }
57202#ifdef FREECIV_JSON_CONNECTION
57203 field_addr.name = "animal";
57204#endif /* FREECIV_JSON_CONNECTION */
57205 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->animal)) {
57206 RECEIVE_PACKET_FIELD_ERROR(animal);
57207 }
57208#ifdef FREECIV_JSON_CONNECTION
57209 field_addr.name = "transform_result";
57210#endif /* FREECIV_JSON_CONNECTION */
57211 {
57212 int readin;
57213
57214 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57215 RECEIVE_PACKET_FIELD_ERROR(transform_result);
57216 }
57217 real_packet->transform_result = readin;
57218 }
57219#ifdef FREECIV_JSON_CONNECTION
57220 field_addr.name = "transform_time";
57221#endif /* FREECIV_JSON_CONNECTION */
57222 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transform_time)) {
57223 RECEIVE_PACKET_FIELD_ERROR(transform_time);
57224 }
57225#ifdef FREECIV_JSON_CONNECTION
57226 field_addr.name = "placing_time";
57227#endif /* FREECIV_JSON_CONNECTION */
57228 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->placing_time)) {
57229 RECEIVE_PACKET_FIELD_ERROR(placing_time);
57230 }
57231#ifdef FREECIV_JSON_CONNECTION
57232 field_addr.name = "pillage_time";
57233#endif /* FREECIV_JSON_CONNECTION */
57234 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pillage_time)) {
57235 RECEIVE_PACKET_FIELD_ERROR(pillage_time);
57236 }
57237#ifdef FREECIV_JSON_CONNECTION
57238 field_addr.name = "extra_count";
57239#endif /* FREECIV_JSON_CONNECTION */
57240 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_count)) {
57241 RECEIVE_PACKET_FIELD_ERROR(extra_count);
57242 }
57243#ifdef FREECIV_JSON_CONNECTION
57244 field_addr.name = "extra_removal_times";
57245#endif /* FREECIV_JSON_CONNECTION */
57246 {
57247 int i;
57248
57249#ifdef FREECIV_JSON_CONNECTION
57250 /* Enter array. */
57251 field_addr.sub_location = plocation_elem_new(0);
57252#endif /* FREECIV_JSON_CONNECTION */
57253
57254 if (real_packet->extra_count > MAX_EXTRA_TYPES) {
57255 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times, ": truncation array");
57256 }
57257 for (i = 0; i < real_packet->extra_count; i++) {
57258#ifdef FREECIV_JSON_CONNECTION
57259 field_addr.sub_location->number = i;
57260#endif /* FREECIV_JSON_CONNECTION */
57261 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_removal_times[i])) {
57262 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times);
57263 }
57264 }
57265
57266#ifdef FREECIV_JSON_CONNECTION
57267 /* Exit array. */
57268 FC_FREE(field_addr.sub_location);
57269#endif /* FREECIV_JSON_CONNECTION */
57270 }
57271#ifdef FREECIV_JSON_CONNECTION
57272 field_addr.name = "color_red";
57273#endif /* FREECIV_JSON_CONNECTION */
57274 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
57275 RECEIVE_PACKET_FIELD_ERROR(color_red);
57276 }
57277#ifdef FREECIV_JSON_CONNECTION
57278 field_addr.name = "color_green";
57279#endif /* FREECIV_JSON_CONNECTION */
57280 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
57281 RECEIVE_PACKET_FIELD_ERROR(color_green);
57282 }
57283#ifdef FREECIV_JSON_CONNECTION
57284 field_addr.name = "color_blue";
57285#endif /* FREECIV_JSON_CONNECTION */
57286 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
57287 RECEIVE_PACKET_FIELD_ERROR(color_blue);
57288 }
57289#ifdef FREECIV_JSON_CONNECTION
57290 field_addr.name = "helptext";
57291#endif /* FREECIV_JSON_CONNECTION */
57292 {
57293 int i;
57294
57295 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
57296 RECEIVE_PACKET_FIELD_ERROR(helptext);
57297 }
57298 strvec_reserve(real_packet->helptext, i);
57299
57300#ifdef FREECIV_JSON_CONNECTION
57301 field_addr.sub_location = plocation_elem_new(0);
57302#endif /* FREECIV_JSON_CONNECTION */
57303
57304 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
57305 char readin[MAX_LEN_PACKET];
57306
57307#ifdef FREECIV_JSON_CONNECTION
57308 /* Next array element */
57309 field_addr.sub_location->number = i;
57310#endif /* FREECIV_JSON_CONNECTION */
57311
57312 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
57313 || !strvec_set(real_packet->helptext, i, readin)) {
57314 RECEIVE_PACKET_FIELD_ERROR(helptext);
57315 }
57316 }
57317
57318#ifdef FREECIV_JSON_CONNECTION
57319 FC_FREE(field_addr.sub_location);
57320#endif /* FREECIV_JSON_CONNECTION */
57321 }
57322#endif
57323 log_packet_detailed("packet_ruleset_terrain_100: got info about ()");
57324
57325#ifdef FREECIV_DELTA_PROTOCOL
57326 if (nullptr == *hash) {
57327 *hash = genhash_new_full(hash_packet_ruleset_terrain_100, cmp_packet_ruleset_terrain_100,
57328 nullptr, nullptr, nullptr, destroy_packet_ruleset_terrain);
57329 }
57330
57331 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
57332 real_packet->id = old->id;
57333 real_packet->tclass = old->tclass;
57334 real_packet->flags = old->flags;
57335 real_packet->native_to = old->native_to;
57336 sz_strlcpy(real_packet->name, old->name);
57337 sz_strlcpy(real_packet->rule_name, old->rule_name);
57338 sz_strlcpy(real_packet->graphic_str, old->graphic_str);
57339 sz_strlcpy(real_packet->graphic_alt, old->graphic_alt);
57340 sz_strlcpy(real_packet->graphic_alt2, old->graphic_alt2);
57341 real_packet->movement_cost = old->movement_cost;
57342 real_packet->defense_bonus = old->defense_bonus;
57343 {
57344 int i;
57345
57346 for (i = 0; i < O_LAST; i++) {
57347 real_packet->output[i] = old->output[i];
57348 }
57349 }
57350 real_packet->num_resources = old->num_resources;
57351 {
57352 int i;
57353
57354 for (i = 0; i < old->num_resources; i++) {
57355 real_packet->resources[i] = old->resources[i];
57356 }
57357 }
57358 {
57359 int i;
57360
57361 for (i = 0; i < old->num_resources; i++) {
57362 real_packet->resource_freq[i] = old->resource_freq[i];
57363 }
57364 }
57365 {
57366 int i;
57367
57368 for (i = 0; i < O_LAST; i++) {
57369 real_packet->road_output_incr_pct[i] = old->road_output_incr_pct[i];
57370 }
57371 }
57372 real_packet->base_time = old->base_time;
57373 real_packet->road_time = old->road_time;
57374 real_packet->cultivate_result = old->cultivate_result;
57375 real_packet->cultivate_time = old->cultivate_time;
57376 real_packet->plant_result = old->plant_result;
57377 real_packet->plant_time = old->plant_time;
57378 real_packet->irrigation_food_incr = old->irrigation_food_incr;
57379 real_packet->irrigation_time = old->irrigation_time;
57380 real_packet->mining_shield_incr = old->mining_shield_incr;
57381 real_packet->mining_time = old->mining_time;
57382 real_packet->animal = old->animal;
57383 real_packet->transform_result = old->transform_result;
57384 real_packet->transform_time = old->transform_time;
57385 real_packet->placing_time = old->placing_time;
57386 real_packet->pillage_time = old->pillage_time;
57387 real_packet->extra_count = old->extra_count;
57388 {
57389 int i;
57390
57391 for (i = 0; i < old->extra_count; i++) {
57392 real_packet->extra_removal_times[i] = old->extra_removal_times[i];
57393 }
57394 }
57395 real_packet->color_red = old->color_red;
57396 real_packet->color_green = old->color_green;
57397 real_packet->color_blue = old->color_blue;
57398 if (old->helptext) {
57399 strvec_copy(real_packet->helptext, old->helptext);
57400 } else {
57401 strvec_clear(real_packet->helptext);
57402 }
57403 } else {
57404 /* packet is already initialized empty */
57405 log_packet_detailed(" no old info");
57406 }
57407
57408 if (BV_ISSET(fields, 0)) {
57409 log_packet_detailed(" got field 'id'");
57410#ifdef FREECIV_JSON_CONNECTION
57411 field_addr.name = "id";
57412#endif /* FREECIV_JSON_CONNECTION */
57413 {
57414 int readin;
57415
57416 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57417 RECEIVE_PACKET_FIELD_ERROR(id);
57418 }
57419 real_packet->id = readin;
57420 }
57421 }
57422 if (BV_ISSET(fields, 1)) {
57423 log_packet_detailed(" got field 'tclass'");
57424#ifdef FREECIV_JSON_CONNECTION
57425 field_addr.name = "tclass";
57426#endif /* FREECIV_JSON_CONNECTION */
57427 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
57428 RECEIVE_PACKET_FIELD_ERROR(tclass);
57429 }
57430 }
57431 if (BV_ISSET(fields, 2)) {
57432 log_packet_detailed(" got field 'flags'");
57433#ifdef FREECIV_JSON_CONNECTION
57434 field_addr.name = "flags";
57435#endif /* FREECIV_JSON_CONNECTION */
57436 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
57437 RECEIVE_PACKET_FIELD_ERROR(flags);
57438 }
57439 }
57440 if (BV_ISSET(fields, 3)) {
57441 log_packet_detailed(" got field 'native_to'");
57442#ifdef FREECIV_JSON_CONNECTION
57443 field_addr.name = "native_to";
57444#endif /* FREECIV_JSON_CONNECTION */
57445 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
57446 RECEIVE_PACKET_FIELD_ERROR(native_to);
57447 }
57448 }
57449 if (BV_ISSET(fields, 4)) {
57450 log_packet_detailed(" got field 'name'");
57451#ifdef FREECIV_JSON_CONNECTION
57452 field_addr.name = "name";
57453#endif /* FREECIV_JSON_CONNECTION */
57454 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
57455 RECEIVE_PACKET_FIELD_ERROR(name);
57456 }
57457 }
57458 if (BV_ISSET(fields, 5)) {
57459 log_packet_detailed(" got field 'rule_name'");
57460#ifdef FREECIV_JSON_CONNECTION
57461 field_addr.name = "rule_name";
57462#endif /* FREECIV_JSON_CONNECTION */
57463 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
57464 RECEIVE_PACKET_FIELD_ERROR(rule_name);
57465 }
57466 }
57467 if (BV_ISSET(fields, 6)) {
57468 log_packet_detailed(" got field 'graphic_str'");
57469#ifdef FREECIV_JSON_CONNECTION
57470 field_addr.name = "graphic_str";
57471#endif /* FREECIV_JSON_CONNECTION */
57472 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
57473 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
57474 }
57475 }
57476 if (BV_ISSET(fields, 7)) {
57477 log_packet_detailed(" got field 'graphic_alt'");
57478#ifdef FREECIV_JSON_CONNECTION
57479 field_addr.name = "graphic_alt";
57480#endif /* FREECIV_JSON_CONNECTION */
57481 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
57482 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
57483 }
57484 }
57485 if (BV_ISSET(fields, 8)) {
57486 log_packet_detailed(" got field 'graphic_alt2'");
57487#ifdef FREECIV_JSON_CONNECTION
57488 field_addr.name = "graphic_alt2";
57489#endif /* FREECIV_JSON_CONNECTION */
57490 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
57491 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
57492 }
57493 }
57494 if (BV_ISSET(fields, 9)) {
57495 log_packet_detailed(" got field 'movement_cost'");
57496#ifdef FREECIV_JSON_CONNECTION
57497 field_addr.name = "movement_cost";
57498#endif /* FREECIV_JSON_CONNECTION */
57499 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->movement_cost)) {
57500 RECEIVE_PACKET_FIELD_ERROR(movement_cost);
57501 }
57502 }
57503 if (BV_ISSET(fields, 10)) {
57504 log_packet_detailed(" got field 'defense_bonus'");
57505#ifdef FREECIV_JSON_CONNECTION
57506 field_addr.name = "defense_bonus";
57507#endif /* FREECIV_JSON_CONNECTION */
57508 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->defense_bonus)) {
57509 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
57510 }
57511 }
57512 if (BV_ISSET(fields, 11)) {
57513 log_packet_detailed(" got field 'output'");
57514#ifdef FREECIV_JSON_CONNECTION
57515 field_addr.name = "output";
57516#endif /* FREECIV_JSON_CONNECTION */
57517 {
57518 int i;
57519
57520#ifdef FREECIV_JSON_CONNECTION
57521 /* Enter array. */
57522 field_addr.sub_location = plocation_elem_new(0);
57523#endif /* FREECIV_JSON_CONNECTION */
57524
57525 for (i = 0; i < O_LAST; i++) {
57526#ifdef FREECIV_JSON_CONNECTION
57527 field_addr.sub_location->number = i;
57528#endif /* FREECIV_JSON_CONNECTION */
57529 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
57530 RECEIVE_PACKET_FIELD_ERROR(output);
57531 }
57532 }
57533
57534#ifdef FREECIV_JSON_CONNECTION
57535 /* Exit array. */
57536 FC_FREE(field_addr.sub_location);
57537#endif /* FREECIV_JSON_CONNECTION */
57538 }
57539 }
57540 if (BV_ISSET(fields, 12)) {
57541 log_packet_detailed(" got field 'num_resources'");
57542#ifdef FREECIV_JSON_CONNECTION
57543 field_addr.name = "num_resources";
57544#endif /* FREECIV_JSON_CONNECTION */
57545 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_resources)) {
57546 RECEIVE_PACKET_FIELD_ERROR(num_resources);
57547 }
57548 }
57549 if (BV_ISSET(fields, 13)) {
57550 log_packet_detailed(" got field 'resources'");
57551#ifdef FREECIV_JSON_CONNECTION
57552 field_addr.name = "resources";
57553#endif /* FREECIV_JSON_CONNECTION */
57554 {
57555 int i;
57556
57557#ifdef FREECIV_JSON_CONNECTION
57558 /* Enter array. */
57559 field_addr.sub_location = plocation_elem_new(0);
57560#endif /* FREECIV_JSON_CONNECTION */
57561
57562 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
57563 RECEIVE_PACKET_FIELD_ERROR(resources, ": truncation array");
57564 }
57565 for (i = 0; i < real_packet->num_resources; i++) {
57566#ifdef FREECIV_JSON_CONNECTION
57567 field_addr.sub_location->number = i;
57568#endif /* FREECIV_JSON_CONNECTION */
57569 {
57570 int readin;
57571
57572 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57573 RECEIVE_PACKET_FIELD_ERROR(resources);
57574 }
57575 real_packet->resources[i] = readin;
57576 }
57577 }
57578
57579#ifdef FREECIV_JSON_CONNECTION
57580 /* Exit array. */
57581 FC_FREE(field_addr.sub_location);
57582#endif /* FREECIV_JSON_CONNECTION */
57583 }
57584 }
57585 if (BV_ISSET(fields, 14)) {
57586 log_packet_detailed(" got field 'resource_freq'");
57587#ifdef FREECIV_JSON_CONNECTION
57588 field_addr.name = "resource_freq";
57589#endif /* FREECIV_JSON_CONNECTION */
57590 {
57591 int i;
57592
57593#ifdef FREECIV_JSON_CONNECTION
57594 /* Enter array. */
57595 field_addr.sub_location = plocation_elem_new(0);
57596#endif /* FREECIV_JSON_CONNECTION */
57597
57598 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
57599 RECEIVE_PACKET_FIELD_ERROR(resource_freq, ": truncation array");
57600 }
57601 for (i = 0; i < real_packet->num_resources; i++) {
57602#ifdef FREECIV_JSON_CONNECTION
57603 field_addr.sub_location->number = i;
57604#endif /* FREECIV_JSON_CONNECTION */
57605 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->resource_freq[i])) {
57606 RECEIVE_PACKET_FIELD_ERROR(resource_freq);
57607 }
57608 }
57609
57610#ifdef FREECIV_JSON_CONNECTION
57611 /* Exit array. */
57612 FC_FREE(field_addr.sub_location);
57613#endif /* FREECIV_JSON_CONNECTION */
57614 }
57615 }
57616 if (BV_ISSET(fields, 15)) {
57617 log_packet_detailed(" got field 'road_output_incr_pct'");
57618#ifdef FREECIV_JSON_CONNECTION
57619 field_addr.name = "road_output_incr_pct";
57620#endif /* FREECIV_JSON_CONNECTION */
57621 {
57622 int i;
57623
57624#ifdef FREECIV_JSON_CONNECTION
57625 /* Enter array. */
57626 field_addr.sub_location = plocation_elem_new(0);
57627#endif /* FREECIV_JSON_CONNECTION */
57628
57629 for (i = 0; i < O_LAST; i++) {
57630#ifdef FREECIV_JSON_CONNECTION
57631 field_addr.sub_location->number = i;
57632#endif /* FREECIV_JSON_CONNECTION */
57633 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->road_output_incr_pct[i])) {
57634 RECEIVE_PACKET_FIELD_ERROR(road_output_incr_pct);
57635 }
57636 }
57637
57638#ifdef FREECIV_JSON_CONNECTION
57639 /* Exit array. */
57640 FC_FREE(field_addr.sub_location);
57641#endif /* FREECIV_JSON_CONNECTION */
57642 }
57643 }
57644 if (BV_ISSET(fields, 16)) {
57645 log_packet_detailed(" got field 'base_time'");
57646#ifdef FREECIV_JSON_CONNECTION
57647 field_addr.name = "base_time";
57648#endif /* FREECIV_JSON_CONNECTION */
57649 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_time)) {
57650 RECEIVE_PACKET_FIELD_ERROR(base_time);
57651 }
57652 }
57653 if (BV_ISSET(fields, 17)) {
57654 log_packet_detailed(" got field 'road_time'");
57655#ifdef FREECIV_JSON_CONNECTION
57656 field_addr.name = "road_time";
57657#endif /* FREECIV_JSON_CONNECTION */
57658 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->road_time)) {
57659 RECEIVE_PACKET_FIELD_ERROR(road_time);
57660 }
57661 }
57662 if (BV_ISSET(fields, 18)) {
57663 log_packet_detailed(" got field 'cultivate_result'");
57664#ifdef FREECIV_JSON_CONNECTION
57665 field_addr.name = "cultivate_result";
57666#endif /* FREECIV_JSON_CONNECTION */
57667 {
57668 int readin;
57669
57670 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57671 RECEIVE_PACKET_FIELD_ERROR(cultivate_result);
57672 }
57673 real_packet->cultivate_result = readin;
57674 }
57675 }
57676 if (BV_ISSET(fields, 19)) {
57677 log_packet_detailed(" got field 'cultivate_time'");
57678#ifdef FREECIV_JSON_CONNECTION
57679 field_addr.name = "cultivate_time";
57680#endif /* FREECIV_JSON_CONNECTION */
57681 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->cultivate_time)) {
57682 RECEIVE_PACKET_FIELD_ERROR(cultivate_time);
57683 }
57684 }
57685 if (BV_ISSET(fields, 20)) {
57686 log_packet_detailed(" got field 'plant_result'");
57687#ifdef FREECIV_JSON_CONNECTION
57688 field_addr.name = "plant_result";
57689#endif /* FREECIV_JSON_CONNECTION */
57690 {
57691 int readin;
57692
57693 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57694 RECEIVE_PACKET_FIELD_ERROR(plant_result);
57695 }
57696 real_packet->plant_result = readin;
57697 }
57698 }
57699 if (BV_ISSET(fields, 21)) {
57700 log_packet_detailed(" got field 'plant_time'");
57701#ifdef FREECIV_JSON_CONNECTION
57702 field_addr.name = "plant_time";
57703#endif /* FREECIV_JSON_CONNECTION */
57704 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->plant_time)) {
57705 RECEIVE_PACKET_FIELD_ERROR(plant_time);
57706 }
57707 }
57708 if (BV_ISSET(fields, 22)) {
57709 log_packet_detailed(" got field 'irrigation_food_incr'");
57710#ifdef FREECIV_JSON_CONNECTION
57711 field_addr.name = "irrigation_food_incr";
57712#endif /* FREECIV_JSON_CONNECTION */
57713 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_food_incr)) {
57714 RECEIVE_PACKET_FIELD_ERROR(irrigation_food_incr);
57715 }
57716 }
57717 if (BV_ISSET(fields, 23)) {
57718 log_packet_detailed(" got field 'irrigation_time'");
57719#ifdef FREECIV_JSON_CONNECTION
57720 field_addr.name = "irrigation_time";
57721#endif /* FREECIV_JSON_CONNECTION */
57722 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_time)) {
57723 RECEIVE_PACKET_FIELD_ERROR(irrigation_time);
57724 }
57725 }
57726 if (BV_ISSET(fields, 24)) {
57727 log_packet_detailed(" got field 'mining_shield_incr'");
57728#ifdef FREECIV_JSON_CONNECTION
57729 field_addr.name = "mining_shield_incr";
57730#endif /* FREECIV_JSON_CONNECTION */
57731 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_shield_incr)) {
57732 RECEIVE_PACKET_FIELD_ERROR(mining_shield_incr);
57733 }
57734 }
57735 if (BV_ISSET(fields, 25)) {
57736 log_packet_detailed(" got field 'mining_time'");
57737#ifdef FREECIV_JSON_CONNECTION
57738 field_addr.name = "mining_time";
57739#endif /* FREECIV_JSON_CONNECTION */
57740 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_time)) {
57741 RECEIVE_PACKET_FIELD_ERROR(mining_time);
57742 }
57743 }
57744 if (BV_ISSET(fields, 26)) {
57745 log_packet_detailed(" got field 'animal'");
57746#ifdef FREECIV_JSON_CONNECTION
57747 field_addr.name = "animal";
57748#endif /* FREECIV_JSON_CONNECTION */
57749 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->animal)) {
57750 RECEIVE_PACKET_FIELD_ERROR(animal);
57751 }
57752 }
57753 if (BV_ISSET(fields, 27)) {
57754 log_packet_detailed(" got field 'transform_result'");
57755#ifdef FREECIV_JSON_CONNECTION
57756 field_addr.name = "transform_result";
57757#endif /* FREECIV_JSON_CONNECTION */
57758 {
57759 int readin;
57760
57761 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57762 RECEIVE_PACKET_FIELD_ERROR(transform_result);
57763 }
57764 real_packet->transform_result = readin;
57765 }
57766 }
57767 if (BV_ISSET(fields, 28)) {
57768 log_packet_detailed(" got field 'transform_time'");
57769#ifdef FREECIV_JSON_CONNECTION
57770 field_addr.name = "transform_time";
57771#endif /* FREECIV_JSON_CONNECTION */
57772 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transform_time)) {
57773 RECEIVE_PACKET_FIELD_ERROR(transform_time);
57774 }
57775 }
57776 if (BV_ISSET(fields, 29)) {
57777 log_packet_detailed(" got field 'placing_time'");
57778#ifdef FREECIV_JSON_CONNECTION
57779 field_addr.name = "placing_time";
57780#endif /* FREECIV_JSON_CONNECTION */
57781 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->placing_time)) {
57782 RECEIVE_PACKET_FIELD_ERROR(placing_time);
57783 }
57784 }
57785 if (BV_ISSET(fields, 30)) {
57786 log_packet_detailed(" got field 'pillage_time'");
57787#ifdef FREECIV_JSON_CONNECTION
57788 field_addr.name = "pillage_time";
57789#endif /* FREECIV_JSON_CONNECTION */
57790 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pillage_time)) {
57791 RECEIVE_PACKET_FIELD_ERROR(pillage_time);
57792 }
57793 }
57794 if (BV_ISSET(fields, 31)) {
57795 log_packet_detailed(" got field 'extra_count'");
57796#ifdef FREECIV_JSON_CONNECTION
57797 field_addr.name = "extra_count";
57798#endif /* FREECIV_JSON_CONNECTION */
57799 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_count)) {
57800 RECEIVE_PACKET_FIELD_ERROR(extra_count);
57801 }
57802 }
57803 if (BV_ISSET(fields, 32)) {
57804 log_packet_detailed(" got field 'extra_removal_times'");
57805#ifdef FREECIV_JSON_CONNECTION
57806 field_addr.name = "extra_removal_times";
57807#endif /* FREECIV_JSON_CONNECTION */
57808 {
57809 int i;
57810
57811#ifdef FREECIV_JSON_CONNECTION
57812 /* Enter array. */
57813 field_addr.sub_location = plocation_elem_new(0);
57814#endif /* FREECIV_JSON_CONNECTION */
57815
57816 if (real_packet->extra_count > MAX_EXTRA_TYPES) {
57817 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times, ": truncation array");
57818 }
57819 for (i = 0; i < real_packet->extra_count; i++) {
57820#ifdef FREECIV_JSON_CONNECTION
57821 field_addr.sub_location->number = i;
57822#endif /* FREECIV_JSON_CONNECTION */
57823 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_removal_times[i])) {
57824 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times);
57825 }
57826 }
57827
57828#ifdef FREECIV_JSON_CONNECTION
57829 /* Exit array. */
57830 FC_FREE(field_addr.sub_location);
57831#endif /* FREECIV_JSON_CONNECTION */
57832 }
57833 }
57834 if (BV_ISSET(fields, 33)) {
57835 log_packet_detailed(" got field 'color_red'");
57836#ifdef FREECIV_JSON_CONNECTION
57837 field_addr.name = "color_red";
57838#endif /* FREECIV_JSON_CONNECTION */
57839 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
57840 RECEIVE_PACKET_FIELD_ERROR(color_red);
57841 }
57842 }
57843 if (BV_ISSET(fields, 34)) {
57844 log_packet_detailed(" got field 'color_green'");
57845#ifdef FREECIV_JSON_CONNECTION
57846 field_addr.name = "color_green";
57847#endif /* FREECIV_JSON_CONNECTION */
57848 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
57849 RECEIVE_PACKET_FIELD_ERROR(color_green);
57850 }
57851 }
57852 if (BV_ISSET(fields, 35)) {
57853 log_packet_detailed(" got field 'color_blue'");
57854#ifdef FREECIV_JSON_CONNECTION
57855 field_addr.name = "color_blue";
57856#endif /* FREECIV_JSON_CONNECTION */
57857 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
57858 RECEIVE_PACKET_FIELD_ERROR(color_blue);
57859 }
57860 }
57861 if (BV_ISSET(fields, 36)) {
57862 log_packet_detailed(" got field 'helptext'");
57863#ifdef FREECIV_JSON_CONNECTION
57864 field_addr.name = "helptext";
57865#endif /* FREECIV_JSON_CONNECTION */
57866 {
57867 int i;
57868
57869 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
57870 RECEIVE_PACKET_FIELD_ERROR(helptext);
57871 }
57872 strvec_reserve(real_packet->helptext, i);
57873
57874#ifdef FREECIV_JSON_CONNECTION
57875 field_addr.sub_location = plocation_elem_new(0);
57876#endif /* FREECIV_JSON_CONNECTION */
57877
57878 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
57879 char readin[MAX_LEN_PACKET];
57880
57881#ifdef FREECIV_JSON_CONNECTION
57882 /* Next array element */
57883 field_addr.sub_location->number = i;
57884#endif /* FREECIV_JSON_CONNECTION */
57885
57886 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
57887 || !strvec_set(real_packet->helptext, i, readin)) {
57888 RECEIVE_PACKET_FIELD_ERROR(helptext);
57889 }
57890 }
57891
57892#ifdef FREECIV_JSON_CONNECTION
57893 FC_FREE(field_addr.sub_location);
57894#endif /* FREECIV_JSON_CONNECTION */
57895 }
57896 }
57897
57898 if (nullptr == old) {
57899 old = fc_malloc(sizeof(*old));
57900 init_packet_ruleset_terrain(old);
57901 old->id = real_packet->id;
57902 old->tclass = real_packet->tclass;
57903 old->flags = real_packet->flags;
57904 old->native_to = real_packet->native_to;
57905 sz_strlcpy(old->name, real_packet->name);
57906 sz_strlcpy(old->rule_name, real_packet->rule_name);
57907 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
57908 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
57909 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
57910 old->movement_cost = real_packet->movement_cost;
57911 old->defense_bonus = real_packet->defense_bonus;
57912 {
57913 int i;
57914
57915 for (i = 0; i < O_LAST; i++) {
57916 old->output[i] = real_packet->output[i];
57917 }
57918 }
57919 old->num_resources = real_packet->num_resources;
57920 {
57921 int i;
57922
57923 for (i = 0; i < real_packet->num_resources; i++) {
57924 old->resources[i] = real_packet->resources[i];
57925 }
57926 }
57927 {
57928 int i;
57929
57930 for (i = 0; i < real_packet->num_resources; i++) {
57931 old->resource_freq[i] = real_packet->resource_freq[i];
57932 }
57933 }
57934 {
57935 int i;
57936
57937 for (i = 0; i < O_LAST; i++) {
57938 old->road_output_incr_pct[i] = real_packet->road_output_incr_pct[i];
57939 }
57940 }
57941 old->base_time = real_packet->base_time;
57942 old->road_time = real_packet->road_time;
57943 old->cultivate_result = real_packet->cultivate_result;
57944 old->cultivate_time = real_packet->cultivate_time;
57945 old->plant_result = real_packet->plant_result;
57946 old->plant_time = real_packet->plant_time;
57947 old->irrigation_food_incr = real_packet->irrigation_food_incr;
57948 old->irrigation_time = real_packet->irrigation_time;
57949 old->mining_shield_incr = real_packet->mining_shield_incr;
57950 old->mining_time = real_packet->mining_time;
57951 old->animal = real_packet->animal;
57952 old->transform_result = real_packet->transform_result;
57953 old->transform_time = real_packet->transform_time;
57954 old->placing_time = real_packet->placing_time;
57955 old->pillage_time = real_packet->pillage_time;
57956 old->extra_count = real_packet->extra_count;
57957 {
57958 int i;
57959
57960 for (i = 0; i < real_packet->extra_count; i++) {
57961 old->extra_removal_times[i] = real_packet->extra_removal_times[i];
57962 }
57963 }
57964 old->color_red = real_packet->color_red;
57965 old->color_green = real_packet->color_green;
57966 old->color_blue = real_packet->color_blue;
57967 if (real_packet->helptext) {
57968 strvec_copy(old->helptext, real_packet->helptext);
57969 } else {
57970 strvec_clear(old->helptext);
57971 }
57972 genhash_insert(*hash, old, old);
57973 } else {
57974 old->id = real_packet->id;
57975 old->tclass = real_packet->tclass;
57976 old->flags = real_packet->flags;
57977 old->native_to = real_packet->native_to;
57978 sz_strlcpy(old->name, real_packet->name);
57979 sz_strlcpy(old->rule_name, real_packet->rule_name);
57980 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
57981 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
57982 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
57983 old->movement_cost = real_packet->movement_cost;
57984 old->defense_bonus = real_packet->defense_bonus;
57985 {
57986 int i;
57987
57988 for (i = 0; i < O_LAST; i++) {
57989 old->output[i] = real_packet->output[i];
57990 }
57991 }
57992 old->num_resources = real_packet->num_resources;
57993 {
57994 int i;
57995
57996 for (i = 0; i < real_packet->num_resources; i++) {
57997 old->resources[i] = real_packet->resources[i];
57998 }
57999 }
58000 {
58001 int i;
58002
58003 for (i = 0; i < real_packet->num_resources; i++) {
58004 old->resource_freq[i] = real_packet->resource_freq[i];
58005 }
58006 }
58007 {
58008 int i;
58009
58010 for (i = 0; i < O_LAST; i++) {
58011 old->road_output_incr_pct[i] = real_packet->road_output_incr_pct[i];
58012 }
58013 }
58014 old->base_time = real_packet->base_time;
58015 old->road_time = real_packet->road_time;
58016 old->cultivate_result = real_packet->cultivate_result;
58017 old->cultivate_time = real_packet->cultivate_time;
58018 old->plant_result = real_packet->plant_result;
58019 old->plant_time = real_packet->plant_time;
58020 old->irrigation_food_incr = real_packet->irrigation_food_incr;
58021 old->irrigation_time = real_packet->irrigation_time;
58022 old->mining_shield_incr = real_packet->mining_shield_incr;
58023 old->mining_time = real_packet->mining_time;
58024 old->animal = real_packet->animal;
58025 old->transform_result = real_packet->transform_result;
58026 old->transform_time = real_packet->transform_time;
58027 old->placing_time = real_packet->placing_time;
58028 old->pillage_time = real_packet->pillage_time;
58029 old->extra_count = real_packet->extra_count;
58030 {
58031 int i;
58032
58033 for (i = 0; i < real_packet->extra_count; i++) {
58034 old->extra_removal_times[i] = real_packet->extra_removal_times[i];
58035 }
58036 }
58037 old->color_red = real_packet->color_red;
58038 old->color_green = real_packet->color_green;
58039 old->color_blue = real_packet->color_blue;
58040 if (real_packet->helptext) {
58041 strvec_copy(old->helptext, real_packet->helptext);
58042 } else {
58043 strvec_clear(old->helptext);
58044 }
58045 }
58046
58047#endif /* FREECIV_DELTA_PROTOCOL */
58048 RECEIVE_PACKET_END(real_packet);
58049#undef FREE_PACKET_STRUCT
58050}
58051
58052 static int send_packet_ruleset_terrain_100(struct connection *pc, const struct packet_ruleset_terrain *packet)
58053{
58054 const struct packet_ruleset_terrain *real_packet = packet;
58055 int e;
58056#ifdef FREECIV_DELTA_PROTOCOL
58057 packet_ruleset_terrain_100_fields fields;
58058 struct packet_ruleset_terrain *old;
58059 bool differ;
58060 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN;
58061#endif /* FREECIV_DELTA_PROTOCOL */
58062 SEND_PACKET_START(PACKET_RULESET_TERRAIN);
58063#ifdef FREECIV_JSON_CONNECTION
58064 struct plocation field_addr;
58065 {
58066 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
58067 field_addr = *field_addr_tmp;
58068 FC_FREE(field_addr_tmp);
58069 }
58070#endif /* FREECIV_JSON_CONNECTION */
58071
58072 log_packet_detailed("packet_ruleset_terrain_100: sending info about ()");
58073
58074#ifdef FREECIV_DELTA_PROTOCOL
58075 if (nullptr == *hash) {
58076 *hash = genhash_new_full(hash_packet_ruleset_terrain_100, cmp_packet_ruleset_terrain_100,
58077 nullptr, nullptr, nullptr, destroy_packet_ruleset_terrain);
58078 }
58079 BV_CLR_ALL(fields);
58080
58081 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
58082 old = fc_malloc(sizeof(*old));
58083 /* temporary bitcopy just to insert correctly */
58084 *old = *real_packet;
58085 genhash_insert(*hash, old, old);
58086 init_packet_ruleset_terrain(old);
58087 }
58088 differ = (old->id != real_packet->id);
58089 if (differ) {
58090 BV_SET(fields, 0);
58091 }
58092
58093 differ = (old->tclass != real_packet->tclass);
58094 if (differ) {
58095 BV_SET(fields, 1);
58096 }
58097
58098 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
58099 if (differ) {
58100 BV_SET(fields, 2);
58101 }
58102
58103 differ = !BV_ARE_EQUAL(old->native_to, real_packet->native_to);
58104 if (differ) {
58105 BV_SET(fields, 3);
58106 }
58107
58108 differ = (strcmp(old->name, real_packet->name) != 0);
58109 if (differ) {
58110 BV_SET(fields, 4);
58111 }
58112
58113 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
58114 if (differ) {
58115 BV_SET(fields, 5);
58116 }
58117
58118 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
58119 if (differ) {
58120 BV_SET(fields, 6);
58121 }
58122
58123 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
58124 if (differ) {
58125 BV_SET(fields, 7);
58126 }
58127
58128 differ = (strcmp(old->graphic_alt2, real_packet->graphic_alt2) != 0);
58129 if (differ) {
58130 BV_SET(fields, 8);
58131 }
58132
58133 differ = (old->movement_cost != real_packet->movement_cost);
58134 if (differ) {
58135 BV_SET(fields, 9);
58136 }
58137
58138 differ = (old->defense_bonus != real_packet->defense_bonus);
58139 if (differ) {
58140 BV_SET(fields, 10);
58141 }
58142
58143 differ = FALSE;
58144 {
58145 int i;
58146
58147 for (i = 0; i < O_LAST; i++) {
58148 differ = (old->output[i] != real_packet->output[i]);
58149 if (differ) {
58150 break;
58151 }
58152 }
58153 }
58154 if (differ) {
58155 BV_SET(fields, 11);
58156 }
58157
58158 differ = (old->num_resources != real_packet->num_resources);
58159 if (differ) {
58160 BV_SET(fields, 12);
58161 }
58162
58163 differ = (old->num_resources != real_packet->num_resources);
58164 if (!differ) {
58165 int i;
58166
58167 for (i = 0; i < real_packet->num_resources; i++) {
58168 differ = (old->resources[i] != real_packet->resources[i]);
58169 if (differ) {
58170 break;
58171 }
58172 }
58173 }
58174 if (differ) {
58175 BV_SET(fields, 13);
58176 }
58177
58178 differ = (old->num_resources != real_packet->num_resources);
58179 if (!differ) {
58180 int i;
58181
58182 for (i = 0; i < real_packet->num_resources; i++) {
58183 differ = (old->resource_freq[i] != real_packet->resource_freq[i]);
58184 if (differ) {
58185 break;
58186 }
58187 }
58188 }
58189 if (differ) {
58190 BV_SET(fields, 14);
58191 }
58192
58193 differ = FALSE;
58194 {
58195 int i;
58196
58197 for (i = 0; i < O_LAST; i++) {
58198 differ = (old->road_output_incr_pct[i] != real_packet->road_output_incr_pct[i]);
58199 if (differ) {
58200 break;
58201 }
58202 }
58203 }
58204 if (differ) {
58205 BV_SET(fields, 15);
58206 }
58207
58208 differ = (old->base_time != real_packet->base_time);
58209 if (differ) {
58210 BV_SET(fields, 16);
58211 }
58212
58213 differ = (old->road_time != real_packet->road_time);
58214 if (differ) {
58215 BV_SET(fields, 17);
58216 }
58217
58218 differ = (old->cultivate_result != real_packet->cultivate_result);
58219 if (differ) {
58220 BV_SET(fields, 18);
58221 }
58222
58223 differ = (old->cultivate_time != real_packet->cultivate_time);
58224 if (differ) {
58225 BV_SET(fields, 19);
58226 }
58227
58228 differ = (old->plant_result != real_packet->plant_result);
58229 if (differ) {
58230 BV_SET(fields, 20);
58231 }
58232
58233 differ = (old->plant_time != real_packet->plant_time);
58234 if (differ) {
58235 BV_SET(fields, 21);
58236 }
58237
58238 differ = (old->irrigation_food_incr != real_packet->irrigation_food_incr);
58239 if (differ) {
58240 BV_SET(fields, 22);
58241 }
58242
58243 differ = (old->irrigation_time != real_packet->irrigation_time);
58244 if (differ) {
58245 BV_SET(fields, 23);
58246 }
58247
58248 differ = (old->mining_shield_incr != real_packet->mining_shield_incr);
58249 if (differ) {
58250 BV_SET(fields, 24);
58251 }
58252
58253 differ = (old->mining_time != real_packet->mining_time);
58254 if (differ) {
58255 BV_SET(fields, 25);
58256 }
58257
58258 differ = (old->animal != real_packet->animal);
58259 if (differ) {
58260 BV_SET(fields, 26);
58261 }
58262
58263 differ = (old->transform_result != real_packet->transform_result);
58264 if (differ) {
58265 BV_SET(fields, 27);
58266 }
58267
58268 differ = (old->transform_time != real_packet->transform_time);
58269 if (differ) {
58270 BV_SET(fields, 28);
58271 }
58272
58273 differ = (old->placing_time != real_packet->placing_time);
58274 if (differ) {
58275 BV_SET(fields, 29);
58276 }
58277
58278 differ = (old->pillage_time != real_packet->pillage_time);
58279 if (differ) {
58280 BV_SET(fields, 30);
58281 }
58282
58283 differ = (old->extra_count != real_packet->extra_count);
58284 if (differ) {
58285 BV_SET(fields, 31);
58286 }
58287
58288 differ = (old->extra_count != real_packet->extra_count);
58289 if (!differ) {
58290 int i;
58291
58292 for (i = 0; i < real_packet->extra_count; i++) {
58293 differ = (old->extra_removal_times[i] != real_packet->extra_removal_times[i]);
58294 if (differ) {
58295 break;
58296 }
58297 }
58298 }
58299 if (differ) {
58300 BV_SET(fields, 32);
58301 }
58302
58303 differ = (old->color_red != real_packet->color_red);
58304 if (differ) {
58305 BV_SET(fields, 33);
58306 }
58307
58308 differ = (old->color_green != real_packet->color_green);
58309 if (differ) {
58310 BV_SET(fields, 34);
58311 }
58312
58313 differ = (old->color_blue != real_packet->color_blue);
58314 if (differ) {
58315 BV_SET(fields, 35);
58316 }
58317
58318 if (real_packet->helptext) {
58319 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
58320 } else {
58321 differ = (strvec_size(old->helptext) > 0);
58322 }
58323 if (differ) {
58324 BV_SET(fields, 36);
58325 }
58326
58327
58328#ifdef FREECIV_JSON_CONNECTION
58329 field_addr.name = "fields";
58330#endif /* FREECIV_JSON_CONNECTION */
58331 e = 0;
58332 e |= DIO_BV_PUT(&dout, &field_addr, fields);
58333 if (e) {
58334 log_packet_detailed("fields bitvector error detected");
58335 }
58336
58337 if (BV_ISSET(fields, 0)) {
58338 log_packet_detailed(" field 'id' has changed");
58339#ifdef FREECIV_JSON_CONNECTION
58340 field_addr.name = "id";
58341#endif /* FREECIV_JSON_CONNECTION */
58342 e = 0;
58343 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
58344 if (e) {
58345 log_packet_detailed("'id' field error detected");
58346 }
58347 }
58348 if (BV_ISSET(fields, 1)) {
58349 log_packet_detailed(" field 'tclass' has changed");
58350#ifdef FREECIV_JSON_CONNECTION
58351 field_addr.name = "tclass";
58352#endif /* FREECIV_JSON_CONNECTION */
58353 e = 0;
58354 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
58355 if (e) {
58356 log_packet_detailed("'tclass' field error detected");
58357 }
58358 }
58359 if (BV_ISSET(fields, 2)) {
58360 log_packet_detailed(" field 'flags' has changed");
58361#ifdef FREECIV_JSON_CONNECTION
58362 field_addr.name = "flags";
58363#endif /* FREECIV_JSON_CONNECTION */
58364 e = 0;
58365 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
58366 if (e) {
58367 log_packet_detailed("'flags' field error detected");
58368 }
58369 }
58370 if (BV_ISSET(fields, 3)) {
58371 log_packet_detailed(" field 'native_to' has changed");
58372#ifdef FREECIV_JSON_CONNECTION
58373 field_addr.name = "native_to";
58374#endif /* FREECIV_JSON_CONNECTION */
58375 e = 0;
58376 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
58377 if (e) {
58378 log_packet_detailed("'native_to' field error detected");
58379 }
58380 }
58381 if (BV_ISSET(fields, 4)) {
58382 log_packet_detailed(" field 'name' has changed");
58383#ifdef FREECIV_JSON_CONNECTION
58384 field_addr.name = "name";
58385#endif /* FREECIV_JSON_CONNECTION */
58386 e = 0;
58387 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
58388 if (e) {
58389 log_packet_detailed("'name' field error detected");
58390 }
58391 }
58392 if (BV_ISSET(fields, 5)) {
58393 log_packet_detailed(" field 'rule_name' has changed");
58394#ifdef FREECIV_JSON_CONNECTION
58395 field_addr.name = "rule_name";
58396#endif /* FREECIV_JSON_CONNECTION */
58397 e = 0;
58398 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
58399 if (e) {
58400 log_packet_detailed("'rule_name' field error detected");
58401 }
58402 }
58403 if (BV_ISSET(fields, 6)) {
58404 log_packet_detailed(" field 'graphic_str' has changed");
58405#ifdef FREECIV_JSON_CONNECTION
58406 field_addr.name = "graphic_str";
58407#endif /* FREECIV_JSON_CONNECTION */
58408 e = 0;
58409 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
58410 if (e) {
58411 log_packet_detailed("'graphic_str' field error detected");
58412 }
58413 }
58414 if (BV_ISSET(fields, 7)) {
58415 log_packet_detailed(" field 'graphic_alt' has changed");
58416#ifdef FREECIV_JSON_CONNECTION
58417 field_addr.name = "graphic_alt";
58418#endif /* FREECIV_JSON_CONNECTION */
58419 e = 0;
58420 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
58421 if (e) {
58422 log_packet_detailed("'graphic_alt' field error detected");
58423 }
58424 }
58425 if (BV_ISSET(fields, 8)) {
58426 log_packet_detailed(" field 'graphic_alt2' has changed");
58427#ifdef FREECIV_JSON_CONNECTION
58428 field_addr.name = "graphic_alt2";
58429#endif /* FREECIV_JSON_CONNECTION */
58430 e = 0;
58431 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
58432 if (e) {
58433 log_packet_detailed("'graphic_alt2' field error detected");
58434 }
58435 }
58436 if (BV_ISSET(fields, 9)) {
58437 log_packet_detailed(" field 'movement_cost' has changed");
58438#ifdef FREECIV_JSON_CONNECTION
58439 field_addr.name = "movement_cost";
58440#endif /* FREECIV_JSON_CONNECTION */
58441 e = 0;
58442 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->movement_cost);
58443 if (e) {
58444 log_packet_detailed("'movement_cost' field error detected");
58445 }
58446 }
58447 if (BV_ISSET(fields, 10)) {
58448 log_packet_detailed(" field 'defense_bonus' has changed");
58449#ifdef FREECIV_JSON_CONNECTION
58450 field_addr.name = "defense_bonus";
58451#endif /* FREECIV_JSON_CONNECTION */
58452 e = 0;
58453 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->defense_bonus);
58454 if (e) {
58455 log_packet_detailed("'defense_bonus' field error detected");
58456 }
58457 }
58458 if (BV_ISSET(fields, 11)) {
58459 log_packet_detailed(" field 'output' has changed");
58460#ifdef FREECIV_JSON_CONNECTION
58461 field_addr.name = "output";
58462#endif /* FREECIV_JSON_CONNECTION */
58463 e = 0;
58464 {
58465 int i;
58466
58467#ifdef FREECIV_JSON_CONNECTION
58468 /* Create the array. */
58469 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
58470
58471 /* Enter the array. */
58472 field_addr.sub_location = plocation_elem_new(0);
58473#endif /* FREECIV_JSON_CONNECTION */
58474
58475 for (i = 0; i < O_LAST; i++) {
58476#ifdef FREECIV_JSON_CONNECTION
58477 /* Next array element. */
58478 field_addr.sub_location->number = i;
58479#endif /* FREECIV_JSON_CONNECTION */
58480 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
58481 }
58482
58483#ifdef FREECIV_JSON_CONNECTION
58484 /* Exit array. */
58485 FC_FREE(field_addr.sub_location);
58486#endif /* FREECIV_JSON_CONNECTION */
58487 }
58488 if (e) {
58489 log_packet_detailed("'output' field error detected");
58490 }
58491 }
58492 if (BV_ISSET(fields, 12)) {
58493 log_packet_detailed(" field 'num_resources' has changed");
58494#ifdef FREECIV_JSON_CONNECTION
58495 field_addr.name = "num_resources";
58496#endif /* FREECIV_JSON_CONNECTION */
58497 e = 0;
58498 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_resources);
58499 if (e) {
58500 log_packet_detailed("'num_resources' field error detected");
58501 }
58502 }
58503 if (BV_ISSET(fields, 13)) {
58504 log_packet_detailed(" field 'resources' has changed");
58505#ifdef FREECIV_JSON_CONNECTION
58506 field_addr.name = "resources";
58507#endif /* FREECIV_JSON_CONNECTION */
58508 e = 0;
58509 {
58510 int i;
58511
58512#ifdef FREECIV_JSON_CONNECTION
58513 /* Create the array. */
58514 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
58515
58516 /* Enter the array. */
58517 field_addr.sub_location = plocation_elem_new(0);
58518#endif /* FREECIV_JSON_CONNECTION */
58519
58520 for (i = 0; i < real_packet->num_resources; i++) {
58521#ifdef FREECIV_JSON_CONNECTION
58522 /* Next array element. */
58523 field_addr.sub_location->number = i;
58524#endif /* FREECIV_JSON_CONNECTION */
58525 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resources[i]);
58526 }
58527
58528#ifdef FREECIV_JSON_CONNECTION
58529 /* Exit array. */
58530 FC_FREE(field_addr.sub_location);
58531#endif /* FREECIV_JSON_CONNECTION */
58532 }
58533 if (e) {
58534 log_packet_detailed("'resources' field error detected");
58535 }
58536 }
58537 if (BV_ISSET(fields, 14)) {
58538 log_packet_detailed(" field 'resource_freq' has changed");
58539#ifdef FREECIV_JSON_CONNECTION
58540 field_addr.name = "resource_freq";
58541#endif /* FREECIV_JSON_CONNECTION */
58542 e = 0;
58543 {
58544 int i;
58545
58546#ifdef FREECIV_JSON_CONNECTION
58547 /* Create the array. */
58548 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
58549
58550 /* Enter the array. */
58551 field_addr.sub_location = plocation_elem_new(0);
58552#endif /* FREECIV_JSON_CONNECTION */
58553
58554 for (i = 0; i < real_packet->num_resources; i++) {
58555#ifdef FREECIV_JSON_CONNECTION
58556 /* Next array element. */
58557 field_addr.sub_location->number = i;
58558#endif /* FREECIV_JSON_CONNECTION */
58559 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource_freq[i]);
58560 }
58561
58562#ifdef FREECIV_JSON_CONNECTION
58563 /* Exit array. */
58564 FC_FREE(field_addr.sub_location);
58565#endif /* FREECIV_JSON_CONNECTION */
58566 }
58567 if (e) {
58568 log_packet_detailed("'resource_freq' field error detected");
58569 }
58570 }
58571 if (BV_ISSET(fields, 15)) {
58572 log_packet_detailed(" field 'road_output_incr_pct' has changed");
58573#ifdef FREECIV_JSON_CONNECTION
58574 field_addr.name = "road_output_incr_pct";
58575#endif /* FREECIV_JSON_CONNECTION */
58576 e = 0;
58577 {
58578 int i;
58579
58580#ifdef FREECIV_JSON_CONNECTION
58581 /* Create the array. */
58582 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
58583
58584 /* Enter the array. */
58585 field_addr.sub_location = plocation_elem_new(0);
58586#endif /* FREECIV_JSON_CONNECTION */
58587
58588 for (i = 0; i < O_LAST; i++) {
58589#ifdef FREECIV_JSON_CONNECTION
58590 /* Next array element. */
58591 field_addr.sub_location->number = i;
58592#endif /* FREECIV_JSON_CONNECTION */
58593 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->road_output_incr_pct[i]);
58594 }
58595
58596#ifdef FREECIV_JSON_CONNECTION
58597 /* Exit array. */
58598 FC_FREE(field_addr.sub_location);
58599#endif /* FREECIV_JSON_CONNECTION */
58600 }
58601 if (e) {
58602 log_packet_detailed("'road_output_incr_pct' field error detected");
58603 }
58604 }
58605 if (BV_ISSET(fields, 16)) {
58606 log_packet_detailed(" field 'base_time' has changed");
58607#ifdef FREECIV_JSON_CONNECTION
58608 field_addr.name = "base_time";
58609#endif /* FREECIV_JSON_CONNECTION */
58610 e = 0;
58611 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_time);
58612 if (e) {
58613 log_packet_detailed("'base_time' field error detected");
58614 }
58615 }
58616 if (BV_ISSET(fields, 17)) {
58617 log_packet_detailed(" field 'road_time' has changed");
58618#ifdef FREECIV_JSON_CONNECTION
58619 field_addr.name = "road_time";
58620#endif /* FREECIV_JSON_CONNECTION */
58621 e = 0;
58622 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->road_time);
58623 if (e) {
58624 log_packet_detailed("'road_time' field error detected");
58625 }
58626 }
58627 if (BV_ISSET(fields, 18)) {
58628 log_packet_detailed(" field 'cultivate_result' has changed");
58629#ifdef FREECIV_JSON_CONNECTION
58630 field_addr.name = "cultivate_result";
58631#endif /* FREECIV_JSON_CONNECTION */
58632 e = 0;
58633 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_result);
58634 if (e) {
58635 log_packet_detailed("'cultivate_result' field error detected");
58636 }
58637 }
58638 if (BV_ISSET(fields, 19)) {
58639 log_packet_detailed(" field 'cultivate_time' has changed");
58640#ifdef FREECIV_JSON_CONNECTION
58641 field_addr.name = "cultivate_time";
58642#endif /* FREECIV_JSON_CONNECTION */
58643 e = 0;
58644 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_time);
58645 if (e) {
58646 log_packet_detailed("'cultivate_time' field error detected");
58647 }
58648 }
58649 if (BV_ISSET(fields, 20)) {
58650 log_packet_detailed(" field 'plant_result' has changed");
58651#ifdef FREECIV_JSON_CONNECTION
58652 field_addr.name = "plant_result";
58653#endif /* FREECIV_JSON_CONNECTION */
58654 e = 0;
58655 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_result);
58656 if (e) {
58657 log_packet_detailed("'plant_result' field error detected");
58658 }
58659 }
58660 if (BV_ISSET(fields, 21)) {
58661 log_packet_detailed(" field 'plant_time' has changed");
58662#ifdef FREECIV_JSON_CONNECTION
58663 field_addr.name = "plant_time";
58664#endif /* FREECIV_JSON_CONNECTION */
58665 e = 0;
58666 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_time);
58667 if (e) {
58668 log_packet_detailed("'plant_time' field error detected");
58669 }
58670 }
58671 if (BV_ISSET(fields, 22)) {
58672 log_packet_detailed(" field 'irrigation_food_incr' has changed");
58673#ifdef FREECIV_JSON_CONNECTION
58674 field_addr.name = "irrigation_food_incr";
58675#endif /* FREECIV_JSON_CONNECTION */
58676 e = 0;
58677 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_food_incr);
58678 if (e) {
58679 log_packet_detailed("'irrigation_food_incr' field error detected");
58680 }
58681 }
58682 if (BV_ISSET(fields, 23)) {
58683 log_packet_detailed(" field 'irrigation_time' has changed");
58684#ifdef FREECIV_JSON_CONNECTION
58685 field_addr.name = "irrigation_time";
58686#endif /* FREECIV_JSON_CONNECTION */
58687 e = 0;
58688 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_time);
58689 if (e) {
58690 log_packet_detailed("'irrigation_time' field error detected");
58691 }
58692 }
58693 if (BV_ISSET(fields, 24)) {
58694 log_packet_detailed(" field 'mining_shield_incr' has changed");
58695#ifdef FREECIV_JSON_CONNECTION
58696 field_addr.name = "mining_shield_incr";
58697#endif /* FREECIV_JSON_CONNECTION */
58698 e = 0;
58699 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_shield_incr);
58700 if (e) {
58701 log_packet_detailed("'mining_shield_incr' field error detected");
58702 }
58703 }
58704 if (BV_ISSET(fields, 25)) {
58705 log_packet_detailed(" field 'mining_time' has changed");
58706#ifdef FREECIV_JSON_CONNECTION
58707 field_addr.name = "mining_time";
58708#endif /* FREECIV_JSON_CONNECTION */
58709 e = 0;
58710 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_time);
58711 if (e) {
58712 log_packet_detailed("'mining_time' field error detected");
58713 }
58714 }
58715 if (BV_ISSET(fields, 26)) {
58716 log_packet_detailed(" field 'animal' has changed");
58717#ifdef FREECIV_JSON_CONNECTION
58718 field_addr.name = "animal";
58719#endif /* FREECIV_JSON_CONNECTION */
58720 e = 0;
58721 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->animal);
58722 if (e) {
58723 log_packet_detailed("'animal' field error detected");
58724 }
58725 }
58726 if (BV_ISSET(fields, 27)) {
58727 log_packet_detailed(" field 'transform_result' has changed");
58728#ifdef FREECIV_JSON_CONNECTION
58729 field_addr.name = "transform_result";
58730#endif /* FREECIV_JSON_CONNECTION */
58731 e = 0;
58732 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_result);
58733 if (e) {
58734 log_packet_detailed("'transform_result' field error detected");
58735 }
58736 }
58737 if (BV_ISSET(fields, 28)) {
58738 log_packet_detailed(" field 'transform_time' has changed");
58739#ifdef FREECIV_JSON_CONNECTION
58740 field_addr.name = "transform_time";
58741#endif /* FREECIV_JSON_CONNECTION */
58742 e = 0;
58743 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_time);
58744 if (e) {
58745 log_packet_detailed("'transform_time' field error detected");
58746 }
58747 }
58748 if (BV_ISSET(fields, 29)) {
58749 log_packet_detailed(" field 'placing_time' has changed");
58750#ifdef FREECIV_JSON_CONNECTION
58751 field_addr.name = "placing_time";
58752#endif /* FREECIV_JSON_CONNECTION */
58753 e = 0;
58754 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->placing_time);
58755 if (e) {
58756 log_packet_detailed("'placing_time' field error detected");
58757 }
58758 }
58759 if (BV_ISSET(fields, 30)) {
58760 log_packet_detailed(" field 'pillage_time' has changed");
58761#ifdef FREECIV_JSON_CONNECTION
58762 field_addr.name = "pillage_time";
58763#endif /* FREECIV_JSON_CONNECTION */
58764 e = 0;
58765 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pillage_time);
58766 if (e) {
58767 log_packet_detailed("'pillage_time' field error detected");
58768 }
58769 }
58770 if (BV_ISSET(fields, 31)) {
58771 log_packet_detailed(" field 'extra_count' has changed");
58772#ifdef FREECIV_JSON_CONNECTION
58773 field_addr.name = "extra_count";
58774#endif /* FREECIV_JSON_CONNECTION */
58775 e = 0;
58776 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_count);
58777 if (e) {
58778 log_packet_detailed("'extra_count' field error detected");
58779 }
58780 }
58781 if (BV_ISSET(fields, 32)) {
58782 log_packet_detailed(" field 'extra_removal_times' has changed");
58783#ifdef FREECIV_JSON_CONNECTION
58784 field_addr.name = "extra_removal_times";
58785#endif /* FREECIV_JSON_CONNECTION */
58786 e = 0;
58787 {
58788 int i;
58789
58790#ifdef FREECIV_JSON_CONNECTION
58791 /* Create the array. */
58792 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->extra_count);
58793
58794 /* Enter the array. */
58795 field_addr.sub_location = plocation_elem_new(0);
58796#endif /* FREECIV_JSON_CONNECTION */
58797
58798 for (i = 0; i < real_packet->extra_count; i++) {
58799#ifdef FREECIV_JSON_CONNECTION
58800 /* Next array element. */
58801 field_addr.sub_location->number = i;
58802#endif /* FREECIV_JSON_CONNECTION */
58803 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_removal_times[i]);
58804 }
58805
58806#ifdef FREECIV_JSON_CONNECTION
58807 /* Exit array. */
58808 FC_FREE(field_addr.sub_location);
58809#endif /* FREECIV_JSON_CONNECTION */
58810 }
58811 if (e) {
58812 log_packet_detailed("'extra_removal_times' field error detected");
58813 }
58814 }
58815 if (BV_ISSET(fields, 33)) {
58816 log_packet_detailed(" field 'color_red' has changed");
58817#ifdef FREECIV_JSON_CONNECTION
58818 field_addr.name = "color_red";
58819#endif /* FREECIV_JSON_CONNECTION */
58820 e = 0;
58821 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
58822 if (e) {
58823 log_packet_detailed("'color_red' field error detected");
58824 }
58825 }
58826 if (BV_ISSET(fields, 34)) {
58827 log_packet_detailed(" field 'color_green' has changed");
58828#ifdef FREECIV_JSON_CONNECTION
58829 field_addr.name = "color_green";
58830#endif /* FREECIV_JSON_CONNECTION */
58831 e = 0;
58832 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
58833 if (e) {
58834 log_packet_detailed("'color_green' field error detected");
58835 }
58836 }
58837 if (BV_ISSET(fields, 35)) {
58838 log_packet_detailed(" field 'color_blue' has changed");
58839#ifdef FREECIV_JSON_CONNECTION
58840 field_addr.name = "color_blue";
58841#endif /* FREECIV_JSON_CONNECTION */
58842 e = 0;
58843 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
58844 if (e) {
58845 log_packet_detailed("'color_blue' field error detected");
58846 }
58847 }
58848 if (BV_ISSET(fields, 36)) {
58849 log_packet_detailed(" field 'helptext' has changed");
58850#ifdef FREECIV_JSON_CONNECTION
58851 field_addr.name = "helptext";
58852#endif /* FREECIV_JSON_CONNECTION */
58853 e = 0;
58854 if (!real_packet->helptext) {
58855 /* Transmit null vector as empty vector */
58856 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
58857 } else {
58858 int i;
58859
58860 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
58861 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
58862
58863#ifdef FREECIV_JSON_CONNECTION
58864 field_addr.sub_location = plocation_elem_new(0);
58865#endif /* FREECIV_JSON_CONNECTION */
58866
58867 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
58868 const char *pstr = strvec_get(real_packet->helptext, i);
58869
58870 if (!pstr) {
58871 /* Transmit null strings as empty strings */
58872 pstr = "";
58873 }
58874
58875#ifdef FREECIV_JSON_CONNECTION
58876 /* Next array element */
58877 field_addr.sub_location->number = i;
58878#endif /* FREECIV_JSON_CONNECTION */
58879
58880 e |= DIO_PUT(string, &dout, &field_addr, pstr);
58881 }
58882
58883#ifdef FREECIV_JSON_CONNECTION
58884 FC_FREE(field_addr.sub_location);
58885#endif /* FREECIV_JSON_CONNECTION */
58886 }
58887 if (e) {
58888 log_packet_detailed("'helptext' field error detected");
58889 }
58890 }
58891
58892 old->id = real_packet->id;
58893 old->tclass = real_packet->tclass;
58894 old->flags = real_packet->flags;
58895 old->native_to = real_packet->native_to;
58896 sz_strlcpy(old->name, real_packet->name);
58897 sz_strlcpy(old->rule_name, real_packet->rule_name);
58898 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
58899 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
58900 sz_strlcpy(old->graphic_alt2, real_packet->graphic_alt2);
58901 old->movement_cost = real_packet->movement_cost;
58902 old->defense_bonus = real_packet->defense_bonus;
58903 {
58904 int i;
58905
58906 for (i = 0; i < O_LAST; i++) {
58907 old->output[i] = real_packet->output[i];
58908 }
58909 }
58910 old->num_resources = real_packet->num_resources;
58911 {
58912 int i;
58913
58914 for (i = 0; i < real_packet->num_resources; i++) {
58915 old->resources[i] = real_packet->resources[i];
58916 }
58917 }
58918 {
58919 int i;
58920
58921 for (i = 0; i < real_packet->num_resources; i++) {
58922 old->resource_freq[i] = real_packet->resource_freq[i];
58923 }
58924 }
58925 {
58926 int i;
58927
58928 for (i = 0; i < O_LAST; i++) {
58929 old->road_output_incr_pct[i] = real_packet->road_output_incr_pct[i];
58930 }
58931 }
58932 old->base_time = real_packet->base_time;
58933 old->road_time = real_packet->road_time;
58934 old->cultivate_result = real_packet->cultivate_result;
58935 old->cultivate_time = real_packet->cultivate_time;
58936 old->plant_result = real_packet->plant_result;
58937 old->plant_time = real_packet->plant_time;
58938 old->irrigation_food_incr = real_packet->irrigation_food_incr;
58939 old->irrigation_time = real_packet->irrigation_time;
58940 old->mining_shield_incr = real_packet->mining_shield_incr;
58941 old->mining_time = real_packet->mining_time;
58942 old->animal = real_packet->animal;
58943 old->transform_result = real_packet->transform_result;
58944 old->transform_time = real_packet->transform_time;
58945 old->placing_time = real_packet->placing_time;
58946 old->pillage_time = real_packet->pillage_time;
58947 old->extra_count = real_packet->extra_count;
58948 {
58949 int i;
58950
58951 for (i = 0; i < real_packet->extra_count; i++) {
58952 old->extra_removal_times[i] = real_packet->extra_removal_times[i];
58953 }
58954 }
58955 old->color_red = real_packet->color_red;
58956 old->color_green = real_packet->color_green;
58957 old->color_blue = real_packet->color_blue;
58958 if (real_packet->helptext) {
58959 strvec_copy(old->helptext, real_packet->helptext);
58960 } else {
58961 strvec_clear(old->helptext);
58962 }
58963#endif /* FREECIV_DELTA_PROTOCOL */
58964#ifndef FREECIV_DELTA_PROTOCOL
58965#ifdef FREECIV_JSON_CONNECTION
58966 field_addr.name = "id";
58967#endif /* FREECIV_JSON_CONNECTION */
58968 e = 0;
58969 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
58970 if (e) {
58971 log_packet_detailed("'id' field error detected");
58972 }
58973#ifdef FREECIV_JSON_CONNECTION
58974 field_addr.name = "tclass";
58975#endif /* FREECIV_JSON_CONNECTION */
58976 e = 0;
58977 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
58978 if (e) {
58979 log_packet_detailed("'tclass' field error detected");
58980 }
58981#ifdef FREECIV_JSON_CONNECTION
58982 field_addr.name = "flags";
58983#endif /* FREECIV_JSON_CONNECTION */
58984 e = 0;
58985 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
58986 if (e) {
58987 log_packet_detailed("'flags' field error detected");
58988 }
58989#ifdef FREECIV_JSON_CONNECTION
58990 field_addr.name = "native_to";
58991#endif /* FREECIV_JSON_CONNECTION */
58992 e = 0;
58993 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
58994 if (e) {
58995 log_packet_detailed("'native_to' field error detected");
58996 }
58997#ifdef FREECIV_JSON_CONNECTION
58998 field_addr.name = "name";
58999#endif /* FREECIV_JSON_CONNECTION */
59000 e = 0;
59001 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
59002 if (e) {
59003 log_packet_detailed("'name' field error detected");
59004 }
59005#ifdef FREECIV_JSON_CONNECTION
59006 field_addr.name = "rule_name";
59007#endif /* FREECIV_JSON_CONNECTION */
59008 e = 0;
59009 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
59010 if (e) {
59011 log_packet_detailed("'rule_name' field error detected");
59012 }
59013#ifdef FREECIV_JSON_CONNECTION
59014 field_addr.name = "graphic_str";
59015#endif /* FREECIV_JSON_CONNECTION */
59016 e = 0;
59017 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
59018 if (e) {
59019 log_packet_detailed("'graphic_str' field error detected");
59020 }
59021#ifdef FREECIV_JSON_CONNECTION
59022 field_addr.name = "graphic_alt";
59023#endif /* FREECIV_JSON_CONNECTION */
59024 e = 0;
59025 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
59026 if (e) {
59027 log_packet_detailed("'graphic_alt' field error detected");
59028 }
59029#ifdef FREECIV_JSON_CONNECTION
59030 field_addr.name = "graphic_alt2";
59031#endif /* FREECIV_JSON_CONNECTION */
59032 e = 0;
59033 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
59034 if (e) {
59035 log_packet_detailed("'graphic_alt2' field error detected");
59036 }
59037#ifdef FREECIV_JSON_CONNECTION
59038 field_addr.name = "movement_cost";
59039#endif /* FREECIV_JSON_CONNECTION */
59040 e = 0;
59041 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->movement_cost);
59042 if (e) {
59043 log_packet_detailed("'movement_cost' field error detected");
59044 }
59045#ifdef FREECIV_JSON_CONNECTION
59046 field_addr.name = "defense_bonus";
59047#endif /* FREECIV_JSON_CONNECTION */
59048 e = 0;
59049 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->defense_bonus);
59050 if (e) {
59051 log_packet_detailed("'defense_bonus' field error detected");
59052 }
59053#ifdef FREECIV_JSON_CONNECTION
59054 field_addr.name = "output";
59055#endif /* FREECIV_JSON_CONNECTION */
59056 e = 0;
59057 {
59058 int i;
59059
59060#ifdef FREECIV_JSON_CONNECTION
59061 /* Create the array. */
59062 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
59063
59064 /* Enter the array. */
59065 field_addr.sub_location = plocation_elem_new(0);
59066#endif /* FREECIV_JSON_CONNECTION */
59067
59068 for (i = 0; i < O_LAST; i++) {
59069#ifdef FREECIV_JSON_CONNECTION
59070 /* Next array element. */
59071 field_addr.sub_location->number = i;
59072#endif /* FREECIV_JSON_CONNECTION */
59073 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
59074 }
59075
59076#ifdef FREECIV_JSON_CONNECTION
59077 /* Exit array. */
59078 FC_FREE(field_addr.sub_location);
59079#endif /* FREECIV_JSON_CONNECTION */
59080 }
59081 if (e) {
59082 log_packet_detailed("'output' field error detected");
59083 }
59084#ifdef FREECIV_JSON_CONNECTION
59085 field_addr.name = "num_resources";
59086#endif /* FREECIV_JSON_CONNECTION */
59087 e = 0;
59088 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_resources);
59089 if (e) {
59090 log_packet_detailed("'num_resources' field error detected");
59091 }
59092#ifdef FREECIV_JSON_CONNECTION
59093 field_addr.name = "resources";
59094#endif /* FREECIV_JSON_CONNECTION */
59095 e = 0;
59096 {
59097 int i;
59098
59099#ifdef FREECIV_JSON_CONNECTION
59100 /* Create the array. */
59101 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
59102
59103 /* Enter the array. */
59104 field_addr.sub_location = plocation_elem_new(0);
59105#endif /* FREECIV_JSON_CONNECTION */
59106
59107 for (i = 0; i < real_packet->num_resources; i++) {
59108#ifdef FREECIV_JSON_CONNECTION
59109 /* Next array element. */
59110 field_addr.sub_location->number = i;
59111#endif /* FREECIV_JSON_CONNECTION */
59112 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resources[i]);
59113 }
59114
59115#ifdef FREECIV_JSON_CONNECTION
59116 /* Exit array. */
59117 FC_FREE(field_addr.sub_location);
59118#endif /* FREECIV_JSON_CONNECTION */
59119 }
59120 if (e) {
59121 log_packet_detailed("'resources' field error detected");
59122 }
59123#ifdef FREECIV_JSON_CONNECTION
59124 field_addr.name = "resource_freq";
59125#endif /* FREECIV_JSON_CONNECTION */
59126 e = 0;
59127 {
59128 int i;
59129
59130#ifdef FREECIV_JSON_CONNECTION
59131 /* Create the array. */
59132 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
59133
59134 /* Enter the array. */
59135 field_addr.sub_location = plocation_elem_new(0);
59136#endif /* FREECIV_JSON_CONNECTION */
59137
59138 for (i = 0; i < real_packet->num_resources; i++) {
59139#ifdef FREECIV_JSON_CONNECTION
59140 /* Next array element. */
59141 field_addr.sub_location->number = i;
59142#endif /* FREECIV_JSON_CONNECTION */
59143 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource_freq[i]);
59144 }
59145
59146#ifdef FREECIV_JSON_CONNECTION
59147 /* Exit array. */
59148 FC_FREE(field_addr.sub_location);
59149#endif /* FREECIV_JSON_CONNECTION */
59150 }
59151 if (e) {
59152 log_packet_detailed("'resource_freq' field error detected");
59153 }
59154#ifdef FREECIV_JSON_CONNECTION
59155 field_addr.name = "road_output_incr_pct";
59156#endif /* FREECIV_JSON_CONNECTION */
59157 e = 0;
59158 {
59159 int i;
59160
59161#ifdef FREECIV_JSON_CONNECTION
59162 /* Create the array. */
59163 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
59164
59165 /* Enter the array. */
59166 field_addr.sub_location = plocation_elem_new(0);
59167#endif /* FREECIV_JSON_CONNECTION */
59168
59169 for (i = 0; i < O_LAST; i++) {
59170#ifdef FREECIV_JSON_CONNECTION
59171 /* Next array element. */
59172 field_addr.sub_location->number = i;
59173#endif /* FREECIV_JSON_CONNECTION */
59174 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->road_output_incr_pct[i]);
59175 }
59176
59177#ifdef FREECIV_JSON_CONNECTION
59178 /* Exit array. */
59179 FC_FREE(field_addr.sub_location);
59180#endif /* FREECIV_JSON_CONNECTION */
59181 }
59182 if (e) {
59183 log_packet_detailed("'road_output_incr_pct' field error detected");
59184 }
59185#ifdef FREECIV_JSON_CONNECTION
59186 field_addr.name = "base_time";
59187#endif /* FREECIV_JSON_CONNECTION */
59188 e = 0;
59189 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_time);
59190 if (e) {
59191 log_packet_detailed("'base_time' field error detected");
59192 }
59193#ifdef FREECIV_JSON_CONNECTION
59194 field_addr.name = "road_time";
59195#endif /* FREECIV_JSON_CONNECTION */
59196 e = 0;
59197 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->road_time);
59198 if (e) {
59199 log_packet_detailed("'road_time' field error detected");
59200 }
59201#ifdef FREECIV_JSON_CONNECTION
59202 field_addr.name = "cultivate_result";
59203#endif /* FREECIV_JSON_CONNECTION */
59204 e = 0;
59205 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_result);
59206 if (e) {
59207 log_packet_detailed("'cultivate_result' field error detected");
59208 }
59209#ifdef FREECIV_JSON_CONNECTION
59210 field_addr.name = "cultivate_time";
59211#endif /* FREECIV_JSON_CONNECTION */
59212 e = 0;
59213 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_time);
59214 if (e) {
59215 log_packet_detailed("'cultivate_time' field error detected");
59216 }
59217#ifdef FREECIV_JSON_CONNECTION
59218 field_addr.name = "plant_result";
59219#endif /* FREECIV_JSON_CONNECTION */
59220 e = 0;
59221 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_result);
59222 if (e) {
59223 log_packet_detailed("'plant_result' field error detected");
59224 }
59225#ifdef FREECIV_JSON_CONNECTION
59226 field_addr.name = "plant_time";
59227#endif /* FREECIV_JSON_CONNECTION */
59228 e = 0;
59229 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_time);
59230 if (e) {
59231 log_packet_detailed("'plant_time' field error detected");
59232 }
59233#ifdef FREECIV_JSON_CONNECTION
59234 field_addr.name = "irrigation_food_incr";
59235#endif /* FREECIV_JSON_CONNECTION */
59236 e = 0;
59237 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_food_incr);
59238 if (e) {
59239 log_packet_detailed("'irrigation_food_incr' field error detected");
59240 }
59241#ifdef FREECIV_JSON_CONNECTION
59242 field_addr.name = "irrigation_time";
59243#endif /* FREECIV_JSON_CONNECTION */
59244 e = 0;
59245 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_time);
59246 if (e) {
59247 log_packet_detailed("'irrigation_time' field error detected");
59248 }
59249#ifdef FREECIV_JSON_CONNECTION
59250 field_addr.name = "mining_shield_incr";
59251#endif /* FREECIV_JSON_CONNECTION */
59252 e = 0;
59253 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_shield_incr);
59254 if (e) {
59255 log_packet_detailed("'mining_shield_incr' field error detected");
59256 }
59257#ifdef FREECIV_JSON_CONNECTION
59258 field_addr.name = "mining_time";
59259#endif /* FREECIV_JSON_CONNECTION */
59260 e = 0;
59261 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_time);
59262 if (e) {
59263 log_packet_detailed("'mining_time' field error detected");
59264 }
59265#ifdef FREECIV_JSON_CONNECTION
59266 field_addr.name = "animal";
59267#endif /* FREECIV_JSON_CONNECTION */
59268 e = 0;
59269 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->animal);
59270 if (e) {
59271 log_packet_detailed("'animal' field error detected");
59272 }
59273#ifdef FREECIV_JSON_CONNECTION
59274 field_addr.name = "transform_result";
59275#endif /* FREECIV_JSON_CONNECTION */
59276 e = 0;
59277 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_result);
59278 if (e) {
59279 log_packet_detailed("'transform_result' field error detected");
59280 }
59281#ifdef FREECIV_JSON_CONNECTION
59282 field_addr.name = "transform_time";
59283#endif /* FREECIV_JSON_CONNECTION */
59284 e = 0;
59285 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_time);
59286 if (e) {
59287 log_packet_detailed("'transform_time' field error detected");
59288 }
59289#ifdef FREECIV_JSON_CONNECTION
59290 field_addr.name = "placing_time";
59291#endif /* FREECIV_JSON_CONNECTION */
59292 e = 0;
59293 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->placing_time);
59294 if (e) {
59295 log_packet_detailed("'placing_time' field error detected");
59296 }
59297#ifdef FREECIV_JSON_CONNECTION
59298 field_addr.name = "pillage_time";
59299#endif /* FREECIV_JSON_CONNECTION */
59300 e = 0;
59301 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pillage_time);
59302 if (e) {
59303 log_packet_detailed("'pillage_time' field error detected");
59304 }
59305#ifdef FREECIV_JSON_CONNECTION
59306 field_addr.name = "extra_count";
59307#endif /* FREECIV_JSON_CONNECTION */
59308 e = 0;
59309 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_count);
59310 if (e) {
59311 log_packet_detailed("'extra_count' field error detected");
59312 }
59313#ifdef FREECIV_JSON_CONNECTION
59314 field_addr.name = "extra_removal_times";
59315#endif /* FREECIV_JSON_CONNECTION */
59316 e = 0;
59317 {
59318 int i;
59319
59320#ifdef FREECIV_JSON_CONNECTION
59321 /* Create the array. */
59322 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->extra_count);
59323
59324 /* Enter the array. */
59325 field_addr.sub_location = plocation_elem_new(0);
59326#endif /* FREECIV_JSON_CONNECTION */
59327
59328 for (i = 0; i < real_packet->extra_count; i++) {
59329#ifdef FREECIV_JSON_CONNECTION
59330 /* Next array element. */
59331 field_addr.sub_location->number = i;
59332#endif /* FREECIV_JSON_CONNECTION */
59333 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_removal_times[i]);
59334 }
59335
59336#ifdef FREECIV_JSON_CONNECTION
59337 /* Exit array. */
59338 FC_FREE(field_addr.sub_location);
59339#endif /* FREECIV_JSON_CONNECTION */
59340 }
59341 if (e) {
59342 log_packet_detailed("'extra_removal_times' field error detected");
59343 }
59344#ifdef FREECIV_JSON_CONNECTION
59345 field_addr.name = "color_red";
59346#endif /* FREECIV_JSON_CONNECTION */
59347 e = 0;
59348 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
59349 if (e) {
59350 log_packet_detailed("'color_red' field error detected");
59351 }
59352#ifdef FREECIV_JSON_CONNECTION
59353 field_addr.name = "color_green";
59354#endif /* FREECIV_JSON_CONNECTION */
59355 e = 0;
59356 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
59357 if (e) {
59358 log_packet_detailed("'color_green' field error detected");
59359 }
59360#ifdef FREECIV_JSON_CONNECTION
59361 field_addr.name = "color_blue";
59362#endif /* FREECIV_JSON_CONNECTION */
59363 e = 0;
59364 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
59365 if (e) {
59366 log_packet_detailed("'color_blue' field error detected");
59367 }
59368#ifdef FREECIV_JSON_CONNECTION
59369 field_addr.name = "helptext";
59370#endif /* FREECIV_JSON_CONNECTION */
59371 e = 0;
59372 if (!real_packet->helptext) {
59373 /* Transmit null vector as empty vector */
59374 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
59375 } else {
59376 int i;
59377
59378 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
59379 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
59380
59381#ifdef FREECIV_JSON_CONNECTION
59382 field_addr.sub_location = plocation_elem_new(0);
59383#endif /* FREECIV_JSON_CONNECTION */
59384
59385 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
59386 const char *pstr = strvec_get(real_packet->helptext, i);
59387
59388 if (!pstr) {
59389 /* Transmit null strings as empty strings */
59390 pstr = "";
59391 }
59392
59393#ifdef FREECIV_JSON_CONNECTION
59394 /* Next array element */
59395 field_addr.sub_location->number = i;
59396#endif /* FREECIV_JSON_CONNECTION */
59397
59398 e |= DIO_PUT(string, &dout, &field_addr, pstr);
59399 }
59400
59401#ifdef FREECIV_JSON_CONNECTION
59402 FC_FREE(field_addr.sub_location);
59403#endif /* FREECIV_JSON_CONNECTION */
59404 }
59405 if (e) {
59406 log_packet_detailed("'helptext' field error detected");
59407 }
59408
59409#endif
59410 SEND_PACKET_END(PACKET_RULESET_TERRAIN);
59411}
59412
59413 int send_packet_ruleset_terrain(struct connection *pc, const struct packet_ruleset_terrain *packet)
59414{
59415 if (!pc->used) {
59416 log_error("WARNING: trying to send data to the closed connection %s",
59417 conn_description(pc));
59418 return -1;
59419 }
59420 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN].packet != nullptr, -1,
59421 "Handler for PACKET_RULESET_TERRAIN not installed");
59422 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN].packet(pc, packet);
59423}
59424
59425 void lsend_packet_ruleset_terrain(struct conn_list *dest, const struct packet_ruleset_terrain *packet)
59426{
59427 conn_list_iterate(dest, pconn) {
59428 send_packet_ruleset_terrain(pconn, packet);
59429 } conn_list_iterate_end;
59430}
59431
59432 static inline void init_packet_ruleset_terrain_flag(struct packet_ruleset_terrain_flag *packet)
59433{
59434 memset(packet, 0, sizeof(*packet));
59435}
59436
59437#define free_packet_ruleset_terrain_flag(_packet) (void) 0
59438#define destroy_packet_ruleset_terrain_flag free
59439
59440#ifdef FREECIV_DELTA_PROTOCOL
59441#define hash_packet_ruleset_terrain_flag_100 hash_const
59442
59443#define cmp_packet_ruleset_terrain_flag_100 cmp_const
59444
59445 BV_DEFINE(packet_ruleset_terrain_flag_100_fields, 3);
59446#endif /* FREECIV_DELTA_PROTOCOL */
59447
59448 static struct packet_ruleset_terrain_flag *receive_packet_ruleset_terrain_flag_100(struct connection *pc)
59449{
59450#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_terrain_flag(_packet)
59451#ifdef FREECIV_DELTA_PROTOCOL
59452 packet_ruleset_terrain_flag_100_fields fields;
59453 struct packet_ruleset_terrain_flag *old;
59454 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN_FLAG;
59455#endif /* FREECIV_DELTA_PROTOCOL */
59456 RECEIVE_PACKET_START(packet_ruleset_terrain_flag, real_packet);
59457#ifdef FREECIV_JSON_CONNECTION
59458 struct plocation field_addr;
59459 {
59460 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
59461 field_addr = *field_addr_tmp;
59462 FC_FREE(field_addr_tmp);
59463 }
59464#endif /* FREECIV_JSON_CONNECTION */
59465
59466#ifdef FREECIV_DELTA_PROTOCOL
59467#ifdef FREECIV_JSON_CONNECTION
59468 field_addr.name = "fields";
59469#endif /* FREECIV_JSON_CONNECTION */
59470 DIO_BV_GET(&din, &field_addr, fields);
59471
59472#else /* FREECIV_DELTA_PROTOCOL */
59473#ifdef FREECIV_JSON_CONNECTION
59474 field_addr.name = "id";
59475#endif /* FREECIV_JSON_CONNECTION */
59476 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59477 RECEIVE_PACKET_FIELD_ERROR(id);
59478 }
59479#ifdef FREECIV_JSON_CONNECTION
59480 field_addr.name = "name";
59481#endif /* FREECIV_JSON_CONNECTION */
59482 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59483 RECEIVE_PACKET_FIELD_ERROR(name);
59484 }
59485#ifdef FREECIV_JSON_CONNECTION
59486 field_addr.name = "helptxt";
59487#endif /* FREECIV_JSON_CONNECTION */
59488 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
59489 RECEIVE_PACKET_FIELD_ERROR(helptxt);
59490 }
59491#endif
59492 log_packet_detailed("packet_ruleset_terrain_flag_100: got info about ()");
59493
59494#ifdef FREECIV_DELTA_PROTOCOL
59495 if (nullptr == *hash) {
59496 *hash = genhash_new_full(hash_packet_ruleset_terrain_flag_100, cmp_packet_ruleset_terrain_flag_100,
59497 nullptr, nullptr, nullptr, destroy_packet_ruleset_terrain_flag);
59498 }
59499
59500 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
59501 *real_packet = *old;
59502 } else {
59503 /* packet is already initialized empty */
59504 log_packet_detailed(" no old info");
59505 }
59506
59507 if (BV_ISSET(fields, 0)) {
59508 log_packet_detailed(" got field 'id'");
59509#ifdef FREECIV_JSON_CONNECTION
59510 field_addr.name = "id";
59511#endif /* FREECIV_JSON_CONNECTION */
59512 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59513 RECEIVE_PACKET_FIELD_ERROR(id);
59514 }
59515 }
59516 if (BV_ISSET(fields, 1)) {
59517 log_packet_detailed(" got field 'name'");
59518#ifdef FREECIV_JSON_CONNECTION
59519 field_addr.name = "name";
59520#endif /* FREECIV_JSON_CONNECTION */
59521 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59522 RECEIVE_PACKET_FIELD_ERROR(name);
59523 }
59524 }
59525 if (BV_ISSET(fields, 2)) {
59526 log_packet_detailed(" got field 'helptxt'");
59527#ifdef FREECIV_JSON_CONNECTION
59528 field_addr.name = "helptxt";
59529#endif /* FREECIV_JSON_CONNECTION */
59530 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
59531 RECEIVE_PACKET_FIELD_ERROR(helptxt);
59532 }
59533 }
59534
59535 if (nullptr == old) {
59536 old = fc_malloc(sizeof(*old));
59537 init_packet_ruleset_terrain_flag(old);
59538 *old = *real_packet;
59539 genhash_insert(*hash, old, old);
59540 } else {
59541 *old = *real_packet;
59542 }
59543
59544#endif /* FREECIV_DELTA_PROTOCOL */
59545 RECEIVE_PACKET_END(real_packet);
59546#undef FREE_PACKET_STRUCT
59547}
59548
59549 static int send_packet_ruleset_terrain_flag_100(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
59550{
59551 const struct packet_ruleset_terrain_flag *real_packet = packet;
59552 int e;
59553#ifdef FREECIV_DELTA_PROTOCOL
59554 packet_ruleset_terrain_flag_100_fields fields;
59555 struct packet_ruleset_terrain_flag *old;
59556 bool differ;
59557 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN_FLAG;
59558#endif /* FREECIV_DELTA_PROTOCOL */
59559 SEND_PACKET_START(PACKET_RULESET_TERRAIN_FLAG);
59560#ifdef FREECIV_JSON_CONNECTION
59561 struct plocation field_addr;
59562 {
59563 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
59564 field_addr = *field_addr_tmp;
59565 FC_FREE(field_addr_tmp);
59566 }
59567#endif /* FREECIV_JSON_CONNECTION */
59568
59569 log_packet_detailed("packet_ruleset_terrain_flag_100: sending info about ()");
59570
59571#ifdef FREECIV_DELTA_PROTOCOL
59572 if (nullptr == *hash) {
59573 *hash = genhash_new_full(hash_packet_ruleset_terrain_flag_100, cmp_packet_ruleset_terrain_flag_100,
59574 nullptr, nullptr, nullptr, destroy_packet_ruleset_terrain_flag);
59575 }
59576 BV_CLR_ALL(fields);
59577
59578 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
59579 old = fc_malloc(sizeof(*old));
59580 /* temporary bitcopy just to insert correctly */
59581 *old = *real_packet;
59582 genhash_insert(*hash, old, old);
59583 init_packet_ruleset_terrain_flag(old);
59584 }
59585 differ = (old->id != real_packet->id);
59586 if (differ) {
59587 BV_SET(fields, 0);
59588 }
59589
59590 differ = (strcmp(old->name, real_packet->name) != 0);
59591 if (differ) {
59592 BV_SET(fields, 1);
59593 }
59594
59595 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
59596 if (differ) {
59597 BV_SET(fields, 2);
59598 }
59599
59600
59601#ifdef FREECIV_JSON_CONNECTION
59602 field_addr.name = "fields";
59603#endif /* FREECIV_JSON_CONNECTION */
59604 e = 0;
59605 e |= DIO_BV_PUT(&dout, &field_addr, fields);
59606 if (e) {
59607 log_packet_detailed("fields bitvector error detected");
59608 }
59609
59610 if (BV_ISSET(fields, 0)) {
59611 log_packet_detailed(" field 'id' has changed");
59612#ifdef FREECIV_JSON_CONNECTION
59613 field_addr.name = "id";
59614#endif /* FREECIV_JSON_CONNECTION */
59615 e = 0;
59616 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
59617 if (e) {
59618 log_packet_detailed("'id' field error detected");
59619 }
59620 }
59621 if (BV_ISSET(fields, 1)) {
59622 log_packet_detailed(" field 'name' has changed");
59623#ifdef FREECIV_JSON_CONNECTION
59624 field_addr.name = "name";
59625#endif /* FREECIV_JSON_CONNECTION */
59626 e = 0;
59627 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
59628 if (e) {
59629 log_packet_detailed("'name' field error detected");
59630 }
59631 }
59632 if (BV_ISSET(fields, 2)) {
59633 log_packet_detailed(" field 'helptxt' has changed");
59634#ifdef FREECIV_JSON_CONNECTION
59635 field_addr.name = "helptxt";
59636#endif /* FREECIV_JSON_CONNECTION */
59637 e = 0;
59638 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
59639 if (e) {
59640 log_packet_detailed("'helptxt' field error detected");
59641 }
59642 }
59643
59644 *old = *real_packet;
59645#endif /* FREECIV_DELTA_PROTOCOL */
59646#ifndef FREECIV_DELTA_PROTOCOL
59647#ifdef FREECIV_JSON_CONNECTION
59648 field_addr.name = "id";
59649#endif /* FREECIV_JSON_CONNECTION */
59650 e = 0;
59651 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
59652 if (e) {
59653 log_packet_detailed("'id' field error detected");
59654 }
59655#ifdef FREECIV_JSON_CONNECTION
59656 field_addr.name = "name";
59657#endif /* FREECIV_JSON_CONNECTION */
59658 e = 0;
59659 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
59660 if (e) {
59661 log_packet_detailed("'name' field error detected");
59662 }
59663#ifdef FREECIV_JSON_CONNECTION
59664 field_addr.name = "helptxt";
59665#endif /* FREECIV_JSON_CONNECTION */
59666 e = 0;
59667 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
59668 if (e) {
59669 log_packet_detailed("'helptxt' field error detected");
59670 }
59671
59672#endif
59673 SEND_PACKET_END(PACKET_RULESET_TERRAIN_FLAG);
59674}
59675
59676 int send_packet_ruleset_terrain_flag(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
59677{
59678 if (!pc->used) {
59679 log_error("WARNING: trying to send data to the closed connection %s",
59680 conn_description(pc));
59681 return -1;
59682 }
59683 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN_FLAG].packet != nullptr, -1,
59684 "Handler for PACKET_RULESET_TERRAIN_FLAG not installed");
59685 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN_FLAG].packet(pc, packet);
59686}
59687
59688 void lsend_packet_ruleset_terrain_flag(struct conn_list *dest, const struct packet_ruleset_terrain_flag *packet)
59689{
59690 conn_list_iterate(dest, pconn) {
59691 send_packet_ruleset_terrain_flag(pconn, packet);
59692 } conn_list_iterate_end;
59693}
59694
59695 static inline void init_packet_ruleset_unit_class(struct packet_ruleset_unit_class *packet)
59696{
59697 memset(packet, 0, sizeof(*packet));
59698
59699 /* no work needed for packet->id */
59700 /* no work needed for packet->name */
59701 /* no work needed for packet->rule_name */
59702 /* no work needed for packet->min_speed */
59703 /* no work needed for packet->hp_loss_pct */
59704 /* no work needed for packet->non_native_def_pct */
59705 /* no work needed for packet->flags */
59706 packet->helptext = strvec_new();
59707}
59708
59709 static inline void free_packet_ruleset_unit_class(struct packet_ruleset_unit_class *packet)
59710{
59711 if (packet->helptext) {
59712 strvec_destroy(packet->helptext);
59713 packet->helptext = nullptr;
59714 }
59715 /* no work needed for packet->flags */
59716 /* no work needed for packet->non_native_def_pct */
59717 /* no work needed for packet->hp_loss_pct */
59718 /* no work needed for packet->min_speed */
59719 /* no work needed for packet->rule_name */
59720 /* no work needed for packet->name */
59721 /* no work needed for packet->id */
59722}
59723
59724 static inline void destroy_packet_ruleset_unit_class(void *packet)
59725{
59726 free_packet_ruleset_unit_class((struct packet_ruleset_unit_class *) packet);
59727 free(packet);
59728}
59729
59730#ifdef FREECIV_DELTA_PROTOCOL
59731#define hash_packet_ruleset_unit_class_100 hash_const
59732
59733#define cmp_packet_ruleset_unit_class_100 cmp_const
59734
59735 BV_DEFINE(packet_ruleset_unit_class_100_fields, 8);
59736#endif /* FREECIV_DELTA_PROTOCOL */
59737
59738 static struct packet_ruleset_unit_class *receive_packet_ruleset_unit_class_100(struct connection *pc)
59739{
59740#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_unit_class(_packet)
59741#ifdef FREECIV_DELTA_PROTOCOL
59742 packet_ruleset_unit_class_100_fields fields;
59743 struct packet_ruleset_unit_class *old;
59744 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_CLASS;
59745#endif /* FREECIV_DELTA_PROTOCOL */
59746 RECEIVE_PACKET_START(packet_ruleset_unit_class, real_packet);
59747#ifdef FREECIV_JSON_CONNECTION
59748 struct plocation field_addr;
59749 {
59750 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
59751 field_addr = *field_addr_tmp;
59752 FC_FREE(field_addr_tmp);
59753 }
59754#endif /* FREECIV_JSON_CONNECTION */
59755
59756#ifdef FREECIV_DELTA_PROTOCOL
59757#ifdef FREECIV_JSON_CONNECTION
59758 field_addr.name = "fields";
59759#endif /* FREECIV_JSON_CONNECTION */
59760 DIO_BV_GET(&din, &field_addr, fields);
59761
59762#else /* FREECIV_DELTA_PROTOCOL */
59763#ifdef FREECIV_JSON_CONNECTION
59764 field_addr.name = "id";
59765#endif /* FREECIV_JSON_CONNECTION */
59766 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59767 RECEIVE_PACKET_FIELD_ERROR(id);
59768 }
59769#ifdef FREECIV_JSON_CONNECTION
59770 field_addr.name = "name";
59771#endif /* FREECIV_JSON_CONNECTION */
59772 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59773 RECEIVE_PACKET_FIELD_ERROR(name);
59774 }
59775#ifdef FREECIV_JSON_CONNECTION
59776 field_addr.name = "rule_name";
59777#endif /* FREECIV_JSON_CONNECTION */
59778 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
59779 RECEIVE_PACKET_FIELD_ERROR(rule_name);
59780 }
59781#ifdef FREECIV_JSON_CONNECTION
59782 field_addr.name = "min_speed";
59783#endif /* FREECIV_JSON_CONNECTION */
59784 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->min_speed)) {
59785 RECEIVE_PACKET_FIELD_ERROR(min_speed);
59786 }
59787#ifdef FREECIV_JSON_CONNECTION
59788 field_addr.name = "hp_loss_pct";
59789#endif /* FREECIV_JSON_CONNECTION */
59790 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp_loss_pct)) {
59791 RECEIVE_PACKET_FIELD_ERROR(hp_loss_pct);
59792 }
59793#ifdef FREECIV_JSON_CONNECTION
59794 field_addr.name = "non_native_def_pct";
59795#endif /* FREECIV_JSON_CONNECTION */
59796 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->non_native_def_pct)) {
59797 RECEIVE_PACKET_FIELD_ERROR(non_native_def_pct);
59798 }
59799#ifdef FREECIV_JSON_CONNECTION
59800 field_addr.name = "flags";
59801#endif /* FREECIV_JSON_CONNECTION */
59802 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
59803 RECEIVE_PACKET_FIELD_ERROR(flags);
59804 }
59805#ifdef FREECIV_JSON_CONNECTION
59806 field_addr.name = "helptext";
59807#endif /* FREECIV_JSON_CONNECTION */
59808 {
59809 int i;
59810
59811 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
59812 RECEIVE_PACKET_FIELD_ERROR(helptext);
59813 }
59814 strvec_reserve(real_packet->helptext, i);
59815
59816#ifdef FREECIV_JSON_CONNECTION
59817 field_addr.sub_location = plocation_elem_new(0);
59818#endif /* FREECIV_JSON_CONNECTION */
59819
59820 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
59821 char readin[MAX_LEN_PACKET];
59822
59823#ifdef FREECIV_JSON_CONNECTION
59824 /* Next array element */
59825 field_addr.sub_location->number = i;
59826#endif /* FREECIV_JSON_CONNECTION */
59827
59828 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
59829 || !strvec_set(real_packet->helptext, i, readin)) {
59830 RECEIVE_PACKET_FIELD_ERROR(helptext);
59831 }
59832 }
59833
59834#ifdef FREECIV_JSON_CONNECTION
59835 FC_FREE(field_addr.sub_location);
59836#endif /* FREECIV_JSON_CONNECTION */
59837 }
59838#endif
59839 log_packet_detailed("packet_ruleset_unit_class_100: got info about ()");
59840
59841#ifdef FREECIV_DELTA_PROTOCOL
59842 if (nullptr == *hash) {
59843 *hash = genhash_new_full(hash_packet_ruleset_unit_class_100, cmp_packet_ruleset_unit_class_100,
59844 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_class);
59845 }
59846
59847 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
59848 real_packet->id = old->id;
59849 sz_strlcpy(real_packet->name, old->name);
59850 sz_strlcpy(real_packet->rule_name, old->rule_name);
59851 real_packet->min_speed = old->min_speed;
59852 real_packet->hp_loss_pct = old->hp_loss_pct;
59853 real_packet->non_native_def_pct = old->non_native_def_pct;
59854 real_packet->flags = old->flags;
59855 if (old->helptext) {
59856 strvec_copy(real_packet->helptext, old->helptext);
59857 } else {
59858 strvec_clear(real_packet->helptext);
59859 }
59860 } else {
59861 /* packet is already initialized empty */
59862 log_packet_detailed(" no old info");
59863 }
59864
59865 if (BV_ISSET(fields, 0)) {
59866 log_packet_detailed(" got field 'id'");
59867#ifdef FREECIV_JSON_CONNECTION
59868 field_addr.name = "id";
59869#endif /* FREECIV_JSON_CONNECTION */
59870 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59871 RECEIVE_PACKET_FIELD_ERROR(id);
59872 }
59873 }
59874 if (BV_ISSET(fields, 1)) {
59875 log_packet_detailed(" got field 'name'");
59876#ifdef FREECIV_JSON_CONNECTION
59877 field_addr.name = "name";
59878#endif /* FREECIV_JSON_CONNECTION */
59879 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
59880 RECEIVE_PACKET_FIELD_ERROR(name);
59881 }
59882 }
59883 if (BV_ISSET(fields, 2)) {
59884 log_packet_detailed(" got field 'rule_name'");
59885#ifdef FREECIV_JSON_CONNECTION
59886 field_addr.name = "rule_name";
59887#endif /* FREECIV_JSON_CONNECTION */
59888 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
59889 RECEIVE_PACKET_FIELD_ERROR(rule_name);
59890 }
59891 }
59892 if (BV_ISSET(fields, 3)) {
59893 log_packet_detailed(" got field 'min_speed'");
59894#ifdef FREECIV_JSON_CONNECTION
59895 field_addr.name = "min_speed";
59896#endif /* FREECIV_JSON_CONNECTION */
59897 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->min_speed)) {
59898 RECEIVE_PACKET_FIELD_ERROR(min_speed);
59899 }
59900 }
59901 if (BV_ISSET(fields, 4)) {
59902 log_packet_detailed(" got field 'hp_loss_pct'");
59903#ifdef FREECIV_JSON_CONNECTION
59904 field_addr.name = "hp_loss_pct";
59905#endif /* FREECIV_JSON_CONNECTION */
59906 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp_loss_pct)) {
59907 RECEIVE_PACKET_FIELD_ERROR(hp_loss_pct);
59908 }
59909 }
59910 if (BV_ISSET(fields, 5)) {
59911 log_packet_detailed(" got field 'non_native_def_pct'");
59912#ifdef FREECIV_JSON_CONNECTION
59913 field_addr.name = "non_native_def_pct";
59914#endif /* FREECIV_JSON_CONNECTION */
59915 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->non_native_def_pct)) {
59916 RECEIVE_PACKET_FIELD_ERROR(non_native_def_pct);
59917 }
59918 }
59919 if (BV_ISSET(fields, 6)) {
59920 log_packet_detailed(" got field 'flags'");
59921#ifdef FREECIV_JSON_CONNECTION
59922 field_addr.name = "flags";
59923#endif /* FREECIV_JSON_CONNECTION */
59924 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
59925 RECEIVE_PACKET_FIELD_ERROR(flags);
59926 }
59927 }
59928 if (BV_ISSET(fields, 7)) {
59929 log_packet_detailed(" got field 'helptext'");
59930#ifdef FREECIV_JSON_CONNECTION
59931 field_addr.name = "helptext";
59932#endif /* FREECIV_JSON_CONNECTION */
59933 {
59934 int i;
59935
59936 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
59937 RECEIVE_PACKET_FIELD_ERROR(helptext);
59938 }
59939 strvec_reserve(real_packet->helptext, i);
59940
59941#ifdef FREECIV_JSON_CONNECTION
59942 field_addr.sub_location = plocation_elem_new(0);
59943#endif /* FREECIV_JSON_CONNECTION */
59944
59945 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
59946 char readin[MAX_LEN_PACKET];
59947
59948#ifdef FREECIV_JSON_CONNECTION
59949 /* Next array element */
59950 field_addr.sub_location->number = i;
59951#endif /* FREECIV_JSON_CONNECTION */
59952
59953 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
59954 || !strvec_set(real_packet->helptext, i, readin)) {
59955 RECEIVE_PACKET_FIELD_ERROR(helptext);
59956 }
59957 }
59958
59959#ifdef FREECIV_JSON_CONNECTION
59960 FC_FREE(field_addr.sub_location);
59961#endif /* FREECIV_JSON_CONNECTION */
59962 }
59963 }
59964
59965 if (nullptr == old) {
59966 old = fc_malloc(sizeof(*old));
59967 init_packet_ruleset_unit_class(old);
59968 old->id = real_packet->id;
59969 sz_strlcpy(old->name, real_packet->name);
59970 sz_strlcpy(old->rule_name, real_packet->rule_name);
59971 old->min_speed = real_packet->min_speed;
59972 old->hp_loss_pct = real_packet->hp_loss_pct;
59973 old->non_native_def_pct = real_packet->non_native_def_pct;
59974 old->flags = real_packet->flags;
59975 if (real_packet->helptext) {
59976 strvec_copy(old->helptext, real_packet->helptext);
59977 } else {
59978 strvec_clear(old->helptext);
59979 }
59980 genhash_insert(*hash, old, old);
59981 } else {
59982 old->id = real_packet->id;
59983 sz_strlcpy(old->name, real_packet->name);
59984 sz_strlcpy(old->rule_name, real_packet->rule_name);
59985 old->min_speed = real_packet->min_speed;
59986 old->hp_loss_pct = real_packet->hp_loss_pct;
59987 old->non_native_def_pct = real_packet->non_native_def_pct;
59988 old->flags = real_packet->flags;
59989 if (real_packet->helptext) {
59990 strvec_copy(old->helptext, real_packet->helptext);
59991 } else {
59992 strvec_clear(old->helptext);
59993 }
59994 }
59995
59996#endif /* FREECIV_DELTA_PROTOCOL */
59997 RECEIVE_PACKET_END(real_packet);
59998#undef FREE_PACKET_STRUCT
59999}
60000
60001 static int send_packet_ruleset_unit_class_100(struct connection *pc, const struct packet_ruleset_unit_class *packet)
60002{
60003 const struct packet_ruleset_unit_class *real_packet = packet;
60004 int e;
60005#ifdef FREECIV_DELTA_PROTOCOL
60006 packet_ruleset_unit_class_100_fields fields;
60007 struct packet_ruleset_unit_class *old;
60008 bool differ;
60009 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_CLASS;
60010#endif /* FREECIV_DELTA_PROTOCOL */
60011 SEND_PACKET_START(PACKET_RULESET_UNIT_CLASS);
60012#ifdef FREECIV_JSON_CONNECTION
60013 struct plocation field_addr;
60014 {
60015 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
60016 field_addr = *field_addr_tmp;
60017 FC_FREE(field_addr_tmp);
60018 }
60019#endif /* FREECIV_JSON_CONNECTION */
60020
60021 log_packet_detailed("packet_ruleset_unit_class_100: sending info about ()");
60022
60023#ifdef FREECIV_DELTA_PROTOCOL
60024 if (nullptr == *hash) {
60025 *hash = genhash_new_full(hash_packet_ruleset_unit_class_100, cmp_packet_ruleset_unit_class_100,
60026 nullptr, nullptr, nullptr, destroy_packet_ruleset_unit_class);
60027 }
60028 BV_CLR_ALL(fields);
60029
60030 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
60031 old = fc_malloc(sizeof(*old));
60032 /* temporary bitcopy just to insert correctly */
60033 *old = *real_packet;
60034 genhash_insert(*hash, old, old);
60035 init_packet_ruleset_unit_class(old);
60036 }
60037 differ = (old->id != real_packet->id);
60038 if (differ) {
60039 BV_SET(fields, 0);
60040 }
60041
60042 differ = (strcmp(old->name, real_packet->name) != 0);
60043 if (differ) {
60044 BV_SET(fields, 1);
60045 }
60046
60047 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
60048 if (differ) {
60049 BV_SET(fields, 2);
60050 }
60051
60052 differ = (old->min_speed != real_packet->min_speed);
60053 if (differ) {
60054 BV_SET(fields, 3);
60055 }
60056
60057 differ = (old->hp_loss_pct != real_packet->hp_loss_pct);
60058 if (differ) {
60059 BV_SET(fields, 4);
60060 }
60061
60062 differ = (old->non_native_def_pct != real_packet->non_native_def_pct);
60063 if (differ) {
60064 BV_SET(fields, 5);
60065 }
60066
60067 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
60068 if (differ) {
60069 BV_SET(fields, 6);
60070 }
60071
60072 if (real_packet->helptext) {
60073 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
60074 } else {
60075 differ = (strvec_size(old->helptext) > 0);
60076 }
60077 if (differ) {
60078 BV_SET(fields, 7);
60079 }
60080
60081
60082#ifdef FREECIV_JSON_CONNECTION
60083 field_addr.name = "fields";
60084#endif /* FREECIV_JSON_CONNECTION */
60085 e = 0;
60086 e |= DIO_BV_PUT(&dout, &field_addr, fields);
60087 if (e) {
60088 log_packet_detailed("fields bitvector error detected");
60089 }
60090
60091 if (BV_ISSET(fields, 0)) {
60092 log_packet_detailed(" field 'id' has changed");
60093#ifdef FREECIV_JSON_CONNECTION
60094 field_addr.name = "id";
60095#endif /* FREECIV_JSON_CONNECTION */
60096 e = 0;
60097 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
60098 if (e) {
60099 log_packet_detailed("'id' field error detected");
60100 }
60101 }
60102 if (BV_ISSET(fields, 1)) {
60103 log_packet_detailed(" field 'name' has changed");
60104#ifdef FREECIV_JSON_CONNECTION
60105 field_addr.name = "name";
60106#endif /* FREECIV_JSON_CONNECTION */
60107 e = 0;
60108 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
60109 if (e) {
60110 log_packet_detailed("'name' field error detected");
60111 }
60112 }
60113 if (BV_ISSET(fields, 2)) {
60114 log_packet_detailed(" field 'rule_name' has changed");
60115#ifdef FREECIV_JSON_CONNECTION
60116 field_addr.name = "rule_name";
60117#endif /* FREECIV_JSON_CONNECTION */
60118 e = 0;
60119 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60120 if (e) {
60121 log_packet_detailed("'rule_name' field error detected");
60122 }
60123 }
60124 if (BV_ISSET(fields, 3)) {
60125 log_packet_detailed(" field 'min_speed' has changed");
60126#ifdef FREECIV_JSON_CONNECTION
60127 field_addr.name = "min_speed";
60128#endif /* FREECIV_JSON_CONNECTION */
60129 e = 0;
60130 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->min_speed);
60131 if (e) {
60132 log_packet_detailed("'min_speed' field error detected");
60133 }
60134 }
60135 if (BV_ISSET(fields, 4)) {
60136 log_packet_detailed(" field 'hp_loss_pct' has changed");
60137#ifdef FREECIV_JSON_CONNECTION
60138 field_addr.name = "hp_loss_pct";
60139#endif /* FREECIV_JSON_CONNECTION */
60140 e = 0;
60141 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp_loss_pct);
60142 if (e) {
60143 log_packet_detailed("'hp_loss_pct' field error detected");
60144 }
60145 }
60146 if (BV_ISSET(fields, 5)) {
60147 log_packet_detailed(" field 'non_native_def_pct' has changed");
60148#ifdef FREECIV_JSON_CONNECTION
60149 field_addr.name = "non_native_def_pct";
60150#endif /* FREECIV_JSON_CONNECTION */
60151 e = 0;
60152 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->non_native_def_pct);
60153 if (e) {
60154 log_packet_detailed("'non_native_def_pct' field error detected");
60155 }
60156 }
60157 if (BV_ISSET(fields, 6)) {
60158 log_packet_detailed(" field 'flags' has changed");
60159#ifdef FREECIV_JSON_CONNECTION
60160 field_addr.name = "flags";
60161#endif /* FREECIV_JSON_CONNECTION */
60162 e = 0;
60163 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
60164 if (e) {
60165 log_packet_detailed("'flags' field error detected");
60166 }
60167 }
60168 if (BV_ISSET(fields, 7)) {
60169 log_packet_detailed(" field 'helptext' has changed");
60170#ifdef FREECIV_JSON_CONNECTION
60171 field_addr.name = "helptext";
60172#endif /* FREECIV_JSON_CONNECTION */
60173 e = 0;
60174 if (!real_packet->helptext) {
60175 /* Transmit null vector as empty vector */
60176 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
60177 } else {
60178 int i;
60179
60180 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
60181 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
60182
60183#ifdef FREECIV_JSON_CONNECTION
60184 field_addr.sub_location = plocation_elem_new(0);
60185#endif /* FREECIV_JSON_CONNECTION */
60186
60187 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
60188 const char *pstr = strvec_get(real_packet->helptext, i);
60189
60190 if (!pstr) {
60191 /* Transmit null strings as empty strings */
60192 pstr = "";
60193 }
60194
60195#ifdef FREECIV_JSON_CONNECTION
60196 /* Next array element */
60197 field_addr.sub_location->number = i;
60198#endif /* FREECIV_JSON_CONNECTION */
60199
60200 e |= DIO_PUT(string, &dout, &field_addr, pstr);
60201 }
60202
60203#ifdef FREECIV_JSON_CONNECTION
60204 FC_FREE(field_addr.sub_location);
60205#endif /* FREECIV_JSON_CONNECTION */
60206 }
60207 if (e) {
60208 log_packet_detailed("'helptext' field error detected");
60209 }
60210 }
60211
60212 old->id = real_packet->id;
60213 sz_strlcpy(old->name, real_packet->name);
60214 sz_strlcpy(old->rule_name, real_packet->rule_name);
60215 old->min_speed = real_packet->min_speed;
60216 old->hp_loss_pct = real_packet->hp_loss_pct;
60217 old->non_native_def_pct = real_packet->non_native_def_pct;
60218 old->flags = real_packet->flags;
60219 if (real_packet->helptext) {
60220 strvec_copy(old->helptext, real_packet->helptext);
60221 } else {
60222 strvec_clear(old->helptext);
60223 }
60224#endif /* FREECIV_DELTA_PROTOCOL */
60225#ifndef FREECIV_DELTA_PROTOCOL
60226#ifdef FREECIV_JSON_CONNECTION
60227 field_addr.name = "id";
60228#endif /* FREECIV_JSON_CONNECTION */
60229 e = 0;
60230 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
60231 if (e) {
60232 log_packet_detailed("'id' field error detected");
60233 }
60234#ifdef FREECIV_JSON_CONNECTION
60235 field_addr.name = "name";
60236#endif /* FREECIV_JSON_CONNECTION */
60237 e = 0;
60238 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
60239 if (e) {
60240 log_packet_detailed("'name' field error detected");
60241 }
60242#ifdef FREECIV_JSON_CONNECTION
60243 field_addr.name = "rule_name";
60244#endif /* FREECIV_JSON_CONNECTION */
60245 e = 0;
60246 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60247 if (e) {
60248 log_packet_detailed("'rule_name' field error detected");
60249 }
60250#ifdef FREECIV_JSON_CONNECTION
60251 field_addr.name = "min_speed";
60252#endif /* FREECIV_JSON_CONNECTION */
60253 e = 0;
60254 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->min_speed);
60255 if (e) {
60256 log_packet_detailed("'min_speed' field error detected");
60257 }
60258#ifdef FREECIV_JSON_CONNECTION
60259 field_addr.name = "hp_loss_pct";
60260#endif /* FREECIV_JSON_CONNECTION */
60261 e = 0;
60262 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp_loss_pct);
60263 if (e) {
60264 log_packet_detailed("'hp_loss_pct' field error detected");
60265 }
60266#ifdef FREECIV_JSON_CONNECTION
60267 field_addr.name = "non_native_def_pct";
60268#endif /* FREECIV_JSON_CONNECTION */
60269 e = 0;
60270 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->non_native_def_pct);
60271 if (e) {
60272 log_packet_detailed("'non_native_def_pct' field error detected");
60273 }
60274#ifdef FREECIV_JSON_CONNECTION
60275 field_addr.name = "flags";
60276#endif /* FREECIV_JSON_CONNECTION */
60277 e = 0;
60278 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
60279 if (e) {
60280 log_packet_detailed("'flags' field error detected");
60281 }
60282#ifdef FREECIV_JSON_CONNECTION
60283 field_addr.name = "helptext";
60284#endif /* FREECIV_JSON_CONNECTION */
60285 e = 0;
60286 if (!real_packet->helptext) {
60287 /* Transmit null vector as empty vector */
60288 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
60289 } else {
60290 int i;
60291
60292 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
60293 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
60294
60295#ifdef FREECIV_JSON_CONNECTION
60296 field_addr.sub_location = plocation_elem_new(0);
60297#endif /* FREECIV_JSON_CONNECTION */
60298
60299 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
60300 const char *pstr = strvec_get(real_packet->helptext, i);
60301
60302 if (!pstr) {
60303 /* Transmit null strings as empty strings */
60304 pstr = "";
60305 }
60306
60307#ifdef FREECIV_JSON_CONNECTION
60308 /* Next array element */
60309 field_addr.sub_location->number = i;
60310#endif /* FREECIV_JSON_CONNECTION */
60311
60312 e |= DIO_PUT(string, &dout, &field_addr, pstr);
60313 }
60314
60315#ifdef FREECIV_JSON_CONNECTION
60316 FC_FREE(field_addr.sub_location);
60317#endif /* FREECIV_JSON_CONNECTION */
60318 }
60319 if (e) {
60320 log_packet_detailed("'helptext' field error detected");
60321 }
60322
60323#endif
60324 SEND_PACKET_END(PACKET_RULESET_UNIT_CLASS);
60325}
60326
60327 int send_packet_ruleset_unit_class(struct connection *pc, const struct packet_ruleset_unit_class *packet)
60328{
60329 if (!pc->used) {
60330 log_error("WARNING: trying to send data to the closed connection %s",
60331 conn_description(pc));
60332 return -1;
60333 }
60334 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS].packet != nullptr, -1,
60335 "Handler for PACKET_RULESET_UNIT_CLASS not installed");
60336 return pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS].packet(pc, packet);
60337}
60338
60339 void lsend_packet_ruleset_unit_class(struct conn_list *dest, const struct packet_ruleset_unit_class *packet)
60340{
60341 conn_list_iterate(dest, pconn) {
60342 send_packet_ruleset_unit_class(pconn, packet);
60343 } conn_list_iterate_end;
60344}
60345
60346 static inline void init_packet_ruleset_extra(struct packet_ruleset_extra *packet)
60347{
60348 memset(packet, 0, sizeof(*packet));
60349
60350 /* no work needed for packet->id */
60351 /* no work needed for packet->name */
60352 /* no work needed for packet->rule_name */
60353 /* no work needed for packet->category */
60354 /* no work needed for packet->causes */
60355 /* no work needed for packet->rmcauses */
60356 /* no work needed for packet->activity_gfx */
60357 /* no work needed for packet->act_gfx_alt */
60358 /* no work needed for packet->act_gfx_alt2 */
60359 /* no work needed for packet->rmact_gfx */
60360 /* no work needed for packet->rmact_gfx_alt */
60361 /* no work needed for packet->rmact_gfx_alt2 */
60362 /* no work needed for packet->graphic_str */
60363 /* no work needed for packet->graphic_alt */
60364 /* no work needed for packet->reqs_count */
60365 /* no work needed for packet->reqs */
60366 /* no work needed for packet->rmreqs_count */
60367 /* no work needed for packet->rmreqs */
60368 /* no work needed for packet->appearance_chance */
60369 /* no work needed for packet->appearance_reqs_count */
60370 /* no work needed for packet->appearance_reqs */
60371 /* no work needed for packet->disappearance_chance */
60372 /* no work needed for packet->disappearance_reqs_count */
60373 /* no work needed for packet->disappearance_reqs */
60374 /* no work needed for packet->visibility_req */
60375 /* no work needed for packet->buildable */
60376 /* no work needed for packet->generated */
60377 /* no work needed for packet->build_time */
60378 /* no work needed for packet->build_time_factor */
60379 /* no work needed for packet->removal_time */
60380 /* no work needed for packet->removal_time_factor */
60381 /* no work needed for packet->infracost */
60382 /* no work needed for packet->defense_bonus */
60383 /* no work needed for packet->eus */
60384 /* no work needed for packet->native_to */
60385 /* no work needed for packet->flags */
60386 /* no work needed for packet->hidden_by */
60387 /* no work needed for packet->bridged_over */
60388 /* no work needed for packet->conflicts */
60389 /* no work needed for packet->no_aggr_near_city */
60390 packet->helptext = strvec_new();
60391}
60392
60393 static inline void free_packet_ruleset_extra(struct packet_ruleset_extra *packet)
60394{
60395 if (packet->helptext) {
60396 strvec_destroy(packet->helptext);
60397 packet->helptext = nullptr;
60398 }
60399 /* no work needed for packet->no_aggr_near_city */
60400 /* no work needed for packet->conflicts */
60401 /* no work needed for packet->bridged_over */
60402 /* no work needed for packet->hidden_by */
60403 /* no work needed for packet->flags */
60404 /* no work needed for packet->native_to */
60405 /* no work needed for packet->eus */
60406 /* no work needed for packet->defense_bonus */
60407 /* no work needed for packet->infracost */
60408 /* no work needed for packet->removal_time_factor */
60409 /* no work needed for packet->removal_time */
60410 /* no work needed for packet->build_time_factor */
60411 /* no work needed for packet->build_time */
60412 /* no work needed for packet->generated */
60413 /* no work needed for packet->buildable */
60414 /* no work needed for packet->visibility_req */
60415 /* no work needed for packet->disappearance_reqs */
60416 /* no work needed for packet->disappearance_reqs_count */
60417 /* no work needed for packet->disappearance_chance */
60418 /* no work needed for packet->appearance_reqs */
60419 /* no work needed for packet->appearance_reqs_count */
60420 /* no work needed for packet->appearance_chance */
60421 /* no work needed for packet->rmreqs */
60422 /* no work needed for packet->rmreqs_count */
60423 /* no work needed for packet->reqs */
60424 /* no work needed for packet->reqs_count */
60425 /* no work needed for packet->graphic_alt */
60426 /* no work needed for packet->graphic_str */
60427 /* no work needed for packet->rmact_gfx_alt2 */
60428 /* no work needed for packet->rmact_gfx_alt */
60429 /* no work needed for packet->rmact_gfx */
60430 /* no work needed for packet->act_gfx_alt2 */
60431 /* no work needed for packet->act_gfx_alt */
60432 /* no work needed for packet->activity_gfx */
60433 /* no work needed for packet->rmcauses */
60434 /* no work needed for packet->causes */
60435 /* no work needed for packet->category */
60436 /* no work needed for packet->rule_name */
60437 /* no work needed for packet->name */
60438 /* no work needed for packet->id */
60439}
60440
60441 static inline void destroy_packet_ruleset_extra(void *packet)
60442{
60443 free_packet_ruleset_extra((struct packet_ruleset_extra *) packet);
60444 free(packet);
60445}
60446
60447#ifdef FREECIV_DELTA_PROTOCOL
60448#define hash_packet_ruleset_extra_100 hash_const
60449
60450#define cmp_packet_ruleset_extra_100 cmp_const
60451
60452 BV_DEFINE(packet_ruleset_extra_100_fields, 41);
60453#endif /* FREECIV_DELTA_PROTOCOL */
60454
60455 static struct packet_ruleset_extra *receive_packet_ruleset_extra_100(struct connection *pc)
60456{
60457#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_extra(_packet)
60458#ifdef FREECIV_DELTA_PROTOCOL
60459 packet_ruleset_extra_100_fields fields;
60460 struct packet_ruleset_extra *old;
60461 struct genhash **hash = pc->phs.received + PACKET_RULESET_EXTRA;
60462#endif /* FREECIV_DELTA_PROTOCOL */
60463 RECEIVE_PACKET_START(packet_ruleset_extra, real_packet);
60464#ifdef FREECIV_JSON_CONNECTION
60465 struct plocation field_addr;
60466 {
60467 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
60468 field_addr = *field_addr_tmp;
60469 FC_FREE(field_addr_tmp);
60470 }
60471#endif /* FREECIV_JSON_CONNECTION */
60472
60473#ifdef FREECIV_DELTA_PROTOCOL
60474#ifdef FREECIV_JSON_CONNECTION
60475 field_addr.name = "fields";
60476#endif /* FREECIV_JSON_CONNECTION */
60477 DIO_BV_GET(&din, &field_addr, fields);
60478
60479#else /* FREECIV_DELTA_PROTOCOL */
60480#ifdef FREECIV_JSON_CONNECTION
60481 field_addr.name = "id";
60482#endif /* FREECIV_JSON_CONNECTION */
60483 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
60484 RECEIVE_PACKET_FIELD_ERROR(id);
60485 }
60486#ifdef FREECIV_JSON_CONNECTION
60487 field_addr.name = "name";
60488#endif /* FREECIV_JSON_CONNECTION */
60489 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60490 RECEIVE_PACKET_FIELD_ERROR(name);
60491 }
60492#ifdef FREECIV_JSON_CONNECTION
60493 field_addr.name = "rule_name";
60494#endif /* FREECIV_JSON_CONNECTION */
60495 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
60496 RECEIVE_PACKET_FIELD_ERROR(rule_name);
60497 }
60498#ifdef FREECIV_JSON_CONNECTION
60499 field_addr.name = "category";
60500#endif /* FREECIV_JSON_CONNECTION */
60501 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
60502 RECEIVE_PACKET_FIELD_ERROR(category);
60503 }
60504#ifdef FREECIV_JSON_CONNECTION
60505 field_addr.name = "causes";
60506#endif /* FREECIV_JSON_CONNECTION */
60507 if (!DIO_BV_GET(&din, &field_addr, real_packet->causes)) {
60508 RECEIVE_PACKET_FIELD_ERROR(causes);
60509 }
60510#ifdef FREECIV_JSON_CONNECTION
60511 field_addr.name = "rmcauses";
60512#endif /* FREECIV_JSON_CONNECTION */
60513 if (!DIO_BV_GET(&din, &field_addr, real_packet->rmcauses)) {
60514 RECEIVE_PACKET_FIELD_ERROR(rmcauses);
60515 }
60516#ifdef FREECIV_JSON_CONNECTION
60517 field_addr.name = "activity_gfx";
60518#endif /* FREECIV_JSON_CONNECTION */
60519 if (!DIO_GET(string, &din, &field_addr, real_packet->activity_gfx, sizeof(real_packet->activity_gfx))) {
60520 RECEIVE_PACKET_FIELD_ERROR(activity_gfx);
60521 }
60522#ifdef FREECIV_JSON_CONNECTION
60523 field_addr.name = "act_gfx_alt";
60524#endif /* FREECIV_JSON_CONNECTION */
60525 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt, sizeof(real_packet->act_gfx_alt))) {
60526 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt);
60527 }
60528#ifdef FREECIV_JSON_CONNECTION
60529 field_addr.name = "act_gfx_alt2";
60530#endif /* FREECIV_JSON_CONNECTION */
60531 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt2, sizeof(real_packet->act_gfx_alt2))) {
60532 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt2);
60533 }
60534#ifdef FREECIV_JSON_CONNECTION
60535 field_addr.name = "rmact_gfx";
60536#endif /* FREECIV_JSON_CONNECTION */
60537 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx, sizeof(real_packet->rmact_gfx))) {
60538 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx);
60539 }
60540#ifdef FREECIV_JSON_CONNECTION
60541 field_addr.name = "rmact_gfx_alt";
60542#endif /* FREECIV_JSON_CONNECTION */
60543 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt, sizeof(real_packet->rmact_gfx_alt))) {
60544 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt);
60545 }
60546#ifdef FREECIV_JSON_CONNECTION
60547 field_addr.name = "rmact_gfx_alt2";
60548#endif /* FREECIV_JSON_CONNECTION */
60549 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt2, sizeof(real_packet->rmact_gfx_alt2))) {
60550 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt2);
60551 }
60552#ifdef FREECIV_JSON_CONNECTION
60553 field_addr.name = "graphic_str";
60554#endif /* FREECIV_JSON_CONNECTION */
60555 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
60556 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
60557 }
60558#ifdef FREECIV_JSON_CONNECTION
60559 field_addr.name = "graphic_alt";
60560#endif /* FREECIV_JSON_CONNECTION */
60561 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
60562 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
60563 }
60564#ifdef FREECIV_JSON_CONNECTION
60565 field_addr.name = "reqs_count";
60566#endif /* FREECIV_JSON_CONNECTION */
60567 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
60568 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
60569 }
60570#ifdef FREECIV_JSON_CONNECTION
60571 field_addr.name = "reqs";
60572#endif /* FREECIV_JSON_CONNECTION */
60573 {
60574 int i;
60575
60576#ifdef FREECIV_JSON_CONNECTION
60577 /* Enter array. */
60578 field_addr.sub_location = plocation_elem_new(0);
60579#endif /* FREECIV_JSON_CONNECTION */
60580
60581 if (real_packet->reqs_count > MAX_NUM_REQS) {
60582 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
60583 }
60584 for (i = 0; i < real_packet->reqs_count; i++) {
60585#ifdef FREECIV_JSON_CONNECTION
60586 field_addr.sub_location->number = i;
60587#endif /* FREECIV_JSON_CONNECTION */
60588 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
60589 RECEIVE_PACKET_FIELD_ERROR(reqs);
60590 }
60591 }
60592
60593#ifdef FREECIV_JSON_CONNECTION
60594 /* Exit array. */
60595 FC_FREE(field_addr.sub_location);
60596#endif /* FREECIV_JSON_CONNECTION */
60597 }
60598#ifdef FREECIV_JSON_CONNECTION
60599 field_addr.name = "rmreqs_count";
60600#endif /* FREECIV_JSON_CONNECTION */
60601 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rmreqs_count)) {
60602 RECEIVE_PACKET_FIELD_ERROR(rmreqs_count);
60603 }
60604#ifdef FREECIV_JSON_CONNECTION
60605 field_addr.name = "rmreqs";
60606#endif /* FREECIV_JSON_CONNECTION */
60607 {
60608 int i;
60609
60610#ifdef FREECIV_JSON_CONNECTION
60611 /* Enter array. */
60612 field_addr.sub_location = plocation_elem_new(0);
60613#endif /* FREECIV_JSON_CONNECTION */
60614
60615 if (real_packet->rmreqs_count > MAX_NUM_REQS) {
60616 RECEIVE_PACKET_FIELD_ERROR(rmreqs, ": truncation array");
60617 }
60618 for (i = 0; i < real_packet->rmreqs_count; i++) {
60619#ifdef FREECIV_JSON_CONNECTION
60620 field_addr.sub_location->number = i;
60621#endif /* FREECIV_JSON_CONNECTION */
60622 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->rmreqs[i])) {
60623 RECEIVE_PACKET_FIELD_ERROR(rmreqs);
60624 }
60625 }
60626
60627#ifdef FREECIV_JSON_CONNECTION
60628 /* Exit array. */
60629 FC_FREE(field_addr.sub_location);
60630#endif /* FREECIV_JSON_CONNECTION */
60631 }
60632#ifdef FREECIV_JSON_CONNECTION
60633 field_addr.name = "appearance_chance";
60634#endif /* FREECIV_JSON_CONNECTION */
60635 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->appearance_chance)) {
60636 RECEIVE_PACKET_FIELD_ERROR(appearance_chance);
60637 }
60638#ifdef FREECIV_JSON_CONNECTION
60639 field_addr.name = "appearance_reqs_count";
60640#endif /* FREECIV_JSON_CONNECTION */
60641 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->appearance_reqs_count)) {
60642 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs_count);
60643 }
60644#ifdef FREECIV_JSON_CONNECTION
60645 field_addr.name = "appearance_reqs";
60646#endif /* FREECIV_JSON_CONNECTION */
60647 {
60648 int i;
60649
60650#ifdef FREECIV_JSON_CONNECTION
60651 /* Enter array. */
60652 field_addr.sub_location = plocation_elem_new(0);
60653#endif /* FREECIV_JSON_CONNECTION */
60654
60655 if (real_packet->appearance_reqs_count > MAX_NUM_REQS) {
60656 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs, ": truncation array");
60657 }
60658 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
60659#ifdef FREECIV_JSON_CONNECTION
60660 field_addr.sub_location->number = i;
60661#endif /* FREECIV_JSON_CONNECTION */
60662 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->appearance_reqs[i])) {
60663 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs);
60664 }
60665 }
60666
60667#ifdef FREECIV_JSON_CONNECTION
60668 /* Exit array. */
60669 FC_FREE(field_addr.sub_location);
60670#endif /* FREECIV_JSON_CONNECTION */
60671 }
60672#ifdef FREECIV_JSON_CONNECTION
60673 field_addr.name = "disappearance_chance";
60674#endif /* FREECIV_JSON_CONNECTION */
60675 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disappearance_chance)) {
60676 RECEIVE_PACKET_FIELD_ERROR(disappearance_chance);
60677 }
60678#ifdef FREECIV_JSON_CONNECTION
60679 field_addr.name = "disappearance_reqs_count";
60680#endif /* FREECIV_JSON_CONNECTION */
60681 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->disappearance_reqs_count)) {
60682 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs_count);
60683 }
60684#ifdef FREECIV_JSON_CONNECTION
60685 field_addr.name = "disappearance_reqs";
60686#endif /* FREECIV_JSON_CONNECTION */
60687 {
60688 int i;
60689
60690#ifdef FREECIV_JSON_CONNECTION
60691 /* Enter array. */
60692 field_addr.sub_location = plocation_elem_new(0);
60693#endif /* FREECIV_JSON_CONNECTION */
60694
60695 if (real_packet->disappearance_reqs_count > MAX_NUM_REQS) {
60696 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs, ": truncation array");
60697 }
60698 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
60699#ifdef FREECIV_JSON_CONNECTION
60700 field_addr.sub_location->number = i;
60701#endif /* FREECIV_JSON_CONNECTION */
60702 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->disappearance_reqs[i])) {
60703 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs);
60704 }
60705 }
60706
60707#ifdef FREECIV_JSON_CONNECTION
60708 /* Exit array. */
60709 FC_FREE(field_addr.sub_location);
60710#endif /* FREECIV_JSON_CONNECTION */
60711 }
60712#ifdef FREECIV_JSON_CONNECTION
60713 field_addr.name = "visibility_req";
60714#endif /* FREECIV_JSON_CONNECTION */
60715 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->visibility_req)) {
60716 RECEIVE_PACKET_FIELD_ERROR(visibility_req);
60717 }
60718#ifdef FREECIV_JSON_CONNECTION
60719 field_addr.name = "buildable";
60720#endif /* FREECIV_JSON_CONNECTION */
60721 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->buildable)) {
60722 RECEIVE_PACKET_FIELD_ERROR(buildable);
60723 }
60724#ifdef FREECIV_JSON_CONNECTION
60725 field_addr.name = "generated";
60726#endif /* FREECIV_JSON_CONNECTION */
60727 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->generated)) {
60728 RECEIVE_PACKET_FIELD_ERROR(generated);
60729 }
60730#ifdef FREECIV_JSON_CONNECTION
60731 field_addr.name = "build_time";
60732#endif /* FREECIV_JSON_CONNECTION */
60733 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time)) {
60734 RECEIVE_PACKET_FIELD_ERROR(build_time);
60735 }
60736#ifdef FREECIV_JSON_CONNECTION
60737 field_addr.name = "build_time_factor";
60738#endif /* FREECIV_JSON_CONNECTION */
60739 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time_factor)) {
60740 RECEIVE_PACKET_FIELD_ERROR(build_time_factor);
60741 }
60742#ifdef FREECIV_JSON_CONNECTION
60743 field_addr.name = "removal_time";
60744#endif /* FREECIV_JSON_CONNECTION */
60745 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time)) {
60746 RECEIVE_PACKET_FIELD_ERROR(removal_time);
60747 }
60748#ifdef FREECIV_JSON_CONNECTION
60749 field_addr.name = "removal_time_factor";
60750#endif /* FREECIV_JSON_CONNECTION */
60751 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time_factor)) {
60752 RECEIVE_PACKET_FIELD_ERROR(removal_time_factor);
60753 }
60754#ifdef FREECIV_JSON_CONNECTION
60755 field_addr.name = "infracost";
60756#endif /* FREECIV_JSON_CONNECTION */
60757 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->infracost)) {
60758 RECEIVE_PACKET_FIELD_ERROR(infracost);
60759 }
60760#ifdef FREECIV_JSON_CONNECTION
60761 field_addr.name = "defense_bonus";
60762#endif /* FREECIV_JSON_CONNECTION */
60763 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_bonus)) {
60764 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
60765 }
60766#ifdef FREECIV_JSON_CONNECTION
60767 field_addr.name = "eus";
60768#endif /* FREECIV_JSON_CONNECTION */
60769 {
60770 int readin;
60771
60772 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
60773 RECEIVE_PACKET_FIELD_ERROR(eus);
60774 }
60775 real_packet->eus = readin;
60776 }
60777#ifdef FREECIV_JSON_CONNECTION
60778 field_addr.name = "native_to";
60779#endif /* FREECIV_JSON_CONNECTION */
60780 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
60781 RECEIVE_PACKET_FIELD_ERROR(native_to);
60782 }
60783#ifdef FREECIV_JSON_CONNECTION
60784 field_addr.name = "flags";
60785#endif /* FREECIV_JSON_CONNECTION */
60786 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
60787 RECEIVE_PACKET_FIELD_ERROR(flags);
60788 }
60789#ifdef FREECIV_JSON_CONNECTION
60790 field_addr.name = "hidden_by";
60791#endif /* FREECIV_JSON_CONNECTION */
60792 if (!DIO_BV_GET(&din, &field_addr, real_packet->hidden_by)) {
60793 RECEIVE_PACKET_FIELD_ERROR(hidden_by);
60794 }
60795#ifdef FREECIV_JSON_CONNECTION
60796 field_addr.name = "bridged_over";
60797#endif /* FREECIV_JSON_CONNECTION */
60798 if (!DIO_BV_GET(&din, &field_addr, real_packet->bridged_over)) {
60799 RECEIVE_PACKET_FIELD_ERROR(bridged_over);
60800 }
60801#ifdef FREECIV_JSON_CONNECTION
60802 field_addr.name = "conflicts";
60803#endif /* FREECIV_JSON_CONNECTION */
60804 if (!DIO_BV_GET(&din, &field_addr, real_packet->conflicts)) {
60805 RECEIVE_PACKET_FIELD_ERROR(conflicts);
60806 }
60807#ifdef FREECIV_JSON_CONNECTION
60808 field_addr.name = "no_aggr_near_city";
60809#endif /* FREECIV_JSON_CONNECTION */
60810 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->no_aggr_near_city)) {
60811 RECEIVE_PACKET_FIELD_ERROR(no_aggr_near_city);
60812 }
60813#ifdef FREECIV_JSON_CONNECTION
60814 field_addr.name = "helptext";
60815#endif /* FREECIV_JSON_CONNECTION */
60816 {
60817 int i;
60818
60819 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
60820 RECEIVE_PACKET_FIELD_ERROR(helptext);
60821 }
60822 strvec_reserve(real_packet->helptext, i);
60823
60824#ifdef FREECIV_JSON_CONNECTION
60825 field_addr.sub_location = plocation_elem_new(0);
60826#endif /* FREECIV_JSON_CONNECTION */
60827
60828 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
60829 char readin[MAX_LEN_PACKET];
60830
60831#ifdef FREECIV_JSON_CONNECTION
60832 /* Next array element */
60833 field_addr.sub_location->number = i;
60834#endif /* FREECIV_JSON_CONNECTION */
60835
60836 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
60837 || !strvec_set(real_packet->helptext, i, readin)) {
60838 RECEIVE_PACKET_FIELD_ERROR(helptext);
60839 }
60840 }
60841
60842#ifdef FREECIV_JSON_CONNECTION
60843 FC_FREE(field_addr.sub_location);
60844#endif /* FREECIV_JSON_CONNECTION */
60845 }
60846#endif
60847 log_packet_detailed("packet_ruleset_extra_100: got info about ()");
60848
60849#ifdef FREECIV_DELTA_PROTOCOL
60850 if (nullptr == *hash) {
60851 *hash = genhash_new_full(hash_packet_ruleset_extra_100, cmp_packet_ruleset_extra_100,
60852 nullptr, nullptr, nullptr, destroy_packet_ruleset_extra);
60853 }
60854
60855 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
60856 real_packet->id = old->id;
60857 sz_strlcpy(real_packet->name, old->name);
60858 sz_strlcpy(real_packet->rule_name, old->rule_name);
60859 real_packet->category = old->category;
60860 real_packet->causes = old->causes;
60861 real_packet->rmcauses = old->rmcauses;
60862 sz_strlcpy(real_packet->activity_gfx, old->activity_gfx);
60863 sz_strlcpy(real_packet->act_gfx_alt, old->act_gfx_alt);
60864 sz_strlcpy(real_packet->act_gfx_alt2, old->act_gfx_alt2);
60865 sz_strlcpy(real_packet->rmact_gfx, old->rmact_gfx);
60866 sz_strlcpy(real_packet->rmact_gfx_alt, old->rmact_gfx_alt);
60867 sz_strlcpy(real_packet->rmact_gfx_alt2, old->rmact_gfx_alt2);
60868 sz_strlcpy(real_packet->graphic_str, old->graphic_str);
60869 sz_strlcpy(real_packet->graphic_alt, old->graphic_alt);
60870 real_packet->reqs_count = old->reqs_count;
60871 {
60872 int i;
60873
60874 for (i = 0; i < old->reqs_count; i++) {
60875 real_packet->reqs[i] = old->reqs[i];
60876 }
60877 }
60878 real_packet->rmreqs_count = old->rmreqs_count;
60879 {
60880 int i;
60881
60882 for (i = 0; i < old->rmreqs_count; i++) {
60883 real_packet->rmreqs[i] = old->rmreqs[i];
60884 }
60885 }
60886 real_packet->appearance_chance = old->appearance_chance;
60887 real_packet->appearance_reqs_count = old->appearance_reqs_count;
60888 {
60889 int i;
60890
60891 for (i = 0; i < old->appearance_reqs_count; i++) {
60892 real_packet->appearance_reqs[i] = old->appearance_reqs[i];
60893 }
60894 }
60895 real_packet->disappearance_chance = old->disappearance_chance;
60896 real_packet->disappearance_reqs_count = old->disappearance_reqs_count;
60897 {
60898 int i;
60899
60900 for (i = 0; i < old->disappearance_reqs_count; i++) {
60901 real_packet->disappearance_reqs[i] = old->disappearance_reqs[i];
60902 }
60903 }
60904 real_packet->visibility_req = old->visibility_req;
60905 real_packet->buildable = old->buildable;
60906 real_packet->generated = old->generated;
60907 real_packet->build_time = old->build_time;
60908 real_packet->build_time_factor = old->build_time_factor;
60909 real_packet->removal_time = old->removal_time;
60910 real_packet->removal_time_factor = old->removal_time_factor;
60911 real_packet->infracost = old->infracost;
60912 real_packet->defense_bonus = old->defense_bonus;
60913 real_packet->eus = old->eus;
60914 real_packet->native_to = old->native_to;
60915 real_packet->flags = old->flags;
60916 real_packet->hidden_by = old->hidden_by;
60917 real_packet->bridged_over = old->bridged_over;
60918 real_packet->conflicts = old->conflicts;
60919 real_packet->no_aggr_near_city = old->no_aggr_near_city;
60920 if (old->helptext) {
60921 strvec_copy(real_packet->helptext, old->helptext);
60922 } else {
60923 strvec_clear(real_packet->helptext);
60924 }
60925 } else {
60926 /* packet is already initialized empty */
60927 log_packet_detailed(" no old info");
60928 }
60929
60930 if (BV_ISSET(fields, 0)) {
60931 log_packet_detailed(" got field 'id'");
60932#ifdef FREECIV_JSON_CONNECTION
60933 field_addr.name = "id";
60934#endif /* FREECIV_JSON_CONNECTION */
60935 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
60936 RECEIVE_PACKET_FIELD_ERROR(id);
60937 }
60938 }
60939 if (BV_ISSET(fields, 1)) {
60940 log_packet_detailed(" got field 'name'");
60941#ifdef FREECIV_JSON_CONNECTION
60942 field_addr.name = "name";
60943#endif /* FREECIV_JSON_CONNECTION */
60944 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60945 RECEIVE_PACKET_FIELD_ERROR(name);
60946 }
60947 }
60948 if (BV_ISSET(fields, 2)) {
60949 log_packet_detailed(" got field 'rule_name'");
60950#ifdef FREECIV_JSON_CONNECTION
60951 field_addr.name = "rule_name";
60952#endif /* FREECIV_JSON_CONNECTION */
60953 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
60954 RECEIVE_PACKET_FIELD_ERROR(rule_name);
60955 }
60956 }
60957 if (BV_ISSET(fields, 3)) {
60958 log_packet_detailed(" got field 'category'");
60959#ifdef FREECIV_JSON_CONNECTION
60960 field_addr.name = "category";
60961#endif /* FREECIV_JSON_CONNECTION */
60962 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
60963 RECEIVE_PACKET_FIELD_ERROR(category);
60964 }
60965 }
60966 if (BV_ISSET(fields, 4)) {
60967 log_packet_detailed(" got field 'causes'");
60968#ifdef FREECIV_JSON_CONNECTION
60969 field_addr.name = "causes";
60970#endif /* FREECIV_JSON_CONNECTION */
60971 if (!DIO_BV_GET(&din, &field_addr, real_packet->causes)) {
60972 RECEIVE_PACKET_FIELD_ERROR(causes);
60973 }
60974 }
60975 if (BV_ISSET(fields, 5)) {
60976 log_packet_detailed(" got field 'rmcauses'");
60977#ifdef FREECIV_JSON_CONNECTION
60978 field_addr.name = "rmcauses";
60979#endif /* FREECIV_JSON_CONNECTION */
60980 if (!DIO_BV_GET(&din, &field_addr, real_packet->rmcauses)) {
60981 RECEIVE_PACKET_FIELD_ERROR(rmcauses);
60982 }
60983 }
60984 if (BV_ISSET(fields, 6)) {
60985 log_packet_detailed(" got field 'activity_gfx'");
60986#ifdef FREECIV_JSON_CONNECTION
60987 field_addr.name = "activity_gfx";
60988#endif /* FREECIV_JSON_CONNECTION */
60989 if (!DIO_GET(string, &din, &field_addr, real_packet->activity_gfx, sizeof(real_packet->activity_gfx))) {
60990 RECEIVE_PACKET_FIELD_ERROR(activity_gfx);
60991 }
60992 }
60993 if (BV_ISSET(fields, 7)) {
60994 log_packet_detailed(" got field 'act_gfx_alt'");
60995#ifdef FREECIV_JSON_CONNECTION
60996 field_addr.name = "act_gfx_alt";
60997#endif /* FREECIV_JSON_CONNECTION */
60998 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt, sizeof(real_packet->act_gfx_alt))) {
60999 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt);
61000 }
61001 }
61002 if (BV_ISSET(fields, 8)) {
61003 log_packet_detailed(" got field 'act_gfx_alt2'");
61004#ifdef FREECIV_JSON_CONNECTION
61005 field_addr.name = "act_gfx_alt2";
61006#endif /* FREECIV_JSON_CONNECTION */
61007 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt2, sizeof(real_packet->act_gfx_alt2))) {
61008 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt2);
61009 }
61010 }
61011 if (BV_ISSET(fields, 9)) {
61012 log_packet_detailed(" got field 'rmact_gfx'");
61013#ifdef FREECIV_JSON_CONNECTION
61014 field_addr.name = "rmact_gfx";
61015#endif /* FREECIV_JSON_CONNECTION */
61016 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx, sizeof(real_packet->rmact_gfx))) {
61017 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx);
61018 }
61019 }
61020 if (BV_ISSET(fields, 10)) {
61021 log_packet_detailed(" got field 'rmact_gfx_alt'");
61022#ifdef FREECIV_JSON_CONNECTION
61023 field_addr.name = "rmact_gfx_alt";
61024#endif /* FREECIV_JSON_CONNECTION */
61025 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt, sizeof(real_packet->rmact_gfx_alt))) {
61026 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt);
61027 }
61028 }
61029 if (BV_ISSET(fields, 11)) {
61030 log_packet_detailed(" got field 'rmact_gfx_alt2'");
61031#ifdef FREECIV_JSON_CONNECTION
61032 field_addr.name = "rmact_gfx_alt2";
61033#endif /* FREECIV_JSON_CONNECTION */
61034 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt2, sizeof(real_packet->rmact_gfx_alt2))) {
61035 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt2);
61036 }
61037 }
61038 if (BV_ISSET(fields, 12)) {
61039 log_packet_detailed(" got field 'graphic_str'");
61040#ifdef FREECIV_JSON_CONNECTION
61041 field_addr.name = "graphic_str";
61042#endif /* FREECIV_JSON_CONNECTION */
61043 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
61044 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
61045 }
61046 }
61047 if (BV_ISSET(fields, 13)) {
61048 log_packet_detailed(" got field 'graphic_alt'");
61049#ifdef FREECIV_JSON_CONNECTION
61050 field_addr.name = "graphic_alt";
61051#endif /* FREECIV_JSON_CONNECTION */
61052 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
61053 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
61054 }
61055 }
61056 if (BV_ISSET(fields, 14)) {
61057 log_packet_detailed(" got field 'reqs_count'");
61058#ifdef FREECIV_JSON_CONNECTION
61059 field_addr.name = "reqs_count";
61060#endif /* FREECIV_JSON_CONNECTION */
61061 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
61062 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
61063 }
61064 }
61065 if (BV_ISSET(fields, 15)) {
61066 log_packet_detailed(" got field 'reqs'");
61067#ifdef FREECIV_JSON_CONNECTION
61068 field_addr.name = "reqs";
61069#endif /* FREECIV_JSON_CONNECTION */
61070 {
61071 int i;
61072
61073#ifdef FREECIV_JSON_CONNECTION
61074 /* Enter array. */
61075 field_addr.sub_location = plocation_elem_new(0);
61076#endif /* FREECIV_JSON_CONNECTION */
61077
61078 if (real_packet->reqs_count > MAX_NUM_REQS) {
61079 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
61080 }
61081 for (i = 0; i < real_packet->reqs_count; i++) {
61082#ifdef FREECIV_JSON_CONNECTION
61083 field_addr.sub_location->number = i;
61084#endif /* FREECIV_JSON_CONNECTION */
61085 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
61086 RECEIVE_PACKET_FIELD_ERROR(reqs);
61087 }
61088 }
61089
61090#ifdef FREECIV_JSON_CONNECTION
61091 /* Exit array. */
61092 FC_FREE(field_addr.sub_location);
61093#endif /* FREECIV_JSON_CONNECTION */
61094 }
61095 }
61096 if (BV_ISSET(fields, 16)) {
61097 log_packet_detailed(" got field 'rmreqs_count'");
61098#ifdef FREECIV_JSON_CONNECTION
61099 field_addr.name = "rmreqs_count";
61100#endif /* FREECIV_JSON_CONNECTION */
61101 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rmreqs_count)) {
61102 RECEIVE_PACKET_FIELD_ERROR(rmreqs_count);
61103 }
61104 }
61105 if (BV_ISSET(fields, 17)) {
61106 log_packet_detailed(" got field 'rmreqs'");
61107#ifdef FREECIV_JSON_CONNECTION
61108 field_addr.name = "rmreqs";
61109#endif /* FREECIV_JSON_CONNECTION */
61110 {
61111 int i;
61112
61113#ifdef FREECIV_JSON_CONNECTION
61114 /* Enter array. */
61115 field_addr.sub_location = plocation_elem_new(0);
61116#endif /* FREECIV_JSON_CONNECTION */
61117
61118 if (real_packet->rmreqs_count > MAX_NUM_REQS) {
61119 RECEIVE_PACKET_FIELD_ERROR(rmreqs, ": truncation array");
61120 }
61121 for (i = 0; i < real_packet->rmreqs_count; i++) {
61122#ifdef FREECIV_JSON_CONNECTION
61123 field_addr.sub_location->number = i;
61124#endif /* FREECIV_JSON_CONNECTION */
61125 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->rmreqs[i])) {
61126 RECEIVE_PACKET_FIELD_ERROR(rmreqs);
61127 }
61128 }
61129
61130#ifdef FREECIV_JSON_CONNECTION
61131 /* Exit array. */
61132 FC_FREE(field_addr.sub_location);
61133#endif /* FREECIV_JSON_CONNECTION */
61134 }
61135 }
61136 if (BV_ISSET(fields, 18)) {
61137 log_packet_detailed(" got field 'appearance_chance'");
61138#ifdef FREECIV_JSON_CONNECTION
61139 field_addr.name = "appearance_chance";
61140#endif /* FREECIV_JSON_CONNECTION */
61141 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->appearance_chance)) {
61142 RECEIVE_PACKET_FIELD_ERROR(appearance_chance);
61143 }
61144 }
61145 if (BV_ISSET(fields, 19)) {
61146 log_packet_detailed(" got field 'appearance_reqs_count'");
61147#ifdef FREECIV_JSON_CONNECTION
61148 field_addr.name = "appearance_reqs_count";
61149#endif /* FREECIV_JSON_CONNECTION */
61150 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->appearance_reqs_count)) {
61151 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs_count);
61152 }
61153 }
61154 if (BV_ISSET(fields, 20)) {
61155 log_packet_detailed(" got field 'appearance_reqs'");
61156#ifdef FREECIV_JSON_CONNECTION
61157 field_addr.name = "appearance_reqs";
61158#endif /* FREECIV_JSON_CONNECTION */
61159 {
61160 int i;
61161
61162#ifdef FREECIV_JSON_CONNECTION
61163 /* Enter array. */
61164 field_addr.sub_location = plocation_elem_new(0);
61165#endif /* FREECIV_JSON_CONNECTION */
61166
61167 if (real_packet->appearance_reqs_count > MAX_NUM_REQS) {
61168 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs, ": truncation array");
61169 }
61170 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
61171#ifdef FREECIV_JSON_CONNECTION
61172 field_addr.sub_location->number = i;
61173#endif /* FREECIV_JSON_CONNECTION */
61174 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->appearance_reqs[i])) {
61175 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs);
61176 }
61177 }
61178
61179#ifdef FREECIV_JSON_CONNECTION
61180 /* Exit array. */
61181 FC_FREE(field_addr.sub_location);
61182#endif /* FREECIV_JSON_CONNECTION */
61183 }
61184 }
61185 if (BV_ISSET(fields, 21)) {
61186 log_packet_detailed(" got field 'disappearance_chance'");
61187#ifdef FREECIV_JSON_CONNECTION
61188 field_addr.name = "disappearance_chance";
61189#endif /* FREECIV_JSON_CONNECTION */
61190 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disappearance_chance)) {
61191 RECEIVE_PACKET_FIELD_ERROR(disappearance_chance);
61192 }
61193 }
61194 if (BV_ISSET(fields, 22)) {
61195 log_packet_detailed(" got field 'disappearance_reqs_count'");
61196#ifdef FREECIV_JSON_CONNECTION
61197 field_addr.name = "disappearance_reqs_count";
61198#endif /* FREECIV_JSON_CONNECTION */
61199 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->disappearance_reqs_count)) {
61200 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs_count);
61201 }
61202 }
61203 if (BV_ISSET(fields, 23)) {
61204 log_packet_detailed(" got field 'disappearance_reqs'");
61205#ifdef FREECIV_JSON_CONNECTION
61206 field_addr.name = "disappearance_reqs";
61207#endif /* FREECIV_JSON_CONNECTION */
61208 {
61209 int i;
61210
61211#ifdef FREECIV_JSON_CONNECTION
61212 /* Enter array. */
61213 field_addr.sub_location = plocation_elem_new(0);
61214#endif /* FREECIV_JSON_CONNECTION */
61215
61216 if (real_packet->disappearance_reqs_count > MAX_NUM_REQS) {
61217 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs, ": truncation array");
61218 }
61219 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
61220#ifdef FREECIV_JSON_CONNECTION
61221 field_addr.sub_location->number = i;
61222#endif /* FREECIV_JSON_CONNECTION */
61223 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->disappearance_reqs[i])) {
61224 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs);
61225 }
61226 }
61227
61228#ifdef FREECIV_JSON_CONNECTION
61229 /* Exit array. */
61230 FC_FREE(field_addr.sub_location);
61231#endif /* FREECIV_JSON_CONNECTION */
61232 }
61233 }
61234 if (BV_ISSET(fields, 24)) {
61235 log_packet_detailed(" got field 'visibility_req'");
61236#ifdef FREECIV_JSON_CONNECTION
61237 field_addr.name = "visibility_req";
61238#endif /* FREECIV_JSON_CONNECTION */
61239 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->visibility_req)) {
61240 RECEIVE_PACKET_FIELD_ERROR(visibility_req);
61241 }
61242 }
61243 real_packet->buildable = BV_ISSET(fields, 25);
61244 real_packet->generated = BV_ISSET(fields, 26);
61245 if (BV_ISSET(fields, 27)) {
61246 log_packet_detailed(" got field 'build_time'");
61247#ifdef FREECIV_JSON_CONNECTION
61248 field_addr.name = "build_time";
61249#endif /* FREECIV_JSON_CONNECTION */
61250 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time)) {
61251 RECEIVE_PACKET_FIELD_ERROR(build_time);
61252 }
61253 }
61254 if (BV_ISSET(fields, 28)) {
61255 log_packet_detailed(" got field 'build_time_factor'");
61256#ifdef FREECIV_JSON_CONNECTION
61257 field_addr.name = "build_time_factor";
61258#endif /* FREECIV_JSON_CONNECTION */
61259 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time_factor)) {
61260 RECEIVE_PACKET_FIELD_ERROR(build_time_factor);
61261 }
61262 }
61263 if (BV_ISSET(fields, 29)) {
61264 log_packet_detailed(" got field 'removal_time'");
61265#ifdef FREECIV_JSON_CONNECTION
61266 field_addr.name = "removal_time";
61267#endif /* FREECIV_JSON_CONNECTION */
61268 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time)) {
61269 RECEIVE_PACKET_FIELD_ERROR(removal_time);
61270 }
61271 }
61272 if (BV_ISSET(fields, 30)) {
61273 log_packet_detailed(" got field 'removal_time_factor'");
61274#ifdef FREECIV_JSON_CONNECTION
61275 field_addr.name = "removal_time_factor";
61276#endif /* FREECIV_JSON_CONNECTION */
61277 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time_factor)) {
61278 RECEIVE_PACKET_FIELD_ERROR(removal_time_factor);
61279 }
61280 }
61281 if (BV_ISSET(fields, 31)) {
61282 log_packet_detailed(" got field 'infracost'");
61283#ifdef FREECIV_JSON_CONNECTION
61284 field_addr.name = "infracost";
61285#endif /* FREECIV_JSON_CONNECTION */
61286 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->infracost)) {
61287 RECEIVE_PACKET_FIELD_ERROR(infracost);
61288 }
61289 }
61290 if (BV_ISSET(fields, 32)) {
61291 log_packet_detailed(" got field 'defense_bonus'");
61292#ifdef FREECIV_JSON_CONNECTION
61293 field_addr.name = "defense_bonus";
61294#endif /* FREECIV_JSON_CONNECTION */
61295 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_bonus)) {
61296 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
61297 }
61298 }
61299 if (BV_ISSET(fields, 33)) {
61300 log_packet_detailed(" got field 'eus'");
61301#ifdef FREECIV_JSON_CONNECTION
61302 field_addr.name = "eus";
61303#endif /* FREECIV_JSON_CONNECTION */
61304 {
61305 int readin;
61306
61307 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
61308 RECEIVE_PACKET_FIELD_ERROR(eus);
61309 }
61310 real_packet->eus = readin;
61311 }
61312 }
61313 if (BV_ISSET(fields, 34)) {
61314 log_packet_detailed(" got field 'native_to'");
61315#ifdef FREECIV_JSON_CONNECTION
61316 field_addr.name = "native_to";
61317#endif /* FREECIV_JSON_CONNECTION */
61318 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
61319 RECEIVE_PACKET_FIELD_ERROR(native_to);
61320 }
61321 }
61322 if (BV_ISSET(fields, 35)) {
61323 log_packet_detailed(" got field 'flags'");
61324#ifdef FREECIV_JSON_CONNECTION
61325 field_addr.name = "flags";
61326#endif /* FREECIV_JSON_CONNECTION */
61327 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
61328 RECEIVE_PACKET_FIELD_ERROR(flags);
61329 }
61330 }
61331 if (BV_ISSET(fields, 36)) {
61332 log_packet_detailed(" got field 'hidden_by'");
61333#ifdef FREECIV_JSON_CONNECTION
61334 field_addr.name = "hidden_by";
61335#endif /* FREECIV_JSON_CONNECTION */
61336 if (!DIO_BV_GET(&din, &field_addr, real_packet->hidden_by)) {
61337 RECEIVE_PACKET_FIELD_ERROR(hidden_by);
61338 }
61339 }
61340 if (BV_ISSET(fields, 37)) {
61341 log_packet_detailed(" got field 'bridged_over'");
61342#ifdef FREECIV_JSON_CONNECTION
61343 field_addr.name = "bridged_over";
61344#endif /* FREECIV_JSON_CONNECTION */
61345 if (!DIO_BV_GET(&din, &field_addr, real_packet->bridged_over)) {
61346 RECEIVE_PACKET_FIELD_ERROR(bridged_over);
61347 }
61348 }
61349 if (BV_ISSET(fields, 38)) {
61350 log_packet_detailed(" got field 'conflicts'");
61351#ifdef FREECIV_JSON_CONNECTION
61352 field_addr.name = "conflicts";
61353#endif /* FREECIV_JSON_CONNECTION */
61354 if (!DIO_BV_GET(&din, &field_addr, real_packet->conflicts)) {
61355 RECEIVE_PACKET_FIELD_ERROR(conflicts);
61356 }
61357 }
61358 if (BV_ISSET(fields, 39)) {
61359 log_packet_detailed(" got field 'no_aggr_near_city'");
61360#ifdef FREECIV_JSON_CONNECTION
61361 field_addr.name = "no_aggr_near_city";
61362#endif /* FREECIV_JSON_CONNECTION */
61363 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->no_aggr_near_city)) {
61364 RECEIVE_PACKET_FIELD_ERROR(no_aggr_near_city);
61365 }
61366 }
61367 if (BV_ISSET(fields, 40)) {
61368 log_packet_detailed(" got field 'helptext'");
61369#ifdef FREECIV_JSON_CONNECTION
61370 field_addr.name = "helptext";
61371#endif /* FREECIV_JSON_CONNECTION */
61372 {
61373 int i;
61374
61375 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
61376 RECEIVE_PACKET_FIELD_ERROR(helptext);
61377 }
61378 strvec_reserve(real_packet->helptext, i);
61379
61380#ifdef FREECIV_JSON_CONNECTION
61381 field_addr.sub_location = plocation_elem_new(0);
61382#endif /* FREECIV_JSON_CONNECTION */
61383
61384 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
61385 char readin[MAX_LEN_PACKET];
61386
61387#ifdef FREECIV_JSON_CONNECTION
61388 /* Next array element */
61389 field_addr.sub_location->number = i;
61390#endif /* FREECIV_JSON_CONNECTION */
61391
61392 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
61393 || !strvec_set(real_packet->helptext, i, readin)) {
61394 RECEIVE_PACKET_FIELD_ERROR(helptext);
61395 }
61396 }
61397
61398#ifdef FREECIV_JSON_CONNECTION
61399 FC_FREE(field_addr.sub_location);
61400#endif /* FREECIV_JSON_CONNECTION */
61401 }
61402 }
61403
61404 if (nullptr == old) {
61405 old = fc_malloc(sizeof(*old));
61406 init_packet_ruleset_extra(old);
61407 old->id = real_packet->id;
61408 sz_strlcpy(old->name, real_packet->name);
61409 sz_strlcpy(old->rule_name, real_packet->rule_name);
61410 old->category = real_packet->category;
61411 old->causes = real_packet->causes;
61412 old->rmcauses = real_packet->rmcauses;
61413 sz_strlcpy(old->activity_gfx, real_packet->activity_gfx);
61414 sz_strlcpy(old->act_gfx_alt, real_packet->act_gfx_alt);
61415 sz_strlcpy(old->act_gfx_alt2, real_packet->act_gfx_alt2);
61416 sz_strlcpy(old->rmact_gfx, real_packet->rmact_gfx);
61417 sz_strlcpy(old->rmact_gfx_alt, real_packet->rmact_gfx_alt);
61418 sz_strlcpy(old->rmact_gfx_alt2, real_packet->rmact_gfx_alt2);
61419 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
61420 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
61421 old->reqs_count = real_packet->reqs_count;
61422 {
61423 int i;
61424
61425 for (i = 0; i < real_packet->reqs_count; i++) {
61426 old->reqs[i] = real_packet->reqs[i];
61427 }
61428 }
61429 old->rmreqs_count = real_packet->rmreqs_count;
61430 {
61431 int i;
61432
61433 for (i = 0; i < real_packet->rmreqs_count; i++) {
61434 old->rmreqs[i] = real_packet->rmreqs[i];
61435 }
61436 }
61437 old->appearance_chance = real_packet->appearance_chance;
61438 old->appearance_reqs_count = real_packet->appearance_reqs_count;
61439 {
61440 int i;
61441
61442 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
61443 old->appearance_reqs[i] = real_packet->appearance_reqs[i];
61444 }
61445 }
61446 old->disappearance_chance = real_packet->disappearance_chance;
61447 old->disappearance_reqs_count = real_packet->disappearance_reqs_count;
61448 {
61449 int i;
61450
61451 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
61452 old->disappearance_reqs[i] = real_packet->disappearance_reqs[i];
61453 }
61454 }
61455 old->visibility_req = real_packet->visibility_req;
61456 old->buildable = real_packet->buildable;
61457 old->generated = real_packet->generated;
61458 old->build_time = real_packet->build_time;
61459 old->build_time_factor = real_packet->build_time_factor;
61460 old->removal_time = real_packet->removal_time;
61461 old->removal_time_factor = real_packet->removal_time_factor;
61462 old->infracost = real_packet->infracost;
61463 old->defense_bonus = real_packet->defense_bonus;
61464 old->eus = real_packet->eus;
61465 old->native_to = real_packet->native_to;
61466 old->flags = real_packet->flags;
61467 old->hidden_by = real_packet->hidden_by;
61468 old->bridged_over = real_packet->bridged_over;
61469 old->conflicts = real_packet->conflicts;
61470 old->no_aggr_near_city = real_packet->no_aggr_near_city;
61471 if (real_packet->helptext) {
61472 strvec_copy(old->helptext, real_packet->helptext);
61473 } else {
61474 strvec_clear(old->helptext);
61475 }
61476 genhash_insert(*hash, old, old);
61477 } else {
61478 old->id = real_packet->id;
61479 sz_strlcpy(old->name, real_packet->name);
61480 sz_strlcpy(old->rule_name, real_packet->rule_name);
61481 old->category = real_packet->category;
61482 old->causes = real_packet->causes;
61483 old->rmcauses = real_packet->rmcauses;
61484 sz_strlcpy(old->activity_gfx, real_packet->activity_gfx);
61485 sz_strlcpy(old->act_gfx_alt, real_packet->act_gfx_alt);
61486 sz_strlcpy(old->act_gfx_alt2, real_packet->act_gfx_alt2);
61487 sz_strlcpy(old->rmact_gfx, real_packet->rmact_gfx);
61488 sz_strlcpy(old->rmact_gfx_alt, real_packet->rmact_gfx_alt);
61489 sz_strlcpy(old->rmact_gfx_alt2, real_packet->rmact_gfx_alt2);
61490 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
61491 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
61492 old->reqs_count = real_packet->reqs_count;
61493 {
61494 int i;
61495
61496 for (i = 0; i < real_packet->reqs_count; i++) {
61497 old->reqs[i] = real_packet->reqs[i];
61498 }
61499 }
61500 old->rmreqs_count = real_packet->rmreqs_count;
61501 {
61502 int i;
61503
61504 for (i = 0; i < real_packet->rmreqs_count; i++) {
61505 old->rmreqs[i] = real_packet->rmreqs[i];
61506 }
61507 }
61508 old->appearance_chance = real_packet->appearance_chance;
61509 old->appearance_reqs_count = real_packet->appearance_reqs_count;
61510 {
61511 int i;
61512
61513 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
61514 old->appearance_reqs[i] = real_packet->appearance_reqs[i];
61515 }
61516 }
61517 old->disappearance_chance = real_packet->disappearance_chance;
61518 old->disappearance_reqs_count = real_packet->disappearance_reqs_count;
61519 {
61520 int i;
61521
61522 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
61523 old->disappearance_reqs[i] = real_packet->disappearance_reqs[i];
61524 }
61525 }
61526 old->visibility_req = real_packet->visibility_req;
61527 old->buildable = real_packet->buildable;
61528 old->generated = real_packet->generated;
61529 old->build_time = real_packet->build_time;
61530 old->build_time_factor = real_packet->build_time_factor;
61531 old->removal_time = real_packet->removal_time;
61532 old->removal_time_factor = real_packet->removal_time_factor;
61533 old->infracost = real_packet->infracost;
61534 old->defense_bonus = real_packet->defense_bonus;
61535 old->eus = real_packet->eus;
61536 old->native_to = real_packet->native_to;
61537 old->flags = real_packet->flags;
61538 old->hidden_by = real_packet->hidden_by;
61539 old->bridged_over = real_packet->bridged_over;
61540 old->conflicts = real_packet->conflicts;
61541 old->no_aggr_near_city = real_packet->no_aggr_near_city;
61542 if (real_packet->helptext) {
61543 strvec_copy(old->helptext, real_packet->helptext);
61544 } else {
61545 strvec_clear(old->helptext);
61546 }
61547 }
61548
61549#endif /* FREECIV_DELTA_PROTOCOL */
61550 RECEIVE_PACKET_END(real_packet);
61551#undef FREE_PACKET_STRUCT
61552}
61553
61554 static int send_packet_ruleset_extra_100(struct connection *pc, const struct packet_ruleset_extra *packet)
61555{
61556 const struct packet_ruleset_extra *real_packet = packet;
61557 int e;
61558#ifdef FREECIV_DELTA_PROTOCOL
61559 packet_ruleset_extra_100_fields fields;
61560 struct packet_ruleset_extra *old;
61561 bool differ;
61562 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EXTRA;
61563#endif /* FREECIV_DELTA_PROTOCOL */
61564 SEND_PACKET_START(PACKET_RULESET_EXTRA);
61565#ifdef FREECIV_JSON_CONNECTION
61566 struct plocation field_addr;
61567 {
61568 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
61569 field_addr = *field_addr_tmp;
61570 FC_FREE(field_addr_tmp);
61571 }
61572#endif /* FREECIV_JSON_CONNECTION */
61573
61574 log_packet_detailed("packet_ruleset_extra_100: sending info about ()");
61575
61576#ifdef FREECIV_DELTA_PROTOCOL
61577 if (nullptr == *hash) {
61578 *hash = genhash_new_full(hash_packet_ruleset_extra_100, cmp_packet_ruleset_extra_100,
61579 nullptr, nullptr, nullptr, destroy_packet_ruleset_extra);
61580 }
61581 BV_CLR_ALL(fields);
61582
61583 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
61584 old = fc_malloc(sizeof(*old));
61585 /* temporary bitcopy just to insert correctly */
61586 *old = *real_packet;
61587 genhash_insert(*hash, old, old);
61588 init_packet_ruleset_extra(old);
61589 }
61590 differ = (old->id != real_packet->id);
61591 if (differ) {
61592 BV_SET(fields, 0);
61593 }
61594
61595 differ = (strcmp(old->name, real_packet->name) != 0);
61596 if (differ) {
61597 BV_SET(fields, 1);
61598 }
61599
61600 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
61601 if (differ) {
61602 BV_SET(fields, 2);
61603 }
61604
61605 differ = (old->category != real_packet->category);
61606 if (differ) {
61607 BV_SET(fields, 3);
61608 }
61609
61610 differ = !BV_ARE_EQUAL(old->causes, real_packet->causes);
61611 if (differ) {
61612 BV_SET(fields, 4);
61613 }
61614
61615 differ = !BV_ARE_EQUAL(old->rmcauses, real_packet->rmcauses);
61616 if (differ) {
61617 BV_SET(fields, 5);
61618 }
61619
61620 differ = (strcmp(old->activity_gfx, real_packet->activity_gfx) != 0);
61621 if (differ) {
61622 BV_SET(fields, 6);
61623 }
61624
61625 differ = (strcmp(old->act_gfx_alt, real_packet->act_gfx_alt) != 0);
61626 if (differ) {
61627 BV_SET(fields, 7);
61628 }
61629
61630 differ = (strcmp(old->act_gfx_alt2, real_packet->act_gfx_alt2) != 0);
61631 if (differ) {
61632 BV_SET(fields, 8);
61633 }
61634
61635 differ = (strcmp(old->rmact_gfx, real_packet->rmact_gfx) != 0);
61636 if (differ) {
61637 BV_SET(fields, 9);
61638 }
61639
61640 differ = (strcmp(old->rmact_gfx_alt, real_packet->rmact_gfx_alt) != 0);
61641 if (differ) {
61642 BV_SET(fields, 10);
61643 }
61644
61645 differ = (strcmp(old->rmact_gfx_alt2, real_packet->rmact_gfx_alt2) != 0);
61646 if (differ) {
61647 BV_SET(fields, 11);
61648 }
61649
61650 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
61651 if (differ) {
61652 BV_SET(fields, 12);
61653 }
61654
61655 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
61656 if (differ) {
61657 BV_SET(fields, 13);
61658 }
61659
61660 differ = (old->reqs_count != real_packet->reqs_count);
61661 if (differ) {
61662 BV_SET(fields, 14);
61663 }
61664
61665 differ = (old->reqs_count != real_packet->reqs_count);
61666 if (!differ) {
61667 int i;
61668
61669 for (i = 0; i < real_packet->reqs_count; i++) {
61670 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
61671 if (differ) {
61672 break;
61673 }
61674 }
61675 }
61676 if (differ) {
61677 BV_SET(fields, 15);
61678 }
61679
61680 differ = (old->rmreqs_count != real_packet->rmreqs_count);
61681 if (differ) {
61682 BV_SET(fields, 16);
61683 }
61684
61685 differ = (old->rmreqs_count != real_packet->rmreqs_count);
61686 if (!differ) {
61687 int i;
61688
61689 for (i = 0; i < real_packet->rmreqs_count; i++) {
61690 differ = !are_requirements_equal(&old->rmreqs[i], &real_packet->rmreqs[i]);
61691 if (differ) {
61692 break;
61693 }
61694 }
61695 }
61696 if (differ) {
61697 BV_SET(fields, 17);
61698 }
61699
61700 differ = (old->appearance_chance != real_packet->appearance_chance);
61701 if (differ) {
61702 BV_SET(fields, 18);
61703 }
61704
61705 differ = (old->appearance_reqs_count != real_packet->appearance_reqs_count);
61706 if (differ) {
61707 BV_SET(fields, 19);
61708 }
61709
61710 differ = (old->appearance_reqs_count != real_packet->appearance_reqs_count);
61711 if (!differ) {
61712 int i;
61713
61714 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
61715 differ = !are_requirements_equal(&old->appearance_reqs[i], &real_packet->appearance_reqs[i]);
61716 if (differ) {
61717 break;
61718 }
61719 }
61720 }
61721 if (differ) {
61722 BV_SET(fields, 20);
61723 }
61724
61725 differ = (old->disappearance_chance != real_packet->disappearance_chance);
61726 if (differ) {
61727 BV_SET(fields, 21);
61728 }
61729
61730 differ = (old->disappearance_reqs_count != real_packet->disappearance_reqs_count);
61731 if (differ) {
61732 BV_SET(fields, 22);
61733 }
61734
61735 differ = (old->disappearance_reqs_count != real_packet->disappearance_reqs_count);
61736 if (!differ) {
61737 int i;
61738
61739 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
61740 differ = !are_requirements_equal(&old->disappearance_reqs[i], &real_packet->disappearance_reqs[i]);
61741 if (differ) {
61742 break;
61743 }
61744 }
61745 }
61746 if (differ) {
61747 BV_SET(fields, 23);
61748 }
61749
61750 differ = (old->visibility_req != real_packet->visibility_req);
61751 if (differ) {
61752 BV_SET(fields, 24);
61753 }
61754
61755 if (packet->buildable) {
61756 BV_SET(fields, 25);
61757 }
61758
61759 if (packet->generated) {
61760 BV_SET(fields, 26);
61761 }
61762
61763 differ = (old->build_time != real_packet->build_time);
61764 if (differ) {
61765 BV_SET(fields, 27);
61766 }
61767
61768 differ = (old->build_time_factor != real_packet->build_time_factor);
61769 if (differ) {
61770 BV_SET(fields, 28);
61771 }
61772
61773 differ = (old->removal_time != real_packet->removal_time);
61774 if (differ) {
61775 BV_SET(fields, 29);
61776 }
61777
61778 differ = (old->removal_time_factor != real_packet->removal_time_factor);
61779 if (differ) {
61780 BV_SET(fields, 30);
61781 }
61782
61783 differ = (old->infracost != real_packet->infracost);
61784 if (differ) {
61785 BV_SET(fields, 31);
61786 }
61787
61788 differ = (old->defense_bonus != real_packet->defense_bonus);
61789 if (differ) {
61790 BV_SET(fields, 32);
61791 }
61792
61793 differ = (old->eus != real_packet->eus);
61794 if (differ) {
61795 BV_SET(fields, 33);
61796 }
61797
61798 differ = !BV_ARE_EQUAL(old->native_to, real_packet->native_to);
61799 if (differ) {
61800 BV_SET(fields, 34);
61801 }
61802
61803 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
61804 if (differ) {
61805 BV_SET(fields, 35);
61806 }
61807
61808 differ = !BV_ARE_EQUAL(old->hidden_by, real_packet->hidden_by);
61809 if (differ) {
61810 BV_SET(fields, 36);
61811 }
61812
61813 differ = !BV_ARE_EQUAL(old->bridged_over, real_packet->bridged_over);
61814 if (differ) {
61815 BV_SET(fields, 37);
61816 }
61817
61818 differ = !BV_ARE_EQUAL(old->conflicts, real_packet->conflicts);
61819 if (differ) {
61820 BV_SET(fields, 38);
61821 }
61822
61823 differ = (old->no_aggr_near_city != real_packet->no_aggr_near_city);
61824 if (differ) {
61825 BV_SET(fields, 39);
61826 }
61827
61828 if (real_packet->helptext) {
61829 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
61830 } else {
61831 differ = (strvec_size(old->helptext) > 0);
61832 }
61833 if (differ) {
61834 BV_SET(fields, 40);
61835 }
61836
61837
61838#ifdef FREECIV_JSON_CONNECTION
61839 field_addr.name = "fields";
61840#endif /* FREECIV_JSON_CONNECTION */
61841 e = 0;
61842 e |= DIO_BV_PUT(&dout, &field_addr, fields);
61843 if (e) {
61844 log_packet_detailed("fields bitvector error detected");
61845 }
61846
61847 if (BV_ISSET(fields, 0)) {
61848 log_packet_detailed(" field 'id' has changed");
61849#ifdef FREECIV_JSON_CONNECTION
61850 field_addr.name = "id";
61851#endif /* FREECIV_JSON_CONNECTION */
61852 e = 0;
61853 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
61854 if (e) {
61855 log_packet_detailed("'id' field error detected");
61856 }
61857 }
61858 if (BV_ISSET(fields, 1)) {
61859 log_packet_detailed(" field 'name' has changed");
61860#ifdef FREECIV_JSON_CONNECTION
61861 field_addr.name = "name";
61862#endif /* FREECIV_JSON_CONNECTION */
61863 e = 0;
61864 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
61865 if (e) {
61866 log_packet_detailed("'name' field error detected");
61867 }
61868 }
61869 if (BV_ISSET(fields, 2)) {
61870 log_packet_detailed(" field 'rule_name' has changed");
61871#ifdef FREECIV_JSON_CONNECTION
61872 field_addr.name = "rule_name";
61873#endif /* FREECIV_JSON_CONNECTION */
61874 e = 0;
61875 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
61876 if (e) {
61877 log_packet_detailed("'rule_name' field error detected");
61878 }
61879 }
61880 if (BV_ISSET(fields, 3)) {
61881 log_packet_detailed(" field 'category' has changed");
61882#ifdef FREECIV_JSON_CONNECTION
61883 field_addr.name = "category";
61884#endif /* FREECIV_JSON_CONNECTION */
61885 e = 0;
61886 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
61887 if (e) {
61888 log_packet_detailed("'category' field error detected");
61889 }
61890 }
61891 if (BV_ISSET(fields, 4)) {
61892 log_packet_detailed(" field 'causes' has changed");
61893#ifdef FREECIV_JSON_CONNECTION
61894 field_addr.name = "causes";
61895#endif /* FREECIV_JSON_CONNECTION */
61896 e = 0;
61897 e |= DIO_BV_PUT(&dout, &field_addr, packet->causes);
61898 if (e) {
61899 log_packet_detailed("'causes' field error detected");
61900 }
61901 }
61902 if (BV_ISSET(fields, 5)) {
61903 log_packet_detailed(" field 'rmcauses' has changed");
61904#ifdef FREECIV_JSON_CONNECTION
61905 field_addr.name = "rmcauses";
61906#endif /* FREECIV_JSON_CONNECTION */
61907 e = 0;
61908 e |= DIO_BV_PUT(&dout, &field_addr, packet->rmcauses);
61909 if (e) {
61910 log_packet_detailed("'rmcauses' field error detected");
61911 }
61912 }
61913 if (BV_ISSET(fields, 6)) {
61914 log_packet_detailed(" field 'activity_gfx' has changed");
61915#ifdef FREECIV_JSON_CONNECTION
61916 field_addr.name = "activity_gfx";
61917#endif /* FREECIV_JSON_CONNECTION */
61918 e = 0;
61919 e |= DIO_PUT(string, &dout, &field_addr, real_packet->activity_gfx);
61920 if (e) {
61921 log_packet_detailed("'activity_gfx' field error detected");
61922 }
61923 }
61924 if (BV_ISSET(fields, 7)) {
61925 log_packet_detailed(" field 'act_gfx_alt' has changed");
61926#ifdef FREECIV_JSON_CONNECTION
61927 field_addr.name = "act_gfx_alt";
61928#endif /* FREECIV_JSON_CONNECTION */
61929 e = 0;
61930 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt);
61931 if (e) {
61932 log_packet_detailed("'act_gfx_alt' field error detected");
61933 }
61934 }
61935 if (BV_ISSET(fields, 8)) {
61936 log_packet_detailed(" field 'act_gfx_alt2' has changed");
61937#ifdef FREECIV_JSON_CONNECTION
61938 field_addr.name = "act_gfx_alt2";
61939#endif /* FREECIV_JSON_CONNECTION */
61940 e = 0;
61941 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt2);
61942 if (e) {
61943 log_packet_detailed("'act_gfx_alt2' field error detected");
61944 }
61945 }
61946 if (BV_ISSET(fields, 9)) {
61947 log_packet_detailed(" field 'rmact_gfx' has changed");
61948#ifdef FREECIV_JSON_CONNECTION
61949 field_addr.name = "rmact_gfx";
61950#endif /* FREECIV_JSON_CONNECTION */
61951 e = 0;
61952 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx);
61953 if (e) {
61954 log_packet_detailed("'rmact_gfx' field error detected");
61955 }
61956 }
61957 if (BV_ISSET(fields, 10)) {
61958 log_packet_detailed(" field 'rmact_gfx_alt' has changed");
61959#ifdef FREECIV_JSON_CONNECTION
61960 field_addr.name = "rmact_gfx_alt";
61961#endif /* FREECIV_JSON_CONNECTION */
61962 e = 0;
61963 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt);
61964 if (e) {
61965 log_packet_detailed("'rmact_gfx_alt' field error detected");
61966 }
61967 }
61968 if (BV_ISSET(fields, 11)) {
61969 log_packet_detailed(" field 'rmact_gfx_alt2' has changed");
61970#ifdef FREECIV_JSON_CONNECTION
61971 field_addr.name = "rmact_gfx_alt2";
61972#endif /* FREECIV_JSON_CONNECTION */
61973 e = 0;
61974 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt2);
61975 if (e) {
61976 log_packet_detailed("'rmact_gfx_alt2' field error detected");
61977 }
61978 }
61979 if (BV_ISSET(fields, 12)) {
61980 log_packet_detailed(" field 'graphic_str' has changed");
61981#ifdef FREECIV_JSON_CONNECTION
61982 field_addr.name = "graphic_str";
61983#endif /* FREECIV_JSON_CONNECTION */
61984 e = 0;
61985 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
61986 if (e) {
61987 log_packet_detailed("'graphic_str' field error detected");
61988 }
61989 }
61990 if (BV_ISSET(fields, 13)) {
61991 log_packet_detailed(" field 'graphic_alt' has changed");
61992#ifdef FREECIV_JSON_CONNECTION
61993 field_addr.name = "graphic_alt";
61994#endif /* FREECIV_JSON_CONNECTION */
61995 e = 0;
61996 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
61997 if (e) {
61998 log_packet_detailed("'graphic_alt' field error detected");
61999 }
62000 }
62001 if (BV_ISSET(fields, 14)) {
62002 log_packet_detailed(" field 'reqs_count' has changed");
62003#ifdef FREECIV_JSON_CONNECTION
62004 field_addr.name = "reqs_count";
62005#endif /* FREECIV_JSON_CONNECTION */
62006 e = 0;
62007 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
62008 if (e) {
62009 log_packet_detailed("'reqs_count' field error detected");
62010 }
62011 }
62012 if (BV_ISSET(fields, 15)) {
62013 log_packet_detailed(" field 'reqs' has changed");
62014#ifdef FREECIV_JSON_CONNECTION
62015 field_addr.name = "reqs";
62016#endif /* FREECIV_JSON_CONNECTION */
62017 e = 0;
62018 {
62019 int i;
62020
62021#ifdef FREECIV_JSON_CONNECTION
62022 /* Create the array. */
62023 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
62024
62025 /* Enter the array. */
62026 field_addr.sub_location = plocation_elem_new(0);
62027#endif /* FREECIV_JSON_CONNECTION */
62028
62029 for (i = 0; i < real_packet->reqs_count; i++) {
62030#ifdef FREECIV_JSON_CONNECTION
62031 /* Next array element. */
62032 field_addr.sub_location->number = i;
62033#endif /* FREECIV_JSON_CONNECTION */
62034 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
62035 }
62036
62037#ifdef FREECIV_JSON_CONNECTION
62038 /* Exit array. */
62039 FC_FREE(field_addr.sub_location);
62040#endif /* FREECIV_JSON_CONNECTION */
62041 }
62042 if (e) {
62043 log_packet_detailed("'reqs' field error detected");
62044 }
62045 }
62046 if (BV_ISSET(fields, 16)) {
62047 log_packet_detailed(" field 'rmreqs_count' has changed");
62048#ifdef FREECIV_JSON_CONNECTION
62049 field_addr.name = "rmreqs_count";
62050#endif /* FREECIV_JSON_CONNECTION */
62051 e = 0;
62052 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rmreqs_count);
62053 if (e) {
62054 log_packet_detailed("'rmreqs_count' field error detected");
62055 }
62056 }
62057 if (BV_ISSET(fields, 17)) {
62058 log_packet_detailed(" field 'rmreqs' has changed");
62059#ifdef FREECIV_JSON_CONNECTION
62060 field_addr.name = "rmreqs";
62061#endif /* FREECIV_JSON_CONNECTION */
62062 e = 0;
62063 {
62064 int i;
62065
62066#ifdef FREECIV_JSON_CONNECTION
62067 /* Create the array. */
62068 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->rmreqs_count);
62069
62070 /* Enter the array. */
62071 field_addr.sub_location = plocation_elem_new(0);
62072#endif /* FREECIV_JSON_CONNECTION */
62073
62074 for (i = 0; i < real_packet->rmreqs_count; i++) {
62075#ifdef FREECIV_JSON_CONNECTION
62076 /* Next array element. */
62077 field_addr.sub_location->number = i;
62078#endif /* FREECIV_JSON_CONNECTION */
62079 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->rmreqs[i]);
62080 }
62081
62082#ifdef FREECIV_JSON_CONNECTION
62083 /* Exit array. */
62084 FC_FREE(field_addr.sub_location);
62085#endif /* FREECIV_JSON_CONNECTION */
62086 }
62087 if (e) {
62088 log_packet_detailed("'rmreqs' field error detected");
62089 }
62090 }
62091 if (BV_ISSET(fields, 18)) {
62092 log_packet_detailed(" field 'appearance_chance' has changed");
62093#ifdef FREECIV_JSON_CONNECTION
62094 field_addr.name = "appearance_chance";
62095#endif /* FREECIV_JSON_CONNECTION */
62096 e = 0;
62097 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->appearance_chance);
62098 if (e) {
62099 log_packet_detailed("'appearance_chance' field error detected");
62100 }
62101 }
62102 if (BV_ISSET(fields, 19)) {
62103 log_packet_detailed(" field 'appearance_reqs_count' has changed");
62104#ifdef FREECIV_JSON_CONNECTION
62105 field_addr.name = "appearance_reqs_count";
62106#endif /* FREECIV_JSON_CONNECTION */
62107 e = 0;
62108 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->appearance_reqs_count);
62109 if (e) {
62110 log_packet_detailed("'appearance_reqs_count' field error detected");
62111 }
62112 }
62113 if (BV_ISSET(fields, 20)) {
62114 log_packet_detailed(" field 'appearance_reqs' has changed");
62115#ifdef FREECIV_JSON_CONNECTION
62116 field_addr.name = "appearance_reqs";
62117#endif /* FREECIV_JSON_CONNECTION */
62118 e = 0;
62119 {
62120 int i;
62121
62122#ifdef FREECIV_JSON_CONNECTION
62123 /* Create the array. */
62124 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->appearance_reqs_count);
62125
62126 /* Enter the array. */
62127 field_addr.sub_location = plocation_elem_new(0);
62128#endif /* FREECIV_JSON_CONNECTION */
62129
62130 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
62131#ifdef FREECIV_JSON_CONNECTION
62132 /* Next array element. */
62133 field_addr.sub_location->number = i;
62134#endif /* FREECIV_JSON_CONNECTION */
62135 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->appearance_reqs[i]);
62136 }
62137
62138#ifdef FREECIV_JSON_CONNECTION
62139 /* Exit array. */
62140 FC_FREE(field_addr.sub_location);
62141#endif /* FREECIV_JSON_CONNECTION */
62142 }
62143 if (e) {
62144 log_packet_detailed("'appearance_reqs' field error detected");
62145 }
62146 }
62147 if (BV_ISSET(fields, 21)) {
62148 log_packet_detailed(" field 'disappearance_chance' has changed");
62149#ifdef FREECIV_JSON_CONNECTION
62150 field_addr.name = "disappearance_chance";
62151#endif /* FREECIV_JSON_CONNECTION */
62152 e = 0;
62153 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disappearance_chance);
62154 if (e) {
62155 log_packet_detailed("'disappearance_chance' field error detected");
62156 }
62157 }
62158 if (BV_ISSET(fields, 22)) {
62159 log_packet_detailed(" field 'disappearance_reqs_count' has changed");
62160#ifdef FREECIV_JSON_CONNECTION
62161 field_addr.name = "disappearance_reqs_count";
62162#endif /* FREECIV_JSON_CONNECTION */
62163 e = 0;
62164 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->disappearance_reqs_count);
62165 if (e) {
62166 log_packet_detailed("'disappearance_reqs_count' field error detected");
62167 }
62168 }
62169 if (BV_ISSET(fields, 23)) {
62170 log_packet_detailed(" field 'disappearance_reqs' has changed");
62171#ifdef FREECIV_JSON_CONNECTION
62172 field_addr.name = "disappearance_reqs";
62173#endif /* FREECIV_JSON_CONNECTION */
62174 e = 0;
62175 {
62176 int i;
62177
62178#ifdef FREECIV_JSON_CONNECTION
62179 /* Create the array. */
62180 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->disappearance_reqs_count);
62181
62182 /* Enter the array. */
62183 field_addr.sub_location = plocation_elem_new(0);
62184#endif /* FREECIV_JSON_CONNECTION */
62185
62186 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
62187#ifdef FREECIV_JSON_CONNECTION
62188 /* Next array element. */
62189 field_addr.sub_location->number = i;
62190#endif /* FREECIV_JSON_CONNECTION */
62191 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->disappearance_reqs[i]);
62192 }
62193
62194#ifdef FREECIV_JSON_CONNECTION
62195 /* Exit array. */
62196 FC_FREE(field_addr.sub_location);
62197#endif /* FREECIV_JSON_CONNECTION */
62198 }
62199 if (e) {
62200 log_packet_detailed("'disappearance_reqs' field error detected");
62201 }
62202 }
62203 if (BV_ISSET(fields, 24)) {
62204 log_packet_detailed(" field 'visibility_req' has changed");
62205#ifdef FREECIV_JSON_CONNECTION
62206 field_addr.name = "visibility_req";
62207#endif /* FREECIV_JSON_CONNECTION */
62208 e = 0;
62209 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->visibility_req);
62210 if (e) {
62211 log_packet_detailed("'visibility_req' field error detected");
62212 }
62213 }
62214 /* field 25 is folded into the header */
62215 /* field 26 is folded into the header */
62216 if (BV_ISSET(fields, 27)) {
62217 log_packet_detailed(" field 'build_time' has changed");
62218#ifdef FREECIV_JSON_CONNECTION
62219 field_addr.name = "build_time";
62220#endif /* FREECIV_JSON_CONNECTION */
62221 e = 0;
62222 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time);
62223 if (e) {
62224 log_packet_detailed("'build_time' field error detected");
62225 }
62226 }
62227 if (BV_ISSET(fields, 28)) {
62228 log_packet_detailed(" field 'build_time_factor' has changed");
62229#ifdef FREECIV_JSON_CONNECTION
62230 field_addr.name = "build_time_factor";
62231#endif /* FREECIV_JSON_CONNECTION */
62232 e = 0;
62233 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time_factor);
62234 if (e) {
62235 log_packet_detailed("'build_time_factor' field error detected");
62236 }
62237 }
62238 if (BV_ISSET(fields, 29)) {
62239 log_packet_detailed(" field 'removal_time' has changed");
62240#ifdef FREECIV_JSON_CONNECTION
62241 field_addr.name = "removal_time";
62242#endif /* FREECIV_JSON_CONNECTION */
62243 e = 0;
62244 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time);
62245 if (e) {
62246 log_packet_detailed("'removal_time' field error detected");
62247 }
62248 }
62249 if (BV_ISSET(fields, 30)) {
62250 log_packet_detailed(" field 'removal_time_factor' has changed");
62251#ifdef FREECIV_JSON_CONNECTION
62252 field_addr.name = "removal_time_factor";
62253#endif /* FREECIV_JSON_CONNECTION */
62254 e = 0;
62255 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time_factor);
62256 if (e) {
62257 log_packet_detailed("'removal_time_factor' field error detected");
62258 }
62259 }
62260 if (BV_ISSET(fields, 31)) {
62261 log_packet_detailed(" field 'infracost' has changed");
62262#ifdef FREECIV_JSON_CONNECTION
62263 field_addr.name = "infracost";
62264#endif /* FREECIV_JSON_CONNECTION */
62265 e = 0;
62266 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->infracost);
62267 if (e) {
62268 log_packet_detailed("'infracost' field error detected");
62269 }
62270 }
62271 if (BV_ISSET(fields, 32)) {
62272 log_packet_detailed(" field 'defense_bonus' has changed");
62273#ifdef FREECIV_JSON_CONNECTION
62274 field_addr.name = "defense_bonus";
62275#endif /* FREECIV_JSON_CONNECTION */
62276 e = 0;
62277 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_bonus);
62278 if (e) {
62279 log_packet_detailed("'defense_bonus' field error detected");
62280 }
62281 }
62282 if (BV_ISSET(fields, 33)) {
62283 log_packet_detailed(" field 'eus' has changed");
62284#ifdef FREECIV_JSON_CONNECTION
62285 field_addr.name = "eus";
62286#endif /* FREECIV_JSON_CONNECTION */
62287 e = 0;
62288 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->eus);
62289 if (e) {
62290 log_packet_detailed("'eus' field error detected");
62291 }
62292 }
62293 if (BV_ISSET(fields, 34)) {
62294 log_packet_detailed(" field 'native_to' has changed");
62295#ifdef FREECIV_JSON_CONNECTION
62296 field_addr.name = "native_to";
62297#endif /* FREECIV_JSON_CONNECTION */
62298 e = 0;
62299 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
62300 if (e) {
62301 log_packet_detailed("'native_to' field error detected");
62302 }
62303 }
62304 if (BV_ISSET(fields, 35)) {
62305 log_packet_detailed(" field 'flags' has changed");
62306#ifdef FREECIV_JSON_CONNECTION
62307 field_addr.name = "flags";
62308#endif /* FREECIV_JSON_CONNECTION */
62309 e = 0;
62310 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
62311 if (e) {
62312 log_packet_detailed("'flags' field error detected");
62313 }
62314 }
62315 if (BV_ISSET(fields, 36)) {
62316 log_packet_detailed(" field 'hidden_by' has changed");
62317#ifdef FREECIV_JSON_CONNECTION
62318 field_addr.name = "hidden_by";
62319#endif /* FREECIV_JSON_CONNECTION */
62320 e = 0;
62321 e |= DIO_BV_PUT(&dout, &field_addr, packet->hidden_by);
62322 if (e) {
62323 log_packet_detailed("'hidden_by' field error detected");
62324 }
62325 }
62326 if (BV_ISSET(fields, 37)) {
62327 log_packet_detailed(" field 'bridged_over' has changed");
62328#ifdef FREECIV_JSON_CONNECTION
62329 field_addr.name = "bridged_over";
62330#endif /* FREECIV_JSON_CONNECTION */
62331 e = 0;
62332 e |= DIO_BV_PUT(&dout, &field_addr, packet->bridged_over);
62333 if (e) {
62334 log_packet_detailed("'bridged_over' field error detected");
62335 }
62336 }
62337 if (BV_ISSET(fields, 38)) {
62338 log_packet_detailed(" field 'conflicts' has changed");
62339#ifdef FREECIV_JSON_CONNECTION
62340 field_addr.name = "conflicts";
62341#endif /* FREECIV_JSON_CONNECTION */
62342 e = 0;
62343 e |= DIO_BV_PUT(&dout, &field_addr, packet->conflicts);
62344 if (e) {
62345 log_packet_detailed("'conflicts' field error detected");
62346 }
62347 }
62348 if (BV_ISSET(fields, 39)) {
62349 log_packet_detailed(" field 'no_aggr_near_city' has changed");
62350#ifdef FREECIV_JSON_CONNECTION
62351 field_addr.name = "no_aggr_near_city";
62352#endif /* FREECIV_JSON_CONNECTION */
62353 e = 0;
62354 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->no_aggr_near_city);
62355 if (e) {
62356 log_packet_detailed("'no_aggr_near_city' field error detected");
62357 }
62358 }
62359 if (BV_ISSET(fields, 40)) {
62360 log_packet_detailed(" field 'helptext' has changed");
62361#ifdef FREECIV_JSON_CONNECTION
62362 field_addr.name = "helptext";
62363#endif /* FREECIV_JSON_CONNECTION */
62364 e = 0;
62365 if (!real_packet->helptext) {
62366 /* Transmit null vector as empty vector */
62367 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
62368 } else {
62369 int i;
62370
62371 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
62372 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
62373
62374#ifdef FREECIV_JSON_CONNECTION
62375 field_addr.sub_location = plocation_elem_new(0);
62376#endif /* FREECIV_JSON_CONNECTION */
62377
62378 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
62379 const char *pstr = strvec_get(real_packet->helptext, i);
62380
62381 if (!pstr) {
62382 /* Transmit null strings as empty strings */
62383 pstr = "";
62384 }
62385
62386#ifdef FREECIV_JSON_CONNECTION
62387 /* Next array element */
62388 field_addr.sub_location->number = i;
62389#endif /* FREECIV_JSON_CONNECTION */
62390
62391 e |= DIO_PUT(string, &dout, &field_addr, pstr);
62392 }
62393
62394#ifdef FREECIV_JSON_CONNECTION
62395 FC_FREE(field_addr.sub_location);
62396#endif /* FREECIV_JSON_CONNECTION */
62397 }
62398 if (e) {
62399 log_packet_detailed("'helptext' field error detected");
62400 }
62401 }
62402
62403 old->id = real_packet->id;
62404 sz_strlcpy(old->name, real_packet->name);
62405 sz_strlcpy(old->rule_name, real_packet->rule_name);
62406 old->category = real_packet->category;
62407 old->causes = real_packet->causes;
62408 old->rmcauses = real_packet->rmcauses;
62409 sz_strlcpy(old->activity_gfx, real_packet->activity_gfx);
62410 sz_strlcpy(old->act_gfx_alt, real_packet->act_gfx_alt);
62411 sz_strlcpy(old->act_gfx_alt2, real_packet->act_gfx_alt2);
62412 sz_strlcpy(old->rmact_gfx, real_packet->rmact_gfx);
62413 sz_strlcpy(old->rmact_gfx_alt, real_packet->rmact_gfx_alt);
62414 sz_strlcpy(old->rmact_gfx_alt2, real_packet->rmact_gfx_alt2);
62415 sz_strlcpy(old->graphic_str, real_packet->graphic_str);
62416 sz_strlcpy(old->graphic_alt, real_packet->graphic_alt);
62417 old->reqs_count = real_packet->reqs_count;
62418 {
62419 int i;
62420
62421 for (i = 0; i < real_packet->reqs_count; i++) {
62422 old->reqs[i] = real_packet->reqs[i];
62423 }
62424 }
62425 old->rmreqs_count = real_packet->rmreqs_count;
62426 {
62427 int i;
62428
62429 for (i = 0; i < real_packet->rmreqs_count; i++) {
62430 old->rmreqs[i] = real_packet->rmreqs[i];
62431 }
62432 }
62433 old->appearance_chance = real_packet->appearance_chance;
62434 old->appearance_reqs_count = real_packet->appearance_reqs_count;
62435 {
62436 int i;
62437
62438 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
62439 old->appearance_reqs[i] = real_packet->appearance_reqs[i];
62440 }
62441 }
62442 old->disappearance_chance = real_packet->disappearance_chance;
62443 old->disappearance_reqs_count = real_packet->disappearance_reqs_count;
62444 {
62445 int i;
62446
62447 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
62448 old->disappearance_reqs[i] = real_packet->disappearance_reqs[i];
62449 }
62450 }
62451 old->visibility_req = real_packet->visibility_req;
62452 old->buildable = real_packet->buildable;
62453 old->generated = real_packet->generated;
62454 old->build_time = real_packet->build_time;
62455 old->build_time_factor = real_packet->build_time_factor;
62456 old->removal_time = real_packet->removal_time;
62457 old->removal_time_factor = real_packet->removal_time_factor;
62458 old->infracost = real_packet->infracost;
62459 old->defense_bonus = real_packet->defense_bonus;
62460 old->eus = real_packet->eus;
62461 old->native_to = real_packet->native_to;
62462 old->flags = real_packet->flags;
62463 old->hidden_by = real_packet->hidden_by;
62464 old->bridged_over = real_packet->bridged_over;
62465 old->conflicts = real_packet->conflicts;
62466 old->no_aggr_near_city = real_packet->no_aggr_near_city;
62467 if (real_packet->helptext) {
62468 strvec_copy(old->helptext, real_packet->helptext);
62469 } else {
62470 strvec_clear(old->helptext);
62471 }
62472#endif /* FREECIV_DELTA_PROTOCOL */
62473#ifndef FREECIV_DELTA_PROTOCOL
62474#ifdef FREECIV_JSON_CONNECTION
62475 field_addr.name = "id";
62476#endif /* FREECIV_JSON_CONNECTION */
62477 e = 0;
62478 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
62479 if (e) {
62480 log_packet_detailed("'id' field error detected");
62481 }
62482#ifdef FREECIV_JSON_CONNECTION
62483 field_addr.name = "name";
62484#endif /* FREECIV_JSON_CONNECTION */
62485 e = 0;
62486 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
62487 if (e) {
62488 log_packet_detailed("'name' field error detected");
62489 }
62490#ifdef FREECIV_JSON_CONNECTION
62491 field_addr.name = "rule_name";
62492#endif /* FREECIV_JSON_CONNECTION */
62493 e = 0;
62494 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
62495 if (e) {
62496 log_packet_detailed("'rule_name' field error detected");
62497 }
62498#ifdef FREECIV_JSON_CONNECTION
62499 field_addr.name = "category";
62500#endif /* FREECIV_JSON_CONNECTION */
62501 e = 0;
62502 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
62503 if (e) {
62504 log_packet_detailed("'category' field error detected");
62505 }
62506#ifdef FREECIV_JSON_CONNECTION
62507 field_addr.name = "causes";
62508#endif /* FREECIV_JSON_CONNECTION */
62509 e = 0;
62510 e |= DIO_BV_PUT(&dout, &field_addr, packet->causes);
62511 if (e) {
62512 log_packet_detailed("'causes' field error detected");
62513 }
62514#ifdef FREECIV_JSON_CONNECTION
62515 field_addr.name = "rmcauses";
62516#endif /* FREECIV_JSON_CONNECTION */
62517 e = 0;
62518 e |= DIO_BV_PUT(&dout, &field_addr, packet->rmcauses);
62519 if (e) {
62520 log_packet_detailed("'rmcauses' field error detected");
62521 }
62522#ifdef FREECIV_JSON_CONNECTION
62523 field_addr.name = "activity_gfx";
62524#endif /* FREECIV_JSON_CONNECTION */
62525 e = 0;
62526 e |= DIO_PUT(string, &dout, &field_addr, real_packet->activity_gfx);
62527 if (e) {
62528 log_packet_detailed("'activity_gfx' field error detected");
62529 }
62530#ifdef FREECIV_JSON_CONNECTION
62531 field_addr.name = "act_gfx_alt";
62532#endif /* FREECIV_JSON_CONNECTION */
62533 e = 0;
62534 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt);
62535 if (e) {
62536 log_packet_detailed("'act_gfx_alt' field error detected");
62537 }
62538#ifdef FREECIV_JSON_CONNECTION
62539 field_addr.name = "act_gfx_alt2";
62540#endif /* FREECIV_JSON_CONNECTION */
62541 e = 0;
62542 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt2);
62543 if (e) {
62544 log_packet_detailed("'act_gfx_alt2' field error detected");
62545 }
62546#ifdef FREECIV_JSON_CONNECTION
62547 field_addr.name = "rmact_gfx";
62548#endif /* FREECIV_JSON_CONNECTION */
62549 e = 0;
62550 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx);
62551 if (e) {
62552 log_packet_detailed("'rmact_gfx' field error detected");
62553 }
62554#ifdef FREECIV_JSON_CONNECTION
62555 field_addr.name = "rmact_gfx_alt";
62556#endif /* FREECIV_JSON_CONNECTION */
62557 e = 0;
62558 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt);
62559 if (e) {
62560 log_packet_detailed("'rmact_gfx_alt' field error detected");
62561 }
62562#ifdef FREECIV_JSON_CONNECTION
62563 field_addr.name = "rmact_gfx_alt2";
62564#endif /* FREECIV_JSON_CONNECTION */
62565 e = 0;
62566 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt2);
62567 if (e) {
62568 log_packet_detailed("'rmact_gfx_alt2' field error detected");
62569 }
62570#ifdef FREECIV_JSON_CONNECTION
62571 field_addr.name = "graphic_str";
62572#endif /* FREECIV_JSON_CONNECTION */
62573 e = 0;
62574 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
62575 if (e) {
62576 log_packet_detailed("'graphic_str' field error detected");
62577 }
62578#ifdef FREECIV_JSON_CONNECTION
62579 field_addr.name = "graphic_alt";
62580#endif /* FREECIV_JSON_CONNECTION */
62581 e = 0;
62582 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
62583 if (e) {
62584 log_packet_detailed("'graphic_alt' field error detected");
62585 }
62586#ifdef FREECIV_JSON_CONNECTION
62587 field_addr.name = "reqs_count";
62588#endif /* FREECIV_JSON_CONNECTION */
62589 e = 0;
62590 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
62591 if (e) {
62592 log_packet_detailed("'reqs_count' field error detected");
62593 }
62594#ifdef FREECIV_JSON_CONNECTION
62595 field_addr.name = "reqs";
62596#endif /* FREECIV_JSON_CONNECTION */
62597 e = 0;
62598 {
62599 int i;
62600
62601#ifdef FREECIV_JSON_CONNECTION
62602 /* Create the array. */
62603 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
62604
62605 /* Enter the array. */
62606 field_addr.sub_location = plocation_elem_new(0);
62607#endif /* FREECIV_JSON_CONNECTION */
62608
62609 for (i = 0; i < real_packet->reqs_count; i++) {
62610#ifdef FREECIV_JSON_CONNECTION
62611 /* Next array element. */
62612 field_addr.sub_location->number = i;
62613#endif /* FREECIV_JSON_CONNECTION */
62614 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
62615 }
62616
62617#ifdef FREECIV_JSON_CONNECTION
62618 /* Exit array. */
62619 FC_FREE(field_addr.sub_location);
62620#endif /* FREECIV_JSON_CONNECTION */
62621 }
62622 if (e) {
62623 log_packet_detailed("'reqs' field error detected");
62624 }
62625#ifdef FREECIV_JSON_CONNECTION
62626 field_addr.name = "rmreqs_count";
62627#endif /* FREECIV_JSON_CONNECTION */
62628 e = 0;
62629 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rmreqs_count);
62630 if (e) {
62631 log_packet_detailed("'rmreqs_count' field error detected");
62632 }
62633#ifdef FREECIV_JSON_CONNECTION
62634 field_addr.name = "rmreqs";
62635#endif /* FREECIV_JSON_CONNECTION */
62636 e = 0;
62637 {
62638 int i;
62639
62640#ifdef FREECIV_JSON_CONNECTION
62641 /* Create the array. */
62642 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->rmreqs_count);
62643
62644 /* Enter the array. */
62645 field_addr.sub_location = plocation_elem_new(0);
62646#endif /* FREECIV_JSON_CONNECTION */
62647
62648 for (i = 0; i < real_packet->rmreqs_count; i++) {
62649#ifdef FREECIV_JSON_CONNECTION
62650 /* Next array element. */
62651 field_addr.sub_location->number = i;
62652#endif /* FREECIV_JSON_CONNECTION */
62653 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->rmreqs[i]);
62654 }
62655
62656#ifdef FREECIV_JSON_CONNECTION
62657 /* Exit array. */
62658 FC_FREE(field_addr.sub_location);
62659#endif /* FREECIV_JSON_CONNECTION */
62660 }
62661 if (e) {
62662 log_packet_detailed("'rmreqs' field error detected");
62663 }
62664#ifdef FREECIV_JSON_CONNECTION
62665 field_addr.name = "appearance_chance";
62666#endif /* FREECIV_JSON_CONNECTION */
62667 e = 0;
62668 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->appearance_chance);
62669 if (e) {
62670 log_packet_detailed("'appearance_chance' field error detected");
62671 }
62672#ifdef FREECIV_JSON_CONNECTION
62673 field_addr.name = "appearance_reqs_count";
62674#endif /* FREECIV_JSON_CONNECTION */
62675 e = 0;
62676 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->appearance_reqs_count);
62677 if (e) {
62678 log_packet_detailed("'appearance_reqs_count' field error detected");
62679 }
62680#ifdef FREECIV_JSON_CONNECTION
62681 field_addr.name = "appearance_reqs";
62682#endif /* FREECIV_JSON_CONNECTION */
62683 e = 0;
62684 {
62685 int i;
62686
62687#ifdef FREECIV_JSON_CONNECTION
62688 /* Create the array. */
62689 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->appearance_reqs_count);
62690
62691 /* Enter the array. */
62692 field_addr.sub_location = plocation_elem_new(0);
62693#endif /* FREECIV_JSON_CONNECTION */
62694
62695 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
62696#ifdef FREECIV_JSON_CONNECTION
62697 /* Next array element. */
62698 field_addr.sub_location->number = i;
62699#endif /* FREECIV_JSON_CONNECTION */
62700 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->appearance_reqs[i]);
62701 }
62702
62703#ifdef FREECIV_JSON_CONNECTION
62704 /* Exit array. */
62705 FC_FREE(field_addr.sub_location);
62706#endif /* FREECIV_JSON_CONNECTION */
62707 }
62708 if (e) {
62709 log_packet_detailed("'appearance_reqs' field error detected");
62710 }
62711#ifdef FREECIV_JSON_CONNECTION
62712 field_addr.name = "disappearance_chance";
62713#endif /* FREECIV_JSON_CONNECTION */
62714 e = 0;
62715 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disappearance_chance);
62716 if (e) {
62717 log_packet_detailed("'disappearance_chance' field error detected");
62718 }
62719#ifdef FREECIV_JSON_CONNECTION
62720 field_addr.name = "disappearance_reqs_count";
62721#endif /* FREECIV_JSON_CONNECTION */
62722 e = 0;
62723 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->disappearance_reqs_count);
62724 if (e) {
62725 log_packet_detailed("'disappearance_reqs_count' field error detected");
62726 }
62727#ifdef FREECIV_JSON_CONNECTION
62728 field_addr.name = "disappearance_reqs";
62729#endif /* FREECIV_JSON_CONNECTION */
62730 e = 0;
62731 {
62732 int i;
62733
62734#ifdef FREECIV_JSON_CONNECTION
62735 /* Create the array. */
62736 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->disappearance_reqs_count);
62737
62738 /* Enter the array. */
62739 field_addr.sub_location = plocation_elem_new(0);
62740#endif /* FREECIV_JSON_CONNECTION */
62741
62742 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
62743#ifdef FREECIV_JSON_CONNECTION
62744 /* Next array element. */
62745 field_addr.sub_location->number = i;
62746#endif /* FREECIV_JSON_CONNECTION */
62747 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->disappearance_reqs[i]);
62748 }
62749
62750#ifdef FREECIV_JSON_CONNECTION
62751 /* Exit array. */
62752 FC_FREE(field_addr.sub_location);
62753#endif /* FREECIV_JSON_CONNECTION */
62754 }
62755 if (e) {
62756 log_packet_detailed("'disappearance_reqs' field error detected");
62757 }
62758#ifdef FREECIV_JSON_CONNECTION
62759 field_addr.name = "visibility_req";
62760#endif /* FREECIV_JSON_CONNECTION */
62761 e = 0;
62762 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->visibility_req);
62763 if (e) {
62764 log_packet_detailed("'visibility_req' field error detected");
62765 }
62766#ifdef FREECIV_JSON_CONNECTION
62767 field_addr.name = "buildable";
62768#endif /* FREECIV_JSON_CONNECTION */
62769 e = 0;
62770 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->buildable);
62771 if (e) {
62772 log_packet_detailed("'buildable' field error detected");
62773 }
62774#ifdef FREECIV_JSON_CONNECTION
62775 field_addr.name = "generated";
62776#endif /* FREECIV_JSON_CONNECTION */
62777 e = 0;
62778 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->generated);
62779 if (e) {
62780 log_packet_detailed("'generated' field error detected");
62781 }
62782#ifdef FREECIV_JSON_CONNECTION
62783 field_addr.name = "build_time";
62784#endif /* FREECIV_JSON_CONNECTION */
62785 e = 0;
62786 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time);
62787 if (e) {
62788 log_packet_detailed("'build_time' field error detected");
62789 }
62790#ifdef FREECIV_JSON_CONNECTION
62791 field_addr.name = "build_time_factor";
62792#endif /* FREECIV_JSON_CONNECTION */
62793 e = 0;
62794 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time_factor);
62795 if (e) {
62796 log_packet_detailed("'build_time_factor' field error detected");
62797 }
62798#ifdef FREECIV_JSON_CONNECTION
62799 field_addr.name = "removal_time";
62800#endif /* FREECIV_JSON_CONNECTION */
62801 e = 0;
62802 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time);
62803 if (e) {
62804 log_packet_detailed("'removal_time' field error detected");
62805 }
62806#ifdef FREECIV_JSON_CONNECTION
62807 field_addr.name = "removal_time_factor";
62808#endif /* FREECIV_JSON_CONNECTION */
62809 e = 0;
62810 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time_factor);
62811 if (e) {
62812 log_packet_detailed("'removal_time_factor' field error detected");
62813 }
62814#ifdef FREECIV_JSON_CONNECTION
62815 field_addr.name = "infracost";
62816#endif /* FREECIV_JSON_CONNECTION */
62817 e = 0;
62818 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->infracost);
62819 if (e) {
62820 log_packet_detailed("'infracost' field error detected");
62821 }
62822#ifdef FREECIV_JSON_CONNECTION
62823 field_addr.name = "defense_bonus";
62824#endif /* FREECIV_JSON_CONNECTION */
62825 e = 0;
62826 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_bonus);
62827 if (e) {
62828 log_packet_detailed("'defense_bonus' field error detected");
62829 }
62830#ifdef FREECIV_JSON_CONNECTION
62831 field_addr.name = "eus";
62832#endif /* FREECIV_JSON_CONNECTION */
62833 e = 0;
62834 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->eus);
62835 if (e) {
62836 log_packet_detailed("'eus' field error detected");
62837 }
62838#ifdef FREECIV_JSON_CONNECTION
62839 field_addr.name = "native_to";
62840#endif /* FREECIV_JSON_CONNECTION */
62841 e = 0;
62842 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
62843 if (e) {
62844 log_packet_detailed("'native_to' field error detected");
62845 }
62846#ifdef FREECIV_JSON_CONNECTION
62847 field_addr.name = "flags";
62848#endif /* FREECIV_JSON_CONNECTION */
62849 e = 0;
62850 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
62851 if (e) {
62852 log_packet_detailed("'flags' field error detected");
62853 }
62854#ifdef FREECIV_JSON_CONNECTION
62855 field_addr.name = "hidden_by";
62856#endif /* FREECIV_JSON_CONNECTION */
62857 e = 0;
62858 e |= DIO_BV_PUT(&dout, &field_addr, packet->hidden_by);
62859 if (e) {
62860 log_packet_detailed("'hidden_by' field error detected");
62861 }
62862#ifdef FREECIV_JSON_CONNECTION
62863 field_addr.name = "bridged_over";
62864#endif /* FREECIV_JSON_CONNECTION */
62865 e = 0;
62866 e |= DIO_BV_PUT(&dout, &field_addr, packet->bridged_over);
62867 if (e) {
62868 log_packet_detailed("'bridged_over' field error detected");
62869 }
62870#ifdef FREECIV_JSON_CONNECTION
62871 field_addr.name = "conflicts";
62872#endif /* FREECIV_JSON_CONNECTION */
62873 e = 0;
62874 e |= DIO_BV_PUT(&dout, &field_addr, packet->conflicts);
62875 if (e) {
62876 log_packet_detailed("'conflicts' field error detected");
62877 }
62878#ifdef FREECIV_JSON_CONNECTION
62879 field_addr.name = "no_aggr_near_city";
62880#endif /* FREECIV_JSON_CONNECTION */
62881 e = 0;
62882 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->no_aggr_near_city);
62883 if (e) {
62884 log_packet_detailed("'no_aggr_near_city' field error detected");
62885 }
62886#ifdef FREECIV_JSON_CONNECTION
62887 field_addr.name = "helptext";
62888#endif /* FREECIV_JSON_CONNECTION */
62889 e = 0;
62890 if (!real_packet->helptext) {
62891 /* Transmit null vector as empty vector */
62892 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
62893 } else {
62894 int i;
62895
62896 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
62897 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
62898
62899#ifdef FREECIV_JSON_CONNECTION
62900 field_addr.sub_location = plocation_elem_new(0);
62901#endif /* FREECIV_JSON_CONNECTION */
62902
62903 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
62904 const char *pstr = strvec_get(real_packet->helptext, i);
62905
62906 if (!pstr) {
62907 /* Transmit null strings as empty strings */
62908 pstr = "";
62909 }
62910
62911#ifdef FREECIV_JSON_CONNECTION
62912 /* Next array element */
62913 field_addr.sub_location->number = i;
62914#endif /* FREECIV_JSON_CONNECTION */
62915
62916 e |= DIO_PUT(string, &dout, &field_addr, pstr);
62917 }
62918
62919#ifdef FREECIV_JSON_CONNECTION
62920 FC_FREE(field_addr.sub_location);
62921#endif /* FREECIV_JSON_CONNECTION */
62922 }
62923 if (e) {
62924 log_packet_detailed("'helptext' field error detected");
62925 }
62926
62927#endif
62928 SEND_PACKET_END(PACKET_RULESET_EXTRA);
62929}
62930
62931 int send_packet_ruleset_extra(struct connection *pc, const struct packet_ruleset_extra *packet)
62932{
62933 if (!pc->used) {
62934 log_error("WARNING: trying to send data to the closed connection %s",
62935 conn_description(pc));
62936 return -1;
62937 }
62938 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EXTRA].packet != nullptr, -1,
62939 "Handler for PACKET_RULESET_EXTRA not installed");
62940 return pc->phs.handlers->send[PACKET_RULESET_EXTRA].packet(pc, packet);
62941}
62942
62943 void lsend_packet_ruleset_extra(struct conn_list *dest, const struct packet_ruleset_extra *packet)
62944{
62945 conn_list_iterate(dest, pconn) {
62946 send_packet_ruleset_extra(pconn, packet);
62947 } conn_list_iterate_end;
62948}
62949
62950 static inline void init_packet_ruleset_extra_flag(struct packet_ruleset_extra_flag *packet)
62951{
62952 memset(packet, 0, sizeof(*packet));
62953}
62954
62955#define free_packet_ruleset_extra_flag(_packet) (void) 0
62956#define destroy_packet_ruleset_extra_flag free
62957
62958#ifdef FREECIV_DELTA_PROTOCOL
62959#define hash_packet_ruleset_extra_flag_100 hash_const
62960
62961#define cmp_packet_ruleset_extra_flag_100 cmp_const
62962
62963 BV_DEFINE(packet_ruleset_extra_flag_100_fields, 3);
62964#endif /* FREECIV_DELTA_PROTOCOL */
62965
62966 static struct packet_ruleset_extra_flag *receive_packet_ruleset_extra_flag_100(struct connection *pc)
62967{
62968#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_extra_flag(_packet)
62969#ifdef FREECIV_DELTA_PROTOCOL
62970 packet_ruleset_extra_flag_100_fields fields;
62971 struct packet_ruleset_extra_flag *old;
62972 struct genhash **hash = pc->phs.received + PACKET_RULESET_EXTRA_FLAG;
62973#endif /* FREECIV_DELTA_PROTOCOL */
62974 RECEIVE_PACKET_START(packet_ruleset_extra_flag, real_packet);
62975#ifdef FREECIV_JSON_CONNECTION
62976 struct plocation field_addr;
62977 {
62978 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
62979 field_addr = *field_addr_tmp;
62980 FC_FREE(field_addr_tmp);
62981 }
62982#endif /* FREECIV_JSON_CONNECTION */
62983
62984#ifdef FREECIV_DELTA_PROTOCOL
62985#ifdef FREECIV_JSON_CONNECTION
62986 field_addr.name = "fields";
62987#endif /* FREECIV_JSON_CONNECTION */
62988 DIO_BV_GET(&din, &field_addr, fields);
62989
62990#else /* FREECIV_DELTA_PROTOCOL */
62991#ifdef FREECIV_JSON_CONNECTION
62992 field_addr.name = "id";
62993#endif /* FREECIV_JSON_CONNECTION */
62994 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
62995 RECEIVE_PACKET_FIELD_ERROR(id);
62996 }
62997#ifdef FREECIV_JSON_CONNECTION
62998 field_addr.name = "name";
62999#endif /* FREECIV_JSON_CONNECTION */
63000 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
63001 RECEIVE_PACKET_FIELD_ERROR(name);
63002 }
63003#ifdef FREECIV_JSON_CONNECTION
63004 field_addr.name = "helptxt";
63005#endif /* FREECIV_JSON_CONNECTION */
63006 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
63007 RECEIVE_PACKET_FIELD_ERROR(helptxt);
63008 }
63009#endif
63010 log_packet_detailed("packet_ruleset_extra_flag_100: got info about ()");
63011
63012#ifdef FREECIV_DELTA_PROTOCOL
63013 if (nullptr == *hash) {
63014 *hash = genhash_new_full(hash_packet_ruleset_extra_flag_100, cmp_packet_ruleset_extra_flag_100,
63015 nullptr, nullptr, nullptr, destroy_packet_ruleset_extra_flag);
63016 }
63017
63018 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
63019 *real_packet = *old;
63020 } else {
63021 /* packet is already initialized empty */
63022 log_packet_detailed(" no old info");
63023 }
63024
63025 if (BV_ISSET(fields, 0)) {
63026 log_packet_detailed(" got field 'id'");
63027#ifdef FREECIV_JSON_CONNECTION
63028 field_addr.name = "id";
63029#endif /* FREECIV_JSON_CONNECTION */
63030 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
63031 RECEIVE_PACKET_FIELD_ERROR(id);
63032 }
63033 }
63034 if (BV_ISSET(fields, 1)) {
63035 log_packet_detailed(" got field 'name'");
63036#ifdef FREECIV_JSON_CONNECTION
63037 field_addr.name = "name";
63038#endif /* FREECIV_JSON_CONNECTION */
63039 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
63040 RECEIVE_PACKET_FIELD_ERROR(name);
63041 }
63042 }
63043 if (BV_ISSET(fields, 2)) {
63044 log_packet_detailed(" got field 'helptxt'");
63045#ifdef FREECIV_JSON_CONNECTION
63046 field_addr.name = "helptxt";
63047#endif /* FREECIV_JSON_CONNECTION */
63048 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
63049 RECEIVE_PACKET_FIELD_ERROR(helptxt);
63050 }
63051 }
63052
63053 if (nullptr == old) {
63054 old = fc_malloc(sizeof(*old));
63055 init_packet_ruleset_extra_flag(old);
63056 *old = *real_packet;
63057 genhash_insert(*hash, old, old);
63058 } else {
63059 *old = *real_packet;
63060 }
63061
63062#endif /* FREECIV_DELTA_PROTOCOL */
63063 RECEIVE_PACKET_END(real_packet);
63064#undef FREE_PACKET_STRUCT
63065}
63066
63067 static int send_packet_ruleset_extra_flag_100(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
63068{
63069 const struct packet_ruleset_extra_flag *real_packet = packet;
63070 int e;
63071#ifdef FREECIV_DELTA_PROTOCOL
63072 packet_ruleset_extra_flag_100_fields fields;
63073 struct packet_ruleset_extra_flag *old;
63074 bool differ;
63075 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EXTRA_FLAG;
63076#endif /* FREECIV_DELTA_PROTOCOL */
63077 SEND_PACKET_START(PACKET_RULESET_EXTRA_FLAG);
63078#ifdef FREECIV_JSON_CONNECTION
63079 struct plocation field_addr;
63080 {
63081 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
63082 field_addr = *field_addr_tmp;
63083 FC_FREE(field_addr_tmp);
63084 }
63085#endif /* FREECIV_JSON_CONNECTION */
63086
63087 log_packet_detailed("packet_ruleset_extra_flag_100: sending info about ()");
63088
63089#ifdef FREECIV_DELTA_PROTOCOL
63090 if (nullptr == *hash) {
63091 *hash = genhash_new_full(hash_packet_ruleset_extra_flag_100, cmp_packet_ruleset_extra_flag_100,
63092 nullptr, nullptr, nullptr, destroy_packet_ruleset_extra_flag);
63093 }
63094 BV_CLR_ALL(fields);
63095
63096 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
63097 old = fc_malloc(sizeof(*old));
63098 /* temporary bitcopy just to insert correctly */
63099 *old = *real_packet;
63100 genhash_insert(*hash, old, old);
63101 init_packet_ruleset_extra_flag(old);
63102 }
63103 differ = (old->id != real_packet->id);
63104 if (differ) {
63105 BV_SET(fields, 0);
63106 }
63107
63108 differ = (strcmp(old->name, real_packet->name) != 0);
63109 if (differ) {
63110 BV_SET(fields, 1);
63111 }
63112
63113 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
63114 if (differ) {
63115 BV_SET(fields, 2);
63116 }
63117
63118
63119#ifdef FREECIV_JSON_CONNECTION
63120 field_addr.name = "fields";
63121#endif /* FREECIV_JSON_CONNECTION */
63122 e = 0;
63123 e |= DIO_BV_PUT(&dout, &field_addr, fields);
63124 if (e) {
63125 log_packet_detailed("fields bitvector error detected");
63126 }
63127
63128 if (BV_ISSET(fields, 0)) {
63129 log_packet_detailed(" field 'id' has changed");
63130#ifdef FREECIV_JSON_CONNECTION
63131 field_addr.name = "id";
63132#endif /* FREECIV_JSON_CONNECTION */
63133 e = 0;
63134 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
63135 if (e) {
63136 log_packet_detailed("'id' field error detected");
63137 }
63138 }
63139 if (BV_ISSET(fields, 1)) {
63140 log_packet_detailed(" field 'name' has changed");
63141#ifdef FREECIV_JSON_CONNECTION
63142 field_addr.name = "name";
63143#endif /* FREECIV_JSON_CONNECTION */
63144 e = 0;
63145 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
63146 if (e) {
63147 log_packet_detailed("'name' field error detected");
63148 }
63149 }
63150 if (BV_ISSET(fields, 2)) {
63151 log_packet_detailed(" field 'helptxt' has changed");
63152#ifdef FREECIV_JSON_CONNECTION
63153 field_addr.name = "helptxt";
63154#endif /* FREECIV_JSON_CONNECTION */
63155 e = 0;
63156 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
63157 if (e) {
63158 log_packet_detailed("'helptxt' field error detected");
63159 }
63160 }
63161
63162 *old = *real_packet;
63163#endif /* FREECIV_DELTA_PROTOCOL */
63164#ifndef FREECIV_DELTA_PROTOCOL
63165#ifdef FREECIV_JSON_CONNECTION
63166 field_addr.name = "id";
63167#endif /* FREECIV_JSON_CONNECTION */
63168 e = 0;
63169 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
63170 if (e) {
63171 log_packet_detailed("'id' field error detected");
63172 }
63173#ifdef FREECIV_JSON_CONNECTION
63174 field_addr.name = "name";
63175#endif /* FREECIV_JSON_CONNECTION */
63176 e = 0;
63177 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
63178 if (e) {
63179 log_packet_detailed("'name' field error detected");
63180 }
63181#ifdef FREECIV_JSON_CONNECTION
63182 field_addr.name = "helptxt";
63183#endif /* FREECIV_JSON_CONNECTION */
63184 e = 0;
63185 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
63186 if (e) {
63187 log_packet_detailed("'helptxt' field error detected");
63188 }
63189
63190#endif
63191 SEND_PACKET_END(PACKET_RULESET_EXTRA_FLAG);
63192}
63193
63194 int send_packet_ruleset_extra_flag(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
63195{
63196 if (!pc->used) {
63197 log_error("WARNING: trying to send data to the closed connection %s",
63198 conn_description(pc));
63199 return -1;
63200 }
63201 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EXTRA_FLAG].packet != nullptr, -1,
63202 "Handler for PACKET_RULESET_EXTRA_FLAG not installed");
63203 return pc->phs.handlers->send[PACKET_RULESET_EXTRA_FLAG].packet(pc, packet);
63204}
63205
63206 void lsend_packet_ruleset_extra_flag(struct conn_list *dest, const struct packet_ruleset_extra_flag *packet)
63207{
63208 conn_list_iterate(dest, pconn) {
63209 send_packet_ruleset_extra_flag(pconn, packet);
63210 } conn_list_iterate_end;
63211}
63212
63213 static inline void init_packet_ruleset_base(struct packet_ruleset_base *packet)
63214{
63215 memset(packet, 0, sizeof(*packet));
63216}
63217
63218#define free_packet_ruleset_base(_packet) (void) 0
63219#define destroy_packet_ruleset_base free
63220
63221#ifdef FREECIV_DELTA_PROTOCOL
63222#define hash_packet_ruleset_base_100 hash_const
63223
63224#define cmp_packet_ruleset_base_100 cmp_const
63225
63226 BV_DEFINE(packet_ruleset_base_100_fields, 6);
63227#endif /* FREECIV_DELTA_PROTOCOL */
63228
63229 static struct packet_ruleset_base *receive_packet_ruleset_base_100(struct connection *pc)
63230{
63231#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_base(_packet)
63232#ifdef FREECIV_DELTA_PROTOCOL
63233 packet_ruleset_base_100_fields fields;
63234 struct packet_ruleset_base *old;
63235 struct genhash **hash = pc->phs.received + PACKET_RULESET_BASE;
63236#endif /* FREECIV_DELTA_PROTOCOL */
63237 RECEIVE_PACKET_START(packet_ruleset_base, real_packet);
63238#ifdef FREECIV_JSON_CONNECTION
63239 struct plocation field_addr;
63240 {
63241 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
63242 field_addr = *field_addr_tmp;
63243 FC_FREE(field_addr_tmp);
63244 }
63245#endif /* FREECIV_JSON_CONNECTION */
63246
63247#ifdef FREECIV_DELTA_PROTOCOL
63248#ifdef FREECIV_JSON_CONNECTION
63249 field_addr.name = "fields";
63250#endif /* FREECIV_JSON_CONNECTION */
63251 DIO_BV_GET(&din, &field_addr, fields);
63252
63253#else /* FREECIV_DELTA_PROTOCOL */
63254#ifdef FREECIV_JSON_CONNECTION
63255 field_addr.name = "id";
63256#endif /* FREECIV_JSON_CONNECTION */
63257 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
63258 RECEIVE_PACKET_FIELD_ERROR(id);
63259 }
63260#ifdef FREECIV_JSON_CONNECTION
63261 field_addr.name = "gui_type";
63262#endif /* FREECIV_JSON_CONNECTION */
63263 {
63264 int readin;
63265
63266 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63267 RECEIVE_PACKET_FIELD_ERROR(gui_type);
63268 }
63269 real_packet->gui_type = readin;
63270 }
63271#ifdef FREECIV_JSON_CONNECTION
63272 field_addr.name = "border_sq";
63273#endif /* FREECIV_JSON_CONNECTION */
63274 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->border_sq)) {
63275 RECEIVE_PACKET_FIELD_ERROR(border_sq);
63276 }
63277#ifdef FREECIV_JSON_CONNECTION
63278 field_addr.name = "vision_main_sq";
63279#endif /* FREECIV_JSON_CONNECTION */
63280 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_main_sq)) {
63281 RECEIVE_PACKET_FIELD_ERROR(vision_main_sq);
63282 }
63283#ifdef FREECIV_JSON_CONNECTION
63284 field_addr.name = "vision_invis_sq";
63285#endif /* FREECIV_JSON_CONNECTION */
63286 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_invis_sq)) {
63287 RECEIVE_PACKET_FIELD_ERROR(vision_invis_sq);
63288 }
63289#ifdef FREECIV_JSON_CONNECTION
63290 field_addr.name = "vision_subs_sq";
63291#endif /* FREECIV_JSON_CONNECTION */
63292 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_subs_sq)) {
63293 RECEIVE_PACKET_FIELD_ERROR(vision_subs_sq);
63294 }
63295#endif
63296 log_packet_detailed("packet_ruleset_base_100: got info about ()");
63297
63298#ifdef FREECIV_DELTA_PROTOCOL
63299 if (nullptr == *hash) {
63300 *hash = genhash_new_full(hash_packet_ruleset_base_100, cmp_packet_ruleset_base_100,
63301 nullptr, nullptr, nullptr, destroy_packet_ruleset_base);
63302 }
63303
63304 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
63305 *real_packet = *old;
63306 } else {
63307 /* packet is already initialized empty */
63308 log_packet_detailed(" no old info");
63309 }
63310
63311 if (BV_ISSET(fields, 0)) {
63312 log_packet_detailed(" got field 'id'");
63313#ifdef FREECIV_JSON_CONNECTION
63314 field_addr.name = "id";
63315#endif /* FREECIV_JSON_CONNECTION */
63316 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
63317 RECEIVE_PACKET_FIELD_ERROR(id);
63318 }
63319 }
63320 if (BV_ISSET(fields, 1)) {
63321 log_packet_detailed(" got field 'gui_type'");
63322#ifdef FREECIV_JSON_CONNECTION
63323 field_addr.name = "gui_type";
63324#endif /* FREECIV_JSON_CONNECTION */
63325 {
63326 int readin;
63327
63328 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63329 RECEIVE_PACKET_FIELD_ERROR(gui_type);
63330 }
63331 real_packet->gui_type = readin;
63332 }
63333 }
63334 if (BV_ISSET(fields, 2)) {
63335 log_packet_detailed(" got field 'border_sq'");
63336#ifdef FREECIV_JSON_CONNECTION
63337 field_addr.name = "border_sq";
63338#endif /* FREECIV_JSON_CONNECTION */
63339 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->border_sq)) {
63340 RECEIVE_PACKET_FIELD_ERROR(border_sq);
63341 }
63342 }
63343 if (BV_ISSET(fields, 3)) {
63344 log_packet_detailed(" got field 'vision_main_sq'");
63345#ifdef FREECIV_JSON_CONNECTION
63346 field_addr.name = "vision_main_sq";
63347#endif /* FREECIV_JSON_CONNECTION */
63348 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_main_sq)) {
63349 RECEIVE_PACKET_FIELD_ERROR(vision_main_sq);
63350 }
63351 }
63352 if (BV_ISSET(fields, 4)) {
63353 log_packet_detailed(" got field 'vision_invis_sq'");
63354#ifdef FREECIV_JSON_CONNECTION
63355 field_addr.name = "vision_invis_sq";
63356#endif /* FREECIV_JSON_CONNECTION */
63357 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_invis_sq)) {
63358 RECEIVE_PACKET_FIELD_ERROR(vision_invis_sq);
63359 }
63360 }
63361 if (BV_ISSET(fields, 5)) {
63362 log_packet_detailed(" got field 'vision_subs_sq'");
63363#ifdef FREECIV_JSON_CONNECTION
63364 field_addr.name = "vision_subs_sq";
63365#endif /* FREECIV_JSON_CONNECTION */
63366 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_subs_sq)) {
63367 RECEIVE_PACKET_FIELD_ERROR(vision_subs_sq);
63368 }
63369 }
63370
63371 if (nullptr == old) {
63372 old = fc_malloc(sizeof(*old));
63373 init_packet_ruleset_base(old);
63374 *old = *real_packet;
63375 genhash_insert(*hash, old, old);
63376 } else {
63377 *old = *real_packet;
63378 }
63379
63380#endif /* FREECIV_DELTA_PROTOCOL */
63381 RECEIVE_PACKET_END(real_packet);
63382#undef FREE_PACKET_STRUCT
63383}
63384
63385 static int send_packet_ruleset_base_100(struct connection *pc, const struct packet_ruleset_base *packet)
63386{
63387 const struct packet_ruleset_base *real_packet = packet;
63388 int e;
63389#ifdef FREECIV_DELTA_PROTOCOL
63390 packet_ruleset_base_100_fields fields;
63391 struct packet_ruleset_base *old;
63392 bool differ;
63393 struct genhash **hash = pc->phs.sent + PACKET_RULESET_BASE;
63394#endif /* FREECIV_DELTA_PROTOCOL */
63395 SEND_PACKET_START(PACKET_RULESET_BASE);
63396#ifdef FREECIV_JSON_CONNECTION
63397 struct plocation field_addr;
63398 {
63399 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
63400 field_addr = *field_addr_tmp;
63401 FC_FREE(field_addr_tmp);
63402 }
63403#endif /* FREECIV_JSON_CONNECTION */
63404
63405 log_packet_detailed("packet_ruleset_base_100: sending info about ()");
63406
63407#ifdef FREECIV_DELTA_PROTOCOL
63408 if (nullptr == *hash) {
63409 *hash = genhash_new_full(hash_packet_ruleset_base_100, cmp_packet_ruleset_base_100,
63410 nullptr, nullptr, nullptr, destroy_packet_ruleset_base);
63411 }
63412 BV_CLR_ALL(fields);
63413
63414 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
63415 old = fc_malloc(sizeof(*old));
63416 /* temporary bitcopy just to insert correctly */
63417 *old = *real_packet;
63418 genhash_insert(*hash, old, old);
63419 init_packet_ruleset_base(old);
63420 }
63421 differ = (old->id != real_packet->id);
63422 if (differ) {
63423 BV_SET(fields, 0);
63424 }
63425
63426 differ = (old->gui_type != real_packet->gui_type);
63427 if (differ) {
63428 BV_SET(fields, 1);
63429 }
63430
63431 differ = (old->border_sq != real_packet->border_sq);
63432 if (differ) {
63433 BV_SET(fields, 2);
63434 }
63435
63436 differ = (old->vision_main_sq != real_packet->vision_main_sq);
63437 if (differ) {
63438 BV_SET(fields, 3);
63439 }
63440
63441 differ = (old->vision_invis_sq != real_packet->vision_invis_sq);
63442 if (differ) {
63443 BV_SET(fields, 4);
63444 }
63445
63446 differ = (old->vision_subs_sq != real_packet->vision_subs_sq);
63447 if (differ) {
63448 BV_SET(fields, 5);
63449 }
63450
63451
63452#ifdef FREECIV_JSON_CONNECTION
63453 field_addr.name = "fields";
63454#endif /* FREECIV_JSON_CONNECTION */
63455 e = 0;
63456 e |= DIO_BV_PUT(&dout, &field_addr, fields);
63457 if (e) {
63458 log_packet_detailed("fields bitvector error detected");
63459 }
63460
63461 if (BV_ISSET(fields, 0)) {
63462 log_packet_detailed(" field 'id' has changed");
63463#ifdef FREECIV_JSON_CONNECTION
63464 field_addr.name = "id";
63465#endif /* FREECIV_JSON_CONNECTION */
63466 e = 0;
63467 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
63468 if (e) {
63469 log_packet_detailed("'id' field error detected");
63470 }
63471 }
63472 if (BV_ISSET(fields, 1)) {
63473 log_packet_detailed(" field 'gui_type' has changed");
63474#ifdef FREECIV_JSON_CONNECTION
63475 field_addr.name = "gui_type";
63476#endif /* FREECIV_JSON_CONNECTION */
63477 e = 0;
63478 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
63479 if (e) {
63480 log_packet_detailed("'gui_type' field error detected");
63481 }
63482 }
63483 if (BV_ISSET(fields, 2)) {
63484 log_packet_detailed(" field 'border_sq' has changed");
63485#ifdef FREECIV_JSON_CONNECTION
63486 field_addr.name = "border_sq";
63487#endif /* FREECIV_JSON_CONNECTION */
63488 e = 0;
63489 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->border_sq);
63490 if (e) {
63491 log_packet_detailed("'border_sq' field error detected");
63492 }
63493 }
63494 if (BV_ISSET(fields, 3)) {
63495 log_packet_detailed(" field 'vision_main_sq' has changed");
63496#ifdef FREECIV_JSON_CONNECTION
63497 field_addr.name = "vision_main_sq";
63498#endif /* FREECIV_JSON_CONNECTION */
63499 e = 0;
63500 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_main_sq);
63501 if (e) {
63502 log_packet_detailed("'vision_main_sq' field error detected");
63503 }
63504 }
63505 if (BV_ISSET(fields, 4)) {
63506 log_packet_detailed(" field 'vision_invis_sq' has changed");
63507#ifdef FREECIV_JSON_CONNECTION
63508 field_addr.name = "vision_invis_sq";
63509#endif /* FREECIV_JSON_CONNECTION */
63510 e = 0;
63511 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_invis_sq);
63512 if (e) {
63513 log_packet_detailed("'vision_invis_sq' field error detected");
63514 }
63515 }
63516 if (BV_ISSET(fields, 5)) {
63517 log_packet_detailed(" field 'vision_subs_sq' has changed");
63518#ifdef FREECIV_JSON_CONNECTION
63519 field_addr.name = "vision_subs_sq";
63520#endif /* FREECIV_JSON_CONNECTION */
63521 e = 0;
63522 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_subs_sq);
63523 if (e) {
63524 log_packet_detailed("'vision_subs_sq' field error detected");
63525 }
63526 }
63527
63528 *old = *real_packet;
63529#endif /* FREECIV_DELTA_PROTOCOL */
63530#ifndef FREECIV_DELTA_PROTOCOL
63531#ifdef FREECIV_JSON_CONNECTION
63532 field_addr.name = "id";
63533#endif /* FREECIV_JSON_CONNECTION */
63534 e = 0;
63535 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
63536 if (e) {
63537 log_packet_detailed("'id' field error detected");
63538 }
63539#ifdef FREECIV_JSON_CONNECTION
63540 field_addr.name = "gui_type";
63541#endif /* FREECIV_JSON_CONNECTION */
63542 e = 0;
63543 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
63544 if (e) {
63545 log_packet_detailed("'gui_type' field error detected");
63546 }
63547#ifdef FREECIV_JSON_CONNECTION
63548 field_addr.name = "border_sq";
63549#endif /* FREECIV_JSON_CONNECTION */
63550 e = 0;
63551 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->border_sq);
63552 if (e) {
63553 log_packet_detailed("'border_sq' field error detected");
63554 }
63555#ifdef FREECIV_JSON_CONNECTION
63556 field_addr.name = "vision_main_sq";
63557#endif /* FREECIV_JSON_CONNECTION */
63558 e = 0;
63559 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_main_sq);
63560 if (e) {
63561 log_packet_detailed("'vision_main_sq' field error detected");
63562 }
63563#ifdef FREECIV_JSON_CONNECTION
63564 field_addr.name = "vision_invis_sq";
63565#endif /* FREECIV_JSON_CONNECTION */
63566 e = 0;
63567 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_invis_sq);
63568 if (e) {
63569 log_packet_detailed("'vision_invis_sq' field error detected");
63570 }
63571#ifdef FREECIV_JSON_CONNECTION
63572 field_addr.name = "vision_subs_sq";
63573#endif /* FREECIV_JSON_CONNECTION */
63574 e = 0;
63575 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_subs_sq);
63576 if (e) {
63577 log_packet_detailed("'vision_subs_sq' field error detected");
63578 }
63579
63580#endif
63581 SEND_PACKET_END(PACKET_RULESET_BASE);
63582}
63583
63584 int send_packet_ruleset_base(struct connection *pc, const struct packet_ruleset_base *packet)
63585{
63586 if (!pc->used) {
63587 log_error("WARNING: trying to send data to the closed connection %s",
63588 conn_description(pc));
63589 return -1;
63590 }
63591 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_BASE].packet != nullptr, -1,
63592 "Handler for PACKET_RULESET_BASE not installed");
63593 return pc->phs.handlers->send[PACKET_RULESET_BASE].packet(pc, packet);
63594}
63595
63596 void lsend_packet_ruleset_base(struct conn_list *dest, const struct packet_ruleset_base *packet)
63597{
63598 conn_list_iterate(dest, pconn) {
63599 send_packet_ruleset_base(pconn, packet);
63600 } conn_list_iterate_end;
63601}
63602
63603 static inline void init_packet_ruleset_road(struct packet_ruleset_road *packet)
63604{
63605 memset(packet, 0, sizeof(*packet));
63606}
63607
63608#define free_packet_ruleset_road(_packet) (void) 0
63609#define destroy_packet_ruleset_road free
63610
63611#ifdef FREECIV_DELTA_PROTOCOL
63612#define hash_packet_ruleset_road_100 hash_const
63613
63614#define cmp_packet_ruleset_road_100 cmp_const
63615
63616 BV_DEFINE(packet_ruleset_road_100_fields, 12);
63617#endif /* FREECIV_DELTA_PROTOCOL */
63618
63619 static struct packet_ruleset_road *receive_packet_ruleset_road_100(struct connection *pc)
63620{
63621#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_road(_packet)
63622#ifdef FREECIV_DELTA_PROTOCOL
63623 packet_ruleset_road_100_fields fields;
63624 struct packet_ruleset_road *old;
63625 struct genhash **hash = pc->phs.received + PACKET_RULESET_ROAD;
63626#endif /* FREECIV_DELTA_PROTOCOL */
63627 RECEIVE_PACKET_START(packet_ruleset_road, real_packet);
63628#ifdef FREECIV_JSON_CONNECTION
63629 struct plocation field_addr;
63630 {
63631 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
63632 field_addr = *field_addr_tmp;
63633 FC_FREE(field_addr_tmp);
63634 }
63635#endif /* FREECIV_JSON_CONNECTION */
63636
63637#ifdef FREECIV_DELTA_PROTOCOL
63638#ifdef FREECIV_JSON_CONNECTION
63639 field_addr.name = "fields";
63640#endif /* FREECIV_JSON_CONNECTION */
63641 DIO_BV_GET(&din, &field_addr, fields);
63642
63643#else /* FREECIV_DELTA_PROTOCOL */
63644#ifdef FREECIV_JSON_CONNECTION
63645 field_addr.name = "id";
63646#endif /* FREECIV_JSON_CONNECTION */
63647 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
63648 RECEIVE_PACKET_FIELD_ERROR(id);
63649 }
63650#ifdef FREECIV_JSON_CONNECTION
63651 field_addr.name = "gui_type";
63652#endif /* FREECIV_JSON_CONNECTION */
63653 {
63654 int readin;
63655
63656 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63657 RECEIVE_PACKET_FIELD_ERROR(gui_type);
63658 }
63659 real_packet->gui_type = readin;
63660 }
63661#ifdef FREECIV_JSON_CONNECTION
63662 field_addr.name = "first_reqs_count";
63663#endif /* FREECIV_JSON_CONNECTION */
63664 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->first_reqs_count)) {
63665 RECEIVE_PACKET_FIELD_ERROR(first_reqs_count);
63666 }
63667#ifdef FREECIV_JSON_CONNECTION
63668 field_addr.name = "first_reqs";
63669#endif /* FREECIV_JSON_CONNECTION */
63670 {
63671 int i;
63672
63673#ifdef FREECIV_JSON_CONNECTION
63674 /* Enter array. */
63675 field_addr.sub_location = plocation_elem_new(0);
63676#endif /* FREECIV_JSON_CONNECTION */
63677
63678 if (real_packet->first_reqs_count > MAX_NUM_REQS) {
63679 RECEIVE_PACKET_FIELD_ERROR(first_reqs, ": truncation array");
63680 }
63681 for (i = 0; i < real_packet->first_reqs_count; i++) {
63682#ifdef FREECIV_JSON_CONNECTION
63683 field_addr.sub_location->number = i;
63684#endif /* FREECIV_JSON_CONNECTION */
63685 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->first_reqs[i])) {
63686 RECEIVE_PACKET_FIELD_ERROR(first_reqs);
63687 }
63688 }
63689
63690#ifdef FREECIV_JSON_CONNECTION
63691 /* Exit array. */
63692 FC_FREE(field_addr.sub_location);
63693#endif /* FREECIV_JSON_CONNECTION */
63694 }
63695#ifdef FREECIV_JSON_CONNECTION
63696 field_addr.name = "move_cost";
63697#endif /* FREECIV_JSON_CONNECTION */
63698 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->move_cost)) {
63699 RECEIVE_PACKET_FIELD_ERROR(move_cost);
63700 }
63701#ifdef FREECIV_JSON_CONNECTION
63702 field_addr.name = "move_mode";
63703#endif /* FREECIV_JSON_CONNECTION */
63704 {
63705 int readin;
63706
63707 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63708 RECEIVE_PACKET_FIELD_ERROR(move_mode);
63709 }
63710 real_packet->move_mode = readin;
63711 }
63712#ifdef FREECIV_JSON_CONNECTION
63713 field_addr.name = "tile_incr_const";
63714#endif /* FREECIV_JSON_CONNECTION */
63715 {
63716 int i;
63717
63718#ifdef FREECIV_JSON_CONNECTION
63719 /* Enter array. */
63720 field_addr.sub_location = plocation_elem_new(0);
63721#endif /* FREECIV_JSON_CONNECTION */
63722
63723 for (i = 0; i < O_LAST; i++) {
63724#ifdef FREECIV_JSON_CONNECTION
63725 field_addr.sub_location->number = i;
63726#endif /* FREECIV_JSON_CONNECTION */
63727 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr_const[i])) {
63728 RECEIVE_PACKET_FIELD_ERROR(tile_incr_const);
63729 }
63730 }
63731
63732#ifdef FREECIV_JSON_CONNECTION
63733 /* Exit array. */
63734 FC_FREE(field_addr.sub_location);
63735#endif /* FREECIV_JSON_CONNECTION */
63736 }
63737#ifdef FREECIV_JSON_CONNECTION
63738 field_addr.name = "tile_incr";
63739#endif /* FREECIV_JSON_CONNECTION */
63740 {
63741 int i;
63742
63743#ifdef FREECIV_JSON_CONNECTION
63744 /* Enter array. */
63745 field_addr.sub_location = plocation_elem_new(0);
63746#endif /* FREECIV_JSON_CONNECTION */
63747
63748 for (i = 0; i < O_LAST; i++) {
63749#ifdef FREECIV_JSON_CONNECTION
63750 field_addr.sub_location->number = i;
63751#endif /* FREECIV_JSON_CONNECTION */
63752 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr[i])) {
63753 RECEIVE_PACKET_FIELD_ERROR(tile_incr);
63754 }
63755 }
63756
63757#ifdef FREECIV_JSON_CONNECTION
63758 /* Exit array. */
63759 FC_FREE(field_addr.sub_location);
63760#endif /* FREECIV_JSON_CONNECTION */
63761 }
63762#ifdef FREECIV_JSON_CONNECTION
63763 field_addr.name = "tile_bonus";
63764#endif /* FREECIV_JSON_CONNECTION */
63765 {
63766 int i;
63767
63768#ifdef FREECIV_JSON_CONNECTION
63769 /* Enter array. */
63770 field_addr.sub_location = plocation_elem_new(0);
63771#endif /* FREECIV_JSON_CONNECTION */
63772
63773 for (i = 0; i < O_LAST; i++) {
63774#ifdef FREECIV_JSON_CONNECTION
63775 field_addr.sub_location->number = i;
63776#endif /* FREECIV_JSON_CONNECTION */
63777 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_bonus[i])) {
63778 RECEIVE_PACKET_FIELD_ERROR(tile_bonus);
63779 }
63780 }
63781
63782#ifdef FREECIV_JSON_CONNECTION
63783 /* Exit array. */
63784 FC_FREE(field_addr.sub_location);
63785#endif /* FREECIV_JSON_CONNECTION */
63786 }
63787#ifdef FREECIV_JSON_CONNECTION
63788 field_addr.name = "compat";
63789#endif /* FREECIV_JSON_CONNECTION */
63790 {
63791 int readin;
63792
63793 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63794 RECEIVE_PACKET_FIELD_ERROR(compat);
63795 }
63796 real_packet->compat = readin;
63797 }
63798#ifdef FREECIV_JSON_CONNECTION
63799 field_addr.name = "integrates";
63800#endif /* FREECIV_JSON_CONNECTION */
63801 if (!DIO_BV_GET(&din, &field_addr, real_packet->integrates)) {
63802 RECEIVE_PACKET_FIELD_ERROR(integrates);
63803 }
63804#ifdef FREECIV_JSON_CONNECTION
63805 field_addr.name = "flags";
63806#endif /* FREECIV_JSON_CONNECTION */
63807 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
63808 RECEIVE_PACKET_FIELD_ERROR(flags);
63809 }
63810#endif
63811 log_packet_detailed("packet_ruleset_road_100: got info about ()");
63812
63813#ifdef FREECIV_DELTA_PROTOCOL
63814 if (nullptr == *hash) {
63815 *hash = genhash_new_full(hash_packet_ruleset_road_100, cmp_packet_ruleset_road_100,
63816 nullptr, nullptr, nullptr, destroy_packet_ruleset_road);
63817 }
63818
63819 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
63820 *real_packet = *old;
63821 } else {
63822 /* packet is already initialized empty */
63823 log_packet_detailed(" no old info");
63824 }
63825
63826 if (BV_ISSET(fields, 0)) {
63827 log_packet_detailed(" got field 'id'");
63828#ifdef FREECIV_JSON_CONNECTION
63829 field_addr.name = "id";
63830#endif /* FREECIV_JSON_CONNECTION */
63831 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
63832 RECEIVE_PACKET_FIELD_ERROR(id);
63833 }
63834 }
63835 if (BV_ISSET(fields, 1)) {
63836 log_packet_detailed(" got field 'gui_type'");
63837#ifdef FREECIV_JSON_CONNECTION
63838 field_addr.name = "gui_type";
63839#endif /* FREECIV_JSON_CONNECTION */
63840 {
63841 int readin;
63842
63843 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63844 RECEIVE_PACKET_FIELD_ERROR(gui_type);
63845 }
63846 real_packet->gui_type = readin;
63847 }
63848 }
63849 if (BV_ISSET(fields, 2)) {
63850 log_packet_detailed(" got field 'first_reqs_count'");
63851#ifdef FREECIV_JSON_CONNECTION
63852 field_addr.name = "first_reqs_count";
63853#endif /* FREECIV_JSON_CONNECTION */
63854 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->first_reqs_count)) {
63855 RECEIVE_PACKET_FIELD_ERROR(first_reqs_count);
63856 }
63857 }
63858 if (BV_ISSET(fields, 3)) {
63859 log_packet_detailed(" got field 'first_reqs'");
63860#ifdef FREECIV_JSON_CONNECTION
63861 field_addr.name = "first_reqs";
63862#endif /* FREECIV_JSON_CONNECTION */
63863 {
63864 int i;
63865
63866#ifdef FREECIV_JSON_CONNECTION
63867 /* Enter array. */
63868 field_addr.sub_location = plocation_elem_new(0);
63869#endif /* FREECIV_JSON_CONNECTION */
63870
63871 if (real_packet->first_reqs_count > MAX_NUM_REQS) {
63872 RECEIVE_PACKET_FIELD_ERROR(first_reqs, ": truncation array");
63873 }
63874 for (i = 0; i < real_packet->first_reqs_count; i++) {
63875#ifdef FREECIV_JSON_CONNECTION
63876 field_addr.sub_location->number = i;
63877#endif /* FREECIV_JSON_CONNECTION */
63878 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->first_reqs[i])) {
63879 RECEIVE_PACKET_FIELD_ERROR(first_reqs);
63880 }
63881 }
63882
63883#ifdef FREECIV_JSON_CONNECTION
63884 /* Exit array. */
63885 FC_FREE(field_addr.sub_location);
63886#endif /* FREECIV_JSON_CONNECTION */
63887 }
63888 }
63889 if (BV_ISSET(fields, 4)) {
63890 log_packet_detailed(" got field 'move_cost'");
63891#ifdef FREECIV_JSON_CONNECTION
63892 field_addr.name = "move_cost";
63893#endif /* FREECIV_JSON_CONNECTION */
63894 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->move_cost)) {
63895 RECEIVE_PACKET_FIELD_ERROR(move_cost);
63896 }
63897 }
63898 if (BV_ISSET(fields, 5)) {
63899 log_packet_detailed(" got field 'move_mode'");
63900#ifdef FREECIV_JSON_CONNECTION
63901 field_addr.name = "move_mode";
63902#endif /* FREECIV_JSON_CONNECTION */
63903 {
63904 int readin;
63905
63906 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63907 RECEIVE_PACKET_FIELD_ERROR(move_mode);
63908 }
63909 real_packet->move_mode = readin;
63910 }
63911 }
63912 if (BV_ISSET(fields, 6)) {
63913 log_packet_detailed(" got field 'tile_incr_const'");
63914#ifdef FREECIV_JSON_CONNECTION
63915 field_addr.name = "tile_incr_const";
63916#endif /* FREECIV_JSON_CONNECTION */
63917 {
63918 int i;
63919
63920#ifdef FREECIV_JSON_CONNECTION
63921 /* Enter array. */
63922 field_addr.sub_location = plocation_elem_new(0);
63923#endif /* FREECIV_JSON_CONNECTION */
63924
63925 for (i = 0; i < O_LAST; i++) {
63926#ifdef FREECIV_JSON_CONNECTION
63927 field_addr.sub_location->number = i;
63928#endif /* FREECIV_JSON_CONNECTION */
63929 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr_const[i])) {
63930 RECEIVE_PACKET_FIELD_ERROR(tile_incr_const);
63931 }
63932 }
63933
63934#ifdef FREECIV_JSON_CONNECTION
63935 /* Exit array. */
63936 FC_FREE(field_addr.sub_location);
63937#endif /* FREECIV_JSON_CONNECTION */
63938 }
63939 }
63940 if (BV_ISSET(fields, 7)) {
63941 log_packet_detailed(" got field 'tile_incr'");
63942#ifdef FREECIV_JSON_CONNECTION
63943 field_addr.name = "tile_incr";
63944#endif /* FREECIV_JSON_CONNECTION */
63945 {
63946 int i;
63947
63948#ifdef FREECIV_JSON_CONNECTION
63949 /* Enter array. */
63950 field_addr.sub_location = plocation_elem_new(0);
63951#endif /* FREECIV_JSON_CONNECTION */
63952
63953 for (i = 0; i < O_LAST; i++) {
63954#ifdef FREECIV_JSON_CONNECTION
63955 field_addr.sub_location->number = i;
63956#endif /* FREECIV_JSON_CONNECTION */
63957 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr[i])) {
63958 RECEIVE_PACKET_FIELD_ERROR(tile_incr);
63959 }
63960 }
63961
63962#ifdef FREECIV_JSON_CONNECTION
63963 /* Exit array. */
63964 FC_FREE(field_addr.sub_location);
63965#endif /* FREECIV_JSON_CONNECTION */
63966 }
63967 }
63968 if (BV_ISSET(fields, 8)) {
63969 log_packet_detailed(" got field 'tile_bonus'");
63970#ifdef FREECIV_JSON_CONNECTION
63971 field_addr.name = "tile_bonus";
63972#endif /* FREECIV_JSON_CONNECTION */
63973 {
63974 int i;
63975
63976#ifdef FREECIV_JSON_CONNECTION
63977 /* Enter array. */
63978 field_addr.sub_location = plocation_elem_new(0);
63979#endif /* FREECIV_JSON_CONNECTION */
63980
63981 for (i = 0; i < O_LAST; i++) {
63982#ifdef FREECIV_JSON_CONNECTION
63983 field_addr.sub_location->number = i;
63984#endif /* FREECIV_JSON_CONNECTION */
63985 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_bonus[i])) {
63986 RECEIVE_PACKET_FIELD_ERROR(tile_bonus);
63987 }
63988 }
63989
63990#ifdef FREECIV_JSON_CONNECTION
63991 /* Exit array. */
63992 FC_FREE(field_addr.sub_location);
63993#endif /* FREECIV_JSON_CONNECTION */
63994 }
63995 }
63996 if (BV_ISSET(fields, 9)) {
63997 log_packet_detailed(" got field 'compat'");
63998#ifdef FREECIV_JSON_CONNECTION
63999 field_addr.name = "compat";
64000#endif /* FREECIV_JSON_CONNECTION */
64001 {
64002 int readin;
64003
64004 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
64005 RECEIVE_PACKET_FIELD_ERROR(compat);
64006 }
64007 real_packet->compat = readin;
64008 }
64009 }
64010 if (BV_ISSET(fields, 10)) {
64011 log_packet_detailed(" got field 'integrates'");
64012#ifdef FREECIV_JSON_CONNECTION
64013 field_addr.name = "integrates";
64014#endif /* FREECIV_JSON_CONNECTION */
64015 if (!DIO_BV_GET(&din, &field_addr, real_packet->integrates)) {
64016 RECEIVE_PACKET_FIELD_ERROR(integrates);
64017 }
64018 }
64019 if (BV_ISSET(fields, 11)) {
64020 log_packet_detailed(" got field 'flags'");
64021#ifdef FREECIV_JSON_CONNECTION
64022 field_addr.name = "flags";
64023#endif /* FREECIV_JSON_CONNECTION */
64024 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
64025 RECEIVE_PACKET_FIELD_ERROR(flags);
64026 }
64027 }
64028
64029 if (nullptr == old) {
64030 old = fc_malloc(sizeof(*old));
64031 init_packet_ruleset_road(old);
64032 *old = *real_packet;
64033 genhash_insert(*hash, old, old);
64034 } else {
64035 *old = *real_packet;
64036 }
64037
64038#endif /* FREECIV_DELTA_PROTOCOL */
64039 RECEIVE_PACKET_END(real_packet);
64040#undef FREE_PACKET_STRUCT
64041}
64042
64043 static int send_packet_ruleset_road_100(struct connection *pc, const struct packet_ruleset_road *packet)
64044{
64045 const struct packet_ruleset_road *real_packet = packet;
64046 int e;
64047#ifdef FREECIV_DELTA_PROTOCOL
64048 packet_ruleset_road_100_fields fields;
64049 struct packet_ruleset_road *old;
64050 bool differ;
64051 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ROAD;
64052#endif /* FREECIV_DELTA_PROTOCOL */
64053 SEND_PACKET_START(PACKET_RULESET_ROAD);
64054#ifdef FREECIV_JSON_CONNECTION
64055 struct plocation field_addr;
64056 {
64057 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
64058 field_addr = *field_addr_tmp;
64059 FC_FREE(field_addr_tmp);
64060 }
64061#endif /* FREECIV_JSON_CONNECTION */
64062
64063 log_packet_detailed("packet_ruleset_road_100: sending info about ()");
64064
64065#ifdef FREECIV_DELTA_PROTOCOL
64066 if (nullptr == *hash) {
64067 *hash = genhash_new_full(hash_packet_ruleset_road_100, cmp_packet_ruleset_road_100,
64068 nullptr, nullptr, nullptr, destroy_packet_ruleset_road);
64069 }
64070 BV_CLR_ALL(fields);
64071
64072 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
64073 old = fc_malloc(sizeof(*old));
64074 /* temporary bitcopy just to insert correctly */
64075 *old = *real_packet;
64076 genhash_insert(*hash, old, old);
64077 init_packet_ruleset_road(old);
64078 }
64079 differ = (old->id != real_packet->id);
64080 if (differ) {
64081 BV_SET(fields, 0);
64082 }
64083
64084 differ = (old->gui_type != real_packet->gui_type);
64085 if (differ) {
64086 BV_SET(fields, 1);
64087 }
64088
64089 differ = (old->first_reqs_count != real_packet->first_reqs_count);
64090 if (differ) {
64091 BV_SET(fields, 2);
64092 }
64093
64094 differ = (old->first_reqs_count != real_packet->first_reqs_count);
64095 if (!differ) {
64096 int i;
64097
64098 for (i = 0; i < real_packet->first_reqs_count; i++) {
64099 differ = !are_requirements_equal(&old->first_reqs[i], &real_packet->first_reqs[i]);
64100 if (differ) {
64101 break;
64102 }
64103 }
64104 }
64105 if (differ) {
64106 BV_SET(fields, 3);
64107 }
64108
64109 differ = (old->move_cost != real_packet->move_cost);
64110 if (differ) {
64111 BV_SET(fields, 4);
64112 }
64113
64114 differ = (old->move_mode != real_packet->move_mode);
64115 if (differ) {
64116 BV_SET(fields, 5);
64117 }
64118
64119 differ = FALSE;
64120 {
64121 int i;
64122
64123 for (i = 0; i < O_LAST; i++) {
64124 differ = (old->tile_incr_const[i] != real_packet->tile_incr_const[i]);
64125 if (differ) {
64126 break;
64127 }
64128 }
64129 }
64130 if (differ) {
64131 BV_SET(fields, 6);
64132 }
64133
64134 differ = FALSE;
64135 {
64136 int i;
64137
64138 for (i = 0; i < O_LAST; i++) {
64139 differ = (old->tile_incr[i] != real_packet->tile_incr[i]);
64140 if (differ) {
64141 break;
64142 }
64143 }
64144 }
64145 if (differ) {
64146 BV_SET(fields, 7);
64147 }
64148
64149 differ = FALSE;
64150 {
64151 int i;
64152
64153 for (i = 0; i < O_LAST; i++) {
64154 differ = (old->tile_bonus[i] != real_packet->tile_bonus[i]);
64155 if (differ) {
64156 break;
64157 }
64158 }
64159 }
64160 if (differ) {
64161 BV_SET(fields, 8);
64162 }
64163
64164 differ = (old->compat != real_packet->compat);
64165 if (differ) {
64166 BV_SET(fields, 9);
64167 }
64168
64169 differ = !BV_ARE_EQUAL(old->integrates, real_packet->integrates);
64170 if (differ) {
64171 BV_SET(fields, 10);
64172 }
64173
64174 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
64175 if (differ) {
64176 BV_SET(fields, 11);
64177 }
64178
64179
64180#ifdef FREECIV_JSON_CONNECTION
64181 field_addr.name = "fields";
64182#endif /* FREECIV_JSON_CONNECTION */
64183 e = 0;
64184 e |= DIO_BV_PUT(&dout, &field_addr, fields);
64185 if (e) {
64186 log_packet_detailed("fields bitvector error detected");
64187 }
64188
64189 if (BV_ISSET(fields, 0)) {
64190 log_packet_detailed(" field 'id' has changed");
64191#ifdef FREECIV_JSON_CONNECTION
64192 field_addr.name = "id";
64193#endif /* FREECIV_JSON_CONNECTION */
64194 e = 0;
64195 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
64196 if (e) {
64197 log_packet_detailed("'id' field error detected");
64198 }
64199 }
64200 if (BV_ISSET(fields, 1)) {
64201 log_packet_detailed(" field 'gui_type' has changed");
64202#ifdef FREECIV_JSON_CONNECTION
64203 field_addr.name = "gui_type";
64204#endif /* FREECIV_JSON_CONNECTION */
64205 e = 0;
64206 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
64207 if (e) {
64208 log_packet_detailed("'gui_type' field error detected");
64209 }
64210 }
64211 if (BV_ISSET(fields, 2)) {
64212 log_packet_detailed(" field 'first_reqs_count' has changed");
64213#ifdef FREECIV_JSON_CONNECTION
64214 field_addr.name = "first_reqs_count";
64215#endif /* FREECIV_JSON_CONNECTION */
64216 e = 0;
64217 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->first_reqs_count);
64218 if (e) {
64219 log_packet_detailed("'first_reqs_count' field error detected");
64220 }
64221 }
64222 if (BV_ISSET(fields, 3)) {
64223 log_packet_detailed(" field 'first_reqs' has changed");
64224#ifdef FREECIV_JSON_CONNECTION
64225 field_addr.name = "first_reqs";
64226#endif /* FREECIV_JSON_CONNECTION */
64227 e = 0;
64228 {
64229 int i;
64230
64231#ifdef FREECIV_JSON_CONNECTION
64232 /* Create the array. */
64233 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->first_reqs_count);
64234
64235 /* Enter the array. */
64236 field_addr.sub_location = plocation_elem_new(0);
64237#endif /* FREECIV_JSON_CONNECTION */
64238
64239 for (i = 0; i < real_packet->first_reqs_count; i++) {
64240#ifdef FREECIV_JSON_CONNECTION
64241 /* Next array element. */
64242 field_addr.sub_location->number = i;
64243#endif /* FREECIV_JSON_CONNECTION */
64244 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->first_reqs[i]);
64245 }
64246
64247#ifdef FREECIV_JSON_CONNECTION
64248 /* Exit array. */
64249 FC_FREE(field_addr.sub_location);
64250#endif /* FREECIV_JSON_CONNECTION */
64251 }
64252 if (e) {
64253 log_packet_detailed("'first_reqs' field error detected");
64254 }
64255 }
64256 if (BV_ISSET(fields, 4)) {
64257 log_packet_detailed(" field 'move_cost' has changed");
64258#ifdef FREECIV_JSON_CONNECTION
64259 field_addr.name = "move_cost";
64260#endif /* FREECIV_JSON_CONNECTION */
64261 e = 0;
64262 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->move_cost);
64263 if (e) {
64264 log_packet_detailed("'move_cost' field error detected");
64265 }
64266 }
64267 if (BV_ISSET(fields, 5)) {
64268 log_packet_detailed(" field 'move_mode' has changed");
64269#ifdef FREECIV_JSON_CONNECTION
64270 field_addr.name = "move_mode";
64271#endif /* FREECIV_JSON_CONNECTION */
64272 e = 0;
64273 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->move_mode);
64274 if (e) {
64275 log_packet_detailed("'move_mode' field error detected");
64276 }
64277 }
64278 if (BV_ISSET(fields, 6)) {
64279 log_packet_detailed(" field 'tile_incr_const' has changed");
64280#ifdef FREECIV_JSON_CONNECTION
64281 field_addr.name = "tile_incr_const";
64282#endif /* FREECIV_JSON_CONNECTION */
64283 e = 0;
64284 {
64285 int i;
64286
64287#ifdef FREECIV_JSON_CONNECTION
64288 /* Create the array. */
64289 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
64290
64291 /* Enter the array. */
64292 field_addr.sub_location = plocation_elem_new(0);
64293#endif /* FREECIV_JSON_CONNECTION */
64294
64295 for (i = 0; i < O_LAST; i++) {
64296#ifdef FREECIV_JSON_CONNECTION
64297 /* Next array element. */
64298 field_addr.sub_location->number = i;
64299#endif /* FREECIV_JSON_CONNECTION */
64300 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr_const[i]);
64301 }
64302
64303#ifdef FREECIV_JSON_CONNECTION
64304 /* Exit array. */
64305 FC_FREE(field_addr.sub_location);
64306#endif /* FREECIV_JSON_CONNECTION */
64307 }
64308 if (e) {
64309 log_packet_detailed("'tile_incr_const' field error detected");
64310 }
64311 }
64312 if (BV_ISSET(fields, 7)) {
64313 log_packet_detailed(" field 'tile_incr' has changed");
64314#ifdef FREECIV_JSON_CONNECTION
64315 field_addr.name = "tile_incr";
64316#endif /* FREECIV_JSON_CONNECTION */
64317 e = 0;
64318 {
64319 int i;
64320
64321#ifdef FREECIV_JSON_CONNECTION
64322 /* Create the array. */
64323 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
64324
64325 /* Enter the array. */
64326 field_addr.sub_location = plocation_elem_new(0);
64327#endif /* FREECIV_JSON_CONNECTION */
64328
64329 for (i = 0; i < O_LAST; i++) {
64330#ifdef FREECIV_JSON_CONNECTION
64331 /* Next array element. */
64332 field_addr.sub_location->number = i;
64333#endif /* FREECIV_JSON_CONNECTION */
64334 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr[i]);
64335 }
64336
64337#ifdef FREECIV_JSON_CONNECTION
64338 /* Exit array. */
64339 FC_FREE(field_addr.sub_location);
64340#endif /* FREECIV_JSON_CONNECTION */
64341 }
64342 if (e) {
64343 log_packet_detailed("'tile_incr' field error detected");
64344 }
64345 }
64346 if (BV_ISSET(fields, 8)) {
64347 log_packet_detailed(" field 'tile_bonus' has changed");
64348#ifdef FREECIV_JSON_CONNECTION
64349 field_addr.name = "tile_bonus";
64350#endif /* FREECIV_JSON_CONNECTION */
64351 e = 0;
64352 {
64353 int i;
64354
64355#ifdef FREECIV_JSON_CONNECTION
64356 /* Create the array. */
64357 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
64358
64359 /* Enter the array. */
64360 field_addr.sub_location = plocation_elem_new(0);
64361#endif /* FREECIV_JSON_CONNECTION */
64362
64363 for (i = 0; i < O_LAST; i++) {
64364#ifdef FREECIV_JSON_CONNECTION
64365 /* Next array element. */
64366 field_addr.sub_location->number = i;
64367#endif /* FREECIV_JSON_CONNECTION */
64368 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_bonus[i]);
64369 }
64370
64371#ifdef FREECIV_JSON_CONNECTION
64372 /* Exit array. */
64373 FC_FREE(field_addr.sub_location);
64374#endif /* FREECIV_JSON_CONNECTION */
64375 }
64376 if (e) {
64377 log_packet_detailed("'tile_bonus' field error detected");
64378 }
64379 }
64380 if (BV_ISSET(fields, 9)) {
64381 log_packet_detailed(" field 'compat' has changed");
64382#ifdef FREECIV_JSON_CONNECTION
64383 field_addr.name = "compat";
64384#endif /* FREECIV_JSON_CONNECTION */
64385 e = 0;
64386 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->compat);
64387 if (e) {
64388 log_packet_detailed("'compat' field error detected");
64389 }
64390 }
64391 if (BV_ISSET(fields, 10)) {
64392 log_packet_detailed(" field 'integrates' has changed");
64393#ifdef FREECIV_JSON_CONNECTION
64394 field_addr.name = "integrates";
64395#endif /* FREECIV_JSON_CONNECTION */
64396 e = 0;
64397 e |= DIO_BV_PUT(&dout, &field_addr, packet->integrates);
64398 if (e) {
64399 log_packet_detailed("'integrates' field error detected");
64400 }
64401 }
64402 if (BV_ISSET(fields, 11)) {
64403 log_packet_detailed(" field 'flags' has changed");
64404#ifdef FREECIV_JSON_CONNECTION
64405 field_addr.name = "flags";
64406#endif /* FREECIV_JSON_CONNECTION */
64407 e = 0;
64408 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
64409 if (e) {
64410 log_packet_detailed("'flags' field error detected");
64411 }
64412 }
64413
64414 *old = *real_packet;
64415#endif /* FREECIV_DELTA_PROTOCOL */
64416#ifndef FREECIV_DELTA_PROTOCOL
64417#ifdef FREECIV_JSON_CONNECTION
64418 field_addr.name = "id";
64419#endif /* FREECIV_JSON_CONNECTION */
64420 e = 0;
64421 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
64422 if (e) {
64423 log_packet_detailed("'id' field error detected");
64424 }
64425#ifdef FREECIV_JSON_CONNECTION
64426 field_addr.name = "gui_type";
64427#endif /* FREECIV_JSON_CONNECTION */
64428 e = 0;
64429 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
64430 if (e) {
64431 log_packet_detailed("'gui_type' field error detected");
64432 }
64433#ifdef FREECIV_JSON_CONNECTION
64434 field_addr.name = "first_reqs_count";
64435#endif /* FREECIV_JSON_CONNECTION */
64436 e = 0;
64437 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->first_reqs_count);
64438 if (e) {
64439 log_packet_detailed("'first_reqs_count' field error detected");
64440 }
64441#ifdef FREECIV_JSON_CONNECTION
64442 field_addr.name = "first_reqs";
64443#endif /* FREECIV_JSON_CONNECTION */
64444 e = 0;
64445 {
64446 int i;
64447
64448#ifdef FREECIV_JSON_CONNECTION
64449 /* Create the array. */
64450 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->first_reqs_count);
64451
64452 /* Enter the array. */
64453 field_addr.sub_location = plocation_elem_new(0);
64454#endif /* FREECIV_JSON_CONNECTION */
64455
64456 for (i = 0; i < real_packet->first_reqs_count; i++) {
64457#ifdef FREECIV_JSON_CONNECTION
64458 /* Next array element. */
64459 field_addr.sub_location->number = i;
64460#endif /* FREECIV_JSON_CONNECTION */
64461 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->first_reqs[i]);
64462 }
64463
64464#ifdef FREECIV_JSON_CONNECTION
64465 /* Exit array. */
64466 FC_FREE(field_addr.sub_location);
64467#endif /* FREECIV_JSON_CONNECTION */
64468 }
64469 if (e) {
64470 log_packet_detailed("'first_reqs' field error detected");
64471 }
64472#ifdef FREECIV_JSON_CONNECTION
64473 field_addr.name = "move_cost";
64474#endif /* FREECIV_JSON_CONNECTION */
64475 e = 0;
64476 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->move_cost);
64477 if (e) {
64478 log_packet_detailed("'move_cost' field error detected");
64479 }
64480#ifdef FREECIV_JSON_CONNECTION
64481 field_addr.name = "move_mode";
64482#endif /* FREECIV_JSON_CONNECTION */
64483 e = 0;
64484 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->move_mode);
64485 if (e) {
64486 log_packet_detailed("'move_mode' field error detected");
64487 }
64488#ifdef FREECIV_JSON_CONNECTION
64489 field_addr.name = "tile_incr_const";
64490#endif /* FREECIV_JSON_CONNECTION */
64491 e = 0;
64492 {
64493 int i;
64494
64495#ifdef FREECIV_JSON_CONNECTION
64496 /* Create the array. */
64497 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
64498
64499 /* Enter the array. */
64500 field_addr.sub_location = plocation_elem_new(0);
64501#endif /* FREECIV_JSON_CONNECTION */
64502
64503 for (i = 0; i < O_LAST; i++) {
64504#ifdef FREECIV_JSON_CONNECTION
64505 /* Next array element. */
64506 field_addr.sub_location->number = i;
64507#endif /* FREECIV_JSON_CONNECTION */
64508 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr_const[i]);
64509 }
64510
64511#ifdef FREECIV_JSON_CONNECTION
64512 /* Exit array. */
64513 FC_FREE(field_addr.sub_location);
64514#endif /* FREECIV_JSON_CONNECTION */
64515 }
64516 if (e) {
64517 log_packet_detailed("'tile_incr_const' field error detected");
64518 }
64519#ifdef FREECIV_JSON_CONNECTION
64520 field_addr.name = "tile_incr";
64521#endif /* FREECIV_JSON_CONNECTION */
64522 e = 0;
64523 {
64524 int i;
64525
64526#ifdef FREECIV_JSON_CONNECTION
64527 /* Create the array. */
64528 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
64529
64530 /* Enter the array. */
64531 field_addr.sub_location = plocation_elem_new(0);
64532#endif /* FREECIV_JSON_CONNECTION */
64533
64534 for (i = 0; i < O_LAST; i++) {
64535#ifdef FREECIV_JSON_CONNECTION
64536 /* Next array element. */
64537 field_addr.sub_location->number = i;
64538#endif /* FREECIV_JSON_CONNECTION */
64539 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr[i]);
64540 }
64541
64542#ifdef FREECIV_JSON_CONNECTION
64543 /* Exit array. */
64544 FC_FREE(field_addr.sub_location);
64545#endif /* FREECIV_JSON_CONNECTION */
64546 }
64547 if (e) {
64548 log_packet_detailed("'tile_incr' field error detected");
64549 }
64550#ifdef FREECIV_JSON_CONNECTION
64551 field_addr.name = "tile_bonus";
64552#endif /* FREECIV_JSON_CONNECTION */
64553 e = 0;
64554 {
64555 int i;
64556
64557#ifdef FREECIV_JSON_CONNECTION
64558 /* Create the array. */
64559 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
64560
64561 /* Enter the array. */
64562 field_addr.sub_location = plocation_elem_new(0);
64563#endif /* FREECIV_JSON_CONNECTION */
64564
64565 for (i = 0; i < O_LAST; i++) {
64566#ifdef FREECIV_JSON_CONNECTION
64567 /* Next array element. */
64568 field_addr.sub_location->number = i;
64569#endif /* FREECIV_JSON_CONNECTION */
64570 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_bonus[i]);
64571 }
64572
64573#ifdef FREECIV_JSON_CONNECTION
64574 /* Exit array. */
64575 FC_FREE(field_addr.sub_location);
64576#endif /* FREECIV_JSON_CONNECTION */
64577 }
64578 if (e) {
64579 log_packet_detailed("'tile_bonus' field error detected");
64580 }
64581#ifdef FREECIV_JSON_CONNECTION
64582 field_addr.name = "compat";
64583#endif /* FREECIV_JSON_CONNECTION */
64584 e = 0;
64585 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->compat);
64586 if (e) {
64587 log_packet_detailed("'compat' field error detected");
64588 }
64589#ifdef FREECIV_JSON_CONNECTION
64590 field_addr.name = "integrates";
64591#endif /* FREECIV_JSON_CONNECTION */
64592 e = 0;
64593 e |= DIO_BV_PUT(&dout, &field_addr, packet->integrates);
64594 if (e) {
64595 log_packet_detailed("'integrates' field error detected");
64596 }
64597#ifdef FREECIV_JSON_CONNECTION
64598 field_addr.name = "flags";
64599#endif /* FREECIV_JSON_CONNECTION */
64600 e = 0;
64601 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
64602 if (e) {
64603 log_packet_detailed("'flags' field error detected");
64604 }
64605
64606#endif
64607 SEND_PACKET_END(PACKET_RULESET_ROAD);
64608}
64609
64610 int send_packet_ruleset_road(struct connection *pc, const struct packet_ruleset_road *packet)
64611{
64612 if (!pc->used) {
64613 log_error("WARNING: trying to send data to the closed connection %s",
64614 conn_description(pc));
64615 return -1;
64616 }
64617 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ROAD].packet != nullptr, -1,
64618 "Handler for PACKET_RULESET_ROAD not installed");
64619 return pc->phs.handlers->send[PACKET_RULESET_ROAD].packet(pc, packet);
64620}
64621
64622 void lsend_packet_ruleset_road(struct conn_list *dest, const struct packet_ruleset_road *packet)
64623{
64624 conn_list_iterate(dest, pconn) {
64625 send_packet_ruleset_road(pconn, packet);
64626 } conn_list_iterate_end;
64627}
64628
64629 static inline void init_packet_ruleset_goods(struct packet_ruleset_goods *packet)
64630{
64631 memset(packet, 0, sizeof(*packet));
64632
64633 /* no work needed for packet->id */
64634 /* no work needed for packet->name */
64635 /* no work needed for packet->rule_name */
64636 /* no work needed for packet->reqs_count */
64637 /* no work needed for packet->reqs */
64638 /* no work needed for packet->from_pct */
64639 /* no work needed for packet->to_pct */
64640 /* no work needed for packet->onetime_pct */
64641 /* no work needed for packet->flags */
64642 packet->helptext = strvec_new();
64643}
64644
64645 static inline void free_packet_ruleset_goods(struct packet_ruleset_goods *packet)
64646{
64647 if (packet->helptext) {
64648 strvec_destroy(packet->helptext);
64649 packet->helptext = nullptr;
64650 }
64651 /* no work needed for packet->flags */
64652 /* no work needed for packet->onetime_pct */
64653 /* no work needed for packet->to_pct */
64654 /* no work needed for packet->from_pct */
64655 /* no work needed for packet->reqs */
64656 /* no work needed for packet->reqs_count */
64657 /* no work needed for packet->rule_name */
64658 /* no work needed for packet->name */
64659 /* no work needed for packet->id */
64660}
64661
64662 static inline void destroy_packet_ruleset_goods(void *packet)
64663{
64664 free_packet_ruleset_goods((struct packet_ruleset_goods *) packet);
64665 free(packet);
64666}
64667
64668#ifdef FREECIV_DELTA_PROTOCOL
64669#define hash_packet_ruleset_goods_100 hash_const
64670
64671#define cmp_packet_ruleset_goods_100 cmp_const
64672
64673 BV_DEFINE(packet_ruleset_goods_100_fields, 10);
64674#endif /* FREECIV_DELTA_PROTOCOL */
64675
64676 static struct packet_ruleset_goods *receive_packet_ruleset_goods_100(struct connection *pc)
64677{
64678#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_goods(_packet)
64679#ifdef FREECIV_DELTA_PROTOCOL
64680 packet_ruleset_goods_100_fields fields;
64681 struct packet_ruleset_goods *old;
64682 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOODS;
64683#endif /* FREECIV_DELTA_PROTOCOL */
64684 RECEIVE_PACKET_START(packet_ruleset_goods, real_packet);
64685#ifdef FREECIV_JSON_CONNECTION
64686 struct plocation field_addr;
64687 {
64688 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
64689 field_addr = *field_addr_tmp;
64690 FC_FREE(field_addr_tmp);
64691 }
64692#endif /* FREECIV_JSON_CONNECTION */
64693
64694#ifdef FREECIV_DELTA_PROTOCOL
64695#ifdef FREECIV_JSON_CONNECTION
64696 field_addr.name = "fields";
64697#endif /* FREECIV_JSON_CONNECTION */
64698 DIO_BV_GET(&din, &field_addr, fields);
64699
64700#else /* FREECIV_DELTA_PROTOCOL */
64701#ifdef FREECIV_JSON_CONNECTION
64702 field_addr.name = "id";
64703#endif /* FREECIV_JSON_CONNECTION */
64704 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
64705 RECEIVE_PACKET_FIELD_ERROR(id);
64706 }
64707#ifdef FREECIV_JSON_CONNECTION
64708 field_addr.name = "name";
64709#endif /* FREECIV_JSON_CONNECTION */
64710 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64711 RECEIVE_PACKET_FIELD_ERROR(name);
64712 }
64713#ifdef FREECIV_JSON_CONNECTION
64714 field_addr.name = "rule_name";
64715#endif /* FREECIV_JSON_CONNECTION */
64716 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64717 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64718 }
64719#ifdef FREECIV_JSON_CONNECTION
64720 field_addr.name = "reqs_count";
64721#endif /* FREECIV_JSON_CONNECTION */
64722 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64723 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64724 }
64725#ifdef FREECIV_JSON_CONNECTION
64726 field_addr.name = "reqs";
64727#endif /* FREECIV_JSON_CONNECTION */
64728 {
64729 int i;
64730
64731#ifdef FREECIV_JSON_CONNECTION
64732 /* Enter array. */
64733 field_addr.sub_location = plocation_elem_new(0);
64734#endif /* FREECIV_JSON_CONNECTION */
64735
64736 if (real_packet->reqs_count > MAX_NUM_REQS) {
64737 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64738 }
64739 for (i = 0; i < real_packet->reqs_count; i++) {
64740#ifdef FREECIV_JSON_CONNECTION
64741 field_addr.sub_location->number = i;
64742#endif /* FREECIV_JSON_CONNECTION */
64743 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64744 RECEIVE_PACKET_FIELD_ERROR(reqs);
64745 }
64746 }
64747
64748#ifdef FREECIV_JSON_CONNECTION
64749 /* Exit array. */
64750 FC_FREE(field_addr.sub_location);
64751#endif /* FREECIV_JSON_CONNECTION */
64752 }
64753#ifdef FREECIV_JSON_CONNECTION
64754 field_addr.name = "from_pct";
64755#endif /* FREECIV_JSON_CONNECTION */
64756 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->from_pct)) {
64757 RECEIVE_PACKET_FIELD_ERROR(from_pct);
64758 }
64759#ifdef FREECIV_JSON_CONNECTION
64760 field_addr.name = "to_pct";
64761#endif /* FREECIV_JSON_CONNECTION */
64762 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->to_pct)) {
64763 RECEIVE_PACKET_FIELD_ERROR(to_pct);
64764 }
64765#ifdef FREECIV_JSON_CONNECTION
64766 field_addr.name = "onetime_pct";
64767#endif /* FREECIV_JSON_CONNECTION */
64768 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->onetime_pct)) {
64769 RECEIVE_PACKET_FIELD_ERROR(onetime_pct);
64770 }
64771#ifdef FREECIV_JSON_CONNECTION
64772 field_addr.name = "flags";
64773#endif /* FREECIV_JSON_CONNECTION */
64774 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
64775 RECEIVE_PACKET_FIELD_ERROR(flags);
64776 }
64777#ifdef FREECIV_JSON_CONNECTION
64778 field_addr.name = "helptext";
64779#endif /* FREECIV_JSON_CONNECTION */
64780 {
64781 int i;
64782
64783 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
64784 RECEIVE_PACKET_FIELD_ERROR(helptext);
64785 }
64786 strvec_reserve(real_packet->helptext, i);
64787
64788#ifdef FREECIV_JSON_CONNECTION
64789 field_addr.sub_location = plocation_elem_new(0);
64790#endif /* FREECIV_JSON_CONNECTION */
64791
64792 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
64793 char readin[MAX_LEN_PACKET];
64794
64795#ifdef FREECIV_JSON_CONNECTION
64796 /* Next array element */
64797 field_addr.sub_location->number = i;
64798#endif /* FREECIV_JSON_CONNECTION */
64799
64800 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
64801 || !strvec_set(real_packet->helptext, i, readin)) {
64802 RECEIVE_PACKET_FIELD_ERROR(helptext);
64803 }
64804 }
64805
64806#ifdef FREECIV_JSON_CONNECTION
64807 FC_FREE(field_addr.sub_location);
64808#endif /* FREECIV_JSON_CONNECTION */
64809 }
64810#endif
64811 log_packet_detailed("packet_ruleset_goods_100: got info about ()");
64812
64813#ifdef FREECIV_DELTA_PROTOCOL
64814 if (nullptr == *hash) {
64815 *hash = genhash_new_full(hash_packet_ruleset_goods_100, cmp_packet_ruleset_goods_100,
64816 nullptr, nullptr, nullptr, destroy_packet_ruleset_goods);
64817 }
64818
64819 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
64820 real_packet->id = old->id;
64821 sz_strlcpy(real_packet->name, old->name);
64822 sz_strlcpy(real_packet->rule_name, old->rule_name);
64823 real_packet->reqs_count = old->reqs_count;
64824 {
64825 int i;
64826
64827 for (i = 0; i < old->reqs_count; i++) {
64828 real_packet->reqs[i] = old->reqs[i];
64829 }
64830 }
64831 real_packet->from_pct = old->from_pct;
64832 real_packet->to_pct = old->to_pct;
64833 real_packet->onetime_pct = old->onetime_pct;
64834 real_packet->flags = old->flags;
64835 if (old->helptext) {
64836 strvec_copy(real_packet->helptext, old->helptext);
64837 } else {
64838 strvec_clear(real_packet->helptext);
64839 }
64840 } else {
64841 /* packet is already initialized empty */
64842 log_packet_detailed(" no old info");
64843 }
64844
64845 if (BV_ISSET(fields, 0)) {
64846 log_packet_detailed(" got field 'id'");
64847#ifdef FREECIV_JSON_CONNECTION
64848 field_addr.name = "id";
64849#endif /* FREECIV_JSON_CONNECTION */
64850 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
64851 RECEIVE_PACKET_FIELD_ERROR(id);
64852 }
64853 }
64854 if (BV_ISSET(fields, 1)) {
64855 log_packet_detailed(" got field 'name'");
64856#ifdef FREECIV_JSON_CONNECTION
64857 field_addr.name = "name";
64858#endif /* FREECIV_JSON_CONNECTION */
64859 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64860 RECEIVE_PACKET_FIELD_ERROR(name);
64861 }
64862 }
64863 if (BV_ISSET(fields, 2)) {
64864 log_packet_detailed(" got field 'rule_name'");
64865#ifdef FREECIV_JSON_CONNECTION
64866 field_addr.name = "rule_name";
64867#endif /* FREECIV_JSON_CONNECTION */
64868 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64869 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64870 }
64871 }
64872 if (BV_ISSET(fields, 3)) {
64873 log_packet_detailed(" got field 'reqs_count'");
64874#ifdef FREECIV_JSON_CONNECTION
64875 field_addr.name = "reqs_count";
64876#endif /* FREECIV_JSON_CONNECTION */
64877 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64878 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64879 }
64880 }
64881 if (BV_ISSET(fields, 4)) {
64882 log_packet_detailed(" got field 'reqs'");
64883#ifdef FREECIV_JSON_CONNECTION
64884 field_addr.name = "reqs";
64885#endif /* FREECIV_JSON_CONNECTION */
64886 {
64887 int i;
64888
64889#ifdef FREECIV_JSON_CONNECTION
64890 /* Enter array. */
64891 field_addr.sub_location = plocation_elem_new(0);
64892#endif /* FREECIV_JSON_CONNECTION */
64893
64894 if (real_packet->reqs_count > MAX_NUM_REQS) {
64895 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64896 }
64897 for (i = 0; i < real_packet->reqs_count; i++) {
64898#ifdef FREECIV_JSON_CONNECTION
64899 field_addr.sub_location->number = i;
64900#endif /* FREECIV_JSON_CONNECTION */
64901 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64902 RECEIVE_PACKET_FIELD_ERROR(reqs);
64903 }
64904 }
64905
64906#ifdef FREECIV_JSON_CONNECTION
64907 /* Exit array. */
64908 FC_FREE(field_addr.sub_location);
64909#endif /* FREECIV_JSON_CONNECTION */
64910 }
64911 }
64912 if (BV_ISSET(fields, 5)) {
64913 log_packet_detailed(" got field 'from_pct'");
64914#ifdef FREECIV_JSON_CONNECTION
64915 field_addr.name = "from_pct";
64916#endif /* FREECIV_JSON_CONNECTION */
64917 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->from_pct)) {
64918 RECEIVE_PACKET_FIELD_ERROR(from_pct);
64919 }
64920 }
64921 if (BV_ISSET(fields, 6)) {
64922 log_packet_detailed(" got field 'to_pct'");
64923#ifdef FREECIV_JSON_CONNECTION
64924 field_addr.name = "to_pct";
64925#endif /* FREECIV_JSON_CONNECTION */
64926 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->to_pct)) {
64927 RECEIVE_PACKET_FIELD_ERROR(to_pct);
64928 }
64929 }
64930 if (BV_ISSET(fields, 7)) {
64931 log_packet_detailed(" got field 'onetime_pct'");
64932#ifdef FREECIV_JSON_CONNECTION
64933 field_addr.name = "onetime_pct";
64934#endif /* FREECIV_JSON_CONNECTION */
64935 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->onetime_pct)) {
64936 RECEIVE_PACKET_FIELD_ERROR(onetime_pct);
64937 }
64938 }
64939 if (BV_ISSET(fields, 8)) {
64940 log_packet_detailed(" got field 'flags'");
64941#ifdef FREECIV_JSON_CONNECTION
64942 field_addr.name = "flags";
64943#endif /* FREECIV_JSON_CONNECTION */
64944 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
64945 RECEIVE_PACKET_FIELD_ERROR(flags);
64946 }
64947 }
64948 if (BV_ISSET(fields, 9)) {
64949 log_packet_detailed(" got field 'helptext'");
64950#ifdef FREECIV_JSON_CONNECTION
64951 field_addr.name = "helptext";
64952#endif /* FREECIV_JSON_CONNECTION */
64953 {
64954 int i;
64955
64956 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
64957 RECEIVE_PACKET_FIELD_ERROR(helptext);
64958 }
64959 strvec_reserve(real_packet->helptext, i);
64960
64961#ifdef FREECIV_JSON_CONNECTION
64962 field_addr.sub_location = plocation_elem_new(0);
64963#endif /* FREECIV_JSON_CONNECTION */
64964
64965 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
64966 char readin[MAX_LEN_PACKET];
64967
64968#ifdef FREECIV_JSON_CONNECTION
64969 /* Next array element */
64970 field_addr.sub_location->number = i;
64971#endif /* FREECIV_JSON_CONNECTION */
64972
64973 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
64974 || !strvec_set(real_packet->helptext, i, readin)) {
64975 RECEIVE_PACKET_FIELD_ERROR(helptext);
64976 }
64977 }
64978
64979#ifdef FREECIV_JSON_CONNECTION
64980 FC_FREE(field_addr.sub_location);
64981#endif /* FREECIV_JSON_CONNECTION */
64982 }
64983 }
64984
64985 if (nullptr == old) {
64986 old = fc_malloc(sizeof(*old));
64987 init_packet_ruleset_goods(old);
64988 old->id = real_packet->id;
64989 sz_strlcpy(old->name, real_packet->name);
64990 sz_strlcpy(old->rule_name, real_packet->rule_name);
64991 old->reqs_count = real_packet->reqs_count;
64992 {
64993 int i;
64994
64995 for (i = 0; i < real_packet->reqs_count; i++) {
64996 old->reqs[i] = real_packet->reqs[i];
64997 }
64998 }
64999 old->from_pct = real_packet->from_pct;
65000 old->to_pct = real_packet->to_pct;
65001 old->onetime_pct = real_packet->onetime_pct;
65002 old->flags = real_packet->flags;
65003 if (real_packet->helptext) {
65004 strvec_copy(old->helptext, real_packet->helptext);
65005 } else {
65006 strvec_clear(old->helptext);
65007 }
65008 genhash_insert(*hash, old, old);
65009 } else {
65010 old->id = real_packet->id;
65011 sz_strlcpy(old->name, real_packet->name);
65012 sz_strlcpy(old->rule_name, real_packet->rule_name);
65013 old->reqs_count = real_packet->reqs_count;
65014 {
65015 int i;
65016
65017 for (i = 0; i < real_packet->reqs_count; i++) {
65018 old->reqs[i] = real_packet->reqs[i];
65019 }
65020 }
65021 old->from_pct = real_packet->from_pct;
65022 old->to_pct = real_packet->to_pct;
65023 old->onetime_pct = real_packet->onetime_pct;
65024 old->flags = real_packet->flags;
65025 if (real_packet->helptext) {
65026 strvec_copy(old->helptext, real_packet->helptext);
65027 } else {
65028 strvec_clear(old->helptext);
65029 }
65030 }
65031
65032#endif /* FREECIV_DELTA_PROTOCOL */
65033 RECEIVE_PACKET_END(real_packet);
65034#undef FREE_PACKET_STRUCT
65035}
65036
65037 static int send_packet_ruleset_goods_100(struct connection *pc, const struct packet_ruleset_goods *packet)
65038{
65039 const struct packet_ruleset_goods *real_packet = packet;
65040 int e;
65041#ifdef FREECIV_DELTA_PROTOCOL
65042 packet_ruleset_goods_100_fields fields;
65043 struct packet_ruleset_goods *old;
65044 bool differ;
65045 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOODS;
65046#endif /* FREECIV_DELTA_PROTOCOL */
65047 SEND_PACKET_START(PACKET_RULESET_GOODS);
65048#ifdef FREECIV_JSON_CONNECTION
65049 struct plocation field_addr;
65050 {
65051 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
65052 field_addr = *field_addr_tmp;
65053 FC_FREE(field_addr_tmp);
65054 }
65055#endif /* FREECIV_JSON_CONNECTION */
65056
65057 log_packet_detailed("packet_ruleset_goods_100: sending info about ()");
65058
65059#ifdef FREECIV_DELTA_PROTOCOL
65060 if (nullptr == *hash) {
65061 *hash = genhash_new_full(hash_packet_ruleset_goods_100, cmp_packet_ruleset_goods_100,
65062 nullptr, nullptr, nullptr, destroy_packet_ruleset_goods);
65063 }
65064 BV_CLR_ALL(fields);
65065
65066 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
65067 old = fc_malloc(sizeof(*old));
65068 /* temporary bitcopy just to insert correctly */
65069 *old = *real_packet;
65070 genhash_insert(*hash, old, old);
65071 init_packet_ruleset_goods(old);
65072 }
65073 differ = (old->id != real_packet->id);
65074 if (differ) {
65075 BV_SET(fields, 0);
65076 }
65077
65078 differ = (strcmp(old->name, real_packet->name) != 0);
65079 if (differ) {
65080 BV_SET(fields, 1);
65081 }
65082
65083 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
65084 if (differ) {
65085 BV_SET(fields, 2);
65086 }
65087
65088 differ = (old->reqs_count != real_packet->reqs_count);
65089 if (differ) {
65090 BV_SET(fields, 3);
65091 }
65092
65093 differ = (old->reqs_count != real_packet->reqs_count);
65094 if (!differ) {
65095 int i;
65096
65097 for (i = 0; i < real_packet->reqs_count; i++) {
65098 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
65099 if (differ) {
65100 break;
65101 }
65102 }
65103 }
65104 if (differ) {
65105 BV_SET(fields, 4);
65106 }
65107
65108 differ = (old->from_pct != real_packet->from_pct);
65109 if (differ) {
65110 BV_SET(fields, 5);
65111 }
65112
65113 differ = (old->to_pct != real_packet->to_pct);
65114 if (differ) {
65115 BV_SET(fields, 6);
65116 }
65117
65118 differ = (old->onetime_pct != real_packet->onetime_pct);
65119 if (differ) {
65120 BV_SET(fields, 7);
65121 }
65122
65123 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
65124 if (differ) {
65125 BV_SET(fields, 8);
65126 }
65127
65128 if (real_packet->helptext) {
65129 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
65130 } else {
65131 differ = (strvec_size(old->helptext) > 0);
65132 }
65133 if (differ) {
65134 BV_SET(fields, 9);
65135 }
65136
65137
65138#ifdef FREECIV_JSON_CONNECTION
65139 field_addr.name = "fields";
65140#endif /* FREECIV_JSON_CONNECTION */
65141 e = 0;
65142 e |= DIO_BV_PUT(&dout, &field_addr, fields);
65143 if (e) {
65144 log_packet_detailed("fields bitvector error detected");
65145 }
65146
65147 if (BV_ISSET(fields, 0)) {
65148 log_packet_detailed(" field 'id' has changed");
65149#ifdef FREECIV_JSON_CONNECTION
65150 field_addr.name = "id";
65151#endif /* FREECIV_JSON_CONNECTION */
65152 e = 0;
65153 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65154 if (e) {
65155 log_packet_detailed("'id' field error detected");
65156 }
65157 }
65158 if (BV_ISSET(fields, 1)) {
65159 log_packet_detailed(" field 'name' has changed");
65160#ifdef FREECIV_JSON_CONNECTION
65161 field_addr.name = "name";
65162#endif /* FREECIV_JSON_CONNECTION */
65163 e = 0;
65164 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
65165 if (e) {
65166 log_packet_detailed("'name' field error detected");
65167 }
65168 }
65169 if (BV_ISSET(fields, 2)) {
65170 log_packet_detailed(" field 'rule_name' has changed");
65171#ifdef FREECIV_JSON_CONNECTION
65172 field_addr.name = "rule_name";
65173#endif /* FREECIV_JSON_CONNECTION */
65174 e = 0;
65175 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65176 if (e) {
65177 log_packet_detailed("'rule_name' field error detected");
65178 }
65179 }
65180 if (BV_ISSET(fields, 3)) {
65181 log_packet_detailed(" field 'reqs_count' has changed");
65182#ifdef FREECIV_JSON_CONNECTION
65183 field_addr.name = "reqs_count";
65184#endif /* FREECIV_JSON_CONNECTION */
65185 e = 0;
65186 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65187 if (e) {
65188 log_packet_detailed("'reqs_count' field error detected");
65189 }
65190 }
65191 if (BV_ISSET(fields, 4)) {
65192 log_packet_detailed(" field 'reqs' has changed");
65193#ifdef FREECIV_JSON_CONNECTION
65194 field_addr.name = "reqs";
65195#endif /* FREECIV_JSON_CONNECTION */
65196 e = 0;
65197 {
65198 int i;
65199
65200#ifdef FREECIV_JSON_CONNECTION
65201 /* Create the array. */
65202 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65203
65204 /* Enter the array. */
65205 field_addr.sub_location = plocation_elem_new(0);
65206#endif /* FREECIV_JSON_CONNECTION */
65207
65208 for (i = 0; i < real_packet->reqs_count; i++) {
65209#ifdef FREECIV_JSON_CONNECTION
65210 /* Next array element. */
65211 field_addr.sub_location->number = i;
65212#endif /* FREECIV_JSON_CONNECTION */
65213 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65214 }
65215
65216#ifdef FREECIV_JSON_CONNECTION
65217 /* Exit array. */
65218 FC_FREE(field_addr.sub_location);
65219#endif /* FREECIV_JSON_CONNECTION */
65220 }
65221 if (e) {
65222 log_packet_detailed("'reqs' field error detected");
65223 }
65224 }
65225 if (BV_ISSET(fields, 5)) {
65226 log_packet_detailed(" field 'from_pct' has changed");
65227#ifdef FREECIV_JSON_CONNECTION
65228 field_addr.name = "from_pct";
65229#endif /* FREECIV_JSON_CONNECTION */
65230 e = 0;
65231 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->from_pct);
65232 if (e) {
65233 log_packet_detailed("'from_pct' field error detected");
65234 }
65235 }
65236 if (BV_ISSET(fields, 6)) {
65237 log_packet_detailed(" field 'to_pct' has changed");
65238#ifdef FREECIV_JSON_CONNECTION
65239 field_addr.name = "to_pct";
65240#endif /* FREECIV_JSON_CONNECTION */
65241 e = 0;
65242 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->to_pct);
65243 if (e) {
65244 log_packet_detailed("'to_pct' field error detected");
65245 }
65246 }
65247 if (BV_ISSET(fields, 7)) {
65248 log_packet_detailed(" field 'onetime_pct' has changed");
65249#ifdef FREECIV_JSON_CONNECTION
65250 field_addr.name = "onetime_pct";
65251#endif /* FREECIV_JSON_CONNECTION */
65252 e = 0;
65253 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->onetime_pct);
65254 if (e) {
65255 log_packet_detailed("'onetime_pct' field error detected");
65256 }
65257 }
65258 if (BV_ISSET(fields, 8)) {
65259 log_packet_detailed(" field 'flags' has changed");
65260#ifdef FREECIV_JSON_CONNECTION
65261 field_addr.name = "flags";
65262#endif /* FREECIV_JSON_CONNECTION */
65263 e = 0;
65264 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
65265 if (e) {
65266 log_packet_detailed("'flags' field error detected");
65267 }
65268 }
65269 if (BV_ISSET(fields, 9)) {
65270 log_packet_detailed(" field 'helptext' has changed");
65271#ifdef FREECIV_JSON_CONNECTION
65272 field_addr.name = "helptext";
65273#endif /* FREECIV_JSON_CONNECTION */
65274 e = 0;
65275 if (!real_packet->helptext) {
65276 /* Transmit null vector as empty vector */
65277 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
65278 } else {
65279 int i;
65280
65281 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
65282 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
65283
65284#ifdef FREECIV_JSON_CONNECTION
65285 field_addr.sub_location = plocation_elem_new(0);
65286#endif /* FREECIV_JSON_CONNECTION */
65287
65288 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
65289 const char *pstr = strvec_get(real_packet->helptext, i);
65290
65291 if (!pstr) {
65292 /* Transmit null strings as empty strings */
65293 pstr = "";
65294 }
65295
65296#ifdef FREECIV_JSON_CONNECTION
65297 /* Next array element */
65298 field_addr.sub_location->number = i;
65299#endif /* FREECIV_JSON_CONNECTION */
65300
65301 e |= DIO_PUT(string, &dout, &field_addr, pstr);
65302 }
65303
65304#ifdef FREECIV_JSON_CONNECTION
65305 FC_FREE(field_addr.sub_location);
65306#endif /* FREECIV_JSON_CONNECTION */
65307 }
65308 if (e) {
65309 log_packet_detailed("'helptext' field error detected");
65310 }
65311 }
65312
65313 old->id = real_packet->id;
65314 sz_strlcpy(old->name, real_packet->name);
65315 sz_strlcpy(old->rule_name, real_packet->rule_name);
65316 old->reqs_count = real_packet->reqs_count;
65317 {
65318 int i;
65319
65320 for (i = 0; i < real_packet->reqs_count; i++) {
65321 old->reqs[i] = real_packet->reqs[i];
65322 }
65323 }
65324 old->from_pct = real_packet->from_pct;
65325 old->to_pct = real_packet->to_pct;
65326 old->onetime_pct = real_packet->onetime_pct;
65327 old->flags = real_packet->flags;
65328 if (real_packet->helptext) {
65329 strvec_copy(old->helptext, real_packet->helptext);
65330 } else {
65331 strvec_clear(old->helptext);
65332 }
65333#endif /* FREECIV_DELTA_PROTOCOL */
65334#ifndef FREECIV_DELTA_PROTOCOL
65335#ifdef FREECIV_JSON_CONNECTION
65336 field_addr.name = "id";
65337#endif /* FREECIV_JSON_CONNECTION */
65338 e = 0;
65339 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65340 if (e) {
65341 log_packet_detailed("'id' field error detected");
65342 }
65343#ifdef FREECIV_JSON_CONNECTION
65344 field_addr.name = "name";
65345#endif /* FREECIV_JSON_CONNECTION */
65346 e = 0;
65347 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
65348 if (e) {
65349 log_packet_detailed("'name' field error detected");
65350 }
65351#ifdef FREECIV_JSON_CONNECTION
65352 field_addr.name = "rule_name";
65353#endif /* FREECIV_JSON_CONNECTION */
65354 e = 0;
65355 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65356 if (e) {
65357 log_packet_detailed("'rule_name' field error detected");
65358 }
65359#ifdef FREECIV_JSON_CONNECTION
65360 field_addr.name = "reqs_count";
65361#endif /* FREECIV_JSON_CONNECTION */
65362 e = 0;
65363 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65364 if (e) {
65365 log_packet_detailed("'reqs_count' field error detected");
65366 }
65367#ifdef FREECIV_JSON_CONNECTION
65368 field_addr.name = "reqs";
65369#endif /* FREECIV_JSON_CONNECTION */
65370 e = 0;
65371 {
65372 int i;
65373
65374#ifdef FREECIV_JSON_CONNECTION
65375 /* Create the array. */
65376 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65377
65378 /* Enter the array. */
65379 field_addr.sub_location = plocation_elem_new(0);
65380#endif /* FREECIV_JSON_CONNECTION */
65381
65382 for (i = 0; i < real_packet->reqs_count; i++) {
65383#ifdef FREECIV_JSON_CONNECTION
65384 /* Next array element. */
65385 field_addr.sub_location->number = i;
65386#endif /* FREECIV_JSON_CONNECTION */
65387 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65388 }
65389
65390#ifdef FREECIV_JSON_CONNECTION
65391 /* Exit array. */
65392 FC_FREE(field_addr.sub_location);
65393#endif /* FREECIV_JSON_CONNECTION */
65394 }
65395 if (e) {
65396 log_packet_detailed("'reqs' field error detected");
65397 }
65398#ifdef FREECIV_JSON_CONNECTION
65399 field_addr.name = "from_pct";
65400#endif /* FREECIV_JSON_CONNECTION */
65401 e = 0;
65402 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->from_pct);
65403 if (e) {
65404 log_packet_detailed("'from_pct' field error detected");
65405 }
65406#ifdef FREECIV_JSON_CONNECTION
65407 field_addr.name = "to_pct";
65408#endif /* FREECIV_JSON_CONNECTION */
65409 e = 0;
65410 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->to_pct);
65411 if (e) {
65412 log_packet_detailed("'to_pct' field error detected");
65413 }
65414#ifdef FREECIV_JSON_CONNECTION
65415 field_addr.name = "onetime_pct";
65416#endif /* FREECIV_JSON_CONNECTION */
65417 e = 0;
65418 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->onetime_pct);
65419 if (e) {
65420 log_packet_detailed("'onetime_pct' field error detected");
65421 }
65422#ifdef FREECIV_JSON_CONNECTION
65423 field_addr.name = "flags";
65424#endif /* FREECIV_JSON_CONNECTION */
65425 e = 0;
65426 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
65427 if (e) {
65428 log_packet_detailed("'flags' field error detected");
65429 }
65430#ifdef FREECIV_JSON_CONNECTION
65431 field_addr.name = "helptext";
65432#endif /* FREECIV_JSON_CONNECTION */
65433 e = 0;
65434 if (!real_packet->helptext) {
65435 /* Transmit null vector as empty vector */
65436 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
65437 } else {
65438 int i;
65439
65440 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
65441 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
65442
65443#ifdef FREECIV_JSON_CONNECTION
65444 field_addr.sub_location = plocation_elem_new(0);
65445#endif /* FREECIV_JSON_CONNECTION */
65446
65447 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
65448 const char *pstr = strvec_get(real_packet->helptext, i);
65449
65450 if (!pstr) {
65451 /* Transmit null strings as empty strings */
65452 pstr = "";
65453 }
65454
65455#ifdef FREECIV_JSON_CONNECTION
65456 /* Next array element */
65457 field_addr.sub_location->number = i;
65458#endif /* FREECIV_JSON_CONNECTION */
65459
65460 e |= DIO_PUT(string, &dout, &field_addr, pstr);
65461 }
65462
65463#ifdef FREECIV_JSON_CONNECTION
65464 FC_FREE(field_addr.sub_location);
65465#endif /* FREECIV_JSON_CONNECTION */
65466 }
65467 if (e) {
65468 log_packet_detailed("'helptext' field error detected");
65469 }
65470
65471#endif
65472 SEND_PACKET_END(PACKET_RULESET_GOODS);
65473}
65474
65475 int send_packet_ruleset_goods(struct connection *pc, const struct packet_ruleset_goods *packet)
65476{
65477 if (!pc->used) {
65478 log_error("WARNING: trying to send data to the closed connection %s",
65479 conn_description(pc));
65480 return -1;
65481 }
65482 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOODS].packet != nullptr, -1,
65483 "Handler for PACKET_RULESET_GOODS not installed");
65484 return pc->phs.handlers->send[PACKET_RULESET_GOODS].packet(pc, packet);
65485}
65486
65487 void lsend_packet_ruleset_goods(struct conn_list *dest, const struct packet_ruleset_goods *packet)
65488{
65489 conn_list_iterate(dest, pconn) {
65490 send_packet_ruleset_goods(pconn, packet);
65491 } conn_list_iterate_end;
65492}
65493
65494 static inline void init_packet_ruleset_disaster(struct packet_ruleset_disaster *packet)
65495{
65496 memset(packet, 0, sizeof(*packet));
65497}
65498
65499#define free_packet_ruleset_disaster(_packet) (void) 0
65500#define destroy_packet_ruleset_disaster free
65501
65502#ifdef FREECIV_DELTA_PROTOCOL
65503#define hash_packet_ruleset_disaster_100 hash_const
65504
65505#define cmp_packet_ruleset_disaster_100 cmp_const
65506
65507 BV_DEFINE(packet_ruleset_disaster_100_fields, 7);
65508#endif /* FREECIV_DELTA_PROTOCOL */
65509
65510 static struct packet_ruleset_disaster *receive_packet_ruleset_disaster_100(struct connection *pc)
65511{
65512#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_disaster(_packet)
65513#ifdef FREECIV_DELTA_PROTOCOL
65514 packet_ruleset_disaster_100_fields fields;
65515 struct packet_ruleset_disaster *old;
65516 struct genhash **hash = pc->phs.received + PACKET_RULESET_DISASTER;
65517#endif /* FREECIV_DELTA_PROTOCOL */
65518 RECEIVE_PACKET_START(packet_ruleset_disaster, real_packet);
65519#ifdef FREECIV_JSON_CONNECTION
65520 struct plocation field_addr;
65521 {
65522 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
65523 field_addr = *field_addr_tmp;
65524 FC_FREE(field_addr_tmp);
65525 }
65526#endif /* FREECIV_JSON_CONNECTION */
65527
65528#ifdef FREECIV_DELTA_PROTOCOL
65529#ifdef FREECIV_JSON_CONNECTION
65530 field_addr.name = "fields";
65531#endif /* FREECIV_JSON_CONNECTION */
65532 DIO_BV_GET(&din, &field_addr, fields);
65533
65534#else /* FREECIV_DELTA_PROTOCOL */
65535#ifdef FREECIV_JSON_CONNECTION
65536 field_addr.name = "id";
65537#endif /* FREECIV_JSON_CONNECTION */
65538 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
65539 RECEIVE_PACKET_FIELD_ERROR(id);
65540 }
65541#ifdef FREECIV_JSON_CONNECTION
65542 field_addr.name = "name";
65543#endif /* FREECIV_JSON_CONNECTION */
65544 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
65545 RECEIVE_PACKET_FIELD_ERROR(name);
65546 }
65547#ifdef FREECIV_JSON_CONNECTION
65548 field_addr.name = "rule_name";
65549#endif /* FREECIV_JSON_CONNECTION */
65550 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
65551 RECEIVE_PACKET_FIELD_ERROR(rule_name);
65552 }
65553#ifdef FREECIV_JSON_CONNECTION
65554 field_addr.name = "reqs_count";
65555#endif /* FREECIV_JSON_CONNECTION */
65556 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
65557 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
65558 }
65559#ifdef FREECIV_JSON_CONNECTION
65560 field_addr.name = "reqs";
65561#endif /* FREECIV_JSON_CONNECTION */
65562 {
65563 int i;
65564
65565#ifdef FREECIV_JSON_CONNECTION
65566 /* Enter array. */
65567 field_addr.sub_location = plocation_elem_new(0);
65568#endif /* FREECIV_JSON_CONNECTION */
65569
65570 if (real_packet->reqs_count > MAX_NUM_REQS) {
65571 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
65572 }
65573 for (i = 0; i < real_packet->reqs_count; i++) {
65574#ifdef FREECIV_JSON_CONNECTION
65575 field_addr.sub_location->number = i;
65576#endif /* FREECIV_JSON_CONNECTION */
65577 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
65578 RECEIVE_PACKET_FIELD_ERROR(reqs);
65579 }
65580 }
65581
65582#ifdef FREECIV_JSON_CONNECTION
65583 /* Exit array. */
65584 FC_FREE(field_addr.sub_location);
65585#endif /* FREECIV_JSON_CONNECTION */
65586 }
65587#ifdef FREECIV_JSON_CONNECTION
65588 field_addr.name = "frequency";
65589#endif /* FREECIV_JSON_CONNECTION */
65590 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->frequency)) {
65591 RECEIVE_PACKET_FIELD_ERROR(frequency);
65592 }
65593#ifdef FREECIV_JSON_CONNECTION
65594 field_addr.name = "effects";
65595#endif /* FREECIV_JSON_CONNECTION */
65596 if (!DIO_BV_GET(&din, &field_addr, real_packet->effects)) {
65597 RECEIVE_PACKET_FIELD_ERROR(effects);
65598 }
65599#endif
65600 log_packet_detailed("packet_ruleset_disaster_100: got info about ()");
65601
65602#ifdef FREECIV_DELTA_PROTOCOL
65603 if (nullptr == *hash) {
65604 *hash = genhash_new_full(hash_packet_ruleset_disaster_100, cmp_packet_ruleset_disaster_100,
65605 nullptr, nullptr, nullptr, destroy_packet_ruleset_disaster);
65606 }
65607
65608 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
65609 *real_packet = *old;
65610 } else {
65611 /* packet is already initialized empty */
65612 log_packet_detailed(" no old info");
65613 }
65614
65615 if (BV_ISSET(fields, 0)) {
65616 log_packet_detailed(" got field 'id'");
65617#ifdef FREECIV_JSON_CONNECTION
65618 field_addr.name = "id";
65619#endif /* FREECIV_JSON_CONNECTION */
65620 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
65621 RECEIVE_PACKET_FIELD_ERROR(id);
65622 }
65623 }
65624 if (BV_ISSET(fields, 1)) {
65625 log_packet_detailed(" got field 'name'");
65626#ifdef FREECIV_JSON_CONNECTION
65627 field_addr.name = "name";
65628#endif /* FREECIV_JSON_CONNECTION */
65629 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
65630 RECEIVE_PACKET_FIELD_ERROR(name);
65631 }
65632 }
65633 if (BV_ISSET(fields, 2)) {
65634 log_packet_detailed(" got field 'rule_name'");
65635#ifdef FREECIV_JSON_CONNECTION
65636 field_addr.name = "rule_name";
65637#endif /* FREECIV_JSON_CONNECTION */
65638 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
65639 RECEIVE_PACKET_FIELD_ERROR(rule_name);
65640 }
65641 }
65642 if (BV_ISSET(fields, 3)) {
65643 log_packet_detailed(" got field 'reqs_count'");
65644#ifdef FREECIV_JSON_CONNECTION
65645 field_addr.name = "reqs_count";
65646#endif /* FREECIV_JSON_CONNECTION */
65647 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
65648 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
65649 }
65650 }
65651 if (BV_ISSET(fields, 4)) {
65652 log_packet_detailed(" got field 'reqs'");
65653#ifdef FREECIV_JSON_CONNECTION
65654 field_addr.name = "reqs";
65655#endif /* FREECIV_JSON_CONNECTION */
65656 {
65657 int i;
65658
65659#ifdef FREECIV_JSON_CONNECTION
65660 /* Enter array. */
65661 field_addr.sub_location = plocation_elem_new(0);
65662#endif /* FREECIV_JSON_CONNECTION */
65663
65664 if (real_packet->reqs_count > MAX_NUM_REQS) {
65665 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
65666 }
65667 for (i = 0; i < real_packet->reqs_count; i++) {
65668#ifdef FREECIV_JSON_CONNECTION
65669 field_addr.sub_location->number = i;
65670#endif /* FREECIV_JSON_CONNECTION */
65671 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
65672 RECEIVE_PACKET_FIELD_ERROR(reqs);
65673 }
65674 }
65675
65676#ifdef FREECIV_JSON_CONNECTION
65677 /* Exit array. */
65678 FC_FREE(field_addr.sub_location);
65679#endif /* FREECIV_JSON_CONNECTION */
65680 }
65681 }
65682 if (BV_ISSET(fields, 5)) {
65683 log_packet_detailed(" got field 'frequency'");
65684#ifdef FREECIV_JSON_CONNECTION
65685 field_addr.name = "frequency";
65686#endif /* FREECIV_JSON_CONNECTION */
65687 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->frequency)) {
65688 RECEIVE_PACKET_FIELD_ERROR(frequency);
65689 }
65690 }
65691 if (BV_ISSET(fields, 6)) {
65692 log_packet_detailed(" got field 'effects'");
65693#ifdef FREECIV_JSON_CONNECTION
65694 field_addr.name = "effects";
65695#endif /* FREECIV_JSON_CONNECTION */
65696 if (!DIO_BV_GET(&din, &field_addr, real_packet->effects)) {
65697 RECEIVE_PACKET_FIELD_ERROR(effects);
65698 }
65699 }
65700
65701 if (nullptr == old) {
65702 old = fc_malloc(sizeof(*old));
65703 init_packet_ruleset_disaster(old);
65704 *old = *real_packet;
65705 genhash_insert(*hash, old, old);
65706 } else {
65707 *old = *real_packet;
65708 }
65709
65710#endif /* FREECIV_DELTA_PROTOCOL */
65711 RECEIVE_PACKET_END(real_packet);
65712#undef FREE_PACKET_STRUCT
65713}
65714
65715 static int send_packet_ruleset_disaster_100(struct connection *pc, const struct packet_ruleset_disaster *packet)
65716{
65717 const struct packet_ruleset_disaster *real_packet = packet;
65718 int e;
65719#ifdef FREECIV_DELTA_PROTOCOL
65720 packet_ruleset_disaster_100_fields fields;
65721 struct packet_ruleset_disaster *old;
65722 bool differ;
65723 struct genhash **hash = pc->phs.sent + PACKET_RULESET_DISASTER;
65724#endif /* FREECIV_DELTA_PROTOCOL */
65725 SEND_PACKET_START(PACKET_RULESET_DISASTER);
65726#ifdef FREECIV_JSON_CONNECTION
65727 struct plocation field_addr;
65728 {
65729 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
65730 field_addr = *field_addr_tmp;
65731 FC_FREE(field_addr_tmp);
65732 }
65733#endif /* FREECIV_JSON_CONNECTION */
65734
65735 log_packet_detailed("packet_ruleset_disaster_100: sending info about ()");
65736
65737#ifdef FREECIV_DELTA_PROTOCOL
65738 if (nullptr == *hash) {
65739 *hash = genhash_new_full(hash_packet_ruleset_disaster_100, cmp_packet_ruleset_disaster_100,
65740 nullptr, nullptr, nullptr, destroy_packet_ruleset_disaster);
65741 }
65742 BV_CLR_ALL(fields);
65743
65744 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
65745 old = fc_malloc(sizeof(*old));
65746 /* temporary bitcopy just to insert correctly */
65747 *old = *real_packet;
65748 genhash_insert(*hash, old, old);
65749 init_packet_ruleset_disaster(old);
65750 }
65751 differ = (old->id != real_packet->id);
65752 if (differ) {
65753 BV_SET(fields, 0);
65754 }
65755
65756 differ = (strcmp(old->name, real_packet->name) != 0);
65757 if (differ) {
65758 BV_SET(fields, 1);
65759 }
65760
65761 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
65762 if (differ) {
65763 BV_SET(fields, 2);
65764 }
65765
65766 differ = (old->reqs_count != real_packet->reqs_count);
65767 if (differ) {
65768 BV_SET(fields, 3);
65769 }
65770
65771 differ = (old->reqs_count != real_packet->reqs_count);
65772 if (!differ) {
65773 int i;
65774
65775 for (i = 0; i < real_packet->reqs_count; i++) {
65776 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
65777 if (differ) {
65778 break;
65779 }
65780 }
65781 }
65782 if (differ) {
65783 BV_SET(fields, 4);
65784 }
65785
65786 differ = (old->frequency != real_packet->frequency);
65787 if (differ) {
65788 BV_SET(fields, 5);
65789 }
65790
65791 differ = !BV_ARE_EQUAL(old->effects, real_packet->effects);
65792 if (differ) {
65793 BV_SET(fields, 6);
65794 }
65795
65796
65797#ifdef FREECIV_JSON_CONNECTION
65798 field_addr.name = "fields";
65799#endif /* FREECIV_JSON_CONNECTION */
65800 e = 0;
65801 e |= DIO_BV_PUT(&dout, &field_addr, fields);
65802 if (e) {
65803 log_packet_detailed("fields bitvector error detected");
65804 }
65805
65806 if (BV_ISSET(fields, 0)) {
65807 log_packet_detailed(" field 'id' has changed");
65808#ifdef FREECIV_JSON_CONNECTION
65809 field_addr.name = "id";
65810#endif /* FREECIV_JSON_CONNECTION */
65811 e = 0;
65812 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65813 if (e) {
65814 log_packet_detailed("'id' field error detected");
65815 }
65816 }
65817 if (BV_ISSET(fields, 1)) {
65818 log_packet_detailed(" field 'name' has changed");
65819#ifdef FREECIV_JSON_CONNECTION
65820 field_addr.name = "name";
65821#endif /* FREECIV_JSON_CONNECTION */
65822 e = 0;
65823 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
65824 if (e) {
65825 log_packet_detailed("'name' field error detected");
65826 }
65827 }
65828 if (BV_ISSET(fields, 2)) {
65829 log_packet_detailed(" field 'rule_name' has changed");
65830#ifdef FREECIV_JSON_CONNECTION
65831 field_addr.name = "rule_name";
65832#endif /* FREECIV_JSON_CONNECTION */
65833 e = 0;
65834 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65835 if (e) {
65836 log_packet_detailed("'rule_name' field error detected");
65837 }
65838 }
65839 if (BV_ISSET(fields, 3)) {
65840 log_packet_detailed(" field 'reqs_count' has changed");
65841#ifdef FREECIV_JSON_CONNECTION
65842 field_addr.name = "reqs_count";
65843#endif /* FREECIV_JSON_CONNECTION */
65844 e = 0;
65845 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65846 if (e) {
65847 log_packet_detailed("'reqs_count' field error detected");
65848 }
65849 }
65850 if (BV_ISSET(fields, 4)) {
65851 log_packet_detailed(" field 'reqs' has changed");
65852#ifdef FREECIV_JSON_CONNECTION
65853 field_addr.name = "reqs";
65854#endif /* FREECIV_JSON_CONNECTION */
65855 e = 0;
65856 {
65857 int i;
65858
65859#ifdef FREECIV_JSON_CONNECTION
65860 /* Create the array. */
65861 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65862
65863 /* Enter the array. */
65864 field_addr.sub_location = plocation_elem_new(0);
65865#endif /* FREECIV_JSON_CONNECTION */
65866
65867 for (i = 0; i < real_packet->reqs_count; i++) {
65868#ifdef FREECIV_JSON_CONNECTION
65869 /* Next array element. */
65870 field_addr.sub_location->number = i;
65871#endif /* FREECIV_JSON_CONNECTION */
65872 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65873 }
65874
65875#ifdef FREECIV_JSON_CONNECTION
65876 /* Exit array. */
65877 FC_FREE(field_addr.sub_location);
65878#endif /* FREECIV_JSON_CONNECTION */
65879 }
65880 if (e) {
65881 log_packet_detailed("'reqs' field error detected");
65882 }
65883 }
65884 if (BV_ISSET(fields, 5)) {
65885 log_packet_detailed(" field 'frequency' has changed");
65886#ifdef FREECIV_JSON_CONNECTION
65887 field_addr.name = "frequency";
65888#endif /* FREECIV_JSON_CONNECTION */
65889 e = 0;
65890 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->frequency);
65891 if (e) {
65892 log_packet_detailed("'frequency' field error detected");
65893 }
65894 }
65895 if (BV_ISSET(fields, 6)) {
65896 log_packet_detailed(" field 'effects' has changed");
65897#ifdef FREECIV_JSON_CONNECTION
65898 field_addr.name = "effects";
65899#endif /* FREECIV_JSON_CONNECTION */
65900 e = 0;
65901 e |= DIO_BV_PUT(&dout, &field_addr, packet->effects);
65902 if (e) {
65903 log_packet_detailed("'effects' field error detected");
65904 }
65905 }
65906
65907 *old = *real_packet;
65908#endif /* FREECIV_DELTA_PROTOCOL */
65909#ifndef FREECIV_DELTA_PROTOCOL
65910#ifdef FREECIV_JSON_CONNECTION
65911 field_addr.name = "id";
65912#endif /* FREECIV_JSON_CONNECTION */
65913 e = 0;
65914 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65915 if (e) {
65916 log_packet_detailed("'id' field error detected");
65917 }
65918#ifdef FREECIV_JSON_CONNECTION
65919 field_addr.name = "name";
65920#endif /* FREECIV_JSON_CONNECTION */
65921 e = 0;
65922 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
65923 if (e) {
65924 log_packet_detailed("'name' field error detected");
65925 }
65926#ifdef FREECIV_JSON_CONNECTION
65927 field_addr.name = "rule_name";
65928#endif /* FREECIV_JSON_CONNECTION */
65929 e = 0;
65930 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65931 if (e) {
65932 log_packet_detailed("'rule_name' field error detected");
65933 }
65934#ifdef FREECIV_JSON_CONNECTION
65935 field_addr.name = "reqs_count";
65936#endif /* FREECIV_JSON_CONNECTION */
65937 e = 0;
65938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65939 if (e) {
65940 log_packet_detailed("'reqs_count' field error detected");
65941 }
65942#ifdef FREECIV_JSON_CONNECTION
65943 field_addr.name = "reqs";
65944#endif /* FREECIV_JSON_CONNECTION */
65945 e = 0;
65946 {
65947 int i;
65948
65949#ifdef FREECIV_JSON_CONNECTION
65950 /* Create the array. */
65951 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65952
65953 /* Enter the array. */
65954 field_addr.sub_location = plocation_elem_new(0);
65955#endif /* FREECIV_JSON_CONNECTION */
65956
65957 for (i = 0; i < real_packet->reqs_count; i++) {
65958#ifdef FREECIV_JSON_CONNECTION
65959 /* Next array element. */
65960 field_addr.sub_location->number = i;
65961#endif /* FREECIV_JSON_CONNECTION */
65962 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65963 }
65964
65965#ifdef FREECIV_JSON_CONNECTION
65966 /* Exit array. */
65967 FC_FREE(field_addr.sub_location);
65968#endif /* FREECIV_JSON_CONNECTION */
65969 }
65970 if (e) {
65971 log_packet_detailed("'reqs' field error detected");
65972 }
65973#ifdef FREECIV_JSON_CONNECTION
65974 field_addr.name = "frequency";
65975#endif /* FREECIV_JSON_CONNECTION */
65976 e = 0;
65977 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->frequency);
65978 if (e) {
65979 log_packet_detailed("'frequency' field error detected");
65980 }
65981#ifdef FREECIV_JSON_CONNECTION
65982 field_addr.name = "effects";
65983#endif /* FREECIV_JSON_CONNECTION */
65984 e = 0;
65985 e |= DIO_BV_PUT(&dout, &field_addr, packet->effects);
65986 if (e) {
65987 log_packet_detailed("'effects' field error detected");
65988 }
65989
65990#endif
65991 SEND_PACKET_END(PACKET_RULESET_DISASTER);
65992}
65993
65994 int send_packet_ruleset_disaster(struct connection *pc, const struct packet_ruleset_disaster *packet)
65995{
65996 if (!pc->used) {
65997 log_error("WARNING: trying to send data to the closed connection %s",
65998 conn_description(pc));
65999 return -1;
66000 }
66001 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_DISASTER].packet != nullptr, -1,
66002 "Handler for PACKET_RULESET_DISASTER not installed");
66003 return pc->phs.handlers->send[PACKET_RULESET_DISASTER].packet(pc, packet);
66004}
66005
66006 void lsend_packet_ruleset_disaster(struct conn_list *dest, const struct packet_ruleset_disaster *packet)
66007{
66008 conn_list_iterate(dest, pconn) {
66009 send_packet_ruleset_disaster(pconn, packet);
66010 } conn_list_iterate_end;
66011}
66012
66013 static inline void init_packet_ruleset_achievement(struct packet_ruleset_achievement *packet)
66014{
66015 memset(packet, 0, sizeof(*packet));
66016}
66017
66018#define free_packet_ruleset_achievement(_packet) (void) 0
66019#define destroy_packet_ruleset_achievement free
66020
66021#ifdef FREECIV_DELTA_PROTOCOL
66022#define hash_packet_ruleset_achievement_100 hash_const
66023
66024#define cmp_packet_ruleset_achievement_100 cmp_const
66025
66026 BV_DEFINE(packet_ruleset_achievement_100_fields, 6);
66027#endif /* FREECIV_DELTA_PROTOCOL */
66028
66029 static struct packet_ruleset_achievement *receive_packet_ruleset_achievement_100(struct connection *pc)
66030{
66031#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_achievement(_packet)
66032#ifdef FREECIV_DELTA_PROTOCOL
66033 packet_ruleset_achievement_100_fields fields;
66034 struct packet_ruleset_achievement *old;
66035 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACHIEVEMENT;
66036#endif /* FREECIV_DELTA_PROTOCOL */
66037 RECEIVE_PACKET_START(packet_ruleset_achievement, real_packet);
66038#ifdef FREECIV_JSON_CONNECTION
66039 struct plocation field_addr;
66040 {
66041 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
66042 field_addr = *field_addr_tmp;
66043 FC_FREE(field_addr_tmp);
66044 }
66045#endif /* FREECIV_JSON_CONNECTION */
66046
66047#ifdef FREECIV_DELTA_PROTOCOL
66048#ifdef FREECIV_JSON_CONNECTION
66049 field_addr.name = "fields";
66050#endif /* FREECIV_JSON_CONNECTION */
66051 DIO_BV_GET(&din, &field_addr, fields);
66052
66053#else /* FREECIV_DELTA_PROTOCOL */
66054#ifdef FREECIV_JSON_CONNECTION
66055 field_addr.name = "id";
66056#endif /* FREECIV_JSON_CONNECTION */
66057 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
66058 RECEIVE_PACKET_FIELD_ERROR(id);
66059 }
66060#ifdef FREECIV_JSON_CONNECTION
66061 field_addr.name = "name";
66062#endif /* FREECIV_JSON_CONNECTION */
66063 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
66064 RECEIVE_PACKET_FIELD_ERROR(name);
66065 }
66066#ifdef FREECIV_JSON_CONNECTION
66067 field_addr.name = "rule_name";
66068#endif /* FREECIV_JSON_CONNECTION */
66069 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
66070 RECEIVE_PACKET_FIELD_ERROR(rule_name);
66071 }
66072#ifdef FREECIV_JSON_CONNECTION
66073 field_addr.name = "type";
66074#endif /* FREECIV_JSON_CONNECTION */
66075 {
66076 int readin;
66077
66078 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66079 RECEIVE_PACKET_FIELD_ERROR(type);
66080 }
66081 real_packet->type = readin;
66082 }
66083#ifdef FREECIV_JSON_CONNECTION
66084 field_addr.name = "unique";
66085#endif /* FREECIV_JSON_CONNECTION */
66086 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unique)) {
66087 RECEIVE_PACKET_FIELD_ERROR(unique);
66088 }
66089#ifdef FREECIV_JSON_CONNECTION
66090 field_addr.name = "value";
66091#endif /* FREECIV_JSON_CONNECTION */
66092 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
66093 RECEIVE_PACKET_FIELD_ERROR(value);
66094 }
66095#endif
66096 log_packet_detailed("packet_ruleset_achievement_100: got info about ()");
66097
66098#ifdef FREECIV_DELTA_PROTOCOL
66099 if (nullptr == *hash) {
66100 *hash = genhash_new_full(hash_packet_ruleset_achievement_100, cmp_packet_ruleset_achievement_100,
66101 nullptr, nullptr, nullptr, destroy_packet_ruleset_achievement);
66102 }
66103
66104 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
66105 *real_packet = *old;
66106 } else {
66107 /* packet is already initialized empty */
66108 log_packet_detailed(" no old info");
66109 }
66110
66111 if (BV_ISSET(fields, 0)) {
66112 log_packet_detailed(" got field 'id'");
66113#ifdef FREECIV_JSON_CONNECTION
66114 field_addr.name = "id";
66115#endif /* FREECIV_JSON_CONNECTION */
66116 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
66117 RECEIVE_PACKET_FIELD_ERROR(id);
66118 }
66119 }
66120 if (BV_ISSET(fields, 1)) {
66121 log_packet_detailed(" got field 'name'");
66122#ifdef FREECIV_JSON_CONNECTION
66123 field_addr.name = "name";
66124#endif /* FREECIV_JSON_CONNECTION */
66125 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
66126 RECEIVE_PACKET_FIELD_ERROR(name);
66127 }
66128 }
66129 if (BV_ISSET(fields, 2)) {
66130 log_packet_detailed(" got field 'rule_name'");
66131#ifdef FREECIV_JSON_CONNECTION
66132 field_addr.name = "rule_name";
66133#endif /* FREECIV_JSON_CONNECTION */
66134 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
66135 RECEIVE_PACKET_FIELD_ERROR(rule_name);
66136 }
66137 }
66138 if (BV_ISSET(fields, 3)) {
66139 log_packet_detailed(" got field 'type'");
66140#ifdef FREECIV_JSON_CONNECTION
66141 field_addr.name = "type";
66142#endif /* FREECIV_JSON_CONNECTION */
66143 {
66144 int readin;
66145
66146 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66147 RECEIVE_PACKET_FIELD_ERROR(type);
66148 }
66149 real_packet->type = readin;
66150 }
66151 }
66152 real_packet->unique = BV_ISSET(fields, 4);
66153 if (BV_ISSET(fields, 5)) {
66154 log_packet_detailed(" got field 'value'");
66155#ifdef FREECIV_JSON_CONNECTION
66156 field_addr.name = "value";
66157#endif /* FREECIV_JSON_CONNECTION */
66158 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
66159 RECEIVE_PACKET_FIELD_ERROR(value);
66160 }
66161 }
66162
66163 if (nullptr == old) {
66164 old = fc_malloc(sizeof(*old));
66165 init_packet_ruleset_achievement(old);
66166 *old = *real_packet;
66167 genhash_insert(*hash, old, old);
66168 } else {
66169 *old = *real_packet;
66170 }
66171
66172#endif /* FREECIV_DELTA_PROTOCOL */
66173 RECEIVE_PACKET_END(real_packet);
66174#undef FREE_PACKET_STRUCT
66175}
66176
66177 static int send_packet_ruleset_achievement_100(struct connection *pc, const struct packet_ruleset_achievement *packet)
66178{
66179 const struct packet_ruleset_achievement *real_packet = packet;
66180 int e;
66181#ifdef FREECIV_DELTA_PROTOCOL
66182 packet_ruleset_achievement_100_fields fields;
66183 struct packet_ruleset_achievement *old;
66184 bool differ;
66185 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACHIEVEMENT;
66186#endif /* FREECIV_DELTA_PROTOCOL */
66187 SEND_PACKET_START(PACKET_RULESET_ACHIEVEMENT);
66188#ifdef FREECIV_JSON_CONNECTION
66189 struct plocation field_addr;
66190 {
66191 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
66192 field_addr = *field_addr_tmp;
66193 FC_FREE(field_addr_tmp);
66194 }
66195#endif /* FREECIV_JSON_CONNECTION */
66196
66197 log_packet_detailed("packet_ruleset_achievement_100: sending info about ()");
66198
66199#ifdef FREECIV_DELTA_PROTOCOL
66200 if (nullptr == *hash) {
66201 *hash = genhash_new_full(hash_packet_ruleset_achievement_100, cmp_packet_ruleset_achievement_100,
66202 nullptr, nullptr, nullptr, destroy_packet_ruleset_achievement);
66203 }
66204 BV_CLR_ALL(fields);
66205
66206 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
66207 old = fc_malloc(sizeof(*old));
66208 /* temporary bitcopy just to insert correctly */
66209 *old = *real_packet;
66210 genhash_insert(*hash, old, old);
66211 init_packet_ruleset_achievement(old);
66212 }
66213 differ = (old->id != real_packet->id);
66214 if (differ) {
66215 BV_SET(fields, 0);
66216 }
66217
66218 differ = (strcmp(old->name, real_packet->name) != 0);
66219 if (differ) {
66220 BV_SET(fields, 1);
66221 }
66222
66223 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
66224 if (differ) {
66225 BV_SET(fields, 2);
66226 }
66227
66228 differ = (old->type != real_packet->type);
66229 if (differ) {
66230 BV_SET(fields, 3);
66231 }
66232
66233 if (packet->unique) {
66234 BV_SET(fields, 4);
66235 }
66236
66237 differ = (old->value != real_packet->value);
66238 if (differ) {
66239 BV_SET(fields, 5);
66240 }
66241
66242
66243#ifdef FREECIV_JSON_CONNECTION
66244 field_addr.name = "fields";
66245#endif /* FREECIV_JSON_CONNECTION */
66246 e = 0;
66247 e |= DIO_BV_PUT(&dout, &field_addr, fields);
66248 if (e) {
66249 log_packet_detailed("fields bitvector error detected");
66250 }
66251
66252 if (BV_ISSET(fields, 0)) {
66253 log_packet_detailed(" field 'id' has changed");
66254#ifdef FREECIV_JSON_CONNECTION
66255 field_addr.name = "id";
66256#endif /* FREECIV_JSON_CONNECTION */
66257 e = 0;
66258 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
66259 if (e) {
66260 log_packet_detailed("'id' field error detected");
66261 }
66262 }
66263 if (BV_ISSET(fields, 1)) {
66264 log_packet_detailed(" field 'name' has changed");
66265#ifdef FREECIV_JSON_CONNECTION
66266 field_addr.name = "name";
66267#endif /* FREECIV_JSON_CONNECTION */
66268 e = 0;
66269 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
66270 if (e) {
66271 log_packet_detailed("'name' field error detected");
66272 }
66273 }
66274 if (BV_ISSET(fields, 2)) {
66275 log_packet_detailed(" field 'rule_name' has changed");
66276#ifdef FREECIV_JSON_CONNECTION
66277 field_addr.name = "rule_name";
66278#endif /* FREECIV_JSON_CONNECTION */
66279 e = 0;
66280 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
66281 if (e) {
66282 log_packet_detailed("'rule_name' field error detected");
66283 }
66284 }
66285 if (BV_ISSET(fields, 3)) {
66286 log_packet_detailed(" field 'type' has changed");
66287#ifdef FREECIV_JSON_CONNECTION
66288 field_addr.name = "type";
66289#endif /* FREECIV_JSON_CONNECTION */
66290 e = 0;
66291 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
66292 if (e) {
66293 log_packet_detailed("'type' field error detected");
66294 }
66295 }
66296 /* field 4 is folded into the header */
66297 if (BV_ISSET(fields, 5)) {
66298 log_packet_detailed(" field 'value' has changed");
66299#ifdef FREECIV_JSON_CONNECTION
66300 field_addr.name = "value";
66301#endif /* FREECIV_JSON_CONNECTION */
66302 e = 0;
66303 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
66304 if (e) {
66305 log_packet_detailed("'value' field error detected");
66306 }
66307 }
66308
66309 *old = *real_packet;
66310#endif /* FREECIV_DELTA_PROTOCOL */
66311#ifndef FREECIV_DELTA_PROTOCOL
66312#ifdef FREECIV_JSON_CONNECTION
66313 field_addr.name = "id";
66314#endif /* FREECIV_JSON_CONNECTION */
66315 e = 0;
66316 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
66317 if (e) {
66318 log_packet_detailed("'id' field error detected");
66319 }
66320#ifdef FREECIV_JSON_CONNECTION
66321 field_addr.name = "name";
66322#endif /* FREECIV_JSON_CONNECTION */
66323 e = 0;
66324 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
66325 if (e) {
66326 log_packet_detailed("'name' field error detected");
66327 }
66328#ifdef FREECIV_JSON_CONNECTION
66329 field_addr.name = "rule_name";
66330#endif /* FREECIV_JSON_CONNECTION */
66331 e = 0;
66332 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
66333 if (e) {
66334 log_packet_detailed("'rule_name' field error detected");
66335 }
66336#ifdef FREECIV_JSON_CONNECTION
66337 field_addr.name = "type";
66338#endif /* FREECIV_JSON_CONNECTION */
66339 e = 0;
66340 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
66341 if (e) {
66342 log_packet_detailed("'type' field error detected");
66343 }
66344#ifdef FREECIV_JSON_CONNECTION
66345 field_addr.name = "unique";
66346#endif /* FREECIV_JSON_CONNECTION */
66347 e = 0;
66348 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unique);
66349 if (e) {
66350 log_packet_detailed("'unique' field error detected");
66351 }
66352#ifdef FREECIV_JSON_CONNECTION
66353 field_addr.name = "value";
66354#endif /* FREECIV_JSON_CONNECTION */
66355 e = 0;
66356 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
66357 if (e) {
66358 log_packet_detailed("'value' field error detected");
66359 }
66360
66361#endif
66362 SEND_PACKET_END(PACKET_RULESET_ACHIEVEMENT);
66363}
66364
66365 int send_packet_ruleset_achievement(struct connection *pc, const struct packet_ruleset_achievement *packet)
66366{
66367 if (!pc->used) {
66368 log_error("WARNING: trying to send data to the closed connection %s",
66369 conn_description(pc));
66370 return -1;
66371 }
66372 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACHIEVEMENT].packet != nullptr, -1,
66373 "Handler for PACKET_RULESET_ACHIEVEMENT not installed");
66374 return pc->phs.handlers->send[PACKET_RULESET_ACHIEVEMENT].packet(pc, packet);
66375}
66376
66377 void lsend_packet_ruleset_achievement(struct conn_list *dest, const struct packet_ruleset_achievement *packet)
66378{
66379 conn_list_iterate(dest, pconn) {
66380 send_packet_ruleset_achievement(pconn, packet);
66381 } conn_list_iterate_end;
66382}
66383
66384 static inline void init_packet_ruleset_trade(struct packet_ruleset_trade *packet)
66385{
66386 memset(packet, 0, sizeof(*packet));
66387}
66388
66389#define free_packet_ruleset_trade(_packet) (void) 0
66390#define destroy_packet_ruleset_trade free
66391
66392#ifdef FREECIV_DELTA_PROTOCOL
66393#define hash_packet_ruleset_trade_100 hash_const
66394
66395#define cmp_packet_ruleset_trade_100 cmp_const
66396
66397 BV_DEFINE(packet_ruleset_trade_100_fields, 4);
66398#endif /* FREECIV_DELTA_PROTOCOL */
66399
66400 static struct packet_ruleset_trade *receive_packet_ruleset_trade_100(struct connection *pc)
66401{
66402#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_trade(_packet)
66403#ifdef FREECIV_DELTA_PROTOCOL
66404 packet_ruleset_trade_100_fields fields;
66405 struct packet_ruleset_trade *old;
66406 struct genhash **hash = pc->phs.received + PACKET_RULESET_TRADE;
66407#endif /* FREECIV_DELTA_PROTOCOL */
66408 RECEIVE_PACKET_START(packet_ruleset_trade, real_packet);
66409#ifdef FREECIV_JSON_CONNECTION
66410 struct plocation field_addr;
66411 {
66412 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
66413 field_addr = *field_addr_tmp;
66414 FC_FREE(field_addr_tmp);
66415 }
66416#endif /* FREECIV_JSON_CONNECTION */
66417
66418#ifdef FREECIV_DELTA_PROTOCOL
66419#ifdef FREECIV_JSON_CONNECTION
66420 field_addr.name = "fields";
66421#endif /* FREECIV_JSON_CONNECTION */
66422 DIO_BV_GET(&din, &field_addr, fields);
66423
66424#else /* FREECIV_DELTA_PROTOCOL */
66425#ifdef FREECIV_JSON_CONNECTION
66426 field_addr.name = "id";
66427#endif /* FREECIV_JSON_CONNECTION */
66428 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
66429 RECEIVE_PACKET_FIELD_ERROR(id);
66430 }
66431#ifdef FREECIV_JSON_CONNECTION
66432 field_addr.name = "trade_pct";
66433#endif /* FREECIV_JSON_CONNECTION */
66434 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trade_pct)) {
66435 RECEIVE_PACKET_FIELD_ERROR(trade_pct);
66436 }
66437#ifdef FREECIV_JSON_CONNECTION
66438 field_addr.name = "cancelling";
66439#endif /* FREECIV_JSON_CONNECTION */
66440 {
66441 int readin;
66442
66443 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66444 RECEIVE_PACKET_FIELD_ERROR(cancelling);
66445 }
66446 real_packet->cancelling = readin;
66447 }
66448#ifdef FREECIV_JSON_CONNECTION
66449 field_addr.name = "bonus_type";
66450#endif /* FREECIV_JSON_CONNECTION */
66451 {
66452 int readin;
66453
66454 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66455 RECEIVE_PACKET_FIELD_ERROR(bonus_type);
66456 }
66457 real_packet->bonus_type = readin;
66458 }
66459#endif
66460 log_packet_detailed("packet_ruleset_trade_100: got info about ()");
66461
66462#ifdef FREECIV_DELTA_PROTOCOL
66463 if (nullptr == *hash) {
66464 *hash = genhash_new_full(hash_packet_ruleset_trade_100, cmp_packet_ruleset_trade_100,
66465 nullptr, nullptr, nullptr, destroy_packet_ruleset_trade);
66466 }
66467
66468 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
66469 *real_packet = *old;
66470 } else {
66471 /* packet is already initialized empty */
66472 log_packet_detailed(" no old info");
66473 }
66474
66475 if (BV_ISSET(fields, 0)) {
66476 log_packet_detailed(" got field 'id'");
66477#ifdef FREECIV_JSON_CONNECTION
66478 field_addr.name = "id";
66479#endif /* FREECIV_JSON_CONNECTION */
66480 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
66481 RECEIVE_PACKET_FIELD_ERROR(id);
66482 }
66483 }
66484 if (BV_ISSET(fields, 1)) {
66485 log_packet_detailed(" got field 'trade_pct'");
66486#ifdef FREECIV_JSON_CONNECTION
66487 field_addr.name = "trade_pct";
66488#endif /* FREECIV_JSON_CONNECTION */
66489 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trade_pct)) {
66490 RECEIVE_PACKET_FIELD_ERROR(trade_pct);
66491 }
66492 }
66493 if (BV_ISSET(fields, 2)) {
66494 log_packet_detailed(" got field 'cancelling'");
66495#ifdef FREECIV_JSON_CONNECTION
66496 field_addr.name = "cancelling";
66497#endif /* FREECIV_JSON_CONNECTION */
66498 {
66499 int readin;
66500
66501 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66502 RECEIVE_PACKET_FIELD_ERROR(cancelling);
66503 }
66504 real_packet->cancelling = readin;
66505 }
66506 }
66507 if (BV_ISSET(fields, 3)) {
66508 log_packet_detailed(" got field 'bonus_type'");
66509#ifdef FREECIV_JSON_CONNECTION
66510 field_addr.name = "bonus_type";
66511#endif /* FREECIV_JSON_CONNECTION */
66512 {
66513 int readin;
66514
66515 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66516 RECEIVE_PACKET_FIELD_ERROR(bonus_type);
66517 }
66518 real_packet->bonus_type = readin;
66519 }
66520 }
66521
66522 if (nullptr == old) {
66523 old = fc_malloc(sizeof(*old));
66524 init_packet_ruleset_trade(old);
66525 *old = *real_packet;
66526 genhash_insert(*hash, old, old);
66527 } else {
66528 *old = *real_packet;
66529 }
66530
66531#endif /* FREECIV_DELTA_PROTOCOL */
66532 RECEIVE_PACKET_END(real_packet);
66533#undef FREE_PACKET_STRUCT
66534}
66535
66536 static int send_packet_ruleset_trade_100(struct connection *pc, const struct packet_ruleset_trade *packet)
66537{
66538 const struct packet_ruleset_trade *real_packet = packet;
66539 int e;
66540#ifdef FREECIV_DELTA_PROTOCOL
66541 packet_ruleset_trade_100_fields fields;
66542 struct packet_ruleset_trade *old;
66543 bool differ;
66544 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TRADE;
66545#endif /* FREECIV_DELTA_PROTOCOL */
66546 SEND_PACKET_START(PACKET_RULESET_TRADE);
66547#ifdef FREECIV_JSON_CONNECTION
66548 struct plocation field_addr;
66549 {
66550 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
66551 field_addr = *field_addr_tmp;
66552 FC_FREE(field_addr_tmp);
66553 }
66554#endif /* FREECIV_JSON_CONNECTION */
66555
66556 log_packet_detailed("packet_ruleset_trade_100: sending info about ()");
66557
66558#ifdef FREECIV_DELTA_PROTOCOL
66559 if (nullptr == *hash) {
66560 *hash = genhash_new_full(hash_packet_ruleset_trade_100, cmp_packet_ruleset_trade_100,
66561 nullptr, nullptr, nullptr, destroy_packet_ruleset_trade);
66562 }
66563 BV_CLR_ALL(fields);
66564
66565 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
66566 old = fc_malloc(sizeof(*old));
66567 /* temporary bitcopy just to insert correctly */
66568 *old = *real_packet;
66569 genhash_insert(*hash, old, old);
66570 init_packet_ruleset_trade(old);
66571 }
66572 differ = (old->id != real_packet->id);
66573 if (differ) {
66574 BV_SET(fields, 0);
66575 }
66576
66577 differ = (old->trade_pct != real_packet->trade_pct);
66578 if (differ) {
66579 BV_SET(fields, 1);
66580 }
66581
66582 differ = (old->cancelling != real_packet->cancelling);
66583 if (differ) {
66584 BV_SET(fields, 2);
66585 }
66586
66587 differ = (old->bonus_type != real_packet->bonus_type);
66588 if (differ) {
66589 BV_SET(fields, 3);
66590 }
66591
66592
66593#ifdef FREECIV_JSON_CONNECTION
66594 field_addr.name = "fields";
66595#endif /* FREECIV_JSON_CONNECTION */
66596 e = 0;
66597 e |= DIO_BV_PUT(&dout, &field_addr, fields);
66598 if (e) {
66599 log_packet_detailed("fields bitvector error detected");
66600 }
66601
66602 if (BV_ISSET(fields, 0)) {
66603 log_packet_detailed(" field 'id' has changed");
66604#ifdef FREECIV_JSON_CONNECTION
66605 field_addr.name = "id";
66606#endif /* FREECIV_JSON_CONNECTION */
66607 e = 0;
66608 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
66609 if (e) {
66610 log_packet_detailed("'id' field error detected");
66611 }
66612 }
66613 if (BV_ISSET(fields, 1)) {
66614 log_packet_detailed(" field 'trade_pct' has changed");
66615#ifdef FREECIV_JSON_CONNECTION
66616 field_addr.name = "trade_pct";
66617#endif /* FREECIV_JSON_CONNECTION */
66618 e = 0;
66619 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trade_pct);
66620 if (e) {
66621 log_packet_detailed("'trade_pct' field error detected");
66622 }
66623 }
66624 if (BV_ISSET(fields, 2)) {
66625 log_packet_detailed(" field 'cancelling' has changed");
66626#ifdef FREECIV_JSON_CONNECTION
66627 field_addr.name = "cancelling";
66628#endif /* FREECIV_JSON_CONNECTION */
66629 e = 0;
66630 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cancelling);
66631 if (e) {
66632 log_packet_detailed("'cancelling' field error detected");
66633 }
66634 }
66635 if (BV_ISSET(fields, 3)) {
66636 log_packet_detailed(" field 'bonus_type' has changed");
66637#ifdef FREECIV_JSON_CONNECTION
66638 field_addr.name = "bonus_type";
66639#endif /* FREECIV_JSON_CONNECTION */
66640 e = 0;
66641 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bonus_type);
66642 if (e) {
66643 log_packet_detailed("'bonus_type' field error detected");
66644 }
66645 }
66646
66647 *old = *real_packet;
66648#endif /* FREECIV_DELTA_PROTOCOL */
66649#ifndef FREECIV_DELTA_PROTOCOL
66650#ifdef FREECIV_JSON_CONNECTION
66651 field_addr.name = "id";
66652#endif /* FREECIV_JSON_CONNECTION */
66653 e = 0;
66654 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
66655 if (e) {
66656 log_packet_detailed("'id' field error detected");
66657 }
66658#ifdef FREECIV_JSON_CONNECTION
66659 field_addr.name = "trade_pct";
66660#endif /* FREECIV_JSON_CONNECTION */
66661 e = 0;
66662 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trade_pct);
66663 if (e) {
66664 log_packet_detailed("'trade_pct' field error detected");
66665 }
66666#ifdef FREECIV_JSON_CONNECTION
66667 field_addr.name = "cancelling";
66668#endif /* FREECIV_JSON_CONNECTION */
66669 e = 0;
66670 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cancelling);
66671 if (e) {
66672 log_packet_detailed("'cancelling' field error detected");
66673 }
66674#ifdef FREECIV_JSON_CONNECTION
66675 field_addr.name = "bonus_type";
66676#endif /* FREECIV_JSON_CONNECTION */
66677 e = 0;
66678 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bonus_type);
66679 if (e) {
66680 log_packet_detailed("'bonus_type' field error detected");
66681 }
66682
66683#endif
66684 SEND_PACKET_END(PACKET_RULESET_TRADE);
66685}
66686
66687 int send_packet_ruleset_trade(struct connection *pc, const struct packet_ruleset_trade *packet)
66688{
66689 if (!pc->used) {
66690 log_error("WARNING: trying to send data to the closed connection %s",
66691 conn_description(pc));
66692 return -1;
66693 }
66694 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TRADE].packet != nullptr, -1,
66695 "Handler for PACKET_RULESET_TRADE not installed");
66696 return pc->phs.handlers->send[PACKET_RULESET_TRADE].packet(pc, packet);
66697}
66698
66699 void lsend_packet_ruleset_trade(struct conn_list *dest, const struct packet_ruleset_trade *packet)
66700{
66701 conn_list_iterate(dest, pconn) {
66702 send_packet_ruleset_trade(pconn, packet);
66703 } conn_list_iterate_end;
66704}
66705
66706 static inline void init_packet_ruleset_action(struct packet_ruleset_action *packet)
66707{
66708 memset(packet, 0, sizeof(*packet));
66709}
66710
66711#define free_packet_ruleset_action(_packet) (void) 0
66712#define destroy_packet_ruleset_action free
66713
66714#ifdef FREECIV_DELTA_PROTOCOL
66715#define hash_packet_ruleset_action_100 hash_const
66716
66717#define cmp_packet_ruleset_action_100 cmp_const
66718
66719 BV_DEFINE(packet_ruleset_action_100_fields, 12);
66720#endif /* FREECIV_DELTA_PROTOCOL */
66721
66722 static struct packet_ruleset_action *receive_packet_ruleset_action_100(struct connection *pc)
66723{
66724#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_action(_packet)
66725#ifdef FREECIV_DELTA_PROTOCOL
66726 packet_ruleset_action_100_fields fields;
66727 struct packet_ruleset_action *old;
66728 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION;
66729#endif /* FREECIV_DELTA_PROTOCOL */
66730 RECEIVE_PACKET_START(packet_ruleset_action, real_packet);
66731#ifdef FREECIV_JSON_CONNECTION
66732 struct plocation field_addr;
66733 {
66734 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
66735 field_addr = *field_addr_tmp;
66736 FC_FREE(field_addr_tmp);
66737 }
66738#endif /* FREECIV_JSON_CONNECTION */
66739
66740#ifdef FREECIV_DELTA_PROTOCOL
66741#ifdef FREECIV_JSON_CONNECTION
66742 field_addr.name = "fields";
66743#endif /* FREECIV_JSON_CONNECTION */
66744 DIO_BV_GET(&din, &field_addr, fields);
66745
66746#else /* FREECIV_DELTA_PROTOCOL */
66747#ifdef FREECIV_JSON_CONNECTION
66748 field_addr.name = "id";
66749#endif /* FREECIV_JSON_CONNECTION */
66750 {
66751 int readin;
66752
66753 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66754 RECEIVE_PACKET_FIELD_ERROR(id);
66755 }
66756 real_packet->id = readin;
66757 }
66758#ifdef FREECIV_JSON_CONNECTION
66759 field_addr.name = "ui_name";
66760#endif /* FREECIV_JSON_CONNECTION */
66761 if (!DIO_GET(string, &din, &field_addr, real_packet->ui_name, sizeof(real_packet->ui_name))) {
66762 RECEIVE_PACKET_FIELD_ERROR(ui_name);
66763 }
66764#ifdef FREECIV_JSON_CONNECTION
66765 field_addr.name = "quiet";
66766#endif /* FREECIV_JSON_CONNECTION */
66767 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->quiet)) {
66768 RECEIVE_PACKET_FIELD_ERROR(quiet);
66769 }
66770#ifdef FREECIV_JSON_CONNECTION
66771 field_addr.name = "result";
66772#endif /* FREECIV_JSON_CONNECTION */
66773 {
66774 int readin;
66775
66776 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66777 RECEIVE_PACKET_FIELD_ERROR(result);
66778 }
66779 real_packet->result = readin;
66780 }
66781#ifdef FREECIV_JSON_CONNECTION
66782 field_addr.name = "sub_results";
66783#endif /* FREECIV_JSON_CONNECTION */
66784 if (!DIO_BV_GET(&din, &field_addr, real_packet->sub_results)) {
66785 RECEIVE_PACKET_FIELD_ERROR(sub_results);
66786 }
66787#ifdef FREECIV_JSON_CONNECTION
66788 field_addr.name = "actor_consuming_always";
66789#endif /* FREECIV_JSON_CONNECTION */
66790 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->actor_consuming_always)) {
66791 RECEIVE_PACKET_FIELD_ERROR(actor_consuming_always);
66792 }
66793#ifdef FREECIV_JSON_CONNECTION
66794 field_addr.name = "act_kind";
66795#endif /* FREECIV_JSON_CONNECTION */
66796 {
66797 int readin;
66798
66799 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66800 RECEIVE_PACKET_FIELD_ERROR(act_kind);
66801 }
66802 real_packet->act_kind = readin;
66803 }
66804#ifdef FREECIV_JSON_CONNECTION
66805 field_addr.name = "tgt_kind";
66806#endif /* FREECIV_JSON_CONNECTION */
66807 {
66808 int readin;
66809
66810 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66811 RECEIVE_PACKET_FIELD_ERROR(tgt_kind);
66812 }
66813 real_packet->tgt_kind = readin;
66814 }
66815#ifdef FREECIV_JSON_CONNECTION
66816 field_addr.name = "sub_tgt_kind";
66817#endif /* FREECIV_JSON_CONNECTION */
66818 {
66819 int readin;
66820
66821 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66822 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_kind);
66823 }
66824 real_packet->sub_tgt_kind = readin;
66825 }
66826#ifdef FREECIV_JSON_CONNECTION
66827 field_addr.name = "min_distance";
66828#endif /* FREECIV_JSON_CONNECTION */
66829 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_distance)) {
66830 RECEIVE_PACKET_FIELD_ERROR(min_distance);
66831 }
66832#ifdef FREECIV_JSON_CONNECTION
66833 field_addr.name = "max_distance";
66834#endif /* FREECIV_JSON_CONNECTION */
66835 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_distance)) {
66836 RECEIVE_PACKET_FIELD_ERROR(max_distance);
66837 }
66838#ifdef FREECIV_JSON_CONNECTION
66839 field_addr.name = "blocked_by";
66840#endif /* FREECIV_JSON_CONNECTION */
66841 if (!DIO_BV_GET(&din, &field_addr, real_packet->blocked_by)) {
66842 RECEIVE_PACKET_FIELD_ERROR(blocked_by);
66843 }
66844#endif
66845 log_packet_detailed("packet_ruleset_action_100: got info about ()");
66846
66847#ifdef FREECIV_DELTA_PROTOCOL
66848 if (nullptr == *hash) {
66849 *hash = genhash_new_full(hash_packet_ruleset_action_100, cmp_packet_ruleset_action_100,
66850 nullptr, nullptr, nullptr, destroy_packet_ruleset_action);
66851 }
66852
66853 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
66854 *real_packet = *old;
66855 } else {
66856 /* packet is already initialized empty */
66857 log_packet_detailed(" no old info");
66858 }
66859
66860 if (BV_ISSET(fields, 0)) {
66861 log_packet_detailed(" got field 'id'");
66862#ifdef FREECIV_JSON_CONNECTION
66863 field_addr.name = "id";
66864#endif /* FREECIV_JSON_CONNECTION */
66865 {
66866 int readin;
66867
66868 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66869 RECEIVE_PACKET_FIELD_ERROR(id);
66870 }
66871 real_packet->id = readin;
66872 }
66873 }
66874 if (BV_ISSET(fields, 1)) {
66875 log_packet_detailed(" got field 'ui_name'");
66876#ifdef FREECIV_JSON_CONNECTION
66877 field_addr.name = "ui_name";
66878#endif /* FREECIV_JSON_CONNECTION */
66879 if (!DIO_GET(string, &din, &field_addr, real_packet->ui_name, sizeof(real_packet->ui_name))) {
66880 RECEIVE_PACKET_FIELD_ERROR(ui_name);
66881 }
66882 }
66883 real_packet->quiet = BV_ISSET(fields, 2);
66884 if (BV_ISSET(fields, 3)) {
66885 log_packet_detailed(" got field 'result'");
66886#ifdef FREECIV_JSON_CONNECTION
66887 field_addr.name = "result";
66888#endif /* FREECIV_JSON_CONNECTION */
66889 {
66890 int readin;
66891
66892 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66893 RECEIVE_PACKET_FIELD_ERROR(result);
66894 }
66895 real_packet->result = readin;
66896 }
66897 }
66898 if (BV_ISSET(fields, 4)) {
66899 log_packet_detailed(" got field 'sub_results'");
66900#ifdef FREECIV_JSON_CONNECTION
66901 field_addr.name = "sub_results";
66902#endif /* FREECIV_JSON_CONNECTION */
66903 if (!DIO_BV_GET(&din, &field_addr, real_packet->sub_results)) {
66904 RECEIVE_PACKET_FIELD_ERROR(sub_results);
66905 }
66906 }
66907 real_packet->actor_consuming_always = BV_ISSET(fields, 5);
66908 if (BV_ISSET(fields, 6)) {
66909 log_packet_detailed(" got field 'act_kind'");
66910#ifdef FREECIV_JSON_CONNECTION
66911 field_addr.name = "act_kind";
66912#endif /* FREECIV_JSON_CONNECTION */
66913 {
66914 int readin;
66915
66916 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66917 RECEIVE_PACKET_FIELD_ERROR(act_kind);
66918 }
66919 real_packet->act_kind = readin;
66920 }
66921 }
66922 if (BV_ISSET(fields, 7)) {
66923 log_packet_detailed(" got field 'tgt_kind'");
66924#ifdef FREECIV_JSON_CONNECTION
66925 field_addr.name = "tgt_kind";
66926#endif /* FREECIV_JSON_CONNECTION */
66927 {
66928 int readin;
66929
66930 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66931 RECEIVE_PACKET_FIELD_ERROR(tgt_kind);
66932 }
66933 real_packet->tgt_kind = readin;
66934 }
66935 }
66936 if (BV_ISSET(fields, 8)) {
66937 log_packet_detailed(" got field 'sub_tgt_kind'");
66938#ifdef FREECIV_JSON_CONNECTION
66939 field_addr.name = "sub_tgt_kind";
66940#endif /* FREECIV_JSON_CONNECTION */
66941 {
66942 int readin;
66943
66944 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
66945 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_kind);
66946 }
66947 real_packet->sub_tgt_kind = readin;
66948 }
66949 }
66950 if (BV_ISSET(fields, 9)) {
66951 log_packet_detailed(" got field 'min_distance'");
66952#ifdef FREECIV_JSON_CONNECTION
66953 field_addr.name = "min_distance";
66954#endif /* FREECIV_JSON_CONNECTION */
66955 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_distance)) {
66956 RECEIVE_PACKET_FIELD_ERROR(min_distance);
66957 }
66958 }
66959 if (BV_ISSET(fields, 10)) {
66960 log_packet_detailed(" got field 'max_distance'");
66961#ifdef FREECIV_JSON_CONNECTION
66962 field_addr.name = "max_distance";
66963#endif /* FREECIV_JSON_CONNECTION */
66964 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_distance)) {
66965 RECEIVE_PACKET_FIELD_ERROR(max_distance);
66966 }
66967 }
66968 if (BV_ISSET(fields, 11)) {
66969 log_packet_detailed(" got field 'blocked_by'");
66970#ifdef FREECIV_JSON_CONNECTION
66971 field_addr.name = "blocked_by";
66972#endif /* FREECIV_JSON_CONNECTION */
66973 if (!DIO_BV_GET(&din, &field_addr, real_packet->blocked_by)) {
66974 RECEIVE_PACKET_FIELD_ERROR(blocked_by);
66975 }
66976 }
66977
66978 if (nullptr == old) {
66979 old = fc_malloc(sizeof(*old));
66980 init_packet_ruleset_action(old);
66981 *old = *real_packet;
66982 genhash_insert(*hash, old, old);
66983 } else {
66984 *old = *real_packet;
66985 }
66986
66987#endif /* FREECIV_DELTA_PROTOCOL */
66988 RECEIVE_PACKET_END(real_packet);
66989#undef FREE_PACKET_STRUCT
66990}
66991
66992 static int send_packet_ruleset_action_100(struct connection *pc, const struct packet_ruleset_action *packet)
66993{
66994 const struct packet_ruleset_action *real_packet = packet;
66995 int e;
66996#ifdef FREECIV_DELTA_PROTOCOL
66997 packet_ruleset_action_100_fields fields;
66998 struct packet_ruleset_action *old;
66999 bool differ;
67000 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION;
67001#endif /* FREECIV_DELTA_PROTOCOL */
67002 SEND_PACKET_START(PACKET_RULESET_ACTION);
67003#ifdef FREECIV_JSON_CONNECTION
67004 struct plocation field_addr;
67005 {
67006 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
67007 field_addr = *field_addr_tmp;
67008 FC_FREE(field_addr_tmp);
67009 }
67010#endif /* FREECIV_JSON_CONNECTION */
67011
67012 log_packet_detailed("packet_ruleset_action_100: sending info about ()");
67013
67014#ifdef FREECIV_DELTA_PROTOCOL
67015 if (nullptr == *hash) {
67016 *hash = genhash_new_full(hash_packet_ruleset_action_100, cmp_packet_ruleset_action_100,
67017 nullptr, nullptr, nullptr, destroy_packet_ruleset_action);
67018 }
67019 BV_CLR_ALL(fields);
67020
67021 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
67022 old = fc_malloc(sizeof(*old));
67023 /* temporary bitcopy just to insert correctly */
67024 *old = *real_packet;
67025 genhash_insert(*hash, old, old);
67026 init_packet_ruleset_action(old);
67027 }
67028 differ = (old->id != real_packet->id);
67029 if (differ) {
67030 BV_SET(fields, 0);
67031 }
67032
67033 differ = (strcmp(old->ui_name, real_packet->ui_name) != 0);
67034 if (differ) {
67035 BV_SET(fields, 1);
67036 }
67037
67038 if (packet->quiet) {
67039 BV_SET(fields, 2);
67040 }
67041
67042 differ = (old->result != real_packet->result);
67043 if (differ) {
67044 BV_SET(fields, 3);
67045 }
67046
67047 differ = !BV_ARE_EQUAL(old->sub_results, real_packet->sub_results);
67048 if (differ) {
67049 BV_SET(fields, 4);
67050 }
67051
67052 if (packet->actor_consuming_always) {
67053 BV_SET(fields, 5);
67054 }
67055
67056 differ = (old->act_kind != real_packet->act_kind);
67057 if (differ) {
67058 BV_SET(fields, 6);
67059 }
67060
67061 differ = (old->tgt_kind != real_packet->tgt_kind);
67062 if (differ) {
67063 BV_SET(fields, 7);
67064 }
67065
67066 differ = (old->sub_tgt_kind != real_packet->sub_tgt_kind);
67067 if (differ) {
67068 BV_SET(fields, 8);
67069 }
67070
67071 differ = (old->min_distance != real_packet->min_distance);
67072 if (differ) {
67073 BV_SET(fields, 9);
67074 }
67075
67076 differ = (old->max_distance != real_packet->max_distance);
67077 if (differ) {
67078 BV_SET(fields, 10);
67079 }
67080
67081 differ = !BV_ARE_EQUAL(old->blocked_by, real_packet->blocked_by);
67082 if (differ) {
67083 BV_SET(fields, 11);
67084 }
67085
67086
67087#ifdef FREECIV_JSON_CONNECTION
67088 field_addr.name = "fields";
67089#endif /* FREECIV_JSON_CONNECTION */
67090 e = 0;
67091 e |= DIO_BV_PUT(&dout, &field_addr, fields);
67092 if (e) {
67093 log_packet_detailed("fields bitvector error detected");
67094 }
67095
67096 if (BV_ISSET(fields, 0)) {
67097 log_packet_detailed(" field 'id' has changed");
67098#ifdef FREECIV_JSON_CONNECTION
67099 field_addr.name = "id";
67100#endif /* FREECIV_JSON_CONNECTION */
67101 e = 0;
67102 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
67103 if (e) {
67104 log_packet_detailed("'id' field error detected");
67105 }
67106 }
67107 if (BV_ISSET(fields, 1)) {
67108 log_packet_detailed(" field 'ui_name' has changed");
67109#ifdef FREECIV_JSON_CONNECTION
67110 field_addr.name = "ui_name";
67111#endif /* FREECIV_JSON_CONNECTION */
67112 e = 0;
67113 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ui_name);
67114 if (e) {
67115 log_packet_detailed("'ui_name' field error detected");
67116 }
67117 }
67118 /* field 2 is folded into the header */
67119 if (BV_ISSET(fields, 3)) {
67120 log_packet_detailed(" field 'result' has changed");
67121#ifdef FREECIV_JSON_CONNECTION
67122 field_addr.name = "result";
67123#endif /* FREECIV_JSON_CONNECTION */
67124 e = 0;
67125 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->result);
67126 if (e) {
67127 log_packet_detailed("'result' field error detected");
67128 }
67129 }
67130 if (BV_ISSET(fields, 4)) {
67131 log_packet_detailed(" field 'sub_results' has changed");
67132#ifdef FREECIV_JSON_CONNECTION
67133 field_addr.name = "sub_results";
67134#endif /* FREECIV_JSON_CONNECTION */
67135 e = 0;
67136 e |= DIO_BV_PUT(&dout, &field_addr, packet->sub_results);
67137 if (e) {
67138 log_packet_detailed("'sub_results' field error detected");
67139 }
67140 }
67141 /* field 5 is folded into the header */
67142 if (BV_ISSET(fields, 6)) {
67143 log_packet_detailed(" field 'act_kind' has changed");
67144#ifdef FREECIV_JSON_CONNECTION
67145 field_addr.name = "act_kind";
67146#endif /* FREECIV_JSON_CONNECTION */
67147 e = 0;
67148 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_kind);
67149 if (e) {
67150 log_packet_detailed("'act_kind' field error detected");
67151 }
67152 }
67153 if (BV_ISSET(fields, 7)) {
67154 log_packet_detailed(" field 'tgt_kind' has changed");
67155#ifdef FREECIV_JSON_CONNECTION
67156 field_addr.name = "tgt_kind";
67157#endif /* FREECIV_JSON_CONNECTION */
67158 e = 0;
67159 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tgt_kind);
67160 if (e) {
67161 log_packet_detailed("'tgt_kind' field error detected");
67162 }
67163 }
67164 if (BV_ISSET(fields, 8)) {
67165 log_packet_detailed(" field 'sub_tgt_kind' has changed");
67166#ifdef FREECIV_JSON_CONNECTION
67167 field_addr.name = "sub_tgt_kind";
67168#endif /* FREECIV_JSON_CONNECTION */
67169 e = 0;
67170 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sub_tgt_kind);
67171 if (e) {
67172 log_packet_detailed("'sub_tgt_kind' field error detected");
67173 }
67174 }
67175 if (BV_ISSET(fields, 9)) {
67176 log_packet_detailed(" field 'min_distance' has changed");
67177#ifdef FREECIV_JSON_CONNECTION
67178 field_addr.name = "min_distance";
67179#endif /* FREECIV_JSON_CONNECTION */
67180 e = 0;
67181 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_distance);
67182 if (e) {
67183 log_packet_detailed("'min_distance' field error detected");
67184 }
67185 }
67186 if (BV_ISSET(fields, 10)) {
67187 log_packet_detailed(" field 'max_distance' has changed");
67188#ifdef FREECIV_JSON_CONNECTION
67189 field_addr.name = "max_distance";
67190#endif /* FREECIV_JSON_CONNECTION */
67191 e = 0;
67192 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_distance);
67193 if (e) {
67194 log_packet_detailed("'max_distance' field error detected");
67195 }
67196 }
67197 if (BV_ISSET(fields, 11)) {
67198 log_packet_detailed(" field 'blocked_by' has changed");
67199#ifdef FREECIV_JSON_CONNECTION
67200 field_addr.name = "blocked_by";
67201#endif /* FREECIV_JSON_CONNECTION */
67202 e = 0;
67203 e |= DIO_BV_PUT(&dout, &field_addr, packet->blocked_by);
67204 if (e) {
67205 log_packet_detailed("'blocked_by' field error detected");
67206 }
67207 }
67208
67209 *old = *real_packet;
67210#endif /* FREECIV_DELTA_PROTOCOL */
67211#ifndef FREECIV_DELTA_PROTOCOL
67212#ifdef FREECIV_JSON_CONNECTION
67213 field_addr.name = "id";
67214#endif /* FREECIV_JSON_CONNECTION */
67215 e = 0;
67216 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
67217 if (e) {
67218 log_packet_detailed("'id' field error detected");
67219 }
67220#ifdef FREECIV_JSON_CONNECTION
67221 field_addr.name = "ui_name";
67222#endif /* FREECIV_JSON_CONNECTION */
67223 e = 0;
67224 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ui_name);
67225 if (e) {
67226 log_packet_detailed("'ui_name' field error detected");
67227 }
67228#ifdef FREECIV_JSON_CONNECTION
67229 field_addr.name = "quiet";
67230#endif /* FREECIV_JSON_CONNECTION */
67231 e = 0;
67232 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->quiet);
67233 if (e) {
67234 log_packet_detailed("'quiet' field error detected");
67235 }
67236#ifdef FREECIV_JSON_CONNECTION
67237 field_addr.name = "result";
67238#endif /* FREECIV_JSON_CONNECTION */
67239 e = 0;
67240 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->result);
67241 if (e) {
67242 log_packet_detailed("'result' field error detected");
67243 }
67244#ifdef FREECIV_JSON_CONNECTION
67245 field_addr.name = "sub_results";
67246#endif /* FREECIV_JSON_CONNECTION */
67247 e = 0;
67248 e |= DIO_BV_PUT(&dout, &field_addr, packet->sub_results);
67249 if (e) {
67250 log_packet_detailed("'sub_results' field error detected");
67251 }
67252#ifdef FREECIV_JSON_CONNECTION
67253 field_addr.name = "actor_consuming_always";
67254#endif /* FREECIV_JSON_CONNECTION */
67255 e = 0;
67256 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->actor_consuming_always);
67257 if (e) {
67258 log_packet_detailed("'actor_consuming_always' field error detected");
67259 }
67260#ifdef FREECIV_JSON_CONNECTION
67261 field_addr.name = "act_kind";
67262#endif /* FREECIV_JSON_CONNECTION */
67263 e = 0;
67264 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_kind);
67265 if (e) {
67266 log_packet_detailed("'act_kind' field error detected");
67267 }
67268#ifdef FREECIV_JSON_CONNECTION
67269 field_addr.name = "tgt_kind";
67270#endif /* FREECIV_JSON_CONNECTION */
67271 e = 0;
67272 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tgt_kind);
67273 if (e) {
67274 log_packet_detailed("'tgt_kind' field error detected");
67275 }
67276#ifdef FREECIV_JSON_CONNECTION
67277 field_addr.name = "sub_tgt_kind";
67278#endif /* FREECIV_JSON_CONNECTION */
67279 e = 0;
67280 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sub_tgt_kind);
67281 if (e) {
67282 log_packet_detailed("'sub_tgt_kind' field error detected");
67283 }
67284#ifdef FREECIV_JSON_CONNECTION
67285 field_addr.name = "min_distance";
67286#endif /* FREECIV_JSON_CONNECTION */
67287 e = 0;
67288 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_distance);
67289 if (e) {
67290 log_packet_detailed("'min_distance' field error detected");
67291 }
67292#ifdef FREECIV_JSON_CONNECTION
67293 field_addr.name = "max_distance";
67294#endif /* FREECIV_JSON_CONNECTION */
67295 e = 0;
67296 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_distance);
67297 if (e) {
67298 log_packet_detailed("'max_distance' field error detected");
67299 }
67300#ifdef FREECIV_JSON_CONNECTION
67301 field_addr.name = "blocked_by";
67302#endif /* FREECIV_JSON_CONNECTION */
67303 e = 0;
67304 e |= DIO_BV_PUT(&dout, &field_addr, packet->blocked_by);
67305 if (e) {
67306 log_packet_detailed("'blocked_by' field error detected");
67307 }
67308
67309#endif
67310 SEND_PACKET_END(PACKET_RULESET_ACTION);
67311}
67312
67313 int send_packet_ruleset_action(struct connection *pc, const struct packet_ruleset_action *packet)
67314{
67315 if (!pc->used) {
67316 log_error("WARNING: trying to send data to the closed connection %s",
67317 conn_description(pc));
67318 return -1;
67319 }
67320 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION].packet != nullptr, -1,
67321 "Handler for PACKET_RULESET_ACTION not installed");
67322 return pc->phs.handlers->send[PACKET_RULESET_ACTION].packet(pc, packet);
67323}
67324
67325 void lsend_packet_ruleset_action(struct conn_list *dest, const struct packet_ruleset_action *packet)
67326{
67327 conn_list_iterate(dest, pconn) {
67328 send_packet_ruleset_action(pconn, packet);
67329 } conn_list_iterate_end;
67330}
67331
67332 static inline void init_packet_ruleset_action_enabler(struct packet_ruleset_action_enabler *packet)
67333{
67334 memset(packet, 0, sizeof(*packet));
67335}
67336
67337#define free_packet_ruleset_action_enabler(_packet) (void) 0
67338#define destroy_packet_ruleset_action_enabler free
67339
67340#ifdef FREECIV_DELTA_PROTOCOL
67341#define hash_packet_ruleset_action_enabler_100 hash_const
67342
67343#define cmp_packet_ruleset_action_enabler_100 cmp_const
67344
67345 BV_DEFINE(packet_ruleset_action_enabler_100_fields, 5);
67346#endif /* FREECIV_DELTA_PROTOCOL */
67347
67348 static struct packet_ruleset_action_enabler *receive_packet_ruleset_action_enabler_100(struct connection *pc)
67349{
67350#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_action_enabler(_packet)
67351#ifdef FREECIV_DELTA_PROTOCOL
67352 packet_ruleset_action_enabler_100_fields fields;
67353 struct packet_ruleset_action_enabler *old;
67354 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION_ENABLER;
67355#endif /* FREECIV_DELTA_PROTOCOL */
67356 RECEIVE_PACKET_START(packet_ruleset_action_enabler, real_packet);
67357#ifdef FREECIV_JSON_CONNECTION
67358 struct plocation field_addr;
67359 {
67360 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
67361 field_addr = *field_addr_tmp;
67362 FC_FREE(field_addr_tmp);
67363 }
67364#endif /* FREECIV_JSON_CONNECTION */
67365
67366#ifdef FREECIV_DELTA_PROTOCOL
67367#ifdef FREECIV_JSON_CONNECTION
67368 field_addr.name = "fields";
67369#endif /* FREECIV_JSON_CONNECTION */
67370 DIO_BV_GET(&din, &field_addr, fields);
67371
67372#else /* FREECIV_DELTA_PROTOCOL */
67373#ifdef FREECIV_JSON_CONNECTION
67374 field_addr.name = "enabled_action";
67375#endif /* FREECIV_JSON_CONNECTION */
67376 {
67377 int readin;
67378
67379 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
67380 RECEIVE_PACKET_FIELD_ERROR(enabled_action);
67381 }
67382 real_packet->enabled_action = readin;
67383 }
67384#ifdef FREECIV_JSON_CONNECTION
67385 field_addr.name = "actor_reqs_count";
67386#endif /* FREECIV_JSON_CONNECTION */
67387 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->actor_reqs_count)) {
67388 RECEIVE_PACKET_FIELD_ERROR(actor_reqs_count);
67389 }
67390#ifdef FREECIV_JSON_CONNECTION
67391 field_addr.name = "actor_reqs";
67392#endif /* FREECIV_JSON_CONNECTION */
67393 {
67394 int i;
67395
67396#ifdef FREECIV_JSON_CONNECTION
67397 /* Enter array. */
67398 field_addr.sub_location = plocation_elem_new(0);
67399#endif /* FREECIV_JSON_CONNECTION */
67400
67401 if (real_packet->actor_reqs_count > MAX_NUM_REQS) {
67402 RECEIVE_PACKET_FIELD_ERROR(actor_reqs, ": truncation array");
67403 }
67404 for (i = 0; i < real_packet->actor_reqs_count; i++) {
67405#ifdef FREECIV_JSON_CONNECTION
67406 field_addr.sub_location->number = i;
67407#endif /* FREECIV_JSON_CONNECTION */
67408 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->actor_reqs[i])) {
67409 RECEIVE_PACKET_FIELD_ERROR(actor_reqs);
67410 }
67411 }
67412
67413#ifdef FREECIV_JSON_CONNECTION
67414 /* Exit array. */
67415 FC_FREE(field_addr.sub_location);
67416#endif /* FREECIV_JSON_CONNECTION */
67417 }
67418#ifdef FREECIV_JSON_CONNECTION
67419 field_addr.name = "target_reqs_count";
67420#endif /* FREECIV_JSON_CONNECTION */
67421 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->target_reqs_count)) {
67422 RECEIVE_PACKET_FIELD_ERROR(target_reqs_count);
67423 }
67424#ifdef FREECIV_JSON_CONNECTION
67425 field_addr.name = "target_reqs";
67426#endif /* FREECIV_JSON_CONNECTION */
67427 {
67428 int i;
67429
67430#ifdef FREECIV_JSON_CONNECTION
67431 /* Enter array. */
67432 field_addr.sub_location = plocation_elem_new(0);
67433#endif /* FREECIV_JSON_CONNECTION */
67434
67435 if (real_packet->target_reqs_count > MAX_NUM_REQS) {
67436 RECEIVE_PACKET_FIELD_ERROR(target_reqs, ": truncation array");
67437 }
67438 for (i = 0; i < real_packet->target_reqs_count; i++) {
67439#ifdef FREECIV_JSON_CONNECTION
67440 field_addr.sub_location->number = i;
67441#endif /* FREECIV_JSON_CONNECTION */
67442 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->target_reqs[i])) {
67443 RECEIVE_PACKET_FIELD_ERROR(target_reqs);
67444 }
67445 }
67446
67447#ifdef FREECIV_JSON_CONNECTION
67448 /* Exit array. */
67449 FC_FREE(field_addr.sub_location);
67450#endif /* FREECIV_JSON_CONNECTION */
67451 }
67452#endif
67453 log_packet_detailed("packet_ruleset_action_enabler_100: got info about ()");
67454
67455#ifdef FREECIV_DELTA_PROTOCOL
67456 if (nullptr == *hash) {
67457 *hash = genhash_new_full(hash_packet_ruleset_action_enabler_100, cmp_packet_ruleset_action_enabler_100,
67458 nullptr, nullptr, nullptr, destroy_packet_ruleset_action_enabler);
67459 }
67460
67461 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
67462 *real_packet = *old;
67463 } else {
67464 /* packet is already initialized empty */
67465 log_packet_detailed(" no old info");
67466 }
67467
67468 if (BV_ISSET(fields, 0)) {
67469 log_packet_detailed(" got field 'enabled_action'");
67470#ifdef FREECIV_JSON_CONNECTION
67471 field_addr.name = "enabled_action";
67472#endif /* FREECIV_JSON_CONNECTION */
67473 {
67474 int readin;
67475
67476 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
67477 RECEIVE_PACKET_FIELD_ERROR(enabled_action);
67478 }
67479 real_packet->enabled_action = readin;
67480 }
67481 }
67482 if (BV_ISSET(fields, 1)) {
67483 log_packet_detailed(" got field 'actor_reqs_count'");
67484#ifdef FREECIV_JSON_CONNECTION
67485 field_addr.name = "actor_reqs_count";
67486#endif /* FREECIV_JSON_CONNECTION */
67487 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->actor_reqs_count)) {
67488 RECEIVE_PACKET_FIELD_ERROR(actor_reqs_count);
67489 }
67490 }
67491 if (BV_ISSET(fields, 2)) {
67492 log_packet_detailed(" got field 'actor_reqs'");
67493#ifdef FREECIV_JSON_CONNECTION
67494 field_addr.name = "actor_reqs";
67495#endif /* FREECIV_JSON_CONNECTION */
67496 {
67497 int i;
67498
67499#ifdef FREECIV_JSON_CONNECTION
67500 /* Enter array. */
67501 field_addr.sub_location = plocation_elem_new(0);
67502#endif /* FREECIV_JSON_CONNECTION */
67503
67504 if (real_packet->actor_reqs_count > MAX_NUM_REQS) {
67505 RECEIVE_PACKET_FIELD_ERROR(actor_reqs, ": truncation array");
67506 }
67507 for (i = 0; i < real_packet->actor_reqs_count; i++) {
67508#ifdef FREECIV_JSON_CONNECTION
67509 field_addr.sub_location->number = i;
67510#endif /* FREECIV_JSON_CONNECTION */
67511 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->actor_reqs[i])) {
67512 RECEIVE_PACKET_FIELD_ERROR(actor_reqs);
67513 }
67514 }
67515
67516#ifdef FREECIV_JSON_CONNECTION
67517 /* Exit array. */
67518 FC_FREE(field_addr.sub_location);
67519#endif /* FREECIV_JSON_CONNECTION */
67520 }
67521 }
67522 if (BV_ISSET(fields, 3)) {
67523 log_packet_detailed(" got field 'target_reqs_count'");
67524#ifdef FREECIV_JSON_CONNECTION
67525 field_addr.name = "target_reqs_count";
67526#endif /* FREECIV_JSON_CONNECTION */
67527 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->target_reqs_count)) {
67528 RECEIVE_PACKET_FIELD_ERROR(target_reqs_count);
67529 }
67530 }
67531 if (BV_ISSET(fields, 4)) {
67532 log_packet_detailed(" got field 'target_reqs'");
67533#ifdef FREECIV_JSON_CONNECTION
67534 field_addr.name = "target_reqs";
67535#endif /* FREECIV_JSON_CONNECTION */
67536 {
67537 int i;
67538
67539#ifdef FREECIV_JSON_CONNECTION
67540 /* Enter array. */
67541 field_addr.sub_location = plocation_elem_new(0);
67542#endif /* FREECIV_JSON_CONNECTION */
67543
67544 if (real_packet->target_reqs_count > MAX_NUM_REQS) {
67545 RECEIVE_PACKET_FIELD_ERROR(target_reqs, ": truncation array");
67546 }
67547 for (i = 0; i < real_packet->target_reqs_count; i++) {
67548#ifdef FREECIV_JSON_CONNECTION
67549 field_addr.sub_location->number = i;
67550#endif /* FREECIV_JSON_CONNECTION */
67551 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->target_reqs[i])) {
67552 RECEIVE_PACKET_FIELD_ERROR(target_reqs);
67553 }
67554 }
67555
67556#ifdef FREECIV_JSON_CONNECTION
67557 /* Exit array. */
67558 FC_FREE(field_addr.sub_location);
67559#endif /* FREECIV_JSON_CONNECTION */
67560 }
67561 }
67562
67563 if (nullptr == old) {
67564 old = fc_malloc(sizeof(*old));
67565 init_packet_ruleset_action_enabler(old);
67566 *old = *real_packet;
67567 genhash_insert(*hash, old, old);
67568 } else {
67569 *old = *real_packet;
67570 }
67571
67572#endif /* FREECIV_DELTA_PROTOCOL */
67573 RECEIVE_PACKET_END(real_packet);
67574#undef FREE_PACKET_STRUCT
67575}
67576
67577 static int send_packet_ruleset_action_enabler_100(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
67578{
67579 const struct packet_ruleset_action_enabler *real_packet = packet;
67580 int e;
67581#ifdef FREECIV_DELTA_PROTOCOL
67582 packet_ruleset_action_enabler_100_fields fields;
67583 struct packet_ruleset_action_enabler *old;
67584 bool differ;
67585 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION_ENABLER;
67586#endif /* FREECIV_DELTA_PROTOCOL */
67587 SEND_PACKET_START(PACKET_RULESET_ACTION_ENABLER);
67588#ifdef FREECIV_JSON_CONNECTION
67589 struct plocation field_addr;
67590 {
67591 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
67592 field_addr = *field_addr_tmp;
67593 FC_FREE(field_addr_tmp);
67594 }
67595#endif /* FREECIV_JSON_CONNECTION */
67596
67597 log_packet_detailed("packet_ruleset_action_enabler_100: sending info about ()");
67598
67599#ifdef FREECIV_DELTA_PROTOCOL
67600 if (nullptr == *hash) {
67601 *hash = genhash_new_full(hash_packet_ruleset_action_enabler_100, cmp_packet_ruleset_action_enabler_100,
67602 nullptr, nullptr, nullptr, destroy_packet_ruleset_action_enabler);
67603 }
67604 BV_CLR_ALL(fields);
67605
67606 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
67607 old = fc_malloc(sizeof(*old));
67608 /* temporary bitcopy just to insert correctly */
67609 *old = *real_packet;
67610 genhash_insert(*hash, old, old);
67611 init_packet_ruleset_action_enabler(old);
67612 }
67613 differ = (old->enabled_action != real_packet->enabled_action);
67614 if (differ) {
67615 BV_SET(fields, 0);
67616 }
67617
67618 differ = (old->actor_reqs_count != real_packet->actor_reqs_count);
67619 if (differ) {
67620 BV_SET(fields, 1);
67621 }
67622
67623 differ = (old->actor_reqs_count != real_packet->actor_reqs_count);
67624 if (!differ) {
67625 int i;
67626
67627 for (i = 0; i < real_packet->actor_reqs_count; i++) {
67628 differ = !are_requirements_equal(&old->actor_reqs[i], &real_packet->actor_reqs[i]);
67629 if (differ) {
67630 break;
67631 }
67632 }
67633 }
67634 if (differ) {
67635 BV_SET(fields, 2);
67636 }
67637
67638 differ = (old->target_reqs_count != real_packet->target_reqs_count);
67639 if (differ) {
67640 BV_SET(fields, 3);
67641 }
67642
67643 differ = (old->target_reqs_count != real_packet->target_reqs_count);
67644 if (!differ) {
67645 int i;
67646
67647 for (i = 0; i < real_packet->target_reqs_count; i++) {
67648 differ = !are_requirements_equal(&old->target_reqs[i], &real_packet->target_reqs[i]);
67649 if (differ) {
67650 break;
67651 }
67652 }
67653 }
67654 if (differ) {
67655 BV_SET(fields, 4);
67656 }
67657
67658
67659#ifdef FREECIV_JSON_CONNECTION
67660 field_addr.name = "fields";
67661#endif /* FREECIV_JSON_CONNECTION */
67662 e = 0;
67663 e |= DIO_BV_PUT(&dout, &field_addr, fields);
67664 if (e) {
67665 log_packet_detailed("fields bitvector error detected");
67666 }
67667
67668 if (BV_ISSET(fields, 0)) {
67669 log_packet_detailed(" field 'enabled_action' has changed");
67670#ifdef FREECIV_JSON_CONNECTION
67671 field_addr.name = "enabled_action";
67672#endif /* FREECIV_JSON_CONNECTION */
67673 e = 0;
67674 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->enabled_action);
67675 if (e) {
67676 log_packet_detailed("'enabled_action' field error detected");
67677 }
67678 }
67679 if (BV_ISSET(fields, 1)) {
67680 log_packet_detailed(" field 'actor_reqs_count' has changed");
67681#ifdef FREECIV_JSON_CONNECTION
67682 field_addr.name = "actor_reqs_count";
67683#endif /* FREECIV_JSON_CONNECTION */
67684 e = 0;
67685 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->actor_reqs_count);
67686 if (e) {
67687 log_packet_detailed("'actor_reqs_count' field error detected");
67688 }
67689 }
67690 if (BV_ISSET(fields, 2)) {
67691 log_packet_detailed(" field 'actor_reqs' has changed");
67692#ifdef FREECIV_JSON_CONNECTION
67693 field_addr.name = "actor_reqs";
67694#endif /* FREECIV_JSON_CONNECTION */
67695 e = 0;
67696 {
67697 int i;
67698
67699#ifdef FREECIV_JSON_CONNECTION
67700 /* Create the array. */
67701 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->actor_reqs_count);
67702
67703 /* Enter the array. */
67704 field_addr.sub_location = plocation_elem_new(0);
67705#endif /* FREECIV_JSON_CONNECTION */
67706
67707 for (i = 0; i < real_packet->actor_reqs_count; i++) {
67708#ifdef FREECIV_JSON_CONNECTION
67709 /* Next array element. */
67710 field_addr.sub_location->number = i;
67711#endif /* FREECIV_JSON_CONNECTION */
67712 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->actor_reqs[i]);
67713 }
67714
67715#ifdef FREECIV_JSON_CONNECTION
67716 /* Exit array. */
67717 FC_FREE(field_addr.sub_location);
67718#endif /* FREECIV_JSON_CONNECTION */
67719 }
67720 if (e) {
67721 log_packet_detailed("'actor_reqs' field error detected");
67722 }
67723 }
67724 if (BV_ISSET(fields, 3)) {
67725 log_packet_detailed(" field 'target_reqs_count' has changed");
67726#ifdef FREECIV_JSON_CONNECTION
67727 field_addr.name = "target_reqs_count";
67728#endif /* FREECIV_JSON_CONNECTION */
67729 e = 0;
67730 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->target_reqs_count);
67731 if (e) {
67732 log_packet_detailed("'target_reqs_count' field error detected");
67733 }
67734 }
67735 if (BV_ISSET(fields, 4)) {
67736 log_packet_detailed(" field 'target_reqs' has changed");
67737#ifdef FREECIV_JSON_CONNECTION
67738 field_addr.name = "target_reqs";
67739#endif /* FREECIV_JSON_CONNECTION */
67740 e = 0;
67741 {
67742 int i;
67743
67744#ifdef FREECIV_JSON_CONNECTION
67745 /* Create the array. */
67746 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->target_reqs_count);
67747
67748 /* Enter the array. */
67749 field_addr.sub_location = plocation_elem_new(0);
67750#endif /* FREECIV_JSON_CONNECTION */
67751
67752 for (i = 0; i < real_packet->target_reqs_count; i++) {
67753#ifdef FREECIV_JSON_CONNECTION
67754 /* Next array element. */
67755 field_addr.sub_location->number = i;
67756#endif /* FREECIV_JSON_CONNECTION */
67757 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->target_reqs[i]);
67758 }
67759
67760#ifdef FREECIV_JSON_CONNECTION
67761 /* Exit array. */
67762 FC_FREE(field_addr.sub_location);
67763#endif /* FREECIV_JSON_CONNECTION */
67764 }
67765 if (e) {
67766 log_packet_detailed("'target_reqs' field error detected");
67767 }
67768 }
67769
67770 *old = *real_packet;
67771#endif /* FREECIV_DELTA_PROTOCOL */
67772#ifndef FREECIV_DELTA_PROTOCOL
67773#ifdef FREECIV_JSON_CONNECTION
67774 field_addr.name = "enabled_action";
67775#endif /* FREECIV_JSON_CONNECTION */
67776 e = 0;
67777 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->enabled_action);
67778 if (e) {
67779 log_packet_detailed("'enabled_action' field error detected");
67780 }
67781#ifdef FREECIV_JSON_CONNECTION
67782 field_addr.name = "actor_reqs_count";
67783#endif /* FREECIV_JSON_CONNECTION */
67784 e = 0;
67785 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->actor_reqs_count);
67786 if (e) {
67787 log_packet_detailed("'actor_reqs_count' field error detected");
67788 }
67789#ifdef FREECIV_JSON_CONNECTION
67790 field_addr.name = "actor_reqs";
67791#endif /* FREECIV_JSON_CONNECTION */
67792 e = 0;
67793 {
67794 int i;
67795
67796#ifdef FREECIV_JSON_CONNECTION
67797 /* Create the array. */
67798 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->actor_reqs_count);
67799
67800 /* Enter the array. */
67801 field_addr.sub_location = plocation_elem_new(0);
67802#endif /* FREECIV_JSON_CONNECTION */
67803
67804 for (i = 0; i < real_packet->actor_reqs_count; i++) {
67805#ifdef FREECIV_JSON_CONNECTION
67806 /* Next array element. */
67807 field_addr.sub_location->number = i;
67808#endif /* FREECIV_JSON_CONNECTION */
67809 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->actor_reqs[i]);
67810 }
67811
67812#ifdef FREECIV_JSON_CONNECTION
67813 /* Exit array. */
67814 FC_FREE(field_addr.sub_location);
67815#endif /* FREECIV_JSON_CONNECTION */
67816 }
67817 if (e) {
67818 log_packet_detailed("'actor_reqs' field error detected");
67819 }
67820#ifdef FREECIV_JSON_CONNECTION
67821 field_addr.name = "target_reqs_count";
67822#endif /* FREECIV_JSON_CONNECTION */
67823 e = 0;
67824 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->target_reqs_count);
67825 if (e) {
67826 log_packet_detailed("'target_reqs_count' field error detected");
67827 }
67828#ifdef FREECIV_JSON_CONNECTION
67829 field_addr.name = "target_reqs";
67830#endif /* FREECIV_JSON_CONNECTION */
67831 e = 0;
67832 {
67833 int i;
67834
67835#ifdef FREECIV_JSON_CONNECTION
67836 /* Create the array. */
67837 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->target_reqs_count);
67838
67839 /* Enter the array. */
67840 field_addr.sub_location = plocation_elem_new(0);
67841#endif /* FREECIV_JSON_CONNECTION */
67842
67843 for (i = 0; i < real_packet->target_reqs_count; i++) {
67844#ifdef FREECIV_JSON_CONNECTION
67845 /* Next array element. */
67846 field_addr.sub_location->number = i;
67847#endif /* FREECIV_JSON_CONNECTION */
67848 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->target_reqs[i]);
67849 }
67850
67851#ifdef FREECIV_JSON_CONNECTION
67852 /* Exit array. */
67853 FC_FREE(field_addr.sub_location);
67854#endif /* FREECIV_JSON_CONNECTION */
67855 }
67856 if (e) {
67857 log_packet_detailed("'target_reqs' field error detected");
67858 }
67859
67860#endif
67861 SEND_PACKET_END(PACKET_RULESET_ACTION_ENABLER);
67862}
67863
67864 int send_packet_ruleset_action_enabler(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
67865{
67866 if (!pc->used) {
67867 log_error("WARNING: trying to send data to the closed connection %s",
67868 conn_description(pc));
67869 return -1;
67870 }
67871 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION_ENABLER].packet != nullptr, -1,
67872 "Handler for PACKET_RULESET_ACTION_ENABLER not installed");
67873 return pc->phs.handlers->send[PACKET_RULESET_ACTION_ENABLER].packet(pc, packet);
67874}
67875
67876 void lsend_packet_ruleset_action_enabler(struct conn_list *dest, const struct packet_ruleset_action_enabler *packet)
67877{
67878 conn_list_iterate(dest, pconn) {
67879 send_packet_ruleset_action_enabler(pconn, packet);
67880 } conn_list_iterate_end;
67881}
67882
67883 static inline void init_packet_ruleset_action_auto(struct packet_ruleset_action_auto *packet)
67884{
67885 memset(packet, 0, sizeof(*packet));
67886}
67887
67888#define free_packet_ruleset_action_auto(_packet) (void) 0
67889#define destroy_packet_ruleset_action_auto free
67890
67891#ifdef FREECIV_DELTA_PROTOCOL
67892#define hash_packet_ruleset_action_auto_100 hash_const
67893
67894#define cmp_packet_ruleset_action_auto_100 cmp_const
67895
67896 BV_DEFINE(packet_ruleset_action_auto_100_fields, 6);
67897#endif /* FREECIV_DELTA_PROTOCOL */
67898
67899 static struct packet_ruleset_action_auto *receive_packet_ruleset_action_auto_100(struct connection *pc)
67900{
67901#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_action_auto(_packet)
67902#ifdef FREECIV_DELTA_PROTOCOL
67903 packet_ruleset_action_auto_100_fields fields;
67904 struct packet_ruleset_action_auto *old;
67905 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION_AUTO;
67906#endif /* FREECIV_DELTA_PROTOCOL */
67907 RECEIVE_PACKET_START(packet_ruleset_action_auto, real_packet);
67908#ifdef FREECIV_JSON_CONNECTION
67909 struct plocation field_addr;
67910 {
67911 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
67912 field_addr = *field_addr_tmp;
67913 FC_FREE(field_addr_tmp);
67914 }
67915#endif /* FREECIV_JSON_CONNECTION */
67916
67917#ifdef FREECIV_DELTA_PROTOCOL
67918#ifdef FREECIV_JSON_CONNECTION
67919 field_addr.name = "fields";
67920#endif /* FREECIV_JSON_CONNECTION */
67921 DIO_BV_GET(&din, &field_addr, fields);
67922
67923#else /* FREECIV_DELTA_PROTOCOL */
67924#ifdef FREECIV_JSON_CONNECTION
67925 field_addr.name = "id";
67926#endif /* FREECIV_JSON_CONNECTION */
67927 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
67928 RECEIVE_PACKET_FIELD_ERROR(id);
67929 }
67930#ifdef FREECIV_JSON_CONNECTION
67931 field_addr.name = "cause";
67932#endif /* FREECIV_JSON_CONNECTION */
67933 {
67934 int readin;
67935
67936 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
67937 RECEIVE_PACKET_FIELD_ERROR(cause);
67938 }
67939 real_packet->cause = readin;
67940 }
67941#ifdef FREECIV_JSON_CONNECTION
67942 field_addr.name = "reqs_count";
67943#endif /* FREECIV_JSON_CONNECTION */
67944 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
67945 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
67946 }
67947#ifdef FREECIV_JSON_CONNECTION
67948 field_addr.name = "reqs";
67949#endif /* FREECIV_JSON_CONNECTION */
67950 {
67951 int i;
67952
67953#ifdef FREECIV_JSON_CONNECTION
67954 /* Enter array. */
67955 field_addr.sub_location = plocation_elem_new(0);
67956#endif /* FREECIV_JSON_CONNECTION */
67957
67958 if (real_packet->reqs_count > MAX_NUM_REQS) {
67959 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
67960 }
67961 for (i = 0; i < real_packet->reqs_count; i++) {
67962#ifdef FREECIV_JSON_CONNECTION
67963 field_addr.sub_location->number = i;
67964#endif /* FREECIV_JSON_CONNECTION */
67965 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
67966 RECEIVE_PACKET_FIELD_ERROR(reqs);
67967 }
67968 }
67969
67970#ifdef FREECIV_JSON_CONNECTION
67971 /* Exit array. */
67972 FC_FREE(field_addr.sub_location);
67973#endif /* FREECIV_JSON_CONNECTION */
67974 }
67975#ifdef FREECIV_JSON_CONNECTION
67976 field_addr.name = "alternatives_count";
67977#endif /* FREECIV_JSON_CONNECTION */
67978 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->alternatives_count)) {
67979 RECEIVE_PACKET_FIELD_ERROR(alternatives_count);
67980 }
67981#ifdef FREECIV_JSON_CONNECTION
67982 field_addr.name = "alternatives";
67983#endif /* FREECIV_JSON_CONNECTION */
67984 {
67985 int i;
67986
67987#ifdef FREECIV_JSON_CONNECTION
67988 /* Enter array. */
67989 field_addr.sub_location = plocation_elem_new(0);
67990#endif /* FREECIV_JSON_CONNECTION */
67991
67992 if (real_packet->alternatives_count > MAX_NUM_ACTIONS) {
67993 RECEIVE_PACKET_FIELD_ERROR(alternatives, ": truncation array");
67994 }
67995 for (i = 0; i < real_packet->alternatives_count; i++) {
67996#ifdef FREECIV_JSON_CONNECTION
67997 field_addr.sub_location->number = i;
67998#endif /* FREECIV_JSON_CONNECTION */
67999 {
68000 int readin;
68001
68002 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68003 RECEIVE_PACKET_FIELD_ERROR(alternatives);
68004 }
68005 real_packet->alternatives[i] = readin;
68006 }
68007 }
68008
68009#ifdef FREECIV_JSON_CONNECTION
68010 /* Exit array. */
68011 FC_FREE(field_addr.sub_location);
68012#endif /* FREECIV_JSON_CONNECTION */
68013 }
68014#endif
68015 log_packet_detailed("packet_ruleset_action_auto_100: got info about ()");
68016
68017#ifdef FREECIV_DELTA_PROTOCOL
68018 if (nullptr == *hash) {
68019 *hash = genhash_new_full(hash_packet_ruleset_action_auto_100, cmp_packet_ruleset_action_auto_100,
68020 nullptr, nullptr, nullptr, destroy_packet_ruleset_action_auto);
68021 }
68022
68023 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
68024 *real_packet = *old;
68025 } else {
68026 /* packet is already initialized empty */
68027 log_packet_detailed(" no old info");
68028 }
68029
68030 if (BV_ISSET(fields, 0)) {
68031 log_packet_detailed(" got field 'id'");
68032#ifdef FREECIV_JSON_CONNECTION
68033 field_addr.name = "id";
68034#endif /* FREECIV_JSON_CONNECTION */
68035 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
68036 RECEIVE_PACKET_FIELD_ERROR(id);
68037 }
68038 }
68039 if (BV_ISSET(fields, 1)) {
68040 log_packet_detailed(" got field 'cause'");
68041#ifdef FREECIV_JSON_CONNECTION
68042 field_addr.name = "cause";
68043#endif /* FREECIV_JSON_CONNECTION */
68044 {
68045 int readin;
68046
68047 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68048 RECEIVE_PACKET_FIELD_ERROR(cause);
68049 }
68050 real_packet->cause = readin;
68051 }
68052 }
68053 if (BV_ISSET(fields, 2)) {
68054 log_packet_detailed(" got field 'reqs_count'");
68055#ifdef FREECIV_JSON_CONNECTION
68056 field_addr.name = "reqs_count";
68057#endif /* FREECIV_JSON_CONNECTION */
68058 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
68059 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
68060 }
68061 }
68062 if (BV_ISSET(fields, 3)) {
68063 log_packet_detailed(" got field 'reqs'");
68064#ifdef FREECIV_JSON_CONNECTION
68065 field_addr.name = "reqs";
68066#endif /* FREECIV_JSON_CONNECTION */
68067 {
68068 int i;
68069
68070#ifdef FREECIV_JSON_CONNECTION
68071 /* Enter array. */
68072 field_addr.sub_location = plocation_elem_new(0);
68073#endif /* FREECIV_JSON_CONNECTION */
68074
68075 if (real_packet->reqs_count > MAX_NUM_REQS) {
68076 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
68077 }
68078 for (i = 0; i < real_packet->reqs_count; i++) {
68079#ifdef FREECIV_JSON_CONNECTION
68080 field_addr.sub_location->number = i;
68081#endif /* FREECIV_JSON_CONNECTION */
68082 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
68083 RECEIVE_PACKET_FIELD_ERROR(reqs);
68084 }
68085 }
68086
68087#ifdef FREECIV_JSON_CONNECTION
68088 /* Exit array. */
68089 FC_FREE(field_addr.sub_location);
68090#endif /* FREECIV_JSON_CONNECTION */
68091 }
68092 }
68093 if (BV_ISSET(fields, 4)) {
68094 log_packet_detailed(" got field 'alternatives_count'");
68095#ifdef FREECIV_JSON_CONNECTION
68096 field_addr.name = "alternatives_count";
68097#endif /* FREECIV_JSON_CONNECTION */
68098 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->alternatives_count)) {
68099 RECEIVE_PACKET_FIELD_ERROR(alternatives_count);
68100 }
68101 }
68102 if (BV_ISSET(fields, 5)) {
68103 log_packet_detailed(" got field 'alternatives'");
68104#ifdef FREECIV_JSON_CONNECTION
68105 field_addr.name = "alternatives";
68106#endif /* FREECIV_JSON_CONNECTION */
68107 {
68108 int i;
68109
68110#ifdef FREECIV_JSON_CONNECTION
68111 /* Enter array. */
68112 field_addr.sub_location = plocation_elem_new(0);
68113#endif /* FREECIV_JSON_CONNECTION */
68114
68115 if (real_packet->alternatives_count > MAX_NUM_ACTIONS) {
68116 RECEIVE_PACKET_FIELD_ERROR(alternatives, ": truncation array");
68117 }
68118 for (i = 0; i < real_packet->alternatives_count; i++) {
68119#ifdef FREECIV_JSON_CONNECTION
68120 field_addr.sub_location->number = i;
68121#endif /* FREECIV_JSON_CONNECTION */
68122 {
68123 int readin;
68124
68125 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68126 RECEIVE_PACKET_FIELD_ERROR(alternatives);
68127 }
68128 real_packet->alternatives[i] = readin;
68129 }
68130 }
68131
68132#ifdef FREECIV_JSON_CONNECTION
68133 /* Exit array. */
68134 FC_FREE(field_addr.sub_location);
68135#endif /* FREECIV_JSON_CONNECTION */
68136 }
68137 }
68138
68139 if (nullptr == old) {
68140 old = fc_malloc(sizeof(*old));
68141 init_packet_ruleset_action_auto(old);
68142 *old = *real_packet;
68143 genhash_insert(*hash, old, old);
68144 } else {
68145 *old = *real_packet;
68146 }
68147
68148#endif /* FREECIV_DELTA_PROTOCOL */
68149 RECEIVE_PACKET_END(real_packet);
68150#undef FREE_PACKET_STRUCT
68151}
68152
68153 static int send_packet_ruleset_action_auto_100(struct connection *pc, const struct packet_ruleset_action_auto *packet)
68154{
68155 const struct packet_ruleset_action_auto *real_packet = packet;
68156 int e;
68157#ifdef FREECIV_DELTA_PROTOCOL
68158 packet_ruleset_action_auto_100_fields fields;
68159 struct packet_ruleset_action_auto *old;
68160 bool differ;
68161 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION_AUTO;
68162#endif /* FREECIV_DELTA_PROTOCOL */
68163 SEND_PACKET_START(PACKET_RULESET_ACTION_AUTO);
68164#ifdef FREECIV_JSON_CONNECTION
68165 struct plocation field_addr;
68166 {
68167 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
68168 field_addr = *field_addr_tmp;
68169 FC_FREE(field_addr_tmp);
68170 }
68171#endif /* FREECIV_JSON_CONNECTION */
68172
68173 log_packet_detailed("packet_ruleset_action_auto_100: sending info about ()");
68174
68175#ifdef FREECIV_DELTA_PROTOCOL
68176 if (nullptr == *hash) {
68177 *hash = genhash_new_full(hash_packet_ruleset_action_auto_100, cmp_packet_ruleset_action_auto_100,
68178 nullptr, nullptr, nullptr, destroy_packet_ruleset_action_auto);
68179 }
68180 BV_CLR_ALL(fields);
68181
68182 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
68183 old = fc_malloc(sizeof(*old));
68184 /* temporary bitcopy just to insert correctly */
68185 *old = *real_packet;
68186 genhash_insert(*hash, old, old);
68187 init_packet_ruleset_action_auto(old);
68188 }
68189 differ = (old->id != real_packet->id);
68190 if (differ) {
68191 BV_SET(fields, 0);
68192 }
68193
68194 differ = (old->cause != real_packet->cause);
68195 if (differ) {
68196 BV_SET(fields, 1);
68197 }
68198
68199 differ = (old->reqs_count != real_packet->reqs_count);
68200 if (differ) {
68201 BV_SET(fields, 2);
68202 }
68203
68204 differ = (old->reqs_count != real_packet->reqs_count);
68205 if (!differ) {
68206 int i;
68207
68208 for (i = 0; i < real_packet->reqs_count; i++) {
68209 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
68210 if (differ) {
68211 break;
68212 }
68213 }
68214 }
68215 if (differ) {
68216 BV_SET(fields, 3);
68217 }
68218
68219 differ = (old->alternatives_count != real_packet->alternatives_count);
68220 if (differ) {
68221 BV_SET(fields, 4);
68222 }
68223
68224 differ = (old->alternatives_count != real_packet->alternatives_count);
68225 if (!differ) {
68226 int i;
68227
68228 for (i = 0; i < real_packet->alternatives_count; i++) {
68229 differ = (old->alternatives[i] != real_packet->alternatives[i]);
68230 if (differ) {
68231 break;
68232 }
68233 }
68234 }
68235 if (differ) {
68236 BV_SET(fields, 5);
68237 }
68238
68239
68240#ifdef FREECIV_JSON_CONNECTION
68241 field_addr.name = "fields";
68242#endif /* FREECIV_JSON_CONNECTION */
68243 e = 0;
68244 e |= DIO_BV_PUT(&dout, &field_addr, fields);
68245 if (e) {
68246 log_packet_detailed("fields bitvector error detected");
68247 }
68248
68249 if (BV_ISSET(fields, 0)) {
68250 log_packet_detailed(" field 'id' has changed");
68251#ifdef FREECIV_JSON_CONNECTION
68252 field_addr.name = "id";
68253#endif /* FREECIV_JSON_CONNECTION */
68254 e = 0;
68255 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
68256 if (e) {
68257 log_packet_detailed("'id' field error detected");
68258 }
68259 }
68260 if (BV_ISSET(fields, 1)) {
68261 log_packet_detailed(" field 'cause' has changed");
68262#ifdef FREECIV_JSON_CONNECTION
68263 field_addr.name = "cause";
68264#endif /* FREECIV_JSON_CONNECTION */
68265 e = 0;
68266 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cause);
68267 if (e) {
68268 log_packet_detailed("'cause' field error detected");
68269 }
68270 }
68271 if (BV_ISSET(fields, 2)) {
68272 log_packet_detailed(" field 'reqs_count' has changed");
68273#ifdef FREECIV_JSON_CONNECTION
68274 field_addr.name = "reqs_count";
68275#endif /* FREECIV_JSON_CONNECTION */
68276 e = 0;
68277 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
68278 if (e) {
68279 log_packet_detailed("'reqs_count' field error detected");
68280 }
68281 }
68282 if (BV_ISSET(fields, 3)) {
68283 log_packet_detailed(" field 'reqs' has changed");
68284#ifdef FREECIV_JSON_CONNECTION
68285 field_addr.name = "reqs";
68286#endif /* FREECIV_JSON_CONNECTION */
68287 e = 0;
68288 {
68289 int i;
68290
68291#ifdef FREECIV_JSON_CONNECTION
68292 /* Create the array. */
68293 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
68294
68295 /* Enter the array. */
68296 field_addr.sub_location = plocation_elem_new(0);
68297#endif /* FREECIV_JSON_CONNECTION */
68298
68299 for (i = 0; i < real_packet->reqs_count; i++) {
68300#ifdef FREECIV_JSON_CONNECTION
68301 /* Next array element. */
68302 field_addr.sub_location->number = i;
68303#endif /* FREECIV_JSON_CONNECTION */
68304 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
68305 }
68306
68307#ifdef FREECIV_JSON_CONNECTION
68308 /* Exit array. */
68309 FC_FREE(field_addr.sub_location);
68310#endif /* FREECIV_JSON_CONNECTION */
68311 }
68312 if (e) {
68313 log_packet_detailed("'reqs' field error detected");
68314 }
68315 }
68316 if (BV_ISSET(fields, 4)) {
68317 log_packet_detailed(" field 'alternatives_count' has changed");
68318#ifdef FREECIV_JSON_CONNECTION
68319 field_addr.name = "alternatives_count";
68320#endif /* FREECIV_JSON_CONNECTION */
68321 e = 0;
68322 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives_count);
68323 if (e) {
68324 log_packet_detailed("'alternatives_count' field error detected");
68325 }
68326 }
68327 if (BV_ISSET(fields, 5)) {
68328 log_packet_detailed(" field 'alternatives' has changed");
68329#ifdef FREECIV_JSON_CONNECTION
68330 field_addr.name = "alternatives";
68331#endif /* FREECIV_JSON_CONNECTION */
68332 e = 0;
68333 {
68334 int i;
68335
68336#ifdef FREECIV_JSON_CONNECTION
68337 /* Create the array. */
68338 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->alternatives_count);
68339
68340 /* Enter the array. */
68341 field_addr.sub_location = plocation_elem_new(0);
68342#endif /* FREECIV_JSON_CONNECTION */
68343
68344 for (i = 0; i < real_packet->alternatives_count; i++) {
68345#ifdef FREECIV_JSON_CONNECTION
68346 /* Next array element. */
68347 field_addr.sub_location->number = i;
68348#endif /* FREECIV_JSON_CONNECTION */
68349 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives[i]);
68350 }
68351
68352#ifdef FREECIV_JSON_CONNECTION
68353 /* Exit array. */
68354 FC_FREE(field_addr.sub_location);
68355#endif /* FREECIV_JSON_CONNECTION */
68356 }
68357 if (e) {
68358 log_packet_detailed("'alternatives' field error detected");
68359 }
68360 }
68361
68362 *old = *real_packet;
68363#endif /* FREECIV_DELTA_PROTOCOL */
68364#ifndef FREECIV_DELTA_PROTOCOL
68365#ifdef FREECIV_JSON_CONNECTION
68366 field_addr.name = "id";
68367#endif /* FREECIV_JSON_CONNECTION */
68368 e = 0;
68369 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
68370 if (e) {
68371 log_packet_detailed("'id' field error detected");
68372 }
68373#ifdef FREECIV_JSON_CONNECTION
68374 field_addr.name = "cause";
68375#endif /* FREECIV_JSON_CONNECTION */
68376 e = 0;
68377 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cause);
68378 if (e) {
68379 log_packet_detailed("'cause' field error detected");
68380 }
68381#ifdef FREECIV_JSON_CONNECTION
68382 field_addr.name = "reqs_count";
68383#endif /* FREECIV_JSON_CONNECTION */
68384 e = 0;
68385 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
68386 if (e) {
68387 log_packet_detailed("'reqs_count' field error detected");
68388 }
68389#ifdef FREECIV_JSON_CONNECTION
68390 field_addr.name = "reqs";
68391#endif /* FREECIV_JSON_CONNECTION */
68392 e = 0;
68393 {
68394 int i;
68395
68396#ifdef FREECIV_JSON_CONNECTION
68397 /* Create the array. */
68398 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
68399
68400 /* Enter the array. */
68401 field_addr.sub_location = plocation_elem_new(0);
68402#endif /* FREECIV_JSON_CONNECTION */
68403
68404 for (i = 0; i < real_packet->reqs_count; i++) {
68405#ifdef FREECIV_JSON_CONNECTION
68406 /* Next array element. */
68407 field_addr.sub_location->number = i;
68408#endif /* FREECIV_JSON_CONNECTION */
68409 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
68410 }
68411
68412#ifdef FREECIV_JSON_CONNECTION
68413 /* Exit array. */
68414 FC_FREE(field_addr.sub_location);
68415#endif /* FREECIV_JSON_CONNECTION */
68416 }
68417 if (e) {
68418 log_packet_detailed("'reqs' field error detected");
68419 }
68420#ifdef FREECIV_JSON_CONNECTION
68421 field_addr.name = "alternatives_count";
68422#endif /* FREECIV_JSON_CONNECTION */
68423 e = 0;
68424 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives_count);
68425 if (e) {
68426 log_packet_detailed("'alternatives_count' field error detected");
68427 }
68428#ifdef FREECIV_JSON_CONNECTION
68429 field_addr.name = "alternatives";
68430#endif /* FREECIV_JSON_CONNECTION */
68431 e = 0;
68432 {
68433 int i;
68434
68435#ifdef FREECIV_JSON_CONNECTION
68436 /* Create the array. */
68437 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->alternatives_count);
68438
68439 /* Enter the array. */
68440 field_addr.sub_location = plocation_elem_new(0);
68441#endif /* FREECIV_JSON_CONNECTION */
68442
68443 for (i = 0; i < real_packet->alternatives_count; i++) {
68444#ifdef FREECIV_JSON_CONNECTION
68445 /* Next array element. */
68446 field_addr.sub_location->number = i;
68447#endif /* FREECIV_JSON_CONNECTION */
68448 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives[i]);
68449 }
68450
68451#ifdef FREECIV_JSON_CONNECTION
68452 /* Exit array. */
68453 FC_FREE(field_addr.sub_location);
68454#endif /* FREECIV_JSON_CONNECTION */
68455 }
68456 if (e) {
68457 log_packet_detailed("'alternatives' field error detected");
68458 }
68459
68460#endif
68461 SEND_PACKET_END(PACKET_RULESET_ACTION_AUTO);
68462}
68463
68464 int send_packet_ruleset_action_auto(struct connection *pc, const struct packet_ruleset_action_auto *packet)
68465{
68466 if (!pc->used) {
68467 log_error("WARNING: trying to send data to the closed connection %s",
68468 conn_description(pc));
68469 return -1;
68470 }
68471 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION_AUTO].packet != nullptr, -1,
68472 "Handler for PACKET_RULESET_ACTION_AUTO not installed");
68473 return pc->phs.handlers->send[PACKET_RULESET_ACTION_AUTO].packet(pc, packet);
68474}
68475
68476 void lsend_packet_ruleset_action_auto(struct conn_list *dest, const struct packet_ruleset_action_auto *packet)
68477{
68478 conn_list_iterate(dest, pconn) {
68479 send_packet_ruleset_action_auto(pconn, packet);
68480 } conn_list_iterate_end;
68481}
68482
68483 static inline void init_packet_ruleset_counter(struct packet_ruleset_counter *packet)
68484{
68485 memset(packet, 0, sizeof(*packet));
68486
68487 /* no work needed for packet->name */
68488 /* no work needed for packet->rule_name */
68489 packet->helptext = strvec_new();
68490 /* no work needed for packet->def */
68491 /* no work needed for packet->checkpoint */
68492 /* no work needed for packet->type */
68493 /* no work needed for packet->behaviour */
68494}
68495
68496 static inline void free_packet_ruleset_counter(struct packet_ruleset_counter *packet)
68497{
68498 /* no work needed for packet->behaviour */
68499 /* no work needed for packet->type */
68500 /* no work needed for packet->checkpoint */
68501 /* no work needed for packet->def */
68502 if (packet->helptext) {
68503 strvec_destroy(packet->helptext);
68504 packet->helptext = nullptr;
68505 }
68506 /* no work needed for packet->rule_name */
68507 /* no work needed for packet->name */
68508}
68509
68510 static inline void destroy_packet_ruleset_counter(void *packet)
68511{
68512 free_packet_ruleset_counter((struct packet_ruleset_counter *) packet);
68513 free(packet);
68514}
68515
68516#ifdef FREECIV_DELTA_PROTOCOL
68517#define hash_packet_ruleset_counter_100 hash_const
68518
68519#define cmp_packet_ruleset_counter_100 cmp_const
68520
68521 BV_DEFINE(packet_ruleset_counter_100_fields, 7);
68522#endif /* FREECIV_DELTA_PROTOCOL */
68523
68524 static struct packet_ruleset_counter *receive_packet_ruleset_counter_100(struct connection *pc)
68525{
68526#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_counter(_packet)
68527#ifdef FREECIV_DELTA_PROTOCOL
68528 packet_ruleset_counter_100_fields fields;
68529 struct packet_ruleset_counter *old;
68530 struct genhash **hash = pc->phs.received + PACKET_RULESET_COUNTER;
68531#endif /* FREECIV_DELTA_PROTOCOL */
68532 RECEIVE_PACKET_START(packet_ruleset_counter, real_packet);
68533#ifdef FREECIV_JSON_CONNECTION
68534 struct plocation field_addr;
68535 {
68536 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
68537 field_addr = *field_addr_tmp;
68538 FC_FREE(field_addr_tmp);
68539 }
68540#endif /* FREECIV_JSON_CONNECTION */
68541
68542#ifdef FREECIV_DELTA_PROTOCOL
68543#ifdef FREECIV_JSON_CONNECTION
68544 field_addr.name = "fields";
68545#endif /* FREECIV_JSON_CONNECTION */
68546 DIO_BV_GET(&din, &field_addr, fields);
68547
68548#else /* FREECIV_DELTA_PROTOCOL */
68549#ifdef FREECIV_JSON_CONNECTION
68550 field_addr.name = "name";
68551#endif /* FREECIV_JSON_CONNECTION */
68552 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
68553 RECEIVE_PACKET_FIELD_ERROR(name);
68554 }
68555#ifdef FREECIV_JSON_CONNECTION
68556 field_addr.name = "rule_name";
68557#endif /* FREECIV_JSON_CONNECTION */
68558 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
68559 RECEIVE_PACKET_FIELD_ERROR(rule_name);
68560 }
68561#ifdef FREECIV_JSON_CONNECTION
68562 field_addr.name = "helptext";
68563#endif /* FREECIV_JSON_CONNECTION */
68564 {
68565 int i;
68566
68567 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
68568 RECEIVE_PACKET_FIELD_ERROR(helptext);
68569 }
68570 strvec_reserve(real_packet->helptext, i);
68571
68572#ifdef FREECIV_JSON_CONNECTION
68573 field_addr.sub_location = plocation_elem_new(0);
68574#endif /* FREECIV_JSON_CONNECTION */
68575
68576 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
68577 char readin[MAX_LEN_PACKET];
68578
68579#ifdef FREECIV_JSON_CONNECTION
68580 /* Next array element */
68581 field_addr.sub_location->number = i;
68582#endif /* FREECIV_JSON_CONNECTION */
68583
68584 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
68585 || !strvec_set(real_packet->helptext, i, readin)) {
68586 RECEIVE_PACKET_FIELD_ERROR(helptext);
68587 }
68588 }
68589
68590#ifdef FREECIV_JSON_CONNECTION
68591 FC_FREE(field_addr.sub_location);
68592#endif /* FREECIV_JSON_CONNECTION */
68593 }
68594#ifdef FREECIV_JSON_CONNECTION
68595 field_addr.name = "def";
68596#endif /* FREECIV_JSON_CONNECTION */
68597 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->def)) {
68598 RECEIVE_PACKET_FIELD_ERROR(def);
68599 }
68600#ifdef FREECIV_JSON_CONNECTION
68601 field_addr.name = "checkpoint";
68602#endif /* FREECIV_JSON_CONNECTION */
68603 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->checkpoint)) {
68604 RECEIVE_PACKET_FIELD_ERROR(checkpoint);
68605 }
68606#ifdef FREECIV_JSON_CONNECTION
68607 field_addr.name = "type";
68608#endif /* FREECIV_JSON_CONNECTION */
68609 {
68610 int readin;
68611
68612 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68613 RECEIVE_PACKET_FIELD_ERROR(type);
68614 }
68615 real_packet->type = readin;
68616 }
68617#ifdef FREECIV_JSON_CONNECTION
68618 field_addr.name = "behaviour";
68619#endif /* FREECIV_JSON_CONNECTION */
68620 {
68621 int readin;
68622
68623 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68624 RECEIVE_PACKET_FIELD_ERROR(behaviour);
68625 }
68626 real_packet->behaviour = readin;
68627 }
68628#endif
68629 log_packet_detailed("packet_ruleset_counter_100: got info about ()");
68630
68631#ifdef FREECIV_DELTA_PROTOCOL
68632 if (nullptr == *hash) {
68633 *hash = genhash_new_full(hash_packet_ruleset_counter_100, cmp_packet_ruleset_counter_100,
68634 nullptr, nullptr, nullptr, destroy_packet_ruleset_counter);
68635 }
68636
68637 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
68638 sz_strlcpy(real_packet->name, old->name);
68639 sz_strlcpy(real_packet->rule_name, old->rule_name);
68640 if (old->helptext) {
68641 strvec_copy(real_packet->helptext, old->helptext);
68642 } else {
68643 strvec_clear(real_packet->helptext);
68644 }
68645 real_packet->def = old->def;
68646 real_packet->checkpoint = old->checkpoint;
68647 real_packet->type = old->type;
68648 real_packet->behaviour = old->behaviour;
68649 } else {
68650 /* packet is already initialized empty */
68651 log_packet_detailed(" no old info");
68652 }
68653
68654 if (BV_ISSET(fields, 0)) {
68655 log_packet_detailed(" got field 'name'");
68656#ifdef FREECIV_JSON_CONNECTION
68657 field_addr.name = "name";
68658#endif /* FREECIV_JSON_CONNECTION */
68659 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
68660 RECEIVE_PACKET_FIELD_ERROR(name);
68661 }
68662 }
68663 if (BV_ISSET(fields, 1)) {
68664 log_packet_detailed(" got field 'rule_name'");
68665#ifdef FREECIV_JSON_CONNECTION
68666 field_addr.name = "rule_name";
68667#endif /* FREECIV_JSON_CONNECTION */
68668 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
68669 RECEIVE_PACKET_FIELD_ERROR(rule_name);
68670 }
68671 }
68672 if (BV_ISSET(fields, 2)) {
68673 log_packet_detailed(" got field 'helptext'");
68674#ifdef FREECIV_JSON_CONNECTION
68675 field_addr.name = "helptext";
68676#endif /* FREECIV_JSON_CONNECTION */
68677 {
68678 int i;
68679
68680 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
68681 RECEIVE_PACKET_FIELD_ERROR(helptext);
68682 }
68683 strvec_reserve(real_packet->helptext, i);
68684
68685#ifdef FREECIV_JSON_CONNECTION
68686 field_addr.sub_location = plocation_elem_new(0);
68687#endif /* FREECIV_JSON_CONNECTION */
68688
68689 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
68690 char readin[MAX_LEN_PACKET];
68691
68692#ifdef FREECIV_JSON_CONNECTION
68693 /* Next array element */
68694 field_addr.sub_location->number = i;
68695#endif /* FREECIV_JSON_CONNECTION */
68696
68697 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
68698 || !strvec_set(real_packet->helptext, i, readin)) {
68699 RECEIVE_PACKET_FIELD_ERROR(helptext);
68700 }
68701 }
68702
68703#ifdef FREECIV_JSON_CONNECTION
68704 FC_FREE(field_addr.sub_location);
68705#endif /* FREECIV_JSON_CONNECTION */
68706 }
68707 }
68708 if (BV_ISSET(fields, 3)) {
68709 log_packet_detailed(" got field 'def'");
68710#ifdef FREECIV_JSON_CONNECTION
68711 field_addr.name = "def";
68712#endif /* FREECIV_JSON_CONNECTION */
68713 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->def)) {
68714 RECEIVE_PACKET_FIELD_ERROR(def);
68715 }
68716 }
68717 if (BV_ISSET(fields, 4)) {
68718 log_packet_detailed(" got field 'checkpoint'");
68719#ifdef FREECIV_JSON_CONNECTION
68720 field_addr.name = "checkpoint";
68721#endif /* FREECIV_JSON_CONNECTION */
68722 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->checkpoint)) {
68723 RECEIVE_PACKET_FIELD_ERROR(checkpoint);
68724 }
68725 }
68726 if (BV_ISSET(fields, 5)) {
68727 log_packet_detailed(" got field 'type'");
68728#ifdef FREECIV_JSON_CONNECTION
68729 field_addr.name = "type";
68730#endif /* FREECIV_JSON_CONNECTION */
68731 {
68732 int readin;
68733
68734 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68735 RECEIVE_PACKET_FIELD_ERROR(type);
68736 }
68737 real_packet->type = readin;
68738 }
68739 }
68740 if (BV_ISSET(fields, 6)) {
68741 log_packet_detailed(" got field 'behaviour'");
68742#ifdef FREECIV_JSON_CONNECTION
68743 field_addr.name = "behaviour";
68744#endif /* FREECIV_JSON_CONNECTION */
68745 {
68746 int readin;
68747
68748 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
68749 RECEIVE_PACKET_FIELD_ERROR(behaviour);
68750 }
68751 real_packet->behaviour = readin;
68752 }
68753 }
68754
68755 if (nullptr == old) {
68756 old = fc_malloc(sizeof(*old));
68757 init_packet_ruleset_counter(old);
68758 sz_strlcpy(old->name, real_packet->name);
68759 sz_strlcpy(old->rule_name, real_packet->rule_name);
68760 if (real_packet->helptext) {
68761 strvec_copy(old->helptext, real_packet->helptext);
68762 } else {
68763 strvec_clear(old->helptext);
68764 }
68765 old->def = real_packet->def;
68766 old->checkpoint = real_packet->checkpoint;
68767 old->type = real_packet->type;
68768 old->behaviour = real_packet->behaviour;
68769 genhash_insert(*hash, old, old);
68770 } else {
68771 sz_strlcpy(old->name, real_packet->name);
68772 sz_strlcpy(old->rule_name, real_packet->rule_name);
68773 if (real_packet->helptext) {
68774 strvec_copy(old->helptext, real_packet->helptext);
68775 } else {
68776 strvec_clear(old->helptext);
68777 }
68778 old->def = real_packet->def;
68779 old->checkpoint = real_packet->checkpoint;
68780 old->type = real_packet->type;
68781 old->behaviour = real_packet->behaviour;
68782 }
68783
68784#endif /* FREECIV_DELTA_PROTOCOL */
68785 RECEIVE_PACKET_END(real_packet);
68786#undef FREE_PACKET_STRUCT
68787}
68788
68789 static int send_packet_ruleset_counter_100(struct connection *pc, const struct packet_ruleset_counter *packet)
68790{
68791 const struct packet_ruleset_counter *real_packet = packet;
68792 int e;
68793#ifdef FREECIV_DELTA_PROTOCOL
68794 packet_ruleset_counter_100_fields fields;
68795 struct packet_ruleset_counter *old;
68796 bool differ;
68797 struct genhash **hash = pc->phs.sent + PACKET_RULESET_COUNTER;
68798#endif /* FREECIV_DELTA_PROTOCOL */
68799 SEND_PACKET_START(PACKET_RULESET_COUNTER);
68800#ifdef FREECIV_JSON_CONNECTION
68801 struct plocation field_addr;
68802 {
68803 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
68804 field_addr = *field_addr_tmp;
68805 FC_FREE(field_addr_tmp);
68806 }
68807#endif /* FREECIV_JSON_CONNECTION */
68808
68809 log_packet_detailed("packet_ruleset_counter_100: sending info about ()");
68810
68811#ifdef FREECIV_DELTA_PROTOCOL
68812 if (nullptr == *hash) {
68813 *hash = genhash_new_full(hash_packet_ruleset_counter_100, cmp_packet_ruleset_counter_100,
68814 nullptr, nullptr, nullptr, destroy_packet_ruleset_counter);
68815 }
68816 BV_CLR_ALL(fields);
68817
68818 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
68819 old = fc_malloc(sizeof(*old));
68820 /* temporary bitcopy just to insert correctly */
68821 *old = *real_packet;
68822 genhash_insert(*hash, old, old);
68823 init_packet_ruleset_counter(old);
68824 }
68825 differ = (strcmp(old->name, real_packet->name) != 0);
68826 if (differ) {
68827 BV_SET(fields, 0);
68828 }
68829
68830 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
68831 if (differ) {
68832 BV_SET(fields, 1);
68833 }
68834
68835 if (real_packet->helptext) {
68836 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
68837 } else {
68838 differ = (strvec_size(old->helptext) > 0);
68839 }
68840 if (differ) {
68841 BV_SET(fields, 2);
68842 }
68843
68844 differ = (old->def != real_packet->def);
68845 if (differ) {
68846 BV_SET(fields, 3);
68847 }
68848
68849 differ = (old->checkpoint != real_packet->checkpoint);
68850 if (differ) {
68851 BV_SET(fields, 4);
68852 }
68853
68854 differ = (old->type != real_packet->type);
68855 if (differ) {
68856 BV_SET(fields, 5);
68857 }
68858
68859 differ = (old->behaviour != real_packet->behaviour);
68860 if (differ) {
68861 BV_SET(fields, 6);
68862 }
68863
68864
68865#ifdef FREECIV_JSON_CONNECTION
68866 field_addr.name = "fields";
68867#endif /* FREECIV_JSON_CONNECTION */
68868 e = 0;
68869 e |= DIO_BV_PUT(&dout, &field_addr, fields);
68870 if (e) {
68871 log_packet_detailed("fields bitvector error detected");
68872 }
68873
68874 if (BV_ISSET(fields, 0)) {
68875 log_packet_detailed(" field 'name' has changed");
68876#ifdef FREECIV_JSON_CONNECTION
68877 field_addr.name = "name";
68878#endif /* FREECIV_JSON_CONNECTION */
68879 e = 0;
68880 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
68881 if (e) {
68882 log_packet_detailed("'name' field error detected");
68883 }
68884 }
68885 if (BV_ISSET(fields, 1)) {
68886 log_packet_detailed(" field 'rule_name' has changed");
68887#ifdef FREECIV_JSON_CONNECTION
68888 field_addr.name = "rule_name";
68889#endif /* FREECIV_JSON_CONNECTION */
68890 e = 0;
68891 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
68892 if (e) {
68893 log_packet_detailed("'rule_name' field error detected");
68894 }
68895 }
68896 if (BV_ISSET(fields, 2)) {
68897 log_packet_detailed(" field 'helptext' has changed");
68898#ifdef FREECIV_JSON_CONNECTION
68899 field_addr.name = "helptext";
68900#endif /* FREECIV_JSON_CONNECTION */
68901 e = 0;
68902 if (!real_packet->helptext) {
68903 /* Transmit null vector as empty vector */
68904 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
68905 } else {
68906 int i;
68907
68908 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
68909 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
68910
68911#ifdef FREECIV_JSON_CONNECTION
68912 field_addr.sub_location = plocation_elem_new(0);
68913#endif /* FREECIV_JSON_CONNECTION */
68914
68915 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
68916 const char *pstr = strvec_get(real_packet->helptext, i);
68917
68918 if (!pstr) {
68919 /* Transmit null strings as empty strings */
68920 pstr = "";
68921 }
68922
68923#ifdef FREECIV_JSON_CONNECTION
68924 /* Next array element */
68925 field_addr.sub_location->number = i;
68926#endif /* FREECIV_JSON_CONNECTION */
68927
68928 e |= DIO_PUT(string, &dout, &field_addr, pstr);
68929 }
68930
68931#ifdef FREECIV_JSON_CONNECTION
68932 FC_FREE(field_addr.sub_location);
68933#endif /* FREECIV_JSON_CONNECTION */
68934 }
68935 if (e) {
68936 log_packet_detailed("'helptext' field error detected");
68937 }
68938 }
68939 if (BV_ISSET(fields, 3)) {
68940 log_packet_detailed(" field 'def' has changed");
68941#ifdef FREECIV_JSON_CONNECTION
68942 field_addr.name = "def";
68943#endif /* FREECIV_JSON_CONNECTION */
68944 e = 0;
68945 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->def);
68946 if (e) {
68947 log_packet_detailed("'def' field error detected");
68948 }
68949 }
68950 if (BV_ISSET(fields, 4)) {
68951 log_packet_detailed(" field 'checkpoint' has changed");
68952#ifdef FREECIV_JSON_CONNECTION
68953 field_addr.name = "checkpoint";
68954#endif /* FREECIV_JSON_CONNECTION */
68955 e = 0;
68956 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->checkpoint);
68957 if (e) {
68958 log_packet_detailed("'checkpoint' field error detected");
68959 }
68960 }
68961 if (BV_ISSET(fields, 5)) {
68962 log_packet_detailed(" field 'type' has changed");
68963#ifdef FREECIV_JSON_CONNECTION
68964 field_addr.name = "type";
68965#endif /* FREECIV_JSON_CONNECTION */
68966 e = 0;
68967 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
68968 if (e) {
68969 log_packet_detailed("'type' field error detected");
68970 }
68971 }
68972 if (BV_ISSET(fields, 6)) {
68973 log_packet_detailed(" field 'behaviour' has changed");
68974#ifdef FREECIV_JSON_CONNECTION
68975 field_addr.name = "behaviour";
68976#endif /* FREECIV_JSON_CONNECTION */
68977 e = 0;
68978 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->behaviour);
68979 if (e) {
68980 log_packet_detailed("'behaviour' field error detected");
68981 }
68982 }
68983
68984 sz_strlcpy(old->name, real_packet->name);
68985 sz_strlcpy(old->rule_name, real_packet->rule_name);
68986 if (real_packet->helptext) {
68987 strvec_copy(old->helptext, real_packet->helptext);
68988 } else {
68989 strvec_clear(old->helptext);
68990 }
68991 old->def = real_packet->def;
68992 old->checkpoint = real_packet->checkpoint;
68993 old->type = real_packet->type;
68994 old->behaviour = real_packet->behaviour;
68995#endif /* FREECIV_DELTA_PROTOCOL */
68996#ifndef FREECIV_DELTA_PROTOCOL
68997#ifdef FREECIV_JSON_CONNECTION
68998 field_addr.name = "name";
68999#endif /* FREECIV_JSON_CONNECTION */
69000 e = 0;
69001 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
69002 if (e) {
69003 log_packet_detailed("'name' field error detected");
69004 }
69005#ifdef FREECIV_JSON_CONNECTION
69006 field_addr.name = "rule_name";
69007#endif /* FREECIV_JSON_CONNECTION */
69008 e = 0;
69009 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
69010 if (e) {
69011 log_packet_detailed("'rule_name' field error detected");
69012 }
69013#ifdef FREECIV_JSON_CONNECTION
69014 field_addr.name = "helptext";
69015#endif /* FREECIV_JSON_CONNECTION */
69016 e = 0;
69017 if (!real_packet->helptext) {
69018 /* Transmit null vector as empty vector */
69019 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
69020 } else {
69021 int i;
69022
69023 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
69024 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
69025
69026#ifdef FREECIV_JSON_CONNECTION
69027 field_addr.sub_location = plocation_elem_new(0);
69028#endif /* FREECIV_JSON_CONNECTION */
69029
69030 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
69031 const char *pstr = strvec_get(real_packet->helptext, i);
69032
69033 if (!pstr) {
69034 /* Transmit null strings as empty strings */
69035 pstr = "";
69036 }
69037
69038#ifdef FREECIV_JSON_CONNECTION
69039 /* Next array element */
69040 field_addr.sub_location->number = i;
69041#endif /* FREECIV_JSON_CONNECTION */
69042
69043 e |= DIO_PUT(string, &dout, &field_addr, pstr);
69044 }
69045
69046#ifdef FREECIV_JSON_CONNECTION
69047 FC_FREE(field_addr.sub_location);
69048#endif /* FREECIV_JSON_CONNECTION */
69049 }
69050 if (e) {
69051 log_packet_detailed("'helptext' field error detected");
69052 }
69053#ifdef FREECIV_JSON_CONNECTION
69054 field_addr.name = "def";
69055#endif /* FREECIV_JSON_CONNECTION */
69056 e = 0;
69057 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->def);
69058 if (e) {
69059 log_packet_detailed("'def' field error detected");
69060 }
69061#ifdef FREECIV_JSON_CONNECTION
69062 field_addr.name = "checkpoint";
69063#endif /* FREECIV_JSON_CONNECTION */
69064 e = 0;
69065 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->checkpoint);
69066 if (e) {
69067 log_packet_detailed("'checkpoint' field error detected");
69068 }
69069#ifdef FREECIV_JSON_CONNECTION
69070 field_addr.name = "type";
69071#endif /* FREECIV_JSON_CONNECTION */
69072 e = 0;
69073 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
69074 if (e) {
69075 log_packet_detailed("'type' field error detected");
69076 }
69077#ifdef FREECIV_JSON_CONNECTION
69078 field_addr.name = "behaviour";
69079#endif /* FREECIV_JSON_CONNECTION */
69080 e = 0;
69081 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->behaviour);
69082 if (e) {
69083 log_packet_detailed("'behaviour' field error detected");
69084 }
69085
69086#endif
69087 SEND_PACKET_END(PACKET_RULESET_COUNTER);
69088}
69089
69090 int send_packet_ruleset_counter(struct connection *pc, const struct packet_ruleset_counter *packet)
69091{
69092 if (!pc->used) {
69093 log_error("WARNING: trying to send data to the closed connection %s",
69094 conn_description(pc));
69095 return -1;
69096 }
69097 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_COUNTER].packet != nullptr, -1,
69098 "Handler for PACKET_RULESET_COUNTER not installed");
69099 return pc->phs.handlers->send[PACKET_RULESET_COUNTER].packet(pc, packet);
69100}
69101
69102 void lsend_packet_ruleset_counter(struct conn_list *dest, const struct packet_ruleset_counter *packet)
69103{
69104 conn_list_iterate(dest, pconn) {
69105 send_packet_ruleset_counter(pconn, packet);
69106 } conn_list_iterate_end;
69107}
69108
69109 static inline void init_packet_ruleset_music(struct packet_ruleset_music *packet)
69110{
69111 memset(packet, 0, sizeof(*packet));
69112}
69113
69114#define free_packet_ruleset_music(_packet) (void) 0
69115#define destroy_packet_ruleset_music free
69116
69117#ifdef FREECIV_DELTA_PROTOCOL
69118#define hash_packet_ruleset_music_100 hash_const
69119
69120#define cmp_packet_ruleset_music_100 cmp_const
69121
69122 BV_DEFINE(packet_ruleset_music_100_fields, 5);
69123#endif /* FREECIV_DELTA_PROTOCOL */
69124
69125 static struct packet_ruleset_music *receive_packet_ruleset_music_100(struct connection *pc)
69126{
69127#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_music(_packet)
69128#ifdef FREECIV_DELTA_PROTOCOL
69129 packet_ruleset_music_100_fields fields;
69130 struct packet_ruleset_music *old;
69131 struct genhash **hash = pc->phs.received + PACKET_RULESET_MUSIC;
69132#endif /* FREECIV_DELTA_PROTOCOL */
69133 RECEIVE_PACKET_START(packet_ruleset_music, real_packet);
69134#ifdef FREECIV_JSON_CONNECTION
69135 struct plocation field_addr;
69136 {
69137 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
69138 field_addr = *field_addr_tmp;
69139 FC_FREE(field_addr_tmp);
69140 }
69141#endif /* FREECIV_JSON_CONNECTION */
69142
69143#ifdef FREECIV_DELTA_PROTOCOL
69144#ifdef FREECIV_JSON_CONNECTION
69145 field_addr.name = "fields";
69146#endif /* FREECIV_JSON_CONNECTION */
69147 DIO_BV_GET(&din, &field_addr, fields);
69148
69149#else /* FREECIV_DELTA_PROTOCOL */
69150#ifdef FREECIV_JSON_CONNECTION
69151 field_addr.name = "id";
69152#endif /* FREECIV_JSON_CONNECTION */
69153 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
69154 RECEIVE_PACKET_FIELD_ERROR(id);
69155 }
69156#ifdef FREECIV_JSON_CONNECTION
69157 field_addr.name = "music_peaceful";
69158#endif /* FREECIV_JSON_CONNECTION */
69159 if (!DIO_GET(string, &din, &field_addr, real_packet->music_peaceful, sizeof(real_packet->music_peaceful))) {
69160 RECEIVE_PACKET_FIELD_ERROR(music_peaceful);
69161 }
69162#ifdef FREECIV_JSON_CONNECTION
69163 field_addr.name = "music_combat";
69164#endif /* FREECIV_JSON_CONNECTION */
69165 if (!DIO_GET(string, &din, &field_addr, real_packet->music_combat, sizeof(real_packet->music_combat))) {
69166 RECEIVE_PACKET_FIELD_ERROR(music_combat);
69167 }
69168#ifdef FREECIV_JSON_CONNECTION
69169 field_addr.name = "reqs_count";
69170#endif /* FREECIV_JSON_CONNECTION */
69171 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
69172 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
69173 }
69174#ifdef FREECIV_JSON_CONNECTION
69175 field_addr.name = "reqs";
69176#endif /* FREECIV_JSON_CONNECTION */
69177 {
69178 int i;
69179
69180#ifdef FREECIV_JSON_CONNECTION
69181 /* Enter array. */
69182 field_addr.sub_location = plocation_elem_new(0);
69183#endif /* FREECIV_JSON_CONNECTION */
69184
69185 if (real_packet->reqs_count > MAX_NUM_REQS) {
69186 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
69187 }
69188 for (i = 0; i < real_packet->reqs_count; i++) {
69189#ifdef FREECIV_JSON_CONNECTION
69190 field_addr.sub_location->number = i;
69191#endif /* FREECIV_JSON_CONNECTION */
69192 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
69193 RECEIVE_PACKET_FIELD_ERROR(reqs);
69194 }
69195 }
69196
69197#ifdef FREECIV_JSON_CONNECTION
69198 /* Exit array. */
69199 FC_FREE(field_addr.sub_location);
69200#endif /* FREECIV_JSON_CONNECTION */
69201 }
69202#endif
69203 log_packet_detailed("packet_ruleset_music_100: got info about ()");
69204
69205#ifdef FREECIV_DELTA_PROTOCOL
69206 if (nullptr == *hash) {
69207 *hash = genhash_new_full(hash_packet_ruleset_music_100, cmp_packet_ruleset_music_100,
69208 nullptr, nullptr, nullptr, destroy_packet_ruleset_music);
69209 }
69210
69211 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
69212 *real_packet = *old;
69213 } else {
69214 /* packet is already initialized empty */
69215 log_packet_detailed(" no old info");
69216 }
69217
69218 if (BV_ISSET(fields, 0)) {
69219 log_packet_detailed(" got field 'id'");
69220#ifdef FREECIV_JSON_CONNECTION
69221 field_addr.name = "id";
69222#endif /* FREECIV_JSON_CONNECTION */
69223 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
69224 RECEIVE_PACKET_FIELD_ERROR(id);
69225 }
69226 }
69227 if (BV_ISSET(fields, 1)) {
69228 log_packet_detailed(" got field 'music_peaceful'");
69229#ifdef FREECIV_JSON_CONNECTION
69230 field_addr.name = "music_peaceful";
69231#endif /* FREECIV_JSON_CONNECTION */
69232 if (!DIO_GET(string, &din, &field_addr, real_packet->music_peaceful, sizeof(real_packet->music_peaceful))) {
69233 RECEIVE_PACKET_FIELD_ERROR(music_peaceful);
69234 }
69235 }
69236 if (BV_ISSET(fields, 2)) {
69237 log_packet_detailed(" got field 'music_combat'");
69238#ifdef FREECIV_JSON_CONNECTION
69239 field_addr.name = "music_combat";
69240#endif /* FREECIV_JSON_CONNECTION */
69241 if (!DIO_GET(string, &din, &field_addr, real_packet->music_combat, sizeof(real_packet->music_combat))) {
69242 RECEIVE_PACKET_FIELD_ERROR(music_combat);
69243 }
69244 }
69245 if (BV_ISSET(fields, 3)) {
69246 log_packet_detailed(" got field 'reqs_count'");
69247#ifdef FREECIV_JSON_CONNECTION
69248 field_addr.name = "reqs_count";
69249#endif /* FREECIV_JSON_CONNECTION */
69250 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
69251 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
69252 }
69253 }
69254 if (BV_ISSET(fields, 4)) {
69255 log_packet_detailed(" got field 'reqs'");
69256#ifdef FREECIV_JSON_CONNECTION
69257 field_addr.name = "reqs";
69258#endif /* FREECIV_JSON_CONNECTION */
69259 {
69260 int i;
69261
69262#ifdef FREECIV_JSON_CONNECTION
69263 /* Enter array. */
69264 field_addr.sub_location = plocation_elem_new(0);
69265#endif /* FREECIV_JSON_CONNECTION */
69266
69267 if (real_packet->reqs_count > MAX_NUM_REQS) {
69268 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
69269 }
69270 for (i = 0; i < real_packet->reqs_count; i++) {
69271#ifdef FREECIV_JSON_CONNECTION
69272 field_addr.sub_location->number = i;
69273#endif /* FREECIV_JSON_CONNECTION */
69274 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
69275 RECEIVE_PACKET_FIELD_ERROR(reqs);
69276 }
69277 }
69278
69279#ifdef FREECIV_JSON_CONNECTION
69280 /* Exit array. */
69281 FC_FREE(field_addr.sub_location);
69282#endif /* FREECIV_JSON_CONNECTION */
69283 }
69284 }
69285
69286 if (nullptr == old) {
69287 old = fc_malloc(sizeof(*old));
69288 init_packet_ruleset_music(old);
69289 *old = *real_packet;
69290 genhash_insert(*hash, old, old);
69291 } else {
69292 *old = *real_packet;
69293 }
69294
69295#endif /* FREECIV_DELTA_PROTOCOL */
69296 RECEIVE_PACKET_END(real_packet);
69297#undef FREE_PACKET_STRUCT
69298}
69299
69300 static int send_packet_ruleset_music_100(struct connection *pc, const struct packet_ruleset_music *packet)
69301{
69302 const struct packet_ruleset_music *real_packet = packet;
69303 int e;
69304#ifdef FREECIV_DELTA_PROTOCOL
69305 packet_ruleset_music_100_fields fields;
69306 struct packet_ruleset_music *old;
69307 bool differ;
69308 struct genhash **hash = pc->phs.sent + PACKET_RULESET_MUSIC;
69309#endif /* FREECIV_DELTA_PROTOCOL */
69310 SEND_PACKET_START(PACKET_RULESET_MUSIC);
69311#ifdef FREECIV_JSON_CONNECTION
69312 struct plocation field_addr;
69313 {
69314 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
69315 field_addr = *field_addr_tmp;
69316 FC_FREE(field_addr_tmp);
69317 }
69318#endif /* FREECIV_JSON_CONNECTION */
69319
69320 log_packet_detailed("packet_ruleset_music_100: sending info about ()");
69321
69322#ifdef FREECIV_DELTA_PROTOCOL
69323 if (nullptr == *hash) {
69324 *hash = genhash_new_full(hash_packet_ruleset_music_100, cmp_packet_ruleset_music_100,
69325 nullptr, nullptr, nullptr, destroy_packet_ruleset_music);
69326 }
69327 BV_CLR_ALL(fields);
69328
69329 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
69330 old = fc_malloc(sizeof(*old));
69331 /* temporary bitcopy just to insert correctly */
69332 *old = *real_packet;
69333 genhash_insert(*hash, old, old);
69334 init_packet_ruleset_music(old);
69335 }
69336 differ = (old->id != real_packet->id);
69337 if (differ) {
69338 BV_SET(fields, 0);
69339 }
69340
69341 differ = (strcmp(old->music_peaceful, real_packet->music_peaceful) != 0);
69342 if (differ) {
69343 BV_SET(fields, 1);
69344 }
69345
69346 differ = (strcmp(old->music_combat, real_packet->music_combat) != 0);
69347 if (differ) {
69348 BV_SET(fields, 2);
69349 }
69350
69351 differ = (old->reqs_count != real_packet->reqs_count);
69352 if (differ) {
69353 BV_SET(fields, 3);
69354 }
69355
69356 differ = (old->reqs_count != real_packet->reqs_count);
69357 if (!differ) {
69358 int i;
69359
69360 for (i = 0; i < real_packet->reqs_count; i++) {
69361 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
69362 if (differ) {
69363 break;
69364 }
69365 }
69366 }
69367 if (differ) {
69368 BV_SET(fields, 4);
69369 }
69370
69371
69372#ifdef FREECIV_JSON_CONNECTION
69373 field_addr.name = "fields";
69374#endif /* FREECIV_JSON_CONNECTION */
69375 e = 0;
69376 e |= DIO_BV_PUT(&dout, &field_addr, fields);
69377 if (e) {
69378 log_packet_detailed("fields bitvector error detected");
69379 }
69380
69381 if (BV_ISSET(fields, 0)) {
69382 log_packet_detailed(" field 'id' has changed");
69383#ifdef FREECIV_JSON_CONNECTION
69384 field_addr.name = "id";
69385#endif /* FREECIV_JSON_CONNECTION */
69386 e = 0;
69387 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
69388 if (e) {
69389 log_packet_detailed("'id' field error detected");
69390 }
69391 }
69392 if (BV_ISSET(fields, 1)) {
69393 log_packet_detailed(" field 'music_peaceful' has changed");
69394#ifdef FREECIV_JSON_CONNECTION
69395 field_addr.name = "music_peaceful";
69396#endif /* FREECIV_JSON_CONNECTION */
69397 e = 0;
69398 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_peaceful);
69399 if (e) {
69400 log_packet_detailed("'music_peaceful' field error detected");
69401 }
69402 }
69403 if (BV_ISSET(fields, 2)) {
69404 log_packet_detailed(" field 'music_combat' has changed");
69405#ifdef FREECIV_JSON_CONNECTION
69406 field_addr.name = "music_combat";
69407#endif /* FREECIV_JSON_CONNECTION */
69408 e = 0;
69409 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_combat);
69410 if (e) {
69411 log_packet_detailed("'music_combat' field error detected");
69412 }
69413 }
69414 if (BV_ISSET(fields, 3)) {
69415 log_packet_detailed(" field 'reqs_count' has changed");
69416#ifdef FREECIV_JSON_CONNECTION
69417 field_addr.name = "reqs_count";
69418#endif /* FREECIV_JSON_CONNECTION */
69419 e = 0;
69420 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
69421 if (e) {
69422 log_packet_detailed("'reqs_count' field error detected");
69423 }
69424 }
69425 if (BV_ISSET(fields, 4)) {
69426 log_packet_detailed(" field 'reqs' has changed");
69427#ifdef FREECIV_JSON_CONNECTION
69428 field_addr.name = "reqs";
69429#endif /* FREECIV_JSON_CONNECTION */
69430 e = 0;
69431 {
69432 int i;
69433
69434#ifdef FREECIV_JSON_CONNECTION
69435 /* Create the array. */
69436 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
69437
69438 /* Enter the array. */
69439 field_addr.sub_location = plocation_elem_new(0);
69440#endif /* FREECIV_JSON_CONNECTION */
69441
69442 for (i = 0; i < real_packet->reqs_count; i++) {
69443#ifdef FREECIV_JSON_CONNECTION
69444 /* Next array element. */
69445 field_addr.sub_location->number = i;
69446#endif /* FREECIV_JSON_CONNECTION */
69447 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
69448 }
69449
69450#ifdef FREECIV_JSON_CONNECTION
69451 /* Exit array. */
69452 FC_FREE(field_addr.sub_location);
69453#endif /* FREECIV_JSON_CONNECTION */
69454 }
69455 if (e) {
69456 log_packet_detailed("'reqs' field error detected");
69457 }
69458 }
69459
69460 *old = *real_packet;
69461#endif /* FREECIV_DELTA_PROTOCOL */
69462#ifndef FREECIV_DELTA_PROTOCOL
69463#ifdef FREECIV_JSON_CONNECTION
69464 field_addr.name = "id";
69465#endif /* FREECIV_JSON_CONNECTION */
69466 e = 0;
69467 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
69468 if (e) {
69469 log_packet_detailed("'id' field error detected");
69470 }
69471#ifdef FREECIV_JSON_CONNECTION
69472 field_addr.name = "music_peaceful";
69473#endif /* FREECIV_JSON_CONNECTION */
69474 e = 0;
69475 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_peaceful);
69476 if (e) {
69477 log_packet_detailed("'music_peaceful' field error detected");
69478 }
69479#ifdef FREECIV_JSON_CONNECTION
69480 field_addr.name = "music_combat";
69481#endif /* FREECIV_JSON_CONNECTION */
69482 e = 0;
69483 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_combat);
69484 if (e) {
69485 log_packet_detailed("'music_combat' field error detected");
69486 }
69487#ifdef FREECIV_JSON_CONNECTION
69488 field_addr.name = "reqs_count";
69489#endif /* FREECIV_JSON_CONNECTION */
69490 e = 0;
69491 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
69492 if (e) {
69493 log_packet_detailed("'reqs_count' field error detected");
69494 }
69495#ifdef FREECIV_JSON_CONNECTION
69496 field_addr.name = "reqs";
69497#endif /* FREECIV_JSON_CONNECTION */
69498 e = 0;
69499 {
69500 int i;
69501
69502#ifdef FREECIV_JSON_CONNECTION
69503 /* Create the array. */
69504 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
69505
69506 /* Enter the array. */
69507 field_addr.sub_location = plocation_elem_new(0);
69508#endif /* FREECIV_JSON_CONNECTION */
69509
69510 for (i = 0; i < real_packet->reqs_count; i++) {
69511#ifdef FREECIV_JSON_CONNECTION
69512 /* Next array element. */
69513 field_addr.sub_location->number = i;
69514#endif /* FREECIV_JSON_CONNECTION */
69515 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
69516 }
69517
69518#ifdef FREECIV_JSON_CONNECTION
69519 /* Exit array. */
69520 FC_FREE(field_addr.sub_location);
69521#endif /* FREECIV_JSON_CONNECTION */
69522 }
69523 if (e) {
69524 log_packet_detailed("'reqs' field error detected");
69525 }
69526
69527#endif
69528 SEND_PACKET_END(PACKET_RULESET_MUSIC);
69529}
69530
69531 int send_packet_ruleset_music(struct connection *pc, const struct packet_ruleset_music *packet)
69532{
69533 if (!pc->used) {
69534 log_error("WARNING: trying to send data to the closed connection %s",
69535 conn_description(pc));
69536 return -1;
69537 }
69538 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_MUSIC].packet != nullptr, -1,
69539 "Handler for PACKET_RULESET_MUSIC not installed");
69540 return pc->phs.handlers->send[PACKET_RULESET_MUSIC].packet(pc, packet);
69541}
69542
69543 void lsend_packet_ruleset_music(struct conn_list *dest, const struct packet_ruleset_music *packet)
69544{
69545 conn_list_iterate(dest, pconn) {
69546 send_packet_ruleset_music(pconn, packet);
69547 } conn_list_iterate_end;
69548}
69549
69550 static inline void init_packet_ruleset_multiplier(struct packet_ruleset_multiplier *packet)
69551{
69552 memset(packet, 0, sizeof(*packet));
69553
69554 /* no work needed for packet->id */
69555 /* no work needed for packet->start */
69556 /* no work needed for packet->stop */
69557 /* no work needed for packet->step */
69558 /* no work needed for packet->def */
69559 /* no work needed for packet->offset */
69560 /* no work needed for packet->factor */
69561 /* no work needed for packet->minimum_turns */
69562 /* no work needed for packet->name */
69563 /* no work needed for packet->rule_name */
69564 /* no work needed for packet->reqs_count */
69565 /* no work needed for packet->reqs */
69566 packet->helptext = strvec_new();
69567}
69568
69569 static inline void free_packet_ruleset_multiplier(struct packet_ruleset_multiplier *packet)
69570{
69571 if (packet->helptext) {
69572 strvec_destroy(packet->helptext);
69573 packet->helptext = nullptr;
69574 }
69575 /* no work needed for packet->reqs */
69576 /* no work needed for packet->reqs_count */
69577 /* no work needed for packet->rule_name */
69578 /* no work needed for packet->name */
69579 /* no work needed for packet->minimum_turns */
69580 /* no work needed for packet->factor */
69581 /* no work needed for packet->offset */
69582 /* no work needed for packet->def */
69583 /* no work needed for packet->step */
69584 /* no work needed for packet->stop */
69585 /* no work needed for packet->start */
69586 /* no work needed for packet->id */
69587}
69588
69589 static inline void destroy_packet_ruleset_multiplier(void *packet)
69590{
69591 free_packet_ruleset_multiplier((struct packet_ruleset_multiplier *) packet);
69592 free(packet);
69593}
69594
69595#ifdef FREECIV_DELTA_PROTOCOL
69596#define hash_packet_ruleset_multiplier_100 hash_const
69597
69598#define cmp_packet_ruleset_multiplier_100 cmp_const
69599
69600 BV_DEFINE(packet_ruleset_multiplier_100_fields, 13);
69601#endif /* FREECIV_DELTA_PROTOCOL */
69602
69603 static struct packet_ruleset_multiplier *receive_packet_ruleset_multiplier_100(struct connection *pc)
69604{
69605#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_multiplier(_packet)
69606#ifdef FREECIV_DELTA_PROTOCOL
69607 packet_ruleset_multiplier_100_fields fields;
69608 struct packet_ruleset_multiplier *old;
69609 struct genhash **hash = pc->phs.received + PACKET_RULESET_MULTIPLIER;
69610#endif /* FREECIV_DELTA_PROTOCOL */
69611 RECEIVE_PACKET_START(packet_ruleset_multiplier, real_packet);
69612#ifdef FREECIV_JSON_CONNECTION
69613 struct plocation field_addr;
69614 {
69615 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
69616 field_addr = *field_addr_tmp;
69617 FC_FREE(field_addr_tmp);
69618 }
69619#endif /* FREECIV_JSON_CONNECTION */
69620
69621#ifdef FREECIV_DELTA_PROTOCOL
69622#ifdef FREECIV_JSON_CONNECTION
69623 field_addr.name = "fields";
69624#endif /* FREECIV_JSON_CONNECTION */
69625 DIO_BV_GET(&din, &field_addr, fields);
69626
69627#else /* FREECIV_DELTA_PROTOCOL */
69628#ifdef FREECIV_JSON_CONNECTION
69629 field_addr.name = "id";
69630#endif /* FREECIV_JSON_CONNECTION */
69631 {
69632 int readin;
69633
69634 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
69635 RECEIVE_PACKET_FIELD_ERROR(id);
69636 }
69637 real_packet->id = readin;
69638 }
69639#ifdef FREECIV_JSON_CONNECTION
69640 field_addr.name = "start";
69641#endif /* FREECIV_JSON_CONNECTION */
69642 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->start)) {
69643 RECEIVE_PACKET_FIELD_ERROR(start);
69644 }
69645#ifdef FREECIV_JSON_CONNECTION
69646 field_addr.name = "stop";
69647#endif /* FREECIV_JSON_CONNECTION */
69648 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->stop)) {
69649 RECEIVE_PACKET_FIELD_ERROR(stop);
69650 }
69651#ifdef FREECIV_JSON_CONNECTION
69652 field_addr.name = "step";
69653#endif /* FREECIV_JSON_CONNECTION */
69654 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->step)) {
69655 RECEIVE_PACKET_FIELD_ERROR(step);
69656 }
69657#ifdef FREECIV_JSON_CONNECTION
69658 field_addr.name = "def";
69659#endif /* FREECIV_JSON_CONNECTION */
69660 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->def)) {
69661 RECEIVE_PACKET_FIELD_ERROR(def);
69662 }
69663#ifdef FREECIV_JSON_CONNECTION
69664 field_addr.name = "offset";
69665#endif /* FREECIV_JSON_CONNECTION */
69666 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->offset)) {
69667 RECEIVE_PACKET_FIELD_ERROR(offset);
69668 }
69669#ifdef FREECIV_JSON_CONNECTION
69670 field_addr.name = "factor";
69671#endif /* FREECIV_JSON_CONNECTION */
69672 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->factor)) {
69673 RECEIVE_PACKET_FIELD_ERROR(factor);
69674 }
69675#ifdef FREECIV_JSON_CONNECTION
69676 field_addr.name = "minimum_turns";
69677#endif /* FREECIV_JSON_CONNECTION */
69678 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->minimum_turns)) {
69679 RECEIVE_PACKET_FIELD_ERROR(minimum_turns);
69680 }
69681#ifdef FREECIV_JSON_CONNECTION
69682 field_addr.name = "name";
69683#endif /* FREECIV_JSON_CONNECTION */
69684 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
69685 RECEIVE_PACKET_FIELD_ERROR(name);
69686 }
69687#ifdef FREECIV_JSON_CONNECTION
69688 field_addr.name = "rule_name";
69689#endif /* FREECIV_JSON_CONNECTION */
69690 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
69691 RECEIVE_PACKET_FIELD_ERROR(rule_name);
69692 }
69693#ifdef FREECIV_JSON_CONNECTION
69694 field_addr.name = "reqs_count";
69695#endif /* FREECIV_JSON_CONNECTION */
69696 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
69697 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
69698 }
69699#ifdef FREECIV_JSON_CONNECTION
69700 field_addr.name = "reqs";
69701#endif /* FREECIV_JSON_CONNECTION */
69702 {
69703 int i;
69704
69705#ifdef FREECIV_JSON_CONNECTION
69706 /* Enter array. */
69707 field_addr.sub_location = plocation_elem_new(0);
69708#endif /* FREECIV_JSON_CONNECTION */
69709
69710 if (real_packet->reqs_count > MAX_NUM_REQS) {
69711 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
69712 }
69713 for (i = 0; i < real_packet->reqs_count; i++) {
69714#ifdef FREECIV_JSON_CONNECTION
69715 field_addr.sub_location->number = i;
69716#endif /* FREECIV_JSON_CONNECTION */
69717 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
69718 RECEIVE_PACKET_FIELD_ERROR(reqs);
69719 }
69720 }
69721
69722#ifdef FREECIV_JSON_CONNECTION
69723 /* Exit array. */
69724 FC_FREE(field_addr.sub_location);
69725#endif /* FREECIV_JSON_CONNECTION */
69726 }
69727#ifdef FREECIV_JSON_CONNECTION
69728 field_addr.name = "helptext";
69729#endif /* FREECIV_JSON_CONNECTION */
69730 {
69731 int i;
69732
69733 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
69734 RECEIVE_PACKET_FIELD_ERROR(helptext);
69735 }
69736 strvec_reserve(real_packet->helptext, i);
69737
69738#ifdef FREECIV_JSON_CONNECTION
69739 field_addr.sub_location = plocation_elem_new(0);
69740#endif /* FREECIV_JSON_CONNECTION */
69741
69742 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
69743 char readin[MAX_LEN_PACKET];
69744
69745#ifdef FREECIV_JSON_CONNECTION
69746 /* Next array element */
69747 field_addr.sub_location->number = i;
69748#endif /* FREECIV_JSON_CONNECTION */
69749
69750 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
69751 || !strvec_set(real_packet->helptext, i, readin)) {
69752 RECEIVE_PACKET_FIELD_ERROR(helptext);
69753 }
69754 }
69755
69756#ifdef FREECIV_JSON_CONNECTION
69757 FC_FREE(field_addr.sub_location);
69758#endif /* FREECIV_JSON_CONNECTION */
69759 }
69760#endif
69761 log_packet_detailed("packet_ruleset_multiplier_100: got info about ()");
69762
69763#ifdef FREECIV_DELTA_PROTOCOL
69764 if (nullptr == *hash) {
69765 *hash = genhash_new_full(hash_packet_ruleset_multiplier_100, cmp_packet_ruleset_multiplier_100,
69766 nullptr, nullptr, nullptr, destroy_packet_ruleset_multiplier);
69767 }
69768
69769 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
69770 real_packet->id = old->id;
69771 real_packet->start = old->start;
69772 real_packet->stop = old->stop;
69773 real_packet->step = old->step;
69774 real_packet->def = old->def;
69775 real_packet->offset = old->offset;
69776 real_packet->factor = old->factor;
69777 real_packet->minimum_turns = old->minimum_turns;
69778 sz_strlcpy(real_packet->name, old->name);
69779 sz_strlcpy(real_packet->rule_name, old->rule_name);
69780 real_packet->reqs_count = old->reqs_count;
69781 {
69782 int i;
69783
69784 for (i = 0; i < old->reqs_count; i++) {
69785 real_packet->reqs[i] = old->reqs[i];
69786 }
69787 }
69788 if (old->helptext) {
69789 strvec_copy(real_packet->helptext, old->helptext);
69790 } else {
69791 strvec_clear(real_packet->helptext);
69792 }
69793 } else {
69794 /* packet is already initialized empty */
69795 log_packet_detailed(" no old info");
69796 }
69797
69798 if (BV_ISSET(fields, 0)) {
69799 log_packet_detailed(" got field 'id'");
69800#ifdef FREECIV_JSON_CONNECTION
69801 field_addr.name = "id";
69802#endif /* FREECIV_JSON_CONNECTION */
69803 {
69804 int readin;
69805
69806 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
69807 RECEIVE_PACKET_FIELD_ERROR(id);
69808 }
69809 real_packet->id = readin;
69810 }
69811 }
69812 if (BV_ISSET(fields, 1)) {
69813 log_packet_detailed(" got field 'start'");
69814#ifdef FREECIV_JSON_CONNECTION
69815 field_addr.name = "start";
69816#endif /* FREECIV_JSON_CONNECTION */
69817 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->start)) {
69818 RECEIVE_PACKET_FIELD_ERROR(start);
69819 }
69820 }
69821 if (BV_ISSET(fields, 2)) {
69822 log_packet_detailed(" got field 'stop'");
69823#ifdef FREECIV_JSON_CONNECTION
69824 field_addr.name = "stop";
69825#endif /* FREECIV_JSON_CONNECTION */
69826 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->stop)) {
69827 RECEIVE_PACKET_FIELD_ERROR(stop);
69828 }
69829 }
69830 if (BV_ISSET(fields, 3)) {
69831 log_packet_detailed(" got field 'step'");
69832#ifdef FREECIV_JSON_CONNECTION
69833 field_addr.name = "step";
69834#endif /* FREECIV_JSON_CONNECTION */
69835 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->step)) {
69836 RECEIVE_PACKET_FIELD_ERROR(step);
69837 }
69838 }
69839 if (BV_ISSET(fields, 4)) {
69840 log_packet_detailed(" got field 'def'");
69841#ifdef FREECIV_JSON_CONNECTION
69842 field_addr.name = "def";
69843#endif /* FREECIV_JSON_CONNECTION */
69844 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->def)) {
69845 RECEIVE_PACKET_FIELD_ERROR(def);
69846 }
69847 }
69848 if (BV_ISSET(fields, 5)) {
69849 log_packet_detailed(" got field 'offset'");
69850#ifdef FREECIV_JSON_CONNECTION
69851 field_addr.name = "offset";
69852#endif /* FREECIV_JSON_CONNECTION */
69853 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->offset)) {
69854 RECEIVE_PACKET_FIELD_ERROR(offset);
69855 }
69856 }
69857 if (BV_ISSET(fields, 6)) {
69858 log_packet_detailed(" got field 'factor'");
69859#ifdef FREECIV_JSON_CONNECTION
69860 field_addr.name = "factor";
69861#endif /* FREECIV_JSON_CONNECTION */
69862 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->factor)) {
69863 RECEIVE_PACKET_FIELD_ERROR(factor);
69864 }
69865 }
69866 if (BV_ISSET(fields, 7)) {
69867 log_packet_detailed(" got field 'minimum_turns'");
69868#ifdef FREECIV_JSON_CONNECTION
69869 field_addr.name = "minimum_turns";
69870#endif /* FREECIV_JSON_CONNECTION */
69871 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->minimum_turns)) {
69872 RECEIVE_PACKET_FIELD_ERROR(minimum_turns);
69873 }
69874 }
69875 if (BV_ISSET(fields, 8)) {
69876 log_packet_detailed(" got field 'name'");
69877#ifdef FREECIV_JSON_CONNECTION
69878 field_addr.name = "name";
69879#endif /* FREECIV_JSON_CONNECTION */
69880 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
69881 RECEIVE_PACKET_FIELD_ERROR(name);
69882 }
69883 }
69884 if (BV_ISSET(fields, 9)) {
69885 log_packet_detailed(" got field 'rule_name'");
69886#ifdef FREECIV_JSON_CONNECTION
69887 field_addr.name = "rule_name";
69888#endif /* FREECIV_JSON_CONNECTION */
69889 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
69890 RECEIVE_PACKET_FIELD_ERROR(rule_name);
69891 }
69892 }
69893 if (BV_ISSET(fields, 10)) {
69894 log_packet_detailed(" got field 'reqs_count'");
69895#ifdef FREECIV_JSON_CONNECTION
69896 field_addr.name = "reqs_count";
69897#endif /* FREECIV_JSON_CONNECTION */
69898 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
69899 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
69900 }
69901 }
69902 if (BV_ISSET(fields, 11)) {
69903 log_packet_detailed(" got field 'reqs'");
69904#ifdef FREECIV_JSON_CONNECTION
69905 field_addr.name = "reqs";
69906#endif /* FREECIV_JSON_CONNECTION */
69907 {
69908 int i;
69909
69910#ifdef FREECIV_JSON_CONNECTION
69911 /* Enter array. */
69912 field_addr.sub_location = plocation_elem_new(0);
69913#endif /* FREECIV_JSON_CONNECTION */
69914
69915 if (real_packet->reqs_count > MAX_NUM_REQS) {
69916 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
69917 }
69918 for (i = 0; i < real_packet->reqs_count; i++) {
69919#ifdef FREECIV_JSON_CONNECTION
69920 field_addr.sub_location->number = i;
69921#endif /* FREECIV_JSON_CONNECTION */
69922 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
69923 RECEIVE_PACKET_FIELD_ERROR(reqs);
69924 }
69925 }
69926
69927#ifdef FREECIV_JSON_CONNECTION
69928 /* Exit array. */
69929 FC_FREE(field_addr.sub_location);
69930#endif /* FREECIV_JSON_CONNECTION */
69931 }
69932 }
69933 if (BV_ISSET(fields, 12)) {
69934 log_packet_detailed(" got field 'helptext'");
69935#ifdef FREECIV_JSON_CONNECTION
69936 field_addr.name = "helptext";
69937#endif /* FREECIV_JSON_CONNECTION */
69938 {
69939 int i;
69940
69941 if (!DIO_GET(arraylen, &din, &field_addr, &i)) {
69942 RECEIVE_PACKET_FIELD_ERROR(helptext);
69943 }
69944 strvec_reserve(real_packet->helptext, i);
69945
69946#ifdef FREECIV_JSON_CONNECTION
69947 field_addr.sub_location = plocation_elem_new(0);
69948#endif /* FREECIV_JSON_CONNECTION */
69949
69950 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
69951 char readin[MAX_LEN_PACKET];
69952
69953#ifdef FREECIV_JSON_CONNECTION
69954 /* Next array element */
69955 field_addr.sub_location->number = i;
69956#endif /* FREECIV_JSON_CONNECTION */
69957
69958 if (!DIO_GET(string, &din, &field_addr, readin, sizeof(readin))
69959 || !strvec_set(real_packet->helptext, i, readin)) {
69960 RECEIVE_PACKET_FIELD_ERROR(helptext);
69961 }
69962 }
69963
69964#ifdef FREECIV_JSON_CONNECTION
69965 FC_FREE(field_addr.sub_location);
69966#endif /* FREECIV_JSON_CONNECTION */
69967 }
69968 }
69969
69970 if (nullptr == old) {
69971 old = fc_malloc(sizeof(*old));
69972 init_packet_ruleset_multiplier(old);
69973 old->id = real_packet->id;
69974 old->start = real_packet->start;
69975 old->stop = real_packet->stop;
69976 old->step = real_packet->step;
69977 old->def = real_packet->def;
69978 old->offset = real_packet->offset;
69979 old->factor = real_packet->factor;
69980 old->minimum_turns = real_packet->minimum_turns;
69981 sz_strlcpy(old->name, real_packet->name);
69982 sz_strlcpy(old->rule_name, real_packet->rule_name);
69983 old->reqs_count = real_packet->reqs_count;
69984 {
69985 int i;
69986
69987 for (i = 0; i < real_packet->reqs_count; i++) {
69988 old->reqs[i] = real_packet->reqs[i];
69989 }
69990 }
69991 if (real_packet->helptext) {
69992 strvec_copy(old->helptext, real_packet->helptext);
69993 } else {
69994 strvec_clear(old->helptext);
69995 }
69996 genhash_insert(*hash, old, old);
69997 } else {
69998 old->id = real_packet->id;
69999 old->start = real_packet->start;
70000 old->stop = real_packet->stop;
70001 old->step = real_packet->step;
70002 old->def = real_packet->def;
70003 old->offset = real_packet->offset;
70004 old->factor = real_packet->factor;
70005 old->minimum_turns = real_packet->minimum_turns;
70006 sz_strlcpy(old->name, real_packet->name);
70007 sz_strlcpy(old->rule_name, real_packet->rule_name);
70008 old->reqs_count = real_packet->reqs_count;
70009 {
70010 int i;
70011
70012 for (i = 0; i < real_packet->reqs_count; i++) {
70013 old->reqs[i] = real_packet->reqs[i];
70014 }
70015 }
70016 if (real_packet->helptext) {
70017 strvec_copy(old->helptext, real_packet->helptext);
70018 } else {
70019 strvec_clear(old->helptext);
70020 }
70021 }
70022
70023#endif /* FREECIV_DELTA_PROTOCOL */
70024 RECEIVE_PACKET_END(real_packet);
70025#undef FREE_PACKET_STRUCT
70026}
70027
70028 static int send_packet_ruleset_multiplier_100(struct connection *pc, const struct packet_ruleset_multiplier *packet)
70029{
70030 const struct packet_ruleset_multiplier *real_packet = packet;
70031 int e;
70032#ifdef FREECIV_DELTA_PROTOCOL
70033 packet_ruleset_multiplier_100_fields fields;
70034 struct packet_ruleset_multiplier *old;
70035 bool differ;
70036 struct genhash **hash = pc->phs.sent + PACKET_RULESET_MULTIPLIER;
70037#endif /* FREECIV_DELTA_PROTOCOL */
70038 SEND_PACKET_START(PACKET_RULESET_MULTIPLIER);
70039#ifdef FREECIV_JSON_CONNECTION
70040 struct plocation field_addr;
70041 {
70042 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
70043 field_addr = *field_addr_tmp;
70044 FC_FREE(field_addr_tmp);
70045 }
70046#endif /* FREECIV_JSON_CONNECTION */
70047
70048 log_packet_detailed("packet_ruleset_multiplier_100: sending info about ()");
70049
70050#ifdef FREECIV_DELTA_PROTOCOL
70051 if (nullptr == *hash) {
70052 *hash = genhash_new_full(hash_packet_ruleset_multiplier_100, cmp_packet_ruleset_multiplier_100,
70053 nullptr, nullptr, nullptr, destroy_packet_ruleset_multiplier);
70054 }
70055 BV_CLR_ALL(fields);
70056
70057 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
70058 old = fc_malloc(sizeof(*old));
70059 /* temporary bitcopy just to insert correctly */
70060 *old = *real_packet;
70061 genhash_insert(*hash, old, old);
70062 init_packet_ruleset_multiplier(old);
70063 }
70064 differ = (old->id != real_packet->id);
70065 if (differ) {
70066 BV_SET(fields, 0);
70067 }
70068
70069 differ = (old->start != real_packet->start);
70070 if (differ) {
70071 BV_SET(fields, 1);
70072 }
70073
70074 differ = (old->stop != real_packet->stop);
70075 if (differ) {
70076 BV_SET(fields, 2);
70077 }
70078
70079 differ = (old->step != real_packet->step);
70080 if (differ) {
70081 BV_SET(fields, 3);
70082 }
70083
70084 differ = (old->def != real_packet->def);
70085 if (differ) {
70086 BV_SET(fields, 4);
70087 }
70088
70089 differ = (old->offset != real_packet->offset);
70090 if (differ) {
70091 BV_SET(fields, 5);
70092 }
70093
70094 differ = (old->factor != real_packet->factor);
70095 if (differ) {
70096 BV_SET(fields, 6);
70097 }
70098
70099 differ = (old->minimum_turns != real_packet->minimum_turns);
70100 if (differ) {
70101 BV_SET(fields, 7);
70102 }
70103
70104 differ = (strcmp(old->name, real_packet->name) != 0);
70105 if (differ) {
70106 BV_SET(fields, 8);
70107 }
70108
70109 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
70110 if (differ) {
70111 BV_SET(fields, 9);
70112 }
70113
70114 differ = (old->reqs_count != real_packet->reqs_count);
70115 if (differ) {
70116 BV_SET(fields, 10);
70117 }
70118
70119 differ = (old->reqs_count != real_packet->reqs_count);
70120 if (!differ) {
70121 int i;
70122
70123 for (i = 0; i < real_packet->reqs_count; i++) {
70124 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
70125 if (differ) {
70126 break;
70127 }
70128 }
70129 }
70130 if (differ) {
70131 BV_SET(fields, 11);
70132 }
70133
70134 if (real_packet->helptext) {
70135 differ = !are_strvecs_equal(old->helptext, real_packet->helptext);
70136 } else {
70137 differ = (strvec_size(old->helptext) > 0);
70138 }
70139 if (differ) {
70140 BV_SET(fields, 12);
70141 }
70142
70143
70144#ifdef FREECIV_JSON_CONNECTION
70145 field_addr.name = "fields";
70146#endif /* FREECIV_JSON_CONNECTION */
70147 e = 0;
70148 e |= DIO_BV_PUT(&dout, &field_addr, fields);
70149 if (e) {
70150 log_packet_detailed("fields bitvector error detected");
70151 }
70152
70153 if (BV_ISSET(fields, 0)) {
70154 log_packet_detailed(" field 'id' has changed");
70155#ifdef FREECIV_JSON_CONNECTION
70156 field_addr.name = "id";
70157#endif /* FREECIV_JSON_CONNECTION */
70158 e = 0;
70159 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
70160 if (e) {
70161 log_packet_detailed("'id' field error detected");
70162 }
70163 }
70164 if (BV_ISSET(fields, 1)) {
70165 log_packet_detailed(" field 'start' has changed");
70166#ifdef FREECIV_JSON_CONNECTION
70167 field_addr.name = "start";
70168#endif /* FREECIV_JSON_CONNECTION */
70169 e = 0;
70170 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->start);
70171 if (e) {
70172 log_packet_detailed("'start' field error detected");
70173 }
70174 }
70175 if (BV_ISSET(fields, 2)) {
70176 log_packet_detailed(" field 'stop' has changed");
70177#ifdef FREECIV_JSON_CONNECTION
70178 field_addr.name = "stop";
70179#endif /* FREECIV_JSON_CONNECTION */
70180 e = 0;
70181 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->stop);
70182 if (e) {
70183 log_packet_detailed("'stop' field error detected");
70184 }
70185 }
70186 if (BV_ISSET(fields, 3)) {
70187 log_packet_detailed(" field 'step' has changed");
70188#ifdef FREECIV_JSON_CONNECTION
70189 field_addr.name = "step";
70190#endif /* FREECIV_JSON_CONNECTION */
70191 e = 0;
70192 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->step);
70193 if (e) {
70194 log_packet_detailed("'step' field error detected");
70195 }
70196 }
70197 if (BV_ISSET(fields, 4)) {
70198 log_packet_detailed(" field 'def' has changed");
70199#ifdef FREECIV_JSON_CONNECTION
70200 field_addr.name = "def";
70201#endif /* FREECIV_JSON_CONNECTION */
70202 e = 0;
70203 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->def);
70204 if (e) {
70205 log_packet_detailed("'def' field error detected");
70206 }
70207 }
70208 if (BV_ISSET(fields, 5)) {
70209 log_packet_detailed(" field 'offset' has changed");
70210#ifdef FREECIV_JSON_CONNECTION
70211 field_addr.name = "offset";
70212#endif /* FREECIV_JSON_CONNECTION */
70213 e = 0;
70214 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->offset);
70215 if (e) {
70216 log_packet_detailed("'offset' field error detected");
70217 }
70218 }
70219 if (BV_ISSET(fields, 6)) {
70220 log_packet_detailed(" field 'factor' has changed");
70221#ifdef FREECIV_JSON_CONNECTION
70222 field_addr.name = "factor";
70223#endif /* FREECIV_JSON_CONNECTION */
70224 e = 0;
70225 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->factor);
70226 if (e) {
70227 log_packet_detailed("'factor' field error detected");
70228 }
70229 }
70230 if (BV_ISSET(fields, 7)) {
70231 log_packet_detailed(" field 'minimum_turns' has changed");
70232#ifdef FREECIV_JSON_CONNECTION
70233 field_addr.name = "minimum_turns";
70234#endif /* FREECIV_JSON_CONNECTION */
70235 e = 0;
70236 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->minimum_turns);
70237 if (e) {
70238 log_packet_detailed("'minimum_turns' field error detected");
70239 }
70240 }
70241 if (BV_ISSET(fields, 8)) {
70242 log_packet_detailed(" field 'name' has changed");
70243#ifdef FREECIV_JSON_CONNECTION
70244 field_addr.name = "name";
70245#endif /* FREECIV_JSON_CONNECTION */
70246 e = 0;
70247 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
70248 if (e) {
70249 log_packet_detailed("'name' field error detected");
70250 }
70251 }
70252 if (BV_ISSET(fields, 9)) {
70253 log_packet_detailed(" field 'rule_name' has changed");
70254#ifdef FREECIV_JSON_CONNECTION
70255 field_addr.name = "rule_name";
70256#endif /* FREECIV_JSON_CONNECTION */
70257 e = 0;
70258 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
70259 if (e) {
70260 log_packet_detailed("'rule_name' field error detected");
70261 }
70262 }
70263 if (BV_ISSET(fields, 10)) {
70264 log_packet_detailed(" field 'reqs_count' has changed");
70265#ifdef FREECIV_JSON_CONNECTION
70266 field_addr.name = "reqs_count";
70267#endif /* FREECIV_JSON_CONNECTION */
70268 e = 0;
70269 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
70270 if (e) {
70271 log_packet_detailed("'reqs_count' field error detected");
70272 }
70273 }
70274 if (BV_ISSET(fields, 11)) {
70275 log_packet_detailed(" field 'reqs' has changed");
70276#ifdef FREECIV_JSON_CONNECTION
70277 field_addr.name = "reqs";
70278#endif /* FREECIV_JSON_CONNECTION */
70279 e = 0;
70280 {
70281 int i;
70282
70283#ifdef FREECIV_JSON_CONNECTION
70284 /* Create the array. */
70285 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
70286
70287 /* Enter the array. */
70288 field_addr.sub_location = plocation_elem_new(0);
70289#endif /* FREECIV_JSON_CONNECTION */
70290
70291 for (i = 0; i < real_packet->reqs_count; i++) {
70292#ifdef FREECIV_JSON_CONNECTION
70293 /* Next array element. */
70294 field_addr.sub_location->number = i;
70295#endif /* FREECIV_JSON_CONNECTION */
70296 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
70297 }
70298
70299#ifdef FREECIV_JSON_CONNECTION
70300 /* Exit array. */
70301 FC_FREE(field_addr.sub_location);
70302#endif /* FREECIV_JSON_CONNECTION */
70303 }
70304 if (e) {
70305 log_packet_detailed("'reqs' field error detected");
70306 }
70307 }
70308 if (BV_ISSET(fields, 12)) {
70309 log_packet_detailed(" field 'helptext' has changed");
70310#ifdef FREECIV_JSON_CONNECTION
70311 field_addr.name = "helptext";
70312#endif /* FREECIV_JSON_CONNECTION */
70313 e = 0;
70314 if (!real_packet->helptext) {
70315 /* Transmit null vector as empty vector */
70316 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
70317 } else {
70318 int i;
70319
70320 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
70321 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
70322
70323#ifdef FREECIV_JSON_CONNECTION
70324 field_addr.sub_location = plocation_elem_new(0);
70325#endif /* FREECIV_JSON_CONNECTION */
70326
70327 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
70328 const char *pstr = strvec_get(real_packet->helptext, i);
70329
70330 if (!pstr) {
70331 /* Transmit null strings as empty strings */
70332 pstr = "";
70333 }
70334
70335#ifdef FREECIV_JSON_CONNECTION
70336 /* Next array element */
70337 field_addr.sub_location->number = i;
70338#endif /* FREECIV_JSON_CONNECTION */
70339
70340 e |= DIO_PUT(string, &dout, &field_addr, pstr);
70341 }
70342
70343#ifdef FREECIV_JSON_CONNECTION
70344 FC_FREE(field_addr.sub_location);
70345#endif /* FREECIV_JSON_CONNECTION */
70346 }
70347 if (e) {
70348 log_packet_detailed("'helptext' field error detected");
70349 }
70350 }
70351
70352 old->id = real_packet->id;
70353 old->start = real_packet->start;
70354 old->stop = real_packet->stop;
70355 old->step = real_packet->step;
70356 old->def = real_packet->def;
70357 old->offset = real_packet->offset;
70358 old->factor = real_packet->factor;
70359 old->minimum_turns = real_packet->minimum_turns;
70360 sz_strlcpy(old->name, real_packet->name);
70361 sz_strlcpy(old->rule_name, real_packet->rule_name);
70362 old->reqs_count = real_packet->reqs_count;
70363 {
70364 int i;
70365
70366 for (i = 0; i < real_packet->reqs_count; i++) {
70367 old->reqs[i] = real_packet->reqs[i];
70368 }
70369 }
70370 if (real_packet->helptext) {
70371 strvec_copy(old->helptext, real_packet->helptext);
70372 } else {
70373 strvec_clear(old->helptext);
70374 }
70375#endif /* FREECIV_DELTA_PROTOCOL */
70376#ifndef FREECIV_DELTA_PROTOCOL
70377#ifdef FREECIV_JSON_CONNECTION
70378 field_addr.name = "id";
70379#endif /* FREECIV_JSON_CONNECTION */
70380 e = 0;
70381 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
70382 if (e) {
70383 log_packet_detailed("'id' field error detected");
70384 }
70385#ifdef FREECIV_JSON_CONNECTION
70386 field_addr.name = "start";
70387#endif /* FREECIV_JSON_CONNECTION */
70388 e = 0;
70389 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->start);
70390 if (e) {
70391 log_packet_detailed("'start' field error detected");
70392 }
70393#ifdef FREECIV_JSON_CONNECTION
70394 field_addr.name = "stop";
70395#endif /* FREECIV_JSON_CONNECTION */
70396 e = 0;
70397 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->stop);
70398 if (e) {
70399 log_packet_detailed("'stop' field error detected");
70400 }
70401#ifdef FREECIV_JSON_CONNECTION
70402 field_addr.name = "step";
70403#endif /* FREECIV_JSON_CONNECTION */
70404 e = 0;
70405 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->step);
70406 if (e) {
70407 log_packet_detailed("'step' field error detected");
70408 }
70409#ifdef FREECIV_JSON_CONNECTION
70410 field_addr.name = "def";
70411#endif /* FREECIV_JSON_CONNECTION */
70412 e = 0;
70413 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->def);
70414 if (e) {
70415 log_packet_detailed("'def' field error detected");
70416 }
70417#ifdef FREECIV_JSON_CONNECTION
70418 field_addr.name = "offset";
70419#endif /* FREECIV_JSON_CONNECTION */
70420 e = 0;
70421 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->offset);
70422 if (e) {
70423 log_packet_detailed("'offset' field error detected");
70424 }
70425#ifdef FREECIV_JSON_CONNECTION
70426 field_addr.name = "factor";
70427#endif /* FREECIV_JSON_CONNECTION */
70428 e = 0;
70429 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->factor);
70430 if (e) {
70431 log_packet_detailed("'factor' field error detected");
70432 }
70433#ifdef FREECIV_JSON_CONNECTION
70434 field_addr.name = "minimum_turns";
70435#endif /* FREECIV_JSON_CONNECTION */
70436 e = 0;
70437 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->minimum_turns);
70438 if (e) {
70439 log_packet_detailed("'minimum_turns' field error detected");
70440 }
70441#ifdef FREECIV_JSON_CONNECTION
70442 field_addr.name = "name";
70443#endif /* FREECIV_JSON_CONNECTION */
70444 e = 0;
70445 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
70446 if (e) {
70447 log_packet_detailed("'name' field error detected");
70448 }
70449#ifdef FREECIV_JSON_CONNECTION
70450 field_addr.name = "rule_name";
70451#endif /* FREECIV_JSON_CONNECTION */
70452 e = 0;
70453 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
70454 if (e) {
70455 log_packet_detailed("'rule_name' field error detected");
70456 }
70457#ifdef FREECIV_JSON_CONNECTION
70458 field_addr.name = "reqs_count";
70459#endif /* FREECIV_JSON_CONNECTION */
70460 e = 0;
70461 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
70462 if (e) {
70463 log_packet_detailed("'reqs_count' field error detected");
70464 }
70465#ifdef FREECIV_JSON_CONNECTION
70466 field_addr.name = "reqs";
70467#endif /* FREECIV_JSON_CONNECTION */
70468 e = 0;
70469 {
70470 int i;
70471
70472#ifdef FREECIV_JSON_CONNECTION
70473 /* Create the array. */
70474 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
70475
70476 /* Enter the array. */
70477 field_addr.sub_location = plocation_elem_new(0);
70478#endif /* FREECIV_JSON_CONNECTION */
70479
70480 for (i = 0; i < real_packet->reqs_count; i++) {
70481#ifdef FREECIV_JSON_CONNECTION
70482 /* Next array element. */
70483 field_addr.sub_location->number = i;
70484#endif /* FREECIV_JSON_CONNECTION */
70485 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
70486 }
70487
70488#ifdef FREECIV_JSON_CONNECTION
70489 /* Exit array. */
70490 FC_FREE(field_addr.sub_location);
70491#endif /* FREECIV_JSON_CONNECTION */
70492 }
70493 if (e) {
70494 log_packet_detailed("'reqs' field error detected");
70495 }
70496#ifdef FREECIV_JSON_CONNECTION
70497 field_addr.name = "helptext";
70498#endif /* FREECIV_JSON_CONNECTION */
70499 e = 0;
70500 if (!real_packet->helptext) {
70501 /* Transmit null vector as empty vector */
70502 e |= DIO_PUT(arraylen, &dout, &field_addr, 0);
70503 } else {
70504 int i;
70505
70506 fc_assert(strvec_size(real_packet->helptext) < MAX_UINT16);
70507 e |= DIO_PUT(arraylen, &dout, &field_addr, strvec_size(real_packet->helptext));
70508
70509#ifdef FREECIV_JSON_CONNECTION
70510 field_addr.sub_location = plocation_elem_new(0);
70511#endif /* FREECIV_JSON_CONNECTION */
70512
70513 for (i = 0; i < strvec_size(real_packet->helptext); i++) {
70514 const char *pstr = strvec_get(real_packet->helptext, i);
70515
70516 if (!pstr) {
70517 /* Transmit null strings as empty strings */
70518 pstr = "";
70519 }
70520
70521#ifdef FREECIV_JSON_CONNECTION
70522 /* Next array element */
70523 field_addr.sub_location->number = i;
70524#endif /* FREECIV_JSON_CONNECTION */
70525
70526 e |= DIO_PUT(string, &dout, &field_addr, pstr);
70527 }
70528
70529#ifdef FREECIV_JSON_CONNECTION
70530 FC_FREE(field_addr.sub_location);
70531#endif /* FREECIV_JSON_CONNECTION */
70532 }
70533 if (e) {
70534 log_packet_detailed("'helptext' field error detected");
70535 }
70536
70537#endif
70538 SEND_PACKET_END(PACKET_RULESET_MULTIPLIER);
70539}
70540
70541 int send_packet_ruleset_multiplier(struct connection *pc, const struct packet_ruleset_multiplier *packet)
70542{
70543 if (!pc->used) {
70544 log_error("WARNING: trying to send data to the closed connection %s",
70545 conn_description(pc));
70546 return -1;
70547 }
70548 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_MULTIPLIER].packet != nullptr, -1,
70549 "Handler for PACKET_RULESET_MULTIPLIER not installed");
70550 return pc->phs.handlers->send[PACKET_RULESET_MULTIPLIER].packet(pc, packet);
70551}
70552
70553 void lsend_packet_ruleset_multiplier(struct conn_list *dest, const struct packet_ruleset_multiplier *packet)
70554{
70555 conn_list_iterate(dest, pconn) {
70556 send_packet_ruleset_multiplier(pconn, packet);
70557 } conn_list_iterate_end;
70558}
70559
70560 int dsend_packet_ruleset_multiplier(struct connection *pc, Multiplier_type_id id, int start, int stop, int step, int def, int offset, int factor, int minimum_turns, const char *name, const char *rule_name, int reqs_count, const struct requirement *reqs, const struct strvec *helptext)
70561{
70562 struct packet_ruleset_multiplier packet, *real_packet = &packet;
70563
70564 real_packet->id = id;
70565 real_packet->start = start;
70566 real_packet->stop = stop;
70567 real_packet->step = step;
70568 real_packet->def = def;
70569 real_packet->offset = offset;
70570 real_packet->factor = factor;
70571 real_packet->minimum_turns = minimum_turns;
70572 sz_strlcpy(real_packet->name, name);
70573 sz_strlcpy(real_packet->rule_name, rule_name);
70574 real_packet->reqs_count = reqs_count;
70575 {
70576 int i;
70577
70578 for (i = 0; i < real_packet->reqs_count; i++) {
70579 real_packet->reqs[i] = reqs[i];
70580 }
70581 }
70582 real_packet->helptext = (struct strvec *) helptext;
70583
70584 return send_packet_ruleset_multiplier(pc, real_packet);
70585}
70586
70587 void dlsend_packet_ruleset_multiplier(struct conn_list *dest, Multiplier_type_id id, int start, int stop, int step, int def, int offset, int factor, int minimum_turns, const char *name, const char *rule_name, int reqs_count, const struct requirement *reqs, const struct strvec *helptext)
70588{
70589 struct packet_ruleset_multiplier packet, *real_packet = &packet;
70590
70591 real_packet->id = id;
70592 real_packet->start = start;
70593 real_packet->stop = stop;
70594 real_packet->step = step;
70595 real_packet->def = def;
70596 real_packet->offset = offset;
70597 real_packet->factor = factor;
70598 real_packet->minimum_turns = minimum_turns;
70599 sz_strlcpy(real_packet->name, name);
70600 sz_strlcpy(real_packet->rule_name, rule_name);
70601 real_packet->reqs_count = reqs_count;
70602 {
70603 int i;
70604
70605 for (i = 0; i < real_packet->reqs_count; i++) {
70606 real_packet->reqs[i] = reqs[i];
70607 }
70608 }
70609 real_packet->helptext = (struct strvec *) helptext;
70610
70611 lsend_packet_ruleset_multiplier(dest, real_packet);
70612}
70613
70614 static inline void init_packet_ruleset_clause(struct packet_ruleset_clause *packet)
70615{
70616 memset(packet, 0, sizeof(*packet));
70617}
70618
70619#define free_packet_ruleset_clause(_packet) (void) 0
70620#define destroy_packet_ruleset_clause free
70621
70622#ifdef FREECIV_DELTA_PROTOCOL
70623#define hash_packet_ruleset_clause_100 hash_const
70624
70625#define cmp_packet_ruleset_clause_100 cmp_const
70626
70627 BV_DEFINE(packet_ruleset_clause_100_fields, 8);
70628#endif /* FREECIV_DELTA_PROTOCOL */
70629
70630 static struct packet_ruleset_clause *receive_packet_ruleset_clause_100(struct connection *pc)
70631{
70632#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_clause(_packet)
70633#ifdef FREECIV_DELTA_PROTOCOL
70634 packet_ruleset_clause_100_fields fields;
70635 struct packet_ruleset_clause *old;
70636 struct genhash **hash = pc->phs.received + PACKET_RULESET_CLAUSE;
70637#endif /* FREECIV_DELTA_PROTOCOL */
70638 RECEIVE_PACKET_START(packet_ruleset_clause, real_packet);
70639#ifdef FREECIV_JSON_CONNECTION
70640 struct plocation field_addr;
70641 {
70642 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
70643 field_addr = *field_addr_tmp;
70644 FC_FREE(field_addr_tmp);
70645 }
70646#endif /* FREECIV_JSON_CONNECTION */
70647
70648#ifdef FREECIV_DELTA_PROTOCOL
70649#ifdef FREECIV_JSON_CONNECTION
70650 field_addr.name = "fields";
70651#endif /* FREECIV_JSON_CONNECTION */
70652 DIO_BV_GET(&din, &field_addr, fields);
70653
70654#else /* FREECIV_DELTA_PROTOCOL */
70655#ifdef FREECIV_JSON_CONNECTION
70656 field_addr.name = "type";
70657#endif /* FREECIV_JSON_CONNECTION */
70658 {
70659 int readin;
70660
70661 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70662 RECEIVE_PACKET_FIELD_ERROR(type);
70663 }
70664 real_packet->type = readin;
70665 }
70666#ifdef FREECIV_JSON_CONNECTION
70667 field_addr.name = "enabled";
70668#endif /* FREECIV_JSON_CONNECTION */
70669 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->enabled)) {
70670 RECEIVE_PACKET_FIELD_ERROR(enabled);
70671 }
70672#ifdef FREECIV_JSON_CONNECTION
70673 field_addr.name = "giver_reqs_count";
70674#endif /* FREECIV_JSON_CONNECTION */
70675 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->giver_reqs_count)) {
70676 RECEIVE_PACKET_FIELD_ERROR(giver_reqs_count);
70677 }
70678#ifdef FREECIV_JSON_CONNECTION
70679 field_addr.name = "giver_reqs";
70680#endif /* FREECIV_JSON_CONNECTION */
70681 {
70682 int i;
70683
70684#ifdef FREECIV_JSON_CONNECTION
70685 /* Enter array. */
70686 field_addr.sub_location = plocation_elem_new(0);
70687#endif /* FREECIV_JSON_CONNECTION */
70688
70689 if (real_packet->giver_reqs_count > MAX_NUM_REQS) {
70690 RECEIVE_PACKET_FIELD_ERROR(giver_reqs, ": truncation array");
70691 }
70692 for (i = 0; i < real_packet->giver_reqs_count; i++) {
70693#ifdef FREECIV_JSON_CONNECTION
70694 field_addr.sub_location->number = i;
70695#endif /* FREECIV_JSON_CONNECTION */
70696 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->giver_reqs[i])) {
70697 RECEIVE_PACKET_FIELD_ERROR(giver_reqs);
70698 }
70699 }
70700
70701#ifdef FREECIV_JSON_CONNECTION
70702 /* Exit array. */
70703 FC_FREE(field_addr.sub_location);
70704#endif /* FREECIV_JSON_CONNECTION */
70705 }
70706#ifdef FREECIV_JSON_CONNECTION
70707 field_addr.name = "receiver_reqs_count";
70708#endif /* FREECIV_JSON_CONNECTION */
70709 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->receiver_reqs_count)) {
70710 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs_count);
70711 }
70712#ifdef FREECIV_JSON_CONNECTION
70713 field_addr.name = "receiver_reqs";
70714#endif /* FREECIV_JSON_CONNECTION */
70715 {
70716 int i;
70717
70718#ifdef FREECIV_JSON_CONNECTION
70719 /* Enter array. */
70720 field_addr.sub_location = plocation_elem_new(0);
70721#endif /* FREECIV_JSON_CONNECTION */
70722
70723 if (real_packet->receiver_reqs_count > MAX_NUM_REQS) {
70724 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs, ": truncation array");
70725 }
70726 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
70727#ifdef FREECIV_JSON_CONNECTION
70728 field_addr.sub_location->number = i;
70729#endif /* FREECIV_JSON_CONNECTION */
70730 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->receiver_reqs[i])) {
70731 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs);
70732 }
70733 }
70734
70735#ifdef FREECIV_JSON_CONNECTION
70736 /* Exit array. */
70737 FC_FREE(field_addr.sub_location);
70738#endif /* FREECIV_JSON_CONNECTION */
70739 }
70740#ifdef FREECIV_JSON_CONNECTION
70741 field_addr.name = "either_reqs_count";
70742#endif /* FREECIV_JSON_CONNECTION */
70743 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->either_reqs_count)) {
70744 RECEIVE_PACKET_FIELD_ERROR(either_reqs_count);
70745 }
70746#ifdef FREECIV_JSON_CONNECTION
70747 field_addr.name = "either_reqs";
70748#endif /* FREECIV_JSON_CONNECTION */
70749 {
70750 int i;
70751
70752#ifdef FREECIV_JSON_CONNECTION
70753 /* Enter array. */
70754 field_addr.sub_location = plocation_elem_new(0);
70755#endif /* FREECIV_JSON_CONNECTION */
70756
70757 if (real_packet->either_reqs_count > MAX_NUM_REQS) {
70758 RECEIVE_PACKET_FIELD_ERROR(either_reqs, ": truncation array");
70759 }
70760 for (i = 0; i < real_packet->either_reqs_count; i++) {
70761#ifdef FREECIV_JSON_CONNECTION
70762 field_addr.sub_location->number = i;
70763#endif /* FREECIV_JSON_CONNECTION */
70764 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->either_reqs[i])) {
70765 RECEIVE_PACKET_FIELD_ERROR(either_reqs);
70766 }
70767 }
70768
70769#ifdef FREECIV_JSON_CONNECTION
70770 /* Exit array. */
70771 FC_FREE(field_addr.sub_location);
70772#endif /* FREECIV_JSON_CONNECTION */
70773 }
70774#endif
70775 log_packet_detailed("packet_ruleset_clause_100: got info about ()");
70776
70777#ifdef FREECIV_DELTA_PROTOCOL
70778 if (nullptr == *hash) {
70779 *hash = genhash_new_full(hash_packet_ruleset_clause_100, cmp_packet_ruleset_clause_100,
70780 nullptr, nullptr, nullptr, destroy_packet_ruleset_clause);
70781 }
70782
70783 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
70784 *real_packet = *old;
70785 } else {
70786 /* packet is already initialized empty */
70787 log_packet_detailed(" no old info");
70788 }
70789
70790 if (BV_ISSET(fields, 0)) {
70791 log_packet_detailed(" got field 'type'");
70792#ifdef FREECIV_JSON_CONNECTION
70793 field_addr.name = "type";
70794#endif /* FREECIV_JSON_CONNECTION */
70795 {
70796 int readin;
70797
70798 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70799 RECEIVE_PACKET_FIELD_ERROR(type);
70800 }
70801 real_packet->type = readin;
70802 }
70803 }
70804 real_packet->enabled = BV_ISSET(fields, 1);
70805 if (BV_ISSET(fields, 2)) {
70806 log_packet_detailed(" got field 'giver_reqs_count'");
70807#ifdef FREECIV_JSON_CONNECTION
70808 field_addr.name = "giver_reqs_count";
70809#endif /* FREECIV_JSON_CONNECTION */
70810 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->giver_reqs_count)) {
70811 RECEIVE_PACKET_FIELD_ERROR(giver_reqs_count);
70812 }
70813 }
70814 if (BV_ISSET(fields, 3)) {
70815 log_packet_detailed(" got field 'giver_reqs'");
70816#ifdef FREECIV_JSON_CONNECTION
70817 field_addr.name = "giver_reqs";
70818#endif /* FREECIV_JSON_CONNECTION */
70819 {
70820 int i;
70821
70822#ifdef FREECIV_JSON_CONNECTION
70823 /* Enter array. */
70824 field_addr.sub_location = plocation_elem_new(0);
70825#endif /* FREECIV_JSON_CONNECTION */
70826
70827 if (real_packet->giver_reqs_count > MAX_NUM_REQS) {
70828 RECEIVE_PACKET_FIELD_ERROR(giver_reqs, ": truncation array");
70829 }
70830 for (i = 0; i < real_packet->giver_reqs_count; i++) {
70831#ifdef FREECIV_JSON_CONNECTION
70832 field_addr.sub_location->number = i;
70833#endif /* FREECIV_JSON_CONNECTION */
70834 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->giver_reqs[i])) {
70835 RECEIVE_PACKET_FIELD_ERROR(giver_reqs);
70836 }
70837 }
70838
70839#ifdef FREECIV_JSON_CONNECTION
70840 /* Exit array. */
70841 FC_FREE(field_addr.sub_location);
70842#endif /* FREECIV_JSON_CONNECTION */
70843 }
70844 }
70845 if (BV_ISSET(fields, 4)) {
70846 log_packet_detailed(" got field 'receiver_reqs_count'");
70847#ifdef FREECIV_JSON_CONNECTION
70848 field_addr.name = "receiver_reqs_count";
70849#endif /* FREECIV_JSON_CONNECTION */
70850 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->receiver_reqs_count)) {
70851 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs_count);
70852 }
70853 }
70854 if (BV_ISSET(fields, 5)) {
70855 log_packet_detailed(" got field 'receiver_reqs'");
70856#ifdef FREECIV_JSON_CONNECTION
70857 field_addr.name = "receiver_reqs";
70858#endif /* FREECIV_JSON_CONNECTION */
70859 {
70860 int i;
70861
70862#ifdef FREECIV_JSON_CONNECTION
70863 /* Enter array. */
70864 field_addr.sub_location = plocation_elem_new(0);
70865#endif /* FREECIV_JSON_CONNECTION */
70866
70867 if (real_packet->receiver_reqs_count > MAX_NUM_REQS) {
70868 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs, ": truncation array");
70869 }
70870 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
70871#ifdef FREECIV_JSON_CONNECTION
70872 field_addr.sub_location->number = i;
70873#endif /* FREECIV_JSON_CONNECTION */
70874 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->receiver_reqs[i])) {
70875 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs);
70876 }
70877 }
70878
70879#ifdef FREECIV_JSON_CONNECTION
70880 /* Exit array. */
70881 FC_FREE(field_addr.sub_location);
70882#endif /* FREECIV_JSON_CONNECTION */
70883 }
70884 }
70885 if (BV_ISSET(fields, 6)) {
70886 log_packet_detailed(" got field 'either_reqs_count'");
70887#ifdef FREECIV_JSON_CONNECTION
70888 field_addr.name = "either_reqs_count";
70889#endif /* FREECIV_JSON_CONNECTION */
70890 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->either_reqs_count)) {
70891 RECEIVE_PACKET_FIELD_ERROR(either_reqs_count);
70892 }
70893 }
70894 if (BV_ISSET(fields, 7)) {
70895 log_packet_detailed(" got field 'either_reqs'");
70896#ifdef FREECIV_JSON_CONNECTION
70897 field_addr.name = "either_reqs";
70898#endif /* FREECIV_JSON_CONNECTION */
70899 {
70900 int i;
70901
70902#ifdef FREECIV_JSON_CONNECTION
70903 /* Enter array. */
70904 field_addr.sub_location = plocation_elem_new(0);
70905#endif /* FREECIV_JSON_CONNECTION */
70906
70907 if (real_packet->either_reqs_count > MAX_NUM_REQS) {
70908 RECEIVE_PACKET_FIELD_ERROR(either_reqs, ": truncation array");
70909 }
70910 for (i = 0; i < real_packet->either_reqs_count; i++) {
70911#ifdef FREECIV_JSON_CONNECTION
70912 field_addr.sub_location->number = i;
70913#endif /* FREECIV_JSON_CONNECTION */
70914 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->either_reqs[i])) {
70915 RECEIVE_PACKET_FIELD_ERROR(either_reqs);
70916 }
70917 }
70918
70919#ifdef FREECIV_JSON_CONNECTION
70920 /* Exit array. */
70921 FC_FREE(field_addr.sub_location);
70922#endif /* FREECIV_JSON_CONNECTION */
70923 }
70924 }
70925
70926 if (nullptr == old) {
70927 old = fc_malloc(sizeof(*old));
70928 init_packet_ruleset_clause(old);
70929 *old = *real_packet;
70930 genhash_insert(*hash, old, old);
70931 } else {
70932 *old = *real_packet;
70933 }
70934
70935#endif /* FREECIV_DELTA_PROTOCOL */
70936 RECEIVE_PACKET_END(real_packet);
70937#undef FREE_PACKET_STRUCT
70938}
70939
70940 static int send_packet_ruleset_clause_100(struct connection *pc, const struct packet_ruleset_clause *packet)
70941{
70942 const struct packet_ruleset_clause *real_packet = packet;
70943 int e;
70944#ifdef FREECIV_DELTA_PROTOCOL
70945 packet_ruleset_clause_100_fields fields;
70946 struct packet_ruleset_clause *old;
70947 bool differ;
70948 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CLAUSE;
70949#endif /* FREECIV_DELTA_PROTOCOL */
70950 SEND_PACKET_START(PACKET_RULESET_CLAUSE);
70951#ifdef FREECIV_JSON_CONNECTION
70952 struct plocation field_addr;
70953 {
70954 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
70955 field_addr = *field_addr_tmp;
70956 FC_FREE(field_addr_tmp);
70957 }
70958#endif /* FREECIV_JSON_CONNECTION */
70959
70960 log_packet_detailed("packet_ruleset_clause_100: sending info about ()");
70961
70962#ifdef FREECIV_DELTA_PROTOCOL
70963 if (nullptr == *hash) {
70964 *hash = genhash_new_full(hash_packet_ruleset_clause_100, cmp_packet_ruleset_clause_100,
70965 nullptr, nullptr, nullptr, destroy_packet_ruleset_clause);
70966 }
70967 BV_CLR_ALL(fields);
70968
70969 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
70970 old = fc_malloc(sizeof(*old));
70971 /* temporary bitcopy just to insert correctly */
70972 *old = *real_packet;
70973 genhash_insert(*hash, old, old);
70974 init_packet_ruleset_clause(old);
70975 }
70976 differ = (old->type != real_packet->type);
70977 if (differ) {
70978 BV_SET(fields, 0);
70979 }
70980
70981 if (packet->enabled) {
70982 BV_SET(fields, 1);
70983 }
70984
70985 differ = (old->giver_reqs_count != real_packet->giver_reqs_count);
70986 if (differ) {
70987 BV_SET(fields, 2);
70988 }
70989
70990 differ = (old->giver_reqs_count != real_packet->giver_reqs_count);
70991 if (!differ) {
70992 int i;
70993
70994 for (i = 0; i < real_packet->giver_reqs_count; i++) {
70995 differ = !are_requirements_equal(&old->giver_reqs[i], &real_packet->giver_reqs[i]);
70996 if (differ) {
70997 break;
70998 }
70999 }
71000 }
71001 if (differ) {
71002 BV_SET(fields, 3);
71003 }
71004
71005 differ = (old->receiver_reqs_count != real_packet->receiver_reqs_count);
71006 if (differ) {
71007 BV_SET(fields, 4);
71008 }
71009
71010 differ = (old->receiver_reqs_count != real_packet->receiver_reqs_count);
71011 if (!differ) {
71012 int i;
71013
71014 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
71015 differ = !are_requirements_equal(&old->receiver_reqs[i], &real_packet->receiver_reqs[i]);
71016 if (differ) {
71017 break;
71018 }
71019 }
71020 }
71021 if (differ) {
71022 BV_SET(fields, 5);
71023 }
71024
71025 differ = (old->either_reqs_count != real_packet->either_reqs_count);
71026 if (differ) {
71027 BV_SET(fields, 6);
71028 }
71029
71030 differ = (old->either_reqs_count != real_packet->either_reqs_count);
71031 if (!differ) {
71032 int i;
71033
71034 for (i = 0; i < real_packet->either_reqs_count; i++) {
71035 differ = !are_requirements_equal(&old->either_reqs[i], &real_packet->either_reqs[i]);
71036 if (differ) {
71037 break;
71038 }
71039 }
71040 }
71041 if (differ) {
71042 BV_SET(fields, 7);
71043 }
71044
71045
71046#ifdef FREECIV_JSON_CONNECTION
71047 field_addr.name = "fields";
71048#endif /* FREECIV_JSON_CONNECTION */
71049 e = 0;
71050 e |= DIO_BV_PUT(&dout, &field_addr, fields);
71051 if (e) {
71052 log_packet_detailed("fields bitvector error detected");
71053 }
71054
71055 if (BV_ISSET(fields, 0)) {
71056 log_packet_detailed(" field 'type' has changed");
71057#ifdef FREECIV_JSON_CONNECTION
71058 field_addr.name = "type";
71059#endif /* FREECIV_JSON_CONNECTION */
71060 e = 0;
71061 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
71062 if (e) {
71063 log_packet_detailed("'type' field error detected");
71064 }
71065 }
71066 /* field 1 is folded into the header */
71067 if (BV_ISSET(fields, 2)) {
71068 log_packet_detailed(" field 'giver_reqs_count' has changed");
71069#ifdef FREECIV_JSON_CONNECTION
71070 field_addr.name = "giver_reqs_count";
71071#endif /* FREECIV_JSON_CONNECTION */
71072 e = 0;
71073 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->giver_reqs_count);
71074 if (e) {
71075 log_packet_detailed("'giver_reqs_count' field error detected");
71076 }
71077 }
71078 if (BV_ISSET(fields, 3)) {
71079 log_packet_detailed(" field 'giver_reqs' has changed");
71080#ifdef FREECIV_JSON_CONNECTION
71081 field_addr.name = "giver_reqs";
71082#endif /* FREECIV_JSON_CONNECTION */
71083 e = 0;
71084 {
71085 int i;
71086
71087#ifdef FREECIV_JSON_CONNECTION
71088 /* Create the array. */
71089 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->giver_reqs_count);
71090
71091 /* Enter the array. */
71092 field_addr.sub_location = plocation_elem_new(0);
71093#endif /* FREECIV_JSON_CONNECTION */
71094
71095 for (i = 0; i < real_packet->giver_reqs_count; i++) {
71096#ifdef FREECIV_JSON_CONNECTION
71097 /* Next array element. */
71098 field_addr.sub_location->number = i;
71099#endif /* FREECIV_JSON_CONNECTION */
71100 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->giver_reqs[i]);
71101 }
71102
71103#ifdef FREECIV_JSON_CONNECTION
71104 /* Exit array. */
71105 FC_FREE(field_addr.sub_location);
71106#endif /* FREECIV_JSON_CONNECTION */
71107 }
71108 if (e) {
71109 log_packet_detailed("'giver_reqs' field error detected");
71110 }
71111 }
71112 if (BV_ISSET(fields, 4)) {
71113 log_packet_detailed(" field 'receiver_reqs_count' has changed");
71114#ifdef FREECIV_JSON_CONNECTION
71115 field_addr.name = "receiver_reqs_count";
71116#endif /* FREECIV_JSON_CONNECTION */
71117 e = 0;
71118 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->receiver_reqs_count);
71119 if (e) {
71120 log_packet_detailed("'receiver_reqs_count' field error detected");
71121 }
71122 }
71123 if (BV_ISSET(fields, 5)) {
71124 log_packet_detailed(" field 'receiver_reqs' has changed");
71125#ifdef FREECIV_JSON_CONNECTION
71126 field_addr.name = "receiver_reqs";
71127#endif /* FREECIV_JSON_CONNECTION */
71128 e = 0;
71129 {
71130 int i;
71131
71132#ifdef FREECIV_JSON_CONNECTION
71133 /* Create the array. */
71134 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->receiver_reqs_count);
71135
71136 /* Enter the array. */
71137 field_addr.sub_location = plocation_elem_new(0);
71138#endif /* FREECIV_JSON_CONNECTION */
71139
71140 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
71141#ifdef FREECIV_JSON_CONNECTION
71142 /* Next array element. */
71143 field_addr.sub_location->number = i;
71144#endif /* FREECIV_JSON_CONNECTION */
71145 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->receiver_reqs[i]);
71146 }
71147
71148#ifdef FREECIV_JSON_CONNECTION
71149 /* Exit array. */
71150 FC_FREE(field_addr.sub_location);
71151#endif /* FREECIV_JSON_CONNECTION */
71152 }
71153 if (e) {
71154 log_packet_detailed("'receiver_reqs' field error detected");
71155 }
71156 }
71157 if (BV_ISSET(fields, 6)) {
71158 log_packet_detailed(" field 'either_reqs_count' has changed");
71159#ifdef FREECIV_JSON_CONNECTION
71160 field_addr.name = "either_reqs_count";
71161#endif /* FREECIV_JSON_CONNECTION */
71162 e = 0;
71163 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->either_reqs_count);
71164 if (e) {
71165 log_packet_detailed("'either_reqs_count' field error detected");
71166 }
71167 }
71168 if (BV_ISSET(fields, 7)) {
71169 log_packet_detailed(" field 'either_reqs' has changed");
71170#ifdef FREECIV_JSON_CONNECTION
71171 field_addr.name = "either_reqs";
71172#endif /* FREECIV_JSON_CONNECTION */
71173 e = 0;
71174 {
71175 int i;
71176
71177#ifdef FREECIV_JSON_CONNECTION
71178 /* Create the array. */
71179 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->either_reqs_count);
71180
71181 /* Enter the array. */
71182 field_addr.sub_location = plocation_elem_new(0);
71183#endif /* FREECIV_JSON_CONNECTION */
71184
71185 for (i = 0; i < real_packet->either_reqs_count; i++) {
71186#ifdef FREECIV_JSON_CONNECTION
71187 /* Next array element. */
71188 field_addr.sub_location->number = i;
71189#endif /* FREECIV_JSON_CONNECTION */
71190 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->either_reqs[i]);
71191 }
71192
71193#ifdef FREECIV_JSON_CONNECTION
71194 /* Exit array. */
71195 FC_FREE(field_addr.sub_location);
71196#endif /* FREECIV_JSON_CONNECTION */
71197 }
71198 if (e) {
71199 log_packet_detailed("'either_reqs' field error detected");
71200 }
71201 }
71202
71203 *old = *real_packet;
71204#endif /* FREECIV_DELTA_PROTOCOL */
71205#ifndef FREECIV_DELTA_PROTOCOL
71206#ifdef FREECIV_JSON_CONNECTION
71207 field_addr.name = "type";
71208#endif /* FREECIV_JSON_CONNECTION */
71209 e = 0;
71210 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
71211 if (e) {
71212 log_packet_detailed("'type' field error detected");
71213 }
71214#ifdef FREECIV_JSON_CONNECTION
71215 field_addr.name = "enabled";
71216#endif /* FREECIV_JSON_CONNECTION */
71217 e = 0;
71218 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->enabled);
71219 if (e) {
71220 log_packet_detailed("'enabled' field error detected");
71221 }
71222#ifdef FREECIV_JSON_CONNECTION
71223 field_addr.name = "giver_reqs_count";
71224#endif /* FREECIV_JSON_CONNECTION */
71225 e = 0;
71226 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->giver_reqs_count);
71227 if (e) {
71228 log_packet_detailed("'giver_reqs_count' field error detected");
71229 }
71230#ifdef FREECIV_JSON_CONNECTION
71231 field_addr.name = "giver_reqs";
71232#endif /* FREECIV_JSON_CONNECTION */
71233 e = 0;
71234 {
71235 int i;
71236
71237#ifdef FREECIV_JSON_CONNECTION
71238 /* Create the array. */
71239 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->giver_reqs_count);
71240
71241 /* Enter the array. */
71242 field_addr.sub_location = plocation_elem_new(0);
71243#endif /* FREECIV_JSON_CONNECTION */
71244
71245 for (i = 0; i < real_packet->giver_reqs_count; i++) {
71246#ifdef FREECIV_JSON_CONNECTION
71247 /* Next array element. */
71248 field_addr.sub_location->number = i;
71249#endif /* FREECIV_JSON_CONNECTION */
71250 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->giver_reqs[i]);
71251 }
71252
71253#ifdef FREECIV_JSON_CONNECTION
71254 /* Exit array. */
71255 FC_FREE(field_addr.sub_location);
71256#endif /* FREECIV_JSON_CONNECTION */
71257 }
71258 if (e) {
71259 log_packet_detailed("'giver_reqs' field error detected");
71260 }
71261#ifdef FREECIV_JSON_CONNECTION
71262 field_addr.name = "receiver_reqs_count";
71263#endif /* FREECIV_JSON_CONNECTION */
71264 e = 0;
71265 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->receiver_reqs_count);
71266 if (e) {
71267 log_packet_detailed("'receiver_reqs_count' field error detected");
71268 }
71269#ifdef FREECIV_JSON_CONNECTION
71270 field_addr.name = "receiver_reqs";
71271#endif /* FREECIV_JSON_CONNECTION */
71272 e = 0;
71273 {
71274 int i;
71275
71276#ifdef FREECIV_JSON_CONNECTION
71277 /* Create the array. */
71278 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->receiver_reqs_count);
71279
71280 /* Enter the array. */
71281 field_addr.sub_location = plocation_elem_new(0);
71282#endif /* FREECIV_JSON_CONNECTION */
71283
71284 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
71285#ifdef FREECIV_JSON_CONNECTION
71286 /* Next array element. */
71287 field_addr.sub_location->number = i;
71288#endif /* FREECIV_JSON_CONNECTION */
71289 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->receiver_reqs[i]);
71290 }
71291
71292#ifdef FREECIV_JSON_CONNECTION
71293 /* Exit array. */
71294 FC_FREE(field_addr.sub_location);
71295#endif /* FREECIV_JSON_CONNECTION */
71296 }
71297 if (e) {
71298 log_packet_detailed("'receiver_reqs' field error detected");
71299 }
71300#ifdef FREECIV_JSON_CONNECTION
71301 field_addr.name = "either_reqs_count";
71302#endif /* FREECIV_JSON_CONNECTION */
71303 e = 0;
71304 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->either_reqs_count);
71305 if (e) {
71306 log_packet_detailed("'either_reqs_count' field error detected");
71307 }
71308#ifdef FREECIV_JSON_CONNECTION
71309 field_addr.name = "either_reqs";
71310#endif /* FREECIV_JSON_CONNECTION */
71311 e = 0;
71312 {
71313 int i;
71314
71315#ifdef FREECIV_JSON_CONNECTION
71316 /* Create the array. */
71317 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->either_reqs_count);
71318
71319 /* Enter the array. */
71320 field_addr.sub_location = plocation_elem_new(0);
71321#endif /* FREECIV_JSON_CONNECTION */
71322
71323 for (i = 0; i < real_packet->either_reqs_count; i++) {
71324#ifdef FREECIV_JSON_CONNECTION
71325 /* Next array element. */
71326 field_addr.sub_location->number = i;
71327#endif /* FREECIV_JSON_CONNECTION */
71328 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->either_reqs[i]);
71329 }
71330
71331#ifdef FREECIV_JSON_CONNECTION
71332 /* Exit array. */
71333 FC_FREE(field_addr.sub_location);
71334#endif /* FREECIV_JSON_CONNECTION */
71335 }
71336 if (e) {
71337 log_packet_detailed("'either_reqs' field error detected");
71338 }
71339
71340#endif
71341 SEND_PACKET_END(PACKET_RULESET_CLAUSE);
71342}
71343
71344 int send_packet_ruleset_clause(struct connection *pc, const struct packet_ruleset_clause *packet)
71345{
71346 if (!pc->used) {
71347 log_error("WARNING: trying to send data to the closed connection %s",
71348 conn_description(pc));
71349 return -1;
71350 }
71351 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CLAUSE].packet != nullptr, -1,
71352 "Handler for PACKET_RULESET_CLAUSE not installed");
71353 return pc->phs.handlers->send[PACKET_RULESET_CLAUSE].packet(pc, packet);
71354}
71355
71356 void lsend_packet_ruleset_clause(struct conn_list *dest, const struct packet_ruleset_clause *packet)
71357{
71358 conn_list_iterate(dest, pconn) {
71359 send_packet_ruleset_clause(pconn, packet);
71360 } conn_list_iterate_end;
71361}
71362
71363 static inline void init_packet_ruleset_control(struct packet_ruleset_control *packet)
71364{
71365 memset(packet, 0, sizeof(*packet));
71366}
71367
71368#define free_packet_ruleset_control(_packet) (void) 0
71369#define destroy_packet_ruleset_control free
71370
71371#ifdef FREECIV_DELTA_PROTOCOL
71372#define hash_packet_ruleset_control_100 hash_const
71373
71374#define cmp_packet_ruleset_control_100 cmp_const
71375
71376 BV_DEFINE(packet_ruleset_control_100_fields, 31);
71377#endif /* FREECIV_DELTA_PROTOCOL */
71378
71379 static struct packet_ruleset_control *receive_packet_ruleset_control_100(struct connection *pc)
71380{
71381#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_control(_packet)
71382#ifdef FREECIV_DELTA_PROTOCOL
71383 packet_ruleset_control_100_fields fields;
71384 struct packet_ruleset_control *old;
71385 struct genhash **hash = pc->phs.received + PACKET_RULESET_CONTROL;
71386#endif /* FREECIV_DELTA_PROTOCOL */
71387 RECEIVE_PACKET_START(packet_ruleset_control, real_packet);
71388#ifdef FREECIV_JSON_CONNECTION
71389 struct plocation field_addr;
71390 {
71391 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
71392 field_addr = *field_addr_tmp;
71393 FC_FREE(field_addr_tmp);
71394 }
71395#endif /* FREECIV_JSON_CONNECTION */
71396
71397#ifdef FREECIV_DELTA_PROTOCOL
71398#ifdef FREECIV_JSON_CONNECTION
71399 field_addr.name = "fields";
71400#endif /* FREECIV_JSON_CONNECTION */
71401 DIO_BV_GET(&din, &field_addr, fields);
71402
71403#else /* FREECIV_DELTA_PROTOCOL */
71404#ifdef FREECIV_JSON_CONNECTION
71405 field_addr.name = "num_unit_classes";
71406#endif /* FREECIV_JSON_CONNECTION */
71407 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
71408 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
71409 }
71410#ifdef FREECIV_JSON_CONNECTION
71411 field_addr.name = "num_unit_types";
71412#endif /* FREECIV_JSON_CONNECTION */
71413 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
71414 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
71415 }
71416#ifdef FREECIV_JSON_CONNECTION
71417 field_addr.name = "num_impr_types";
71418#endif /* FREECIV_JSON_CONNECTION */
71419 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
71420 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
71421 }
71422#ifdef FREECIV_JSON_CONNECTION
71423 field_addr.name = "num_tech_classes";
71424#endif /* FREECIV_JSON_CONNECTION */
71425 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
71426 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
71427 }
71428#ifdef FREECIV_JSON_CONNECTION
71429 field_addr.name = "num_tech_types";
71430#endif /* FREECIV_JSON_CONNECTION */
71431 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
71432 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
71433 }
71434#ifdef FREECIV_JSON_CONNECTION
71435 field_addr.name = "num_extra_types";
71436#endif /* FREECIV_JSON_CONNECTION */
71437 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
71438 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
71439 }
71440#ifdef FREECIV_JSON_CONNECTION
71441 field_addr.name = "num_base_types";
71442#endif /* FREECIV_JSON_CONNECTION */
71443 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
71444 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
71445 }
71446#ifdef FREECIV_JSON_CONNECTION
71447 field_addr.name = "num_road_types";
71448#endif /* FREECIV_JSON_CONNECTION */
71449 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
71450 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
71451 }
71452#ifdef FREECIV_JSON_CONNECTION
71453 field_addr.name = "num_resource_types";
71454#endif /* FREECIV_JSON_CONNECTION */
71455 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
71456 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
71457 }
71458#ifdef FREECIV_JSON_CONNECTION
71459 field_addr.name = "num_goods_types";
71460#endif /* FREECIV_JSON_CONNECTION */
71461 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
71462 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
71463 }
71464#ifdef FREECIV_JSON_CONNECTION
71465 field_addr.name = "num_disaster_types";
71466#endif /* FREECIV_JSON_CONNECTION */
71467 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
71468 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
71469 }
71470#ifdef FREECIV_JSON_CONNECTION
71471 field_addr.name = "num_achievement_types";
71472#endif /* FREECIV_JSON_CONNECTION */
71473 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
71474 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
71475 }
71476#ifdef FREECIV_JSON_CONNECTION
71477 field_addr.name = "num_multipliers";
71478#endif /* FREECIV_JSON_CONNECTION */
71479 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
71480 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
71481 }
71482#ifdef FREECIV_JSON_CONNECTION
71483 field_addr.name = "num_styles";
71484#endif /* FREECIV_JSON_CONNECTION */
71485 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
71486 RECEIVE_PACKET_FIELD_ERROR(num_styles);
71487 }
71488#ifdef FREECIV_JSON_CONNECTION
71489 field_addr.name = "num_music_styles";
71490#endif /* FREECIV_JSON_CONNECTION */
71491 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
71492 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
71493 }
71494#ifdef FREECIV_JSON_CONNECTION
71495 field_addr.name = "government_count";
71496#endif /* FREECIV_JSON_CONNECTION */
71497 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
71498 RECEIVE_PACKET_FIELD_ERROR(government_count);
71499 }
71500#ifdef FREECIV_JSON_CONNECTION
71501 field_addr.name = "nation_count";
71502#endif /* FREECIV_JSON_CONNECTION */
71503 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
71504 RECEIVE_PACKET_FIELD_ERROR(nation_count);
71505 }
71506#ifdef FREECIV_JSON_CONNECTION
71507 field_addr.name = "num_city_styles";
71508#endif /* FREECIV_JSON_CONNECTION */
71509 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_city_styles)) {
71510 RECEIVE_PACKET_FIELD_ERROR(num_city_styles);
71511 }
71512#ifdef FREECIV_JSON_CONNECTION
71513 field_addr.name = "terrain_count";
71514#endif /* FREECIV_JSON_CONNECTION */
71515 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
71516 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
71517 }
71518#ifdef FREECIV_JSON_CONNECTION
71519 field_addr.name = "num_specialist_types";
71520#endif /* FREECIV_JSON_CONNECTION */
71521 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
71522 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
71523 }
71524#ifdef FREECIV_JSON_CONNECTION
71525 field_addr.name = "num_nation_groups";
71526#endif /* FREECIV_JSON_CONNECTION */
71527 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
71528 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
71529 }
71530#ifdef FREECIV_JSON_CONNECTION
71531 field_addr.name = "num_nation_sets";
71532#endif /* FREECIV_JSON_CONNECTION */
71533 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
71534 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
71535 }
71536#ifdef FREECIV_JSON_CONNECTION
71537 field_addr.name = "preferred_tileset";
71538#endif /* FREECIV_JSON_CONNECTION */
71539 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
71540 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
71541 }
71542#ifdef FREECIV_JSON_CONNECTION
71543 field_addr.name = "preferred_soundset";
71544#endif /* FREECIV_JSON_CONNECTION */
71545 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
71546 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
71547 }
71548#ifdef FREECIV_JSON_CONNECTION
71549 field_addr.name = "preferred_musicset";
71550#endif /* FREECIV_JSON_CONNECTION */
71551 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
71552 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
71553 }
71554#ifdef FREECIV_JSON_CONNECTION
71555 field_addr.name = "popup_tech_help";
71556#endif /* FREECIV_JSON_CONNECTION */
71557 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->popup_tech_help)) {
71558 RECEIVE_PACKET_FIELD_ERROR(popup_tech_help);
71559 }
71560#ifdef FREECIV_JSON_CONNECTION
71561 field_addr.name = "name";
71562#endif /* FREECIV_JSON_CONNECTION */
71563 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
71564 RECEIVE_PACKET_FIELD_ERROR(name);
71565 }
71566#ifdef FREECIV_JSON_CONNECTION
71567 field_addr.name = "version";
71568#endif /* FREECIV_JSON_CONNECTION */
71569 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
71570 RECEIVE_PACKET_FIELD_ERROR(version);
71571 }
71572#ifdef FREECIV_JSON_CONNECTION
71573 field_addr.name = "alt_dir";
71574#endif /* FREECIV_JSON_CONNECTION */
71575 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
71576 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
71577 }
71578#ifdef FREECIV_JSON_CONNECTION
71579 field_addr.name = "desc_length";
71580#endif /* FREECIV_JSON_CONNECTION */
71581 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->desc_length)) {
71582 RECEIVE_PACKET_FIELD_ERROR(desc_length);
71583 }
71584#ifdef FREECIV_JSON_CONNECTION
71585 field_addr.name = "num_counters";
71586#endif /* FREECIV_JSON_CONNECTION */
71587 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_counters)) {
71588 RECEIVE_PACKET_FIELD_ERROR(num_counters);
71589 }
71590#endif
71591 log_packet_detailed("packet_ruleset_control_100: got info about ()");
71592
71593#ifdef FREECIV_DELTA_PROTOCOL
71594 if (nullptr == *hash) {
71595 *hash = genhash_new_full(hash_packet_ruleset_control_100, cmp_packet_ruleset_control_100,
71596 nullptr, nullptr, nullptr, destroy_packet_ruleset_control);
71597 }
71598
71599 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
71600 *real_packet = *old;
71601 } else {
71602 /* packet is already initialized empty */
71603 log_packet_detailed(" no old info");
71604 }
71605
71606 if (BV_ISSET(fields, 0)) {
71607 log_packet_detailed(" got field 'num_unit_classes'");
71608#ifdef FREECIV_JSON_CONNECTION
71609 field_addr.name = "num_unit_classes";
71610#endif /* FREECIV_JSON_CONNECTION */
71611 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
71612 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
71613 }
71614 }
71615 if (BV_ISSET(fields, 1)) {
71616 log_packet_detailed(" got field 'num_unit_types'");
71617#ifdef FREECIV_JSON_CONNECTION
71618 field_addr.name = "num_unit_types";
71619#endif /* FREECIV_JSON_CONNECTION */
71620 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
71621 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
71622 }
71623 }
71624 if (BV_ISSET(fields, 2)) {
71625 log_packet_detailed(" got field 'num_impr_types'");
71626#ifdef FREECIV_JSON_CONNECTION
71627 field_addr.name = "num_impr_types";
71628#endif /* FREECIV_JSON_CONNECTION */
71629 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
71630 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
71631 }
71632 }
71633 if (BV_ISSET(fields, 3)) {
71634 log_packet_detailed(" got field 'num_tech_classes'");
71635#ifdef FREECIV_JSON_CONNECTION
71636 field_addr.name = "num_tech_classes";
71637#endif /* FREECIV_JSON_CONNECTION */
71638 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
71639 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
71640 }
71641 }
71642 if (BV_ISSET(fields, 4)) {
71643 log_packet_detailed(" got field 'num_tech_types'");
71644#ifdef FREECIV_JSON_CONNECTION
71645 field_addr.name = "num_tech_types";
71646#endif /* FREECIV_JSON_CONNECTION */
71647 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
71648 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
71649 }
71650 }
71651 if (BV_ISSET(fields, 5)) {
71652 log_packet_detailed(" got field 'num_extra_types'");
71653#ifdef FREECIV_JSON_CONNECTION
71654 field_addr.name = "num_extra_types";
71655#endif /* FREECIV_JSON_CONNECTION */
71656 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
71657 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
71658 }
71659 }
71660 if (BV_ISSET(fields, 6)) {
71661 log_packet_detailed(" got field 'num_base_types'");
71662#ifdef FREECIV_JSON_CONNECTION
71663 field_addr.name = "num_base_types";
71664#endif /* FREECIV_JSON_CONNECTION */
71665 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
71666 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
71667 }
71668 }
71669 if (BV_ISSET(fields, 7)) {
71670 log_packet_detailed(" got field 'num_road_types'");
71671#ifdef FREECIV_JSON_CONNECTION
71672 field_addr.name = "num_road_types";
71673#endif /* FREECIV_JSON_CONNECTION */
71674 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
71675 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
71676 }
71677 }
71678 if (BV_ISSET(fields, 8)) {
71679 log_packet_detailed(" got field 'num_resource_types'");
71680#ifdef FREECIV_JSON_CONNECTION
71681 field_addr.name = "num_resource_types";
71682#endif /* FREECIV_JSON_CONNECTION */
71683 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
71684 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
71685 }
71686 }
71687 if (BV_ISSET(fields, 9)) {
71688 log_packet_detailed(" got field 'num_goods_types'");
71689#ifdef FREECIV_JSON_CONNECTION
71690 field_addr.name = "num_goods_types";
71691#endif /* FREECIV_JSON_CONNECTION */
71692 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
71693 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
71694 }
71695 }
71696 if (BV_ISSET(fields, 10)) {
71697 log_packet_detailed(" got field 'num_disaster_types'");
71698#ifdef FREECIV_JSON_CONNECTION
71699 field_addr.name = "num_disaster_types";
71700#endif /* FREECIV_JSON_CONNECTION */
71701 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
71702 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
71703 }
71704 }
71705 if (BV_ISSET(fields, 11)) {
71706 log_packet_detailed(" got field 'num_achievement_types'");
71707#ifdef FREECIV_JSON_CONNECTION
71708 field_addr.name = "num_achievement_types";
71709#endif /* FREECIV_JSON_CONNECTION */
71710 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
71711 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
71712 }
71713 }
71714 if (BV_ISSET(fields, 12)) {
71715 log_packet_detailed(" got field 'num_multipliers'");
71716#ifdef FREECIV_JSON_CONNECTION
71717 field_addr.name = "num_multipliers";
71718#endif /* FREECIV_JSON_CONNECTION */
71719 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
71720 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
71721 }
71722 }
71723 if (BV_ISSET(fields, 13)) {
71724 log_packet_detailed(" got field 'num_styles'");
71725#ifdef FREECIV_JSON_CONNECTION
71726 field_addr.name = "num_styles";
71727#endif /* FREECIV_JSON_CONNECTION */
71728 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
71729 RECEIVE_PACKET_FIELD_ERROR(num_styles);
71730 }
71731 }
71732 if (BV_ISSET(fields, 14)) {
71733 log_packet_detailed(" got field 'num_music_styles'");
71734#ifdef FREECIV_JSON_CONNECTION
71735 field_addr.name = "num_music_styles";
71736#endif /* FREECIV_JSON_CONNECTION */
71737 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
71738 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
71739 }
71740 }
71741 if (BV_ISSET(fields, 15)) {
71742 log_packet_detailed(" got field 'government_count'");
71743#ifdef FREECIV_JSON_CONNECTION
71744 field_addr.name = "government_count";
71745#endif /* FREECIV_JSON_CONNECTION */
71746 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
71747 RECEIVE_PACKET_FIELD_ERROR(government_count);
71748 }
71749 }
71750 if (BV_ISSET(fields, 16)) {
71751 log_packet_detailed(" got field 'nation_count'");
71752#ifdef FREECIV_JSON_CONNECTION
71753 field_addr.name = "nation_count";
71754#endif /* FREECIV_JSON_CONNECTION */
71755 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
71756 RECEIVE_PACKET_FIELD_ERROR(nation_count);
71757 }
71758 }
71759 if (BV_ISSET(fields, 17)) {
71760 log_packet_detailed(" got field 'num_city_styles'");
71761#ifdef FREECIV_JSON_CONNECTION
71762 field_addr.name = "num_city_styles";
71763#endif /* FREECIV_JSON_CONNECTION */
71764 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_city_styles)) {
71765 RECEIVE_PACKET_FIELD_ERROR(num_city_styles);
71766 }
71767 }
71768 if (BV_ISSET(fields, 18)) {
71769 log_packet_detailed(" got field 'terrain_count'");
71770#ifdef FREECIV_JSON_CONNECTION
71771 field_addr.name = "terrain_count";
71772#endif /* FREECIV_JSON_CONNECTION */
71773 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
71774 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
71775 }
71776 }
71777 if (BV_ISSET(fields, 19)) {
71778 log_packet_detailed(" got field 'num_specialist_types'");
71779#ifdef FREECIV_JSON_CONNECTION
71780 field_addr.name = "num_specialist_types";
71781#endif /* FREECIV_JSON_CONNECTION */
71782 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
71783 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
71784 }
71785 }
71786 if (BV_ISSET(fields, 20)) {
71787 log_packet_detailed(" got field 'num_nation_groups'");
71788#ifdef FREECIV_JSON_CONNECTION
71789 field_addr.name = "num_nation_groups";
71790#endif /* FREECIV_JSON_CONNECTION */
71791 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
71792 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
71793 }
71794 }
71795 if (BV_ISSET(fields, 21)) {
71796 log_packet_detailed(" got field 'num_nation_sets'");
71797#ifdef FREECIV_JSON_CONNECTION
71798 field_addr.name = "num_nation_sets";
71799#endif /* FREECIV_JSON_CONNECTION */
71800 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
71801 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
71802 }
71803 }
71804 if (BV_ISSET(fields, 22)) {
71805 log_packet_detailed(" got field 'preferred_tileset'");
71806#ifdef FREECIV_JSON_CONNECTION
71807 field_addr.name = "preferred_tileset";
71808#endif /* FREECIV_JSON_CONNECTION */
71809 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
71810 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
71811 }
71812 }
71813 if (BV_ISSET(fields, 23)) {
71814 log_packet_detailed(" got field 'preferred_soundset'");
71815#ifdef FREECIV_JSON_CONNECTION
71816 field_addr.name = "preferred_soundset";
71817#endif /* FREECIV_JSON_CONNECTION */
71818 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
71819 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
71820 }
71821 }
71822 if (BV_ISSET(fields, 24)) {
71823 log_packet_detailed(" got field 'preferred_musicset'");
71824#ifdef FREECIV_JSON_CONNECTION
71825 field_addr.name = "preferred_musicset";
71826#endif /* FREECIV_JSON_CONNECTION */
71827 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
71828 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
71829 }
71830 }
71831 real_packet->popup_tech_help = BV_ISSET(fields, 25);
71832 if (BV_ISSET(fields, 26)) {
71833 log_packet_detailed(" got field 'name'");
71834#ifdef FREECIV_JSON_CONNECTION
71835 field_addr.name = "name";
71836#endif /* FREECIV_JSON_CONNECTION */
71837 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
71838 RECEIVE_PACKET_FIELD_ERROR(name);
71839 }
71840 }
71841 if (BV_ISSET(fields, 27)) {
71842 log_packet_detailed(" got field 'version'");
71843#ifdef FREECIV_JSON_CONNECTION
71844 field_addr.name = "version";
71845#endif /* FREECIV_JSON_CONNECTION */
71846 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
71847 RECEIVE_PACKET_FIELD_ERROR(version);
71848 }
71849 }
71850 if (BV_ISSET(fields, 28)) {
71851 log_packet_detailed(" got field 'alt_dir'");
71852#ifdef FREECIV_JSON_CONNECTION
71853 field_addr.name = "alt_dir";
71854#endif /* FREECIV_JSON_CONNECTION */
71855 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
71856 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
71857 }
71858 }
71859 if (BV_ISSET(fields, 29)) {
71860 log_packet_detailed(" got field 'desc_length'");
71861#ifdef FREECIV_JSON_CONNECTION
71862 field_addr.name = "desc_length";
71863#endif /* FREECIV_JSON_CONNECTION */
71864 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->desc_length)) {
71865 RECEIVE_PACKET_FIELD_ERROR(desc_length);
71866 }
71867 }
71868 if (BV_ISSET(fields, 30)) {
71869 log_packet_detailed(" got field 'num_counters'");
71870#ifdef FREECIV_JSON_CONNECTION
71871 field_addr.name = "num_counters";
71872#endif /* FREECIV_JSON_CONNECTION */
71873 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_counters)) {
71874 RECEIVE_PACKET_FIELD_ERROR(num_counters);
71875 }
71876 }
71877
71878 if (nullptr == old) {
71879 old = fc_malloc(sizeof(*old));
71880 init_packet_ruleset_control(old);
71881 *old = *real_packet;
71882 genhash_insert(*hash, old, old);
71883 } else {
71884 *old = *real_packet;
71885 }
71886
71887#endif /* FREECIV_DELTA_PROTOCOL */
71888 RECEIVE_PACKET_END(real_packet);
71889#undef FREE_PACKET_STRUCT
71890}
71891
71892 static int send_packet_ruleset_control_100(struct connection *pc, const struct packet_ruleset_control *packet)
71893{
71894 const struct packet_ruleset_control *real_packet = packet;
71895 int e;
71896#ifdef FREECIV_DELTA_PROTOCOL
71897 packet_ruleset_control_100_fields fields;
71898 struct packet_ruleset_control *old;
71899 bool differ;
71900 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CONTROL;
71901#endif /* FREECIV_DELTA_PROTOCOL */
71902 SEND_PACKET_START(PACKET_RULESET_CONTROL);
71903#ifdef FREECIV_JSON_CONNECTION
71904 struct plocation field_addr;
71905 {
71906 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
71907 field_addr = *field_addr_tmp;
71908 FC_FREE(field_addr_tmp);
71909 }
71910#endif /* FREECIV_JSON_CONNECTION */
71911
71912 log_packet_detailed("packet_ruleset_control_100: sending info about ()");
71913
71914#ifdef FREECIV_DELTA_PROTOCOL
71915 if (nullptr == *hash) {
71916 *hash = genhash_new_full(hash_packet_ruleset_control_100, cmp_packet_ruleset_control_100,
71917 nullptr, nullptr, nullptr, destroy_packet_ruleset_control);
71918 }
71919 BV_CLR_ALL(fields);
71920
71921 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
71922 old = fc_malloc(sizeof(*old));
71923 /* temporary bitcopy just to insert correctly */
71924 *old = *real_packet;
71925 genhash_insert(*hash, old, old);
71926 init_packet_ruleset_control(old);
71927 }
71928 differ = (old->num_unit_classes != real_packet->num_unit_classes);
71929 if (differ) {
71930 BV_SET(fields, 0);
71931 }
71932
71933 differ = (old->num_unit_types != real_packet->num_unit_types);
71934 if (differ) {
71935 BV_SET(fields, 1);
71936 }
71937
71938 differ = (old->num_impr_types != real_packet->num_impr_types);
71939 if (differ) {
71940 BV_SET(fields, 2);
71941 }
71942
71943 differ = (old->num_tech_classes != real_packet->num_tech_classes);
71944 if (differ) {
71945 BV_SET(fields, 3);
71946 }
71947
71948 differ = (old->num_tech_types != real_packet->num_tech_types);
71949 if (differ) {
71950 BV_SET(fields, 4);
71951 }
71952
71953 differ = (old->num_extra_types != real_packet->num_extra_types);
71954 if (differ) {
71955 BV_SET(fields, 5);
71956 }
71957
71958 differ = (old->num_base_types != real_packet->num_base_types);
71959 if (differ) {
71960 BV_SET(fields, 6);
71961 }
71962
71963 differ = (old->num_road_types != real_packet->num_road_types);
71964 if (differ) {
71965 BV_SET(fields, 7);
71966 }
71967
71968 differ = (old->num_resource_types != real_packet->num_resource_types);
71969 if (differ) {
71970 BV_SET(fields, 8);
71971 }
71972
71973 differ = (old->num_goods_types != real_packet->num_goods_types);
71974 if (differ) {
71975 BV_SET(fields, 9);
71976 }
71977
71978 differ = (old->num_disaster_types != real_packet->num_disaster_types);
71979 if (differ) {
71980 BV_SET(fields, 10);
71981 }
71982
71983 differ = (old->num_achievement_types != real_packet->num_achievement_types);
71984 if (differ) {
71985 BV_SET(fields, 11);
71986 }
71987
71988 differ = (old->num_multipliers != real_packet->num_multipliers);
71989 if (differ) {
71990 BV_SET(fields, 12);
71991 }
71992
71993 differ = (old->num_styles != real_packet->num_styles);
71994 if (differ) {
71995 BV_SET(fields, 13);
71996 }
71997
71998 differ = (old->num_music_styles != real_packet->num_music_styles);
71999 if (differ) {
72000 BV_SET(fields, 14);
72001 }
72002
72003 differ = (old->government_count != real_packet->government_count);
72004 if (differ) {
72005 BV_SET(fields, 15);
72006 }
72007
72008 differ = (old->nation_count != real_packet->nation_count);
72009 if (differ) {
72010 BV_SET(fields, 16);
72011 }
72012
72013 differ = (old->num_city_styles != real_packet->num_city_styles);
72014 if (differ) {
72015 BV_SET(fields, 17);
72016 }
72017
72018 differ = (old->terrain_count != real_packet->terrain_count);
72019 if (differ) {
72020 BV_SET(fields, 18);
72021 }
72022
72023 differ = (old->num_specialist_types != real_packet->num_specialist_types);
72024 if (differ) {
72025 BV_SET(fields, 19);
72026 }
72027
72028 differ = (old->num_nation_groups != real_packet->num_nation_groups);
72029 if (differ) {
72030 BV_SET(fields, 20);
72031 }
72032
72033 differ = (old->num_nation_sets != real_packet->num_nation_sets);
72034 if (differ) {
72035 BV_SET(fields, 21);
72036 }
72037
72038 differ = (strcmp(old->preferred_tileset, real_packet->preferred_tileset) != 0);
72039 if (differ) {
72040 BV_SET(fields, 22);
72041 }
72042
72043 differ = (strcmp(old->preferred_soundset, real_packet->preferred_soundset) != 0);
72044 if (differ) {
72045 BV_SET(fields, 23);
72046 }
72047
72048 differ = (strcmp(old->preferred_musicset, real_packet->preferred_musicset) != 0);
72049 if (differ) {
72050 BV_SET(fields, 24);
72051 }
72052
72053 if (packet->popup_tech_help) {
72054 BV_SET(fields, 25);
72055 }
72056
72057 differ = (strcmp(old->name, real_packet->name) != 0);
72058 if (differ) {
72059 BV_SET(fields, 26);
72060 }
72061
72062 differ = (strcmp(old->version, real_packet->version) != 0);
72063 if (differ) {
72064 BV_SET(fields, 27);
72065 }
72066
72067 differ = (strcmp(old->alt_dir, real_packet->alt_dir) != 0);
72068 if (differ) {
72069 BV_SET(fields, 28);
72070 }
72071
72072 differ = (old->desc_length != real_packet->desc_length);
72073 if (differ) {
72074 BV_SET(fields, 29);
72075 }
72076
72077 differ = (old->num_counters != real_packet->num_counters);
72078 if (differ) {
72079 BV_SET(fields, 30);
72080 }
72081
72082
72083#ifdef FREECIV_JSON_CONNECTION
72084 field_addr.name = "fields";
72085#endif /* FREECIV_JSON_CONNECTION */
72086 e = 0;
72087 e |= DIO_BV_PUT(&dout, &field_addr, fields);
72088 if (e) {
72089 log_packet_detailed("fields bitvector error detected");
72090 }
72091
72092 if (BV_ISSET(fields, 0)) {
72093 log_packet_detailed(" field 'num_unit_classes' has changed");
72094#ifdef FREECIV_JSON_CONNECTION
72095 field_addr.name = "num_unit_classes";
72096#endif /* FREECIV_JSON_CONNECTION */
72097 e = 0;
72098 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
72099 if (e) {
72100 log_packet_detailed("'num_unit_classes' field error detected");
72101 }
72102 }
72103 if (BV_ISSET(fields, 1)) {
72104 log_packet_detailed(" field 'num_unit_types' has changed");
72105#ifdef FREECIV_JSON_CONNECTION
72106 field_addr.name = "num_unit_types";
72107#endif /* FREECIV_JSON_CONNECTION */
72108 e = 0;
72109 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
72110 if (e) {
72111 log_packet_detailed("'num_unit_types' field error detected");
72112 }
72113 }
72114 if (BV_ISSET(fields, 2)) {
72115 log_packet_detailed(" field 'num_impr_types' has changed");
72116#ifdef FREECIV_JSON_CONNECTION
72117 field_addr.name = "num_impr_types";
72118#endif /* FREECIV_JSON_CONNECTION */
72119 e = 0;
72120 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
72121 if (e) {
72122 log_packet_detailed("'num_impr_types' field error detected");
72123 }
72124 }
72125 if (BV_ISSET(fields, 3)) {
72126 log_packet_detailed(" field 'num_tech_classes' has changed");
72127#ifdef FREECIV_JSON_CONNECTION
72128 field_addr.name = "num_tech_classes";
72129#endif /* FREECIV_JSON_CONNECTION */
72130 e = 0;
72131 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
72132 if (e) {
72133 log_packet_detailed("'num_tech_classes' field error detected");
72134 }
72135 }
72136 if (BV_ISSET(fields, 4)) {
72137 log_packet_detailed(" field 'num_tech_types' has changed");
72138#ifdef FREECIV_JSON_CONNECTION
72139 field_addr.name = "num_tech_types";
72140#endif /* FREECIV_JSON_CONNECTION */
72141 e = 0;
72142 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
72143 if (e) {
72144 log_packet_detailed("'num_tech_types' field error detected");
72145 }
72146 }
72147 if (BV_ISSET(fields, 5)) {
72148 log_packet_detailed(" field 'num_extra_types' has changed");
72149#ifdef FREECIV_JSON_CONNECTION
72150 field_addr.name = "num_extra_types";
72151#endif /* FREECIV_JSON_CONNECTION */
72152 e = 0;
72153 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
72154 if (e) {
72155 log_packet_detailed("'num_extra_types' field error detected");
72156 }
72157 }
72158 if (BV_ISSET(fields, 6)) {
72159 log_packet_detailed(" field 'num_base_types' has changed");
72160#ifdef FREECIV_JSON_CONNECTION
72161 field_addr.name = "num_base_types";
72162#endif /* FREECIV_JSON_CONNECTION */
72163 e = 0;
72164 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
72165 if (e) {
72166 log_packet_detailed("'num_base_types' field error detected");
72167 }
72168 }
72169 if (BV_ISSET(fields, 7)) {
72170 log_packet_detailed(" field 'num_road_types' has changed");
72171#ifdef FREECIV_JSON_CONNECTION
72172 field_addr.name = "num_road_types";
72173#endif /* FREECIV_JSON_CONNECTION */
72174 e = 0;
72175 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
72176 if (e) {
72177 log_packet_detailed("'num_road_types' field error detected");
72178 }
72179 }
72180 if (BV_ISSET(fields, 8)) {
72181 log_packet_detailed(" field 'num_resource_types' has changed");
72182#ifdef FREECIV_JSON_CONNECTION
72183 field_addr.name = "num_resource_types";
72184#endif /* FREECIV_JSON_CONNECTION */
72185 e = 0;
72186 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
72187 if (e) {
72188 log_packet_detailed("'num_resource_types' field error detected");
72189 }
72190 }
72191 if (BV_ISSET(fields, 9)) {
72192 log_packet_detailed(" field 'num_goods_types' has changed");
72193#ifdef FREECIV_JSON_CONNECTION
72194 field_addr.name = "num_goods_types";
72195#endif /* FREECIV_JSON_CONNECTION */
72196 e = 0;
72197 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
72198 if (e) {
72199 log_packet_detailed("'num_goods_types' field error detected");
72200 }
72201 }
72202 if (BV_ISSET(fields, 10)) {
72203 log_packet_detailed(" field 'num_disaster_types' has changed");
72204#ifdef FREECIV_JSON_CONNECTION
72205 field_addr.name = "num_disaster_types";
72206#endif /* FREECIV_JSON_CONNECTION */
72207 e = 0;
72208 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
72209 if (e) {
72210 log_packet_detailed("'num_disaster_types' field error detected");
72211 }
72212 }
72213 if (BV_ISSET(fields, 11)) {
72214 log_packet_detailed(" field 'num_achievement_types' has changed");
72215#ifdef FREECIV_JSON_CONNECTION
72216 field_addr.name = "num_achievement_types";
72217#endif /* FREECIV_JSON_CONNECTION */
72218 e = 0;
72219 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
72220 if (e) {
72221 log_packet_detailed("'num_achievement_types' field error detected");
72222 }
72223 }
72224 if (BV_ISSET(fields, 12)) {
72225 log_packet_detailed(" field 'num_multipliers' has changed");
72226#ifdef FREECIV_JSON_CONNECTION
72227 field_addr.name = "num_multipliers";
72228#endif /* FREECIV_JSON_CONNECTION */
72229 e = 0;
72230 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
72231 if (e) {
72232 log_packet_detailed("'num_multipliers' field error detected");
72233 }
72234 }
72235 if (BV_ISSET(fields, 13)) {
72236 log_packet_detailed(" field 'num_styles' has changed");
72237#ifdef FREECIV_JSON_CONNECTION
72238 field_addr.name = "num_styles";
72239#endif /* FREECIV_JSON_CONNECTION */
72240 e = 0;
72241 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
72242 if (e) {
72243 log_packet_detailed("'num_styles' field error detected");
72244 }
72245 }
72246 if (BV_ISSET(fields, 14)) {
72247 log_packet_detailed(" field 'num_music_styles' has changed");
72248#ifdef FREECIV_JSON_CONNECTION
72249 field_addr.name = "num_music_styles";
72250#endif /* FREECIV_JSON_CONNECTION */
72251 e = 0;
72252 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
72253 if (e) {
72254 log_packet_detailed("'num_music_styles' field error detected");
72255 }
72256 }
72257 if (BV_ISSET(fields, 15)) {
72258 log_packet_detailed(" field 'government_count' has changed");
72259#ifdef FREECIV_JSON_CONNECTION
72260 field_addr.name = "government_count";
72261#endif /* FREECIV_JSON_CONNECTION */
72262 e = 0;
72263 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
72264 if (e) {
72265 log_packet_detailed("'government_count' field error detected");
72266 }
72267 }
72268 if (BV_ISSET(fields, 16)) {
72269 log_packet_detailed(" field 'nation_count' has changed");
72270#ifdef FREECIV_JSON_CONNECTION
72271 field_addr.name = "nation_count";
72272#endif /* FREECIV_JSON_CONNECTION */
72273 e = 0;
72274 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
72275 if (e) {
72276 log_packet_detailed("'nation_count' field error detected");
72277 }
72278 }
72279 if (BV_ISSET(fields, 17)) {
72280 log_packet_detailed(" field 'num_city_styles' has changed");
72281#ifdef FREECIV_JSON_CONNECTION
72282 field_addr.name = "num_city_styles";
72283#endif /* FREECIV_JSON_CONNECTION */
72284 e = 0;
72285 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_city_styles);
72286 if (e) {
72287 log_packet_detailed("'num_city_styles' field error detected");
72288 }
72289 }
72290 if (BV_ISSET(fields, 18)) {
72291 log_packet_detailed(" field 'terrain_count' has changed");
72292#ifdef FREECIV_JSON_CONNECTION
72293 field_addr.name = "terrain_count";
72294#endif /* FREECIV_JSON_CONNECTION */
72295 e = 0;
72296 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
72297 if (e) {
72298 log_packet_detailed("'terrain_count' field error detected");
72299 }
72300 }
72301 if (BV_ISSET(fields, 19)) {
72302 log_packet_detailed(" field 'num_specialist_types' has changed");
72303#ifdef FREECIV_JSON_CONNECTION
72304 field_addr.name = "num_specialist_types";
72305#endif /* FREECIV_JSON_CONNECTION */
72306 e = 0;
72307 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
72308 if (e) {
72309 log_packet_detailed("'num_specialist_types' field error detected");
72310 }
72311 }
72312 if (BV_ISSET(fields, 20)) {
72313 log_packet_detailed(" field 'num_nation_groups' has changed");
72314#ifdef FREECIV_JSON_CONNECTION
72315 field_addr.name = "num_nation_groups";
72316#endif /* FREECIV_JSON_CONNECTION */
72317 e = 0;
72318 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
72319 if (e) {
72320 log_packet_detailed("'num_nation_groups' field error detected");
72321 }
72322 }
72323 if (BV_ISSET(fields, 21)) {
72324 log_packet_detailed(" field 'num_nation_sets' has changed");
72325#ifdef FREECIV_JSON_CONNECTION
72326 field_addr.name = "num_nation_sets";
72327#endif /* FREECIV_JSON_CONNECTION */
72328 e = 0;
72329 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
72330 if (e) {
72331 log_packet_detailed("'num_nation_sets' field error detected");
72332 }
72333 }
72334 if (BV_ISSET(fields, 22)) {
72335 log_packet_detailed(" field 'preferred_tileset' has changed");
72336#ifdef FREECIV_JSON_CONNECTION
72337 field_addr.name = "preferred_tileset";
72338#endif /* FREECIV_JSON_CONNECTION */
72339 e = 0;
72340 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
72341 if (e) {
72342 log_packet_detailed("'preferred_tileset' field error detected");
72343 }
72344 }
72345 if (BV_ISSET(fields, 23)) {
72346 log_packet_detailed(" field 'preferred_soundset' has changed");
72347#ifdef FREECIV_JSON_CONNECTION
72348 field_addr.name = "preferred_soundset";
72349#endif /* FREECIV_JSON_CONNECTION */
72350 e = 0;
72351 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
72352 if (e) {
72353 log_packet_detailed("'preferred_soundset' field error detected");
72354 }
72355 }
72356 if (BV_ISSET(fields, 24)) {
72357 log_packet_detailed(" field 'preferred_musicset' has changed");
72358#ifdef FREECIV_JSON_CONNECTION
72359 field_addr.name = "preferred_musicset";
72360#endif /* FREECIV_JSON_CONNECTION */
72361 e = 0;
72362 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
72363 if (e) {
72364 log_packet_detailed("'preferred_musicset' field error detected");
72365 }
72366 }
72367 /* field 25 is folded into the header */
72368 if (BV_ISSET(fields, 26)) {
72369 log_packet_detailed(" field 'name' has changed");
72370#ifdef FREECIV_JSON_CONNECTION
72371 field_addr.name = "name";
72372#endif /* FREECIV_JSON_CONNECTION */
72373 e = 0;
72374 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
72375 if (e) {
72376 log_packet_detailed("'name' field error detected");
72377 }
72378 }
72379 if (BV_ISSET(fields, 27)) {
72380 log_packet_detailed(" field 'version' has changed");
72381#ifdef FREECIV_JSON_CONNECTION
72382 field_addr.name = "version";
72383#endif /* FREECIV_JSON_CONNECTION */
72384 e = 0;
72385 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version);
72386 if (e) {
72387 log_packet_detailed("'version' field error detected");
72388 }
72389 }
72390 if (BV_ISSET(fields, 28)) {
72391 log_packet_detailed(" field 'alt_dir' has changed");
72392#ifdef FREECIV_JSON_CONNECTION
72393 field_addr.name = "alt_dir";
72394#endif /* FREECIV_JSON_CONNECTION */
72395 e = 0;
72396 e |= DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
72397 if (e) {
72398 log_packet_detailed("'alt_dir' field error detected");
72399 }
72400 }
72401 if (BV_ISSET(fields, 29)) {
72402 log_packet_detailed(" field 'desc_length' has changed");
72403#ifdef FREECIV_JSON_CONNECTION
72404 field_addr.name = "desc_length";
72405#endif /* FREECIV_JSON_CONNECTION */
72406 e = 0;
72407 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->desc_length);
72408 if (e) {
72409 log_packet_detailed("'desc_length' field error detected");
72410 }
72411 }
72412 if (BV_ISSET(fields, 30)) {
72413 log_packet_detailed(" field 'num_counters' has changed");
72414#ifdef FREECIV_JSON_CONNECTION
72415 field_addr.name = "num_counters";
72416#endif /* FREECIV_JSON_CONNECTION */
72417 e = 0;
72418 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_counters);
72419 if (e) {
72420 log_packet_detailed("'num_counters' field error detected");
72421 }
72422 }
72423
72424 *old = *real_packet;
72425#endif /* FREECIV_DELTA_PROTOCOL */
72426#ifndef FREECIV_DELTA_PROTOCOL
72427#ifdef FREECIV_JSON_CONNECTION
72428 field_addr.name = "num_unit_classes";
72429#endif /* FREECIV_JSON_CONNECTION */
72430 e = 0;
72431 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
72432 if (e) {
72433 log_packet_detailed("'num_unit_classes' field error detected");
72434 }
72435#ifdef FREECIV_JSON_CONNECTION
72436 field_addr.name = "num_unit_types";
72437#endif /* FREECIV_JSON_CONNECTION */
72438 e = 0;
72439 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
72440 if (e) {
72441 log_packet_detailed("'num_unit_types' field error detected");
72442 }
72443#ifdef FREECIV_JSON_CONNECTION
72444 field_addr.name = "num_impr_types";
72445#endif /* FREECIV_JSON_CONNECTION */
72446 e = 0;
72447 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
72448 if (e) {
72449 log_packet_detailed("'num_impr_types' field error detected");
72450 }
72451#ifdef FREECIV_JSON_CONNECTION
72452 field_addr.name = "num_tech_classes";
72453#endif /* FREECIV_JSON_CONNECTION */
72454 e = 0;
72455 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
72456 if (e) {
72457 log_packet_detailed("'num_tech_classes' field error detected");
72458 }
72459#ifdef FREECIV_JSON_CONNECTION
72460 field_addr.name = "num_tech_types";
72461#endif /* FREECIV_JSON_CONNECTION */
72462 e = 0;
72463 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
72464 if (e) {
72465 log_packet_detailed("'num_tech_types' field error detected");
72466 }
72467#ifdef FREECIV_JSON_CONNECTION
72468 field_addr.name = "num_extra_types";
72469#endif /* FREECIV_JSON_CONNECTION */
72470 e = 0;
72471 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
72472 if (e) {
72473 log_packet_detailed("'num_extra_types' field error detected");
72474 }
72475#ifdef FREECIV_JSON_CONNECTION
72476 field_addr.name = "num_base_types";
72477#endif /* FREECIV_JSON_CONNECTION */
72478 e = 0;
72479 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
72480 if (e) {
72481 log_packet_detailed("'num_base_types' field error detected");
72482 }
72483#ifdef FREECIV_JSON_CONNECTION
72484 field_addr.name = "num_road_types";
72485#endif /* FREECIV_JSON_CONNECTION */
72486 e = 0;
72487 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
72488 if (e) {
72489 log_packet_detailed("'num_road_types' field error detected");
72490 }
72491#ifdef FREECIV_JSON_CONNECTION
72492 field_addr.name = "num_resource_types";
72493#endif /* FREECIV_JSON_CONNECTION */
72494 e = 0;
72495 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
72496 if (e) {
72497 log_packet_detailed("'num_resource_types' field error detected");
72498 }
72499#ifdef FREECIV_JSON_CONNECTION
72500 field_addr.name = "num_goods_types";
72501#endif /* FREECIV_JSON_CONNECTION */
72502 e = 0;
72503 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
72504 if (e) {
72505 log_packet_detailed("'num_goods_types' field error detected");
72506 }
72507#ifdef FREECIV_JSON_CONNECTION
72508 field_addr.name = "num_disaster_types";
72509#endif /* FREECIV_JSON_CONNECTION */
72510 e = 0;
72511 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
72512 if (e) {
72513 log_packet_detailed("'num_disaster_types' field error detected");
72514 }
72515#ifdef FREECIV_JSON_CONNECTION
72516 field_addr.name = "num_achievement_types";
72517#endif /* FREECIV_JSON_CONNECTION */
72518 e = 0;
72519 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
72520 if (e) {
72521 log_packet_detailed("'num_achievement_types' field error detected");
72522 }
72523#ifdef FREECIV_JSON_CONNECTION
72524 field_addr.name = "num_multipliers";
72525#endif /* FREECIV_JSON_CONNECTION */
72526 e = 0;
72527 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
72528 if (e) {
72529 log_packet_detailed("'num_multipliers' field error detected");
72530 }
72531#ifdef FREECIV_JSON_CONNECTION
72532 field_addr.name = "num_styles";
72533#endif /* FREECIV_JSON_CONNECTION */
72534 e = 0;
72535 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
72536 if (e) {
72537 log_packet_detailed("'num_styles' field error detected");
72538 }
72539#ifdef FREECIV_JSON_CONNECTION
72540 field_addr.name = "num_music_styles";
72541#endif /* FREECIV_JSON_CONNECTION */
72542 e = 0;
72543 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
72544 if (e) {
72545 log_packet_detailed("'num_music_styles' field error detected");
72546 }
72547#ifdef FREECIV_JSON_CONNECTION
72548 field_addr.name = "government_count";
72549#endif /* FREECIV_JSON_CONNECTION */
72550 e = 0;
72551 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
72552 if (e) {
72553 log_packet_detailed("'government_count' field error detected");
72554 }
72555#ifdef FREECIV_JSON_CONNECTION
72556 field_addr.name = "nation_count";
72557#endif /* FREECIV_JSON_CONNECTION */
72558 e = 0;
72559 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
72560 if (e) {
72561 log_packet_detailed("'nation_count' field error detected");
72562 }
72563#ifdef FREECIV_JSON_CONNECTION
72564 field_addr.name = "num_city_styles";
72565#endif /* FREECIV_JSON_CONNECTION */
72566 e = 0;
72567 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_city_styles);
72568 if (e) {
72569 log_packet_detailed("'num_city_styles' field error detected");
72570 }
72571#ifdef FREECIV_JSON_CONNECTION
72572 field_addr.name = "terrain_count";
72573#endif /* FREECIV_JSON_CONNECTION */
72574 e = 0;
72575 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
72576 if (e) {
72577 log_packet_detailed("'terrain_count' field error detected");
72578 }
72579#ifdef FREECIV_JSON_CONNECTION
72580 field_addr.name = "num_specialist_types";
72581#endif /* FREECIV_JSON_CONNECTION */
72582 e = 0;
72583 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
72584 if (e) {
72585 log_packet_detailed("'num_specialist_types' field error detected");
72586 }
72587#ifdef FREECIV_JSON_CONNECTION
72588 field_addr.name = "num_nation_groups";
72589#endif /* FREECIV_JSON_CONNECTION */
72590 e = 0;
72591 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
72592 if (e) {
72593 log_packet_detailed("'num_nation_groups' field error detected");
72594 }
72595#ifdef FREECIV_JSON_CONNECTION
72596 field_addr.name = "num_nation_sets";
72597#endif /* FREECIV_JSON_CONNECTION */
72598 e = 0;
72599 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
72600 if (e) {
72601 log_packet_detailed("'num_nation_sets' field error detected");
72602 }
72603#ifdef FREECIV_JSON_CONNECTION
72604 field_addr.name = "preferred_tileset";
72605#endif /* FREECIV_JSON_CONNECTION */
72606 e = 0;
72607 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
72608 if (e) {
72609 log_packet_detailed("'preferred_tileset' field error detected");
72610 }
72611#ifdef FREECIV_JSON_CONNECTION
72612 field_addr.name = "preferred_soundset";
72613#endif /* FREECIV_JSON_CONNECTION */
72614 e = 0;
72615 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
72616 if (e) {
72617 log_packet_detailed("'preferred_soundset' field error detected");
72618 }
72619#ifdef FREECIV_JSON_CONNECTION
72620 field_addr.name = "preferred_musicset";
72621#endif /* FREECIV_JSON_CONNECTION */
72622 e = 0;
72623 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
72624 if (e) {
72625 log_packet_detailed("'preferred_musicset' field error detected");
72626 }
72627#ifdef FREECIV_JSON_CONNECTION
72628 field_addr.name = "popup_tech_help";
72629#endif /* FREECIV_JSON_CONNECTION */
72630 e = 0;
72631 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->popup_tech_help);
72632 if (e) {
72633 log_packet_detailed("'popup_tech_help' field error detected");
72634 }
72635#ifdef FREECIV_JSON_CONNECTION
72636 field_addr.name = "name";
72637#endif /* FREECIV_JSON_CONNECTION */
72638 e = 0;
72639 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
72640 if (e) {
72641 log_packet_detailed("'name' field error detected");
72642 }
72643#ifdef FREECIV_JSON_CONNECTION
72644 field_addr.name = "version";
72645#endif /* FREECIV_JSON_CONNECTION */
72646 e = 0;
72647 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version);
72648 if (e) {
72649 log_packet_detailed("'version' field error detected");
72650 }
72651#ifdef FREECIV_JSON_CONNECTION
72652 field_addr.name = "alt_dir";
72653#endif /* FREECIV_JSON_CONNECTION */
72654 e = 0;
72655 e |= DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
72656 if (e) {
72657 log_packet_detailed("'alt_dir' field error detected");
72658 }
72659#ifdef FREECIV_JSON_CONNECTION
72660 field_addr.name = "desc_length";
72661#endif /* FREECIV_JSON_CONNECTION */
72662 e = 0;
72663 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->desc_length);
72664 if (e) {
72665 log_packet_detailed("'desc_length' field error detected");
72666 }
72667#ifdef FREECIV_JSON_CONNECTION
72668 field_addr.name = "num_counters";
72669#endif /* FREECIV_JSON_CONNECTION */
72670 e = 0;
72671 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_counters);
72672 if (e) {
72673 log_packet_detailed("'num_counters' field error detected");
72674 }
72675
72676#endif
72677 SEND_PACKET_END(PACKET_RULESET_CONTROL);
72678}
72679
72680 int send_packet_ruleset_control(struct connection *pc, const struct packet_ruleset_control *packet)
72681{
72682 if (!pc->used) {
72683 log_error("WARNING: trying to send data to the closed connection %s",
72684 conn_description(pc));
72685 return -1;
72686 }
72687 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CONTROL].packet != nullptr, -1,
72688 "Handler for PACKET_RULESET_CONTROL not installed");
72689 return pc->phs.handlers->send[PACKET_RULESET_CONTROL].packet(pc, packet);
72690}
72691
72692 void lsend_packet_ruleset_control(struct conn_list *dest, const struct packet_ruleset_control *packet)
72693{
72694 conn_list_iterate(dest, pconn) {
72695 send_packet_ruleset_control(pconn, packet);
72696 } conn_list_iterate_end;
72697}
72698
72699 static inline void init_packet_ruleset_summary(struct packet_ruleset_summary *packet)
72700{
72701 memset(packet, 0, sizeof(*packet));
72702}
72703
72704#define free_packet_ruleset_summary(_packet) (void) 0
72705#define destroy_packet_ruleset_summary free
72706
72707#ifdef FREECIV_DELTA_PROTOCOL
72708#define hash_packet_ruleset_summary_100 hash_const
72709
72710#define cmp_packet_ruleset_summary_100 cmp_const
72711
72712 BV_DEFINE(packet_ruleset_summary_100_fields, 1);
72713#endif /* FREECIV_DELTA_PROTOCOL */
72714
72715 static struct packet_ruleset_summary *receive_packet_ruleset_summary_100(struct connection *pc)
72716{
72717#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_summary(_packet)
72718#ifdef FREECIV_DELTA_PROTOCOL
72719 packet_ruleset_summary_100_fields fields;
72720 struct packet_ruleset_summary *old;
72721 struct genhash **hash = pc->phs.received + PACKET_RULESET_SUMMARY;
72722#endif /* FREECIV_DELTA_PROTOCOL */
72723 RECEIVE_PACKET_START(packet_ruleset_summary, real_packet);
72724#ifdef FREECIV_JSON_CONNECTION
72725 struct plocation field_addr;
72726 {
72727 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
72728 field_addr = *field_addr_tmp;
72729 FC_FREE(field_addr_tmp);
72730 }
72731#endif /* FREECIV_JSON_CONNECTION */
72732
72733#ifdef FREECIV_DELTA_PROTOCOL
72734#ifdef FREECIV_JSON_CONNECTION
72735 field_addr.name = "fields";
72736#endif /* FREECIV_JSON_CONNECTION */
72737 DIO_BV_GET(&din, &field_addr, fields);
72738
72739#else /* FREECIV_DELTA_PROTOCOL */
72740#ifdef FREECIV_JSON_CONNECTION
72741 field_addr.name = "text";
72742#endif /* FREECIV_JSON_CONNECTION */
72743 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
72744 RECEIVE_PACKET_FIELD_ERROR(text);
72745 }
72746#endif
72747 log_packet_detailed("packet_ruleset_summary_100: got info about ()");
72748
72749#ifdef FREECIV_DELTA_PROTOCOL
72750 if (nullptr == *hash) {
72751 *hash = genhash_new_full(hash_packet_ruleset_summary_100, cmp_packet_ruleset_summary_100,
72752 nullptr, nullptr, nullptr, destroy_packet_ruleset_summary);
72753 }
72754
72755 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72756 *real_packet = *old;
72757 } else {
72758 /* packet is already initialized empty */
72759 log_packet_detailed(" no old info");
72760 }
72761
72762 if (BV_ISSET(fields, 0)) {
72763 log_packet_detailed(" got field 'text'");
72764#ifdef FREECIV_JSON_CONNECTION
72765 field_addr.name = "text";
72766#endif /* FREECIV_JSON_CONNECTION */
72767 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
72768 RECEIVE_PACKET_FIELD_ERROR(text);
72769 }
72770 }
72771
72772 if (nullptr == old) {
72773 old = fc_malloc(sizeof(*old));
72774 init_packet_ruleset_summary(old);
72775 *old = *real_packet;
72776 genhash_insert(*hash, old, old);
72777 } else {
72778 *old = *real_packet;
72779 }
72780
72781#endif /* FREECIV_DELTA_PROTOCOL */
72782 RECEIVE_PACKET_END(real_packet);
72783#undef FREE_PACKET_STRUCT
72784}
72785
72786 static int send_packet_ruleset_summary_100(struct connection *pc, const struct packet_ruleset_summary *packet)
72787{
72788 const struct packet_ruleset_summary *real_packet = packet;
72789 int e;
72790#ifdef FREECIV_DELTA_PROTOCOL
72791 packet_ruleset_summary_100_fields fields;
72792 struct packet_ruleset_summary *old;
72793 bool differ;
72794 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SUMMARY;
72795#endif /* FREECIV_DELTA_PROTOCOL */
72796 SEND_PACKET_START(PACKET_RULESET_SUMMARY);
72797#ifdef FREECIV_JSON_CONNECTION
72798 struct plocation field_addr;
72799 {
72800 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
72801 field_addr = *field_addr_tmp;
72802 FC_FREE(field_addr_tmp);
72803 }
72804#endif /* FREECIV_JSON_CONNECTION */
72805
72806 log_packet_detailed("packet_ruleset_summary_100: sending info about ()");
72807
72808#ifdef FREECIV_DELTA_PROTOCOL
72809 if (nullptr == *hash) {
72810 *hash = genhash_new_full(hash_packet_ruleset_summary_100, cmp_packet_ruleset_summary_100,
72811 nullptr, nullptr, nullptr, destroy_packet_ruleset_summary);
72812 }
72813 BV_CLR_ALL(fields);
72814
72815 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
72816 old = fc_malloc(sizeof(*old));
72817 /* temporary bitcopy just to insert correctly */
72818 *old = *real_packet;
72819 genhash_insert(*hash, old, old);
72820 init_packet_ruleset_summary(old);
72821 }
72822 differ = (strcmp(old->text, real_packet->text) != 0);
72823 if (differ) {
72824 BV_SET(fields, 0);
72825 }
72826
72827
72828#ifdef FREECIV_JSON_CONNECTION
72829 field_addr.name = "fields";
72830#endif /* FREECIV_JSON_CONNECTION */
72831 e = 0;
72832 e |= DIO_BV_PUT(&dout, &field_addr, fields);
72833 if (e) {
72834 log_packet_detailed("fields bitvector error detected");
72835 }
72836
72837 if (BV_ISSET(fields, 0)) {
72838 log_packet_detailed(" field 'text' has changed");
72839#ifdef FREECIV_JSON_CONNECTION
72840 field_addr.name = "text";
72841#endif /* FREECIV_JSON_CONNECTION */
72842 e = 0;
72843 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
72844 if (e) {
72845 log_packet_detailed("'text' field error detected");
72846 }
72847 }
72848
72849 *old = *real_packet;
72850#endif /* FREECIV_DELTA_PROTOCOL */
72851#ifndef FREECIV_DELTA_PROTOCOL
72852#ifdef FREECIV_JSON_CONNECTION
72853 field_addr.name = "text";
72854#endif /* FREECIV_JSON_CONNECTION */
72855 e = 0;
72856 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
72857 if (e) {
72858 log_packet_detailed("'text' field error detected");
72859 }
72860
72861#endif
72862 SEND_PACKET_END(PACKET_RULESET_SUMMARY);
72863}
72864
72865 int send_packet_ruleset_summary(struct connection *pc, const struct packet_ruleset_summary *packet)
72866{
72867 if (!pc->used) {
72868 log_error("WARNING: trying to send data to the closed connection %s",
72869 conn_description(pc));
72870 return -1;
72871 }
72872 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SUMMARY].packet != nullptr, -1,
72873 "Handler for PACKET_RULESET_SUMMARY not installed");
72874 return pc->phs.handlers->send[PACKET_RULESET_SUMMARY].packet(pc, packet);
72875}
72876
72877 void lsend_packet_ruleset_summary(struct conn_list *dest, const struct packet_ruleset_summary *packet)
72878{
72879 conn_list_iterate(dest, pconn) {
72880 send_packet_ruleset_summary(pconn, packet);
72881 } conn_list_iterate_end;
72882}
72883
72884 static inline void init_packet_ruleset_description_part(struct packet_ruleset_description_part *packet)
72885{
72886 memset(packet, 0, sizeof(*packet));
72887}
72888
72889#define free_packet_ruleset_description_part(_packet) (void) 0
72890#define destroy_packet_ruleset_description_part free
72891
72892#ifdef FREECIV_DELTA_PROTOCOL
72893#define hash_packet_ruleset_description_part_100 hash_const
72894
72895#define cmp_packet_ruleset_description_part_100 cmp_const
72896
72897 BV_DEFINE(packet_ruleset_description_part_100_fields, 1);
72898#endif /* FREECIV_DELTA_PROTOCOL */
72899
72900 static struct packet_ruleset_description_part *receive_packet_ruleset_description_part_100(struct connection *pc)
72901{
72902#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_description_part(_packet)
72903#ifdef FREECIV_DELTA_PROTOCOL
72904 packet_ruleset_description_part_100_fields fields;
72905 struct packet_ruleset_description_part *old;
72906 struct genhash **hash = pc->phs.received + PACKET_RULESET_DESCRIPTION_PART;
72907#endif /* FREECIV_DELTA_PROTOCOL */
72908 RECEIVE_PACKET_START(packet_ruleset_description_part, real_packet);
72909#ifdef FREECIV_JSON_CONNECTION
72910 struct plocation field_addr;
72911 {
72912 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
72913 field_addr = *field_addr_tmp;
72914 FC_FREE(field_addr_tmp);
72915 }
72916#endif /* FREECIV_JSON_CONNECTION */
72917
72918#ifdef FREECIV_DELTA_PROTOCOL
72919#ifdef FREECIV_JSON_CONNECTION
72920 field_addr.name = "fields";
72921#endif /* FREECIV_JSON_CONNECTION */
72922 DIO_BV_GET(&din, &field_addr, fields);
72923
72924#else /* FREECIV_DELTA_PROTOCOL */
72925#ifdef FREECIV_JSON_CONNECTION
72926 field_addr.name = "text";
72927#endif /* FREECIV_JSON_CONNECTION */
72928 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
72929 RECEIVE_PACKET_FIELD_ERROR(text);
72930 }
72931#endif
72932 log_packet_detailed("packet_ruleset_description_part_100: got info about ()");
72933
72934#ifdef FREECIV_DELTA_PROTOCOL
72935 if (nullptr == *hash) {
72936 *hash = genhash_new_full(hash_packet_ruleset_description_part_100, cmp_packet_ruleset_description_part_100,
72937 nullptr, nullptr, nullptr, destroy_packet_ruleset_description_part);
72938 }
72939
72940 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72941 *real_packet = *old;
72942 } else {
72943 /* packet is already initialized empty */
72944 log_packet_detailed(" no old info");
72945 }
72946
72947 if (BV_ISSET(fields, 0)) {
72948 log_packet_detailed(" got field 'text'");
72949#ifdef FREECIV_JSON_CONNECTION
72950 field_addr.name = "text";
72951#endif /* FREECIV_JSON_CONNECTION */
72952 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
72953 RECEIVE_PACKET_FIELD_ERROR(text);
72954 }
72955 }
72956
72957 if (nullptr == old) {
72958 old = fc_malloc(sizeof(*old));
72959 init_packet_ruleset_description_part(old);
72960 *old = *real_packet;
72961 genhash_insert(*hash, old, old);
72962 } else {
72963 *old = *real_packet;
72964 }
72965
72966#endif /* FREECIV_DELTA_PROTOCOL */
72967 RECEIVE_PACKET_END(real_packet);
72968#undef FREE_PACKET_STRUCT
72969}
72970
72971 static int send_packet_ruleset_description_part_100(struct connection *pc, const struct packet_ruleset_description_part *packet)
72972{
72973 const struct packet_ruleset_description_part *real_packet = packet;
72974 int e;
72975#ifdef FREECIV_DELTA_PROTOCOL
72976 packet_ruleset_description_part_100_fields fields;
72977 struct packet_ruleset_description_part *old;
72978 bool differ;
72979 struct genhash **hash = pc->phs.sent + PACKET_RULESET_DESCRIPTION_PART;
72980#endif /* FREECIV_DELTA_PROTOCOL */
72981 SEND_PACKET_START(PACKET_RULESET_DESCRIPTION_PART);
72982#ifdef FREECIV_JSON_CONNECTION
72983 struct plocation field_addr;
72984 {
72985 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
72986 field_addr = *field_addr_tmp;
72987 FC_FREE(field_addr_tmp);
72988 }
72989#endif /* FREECIV_JSON_CONNECTION */
72990
72991 log_packet_detailed("packet_ruleset_description_part_100: sending info about ()");
72992
72993#ifdef FREECIV_DELTA_PROTOCOL
72994 if (nullptr == *hash) {
72995 *hash = genhash_new_full(hash_packet_ruleset_description_part_100, cmp_packet_ruleset_description_part_100,
72996 nullptr, nullptr, nullptr, destroy_packet_ruleset_description_part);
72997 }
72998 BV_CLR_ALL(fields);
72999
73000 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73001 old = fc_malloc(sizeof(*old));
73002 /* temporary bitcopy just to insert correctly */
73003 *old = *real_packet;
73004 genhash_insert(*hash, old, old);
73005 init_packet_ruleset_description_part(old);
73006 }
73007 differ = (strcmp(old->text, real_packet->text) != 0);
73008 if (differ) {
73009 BV_SET(fields, 0);
73010 }
73011
73012
73013#ifdef FREECIV_JSON_CONNECTION
73014 field_addr.name = "fields";
73015#endif /* FREECIV_JSON_CONNECTION */
73016 e = 0;
73017 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73018 if (e) {
73019 log_packet_detailed("fields bitvector error detected");
73020 }
73021
73022 if (BV_ISSET(fields, 0)) {
73023 log_packet_detailed(" field 'text' has changed");
73024#ifdef FREECIV_JSON_CONNECTION
73025 field_addr.name = "text";
73026#endif /* FREECIV_JSON_CONNECTION */
73027 e = 0;
73028 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
73029 if (e) {
73030 log_packet_detailed("'text' field error detected");
73031 }
73032 }
73033
73034 *old = *real_packet;
73035#endif /* FREECIV_DELTA_PROTOCOL */
73036#ifndef FREECIV_DELTA_PROTOCOL
73037#ifdef FREECIV_JSON_CONNECTION
73038 field_addr.name = "text";
73039#endif /* FREECIV_JSON_CONNECTION */
73040 e = 0;
73041 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
73042 if (e) {
73043 log_packet_detailed("'text' field error detected");
73044 }
73045
73046#endif
73047 SEND_PACKET_END(PACKET_RULESET_DESCRIPTION_PART);
73048}
73049
73050 int send_packet_ruleset_description_part(struct connection *pc, const struct packet_ruleset_description_part *packet)
73051{
73052 if (!pc->used) {
73053 log_error("WARNING: trying to send data to the closed connection %s",
73054 conn_description(pc));
73055 return -1;
73056 }
73057 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_DESCRIPTION_PART].packet != nullptr, -1,
73058 "Handler for PACKET_RULESET_DESCRIPTION_PART not installed");
73059 return pc->phs.handlers->send[PACKET_RULESET_DESCRIPTION_PART].packet(pc, packet);
73060}
73061
73062 void lsend_packet_ruleset_description_part(struct conn_list *dest, const struct packet_ruleset_description_part *packet)
73063{
73064 conn_list_iterate(dest, pconn) {
73065 send_packet_ruleset_description_part(pconn, packet);
73066 } conn_list_iterate_end;
73067}
73068
73069 static inline void init_packet_single_want_hack_req(struct packet_single_want_hack_req *packet)
73070{
73071 memset(packet, 0, sizeof(*packet));
73072}
73073
73074#define free_packet_single_want_hack_req(_packet) (void) 0
73075#define destroy_packet_single_want_hack_req free
73076
73077#ifdef FREECIV_DELTA_PROTOCOL
73078#define hash_packet_single_want_hack_req_100 hash_const
73079
73080#define cmp_packet_single_want_hack_req_100 cmp_const
73081
73082 BV_DEFINE(packet_single_want_hack_req_100_fields, 1);
73083#endif /* FREECIV_DELTA_PROTOCOL */
73084
73085 static struct packet_single_want_hack_req *receive_packet_single_want_hack_req_100(struct connection *pc)
73086{
73087#define FREE_PACKET_STRUCT(_packet) free_packet_single_want_hack_req(_packet)
73088#ifdef FREECIV_DELTA_PROTOCOL
73089 packet_single_want_hack_req_100_fields fields;
73090 struct packet_single_want_hack_req *old;
73091 struct genhash **hash = pc->phs.received + PACKET_SINGLE_WANT_HACK_REQ;
73092#endif /* FREECIV_DELTA_PROTOCOL */
73093 RECEIVE_PACKET_START(packet_single_want_hack_req, real_packet);
73094#ifdef FREECIV_JSON_CONNECTION
73095 struct plocation field_addr;
73096 {
73097 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73098 field_addr = *field_addr_tmp;
73099 FC_FREE(field_addr_tmp);
73100 }
73101#endif /* FREECIV_JSON_CONNECTION */
73102
73103#ifdef FREECIV_DELTA_PROTOCOL
73104#ifdef FREECIV_JSON_CONNECTION
73105 field_addr.name = "fields";
73106#endif /* FREECIV_JSON_CONNECTION */
73107 DIO_BV_GET(&din, &field_addr, fields);
73108
73109#else /* FREECIV_DELTA_PROTOCOL */
73110#ifdef FREECIV_JSON_CONNECTION
73111 field_addr.name = "token";
73112#endif /* FREECIV_JSON_CONNECTION */
73113 if (!DIO_GET(string, &din, &field_addr, real_packet->token, sizeof(real_packet->token))) {
73114 RECEIVE_PACKET_FIELD_ERROR(token);
73115 }
73116#endif
73117 log_packet_detailed("packet_single_want_hack_req_100: got info about ()");
73118
73119#ifdef FREECIV_DELTA_PROTOCOL
73120 if (nullptr == *hash) {
73121 *hash = genhash_new_full(hash_packet_single_want_hack_req_100, cmp_packet_single_want_hack_req_100,
73122 nullptr, nullptr, nullptr, destroy_packet_single_want_hack_req);
73123 }
73124
73125 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73126 *real_packet = *old;
73127 } else {
73128 /* packet is already initialized empty */
73129 log_packet_detailed(" no old info");
73130 }
73131
73132 if (BV_ISSET(fields, 0)) {
73133 log_packet_detailed(" got field 'token'");
73134#ifdef FREECIV_JSON_CONNECTION
73135 field_addr.name = "token";
73136#endif /* FREECIV_JSON_CONNECTION */
73137 if (!DIO_GET(string, &din, &field_addr, real_packet->token, sizeof(real_packet->token))) {
73138 RECEIVE_PACKET_FIELD_ERROR(token);
73139 }
73140 }
73141
73142 if (nullptr == old) {
73143 old = fc_malloc(sizeof(*old));
73144 init_packet_single_want_hack_req(old);
73145 *old = *real_packet;
73146 genhash_insert(*hash, old, old);
73147 } else {
73148 *old = *real_packet;
73149 }
73150
73151#endif /* FREECIV_DELTA_PROTOCOL */
73152 RECEIVE_PACKET_END(real_packet);
73153#undef FREE_PACKET_STRUCT
73154}
73155
73156 static int send_packet_single_want_hack_req_100(struct connection *pc, const struct packet_single_want_hack_req *packet)
73157{
73158 const struct packet_single_want_hack_req *real_packet = packet;
73159 int e;
73160#ifdef FREECIV_DELTA_PROTOCOL
73161 packet_single_want_hack_req_100_fields fields;
73162 struct packet_single_want_hack_req *old;
73163 bool differ;
73164 struct genhash **hash = pc->phs.sent + PACKET_SINGLE_WANT_HACK_REQ;
73165#endif /* FREECIV_DELTA_PROTOCOL */
73166 SEND_PACKET_START(PACKET_SINGLE_WANT_HACK_REQ);
73167#ifdef FREECIV_JSON_CONNECTION
73168 struct plocation field_addr;
73169 {
73170 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73171 field_addr = *field_addr_tmp;
73172 FC_FREE(field_addr_tmp);
73173 }
73174#endif /* FREECIV_JSON_CONNECTION */
73175
73176 log_packet_detailed("packet_single_want_hack_req_100: sending info about ()");
73177
73178#ifdef FREECIV_DELTA_PROTOCOL
73179 if (nullptr == *hash) {
73180 *hash = genhash_new_full(hash_packet_single_want_hack_req_100, cmp_packet_single_want_hack_req_100,
73181 nullptr, nullptr, nullptr, destroy_packet_single_want_hack_req);
73182 }
73183 BV_CLR_ALL(fields);
73184
73185 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73186 old = fc_malloc(sizeof(*old));
73187 /* temporary bitcopy just to insert correctly */
73188 *old = *real_packet;
73189 genhash_insert(*hash, old, old);
73190 init_packet_single_want_hack_req(old);
73191 }
73192 differ = (strcmp(old->token, real_packet->token) != 0);
73193 if (differ) {
73194 BV_SET(fields, 0);
73195 }
73196
73197
73198#ifdef FREECIV_JSON_CONNECTION
73199 field_addr.name = "fields";
73200#endif /* FREECIV_JSON_CONNECTION */
73201 e = 0;
73202 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73203 if (e) {
73204 log_packet_detailed("fields bitvector error detected");
73205 }
73206
73207 if (BV_ISSET(fields, 0)) {
73208 log_packet_detailed(" field 'token' has changed");
73209#ifdef FREECIV_JSON_CONNECTION
73210 field_addr.name = "token";
73211#endif /* FREECIV_JSON_CONNECTION */
73212 e = 0;
73213 e |= DIO_PUT(string, &dout, &field_addr, real_packet->token);
73214 if (e) {
73215 log_packet_detailed("'token' field error detected");
73216 }
73217 }
73218
73219 *old = *real_packet;
73220#endif /* FREECIV_DELTA_PROTOCOL */
73221#ifndef FREECIV_DELTA_PROTOCOL
73222#ifdef FREECIV_JSON_CONNECTION
73223 field_addr.name = "token";
73224#endif /* FREECIV_JSON_CONNECTION */
73225 e = 0;
73226 e |= DIO_PUT(string, &dout, &field_addr, real_packet->token);
73227 if (e) {
73228 log_packet_detailed("'token' field error detected");
73229 }
73230
73231#endif
73232 SEND_PACKET_END(PACKET_SINGLE_WANT_HACK_REQ);
73233}
73234
73235 int send_packet_single_want_hack_req(struct connection *pc, const struct packet_single_want_hack_req *packet)
73236{
73237 if (!pc->used) {
73238 log_error("WARNING: trying to send data to the closed connection %s",
73239 conn_description(pc));
73240 return -1;
73241 }
73242 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet != nullptr, -1,
73243 "Handler for PACKET_SINGLE_WANT_HACK_REQ not installed");
73244 return pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet(pc, packet);
73245}
73246
73247 static inline void init_packet_single_want_hack_reply(struct packet_single_want_hack_reply *packet)
73248{
73249 memset(packet, 0, sizeof(*packet));
73250}
73251
73252#define free_packet_single_want_hack_reply(_packet) (void) 0
73253#define destroy_packet_single_want_hack_reply free
73254
73255#ifdef FREECIV_DELTA_PROTOCOL
73256#define hash_packet_single_want_hack_reply_100 hash_const
73257
73258#define cmp_packet_single_want_hack_reply_100 cmp_const
73259
73260 BV_DEFINE(packet_single_want_hack_reply_100_fields, 1);
73261#endif /* FREECIV_DELTA_PROTOCOL */
73262
73263 static struct packet_single_want_hack_reply *receive_packet_single_want_hack_reply_100(struct connection *pc)
73264{
73265#define FREE_PACKET_STRUCT(_packet) free_packet_single_want_hack_reply(_packet)
73266#ifdef FREECIV_DELTA_PROTOCOL
73267 packet_single_want_hack_reply_100_fields fields;
73268 struct packet_single_want_hack_reply *old;
73269 struct genhash **hash = pc->phs.received + PACKET_SINGLE_WANT_HACK_REPLY;
73270#endif /* FREECIV_DELTA_PROTOCOL */
73271 RECEIVE_PACKET_START(packet_single_want_hack_reply, real_packet);
73272#ifdef FREECIV_JSON_CONNECTION
73273 struct plocation field_addr;
73274 {
73275 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73276 field_addr = *field_addr_tmp;
73277 FC_FREE(field_addr_tmp);
73278 }
73279#endif /* FREECIV_JSON_CONNECTION */
73280
73281#ifdef FREECIV_DELTA_PROTOCOL
73282#ifdef FREECIV_JSON_CONNECTION
73283 field_addr.name = "fields";
73284#endif /* FREECIV_JSON_CONNECTION */
73285 DIO_BV_GET(&din, &field_addr, fields);
73286
73287#else /* FREECIV_DELTA_PROTOCOL */
73288#ifdef FREECIV_JSON_CONNECTION
73289 field_addr.name = "you_have_hack";
73290#endif /* FREECIV_JSON_CONNECTION */
73291 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->you_have_hack)) {
73292 RECEIVE_PACKET_FIELD_ERROR(you_have_hack);
73293 }
73294#endif
73295 log_packet_detailed("packet_single_want_hack_reply_100: got info about ()");
73296
73297#ifdef FREECIV_DELTA_PROTOCOL
73298 if (nullptr == *hash) {
73299 *hash = genhash_new_full(hash_packet_single_want_hack_reply_100, cmp_packet_single_want_hack_reply_100,
73300 nullptr, nullptr, nullptr, destroy_packet_single_want_hack_reply);
73301 }
73302
73303 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73304 *real_packet = *old;
73305 } else {
73306 /* packet is already initialized empty */
73307 log_packet_detailed(" no old info");
73308 }
73309
73310 real_packet->you_have_hack = BV_ISSET(fields, 0);
73311
73312 if (nullptr == old) {
73313 old = fc_malloc(sizeof(*old));
73314 init_packet_single_want_hack_reply(old);
73315 *old = *real_packet;
73316 genhash_insert(*hash, old, old);
73317 } else {
73318 *old = *real_packet;
73319 }
73320
73321#endif /* FREECIV_DELTA_PROTOCOL */
73322 RECEIVE_PACKET_END(real_packet);
73323#undef FREE_PACKET_STRUCT
73324}
73325
73326 static int send_packet_single_want_hack_reply_100(struct connection *pc, const struct packet_single_want_hack_reply *packet)
73327{
73328 const struct packet_single_want_hack_reply *real_packet = packet;
73329 int e;
73330#ifdef FREECIV_DELTA_PROTOCOL
73331 packet_single_want_hack_reply_100_fields fields;
73332 struct packet_single_want_hack_reply *old;
73333 struct genhash **hash = pc->phs.sent + PACKET_SINGLE_WANT_HACK_REPLY;
73334#endif /* FREECIV_DELTA_PROTOCOL */
73335 SEND_PACKET_START(PACKET_SINGLE_WANT_HACK_REPLY);
73336#ifdef FREECIV_JSON_CONNECTION
73337 struct plocation field_addr;
73338 {
73339 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73340 field_addr = *field_addr_tmp;
73341 FC_FREE(field_addr_tmp);
73342 }
73343#endif /* FREECIV_JSON_CONNECTION */
73344
73345 log_packet_detailed("packet_single_want_hack_reply_100: sending info about ()");
73346
73347#ifdef FREECIV_DELTA_PROTOCOL
73348 if (nullptr == *hash) {
73349 *hash = genhash_new_full(hash_packet_single_want_hack_reply_100, cmp_packet_single_want_hack_reply_100,
73350 nullptr, nullptr, nullptr, destroy_packet_single_want_hack_reply);
73351 }
73352 BV_CLR_ALL(fields);
73353
73354 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73355 old = fc_malloc(sizeof(*old));
73356 /* temporary bitcopy just to insert correctly */
73357 *old = *real_packet;
73358 genhash_insert(*hash, old, old);
73359 init_packet_single_want_hack_reply(old);
73360 }
73361 if (packet->you_have_hack) {
73362 BV_SET(fields, 0);
73363 }
73364
73365
73366#ifdef FREECIV_JSON_CONNECTION
73367 field_addr.name = "fields";
73368#endif /* FREECIV_JSON_CONNECTION */
73369 e = 0;
73370 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73371 if (e) {
73372 log_packet_detailed("fields bitvector error detected");
73373 }
73374
73375 /* field 0 is folded into the header */
73376
73377 *old = *real_packet;
73378#endif /* FREECIV_DELTA_PROTOCOL */
73379#ifndef FREECIV_DELTA_PROTOCOL
73380#ifdef FREECIV_JSON_CONNECTION
73381 field_addr.name = "you_have_hack";
73382#endif /* FREECIV_JSON_CONNECTION */
73383 e = 0;
73384 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->you_have_hack);
73385 if (e) {
73386 log_packet_detailed("'you_have_hack' field error detected");
73387 }
73388
73389#endif
73390 SEND_PACKET_END(PACKET_SINGLE_WANT_HACK_REPLY);
73391}
73392
73393 int send_packet_single_want_hack_reply(struct connection *pc, const struct packet_single_want_hack_reply *packet)
73394{
73395 if (!pc->used) {
73396 log_error("WARNING: trying to send data to the closed connection %s",
73397 conn_description(pc));
73398 return -1;
73399 }
73400 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet != nullptr, -1,
73401 "Handler for PACKET_SINGLE_WANT_HACK_REPLY not installed");
73402 return pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet(pc, packet);
73403}
73404
73405 int dsend_packet_single_want_hack_reply(struct connection *pc, bool you_have_hack)
73406{
73407 struct packet_single_want_hack_reply packet, *real_packet = &packet;
73408
73409 real_packet->you_have_hack = you_have_hack;
73410
73411 return send_packet_single_want_hack_reply(pc, real_packet);
73412}
73413
73414 static inline void init_packet_ruleset_choices(struct packet_ruleset_choices *packet)
73415{
73416 memset(packet, 0, sizeof(*packet));
73417}
73418
73419#define free_packet_ruleset_choices(_packet) (void) 0
73420#define destroy_packet_ruleset_choices free
73421
73422#ifdef FREECIV_DELTA_PROTOCOL
73423#define hash_packet_ruleset_choices_100 hash_const
73424
73425#define cmp_packet_ruleset_choices_100 cmp_const
73426
73427 BV_DEFINE(packet_ruleset_choices_100_fields, 2);
73428#endif /* FREECIV_DELTA_PROTOCOL */
73429
73430 static struct packet_ruleset_choices *receive_packet_ruleset_choices_100(struct connection *pc)
73431{
73432#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_choices(_packet)
73433#ifdef FREECIV_DELTA_PROTOCOL
73434 packet_ruleset_choices_100_fields fields;
73435 struct packet_ruleset_choices *old;
73436 struct genhash **hash = pc->phs.received + PACKET_RULESET_CHOICES;
73437#endif /* FREECIV_DELTA_PROTOCOL */
73438 RECEIVE_PACKET_START(packet_ruleset_choices, real_packet);
73439#ifdef FREECIV_JSON_CONNECTION
73440 struct plocation field_addr;
73441 {
73442 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73443 field_addr = *field_addr_tmp;
73444 FC_FREE(field_addr_tmp);
73445 }
73446#endif /* FREECIV_JSON_CONNECTION */
73447
73448#ifdef FREECIV_DELTA_PROTOCOL
73449#ifdef FREECIV_JSON_CONNECTION
73450 field_addr.name = "fields";
73451#endif /* FREECIV_JSON_CONNECTION */
73452 DIO_BV_GET(&din, &field_addr, fields);
73453
73454#else /* FREECIV_DELTA_PROTOCOL */
73455#ifdef FREECIV_JSON_CONNECTION
73456 field_addr.name = "ruleset_count";
73457#endif /* FREECIV_JSON_CONNECTION */
73458 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ruleset_count)) {
73459 RECEIVE_PACKET_FIELD_ERROR(ruleset_count);
73460 }
73461#ifdef FREECIV_JSON_CONNECTION
73462 field_addr.name = "rulesets";
73463#endif /* FREECIV_JSON_CONNECTION */
73464 {
73465 int i;
73466
73467#ifdef FREECIV_JSON_CONNECTION
73468 /* Enter array. */
73469 field_addr.sub_location = plocation_elem_new(0);
73470#endif /* FREECIV_JSON_CONNECTION */
73471
73472 if (real_packet->ruleset_count > MAX_NUM_RULESETS) {
73473 RECEIVE_PACKET_FIELD_ERROR(rulesets, ": truncation array");
73474 }
73475 for (i = 0; i < real_packet->ruleset_count; i++) {
73476#ifdef FREECIV_JSON_CONNECTION
73477 field_addr.sub_location->number = i;
73478#endif /* FREECIV_JSON_CONNECTION */
73479 if (!DIO_GET(string, &din, &field_addr, real_packet->rulesets[i], sizeof(real_packet->rulesets[i]))) {
73480 RECEIVE_PACKET_FIELD_ERROR(rulesets);
73481 }
73482 }
73483
73484#ifdef FREECIV_JSON_CONNECTION
73485 /* Exit array. */
73486 FC_FREE(field_addr.sub_location);
73487#endif /* FREECIV_JSON_CONNECTION */
73488 }
73489#endif
73490 log_packet_detailed("packet_ruleset_choices_100: got info about ()");
73491
73492#ifdef FREECIV_DELTA_PROTOCOL
73493 if (nullptr == *hash) {
73494 *hash = genhash_new_full(hash_packet_ruleset_choices_100, cmp_packet_ruleset_choices_100,
73495 nullptr, nullptr, nullptr, destroy_packet_ruleset_choices);
73496 }
73497
73498 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73499 *real_packet = *old;
73500 } else {
73501 /* packet is already initialized empty */
73502 log_packet_detailed(" no old info");
73503 }
73504
73505 if (BV_ISSET(fields, 0)) {
73506 log_packet_detailed(" got field 'ruleset_count'");
73507#ifdef FREECIV_JSON_CONNECTION
73508 field_addr.name = "ruleset_count";
73509#endif /* FREECIV_JSON_CONNECTION */
73510 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ruleset_count)) {
73511 RECEIVE_PACKET_FIELD_ERROR(ruleset_count);
73512 }
73513 }
73514 if (BV_ISSET(fields, 1)) {
73515 log_packet_detailed(" got field 'rulesets'");
73516#ifdef FREECIV_JSON_CONNECTION
73517 field_addr.name = "rulesets";
73518#endif /* FREECIV_JSON_CONNECTION */
73519 {
73520 int i;
73521
73522#ifdef FREECIV_JSON_CONNECTION
73523 /* Enter array. */
73524 field_addr.sub_location = plocation_elem_new(0);
73525#endif /* FREECIV_JSON_CONNECTION */
73526
73527 if (real_packet->ruleset_count > MAX_NUM_RULESETS) {
73528 RECEIVE_PACKET_FIELD_ERROR(rulesets, ": truncation array");
73529 }
73530 for (i = 0; i < real_packet->ruleset_count; i++) {
73531#ifdef FREECIV_JSON_CONNECTION
73532 field_addr.sub_location->number = i;
73533#endif /* FREECIV_JSON_CONNECTION */
73534 if (!DIO_GET(string, &din, &field_addr, real_packet->rulesets[i], sizeof(real_packet->rulesets[i]))) {
73535 RECEIVE_PACKET_FIELD_ERROR(rulesets);
73536 }
73537 }
73538
73539#ifdef FREECIV_JSON_CONNECTION
73540 /* Exit array. */
73541 FC_FREE(field_addr.sub_location);
73542#endif /* FREECIV_JSON_CONNECTION */
73543 }
73544 }
73545
73546 if (nullptr == old) {
73547 old = fc_malloc(sizeof(*old));
73548 init_packet_ruleset_choices(old);
73549 *old = *real_packet;
73550 genhash_insert(*hash, old, old);
73551 } else {
73552 *old = *real_packet;
73553 }
73554
73555#endif /* FREECIV_DELTA_PROTOCOL */
73556 RECEIVE_PACKET_END(real_packet);
73557#undef FREE_PACKET_STRUCT
73558}
73559
73560 static int send_packet_ruleset_choices_100(struct connection *pc, const struct packet_ruleset_choices *packet)
73561{
73562 const struct packet_ruleset_choices *real_packet = packet;
73563 int e;
73564#ifdef FREECIV_DELTA_PROTOCOL
73565 packet_ruleset_choices_100_fields fields;
73566 struct packet_ruleset_choices *old;
73567 bool differ;
73568 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CHOICES;
73569#endif /* FREECIV_DELTA_PROTOCOL */
73570 SEND_PACKET_START(PACKET_RULESET_CHOICES);
73571#ifdef FREECIV_JSON_CONNECTION
73572 struct plocation field_addr;
73573 {
73574 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73575 field_addr = *field_addr_tmp;
73576 FC_FREE(field_addr_tmp);
73577 }
73578#endif /* FREECIV_JSON_CONNECTION */
73579
73580 log_packet_detailed("packet_ruleset_choices_100: sending info about ()");
73581
73582#ifdef FREECIV_DELTA_PROTOCOL
73583 if (nullptr == *hash) {
73584 *hash = genhash_new_full(hash_packet_ruleset_choices_100, cmp_packet_ruleset_choices_100,
73585 nullptr, nullptr, nullptr, destroy_packet_ruleset_choices);
73586 }
73587 BV_CLR_ALL(fields);
73588
73589 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73590 old = fc_malloc(sizeof(*old));
73591 /* temporary bitcopy just to insert correctly */
73592 *old = *real_packet;
73593 genhash_insert(*hash, old, old);
73594 init_packet_ruleset_choices(old);
73595 }
73596 differ = (old->ruleset_count != real_packet->ruleset_count);
73597 if (differ) {
73598 BV_SET(fields, 0);
73599 }
73600
73601 differ = (old->ruleset_count != real_packet->ruleset_count);
73602 if (!differ) {
73603 int i;
73604
73605 for (i = 0; i < real_packet->ruleset_count; i++) {
73606 differ = (strcmp(old->rulesets[i], real_packet->rulesets[i]) != 0);
73607 if (differ) {
73608 break;
73609 }
73610 }
73611 }
73612 if (differ) {
73613 BV_SET(fields, 1);
73614 }
73615
73616
73617#ifdef FREECIV_JSON_CONNECTION
73618 field_addr.name = "fields";
73619#endif /* FREECIV_JSON_CONNECTION */
73620 e = 0;
73621 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73622 if (e) {
73623 log_packet_detailed("fields bitvector error detected");
73624 }
73625
73626 if (BV_ISSET(fields, 0)) {
73627 log_packet_detailed(" field 'ruleset_count' has changed");
73628#ifdef FREECIV_JSON_CONNECTION
73629 field_addr.name = "ruleset_count";
73630#endif /* FREECIV_JSON_CONNECTION */
73631 e = 0;
73632 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ruleset_count);
73633 if (e) {
73634 log_packet_detailed("'ruleset_count' field error detected");
73635 }
73636 }
73637 if (BV_ISSET(fields, 1)) {
73638 log_packet_detailed(" field 'rulesets' has changed");
73639#ifdef FREECIV_JSON_CONNECTION
73640 field_addr.name = "rulesets";
73641#endif /* FREECIV_JSON_CONNECTION */
73642 e = 0;
73643 {
73644 int i;
73645
73646#ifdef FREECIV_JSON_CONNECTION
73647 /* Create the array. */
73648 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ruleset_count);
73649
73650 /* Enter the array. */
73651 field_addr.sub_location = plocation_elem_new(0);
73652#endif /* FREECIV_JSON_CONNECTION */
73653
73654 for (i = 0; i < real_packet->ruleset_count; i++) {
73655#ifdef FREECIV_JSON_CONNECTION
73656 /* Next array element. */
73657 field_addr.sub_location->number = i;
73658#endif /* FREECIV_JSON_CONNECTION */
73659 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rulesets[i]);
73660 }
73661
73662#ifdef FREECIV_JSON_CONNECTION
73663 /* Exit array. */
73664 FC_FREE(field_addr.sub_location);
73665#endif /* FREECIV_JSON_CONNECTION */
73666 }
73667 if (e) {
73668 log_packet_detailed("'rulesets' field error detected");
73669 }
73670 }
73671
73672 *old = *real_packet;
73673#endif /* FREECIV_DELTA_PROTOCOL */
73674#ifndef FREECIV_DELTA_PROTOCOL
73675#ifdef FREECIV_JSON_CONNECTION
73676 field_addr.name = "ruleset_count";
73677#endif /* FREECIV_JSON_CONNECTION */
73678 e = 0;
73679 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ruleset_count);
73680 if (e) {
73681 log_packet_detailed("'ruleset_count' field error detected");
73682 }
73683#ifdef FREECIV_JSON_CONNECTION
73684 field_addr.name = "rulesets";
73685#endif /* FREECIV_JSON_CONNECTION */
73686 e = 0;
73687 {
73688 int i;
73689
73690#ifdef FREECIV_JSON_CONNECTION
73691 /* Create the array. */
73692 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ruleset_count);
73693
73694 /* Enter the array. */
73695 field_addr.sub_location = plocation_elem_new(0);
73696#endif /* FREECIV_JSON_CONNECTION */
73697
73698 for (i = 0; i < real_packet->ruleset_count; i++) {
73699#ifdef FREECIV_JSON_CONNECTION
73700 /* Next array element. */
73701 field_addr.sub_location->number = i;
73702#endif /* FREECIV_JSON_CONNECTION */
73703 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rulesets[i]);
73704 }
73705
73706#ifdef FREECIV_JSON_CONNECTION
73707 /* Exit array. */
73708 FC_FREE(field_addr.sub_location);
73709#endif /* FREECIV_JSON_CONNECTION */
73710 }
73711 if (e) {
73712 log_packet_detailed("'rulesets' field error detected");
73713 }
73714
73715#endif
73716 SEND_PACKET_END(PACKET_RULESET_CHOICES);
73717}
73718
73719 int send_packet_ruleset_choices(struct connection *pc, const struct packet_ruleset_choices *packet)
73720{
73721 if (!pc->used) {
73722 log_error("WARNING: trying to send data to the closed connection %s",
73723 conn_description(pc));
73724 return -1;
73725 }
73726 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CHOICES].packet != nullptr, -1,
73727 "Handler for PACKET_RULESET_CHOICES not installed");
73728 return pc->phs.handlers->send[PACKET_RULESET_CHOICES].packet(pc, packet);
73729}
73730
73731 static inline void init_packet_ruleset_select(struct packet_ruleset_select *packet)
73732{
73733 memset(packet, 0, sizeof(*packet));
73734}
73735
73736#define free_packet_ruleset_select(_packet) (void) 0
73737#define destroy_packet_ruleset_select free
73738
73739#ifdef FREECIV_DELTA_PROTOCOL
73740#define hash_packet_ruleset_select_100 hash_const
73741
73742#define cmp_packet_ruleset_select_100 cmp_const
73743
73744 BV_DEFINE(packet_ruleset_select_100_fields, 1);
73745#endif /* FREECIV_DELTA_PROTOCOL */
73746
73747 static struct packet_ruleset_select *receive_packet_ruleset_select_100(struct connection *pc)
73748{
73749#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_select(_packet)
73750#ifdef FREECIV_DELTA_PROTOCOL
73751 packet_ruleset_select_100_fields fields;
73752 struct packet_ruleset_select *old;
73753 struct genhash **hash = pc->phs.received + PACKET_RULESET_SELECT;
73754#endif /* FREECIV_DELTA_PROTOCOL */
73755 RECEIVE_PACKET_START(packet_ruleset_select, real_packet);
73756#ifdef FREECIV_JSON_CONNECTION
73757 struct plocation field_addr;
73758 {
73759 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73760 field_addr = *field_addr_tmp;
73761 FC_FREE(field_addr_tmp);
73762 }
73763#endif /* FREECIV_JSON_CONNECTION */
73764
73765#ifdef FREECIV_DELTA_PROTOCOL
73766#ifdef FREECIV_JSON_CONNECTION
73767 field_addr.name = "fields";
73768#endif /* FREECIV_JSON_CONNECTION */
73769 DIO_BV_GET(&din, &field_addr, fields);
73770
73771#else /* FREECIV_DELTA_PROTOCOL */
73772#ifdef FREECIV_JSON_CONNECTION
73773 field_addr.name = "modpack";
73774#endif /* FREECIV_JSON_CONNECTION */
73775 if (!DIO_GET(string, &din, &field_addr, real_packet->modpack, sizeof(real_packet->modpack))) {
73776 RECEIVE_PACKET_FIELD_ERROR(modpack);
73777 }
73778#endif
73779 log_packet_detailed("packet_ruleset_select_100: got info about ()");
73780
73781#ifdef FREECIV_DELTA_PROTOCOL
73782 if (nullptr == *hash) {
73783 *hash = genhash_new_full(hash_packet_ruleset_select_100, cmp_packet_ruleset_select_100,
73784 nullptr, nullptr, nullptr, destroy_packet_ruleset_select);
73785 }
73786
73787 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73788 *real_packet = *old;
73789 } else {
73790 /* packet is already initialized empty */
73791 log_packet_detailed(" no old info");
73792 }
73793
73794 if (BV_ISSET(fields, 0)) {
73795 log_packet_detailed(" got field 'modpack'");
73796#ifdef FREECIV_JSON_CONNECTION
73797 field_addr.name = "modpack";
73798#endif /* FREECIV_JSON_CONNECTION */
73799 if (!DIO_GET(string, &din, &field_addr, real_packet->modpack, sizeof(real_packet->modpack))) {
73800 RECEIVE_PACKET_FIELD_ERROR(modpack);
73801 }
73802 }
73803
73804 if (nullptr == old) {
73805 old = fc_malloc(sizeof(*old));
73806 init_packet_ruleset_select(old);
73807 *old = *real_packet;
73808 genhash_insert(*hash, old, old);
73809 } else {
73810 *old = *real_packet;
73811 }
73812
73813#endif /* FREECIV_DELTA_PROTOCOL */
73814 RECEIVE_PACKET_END(real_packet);
73815#undef FREE_PACKET_STRUCT
73816}
73817
73818 static int send_packet_ruleset_select_100(struct connection *pc, const struct packet_ruleset_select *packet)
73819{
73820 const struct packet_ruleset_select *real_packet = packet;
73821 int e;
73822#ifdef FREECIV_DELTA_PROTOCOL
73823 packet_ruleset_select_100_fields fields;
73824 struct packet_ruleset_select *old;
73825 bool differ;
73826 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SELECT;
73827#endif /* FREECIV_DELTA_PROTOCOL */
73828 SEND_PACKET_START(PACKET_RULESET_SELECT);
73829#ifdef FREECIV_JSON_CONNECTION
73830 struct plocation field_addr;
73831 {
73832 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73833 field_addr = *field_addr_tmp;
73834 FC_FREE(field_addr_tmp);
73835 }
73836#endif /* FREECIV_JSON_CONNECTION */
73837
73838 log_packet_detailed("packet_ruleset_select_100: sending info about ()");
73839
73840#ifdef FREECIV_DELTA_PROTOCOL
73841 if (nullptr == *hash) {
73842 *hash = genhash_new_full(hash_packet_ruleset_select_100, cmp_packet_ruleset_select_100,
73843 nullptr, nullptr, nullptr, destroy_packet_ruleset_select);
73844 }
73845 BV_CLR_ALL(fields);
73846
73847 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73848 old = fc_malloc(sizeof(*old));
73849 /* temporary bitcopy just to insert correctly */
73850 *old = *real_packet;
73851 genhash_insert(*hash, old, old);
73852 init_packet_ruleset_select(old);
73853 }
73854 differ = (strcmp(old->modpack, real_packet->modpack) != 0);
73855 if (differ) {
73856 BV_SET(fields, 0);
73857 }
73858
73859
73860#ifdef FREECIV_JSON_CONNECTION
73861 field_addr.name = "fields";
73862#endif /* FREECIV_JSON_CONNECTION */
73863 e = 0;
73864 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73865 if (e) {
73866 log_packet_detailed("fields bitvector error detected");
73867 }
73868
73869 if (BV_ISSET(fields, 0)) {
73870 log_packet_detailed(" field 'modpack' has changed");
73871#ifdef FREECIV_JSON_CONNECTION
73872 field_addr.name = "modpack";
73873#endif /* FREECIV_JSON_CONNECTION */
73874 e = 0;
73875 e |= DIO_PUT(string, &dout, &field_addr, real_packet->modpack);
73876 if (e) {
73877 log_packet_detailed("'modpack' field error detected");
73878 }
73879 }
73880
73881 *old = *real_packet;
73882#endif /* FREECIV_DELTA_PROTOCOL */
73883#ifndef FREECIV_DELTA_PROTOCOL
73884#ifdef FREECIV_JSON_CONNECTION
73885 field_addr.name = "modpack";
73886#endif /* FREECIV_JSON_CONNECTION */
73887 e = 0;
73888 e |= DIO_PUT(string, &dout, &field_addr, real_packet->modpack);
73889 if (e) {
73890 log_packet_detailed("'modpack' field error detected");
73891 }
73892
73893#endif
73894 SEND_PACKET_END(PACKET_RULESET_SELECT);
73895}
73896
73897 int send_packet_ruleset_select(struct connection *pc, const struct packet_ruleset_select *packet)
73898{
73899 if (!pc->used) {
73900 log_error("WARNING: trying to send data to the closed connection %s",
73901 conn_description(pc));
73902 return -1;
73903 }
73904 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SELECT].packet != nullptr, -1,
73905 "Handler for PACKET_RULESET_SELECT not installed");
73906 return pc->phs.handlers->send[PACKET_RULESET_SELECT].packet(pc, packet);
73907}
73908
73909 static inline void init_packet_game_load(struct packet_game_load *packet)
73910{
73911 memset(packet, 0, sizeof(*packet));
73912}
73913
73914#define free_packet_game_load(_packet) (void) 0
73915#define destroy_packet_game_load free
73916
73917#ifdef FREECIV_DELTA_PROTOCOL
73918#define hash_packet_game_load_100 hash_const
73919
73920#define cmp_packet_game_load_100 cmp_const
73921
73922 BV_DEFINE(packet_game_load_100_fields, 2);
73923#endif /* FREECIV_DELTA_PROTOCOL */
73924
73925 static struct packet_game_load *receive_packet_game_load_100(struct connection *pc)
73926{
73927#define FREE_PACKET_STRUCT(_packet) free_packet_game_load(_packet)
73928#ifdef FREECIV_DELTA_PROTOCOL
73929 packet_game_load_100_fields fields;
73930 struct packet_game_load *old;
73931 struct genhash **hash = pc->phs.received + PACKET_GAME_LOAD;
73932#endif /* FREECIV_DELTA_PROTOCOL */
73933 RECEIVE_PACKET_START(packet_game_load, real_packet);
73934#ifdef FREECIV_JSON_CONNECTION
73935 struct plocation field_addr;
73936 {
73937 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
73938 field_addr = *field_addr_tmp;
73939 FC_FREE(field_addr_tmp);
73940 }
73941#endif /* FREECIV_JSON_CONNECTION */
73942
73943#ifdef FREECIV_DELTA_PROTOCOL
73944#ifdef FREECIV_JSON_CONNECTION
73945 field_addr.name = "fields";
73946#endif /* FREECIV_JSON_CONNECTION */
73947 DIO_BV_GET(&din, &field_addr, fields);
73948
73949#else /* FREECIV_DELTA_PROTOCOL */
73950#ifdef FREECIV_JSON_CONNECTION
73951 field_addr.name = "load_successful";
73952#endif /* FREECIV_JSON_CONNECTION */
73953 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->load_successful)) {
73954 RECEIVE_PACKET_FIELD_ERROR(load_successful);
73955 }
73956#ifdef FREECIV_JSON_CONNECTION
73957 field_addr.name = "load_filename";
73958#endif /* FREECIV_JSON_CONNECTION */
73959 if (!DIO_GET(string, &din, &field_addr, real_packet->load_filename, sizeof(real_packet->load_filename))) {
73960 RECEIVE_PACKET_FIELD_ERROR(load_filename);
73961 }
73962#endif
73963 log_packet_detailed("packet_game_load_100: got info about ()");
73964
73965#ifdef FREECIV_DELTA_PROTOCOL
73966 if (nullptr == *hash) {
73967 *hash = genhash_new_full(hash_packet_game_load_100, cmp_packet_game_load_100,
73968 nullptr, nullptr, nullptr, destroy_packet_game_load);
73969 }
73970
73971 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73972 *real_packet = *old;
73973 } else {
73974 /* packet is already initialized empty */
73975 log_packet_detailed(" no old info");
73976 }
73977
73978 real_packet->load_successful = BV_ISSET(fields, 0);
73979 if (BV_ISSET(fields, 1)) {
73980 log_packet_detailed(" got field 'load_filename'");
73981#ifdef FREECIV_JSON_CONNECTION
73982 field_addr.name = "load_filename";
73983#endif /* FREECIV_JSON_CONNECTION */
73984 if (!DIO_GET(string, &din, &field_addr, real_packet->load_filename, sizeof(real_packet->load_filename))) {
73985 RECEIVE_PACKET_FIELD_ERROR(load_filename);
73986 }
73987 }
73988
73989 if (nullptr == old) {
73990 old = fc_malloc(sizeof(*old));
73991 init_packet_game_load(old);
73992 *old = *real_packet;
73993 genhash_insert(*hash, old, old);
73994 } else {
73995 *old = *real_packet;
73996 }
73997
73998#endif /* FREECIV_DELTA_PROTOCOL */
73999 RECEIVE_PACKET_END(real_packet);
74000#undef FREE_PACKET_STRUCT
74001}
74002
74003 static int send_packet_game_load_100(struct connection *pc, const struct packet_game_load *packet)
74004{
74005 const struct packet_game_load *real_packet = packet;
74006 int e;
74007#ifdef FREECIV_DELTA_PROTOCOL
74008 packet_game_load_100_fields fields;
74009 struct packet_game_load *old;
74010 bool differ;
74011 struct genhash **hash = pc->phs.sent + PACKET_GAME_LOAD;
74012#endif /* FREECIV_DELTA_PROTOCOL */
74013 SEND_PACKET_START(PACKET_GAME_LOAD);
74014#ifdef FREECIV_JSON_CONNECTION
74015 struct plocation field_addr;
74016 {
74017 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
74018 field_addr = *field_addr_tmp;
74019 FC_FREE(field_addr_tmp);
74020 }
74021#endif /* FREECIV_JSON_CONNECTION */
74022
74023 log_packet_detailed("packet_game_load_100: sending info about ()");
74024
74025#ifdef FREECIV_DELTA_PROTOCOL
74026 if (nullptr == *hash) {
74027 *hash = genhash_new_full(hash_packet_game_load_100, cmp_packet_game_load_100,
74028 nullptr, nullptr, nullptr, destroy_packet_game_load);
74029 }
74030 BV_CLR_ALL(fields);
74031
74032 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74033 old = fc_malloc(sizeof(*old));
74034 /* temporary bitcopy just to insert correctly */
74035 *old = *real_packet;
74036 genhash_insert(*hash, old, old);
74037 init_packet_game_load(old);
74038 }
74039 if (packet->load_successful) {
74040 BV_SET(fields, 0);
74041 }
74042
74043 differ = (strcmp(old->load_filename, real_packet->load_filename) != 0);
74044 if (differ) {
74045 BV_SET(fields, 1);
74046 }
74047
74048
74049#ifdef FREECIV_JSON_CONNECTION
74050 field_addr.name = "fields";
74051#endif /* FREECIV_JSON_CONNECTION */
74052 e = 0;
74053 e |= DIO_BV_PUT(&dout, &field_addr, fields);
74054 if (e) {
74055 log_packet_detailed("fields bitvector error detected");
74056 }
74057
74058 /* field 0 is folded into the header */
74059 if (BV_ISSET(fields, 1)) {
74060 log_packet_detailed(" field 'load_filename' has changed");
74061#ifdef FREECIV_JSON_CONNECTION
74062 field_addr.name = "load_filename";
74063#endif /* FREECIV_JSON_CONNECTION */
74064 e = 0;
74065 e |= DIO_PUT(string, &dout, &field_addr, real_packet->load_filename);
74066 if (e) {
74067 log_packet_detailed("'load_filename' field error detected");
74068 }
74069 }
74070
74071 *old = *real_packet;
74072#endif /* FREECIV_DELTA_PROTOCOL */
74073#ifndef FREECIV_DELTA_PROTOCOL
74074#ifdef FREECIV_JSON_CONNECTION
74075 field_addr.name = "load_successful";
74076#endif /* FREECIV_JSON_CONNECTION */
74077 e = 0;
74078 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->load_successful);
74079 if (e) {
74080 log_packet_detailed("'load_successful' field error detected");
74081 }
74082#ifdef FREECIV_JSON_CONNECTION
74083 field_addr.name = "load_filename";
74084#endif /* FREECIV_JSON_CONNECTION */
74085 e = 0;
74086 e |= DIO_PUT(string, &dout, &field_addr, real_packet->load_filename);
74087 if (e) {
74088 log_packet_detailed("'load_filename' field error detected");
74089 }
74090
74091#endif
74092 SEND_PACKET_END(PACKET_GAME_LOAD);
74093}
74094
74095 int send_packet_game_load(struct connection *pc, const struct packet_game_load *packet)
74096{
74097 if (!pc->used) {
74098 log_error("WARNING: trying to send data to the closed connection %s",
74099 conn_description(pc));
74100 return -1;
74101 }
74102 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_GAME_LOAD].packet != nullptr, -1,
74103 "Handler for PACKET_GAME_LOAD not installed");
74104 return pc->phs.handlers->send[PACKET_GAME_LOAD].packet(pc, packet);
74105}
74106
74107 void lsend_packet_game_load(struct conn_list *dest, const struct packet_game_load *packet)
74108{
74109 conn_list_iterate(dest, pconn) {
74110 send_packet_game_load(pconn, packet);
74111 } conn_list_iterate_end;
74112}
74113
74114 int dsend_packet_game_load(struct connection *pc, bool load_successful, const char *load_filename)
74115{
74116 struct packet_game_load packet, *real_packet = &packet;
74117
74118 real_packet->load_successful = load_successful;
74119 sz_strlcpy(real_packet->load_filename, load_filename);
74120
74121 return send_packet_game_load(pc, real_packet);
74122}
74123
74124 void dlsend_packet_game_load(struct conn_list *dest, bool load_successful, const char *load_filename)
74125{
74126 struct packet_game_load packet, *real_packet = &packet;
74127
74128 real_packet->load_successful = load_successful;
74129 sz_strlcpy(real_packet->load_filename, load_filename);
74130
74131 lsend_packet_game_load(dest, real_packet);
74132}
74133
74134 static inline void init_packet_server_setting_control(struct packet_server_setting_control *packet)
74135{
74136 memset(packet, 0, sizeof(*packet));
74137}
74138
74139#define free_packet_server_setting_control(_packet) (void) 0
74140#define destroy_packet_server_setting_control free
74141
74142#ifdef FREECIV_DELTA_PROTOCOL
74143#define hash_packet_server_setting_control_100 hash_const
74144
74145#define cmp_packet_server_setting_control_100 cmp_const
74146
74147 BV_DEFINE(packet_server_setting_control_100_fields, 3);
74148#endif /* FREECIV_DELTA_PROTOCOL */
74149
74150 static struct packet_server_setting_control *receive_packet_server_setting_control_100(struct connection *pc)
74151{
74152#define FREE_PACKET_STRUCT(_packet) free_packet_server_setting_control(_packet)
74153#ifdef FREECIV_DELTA_PROTOCOL
74154 packet_server_setting_control_100_fields fields;
74155 struct packet_server_setting_control *old;
74156 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_CONTROL;
74157#endif /* FREECIV_DELTA_PROTOCOL */
74158 RECEIVE_PACKET_START(packet_server_setting_control, real_packet);
74159#ifdef FREECIV_JSON_CONNECTION
74160 struct plocation field_addr;
74161 {
74162 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
74163 field_addr = *field_addr_tmp;
74164 FC_FREE(field_addr_tmp);
74165 }
74166#endif /* FREECIV_JSON_CONNECTION */
74167
74168#ifdef FREECIV_DELTA_PROTOCOL
74169#ifdef FREECIV_JSON_CONNECTION
74170 field_addr.name = "fields";
74171#endif /* FREECIV_JSON_CONNECTION */
74172 DIO_BV_GET(&din, &field_addr, fields);
74173
74174#else /* FREECIV_DELTA_PROTOCOL */
74175#ifdef FREECIV_JSON_CONNECTION
74176 field_addr.name = "settings_num";
74177#endif /* FREECIV_JSON_CONNECTION */
74178 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->settings_num)) {
74179 RECEIVE_PACKET_FIELD_ERROR(settings_num);
74180 }
74181#ifdef FREECIV_JSON_CONNECTION
74182 field_addr.name = "categories_num";
74183#endif /* FREECIV_JSON_CONNECTION */
74184 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->categories_num)) {
74185 RECEIVE_PACKET_FIELD_ERROR(categories_num);
74186 }
74187#ifdef FREECIV_JSON_CONNECTION
74188 field_addr.name = "category_names";
74189#endif /* FREECIV_JSON_CONNECTION */
74190 {
74191 int i;
74192
74193#ifdef FREECIV_JSON_CONNECTION
74194 /* Enter array. */
74195 field_addr.sub_location = plocation_elem_new(0);
74196#endif /* FREECIV_JSON_CONNECTION */
74197
74198 if (real_packet->categories_num > 256) {
74199 RECEIVE_PACKET_FIELD_ERROR(category_names, ": truncation array");
74200 }
74201 for (i = 0; i < real_packet->categories_num; i++) {
74202#ifdef FREECIV_JSON_CONNECTION
74203 field_addr.sub_location->number = i;
74204#endif /* FREECIV_JSON_CONNECTION */
74205 if (!DIO_GET(string, &din, &field_addr, real_packet->category_names[i], sizeof(real_packet->category_names[i]))) {
74206 RECEIVE_PACKET_FIELD_ERROR(category_names);
74207 }
74208 }
74209
74210#ifdef FREECIV_JSON_CONNECTION
74211 /* Exit array. */
74212 FC_FREE(field_addr.sub_location);
74213#endif /* FREECIV_JSON_CONNECTION */
74214 }
74215#endif
74216 log_packet_detailed("packet_server_setting_control_100: got info about ()");
74217
74218#ifdef FREECIV_DELTA_PROTOCOL
74219 if (nullptr == *hash) {
74220 *hash = genhash_new_full(hash_packet_server_setting_control_100, cmp_packet_server_setting_control_100,
74221 nullptr, nullptr, nullptr, destroy_packet_server_setting_control);
74222 }
74223
74224 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74225 *real_packet = *old;
74226 } else {
74227 /* packet is already initialized empty */
74228 log_packet_detailed(" no old info");
74229 }
74230
74231 if (BV_ISSET(fields, 0)) {
74232 log_packet_detailed(" got field 'settings_num'");
74233#ifdef FREECIV_JSON_CONNECTION
74234 field_addr.name = "settings_num";
74235#endif /* FREECIV_JSON_CONNECTION */
74236 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->settings_num)) {
74237 RECEIVE_PACKET_FIELD_ERROR(settings_num);
74238 }
74239 }
74240 if (BV_ISSET(fields, 1)) {
74241 log_packet_detailed(" got field 'categories_num'");
74242#ifdef FREECIV_JSON_CONNECTION
74243 field_addr.name = "categories_num";
74244#endif /* FREECIV_JSON_CONNECTION */
74245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->categories_num)) {
74246 RECEIVE_PACKET_FIELD_ERROR(categories_num);
74247 }
74248 }
74249 if (BV_ISSET(fields, 2)) {
74250 log_packet_detailed(" got field 'category_names'");
74251#ifdef FREECIV_JSON_CONNECTION
74252 field_addr.name = "category_names";
74253#endif /* FREECIV_JSON_CONNECTION */
74254 {
74255 int i;
74256
74257#ifdef FREECIV_JSON_CONNECTION
74258 /* Enter array. */
74259 field_addr.sub_location = plocation_elem_new(0);
74260#endif /* FREECIV_JSON_CONNECTION */
74261
74262 if (real_packet->categories_num > 256) {
74263 RECEIVE_PACKET_FIELD_ERROR(category_names, ": truncation array");
74264 }
74265 for (i = 0; i < real_packet->categories_num; i++) {
74266#ifdef FREECIV_JSON_CONNECTION
74267 field_addr.sub_location->number = i;
74268#endif /* FREECIV_JSON_CONNECTION */
74269 if (!DIO_GET(string, &din, &field_addr, real_packet->category_names[i], sizeof(real_packet->category_names[i]))) {
74270 RECEIVE_PACKET_FIELD_ERROR(category_names);
74271 }
74272 }
74273
74274#ifdef FREECIV_JSON_CONNECTION
74275 /* Exit array. */
74276 FC_FREE(field_addr.sub_location);
74277#endif /* FREECIV_JSON_CONNECTION */
74278 }
74279 }
74280
74281 if (nullptr == old) {
74282 old = fc_malloc(sizeof(*old));
74283 init_packet_server_setting_control(old);
74284 *old = *real_packet;
74285 genhash_insert(*hash, old, old);
74286 } else {
74287 *old = *real_packet;
74288 }
74289
74290#endif /* FREECIV_DELTA_PROTOCOL */
74291 RECEIVE_PACKET_END(real_packet);
74292#undef FREE_PACKET_STRUCT
74293}
74294
74295 static int send_packet_server_setting_control_100(struct connection *pc, const struct packet_server_setting_control *packet)
74296{
74297 const struct packet_server_setting_control *real_packet = packet;
74298 int e;
74299#ifdef FREECIV_DELTA_PROTOCOL
74300 packet_server_setting_control_100_fields fields;
74301 struct packet_server_setting_control *old;
74302 bool differ;
74303 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_CONTROL;
74304 int different = 0;
74305#endif /* FREECIV_DELTA_PROTOCOL */
74306 SEND_PACKET_START(PACKET_SERVER_SETTING_CONTROL);
74307#ifdef FREECIV_JSON_CONNECTION
74308 struct plocation field_addr;
74309 {
74310 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
74311 field_addr = *field_addr_tmp;
74312 FC_FREE(field_addr_tmp);
74313 }
74314#endif /* FREECIV_JSON_CONNECTION */
74315
74316 log_packet_detailed("packet_server_setting_control_100: sending info about ()");
74317
74318#ifdef FREECIV_DELTA_PROTOCOL
74319 if (nullptr == *hash) {
74320 *hash = genhash_new_full(hash_packet_server_setting_control_100, cmp_packet_server_setting_control_100,
74321 nullptr, nullptr, nullptr, destroy_packet_server_setting_control);
74322 }
74323 BV_CLR_ALL(fields);
74324
74325 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74326 old = fc_malloc(sizeof(*old));
74327 /* temporary bitcopy just to insert correctly */
74328 *old = *real_packet;
74329 genhash_insert(*hash, old, old);
74330 init_packet_server_setting_control(old);
74331 different = 1; /* Force to send. */
74332 }
74333 differ = (old->settings_num != real_packet->settings_num);
74334 if (differ) {
74335 different++;
74336 BV_SET(fields, 0);
74337 }
74338
74339 differ = (old->categories_num != real_packet->categories_num);
74340 if (differ) {
74341 different++;
74342 BV_SET(fields, 1);
74343 }
74344
74345 differ = (old->categories_num != real_packet->categories_num);
74346 if (!differ) {
74347 int i;
74348
74349 for (i = 0; i < real_packet->categories_num; i++) {
74350 differ = (strcmp(old->category_names[i], real_packet->category_names[i]) != 0);
74351 if (differ) {
74352 break;
74353 }
74354 }
74355 }
74356 if (differ) {
74357 different++;
74358 BV_SET(fields, 2);
74359 }
74360
74361 if (different == 0) {
74362 log_packet_detailed(" no change -> discard");
74363 return 0;
74364 }
74365
74366#ifdef FREECIV_JSON_CONNECTION
74367 field_addr.name = "fields";
74368#endif /* FREECIV_JSON_CONNECTION */
74369 e = 0;
74370 e |= DIO_BV_PUT(&dout, &field_addr, fields);
74371 if (e) {
74372 log_packet_detailed("fields bitvector error detected");
74373 }
74374
74375 if (BV_ISSET(fields, 0)) {
74376 log_packet_detailed(" field 'settings_num' has changed");
74377#ifdef FREECIV_JSON_CONNECTION
74378 field_addr.name = "settings_num";
74379#endif /* FREECIV_JSON_CONNECTION */
74380 e = 0;
74381 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->settings_num);
74382 if (e) {
74383 log_packet_detailed("'settings_num' field error detected");
74384 }
74385 }
74386 if (BV_ISSET(fields, 1)) {
74387 log_packet_detailed(" field 'categories_num' has changed");
74388#ifdef FREECIV_JSON_CONNECTION
74389 field_addr.name = "categories_num";
74390#endif /* FREECIV_JSON_CONNECTION */
74391 e = 0;
74392 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->categories_num);
74393 if (e) {
74394 log_packet_detailed("'categories_num' field error detected");
74395 }
74396 }
74397 if (BV_ISSET(fields, 2)) {
74398 log_packet_detailed(" field 'category_names' has changed");
74399#ifdef FREECIV_JSON_CONNECTION
74400 field_addr.name = "category_names";
74401#endif /* FREECIV_JSON_CONNECTION */
74402 e = 0;
74403 {
74404 int i;
74405
74406#ifdef FREECIV_JSON_CONNECTION
74407 /* Create the array. */
74408 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->categories_num);
74409
74410 /* Enter the array. */
74411 field_addr.sub_location = plocation_elem_new(0);
74412#endif /* FREECIV_JSON_CONNECTION */
74413
74414 for (i = 0; i < real_packet->categories_num; i++) {
74415#ifdef FREECIV_JSON_CONNECTION
74416 /* Next array element. */
74417 field_addr.sub_location->number = i;
74418#endif /* FREECIV_JSON_CONNECTION */
74419 e |= DIO_PUT(string, &dout, &field_addr, real_packet->category_names[i]);
74420 }
74421
74422#ifdef FREECIV_JSON_CONNECTION
74423 /* Exit array. */
74424 FC_FREE(field_addr.sub_location);
74425#endif /* FREECIV_JSON_CONNECTION */
74426 }
74427 if (e) {
74428 log_packet_detailed("'category_names' field error detected");
74429 }
74430 }
74431
74432 *old = *real_packet;
74433#endif /* FREECIV_DELTA_PROTOCOL */
74434#ifndef FREECIV_DELTA_PROTOCOL
74435#ifdef FREECIV_JSON_CONNECTION
74436 field_addr.name = "settings_num";
74437#endif /* FREECIV_JSON_CONNECTION */
74438 e = 0;
74439 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->settings_num);
74440 if (e) {
74441 log_packet_detailed("'settings_num' field error detected");
74442 }
74443#ifdef FREECIV_JSON_CONNECTION
74444 field_addr.name = "categories_num";
74445#endif /* FREECIV_JSON_CONNECTION */
74446 e = 0;
74447 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->categories_num);
74448 if (e) {
74449 log_packet_detailed("'categories_num' field error detected");
74450 }
74451#ifdef FREECIV_JSON_CONNECTION
74452 field_addr.name = "category_names";
74453#endif /* FREECIV_JSON_CONNECTION */
74454 e = 0;
74455 {
74456 int i;
74457
74458#ifdef FREECIV_JSON_CONNECTION
74459 /* Create the array. */
74460 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->categories_num);
74461
74462 /* Enter the array. */
74463 field_addr.sub_location = plocation_elem_new(0);
74464#endif /* FREECIV_JSON_CONNECTION */
74465
74466 for (i = 0; i < real_packet->categories_num; i++) {
74467#ifdef FREECIV_JSON_CONNECTION
74468 /* Next array element. */
74469 field_addr.sub_location->number = i;
74470#endif /* FREECIV_JSON_CONNECTION */
74471 e |= DIO_PUT(string, &dout, &field_addr, real_packet->category_names[i]);
74472 }
74473
74474#ifdef FREECIV_JSON_CONNECTION
74475 /* Exit array. */
74476 FC_FREE(field_addr.sub_location);
74477#endif /* FREECIV_JSON_CONNECTION */
74478 }
74479 if (e) {
74480 log_packet_detailed("'category_names' field error detected");
74481 }
74482
74483#endif
74484 SEND_PACKET_END(PACKET_SERVER_SETTING_CONTROL);
74485}
74486
74487 int send_packet_server_setting_control(struct connection *pc, const struct packet_server_setting_control *packet)
74488{
74489 if (!pc->used) {
74490 log_error("WARNING: trying to send data to the closed connection %s",
74491 conn_description(pc));
74492 return -1;
74493 }
74494 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_CONTROL].packet != nullptr, -1,
74495 "Handler for PACKET_SERVER_SETTING_CONTROL not installed");
74496 return pc->phs.handlers->send[PACKET_SERVER_SETTING_CONTROL].packet(pc, packet);
74497}
74498
74499 static inline void init_packet_server_setting_const(struct packet_server_setting_const *packet)
74500{
74501 memset(packet, 0, sizeof(*packet));
74502}
74503
74504#define free_packet_server_setting_const(_packet) (void) 0
74505#define destroy_packet_server_setting_const free
74506
74507#ifdef FREECIV_DELTA_PROTOCOL
74508static genhash_val_t hash_packet_server_setting_const_100(const void *vkey)
74509{
74510 const struct packet_server_setting_const *key = (const struct packet_server_setting_const *) vkey;
74511 genhash_val_t result = 0;
74512
74513 result += key->id;
74514
74515 result &= 0xFFFFFFFF;
74516 return result;
74517}
74518
74519static bool cmp_packet_server_setting_const_100(const void *vkey1, const void *vkey2)
74520{
74521 const struct packet_server_setting_const *old = (const struct packet_server_setting_const *) vkey1;
74522 const struct packet_server_setting_const *real_packet = (const struct packet_server_setting_const *) vkey2;
74523 bool differ;
74524
74525 differ = (old->id != real_packet->id);
74526
74527 return !differ;
74528}
74529 BV_DEFINE(packet_server_setting_const_100_fields, 4);
74530#endif /* FREECIV_DELTA_PROTOCOL */
74531
74532 static struct packet_server_setting_const *receive_packet_server_setting_const_100(struct connection *pc)
74533{
74534#define FREE_PACKET_STRUCT(_packet) free_packet_server_setting_const(_packet)
74535#ifdef FREECIV_DELTA_PROTOCOL
74536 packet_server_setting_const_100_fields fields;
74537 struct packet_server_setting_const *old;
74538 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_CONST;
74539#endif /* FREECIV_DELTA_PROTOCOL */
74540 RECEIVE_PACKET_START(packet_server_setting_const, real_packet);
74541#ifdef FREECIV_JSON_CONNECTION
74542 struct plocation field_addr;
74543 {
74544 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
74545 field_addr = *field_addr_tmp;
74546 FC_FREE(field_addr_tmp);
74547 }
74548#endif /* FREECIV_JSON_CONNECTION */
74549
74550#ifdef FREECIV_DELTA_PROTOCOL
74551#ifdef FREECIV_JSON_CONNECTION
74552 field_addr.name = "fields";
74553#endif /* FREECIV_JSON_CONNECTION */
74554 DIO_BV_GET(&din, &field_addr, fields);
74555#ifdef FREECIV_JSON_CONNECTION
74556 field_addr.name = "id";
74557#endif /* FREECIV_JSON_CONNECTION */
74558 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
74559 RECEIVE_PACKET_FIELD_ERROR(id);
74560 }
74561
74562#else /* FREECIV_DELTA_PROTOCOL */
74563#ifdef FREECIV_JSON_CONNECTION
74564 field_addr.name = "id";
74565#endif /* FREECIV_JSON_CONNECTION */
74566 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
74567 RECEIVE_PACKET_FIELD_ERROR(id);
74568 }
74569#ifdef FREECIV_JSON_CONNECTION
74570 field_addr.name = "name";
74571#endif /* FREECIV_JSON_CONNECTION */
74572 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
74573 RECEIVE_PACKET_FIELD_ERROR(name);
74574 }
74575#ifdef FREECIV_JSON_CONNECTION
74576 field_addr.name = "short_help";
74577#endif /* FREECIV_JSON_CONNECTION */
74578 if (!DIO_GET(string, &din, &field_addr, real_packet->short_help, sizeof(real_packet->short_help))) {
74579 RECEIVE_PACKET_FIELD_ERROR(short_help);
74580 }
74581#ifdef FREECIV_JSON_CONNECTION
74582 field_addr.name = "extra_help";
74583#endif /* FREECIV_JSON_CONNECTION */
74584 if (!DIO_GET(string, &din, &field_addr, real_packet->extra_help, sizeof(real_packet->extra_help))) {
74585 RECEIVE_PACKET_FIELD_ERROR(extra_help);
74586 }
74587#ifdef FREECIV_JSON_CONNECTION
74588 field_addr.name = "category";
74589#endif /* FREECIV_JSON_CONNECTION */
74590 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
74591 RECEIVE_PACKET_FIELD_ERROR(category);
74592 }
74593#endif
74594 log_packet_detailed("packet_server_setting_const_100: got info about (%d)",
74595 real_packet->id);
74596
74597#ifdef FREECIV_DELTA_PROTOCOL
74598 if (nullptr == *hash) {
74599 *hash = genhash_new_full(hash_packet_server_setting_const_100, cmp_packet_server_setting_const_100,
74600 nullptr, nullptr, nullptr, destroy_packet_server_setting_const);
74601 }
74602
74603 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74604 *real_packet = *old;
74605 } else {
74606 /* packet is already initialized empty */
74607 log_packet_detailed(" no old info");
74608 }
74609
74610 if (BV_ISSET(fields, 0)) {
74611 log_packet_detailed(" got field 'name'");
74612#ifdef FREECIV_JSON_CONNECTION
74613 field_addr.name = "name";
74614#endif /* FREECIV_JSON_CONNECTION */
74615 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
74616 RECEIVE_PACKET_FIELD_ERROR(name);
74617 }
74618 }
74619 if (BV_ISSET(fields, 1)) {
74620 log_packet_detailed(" got field 'short_help'");
74621#ifdef FREECIV_JSON_CONNECTION
74622 field_addr.name = "short_help";
74623#endif /* FREECIV_JSON_CONNECTION */
74624 if (!DIO_GET(string, &din, &field_addr, real_packet->short_help, sizeof(real_packet->short_help))) {
74625 RECEIVE_PACKET_FIELD_ERROR(short_help);
74626 }
74627 }
74628 if (BV_ISSET(fields, 2)) {
74629 log_packet_detailed(" got field 'extra_help'");
74630#ifdef FREECIV_JSON_CONNECTION
74631 field_addr.name = "extra_help";
74632#endif /* FREECIV_JSON_CONNECTION */
74633 if (!DIO_GET(string, &din, &field_addr, real_packet->extra_help, sizeof(real_packet->extra_help))) {
74634 RECEIVE_PACKET_FIELD_ERROR(extra_help);
74635 }
74636 }
74637 if (BV_ISSET(fields, 3)) {
74638 log_packet_detailed(" got field 'category'");
74639#ifdef FREECIV_JSON_CONNECTION
74640 field_addr.name = "category";
74641#endif /* FREECIV_JSON_CONNECTION */
74642 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
74643 RECEIVE_PACKET_FIELD_ERROR(category);
74644 }
74645 }
74646
74647 if (nullptr == old) {
74648 old = fc_malloc(sizeof(*old));
74649 init_packet_server_setting_const(old);
74650 *old = *real_packet;
74651 genhash_insert(*hash, old, old);
74652 } else {
74653 *old = *real_packet;
74654 }
74655
74656#endif /* FREECIV_DELTA_PROTOCOL */
74657 RECEIVE_PACKET_END(real_packet);
74658#undef FREE_PACKET_STRUCT
74659}
74660
74661 static int send_packet_server_setting_const_100(struct connection *pc, const struct packet_server_setting_const *packet)
74662{
74663 const struct packet_server_setting_const *real_packet = packet;
74664 int e;
74665#ifdef FREECIV_DELTA_PROTOCOL
74666 packet_server_setting_const_100_fields fields;
74667 struct packet_server_setting_const *old;
74668 bool differ;
74669 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_CONST;
74670 int different = 0;
74671#endif /* FREECIV_DELTA_PROTOCOL */
74672 SEND_PACKET_START(PACKET_SERVER_SETTING_CONST);
74673#ifdef FREECIV_JSON_CONNECTION
74674 struct plocation field_addr;
74675 {
74676 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
74677 field_addr = *field_addr_tmp;
74678 FC_FREE(field_addr_tmp);
74679 }
74680#endif /* FREECIV_JSON_CONNECTION */
74681
74682 log_packet_detailed("packet_server_setting_const_100: sending info about (%d)",
74683 real_packet->id);
74684
74685#ifdef FREECIV_DELTA_PROTOCOL
74686 if (nullptr == *hash) {
74687 *hash = genhash_new_full(hash_packet_server_setting_const_100, cmp_packet_server_setting_const_100,
74688 nullptr, nullptr, nullptr, destroy_packet_server_setting_const);
74689 }
74690 BV_CLR_ALL(fields);
74691
74692 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74693 old = fc_malloc(sizeof(*old));
74694 /* temporary bitcopy just to insert correctly */
74695 *old = *real_packet;
74696 genhash_insert(*hash, old, old);
74697 init_packet_server_setting_const(old);
74698 different = 1; /* Force to send. */
74699 }
74700 differ = (strcmp(old->name, real_packet->name) != 0);
74701 if (differ) {
74702 different++;
74703 BV_SET(fields, 0);
74704 }
74705
74706 differ = (strcmp(old->short_help, real_packet->short_help) != 0);
74707 if (differ) {
74708 different++;
74709 BV_SET(fields, 1);
74710 }
74711
74712 differ = (strcmp(old->extra_help, real_packet->extra_help) != 0);
74713 if (differ) {
74714 different++;
74715 BV_SET(fields, 2);
74716 }
74717
74718 differ = (old->category != real_packet->category);
74719 if (differ) {
74720 different++;
74721 BV_SET(fields, 3);
74722 }
74723
74724 if (different == 0) {
74725 log_packet_detailed(" no change -> discard");
74726 return 0;
74727 }
74728
74729#ifdef FREECIV_JSON_CONNECTION
74730 field_addr.name = "fields";
74731#endif /* FREECIV_JSON_CONNECTION */
74732 e = 0;
74733 e |= DIO_BV_PUT(&dout, &field_addr, fields);
74734 if (e) {
74735 log_packet_detailed("fields bitvector error detected");
74736 }
74737#ifdef FREECIV_JSON_CONNECTION
74738 field_addr.name = "id";
74739#endif /* FREECIV_JSON_CONNECTION */
74740 e = 0;
74741 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
74742 if (e) {
74743 log_packet_detailed("'id' field error detected");
74744 }
74745
74746 if (BV_ISSET(fields, 0)) {
74747 log_packet_detailed(" field 'name' has changed");
74748#ifdef FREECIV_JSON_CONNECTION
74749 field_addr.name = "name";
74750#endif /* FREECIV_JSON_CONNECTION */
74751 e = 0;
74752 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
74753 if (e) {
74754 log_packet_detailed("'name' field error detected");
74755 }
74756 }
74757 if (BV_ISSET(fields, 1)) {
74758 log_packet_detailed(" field 'short_help' has changed");
74759#ifdef FREECIV_JSON_CONNECTION
74760 field_addr.name = "short_help";
74761#endif /* FREECIV_JSON_CONNECTION */
74762 e = 0;
74763 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_help);
74764 if (e) {
74765 log_packet_detailed("'short_help' field error detected");
74766 }
74767 }
74768 if (BV_ISSET(fields, 2)) {
74769 log_packet_detailed(" field 'extra_help' has changed");
74770#ifdef FREECIV_JSON_CONNECTION
74771 field_addr.name = "extra_help";
74772#endif /* FREECIV_JSON_CONNECTION */
74773 e = 0;
74774 e |= DIO_PUT(string, &dout, &field_addr, real_packet->extra_help);
74775 if (e) {
74776 log_packet_detailed("'extra_help' field error detected");
74777 }
74778 }
74779 if (BV_ISSET(fields, 3)) {
74780 log_packet_detailed(" field 'category' has changed");
74781#ifdef FREECIV_JSON_CONNECTION
74782 field_addr.name = "category";
74783#endif /* FREECIV_JSON_CONNECTION */
74784 e = 0;
74785 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
74786 if (e) {
74787 log_packet_detailed("'category' field error detected");
74788 }
74789 }
74790
74791 *old = *real_packet;
74792#endif /* FREECIV_DELTA_PROTOCOL */
74793#ifndef FREECIV_DELTA_PROTOCOL
74794#ifdef FREECIV_JSON_CONNECTION
74795 field_addr.name = "id";
74796#endif /* FREECIV_JSON_CONNECTION */
74797 e = 0;
74798 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
74799 if (e) {
74800 log_packet_detailed("'id' field error detected");
74801 }
74802#ifdef FREECIV_JSON_CONNECTION
74803 field_addr.name = "name";
74804#endif /* FREECIV_JSON_CONNECTION */
74805 e = 0;
74806 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
74807 if (e) {
74808 log_packet_detailed("'name' field error detected");
74809 }
74810#ifdef FREECIV_JSON_CONNECTION
74811 field_addr.name = "short_help";
74812#endif /* FREECIV_JSON_CONNECTION */
74813 e = 0;
74814 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_help);
74815 if (e) {
74816 log_packet_detailed("'short_help' field error detected");
74817 }
74818#ifdef FREECIV_JSON_CONNECTION
74819 field_addr.name = "extra_help";
74820#endif /* FREECIV_JSON_CONNECTION */
74821 e = 0;
74822 e |= DIO_PUT(string, &dout, &field_addr, real_packet->extra_help);
74823 if (e) {
74824 log_packet_detailed("'extra_help' field error detected");
74825 }
74826#ifdef FREECIV_JSON_CONNECTION
74827 field_addr.name = "category";
74828#endif /* FREECIV_JSON_CONNECTION */
74829 e = 0;
74830 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
74831 if (e) {
74832 log_packet_detailed("'category' field error detected");
74833 }
74834
74835#endif
74836 SEND_PACKET_END(PACKET_SERVER_SETTING_CONST);
74837}
74838
74839 int send_packet_server_setting_const(struct connection *pc, const struct packet_server_setting_const *packet)
74840{
74841 if (!pc->used) {
74842 log_error("WARNING: trying to send data to the closed connection %s",
74843 conn_description(pc));
74844 return -1;
74845 }
74846 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_CONST].packet != nullptr, -1,
74847 "Handler for PACKET_SERVER_SETTING_CONST not installed");
74848 return pc->phs.handlers->send[PACKET_SERVER_SETTING_CONST].packet(pc, packet);
74849}
74850
74851 static inline void init_packet_server_setting_bool(struct packet_server_setting_bool *packet)
74852{
74853 memset(packet, 0, sizeof(*packet));
74854}
74855
74856#define free_packet_server_setting_bool(_packet) (void) 0
74857#define destroy_packet_server_setting_bool free
74858
74859#ifdef FREECIV_DELTA_PROTOCOL
74860static genhash_val_t hash_packet_server_setting_bool_100(const void *vkey)
74861{
74862 const struct packet_server_setting_bool *key = (const struct packet_server_setting_bool *) vkey;
74863 genhash_val_t result = 0;
74864
74865 result += key->id;
74866
74867 result &= 0xFFFFFFFF;
74868 return result;
74869}
74870
74871static bool cmp_packet_server_setting_bool_100(const void *vkey1, const void *vkey2)
74872{
74873 const struct packet_server_setting_bool *old = (const struct packet_server_setting_bool *) vkey1;
74874 const struct packet_server_setting_bool *real_packet = (const struct packet_server_setting_bool *) vkey2;
74875 bool differ;
74876
74877 differ = (old->id != real_packet->id);
74878
74879 return !differ;
74880}
74881 BV_DEFINE(packet_server_setting_bool_100_fields, 6);
74882#endif /* FREECIV_DELTA_PROTOCOL */
74883
74884 static struct packet_server_setting_bool *receive_packet_server_setting_bool_100(struct connection *pc)
74885{
74886#define FREE_PACKET_STRUCT(_packet) free_packet_server_setting_bool(_packet)
74887#ifdef FREECIV_DELTA_PROTOCOL
74888 packet_server_setting_bool_100_fields fields;
74889 struct packet_server_setting_bool *old;
74890 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_BOOL;
74891#endif /* FREECIV_DELTA_PROTOCOL */
74892 RECEIVE_PACKET_START(packet_server_setting_bool, real_packet);
74893#ifdef FREECIV_JSON_CONNECTION
74894 struct plocation field_addr;
74895 {
74896 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
74897 field_addr = *field_addr_tmp;
74898 FC_FREE(field_addr_tmp);
74899 }
74900#endif /* FREECIV_JSON_CONNECTION */
74901
74902#ifdef FREECIV_DELTA_PROTOCOL
74903#ifdef FREECIV_JSON_CONNECTION
74904 field_addr.name = "fields";
74905#endif /* FREECIV_JSON_CONNECTION */
74906 DIO_BV_GET(&din, &field_addr, fields);
74907#ifdef FREECIV_JSON_CONNECTION
74908 field_addr.name = "id";
74909#endif /* FREECIV_JSON_CONNECTION */
74910 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
74911 RECEIVE_PACKET_FIELD_ERROR(id);
74912 }
74913
74914#else /* FREECIV_DELTA_PROTOCOL */
74915#ifdef FREECIV_JSON_CONNECTION
74916 field_addr.name = "id";
74917#endif /* FREECIV_JSON_CONNECTION */
74918 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
74919 RECEIVE_PACKET_FIELD_ERROR(id);
74920 }
74921#ifdef FREECIV_JSON_CONNECTION
74922 field_addr.name = "is_visible";
74923#endif /* FREECIV_JSON_CONNECTION */
74924 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
74925 RECEIVE_PACKET_FIELD_ERROR(is_visible);
74926 }
74927#ifdef FREECIV_JSON_CONNECTION
74928 field_addr.name = "is_changeable";
74929#endif /* FREECIV_JSON_CONNECTION */
74930 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
74931 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
74932 }
74933#ifdef FREECIV_JSON_CONNECTION
74934 field_addr.name = "initial_setting";
74935#endif /* FREECIV_JSON_CONNECTION */
74936 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
74937 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
74938 }
74939#ifdef FREECIV_JSON_CONNECTION
74940 field_addr.name = "setdef";
74941#endif /* FREECIV_JSON_CONNECTION */
74942 {
74943 int readin;
74944
74945 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
74946 RECEIVE_PACKET_FIELD_ERROR(setdef);
74947 }
74948 real_packet->setdef = readin;
74949 }
74950#ifdef FREECIV_JSON_CONNECTION
74951 field_addr.name = "val";
74952#endif /* FREECIV_JSON_CONNECTION */
74953 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->val)) {
74954 RECEIVE_PACKET_FIELD_ERROR(val);
74955 }
74956#ifdef FREECIV_JSON_CONNECTION
74957 field_addr.name = "default_val";
74958#endif /* FREECIV_JSON_CONNECTION */
74959 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->default_val)) {
74960 RECEIVE_PACKET_FIELD_ERROR(default_val);
74961 }
74962#endif
74963 log_packet_detailed("packet_server_setting_bool_100: got info about (%d)",
74964 real_packet->id);
74965
74966#ifdef FREECIV_DELTA_PROTOCOL
74967 if (nullptr == *hash) {
74968 *hash = genhash_new_full(hash_packet_server_setting_bool_100, cmp_packet_server_setting_bool_100,
74969 nullptr, nullptr, nullptr, destroy_packet_server_setting_bool);
74970 }
74971
74972 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74973 *real_packet = *old;
74974 } else {
74975 /* packet is already initialized empty */
74976 log_packet_detailed(" no old info");
74977 }
74978
74979 real_packet->is_visible = BV_ISSET(fields, 0);
74980 real_packet->is_changeable = BV_ISSET(fields, 1);
74981 real_packet->initial_setting = BV_ISSET(fields, 2);
74982 if (BV_ISSET(fields, 3)) {
74983 log_packet_detailed(" got field 'setdef'");
74984#ifdef FREECIV_JSON_CONNECTION
74985 field_addr.name = "setdef";
74986#endif /* FREECIV_JSON_CONNECTION */
74987 {
74988 int readin;
74989
74990 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
74991 RECEIVE_PACKET_FIELD_ERROR(setdef);
74992 }
74993 real_packet->setdef = readin;
74994 }
74995 }
74996 real_packet->val = BV_ISSET(fields, 4);
74997 real_packet->default_val = BV_ISSET(fields, 5);
74998
74999 if (nullptr == old) {
75000 old = fc_malloc(sizeof(*old));
75001 init_packet_server_setting_bool(old);
75002 *old = *real_packet;
75003 genhash_insert(*hash, old, old);
75004 } else {
75005 *old = *real_packet;
75006 }
75007
75008#endif /* FREECIV_DELTA_PROTOCOL */
75009 RECEIVE_PACKET_END(real_packet);
75010#undef FREE_PACKET_STRUCT
75011}
75012
75013 static int send_packet_server_setting_bool_100(struct connection *pc, const struct packet_server_setting_bool *packet)
75014{
75015 const struct packet_server_setting_bool *real_packet = packet;
75016 int e;
75017#ifdef FREECIV_DELTA_PROTOCOL
75018 packet_server_setting_bool_100_fields fields;
75019 struct packet_server_setting_bool *old;
75020 bool differ;
75021 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_BOOL;
75022 int different = 0;
75023#endif /* FREECIV_DELTA_PROTOCOL */
75024 SEND_PACKET_START(PACKET_SERVER_SETTING_BOOL);
75025#ifdef FREECIV_JSON_CONNECTION
75026 struct plocation field_addr;
75027 {
75028 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
75029 field_addr = *field_addr_tmp;
75030 FC_FREE(field_addr_tmp);
75031 }
75032#endif /* FREECIV_JSON_CONNECTION */
75033
75034 log_packet_detailed("packet_server_setting_bool_100: sending info about (%d)",
75035 real_packet->id);
75036
75037#ifdef FREECIV_DELTA_PROTOCOL
75038 if (nullptr == *hash) {
75039 *hash = genhash_new_full(hash_packet_server_setting_bool_100, cmp_packet_server_setting_bool_100,
75040 nullptr, nullptr, nullptr, destroy_packet_server_setting_bool);
75041 }
75042 BV_CLR_ALL(fields);
75043
75044 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75045 old = fc_malloc(sizeof(*old));
75046 /* temporary bitcopy just to insert correctly */
75047 *old = *real_packet;
75048 genhash_insert(*hash, old, old);
75049 init_packet_server_setting_bool(old);
75050 different = 1; /* Force to send. */
75051 }
75052 differ = (old->is_visible != real_packet->is_visible);
75053 if (differ) {
75054 different++;
75055 }
75056 if (packet->is_visible) {
75057 BV_SET(fields, 0);
75058 }
75059
75060 differ = (old->is_changeable != real_packet->is_changeable);
75061 if (differ) {
75062 different++;
75063 }
75064 if (packet->is_changeable) {
75065 BV_SET(fields, 1);
75066 }
75067
75068 differ = (old->initial_setting != real_packet->initial_setting);
75069 if (differ) {
75070 different++;
75071 }
75072 if (packet->initial_setting) {
75073 BV_SET(fields, 2);
75074 }
75075
75076 differ = (old->setdef != real_packet->setdef);
75077 if (differ) {
75078 different++;
75079 BV_SET(fields, 3);
75080 }
75081
75082 differ = (old->val != real_packet->val);
75083 if (differ) {
75084 different++;
75085 }
75086 if (packet->val) {
75087 BV_SET(fields, 4);
75088 }
75089
75090 differ = (old->default_val != real_packet->default_val);
75091 if (differ) {
75092 different++;
75093 }
75094 if (packet->default_val) {
75095 BV_SET(fields, 5);
75096 }
75097
75098 if (different == 0) {
75099 log_packet_detailed(" no change -> discard");
75100 return 0;
75101 }
75102
75103#ifdef FREECIV_JSON_CONNECTION
75104 field_addr.name = "fields";
75105#endif /* FREECIV_JSON_CONNECTION */
75106 e = 0;
75107 e |= DIO_BV_PUT(&dout, &field_addr, fields);
75108 if (e) {
75109 log_packet_detailed("fields bitvector error detected");
75110 }
75111#ifdef FREECIV_JSON_CONNECTION
75112 field_addr.name = "id";
75113#endif /* FREECIV_JSON_CONNECTION */
75114 e = 0;
75115 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
75116 if (e) {
75117 log_packet_detailed("'id' field error detected");
75118 }
75119
75120 /* field 0 is folded into the header */
75121 /* field 1 is folded into the header */
75122 /* field 2 is folded into the header */
75123 if (BV_ISSET(fields, 3)) {
75124 log_packet_detailed(" field 'setdef' has changed");
75125#ifdef FREECIV_JSON_CONNECTION
75126 field_addr.name = "setdef";
75127#endif /* FREECIV_JSON_CONNECTION */
75128 e = 0;
75129 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
75130 if (e) {
75131 log_packet_detailed("'setdef' field error detected");
75132 }
75133 }
75134 /* field 4 is folded into the header */
75135 /* field 5 is folded into the header */
75136
75137 *old = *real_packet;
75138#endif /* FREECIV_DELTA_PROTOCOL */
75139#ifndef FREECIV_DELTA_PROTOCOL
75140#ifdef FREECIV_JSON_CONNECTION
75141 field_addr.name = "id";
75142#endif /* FREECIV_JSON_CONNECTION */
75143 e = 0;
75144 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
75145 if (e) {
75146 log_packet_detailed("'id' field error detected");
75147 }
75148#ifdef FREECIV_JSON_CONNECTION
75149 field_addr.name = "is_visible";
75150#endif /* FREECIV_JSON_CONNECTION */
75151 e = 0;
75152 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
75153 if (e) {
75154 log_packet_detailed("'is_visible' field error detected");
75155 }
75156#ifdef FREECIV_JSON_CONNECTION
75157 field_addr.name = "is_changeable";
75158#endif /* FREECIV_JSON_CONNECTION */
75159 e = 0;
75160 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
75161 if (e) {
75162 log_packet_detailed("'is_changeable' field error detected");
75163 }
75164#ifdef FREECIV_JSON_CONNECTION
75165 field_addr.name = "initial_setting";
75166#endif /* FREECIV_JSON_CONNECTION */
75167 e = 0;
75168 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
75169 if (e) {
75170 log_packet_detailed("'initial_setting' field error detected");
75171 }
75172#ifdef FREECIV_JSON_CONNECTION
75173 field_addr.name = "setdef";
75174#endif /* FREECIV_JSON_CONNECTION */
75175 e = 0;
75176 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
75177 if (e) {
75178 log_packet_detailed("'setdef' field error detected");
75179 }
75180#ifdef FREECIV_JSON_CONNECTION
75181 field_addr.name = "val";
75182#endif /* FREECIV_JSON_CONNECTION */
75183 e = 0;
75184 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->val);
75185 if (e) {
75186 log_packet_detailed("'val' field error detected");
75187 }
75188#ifdef FREECIV_JSON_CONNECTION
75189 field_addr.name = "default_val";
75190#endif /* FREECIV_JSON_CONNECTION */
75191 e = 0;
75192 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->default_val);
75193 if (e) {
75194 log_packet_detailed("'default_val' field error detected");
75195 }
75196
75197#endif
75198 SEND_PACKET_END(PACKET_SERVER_SETTING_BOOL);
75199}
75200
75201 int send_packet_server_setting_bool(struct connection *pc, const struct packet_server_setting_bool *packet)
75202{
75203 if (!pc->used) {
75204 log_error("WARNING: trying to send data to the closed connection %s",
75205 conn_description(pc));
75206 return -1;
75207 }
75208 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_BOOL].packet != nullptr, -1,
75209 "Handler for PACKET_SERVER_SETTING_BOOL not installed");
75210 return pc->phs.handlers->send[PACKET_SERVER_SETTING_BOOL].packet(pc, packet);
75211}
75212
75213 static inline void init_packet_server_setting_int(struct packet_server_setting_int *packet)
75214{
75215 memset(packet, 0, sizeof(*packet));
75216}
75217
75218#define free_packet_server_setting_int(_packet) (void) 0
75219#define destroy_packet_server_setting_int free
75220
75221#ifdef FREECIV_DELTA_PROTOCOL
75222static genhash_val_t hash_packet_server_setting_int_100(const void *vkey)
75223{
75224 const struct packet_server_setting_int *key = (const struct packet_server_setting_int *) vkey;
75225 genhash_val_t result = 0;
75226
75227 result += key->id;
75228
75229 result &= 0xFFFFFFFF;
75230 return result;
75231}
75232
75233static bool cmp_packet_server_setting_int_100(const void *vkey1, const void *vkey2)
75234{
75235 const struct packet_server_setting_int *old = (const struct packet_server_setting_int *) vkey1;
75236 const struct packet_server_setting_int *real_packet = (const struct packet_server_setting_int *) vkey2;
75237 bool differ;
75238
75239 differ = (old->id != real_packet->id);
75240
75241 return !differ;
75242}
75243 BV_DEFINE(packet_server_setting_int_100_fields, 8);
75244#endif /* FREECIV_DELTA_PROTOCOL */
75245
75246 static struct packet_server_setting_int *receive_packet_server_setting_int_100(struct connection *pc)
75247{
75248#define FREE_PACKET_STRUCT(_packet) free_packet_server_setting_int(_packet)
75249#ifdef FREECIV_DELTA_PROTOCOL
75250 packet_server_setting_int_100_fields fields;
75251 struct packet_server_setting_int *old;
75252 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_INT;
75253#endif /* FREECIV_DELTA_PROTOCOL */
75254 RECEIVE_PACKET_START(packet_server_setting_int, real_packet);
75255#ifdef FREECIV_JSON_CONNECTION
75256 struct plocation field_addr;
75257 {
75258 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
75259 field_addr = *field_addr_tmp;
75260 FC_FREE(field_addr_tmp);
75261 }
75262#endif /* FREECIV_JSON_CONNECTION */
75263
75264#ifdef FREECIV_DELTA_PROTOCOL
75265#ifdef FREECIV_JSON_CONNECTION
75266 field_addr.name = "fields";
75267#endif /* FREECIV_JSON_CONNECTION */
75268 DIO_BV_GET(&din, &field_addr, fields);
75269#ifdef FREECIV_JSON_CONNECTION
75270 field_addr.name = "id";
75271#endif /* FREECIV_JSON_CONNECTION */
75272 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
75273 RECEIVE_PACKET_FIELD_ERROR(id);
75274 }
75275
75276#else /* FREECIV_DELTA_PROTOCOL */
75277#ifdef FREECIV_JSON_CONNECTION
75278 field_addr.name = "id";
75279#endif /* FREECIV_JSON_CONNECTION */
75280 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
75281 RECEIVE_PACKET_FIELD_ERROR(id);
75282 }
75283#ifdef FREECIV_JSON_CONNECTION
75284 field_addr.name = "is_visible";
75285#endif /* FREECIV_JSON_CONNECTION */
75286 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
75287 RECEIVE_PACKET_FIELD_ERROR(is_visible);
75288 }
75289#ifdef FREECIV_JSON_CONNECTION
75290 field_addr.name = "is_changeable";
75291#endif /* FREECIV_JSON_CONNECTION */
75292 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
75293 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
75294 }
75295#ifdef FREECIV_JSON_CONNECTION
75296 field_addr.name = "initial_setting";
75297#endif /* FREECIV_JSON_CONNECTION */
75298 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
75299 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
75300 }
75301#ifdef FREECIV_JSON_CONNECTION
75302 field_addr.name = "setdef";
75303#endif /* FREECIV_JSON_CONNECTION */
75304 {
75305 int readin;
75306
75307 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75308 RECEIVE_PACKET_FIELD_ERROR(setdef);
75309 }
75310 real_packet->setdef = readin;
75311 }
75312#ifdef FREECIV_JSON_CONNECTION
75313 field_addr.name = "val";
75314#endif /* FREECIV_JSON_CONNECTION */
75315 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->val)) {
75316 RECEIVE_PACKET_FIELD_ERROR(val);
75317 }
75318#ifdef FREECIV_JSON_CONNECTION
75319 field_addr.name = "default_val";
75320#endif /* FREECIV_JSON_CONNECTION */
75321 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->default_val)) {
75322 RECEIVE_PACKET_FIELD_ERROR(default_val);
75323 }
75324#ifdef FREECIV_JSON_CONNECTION
75325 field_addr.name = "min_val";
75326#endif /* FREECIV_JSON_CONNECTION */
75327 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_val)) {
75328 RECEIVE_PACKET_FIELD_ERROR(min_val);
75329 }
75330#ifdef FREECIV_JSON_CONNECTION
75331 field_addr.name = "max_val";
75332#endif /* FREECIV_JSON_CONNECTION */
75333 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_val)) {
75334 RECEIVE_PACKET_FIELD_ERROR(max_val);
75335 }
75336#endif
75337 log_packet_detailed("packet_server_setting_int_100: got info about (%d)",
75338 real_packet->id);
75339
75340#ifdef FREECIV_DELTA_PROTOCOL
75341 if (nullptr == *hash) {
75342 *hash = genhash_new_full(hash_packet_server_setting_int_100, cmp_packet_server_setting_int_100,
75343 nullptr, nullptr, nullptr, destroy_packet_server_setting_int);
75344 }
75345
75346 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75347 *real_packet = *old;
75348 } else {
75349 /* packet is already initialized empty */
75350 log_packet_detailed(" no old info");
75351 }
75352
75353 real_packet->is_visible = BV_ISSET(fields, 0);
75354 real_packet->is_changeable = BV_ISSET(fields, 1);
75355 real_packet->initial_setting = BV_ISSET(fields, 2);
75356 if (BV_ISSET(fields, 3)) {
75357 log_packet_detailed(" got field 'setdef'");
75358#ifdef FREECIV_JSON_CONNECTION
75359 field_addr.name = "setdef";
75360#endif /* FREECIV_JSON_CONNECTION */
75361 {
75362 int readin;
75363
75364 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75365 RECEIVE_PACKET_FIELD_ERROR(setdef);
75366 }
75367 real_packet->setdef = readin;
75368 }
75369 }
75370 if (BV_ISSET(fields, 4)) {
75371 log_packet_detailed(" got field 'val'");
75372#ifdef FREECIV_JSON_CONNECTION
75373 field_addr.name = "val";
75374#endif /* FREECIV_JSON_CONNECTION */
75375 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->val)) {
75376 RECEIVE_PACKET_FIELD_ERROR(val);
75377 }
75378 }
75379 if (BV_ISSET(fields, 5)) {
75380 log_packet_detailed(" got field 'default_val'");
75381#ifdef FREECIV_JSON_CONNECTION
75382 field_addr.name = "default_val";
75383#endif /* FREECIV_JSON_CONNECTION */
75384 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->default_val)) {
75385 RECEIVE_PACKET_FIELD_ERROR(default_val);
75386 }
75387 }
75388 if (BV_ISSET(fields, 6)) {
75389 log_packet_detailed(" got field 'min_val'");
75390#ifdef FREECIV_JSON_CONNECTION
75391 field_addr.name = "min_val";
75392#endif /* FREECIV_JSON_CONNECTION */
75393 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_val)) {
75394 RECEIVE_PACKET_FIELD_ERROR(min_val);
75395 }
75396 }
75397 if (BV_ISSET(fields, 7)) {
75398 log_packet_detailed(" got field 'max_val'");
75399#ifdef FREECIV_JSON_CONNECTION
75400 field_addr.name = "max_val";
75401#endif /* FREECIV_JSON_CONNECTION */
75402 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_val)) {
75403 RECEIVE_PACKET_FIELD_ERROR(max_val);
75404 }
75405 }
75406
75407 if (nullptr == old) {
75408 old = fc_malloc(sizeof(*old));
75409 init_packet_server_setting_int(old);
75410 *old = *real_packet;
75411 genhash_insert(*hash, old, old);
75412 } else {
75413 *old = *real_packet;
75414 }
75415
75416#endif /* FREECIV_DELTA_PROTOCOL */
75417 RECEIVE_PACKET_END(real_packet);
75418#undef FREE_PACKET_STRUCT
75419}
75420
75421 static int send_packet_server_setting_int_100(struct connection *pc, const struct packet_server_setting_int *packet)
75422{
75423 const struct packet_server_setting_int *real_packet = packet;
75424 int e;
75425#ifdef FREECIV_DELTA_PROTOCOL
75426 packet_server_setting_int_100_fields fields;
75427 struct packet_server_setting_int *old;
75428 bool differ;
75429 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_INT;
75430 int different = 0;
75431#endif /* FREECIV_DELTA_PROTOCOL */
75432 SEND_PACKET_START(PACKET_SERVER_SETTING_INT);
75433#ifdef FREECIV_JSON_CONNECTION
75434 struct plocation field_addr;
75435 {
75436 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
75437 field_addr = *field_addr_tmp;
75438 FC_FREE(field_addr_tmp);
75439 }
75440#endif /* FREECIV_JSON_CONNECTION */
75441
75442 log_packet_detailed("packet_server_setting_int_100: sending info about (%d)",
75443 real_packet->id);
75444
75445#ifdef FREECIV_DELTA_PROTOCOL
75446 if (nullptr == *hash) {
75447 *hash = genhash_new_full(hash_packet_server_setting_int_100, cmp_packet_server_setting_int_100,
75448 nullptr, nullptr, nullptr, destroy_packet_server_setting_int);
75449 }
75450 BV_CLR_ALL(fields);
75451
75452 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75453 old = fc_malloc(sizeof(*old));
75454 /* temporary bitcopy just to insert correctly */
75455 *old = *real_packet;
75456 genhash_insert(*hash, old, old);
75457 init_packet_server_setting_int(old);
75458 different = 1; /* Force to send. */
75459 }
75460 differ = (old->is_visible != real_packet->is_visible);
75461 if (differ) {
75462 different++;
75463 }
75464 if (packet->is_visible) {
75465 BV_SET(fields, 0);
75466 }
75467
75468 differ = (old->is_changeable != real_packet->is_changeable);
75469 if (differ) {
75470 different++;
75471 }
75472 if (packet->is_changeable) {
75473 BV_SET(fields, 1);
75474 }
75475
75476 differ = (old->initial_setting != real_packet->initial_setting);
75477 if (differ) {
75478 different++;
75479 }
75480 if (packet->initial_setting) {
75481 BV_SET(fields, 2);
75482 }
75483
75484 differ = (old->setdef != real_packet->setdef);
75485 if (differ) {
75486 different++;
75487 BV_SET(fields, 3);
75488 }
75489
75490 differ = (old->val != real_packet->val);
75491 if (differ) {
75492 different++;
75493 BV_SET(fields, 4);
75494 }
75495
75496 differ = (old->default_val != real_packet->default_val);
75497 if (differ) {
75498 different++;
75499 BV_SET(fields, 5);
75500 }
75501
75502 differ = (old->min_val != real_packet->min_val);
75503 if (differ) {
75504 different++;
75505 BV_SET(fields, 6);
75506 }
75507
75508 differ = (old->max_val != real_packet->max_val);
75509 if (differ) {
75510 different++;
75511 BV_SET(fields, 7);
75512 }
75513
75514 if (different == 0) {
75515 log_packet_detailed(" no change -> discard");
75516 return 0;
75517 }
75518
75519#ifdef FREECIV_JSON_CONNECTION
75520 field_addr.name = "fields";
75521#endif /* FREECIV_JSON_CONNECTION */
75522 e = 0;
75523 e |= DIO_BV_PUT(&dout, &field_addr, fields);
75524 if (e) {
75525 log_packet_detailed("fields bitvector error detected");
75526 }
75527#ifdef FREECIV_JSON_CONNECTION
75528 field_addr.name = "id";
75529#endif /* FREECIV_JSON_CONNECTION */
75530 e = 0;
75531 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
75532 if (e) {
75533 log_packet_detailed("'id' field error detected");
75534 }
75535
75536 /* field 0 is folded into the header */
75537 /* field 1 is folded into the header */
75538 /* field 2 is folded into the header */
75539 if (BV_ISSET(fields, 3)) {
75540 log_packet_detailed(" field 'setdef' has changed");
75541#ifdef FREECIV_JSON_CONNECTION
75542 field_addr.name = "setdef";
75543#endif /* FREECIV_JSON_CONNECTION */
75544 e = 0;
75545 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
75546 if (e) {
75547 log_packet_detailed("'setdef' field error detected");
75548 }
75549 }
75550 if (BV_ISSET(fields, 4)) {
75551 log_packet_detailed(" field 'val' has changed");
75552#ifdef FREECIV_JSON_CONNECTION
75553 field_addr.name = "val";
75554#endif /* FREECIV_JSON_CONNECTION */
75555 e = 0;
75556 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->val);
75557 if (e) {
75558 log_packet_detailed("'val' field error detected");
75559 }
75560 }
75561 if (BV_ISSET(fields, 5)) {
75562 log_packet_detailed(" field 'default_val' has changed");
75563#ifdef FREECIV_JSON_CONNECTION
75564 field_addr.name = "default_val";
75565#endif /* FREECIV_JSON_CONNECTION */
75566 e = 0;
75567 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->default_val);
75568 if (e) {
75569 log_packet_detailed("'default_val' field error detected");
75570 }
75571 }
75572 if (BV_ISSET(fields, 6)) {
75573 log_packet_detailed(" field 'min_val' has changed");
75574#ifdef FREECIV_JSON_CONNECTION
75575 field_addr.name = "min_val";
75576#endif /* FREECIV_JSON_CONNECTION */
75577 e = 0;
75578 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_val);
75579 if (e) {
75580 log_packet_detailed("'min_val' field error detected");
75581 }
75582 }
75583 if (BV_ISSET(fields, 7)) {
75584 log_packet_detailed(" field 'max_val' has changed");
75585#ifdef FREECIV_JSON_CONNECTION
75586 field_addr.name = "max_val";
75587#endif /* FREECIV_JSON_CONNECTION */
75588 e = 0;
75589 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_val);
75590 if (e) {
75591 log_packet_detailed("'max_val' field error detected");
75592 }
75593 }
75594
75595 *old = *real_packet;
75596#endif /* FREECIV_DELTA_PROTOCOL */
75597#ifndef FREECIV_DELTA_PROTOCOL
75598#ifdef FREECIV_JSON_CONNECTION
75599 field_addr.name = "id";
75600#endif /* FREECIV_JSON_CONNECTION */
75601 e = 0;
75602 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
75603 if (e) {
75604 log_packet_detailed("'id' field error detected");
75605 }
75606#ifdef FREECIV_JSON_CONNECTION
75607 field_addr.name = "is_visible";
75608#endif /* FREECIV_JSON_CONNECTION */
75609 e = 0;
75610 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
75611 if (e) {
75612 log_packet_detailed("'is_visible' field error detected");
75613 }
75614#ifdef FREECIV_JSON_CONNECTION
75615 field_addr.name = "is_changeable";
75616#endif /* FREECIV_JSON_CONNECTION */
75617 e = 0;
75618 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
75619 if (e) {
75620 log_packet_detailed("'is_changeable' field error detected");
75621 }
75622#ifdef FREECIV_JSON_CONNECTION
75623 field_addr.name = "initial_setting";
75624#endif /* FREECIV_JSON_CONNECTION */
75625 e = 0;
75626 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
75627 if (e) {
75628 log_packet_detailed("'initial_setting' field error detected");
75629 }
75630#ifdef FREECIV_JSON_CONNECTION
75631 field_addr.name = "setdef";
75632#endif /* FREECIV_JSON_CONNECTION */
75633 e = 0;
75634 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
75635 if (e) {
75636 log_packet_detailed("'setdef' field error detected");
75637 }
75638#ifdef FREECIV_JSON_CONNECTION
75639 field_addr.name = "val";
75640#endif /* FREECIV_JSON_CONNECTION */
75641 e = 0;
75642 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->val);
75643 if (e) {
75644 log_packet_detailed("'val' field error detected");
75645 }
75646#ifdef FREECIV_JSON_CONNECTION
75647 field_addr.name = "default_val";
75648#endif /* FREECIV_JSON_CONNECTION */
75649 e = 0;
75650 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->default_val);
75651 if (e) {
75652 log_packet_detailed("'default_val' field error detected");
75653 }
75654#ifdef FREECIV_JSON_CONNECTION
75655 field_addr.name = "min_val";
75656#endif /* FREECIV_JSON_CONNECTION */
75657 e = 0;
75658 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_val);
75659 if (e) {
75660 log_packet_detailed("'min_val' field error detected");
75661 }
75662#ifdef FREECIV_JSON_CONNECTION
75663 field_addr.name = "max_val";
75664#endif /* FREECIV_JSON_CONNECTION */
75665 e = 0;
75666 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_val);
75667 if (e) {
75668 log_packet_detailed("'max_val' field error detected");
75669 }
75670
75671#endif
75672 SEND_PACKET_END(PACKET_SERVER_SETTING_INT);
75673}
75674
75675 int send_packet_server_setting_int(struct connection *pc, const struct packet_server_setting_int *packet)
75676{
75677 if (!pc->used) {
75678 log_error("WARNING: trying to send data to the closed connection %s",
75679 conn_description(pc));
75680 return -1;
75681 }
75682 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_INT].packet != nullptr, -1,
75683 "Handler for PACKET_SERVER_SETTING_INT not installed");
75684 return pc->phs.handlers->send[PACKET_SERVER_SETTING_INT].packet(pc, packet);
75685}
75686
75687 static inline void init_packet_server_setting_str(struct packet_server_setting_str *packet)
75688{
75689 memset(packet, 0, sizeof(*packet));
75690}
75691
75692#define free_packet_server_setting_str(_packet) (void) 0
75693#define destroy_packet_server_setting_str free
75694
75695#ifdef FREECIV_DELTA_PROTOCOL
75696static genhash_val_t hash_packet_server_setting_str_100(const void *vkey)
75697{
75698 const struct packet_server_setting_str *key = (const struct packet_server_setting_str *) vkey;
75699 genhash_val_t result = 0;
75700
75701 result += key->id;
75702
75703 result &= 0xFFFFFFFF;
75704 return result;
75705}
75706
75707static bool cmp_packet_server_setting_str_100(const void *vkey1, const void *vkey2)
75708{
75709 const struct packet_server_setting_str *old = (const struct packet_server_setting_str *) vkey1;
75710 const struct packet_server_setting_str *real_packet = (const struct packet_server_setting_str *) vkey2;
75711 bool differ;
75712
75713 differ = (old->id != real_packet->id);
75714
75715 return !differ;
75716}
75717 BV_DEFINE(packet_server_setting_str_100_fields, 6);
75718#endif /* FREECIV_DELTA_PROTOCOL */
75719
75720 static struct packet_server_setting_str *receive_packet_server_setting_str_100(struct connection *pc)
75721{
75722#define FREE_PACKET_STRUCT(_packet) free_packet_server_setting_str(_packet)
75723#ifdef FREECIV_DELTA_PROTOCOL
75724 packet_server_setting_str_100_fields fields;
75725 struct packet_server_setting_str *old;
75726 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_STR;
75727#endif /* FREECIV_DELTA_PROTOCOL */
75728 RECEIVE_PACKET_START(packet_server_setting_str, real_packet);
75729#ifdef FREECIV_JSON_CONNECTION
75730 struct plocation field_addr;
75731 {
75732 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
75733 field_addr = *field_addr_tmp;
75734 FC_FREE(field_addr_tmp);
75735 }
75736#endif /* FREECIV_JSON_CONNECTION */
75737
75738#ifdef FREECIV_DELTA_PROTOCOL
75739#ifdef FREECIV_JSON_CONNECTION
75740 field_addr.name = "fields";
75741#endif /* FREECIV_JSON_CONNECTION */
75742 DIO_BV_GET(&din, &field_addr, fields);
75743#ifdef FREECIV_JSON_CONNECTION
75744 field_addr.name = "id";
75745#endif /* FREECIV_JSON_CONNECTION */
75746 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
75747 RECEIVE_PACKET_FIELD_ERROR(id);
75748 }
75749
75750#else /* FREECIV_DELTA_PROTOCOL */
75751#ifdef FREECIV_JSON_CONNECTION
75752 field_addr.name = "id";
75753#endif /* FREECIV_JSON_CONNECTION */
75754 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
75755 RECEIVE_PACKET_FIELD_ERROR(id);
75756 }
75757#ifdef FREECIV_JSON_CONNECTION
75758 field_addr.name = "is_visible";
75759#endif /* FREECIV_JSON_CONNECTION */
75760 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
75761 RECEIVE_PACKET_FIELD_ERROR(is_visible);
75762 }
75763#ifdef FREECIV_JSON_CONNECTION
75764 field_addr.name = "is_changeable";
75765#endif /* FREECIV_JSON_CONNECTION */
75766 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
75767 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
75768 }
75769#ifdef FREECIV_JSON_CONNECTION
75770 field_addr.name = "initial_setting";
75771#endif /* FREECIV_JSON_CONNECTION */
75772 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
75773 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
75774 }
75775#ifdef FREECIV_JSON_CONNECTION
75776 field_addr.name = "setdef";
75777#endif /* FREECIV_JSON_CONNECTION */
75778 {
75779 int readin;
75780
75781 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75782 RECEIVE_PACKET_FIELD_ERROR(setdef);
75783 }
75784 real_packet->setdef = readin;
75785 }
75786#ifdef FREECIV_JSON_CONNECTION
75787 field_addr.name = "val";
75788#endif /* FREECIV_JSON_CONNECTION */
75789 if (!DIO_GET(string, &din, &field_addr, real_packet->val, sizeof(real_packet->val))) {
75790 RECEIVE_PACKET_FIELD_ERROR(val);
75791 }
75792#ifdef FREECIV_JSON_CONNECTION
75793 field_addr.name = "default_val";
75794#endif /* FREECIV_JSON_CONNECTION */
75795 if (!DIO_GET(string, &din, &field_addr, real_packet->default_val, sizeof(real_packet->default_val))) {
75796 RECEIVE_PACKET_FIELD_ERROR(default_val);
75797 }
75798#endif
75799 log_packet_detailed("packet_server_setting_str_100: got info about (%d)",
75800 real_packet->id);
75801
75802#ifdef FREECIV_DELTA_PROTOCOL
75803 if (nullptr == *hash) {
75804 *hash = genhash_new_full(hash_packet_server_setting_str_100, cmp_packet_server_setting_str_100,
75805 nullptr, nullptr, nullptr, destroy_packet_server_setting_str);
75806 }
75807
75808 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75809 *real_packet = *old;
75810 } else {
75811 /* packet is already initialized empty */
75812 log_packet_detailed(" no old info");
75813 }
75814
75815 real_packet->is_visible = BV_ISSET(fields, 0);
75816 real_packet->is_changeable = BV_ISSET(fields, 1);
75817 real_packet->initial_setting = BV_ISSET(fields, 2);
75818 if (BV_ISSET(fields, 3)) {
75819 log_packet_detailed(" got field 'setdef'");
75820#ifdef FREECIV_JSON_CONNECTION
75821 field_addr.name = "setdef";
75822#endif /* FREECIV_JSON_CONNECTION */
75823 {
75824 int readin;
75825
75826 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75827 RECEIVE_PACKET_FIELD_ERROR(setdef);
75828 }
75829 real_packet->setdef = readin;
75830 }
75831 }
75832 if (BV_ISSET(fields, 4)) {
75833 log_packet_detailed(" got field 'val'");
75834#ifdef FREECIV_JSON_CONNECTION
75835 field_addr.name = "val";
75836#endif /* FREECIV_JSON_CONNECTION */
75837 if (!DIO_GET(string, &din, &field_addr, real_packet->val, sizeof(real_packet->val))) {
75838 RECEIVE_PACKET_FIELD_ERROR(val);
75839 }
75840 }
75841 if (BV_ISSET(fields, 5)) {
75842 log_packet_detailed(" got field 'default_val'");
75843#ifdef FREECIV_JSON_CONNECTION
75844 field_addr.name = "default_val";
75845#endif /* FREECIV_JSON_CONNECTION */
75846 if (!DIO_GET(string, &din, &field_addr, real_packet->default_val, sizeof(real_packet->default_val))) {
75847 RECEIVE_PACKET_FIELD_ERROR(default_val);
75848 }
75849 }
75850
75851 if (nullptr == old) {
75852 old = fc_malloc(sizeof(*old));
75853 init_packet_server_setting_str(old);
75854 *old = *real_packet;
75855 genhash_insert(*hash, old, old);
75856 } else {
75857 *old = *real_packet;
75858 }
75859
75860#endif /* FREECIV_DELTA_PROTOCOL */
75861 RECEIVE_PACKET_END(real_packet);
75862#undef FREE_PACKET_STRUCT
75863}
75864
75865 static int send_packet_server_setting_str_100(struct connection *pc, const struct packet_server_setting_str *packet)
75866{
75867 const struct packet_server_setting_str *real_packet = packet;
75868 int e;
75869#ifdef FREECIV_DELTA_PROTOCOL
75870 packet_server_setting_str_100_fields fields;
75871 struct packet_server_setting_str *old;
75872 bool differ;
75873 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_STR;
75874 int different = 0;
75875#endif /* FREECIV_DELTA_PROTOCOL */
75876 SEND_PACKET_START(PACKET_SERVER_SETTING_STR);
75877#ifdef FREECIV_JSON_CONNECTION
75878 struct plocation field_addr;
75879 {
75880 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
75881 field_addr = *field_addr_tmp;
75882 FC_FREE(field_addr_tmp);
75883 }
75884#endif /* FREECIV_JSON_CONNECTION */
75885
75886 log_packet_detailed("packet_server_setting_str_100: sending info about (%d)",
75887 real_packet->id);
75888
75889#ifdef FREECIV_DELTA_PROTOCOL
75890 if (nullptr == *hash) {
75891 *hash = genhash_new_full(hash_packet_server_setting_str_100, cmp_packet_server_setting_str_100,
75892 nullptr, nullptr, nullptr, destroy_packet_server_setting_str);
75893 }
75894 BV_CLR_ALL(fields);
75895
75896 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75897 old = fc_malloc(sizeof(*old));
75898 /* temporary bitcopy just to insert correctly */
75899 *old = *real_packet;
75900 genhash_insert(*hash, old, old);
75901 init_packet_server_setting_str(old);
75902 different = 1; /* Force to send. */
75903 }
75904 differ = (old->is_visible != real_packet->is_visible);
75905 if (differ) {
75906 different++;
75907 }
75908 if (packet->is_visible) {
75909 BV_SET(fields, 0);
75910 }
75911
75912 differ = (old->is_changeable != real_packet->is_changeable);
75913 if (differ) {
75914 different++;
75915 }
75916 if (packet->is_changeable) {
75917 BV_SET(fields, 1);
75918 }
75919
75920 differ = (old->initial_setting != real_packet->initial_setting);
75921 if (differ) {
75922 different++;
75923 }
75924 if (packet->initial_setting) {
75925 BV_SET(fields, 2);
75926 }
75927
75928 differ = (old->setdef != real_packet->setdef);
75929 if (differ) {
75930 different++;
75931 BV_SET(fields, 3);
75932 }
75933
75934 differ = (strcmp(old->val, real_packet->val) != 0);
75935 if (differ) {
75936 different++;
75937 BV_SET(fields, 4);
75938 }
75939
75940 differ = (strcmp(old->default_val, real_packet->default_val) != 0);
75941 if (differ) {
75942 different++;
75943 BV_SET(fields, 5);
75944 }
75945
75946 if (different == 0) {
75947 log_packet_detailed(" no change -> discard");
75948 return 0;
75949 }
75950
75951#ifdef FREECIV_JSON_CONNECTION
75952 field_addr.name = "fields";
75953#endif /* FREECIV_JSON_CONNECTION */
75954 e = 0;
75955 e |= DIO_BV_PUT(&dout, &field_addr, fields);
75956 if (e) {
75957 log_packet_detailed("fields bitvector error detected");
75958 }
75959#ifdef FREECIV_JSON_CONNECTION
75960 field_addr.name = "id";
75961#endif /* FREECIV_JSON_CONNECTION */
75962 e = 0;
75963 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
75964 if (e) {
75965 log_packet_detailed("'id' field error detected");
75966 }
75967
75968 /* field 0 is folded into the header */
75969 /* field 1 is folded into the header */
75970 /* field 2 is folded into the header */
75971 if (BV_ISSET(fields, 3)) {
75972 log_packet_detailed(" field 'setdef' has changed");
75973#ifdef FREECIV_JSON_CONNECTION
75974 field_addr.name = "setdef";
75975#endif /* FREECIV_JSON_CONNECTION */
75976 e = 0;
75977 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
75978 if (e) {
75979 log_packet_detailed("'setdef' field error detected");
75980 }
75981 }
75982 if (BV_ISSET(fields, 4)) {
75983 log_packet_detailed(" field 'val' has changed");
75984#ifdef FREECIV_JSON_CONNECTION
75985 field_addr.name = "val";
75986#endif /* FREECIV_JSON_CONNECTION */
75987 e = 0;
75988 e |= DIO_PUT(string, &dout, &field_addr, real_packet->val);
75989 if (e) {
75990 log_packet_detailed("'val' field error detected");
75991 }
75992 }
75993 if (BV_ISSET(fields, 5)) {
75994 log_packet_detailed(" field 'default_val' has changed");
75995#ifdef FREECIV_JSON_CONNECTION
75996 field_addr.name = "default_val";
75997#endif /* FREECIV_JSON_CONNECTION */
75998 e = 0;
75999 e |= DIO_PUT(string, &dout, &field_addr, real_packet->default_val);
76000 if (e) {
76001 log_packet_detailed("'default_val' field error detected");
76002 }
76003 }
76004
76005 *old = *real_packet;
76006#endif /* FREECIV_DELTA_PROTOCOL */
76007#ifndef FREECIV_DELTA_PROTOCOL
76008#ifdef FREECIV_JSON_CONNECTION
76009 field_addr.name = "id";
76010#endif /* FREECIV_JSON_CONNECTION */
76011 e = 0;
76012 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
76013 if (e) {
76014 log_packet_detailed("'id' field error detected");
76015 }
76016#ifdef FREECIV_JSON_CONNECTION
76017 field_addr.name = "is_visible";
76018#endif /* FREECIV_JSON_CONNECTION */
76019 e = 0;
76020 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
76021 if (e) {
76022 log_packet_detailed("'is_visible' field error detected");
76023 }
76024#ifdef FREECIV_JSON_CONNECTION
76025 field_addr.name = "is_changeable";
76026#endif /* FREECIV_JSON_CONNECTION */
76027 e = 0;
76028 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
76029 if (e) {
76030 log_packet_detailed("'is_changeable' field error detected");
76031 }
76032#ifdef FREECIV_JSON_CONNECTION
76033 field_addr.name = "initial_setting";
76034#endif /* FREECIV_JSON_CONNECTION */
76035 e = 0;
76036 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
76037 if (e) {
76038 log_packet_detailed("'initial_setting' field error detected");
76039 }
76040#ifdef FREECIV_JSON_CONNECTION
76041 field_addr.name = "setdef";
76042#endif /* FREECIV_JSON_CONNECTION */
76043 e = 0;
76044 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
76045 if (e) {
76046 log_packet_detailed("'setdef' field error detected");
76047 }
76048#ifdef FREECIV_JSON_CONNECTION
76049 field_addr.name = "val";
76050#endif /* FREECIV_JSON_CONNECTION */
76051 e = 0;
76052 e |= DIO_PUT(string, &dout, &field_addr, real_packet->val);
76053 if (e) {
76054 log_packet_detailed("'val' field error detected");
76055 }
76056#ifdef FREECIV_JSON_CONNECTION
76057 field_addr.name = "default_val";
76058#endif /* FREECIV_JSON_CONNECTION */
76059 e = 0;
76060 e |= DIO_PUT(string, &dout, &field_addr, real_packet->default_val);
76061 if (e) {
76062 log_packet_detailed("'default_val' field error detected");
76063 }
76064
76065#endif
76066 SEND_PACKET_END(PACKET_SERVER_SETTING_STR);
76067}
76068
76069 int send_packet_server_setting_str(struct connection *pc, const struct packet_server_setting_str *packet)
76070{
76071 if (!pc->used) {
76072 log_error("WARNING: trying to send data to the closed connection %s",
76073 conn_description(pc));
76074 return -1;
76075 }
76076 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_STR].packet != nullptr, -1,
76077 "Handler for PACKET_SERVER_SETTING_STR not installed");
76078 return pc->phs.handlers->send[PACKET_SERVER_SETTING_STR].packet(pc, packet);
76079}
76080
76081 static inline void init_packet_server_setting_enum(struct packet_server_setting_enum *packet)
76082{
76083 memset(packet, 0, sizeof(*packet));
76084}
76085
76086#define free_packet_server_setting_enum(_packet) (void) 0
76087#define destroy_packet_server_setting_enum free
76088
76089#ifdef FREECIV_DELTA_PROTOCOL
76090static genhash_val_t hash_packet_server_setting_enum_100(const void *vkey)
76091{
76092 const struct packet_server_setting_enum *key = (const struct packet_server_setting_enum *) vkey;
76093 genhash_val_t result = 0;
76094
76095 result += key->id;
76096
76097 result &= 0xFFFFFFFF;
76098 return result;
76099}
76100
76101static bool cmp_packet_server_setting_enum_100(const void *vkey1, const void *vkey2)
76102{
76103 const struct packet_server_setting_enum *old = (const struct packet_server_setting_enum *) vkey1;
76104 const struct packet_server_setting_enum *real_packet = (const struct packet_server_setting_enum *) vkey2;
76105 bool differ;
76106
76107 differ = (old->id != real_packet->id);
76108
76109 return !differ;
76110}
76111 BV_DEFINE(packet_server_setting_enum_100_fields, 9);
76112#endif /* FREECIV_DELTA_PROTOCOL */
76113
76114 static struct packet_server_setting_enum *receive_packet_server_setting_enum_100(struct connection *pc)
76115{
76116#define FREE_PACKET_STRUCT(_packet) free_packet_server_setting_enum(_packet)
76117#ifdef FREECIV_DELTA_PROTOCOL
76118 packet_server_setting_enum_100_fields fields;
76119 struct packet_server_setting_enum *old;
76120 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_ENUM;
76121#endif /* FREECIV_DELTA_PROTOCOL */
76122 RECEIVE_PACKET_START(packet_server_setting_enum, real_packet);
76123#ifdef FREECIV_JSON_CONNECTION
76124 struct plocation field_addr;
76125 {
76126 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
76127 field_addr = *field_addr_tmp;
76128 FC_FREE(field_addr_tmp);
76129 }
76130#endif /* FREECIV_JSON_CONNECTION */
76131
76132#ifdef FREECIV_DELTA_PROTOCOL
76133#ifdef FREECIV_JSON_CONNECTION
76134 field_addr.name = "fields";
76135#endif /* FREECIV_JSON_CONNECTION */
76136 DIO_BV_GET(&din, &field_addr, fields);
76137#ifdef FREECIV_JSON_CONNECTION
76138 field_addr.name = "id";
76139#endif /* FREECIV_JSON_CONNECTION */
76140 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
76141 RECEIVE_PACKET_FIELD_ERROR(id);
76142 }
76143
76144#else /* FREECIV_DELTA_PROTOCOL */
76145#ifdef FREECIV_JSON_CONNECTION
76146 field_addr.name = "id";
76147#endif /* FREECIV_JSON_CONNECTION */
76148 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
76149 RECEIVE_PACKET_FIELD_ERROR(id);
76150 }
76151#ifdef FREECIV_JSON_CONNECTION
76152 field_addr.name = "is_visible";
76153#endif /* FREECIV_JSON_CONNECTION */
76154 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
76155 RECEIVE_PACKET_FIELD_ERROR(is_visible);
76156 }
76157#ifdef FREECIV_JSON_CONNECTION
76158 field_addr.name = "is_changeable";
76159#endif /* FREECIV_JSON_CONNECTION */
76160 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
76161 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
76162 }
76163#ifdef FREECIV_JSON_CONNECTION
76164 field_addr.name = "initial_setting";
76165#endif /* FREECIV_JSON_CONNECTION */
76166 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
76167 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
76168 }
76169#ifdef FREECIV_JSON_CONNECTION
76170 field_addr.name = "setdef";
76171#endif /* FREECIV_JSON_CONNECTION */
76172 {
76173 int readin;
76174
76175 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76176 RECEIVE_PACKET_FIELD_ERROR(setdef);
76177 }
76178 real_packet->setdef = readin;
76179 }
76180#ifdef FREECIV_JSON_CONNECTION
76181 field_addr.name = "val";
76182#endif /* FREECIV_JSON_CONNECTION */
76183 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->val)) {
76184 RECEIVE_PACKET_FIELD_ERROR(val);
76185 }
76186#ifdef FREECIV_JSON_CONNECTION
76187 field_addr.name = "default_val";
76188#endif /* FREECIV_JSON_CONNECTION */
76189 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->default_val)) {
76190 RECEIVE_PACKET_FIELD_ERROR(default_val);
76191 }
76192#ifdef FREECIV_JSON_CONNECTION
76193 field_addr.name = "values_num";
76194#endif /* FREECIV_JSON_CONNECTION */
76195 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->values_num)) {
76196 RECEIVE_PACKET_FIELD_ERROR(values_num);
76197 }
76198#ifdef FREECIV_JSON_CONNECTION
76199 field_addr.name = "support_names";
76200#endif /* FREECIV_JSON_CONNECTION */
76201 {
76202 int i;
76203
76204#ifdef FREECIV_JSON_CONNECTION
76205 /* Enter array. */
76206 field_addr.sub_location = plocation_elem_new(0);
76207#endif /* FREECIV_JSON_CONNECTION */
76208
76209 if (real_packet->values_num > 64) {
76210 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
76211 }
76212 for (i = 0; i < real_packet->values_num; i++) {
76213#ifdef FREECIV_JSON_CONNECTION
76214 field_addr.sub_location->number = i;
76215#endif /* FREECIV_JSON_CONNECTION */
76216 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
76217 RECEIVE_PACKET_FIELD_ERROR(support_names);
76218 }
76219 }
76220
76221#ifdef FREECIV_JSON_CONNECTION
76222 /* Exit array. */
76223 FC_FREE(field_addr.sub_location);
76224#endif /* FREECIV_JSON_CONNECTION */
76225 }
76226#ifdef FREECIV_JSON_CONNECTION
76227 field_addr.name = "pretty_names";
76228#endif /* FREECIV_JSON_CONNECTION */
76229 {
76230 int i;
76231
76232#ifdef FREECIV_JSON_CONNECTION
76233 /* Enter array. */
76234 field_addr.sub_location = plocation_elem_new(0);
76235#endif /* FREECIV_JSON_CONNECTION */
76236
76237 if (real_packet->values_num > 64) {
76238 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
76239 }
76240 for (i = 0; i < real_packet->values_num; i++) {
76241#ifdef FREECIV_JSON_CONNECTION
76242 field_addr.sub_location->number = i;
76243#endif /* FREECIV_JSON_CONNECTION */
76244 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
76245 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
76246 }
76247 }
76248
76249#ifdef FREECIV_JSON_CONNECTION
76250 /* Exit array. */
76251 FC_FREE(field_addr.sub_location);
76252#endif /* FREECIV_JSON_CONNECTION */
76253 }
76254#endif
76255 log_packet_detailed("packet_server_setting_enum_100: got info about (%d)",
76256 real_packet->id);
76257
76258#ifdef FREECIV_DELTA_PROTOCOL
76259 if (nullptr == *hash) {
76260 *hash = genhash_new_full(hash_packet_server_setting_enum_100, cmp_packet_server_setting_enum_100,
76261 nullptr, nullptr, nullptr, destroy_packet_server_setting_enum);
76262 }
76263
76264 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
76265 *real_packet = *old;
76266 } else {
76267 /* packet is already initialized empty */
76268 log_packet_detailed(" no old info");
76269 }
76270
76271 real_packet->is_visible = BV_ISSET(fields, 0);
76272 real_packet->is_changeable = BV_ISSET(fields, 1);
76273 real_packet->initial_setting = BV_ISSET(fields, 2);
76274 if (BV_ISSET(fields, 3)) {
76275 log_packet_detailed(" got field 'setdef'");
76276#ifdef FREECIV_JSON_CONNECTION
76277 field_addr.name = "setdef";
76278#endif /* FREECIV_JSON_CONNECTION */
76279 {
76280 int readin;
76281
76282 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76283 RECEIVE_PACKET_FIELD_ERROR(setdef);
76284 }
76285 real_packet->setdef = readin;
76286 }
76287 }
76288 if (BV_ISSET(fields, 4)) {
76289 log_packet_detailed(" got field 'val'");
76290#ifdef FREECIV_JSON_CONNECTION
76291 field_addr.name = "val";
76292#endif /* FREECIV_JSON_CONNECTION */
76293 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->val)) {
76294 RECEIVE_PACKET_FIELD_ERROR(val);
76295 }
76296 }
76297 if (BV_ISSET(fields, 5)) {
76298 log_packet_detailed(" got field 'default_val'");
76299#ifdef FREECIV_JSON_CONNECTION
76300 field_addr.name = "default_val";
76301#endif /* FREECIV_JSON_CONNECTION */
76302 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->default_val)) {
76303 RECEIVE_PACKET_FIELD_ERROR(default_val);
76304 }
76305 }
76306 if (BV_ISSET(fields, 6)) {
76307 log_packet_detailed(" got field 'values_num'");
76308#ifdef FREECIV_JSON_CONNECTION
76309 field_addr.name = "values_num";
76310#endif /* FREECIV_JSON_CONNECTION */
76311 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->values_num)) {
76312 RECEIVE_PACKET_FIELD_ERROR(values_num);
76313 }
76314 }
76315 if (BV_ISSET(fields, 7)) {
76316 log_packet_detailed(" got field 'support_names'");
76317#ifdef FREECIV_JSON_CONNECTION
76318 field_addr.name = "support_names";
76319#endif /* FREECIV_JSON_CONNECTION */
76320 {
76321 int i;
76322
76323#ifdef FREECIV_JSON_CONNECTION
76324 /* Enter array. */
76325 field_addr.sub_location = plocation_elem_new(0);
76326#endif /* FREECIV_JSON_CONNECTION */
76327
76328 if (real_packet->values_num > 64) {
76329 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
76330 }
76331 for (i = 0; i < real_packet->values_num; i++) {
76332#ifdef FREECIV_JSON_CONNECTION
76333 field_addr.sub_location->number = i;
76334#endif /* FREECIV_JSON_CONNECTION */
76335 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
76336 RECEIVE_PACKET_FIELD_ERROR(support_names);
76337 }
76338 }
76339
76340#ifdef FREECIV_JSON_CONNECTION
76341 /* Exit array. */
76342 FC_FREE(field_addr.sub_location);
76343#endif /* FREECIV_JSON_CONNECTION */
76344 }
76345 }
76346 if (BV_ISSET(fields, 8)) {
76347 log_packet_detailed(" got field 'pretty_names'");
76348#ifdef FREECIV_JSON_CONNECTION
76349 field_addr.name = "pretty_names";
76350#endif /* FREECIV_JSON_CONNECTION */
76351 {
76352 int i;
76353
76354#ifdef FREECIV_JSON_CONNECTION
76355 /* Enter array. */
76356 field_addr.sub_location = plocation_elem_new(0);
76357#endif /* FREECIV_JSON_CONNECTION */
76358
76359 if (real_packet->values_num > 64) {
76360 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
76361 }
76362 for (i = 0; i < real_packet->values_num; i++) {
76363#ifdef FREECIV_JSON_CONNECTION
76364 field_addr.sub_location->number = i;
76365#endif /* FREECIV_JSON_CONNECTION */
76366 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
76367 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
76368 }
76369 }
76370
76371#ifdef FREECIV_JSON_CONNECTION
76372 /* Exit array. */
76373 FC_FREE(field_addr.sub_location);
76374#endif /* FREECIV_JSON_CONNECTION */
76375 }
76376 }
76377
76378 if (nullptr == old) {
76379 old = fc_malloc(sizeof(*old));
76380 init_packet_server_setting_enum(old);
76381 *old = *real_packet;
76382 genhash_insert(*hash, old, old);
76383 } else {
76384 *old = *real_packet;
76385 }
76386
76387#endif /* FREECIV_DELTA_PROTOCOL */
76388 RECEIVE_PACKET_END(real_packet);
76389#undef FREE_PACKET_STRUCT
76390}
76391
76392 static int send_packet_server_setting_enum_100(struct connection *pc, const struct packet_server_setting_enum *packet)
76393{
76394 const struct packet_server_setting_enum *real_packet = packet;
76395 int e;
76396#ifdef FREECIV_DELTA_PROTOCOL
76397 packet_server_setting_enum_100_fields fields;
76398 struct packet_server_setting_enum *old;
76399 bool differ;
76400 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_ENUM;
76401 int different = 0;
76402#endif /* FREECIV_DELTA_PROTOCOL */
76403 SEND_PACKET_START(PACKET_SERVER_SETTING_ENUM);
76404#ifdef FREECIV_JSON_CONNECTION
76405 struct plocation field_addr;
76406 {
76407 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
76408 field_addr = *field_addr_tmp;
76409 FC_FREE(field_addr_tmp);
76410 }
76411#endif /* FREECIV_JSON_CONNECTION */
76412
76413 log_packet_detailed("packet_server_setting_enum_100: sending info about (%d)",
76414 real_packet->id);
76415
76416#ifdef FREECIV_DELTA_PROTOCOL
76417 if (nullptr == *hash) {
76418 *hash = genhash_new_full(hash_packet_server_setting_enum_100, cmp_packet_server_setting_enum_100,
76419 nullptr, nullptr, nullptr, destroy_packet_server_setting_enum);
76420 }
76421 BV_CLR_ALL(fields);
76422
76423 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
76424 old = fc_malloc(sizeof(*old));
76425 /* temporary bitcopy just to insert correctly */
76426 *old = *real_packet;
76427 genhash_insert(*hash, old, old);
76428 init_packet_server_setting_enum(old);
76429 different = 1; /* Force to send. */
76430 }
76431 differ = (old->is_visible != real_packet->is_visible);
76432 if (differ) {
76433 different++;
76434 }
76435 if (packet->is_visible) {
76436 BV_SET(fields, 0);
76437 }
76438
76439 differ = (old->is_changeable != real_packet->is_changeable);
76440 if (differ) {
76441 different++;
76442 }
76443 if (packet->is_changeable) {
76444 BV_SET(fields, 1);
76445 }
76446
76447 differ = (old->initial_setting != real_packet->initial_setting);
76448 if (differ) {
76449 different++;
76450 }
76451 if (packet->initial_setting) {
76452 BV_SET(fields, 2);
76453 }
76454
76455 differ = (old->setdef != real_packet->setdef);
76456 if (differ) {
76457 different++;
76458 BV_SET(fields, 3);
76459 }
76460
76461 differ = (old->val != real_packet->val);
76462 if (differ) {
76463 different++;
76464 BV_SET(fields, 4);
76465 }
76466
76467 differ = (old->default_val != real_packet->default_val);
76468 if (differ) {
76469 different++;
76470 BV_SET(fields, 5);
76471 }
76472
76473 differ = (old->values_num != real_packet->values_num);
76474 if (differ) {
76475 different++;
76476 BV_SET(fields, 6);
76477 }
76478
76479 differ = (old->values_num != real_packet->values_num);
76480 if (!differ) {
76481 int i;
76482
76483 for (i = 0; i < real_packet->values_num; i++) {
76484 differ = (strcmp(old->support_names[i], real_packet->support_names[i]) != 0);
76485 if (differ) {
76486 break;
76487 }
76488 }
76489 }
76490 if (differ) {
76491 different++;
76492 BV_SET(fields, 7);
76493 }
76494
76495 differ = (old->values_num != real_packet->values_num);
76496 if (!differ) {
76497 int i;
76498
76499 for (i = 0; i < real_packet->values_num; i++) {
76500 differ = (strcmp(old->pretty_names[i], real_packet->pretty_names[i]) != 0);
76501 if (differ) {
76502 break;
76503 }
76504 }
76505 }
76506 if (differ) {
76507 different++;
76508 BV_SET(fields, 8);
76509 }
76510
76511 if (different == 0) {
76512 log_packet_detailed(" no change -> discard");
76513 return 0;
76514 }
76515
76516#ifdef FREECIV_JSON_CONNECTION
76517 field_addr.name = "fields";
76518#endif /* FREECIV_JSON_CONNECTION */
76519 e = 0;
76520 e |= DIO_BV_PUT(&dout, &field_addr, fields);
76521 if (e) {
76522 log_packet_detailed("fields bitvector error detected");
76523 }
76524#ifdef FREECIV_JSON_CONNECTION
76525 field_addr.name = "id";
76526#endif /* FREECIV_JSON_CONNECTION */
76527 e = 0;
76528 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
76529 if (e) {
76530 log_packet_detailed("'id' field error detected");
76531 }
76532
76533 /* field 0 is folded into the header */
76534 /* field 1 is folded into the header */
76535 /* field 2 is folded into the header */
76536 if (BV_ISSET(fields, 3)) {
76537 log_packet_detailed(" field 'setdef' has changed");
76538#ifdef FREECIV_JSON_CONNECTION
76539 field_addr.name = "setdef";
76540#endif /* FREECIV_JSON_CONNECTION */
76541 e = 0;
76542 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
76543 if (e) {
76544 log_packet_detailed("'setdef' field error detected");
76545 }
76546 }
76547 if (BV_ISSET(fields, 4)) {
76548 log_packet_detailed(" field 'val' has changed");
76549#ifdef FREECIV_JSON_CONNECTION
76550 field_addr.name = "val";
76551#endif /* FREECIV_JSON_CONNECTION */
76552 e = 0;
76553 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->val);
76554 if (e) {
76555 log_packet_detailed("'val' field error detected");
76556 }
76557 }
76558 if (BV_ISSET(fields, 5)) {
76559 log_packet_detailed(" field 'default_val' has changed");
76560#ifdef FREECIV_JSON_CONNECTION
76561 field_addr.name = "default_val";
76562#endif /* FREECIV_JSON_CONNECTION */
76563 e = 0;
76564 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_val);
76565 if (e) {
76566 log_packet_detailed("'default_val' field error detected");
76567 }
76568 }
76569 if (BV_ISSET(fields, 6)) {
76570 log_packet_detailed(" field 'values_num' has changed");
76571#ifdef FREECIV_JSON_CONNECTION
76572 field_addr.name = "values_num";
76573#endif /* FREECIV_JSON_CONNECTION */
76574 e = 0;
76575 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->values_num);
76576 if (e) {
76577 log_packet_detailed("'values_num' field error detected");
76578 }
76579 }
76580 if (BV_ISSET(fields, 7)) {
76581 log_packet_detailed(" field 'support_names' has changed");
76582#ifdef FREECIV_JSON_CONNECTION
76583 field_addr.name = "support_names";
76584#endif /* FREECIV_JSON_CONNECTION */
76585 e = 0;
76586 {
76587 int i;
76588
76589#ifdef FREECIV_JSON_CONNECTION
76590 /* Create the array. */
76591 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
76592
76593 /* Enter the array. */
76594 field_addr.sub_location = plocation_elem_new(0);
76595#endif /* FREECIV_JSON_CONNECTION */
76596
76597 for (i = 0; i < real_packet->values_num; i++) {
76598#ifdef FREECIV_JSON_CONNECTION
76599 /* Next array element. */
76600 field_addr.sub_location->number = i;
76601#endif /* FREECIV_JSON_CONNECTION */
76602 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
76603 }
76604
76605#ifdef FREECIV_JSON_CONNECTION
76606 /* Exit array. */
76607 FC_FREE(field_addr.sub_location);
76608#endif /* FREECIV_JSON_CONNECTION */
76609 }
76610 if (e) {
76611 log_packet_detailed("'support_names' field error detected");
76612 }
76613 }
76614 if (BV_ISSET(fields, 8)) {
76615 log_packet_detailed(" field 'pretty_names' has changed");
76616#ifdef FREECIV_JSON_CONNECTION
76617 field_addr.name = "pretty_names";
76618#endif /* FREECIV_JSON_CONNECTION */
76619 e = 0;
76620 {
76621 int i;
76622
76623#ifdef FREECIV_JSON_CONNECTION
76624 /* Create the array. */
76625 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
76626
76627 /* Enter the array. */
76628 field_addr.sub_location = plocation_elem_new(0);
76629#endif /* FREECIV_JSON_CONNECTION */
76630
76631 for (i = 0; i < real_packet->values_num; i++) {
76632#ifdef FREECIV_JSON_CONNECTION
76633 /* Next array element. */
76634 field_addr.sub_location->number = i;
76635#endif /* FREECIV_JSON_CONNECTION */
76636 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
76637 }
76638
76639#ifdef FREECIV_JSON_CONNECTION
76640 /* Exit array. */
76641 FC_FREE(field_addr.sub_location);
76642#endif /* FREECIV_JSON_CONNECTION */
76643 }
76644 if (e) {
76645 log_packet_detailed("'pretty_names' field error detected");
76646 }
76647 }
76648
76649 *old = *real_packet;
76650#endif /* FREECIV_DELTA_PROTOCOL */
76651#ifndef FREECIV_DELTA_PROTOCOL
76652#ifdef FREECIV_JSON_CONNECTION
76653 field_addr.name = "id";
76654#endif /* FREECIV_JSON_CONNECTION */
76655 e = 0;
76656 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
76657 if (e) {
76658 log_packet_detailed("'id' field error detected");
76659 }
76660#ifdef FREECIV_JSON_CONNECTION
76661 field_addr.name = "is_visible";
76662#endif /* FREECIV_JSON_CONNECTION */
76663 e = 0;
76664 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
76665 if (e) {
76666 log_packet_detailed("'is_visible' field error detected");
76667 }
76668#ifdef FREECIV_JSON_CONNECTION
76669 field_addr.name = "is_changeable";
76670#endif /* FREECIV_JSON_CONNECTION */
76671 e = 0;
76672 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
76673 if (e) {
76674 log_packet_detailed("'is_changeable' field error detected");
76675 }
76676#ifdef FREECIV_JSON_CONNECTION
76677 field_addr.name = "initial_setting";
76678#endif /* FREECIV_JSON_CONNECTION */
76679 e = 0;
76680 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
76681 if (e) {
76682 log_packet_detailed("'initial_setting' field error detected");
76683 }
76684#ifdef FREECIV_JSON_CONNECTION
76685 field_addr.name = "setdef";
76686#endif /* FREECIV_JSON_CONNECTION */
76687 e = 0;
76688 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
76689 if (e) {
76690 log_packet_detailed("'setdef' field error detected");
76691 }
76692#ifdef FREECIV_JSON_CONNECTION
76693 field_addr.name = "val";
76694#endif /* FREECIV_JSON_CONNECTION */
76695 e = 0;
76696 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->val);
76697 if (e) {
76698 log_packet_detailed("'val' field error detected");
76699 }
76700#ifdef FREECIV_JSON_CONNECTION
76701 field_addr.name = "default_val";
76702#endif /* FREECIV_JSON_CONNECTION */
76703 e = 0;
76704 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_val);
76705 if (e) {
76706 log_packet_detailed("'default_val' field error detected");
76707 }
76708#ifdef FREECIV_JSON_CONNECTION
76709 field_addr.name = "values_num";
76710#endif /* FREECIV_JSON_CONNECTION */
76711 e = 0;
76712 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->values_num);
76713 if (e) {
76714 log_packet_detailed("'values_num' field error detected");
76715 }
76716#ifdef FREECIV_JSON_CONNECTION
76717 field_addr.name = "support_names";
76718#endif /* FREECIV_JSON_CONNECTION */
76719 e = 0;
76720 {
76721 int i;
76722
76723#ifdef FREECIV_JSON_CONNECTION
76724 /* Create the array. */
76725 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
76726
76727 /* Enter the array. */
76728 field_addr.sub_location = plocation_elem_new(0);
76729#endif /* FREECIV_JSON_CONNECTION */
76730
76731 for (i = 0; i < real_packet->values_num; i++) {
76732#ifdef FREECIV_JSON_CONNECTION
76733 /* Next array element. */
76734 field_addr.sub_location->number = i;
76735#endif /* FREECIV_JSON_CONNECTION */
76736 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
76737 }
76738
76739#ifdef FREECIV_JSON_CONNECTION
76740 /* Exit array. */
76741 FC_FREE(field_addr.sub_location);
76742#endif /* FREECIV_JSON_CONNECTION */
76743 }
76744 if (e) {
76745 log_packet_detailed("'support_names' field error detected");
76746 }
76747#ifdef FREECIV_JSON_CONNECTION
76748 field_addr.name = "pretty_names";
76749#endif /* FREECIV_JSON_CONNECTION */
76750 e = 0;
76751 {
76752 int i;
76753
76754#ifdef FREECIV_JSON_CONNECTION
76755 /* Create the array. */
76756 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
76757
76758 /* Enter the array. */
76759 field_addr.sub_location = plocation_elem_new(0);
76760#endif /* FREECIV_JSON_CONNECTION */
76761
76762 for (i = 0; i < real_packet->values_num; i++) {
76763#ifdef FREECIV_JSON_CONNECTION
76764 /* Next array element. */
76765 field_addr.sub_location->number = i;
76766#endif /* FREECIV_JSON_CONNECTION */
76767 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
76768 }
76769
76770#ifdef FREECIV_JSON_CONNECTION
76771 /* Exit array. */
76772 FC_FREE(field_addr.sub_location);
76773#endif /* FREECIV_JSON_CONNECTION */
76774 }
76775 if (e) {
76776 log_packet_detailed("'pretty_names' field error detected");
76777 }
76778
76779#endif
76780 SEND_PACKET_END(PACKET_SERVER_SETTING_ENUM);
76781}
76782
76783 int send_packet_server_setting_enum(struct connection *pc, const struct packet_server_setting_enum *packet)
76784{
76785 if (!pc->used) {
76786 log_error("WARNING: trying to send data to the closed connection %s",
76787 conn_description(pc));
76788 return -1;
76789 }
76790 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_ENUM].packet != nullptr, -1,
76791 "Handler for PACKET_SERVER_SETTING_ENUM not installed");
76792 return pc->phs.handlers->send[PACKET_SERVER_SETTING_ENUM].packet(pc, packet);
76793}
76794
76795 static inline void init_packet_server_setting_bitwise(struct packet_server_setting_bitwise *packet)
76796{
76797 memset(packet, 0, sizeof(*packet));
76798}
76799
76800#define free_packet_server_setting_bitwise(_packet) (void) 0
76801#define destroy_packet_server_setting_bitwise free
76802
76803#ifdef FREECIV_DELTA_PROTOCOL
76804static genhash_val_t hash_packet_server_setting_bitwise_100(const void *vkey)
76805{
76806 const struct packet_server_setting_bitwise *key = (const struct packet_server_setting_bitwise *) vkey;
76807 genhash_val_t result = 0;
76808
76809 result += key->id;
76810
76811 result &= 0xFFFFFFFF;
76812 return result;
76813}
76814
76815static bool cmp_packet_server_setting_bitwise_100(const void *vkey1, const void *vkey2)
76816{
76817 const struct packet_server_setting_bitwise *old = (const struct packet_server_setting_bitwise *) vkey1;
76818 const struct packet_server_setting_bitwise *real_packet = (const struct packet_server_setting_bitwise *) vkey2;
76819 bool differ;
76820
76821 differ = (old->id != real_packet->id);
76822
76823 return !differ;
76824}
76825 BV_DEFINE(packet_server_setting_bitwise_100_fields, 9);
76826#endif /* FREECIV_DELTA_PROTOCOL */
76827
76828 static struct packet_server_setting_bitwise *receive_packet_server_setting_bitwise_100(struct connection *pc)
76829{
76830#define FREE_PACKET_STRUCT(_packet) free_packet_server_setting_bitwise(_packet)
76831#ifdef FREECIV_DELTA_PROTOCOL
76832 packet_server_setting_bitwise_100_fields fields;
76833 struct packet_server_setting_bitwise *old;
76834 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_BITWISE;
76835#endif /* FREECIV_DELTA_PROTOCOL */
76836 RECEIVE_PACKET_START(packet_server_setting_bitwise, real_packet);
76837#ifdef FREECIV_JSON_CONNECTION
76838 struct plocation field_addr;
76839 {
76840 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
76841 field_addr = *field_addr_tmp;
76842 FC_FREE(field_addr_tmp);
76843 }
76844#endif /* FREECIV_JSON_CONNECTION */
76845
76846#ifdef FREECIV_DELTA_PROTOCOL
76847#ifdef FREECIV_JSON_CONNECTION
76848 field_addr.name = "fields";
76849#endif /* FREECIV_JSON_CONNECTION */
76850 DIO_BV_GET(&din, &field_addr, fields);
76851#ifdef FREECIV_JSON_CONNECTION
76852 field_addr.name = "id";
76853#endif /* FREECIV_JSON_CONNECTION */
76854 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
76855 RECEIVE_PACKET_FIELD_ERROR(id);
76856 }
76857
76858#else /* FREECIV_DELTA_PROTOCOL */
76859#ifdef FREECIV_JSON_CONNECTION
76860 field_addr.name = "id";
76861#endif /* FREECIV_JSON_CONNECTION */
76862 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
76863 RECEIVE_PACKET_FIELD_ERROR(id);
76864 }
76865#ifdef FREECIV_JSON_CONNECTION
76866 field_addr.name = "is_visible";
76867#endif /* FREECIV_JSON_CONNECTION */
76868 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
76869 RECEIVE_PACKET_FIELD_ERROR(is_visible);
76870 }
76871#ifdef FREECIV_JSON_CONNECTION
76872 field_addr.name = "is_changeable";
76873#endif /* FREECIV_JSON_CONNECTION */
76874 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
76875 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
76876 }
76877#ifdef FREECIV_JSON_CONNECTION
76878 field_addr.name = "initial_setting";
76879#endif /* FREECIV_JSON_CONNECTION */
76880 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
76881 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
76882 }
76883#ifdef FREECIV_JSON_CONNECTION
76884 field_addr.name = "setdef";
76885#endif /* FREECIV_JSON_CONNECTION */
76886 {
76887 int readin;
76888
76889 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76890 RECEIVE_PACKET_FIELD_ERROR(setdef);
76891 }
76892 real_packet->setdef = readin;
76893 }
76894#ifdef FREECIV_JSON_CONNECTION
76895 field_addr.name = "val";
76896#endif /* FREECIV_JSON_CONNECTION */
76897 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->val)) {
76898 RECEIVE_PACKET_FIELD_ERROR(val);
76899 }
76900#ifdef FREECIV_JSON_CONNECTION
76901 field_addr.name = "default_val";
76902#endif /* FREECIV_JSON_CONNECTION */
76903 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->default_val)) {
76904 RECEIVE_PACKET_FIELD_ERROR(default_val);
76905 }
76906#ifdef FREECIV_JSON_CONNECTION
76907 field_addr.name = "bits_num";
76908#endif /* FREECIV_JSON_CONNECTION */
76909 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bits_num)) {
76910 RECEIVE_PACKET_FIELD_ERROR(bits_num);
76911 }
76912#ifdef FREECIV_JSON_CONNECTION
76913 field_addr.name = "support_names";
76914#endif /* FREECIV_JSON_CONNECTION */
76915 {
76916 int i;
76917
76918#ifdef FREECIV_JSON_CONNECTION
76919 /* Enter array. */
76920 field_addr.sub_location = plocation_elem_new(0);
76921#endif /* FREECIV_JSON_CONNECTION */
76922
76923 if (real_packet->bits_num > 64) {
76924 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
76925 }
76926 for (i = 0; i < real_packet->bits_num; i++) {
76927#ifdef FREECIV_JSON_CONNECTION
76928 field_addr.sub_location->number = i;
76929#endif /* FREECIV_JSON_CONNECTION */
76930 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
76931 RECEIVE_PACKET_FIELD_ERROR(support_names);
76932 }
76933 }
76934
76935#ifdef FREECIV_JSON_CONNECTION
76936 /* Exit array. */
76937 FC_FREE(field_addr.sub_location);
76938#endif /* FREECIV_JSON_CONNECTION */
76939 }
76940#ifdef FREECIV_JSON_CONNECTION
76941 field_addr.name = "pretty_names";
76942#endif /* FREECIV_JSON_CONNECTION */
76943 {
76944 int i;
76945
76946#ifdef FREECIV_JSON_CONNECTION
76947 /* Enter array. */
76948 field_addr.sub_location = plocation_elem_new(0);
76949#endif /* FREECIV_JSON_CONNECTION */
76950
76951 if (real_packet->bits_num > 64) {
76952 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
76953 }
76954 for (i = 0; i < real_packet->bits_num; i++) {
76955#ifdef FREECIV_JSON_CONNECTION
76956 field_addr.sub_location->number = i;
76957#endif /* FREECIV_JSON_CONNECTION */
76958 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
76959 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
76960 }
76961 }
76962
76963#ifdef FREECIV_JSON_CONNECTION
76964 /* Exit array. */
76965 FC_FREE(field_addr.sub_location);
76966#endif /* FREECIV_JSON_CONNECTION */
76967 }
76968#endif
76969 log_packet_detailed("packet_server_setting_bitwise_100: got info about (%d)",
76970 real_packet->id);
76971
76972#ifdef FREECIV_DELTA_PROTOCOL
76973 if (nullptr == *hash) {
76974 *hash = genhash_new_full(hash_packet_server_setting_bitwise_100, cmp_packet_server_setting_bitwise_100,
76975 nullptr, nullptr, nullptr, destroy_packet_server_setting_bitwise);
76976 }
76977
76978 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
76979 *real_packet = *old;
76980 } else {
76981 /* packet is already initialized empty */
76982 log_packet_detailed(" no old info");
76983 }
76984
76985 real_packet->is_visible = BV_ISSET(fields, 0);
76986 real_packet->is_changeable = BV_ISSET(fields, 1);
76987 real_packet->initial_setting = BV_ISSET(fields, 2);
76988 if (BV_ISSET(fields, 3)) {
76989 log_packet_detailed(" got field 'setdef'");
76990#ifdef FREECIV_JSON_CONNECTION
76991 field_addr.name = "setdef";
76992#endif /* FREECIV_JSON_CONNECTION */
76993 {
76994 int readin;
76995
76996 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76997 RECEIVE_PACKET_FIELD_ERROR(setdef);
76998 }
76999 real_packet->setdef = readin;
77000 }
77001 }
77002 if (BV_ISSET(fields, 4)) {
77003 log_packet_detailed(" got field 'val'");
77004#ifdef FREECIV_JSON_CONNECTION
77005 field_addr.name = "val";
77006#endif /* FREECIV_JSON_CONNECTION */
77007 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->val)) {
77008 RECEIVE_PACKET_FIELD_ERROR(val);
77009 }
77010 }
77011 if (BV_ISSET(fields, 5)) {
77012 log_packet_detailed(" got field 'default_val'");
77013#ifdef FREECIV_JSON_CONNECTION
77014 field_addr.name = "default_val";
77015#endif /* FREECIV_JSON_CONNECTION */
77016 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->default_val)) {
77017 RECEIVE_PACKET_FIELD_ERROR(default_val);
77018 }
77019 }
77020 if (BV_ISSET(fields, 6)) {
77021 log_packet_detailed(" got field 'bits_num'");
77022#ifdef FREECIV_JSON_CONNECTION
77023 field_addr.name = "bits_num";
77024#endif /* FREECIV_JSON_CONNECTION */
77025 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bits_num)) {
77026 RECEIVE_PACKET_FIELD_ERROR(bits_num);
77027 }
77028 }
77029 if (BV_ISSET(fields, 7)) {
77030 log_packet_detailed(" got field 'support_names'");
77031#ifdef FREECIV_JSON_CONNECTION
77032 field_addr.name = "support_names";
77033#endif /* FREECIV_JSON_CONNECTION */
77034 {
77035 int i;
77036
77037#ifdef FREECIV_JSON_CONNECTION
77038 /* Enter array. */
77039 field_addr.sub_location = plocation_elem_new(0);
77040#endif /* FREECIV_JSON_CONNECTION */
77041
77042 if (real_packet->bits_num > 64) {
77043 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
77044 }
77045 for (i = 0; i < real_packet->bits_num; i++) {
77046#ifdef FREECIV_JSON_CONNECTION
77047 field_addr.sub_location->number = i;
77048#endif /* FREECIV_JSON_CONNECTION */
77049 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
77050 RECEIVE_PACKET_FIELD_ERROR(support_names);
77051 }
77052 }
77053
77054#ifdef FREECIV_JSON_CONNECTION
77055 /* Exit array. */
77056 FC_FREE(field_addr.sub_location);
77057#endif /* FREECIV_JSON_CONNECTION */
77058 }
77059 }
77060 if (BV_ISSET(fields, 8)) {
77061 log_packet_detailed(" got field 'pretty_names'");
77062#ifdef FREECIV_JSON_CONNECTION
77063 field_addr.name = "pretty_names";
77064#endif /* FREECIV_JSON_CONNECTION */
77065 {
77066 int i;
77067
77068#ifdef FREECIV_JSON_CONNECTION
77069 /* Enter array. */
77070 field_addr.sub_location = plocation_elem_new(0);
77071#endif /* FREECIV_JSON_CONNECTION */
77072
77073 if (real_packet->bits_num > 64) {
77074 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
77075 }
77076 for (i = 0; i < real_packet->bits_num; i++) {
77077#ifdef FREECIV_JSON_CONNECTION
77078 field_addr.sub_location->number = i;
77079#endif /* FREECIV_JSON_CONNECTION */
77080 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
77081 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
77082 }
77083 }
77084
77085#ifdef FREECIV_JSON_CONNECTION
77086 /* Exit array. */
77087 FC_FREE(field_addr.sub_location);
77088#endif /* FREECIV_JSON_CONNECTION */
77089 }
77090 }
77091
77092 if (nullptr == old) {
77093 old = fc_malloc(sizeof(*old));
77094 init_packet_server_setting_bitwise(old);
77095 *old = *real_packet;
77096 genhash_insert(*hash, old, old);
77097 } else {
77098 *old = *real_packet;
77099 }
77100
77101#endif /* FREECIV_DELTA_PROTOCOL */
77102 RECEIVE_PACKET_END(real_packet);
77103#undef FREE_PACKET_STRUCT
77104}
77105
77106 static int send_packet_server_setting_bitwise_100(struct connection *pc, const struct packet_server_setting_bitwise *packet)
77107{
77108 const struct packet_server_setting_bitwise *real_packet = packet;
77109 int e;
77110#ifdef FREECIV_DELTA_PROTOCOL
77111 packet_server_setting_bitwise_100_fields fields;
77112 struct packet_server_setting_bitwise *old;
77113 bool differ;
77114 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_BITWISE;
77115 int different = 0;
77116#endif /* FREECIV_DELTA_PROTOCOL */
77117 SEND_PACKET_START(PACKET_SERVER_SETTING_BITWISE);
77118#ifdef FREECIV_JSON_CONNECTION
77119 struct plocation field_addr;
77120 {
77121 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
77122 field_addr = *field_addr_tmp;
77123 FC_FREE(field_addr_tmp);
77124 }
77125#endif /* FREECIV_JSON_CONNECTION */
77126
77127 log_packet_detailed("packet_server_setting_bitwise_100: sending info about (%d)",
77128 real_packet->id);
77129
77130#ifdef FREECIV_DELTA_PROTOCOL
77131 if (nullptr == *hash) {
77132 *hash = genhash_new_full(hash_packet_server_setting_bitwise_100, cmp_packet_server_setting_bitwise_100,
77133 nullptr, nullptr, nullptr, destroy_packet_server_setting_bitwise);
77134 }
77135 BV_CLR_ALL(fields);
77136
77137 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
77138 old = fc_malloc(sizeof(*old));
77139 /* temporary bitcopy just to insert correctly */
77140 *old = *real_packet;
77141 genhash_insert(*hash, old, old);
77142 init_packet_server_setting_bitwise(old);
77143 different = 1; /* Force to send. */
77144 }
77145 differ = (old->is_visible != real_packet->is_visible);
77146 if (differ) {
77147 different++;
77148 }
77149 if (packet->is_visible) {
77150 BV_SET(fields, 0);
77151 }
77152
77153 differ = (old->is_changeable != real_packet->is_changeable);
77154 if (differ) {
77155 different++;
77156 }
77157 if (packet->is_changeable) {
77158 BV_SET(fields, 1);
77159 }
77160
77161 differ = (old->initial_setting != real_packet->initial_setting);
77162 if (differ) {
77163 different++;
77164 }
77165 if (packet->initial_setting) {
77166 BV_SET(fields, 2);
77167 }
77168
77169 differ = (old->setdef != real_packet->setdef);
77170 if (differ) {
77171 different++;
77172 BV_SET(fields, 3);
77173 }
77174
77175 differ = (old->val != real_packet->val);
77176 if (differ) {
77177 different++;
77178 BV_SET(fields, 4);
77179 }
77180
77181 differ = (old->default_val != real_packet->default_val);
77182 if (differ) {
77183 different++;
77184 BV_SET(fields, 5);
77185 }
77186
77187 differ = (old->bits_num != real_packet->bits_num);
77188 if (differ) {
77189 different++;
77190 BV_SET(fields, 6);
77191 }
77192
77193 differ = (old->bits_num != real_packet->bits_num);
77194 if (!differ) {
77195 int i;
77196
77197 for (i = 0; i < real_packet->bits_num; i++) {
77198 differ = (strcmp(old->support_names[i], real_packet->support_names[i]) != 0);
77199 if (differ) {
77200 break;
77201 }
77202 }
77203 }
77204 if (differ) {
77205 different++;
77206 BV_SET(fields, 7);
77207 }
77208
77209 differ = (old->bits_num != real_packet->bits_num);
77210 if (!differ) {
77211 int i;
77212
77213 for (i = 0; i < real_packet->bits_num; i++) {
77214 differ = (strcmp(old->pretty_names[i], real_packet->pretty_names[i]) != 0);
77215 if (differ) {
77216 break;
77217 }
77218 }
77219 }
77220 if (differ) {
77221 different++;
77222 BV_SET(fields, 8);
77223 }
77224
77225 if (different == 0) {
77226 log_packet_detailed(" no change -> discard");
77227 return 0;
77228 }
77229
77230#ifdef FREECIV_JSON_CONNECTION
77231 field_addr.name = "fields";
77232#endif /* FREECIV_JSON_CONNECTION */
77233 e = 0;
77234 e |= DIO_BV_PUT(&dout, &field_addr, fields);
77235 if (e) {
77236 log_packet_detailed("fields bitvector error detected");
77237 }
77238#ifdef FREECIV_JSON_CONNECTION
77239 field_addr.name = "id";
77240#endif /* FREECIV_JSON_CONNECTION */
77241 e = 0;
77242 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
77243 if (e) {
77244 log_packet_detailed("'id' field error detected");
77245 }
77246
77247 /* field 0 is folded into the header */
77248 /* field 1 is folded into the header */
77249 /* field 2 is folded into the header */
77250 if (BV_ISSET(fields, 3)) {
77251 log_packet_detailed(" field 'setdef' has changed");
77252#ifdef FREECIV_JSON_CONNECTION
77253 field_addr.name = "setdef";
77254#endif /* FREECIV_JSON_CONNECTION */
77255 e = 0;
77256 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
77257 if (e) {
77258 log_packet_detailed("'setdef' field error detected");
77259 }
77260 }
77261 if (BV_ISSET(fields, 4)) {
77262 log_packet_detailed(" field 'val' has changed");
77263#ifdef FREECIV_JSON_CONNECTION
77264 field_addr.name = "val";
77265#endif /* FREECIV_JSON_CONNECTION */
77266 e = 0;
77267 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->val);
77268 if (e) {
77269 log_packet_detailed("'val' field error detected");
77270 }
77271 }
77272 if (BV_ISSET(fields, 5)) {
77273 log_packet_detailed(" field 'default_val' has changed");
77274#ifdef FREECIV_JSON_CONNECTION
77275 field_addr.name = "default_val";
77276#endif /* FREECIV_JSON_CONNECTION */
77277 e = 0;
77278 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->default_val);
77279 if (e) {
77280 log_packet_detailed("'default_val' field error detected");
77281 }
77282 }
77283 if (BV_ISSET(fields, 6)) {
77284 log_packet_detailed(" field 'bits_num' has changed");
77285#ifdef FREECIV_JSON_CONNECTION
77286 field_addr.name = "bits_num";
77287#endif /* FREECIV_JSON_CONNECTION */
77288 e = 0;
77289 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bits_num);
77290 if (e) {
77291 log_packet_detailed("'bits_num' field error detected");
77292 }
77293 }
77294 if (BV_ISSET(fields, 7)) {
77295 log_packet_detailed(" field 'support_names' has changed");
77296#ifdef FREECIV_JSON_CONNECTION
77297 field_addr.name = "support_names";
77298#endif /* FREECIV_JSON_CONNECTION */
77299 e = 0;
77300 {
77301 int i;
77302
77303#ifdef FREECIV_JSON_CONNECTION
77304 /* Create the array. */
77305 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
77306
77307 /* Enter the array. */
77308 field_addr.sub_location = plocation_elem_new(0);
77309#endif /* FREECIV_JSON_CONNECTION */
77310
77311 for (i = 0; i < real_packet->bits_num; i++) {
77312#ifdef FREECIV_JSON_CONNECTION
77313 /* Next array element. */
77314 field_addr.sub_location->number = i;
77315#endif /* FREECIV_JSON_CONNECTION */
77316 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
77317 }
77318
77319#ifdef FREECIV_JSON_CONNECTION
77320 /* Exit array. */
77321 FC_FREE(field_addr.sub_location);
77322#endif /* FREECIV_JSON_CONNECTION */
77323 }
77324 if (e) {
77325 log_packet_detailed("'support_names' field error detected");
77326 }
77327 }
77328 if (BV_ISSET(fields, 8)) {
77329 log_packet_detailed(" field 'pretty_names' has changed");
77330#ifdef FREECIV_JSON_CONNECTION
77331 field_addr.name = "pretty_names";
77332#endif /* FREECIV_JSON_CONNECTION */
77333 e = 0;
77334 {
77335 int i;
77336
77337#ifdef FREECIV_JSON_CONNECTION
77338 /* Create the array. */
77339 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
77340
77341 /* Enter the array. */
77342 field_addr.sub_location = plocation_elem_new(0);
77343#endif /* FREECIV_JSON_CONNECTION */
77344
77345 for (i = 0; i < real_packet->bits_num; i++) {
77346#ifdef FREECIV_JSON_CONNECTION
77347 /* Next array element. */
77348 field_addr.sub_location->number = i;
77349#endif /* FREECIV_JSON_CONNECTION */
77350 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
77351 }
77352
77353#ifdef FREECIV_JSON_CONNECTION
77354 /* Exit array. */
77355 FC_FREE(field_addr.sub_location);
77356#endif /* FREECIV_JSON_CONNECTION */
77357 }
77358 if (e) {
77359 log_packet_detailed("'pretty_names' field error detected");
77360 }
77361 }
77362
77363 *old = *real_packet;
77364#endif /* FREECIV_DELTA_PROTOCOL */
77365#ifndef FREECIV_DELTA_PROTOCOL
77366#ifdef FREECIV_JSON_CONNECTION
77367 field_addr.name = "id";
77368#endif /* FREECIV_JSON_CONNECTION */
77369 e = 0;
77370 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
77371 if (e) {
77372 log_packet_detailed("'id' field error detected");
77373 }
77374#ifdef FREECIV_JSON_CONNECTION
77375 field_addr.name = "is_visible";
77376#endif /* FREECIV_JSON_CONNECTION */
77377 e = 0;
77378 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
77379 if (e) {
77380 log_packet_detailed("'is_visible' field error detected");
77381 }
77382#ifdef FREECIV_JSON_CONNECTION
77383 field_addr.name = "is_changeable";
77384#endif /* FREECIV_JSON_CONNECTION */
77385 e = 0;
77386 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
77387 if (e) {
77388 log_packet_detailed("'is_changeable' field error detected");
77389 }
77390#ifdef FREECIV_JSON_CONNECTION
77391 field_addr.name = "initial_setting";
77392#endif /* FREECIV_JSON_CONNECTION */
77393 e = 0;
77394 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
77395 if (e) {
77396 log_packet_detailed("'initial_setting' field error detected");
77397 }
77398#ifdef FREECIV_JSON_CONNECTION
77399 field_addr.name = "setdef";
77400#endif /* FREECIV_JSON_CONNECTION */
77401 e = 0;
77402 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
77403 if (e) {
77404 log_packet_detailed("'setdef' field error detected");
77405 }
77406#ifdef FREECIV_JSON_CONNECTION
77407 field_addr.name = "val";
77408#endif /* FREECIV_JSON_CONNECTION */
77409 e = 0;
77410 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->val);
77411 if (e) {
77412 log_packet_detailed("'val' field error detected");
77413 }
77414#ifdef FREECIV_JSON_CONNECTION
77415 field_addr.name = "default_val";
77416#endif /* FREECIV_JSON_CONNECTION */
77417 e = 0;
77418 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->default_val);
77419 if (e) {
77420 log_packet_detailed("'default_val' field error detected");
77421 }
77422#ifdef FREECIV_JSON_CONNECTION
77423 field_addr.name = "bits_num";
77424#endif /* FREECIV_JSON_CONNECTION */
77425 e = 0;
77426 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bits_num);
77427 if (e) {
77428 log_packet_detailed("'bits_num' field error detected");
77429 }
77430#ifdef FREECIV_JSON_CONNECTION
77431 field_addr.name = "support_names";
77432#endif /* FREECIV_JSON_CONNECTION */
77433 e = 0;
77434 {
77435 int i;
77436
77437#ifdef FREECIV_JSON_CONNECTION
77438 /* Create the array. */
77439 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
77440
77441 /* Enter the array. */
77442 field_addr.sub_location = plocation_elem_new(0);
77443#endif /* FREECIV_JSON_CONNECTION */
77444
77445 for (i = 0; i < real_packet->bits_num; i++) {
77446#ifdef FREECIV_JSON_CONNECTION
77447 /* Next array element. */
77448 field_addr.sub_location->number = i;
77449#endif /* FREECIV_JSON_CONNECTION */
77450 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
77451 }
77452
77453#ifdef FREECIV_JSON_CONNECTION
77454 /* Exit array. */
77455 FC_FREE(field_addr.sub_location);
77456#endif /* FREECIV_JSON_CONNECTION */
77457 }
77458 if (e) {
77459 log_packet_detailed("'support_names' field error detected");
77460 }
77461#ifdef FREECIV_JSON_CONNECTION
77462 field_addr.name = "pretty_names";
77463#endif /* FREECIV_JSON_CONNECTION */
77464 e = 0;
77465 {
77466 int i;
77467
77468#ifdef FREECIV_JSON_CONNECTION
77469 /* Create the array. */
77470 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
77471
77472 /* Enter the array. */
77473 field_addr.sub_location = plocation_elem_new(0);
77474#endif /* FREECIV_JSON_CONNECTION */
77475
77476 for (i = 0; i < real_packet->bits_num; i++) {
77477#ifdef FREECIV_JSON_CONNECTION
77478 /* Next array element. */
77479 field_addr.sub_location->number = i;
77480#endif /* FREECIV_JSON_CONNECTION */
77481 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
77482 }
77483
77484#ifdef FREECIV_JSON_CONNECTION
77485 /* Exit array. */
77486 FC_FREE(field_addr.sub_location);
77487#endif /* FREECIV_JSON_CONNECTION */
77488 }
77489 if (e) {
77490 log_packet_detailed("'pretty_names' field error detected");
77491 }
77492
77493#endif
77494 SEND_PACKET_END(PACKET_SERVER_SETTING_BITWISE);
77495}
77496
77497 int send_packet_server_setting_bitwise(struct connection *pc, const struct packet_server_setting_bitwise *packet)
77498{
77499 if (!pc->used) {
77500 log_error("WARNING: trying to send data to the closed connection %s",
77501 conn_description(pc));
77502 return -1;
77503 }
77504 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_BITWISE].packet != nullptr, -1,
77505 "Handler for PACKET_SERVER_SETTING_BITWISE not installed");
77506 return pc->phs.handlers->send[PACKET_SERVER_SETTING_BITWISE].packet(pc, packet);
77507}
77508
77509 static inline void init_packet_set_topology(struct packet_set_topology *packet)
77510{
77511 memset(packet, 0, sizeof(*packet));
77512}
77513
77514#define free_packet_set_topology(_packet) (void) 0
77515#define destroy_packet_set_topology free
77516
77517#ifdef FREECIV_DELTA_PROTOCOL
77518#define hash_packet_set_topology_100 hash_const
77519
77520#define cmp_packet_set_topology_100 cmp_const
77521
77522 BV_DEFINE(packet_set_topology_100_fields, 2);
77523#endif /* FREECIV_DELTA_PROTOCOL */
77524
77525 static struct packet_set_topology *receive_packet_set_topology_100(struct connection *pc)
77526{
77527#define FREE_PACKET_STRUCT(_packet) free_packet_set_topology(_packet)
77528#ifdef FREECIV_DELTA_PROTOCOL
77529 packet_set_topology_100_fields fields;
77530 struct packet_set_topology *old;
77531 struct genhash **hash = pc->phs.received + PACKET_SET_TOPOLOGY;
77532#endif /* FREECIV_DELTA_PROTOCOL */
77533 RECEIVE_PACKET_START(packet_set_topology, real_packet);
77534#ifdef FREECIV_JSON_CONNECTION
77535 struct plocation field_addr;
77536 {
77537 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
77538 field_addr = *field_addr_tmp;
77539 FC_FREE(field_addr_tmp);
77540 }
77541#endif /* FREECIV_JSON_CONNECTION */
77542
77543#ifdef FREECIV_DELTA_PROTOCOL
77544#ifdef FREECIV_JSON_CONNECTION
77545 field_addr.name = "fields";
77546#endif /* FREECIV_JSON_CONNECTION */
77547 DIO_BV_GET(&din, &field_addr, fields);
77548
77549#else /* FREECIV_DELTA_PROTOCOL */
77550#ifdef FREECIV_JSON_CONNECTION
77551 field_addr.name = "topology_id";
77552#endif /* FREECIV_JSON_CONNECTION */
77553 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
77554 RECEIVE_PACKET_FIELD_ERROR(topology_id);
77555 }
77556#ifdef FREECIV_JSON_CONNECTION
77557 field_addr.name = "wrap_id";
77558#endif /* FREECIV_JSON_CONNECTION */
77559 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
77560 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
77561 }
77562#endif
77563 log_packet_detailed("packet_set_topology_100: got info about ()");
77564
77565#ifdef FREECIV_DELTA_PROTOCOL
77566 if (nullptr == *hash) {
77567 *hash = genhash_new_full(hash_packet_set_topology_100, cmp_packet_set_topology_100,
77568 nullptr, nullptr, nullptr, destroy_packet_set_topology);
77569 }
77570
77571 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
77572 *real_packet = *old;
77573 } else {
77574 /* packet is already initialized empty */
77575 log_packet_detailed(" no old info");
77576 }
77577
77578 if (BV_ISSET(fields, 0)) {
77579 log_packet_detailed(" got field 'topology_id'");
77580#ifdef FREECIV_JSON_CONNECTION
77581 field_addr.name = "topology_id";
77582#endif /* FREECIV_JSON_CONNECTION */
77583 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
77584 RECEIVE_PACKET_FIELD_ERROR(topology_id);
77585 }
77586 }
77587 if (BV_ISSET(fields, 1)) {
77588 log_packet_detailed(" got field 'wrap_id'");
77589#ifdef FREECIV_JSON_CONNECTION
77590 field_addr.name = "wrap_id";
77591#endif /* FREECIV_JSON_CONNECTION */
77592 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
77593 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
77594 }
77595 }
77596
77597 if (nullptr == old) {
77598 old = fc_malloc(sizeof(*old));
77599 init_packet_set_topology(old);
77600 *old = *real_packet;
77601 genhash_insert(*hash, old, old);
77602 } else {
77603 *old = *real_packet;
77604 }
77605
77606#endif /* FREECIV_DELTA_PROTOCOL */
77607 RECEIVE_PACKET_END(real_packet);
77608#undef FREE_PACKET_STRUCT
77609}
77610
77611 static int send_packet_set_topology_100(struct connection *pc, const struct packet_set_topology *packet)
77612{
77613 const struct packet_set_topology *real_packet = packet;
77614 int e;
77615#ifdef FREECIV_DELTA_PROTOCOL
77616 packet_set_topology_100_fields fields;
77617 struct packet_set_topology *old;
77618 bool differ;
77619 struct genhash **hash = pc->phs.sent + PACKET_SET_TOPOLOGY;
77620#endif /* FREECIV_DELTA_PROTOCOL */
77621 SEND_PACKET_START(PACKET_SET_TOPOLOGY);
77622#ifdef FREECIV_JSON_CONNECTION
77623 struct plocation field_addr;
77624 {
77625 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
77626 field_addr = *field_addr_tmp;
77627 FC_FREE(field_addr_tmp);
77628 }
77629#endif /* FREECIV_JSON_CONNECTION */
77630
77631 log_packet_detailed("packet_set_topology_100: sending info about ()");
77632
77633#ifdef FREECIV_DELTA_PROTOCOL
77634 if (nullptr == *hash) {
77635 *hash = genhash_new_full(hash_packet_set_topology_100, cmp_packet_set_topology_100,
77636 nullptr, nullptr, nullptr, destroy_packet_set_topology);
77637 }
77638 BV_CLR_ALL(fields);
77639
77640 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
77641 old = fc_malloc(sizeof(*old));
77642 /* temporary bitcopy just to insert correctly */
77643 *old = *real_packet;
77644 genhash_insert(*hash, old, old);
77645 init_packet_set_topology(old);
77646 }
77647 differ = (old->topology_id != real_packet->topology_id);
77648 if (differ) {
77649 BV_SET(fields, 0);
77650 }
77651
77652 differ = (old->wrap_id != real_packet->wrap_id);
77653 if (differ) {
77654 BV_SET(fields, 1);
77655 }
77656
77657
77658#ifdef FREECIV_JSON_CONNECTION
77659 field_addr.name = "fields";
77660#endif /* FREECIV_JSON_CONNECTION */
77661 e = 0;
77662 e |= DIO_BV_PUT(&dout, &field_addr, fields);
77663 if (e) {
77664 log_packet_detailed("fields bitvector error detected");
77665 }
77666
77667 if (BV_ISSET(fields, 0)) {
77668 log_packet_detailed(" field 'topology_id' has changed");
77669#ifdef FREECIV_JSON_CONNECTION
77670 field_addr.name = "topology_id";
77671#endif /* FREECIV_JSON_CONNECTION */
77672 e = 0;
77673 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
77674 if (e) {
77675 log_packet_detailed("'topology_id' field error detected");
77676 }
77677 }
77678 if (BV_ISSET(fields, 1)) {
77679 log_packet_detailed(" field 'wrap_id' has changed");
77680#ifdef FREECIV_JSON_CONNECTION
77681 field_addr.name = "wrap_id";
77682#endif /* FREECIV_JSON_CONNECTION */
77683 e = 0;
77684 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
77685 if (e) {
77686 log_packet_detailed("'wrap_id' field error detected");
77687 }
77688 }
77689
77690 *old = *real_packet;
77691#endif /* FREECIV_DELTA_PROTOCOL */
77692#ifndef FREECIV_DELTA_PROTOCOL
77693#ifdef FREECIV_JSON_CONNECTION
77694 field_addr.name = "topology_id";
77695#endif /* FREECIV_JSON_CONNECTION */
77696 e = 0;
77697 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
77698 if (e) {
77699 log_packet_detailed("'topology_id' field error detected");
77700 }
77701#ifdef FREECIV_JSON_CONNECTION
77702 field_addr.name = "wrap_id";
77703#endif /* FREECIV_JSON_CONNECTION */
77704 e = 0;
77705 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
77706 if (e) {
77707 log_packet_detailed("'wrap_id' field error detected");
77708 }
77709
77710#endif
77711 SEND_PACKET_END(PACKET_SET_TOPOLOGY);
77712}
77713
77714 int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
77715{
77716 if (!pc->used) {
77717 log_error("WARNING: trying to send data to the closed connection %s",
77718 conn_description(pc));
77719 return -1;
77720 }
77721 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SET_TOPOLOGY].packet != nullptr, -1,
77722 "Handler for PACKET_SET_TOPOLOGY not installed");
77723 return pc->phs.handlers->send[PACKET_SET_TOPOLOGY].packet(pc, packet);
77724}
77725
77726 static inline void init_packet_ruleset_effect(struct packet_ruleset_effect *packet)
77727{
77728 memset(packet, 0, sizeof(*packet));
77729}
77730
77731#define free_packet_ruleset_effect(_packet) (void) 0
77732#define destroy_packet_ruleset_effect free
77733
77734#ifdef FREECIV_DELTA_PROTOCOL
77735#define hash_packet_ruleset_effect_100 hash_const
77736
77737#define cmp_packet_ruleset_effect_100 cmp_const
77738
77739 BV_DEFINE(packet_ruleset_effect_100_fields, 6);
77740#endif /* FREECIV_DELTA_PROTOCOL */
77741
77742 static struct packet_ruleset_effect *receive_packet_ruleset_effect_100(struct connection *pc)
77743{
77744#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_effect(_packet)
77745#ifdef FREECIV_DELTA_PROTOCOL
77746 packet_ruleset_effect_100_fields fields;
77747 struct packet_ruleset_effect *old;
77748 struct genhash **hash = pc->phs.received + PACKET_RULESET_EFFECT;
77749#endif /* FREECIV_DELTA_PROTOCOL */
77750 RECEIVE_PACKET_START(packet_ruleset_effect, real_packet);
77751#ifdef FREECIV_JSON_CONNECTION
77752 struct plocation field_addr;
77753 {
77754 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
77755 field_addr = *field_addr_tmp;
77756 FC_FREE(field_addr_tmp);
77757 }
77758#endif /* FREECIV_JSON_CONNECTION */
77759
77760#ifdef FREECIV_DELTA_PROTOCOL
77761#ifdef FREECIV_JSON_CONNECTION
77762 field_addr.name = "fields";
77763#endif /* FREECIV_JSON_CONNECTION */
77764 DIO_BV_GET(&din, &field_addr, fields);
77765
77766#else /* FREECIV_DELTA_PROTOCOL */
77767#ifdef FREECIV_JSON_CONNECTION
77768 field_addr.name = "effect_type";
77769#endif /* FREECIV_JSON_CONNECTION */
77770 {
77771 int readin;
77772
77773 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77774 RECEIVE_PACKET_FIELD_ERROR(effect_type);
77775 }
77776 real_packet->effect_type = readin;
77777 }
77778#ifdef FREECIV_JSON_CONNECTION
77779 field_addr.name = "effect_value";
77780#endif /* FREECIV_JSON_CONNECTION */
77781 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->effect_value)) {
77782 RECEIVE_PACKET_FIELD_ERROR(effect_value);
77783 }
77784#ifdef FREECIV_JSON_CONNECTION
77785 field_addr.name = "has_multiplier";
77786#endif /* FREECIV_JSON_CONNECTION */
77787 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->has_multiplier)) {
77788 RECEIVE_PACKET_FIELD_ERROR(has_multiplier);
77789 }
77790#ifdef FREECIV_JSON_CONNECTION
77791 field_addr.name = "multiplier";
77792#endif /* FREECIV_JSON_CONNECTION */
77793 {
77794 int readin;
77795
77796 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77797 RECEIVE_PACKET_FIELD_ERROR(multiplier);
77798 }
77799 real_packet->multiplier = readin;
77800 }
77801#ifdef FREECIV_JSON_CONNECTION
77802 field_addr.name = "reqs_count";
77803#endif /* FREECIV_JSON_CONNECTION */
77804 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
77805 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
77806 }
77807#ifdef FREECIV_JSON_CONNECTION
77808 field_addr.name = "reqs";
77809#endif /* FREECIV_JSON_CONNECTION */
77810 {
77811 int i;
77812
77813#ifdef FREECIV_JSON_CONNECTION
77814 /* Enter array. */
77815 field_addr.sub_location = plocation_elem_new(0);
77816#endif /* FREECIV_JSON_CONNECTION */
77817
77818 if (real_packet->reqs_count > MAX_NUM_REQS) {
77819 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
77820 }
77821 for (i = 0; i < real_packet->reqs_count; i++) {
77822#ifdef FREECIV_JSON_CONNECTION
77823 field_addr.sub_location->number = i;
77824#endif /* FREECIV_JSON_CONNECTION */
77825 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
77826 RECEIVE_PACKET_FIELD_ERROR(reqs);
77827 }
77828 }
77829
77830#ifdef FREECIV_JSON_CONNECTION
77831 /* Exit array. */
77832 FC_FREE(field_addr.sub_location);
77833#endif /* FREECIV_JSON_CONNECTION */
77834 }
77835#endif
77836 log_packet_detailed("packet_ruleset_effect_100: got info about ()");
77837
77838#ifdef FREECIV_DELTA_PROTOCOL
77839 if (nullptr == *hash) {
77840 *hash = genhash_new_full(hash_packet_ruleset_effect_100, cmp_packet_ruleset_effect_100,
77841 nullptr, nullptr, nullptr, destroy_packet_ruleset_effect);
77842 }
77843
77844 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
77845 *real_packet = *old;
77846 } else {
77847 /* packet is already initialized empty */
77848 log_packet_detailed(" no old info");
77849 }
77850
77851 if (BV_ISSET(fields, 0)) {
77852 log_packet_detailed(" got field 'effect_type'");
77853#ifdef FREECIV_JSON_CONNECTION
77854 field_addr.name = "effect_type";
77855#endif /* FREECIV_JSON_CONNECTION */
77856 {
77857 int readin;
77858
77859 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77860 RECEIVE_PACKET_FIELD_ERROR(effect_type);
77861 }
77862 real_packet->effect_type = readin;
77863 }
77864 }
77865 if (BV_ISSET(fields, 1)) {
77866 log_packet_detailed(" got field 'effect_value'");
77867#ifdef FREECIV_JSON_CONNECTION
77868 field_addr.name = "effect_value";
77869#endif /* FREECIV_JSON_CONNECTION */
77870 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->effect_value)) {
77871 RECEIVE_PACKET_FIELD_ERROR(effect_value);
77872 }
77873 }
77874 real_packet->has_multiplier = BV_ISSET(fields, 2);
77875 if (BV_ISSET(fields, 3)) {
77876 log_packet_detailed(" got field 'multiplier'");
77877#ifdef FREECIV_JSON_CONNECTION
77878 field_addr.name = "multiplier";
77879#endif /* FREECIV_JSON_CONNECTION */
77880 {
77881 int readin;
77882
77883 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77884 RECEIVE_PACKET_FIELD_ERROR(multiplier);
77885 }
77886 real_packet->multiplier = readin;
77887 }
77888 }
77889 if (BV_ISSET(fields, 4)) {
77890 log_packet_detailed(" got field 'reqs_count'");
77891#ifdef FREECIV_JSON_CONNECTION
77892 field_addr.name = "reqs_count";
77893#endif /* FREECIV_JSON_CONNECTION */
77894 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
77895 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
77896 }
77897 }
77898 if (BV_ISSET(fields, 5)) {
77899 log_packet_detailed(" got field 'reqs'");
77900#ifdef FREECIV_JSON_CONNECTION
77901 field_addr.name = "reqs";
77902#endif /* FREECIV_JSON_CONNECTION */
77903 {
77904 int i;
77905
77906#ifdef FREECIV_JSON_CONNECTION
77907 /* Enter array. */
77908 field_addr.sub_location = plocation_elem_new(0);
77909#endif /* FREECIV_JSON_CONNECTION */
77910
77911 if (real_packet->reqs_count > MAX_NUM_REQS) {
77912 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
77913 }
77914 for (i = 0; i < real_packet->reqs_count; i++) {
77915#ifdef FREECIV_JSON_CONNECTION
77916 field_addr.sub_location->number = i;
77917#endif /* FREECIV_JSON_CONNECTION */
77918 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
77919 RECEIVE_PACKET_FIELD_ERROR(reqs);
77920 }
77921 }
77922
77923#ifdef FREECIV_JSON_CONNECTION
77924 /* Exit array. */
77925 FC_FREE(field_addr.sub_location);
77926#endif /* FREECIV_JSON_CONNECTION */
77927 }
77928 }
77929
77930 if (nullptr == old) {
77931 old = fc_malloc(sizeof(*old));
77932 init_packet_ruleset_effect(old);
77933 *old = *real_packet;
77934 genhash_insert(*hash, old, old);
77935 } else {
77936 *old = *real_packet;
77937 }
77938
77939#endif /* FREECIV_DELTA_PROTOCOL */
77940 RECEIVE_PACKET_END(real_packet);
77941#undef FREE_PACKET_STRUCT
77942}
77943
77944 static int send_packet_ruleset_effect_100(struct connection *pc, const struct packet_ruleset_effect *packet)
77945{
77946 const struct packet_ruleset_effect *real_packet = packet;
77947 int e;
77948#ifdef FREECIV_DELTA_PROTOCOL
77949 packet_ruleset_effect_100_fields fields;
77950 struct packet_ruleset_effect *old;
77951 bool differ;
77952 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EFFECT;
77953#endif /* FREECIV_DELTA_PROTOCOL */
77954 SEND_PACKET_START(PACKET_RULESET_EFFECT);
77955#ifdef FREECIV_JSON_CONNECTION
77956 struct plocation field_addr;
77957 {
77958 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
77959 field_addr = *field_addr_tmp;
77960 FC_FREE(field_addr_tmp);
77961 }
77962#endif /* FREECIV_JSON_CONNECTION */
77963
77964 log_packet_detailed("packet_ruleset_effect_100: sending info about ()");
77965
77966#ifdef FREECIV_DELTA_PROTOCOL
77967 if (nullptr == *hash) {
77968 *hash = genhash_new_full(hash_packet_ruleset_effect_100, cmp_packet_ruleset_effect_100,
77969 nullptr, nullptr, nullptr, destroy_packet_ruleset_effect);
77970 }
77971 BV_CLR_ALL(fields);
77972
77973 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
77974 old = fc_malloc(sizeof(*old));
77975 /* temporary bitcopy just to insert correctly */
77976 *old = *real_packet;
77977 genhash_insert(*hash, old, old);
77978 init_packet_ruleset_effect(old);
77979 }
77980 differ = (old->effect_type != real_packet->effect_type);
77981 if (differ) {
77982 BV_SET(fields, 0);
77983 }
77984
77985 differ = (old->effect_value != real_packet->effect_value);
77986 if (differ) {
77987 BV_SET(fields, 1);
77988 }
77989
77990 if (packet->has_multiplier) {
77991 BV_SET(fields, 2);
77992 }
77993
77994 differ = (old->multiplier != real_packet->multiplier);
77995 if (differ) {
77996 BV_SET(fields, 3);
77997 }
77998
77999 differ = (old->reqs_count != real_packet->reqs_count);
78000 if (differ) {
78001 BV_SET(fields, 4);
78002 }
78003
78004 differ = (old->reqs_count != real_packet->reqs_count);
78005 if (!differ) {
78006 int i;
78007
78008 for (i = 0; i < real_packet->reqs_count; i++) {
78009 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
78010 if (differ) {
78011 break;
78012 }
78013 }
78014 }
78015 if (differ) {
78016 BV_SET(fields, 5);
78017 }
78018
78019
78020#ifdef FREECIV_JSON_CONNECTION
78021 field_addr.name = "fields";
78022#endif /* FREECIV_JSON_CONNECTION */
78023 e = 0;
78024 e |= DIO_BV_PUT(&dout, &field_addr, fields);
78025 if (e) {
78026 log_packet_detailed("fields bitvector error detected");
78027 }
78028
78029 if (BV_ISSET(fields, 0)) {
78030 log_packet_detailed(" field 'effect_type' has changed");
78031#ifdef FREECIV_JSON_CONNECTION
78032 field_addr.name = "effect_type";
78033#endif /* FREECIV_JSON_CONNECTION */
78034 e = 0;
78035 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->effect_type);
78036 if (e) {
78037 log_packet_detailed("'effect_type' field error detected");
78038 }
78039 }
78040 if (BV_ISSET(fields, 1)) {
78041 log_packet_detailed(" field 'effect_value' has changed");
78042#ifdef FREECIV_JSON_CONNECTION
78043 field_addr.name = "effect_value";
78044#endif /* FREECIV_JSON_CONNECTION */
78045 e = 0;
78046 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->effect_value);
78047 if (e) {
78048 log_packet_detailed("'effect_value' field error detected");
78049 }
78050 }
78051 /* field 2 is folded into the header */
78052 if (BV_ISSET(fields, 3)) {
78053 log_packet_detailed(" field 'multiplier' has changed");
78054#ifdef FREECIV_JSON_CONNECTION
78055 field_addr.name = "multiplier";
78056#endif /* FREECIV_JSON_CONNECTION */
78057 e = 0;
78058 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multiplier);
78059 if (e) {
78060 log_packet_detailed("'multiplier' field error detected");
78061 }
78062 }
78063 if (BV_ISSET(fields, 4)) {
78064 log_packet_detailed(" field 'reqs_count' has changed");
78065#ifdef FREECIV_JSON_CONNECTION
78066 field_addr.name = "reqs_count";
78067#endif /* FREECIV_JSON_CONNECTION */
78068 e = 0;
78069 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
78070 if (e) {
78071 log_packet_detailed("'reqs_count' field error detected");
78072 }
78073 }
78074 if (BV_ISSET(fields, 5)) {
78075 log_packet_detailed(" field 'reqs' has changed");
78076#ifdef FREECIV_JSON_CONNECTION
78077 field_addr.name = "reqs";
78078#endif /* FREECIV_JSON_CONNECTION */
78079 e = 0;
78080 {
78081 int i;
78082
78083#ifdef FREECIV_JSON_CONNECTION
78084 /* Create the array. */
78085 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
78086
78087 /* Enter the array. */
78088 field_addr.sub_location = plocation_elem_new(0);
78089#endif /* FREECIV_JSON_CONNECTION */
78090
78091 for (i = 0; i < real_packet->reqs_count; i++) {
78092#ifdef FREECIV_JSON_CONNECTION
78093 /* Next array element. */
78094 field_addr.sub_location->number = i;
78095#endif /* FREECIV_JSON_CONNECTION */
78096 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
78097 }
78098
78099#ifdef FREECIV_JSON_CONNECTION
78100 /* Exit array. */
78101 FC_FREE(field_addr.sub_location);
78102#endif /* FREECIV_JSON_CONNECTION */
78103 }
78104 if (e) {
78105 log_packet_detailed("'reqs' field error detected");
78106 }
78107 }
78108
78109 *old = *real_packet;
78110#endif /* FREECIV_DELTA_PROTOCOL */
78111#ifndef FREECIV_DELTA_PROTOCOL
78112#ifdef FREECIV_JSON_CONNECTION
78113 field_addr.name = "effect_type";
78114#endif /* FREECIV_JSON_CONNECTION */
78115 e = 0;
78116 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->effect_type);
78117 if (e) {
78118 log_packet_detailed("'effect_type' field error detected");
78119 }
78120#ifdef FREECIV_JSON_CONNECTION
78121 field_addr.name = "effect_value";
78122#endif /* FREECIV_JSON_CONNECTION */
78123 e = 0;
78124 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->effect_value);
78125 if (e) {
78126 log_packet_detailed("'effect_value' field error detected");
78127 }
78128#ifdef FREECIV_JSON_CONNECTION
78129 field_addr.name = "has_multiplier";
78130#endif /* FREECIV_JSON_CONNECTION */
78131 e = 0;
78132 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->has_multiplier);
78133 if (e) {
78134 log_packet_detailed("'has_multiplier' field error detected");
78135 }
78136#ifdef FREECIV_JSON_CONNECTION
78137 field_addr.name = "multiplier";
78138#endif /* FREECIV_JSON_CONNECTION */
78139 e = 0;
78140 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multiplier);
78141 if (e) {
78142 log_packet_detailed("'multiplier' field error detected");
78143 }
78144#ifdef FREECIV_JSON_CONNECTION
78145 field_addr.name = "reqs_count";
78146#endif /* FREECIV_JSON_CONNECTION */
78147 e = 0;
78148 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
78149 if (e) {
78150 log_packet_detailed("'reqs_count' field error detected");
78151 }
78152#ifdef FREECIV_JSON_CONNECTION
78153 field_addr.name = "reqs";
78154#endif /* FREECIV_JSON_CONNECTION */
78155 e = 0;
78156 {
78157 int i;
78158
78159#ifdef FREECIV_JSON_CONNECTION
78160 /* Create the array. */
78161 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
78162
78163 /* Enter the array. */
78164 field_addr.sub_location = plocation_elem_new(0);
78165#endif /* FREECIV_JSON_CONNECTION */
78166
78167 for (i = 0; i < real_packet->reqs_count; i++) {
78168#ifdef FREECIV_JSON_CONNECTION
78169 /* Next array element. */
78170 field_addr.sub_location->number = i;
78171#endif /* FREECIV_JSON_CONNECTION */
78172 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
78173 }
78174
78175#ifdef FREECIV_JSON_CONNECTION
78176 /* Exit array. */
78177 FC_FREE(field_addr.sub_location);
78178#endif /* FREECIV_JSON_CONNECTION */
78179 }
78180 if (e) {
78181 log_packet_detailed("'reqs' field error detected");
78182 }
78183
78184#endif
78185 SEND_PACKET_END(PACKET_RULESET_EFFECT);
78186}
78187
78188 int send_packet_ruleset_effect(struct connection *pc, const struct packet_ruleset_effect *packet)
78189{
78190 if (!pc->used) {
78191 log_error("WARNING: trying to send data to the closed connection %s",
78192 conn_description(pc));
78193 return -1;
78194 }
78195 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EFFECT].packet != nullptr, -1,
78196 "Handler for PACKET_RULESET_EFFECT not installed");
78197 return pc->phs.handlers->send[PACKET_RULESET_EFFECT].packet(pc, packet);
78198}
78199
78200 void lsend_packet_ruleset_effect(struct conn_list *dest, const struct packet_ruleset_effect *packet)
78201{
78202 conn_list_iterate(dest, pconn) {
78203 send_packet_ruleset_effect(pconn, packet);
78204 } conn_list_iterate_end;
78205}
78206
78207 static inline void init_packet_ruleset_resource(struct packet_ruleset_resource *packet)
78208{
78209 memset(packet, 0, sizeof(*packet));
78210}
78211
78212#define free_packet_ruleset_resource(_packet) (void) 0
78213#define destroy_packet_ruleset_resource free
78214
78215#ifdef FREECIV_DELTA_PROTOCOL
78216#define hash_packet_ruleset_resource_100 hash_const
78217
78218#define cmp_packet_ruleset_resource_100 cmp_const
78219
78220 BV_DEFINE(packet_ruleset_resource_100_fields, 2);
78221#endif /* FREECIV_DELTA_PROTOCOL */
78222
78223 static struct packet_ruleset_resource *receive_packet_ruleset_resource_100(struct connection *pc)
78224{
78225#define FREE_PACKET_STRUCT(_packet) free_packet_ruleset_resource(_packet)
78226#ifdef FREECIV_DELTA_PROTOCOL
78227 packet_ruleset_resource_100_fields fields;
78228 struct packet_ruleset_resource *old;
78229 struct genhash **hash = pc->phs.received + PACKET_RULESET_RESOURCE;
78230#endif /* FREECIV_DELTA_PROTOCOL */
78231 RECEIVE_PACKET_START(packet_ruleset_resource, real_packet);
78232#ifdef FREECIV_JSON_CONNECTION
78233 struct plocation field_addr;
78234 {
78235 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
78236 field_addr = *field_addr_tmp;
78237 FC_FREE(field_addr_tmp);
78238 }
78239#endif /* FREECIV_JSON_CONNECTION */
78240
78241#ifdef FREECIV_DELTA_PROTOCOL
78242#ifdef FREECIV_JSON_CONNECTION
78243 field_addr.name = "fields";
78244#endif /* FREECIV_JSON_CONNECTION */
78245 DIO_BV_GET(&din, &field_addr, fields);
78246
78247#else /* FREECIV_DELTA_PROTOCOL */
78248#ifdef FREECIV_JSON_CONNECTION
78249 field_addr.name = "id";
78250#endif /* FREECIV_JSON_CONNECTION */
78251 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
78252 RECEIVE_PACKET_FIELD_ERROR(id);
78253 }
78254#ifdef FREECIV_JSON_CONNECTION
78255 field_addr.name = "output";
78256#endif /* FREECIV_JSON_CONNECTION */
78257 {
78258 int i;
78259
78260#ifdef FREECIV_JSON_CONNECTION
78261 /* Enter array. */
78262 field_addr.sub_location = plocation_elem_new(0);
78263#endif /* FREECIV_JSON_CONNECTION */
78264
78265 for (i = 0; i < O_LAST; i++) {
78266#ifdef FREECIV_JSON_CONNECTION
78267 field_addr.sub_location->number = i;
78268#endif /* FREECIV_JSON_CONNECTION */
78269 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
78270 RECEIVE_PACKET_FIELD_ERROR(output);
78271 }
78272 }
78273
78274#ifdef FREECIV_JSON_CONNECTION
78275 /* Exit array. */
78276 FC_FREE(field_addr.sub_location);
78277#endif /* FREECIV_JSON_CONNECTION */
78278 }
78279#endif
78280 log_packet_detailed("packet_ruleset_resource_100: got info about ()");
78281
78282#ifdef FREECIV_DELTA_PROTOCOL
78283 if (nullptr == *hash) {
78284 *hash = genhash_new_full(hash_packet_ruleset_resource_100, cmp_packet_ruleset_resource_100,
78285 nullptr, nullptr, nullptr, destroy_packet_ruleset_resource);
78286 }
78287
78288 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78289 *real_packet = *old;
78290 } else {
78291 /* packet is already initialized empty */
78292 log_packet_detailed(" no old info");
78293 }
78294
78295 if (BV_ISSET(fields, 0)) {
78296 log_packet_detailed(" got field 'id'");
78297#ifdef FREECIV_JSON_CONNECTION
78298 field_addr.name = "id";
78299#endif /* FREECIV_JSON_CONNECTION */
78300 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
78301 RECEIVE_PACKET_FIELD_ERROR(id);
78302 }
78303 }
78304 if (BV_ISSET(fields, 1)) {
78305 log_packet_detailed(" got field 'output'");
78306#ifdef FREECIV_JSON_CONNECTION
78307 field_addr.name = "output";
78308#endif /* FREECIV_JSON_CONNECTION */
78309 {
78310 int i;
78311
78312#ifdef FREECIV_JSON_CONNECTION
78313 /* Enter array. */
78314 field_addr.sub_location = plocation_elem_new(0);
78315#endif /* FREECIV_JSON_CONNECTION */
78316
78317 for (i = 0; i < O_LAST; i++) {
78318#ifdef FREECIV_JSON_CONNECTION
78319 field_addr.sub_location->number = i;
78320#endif /* FREECIV_JSON_CONNECTION */
78321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
78322 RECEIVE_PACKET_FIELD_ERROR(output);
78323 }
78324 }
78325
78326#ifdef FREECIV_JSON_CONNECTION
78327 /* Exit array. */
78328 FC_FREE(field_addr.sub_location);
78329#endif /* FREECIV_JSON_CONNECTION */
78330 }
78331 }
78332
78333 if (nullptr == old) {
78334 old = fc_malloc(sizeof(*old));
78335 init_packet_ruleset_resource(old);
78336 *old = *real_packet;
78337 genhash_insert(*hash, old, old);
78338 } else {
78339 *old = *real_packet;
78340 }
78341
78342#endif /* FREECIV_DELTA_PROTOCOL */
78343 RECEIVE_PACKET_END(real_packet);
78344#undef FREE_PACKET_STRUCT
78345}
78346
78347 static int send_packet_ruleset_resource_100(struct connection *pc, const struct packet_ruleset_resource *packet)
78348{
78349 const struct packet_ruleset_resource *real_packet = packet;
78350 int e;
78351#ifdef FREECIV_DELTA_PROTOCOL
78352 packet_ruleset_resource_100_fields fields;
78353 struct packet_ruleset_resource *old;
78354 bool differ;
78355 struct genhash **hash = pc->phs.sent + PACKET_RULESET_RESOURCE;
78356#endif /* FREECIV_DELTA_PROTOCOL */
78357 SEND_PACKET_START(PACKET_RULESET_RESOURCE);
78358#ifdef FREECIV_JSON_CONNECTION
78359 struct plocation field_addr;
78360 {
78361 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
78362 field_addr = *field_addr_tmp;
78363 FC_FREE(field_addr_tmp);
78364 }
78365#endif /* FREECIV_JSON_CONNECTION */
78366
78367 log_packet_detailed("packet_ruleset_resource_100: sending info about ()");
78368
78369#ifdef FREECIV_DELTA_PROTOCOL
78370 if (nullptr == *hash) {
78371 *hash = genhash_new_full(hash_packet_ruleset_resource_100, cmp_packet_ruleset_resource_100,
78372 nullptr, nullptr, nullptr, destroy_packet_ruleset_resource);
78373 }
78374 BV_CLR_ALL(fields);
78375
78376 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78377 old = fc_malloc(sizeof(*old));
78378 /* temporary bitcopy just to insert correctly */
78379 *old = *real_packet;
78380 genhash_insert(*hash, old, old);
78381 init_packet_ruleset_resource(old);
78382 }
78383 differ = (old->id != real_packet->id);
78384 if (differ) {
78385 BV_SET(fields, 0);
78386 }
78387
78388 differ = FALSE;
78389 {
78390 int i;
78391
78392 for (i = 0; i < O_LAST; i++) {
78393 differ = (old->output[i] != real_packet->output[i]);
78394 if (differ) {
78395 break;
78396 }
78397 }
78398 }
78399 if (differ) {
78400 BV_SET(fields, 1);
78401 }
78402
78403
78404#ifdef FREECIV_JSON_CONNECTION
78405 field_addr.name = "fields";
78406#endif /* FREECIV_JSON_CONNECTION */
78407 e = 0;
78408 e |= DIO_BV_PUT(&dout, &field_addr, fields);
78409 if (e) {
78410 log_packet_detailed("fields bitvector error detected");
78411 }
78412
78413 if (BV_ISSET(fields, 0)) {
78414 log_packet_detailed(" field 'id' has changed");
78415#ifdef FREECIV_JSON_CONNECTION
78416 field_addr.name = "id";
78417#endif /* FREECIV_JSON_CONNECTION */
78418 e = 0;
78419 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
78420 if (e) {
78421 log_packet_detailed("'id' field error detected");
78422 }
78423 }
78424 if (BV_ISSET(fields, 1)) {
78425 log_packet_detailed(" field 'output' has changed");
78426#ifdef FREECIV_JSON_CONNECTION
78427 field_addr.name = "output";
78428#endif /* FREECIV_JSON_CONNECTION */
78429 e = 0;
78430 {
78431 int i;
78432
78433#ifdef FREECIV_JSON_CONNECTION
78434 /* Create the array. */
78435 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
78436
78437 /* Enter the array. */
78438 field_addr.sub_location = plocation_elem_new(0);
78439#endif /* FREECIV_JSON_CONNECTION */
78440
78441 for (i = 0; i < O_LAST; i++) {
78442#ifdef FREECIV_JSON_CONNECTION
78443 /* Next array element. */
78444 field_addr.sub_location->number = i;
78445#endif /* FREECIV_JSON_CONNECTION */
78446 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
78447 }
78448
78449#ifdef FREECIV_JSON_CONNECTION
78450 /* Exit array. */
78451 FC_FREE(field_addr.sub_location);
78452#endif /* FREECIV_JSON_CONNECTION */
78453 }
78454 if (e) {
78455 log_packet_detailed("'output' field error detected");
78456 }
78457 }
78458
78459 *old = *real_packet;
78460#endif /* FREECIV_DELTA_PROTOCOL */
78461#ifndef FREECIV_DELTA_PROTOCOL
78462#ifdef FREECIV_JSON_CONNECTION
78463 field_addr.name = "id";
78464#endif /* FREECIV_JSON_CONNECTION */
78465 e = 0;
78466 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
78467 if (e) {
78468 log_packet_detailed("'id' field error detected");
78469 }
78470#ifdef FREECIV_JSON_CONNECTION
78471 field_addr.name = "output";
78472#endif /* FREECIV_JSON_CONNECTION */
78473 e = 0;
78474 {
78475 int i;
78476
78477#ifdef FREECIV_JSON_CONNECTION
78478 /* Create the array. */
78479 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
78480
78481 /* Enter the array. */
78482 field_addr.sub_location = plocation_elem_new(0);
78483#endif /* FREECIV_JSON_CONNECTION */
78484
78485 for (i = 0; i < O_LAST; i++) {
78486#ifdef FREECIV_JSON_CONNECTION
78487 /* Next array element. */
78488 field_addr.sub_location->number = i;
78489#endif /* FREECIV_JSON_CONNECTION */
78490 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
78491 }
78492
78493#ifdef FREECIV_JSON_CONNECTION
78494 /* Exit array. */
78495 FC_FREE(field_addr.sub_location);
78496#endif /* FREECIV_JSON_CONNECTION */
78497 }
78498 if (e) {
78499 log_packet_detailed("'output' field error detected");
78500 }
78501
78502#endif
78503 SEND_PACKET_END(PACKET_RULESET_RESOURCE);
78504}
78505
78506 int send_packet_ruleset_resource(struct connection *pc, const struct packet_ruleset_resource *packet)
78507{
78508 if (!pc->used) {
78509 log_error("WARNING: trying to send data to the closed connection %s",
78510 conn_description(pc));
78511 return -1;
78512 }
78513 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_RESOURCE].packet != nullptr, -1,
78514 "Handler for PACKET_RULESET_RESOURCE not installed");
78515 return pc->phs.handlers->send[PACKET_RULESET_RESOURCE].packet(pc, packet);
78516}
78517
78518 void lsend_packet_ruleset_resource(struct conn_list *dest, const struct packet_ruleset_resource *packet)
78519{
78520 conn_list_iterate(dest, pconn) {
78521 send_packet_ruleset_resource(pconn, packet);
78522 } conn_list_iterate_end;
78523}
78524
78525 static inline void init_packet_scenario_info(struct packet_scenario_info *packet)
78526{
78527 memset(packet, 0, sizeof(*packet));
78528}
78529
78530#define free_packet_scenario_info(_packet) (void) 0
78531#define destroy_packet_scenario_info free
78532
78533#ifdef FREECIV_DELTA_PROTOCOL
78534#define hash_packet_scenario_info_100 hash_const
78535
78536#define cmp_packet_scenario_info_100 cmp_const
78537
78538 BV_DEFINE(packet_scenario_info_100_fields, 14);
78539#endif /* FREECIV_DELTA_PROTOCOL */
78540
78541 static struct packet_scenario_info *receive_packet_scenario_info_100(struct connection *pc)
78542{
78543#define FREE_PACKET_STRUCT(_packet) free_packet_scenario_info(_packet)
78544#ifdef FREECIV_DELTA_PROTOCOL
78545 packet_scenario_info_100_fields fields;
78546 struct packet_scenario_info *old;
78547 struct genhash **hash = pc->phs.received + PACKET_SCENARIO_INFO;
78548#endif /* FREECIV_DELTA_PROTOCOL */
78549 RECEIVE_PACKET_START(packet_scenario_info, real_packet);
78550#ifdef FREECIV_JSON_CONNECTION
78551 struct plocation field_addr;
78552 {
78553 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
78554 field_addr = *field_addr_tmp;
78555 FC_FREE(field_addr_tmp);
78556 }
78557#endif /* FREECIV_JSON_CONNECTION */
78558
78559#ifdef FREECIV_DELTA_PROTOCOL
78560#ifdef FREECIV_JSON_CONNECTION
78561 field_addr.name = "fields";
78562#endif /* FREECIV_JSON_CONNECTION */
78563 DIO_BV_GET(&din, &field_addr, fields);
78564
78565#else /* FREECIV_DELTA_PROTOCOL */
78566#ifdef FREECIV_JSON_CONNECTION
78567 field_addr.name = "is_scenario";
78568#endif /* FREECIV_JSON_CONNECTION */
78569 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_scenario)) {
78570 RECEIVE_PACKET_FIELD_ERROR(is_scenario);
78571 }
78572#ifdef FREECIV_JSON_CONNECTION
78573 field_addr.name = "name";
78574#endif /* FREECIV_JSON_CONNECTION */
78575 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
78576 RECEIVE_PACKET_FIELD_ERROR(name);
78577 }
78578#ifdef FREECIV_JSON_CONNECTION
78579 field_addr.name = "authors";
78580#endif /* FREECIV_JSON_CONNECTION */
78581 if (!DIO_GET(string, &din, &field_addr, real_packet->authors, sizeof(real_packet->authors))) {
78582 RECEIVE_PACKET_FIELD_ERROR(authors);
78583 }
78584#ifdef FREECIV_JSON_CONNECTION
78585 field_addr.name = "players";
78586#endif /* FREECIV_JSON_CONNECTION */
78587 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->players)) {
78588 RECEIVE_PACKET_FIELD_ERROR(players);
78589 }
78590#ifdef FREECIV_JSON_CONNECTION
78591 field_addr.name = "startpos_nations";
78592#endif /* FREECIV_JSON_CONNECTION */
78593 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->startpos_nations)) {
78594 RECEIVE_PACKET_FIELD_ERROR(startpos_nations);
78595 }
78596#ifdef FREECIV_JSON_CONNECTION
78597 field_addr.name = "save_random";
78598#endif /* FREECIV_JSON_CONNECTION */
78599 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->save_random)) {
78600 RECEIVE_PACKET_FIELD_ERROR(save_random);
78601 }
78602#ifdef FREECIV_JSON_CONNECTION
78603 field_addr.name = "prevent_new_cities";
78604#endif /* FREECIV_JSON_CONNECTION */
78605 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->prevent_new_cities)) {
78606 RECEIVE_PACKET_FIELD_ERROR(prevent_new_cities);
78607 }
78608#ifdef FREECIV_JSON_CONNECTION
78609 field_addr.name = "lake_flooding";
78610#endif /* FREECIV_JSON_CONNECTION */
78611 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->lake_flooding)) {
78612 RECEIVE_PACKET_FIELD_ERROR(lake_flooding);
78613 }
78614#ifdef FREECIV_JSON_CONNECTION
78615 field_addr.name = "handmade";
78616#endif /* FREECIV_JSON_CONNECTION */
78617 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->handmade)) {
78618 RECEIVE_PACKET_FIELD_ERROR(handmade);
78619 }
78620#ifdef FREECIV_JSON_CONNECTION
78621 field_addr.name = "allow_ai_type_fallback";
78622#endif /* FREECIV_JSON_CONNECTION */
78623 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->allow_ai_type_fallback)) {
78624 RECEIVE_PACKET_FIELD_ERROR(allow_ai_type_fallback);
78625 }
78626#ifdef FREECIV_JSON_CONNECTION
78627 field_addr.name = "ruleset_locked";
78628#endif /* FREECIV_JSON_CONNECTION */
78629 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ruleset_locked)) {
78630 RECEIVE_PACKET_FIELD_ERROR(ruleset_locked);
78631 }
78632#ifdef FREECIV_JSON_CONNECTION
78633 field_addr.name = "datafile";
78634#endif /* FREECIV_JSON_CONNECTION */
78635 if (!DIO_GET(string, &din, &field_addr, real_packet->datafile, sizeof(real_packet->datafile))) {
78636 RECEIVE_PACKET_FIELD_ERROR(datafile);
78637 }
78638#ifdef FREECIV_JSON_CONNECTION
78639 field_addr.name = "have_resources";
78640#endif /* FREECIV_JSON_CONNECTION */
78641 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->have_resources)) {
78642 RECEIVE_PACKET_FIELD_ERROR(have_resources);
78643 }
78644#ifdef FREECIV_JSON_CONNECTION
78645 field_addr.name = "req_caps";
78646#endif /* FREECIV_JSON_CONNECTION */
78647 if (!DIO_GET(string, &din, &field_addr, real_packet->req_caps, sizeof(real_packet->req_caps))) {
78648 RECEIVE_PACKET_FIELD_ERROR(req_caps);
78649 }
78650#endif
78651 log_packet_detailed("packet_scenario_info_100: got info about ()");
78652
78653#ifdef FREECIV_DELTA_PROTOCOL
78654 if (nullptr == *hash) {
78655 *hash = genhash_new_full(hash_packet_scenario_info_100, cmp_packet_scenario_info_100,
78656 nullptr, nullptr, nullptr, destroy_packet_scenario_info);
78657 }
78658
78659 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78660 *real_packet = *old;
78661 } else {
78662 /* packet is already initialized empty */
78663 log_packet_detailed(" no old info");
78664 }
78665
78666 real_packet->is_scenario = BV_ISSET(fields, 0);
78667 if (BV_ISSET(fields, 1)) {
78668 log_packet_detailed(" got field 'name'");
78669#ifdef FREECIV_JSON_CONNECTION
78670 field_addr.name = "name";
78671#endif /* FREECIV_JSON_CONNECTION */
78672 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
78673 RECEIVE_PACKET_FIELD_ERROR(name);
78674 }
78675 }
78676 if (BV_ISSET(fields, 2)) {
78677 log_packet_detailed(" got field 'authors'");
78678#ifdef FREECIV_JSON_CONNECTION
78679 field_addr.name = "authors";
78680#endif /* FREECIV_JSON_CONNECTION */
78681 if (!DIO_GET(string, &din, &field_addr, real_packet->authors, sizeof(real_packet->authors))) {
78682 RECEIVE_PACKET_FIELD_ERROR(authors);
78683 }
78684 }
78685 real_packet->players = BV_ISSET(fields, 3);
78686 real_packet->startpos_nations = BV_ISSET(fields, 4);
78687 real_packet->save_random = BV_ISSET(fields, 5);
78688 real_packet->prevent_new_cities = BV_ISSET(fields, 6);
78689 real_packet->lake_flooding = BV_ISSET(fields, 7);
78690 real_packet->handmade = BV_ISSET(fields, 8);
78691 real_packet->allow_ai_type_fallback = BV_ISSET(fields, 9);
78692 real_packet->ruleset_locked = BV_ISSET(fields, 10);
78693 if (BV_ISSET(fields, 11)) {
78694 log_packet_detailed(" got field 'datafile'");
78695#ifdef FREECIV_JSON_CONNECTION
78696 field_addr.name = "datafile";
78697#endif /* FREECIV_JSON_CONNECTION */
78698 if (!DIO_GET(string, &din, &field_addr, real_packet->datafile, sizeof(real_packet->datafile))) {
78699 RECEIVE_PACKET_FIELD_ERROR(datafile);
78700 }
78701 }
78702 real_packet->have_resources = BV_ISSET(fields, 12);
78703 if (BV_ISSET(fields, 13)) {
78704 log_packet_detailed(" got field 'req_caps'");
78705#ifdef FREECIV_JSON_CONNECTION
78706 field_addr.name = "req_caps";
78707#endif /* FREECIV_JSON_CONNECTION */
78708 if (!DIO_GET(string, &din, &field_addr, real_packet->req_caps, sizeof(real_packet->req_caps))) {
78709 RECEIVE_PACKET_FIELD_ERROR(req_caps);
78710 }
78711 }
78712
78713 if (nullptr == old) {
78714 old = fc_malloc(sizeof(*old));
78715 init_packet_scenario_info(old);
78716 *old = *real_packet;
78717 genhash_insert(*hash, old, old);
78718 } else {
78719 *old = *real_packet;
78720 }
78721
78722#endif /* FREECIV_DELTA_PROTOCOL */
78723 RECEIVE_PACKET_END(real_packet);
78724#undef FREE_PACKET_STRUCT
78725}
78726
78727 static int send_packet_scenario_info_100(struct connection *pc, const struct packet_scenario_info *packet)
78728{
78729 const struct packet_scenario_info *real_packet = packet;
78730 int e;
78731#ifdef FREECIV_DELTA_PROTOCOL
78732 packet_scenario_info_100_fields fields;
78733 struct packet_scenario_info *old;
78734 bool differ;
78735 struct genhash **hash = pc->phs.sent + PACKET_SCENARIO_INFO;
78736#endif /* FREECIV_DELTA_PROTOCOL */
78737 SEND_PACKET_START(PACKET_SCENARIO_INFO);
78738#ifdef FREECIV_JSON_CONNECTION
78739 struct plocation field_addr;
78740 {
78741 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
78742 field_addr = *field_addr_tmp;
78743 FC_FREE(field_addr_tmp);
78744 }
78745#endif /* FREECIV_JSON_CONNECTION */
78746
78747 log_packet_detailed("packet_scenario_info_100: sending info about ()");
78748
78749#ifdef FREECIV_DELTA_PROTOCOL
78750 if (nullptr == *hash) {
78751 *hash = genhash_new_full(hash_packet_scenario_info_100, cmp_packet_scenario_info_100,
78752 nullptr, nullptr, nullptr, destroy_packet_scenario_info);
78753 }
78754 BV_CLR_ALL(fields);
78755
78756 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78757 old = fc_malloc(sizeof(*old));
78758 /* temporary bitcopy just to insert correctly */
78759 *old = *real_packet;
78760 genhash_insert(*hash, old, old);
78761 init_packet_scenario_info(old);
78762 }
78763 if (packet->is_scenario) {
78764 BV_SET(fields, 0);
78765 }
78766
78767 differ = (strcmp(old->name, real_packet->name) != 0);
78768 if (differ) {
78769 BV_SET(fields, 1);
78770 }
78771
78772 differ = (strcmp(old->authors, real_packet->authors) != 0);
78773 if (differ) {
78774 BV_SET(fields, 2);
78775 }
78776
78777 if (packet->players) {
78778 BV_SET(fields, 3);
78779 }
78780
78781 if (packet->startpos_nations) {
78782 BV_SET(fields, 4);
78783 }
78784
78785 if (packet->save_random) {
78786 BV_SET(fields, 5);
78787 }
78788
78789 if (packet->prevent_new_cities) {
78790 BV_SET(fields, 6);
78791 }
78792
78793 if (packet->lake_flooding) {
78794 BV_SET(fields, 7);
78795 }
78796
78797 if (packet->handmade) {
78798 BV_SET(fields, 8);
78799 }
78800
78801 if (packet->allow_ai_type_fallback) {
78802 BV_SET(fields, 9);
78803 }
78804
78805 if (packet->ruleset_locked) {
78806 BV_SET(fields, 10);
78807 }
78808
78809 differ = (strcmp(old->datafile, real_packet->datafile) != 0);
78810 if (differ) {
78811 BV_SET(fields, 11);
78812 }
78813
78814 if (packet->have_resources) {
78815 BV_SET(fields, 12);
78816 }
78817
78818 differ = (strcmp(old->req_caps, real_packet->req_caps) != 0);
78819 if (differ) {
78820 BV_SET(fields, 13);
78821 }
78822
78823
78824#ifdef FREECIV_JSON_CONNECTION
78825 field_addr.name = "fields";
78826#endif /* FREECIV_JSON_CONNECTION */
78827 e = 0;
78828 e |= DIO_BV_PUT(&dout, &field_addr, fields);
78829 if (e) {
78830 log_packet_detailed("fields bitvector error detected");
78831 }
78832
78833 /* field 0 is folded into the header */
78834 if (BV_ISSET(fields, 1)) {
78835 log_packet_detailed(" field 'name' has changed");
78836#ifdef FREECIV_JSON_CONNECTION
78837 field_addr.name = "name";
78838#endif /* FREECIV_JSON_CONNECTION */
78839 e = 0;
78840 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
78841 if (e) {
78842 log_packet_detailed("'name' field error detected");
78843 }
78844 }
78845 if (BV_ISSET(fields, 2)) {
78846 log_packet_detailed(" field 'authors' has changed");
78847#ifdef FREECIV_JSON_CONNECTION
78848 field_addr.name = "authors";
78849#endif /* FREECIV_JSON_CONNECTION */
78850 e = 0;
78851 e |= DIO_PUT(string, &dout, &field_addr, real_packet->authors);
78852 if (e) {
78853 log_packet_detailed("'authors' field error detected");
78854 }
78855 }
78856 /* field 3 is folded into the header */
78857 /* field 4 is folded into the header */
78858 /* field 5 is folded into the header */
78859 /* field 6 is folded into the header */
78860 /* field 7 is folded into the header */
78861 /* field 8 is folded into the header */
78862 /* field 9 is folded into the header */
78863 /* field 10 is folded into the header */
78864 if (BV_ISSET(fields, 11)) {
78865 log_packet_detailed(" field 'datafile' has changed");
78866#ifdef FREECIV_JSON_CONNECTION
78867 field_addr.name = "datafile";
78868#endif /* FREECIV_JSON_CONNECTION */
78869 e = 0;
78870 e |= DIO_PUT(string, &dout, &field_addr, real_packet->datafile);
78871 if (e) {
78872 log_packet_detailed("'datafile' field error detected");
78873 }
78874 }
78875 /* field 12 is folded into the header */
78876 if (BV_ISSET(fields, 13)) {
78877 log_packet_detailed(" field 'req_caps' has changed");
78878#ifdef FREECIV_JSON_CONNECTION
78879 field_addr.name = "req_caps";
78880#endif /* FREECIV_JSON_CONNECTION */
78881 e = 0;
78882 e |= DIO_PUT(string, &dout, &field_addr, real_packet->req_caps);
78883 if (e) {
78884 log_packet_detailed("'req_caps' field error detected");
78885 }
78886 }
78887
78888 *old = *real_packet;
78889#endif /* FREECIV_DELTA_PROTOCOL */
78890#ifndef FREECIV_DELTA_PROTOCOL
78891#ifdef FREECIV_JSON_CONNECTION
78892 field_addr.name = "is_scenario";
78893#endif /* FREECIV_JSON_CONNECTION */
78894 e = 0;
78895 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_scenario);
78896 if (e) {
78897 log_packet_detailed("'is_scenario' field error detected");
78898 }
78899#ifdef FREECIV_JSON_CONNECTION
78900 field_addr.name = "name";
78901#endif /* FREECIV_JSON_CONNECTION */
78902 e = 0;
78903 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
78904 if (e) {
78905 log_packet_detailed("'name' field error detected");
78906 }
78907#ifdef FREECIV_JSON_CONNECTION
78908 field_addr.name = "authors";
78909#endif /* FREECIV_JSON_CONNECTION */
78910 e = 0;
78911 e |= DIO_PUT(string, &dout, &field_addr, real_packet->authors);
78912 if (e) {
78913 log_packet_detailed("'authors' field error detected");
78914 }
78915#ifdef FREECIV_JSON_CONNECTION
78916 field_addr.name = "players";
78917#endif /* FREECIV_JSON_CONNECTION */
78918 e = 0;
78919 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->players);
78920 if (e) {
78921 log_packet_detailed("'players' field error detected");
78922 }
78923#ifdef FREECIV_JSON_CONNECTION
78924 field_addr.name = "startpos_nations";
78925#endif /* FREECIV_JSON_CONNECTION */
78926 e = 0;
78927 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->startpos_nations);
78928 if (e) {
78929 log_packet_detailed("'startpos_nations' field error detected");
78930 }
78931#ifdef FREECIV_JSON_CONNECTION
78932 field_addr.name = "save_random";
78933#endif /* FREECIV_JSON_CONNECTION */
78934 e = 0;
78935 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->save_random);
78936 if (e) {
78937 log_packet_detailed("'save_random' field error detected");
78938 }
78939#ifdef FREECIV_JSON_CONNECTION
78940 field_addr.name = "prevent_new_cities";
78941#endif /* FREECIV_JSON_CONNECTION */
78942 e = 0;
78943 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->prevent_new_cities);
78944 if (e) {
78945 log_packet_detailed("'prevent_new_cities' field error detected");
78946 }
78947#ifdef FREECIV_JSON_CONNECTION
78948 field_addr.name = "lake_flooding";
78949#endif /* FREECIV_JSON_CONNECTION */
78950 e = 0;
78951 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->lake_flooding);
78952 if (e) {
78953 log_packet_detailed("'lake_flooding' field error detected");
78954 }
78955#ifdef FREECIV_JSON_CONNECTION
78956 field_addr.name = "handmade";
78957#endif /* FREECIV_JSON_CONNECTION */
78958 e = 0;
78959 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->handmade);
78960 if (e) {
78961 log_packet_detailed("'handmade' field error detected");
78962 }
78963#ifdef FREECIV_JSON_CONNECTION
78964 field_addr.name = "allow_ai_type_fallback";
78965#endif /* FREECIV_JSON_CONNECTION */
78966 e = 0;
78967 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->allow_ai_type_fallback);
78968 if (e) {
78969 log_packet_detailed("'allow_ai_type_fallback' field error detected");
78970 }
78971#ifdef FREECIV_JSON_CONNECTION
78972 field_addr.name = "ruleset_locked";
78973#endif /* FREECIV_JSON_CONNECTION */
78974 e = 0;
78975 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->ruleset_locked);
78976 if (e) {
78977 log_packet_detailed("'ruleset_locked' field error detected");
78978 }
78979#ifdef FREECIV_JSON_CONNECTION
78980 field_addr.name = "datafile";
78981#endif /* FREECIV_JSON_CONNECTION */
78982 e = 0;
78983 e |= DIO_PUT(string, &dout, &field_addr, real_packet->datafile);
78984 if (e) {
78985 log_packet_detailed("'datafile' field error detected");
78986 }
78987#ifdef FREECIV_JSON_CONNECTION
78988 field_addr.name = "have_resources";
78989#endif /* FREECIV_JSON_CONNECTION */
78990 e = 0;
78991 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->have_resources);
78992 if (e) {
78993 log_packet_detailed("'have_resources' field error detected");
78994 }
78995#ifdef FREECIV_JSON_CONNECTION
78996 field_addr.name = "req_caps";
78997#endif /* FREECIV_JSON_CONNECTION */
78998 e = 0;
78999 e |= DIO_PUT(string, &dout, &field_addr, real_packet->req_caps);
79000 if (e) {
79001 log_packet_detailed("'req_caps' field error detected");
79002 }
79003
79004#endif
79005 SEND_PACKET_END(PACKET_SCENARIO_INFO);
79006}
79007
79008 int send_packet_scenario_info(struct connection *pc, const struct packet_scenario_info *packet)
79009{
79010 if (!pc->used) {
79011 log_error("WARNING: trying to send data to the closed connection %s",
79012 conn_description(pc));
79013 return -1;
79014 }
79015 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SCENARIO_INFO].packet != nullptr, -1,
79016 "Handler for PACKET_SCENARIO_INFO not installed");
79017 return pc->phs.handlers->send[PACKET_SCENARIO_INFO].packet(pc, packet);
79018}
79019
79020 static inline void init_packet_scenario_description(struct packet_scenario_description *packet)
79021{
79022 memset(packet, 0, sizeof(*packet));
79023}
79024
79025#define free_packet_scenario_description(_packet) (void) 0
79026#define destroy_packet_scenario_description free
79027
79028#ifdef FREECIV_DELTA_PROTOCOL
79029#define hash_packet_scenario_description_100 hash_const
79030
79031#define cmp_packet_scenario_description_100 cmp_const
79032
79033 BV_DEFINE(packet_scenario_description_100_fields, 1);
79034#endif /* FREECIV_DELTA_PROTOCOL */
79035
79036 static struct packet_scenario_description *receive_packet_scenario_description_100(struct connection *pc)
79037{
79038#define FREE_PACKET_STRUCT(_packet) free_packet_scenario_description(_packet)
79039#ifdef FREECIV_DELTA_PROTOCOL
79040 packet_scenario_description_100_fields fields;
79041 struct packet_scenario_description *old;
79042 struct genhash **hash = pc->phs.received + PACKET_SCENARIO_DESCRIPTION;
79043#endif /* FREECIV_DELTA_PROTOCOL */
79044 RECEIVE_PACKET_START(packet_scenario_description, real_packet);
79045#ifdef FREECIV_JSON_CONNECTION
79046 struct plocation field_addr;
79047 {
79048 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79049 field_addr = *field_addr_tmp;
79050 FC_FREE(field_addr_tmp);
79051 }
79052#endif /* FREECIV_JSON_CONNECTION */
79053
79054#ifdef FREECIV_DELTA_PROTOCOL
79055#ifdef FREECIV_JSON_CONNECTION
79056 field_addr.name = "fields";
79057#endif /* FREECIV_JSON_CONNECTION */
79058 DIO_BV_GET(&din, &field_addr, fields);
79059
79060#else /* FREECIV_DELTA_PROTOCOL */
79061#ifdef FREECIV_JSON_CONNECTION
79062 field_addr.name = "description";
79063#endif /* FREECIV_JSON_CONNECTION */
79064 if (!DIO_GET(string, &din, &field_addr, real_packet->description, sizeof(real_packet->description))) {
79065 RECEIVE_PACKET_FIELD_ERROR(description);
79066 }
79067#endif
79068 log_packet_detailed("packet_scenario_description_100: got info about ()");
79069
79070#ifdef FREECIV_DELTA_PROTOCOL
79071 if (nullptr == *hash) {
79072 *hash = genhash_new_full(hash_packet_scenario_description_100, cmp_packet_scenario_description_100,
79073 nullptr, nullptr, nullptr, destroy_packet_scenario_description);
79074 }
79075
79076 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79077 *real_packet = *old;
79078 } else {
79079 /* packet is already initialized empty */
79080 log_packet_detailed(" no old info");
79081 }
79082
79083 if (BV_ISSET(fields, 0)) {
79084 log_packet_detailed(" got field 'description'");
79085#ifdef FREECIV_JSON_CONNECTION
79086 field_addr.name = "description";
79087#endif /* FREECIV_JSON_CONNECTION */
79088 if (!DIO_GET(string, &din, &field_addr, real_packet->description, sizeof(real_packet->description))) {
79089 RECEIVE_PACKET_FIELD_ERROR(description);
79090 }
79091 }
79092
79093 if (nullptr == old) {
79094 old = fc_malloc(sizeof(*old));
79095 init_packet_scenario_description(old);
79096 *old = *real_packet;
79097 genhash_insert(*hash, old, old);
79098 } else {
79099 *old = *real_packet;
79100 }
79101
79102#endif /* FREECIV_DELTA_PROTOCOL */
79103 RECEIVE_PACKET_END(real_packet);
79104#undef FREE_PACKET_STRUCT
79105}
79106
79107 static int send_packet_scenario_description_100(struct connection *pc, const struct packet_scenario_description *packet)
79108{
79109 const struct packet_scenario_description *real_packet = packet;
79110 int e;
79111#ifdef FREECIV_DELTA_PROTOCOL
79112 packet_scenario_description_100_fields fields;
79113 struct packet_scenario_description *old;
79114 bool differ;
79115 struct genhash **hash = pc->phs.sent + PACKET_SCENARIO_DESCRIPTION;
79116#endif /* FREECIV_DELTA_PROTOCOL */
79117 SEND_PACKET_START(PACKET_SCENARIO_DESCRIPTION);
79118#ifdef FREECIV_JSON_CONNECTION
79119 struct plocation field_addr;
79120 {
79121 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79122 field_addr = *field_addr_tmp;
79123 FC_FREE(field_addr_tmp);
79124 }
79125#endif /* FREECIV_JSON_CONNECTION */
79126
79127 log_packet_detailed("packet_scenario_description_100: sending info about ()");
79128
79129#ifdef FREECIV_DELTA_PROTOCOL
79130 if (nullptr == *hash) {
79131 *hash = genhash_new_full(hash_packet_scenario_description_100, cmp_packet_scenario_description_100,
79132 nullptr, nullptr, nullptr, destroy_packet_scenario_description);
79133 }
79134 BV_CLR_ALL(fields);
79135
79136 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79137 old = fc_malloc(sizeof(*old));
79138 /* temporary bitcopy just to insert correctly */
79139 *old = *real_packet;
79140 genhash_insert(*hash, old, old);
79141 init_packet_scenario_description(old);
79142 }
79143 differ = (strcmp(old->description, real_packet->description) != 0);
79144 if (differ) {
79145 BV_SET(fields, 0);
79146 }
79147
79148
79149#ifdef FREECIV_JSON_CONNECTION
79150 field_addr.name = "fields";
79151#endif /* FREECIV_JSON_CONNECTION */
79152 e = 0;
79153 e |= DIO_BV_PUT(&dout, &field_addr, fields);
79154 if (e) {
79155 log_packet_detailed("fields bitvector error detected");
79156 }
79157
79158 if (BV_ISSET(fields, 0)) {
79159 log_packet_detailed(" field 'description' has changed");
79160#ifdef FREECIV_JSON_CONNECTION
79161 field_addr.name = "description";
79162#endif /* FREECIV_JSON_CONNECTION */
79163 e = 0;
79164 e |= DIO_PUT(string, &dout, &field_addr, real_packet->description);
79165 if (e) {
79166 log_packet_detailed("'description' field error detected");
79167 }
79168 }
79169
79170 *old = *real_packet;
79171#endif /* FREECIV_DELTA_PROTOCOL */
79172#ifndef FREECIV_DELTA_PROTOCOL
79173#ifdef FREECIV_JSON_CONNECTION
79174 field_addr.name = "description";
79175#endif /* FREECIV_JSON_CONNECTION */
79176 e = 0;
79177 e |= DIO_PUT(string, &dout, &field_addr, real_packet->description);
79178 if (e) {
79179 log_packet_detailed("'description' field error detected");
79180 }
79181
79182#endif
79183 SEND_PACKET_END(PACKET_SCENARIO_DESCRIPTION);
79184}
79185
79186 int send_packet_scenario_description(struct connection *pc, const struct packet_scenario_description *packet)
79187{
79188 if (!pc->used) {
79189 log_error("WARNING: trying to send data to the closed connection %s",
79190 conn_description(pc));
79191 return -1;
79192 }
79193 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SCENARIO_DESCRIPTION].packet != nullptr, -1,
79194 "Handler for PACKET_SCENARIO_DESCRIPTION not installed");
79195 return pc->phs.handlers->send[PACKET_SCENARIO_DESCRIPTION].packet(pc, packet);
79196}
79197
79198 static inline void init_packet_save_scenario(struct packet_save_scenario *packet)
79199{
79200 memset(packet, 0, sizeof(*packet));
79201}
79202
79203#define free_packet_save_scenario(_packet) (void) 0
79204#define destroy_packet_save_scenario free
79205
79206#ifdef FREECIV_DELTA_PROTOCOL
79207#define hash_packet_save_scenario_100 hash_const
79208
79209#define cmp_packet_save_scenario_100 cmp_const
79210
79211 BV_DEFINE(packet_save_scenario_100_fields, 1);
79212#endif /* FREECIV_DELTA_PROTOCOL */
79213
79214 static struct packet_save_scenario *receive_packet_save_scenario_100(struct connection *pc)
79215{
79216#define FREE_PACKET_STRUCT(_packet) free_packet_save_scenario(_packet)
79217#ifdef FREECIV_DELTA_PROTOCOL
79218 packet_save_scenario_100_fields fields;
79219 struct packet_save_scenario *old;
79220 struct genhash **hash = pc->phs.received + PACKET_SAVE_SCENARIO;
79221#endif /* FREECIV_DELTA_PROTOCOL */
79222 RECEIVE_PACKET_START(packet_save_scenario, real_packet);
79223#ifdef FREECIV_JSON_CONNECTION
79224 struct plocation field_addr;
79225 {
79226 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79227 field_addr = *field_addr_tmp;
79228 FC_FREE(field_addr_tmp);
79229 }
79230#endif /* FREECIV_JSON_CONNECTION */
79231
79232#ifdef FREECIV_DELTA_PROTOCOL
79233#ifdef FREECIV_JSON_CONNECTION
79234 field_addr.name = "fields";
79235#endif /* FREECIV_JSON_CONNECTION */
79236 DIO_BV_GET(&din, &field_addr, fields);
79237
79238#else /* FREECIV_DELTA_PROTOCOL */
79239#ifdef FREECIV_JSON_CONNECTION
79240 field_addr.name = "name";
79241#endif /* FREECIV_JSON_CONNECTION */
79242 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
79243 RECEIVE_PACKET_FIELD_ERROR(name);
79244 }
79245#endif
79246 log_packet_detailed("packet_save_scenario_100: got info about ()");
79247
79248#ifdef FREECIV_DELTA_PROTOCOL
79249 if (nullptr == *hash) {
79250 *hash = genhash_new_full(hash_packet_save_scenario_100, cmp_packet_save_scenario_100,
79251 nullptr, nullptr, nullptr, destroy_packet_save_scenario);
79252 }
79253
79254 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79255 *real_packet = *old;
79256 } else {
79257 /* packet is already initialized empty */
79258 log_packet_detailed(" no old info");
79259 }
79260
79261 if (BV_ISSET(fields, 0)) {
79262 log_packet_detailed(" got field 'name'");
79263#ifdef FREECIV_JSON_CONNECTION
79264 field_addr.name = "name";
79265#endif /* FREECIV_JSON_CONNECTION */
79266 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
79267 RECEIVE_PACKET_FIELD_ERROR(name);
79268 }
79269 }
79270
79271 if (nullptr == old) {
79272 old = fc_malloc(sizeof(*old));
79273 init_packet_save_scenario(old);
79274 *old = *real_packet;
79275 genhash_insert(*hash, old, old);
79276 } else {
79277 *old = *real_packet;
79278 }
79279
79280#endif /* FREECIV_DELTA_PROTOCOL */
79281 RECEIVE_PACKET_END(real_packet);
79282#undef FREE_PACKET_STRUCT
79283}
79284
79285 static int send_packet_save_scenario_100(struct connection *pc, const struct packet_save_scenario *packet)
79286{
79287 const struct packet_save_scenario *real_packet = packet;
79288 int e;
79289#ifdef FREECIV_DELTA_PROTOCOL
79290 packet_save_scenario_100_fields fields;
79291 struct packet_save_scenario *old;
79292 bool differ;
79293 struct genhash **hash = pc->phs.sent + PACKET_SAVE_SCENARIO;
79294#endif /* FREECIV_DELTA_PROTOCOL */
79295 SEND_PACKET_START(PACKET_SAVE_SCENARIO);
79296#ifdef FREECIV_JSON_CONNECTION
79297 struct plocation field_addr;
79298 {
79299 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79300 field_addr = *field_addr_tmp;
79301 FC_FREE(field_addr_tmp);
79302 }
79303#endif /* FREECIV_JSON_CONNECTION */
79304
79305 log_packet_detailed("packet_save_scenario_100: sending info about ()");
79306
79307#ifdef FREECIV_DELTA_PROTOCOL
79308 if (nullptr == *hash) {
79309 *hash = genhash_new_full(hash_packet_save_scenario_100, cmp_packet_save_scenario_100,
79310 nullptr, nullptr, nullptr, destroy_packet_save_scenario);
79311 }
79312 BV_CLR_ALL(fields);
79313
79314 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79315 old = fc_malloc(sizeof(*old));
79316 /* temporary bitcopy just to insert correctly */
79317 *old = *real_packet;
79318 genhash_insert(*hash, old, old);
79319 init_packet_save_scenario(old);
79320 }
79321 differ = (strcmp(old->name, real_packet->name) != 0);
79322 if (differ) {
79323 BV_SET(fields, 0);
79324 }
79325
79326
79327#ifdef FREECIV_JSON_CONNECTION
79328 field_addr.name = "fields";
79329#endif /* FREECIV_JSON_CONNECTION */
79330 e = 0;
79331 e |= DIO_BV_PUT(&dout, &field_addr, fields);
79332 if (e) {
79333 log_packet_detailed("fields bitvector error detected");
79334 }
79335
79336 if (BV_ISSET(fields, 0)) {
79337 log_packet_detailed(" field 'name' has changed");
79338#ifdef FREECIV_JSON_CONNECTION
79339 field_addr.name = "name";
79340#endif /* FREECIV_JSON_CONNECTION */
79341 e = 0;
79342 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
79343 if (e) {
79344 log_packet_detailed("'name' field error detected");
79345 }
79346 }
79347
79348 *old = *real_packet;
79349#endif /* FREECIV_DELTA_PROTOCOL */
79350#ifndef FREECIV_DELTA_PROTOCOL
79351#ifdef FREECIV_JSON_CONNECTION
79352 field_addr.name = "name";
79353#endif /* FREECIV_JSON_CONNECTION */
79354 e = 0;
79355 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
79356 if (e) {
79357 log_packet_detailed("'name' field error detected");
79358 }
79359
79360#endif
79361 SEND_PACKET_END(PACKET_SAVE_SCENARIO);
79362}
79363
79364 int send_packet_save_scenario(struct connection *pc, const struct packet_save_scenario *packet)
79365{
79366 if (!pc->used) {
79367 log_error("WARNING: trying to send data to the closed connection %s",
79368 conn_description(pc));
79369 return -1;
79370 }
79371 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SAVE_SCENARIO].packet != nullptr, -1,
79372 "Handler for PACKET_SAVE_SCENARIO not installed");
79373 return pc->phs.handlers->send[PACKET_SAVE_SCENARIO].packet(pc, packet);
79374}
79375
79376 int dsend_packet_save_scenario(struct connection *pc, const char *name)
79377{
79378 struct packet_save_scenario packet, *real_packet = &packet;
79379
79380 sz_strlcpy(real_packet->name, name);
79381
79382 return send_packet_save_scenario(pc, real_packet);
79383}
79384
79385 static inline void init_packet_vote_new(struct packet_vote_new *packet)
79386{
79387 memset(packet, 0, sizeof(*packet));
79388}
79389
79390#define free_packet_vote_new(_packet) (void) 0
79391#define destroy_packet_vote_new free
79392
79393#ifdef FREECIV_DELTA_PROTOCOL
79394#define hash_packet_vote_new_100 hash_const
79395
79396#define cmp_packet_vote_new_100 cmp_const
79397
79398 BV_DEFINE(packet_vote_new_100_fields, 5);
79399#endif /* FREECIV_DELTA_PROTOCOL */
79400
79401 static struct packet_vote_new *receive_packet_vote_new_100(struct connection *pc)
79402{
79403#define FREE_PACKET_STRUCT(_packet) free_packet_vote_new(_packet)
79404#ifdef FREECIV_DELTA_PROTOCOL
79405 packet_vote_new_100_fields fields;
79406 struct packet_vote_new *old;
79407 struct genhash **hash = pc->phs.received + PACKET_VOTE_NEW;
79408#endif /* FREECIV_DELTA_PROTOCOL */
79409 RECEIVE_PACKET_START(packet_vote_new, real_packet);
79410#ifdef FREECIV_JSON_CONNECTION
79411 struct plocation field_addr;
79412 {
79413 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79414 field_addr = *field_addr_tmp;
79415 FC_FREE(field_addr_tmp);
79416 }
79417#endif /* FREECIV_JSON_CONNECTION */
79418
79419#ifdef FREECIV_DELTA_PROTOCOL
79420#ifdef FREECIV_JSON_CONNECTION
79421 field_addr.name = "fields";
79422#endif /* FREECIV_JSON_CONNECTION */
79423 DIO_BV_GET(&din, &field_addr, fields);
79424
79425#else /* FREECIV_DELTA_PROTOCOL */
79426#ifdef FREECIV_JSON_CONNECTION
79427 field_addr.name = "vote_no";
79428#endif /* FREECIV_JSON_CONNECTION */
79429 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
79430 RECEIVE_PACKET_FIELD_ERROR(vote_no);
79431 }
79432#ifdef FREECIV_JSON_CONNECTION
79433 field_addr.name = "user";
79434#endif /* FREECIV_JSON_CONNECTION */
79435 if (!DIO_GET(string, &din, &field_addr, real_packet->user, sizeof(real_packet->user))) {
79436 RECEIVE_PACKET_FIELD_ERROR(user);
79437 }
79438#ifdef FREECIV_JSON_CONNECTION
79439 field_addr.name = "desc";
79440#endif /* FREECIV_JSON_CONNECTION */
79441 if (!DIO_GET(string, &din, &field_addr, real_packet->desc, sizeof(real_packet->desc))) {
79442 RECEIVE_PACKET_FIELD_ERROR(desc);
79443 }
79444#ifdef FREECIV_JSON_CONNECTION
79445 field_addr.name = "percent_required";
79446#endif /* FREECIV_JSON_CONNECTION */
79447 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->percent_required)) {
79448 RECEIVE_PACKET_FIELD_ERROR(percent_required);
79449 }
79450#ifdef FREECIV_JSON_CONNECTION
79451 field_addr.name = "flags";
79452#endif /* FREECIV_JSON_CONNECTION */
79453 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->flags)) {
79454 RECEIVE_PACKET_FIELD_ERROR(flags);
79455 }
79456#endif
79457 log_packet_detailed("packet_vote_new_100: got info about ()");
79458
79459#ifdef FREECIV_DELTA_PROTOCOL
79460 if (nullptr == *hash) {
79461 *hash = genhash_new_full(hash_packet_vote_new_100, cmp_packet_vote_new_100,
79462 nullptr, nullptr, nullptr, destroy_packet_vote_new);
79463 }
79464
79465 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79466 *real_packet = *old;
79467 } else {
79468 /* packet is already initialized empty */
79469 log_packet_detailed(" no old info");
79470 }
79471
79472 if (BV_ISSET(fields, 0)) {
79473 log_packet_detailed(" got field 'vote_no'");
79474#ifdef FREECIV_JSON_CONNECTION
79475 field_addr.name = "vote_no";
79476#endif /* FREECIV_JSON_CONNECTION */
79477 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
79478 RECEIVE_PACKET_FIELD_ERROR(vote_no);
79479 }
79480 }
79481 if (BV_ISSET(fields, 1)) {
79482 log_packet_detailed(" got field 'user'");
79483#ifdef FREECIV_JSON_CONNECTION
79484 field_addr.name = "user";
79485#endif /* FREECIV_JSON_CONNECTION */
79486 if (!DIO_GET(string, &din, &field_addr, real_packet->user, sizeof(real_packet->user))) {
79487 RECEIVE_PACKET_FIELD_ERROR(user);
79488 }
79489 }
79490 if (BV_ISSET(fields, 2)) {
79491 log_packet_detailed(" got field 'desc'");
79492#ifdef FREECIV_JSON_CONNECTION
79493 field_addr.name = "desc";
79494#endif /* FREECIV_JSON_CONNECTION */
79495 if (!DIO_GET(string, &din, &field_addr, real_packet->desc, sizeof(real_packet->desc))) {
79496 RECEIVE_PACKET_FIELD_ERROR(desc);
79497 }
79498 }
79499 if (BV_ISSET(fields, 3)) {
79500 log_packet_detailed(" got field 'percent_required'");
79501#ifdef FREECIV_JSON_CONNECTION
79502 field_addr.name = "percent_required";
79503#endif /* FREECIV_JSON_CONNECTION */
79504 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->percent_required)) {
79505 RECEIVE_PACKET_FIELD_ERROR(percent_required);
79506 }
79507 }
79508 if (BV_ISSET(fields, 4)) {
79509 log_packet_detailed(" got field 'flags'");
79510#ifdef FREECIV_JSON_CONNECTION
79511 field_addr.name = "flags";
79512#endif /* FREECIV_JSON_CONNECTION */
79513 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->flags)) {
79514 RECEIVE_PACKET_FIELD_ERROR(flags);
79515 }
79516 }
79517
79518 if (nullptr == old) {
79519 old = fc_malloc(sizeof(*old));
79520 init_packet_vote_new(old);
79521 *old = *real_packet;
79522 genhash_insert(*hash, old, old);
79523 } else {
79524 *old = *real_packet;
79525 }
79526
79527#endif /* FREECIV_DELTA_PROTOCOL */
79528 RECEIVE_PACKET_END(real_packet);
79529#undef FREE_PACKET_STRUCT
79530}
79531
79532 static int send_packet_vote_new_100(struct connection *pc, const struct packet_vote_new *packet)
79533{
79534 const struct packet_vote_new *real_packet = packet;
79535 int e;
79536#ifdef FREECIV_DELTA_PROTOCOL
79537 packet_vote_new_100_fields fields;
79538 struct packet_vote_new *old;
79539 bool differ;
79540 struct genhash **hash = pc->phs.sent + PACKET_VOTE_NEW;
79541#endif /* FREECIV_DELTA_PROTOCOL */
79542 SEND_PACKET_START(PACKET_VOTE_NEW);
79543#ifdef FREECIV_JSON_CONNECTION
79544 struct plocation field_addr;
79545 {
79546 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79547 field_addr = *field_addr_tmp;
79548 FC_FREE(field_addr_tmp);
79549 }
79550#endif /* FREECIV_JSON_CONNECTION */
79551
79552 log_packet_detailed("packet_vote_new_100: sending info about ()");
79553
79554#ifdef FREECIV_DELTA_PROTOCOL
79555 if (nullptr == *hash) {
79556 *hash = genhash_new_full(hash_packet_vote_new_100, cmp_packet_vote_new_100,
79557 nullptr, nullptr, nullptr, destroy_packet_vote_new);
79558 }
79559 BV_CLR_ALL(fields);
79560
79561 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79562 old = fc_malloc(sizeof(*old));
79563 /* temporary bitcopy just to insert correctly */
79564 *old = *real_packet;
79565 genhash_insert(*hash, old, old);
79566 init_packet_vote_new(old);
79567 }
79568 differ = (old->vote_no != real_packet->vote_no);
79569 if (differ) {
79570 BV_SET(fields, 0);
79571 }
79572
79573 differ = (strcmp(old->user, real_packet->user) != 0);
79574 if (differ) {
79575 BV_SET(fields, 1);
79576 }
79577
79578 differ = (strcmp(old->desc, real_packet->desc) != 0);
79579 if (differ) {
79580 BV_SET(fields, 2);
79581 }
79582
79583 differ = (old->percent_required != real_packet->percent_required);
79584 if (differ) {
79585 BV_SET(fields, 3);
79586 }
79587
79588 differ = (old->flags != real_packet->flags);
79589 if (differ) {
79590 BV_SET(fields, 4);
79591 }
79592
79593
79594#ifdef FREECIV_JSON_CONNECTION
79595 field_addr.name = "fields";
79596#endif /* FREECIV_JSON_CONNECTION */
79597 e = 0;
79598 e |= DIO_BV_PUT(&dout, &field_addr, fields);
79599 if (e) {
79600 log_packet_detailed("fields bitvector error detected");
79601 }
79602
79603 if (BV_ISSET(fields, 0)) {
79604 log_packet_detailed(" field 'vote_no' has changed");
79605#ifdef FREECIV_JSON_CONNECTION
79606 field_addr.name = "vote_no";
79607#endif /* FREECIV_JSON_CONNECTION */
79608 e = 0;
79609 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
79610 if (e) {
79611 log_packet_detailed("'vote_no' field error detected");
79612 }
79613 }
79614 if (BV_ISSET(fields, 1)) {
79615 log_packet_detailed(" field 'user' has changed");
79616#ifdef FREECIV_JSON_CONNECTION
79617 field_addr.name = "user";
79618#endif /* FREECIV_JSON_CONNECTION */
79619 e = 0;
79620 e |= DIO_PUT(string, &dout, &field_addr, real_packet->user);
79621 if (e) {
79622 log_packet_detailed("'user' field error detected");
79623 }
79624 }
79625 if (BV_ISSET(fields, 2)) {
79626 log_packet_detailed(" field 'desc' has changed");
79627#ifdef FREECIV_JSON_CONNECTION
79628 field_addr.name = "desc";
79629#endif /* FREECIV_JSON_CONNECTION */
79630 e = 0;
79631 e |= DIO_PUT(string, &dout, &field_addr, real_packet->desc);
79632 if (e) {
79633 log_packet_detailed("'desc' field error detected");
79634 }
79635 }
79636 if (BV_ISSET(fields, 3)) {
79637 log_packet_detailed(" field 'percent_required' has changed");
79638#ifdef FREECIV_JSON_CONNECTION
79639 field_addr.name = "percent_required";
79640#endif /* FREECIV_JSON_CONNECTION */
79641 e = 0;
79642 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->percent_required);
79643 if (e) {
79644 log_packet_detailed("'percent_required' field error detected");
79645 }
79646 }
79647 if (BV_ISSET(fields, 4)) {
79648 log_packet_detailed(" field 'flags' has changed");
79649#ifdef FREECIV_JSON_CONNECTION
79650 field_addr.name = "flags";
79651#endif /* FREECIV_JSON_CONNECTION */
79652 e = 0;
79653 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->flags);
79654 if (e) {
79655 log_packet_detailed("'flags' field error detected");
79656 }
79657 }
79658
79659 *old = *real_packet;
79660#endif /* FREECIV_DELTA_PROTOCOL */
79661#ifndef FREECIV_DELTA_PROTOCOL
79662#ifdef FREECIV_JSON_CONNECTION
79663 field_addr.name = "vote_no";
79664#endif /* FREECIV_JSON_CONNECTION */
79665 e = 0;
79666 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
79667 if (e) {
79668 log_packet_detailed("'vote_no' field error detected");
79669 }
79670#ifdef FREECIV_JSON_CONNECTION
79671 field_addr.name = "user";
79672#endif /* FREECIV_JSON_CONNECTION */
79673 e = 0;
79674 e |= DIO_PUT(string, &dout, &field_addr, real_packet->user);
79675 if (e) {
79676 log_packet_detailed("'user' field error detected");
79677 }
79678#ifdef FREECIV_JSON_CONNECTION
79679 field_addr.name = "desc";
79680#endif /* FREECIV_JSON_CONNECTION */
79681 e = 0;
79682 e |= DIO_PUT(string, &dout, &field_addr, real_packet->desc);
79683 if (e) {
79684 log_packet_detailed("'desc' field error detected");
79685 }
79686#ifdef FREECIV_JSON_CONNECTION
79687 field_addr.name = "percent_required";
79688#endif /* FREECIV_JSON_CONNECTION */
79689 e = 0;
79690 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->percent_required);
79691 if (e) {
79692 log_packet_detailed("'percent_required' field error detected");
79693 }
79694#ifdef FREECIV_JSON_CONNECTION
79695 field_addr.name = "flags";
79696#endif /* FREECIV_JSON_CONNECTION */
79697 e = 0;
79698 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->flags);
79699 if (e) {
79700 log_packet_detailed("'flags' field error detected");
79701 }
79702
79703#endif
79704 SEND_PACKET_END(PACKET_VOTE_NEW);
79705}
79706
79707 int send_packet_vote_new(struct connection *pc, const struct packet_vote_new *packet)
79708{
79709 if (!pc->used) {
79710 log_error("WARNING: trying to send data to the closed connection %s",
79711 conn_description(pc));
79712 return -1;
79713 }
79714 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_NEW].packet != nullptr, -1,
79715 "Handler for PACKET_VOTE_NEW not installed");
79716 return pc->phs.handlers->send[PACKET_VOTE_NEW].packet(pc, packet);
79717}
79718
79719 static inline void init_packet_vote_update(struct packet_vote_update *packet)
79720{
79721 memset(packet, 0, sizeof(*packet));
79722}
79723
79724#define free_packet_vote_update(_packet) (void) 0
79725#define destroy_packet_vote_update free
79726
79727#ifdef FREECIV_DELTA_PROTOCOL
79728static genhash_val_t hash_packet_vote_update_100(const void *vkey)
79729{
79730 const struct packet_vote_update *key = (const struct packet_vote_update *) vkey;
79731 genhash_val_t result = 0;
79732
79733 result += key->vote_no;
79734
79735 result &= 0xFFFFFFFF;
79736 return result;
79737}
79738
79739static bool cmp_packet_vote_update_100(const void *vkey1, const void *vkey2)
79740{
79741 const struct packet_vote_update *old = (const struct packet_vote_update *) vkey1;
79742 const struct packet_vote_update *real_packet = (const struct packet_vote_update *) vkey2;
79743 bool differ;
79744
79745 differ = (old->vote_no != real_packet->vote_no);
79746
79747 return !differ;
79748}
79749 BV_DEFINE(packet_vote_update_100_fields, 4);
79750#endif /* FREECIV_DELTA_PROTOCOL */
79751
79752 static struct packet_vote_update *receive_packet_vote_update_100(struct connection *pc)
79753{
79754#define FREE_PACKET_STRUCT(_packet) free_packet_vote_update(_packet)
79755#ifdef FREECIV_DELTA_PROTOCOL
79756 packet_vote_update_100_fields fields;
79757 struct packet_vote_update *old;
79758 struct genhash **hash = pc->phs.received + PACKET_VOTE_UPDATE;
79759#endif /* FREECIV_DELTA_PROTOCOL */
79760 RECEIVE_PACKET_START(packet_vote_update, real_packet);
79761#ifdef FREECIV_JSON_CONNECTION
79762 struct plocation field_addr;
79763 {
79764 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79765 field_addr = *field_addr_tmp;
79766 FC_FREE(field_addr_tmp);
79767 }
79768#endif /* FREECIV_JSON_CONNECTION */
79769
79770#ifdef FREECIV_DELTA_PROTOCOL
79771#ifdef FREECIV_JSON_CONNECTION
79772 field_addr.name = "fields";
79773#endif /* FREECIV_JSON_CONNECTION */
79774 DIO_BV_GET(&din, &field_addr, fields);
79775#ifdef FREECIV_JSON_CONNECTION
79776 field_addr.name = "vote_no";
79777#endif /* FREECIV_JSON_CONNECTION */
79778 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
79779 RECEIVE_PACKET_FIELD_ERROR(vote_no);
79780 }
79781
79782#else /* FREECIV_DELTA_PROTOCOL */
79783#ifdef FREECIV_JSON_CONNECTION
79784 field_addr.name = "vote_no";
79785#endif /* FREECIV_JSON_CONNECTION */
79786 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
79787 RECEIVE_PACKET_FIELD_ERROR(vote_no);
79788 }
79789#ifdef FREECIV_JSON_CONNECTION
79790 field_addr.name = "yes";
79791#endif /* FREECIV_JSON_CONNECTION */
79792 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->yes)) {
79793 RECEIVE_PACKET_FIELD_ERROR(yes);
79794 }
79795#ifdef FREECIV_JSON_CONNECTION
79796 field_addr.name = "no";
79797#endif /* FREECIV_JSON_CONNECTION */
79798 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->no)) {
79799 RECEIVE_PACKET_FIELD_ERROR(no);
79800 }
79801#ifdef FREECIV_JSON_CONNECTION
79802 field_addr.name = "abstain";
79803#endif /* FREECIV_JSON_CONNECTION */
79804 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->abstain)) {
79805 RECEIVE_PACKET_FIELD_ERROR(abstain);
79806 }
79807#ifdef FREECIV_JSON_CONNECTION
79808 field_addr.name = "num_voters";
79809#endif /* FREECIV_JSON_CONNECTION */
79810 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_voters)) {
79811 RECEIVE_PACKET_FIELD_ERROR(num_voters);
79812 }
79813#endif
79814 log_packet_detailed("packet_vote_update_100: got info about (%d)",
79815 real_packet->vote_no);
79816
79817#ifdef FREECIV_DELTA_PROTOCOL
79818 if (nullptr == *hash) {
79819 *hash = genhash_new_full(hash_packet_vote_update_100, cmp_packet_vote_update_100,
79820 nullptr, nullptr, nullptr, destroy_packet_vote_update);
79821 }
79822
79823 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
79824 *real_packet = *old;
79825 } else {
79826 /* packet is already initialized empty */
79827 log_packet_detailed(" no old info");
79828 }
79829
79830 if (BV_ISSET(fields, 0)) {
79831 log_packet_detailed(" got field 'yes'");
79832#ifdef FREECIV_JSON_CONNECTION
79833 field_addr.name = "yes";
79834#endif /* FREECIV_JSON_CONNECTION */
79835 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->yes)) {
79836 RECEIVE_PACKET_FIELD_ERROR(yes);
79837 }
79838 }
79839 if (BV_ISSET(fields, 1)) {
79840 log_packet_detailed(" got field 'no'");
79841#ifdef FREECIV_JSON_CONNECTION
79842 field_addr.name = "no";
79843#endif /* FREECIV_JSON_CONNECTION */
79844 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->no)) {
79845 RECEIVE_PACKET_FIELD_ERROR(no);
79846 }
79847 }
79848 if (BV_ISSET(fields, 2)) {
79849 log_packet_detailed(" got field 'abstain'");
79850#ifdef FREECIV_JSON_CONNECTION
79851 field_addr.name = "abstain";
79852#endif /* FREECIV_JSON_CONNECTION */
79853 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->abstain)) {
79854 RECEIVE_PACKET_FIELD_ERROR(abstain);
79855 }
79856 }
79857 if (BV_ISSET(fields, 3)) {
79858 log_packet_detailed(" got field 'num_voters'");
79859#ifdef FREECIV_JSON_CONNECTION
79860 field_addr.name = "num_voters";
79861#endif /* FREECIV_JSON_CONNECTION */
79862 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_voters)) {
79863 RECEIVE_PACKET_FIELD_ERROR(num_voters);
79864 }
79865 }
79866
79867 if (nullptr == old) {
79868 old = fc_malloc(sizeof(*old));
79869 init_packet_vote_update(old);
79870 *old = *real_packet;
79871 genhash_insert(*hash, old, old);
79872 } else {
79873 *old = *real_packet;
79874 }
79875
79876#endif /* FREECIV_DELTA_PROTOCOL */
79877 RECEIVE_PACKET_END(real_packet);
79878#undef FREE_PACKET_STRUCT
79879}
79880
79881 static int send_packet_vote_update_100(struct connection *pc, const struct packet_vote_update *packet)
79882{
79883 const struct packet_vote_update *real_packet = packet;
79884 int e;
79885#ifdef FREECIV_DELTA_PROTOCOL
79886 packet_vote_update_100_fields fields;
79887 struct packet_vote_update *old;
79888 bool differ;
79889 struct genhash **hash = pc->phs.sent + PACKET_VOTE_UPDATE;
79890 int different = 0;
79891#endif /* FREECIV_DELTA_PROTOCOL */
79892 SEND_PACKET_START(PACKET_VOTE_UPDATE);
79893#ifdef FREECIV_JSON_CONNECTION
79894 struct plocation field_addr;
79895 {
79896 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
79897 field_addr = *field_addr_tmp;
79898 FC_FREE(field_addr_tmp);
79899 }
79900#endif /* FREECIV_JSON_CONNECTION */
79901
79902 log_packet_detailed("packet_vote_update_100: sending info about (%d)",
79903 real_packet->vote_no);
79904
79905#ifdef FREECIV_DELTA_PROTOCOL
79906 if (nullptr == *hash) {
79907 *hash = genhash_new_full(hash_packet_vote_update_100, cmp_packet_vote_update_100,
79908 nullptr, nullptr, nullptr, destroy_packet_vote_update);
79909 }
79910 BV_CLR_ALL(fields);
79911
79912 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79913 old = fc_malloc(sizeof(*old));
79914 /* temporary bitcopy just to insert correctly */
79915 *old = *real_packet;
79916 genhash_insert(*hash, old, old);
79917 init_packet_vote_update(old);
79918 different = 1; /* Force to send. */
79919 }
79920 differ = (old->yes != real_packet->yes);
79921 if (differ) {
79922 different++;
79923 BV_SET(fields, 0);
79924 }
79925
79926 differ = (old->no != real_packet->no);
79927 if (differ) {
79928 different++;
79929 BV_SET(fields, 1);
79930 }
79931
79932 differ = (old->abstain != real_packet->abstain);
79933 if (differ) {
79934 different++;
79935 BV_SET(fields, 2);
79936 }
79937
79938 differ = (old->num_voters != real_packet->num_voters);
79939 if (differ) {
79940 different++;
79941 BV_SET(fields, 3);
79942 }
79943
79944 if (different == 0) {
79945 log_packet_detailed(" no change -> discard");
79946 return 0;
79947 }
79948
79949#ifdef FREECIV_JSON_CONNECTION
79950 field_addr.name = "fields";
79951#endif /* FREECIV_JSON_CONNECTION */
79952 e = 0;
79953 e |= DIO_BV_PUT(&dout, &field_addr, fields);
79954 if (e) {
79955 log_packet_detailed("fields bitvector error detected");
79956 }
79957#ifdef FREECIV_JSON_CONNECTION
79958 field_addr.name = "vote_no";
79959#endif /* FREECIV_JSON_CONNECTION */
79960 e = 0;
79961 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
79962 if (e) {
79963 log_packet_detailed("'vote_no' field error detected");
79964 }
79965
79966 if (BV_ISSET(fields, 0)) {
79967 log_packet_detailed(" field 'yes' has changed");
79968#ifdef FREECIV_JSON_CONNECTION
79969 field_addr.name = "yes";
79970#endif /* FREECIV_JSON_CONNECTION */
79971 e = 0;
79972 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->yes);
79973 if (e) {
79974 log_packet_detailed("'yes' field error detected");
79975 }
79976 }
79977 if (BV_ISSET(fields, 1)) {
79978 log_packet_detailed(" field 'no' has changed");
79979#ifdef FREECIV_JSON_CONNECTION
79980 field_addr.name = "no";
79981#endif /* FREECIV_JSON_CONNECTION */
79982 e = 0;
79983 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->no);
79984 if (e) {
79985 log_packet_detailed("'no' field error detected");
79986 }
79987 }
79988 if (BV_ISSET(fields, 2)) {
79989 log_packet_detailed(" field 'abstain' has changed");
79990#ifdef FREECIV_JSON_CONNECTION
79991 field_addr.name = "abstain";
79992#endif /* FREECIV_JSON_CONNECTION */
79993 e = 0;
79994 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->abstain);
79995 if (e) {
79996 log_packet_detailed("'abstain' field error detected");
79997 }
79998 }
79999 if (BV_ISSET(fields, 3)) {
80000 log_packet_detailed(" field 'num_voters' has changed");
80001#ifdef FREECIV_JSON_CONNECTION
80002 field_addr.name = "num_voters";
80003#endif /* FREECIV_JSON_CONNECTION */
80004 e = 0;
80005 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_voters);
80006 if (e) {
80007 log_packet_detailed("'num_voters' field error detected");
80008 }
80009 }
80010
80011 *old = *real_packet;
80012#endif /* FREECIV_DELTA_PROTOCOL */
80013#ifndef FREECIV_DELTA_PROTOCOL
80014#ifdef FREECIV_JSON_CONNECTION
80015 field_addr.name = "vote_no";
80016#endif /* FREECIV_JSON_CONNECTION */
80017 e = 0;
80018 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
80019 if (e) {
80020 log_packet_detailed("'vote_no' field error detected");
80021 }
80022#ifdef FREECIV_JSON_CONNECTION
80023 field_addr.name = "yes";
80024#endif /* FREECIV_JSON_CONNECTION */
80025 e = 0;
80026 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->yes);
80027 if (e) {
80028 log_packet_detailed("'yes' field error detected");
80029 }
80030#ifdef FREECIV_JSON_CONNECTION
80031 field_addr.name = "no";
80032#endif /* FREECIV_JSON_CONNECTION */
80033 e = 0;
80034 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->no);
80035 if (e) {
80036 log_packet_detailed("'no' field error detected");
80037 }
80038#ifdef FREECIV_JSON_CONNECTION
80039 field_addr.name = "abstain";
80040#endif /* FREECIV_JSON_CONNECTION */
80041 e = 0;
80042 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->abstain);
80043 if (e) {
80044 log_packet_detailed("'abstain' field error detected");
80045 }
80046#ifdef FREECIV_JSON_CONNECTION
80047 field_addr.name = "num_voters";
80048#endif /* FREECIV_JSON_CONNECTION */
80049 e = 0;
80050 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_voters);
80051 if (e) {
80052 log_packet_detailed("'num_voters' field error detected");
80053 }
80054
80055#endif
80056 SEND_PACKET_END(PACKET_VOTE_UPDATE);
80057}
80058
80059 int send_packet_vote_update(struct connection *pc, const struct packet_vote_update *packet)
80060{
80061 if (!pc->used) {
80062 log_error("WARNING: trying to send data to the closed connection %s",
80063 conn_description(pc));
80064 return -1;
80065 }
80066 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_UPDATE].packet != nullptr, -1,
80067 "Handler for PACKET_VOTE_UPDATE not installed");
80068 return pc->phs.handlers->send[PACKET_VOTE_UPDATE].packet(pc, packet);
80069}
80070
80071 static inline void init_packet_vote_remove(struct packet_vote_remove *packet)
80072{
80073 memset(packet, 0, sizeof(*packet));
80074}
80075
80076#define free_packet_vote_remove(_packet) (void) 0
80077#define destroy_packet_vote_remove free
80078
80079#ifdef FREECIV_DELTA_PROTOCOL
80080#define hash_packet_vote_remove_100 hash_const
80081
80082#define cmp_packet_vote_remove_100 cmp_const
80083
80084 BV_DEFINE(packet_vote_remove_100_fields, 1);
80085#endif /* FREECIV_DELTA_PROTOCOL */
80086
80087 static struct packet_vote_remove *receive_packet_vote_remove_100(struct connection *pc)
80088{
80089#define FREE_PACKET_STRUCT(_packet) free_packet_vote_remove(_packet)
80090#ifdef FREECIV_DELTA_PROTOCOL
80091 packet_vote_remove_100_fields fields;
80092 struct packet_vote_remove *old;
80093 struct genhash **hash = pc->phs.received + PACKET_VOTE_REMOVE;
80094#endif /* FREECIV_DELTA_PROTOCOL */
80095 RECEIVE_PACKET_START(packet_vote_remove, real_packet);
80096#ifdef FREECIV_JSON_CONNECTION
80097 struct plocation field_addr;
80098 {
80099 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80100 field_addr = *field_addr_tmp;
80101 FC_FREE(field_addr_tmp);
80102 }
80103#endif /* FREECIV_JSON_CONNECTION */
80104
80105#ifdef FREECIV_DELTA_PROTOCOL
80106#ifdef FREECIV_JSON_CONNECTION
80107 field_addr.name = "fields";
80108#endif /* FREECIV_JSON_CONNECTION */
80109 DIO_BV_GET(&din, &field_addr, fields);
80110
80111#else /* FREECIV_DELTA_PROTOCOL */
80112#ifdef FREECIV_JSON_CONNECTION
80113 field_addr.name = "vote_no";
80114#endif /* FREECIV_JSON_CONNECTION */
80115 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
80116 RECEIVE_PACKET_FIELD_ERROR(vote_no);
80117 }
80118#endif
80119 log_packet_detailed("packet_vote_remove_100: got info about ()");
80120
80121#ifdef FREECIV_DELTA_PROTOCOL
80122 if (nullptr == *hash) {
80123 *hash = genhash_new_full(hash_packet_vote_remove_100, cmp_packet_vote_remove_100,
80124 nullptr, nullptr, nullptr, destroy_packet_vote_remove);
80125 }
80126
80127 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80128 *real_packet = *old;
80129 } else {
80130 /* packet is already initialized empty */
80131 log_packet_detailed(" no old info");
80132 }
80133
80134 if (BV_ISSET(fields, 0)) {
80135 log_packet_detailed(" got field 'vote_no'");
80136#ifdef FREECIV_JSON_CONNECTION
80137 field_addr.name = "vote_no";
80138#endif /* FREECIV_JSON_CONNECTION */
80139 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
80140 RECEIVE_PACKET_FIELD_ERROR(vote_no);
80141 }
80142 }
80143
80144 if (nullptr == old) {
80145 old = fc_malloc(sizeof(*old));
80146 init_packet_vote_remove(old);
80147 *old = *real_packet;
80148 genhash_insert(*hash, old, old);
80149 } else {
80150 *old = *real_packet;
80151 }
80152
80153#endif /* FREECIV_DELTA_PROTOCOL */
80154 RECEIVE_PACKET_END(real_packet);
80155#undef FREE_PACKET_STRUCT
80156}
80157
80158 static int send_packet_vote_remove_100(struct connection *pc, const struct packet_vote_remove *packet)
80159{
80160 const struct packet_vote_remove *real_packet = packet;
80161 int e;
80162#ifdef FREECIV_DELTA_PROTOCOL
80163 packet_vote_remove_100_fields fields;
80164 struct packet_vote_remove *old;
80165 bool differ;
80166 struct genhash **hash = pc->phs.sent + PACKET_VOTE_REMOVE;
80167#endif /* FREECIV_DELTA_PROTOCOL */
80168 SEND_PACKET_START(PACKET_VOTE_REMOVE);
80169#ifdef FREECIV_JSON_CONNECTION
80170 struct plocation field_addr;
80171 {
80172 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80173 field_addr = *field_addr_tmp;
80174 FC_FREE(field_addr_tmp);
80175 }
80176#endif /* FREECIV_JSON_CONNECTION */
80177
80178 log_packet_detailed("packet_vote_remove_100: sending info about ()");
80179
80180#ifdef FREECIV_DELTA_PROTOCOL
80181 if (nullptr == *hash) {
80182 *hash = genhash_new_full(hash_packet_vote_remove_100, cmp_packet_vote_remove_100,
80183 nullptr, nullptr, nullptr, destroy_packet_vote_remove);
80184 }
80185 BV_CLR_ALL(fields);
80186
80187 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80188 old = fc_malloc(sizeof(*old));
80189 /* temporary bitcopy just to insert correctly */
80190 *old = *real_packet;
80191 genhash_insert(*hash, old, old);
80192 init_packet_vote_remove(old);
80193 }
80194 differ = (old->vote_no != real_packet->vote_no);
80195 if (differ) {
80196 BV_SET(fields, 0);
80197 }
80198
80199
80200#ifdef FREECIV_JSON_CONNECTION
80201 field_addr.name = "fields";
80202#endif /* FREECIV_JSON_CONNECTION */
80203 e = 0;
80204 e |= DIO_BV_PUT(&dout, &field_addr, fields);
80205 if (e) {
80206 log_packet_detailed("fields bitvector error detected");
80207 }
80208
80209 if (BV_ISSET(fields, 0)) {
80210 log_packet_detailed(" field 'vote_no' has changed");
80211#ifdef FREECIV_JSON_CONNECTION
80212 field_addr.name = "vote_no";
80213#endif /* FREECIV_JSON_CONNECTION */
80214 e = 0;
80215 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
80216 if (e) {
80217 log_packet_detailed("'vote_no' field error detected");
80218 }
80219 }
80220
80221 *old = *real_packet;
80222#endif /* FREECIV_DELTA_PROTOCOL */
80223#ifndef FREECIV_DELTA_PROTOCOL
80224#ifdef FREECIV_JSON_CONNECTION
80225 field_addr.name = "vote_no";
80226#endif /* FREECIV_JSON_CONNECTION */
80227 e = 0;
80228 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
80229 if (e) {
80230 log_packet_detailed("'vote_no' field error detected");
80231 }
80232
80233#endif
80234 SEND_PACKET_END(PACKET_VOTE_REMOVE);
80235}
80236
80237 int send_packet_vote_remove(struct connection *pc, const struct packet_vote_remove *packet)
80238{
80239 if (!pc->used) {
80240 log_error("WARNING: trying to send data to the closed connection %s",
80241 conn_description(pc));
80242 return -1;
80243 }
80244 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_REMOVE].packet != nullptr, -1,
80245 "Handler for PACKET_VOTE_REMOVE not installed");
80246 return pc->phs.handlers->send[PACKET_VOTE_REMOVE].packet(pc, packet);
80247}
80248
80249 static inline void init_packet_vote_resolve(struct packet_vote_resolve *packet)
80250{
80251 memset(packet, 0, sizeof(*packet));
80252}
80253
80254#define free_packet_vote_resolve(_packet) (void) 0
80255#define destroy_packet_vote_resolve free
80256
80257#ifdef FREECIV_DELTA_PROTOCOL
80258#define hash_packet_vote_resolve_100 hash_const
80259
80260#define cmp_packet_vote_resolve_100 cmp_const
80261
80262 BV_DEFINE(packet_vote_resolve_100_fields, 2);
80263#endif /* FREECIV_DELTA_PROTOCOL */
80264
80265 static struct packet_vote_resolve *receive_packet_vote_resolve_100(struct connection *pc)
80266{
80267#define FREE_PACKET_STRUCT(_packet) free_packet_vote_resolve(_packet)
80268#ifdef FREECIV_DELTA_PROTOCOL
80269 packet_vote_resolve_100_fields fields;
80270 struct packet_vote_resolve *old;
80271 struct genhash **hash = pc->phs.received + PACKET_VOTE_RESOLVE;
80272#endif /* FREECIV_DELTA_PROTOCOL */
80273 RECEIVE_PACKET_START(packet_vote_resolve, real_packet);
80274#ifdef FREECIV_JSON_CONNECTION
80275 struct plocation field_addr;
80276 {
80277 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80278 field_addr = *field_addr_tmp;
80279 FC_FREE(field_addr_tmp);
80280 }
80281#endif /* FREECIV_JSON_CONNECTION */
80282
80283#ifdef FREECIV_DELTA_PROTOCOL
80284#ifdef FREECIV_JSON_CONNECTION
80285 field_addr.name = "fields";
80286#endif /* FREECIV_JSON_CONNECTION */
80287 DIO_BV_GET(&din, &field_addr, fields);
80288
80289#else /* FREECIV_DELTA_PROTOCOL */
80290#ifdef FREECIV_JSON_CONNECTION
80291 field_addr.name = "vote_no";
80292#endif /* FREECIV_JSON_CONNECTION */
80293 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
80294 RECEIVE_PACKET_FIELD_ERROR(vote_no);
80295 }
80296#ifdef FREECIV_JSON_CONNECTION
80297 field_addr.name = "passed";
80298#endif /* FREECIV_JSON_CONNECTION */
80299 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->passed)) {
80300 RECEIVE_PACKET_FIELD_ERROR(passed);
80301 }
80302#endif
80303 log_packet_detailed("packet_vote_resolve_100: got info about ()");
80304
80305#ifdef FREECIV_DELTA_PROTOCOL
80306 if (nullptr == *hash) {
80307 *hash = genhash_new_full(hash_packet_vote_resolve_100, cmp_packet_vote_resolve_100,
80308 nullptr, nullptr, nullptr, destroy_packet_vote_resolve);
80309 }
80310
80311 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80312 *real_packet = *old;
80313 } else {
80314 /* packet is already initialized empty */
80315 log_packet_detailed(" no old info");
80316 }
80317
80318 if (BV_ISSET(fields, 0)) {
80319 log_packet_detailed(" got field 'vote_no'");
80320#ifdef FREECIV_JSON_CONNECTION
80321 field_addr.name = "vote_no";
80322#endif /* FREECIV_JSON_CONNECTION */
80323 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
80324 RECEIVE_PACKET_FIELD_ERROR(vote_no);
80325 }
80326 }
80327 real_packet->passed = BV_ISSET(fields, 1);
80328
80329 if (nullptr == old) {
80330 old = fc_malloc(sizeof(*old));
80331 init_packet_vote_resolve(old);
80332 *old = *real_packet;
80333 genhash_insert(*hash, old, old);
80334 } else {
80335 *old = *real_packet;
80336 }
80337
80338#endif /* FREECIV_DELTA_PROTOCOL */
80339 RECEIVE_PACKET_END(real_packet);
80340#undef FREE_PACKET_STRUCT
80341}
80342
80343 static int send_packet_vote_resolve_100(struct connection *pc, const struct packet_vote_resolve *packet)
80344{
80345 const struct packet_vote_resolve *real_packet = packet;
80346 int e;
80347#ifdef FREECIV_DELTA_PROTOCOL
80348 packet_vote_resolve_100_fields fields;
80349 struct packet_vote_resolve *old;
80350 bool differ;
80351 struct genhash **hash = pc->phs.sent + PACKET_VOTE_RESOLVE;
80352#endif /* FREECIV_DELTA_PROTOCOL */
80353 SEND_PACKET_START(PACKET_VOTE_RESOLVE);
80354#ifdef FREECIV_JSON_CONNECTION
80355 struct plocation field_addr;
80356 {
80357 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80358 field_addr = *field_addr_tmp;
80359 FC_FREE(field_addr_tmp);
80360 }
80361#endif /* FREECIV_JSON_CONNECTION */
80362
80363 log_packet_detailed("packet_vote_resolve_100: sending info about ()");
80364
80365#ifdef FREECIV_DELTA_PROTOCOL
80366 if (nullptr == *hash) {
80367 *hash = genhash_new_full(hash_packet_vote_resolve_100, cmp_packet_vote_resolve_100,
80368 nullptr, nullptr, nullptr, destroy_packet_vote_resolve);
80369 }
80370 BV_CLR_ALL(fields);
80371
80372 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80373 old = fc_malloc(sizeof(*old));
80374 /* temporary bitcopy just to insert correctly */
80375 *old = *real_packet;
80376 genhash_insert(*hash, old, old);
80377 init_packet_vote_resolve(old);
80378 }
80379 differ = (old->vote_no != real_packet->vote_no);
80380 if (differ) {
80381 BV_SET(fields, 0);
80382 }
80383
80384 if (packet->passed) {
80385 BV_SET(fields, 1);
80386 }
80387
80388
80389#ifdef FREECIV_JSON_CONNECTION
80390 field_addr.name = "fields";
80391#endif /* FREECIV_JSON_CONNECTION */
80392 e = 0;
80393 e |= DIO_BV_PUT(&dout, &field_addr, fields);
80394 if (e) {
80395 log_packet_detailed("fields bitvector error detected");
80396 }
80397
80398 if (BV_ISSET(fields, 0)) {
80399 log_packet_detailed(" field 'vote_no' has changed");
80400#ifdef FREECIV_JSON_CONNECTION
80401 field_addr.name = "vote_no";
80402#endif /* FREECIV_JSON_CONNECTION */
80403 e = 0;
80404 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
80405 if (e) {
80406 log_packet_detailed("'vote_no' field error detected");
80407 }
80408 }
80409 /* field 1 is folded into the header */
80410
80411 *old = *real_packet;
80412#endif /* FREECIV_DELTA_PROTOCOL */
80413#ifndef FREECIV_DELTA_PROTOCOL
80414#ifdef FREECIV_JSON_CONNECTION
80415 field_addr.name = "vote_no";
80416#endif /* FREECIV_JSON_CONNECTION */
80417 e = 0;
80418 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
80419 if (e) {
80420 log_packet_detailed("'vote_no' field error detected");
80421 }
80422#ifdef FREECIV_JSON_CONNECTION
80423 field_addr.name = "passed";
80424#endif /* FREECIV_JSON_CONNECTION */
80425 e = 0;
80426 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->passed);
80427 if (e) {
80428 log_packet_detailed("'passed' field error detected");
80429 }
80430
80431#endif
80432 SEND_PACKET_END(PACKET_VOTE_RESOLVE);
80433}
80434
80435 int send_packet_vote_resolve(struct connection *pc, const struct packet_vote_resolve *packet)
80436{
80437 if (!pc->used) {
80438 log_error("WARNING: trying to send data to the closed connection %s",
80439 conn_description(pc));
80440 return -1;
80441 }
80442 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_RESOLVE].packet != nullptr, -1,
80443 "Handler for PACKET_VOTE_RESOLVE not installed");
80444 return pc->phs.handlers->send[PACKET_VOTE_RESOLVE].packet(pc, packet);
80445}
80446
80447 static inline void init_packet_vote_submit(struct packet_vote_submit *packet)
80448{
80449 memset(packet, 0, sizeof(*packet));
80450}
80451
80452#define free_packet_vote_submit(_packet) (void) 0
80453#define destroy_packet_vote_submit free
80454
80455 static struct packet_vote_submit *receive_packet_vote_submit_100(struct connection *pc)
80456{
80457#define FREE_PACKET_STRUCT(_packet) free_packet_vote_submit(_packet)
80458 RECEIVE_PACKET_START(packet_vote_submit, real_packet);
80459#ifdef FREECIV_JSON_CONNECTION
80460 struct plocation field_addr;
80461 {
80462 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80463 field_addr = *field_addr_tmp;
80464 FC_FREE(field_addr_tmp);
80465 }
80466#endif /* FREECIV_JSON_CONNECTION */
80467#if 1 /* To match endif */
80468#ifdef FREECIV_JSON_CONNECTION
80469 field_addr.name = "vote_no";
80470#endif /* FREECIV_JSON_CONNECTION */
80471 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
80472 RECEIVE_PACKET_FIELD_ERROR(vote_no);
80473 }
80474#ifdef FREECIV_JSON_CONNECTION
80475 field_addr.name = "value";
80476#endif /* FREECIV_JSON_CONNECTION */
80477 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->value)) {
80478 RECEIVE_PACKET_FIELD_ERROR(value);
80479 }
80480#endif
80481 log_packet_detailed("packet_vote_submit_100: got info about ()");
80482 RECEIVE_PACKET_END(real_packet);
80483#undef FREE_PACKET_STRUCT
80484}
80485
80486 static int send_packet_vote_submit_100(struct connection *pc, const struct packet_vote_submit *packet)
80487{
80488 const struct packet_vote_submit *real_packet = packet;
80489 int e;
80490 SEND_PACKET_START(PACKET_VOTE_SUBMIT);
80491#ifdef FREECIV_JSON_CONNECTION
80492 struct plocation field_addr;
80493 {
80494 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80495 field_addr = *field_addr_tmp;
80496 FC_FREE(field_addr_tmp);
80497 }
80498#endif /* FREECIV_JSON_CONNECTION */
80499
80500 log_packet_detailed("packet_vote_submit_100: sending info about ()");
80501#if 1 /* To match endif */
80502#ifdef FREECIV_JSON_CONNECTION
80503 field_addr.name = "vote_no";
80504#endif /* FREECIV_JSON_CONNECTION */
80505 e = 0;
80506 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
80507 if (e) {
80508 log_packet_detailed("'vote_no' field error detected");
80509 }
80510#ifdef FREECIV_JSON_CONNECTION
80511 field_addr.name = "value";
80512#endif /* FREECIV_JSON_CONNECTION */
80513 e = 0;
80514 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->value);
80515 if (e) {
80516 log_packet_detailed("'value' field error detected");
80517 }
80518
80519#endif
80520 SEND_PACKET_END(PACKET_VOTE_SUBMIT);
80521}
80522
80523 int send_packet_vote_submit(struct connection *pc, const struct packet_vote_submit *packet)
80524{
80525 if (!pc->used) {
80526 log_error("WARNING: trying to send data to the closed connection %s",
80527 conn_description(pc));
80528 return -1;
80529 }
80530 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_SUBMIT].packet != nullptr, -1,
80531 "Handler for PACKET_VOTE_SUBMIT not installed");
80532 return pc->phs.handlers->send[PACKET_VOTE_SUBMIT].packet(pc, packet);
80533}
80534
80535 static inline void init_packet_edit_mode(struct packet_edit_mode *packet)
80536{
80537 memset(packet, 0, sizeof(*packet));
80538}
80539
80540#define free_packet_edit_mode(_packet) (void) 0
80541#define destroy_packet_edit_mode free
80542
80543#ifdef FREECIV_DELTA_PROTOCOL
80544#define hash_packet_edit_mode_100 hash_const
80545
80546#define cmp_packet_edit_mode_100 cmp_const
80547
80548 BV_DEFINE(packet_edit_mode_100_fields, 1);
80549#endif /* FREECIV_DELTA_PROTOCOL */
80550
80551 static struct packet_edit_mode *receive_packet_edit_mode_100(struct connection *pc)
80552{
80553#define FREE_PACKET_STRUCT(_packet) free_packet_edit_mode(_packet)
80554#ifdef FREECIV_DELTA_PROTOCOL
80555 packet_edit_mode_100_fields fields;
80556 struct packet_edit_mode *old;
80557 struct genhash **hash = pc->phs.received + PACKET_EDIT_MODE;
80558#endif /* FREECIV_DELTA_PROTOCOL */
80559 RECEIVE_PACKET_START(packet_edit_mode, real_packet);
80560#ifdef FREECIV_JSON_CONNECTION
80561 struct plocation field_addr;
80562 {
80563 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80564 field_addr = *field_addr_tmp;
80565 FC_FREE(field_addr_tmp);
80566 }
80567#endif /* FREECIV_JSON_CONNECTION */
80568
80569#ifdef FREECIV_DELTA_PROTOCOL
80570#ifdef FREECIV_JSON_CONNECTION
80571 field_addr.name = "fields";
80572#endif /* FREECIV_JSON_CONNECTION */
80573 DIO_BV_GET(&din, &field_addr, fields);
80574
80575#else /* FREECIV_DELTA_PROTOCOL */
80576#ifdef FREECIV_JSON_CONNECTION
80577 field_addr.name = "state";
80578#endif /* FREECIV_JSON_CONNECTION */
80579 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->state)) {
80580 RECEIVE_PACKET_FIELD_ERROR(state);
80581 }
80582#endif
80583 log_packet_detailed("packet_edit_mode_100: got info about ()");
80584
80585#ifdef FREECIV_DELTA_PROTOCOL
80586 if (nullptr == *hash) {
80587 *hash = genhash_new_full(hash_packet_edit_mode_100, cmp_packet_edit_mode_100,
80588 nullptr, nullptr, nullptr, destroy_packet_edit_mode);
80589 }
80590
80591 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80592 *real_packet = *old;
80593 } else {
80594 /* packet is already initialized empty */
80595 log_packet_detailed(" no old info");
80596 }
80597
80598 real_packet->state = BV_ISSET(fields, 0);
80599
80600 if (nullptr == old) {
80601 old = fc_malloc(sizeof(*old));
80602 init_packet_edit_mode(old);
80603 *old = *real_packet;
80604 genhash_insert(*hash, old, old);
80605 } else {
80606 *old = *real_packet;
80607 }
80608
80609#endif /* FREECIV_DELTA_PROTOCOL */
80610 RECEIVE_PACKET_END(real_packet);
80611#undef FREE_PACKET_STRUCT
80612}
80613
80614 static int send_packet_edit_mode_100(struct connection *pc, const struct packet_edit_mode *packet)
80615{
80616 const struct packet_edit_mode *real_packet = packet;
80617 int e;
80618#ifdef FREECIV_DELTA_PROTOCOL
80619 packet_edit_mode_100_fields fields;
80620 struct packet_edit_mode *old;
80621 struct genhash **hash = pc->phs.sent + PACKET_EDIT_MODE;
80622#endif /* FREECIV_DELTA_PROTOCOL */
80623 SEND_PACKET_START(PACKET_EDIT_MODE);
80624#ifdef FREECIV_JSON_CONNECTION
80625 struct plocation field_addr;
80626 {
80627 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80628 field_addr = *field_addr_tmp;
80629 FC_FREE(field_addr_tmp);
80630 }
80631#endif /* FREECIV_JSON_CONNECTION */
80632
80633 log_packet_detailed("packet_edit_mode_100: sending info about ()");
80634
80635#ifdef FREECIV_DELTA_PROTOCOL
80636 if (nullptr == *hash) {
80637 *hash = genhash_new_full(hash_packet_edit_mode_100, cmp_packet_edit_mode_100,
80638 nullptr, nullptr, nullptr, destroy_packet_edit_mode);
80639 }
80640 BV_CLR_ALL(fields);
80641
80642 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80643 old = fc_malloc(sizeof(*old));
80644 /* temporary bitcopy just to insert correctly */
80645 *old = *real_packet;
80646 genhash_insert(*hash, old, old);
80647 init_packet_edit_mode(old);
80648 }
80649 if (packet->state) {
80650 BV_SET(fields, 0);
80651 }
80652
80653
80654#ifdef FREECIV_JSON_CONNECTION
80655 field_addr.name = "fields";
80656#endif /* FREECIV_JSON_CONNECTION */
80657 e = 0;
80658 e |= DIO_BV_PUT(&dout, &field_addr, fields);
80659 if (e) {
80660 log_packet_detailed("fields bitvector error detected");
80661 }
80662
80663 /* field 0 is folded into the header */
80664
80665 *old = *real_packet;
80666#endif /* FREECIV_DELTA_PROTOCOL */
80667#ifndef FREECIV_DELTA_PROTOCOL
80668#ifdef FREECIV_JSON_CONNECTION
80669 field_addr.name = "state";
80670#endif /* FREECIV_JSON_CONNECTION */
80671 e = 0;
80672 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->state);
80673 if (e) {
80674 log_packet_detailed("'state' field error detected");
80675 }
80676
80677#endif
80678 SEND_PACKET_END(PACKET_EDIT_MODE);
80679}
80680
80681 int send_packet_edit_mode(struct connection *pc, const struct packet_edit_mode *packet)
80682{
80683 if (!pc->used) {
80684 log_error("WARNING: trying to send data to the closed connection %s",
80685 conn_description(pc));
80686 return -1;
80687 }
80688 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_MODE].packet != nullptr, -1,
80689 "Handler for PACKET_EDIT_MODE not installed");
80690 return pc->phs.handlers->send[PACKET_EDIT_MODE].packet(pc, packet);
80691}
80692
80693 int dsend_packet_edit_mode(struct connection *pc, bool state)
80694{
80695 struct packet_edit_mode packet, *real_packet = &packet;
80696
80697 real_packet->state = state;
80698
80699 return send_packet_edit_mode(pc, real_packet);
80700}
80701
80702 static inline void init_packet_edit_recalculate_borders(struct packet_edit_recalculate_borders *packet)
80703{
80704 memset(packet, 0, sizeof(*packet));
80705}
80706
80707#define free_packet_edit_recalculate_borders(_packet) (void) 0
80708#define destroy_packet_edit_recalculate_borders free
80709
80710 static struct packet_edit_recalculate_borders *receive_packet_edit_recalculate_borders_100(struct connection *pc)
80711{
80712#define FREE_PACKET_STRUCT(_packet) free_packet_edit_recalculate_borders(_packet)
80713 RECEIVE_PACKET_START(packet_edit_recalculate_borders, real_packet);
80714#if 1 /* To match endif */
80715 real_packet->__dummy = 0xff;
80716#endif
80717 log_packet_detailed("packet_edit_recalculate_borders_100: got info about ()");
80718 RECEIVE_PACKET_END(real_packet);
80719#undef FREE_PACKET_STRUCT
80720}
80721
80722 static int send_packet_edit_recalculate_borders_100(struct connection *pc)
80723{
80724 SEND_PACKET_START(PACKET_EDIT_RECALCULATE_BORDERS);
80725
80726 log_packet_detailed("packet_edit_recalculate_borders_100: sending info about ()");
80727 SEND_PACKET_END(PACKET_EDIT_RECALCULATE_BORDERS);
80728}
80729
80730 int send_packet_edit_recalculate_borders(struct connection *pc)
80731{
80732 if (!pc->used) {
80733 log_error("WARNING: trying to send data to the closed connection %s",
80734 conn_description(pc));
80735 return -1;
80736 }
80737 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet != nullptr, -1,
80738 "Handler for PACKET_EDIT_RECALCULATE_BORDERS not installed");
80739 return pc->phs.handlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet(pc);
80740}
80741
80742 static inline void init_packet_edit_check_tiles(struct packet_edit_check_tiles *packet)
80743{
80744 memset(packet, 0, sizeof(*packet));
80745}
80746
80747#define free_packet_edit_check_tiles(_packet) (void) 0
80748#define destroy_packet_edit_check_tiles free
80749
80750 static struct packet_edit_check_tiles *receive_packet_edit_check_tiles_100(struct connection *pc)
80751{
80752#define FREE_PACKET_STRUCT(_packet) free_packet_edit_check_tiles(_packet)
80753 RECEIVE_PACKET_START(packet_edit_check_tiles, real_packet);
80754#if 1 /* To match endif */
80755 real_packet->__dummy = 0xff;
80756#endif
80757 log_packet_detailed("packet_edit_check_tiles_100: got info about ()");
80758 RECEIVE_PACKET_END(real_packet);
80759#undef FREE_PACKET_STRUCT
80760}
80761
80762 static int send_packet_edit_check_tiles_100(struct connection *pc)
80763{
80764 SEND_PACKET_START(PACKET_EDIT_CHECK_TILES);
80765
80766 log_packet_detailed("packet_edit_check_tiles_100: sending info about ()");
80767 SEND_PACKET_END(PACKET_EDIT_CHECK_TILES);
80768}
80769
80770 int send_packet_edit_check_tiles(struct connection *pc)
80771{
80772 if (!pc->used) {
80773 log_error("WARNING: trying to send data to the closed connection %s",
80774 conn_description(pc));
80775 return -1;
80776 }
80777 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CHECK_TILES].no_packet != nullptr, -1,
80778 "Handler for PACKET_EDIT_CHECK_TILES not installed");
80779 return pc->phs.handlers->send[PACKET_EDIT_CHECK_TILES].no_packet(pc);
80780}
80781
80782 static inline void init_packet_edit_toggle_fogofwar(struct packet_edit_toggle_fogofwar *packet)
80783{
80784 memset(packet, 0, sizeof(*packet));
80785}
80786
80787#define free_packet_edit_toggle_fogofwar(_packet) (void) 0
80788#define destroy_packet_edit_toggle_fogofwar free
80789
80790#ifdef FREECIV_DELTA_PROTOCOL
80791#define hash_packet_edit_toggle_fogofwar_100 hash_const
80792
80793#define cmp_packet_edit_toggle_fogofwar_100 cmp_const
80794
80795 BV_DEFINE(packet_edit_toggle_fogofwar_100_fields, 1);
80796#endif /* FREECIV_DELTA_PROTOCOL */
80797
80798 static struct packet_edit_toggle_fogofwar *receive_packet_edit_toggle_fogofwar_100(struct connection *pc)
80799{
80800#define FREE_PACKET_STRUCT(_packet) free_packet_edit_toggle_fogofwar(_packet)
80801#ifdef FREECIV_DELTA_PROTOCOL
80802 packet_edit_toggle_fogofwar_100_fields fields;
80803 struct packet_edit_toggle_fogofwar *old;
80804 struct genhash **hash = pc->phs.received + PACKET_EDIT_TOGGLE_FOGOFWAR;
80805#endif /* FREECIV_DELTA_PROTOCOL */
80806 RECEIVE_PACKET_START(packet_edit_toggle_fogofwar, real_packet);
80807#ifdef FREECIV_JSON_CONNECTION
80808 struct plocation field_addr;
80809 {
80810 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80811 field_addr = *field_addr_tmp;
80812 FC_FREE(field_addr_tmp);
80813 }
80814#endif /* FREECIV_JSON_CONNECTION */
80815
80816#ifdef FREECIV_DELTA_PROTOCOL
80817#ifdef FREECIV_JSON_CONNECTION
80818 field_addr.name = "fields";
80819#endif /* FREECIV_JSON_CONNECTION */
80820 DIO_BV_GET(&din, &field_addr, fields);
80821
80822#else /* FREECIV_DELTA_PROTOCOL */
80823#ifdef FREECIV_JSON_CONNECTION
80824 field_addr.name = "player";
80825#endif /* FREECIV_JSON_CONNECTION */
80826 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player)) {
80827 RECEIVE_PACKET_FIELD_ERROR(player);
80828 }
80829#endif
80830 log_packet_detailed("packet_edit_toggle_fogofwar_100: got info about ()");
80831
80832#ifdef FREECIV_DELTA_PROTOCOL
80833 if (nullptr == *hash) {
80834 *hash = genhash_new_full(hash_packet_edit_toggle_fogofwar_100, cmp_packet_edit_toggle_fogofwar_100,
80835 nullptr, nullptr, nullptr, destroy_packet_edit_toggle_fogofwar);
80836 }
80837
80838 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80839 *real_packet = *old;
80840 } else {
80841 /* packet is already initialized empty */
80842 log_packet_detailed(" no old info");
80843 }
80844
80845 if (BV_ISSET(fields, 0)) {
80846 log_packet_detailed(" got field 'player'");
80847#ifdef FREECIV_JSON_CONNECTION
80848 field_addr.name = "player";
80849#endif /* FREECIV_JSON_CONNECTION */
80850 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player)) {
80851 RECEIVE_PACKET_FIELD_ERROR(player);
80852 }
80853 }
80854
80855 if (nullptr == old) {
80856 old = fc_malloc(sizeof(*old));
80857 init_packet_edit_toggle_fogofwar(old);
80858 *old = *real_packet;
80859 genhash_insert(*hash, old, old);
80860 } else {
80861 *old = *real_packet;
80862 }
80863
80864#endif /* FREECIV_DELTA_PROTOCOL */
80865 RECEIVE_PACKET_END(real_packet);
80866#undef FREE_PACKET_STRUCT
80867}
80868
80869 static int send_packet_edit_toggle_fogofwar_100(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
80870{
80871 const struct packet_edit_toggle_fogofwar *real_packet = packet;
80872 int e;
80873#ifdef FREECIV_DELTA_PROTOCOL
80874 packet_edit_toggle_fogofwar_100_fields fields;
80875 struct packet_edit_toggle_fogofwar *old;
80876 bool differ;
80877 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TOGGLE_FOGOFWAR;
80878#endif /* FREECIV_DELTA_PROTOCOL */
80879 SEND_PACKET_START(PACKET_EDIT_TOGGLE_FOGOFWAR);
80880#ifdef FREECIV_JSON_CONNECTION
80881 struct plocation field_addr;
80882 {
80883 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
80884 field_addr = *field_addr_tmp;
80885 FC_FREE(field_addr_tmp);
80886 }
80887#endif /* FREECIV_JSON_CONNECTION */
80888
80889 log_packet_detailed("packet_edit_toggle_fogofwar_100: sending info about ()");
80890
80891#ifdef FREECIV_DELTA_PROTOCOL
80892 if (nullptr == *hash) {
80893 *hash = genhash_new_full(hash_packet_edit_toggle_fogofwar_100, cmp_packet_edit_toggle_fogofwar_100,
80894 nullptr, nullptr, nullptr, destroy_packet_edit_toggle_fogofwar);
80895 }
80896 BV_CLR_ALL(fields);
80897
80898 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80899 old = fc_malloc(sizeof(*old));
80900 /* temporary bitcopy just to insert correctly */
80901 *old = *real_packet;
80902 genhash_insert(*hash, old, old);
80903 init_packet_edit_toggle_fogofwar(old);
80904 }
80905 differ = (old->player != real_packet->player);
80906 if (differ) {
80907 BV_SET(fields, 0);
80908 }
80909
80910
80911#ifdef FREECIV_JSON_CONNECTION
80912 field_addr.name = "fields";
80913#endif /* FREECIV_JSON_CONNECTION */
80914 e = 0;
80915 e |= DIO_BV_PUT(&dout, &field_addr, fields);
80916 if (e) {
80917 log_packet_detailed("fields bitvector error detected");
80918 }
80919
80920 if (BV_ISSET(fields, 0)) {
80921 log_packet_detailed(" field 'player' has changed");
80922#ifdef FREECIV_JSON_CONNECTION
80923 field_addr.name = "player";
80924#endif /* FREECIV_JSON_CONNECTION */
80925 e = 0;
80926 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player);
80927 if (e) {
80928 log_packet_detailed("'player' field error detected");
80929 }
80930 }
80931
80932 *old = *real_packet;
80933#endif /* FREECIV_DELTA_PROTOCOL */
80934#ifndef FREECIV_DELTA_PROTOCOL
80935#ifdef FREECIV_JSON_CONNECTION
80936 field_addr.name = "player";
80937#endif /* FREECIV_JSON_CONNECTION */
80938 e = 0;
80939 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player);
80940 if (e) {
80941 log_packet_detailed("'player' field error detected");
80942 }
80943
80944#endif
80945 SEND_PACKET_END(PACKET_EDIT_TOGGLE_FOGOFWAR);
80946}
80947
80948 int send_packet_edit_toggle_fogofwar(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
80949{
80950 if (!pc->used) {
80951 log_error("WARNING: trying to send data to the closed connection %s",
80952 conn_description(pc));
80953 return -1;
80954 }
80955 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet != nullptr, -1,
80956 "Handler for PACKET_EDIT_TOGGLE_FOGOFWAR not installed");
80957 return pc->phs.handlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet(pc, packet);
80958}
80959
80960 int dsend_packet_edit_toggle_fogofwar(struct connection *pc, int player)
80961{
80962 struct packet_edit_toggle_fogofwar packet, *real_packet = &packet;
80963
80964 real_packet->player = player;
80965
80966 return send_packet_edit_toggle_fogofwar(pc, real_packet);
80967}
80968
80969 static inline void init_packet_edit_tile_terrain(struct packet_edit_tile_terrain *packet)
80970{
80971 memset(packet, 0, sizeof(*packet));
80972}
80973
80974#define free_packet_edit_tile_terrain(_packet) (void) 0
80975#define destroy_packet_edit_tile_terrain free
80976
80977#ifdef FREECIV_DELTA_PROTOCOL
80978static genhash_val_t hash_packet_edit_tile_terrain_100(const void *vkey)
80979{
80980 const struct packet_edit_tile_terrain *key = (const struct packet_edit_tile_terrain *) vkey;
80981 genhash_val_t result = 0;
80982
80983 result += key->tile;
80984
80985 result &= 0xFFFFFFFF;
80986 return result;
80987}
80988
80989static bool cmp_packet_edit_tile_terrain_100(const void *vkey1, const void *vkey2)
80990{
80991 const struct packet_edit_tile_terrain *old = (const struct packet_edit_tile_terrain *) vkey1;
80992 const struct packet_edit_tile_terrain *real_packet = (const struct packet_edit_tile_terrain *) vkey2;
80993 bool differ;
80994
80995 differ = (old->tile != real_packet->tile);
80996
80997 return !differ;
80998}
80999 BV_DEFINE(packet_edit_tile_terrain_100_fields, 2);
81000#endif /* FREECIV_DELTA_PROTOCOL */
81001
81002 static struct packet_edit_tile_terrain *receive_packet_edit_tile_terrain_100(struct connection *pc)
81003{
81004#define FREE_PACKET_STRUCT(_packet) free_packet_edit_tile_terrain(_packet)
81005#ifdef FREECIV_DELTA_PROTOCOL
81006 packet_edit_tile_terrain_100_fields fields;
81007 struct packet_edit_tile_terrain *old;
81008 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE_TERRAIN;
81009#endif /* FREECIV_DELTA_PROTOCOL */
81010 RECEIVE_PACKET_START(packet_edit_tile_terrain, real_packet);
81011#ifdef FREECIV_JSON_CONNECTION
81012 struct plocation field_addr;
81013 {
81014 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81015 field_addr = *field_addr_tmp;
81016 FC_FREE(field_addr_tmp);
81017 }
81018#endif /* FREECIV_JSON_CONNECTION */
81019
81020#ifdef FREECIV_DELTA_PROTOCOL
81021#ifdef FREECIV_JSON_CONNECTION
81022 field_addr.name = "fields";
81023#endif /* FREECIV_JSON_CONNECTION */
81024 DIO_BV_GET(&din, &field_addr, fields);
81025#ifdef FREECIV_JSON_CONNECTION
81026 field_addr.name = "tile";
81027#endif /* FREECIV_JSON_CONNECTION */
81028 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
81029 RECEIVE_PACKET_FIELD_ERROR(tile);
81030 }
81031
81032#else /* FREECIV_DELTA_PROTOCOL */
81033#ifdef FREECIV_JSON_CONNECTION
81034 field_addr.name = "tile";
81035#endif /* FREECIV_JSON_CONNECTION */
81036 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
81037 RECEIVE_PACKET_FIELD_ERROR(tile);
81038 }
81039#ifdef FREECIV_JSON_CONNECTION
81040 field_addr.name = "terrain";
81041#endif /* FREECIV_JSON_CONNECTION */
81042 {
81043 int readin;
81044
81045 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81046 RECEIVE_PACKET_FIELD_ERROR(terrain);
81047 }
81048 real_packet->terrain = readin;
81049 }
81050#ifdef FREECIV_JSON_CONNECTION
81051 field_addr.name = "size";
81052#endif /* FREECIV_JSON_CONNECTION */
81053 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
81054 RECEIVE_PACKET_FIELD_ERROR(size);
81055 }
81056#endif
81057 log_packet_detailed("packet_edit_tile_terrain_100: got info about (%d)",
81058 real_packet->tile);
81059
81060#ifdef FREECIV_DELTA_PROTOCOL
81061 if (nullptr == *hash) {
81062 *hash = genhash_new_full(hash_packet_edit_tile_terrain_100, cmp_packet_edit_tile_terrain_100,
81063 nullptr, nullptr, nullptr, destroy_packet_edit_tile_terrain);
81064 }
81065
81066 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
81067 *real_packet = *old;
81068 } else {
81069 /* packet is already initialized empty */
81070 log_packet_detailed(" no old info");
81071 }
81072
81073 if (BV_ISSET(fields, 0)) {
81074 log_packet_detailed(" got field 'terrain'");
81075#ifdef FREECIV_JSON_CONNECTION
81076 field_addr.name = "terrain";
81077#endif /* FREECIV_JSON_CONNECTION */
81078 {
81079 int readin;
81080
81081 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81082 RECEIVE_PACKET_FIELD_ERROR(terrain);
81083 }
81084 real_packet->terrain = readin;
81085 }
81086 }
81087 if (BV_ISSET(fields, 1)) {
81088 log_packet_detailed(" got field 'size'");
81089#ifdef FREECIV_JSON_CONNECTION
81090 field_addr.name = "size";
81091#endif /* FREECIV_JSON_CONNECTION */
81092 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
81093 RECEIVE_PACKET_FIELD_ERROR(size);
81094 }
81095 }
81096
81097 if (nullptr == old) {
81098 old = fc_malloc(sizeof(*old));
81099 init_packet_edit_tile_terrain(old);
81100 *old = *real_packet;
81101 genhash_insert(*hash, old, old);
81102 } else {
81103 *old = *real_packet;
81104 }
81105
81106#endif /* FREECIV_DELTA_PROTOCOL */
81107 RECEIVE_PACKET_END(real_packet);
81108#undef FREE_PACKET_STRUCT
81109}
81110
81111 static int send_packet_edit_tile_terrain_100(struct connection *pc, const struct packet_edit_tile_terrain *packet)
81112{
81113 const struct packet_edit_tile_terrain *real_packet = packet;
81114 int e;
81115#ifdef FREECIV_DELTA_PROTOCOL
81116 packet_edit_tile_terrain_100_fields fields;
81117 struct packet_edit_tile_terrain *old;
81118 bool differ;
81119 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE_TERRAIN;
81120#endif /* FREECIV_DELTA_PROTOCOL */
81121 SEND_PACKET_START(PACKET_EDIT_TILE_TERRAIN);
81122#ifdef FREECIV_JSON_CONNECTION
81123 struct plocation field_addr;
81124 {
81125 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81126 field_addr = *field_addr_tmp;
81127 FC_FREE(field_addr_tmp);
81128 }
81129#endif /* FREECIV_JSON_CONNECTION */
81130
81131 log_packet_detailed("packet_edit_tile_terrain_100: sending info about (%d)",
81132 real_packet->tile);
81133
81134#ifdef FREECIV_DELTA_PROTOCOL
81135 if (nullptr == *hash) {
81136 *hash = genhash_new_full(hash_packet_edit_tile_terrain_100, cmp_packet_edit_tile_terrain_100,
81137 nullptr, nullptr, nullptr, destroy_packet_edit_tile_terrain);
81138 }
81139 BV_CLR_ALL(fields);
81140
81141 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
81142 old = fc_malloc(sizeof(*old));
81143 /* temporary bitcopy just to insert correctly */
81144 *old = *real_packet;
81145 genhash_insert(*hash, old, old);
81146 init_packet_edit_tile_terrain(old);
81147 }
81148 differ = (old->terrain != real_packet->terrain);
81149 if (differ) {
81150 BV_SET(fields, 0);
81151 }
81152
81153 differ = (old->size != real_packet->size);
81154 if (differ) {
81155 BV_SET(fields, 1);
81156 }
81157
81158
81159#ifdef FREECIV_JSON_CONNECTION
81160 field_addr.name = "fields";
81161#endif /* FREECIV_JSON_CONNECTION */
81162 e = 0;
81163 e |= DIO_BV_PUT(&dout, &field_addr, fields);
81164 if (e) {
81165 log_packet_detailed("fields bitvector error detected");
81166 }
81167#ifdef FREECIV_JSON_CONNECTION
81168 field_addr.name = "tile";
81169#endif /* FREECIV_JSON_CONNECTION */
81170 e = 0;
81171 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
81172 if (e) {
81173 log_packet_detailed("'tile' field error detected");
81174 }
81175
81176 if (BV_ISSET(fields, 0)) {
81177 log_packet_detailed(" field 'terrain' has changed");
81178#ifdef FREECIV_JSON_CONNECTION
81179 field_addr.name = "terrain";
81180#endif /* FREECIV_JSON_CONNECTION */
81181 e = 0;
81182 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
81183 if (e) {
81184 log_packet_detailed("'terrain' field error detected");
81185 }
81186 }
81187 if (BV_ISSET(fields, 1)) {
81188 log_packet_detailed(" field 'size' has changed");
81189#ifdef FREECIV_JSON_CONNECTION
81190 field_addr.name = "size";
81191#endif /* FREECIV_JSON_CONNECTION */
81192 e = 0;
81193 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
81194 if (e) {
81195 log_packet_detailed("'size' field error detected");
81196 }
81197 }
81198
81199 *old = *real_packet;
81200#endif /* FREECIV_DELTA_PROTOCOL */
81201#ifndef FREECIV_DELTA_PROTOCOL
81202#ifdef FREECIV_JSON_CONNECTION
81203 field_addr.name = "tile";
81204#endif /* FREECIV_JSON_CONNECTION */
81205 e = 0;
81206 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
81207 if (e) {
81208 log_packet_detailed("'tile' field error detected");
81209 }
81210#ifdef FREECIV_JSON_CONNECTION
81211 field_addr.name = "terrain";
81212#endif /* FREECIV_JSON_CONNECTION */
81213 e = 0;
81214 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
81215 if (e) {
81216 log_packet_detailed("'terrain' field error detected");
81217 }
81218#ifdef FREECIV_JSON_CONNECTION
81219 field_addr.name = "size";
81220#endif /* FREECIV_JSON_CONNECTION */
81221 e = 0;
81222 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
81223 if (e) {
81224 log_packet_detailed("'size' field error detected");
81225 }
81226
81227#endif
81228 SEND_PACKET_END(PACKET_EDIT_TILE_TERRAIN);
81229}
81230
81231 int send_packet_edit_tile_terrain(struct connection *pc, const struct packet_edit_tile_terrain *packet)
81232{
81233 if (!pc->used) {
81234 log_error("WARNING: trying to send data to the closed connection %s",
81235 conn_description(pc));
81236 return -1;
81237 }
81238 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE_TERRAIN].packet != nullptr, -1,
81239 "Handler for PACKET_EDIT_TILE_TERRAIN not installed");
81240 return pc->phs.handlers->send[PACKET_EDIT_TILE_TERRAIN].packet(pc, packet);
81241}
81242
81243 int dsend_packet_edit_tile_terrain(struct connection *pc, int tile, Terrain_type_id terrain, int size)
81244{
81245 struct packet_edit_tile_terrain packet, *real_packet = &packet;
81246
81247 real_packet->tile = tile;
81248 real_packet->terrain = terrain;
81249 real_packet->size = size;
81250
81251 return send_packet_edit_tile_terrain(pc, real_packet);
81252}
81253
81254 static inline void init_packet_edit_tile_extra(struct packet_edit_tile_extra *packet)
81255{
81256 memset(packet, 0, sizeof(*packet));
81257}
81258
81259#define free_packet_edit_tile_extra(_packet) (void) 0
81260#define destroy_packet_edit_tile_extra free
81261
81262#ifdef FREECIV_DELTA_PROTOCOL
81263static genhash_val_t hash_packet_edit_tile_extra_100(const void *vkey)
81264{
81265 const struct packet_edit_tile_extra *key = (const struct packet_edit_tile_extra *) vkey;
81266 genhash_val_t result = 0;
81267
81268 result += key->tile;
81269
81270 result &= 0xFFFFFFFF;
81271 return result;
81272}
81273
81274static bool cmp_packet_edit_tile_extra_100(const void *vkey1, const void *vkey2)
81275{
81276 const struct packet_edit_tile_extra *old = (const struct packet_edit_tile_extra *) vkey1;
81277 const struct packet_edit_tile_extra *real_packet = (const struct packet_edit_tile_extra *) vkey2;
81278 bool differ;
81279
81280 differ = (old->tile != real_packet->tile);
81281
81282 return !differ;
81283}
81284 BV_DEFINE(packet_edit_tile_extra_100_fields, 4);
81285#endif /* FREECIV_DELTA_PROTOCOL */
81286
81287 static struct packet_edit_tile_extra *receive_packet_edit_tile_extra_100(struct connection *pc)
81288{
81289#define FREE_PACKET_STRUCT(_packet) free_packet_edit_tile_extra(_packet)
81290#ifdef FREECIV_DELTA_PROTOCOL
81291 packet_edit_tile_extra_100_fields fields;
81292 struct packet_edit_tile_extra *old;
81293 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE_EXTRA;
81294#endif /* FREECIV_DELTA_PROTOCOL */
81295 RECEIVE_PACKET_START(packet_edit_tile_extra, real_packet);
81296#ifdef FREECIV_JSON_CONNECTION
81297 struct plocation field_addr;
81298 {
81299 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81300 field_addr = *field_addr_tmp;
81301 FC_FREE(field_addr_tmp);
81302 }
81303#endif /* FREECIV_JSON_CONNECTION */
81304
81305#ifdef FREECIV_DELTA_PROTOCOL
81306#ifdef FREECIV_JSON_CONNECTION
81307 field_addr.name = "fields";
81308#endif /* FREECIV_JSON_CONNECTION */
81309 DIO_BV_GET(&din, &field_addr, fields);
81310#ifdef FREECIV_JSON_CONNECTION
81311 field_addr.name = "tile";
81312#endif /* FREECIV_JSON_CONNECTION */
81313 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
81314 RECEIVE_PACKET_FIELD_ERROR(tile);
81315 }
81316
81317#else /* FREECIV_DELTA_PROTOCOL */
81318#ifdef FREECIV_JSON_CONNECTION
81319 field_addr.name = "tile";
81320#endif /* FREECIV_JSON_CONNECTION */
81321 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
81322 RECEIVE_PACKET_FIELD_ERROR(tile);
81323 }
81324#ifdef FREECIV_JSON_CONNECTION
81325 field_addr.name = "extra_type_id";
81326#endif /* FREECIV_JSON_CONNECTION */
81327 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra_type_id)) {
81328 RECEIVE_PACKET_FIELD_ERROR(extra_type_id);
81329 }
81330#ifdef FREECIV_JSON_CONNECTION
81331 field_addr.name = "removal";
81332#endif /* FREECIV_JSON_CONNECTION */
81333 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removal)) {
81334 RECEIVE_PACKET_FIELD_ERROR(removal);
81335 }
81336#ifdef FREECIV_JSON_CONNECTION
81337 field_addr.name = "eowner";
81338#endif /* FREECIV_JSON_CONNECTION */
81339 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->eowner)) {
81340 RECEIVE_PACKET_FIELD_ERROR(eowner);
81341 }
81342#ifdef FREECIV_JSON_CONNECTION
81343 field_addr.name = "size";
81344#endif /* FREECIV_JSON_CONNECTION */
81345 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
81346 RECEIVE_PACKET_FIELD_ERROR(size);
81347 }
81348#endif
81349 log_packet_detailed("packet_edit_tile_extra_100: got info about (%d)",
81350 real_packet->tile);
81351
81352#ifdef FREECIV_DELTA_PROTOCOL
81353 if (nullptr == *hash) {
81354 *hash = genhash_new_full(hash_packet_edit_tile_extra_100, cmp_packet_edit_tile_extra_100,
81355 nullptr, nullptr, nullptr, destroy_packet_edit_tile_extra);
81356 }
81357
81358 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
81359 *real_packet = *old;
81360 } else {
81361 /* packet is already initialized empty */
81362 log_packet_detailed(" no old info");
81363 }
81364
81365 if (BV_ISSET(fields, 0)) {
81366 log_packet_detailed(" got field 'extra_type_id'");
81367#ifdef FREECIV_JSON_CONNECTION
81368 field_addr.name = "extra_type_id";
81369#endif /* FREECIV_JSON_CONNECTION */
81370 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra_type_id)) {
81371 RECEIVE_PACKET_FIELD_ERROR(extra_type_id);
81372 }
81373 }
81374 real_packet->removal = BV_ISSET(fields, 1);
81375 if (BV_ISSET(fields, 2)) {
81376 log_packet_detailed(" got field 'eowner'");
81377#ifdef FREECIV_JSON_CONNECTION
81378 field_addr.name = "eowner";
81379#endif /* FREECIV_JSON_CONNECTION */
81380 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->eowner)) {
81381 RECEIVE_PACKET_FIELD_ERROR(eowner);
81382 }
81383 }
81384 if (BV_ISSET(fields, 3)) {
81385 log_packet_detailed(" got field 'size'");
81386#ifdef FREECIV_JSON_CONNECTION
81387 field_addr.name = "size";
81388#endif /* FREECIV_JSON_CONNECTION */
81389 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
81390 RECEIVE_PACKET_FIELD_ERROR(size);
81391 }
81392 }
81393
81394 if (nullptr == old) {
81395 old = fc_malloc(sizeof(*old));
81396 init_packet_edit_tile_extra(old);
81397 *old = *real_packet;
81398 genhash_insert(*hash, old, old);
81399 } else {
81400 *old = *real_packet;
81401 }
81402
81403#endif /* FREECIV_DELTA_PROTOCOL */
81404 RECEIVE_PACKET_END(real_packet);
81405#undef FREE_PACKET_STRUCT
81406}
81407
81408 static int send_packet_edit_tile_extra_100(struct connection *pc, const struct packet_edit_tile_extra *packet)
81409{
81410 const struct packet_edit_tile_extra *real_packet = packet;
81411 int e;
81412#ifdef FREECIV_DELTA_PROTOCOL
81413 packet_edit_tile_extra_100_fields fields;
81414 struct packet_edit_tile_extra *old;
81415 bool differ;
81416 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE_EXTRA;
81417#endif /* FREECIV_DELTA_PROTOCOL */
81418 SEND_PACKET_START(PACKET_EDIT_TILE_EXTRA);
81419#ifdef FREECIV_JSON_CONNECTION
81420 struct plocation field_addr;
81421 {
81422 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81423 field_addr = *field_addr_tmp;
81424 FC_FREE(field_addr_tmp);
81425 }
81426#endif /* FREECIV_JSON_CONNECTION */
81427
81428 log_packet_detailed("packet_edit_tile_extra_100: sending info about (%d)",
81429 real_packet->tile);
81430
81431#ifdef FREECIV_DELTA_PROTOCOL
81432 if (nullptr == *hash) {
81433 *hash = genhash_new_full(hash_packet_edit_tile_extra_100, cmp_packet_edit_tile_extra_100,
81434 nullptr, nullptr, nullptr, destroy_packet_edit_tile_extra);
81435 }
81436 BV_CLR_ALL(fields);
81437
81438 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
81439 old = fc_malloc(sizeof(*old));
81440 /* temporary bitcopy just to insert correctly */
81441 *old = *real_packet;
81442 genhash_insert(*hash, old, old);
81443 init_packet_edit_tile_extra(old);
81444 }
81445 differ = (old->extra_type_id != real_packet->extra_type_id);
81446 if (differ) {
81447 BV_SET(fields, 0);
81448 }
81449
81450 if (packet->removal) {
81451 BV_SET(fields, 1);
81452 }
81453
81454 differ = (old->eowner != real_packet->eowner);
81455 if (differ) {
81456 BV_SET(fields, 2);
81457 }
81458
81459 differ = (old->size != real_packet->size);
81460 if (differ) {
81461 BV_SET(fields, 3);
81462 }
81463
81464
81465#ifdef FREECIV_JSON_CONNECTION
81466 field_addr.name = "fields";
81467#endif /* FREECIV_JSON_CONNECTION */
81468 e = 0;
81469 e |= DIO_BV_PUT(&dout, &field_addr, fields);
81470 if (e) {
81471 log_packet_detailed("fields bitvector error detected");
81472 }
81473#ifdef FREECIV_JSON_CONNECTION
81474 field_addr.name = "tile";
81475#endif /* FREECIV_JSON_CONNECTION */
81476 e = 0;
81477 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
81478 if (e) {
81479 log_packet_detailed("'tile' field error detected");
81480 }
81481
81482 if (BV_ISSET(fields, 0)) {
81483 log_packet_detailed(" field 'extra_type_id' has changed");
81484#ifdef FREECIV_JSON_CONNECTION
81485 field_addr.name = "extra_type_id";
81486#endif /* FREECIV_JSON_CONNECTION */
81487 e = 0;
81488 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra_type_id);
81489 if (e) {
81490 log_packet_detailed("'extra_type_id' field error detected");
81491 }
81492 }
81493 /* field 1 is folded into the header */
81494 if (BV_ISSET(fields, 2)) {
81495 log_packet_detailed(" field 'eowner' has changed");
81496#ifdef FREECIV_JSON_CONNECTION
81497 field_addr.name = "eowner";
81498#endif /* FREECIV_JSON_CONNECTION */
81499 e = 0;
81500 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->eowner);
81501 if (e) {
81502 log_packet_detailed("'eowner' field error detected");
81503 }
81504 }
81505 if (BV_ISSET(fields, 3)) {
81506 log_packet_detailed(" field 'size' has changed");
81507#ifdef FREECIV_JSON_CONNECTION
81508 field_addr.name = "size";
81509#endif /* FREECIV_JSON_CONNECTION */
81510 e = 0;
81511 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
81512 if (e) {
81513 log_packet_detailed("'size' field error detected");
81514 }
81515 }
81516
81517 *old = *real_packet;
81518#endif /* FREECIV_DELTA_PROTOCOL */
81519#ifndef FREECIV_DELTA_PROTOCOL
81520#ifdef FREECIV_JSON_CONNECTION
81521 field_addr.name = "tile";
81522#endif /* FREECIV_JSON_CONNECTION */
81523 e = 0;
81524 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
81525 if (e) {
81526 log_packet_detailed("'tile' field error detected");
81527 }
81528#ifdef FREECIV_JSON_CONNECTION
81529 field_addr.name = "extra_type_id";
81530#endif /* FREECIV_JSON_CONNECTION */
81531 e = 0;
81532 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra_type_id);
81533 if (e) {
81534 log_packet_detailed("'extra_type_id' field error detected");
81535 }
81536#ifdef FREECIV_JSON_CONNECTION
81537 field_addr.name = "removal";
81538#endif /* FREECIV_JSON_CONNECTION */
81539 e = 0;
81540 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->removal);
81541 if (e) {
81542 log_packet_detailed("'removal' field error detected");
81543 }
81544#ifdef FREECIV_JSON_CONNECTION
81545 field_addr.name = "eowner";
81546#endif /* FREECIV_JSON_CONNECTION */
81547 e = 0;
81548 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->eowner);
81549 if (e) {
81550 log_packet_detailed("'eowner' field error detected");
81551 }
81552#ifdef FREECIV_JSON_CONNECTION
81553 field_addr.name = "size";
81554#endif /* FREECIV_JSON_CONNECTION */
81555 e = 0;
81556 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
81557 if (e) {
81558 log_packet_detailed("'size' field error detected");
81559 }
81560
81561#endif
81562 SEND_PACKET_END(PACKET_EDIT_TILE_EXTRA);
81563}
81564
81565 int send_packet_edit_tile_extra(struct connection *pc, const struct packet_edit_tile_extra *packet)
81566{
81567 if (!pc->used) {
81568 log_error("WARNING: trying to send data to the closed connection %s",
81569 conn_description(pc));
81570 return -1;
81571 }
81572 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE_EXTRA].packet != nullptr, -1,
81573 "Handler for PACKET_EDIT_TILE_EXTRA not installed");
81574 return pc->phs.handlers->send[PACKET_EDIT_TILE_EXTRA].packet(pc, packet);
81575}
81576
81577 int dsend_packet_edit_tile_extra(struct connection *pc, int tile, int extra_type_id, bool removal, int eowner, int size)
81578{
81579 struct packet_edit_tile_extra packet, *real_packet = &packet;
81580
81581 real_packet->tile = tile;
81582 real_packet->extra_type_id = extra_type_id;
81583 real_packet->removal = removal;
81584 real_packet->eowner = eowner;
81585 real_packet->size = size;
81586
81587 return send_packet_edit_tile_extra(pc, real_packet);
81588}
81589
81590 static inline void init_packet_edit_startpos(struct packet_edit_startpos *packet)
81591{
81592 memset(packet, 0, sizeof(*packet));
81593}
81594
81595#define free_packet_edit_startpos(_packet) (void) 0
81596#define destroy_packet_edit_startpos free
81597
81598 static struct packet_edit_startpos *receive_packet_edit_startpos_100(struct connection *pc)
81599{
81600#define FREE_PACKET_STRUCT(_packet) free_packet_edit_startpos(_packet)
81601 RECEIVE_PACKET_START(packet_edit_startpos, real_packet);
81602#ifdef FREECIV_JSON_CONNECTION
81603 struct plocation field_addr;
81604 {
81605 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81606 field_addr = *field_addr_tmp;
81607 FC_FREE(field_addr_tmp);
81608 }
81609#endif /* FREECIV_JSON_CONNECTION */
81610#if 1 /* To match endif */
81611#ifdef FREECIV_JSON_CONNECTION
81612 field_addr.name = "id";
81613#endif /* FREECIV_JSON_CONNECTION */
81614 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
81615 RECEIVE_PACKET_FIELD_ERROR(id);
81616 }
81617#ifdef FREECIV_JSON_CONNECTION
81618 field_addr.name = "removal";
81619#endif /* FREECIV_JSON_CONNECTION */
81620 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removal)) {
81621 RECEIVE_PACKET_FIELD_ERROR(removal);
81622 }
81623#ifdef FREECIV_JSON_CONNECTION
81624 field_addr.name = "tag";
81625#endif /* FREECIV_JSON_CONNECTION */
81626 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
81627 RECEIVE_PACKET_FIELD_ERROR(tag);
81628 }
81629#endif
81630 log_packet_detailed("packet_edit_startpos_100: got info about ()");
81631 RECEIVE_PACKET_END(real_packet);
81632#undef FREE_PACKET_STRUCT
81633}
81634
81635 static int send_packet_edit_startpos_100(struct connection *pc, const struct packet_edit_startpos *packet)
81636{
81637 const struct packet_edit_startpos *real_packet = packet;
81638 int e;
81639 SEND_PACKET_START(PACKET_EDIT_STARTPOS);
81640#ifdef FREECIV_JSON_CONNECTION
81641 struct plocation field_addr;
81642 {
81643 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81644 field_addr = *field_addr_tmp;
81645 FC_FREE(field_addr_tmp);
81646 }
81647#endif /* FREECIV_JSON_CONNECTION */
81648
81649 log_packet_detailed("packet_edit_startpos_100: sending info about ()");
81650#if 1 /* To match endif */
81651#ifdef FREECIV_JSON_CONNECTION
81652 field_addr.name = "id";
81653#endif /* FREECIV_JSON_CONNECTION */
81654 e = 0;
81655 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
81656 if (e) {
81657 log_packet_detailed("'id' field error detected");
81658 }
81659#ifdef FREECIV_JSON_CONNECTION
81660 field_addr.name = "removal";
81661#endif /* FREECIV_JSON_CONNECTION */
81662 e = 0;
81663 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->removal);
81664 if (e) {
81665 log_packet_detailed("'removal' field error detected");
81666 }
81667#ifdef FREECIV_JSON_CONNECTION
81668 field_addr.name = "tag";
81669#endif /* FREECIV_JSON_CONNECTION */
81670 e = 0;
81671 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
81672 if (e) {
81673 log_packet_detailed("'tag' field error detected");
81674 }
81675
81676#endif
81677 SEND_PACKET_END(PACKET_EDIT_STARTPOS);
81678}
81679
81680 int send_packet_edit_startpos(struct connection *pc, const struct packet_edit_startpos *packet)
81681{
81682 if (!pc->used) {
81683 log_error("WARNING: trying to send data to the closed connection %s",
81684 conn_description(pc));
81685 return -1;
81686 }
81687 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_STARTPOS].packet != nullptr, -1,
81688 "Handler for PACKET_EDIT_STARTPOS not installed");
81689 return pc->phs.handlers->send[PACKET_EDIT_STARTPOS].packet(pc, packet);
81690}
81691
81692 int dsend_packet_edit_startpos(struct connection *pc, int id, bool removal, int tag)
81693{
81694 struct packet_edit_startpos packet, *real_packet = &packet;
81695
81696 real_packet->id = id;
81697 real_packet->removal = removal;
81698 real_packet->tag = tag;
81699
81700 return send_packet_edit_startpos(pc, real_packet);
81701}
81702
81703 static inline void init_packet_edit_startpos_full(struct packet_edit_startpos_full *packet)
81704{
81705 memset(packet, 0, sizeof(*packet));
81706}
81707
81708#define free_packet_edit_startpos_full(_packet) (void) 0
81709#define destroy_packet_edit_startpos_full free
81710
81711 static struct packet_edit_startpos_full *receive_packet_edit_startpos_full_100(struct connection *pc)
81712{
81713#define FREE_PACKET_STRUCT(_packet) free_packet_edit_startpos_full(_packet)
81714 RECEIVE_PACKET_START(packet_edit_startpos_full, real_packet);
81715#ifdef FREECIV_JSON_CONNECTION
81716 struct plocation field_addr;
81717 {
81718 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81719 field_addr = *field_addr_tmp;
81720 FC_FREE(field_addr_tmp);
81721 }
81722#endif /* FREECIV_JSON_CONNECTION */
81723#if 1 /* To match endif */
81724#ifdef FREECIV_JSON_CONNECTION
81725 field_addr.name = "id";
81726#endif /* FREECIV_JSON_CONNECTION */
81727 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
81728 RECEIVE_PACKET_FIELD_ERROR(id);
81729 }
81730#ifdef FREECIV_JSON_CONNECTION
81731 field_addr.name = "exclude";
81732#endif /* FREECIV_JSON_CONNECTION */
81733 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->exclude)) {
81734 RECEIVE_PACKET_FIELD_ERROR(exclude);
81735 }
81736#ifdef FREECIV_JSON_CONNECTION
81737 field_addr.name = "nations";
81738#endif /* FREECIV_JSON_CONNECTION */
81739 if (!DIO_BV_GET(&din, &field_addr, real_packet->nations)) {
81740 RECEIVE_PACKET_FIELD_ERROR(nations);
81741 }
81742#endif
81743 log_packet_detailed("packet_edit_startpos_full_100: got info about ()");
81744 RECEIVE_PACKET_END(real_packet);
81745#undef FREE_PACKET_STRUCT
81746}
81747
81748 static int send_packet_edit_startpos_full_100(struct connection *pc, const struct packet_edit_startpos_full *packet)
81749{
81750 const struct packet_edit_startpos_full *real_packet = packet;
81751 int e;
81752 SEND_PACKET_START(PACKET_EDIT_STARTPOS_FULL);
81753#ifdef FREECIV_JSON_CONNECTION
81754 struct plocation field_addr;
81755 {
81756 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81757 field_addr = *field_addr_tmp;
81758 FC_FREE(field_addr_tmp);
81759 }
81760#endif /* FREECIV_JSON_CONNECTION */
81761
81762 log_packet_detailed("packet_edit_startpos_full_100: sending info about ()");
81763#if 1 /* To match endif */
81764#ifdef FREECIV_JSON_CONNECTION
81765 field_addr.name = "id";
81766#endif /* FREECIV_JSON_CONNECTION */
81767 e = 0;
81768 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
81769 if (e) {
81770 log_packet_detailed("'id' field error detected");
81771 }
81772#ifdef FREECIV_JSON_CONNECTION
81773 field_addr.name = "exclude";
81774#endif /* FREECIV_JSON_CONNECTION */
81775 e = 0;
81776 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->exclude);
81777 if (e) {
81778 log_packet_detailed("'exclude' field error detected");
81779 }
81780#ifdef FREECIV_JSON_CONNECTION
81781 field_addr.name = "nations";
81782#endif /* FREECIV_JSON_CONNECTION */
81783 e = 0;
81784 e |= DIO_BV_PUT(&dout, &field_addr, packet->nations);
81785 if (e) {
81786 log_packet_detailed("'nations' field error detected");
81787 }
81788
81789#endif
81790 SEND_PACKET_END(PACKET_EDIT_STARTPOS_FULL);
81791}
81792
81793 int send_packet_edit_startpos_full(struct connection *pc, const struct packet_edit_startpos_full *packet)
81794{
81795 if (!pc->used) {
81796 log_error("WARNING: trying to send data to the closed connection %s",
81797 conn_description(pc));
81798 return -1;
81799 }
81800 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_STARTPOS_FULL].packet != nullptr, -1,
81801 "Handler for PACKET_EDIT_STARTPOS_FULL not installed");
81802 return pc->phs.handlers->send[PACKET_EDIT_STARTPOS_FULL].packet(pc, packet);
81803}
81804
81805 static inline void init_packet_edit_tile(struct packet_edit_tile *packet)
81806{
81807 memset(packet, 0, sizeof(*packet));
81808}
81809
81810#define free_packet_edit_tile(_packet) (void) 0
81811#define destroy_packet_edit_tile free
81812
81813#ifdef FREECIV_DELTA_PROTOCOL
81814static genhash_val_t hash_packet_edit_tile_100(const void *vkey)
81815{
81816 const struct packet_edit_tile *key = (const struct packet_edit_tile *) vkey;
81817 genhash_val_t result = 0;
81818
81819 result += key->tile;
81820
81821 result &= 0xFFFFFFFF;
81822 return result;
81823}
81824
81825static bool cmp_packet_edit_tile_100(const void *vkey1, const void *vkey2)
81826{
81827 const struct packet_edit_tile *old = (const struct packet_edit_tile *) vkey1;
81828 const struct packet_edit_tile *real_packet = (const struct packet_edit_tile *) vkey2;
81829 bool differ;
81830
81831 differ = (old->tile != real_packet->tile);
81832
81833 return !differ;
81834}
81835 BV_DEFINE(packet_edit_tile_100_fields, 6);
81836#endif /* FREECIV_DELTA_PROTOCOL */
81837
81838 static struct packet_edit_tile *receive_packet_edit_tile_100(struct connection *pc)
81839{
81840#define FREE_PACKET_STRUCT(_packet) free_packet_edit_tile(_packet)
81841#ifdef FREECIV_DELTA_PROTOCOL
81842 packet_edit_tile_100_fields fields;
81843 struct packet_edit_tile *old;
81844 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE;
81845#endif /* FREECIV_DELTA_PROTOCOL */
81846 RECEIVE_PACKET_START(packet_edit_tile, real_packet);
81847#ifdef FREECIV_JSON_CONNECTION
81848 struct plocation field_addr;
81849 {
81850 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
81851 field_addr = *field_addr_tmp;
81852 FC_FREE(field_addr_tmp);
81853 }
81854#endif /* FREECIV_JSON_CONNECTION */
81855
81856#ifdef FREECIV_DELTA_PROTOCOL
81857#ifdef FREECIV_JSON_CONNECTION
81858 field_addr.name = "fields";
81859#endif /* FREECIV_JSON_CONNECTION */
81860 DIO_BV_GET(&din, &field_addr, fields);
81861#ifdef FREECIV_JSON_CONNECTION
81862 field_addr.name = "tile";
81863#endif /* FREECIV_JSON_CONNECTION */
81864 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
81865 RECEIVE_PACKET_FIELD_ERROR(tile);
81866 }
81867
81868#else /* FREECIV_DELTA_PROTOCOL */
81869#ifdef FREECIV_JSON_CONNECTION
81870 field_addr.name = "tile";
81871#endif /* FREECIV_JSON_CONNECTION */
81872 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
81873 RECEIVE_PACKET_FIELD_ERROR(tile);
81874 }
81875#ifdef FREECIV_JSON_CONNECTION
81876 field_addr.name = "extras";
81877#endif /* FREECIV_JSON_CONNECTION */
81878 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
81879 RECEIVE_PACKET_FIELD_ERROR(extras);
81880 }
81881#ifdef FREECIV_JSON_CONNECTION
81882 field_addr.name = "resource";
81883#endif /* FREECIV_JSON_CONNECTION */
81884 {
81885 int readin;
81886
81887 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81888 RECEIVE_PACKET_FIELD_ERROR(resource);
81889 }
81890 real_packet->resource = readin;
81891 }
81892#ifdef FREECIV_JSON_CONNECTION
81893 field_addr.name = "terrain";
81894#endif /* FREECIV_JSON_CONNECTION */
81895 {
81896 int readin;
81897
81898 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81899 RECEIVE_PACKET_FIELD_ERROR(terrain);
81900 }
81901 real_packet->terrain = readin;
81902 }
81903#ifdef FREECIV_JSON_CONNECTION
81904 field_addr.name = "startpos_nation";
81905#endif /* FREECIV_JSON_CONNECTION */
81906 {
81907 int readin;
81908
81909 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
81910 RECEIVE_PACKET_FIELD_ERROR(startpos_nation);
81911 }
81912 real_packet->startpos_nation = readin;
81913 }
81914#ifdef FREECIV_JSON_CONNECTION
81915 field_addr.name = "eowner";
81916#endif /* FREECIV_JSON_CONNECTION */
81917 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->eowner)) {
81918 RECEIVE_PACKET_FIELD_ERROR(eowner);
81919 }
81920#ifdef FREECIV_JSON_CONNECTION
81921 field_addr.name = "label";
81922#endif /* FREECIV_JSON_CONNECTION */
81923 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
81924 RECEIVE_PACKET_FIELD_ERROR(label);
81925 }
81926#endif
81927 log_packet_detailed("packet_edit_tile_100: got info about (%d)",
81928 real_packet->tile);
81929
81930#ifdef FREECIV_DELTA_PROTOCOL
81931 if (nullptr == *hash) {
81932 *hash = genhash_new_full(hash_packet_edit_tile_100, cmp_packet_edit_tile_100,
81933 nullptr, nullptr, nullptr, destroy_packet_edit_tile);
81934 }
81935
81936 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
81937 *real_packet = *old;
81938 } else {
81939 /* packet is already initialized empty */
81940 log_packet_detailed(" no old info");
81941 }
81942
81943 if (BV_ISSET(fields, 0)) {
81944 log_packet_detailed(" got field 'extras'");
81945#ifdef FREECIV_JSON_CONNECTION
81946 field_addr.name = "extras";
81947#endif /* FREECIV_JSON_CONNECTION */
81948 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
81949 RECEIVE_PACKET_FIELD_ERROR(extras);
81950 }
81951 }
81952 if (BV_ISSET(fields, 1)) {
81953 log_packet_detailed(" got field 'resource'");
81954#ifdef FREECIV_JSON_CONNECTION
81955 field_addr.name = "resource";
81956#endif /* FREECIV_JSON_CONNECTION */
81957 {
81958 int readin;
81959
81960 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81961 RECEIVE_PACKET_FIELD_ERROR(resource);
81962 }
81963 real_packet->resource = readin;
81964 }
81965 }
81966 if (BV_ISSET(fields, 2)) {
81967 log_packet_detailed(" got field 'terrain'");
81968#ifdef FREECIV_JSON_CONNECTION
81969 field_addr.name = "terrain";
81970#endif /* FREECIV_JSON_CONNECTION */
81971 {
81972 int readin;
81973
81974 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
81975 RECEIVE_PACKET_FIELD_ERROR(terrain);
81976 }
81977 real_packet->terrain = readin;
81978 }
81979 }
81980 if (BV_ISSET(fields, 3)) {
81981 log_packet_detailed(" got field 'startpos_nation'");
81982#ifdef FREECIV_JSON_CONNECTION
81983 field_addr.name = "startpos_nation";
81984#endif /* FREECIV_JSON_CONNECTION */
81985 {
81986 int readin;
81987
81988 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
81989 RECEIVE_PACKET_FIELD_ERROR(startpos_nation);
81990 }
81991 real_packet->startpos_nation = readin;
81992 }
81993 }
81994 if (BV_ISSET(fields, 4)) {
81995 log_packet_detailed(" got field 'eowner'");
81996#ifdef FREECIV_JSON_CONNECTION
81997 field_addr.name = "eowner";
81998#endif /* FREECIV_JSON_CONNECTION */
81999 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->eowner)) {
82000 RECEIVE_PACKET_FIELD_ERROR(eowner);
82001 }
82002 }
82003 if (BV_ISSET(fields, 5)) {
82004 log_packet_detailed(" got field 'label'");
82005#ifdef FREECIV_JSON_CONNECTION
82006 field_addr.name = "label";
82007#endif /* FREECIV_JSON_CONNECTION */
82008 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
82009 RECEIVE_PACKET_FIELD_ERROR(label);
82010 }
82011 }
82012
82013 if (nullptr == old) {
82014 old = fc_malloc(sizeof(*old));
82015 init_packet_edit_tile(old);
82016 *old = *real_packet;
82017 genhash_insert(*hash, old, old);
82018 } else {
82019 *old = *real_packet;
82020 }
82021
82022#endif /* FREECIV_DELTA_PROTOCOL */
82023 RECEIVE_PACKET_END(real_packet);
82024#undef FREE_PACKET_STRUCT
82025}
82026
82027 static int send_packet_edit_tile_100(struct connection *pc, const struct packet_edit_tile *packet)
82028{
82029 const struct packet_edit_tile *real_packet = packet;
82030 int e;
82031#ifdef FREECIV_DELTA_PROTOCOL
82032 packet_edit_tile_100_fields fields;
82033 struct packet_edit_tile *old;
82034 bool differ;
82035 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE;
82036#endif /* FREECIV_DELTA_PROTOCOL */
82037 SEND_PACKET_START(PACKET_EDIT_TILE);
82038#ifdef FREECIV_JSON_CONNECTION
82039 struct plocation field_addr;
82040 {
82041 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
82042 field_addr = *field_addr_tmp;
82043 FC_FREE(field_addr_tmp);
82044 }
82045#endif /* FREECIV_JSON_CONNECTION */
82046
82047 log_packet_detailed("packet_edit_tile_100: sending info about (%d)",
82048 real_packet->tile);
82049
82050#ifdef FREECIV_DELTA_PROTOCOL
82051 if (nullptr == *hash) {
82052 *hash = genhash_new_full(hash_packet_edit_tile_100, cmp_packet_edit_tile_100,
82053 nullptr, nullptr, nullptr, destroy_packet_edit_tile);
82054 }
82055 BV_CLR_ALL(fields);
82056
82057 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82058 old = fc_malloc(sizeof(*old));
82059 /* temporary bitcopy just to insert correctly */
82060 *old = *real_packet;
82061 genhash_insert(*hash, old, old);
82062 init_packet_edit_tile(old);
82063 }
82064 differ = !BV_ARE_EQUAL(old->extras, real_packet->extras);
82065 if (differ) {
82066 BV_SET(fields, 0);
82067 }
82068
82069 differ = (old->resource != real_packet->resource);
82070 if (differ) {
82071 BV_SET(fields, 1);
82072 }
82073
82074 differ = (old->terrain != real_packet->terrain);
82075 if (differ) {
82076 BV_SET(fields, 2);
82077 }
82078
82079 differ = (old->startpos_nation != real_packet->startpos_nation);
82080 if (differ) {
82081 BV_SET(fields, 3);
82082 }
82083
82084 differ = (old->eowner != real_packet->eowner);
82085 if (differ) {
82086 BV_SET(fields, 4);
82087 }
82088
82089 differ = (strcmp(old->label, real_packet->label) != 0);
82090 if (differ) {
82091 BV_SET(fields, 5);
82092 }
82093
82094
82095#ifdef FREECIV_JSON_CONNECTION
82096 field_addr.name = "fields";
82097#endif /* FREECIV_JSON_CONNECTION */
82098 e = 0;
82099 e |= DIO_BV_PUT(&dout, &field_addr, fields);
82100 if (e) {
82101 log_packet_detailed("fields bitvector error detected");
82102 }
82103#ifdef FREECIV_JSON_CONNECTION
82104 field_addr.name = "tile";
82105#endif /* FREECIV_JSON_CONNECTION */
82106 e = 0;
82107 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82108 if (e) {
82109 log_packet_detailed("'tile' field error detected");
82110 }
82111
82112 if (BV_ISSET(fields, 0)) {
82113 log_packet_detailed(" field 'extras' has changed");
82114#ifdef FREECIV_JSON_CONNECTION
82115 field_addr.name = "extras";
82116#endif /* FREECIV_JSON_CONNECTION */
82117 e = 0;
82118 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
82119 if (e) {
82120 log_packet_detailed("'extras' field error detected");
82121 }
82122 }
82123 if (BV_ISSET(fields, 1)) {
82124 log_packet_detailed(" field 'resource' has changed");
82125#ifdef FREECIV_JSON_CONNECTION
82126 field_addr.name = "resource";
82127#endif /* FREECIV_JSON_CONNECTION */
82128 e = 0;
82129 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
82130 if (e) {
82131 log_packet_detailed("'resource' field error detected");
82132 }
82133 }
82134 if (BV_ISSET(fields, 2)) {
82135 log_packet_detailed(" field 'terrain' has changed");
82136#ifdef FREECIV_JSON_CONNECTION
82137 field_addr.name = "terrain";
82138#endif /* FREECIV_JSON_CONNECTION */
82139 e = 0;
82140 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
82141 if (e) {
82142 log_packet_detailed("'terrain' field error detected");
82143 }
82144 }
82145 if (BV_ISSET(fields, 3)) {
82146 log_packet_detailed(" field 'startpos_nation' has changed");
82147#ifdef FREECIV_JSON_CONNECTION
82148 field_addr.name = "startpos_nation";
82149#endif /* FREECIV_JSON_CONNECTION */
82150 e = 0;
82151 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->startpos_nation);
82152 if (e) {
82153 log_packet_detailed("'startpos_nation' field error detected");
82154 }
82155 }
82156 if (BV_ISSET(fields, 4)) {
82157 log_packet_detailed(" field 'eowner' has changed");
82158#ifdef FREECIV_JSON_CONNECTION
82159 field_addr.name = "eowner";
82160#endif /* FREECIV_JSON_CONNECTION */
82161 e = 0;
82162 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->eowner);
82163 if (e) {
82164 log_packet_detailed("'eowner' field error detected");
82165 }
82166 }
82167 if (BV_ISSET(fields, 5)) {
82168 log_packet_detailed(" field 'label' has changed");
82169#ifdef FREECIV_JSON_CONNECTION
82170 field_addr.name = "label";
82171#endif /* FREECIV_JSON_CONNECTION */
82172 e = 0;
82173 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
82174 if (e) {
82175 log_packet_detailed("'label' field error detected");
82176 }
82177 }
82178
82179 *old = *real_packet;
82180#endif /* FREECIV_DELTA_PROTOCOL */
82181#ifndef FREECIV_DELTA_PROTOCOL
82182#ifdef FREECIV_JSON_CONNECTION
82183 field_addr.name = "tile";
82184#endif /* FREECIV_JSON_CONNECTION */
82185 e = 0;
82186 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82187 if (e) {
82188 log_packet_detailed("'tile' field error detected");
82189 }
82190#ifdef FREECIV_JSON_CONNECTION
82191 field_addr.name = "extras";
82192#endif /* FREECIV_JSON_CONNECTION */
82193 e = 0;
82194 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
82195 if (e) {
82196 log_packet_detailed("'extras' field error detected");
82197 }
82198#ifdef FREECIV_JSON_CONNECTION
82199 field_addr.name = "resource";
82200#endif /* FREECIV_JSON_CONNECTION */
82201 e = 0;
82202 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
82203 if (e) {
82204 log_packet_detailed("'resource' field error detected");
82205 }
82206#ifdef FREECIV_JSON_CONNECTION
82207 field_addr.name = "terrain";
82208#endif /* FREECIV_JSON_CONNECTION */
82209 e = 0;
82210 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
82211 if (e) {
82212 log_packet_detailed("'terrain' field error detected");
82213 }
82214#ifdef FREECIV_JSON_CONNECTION
82215 field_addr.name = "startpos_nation";
82216#endif /* FREECIV_JSON_CONNECTION */
82217 e = 0;
82218 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->startpos_nation);
82219 if (e) {
82220 log_packet_detailed("'startpos_nation' field error detected");
82221 }
82222#ifdef FREECIV_JSON_CONNECTION
82223 field_addr.name = "eowner";
82224#endif /* FREECIV_JSON_CONNECTION */
82225 e = 0;
82226 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->eowner);
82227 if (e) {
82228 log_packet_detailed("'eowner' field error detected");
82229 }
82230#ifdef FREECIV_JSON_CONNECTION
82231 field_addr.name = "label";
82232#endif /* FREECIV_JSON_CONNECTION */
82233 e = 0;
82234 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
82235 if (e) {
82236 log_packet_detailed("'label' field error detected");
82237 }
82238
82239#endif
82240 SEND_PACKET_END(PACKET_EDIT_TILE);
82241}
82242
82243 int send_packet_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
82244{
82245 if (!pc->used) {
82246 log_error("WARNING: trying to send data to the closed connection %s",
82247 conn_description(pc));
82248 return -1;
82249 }
82250 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE].packet != nullptr, -1,
82251 "Handler for PACKET_EDIT_TILE not installed");
82252 return pc->phs.handlers->send[PACKET_EDIT_TILE].packet(pc, packet);
82253}
82254
82255 static inline void init_packet_edit_unit_create(struct packet_edit_unit_create *packet)
82256{
82257 memset(packet, 0, sizeof(*packet));
82258}
82259
82260#define free_packet_edit_unit_create(_packet) (void) 0
82261#define destroy_packet_edit_unit_create free
82262
82263#ifdef FREECIV_DELTA_PROTOCOL
82264#define hash_packet_edit_unit_create_100 hash_const
82265
82266#define cmp_packet_edit_unit_create_100 cmp_const
82267
82268 BV_DEFINE(packet_edit_unit_create_100_fields, 5);
82269#endif /* FREECIV_DELTA_PROTOCOL */
82270
82271 static struct packet_edit_unit_create *receive_packet_edit_unit_create_100(struct connection *pc)
82272{
82273#define FREE_PACKET_STRUCT(_packet) free_packet_edit_unit_create(_packet)
82274#ifdef FREECIV_DELTA_PROTOCOL
82275 packet_edit_unit_create_100_fields fields;
82276 struct packet_edit_unit_create *old;
82277 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_CREATE;
82278#endif /* FREECIV_DELTA_PROTOCOL */
82279 RECEIVE_PACKET_START(packet_edit_unit_create, real_packet);
82280#ifdef FREECIV_JSON_CONNECTION
82281 struct plocation field_addr;
82282 {
82283 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
82284 field_addr = *field_addr_tmp;
82285 FC_FREE(field_addr_tmp);
82286 }
82287#endif /* FREECIV_JSON_CONNECTION */
82288
82289#ifdef FREECIV_DELTA_PROTOCOL
82290#ifdef FREECIV_JSON_CONNECTION
82291 field_addr.name = "fields";
82292#endif /* FREECIV_JSON_CONNECTION */
82293 DIO_BV_GET(&din, &field_addr, fields);
82294
82295#else /* FREECIV_DELTA_PROTOCOL */
82296#ifdef FREECIV_JSON_CONNECTION
82297 field_addr.name = "owner";
82298#endif /* FREECIV_JSON_CONNECTION */
82299 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
82300 RECEIVE_PACKET_FIELD_ERROR(owner);
82301 }
82302#ifdef FREECIV_JSON_CONNECTION
82303 field_addr.name = "tile";
82304#endif /* FREECIV_JSON_CONNECTION */
82305 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
82306 RECEIVE_PACKET_FIELD_ERROR(tile);
82307 }
82308#ifdef FREECIV_JSON_CONNECTION
82309 field_addr.name = "type";
82310#endif /* FREECIV_JSON_CONNECTION */
82311 {
82312 int readin;
82313
82314 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
82315 RECEIVE_PACKET_FIELD_ERROR(type);
82316 }
82317 real_packet->type = readin;
82318 }
82319#ifdef FREECIV_JSON_CONNECTION
82320 field_addr.name = "count";
82321#endif /* FREECIV_JSON_CONNECTION */
82322 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
82323 RECEIVE_PACKET_FIELD_ERROR(count);
82324 }
82325#ifdef FREECIV_JSON_CONNECTION
82326 field_addr.name = "tag";
82327#endif /* FREECIV_JSON_CONNECTION */
82328 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
82329 RECEIVE_PACKET_FIELD_ERROR(tag);
82330 }
82331#endif
82332 log_packet_detailed("packet_edit_unit_create_100: got info about ()");
82333
82334#ifdef FREECIV_DELTA_PROTOCOL
82335 if (nullptr == *hash) {
82336 *hash = genhash_new_full(hash_packet_edit_unit_create_100, cmp_packet_edit_unit_create_100,
82337 nullptr, nullptr, nullptr, destroy_packet_edit_unit_create);
82338 }
82339
82340 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82341 *real_packet = *old;
82342 } else {
82343 /* packet is already initialized empty */
82344 log_packet_detailed(" no old info");
82345 }
82346
82347 if (BV_ISSET(fields, 0)) {
82348 log_packet_detailed(" got field 'owner'");
82349#ifdef FREECIV_JSON_CONNECTION
82350 field_addr.name = "owner";
82351#endif /* FREECIV_JSON_CONNECTION */
82352 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
82353 RECEIVE_PACKET_FIELD_ERROR(owner);
82354 }
82355 }
82356 if (BV_ISSET(fields, 1)) {
82357 log_packet_detailed(" got field 'tile'");
82358#ifdef FREECIV_JSON_CONNECTION
82359 field_addr.name = "tile";
82360#endif /* FREECIV_JSON_CONNECTION */
82361 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
82362 RECEIVE_PACKET_FIELD_ERROR(tile);
82363 }
82364 }
82365 if (BV_ISSET(fields, 2)) {
82366 log_packet_detailed(" got field 'type'");
82367#ifdef FREECIV_JSON_CONNECTION
82368 field_addr.name = "type";
82369#endif /* FREECIV_JSON_CONNECTION */
82370 {
82371 int readin;
82372
82373 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
82374 RECEIVE_PACKET_FIELD_ERROR(type);
82375 }
82376 real_packet->type = readin;
82377 }
82378 }
82379 if (BV_ISSET(fields, 3)) {
82380 log_packet_detailed(" got field 'count'");
82381#ifdef FREECIV_JSON_CONNECTION
82382 field_addr.name = "count";
82383#endif /* FREECIV_JSON_CONNECTION */
82384 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
82385 RECEIVE_PACKET_FIELD_ERROR(count);
82386 }
82387 }
82388 if (BV_ISSET(fields, 4)) {
82389 log_packet_detailed(" got field 'tag'");
82390#ifdef FREECIV_JSON_CONNECTION
82391 field_addr.name = "tag";
82392#endif /* FREECIV_JSON_CONNECTION */
82393 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
82394 RECEIVE_PACKET_FIELD_ERROR(tag);
82395 }
82396 }
82397
82398 if (nullptr == old) {
82399 old = fc_malloc(sizeof(*old));
82400 init_packet_edit_unit_create(old);
82401 *old = *real_packet;
82402 genhash_insert(*hash, old, old);
82403 } else {
82404 *old = *real_packet;
82405 }
82406
82407#endif /* FREECIV_DELTA_PROTOCOL */
82408 RECEIVE_PACKET_END(real_packet);
82409#undef FREE_PACKET_STRUCT
82410}
82411
82412 static int send_packet_edit_unit_create_100(struct connection *pc, const struct packet_edit_unit_create *packet)
82413{
82414 const struct packet_edit_unit_create *real_packet = packet;
82415 int e;
82416#ifdef FREECIV_DELTA_PROTOCOL
82417 packet_edit_unit_create_100_fields fields;
82418 struct packet_edit_unit_create *old;
82419 bool differ;
82420 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_CREATE;
82421#endif /* FREECIV_DELTA_PROTOCOL */
82422 SEND_PACKET_START(PACKET_EDIT_UNIT_CREATE);
82423#ifdef FREECIV_JSON_CONNECTION
82424 struct plocation field_addr;
82425 {
82426 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
82427 field_addr = *field_addr_tmp;
82428 FC_FREE(field_addr_tmp);
82429 }
82430#endif /* FREECIV_JSON_CONNECTION */
82431
82432 log_packet_detailed("packet_edit_unit_create_100: sending info about ()");
82433
82434#ifdef FREECIV_DELTA_PROTOCOL
82435 if (nullptr == *hash) {
82436 *hash = genhash_new_full(hash_packet_edit_unit_create_100, cmp_packet_edit_unit_create_100,
82437 nullptr, nullptr, nullptr, destroy_packet_edit_unit_create);
82438 }
82439 BV_CLR_ALL(fields);
82440
82441 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82442 old = fc_malloc(sizeof(*old));
82443 /* temporary bitcopy just to insert correctly */
82444 *old = *real_packet;
82445 genhash_insert(*hash, old, old);
82446 init_packet_edit_unit_create(old);
82447 }
82448 differ = (old->owner != real_packet->owner);
82449 if (differ) {
82450 BV_SET(fields, 0);
82451 }
82452
82453 differ = (old->tile != real_packet->tile);
82454 if (differ) {
82455 BV_SET(fields, 1);
82456 }
82457
82458 differ = (old->type != real_packet->type);
82459 if (differ) {
82460 BV_SET(fields, 2);
82461 }
82462
82463 differ = (old->count != real_packet->count);
82464 if (differ) {
82465 BV_SET(fields, 3);
82466 }
82467
82468 differ = (old->tag != real_packet->tag);
82469 if (differ) {
82470 BV_SET(fields, 4);
82471 }
82472
82473
82474#ifdef FREECIV_JSON_CONNECTION
82475 field_addr.name = "fields";
82476#endif /* FREECIV_JSON_CONNECTION */
82477 e = 0;
82478 e |= DIO_BV_PUT(&dout, &field_addr, fields);
82479 if (e) {
82480 log_packet_detailed("fields bitvector error detected");
82481 }
82482
82483 if (BV_ISSET(fields, 0)) {
82484 log_packet_detailed(" field 'owner' has changed");
82485#ifdef FREECIV_JSON_CONNECTION
82486 field_addr.name = "owner";
82487#endif /* FREECIV_JSON_CONNECTION */
82488 e = 0;
82489 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
82490 if (e) {
82491 log_packet_detailed("'owner' field error detected");
82492 }
82493 }
82494 if (BV_ISSET(fields, 1)) {
82495 log_packet_detailed(" field 'tile' has changed");
82496#ifdef FREECIV_JSON_CONNECTION
82497 field_addr.name = "tile";
82498#endif /* FREECIV_JSON_CONNECTION */
82499 e = 0;
82500 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82501 if (e) {
82502 log_packet_detailed("'tile' field error detected");
82503 }
82504 }
82505 if (BV_ISSET(fields, 2)) {
82506 log_packet_detailed(" field 'type' has changed");
82507#ifdef FREECIV_JSON_CONNECTION
82508 field_addr.name = "type";
82509#endif /* FREECIV_JSON_CONNECTION */
82510 e = 0;
82511 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
82512 if (e) {
82513 log_packet_detailed("'type' field error detected");
82514 }
82515 }
82516 if (BV_ISSET(fields, 3)) {
82517 log_packet_detailed(" field 'count' has changed");
82518#ifdef FREECIV_JSON_CONNECTION
82519 field_addr.name = "count";
82520#endif /* FREECIV_JSON_CONNECTION */
82521 e = 0;
82522 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
82523 if (e) {
82524 log_packet_detailed("'count' field error detected");
82525 }
82526 }
82527 if (BV_ISSET(fields, 4)) {
82528 log_packet_detailed(" field 'tag' has changed");
82529#ifdef FREECIV_JSON_CONNECTION
82530 field_addr.name = "tag";
82531#endif /* FREECIV_JSON_CONNECTION */
82532 e = 0;
82533 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
82534 if (e) {
82535 log_packet_detailed("'tag' field error detected");
82536 }
82537 }
82538
82539 *old = *real_packet;
82540#endif /* FREECIV_DELTA_PROTOCOL */
82541#ifndef FREECIV_DELTA_PROTOCOL
82542#ifdef FREECIV_JSON_CONNECTION
82543 field_addr.name = "owner";
82544#endif /* FREECIV_JSON_CONNECTION */
82545 e = 0;
82546 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
82547 if (e) {
82548 log_packet_detailed("'owner' field error detected");
82549 }
82550#ifdef FREECIV_JSON_CONNECTION
82551 field_addr.name = "tile";
82552#endif /* FREECIV_JSON_CONNECTION */
82553 e = 0;
82554 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82555 if (e) {
82556 log_packet_detailed("'tile' field error detected");
82557 }
82558#ifdef FREECIV_JSON_CONNECTION
82559 field_addr.name = "type";
82560#endif /* FREECIV_JSON_CONNECTION */
82561 e = 0;
82562 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
82563 if (e) {
82564 log_packet_detailed("'type' field error detected");
82565 }
82566#ifdef FREECIV_JSON_CONNECTION
82567 field_addr.name = "count";
82568#endif /* FREECIV_JSON_CONNECTION */
82569 e = 0;
82570 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
82571 if (e) {
82572 log_packet_detailed("'count' field error detected");
82573 }
82574#ifdef FREECIV_JSON_CONNECTION
82575 field_addr.name = "tag";
82576#endif /* FREECIV_JSON_CONNECTION */
82577 e = 0;
82578 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
82579 if (e) {
82580 log_packet_detailed("'tag' field error detected");
82581 }
82582
82583#endif
82584 SEND_PACKET_END(PACKET_EDIT_UNIT_CREATE);
82585}
82586
82587 int send_packet_edit_unit_create(struct connection *pc, const struct packet_edit_unit_create *packet)
82588{
82589 if (!pc->used) {
82590 log_error("WARNING: trying to send data to the closed connection %s",
82591 conn_description(pc));
82592 return -1;
82593 }
82594 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_CREATE].packet != nullptr, -1,
82595 "Handler for PACKET_EDIT_UNIT_CREATE not installed");
82596 return pc->phs.handlers->send[PACKET_EDIT_UNIT_CREATE].packet(pc, packet);
82597}
82598
82599 int dsend_packet_edit_unit_create(struct connection *pc, int owner, int tile, Unit_type_id type, int count, int tag)
82600{
82601 struct packet_edit_unit_create packet, *real_packet = &packet;
82602
82603 real_packet->owner = owner;
82604 real_packet->tile = tile;
82605 real_packet->type = type;
82606 real_packet->count = count;
82607 real_packet->tag = tag;
82608
82609 return send_packet_edit_unit_create(pc, real_packet);
82610}
82611
82612 static inline void init_packet_edit_unit_remove(struct packet_edit_unit_remove *packet)
82613{
82614 memset(packet, 0, sizeof(*packet));
82615}
82616
82617#define free_packet_edit_unit_remove(_packet) (void) 0
82618#define destroy_packet_edit_unit_remove free
82619
82620#ifdef FREECIV_DELTA_PROTOCOL
82621#define hash_packet_edit_unit_remove_100 hash_const
82622
82623#define cmp_packet_edit_unit_remove_100 cmp_const
82624
82625 BV_DEFINE(packet_edit_unit_remove_100_fields, 4);
82626#endif /* FREECIV_DELTA_PROTOCOL */
82627
82628 static struct packet_edit_unit_remove *receive_packet_edit_unit_remove_100(struct connection *pc)
82629{
82630#define FREE_PACKET_STRUCT(_packet) free_packet_edit_unit_remove(_packet)
82631#ifdef FREECIV_DELTA_PROTOCOL
82632 packet_edit_unit_remove_100_fields fields;
82633 struct packet_edit_unit_remove *old;
82634 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_REMOVE;
82635#endif /* FREECIV_DELTA_PROTOCOL */
82636 RECEIVE_PACKET_START(packet_edit_unit_remove, real_packet);
82637#ifdef FREECIV_JSON_CONNECTION
82638 struct plocation field_addr;
82639 {
82640 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
82641 field_addr = *field_addr_tmp;
82642 FC_FREE(field_addr_tmp);
82643 }
82644#endif /* FREECIV_JSON_CONNECTION */
82645
82646#ifdef FREECIV_DELTA_PROTOCOL
82647#ifdef FREECIV_JSON_CONNECTION
82648 field_addr.name = "fields";
82649#endif /* FREECIV_JSON_CONNECTION */
82650 DIO_BV_GET(&din, &field_addr, fields);
82651
82652#else /* FREECIV_DELTA_PROTOCOL */
82653#ifdef FREECIV_JSON_CONNECTION
82654 field_addr.name = "owner";
82655#endif /* FREECIV_JSON_CONNECTION */
82656 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
82657 RECEIVE_PACKET_FIELD_ERROR(owner);
82658 }
82659#ifdef FREECIV_JSON_CONNECTION
82660 field_addr.name = "tile";
82661#endif /* FREECIV_JSON_CONNECTION */
82662 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
82663 RECEIVE_PACKET_FIELD_ERROR(tile);
82664 }
82665#ifdef FREECIV_JSON_CONNECTION
82666 field_addr.name = "type";
82667#endif /* FREECIV_JSON_CONNECTION */
82668 {
82669 int readin;
82670
82671 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
82672 RECEIVE_PACKET_FIELD_ERROR(type);
82673 }
82674 real_packet->type = readin;
82675 }
82676#ifdef FREECIV_JSON_CONNECTION
82677 field_addr.name = "count";
82678#endif /* FREECIV_JSON_CONNECTION */
82679 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
82680 RECEIVE_PACKET_FIELD_ERROR(count);
82681 }
82682#endif
82683 log_packet_detailed("packet_edit_unit_remove_100: got info about ()");
82684
82685#ifdef FREECIV_DELTA_PROTOCOL
82686 if (nullptr == *hash) {
82687 *hash = genhash_new_full(hash_packet_edit_unit_remove_100, cmp_packet_edit_unit_remove_100,
82688 nullptr, nullptr, nullptr, destroy_packet_edit_unit_remove);
82689 }
82690
82691 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82692 *real_packet = *old;
82693 } else {
82694 /* packet is already initialized empty */
82695 log_packet_detailed(" no old info");
82696 }
82697
82698 if (BV_ISSET(fields, 0)) {
82699 log_packet_detailed(" got field 'owner'");
82700#ifdef FREECIV_JSON_CONNECTION
82701 field_addr.name = "owner";
82702#endif /* FREECIV_JSON_CONNECTION */
82703 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
82704 RECEIVE_PACKET_FIELD_ERROR(owner);
82705 }
82706 }
82707 if (BV_ISSET(fields, 1)) {
82708 log_packet_detailed(" got field 'tile'");
82709#ifdef FREECIV_JSON_CONNECTION
82710 field_addr.name = "tile";
82711#endif /* FREECIV_JSON_CONNECTION */
82712 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
82713 RECEIVE_PACKET_FIELD_ERROR(tile);
82714 }
82715 }
82716 if (BV_ISSET(fields, 2)) {
82717 log_packet_detailed(" got field 'type'");
82718#ifdef FREECIV_JSON_CONNECTION
82719 field_addr.name = "type";
82720#endif /* FREECIV_JSON_CONNECTION */
82721 {
82722 int readin;
82723
82724 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
82725 RECEIVE_PACKET_FIELD_ERROR(type);
82726 }
82727 real_packet->type = readin;
82728 }
82729 }
82730 if (BV_ISSET(fields, 3)) {
82731 log_packet_detailed(" got field 'count'");
82732#ifdef FREECIV_JSON_CONNECTION
82733 field_addr.name = "count";
82734#endif /* FREECIV_JSON_CONNECTION */
82735 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
82736 RECEIVE_PACKET_FIELD_ERROR(count);
82737 }
82738 }
82739
82740 if (nullptr == old) {
82741 old = fc_malloc(sizeof(*old));
82742 init_packet_edit_unit_remove(old);
82743 *old = *real_packet;
82744 genhash_insert(*hash, old, old);
82745 } else {
82746 *old = *real_packet;
82747 }
82748
82749#endif /* FREECIV_DELTA_PROTOCOL */
82750 RECEIVE_PACKET_END(real_packet);
82751#undef FREE_PACKET_STRUCT
82752}
82753
82754 static int send_packet_edit_unit_remove_100(struct connection *pc, const struct packet_edit_unit_remove *packet)
82755{
82756 const struct packet_edit_unit_remove *real_packet = packet;
82757 int e;
82758#ifdef FREECIV_DELTA_PROTOCOL
82759 packet_edit_unit_remove_100_fields fields;
82760 struct packet_edit_unit_remove *old;
82761 bool differ;
82762 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_REMOVE;
82763#endif /* FREECIV_DELTA_PROTOCOL */
82764 SEND_PACKET_START(PACKET_EDIT_UNIT_REMOVE);
82765#ifdef FREECIV_JSON_CONNECTION
82766 struct plocation field_addr;
82767 {
82768 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
82769 field_addr = *field_addr_tmp;
82770 FC_FREE(field_addr_tmp);
82771 }
82772#endif /* FREECIV_JSON_CONNECTION */
82773
82774 log_packet_detailed("packet_edit_unit_remove_100: sending info about ()");
82775
82776#ifdef FREECIV_DELTA_PROTOCOL
82777 if (nullptr == *hash) {
82778 *hash = genhash_new_full(hash_packet_edit_unit_remove_100, cmp_packet_edit_unit_remove_100,
82779 nullptr, nullptr, nullptr, destroy_packet_edit_unit_remove);
82780 }
82781 BV_CLR_ALL(fields);
82782
82783 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82784 old = fc_malloc(sizeof(*old));
82785 /* temporary bitcopy just to insert correctly */
82786 *old = *real_packet;
82787 genhash_insert(*hash, old, old);
82788 init_packet_edit_unit_remove(old);
82789 }
82790 differ = (old->owner != real_packet->owner);
82791 if (differ) {
82792 BV_SET(fields, 0);
82793 }
82794
82795 differ = (old->tile != real_packet->tile);
82796 if (differ) {
82797 BV_SET(fields, 1);
82798 }
82799
82800 differ = (old->type != real_packet->type);
82801 if (differ) {
82802 BV_SET(fields, 2);
82803 }
82804
82805 differ = (old->count != real_packet->count);
82806 if (differ) {
82807 BV_SET(fields, 3);
82808 }
82809
82810
82811#ifdef FREECIV_JSON_CONNECTION
82812 field_addr.name = "fields";
82813#endif /* FREECIV_JSON_CONNECTION */
82814 e = 0;
82815 e |= DIO_BV_PUT(&dout, &field_addr, fields);
82816 if (e) {
82817 log_packet_detailed("fields bitvector error detected");
82818 }
82819
82820 if (BV_ISSET(fields, 0)) {
82821 log_packet_detailed(" field 'owner' has changed");
82822#ifdef FREECIV_JSON_CONNECTION
82823 field_addr.name = "owner";
82824#endif /* FREECIV_JSON_CONNECTION */
82825 e = 0;
82826 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
82827 if (e) {
82828 log_packet_detailed("'owner' field error detected");
82829 }
82830 }
82831 if (BV_ISSET(fields, 1)) {
82832 log_packet_detailed(" field 'tile' has changed");
82833#ifdef FREECIV_JSON_CONNECTION
82834 field_addr.name = "tile";
82835#endif /* FREECIV_JSON_CONNECTION */
82836 e = 0;
82837 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82838 if (e) {
82839 log_packet_detailed("'tile' field error detected");
82840 }
82841 }
82842 if (BV_ISSET(fields, 2)) {
82843 log_packet_detailed(" field 'type' has changed");
82844#ifdef FREECIV_JSON_CONNECTION
82845 field_addr.name = "type";
82846#endif /* FREECIV_JSON_CONNECTION */
82847 e = 0;
82848 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
82849 if (e) {
82850 log_packet_detailed("'type' field error detected");
82851 }
82852 }
82853 if (BV_ISSET(fields, 3)) {
82854 log_packet_detailed(" field 'count' has changed");
82855#ifdef FREECIV_JSON_CONNECTION
82856 field_addr.name = "count";
82857#endif /* FREECIV_JSON_CONNECTION */
82858 e = 0;
82859 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
82860 if (e) {
82861 log_packet_detailed("'count' field error detected");
82862 }
82863 }
82864
82865 *old = *real_packet;
82866#endif /* FREECIV_DELTA_PROTOCOL */
82867#ifndef FREECIV_DELTA_PROTOCOL
82868#ifdef FREECIV_JSON_CONNECTION
82869 field_addr.name = "owner";
82870#endif /* FREECIV_JSON_CONNECTION */
82871 e = 0;
82872 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
82873 if (e) {
82874 log_packet_detailed("'owner' field error detected");
82875 }
82876#ifdef FREECIV_JSON_CONNECTION
82877 field_addr.name = "tile";
82878#endif /* FREECIV_JSON_CONNECTION */
82879 e = 0;
82880 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82881 if (e) {
82882 log_packet_detailed("'tile' field error detected");
82883 }
82884#ifdef FREECIV_JSON_CONNECTION
82885 field_addr.name = "type";
82886#endif /* FREECIV_JSON_CONNECTION */
82887 e = 0;
82888 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->type);
82889 if (e) {
82890 log_packet_detailed("'type' field error detected");
82891 }
82892#ifdef FREECIV_JSON_CONNECTION
82893 field_addr.name = "count";
82894#endif /* FREECIV_JSON_CONNECTION */
82895 e = 0;
82896 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
82897 if (e) {
82898 log_packet_detailed("'count' field error detected");
82899 }
82900
82901#endif
82902 SEND_PACKET_END(PACKET_EDIT_UNIT_REMOVE);
82903}
82904
82905 int send_packet_edit_unit_remove(struct connection *pc, const struct packet_edit_unit_remove *packet)
82906{
82907 if (!pc->used) {
82908 log_error("WARNING: trying to send data to the closed connection %s",
82909 conn_description(pc));
82910 return -1;
82911 }
82912 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE].packet != nullptr, -1,
82913 "Handler for PACKET_EDIT_UNIT_REMOVE not installed");
82914 return pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE].packet(pc, packet);
82915}
82916
82917 int dsend_packet_edit_unit_remove(struct connection *pc, int owner, int tile, Unit_type_id type, int count)
82918{
82919 struct packet_edit_unit_remove packet, *real_packet = &packet;
82920
82921 real_packet->owner = owner;
82922 real_packet->tile = tile;
82923 real_packet->type = type;
82924 real_packet->count = count;
82925
82926 return send_packet_edit_unit_remove(pc, real_packet);
82927}
82928
82929 static inline void init_packet_edit_unit_remove_by_id(struct packet_edit_unit_remove_by_id *packet)
82930{
82931 memset(packet, 0, sizeof(*packet));
82932}
82933
82934#define free_packet_edit_unit_remove_by_id(_packet) (void) 0
82935#define destroy_packet_edit_unit_remove_by_id free
82936
82937#ifdef FREECIV_DELTA_PROTOCOL
82938#define hash_packet_edit_unit_remove_by_id_100 hash_const
82939
82940#define cmp_packet_edit_unit_remove_by_id_100 cmp_const
82941
82942 BV_DEFINE(packet_edit_unit_remove_by_id_100_fields, 1);
82943#endif /* FREECIV_DELTA_PROTOCOL */
82944
82945 static struct packet_edit_unit_remove_by_id *receive_packet_edit_unit_remove_by_id_100(struct connection *pc)
82946{
82947#define FREE_PACKET_STRUCT(_packet) free_packet_edit_unit_remove_by_id(_packet)
82948#ifdef FREECIV_DELTA_PROTOCOL
82949 packet_edit_unit_remove_by_id_100_fields fields;
82950 struct packet_edit_unit_remove_by_id *old;
82951 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_REMOVE_BY_ID;
82952#endif /* FREECIV_DELTA_PROTOCOL */
82953 RECEIVE_PACKET_START(packet_edit_unit_remove_by_id, real_packet);
82954#ifdef FREECIV_JSON_CONNECTION
82955 struct plocation field_addr;
82956 {
82957 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
82958 field_addr = *field_addr_tmp;
82959 FC_FREE(field_addr_tmp);
82960 }
82961#endif /* FREECIV_JSON_CONNECTION */
82962
82963#ifdef FREECIV_DELTA_PROTOCOL
82964#ifdef FREECIV_JSON_CONNECTION
82965 field_addr.name = "fields";
82966#endif /* FREECIV_JSON_CONNECTION */
82967 DIO_BV_GET(&din, &field_addr, fields);
82968
82969#else /* FREECIV_DELTA_PROTOCOL */
82970#ifdef FREECIV_JSON_CONNECTION
82971 field_addr.name = "id";
82972#endif /* FREECIV_JSON_CONNECTION */
82973 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
82974 RECEIVE_PACKET_FIELD_ERROR(id);
82975 }
82976#endif
82977 log_packet_detailed("packet_edit_unit_remove_by_id_100: got info about ()");
82978
82979#ifdef FREECIV_DELTA_PROTOCOL
82980 if (nullptr == *hash) {
82981 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_100, cmp_packet_edit_unit_remove_by_id_100,
82982 nullptr, nullptr, nullptr, destroy_packet_edit_unit_remove_by_id);
82983 }
82984
82985 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82986 *real_packet = *old;
82987 } else {
82988 /* packet is already initialized empty */
82989 log_packet_detailed(" no old info");
82990 }
82991
82992 if (BV_ISSET(fields, 0)) {
82993 log_packet_detailed(" got field 'id'");
82994#ifdef FREECIV_JSON_CONNECTION
82995 field_addr.name = "id";
82996#endif /* FREECIV_JSON_CONNECTION */
82997 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
82998 RECEIVE_PACKET_FIELD_ERROR(id);
82999 }
83000 }
83001
83002 if (nullptr == old) {
83003 old = fc_malloc(sizeof(*old));
83004 init_packet_edit_unit_remove_by_id(old);
83005 *old = *real_packet;
83006 genhash_insert(*hash, old, old);
83007 } else {
83008 *old = *real_packet;
83009 }
83010
83011#endif /* FREECIV_DELTA_PROTOCOL */
83012 RECEIVE_PACKET_END(real_packet);
83013#undef FREE_PACKET_STRUCT
83014}
83015
83016 static int send_packet_edit_unit_remove_by_id_100(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
83017{
83018 const struct packet_edit_unit_remove_by_id *real_packet = packet;
83019 int e;
83020#ifdef FREECIV_DELTA_PROTOCOL
83021 packet_edit_unit_remove_by_id_100_fields fields;
83022 struct packet_edit_unit_remove_by_id *old;
83023 bool differ;
83024 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_REMOVE_BY_ID;
83025#endif /* FREECIV_DELTA_PROTOCOL */
83026 SEND_PACKET_START(PACKET_EDIT_UNIT_REMOVE_BY_ID);
83027#ifdef FREECIV_JSON_CONNECTION
83028 struct plocation field_addr;
83029 {
83030 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
83031 field_addr = *field_addr_tmp;
83032 FC_FREE(field_addr_tmp);
83033 }
83034#endif /* FREECIV_JSON_CONNECTION */
83035
83036 log_packet_detailed("packet_edit_unit_remove_by_id_100: sending info about ()");
83037
83038#ifdef FREECIV_DELTA_PROTOCOL
83039 if (nullptr == *hash) {
83040 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_100, cmp_packet_edit_unit_remove_by_id_100,
83041 nullptr, nullptr, nullptr, destroy_packet_edit_unit_remove_by_id);
83042 }
83043 BV_CLR_ALL(fields);
83044
83045 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
83046 old = fc_malloc(sizeof(*old));
83047 /* temporary bitcopy just to insert correctly */
83048 *old = *real_packet;
83049 genhash_insert(*hash, old, old);
83050 init_packet_edit_unit_remove_by_id(old);
83051 }
83052 differ = (old->id != real_packet->id);
83053 if (differ) {
83054 BV_SET(fields, 0);
83055 }
83056
83057
83058#ifdef FREECIV_JSON_CONNECTION
83059 field_addr.name = "fields";
83060#endif /* FREECIV_JSON_CONNECTION */
83061 e = 0;
83062 e |= DIO_BV_PUT(&dout, &field_addr, fields);
83063 if (e) {
83064 log_packet_detailed("fields bitvector error detected");
83065 }
83066
83067 if (BV_ISSET(fields, 0)) {
83068 log_packet_detailed(" field 'id' has changed");
83069#ifdef FREECIV_JSON_CONNECTION
83070 field_addr.name = "id";
83071#endif /* FREECIV_JSON_CONNECTION */
83072 e = 0;
83073 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
83074 if (e) {
83075 log_packet_detailed("'id' field error detected");
83076 }
83077 }
83078
83079 *old = *real_packet;
83080#endif /* FREECIV_DELTA_PROTOCOL */
83081#ifndef FREECIV_DELTA_PROTOCOL
83082#ifdef FREECIV_JSON_CONNECTION
83083 field_addr.name = "id";
83084#endif /* FREECIV_JSON_CONNECTION */
83085 e = 0;
83086 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
83087 if (e) {
83088 log_packet_detailed("'id' field error detected");
83089 }
83090
83091#endif
83092 SEND_PACKET_END(PACKET_EDIT_UNIT_REMOVE_BY_ID);
83093}
83094
83095 int send_packet_edit_unit_remove_by_id(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
83096{
83097 if (!pc->used) {
83098 log_error("WARNING: trying to send data to the closed connection %s",
83099 conn_description(pc));
83100 return -1;
83101 }
83102 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet != nullptr, -1,
83103 "Handler for PACKET_EDIT_UNIT_REMOVE_BY_ID not installed");
83104 return pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet(pc, packet);
83105}
83106
83107 int dsend_packet_edit_unit_remove_by_id(struct connection *pc, int id)
83108{
83109 struct packet_edit_unit_remove_by_id packet, *real_packet = &packet;
83110
83111 real_packet->id = id;
83112
83113 return send_packet_edit_unit_remove_by_id(pc, real_packet);
83114}
83115
83116 static inline void init_packet_edit_unit(struct packet_edit_unit *packet)
83117{
83118 memset(packet, 0, sizeof(*packet));
83119}
83120
83121#define free_packet_edit_unit(_packet) (void) 0
83122#define destroy_packet_edit_unit free
83123
83124#ifdef FREECIV_DELTA_PROTOCOL
83125static genhash_val_t hash_packet_edit_unit_100(const void *vkey)
83126{
83127 const struct packet_edit_unit *key = (const struct packet_edit_unit *) vkey;
83128 genhash_val_t result = 0;
83129
83130 result += key->id;
83131
83132 result &= 0xFFFFFFFF;
83133 return result;
83134}
83135
83136static bool cmp_packet_edit_unit_100(const void *vkey1, const void *vkey2)
83137{
83138 const struct packet_edit_unit *old = (const struct packet_edit_unit *) vkey1;
83139 const struct packet_edit_unit *real_packet = (const struct packet_edit_unit *) vkey2;
83140 bool differ;
83141
83142 differ = (old->id != real_packet->id);
83143
83144 return !differ;
83145}
83146 BV_DEFINE(packet_edit_unit_100_fields, 16);
83147#endif /* FREECIV_DELTA_PROTOCOL */
83148
83149 static struct packet_edit_unit *receive_packet_edit_unit_100(struct connection *pc)
83150{
83151#define FREE_PACKET_STRUCT(_packet) free_packet_edit_unit(_packet)
83152#ifdef FREECIV_DELTA_PROTOCOL
83153 packet_edit_unit_100_fields fields;
83154 struct packet_edit_unit *old;
83155 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT;
83156#endif /* FREECIV_DELTA_PROTOCOL */
83157 RECEIVE_PACKET_START(packet_edit_unit, real_packet);
83158#ifdef FREECIV_JSON_CONNECTION
83159 struct plocation field_addr;
83160 {
83161 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
83162 field_addr = *field_addr_tmp;
83163 FC_FREE(field_addr_tmp);
83164 }
83165#endif /* FREECIV_JSON_CONNECTION */
83166
83167#ifdef FREECIV_DELTA_PROTOCOL
83168#ifdef FREECIV_JSON_CONNECTION
83169 field_addr.name = "fields";
83170#endif /* FREECIV_JSON_CONNECTION */
83171 DIO_BV_GET(&din, &field_addr, fields);
83172#ifdef FREECIV_JSON_CONNECTION
83173 field_addr.name = "id";
83174#endif /* FREECIV_JSON_CONNECTION */
83175 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
83176 RECEIVE_PACKET_FIELD_ERROR(id);
83177 }
83178
83179#else /* FREECIV_DELTA_PROTOCOL */
83180#ifdef FREECIV_JSON_CONNECTION
83181 field_addr.name = "id";
83182#endif /* FREECIV_JSON_CONNECTION */
83183 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
83184 RECEIVE_PACKET_FIELD_ERROR(id);
83185 }
83186#ifdef FREECIV_JSON_CONNECTION
83187 field_addr.name = "utype";
83188#endif /* FREECIV_JSON_CONNECTION */
83189 {
83190 int readin;
83191
83192 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
83193 RECEIVE_PACKET_FIELD_ERROR(utype);
83194 }
83195 real_packet->utype = readin;
83196 }
83197#ifdef FREECIV_JSON_CONNECTION
83198 field_addr.name = "owner";
83199#endif /* FREECIV_JSON_CONNECTION */
83200 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
83201 RECEIVE_PACKET_FIELD_ERROR(owner);
83202 }
83203#ifdef FREECIV_JSON_CONNECTION
83204 field_addr.name = "homecity";
83205#endif /* FREECIV_JSON_CONNECTION */
83206 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
83207 RECEIVE_PACKET_FIELD_ERROR(homecity);
83208 }
83209#ifdef FREECIV_JSON_CONNECTION
83210 field_addr.name = "moves_left";
83211#endif /* FREECIV_JSON_CONNECTION */
83212 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
83213 RECEIVE_PACKET_FIELD_ERROR(moves_left);
83214 }
83215#ifdef FREECIV_JSON_CONNECTION
83216 field_addr.name = "hp";
83217#endif /* FREECIV_JSON_CONNECTION */
83218 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
83219 RECEIVE_PACKET_FIELD_ERROR(hp);
83220 }
83221#ifdef FREECIV_JSON_CONNECTION
83222 field_addr.name = "veteran";
83223#endif /* FREECIV_JSON_CONNECTION */
83224 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
83225 RECEIVE_PACKET_FIELD_ERROR(veteran);
83226 }
83227#ifdef FREECIV_JSON_CONNECTION
83228 field_addr.name = "fuel";
83229#endif /* FREECIV_JSON_CONNECTION */
83230 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
83231 RECEIVE_PACKET_FIELD_ERROR(fuel);
83232 }
83233#ifdef FREECIV_JSON_CONNECTION
83234 field_addr.name = "activity";
83235#endif /* FREECIV_JSON_CONNECTION */
83236 {
83237 int readin;
83238
83239 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
83240 RECEIVE_PACKET_FIELD_ERROR(activity);
83241 }
83242 real_packet->activity = readin;
83243 }
83244#ifdef FREECIV_JSON_CONNECTION
83245 field_addr.name = "activity_count";
83246#endif /* FREECIV_JSON_CONNECTION */
83247 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
83248 RECEIVE_PACKET_FIELD_ERROR(activity_count);
83249 }
83250#ifdef FREECIV_JSON_CONNECTION
83251 field_addr.name = "activity_base";
83252#endif /* FREECIV_JSON_CONNECTION */
83253 {
83254 int readin;
83255
83256 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
83257 RECEIVE_PACKET_FIELD_ERROR(activity_base);
83258 }
83259 real_packet->activity_base = readin;
83260 }
83261#ifdef FREECIV_JSON_CONNECTION
83262 field_addr.name = "debug";
83263#endif /* FREECIV_JSON_CONNECTION */
83264 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
83265 RECEIVE_PACKET_FIELD_ERROR(debug);
83266 }
83267#ifdef FREECIV_JSON_CONNECTION
83268 field_addr.name = "moved";
83269#endif /* FREECIV_JSON_CONNECTION */
83270 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->moved)) {
83271 RECEIVE_PACKET_FIELD_ERROR(moved);
83272 }
83273#ifdef FREECIV_JSON_CONNECTION
83274 field_addr.name = "paradropped";
83275#endif /* FREECIV_JSON_CONNECTION */
83276 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
83277 RECEIVE_PACKET_FIELD_ERROR(paradropped);
83278 }
83279#ifdef FREECIV_JSON_CONNECTION
83280 field_addr.name = "done_moving";
83281#endif /* FREECIV_JSON_CONNECTION */
83282 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
83283 RECEIVE_PACKET_FIELD_ERROR(done_moving);
83284 }
83285#ifdef FREECIV_JSON_CONNECTION
83286 field_addr.name = "transported_by";
83287#endif /* FREECIV_JSON_CONNECTION */
83288 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
83289 RECEIVE_PACKET_FIELD_ERROR(transported_by);
83290 }
83291#ifdef FREECIV_JSON_CONNECTION
83292 field_addr.name = "stay";
83293#endif /* FREECIV_JSON_CONNECTION */
83294 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
83295 RECEIVE_PACKET_FIELD_ERROR(stay);
83296 }
83297#endif
83298 log_packet_detailed("packet_edit_unit_100: got info about (%d)",
83299 real_packet->id);
83300
83301#ifdef FREECIV_DELTA_PROTOCOL
83302 if (nullptr == *hash) {
83303 *hash = genhash_new_full(hash_packet_edit_unit_100, cmp_packet_edit_unit_100,
83304 nullptr, nullptr, nullptr, destroy_packet_edit_unit);
83305 }
83306
83307 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83308 *real_packet = *old;
83309 } else {
83310 /* packet is already initialized empty */
83311 log_packet_detailed(" no old info");
83312 }
83313
83314 if (BV_ISSET(fields, 0)) {
83315 log_packet_detailed(" got field 'utype'");
83316#ifdef FREECIV_JSON_CONNECTION
83317 field_addr.name = "utype";
83318#endif /* FREECIV_JSON_CONNECTION */
83319 {
83320 int readin;
83321
83322 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
83323 RECEIVE_PACKET_FIELD_ERROR(utype);
83324 }
83325 real_packet->utype = readin;
83326 }
83327 }
83328 if (BV_ISSET(fields, 1)) {
83329 log_packet_detailed(" got field 'owner'");
83330#ifdef FREECIV_JSON_CONNECTION
83331 field_addr.name = "owner";
83332#endif /* FREECIV_JSON_CONNECTION */
83333 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
83334 RECEIVE_PACKET_FIELD_ERROR(owner);
83335 }
83336 }
83337 if (BV_ISSET(fields, 2)) {
83338 log_packet_detailed(" got field 'homecity'");
83339#ifdef FREECIV_JSON_CONNECTION
83340 field_addr.name = "homecity";
83341#endif /* FREECIV_JSON_CONNECTION */
83342 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
83343 RECEIVE_PACKET_FIELD_ERROR(homecity);
83344 }
83345 }
83346 if (BV_ISSET(fields, 3)) {
83347 log_packet_detailed(" got field 'moves_left'");
83348#ifdef FREECIV_JSON_CONNECTION
83349 field_addr.name = "moves_left";
83350#endif /* FREECIV_JSON_CONNECTION */
83351 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
83352 RECEIVE_PACKET_FIELD_ERROR(moves_left);
83353 }
83354 }
83355 if (BV_ISSET(fields, 4)) {
83356 log_packet_detailed(" got field 'hp'");
83357#ifdef FREECIV_JSON_CONNECTION
83358 field_addr.name = "hp";
83359#endif /* FREECIV_JSON_CONNECTION */
83360 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
83361 RECEIVE_PACKET_FIELD_ERROR(hp);
83362 }
83363 }
83364 if (BV_ISSET(fields, 5)) {
83365 log_packet_detailed(" got field 'veteran'");
83366#ifdef FREECIV_JSON_CONNECTION
83367 field_addr.name = "veteran";
83368#endif /* FREECIV_JSON_CONNECTION */
83369 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
83370 RECEIVE_PACKET_FIELD_ERROR(veteran);
83371 }
83372 }
83373 if (BV_ISSET(fields, 6)) {
83374 log_packet_detailed(" got field 'fuel'");
83375#ifdef FREECIV_JSON_CONNECTION
83376 field_addr.name = "fuel";
83377#endif /* FREECIV_JSON_CONNECTION */
83378 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
83379 RECEIVE_PACKET_FIELD_ERROR(fuel);
83380 }
83381 }
83382 if (BV_ISSET(fields, 7)) {
83383 log_packet_detailed(" got field 'activity'");
83384#ifdef FREECIV_JSON_CONNECTION
83385 field_addr.name = "activity";
83386#endif /* FREECIV_JSON_CONNECTION */
83387 {
83388 int readin;
83389
83390 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
83391 RECEIVE_PACKET_FIELD_ERROR(activity);
83392 }
83393 real_packet->activity = readin;
83394 }
83395 }
83396 if (BV_ISSET(fields, 8)) {
83397 log_packet_detailed(" got field 'activity_count'");
83398#ifdef FREECIV_JSON_CONNECTION
83399 field_addr.name = "activity_count";
83400#endif /* FREECIV_JSON_CONNECTION */
83401 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
83402 RECEIVE_PACKET_FIELD_ERROR(activity_count);
83403 }
83404 }
83405 if (BV_ISSET(fields, 9)) {
83406 log_packet_detailed(" got field 'activity_base'");
83407#ifdef FREECIV_JSON_CONNECTION
83408 field_addr.name = "activity_base";
83409#endif /* FREECIV_JSON_CONNECTION */
83410 {
83411 int readin;
83412
83413 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
83414 RECEIVE_PACKET_FIELD_ERROR(activity_base);
83415 }
83416 real_packet->activity_base = readin;
83417 }
83418 }
83419 real_packet->debug = BV_ISSET(fields, 10);
83420 real_packet->moved = BV_ISSET(fields, 11);
83421 real_packet->paradropped = BV_ISSET(fields, 12);
83422 real_packet->done_moving = BV_ISSET(fields, 13);
83423 if (BV_ISSET(fields, 14)) {
83424 log_packet_detailed(" got field 'transported_by'");
83425#ifdef FREECIV_JSON_CONNECTION
83426 field_addr.name = "transported_by";
83427#endif /* FREECIV_JSON_CONNECTION */
83428 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
83429 RECEIVE_PACKET_FIELD_ERROR(transported_by);
83430 }
83431 }
83432 real_packet->stay = BV_ISSET(fields, 15);
83433
83434 if (nullptr == old) {
83435 old = fc_malloc(sizeof(*old));
83436 init_packet_edit_unit(old);
83437 *old = *real_packet;
83438 genhash_insert(*hash, old, old);
83439 } else {
83440 *old = *real_packet;
83441 }
83442
83443#endif /* FREECIV_DELTA_PROTOCOL */
83444 RECEIVE_PACKET_END(real_packet);
83445#undef FREE_PACKET_STRUCT
83446}
83447
83448 static int send_packet_edit_unit_100(struct connection *pc, const struct packet_edit_unit *packet)
83449{
83450 const struct packet_edit_unit *real_packet = packet;
83451 int e;
83452#ifdef FREECIV_DELTA_PROTOCOL
83453 packet_edit_unit_100_fields fields;
83454 struct packet_edit_unit *old;
83455 bool differ;
83456 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT;
83457#endif /* FREECIV_DELTA_PROTOCOL */
83458 SEND_PACKET_START(PACKET_EDIT_UNIT);
83459#ifdef FREECIV_JSON_CONNECTION
83460 struct plocation field_addr;
83461 {
83462 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
83463 field_addr = *field_addr_tmp;
83464 FC_FREE(field_addr_tmp);
83465 }
83466#endif /* FREECIV_JSON_CONNECTION */
83467
83468 log_packet_detailed("packet_edit_unit_100: sending info about (%d)",
83469 real_packet->id);
83470
83471#ifdef FREECIV_DELTA_PROTOCOL
83472 if (nullptr == *hash) {
83473 *hash = genhash_new_full(hash_packet_edit_unit_100, cmp_packet_edit_unit_100,
83474 nullptr, nullptr, nullptr, destroy_packet_edit_unit);
83475 }
83476 BV_CLR_ALL(fields);
83477
83478 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
83479 old = fc_malloc(sizeof(*old));
83480 /* temporary bitcopy just to insert correctly */
83481 *old = *real_packet;
83482 genhash_insert(*hash, old, old);
83483 init_packet_edit_unit(old);
83484 }
83485 differ = (old->utype != real_packet->utype);
83486 if (differ) {
83487 BV_SET(fields, 0);
83488 }
83489
83490 differ = (old->owner != real_packet->owner);
83491 if (differ) {
83492 BV_SET(fields, 1);
83493 }
83494
83495 differ = (old->homecity != real_packet->homecity);
83496 if (differ) {
83497 BV_SET(fields, 2);
83498 }
83499
83500 differ = (old->moves_left != real_packet->moves_left);
83501 if (differ) {
83502 BV_SET(fields, 3);
83503 }
83504
83505 differ = (old->hp != real_packet->hp);
83506 if (differ) {
83507 BV_SET(fields, 4);
83508 }
83509
83510 differ = (old->veteran != real_packet->veteran);
83511 if (differ) {
83512 BV_SET(fields, 5);
83513 }
83514
83515 differ = (old->fuel != real_packet->fuel);
83516 if (differ) {
83517 BV_SET(fields, 6);
83518 }
83519
83520 differ = (old->activity != real_packet->activity);
83521 if (differ) {
83522 BV_SET(fields, 7);
83523 }
83524
83525 differ = (old->activity_count != real_packet->activity_count);
83526 if (differ) {
83527 BV_SET(fields, 8);
83528 }
83529
83530 differ = (old->activity_base != real_packet->activity_base);
83531 if (differ) {
83532 BV_SET(fields, 9);
83533 }
83534
83535 if (packet->debug) {
83536 BV_SET(fields, 10);
83537 }
83538
83539 if (packet->moved) {
83540 BV_SET(fields, 11);
83541 }
83542
83543 if (packet->paradropped) {
83544 BV_SET(fields, 12);
83545 }
83546
83547 if (packet->done_moving) {
83548 BV_SET(fields, 13);
83549 }
83550
83551 differ = (old->transported_by != real_packet->transported_by);
83552 if (differ) {
83553 BV_SET(fields, 14);
83554 }
83555
83556 if (packet->stay) {
83557 BV_SET(fields, 15);
83558 }
83559
83560
83561#ifdef FREECIV_JSON_CONNECTION
83562 field_addr.name = "fields";
83563#endif /* FREECIV_JSON_CONNECTION */
83564 e = 0;
83565 e |= DIO_BV_PUT(&dout, &field_addr, fields);
83566 if (e) {
83567 log_packet_detailed("fields bitvector error detected");
83568 }
83569#ifdef FREECIV_JSON_CONNECTION
83570 field_addr.name = "id";
83571#endif /* FREECIV_JSON_CONNECTION */
83572 e = 0;
83573 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
83574 if (e) {
83575 log_packet_detailed("'id' field error detected");
83576 }
83577
83578 if (BV_ISSET(fields, 0)) {
83579 log_packet_detailed(" field 'utype' has changed");
83580#ifdef FREECIV_JSON_CONNECTION
83581 field_addr.name = "utype";
83582#endif /* FREECIV_JSON_CONNECTION */
83583 e = 0;
83584 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->utype);
83585 if (e) {
83586 log_packet_detailed("'utype' field error detected");
83587 }
83588 }
83589 if (BV_ISSET(fields, 1)) {
83590 log_packet_detailed(" field 'owner' has changed");
83591#ifdef FREECIV_JSON_CONNECTION
83592 field_addr.name = "owner";
83593#endif /* FREECIV_JSON_CONNECTION */
83594 e = 0;
83595 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
83596 if (e) {
83597 log_packet_detailed("'owner' field error detected");
83598 }
83599 }
83600 if (BV_ISSET(fields, 2)) {
83601 log_packet_detailed(" field 'homecity' has changed");
83602#ifdef FREECIV_JSON_CONNECTION
83603 field_addr.name = "homecity";
83604#endif /* FREECIV_JSON_CONNECTION */
83605 e = 0;
83606 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
83607 if (e) {
83608 log_packet_detailed("'homecity' field error detected");
83609 }
83610 }
83611 if (BV_ISSET(fields, 3)) {
83612 log_packet_detailed(" field 'moves_left' has changed");
83613#ifdef FREECIV_JSON_CONNECTION
83614 field_addr.name = "moves_left";
83615#endif /* FREECIV_JSON_CONNECTION */
83616 e = 0;
83617 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
83618 if (e) {
83619 log_packet_detailed("'moves_left' field error detected");
83620 }
83621 }
83622 if (BV_ISSET(fields, 4)) {
83623 log_packet_detailed(" field 'hp' has changed");
83624#ifdef FREECIV_JSON_CONNECTION
83625 field_addr.name = "hp";
83626#endif /* FREECIV_JSON_CONNECTION */
83627 e = 0;
83628 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
83629 if (e) {
83630 log_packet_detailed("'hp' field error detected");
83631 }
83632 }
83633 if (BV_ISSET(fields, 5)) {
83634 log_packet_detailed(" field 'veteran' has changed");
83635#ifdef FREECIV_JSON_CONNECTION
83636 field_addr.name = "veteran";
83637#endif /* FREECIV_JSON_CONNECTION */
83638 e = 0;
83639 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
83640 if (e) {
83641 log_packet_detailed("'veteran' field error detected");
83642 }
83643 }
83644 if (BV_ISSET(fields, 6)) {
83645 log_packet_detailed(" field 'fuel' has changed");
83646#ifdef FREECIV_JSON_CONNECTION
83647 field_addr.name = "fuel";
83648#endif /* FREECIV_JSON_CONNECTION */
83649 e = 0;
83650 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
83651 if (e) {
83652 log_packet_detailed("'fuel' field error detected");
83653 }
83654 }
83655 if (BV_ISSET(fields, 7)) {
83656 log_packet_detailed(" field 'activity' has changed");
83657#ifdef FREECIV_JSON_CONNECTION
83658 field_addr.name = "activity";
83659#endif /* FREECIV_JSON_CONNECTION */
83660 e = 0;
83661 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
83662 if (e) {
83663 log_packet_detailed("'activity' field error detected");
83664 }
83665 }
83666 if (BV_ISSET(fields, 8)) {
83667 log_packet_detailed(" field 'activity_count' has changed");
83668#ifdef FREECIV_JSON_CONNECTION
83669 field_addr.name = "activity_count";
83670#endif /* FREECIV_JSON_CONNECTION */
83671 e = 0;
83672 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
83673 if (e) {
83674 log_packet_detailed("'activity_count' field error detected");
83675 }
83676 }
83677 if (BV_ISSET(fields, 9)) {
83678 log_packet_detailed(" field 'activity_base' has changed");
83679#ifdef FREECIV_JSON_CONNECTION
83680 field_addr.name = "activity_base";
83681#endif /* FREECIV_JSON_CONNECTION */
83682 e = 0;
83683 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
83684 if (e) {
83685 log_packet_detailed("'activity_base' field error detected");
83686 }
83687 }
83688 /* field 10 is folded into the header */
83689 /* field 11 is folded into the header */
83690 /* field 12 is folded into the header */
83691 /* field 13 is folded into the header */
83692 if (BV_ISSET(fields, 14)) {
83693 log_packet_detailed(" field 'transported_by' has changed");
83694#ifdef FREECIV_JSON_CONNECTION
83695 field_addr.name = "transported_by";
83696#endif /* FREECIV_JSON_CONNECTION */
83697 e = 0;
83698 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
83699 if (e) {
83700 log_packet_detailed("'transported_by' field error detected");
83701 }
83702 }
83703 /* field 15 is folded into the header */
83704
83705 *old = *real_packet;
83706#endif /* FREECIV_DELTA_PROTOCOL */
83707#ifndef FREECIV_DELTA_PROTOCOL
83708#ifdef FREECIV_JSON_CONNECTION
83709 field_addr.name = "id";
83710#endif /* FREECIV_JSON_CONNECTION */
83711 e = 0;
83712 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
83713 if (e) {
83714 log_packet_detailed("'id' field error detected");
83715 }
83716#ifdef FREECIV_JSON_CONNECTION
83717 field_addr.name = "utype";
83718#endif /* FREECIV_JSON_CONNECTION */
83719 e = 0;
83720 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->utype);
83721 if (e) {
83722 log_packet_detailed("'utype' field error detected");
83723 }
83724#ifdef FREECIV_JSON_CONNECTION
83725 field_addr.name = "owner";
83726#endif /* FREECIV_JSON_CONNECTION */
83727 e = 0;
83728 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
83729 if (e) {
83730 log_packet_detailed("'owner' field error detected");
83731 }
83732#ifdef FREECIV_JSON_CONNECTION
83733 field_addr.name = "homecity";
83734#endif /* FREECIV_JSON_CONNECTION */
83735 e = 0;
83736 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
83737 if (e) {
83738 log_packet_detailed("'homecity' field error detected");
83739 }
83740#ifdef FREECIV_JSON_CONNECTION
83741 field_addr.name = "moves_left";
83742#endif /* FREECIV_JSON_CONNECTION */
83743 e = 0;
83744 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
83745 if (e) {
83746 log_packet_detailed("'moves_left' field error detected");
83747 }
83748#ifdef FREECIV_JSON_CONNECTION
83749 field_addr.name = "hp";
83750#endif /* FREECIV_JSON_CONNECTION */
83751 e = 0;
83752 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
83753 if (e) {
83754 log_packet_detailed("'hp' field error detected");
83755 }
83756#ifdef FREECIV_JSON_CONNECTION
83757 field_addr.name = "veteran";
83758#endif /* FREECIV_JSON_CONNECTION */
83759 e = 0;
83760 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
83761 if (e) {
83762 log_packet_detailed("'veteran' field error detected");
83763 }
83764#ifdef FREECIV_JSON_CONNECTION
83765 field_addr.name = "fuel";
83766#endif /* FREECIV_JSON_CONNECTION */
83767 e = 0;
83768 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
83769 if (e) {
83770 log_packet_detailed("'fuel' field error detected");
83771 }
83772#ifdef FREECIV_JSON_CONNECTION
83773 field_addr.name = "activity";
83774#endif /* FREECIV_JSON_CONNECTION */
83775 e = 0;
83776 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
83777 if (e) {
83778 log_packet_detailed("'activity' field error detected");
83779 }
83780#ifdef FREECIV_JSON_CONNECTION
83781 field_addr.name = "activity_count";
83782#endif /* FREECIV_JSON_CONNECTION */
83783 e = 0;
83784 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
83785 if (e) {
83786 log_packet_detailed("'activity_count' field error detected");
83787 }
83788#ifdef FREECIV_JSON_CONNECTION
83789 field_addr.name = "activity_base";
83790#endif /* FREECIV_JSON_CONNECTION */
83791 e = 0;
83792 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
83793 if (e) {
83794 log_packet_detailed("'activity_base' field error detected");
83795 }
83796#ifdef FREECIV_JSON_CONNECTION
83797 field_addr.name = "debug";
83798#endif /* FREECIV_JSON_CONNECTION */
83799 e = 0;
83800 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
83801 if (e) {
83802 log_packet_detailed("'debug' field error detected");
83803 }
83804#ifdef FREECIV_JSON_CONNECTION
83805 field_addr.name = "moved";
83806#endif /* FREECIV_JSON_CONNECTION */
83807 e = 0;
83808 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->moved);
83809 if (e) {
83810 log_packet_detailed("'moved' field error detected");
83811 }
83812#ifdef FREECIV_JSON_CONNECTION
83813 field_addr.name = "paradropped";
83814#endif /* FREECIV_JSON_CONNECTION */
83815 e = 0;
83816 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
83817 if (e) {
83818 log_packet_detailed("'paradropped' field error detected");
83819 }
83820#ifdef FREECIV_JSON_CONNECTION
83821 field_addr.name = "done_moving";
83822#endif /* FREECIV_JSON_CONNECTION */
83823 e = 0;
83824 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
83825 if (e) {
83826 log_packet_detailed("'done_moving' field error detected");
83827 }
83828#ifdef FREECIV_JSON_CONNECTION
83829 field_addr.name = "transported_by";
83830#endif /* FREECIV_JSON_CONNECTION */
83831 e = 0;
83832 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
83833 if (e) {
83834 log_packet_detailed("'transported_by' field error detected");
83835 }
83836#ifdef FREECIV_JSON_CONNECTION
83837 field_addr.name = "stay";
83838#endif /* FREECIV_JSON_CONNECTION */
83839 e = 0;
83840 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
83841 if (e) {
83842 log_packet_detailed("'stay' field error detected");
83843 }
83844
83845#endif
83846 SEND_PACKET_END(PACKET_EDIT_UNIT);
83847}
83848
83849 int send_packet_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
83850{
83851 if (!pc->used) {
83852 log_error("WARNING: trying to send data to the closed connection %s",
83853 conn_description(pc));
83854 return -1;
83855 }
83856 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT].packet != nullptr, -1,
83857 "Handler for PACKET_EDIT_UNIT not installed");
83858 return pc->phs.handlers->send[PACKET_EDIT_UNIT].packet(pc, packet);
83859}
83860
83861 static inline void init_packet_edit_city_create(struct packet_edit_city_create *packet)
83862{
83863 memset(packet, 0, sizeof(*packet));
83864}
83865
83866#define free_packet_edit_city_create(_packet) (void) 0
83867#define destroy_packet_edit_city_create free
83868
83869#ifdef FREECIV_DELTA_PROTOCOL
83870#define hash_packet_edit_city_create_100 hash_const
83871
83872#define cmp_packet_edit_city_create_100 cmp_const
83873
83874 BV_DEFINE(packet_edit_city_create_100_fields, 4);
83875#endif /* FREECIV_DELTA_PROTOCOL */
83876
83877 static struct packet_edit_city_create *receive_packet_edit_city_create_100(struct connection *pc)
83878{
83879#define FREE_PACKET_STRUCT(_packet) free_packet_edit_city_create(_packet)
83880#ifdef FREECIV_DELTA_PROTOCOL
83881 packet_edit_city_create_100_fields fields;
83882 struct packet_edit_city_create *old;
83883 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY_CREATE;
83884#endif /* FREECIV_DELTA_PROTOCOL */
83885 RECEIVE_PACKET_START(packet_edit_city_create, real_packet);
83886#ifdef FREECIV_JSON_CONNECTION
83887 struct plocation field_addr;
83888 {
83889 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
83890 field_addr = *field_addr_tmp;
83891 FC_FREE(field_addr_tmp);
83892 }
83893#endif /* FREECIV_JSON_CONNECTION */
83894
83895#ifdef FREECIV_DELTA_PROTOCOL
83896#ifdef FREECIV_JSON_CONNECTION
83897 field_addr.name = "fields";
83898#endif /* FREECIV_JSON_CONNECTION */
83899 DIO_BV_GET(&din, &field_addr, fields);
83900
83901#else /* FREECIV_DELTA_PROTOCOL */
83902#ifdef FREECIV_JSON_CONNECTION
83903 field_addr.name = "owner";
83904#endif /* FREECIV_JSON_CONNECTION */
83905 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
83906 RECEIVE_PACKET_FIELD_ERROR(owner);
83907 }
83908#ifdef FREECIV_JSON_CONNECTION
83909 field_addr.name = "tile";
83910#endif /* FREECIV_JSON_CONNECTION */
83911 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
83912 RECEIVE_PACKET_FIELD_ERROR(tile);
83913 }
83914#ifdef FREECIV_JSON_CONNECTION
83915 field_addr.name = "size";
83916#endif /* FREECIV_JSON_CONNECTION */
83917 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
83918 RECEIVE_PACKET_FIELD_ERROR(size);
83919 }
83920#ifdef FREECIV_JSON_CONNECTION
83921 field_addr.name = "tag";
83922#endif /* FREECIV_JSON_CONNECTION */
83923 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
83924 RECEIVE_PACKET_FIELD_ERROR(tag);
83925 }
83926#endif
83927 log_packet_detailed("packet_edit_city_create_100: got info about ()");
83928
83929#ifdef FREECIV_DELTA_PROTOCOL
83930 if (nullptr == *hash) {
83931 *hash = genhash_new_full(hash_packet_edit_city_create_100, cmp_packet_edit_city_create_100,
83932 nullptr, nullptr, nullptr, destroy_packet_edit_city_create);
83933 }
83934
83935 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83936 *real_packet = *old;
83937 } else {
83938 /* packet is already initialized empty */
83939 log_packet_detailed(" no old info");
83940 }
83941
83942 if (BV_ISSET(fields, 0)) {
83943 log_packet_detailed(" got field 'owner'");
83944#ifdef FREECIV_JSON_CONNECTION
83945 field_addr.name = "owner";
83946#endif /* FREECIV_JSON_CONNECTION */
83947 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
83948 RECEIVE_PACKET_FIELD_ERROR(owner);
83949 }
83950 }
83951 if (BV_ISSET(fields, 1)) {
83952 log_packet_detailed(" got field 'tile'");
83953#ifdef FREECIV_JSON_CONNECTION
83954 field_addr.name = "tile";
83955#endif /* FREECIV_JSON_CONNECTION */
83956 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
83957 RECEIVE_PACKET_FIELD_ERROR(tile);
83958 }
83959 }
83960 if (BV_ISSET(fields, 2)) {
83961 log_packet_detailed(" got field 'size'");
83962#ifdef FREECIV_JSON_CONNECTION
83963 field_addr.name = "size";
83964#endif /* FREECIV_JSON_CONNECTION */
83965 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
83966 RECEIVE_PACKET_FIELD_ERROR(size);
83967 }
83968 }
83969 if (BV_ISSET(fields, 3)) {
83970 log_packet_detailed(" got field 'tag'");
83971#ifdef FREECIV_JSON_CONNECTION
83972 field_addr.name = "tag";
83973#endif /* FREECIV_JSON_CONNECTION */
83974 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
83975 RECEIVE_PACKET_FIELD_ERROR(tag);
83976 }
83977 }
83978
83979 if (nullptr == old) {
83980 old = fc_malloc(sizeof(*old));
83981 init_packet_edit_city_create(old);
83982 *old = *real_packet;
83983 genhash_insert(*hash, old, old);
83984 } else {
83985 *old = *real_packet;
83986 }
83987
83988#endif /* FREECIV_DELTA_PROTOCOL */
83989 RECEIVE_PACKET_END(real_packet);
83990#undef FREE_PACKET_STRUCT
83991}
83992
83993 static int send_packet_edit_city_create_100(struct connection *pc, const struct packet_edit_city_create *packet)
83994{
83995 const struct packet_edit_city_create *real_packet = packet;
83996 int e;
83997#ifdef FREECIV_DELTA_PROTOCOL
83998 packet_edit_city_create_100_fields fields;
83999 struct packet_edit_city_create *old;
84000 bool differ;
84001 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY_CREATE;
84002#endif /* FREECIV_DELTA_PROTOCOL */
84003 SEND_PACKET_START(PACKET_EDIT_CITY_CREATE);
84004#ifdef FREECIV_JSON_CONNECTION
84005 struct plocation field_addr;
84006 {
84007 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
84008 field_addr = *field_addr_tmp;
84009 FC_FREE(field_addr_tmp);
84010 }
84011#endif /* FREECIV_JSON_CONNECTION */
84012
84013 log_packet_detailed("packet_edit_city_create_100: sending info about ()");
84014
84015#ifdef FREECIV_DELTA_PROTOCOL
84016 if (nullptr == *hash) {
84017 *hash = genhash_new_full(hash_packet_edit_city_create_100, cmp_packet_edit_city_create_100,
84018 nullptr, nullptr, nullptr, destroy_packet_edit_city_create);
84019 }
84020 BV_CLR_ALL(fields);
84021
84022 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84023 old = fc_malloc(sizeof(*old));
84024 /* temporary bitcopy just to insert correctly */
84025 *old = *real_packet;
84026 genhash_insert(*hash, old, old);
84027 init_packet_edit_city_create(old);
84028 }
84029 differ = (old->owner != real_packet->owner);
84030 if (differ) {
84031 BV_SET(fields, 0);
84032 }
84033
84034 differ = (old->tile != real_packet->tile);
84035 if (differ) {
84036 BV_SET(fields, 1);
84037 }
84038
84039 differ = (old->size != real_packet->size);
84040 if (differ) {
84041 BV_SET(fields, 2);
84042 }
84043
84044 differ = (old->tag != real_packet->tag);
84045 if (differ) {
84046 BV_SET(fields, 3);
84047 }
84048
84049
84050#ifdef FREECIV_JSON_CONNECTION
84051 field_addr.name = "fields";
84052#endif /* FREECIV_JSON_CONNECTION */
84053 e = 0;
84054 e |= DIO_BV_PUT(&dout, &field_addr, fields);
84055 if (e) {
84056 log_packet_detailed("fields bitvector error detected");
84057 }
84058
84059 if (BV_ISSET(fields, 0)) {
84060 log_packet_detailed(" field 'owner' has changed");
84061#ifdef FREECIV_JSON_CONNECTION
84062 field_addr.name = "owner";
84063#endif /* FREECIV_JSON_CONNECTION */
84064 e = 0;
84065 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
84066 if (e) {
84067 log_packet_detailed("'owner' field error detected");
84068 }
84069 }
84070 if (BV_ISSET(fields, 1)) {
84071 log_packet_detailed(" field 'tile' has changed");
84072#ifdef FREECIV_JSON_CONNECTION
84073 field_addr.name = "tile";
84074#endif /* FREECIV_JSON_CONNECTION */
84075 e = 0;
84076 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
84077 if (e) {
84078 log_packet_detailed("'tile' field error detected");
84079 }
84080 }
84081 if (BV_ISSET(fields, 2)) {
84082 log_packet_detailed(" field 'size' has changed");
84083#ifdef FREECIV_JSON_CONNECTION
84084 field_addr.name = "size";
84085#endif /* FREECIV_JSON_CONNECTION */
84086 e = 0;
84087 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
84088 if (e) {
84089 log_packet_detailed("'size' field error detected");
84090 }
84091 }
84092 if (BV_ISSET(fields, 3)) {
84093 log_packet_detailed(" field 'tag' has changed");
84094#ifdef FREECIV_JSON_CONNECTION
84095 field_addr.name = "tag";
84096#endif /* FREECIV_JSON_CONNECTION */
84097 e = 0;
84098 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
84099 if (e) {
84100 log_packet_detailed("'tag' field error detected");
84101 }
84102 }
84103
84104 *old = *real_packet;
84105#endif /* FREECIV_DELTA_PROTOCOL */
84106#ifndef FREECIV_DELTA_PROTOCOL
84107#ifdef FREECIV_JSON_CONNECTION
84108 field_addr.name = "owner";
84109#endif /* FREECIV_JSON_CONNECTION */
84110 e = 0;
84111 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
84112 if (e) {
84113 log_packet_detailed("'owner' field error detected");
84114 }
84115#ifdef FREECIV_JSON_CONNECTION
84116 field_addr.name = "tile";
84117#endif /* FREECIV_JSON_CONNECTION */
84118 e = 0;
84119 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
84120 if (e) {
84121 log_packet_detailed("'tile' field error detected");
84122 }
84123#ifdef FREECIV_JSON_CONNECTION
84124 field_addr.name = "size";
84125#endif /* FREECIV_JSON_CONNECTION */
84126 e = 0;
84127 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
84128 if (e) {
84129 log_packet_detailed("'size' field error detected");
84130 }
84131#ifdef FREECIV_JSON_CONNECTION
84132 field_addr.name = "tag";
84133#endif /* FREECIV_JSON_CONNECTION */
84134 e = 0;
84135 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
84136 if (e) {
84137 log_packet_detailed("'tag' field error detected");
84138 }
84139
84140#endif
84141 SEND_PACKET_END(PACKET_EDIT_CITY_CREATE);
84142}
84143
84144 int send_packet_edit_city_create(struct connection *pc, const struct packet_edit_city_create *packet)
84145{
84146 if (!pc->used) {
84147 log_error("WARNING: trying to send data to the closed connection %s",
84148 conn_description(pc));
84149 return -1;
84150 }
84151 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY_CREATE].packet != nullptr, -1,
84152 "Handler for PACKET_EDIT_CITY_CREATE not installed");
84153 return pc->phs.handlers->send[PACKET_EDIT_CITY_CREATE].packet(pc, packet);
84154}
84155
84156 int dsend_packet_edit_city_create(struct connection *pc, int owner, int tile, int size, int tag)
84157{
84158 struct packet_edit_city_create packet, *real_packet = &packet;
84159
84160 real_packet->owner = owner;
84161 real_packet->tile = tile;
84162 real_packet->size = size;
84163 real_packet->tag = tag;
84164
84165 return send_packet_edit_city_create(pc, real_packet);
84166}
84167
84168 static inline void init_packet_edit_city_remove(struct packet_edit_city_remove *packet)
84169{
84170 memset(packet, 0, sizeof(*packet));
84171}
84172
84173#define free_packet_edit_city_remove(_packet) (void) 0
84174#define destroy_packet_edit_city_remove free
84175
84176#ifdef FREECIV_DELTA_PROTOCOL
84177#define hash_packet_edit_city_remove_100 hash_const
84178
84179#define cmp_packet_edit_city_remove_100 cmp_const
84180
84181 BV_DEFINE(packet_edit_city_remove_100_fields, 1);
84182#endif /* FREECIV_DELTA_PROTOCOL */
84183
84184 static struct packet_edit_city_remove *receive_packet_edit_city_remove_100(struct connection *pc)
84185{
84186#define FREE_PACKET_STRUCT(_packet) free_packet_edit_city_remove(_packet)
84187#ifdef FREECIV_DELTA_PROTOCOL
84188 packet_edit_city_remove_100_fields fields;
84189 struct packet_edit_city_remove *old;
84190 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY_REMOVE;
84191#endif /* FREECIV_DELTA_PROTOCOL */
84192 RECEIVE_PACKET_START(packet_edit_city_remove, real_packet);
84193#ifdef FREECIV_JSON_CONNECTION
84194 struct plocation field_addr;
84195 {
84196 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
84197 field_addr = *field_addr_tmp;
84198 FC_FREE(field_addr_tmp);
84199 }
84200#endif /* FREECIV_JSON_CONNECTION */
84201
84202#ifdef FREECIV_DELTA_PROTOCOL
84203#ifdef FREECIV_JSON_CONNECTION
84204 field_addr.name = "fields";
84205#endif /* FREECIV_JSON_CONNECTION */
84206 DIO_BV_GET(&din, &field_addr, fields);
84207
84208#else /* FREECIV_DELTA_PROTOCOL */
84209#ifdef FREECIV_JSON_CONNECTION
84210 field_addr.name = "id";
84211#endif /* FREECIV_JSON_CONNECTION */
84212 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84213 RECEIVE_PACKET_FIELD_ERROR(id);
84214 }
84215#endif
84216 log_packet_detailed("packet_edit_city_remove_100: got info about ()");
84217
84218#ifdef FREECIV_DELTA_PROTOCOL
84219 if (nullptr == *hash) {
84220 *hash = genhash_new_full(hash_packet_edit_city_remove_100, cmp_packet_edit_city_remove_100,
84221 nullptr, nullptr, nullptr, destroy_packet_edit_city_remove);
84222 }
84223
84224 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84225 *real_packet = *old;
84226 } else {
84227 /* packet is already initialized empty */
84228 log_packet_detailed(" no old info");
84229 }
84230
84231 if (BV_ISSET(fields, 0)) {
84232 log_packet_detailed(" got field 'id'");
84233#ifdef FREECIV_JSON_CONNECTION
84234 field_addr.name = "id";
84235#endif /* FREECIV_JSON_CONNECTION */
84236 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84237 RECEIVE_PACKET_FIELD_ERROR(id);
84238 }
84239 }
84240
84241 if (nullptr == old) {
84242 old = fc_malloc(sizeof(*old));
84243 init_packet_edit_city_remove(old);
84244 *old = *real_packet;
84245 genhash_insert(*hash, old, old);
84246 } else {
84247 *old = *real_packet;
84248 }
84249
84250#endif /* FREECIV_DELTA_PROTOCOL */
84251 RECEIVE_PACKET_END(real_packet);
84252#undef FREE_PACKET_STRUCT
84253}
84254
84255 static int send_packet_edit_city_remove_100(struct connection *pc, const struct packet_edit_city_remove *packet)
84256{
84257 const struct packet_edit_city_remove *real_packet = packet;
84258 int e;
84259#ifdef FREECIV_DELTA_PROTOCOL
84260 packet_edit_city_remove_100_fields fields;
84261 struct packet_edit_city_remove *old;
84262 bool differ;
84263 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY_REMOVE;
84264#endif /* FREECIV_DELTA_PROTOCOL */
84265 SEND_PACKET_START(PACKET_EDIT_CITY_REMOVE);
84266#ifdef FREECIV_JSON_CONNECTION
84267 struct plocation field_addr;
84268 {
84269 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
84270 field_addr = *field_addr_tmp;
84271 FC_FREE(field_addr_tmp);
84272 }
84273#endif /* FREECIV_JSON_CONNECTION */
84274
84275 log_packet_detailed("packet_edit_city_remove_100: sending info about ()");
84276
84277#ifdef FREECIV_DELTA_PROTOCOL
84278 if (nullptr == *hash) {
84279 *hash = genhash_new_full(hash_packet_edit_city_remove_100, cmp_packet_edit_city_remove_100,
84280 nullptr, nullptr, nullptr, destroy_packet_edit_city_remove);
84281 }
84282 BV_CLR_ALL(fields);
84283
84284 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84285 old = fc_malloc(sizeof(*old));
84286 /* temporary bitcopy just to insert correctly */
84287 *old = *real_packet;
84288 genhash_insert(*hash, old, old);
84289 init_packet_edit_city_remove(old);
84290 }
84291 differ = (old->id != real_packet->id);
84292 if (differ) {
84293 BV_SET(fields, 0);
84294 }
84295
84296
84297#ifdef FREECIV_JSON_CONNECTION
84298 field_addr.name = "fields";
84299#endif /* FREECIV_JSON_CONNECTION */
84300 e = 0;
84301 e |= DIO_BV_PUT(&dout, &field_addr, fields);
84302 if (e) {
84303 log_packet_detailed("fields bitvector error detected");
84304 }
84305
84306 if (BV_ISSET(fields, 0)) {
84307 log_packet_detailed(" field 'id' has changed");
84308#ifdef FREECIV_JSON_CONNECTION
84309 field_addr.name = "id";
84310#endif /* FREECIV_JSON_CONNECTION */
84311 e = 0;
84312 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
84313 if (e) {
84314 log_packet_detailed("'id' field error detected");
84315 }
84316 }
84317
84318 *old = *real_packet;
84319#endif /* FREECIV_DELTA_PROTOCOL */
84320#ifndef FREECIV_DELTA_PROTOCOL
84321#ifdef FREECIV_JSON_CONNECTION
84322 field_addr.name = "id";
84323#endif /* FREECIV_JSON_CONNECTION */
84324 e = 0;
84325 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
84326 if (e) {
84327 log_packet_detailed("'id' field error detected");
84328 }
84329
84330#endif
84331 SEND_PACKET_END(PACKET_EDIT_CITY_REMOVE);
84332}
84333
84334 int send_packet_edit_city_remove(struct connection *pc, const struct packet_edit_city_remove *packet)
84335{
84336 if (!pc->used) {
84337 log_error("WARNING: trying to send data to the closed connection %s",
84338 conn_description(pc));
84339 return -1;
84340 }
84341 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY_REMOVE].packet != nullptr, -1,
84342 "Handler for PACKET_EDIT_CITY_REMOVE not installed");
84343 return pc->phs.handlers->send[PACKET_EDIT_CITY_REMOVE].packet(pc, packet);
84344}
84345
84346 int dsend_packet_edit_city_remove(struct connection *pc, int id)
84347{
84348 struct packet_edit_city_remove packet, *real_packet = &packet;
84349
84350 real_packet->id = id;
84351
84352 return send_packet_edit_city_remove(pc, real_packet);
84353}
84354
84355 static inline void init_packet_edit_city(struct packet_edit_city *packet)
84356{
84357 memset(packet, 0, sizeof(*packet));
84358}
84359
84360#define free_packet_edit_city(_packet) (void) 0
84361#define destroy_packet_edit_city free
84362
84363#ifdef FREECIV_DELTA_PROTOCOL
84364static genhash_val_t hash_packet_edit_city_100(const void *vkey)
84365{
84366 const struct packet_edit_city *key = (const struct packet_edit_city *) vkey;
84367 genhash_val_t result = 0;
84368
84369 result += key->id;
84370
84371 result &= 0xFFFFFFFF;
84372 return result;
84373}
84374
84375static bool cmp_packet_edit_city_100(const void *vkey1, const void *vkey2)
84376{
84377 const struct packet_edit_city *old = (const struct packet_edit_city *) vkey1;
84378 const struct packet_edit_city *real_packet = (const struct packet_edit_city *) vkey2;
84379 bool differ;
84380
84381 differ = (old->id != real_packet->id);
84382
84383 return !differ;
84384}
84385 BV_DEFINE(packet_edit_city_100_fields, 28);
84386#endif /* FREECIV_DELTA_PROTOCOL */
84387
84388 static struct packet_edit_city *receive_packet_edit_city_100(struct connection *pc)
84389{
84390#define FREE_PACKET_STRUCT(_packet) free_packet_edit_city(_packet)
84391#ifdef FREECIV_DELTA_PROTOCOL
84392 packet_edit_city_100_fields fields;
84393 struct packet_edit_city *old;
84394 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY;
84395#endif /* FREECIV_DELTA_PROTOCOL */
84396 RECEIVE_PACKET_START(packet_edit_city, real_packet);
84397#ifdef FREECIV_JSON_CONNECTION
84398 struct plocation field_addr;
84399 {
84400 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
84401 field_addr = *field_addr_tmp;
84402 FC_FREE(field_addr_tmp);
84403 }
84404#endif /* FREECIV_JSON_CONNECTION */
84405
84406#ifdef FREECIV_DELTA_PROTOCOL
84407#ifdef FREECIV_JSON_CONNECTION
84408 field_addr.name = "fields";
84409#endif /* FREECIV_JSON_CONNECTION */
84410 DIO_BV_GET(&din, &field_addr, fields);
84411#ifdef FREECIV_JSON_CONNECTION
84412 field_addr.name = "id";
84413#endif /* FREECIV_JSON_CONNECTION */
84414 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84415 RECEIVE_PACKET_FIELD_ERROR(id);
84416 }
84417
84418#else /* FREECIV_DELTA_PROTOCOL */
84419#ifdef FREECIV_JSON_CONNECTION
84420 field_addr.name = "id";
84421#endif /* FREECIV_JSON_CONNECTION */
84422 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84423 RECEIVE_PACKET_FIELD_ERROR(id);
84424 }
84425#ifdef FREECIV_JSON_CONNECTION
84426 field_addr.name = "name";
84427#endif /* FREECIV_JSON_CONNECTION */
84428 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
84429 RECEIVE_PACKET_FIELD_ERROR(name);
84430 }
84431#ifdef FREECIV_JSON_CONNECTION
84432 field_addr.name = "owner";
84433#endif /* FREECIV_JSON_CONNECTION */
84434 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
84435 RECEIVE_PACKET_FIELD_ERROR(owner);
84436 }
84437#ifdef FREECIV_JSON_CONNECTION
84438 field_addr.name = "original";
84439#endif /* FREECIV_JSON_CONNECTION */
84440 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->original)) {
84441 RECEIVE_PACKET_FIELD_ERROR(original);
84442 }
84443#ifdef FREECIV_JSON_CONNECTION
84444 field_addr.name = "size";
84445#endif /* FREECIV_JSON_CONNECTION */
84446 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
84447 RECEIVE_PACKET_FIELD_ERROR(size);
84448 }
84449#ifdef FREECIV_JSON_CONNECTION
84450 field_addr.name = "history";
84451#endif /* FREECIV_JSON_CONNECTION */
84452 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
84453 RECEIVE_PACKET_FIELD_ERROR(history);
84454 }
84455#ifdef FREECIV_JSON_CONNECTION
84456 field_addr.name = "ppl_happy";
84457#endif /* FREECIV_JSON_CONNECTION */
84458 {
84459 int i;
84460
84461#ifdef FREECIV_JSON_CONNECTION
84462 /* Enter array. */
84463 field_addr.sub_location = plocation_elem_new(0);
84464#endif /* FREECIV_JSON_CONNECTION */
84465
84466 for (i = 0; i < 5; i++) {
84467#ifdef FREECIV_JSON_CONNECTION
84468 field_addr.sub_location->number = i;
84469#endif /* FREECIV_JSON_CONNECTION */
84470 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
84471 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
84472 }
84473 }
84474
84475#ifdef FREECIV_JSON_CONNECTION
84476 /* Exit array. */
84477 FC_FREE(field_addr.sub_location);
84478#endif /* FREECIV_JSON_CONNECTION */
84479 }
84480#ifdef FREECIV_JSON_CONNECTION
84481 field_addr.name = "ppl_content";
84482#endif /* FREECIV_JSON_CONNECTION */
84483 {
84484 int i;
84485
84486#ifdef FREECIV_JSON_CONNECTION
84487 /* Enter array. */
84488 field_addr.sub_location = plocation_elem_new(0);
84489#endif /* FREECIV_JSON_CONNECTION */
84490
84491 for (i = 0; i < 5; i++) {
84492#ifdef FREECIV_JSON_CONNECTION
84493 field_addr.sub_location->number = i;
84494#endif /* FREECIV_JSON_CONNECTION */
84495 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
84496 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
84497 }
84498 }
84499
84500#ifdef FREECIV_JSON_CONNECTION
84501 /* Exit array. */
84502 FC_FREE(field_addr.sub_location);
84503#endif /* FREECIV_JSON_CONNECTION */
84504 }
84505#ifdef FREECIV_JSON_CONNECTION
84506 field_addr.name = "ppl_unhappy";
84507#endif /* FREECIV_JSON_CONNECTION */
84508 {
84509 int i;
84510
84511#ifdef FREECIV_JSON_CONNECTION
84512 /* Enter array. */
84513 field_addr.sub_location = plocation_elem_new(0);
84514#endif /* FREECIV_JSON_CONNECTION */
84515
84516 for (i = 0; i < 5; i++) {
84517#ifdef FREECIV_JSON_CONNECTION
84518 field_addr.sub_location->number = i;
84519#endif /* FREECIV_JSON_CONNECTION */
84520 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
84521 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
84522 }
84523 }
84524
84525#ifdef FREECIV_JSON_CONNECTION
84526 /* Exit array. */
84527 FC_FREE(field_addr.sub_location);
84528#endif /* FREECIV_JSON_CONNECTION */
84529 }
84530#ifdef FREECIV_JSON_CONNECTION
84531 field_addr.name = "ppl_angry";
84532#endif /* FREECIV_JSON_CONNECTION */
84533 {
84534 int i;
84535
84536#ifdef FREECIV_JSON_CONNECTION
84537 /* Enter array. */
84538 field_addr.sub_location = plocation_elem_new(0);
84539#endif /* FREECIV_JSON_CONNECTION */
84540
84541 for (i = 0; i < 5; i++) {
84542#ifdef FREECIV_JSON_CONNECTION
84543 field_addr.sub_location->number = i;
84544#endif /* FREECIV_JSON_CONNECTION */
84545 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
84546 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
84547 }
84548 }
84549
84550#ifdef FREECIV_JSON_CONNECTION
84551 /* Exit array. */
84552 FC_FREE(field_addr.sub_location);
84553#endif /* FREECIV_JSON_CONNECTION */
84554 }
84555#ifdef FREECIV_JSON_CONNECTION
84556 field_addr.name = "specialists_size";
84557#endif /* FREECIV_JSON_CONNECTION */
84558 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
84559 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
84560 }
84561#ifdef FREECIV_JSON_CONNECTION
84562 field_addr.name = "specialists";
84563#endif /* FREECIV_JSON_CONNECTION */
84564 {
84565 int i;
84566
84567#ifdef FREECIV_JSON_CONNECTION
84568 /* Enter array. */
84569 field_addr.sub_location = plocation_elem_new(0);
84570#endif /* FREECIV_JSON_CONNECTION */
84571
84572 if (real_packet->specialists_size > SP_MAX) {
84573 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
84574 }
84575 for (i = 0; i < real_packet->specialists_size; i++) {
84576#ifdef FREECIV_JSON_CONNECTION
84577 field_addr.sub_location->number = i;
84578#endif /* FREECIV_JSON_CONNECTION */
84579 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
84580 RECEIVE_PACKET_FIELD_ERROR(specialists);
84581 }
84582 }
84583
84584#ifdef FREECIV_JSON_CONNECTION
84585 /* Exit array. */
84586 FC_FREE(field_addr.sub_location);
84587#endif /* FREECIV_JSON_CONNECTION */
84588 }
84589#ifdef FREECIV_JSON_CONNECTION
84590 field_addr.name = "food_stock";
84591#endif /* FREECIV_JSON_CONNECTION */
84592 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
84593 RECEIVE_PACKET_FIELD_ERROR(food_stock);
84594 }
84595#ifdef FREECIV_JSON_CONNECTION
84596 field_addr.name = "shield_stock";
84597#endif /* FREECIV_JSON_CONNECTION */
84598 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
84599 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
84600 }
84601#ifdef FREECIV_JSON_CONNECTION
84602 field_addr.name = "airlift";
84603#endif /* FREECIV_JSON_CONNECTION */
84604 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift)) {
84605 RECEIVE_PACKET_FIELD_ERROR(airlift);
84606 }
84607#ifdef FREECIV_JSON_CONNECTION
84608 field_addr.name = "debug";
84609#endif /* FREECIV_JSON_CONNECTION */
84610 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
84611 RECEIVE_PACKET_FIELD_ERROR(debug);
84612 }
84613#ifdef FREECIV_JSON_CONNECTION
84614 field_addr.name = "did_buy";
84615#endif /* FREECIV_JSON_CONNECTION */
84616 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
84617 RECEIVE_PACKET_FIELD_ERROR(did_buy);
84618 }
84619#ifdef FREECIV_JSON_CONNECTION
84620 field_addr.name = "did_sell";
84621#endif /* FREECIV_JSON_CONNECTION */
84622 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
84623 RECEIVE_PACKET_FIELD_ERROR(did_sell);
84624 }
84625#ifdef FREECIV_JSON_CONNECTION
84626 field_addr.name = "was_happy";
84627#endif /* FREECIV_JSON_CONNECTION */
84628 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
84629 RECEIVE_PACKET_FIELD_ERROR(was_happy);
84630 }
84631#ifdef FREECIV_JSON_CONNECTION
84632 field_addr.name = "had_famine";
84633#endif /* FREECIV_JSON_CONNECTION */
84634 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->had_famine)) {
84635 RECEIVE_PACKET_FIELD_ERROR(had_famine);
84636 }
84637#ifdef FREECIV_JSON_CONNECTION
84638 field_addr.name = "anarchy";
84639#endif /* FREECIV_JSON_CONNECTION */
84640 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
84641 RECEIVE_PACKET_FIELD_ERROR(anarchy);
84642 }
84643#ifdef FREECIV_JSON_CONNECTION
84644 field_addr.name = "rapture";
84645#endif /* FREECIV_JSON_CONNECTION */
84646 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
84647 RECEIVE_PACKET_FIELD_ERROR(rapture);
84648 }
84649#ifdef FREECIV_JSON_CONNECTION
84650 field_addr.name = "steal";
84651#endif /* FREECIV_JSON_CONNECTION */
84652 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
84653 RECEIVE_PACKET_FIELD_ERROR(steal);
84654 }
84655#ifdef FREECIV_JSON_CONNECTION
84656 field_addr.name = "turn_founded";
84657#endif /* FREECIV_JSON_CONNECTION */
84658 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
84659 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
84660 }
84661#ifdef FREECIV_JSON_CONNECTION
84662 field_addr.name = "turn_last_built";
84663#endif /* FREECIV_JSON_CONNECTION */
84664 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
84665 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
84666 }
84667#ifdef FREECIV_JSON_CONNECTION
84668 field_addr.name = "built";
84669#endif /* FREECIV_JSON_CONNECTION */
84670 {
84671 int i;
84672
84673#ifdef FREECIV_JSON_CONNECTION
84674 /* Enter array. */
84675 field_addr.sub_location = plocation_elem_new(0);
84676#endif /* FREECIV_JSON_CONNECTION */
84677
84678 for (i = 0; i < B_LAST; i++) {
84679#ifdef FREECIV_JSON_CONNECTION
84680 field_addr.sub_location->number = i;
84681#endif /* FREECIV_JSON_CONNECTION */
84682 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
84683 RECEIVE_PACKET_FIELD_ERROR(built);
84684 }
84685 }
84686
84687#ifdef FREECIV_JSON_CONNECTION
84688 /* Exit array. */
84689 FC_FREE(field_addr.sub_location);
84690#endif /* FREECIV_JSON_CONNECTION */
84691 }
84692#ifdef FREECIV_JSON_CONNECTION
84693 field_addr.name = "production_kind";
84694#endif /* FREECIV_JSON_CONNECTION */
84695 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
84696 RECEIVE_PACKET_FIELD_ERROR(production_kind);
84697 }
84698#ifdef FREECIV_JSON_CONNECTION
84699 field_addr.name = "production_value";
84700#endif /* FREECIV_JSON_CONNECTION */
84701 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
84702 RECEIVE_PACKET_FIELD_ERROR(production_value);
84703 }
84704#ifdef FREECIV_JSON_CONNECTION
84705 field_addr.name = "city_options";
84706#endif /* FREECIV_JSON_CONNECTION */
84707 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
84708 RECEIVE_PACKET_FIELD_ERROR(city_options);
84709 }
84710#endif
84711 log_packet_detailed("packet_edit_city_100: got info about (%d)",
84712 real_packet->id);
84713
84714#ifdef FREECIV_DELTA_PROTOCOL
84715 if (nullptr == *hash) {
84716 *hash = genhash_new_full(hash_packet_edit_city_100, cmp_packet_edit_city_100,
84717 nullptr, nullptr, nullptr, destroy_packet_edit_city);
84718 }
84719
84720 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84721 *real_packet = *old;
84722 } else {
84723 /* packet is already initialized empty */
84724 log_packet_detailed(" no old info");
84725 }
84726
84727 if (BV_ISSET(fields, 0)) {
84728 log_packet_detailed(" got field 'name'");
84729#ifdef FREECIV_JSON_CONNECTION
84730 field_addr.name = "name";
84731#endif /* FREECIV_JSON_CONNECTION */
84732 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
84733 RECEIVE_PACKET_FIELD_ERROR(name);
84734 }
84735 }
84736 if (BV_ISSET(fields, 1)) {
84737 log_packet_detailed(" got field 'owner'");
84738#ifdef FREECIV_JSON_CONNECTION
84739 field_addr.name = "owner";
84740#endif /* FREECIV_JSON_CONNECTION */
84741 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->owner)) {
84742 RECEIVE_PACKET_FIELD_ERROR(owner);
84743 }
84744 }
84745 if (BV_ISSET(fields, 2)) {
84746 log_packet_detailed(" got field 'original'");
84747#ifdef FREECIV_JSON_CONNECTION
84748 field_addr.name = "original";
84749#endif /* FREECIV_JSON_CONNECTION */
84750 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->original)) {
84751 RECEIVE_PACKET_FIELD_ERROR(original);
84752 }
84753 }
84754 if (BV_ISSET(fields, 3)) {
84755 log_packet_detailed(" got field 'size'");
84756#ifdef FREECIV_JSON_CONNECTION
84757 field_addr.name = "size";
84758#endif /* FREECIV_JSON_CONNECTION */
84759 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
84760 RECEIVE_PACKET_FIELD_ERROR(size);
84761 }
84762 }
84763 if (BV_ISSET(fields, 4)) {
84764 log_packet_detailed(" got field 'history'");
84765#ifdef FREECIV_JSON_CONNECTION
84766 field_addr.name = "history";
84767#endif /* FREECIV_JSON_CONNECTION */
84768 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
84769 RECEIVE_PACKET_FIELD_ERROR(history);
84770 }
84771 }
84772 if (BV_ISSET(fields, 5)) {
84773 log_packet_detailed(" got field 'ppl_happy'");
84774#ifdef FREECIV_JSON_CONNECTION
84775 field_addr.name = "ppl_happy";
84776#endif /* FREECIV_JSON_CONNECTION */
84777 {
84778 int i;
84779
84780#ifdef FREECIV_JSON_CONNECTION
84781 /* Enter array. */
84782 field_addr.sub_location = plocation_elem_new(0);
84783#endif /* FREECIV_JSON_CONNECTION */
84784
84785 for (i = 0; i < 5; i++) {
84786#ifdef FREECIV_JSON_CONNECTION
84787 field_addr.sub_location->number = i;
84788#endif /* FREECIV_JSON_CONNECTION */
84789 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
84790 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
84791 }
84792 }
84793
84794#ifdef FREECIV_JSON_CONNECTION
84795 /* Exit array. */
84796 FC_FREE(field_addr.sub_location);
84797#endif /* FREECIV_JSON_CONNECTION */
84798 }
84799 }
84800 if (BV_ISSET(fields, 6)) {
84801 log_packet_detailed(" got field 'ppl_content'");
84802#ifdef FREECIV_JSON_CONNECTION
84803 field_addr.name = "ppl_content";
84804#endif /* FREECIV_JSON_CONNECTION */
84805 {
84806 int i;
84807
84808#ifdef FREECIV_JSON_CONNECTION
84809 /* Enter array. */
84810 field_addr.sub_location = plocation_elem_new(0);
84811#endif /* FREECIV_JSON_CONNECTION */
84812
84813 for (i = 0; i < 5; i++) {
84814#ifdef FREECIV_JSON_CONNECTION
84815 field_addr.sub_location->number = i;
84816#endif /* FREECIV_JSON_CONNECTION */
84817 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
84818 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
84819 }
84820 }
84821
84822#ifdef FREECIV_JSON_CONNECTION
84823 /* Exit array. */
84824 FC_FREE(field_addr.sub_location);
84825#endif /* FREECIV_JSON_CONNECTION */
84826 }
84827 }
84828 if (BV_ISSET(fields, 7)) {
84829 log_packet_detailed(" got field 'ppl_unhappy'");
84830#ifdef FREECIV_JSON_CONNECTION
84831 field_addr.name = "ppl_unhappy";
84832#endif /* FREECIV_JSON_CONNECTION */
84833 {
84834 int i;
84835
84836#ifdef FREECIV_JSON_CONNECTION
84837 /* Enter array. */
84838 field_addr.sub_location = plocation_elem_new(0);
84839#endif /* FREECIV_JSON_CONNECTION */
84840
84841 for (i = 0; i < 5; i++) {
84842#ifdef FREECIV_JSON_CONNECTION
84843 field_addr.sub_location->number = i;
84844#endif /* FREECIV_JSON_CONNECTION */
84845 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
84846 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
84847 }
84848 }
84849
84850#ifdef FREECIV_JSON_CONNECTION
84851 /* Exit array. */
84852 FC_FREE(field_addr.sub_location);
84853#endif /* FREECIV_JSON_CONNECTION */
84854 }
84855 }
84856 if (BV_ISSET(fields, 8)) {
84857 log_packet_detailed(" got field 'ppl_angry'");
84858#ifdef FREECIV_JSON_CONNECTION
84859 field_addr.name = "ppl_angry";
84860#endif /* FREECIV_JSON_CONNECTION */
84861 {
84862 int i;
84863
84864#ifdef FREECIV_JSON_CONNECTION
84865 /* Enter array. */
84866 field_addr.sub_location = plocation_elem_new(0);
84867#endif /* FREECIV_JSON_CONNECTION */
84868
84869 for (i = 0; i < 5; i++) {
84870#ifdef FREECIV_JSON_CONNECTION
84871 field_addr.sub_location->number = i;
84872#endif /* FREECIV_JSON_CONNECTION */
84873 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
84874 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
84875 }
84876 }
84877
84878#ifdef FREECIV_JSON_CONNECTION
84879 /* Exit array. */
84880 FC_FREE(field_addr.sub_location);
84881#endif /* FREECIV_JSON_CONNECTION */
84882 }
84883 }
84884 if (BV_ISSET(fields, 9)) {
84885 log_packet_detailed(" got field 'specialists_size'");
84886#ifdef FREECIV_JSON_CONNECTION
84887 field_addr.name = "specialists_size";
84888#endif /* FREECIV_JSON_CONNECTION */
84889 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
84890 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
84891 }
84892 }
84893 if (BV_ISSET(fields, 10)) {
84894 log_packet_detailed(" got field 'specialists'");
84895#ifdef FREECIV_JSON_CONNECTION
84896 field_addr.name = "specialists";
84897#endif /* FREECIV_JSON_CONNECTION */
84898 {
84899 int i;
84900
84901#ifdef FREECIV_JSON_CONNECTION
84902 /* Enter array. */
84903 field_addr.sub_location = plocation_elem_new(0);
84904#endif /* FREECIV_JSON_CONNECTION */
84905
84906 if (real_packet->specialists_size > SP_MAX) {
84907 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
84908 }
84909 for (i = 0; i < real_packet->specialists_size; i++) {
84910#ifdef FREECIV_JSON_CONNECTION
84911 field_addr.sub_location->number = i;
84912#endif /* FREECIV_JSON_CONNECTION */
84913 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
84914 RECEIVE_PACKET_FIELD_ERROR(specialists);
84915 }
84916 }
84917
84918#ifdef FREECIV_JSON_CONNECTION
84919 /* Exit array. */
84920 FC_FREE(field_addr.sub_location);
84921#endif /* FREECIV_JSON_CONNECTION */
84922 }
84923 }
84924 if (BV_ISSET(fields, 11)) {
84925 log_packet_detailed(" got field 'food_stock'");
84926#ifdef FREECIV_JSON_CONNECTION
84927 field_addr.name = "food_stock";
84928#endif /* FREECIV_JSON_CONNECTION */
84929 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
84930 RECEIVE_PACKET_FIELD_ERROR(food_stock);
84931 }
84932 }
84933 if (BV_ISSET(fields, 12)) {
84934 log_packet_detailed(" got field 'shield_stock'");
84935#ifdef FREECIV_JSON_CONNECTION
84936 field_addr.name = "shield_stock";
84937#endif /* FREECIV_JSON_CONNECTION */
84938 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
84939 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
84940 }
84941 }
84942 real_packet->airlift = BV_ISSET(fields, 13);
84943 real_packet->debug = BV_ISSET(fields, 14);
84944 real_packet->did_buy = BV_ISSET(fields, 15);
84945 real_packet->did_sell = BV_ISSET(fields, 16);
84946 real_packet->was_happy = BV_ISSET(fields, 17);
84947 real_packet->had_famine = BV_ISSET(fields, 18);
84948 if (BV_ISSET(fields, 19)) {
84949 log_packet_detailed(" got field 'anarchy'");
84950#ifdef FREECIV_JSON_CONNECTION
84951 field_addr.name = "anarchy";
84952#endif /* FREECIV_JSON_CONNECTION */
84953 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
84954 RECEIVE_PACKET_FIELD_ERROR(anarchy);
84955 }
84956 }
84957 if (BV_ISSET(fields, 20)) {
84958 log_packet_detailed(" got field 'rapture'");
84959#ifdef FREECIV_JSON_CONNECTION
84960 field_addr.name = "rapture";
84961#endif /* FREECIV_JSON_CONNECTION */
84962 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
84963 RECEIVE_PACKET_FIELD_ERROR(rapture);
84964 }
84965 }
84966 if (BV_ISSET(fields, 21)) {
84967 log_packet_detailed(" got field 'steal'");
84968#ifdef FREECIV_JSON_CONNECTION
84969 field_addr.name = "steal";
84970#endif /* FREECIV_JSON_CONNECTION */
84971 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
84972 RECEIVE_PACKET_FIELD_ERROR(steal);
84973 }
84974 }
84975 if (BV_ISSET(fields, 22)) {
84976 log_packet_detailed(" got field 'turn_founded'");
84977#ifdef FREECIV_JSON_CONNECTION
84978 field_addr.name = "turn_founded";
84979#endif /* FREECIV_JSON_CONNECTION */
84980 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
84981 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
84982 }
84983 }
84984 if (BV_ISSET(fields, 23)) {
84985 log_packet_detailed(" got field 'turn_last_built'");
84986#ifdef FREECIV_JSON_CONNECTION
84987 field_addr.name = "turn_last_built";
84988#endif /* FREECIV_JSON_CONNECTION */
84989 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
84990 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
84991 }
84992 }
84993 if (BV_ISSET(fields, 24)) {
84994 log_packet_detailed(" got field 'built'");
84995#ifdef FREECIV_JSON_CONNECTION
84996 field_addr.name = "built";
84997#endif /* FREECIV_JSON_CONNECTION */
84998 {
84999#ifdef FREECIV_JSON_CONNECTION
85000 int count_i;
85001
85002 /* Enter array. */
85003 field_addr.sub_location = plocation_elem_new(0);
85004
85005 for (count_i = 0;; count_i++) {
85006 int i;
85007
85008 field_addr.sub_location->number = count_i;
85009
85010 /* Enter diff array element (start at the index address). */
85011 field_addr.sub_location->sub_location = plocation_elem_new(0);
85012#else /* FREECIV_JSON_CONNECTION */
85013 while (TRUE) {
85014 int i;
85015#endif /* FREECIV_JSON_CONNECTION */
85016
85017 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
85018 RECEIVE_PACKET_FIELD_ERROR(built);
85019 }
85020 if (i == MAX_UINT16) {
85021#ifdef FREECIV_JSON_CONNECTION
85022 /* Exit diff array element. */
85023 FC_FREE(field_addr.sub_location->sub_location);
85024
85025 /* Exit diff array. */
85026 FC_FREE(field_addr.sub_location);
85027#endif /* FREECIV_JSON_CONNECTION */
85028
85029 break;
85030 }
85031 if (i > B_LAST) {
85032 RECEIVE_PACKET_FIELD_ERROR(built,
85033 ": unexpected value %d "
85034 "(> B_LAST) in array diff",
85035 i);
85036 } else {
85037#ifdef FREECIV_JSON_CONNECTION
85038 /* Content address. */
85039 field_addr.sub_location->sub_location->number = 1;
85040#endif /* FREECIV_JSON_CONNECTION */
85041 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
85042 RECEIVE_PACKET_FIELD_ERROR(built);
85043 }
85044 }
85045
85046#ifdef FREECIV_JSON_CONNECTION
85047 /* Exit diff array element. */
85048 FC_FREE(field_addr.sub_location->sub_location);
85049#endif /* FREECIV_JSON_CONNECTION */
85050 }
85051
85052#ifdef FREECIV_JSON_CONNECTION
85053 /* Exit array. */
85054 FC_FREE(field_addr.sub_location);
85055#endif /* FREECIV_JSON_CONNECTION */
85056 }
85057 }
85058 if (BV_ISSET(fields, 25)) {
85059 log_packet_detailed(" got field 'production_kind'");
85060#ifdef FREECIV_JSON_CONNECTION
85061 field_addr.name = "production_kind";
85062#endif /* FREECIV_JSON_CONNECTION */
85063 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
85064 RECEIVE_PACKET_FIELD_ERROR(production_kind);
85065 }
85066 }
85067 if (BV_ISSET(fields, 26)) {
85068 log_packet_detailed(" got field 'production_value'");
85069#ifdef FREECIV_JSON_CONNECTION
85070 field_addr.name = "production_value";
85071#endif /* FREECIV_JSON_CONNECTION */
85072 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
85073 RECEIVE_PACKET_FIELD_ERROR(production_value);
85074 }
85075 }
85076 if (BV_ISSET(fields, 27)) {
85077 log_packet_detailed(" got field 'city_options'");
85078#ifdef FREECIV_JSON_CONNECTION
85079 field_addr.name = "city_options";
85080#endif /* FREECIV_JSON_CONNECTION */
85081 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
85082 RECEIVE_PACKET_FIELD_ERROR(city_options);
85083 }
85084 }
85085
85086 if (nullptr == old) {
85087 old = fc_malloc(sizeof(*old));
85088 init_packet_edit_city(old);
85089 *old = *real_packet;
85090 genhash_insert(*hash, old, old);
85091 } else {
85092 *old = *real_packet;
85093 }
85094
85095#endif /* FREECIV_DELTA_PROTOCOL */
85096 RECEIVE_PACKET_END(real_packet);
85097#undef FREE_PACKET_STRUCT
85098}
85099
85100 static int send_packet_edit_city_100(struct connection *pc, const struct packet_edit_city *packet)
85101{
85102 const struct packet_edit_city *real_packet = packet;
85103 int e;
85104#ifdef FREECIV_DELTA_PROTOCOL
85105 packet_edit_city_100_fields fields;
85106 struct packet_edit_city *old;
85107 bool differ;
85108 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY;
85109#endif /* FREECIV_DELTA_PROTOCOL */
85110 SEND_PACKET_START(PACKET_EDIT_CITY);
85111#ifdef FREECIV_JSON_CONNECTION
85112 struct plocation field_addr;
85113 {
85114 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
85115 field_addr = *field_addr_tmp;
85116 FC_FREE(field_addr_tmp);
85117 }
85118#endif /* FREECIV_JSON_CONNECTION */
85119
85120 log_packet_detailed("packet_edit_city_100: sending info about (%d)",
85121 real_packet->id);
85122
85123#ifdef FREECIV_DELTA_PROTOCOL
85124 if (nullptr == *hash) {
85125 *hash = genhash_new_full(hash_packet_edit_city_100, cmp_packet_edit_city_100,
85126 nullptr, nullptr, nullptr, destroy_packet_edit_city);
85127 }
85128 BV_CLR_ALL(fields);
85129
85130 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
85131 old = fc_malloc(sizeof(*old));
85132 /* temporary bitcopy just to insert correctly */
85133 *old = *real_packet;
85134 genhash_insert(*hash, old, old);
85135 init_packet_edit_city(old);
85136 }
85137 differ = (strcmp(old->name, real_packet->name) != 0);
85138 if (differ) {
85139 BV_SET(fields, 0);
85140 }
85141
85142 differ = (old->owner != real_packet->owner);
85143 if (differ) {
85144 BV_SET(fields, 1);
85145 }
85146
85147 differ = (old->original != real_packet->original);
85148 if (differ) {
85149 BV_SET(fields, 2);
85150 }
85151
85152 differ = (old->size != real_packet->size);
85153 if (differ) {
85154 BV_SET(fields, 3);
85155 }
85156
85157 differ = (old->history != real_packet->history);
85158 if (differ) {
85159 BV_SET(fields, 4);
85160 }
85161
85162 differ = FALSE;
85163 {
85164 int i;
85165
85166 for (i = 0; i < 5; i++) {
85167 differ = (old->ppl_happy[i] != real_packet->ppl_happy[i]);
85168 if (differ) {
85169 break;
85170 }
85171 }
85172 }
85173 if (differ) {
85174 BV_SET(fields, 5);
85175 }
85176
85177 differ = FALSE;
85178 {
85179 int i;
85180
85181 for (i = 0; i < 5; i++) {
85182 differ = (old->ppl_content[i] != real_packet->ppl_content[i]);
85183 if (differ) {
85184 break;
85185 }
85186 }
85187 }
85188 if (differ) {
85189 BV_SET(fields, 6);
85190 }
85191
85192 differ = FALSE;
85193 {
85194 int i;
85195
85196 for (i = 0; i < 5; i++) {
85197 differ = (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]);
85198 if (differ) {
85199 break;
85200 }
85201 }
85202 }
85203 if (differ) {
85204 BV_SET(fields, 7);
85205 }
85206
85207 differ = FALSE;
85208 {
85209 int i;
85210
85211 for (i = 0; i < 5; i++) {
85212 differ = (old->ppl_angry[i] != real_packet->ppl_angry[i]);
85213 if (differ) {
85214 break;
85215 }
85216 }
85217 }
85218 if (differ) {
85219 BV_SET(fields, 8);
85220 }
85221
85222 differ = (old->specialists_size != real_packet->specialists_size);
85223 if (differ) {
85224 BV_SET(fields, 9);
85225 }
85226
85227 differ = (old->specialists_size != real_packet->specialists_size);
85228 if (!differ) {
85229 int i;
85230
85231 for (i = 0; i < real_packet->specialists_size; i++) {
85232 differ = (old->specialists[i] != real_packet->specialists[i]);
85233 if (differ) {
85234 break;
85235 }
85236 }
85237 }
85238 if (differ) {
85239 BV_SET(fields, 10);
85240 }
85241
85242 differ = (old->food_stock != real_packet->food_stock);
85243 if (differ) {
85244 BV_SET(fields, 11);
85245 }
85246
85247 differ = (old->shield_stock != real_packet->shield_stock);
85248 if (differ) {
85249 BV_SET(fields, 12);
85250 }
85251
85252 if (packet->airlift) {
85253 BV_SET(fields, 13);
85254 }
85255
85256 if (packet->debug) {
85257 BV_SET(fields, 14);
85258 }
85259
85260 if (packet->did_buy) {
85261 BV_SET(fields, 15);
85262 }
85263
85264 if (packet->did_sell) {
85265 BV_SET(fields, 16);
85266 }
85267
85268 if (packet->was_happy) {
85269 BV_SET(fields, 17);
85270 }
85271
85272 if (packet->had_famine) {
85273 BV_SET(fields, 18);
85274 }
85275
85276 differ = (old->anarchy != real_packet->anarchy);
85277 if (differ) {
85278 BV_SET(fields, 19);
85279 }
85280
85281 differ = (old->rapture != real_packet->rapture);
85282 if (differ) {
85283 BV_SET(fields, 20);
85284 }
85285
85286 differ = (old->steal != real_packet->steal);
85287 if (differ) {
85288 BV_SET(fields, 21);
85289 }
85290
85291 differ = (old->turn_founded != real_packet->turn_founded);
85292 if (differ) {
85293 BV_SET(fields, 22);
85294 }
85295
85296 differ = (old->turn_last_built != real_packet->turn_last_built);
85297 if (differ) {
85298 BV_SET(fields, 23);
85299 }
85300
85301 differ = FALSE;
85302 {
85303 int i;
85304
85305 for (i = 0; i < B_LAST; i++) {
85306 differ = (old->built[i] != real_packet->built[i]);
85307 if (differ) {
85308 break;
85309 }
85310 }
85311 }
85312 if (differ) {
85313 BV_SET(fields, 24);
85314 }
85315
85316 differ = (old->production_kind != real_packet->production_kind);
85317 if (differ) {
85318 BV_SET(fields, 25);
85319 }
85320
85321 differ = (old->production_value != real_packet->production_value);
85322 if (differ) {
85323 BV_SET(fields, 26);
85324 }
85325
85326 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
85327 if (differ) {
85328 BV_SET(fields, 27);
85329 }
85330
85331
85332#ifdef FREECIV_JSON_CONNECTION
85333 field_addr.name = "fields";
85334#endif /* FREECIV_JSON_CONNECTION */
85335 e = 0;
85336 e |= DIO_BV_PUT(&dout, &field_addr, fields);
85337 if (e) {
85338 log_packet_detailed("fields bitvector error detected");
85339 }
85340#ifdef FREECIV_JSON_CONNECTION
85341 field_addr.name = "id";
85342#endif /* FREECIV_JSON_CONNECTION */
85343 e = 0;
85344 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
85345 if (e) {
85346 log_packet_detailed("'id' field error detected");
85347 }
85348
85349 if (BV_ISSET(fields, 0)) {
85350 log_packet_detailed(" field 'name' has changed");
85351#ifdef FREECIV_JSON_CONNECTION
85352 field_addr.name = "name";
85353#endif /* FREECIV_JSON_CONNECTION */
85354 e = 0;
85355 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
85356 if (e) {
85357 log_packet_detailed("'name' field error detected");
85358 }
85359 }
85360 if (BV_ISSET(fields, 1)) {
85361 log_packet_detailed(" field 'owner' has changed");
85362#ifdef FREECIV_JSON_CONNECTION
85363 field_addr.name = "owner";
85364#endif /* FREECIV_JSON_CONNECTION */
85365 e = 0;
85366 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
85367 if (e) {
85368 log_packet_detailed("'owner' field error detected");
85369 }
85370 }
85371 if (BV_ISSET(fields, 2)) {
85372 log_packet_detailed(" field 'original' has changed");
85373#ifdef FREECIV_JSON_CONNECTION
85374 field_addr.name = "original";
85375#endif /* FREECIV_JSON_CONNECTION */
85376 e = 0;
85377 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->original);
85378 if (e) {
85379 log_packet_detailed("'original' field error detected");
85380 }
85381 }
85382 if (BV_ISSET(fields, 3)) {
85383 log_packet_detailed(" field 'size' has changed");
85384#ifdef FREECIV_JSON_CONNECTION
85385 field_addr.name = "size";
85386#endif /* FREECIV_JSON_CONNECTION */
85387 e = 0;
85388 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
85389 if (e) {
85390 log_packet_detailed("'size' field error detected");
85391 }
85392 }
85393 if (BV_ISSET(fields, 4)) {
85394 log_packet_detailed(" field 'history' has changed");
85395#ifdef FREECIV_JSON_CONNECTION
85396 field_addr.name = "history";
85397#endif /* FREECIV_JSON_CONNECTION */
85398 e = 0;
85399 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
85400 if (e) {
85401 log_packet_detailed("'history' field error detected");
85402 }
85403 }
85404 if (BV_ISSET(fields, 5)) {
85405 log_packet_detailed(" field 'ppl_happy' has changed");
85406#ifdef FREECIV_JSON_CONNECTION
85407 field_addr.name = "ppl_happy";
85408#endif /* FREECIV_JSON_CONNECTION */
85409 e = 0;
85410 {
85411 int i;
85412
85413#ifdef FREECIV_JSON_CONNECTION
85414 /* Create the array. */
85415 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85416
85417 /* Enter the array. */
85418 field_addr.sub_location = plocation_elem_new(0);
85419#endif /* FREECIV_JSON_CONNECTION */
85420
85421 for (i = 0; i < 5; i++) {
85422#ifdef FREECIV_JSON_CONNECTION
85423 /* Next array element. */
85424 field_addr.sub_location->number = i;
85425#endif /* FREECIV_JSON_CONNECTION */
85426 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
85427 }
85428
85429#ifdef FREECIV_JSON_CONNECTION
85430 /* Exit array. */
85431 FC_FREE(field_addr.sub_location);
85432#endif /* FREECIV_JSON_CONNECTION */
85433 }
85434 if (e) {
85435 log_packet_detailed("'ppl_happy' field error detected");
85436 }
85437 }
85438 if (BV_ISSET(fields, 6)) {
85439 log_packet_detailed(" field 'ppl_content' has changed");
85440#ifdef FREECIV_JSON_CONNECTION
85441 field_addr.name = "ppl_content";
85442#endif /* FREECIV_JSON_CONNECTION */
85443 e = 0;
85444 {
85445 int i;
85446
85447#ifdef FREECIV_JSON_CONNECTION
85448 /* Create the array. */
85449 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85450
85451 /* Enter the array. */
85452 field_addr.sub_location = plocation_elem_new(0);
85453#endif /* FREECIV_JSON_CONNECTION */
85454
85455 for (i = 0; i < 5; i++) {
85456#ifdef FREECIV_JSON_CONNECTION
85457 /* Next array element. */
85458 field_addr.sub_location->number = i;
85459#endif /* FREECIV_JSON_CONNECTION */
85460 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
85461 }
85462
85463#ifdef FREECIV_JSON_CONNECTION
85464 /* Exit array. */
85465 FC_FREE(field_addr.sub_location);
85466#endif /* FREECIV_JSON_CONNECTION */
85467 }
85468 if (e) {
85469 log_packet_detailed("'ppl_content' field error detected");
85470 }
85471 }
85472 if (BV_ISSET(fields, 7)) {
85473 log_packet_detailed(" field 'ppl_unhappy' has changed");
85474#ifdef FREECIV_JSON_CONNECTION
85475 field_addr.name = "ppl_unhappy";
85476#endif /* FREECIV_JSON_CONNECTION */
85477 e = 0;
85478 {
85479 int i;
85480
85481#ifdef FREECIV_JSON_CONNECTION
85482 /* Create the array. */
85483 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85484
85485 /* Enter the array. */
85486 field_addr.sub_location = plocation_elem_new(0);
85487#endif /* FREECIV_JSON_CONNECTION */
85488
85489 for (i = 0; i < 5; i++) {
85490#ifdef FREECIV_JSON_CONNECTION
85491 /* Next array element. */
85492 field_addr.sub_location->number = i;
85493#endif /* FREECIV_JSON_CONNECTION */
85494 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
85495 }
85496
85497#ifdef FREECIV_JSON_CONNECTION
85498 /* Exit array. */
85499 FC_FREE(field_addr.sub_location);
85500#endif /* FREECIV_JSON_CONNECTION */
85501 }
85502 if (e) {
85503 log_packet_detailed("'ppl_unhappy' field error detected");
85504 }
85505 }
85506 if (BV_ISSET(fields, 8)) {
85507 log_packet_detailed(" field 'ppl_angry' has changed");
85508#ifdef FREECIV_JSON_CONNECTION
85509 field_addr.name = "ppl_angry";
85510#endif /* FREECIV_JSON_CONNECTION */
85511 e = 0;
85512 {
85513 int i;
85514
85515#ifdef FREECIV_JSON_CONNECTION
85516 /* Create the array. */
85517 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85518
85519 /* Enter the array. */
85520 field_addr.sub_location = plocation_elem_new(0);
85521#endif /* FREECIV_JSON_CONNECTION */
85522
85523 for (i = 0; i < 5; i++) {
85524#ifdef FREECIV_JSON_CONNECTION
85525 /* Next array element. */
85526 field_addr.sub_location->number = i;
85527#endif /* FREECIV_JSON_CONNECTION */
85528 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
85529 }
85530
85531#ifdef FREECIV_JSON_CONNECTION
85532 /* Exit array. */
85533 FC_FREE(field_addr.sub_location);
85534#endif /* FREECIV_JSON_CONNECTION */
85535 }
85536 if (e) {
85537 log_packet_detailed("'ppl_angry' field error detected");
85538 }
85539 }
85540 if (BV_ISSET(fields, 9)) {
85541 log_packet_detailed(" field 'specialists_size' has changed");
85542#ifdef FREECIV_JSON_CONNECTION
85543 field_addr.name = "specialists_size";
85544#endif /* FREECIV_JSON_CONNECTION */
85545 e = 0;
85546 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
85547 if (e) {
85548 log_packet_detailed("'specialists_size' field error detected");
85549 }
85550 }
85551 if (BV_ISSET(fields, 10)) {
85552 log_packet_detailed(" field 'specialists' has changed");
85553#ifdef FREECIV_JSON_CONNECTION
85554 field_addr.name = "specialists";
85555#endif /* FREECIV_JSON_CONNECTION */
85556 e = 0;
85557 {
85558 int i;
85559
85560#ifdef FREECIV_JSON_CONNECTION
85561 /* Create the array. */
85562 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
85563
85564 /* Enter the array. */
85565 field_addr.sub_location = plocation_elem_new(0);
85566#endif /* FREECIV_JSON_CONNECTION */
85567
85568 for (i = 0; i < real_packet->specialists_size; i++) {
85569#ifdef FREECIV_JSON_CONNECTION
85570 /* Next array element. */
85571 field_addr.sub_location->number = i;
85572#endif /* FREECIV_JSON_CONNECTION */
85573 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
85574 }
85575
85576#ifdef FREECIV_JSON_CONNECTION
85577 /* Exit array. */
85578 FC_FREE(field_addr.sub_location);
85579#endif /* FREECIV_JSON_CONNECTION */
85580 }
85581 if (e) {
85582 log_packet_detailed("'specialists' field error detected");
85583 }
85584 }
85585 if (BV_ISSET(fields, 11)) {
85586 log_packet_detailed(" field 'food_stock' has changed");
85587#ifdef FREECIV_JSON_CONNECTION
85588 field_addr.name = "food_stock";
85589#endif /* FREECIV_JSON_CONNECTION */
85590 e = 0;
85591 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
85592 if (e) {
85593 log_packet_detailed("'food_stock' field error detected");
85594 }
85595 }
85596 if (BV_ISSET(fields, 12)) {
85597 log_packet_detailed(" field 'shield_stock' has changed");
85598#ifdef FREECIV_JSON_CONNECTION
85599 field_addr.name = "shield_stock";
85600#endif /* FREECIV_JSON_CONNECTION */
85601 e = 0;
85602 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
85603 if (e) {
85604 log_packet_detailed("'shield_stock' field error detected");
85605 }
85606 }
85607 /* field 13 is folded into the header */
85608 /* field 14 is folded into the header */
85609 /* field 15 is folded into the header */
85610 /* field 16 is folded into the header */
85611 /* field 17 is folded into the header */
85612 /* field 18 is folded into the header */
85613 if (BV_ISSET(fields, 19)) {
85614 log_packet_detailed(" field 'anarchy' has changed");
85615#ifdef FREECIV_JSON_CONNECTION
85616 field_addr.name = "anarchy";
85617#endif /* FREECIV_JSON_CONNECTION */
85618 e = 0;
85619 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
85620 if (e) {
85621 log_packet_detailed("'anarchy' field error detected");
85622 }
85623 }
85624 if (BV_ISSET(fields, 20)) {
85625 log_packet_detailed(" field 'rapture' has changed");
85626#ifdef FREECIV_JSON_CONNECTION
85627 field_addr.name = "rapture";
85628#endif /* FREECIV_JSON_CONNECTION */
85629 e = 0;
85630 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
85631 if (e) {
85632 log_packet_detailed("'rapture' field error detected");
85633 }
85634 }
85635 if (BV_ISSET(fields, 21)) {
85636 log_packet_detailed(" field 'steal' has changed");
85637#ifdef FREECIV_JSON_CONNECTION
85638 field_addr.name = "steal";
85639#endif /* FREECIV_JSON_CONNECTION */
85640 e = 0;
85641 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
85642 if (e) {
85643 log_packet_detailed("'steal' field error detected");
85644 }
85645 }
85646 if (BV_ISSET(fields, 22)) {
85647 log_packet_detailed(" field 'turn_founded' has changed");
85648#ifdef FREECIV_JSON_CONNECTION
85649 field_addr.name = "turn_founded";
85650#endif /* FREECIV_JSON_CONNECTION */
85651 e = 0;
85652 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
85653 if (e) {
85654 log_packet_detailed("'turn_founded' field error detected");
85655 }
85656 }
85657 if (BV_ISSET(fields, 23)) {
85658 log_packet_detailed(" field 'turn_last_built' has changed");
85659#ifdef FREECIV_JSON_CONNECTION
85660 field_addr.name = "turn_last_built";
85661#endif /* FREECIV_JSON_CONNECTION */
85662 e = 0;
85663 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
85664 if (e) {
85665 log_packet_detailed("'turn_last_built' field error detected");
85666 }
85667 }
85668 if (BV_ISSET(fields, 24)) {
85669 log_packet_detailed(" field 'built' has changed");
85670#ifdef FREECIV_JSON_CONNECTION
85671 field_addr.name = "built";
85672#endif /* FREECIV_JSON_CONNECTION */
85673 e = 0;
85674 {
85675 int i;
85676
85677#ifdef FREECIV_JSON_CONNECTION
85678 size_t count_i = 0;
85679
85680 /* Create the array. */
85681 e |= DIO_PUT(farray, &dout, &field_addr, 0);
85682
85683 /* Enter array. */
85684 field_addr.sub_location = plocation_elem_new(0);
85685#endif /* FREECIV_JSON_CONNECTION */
85686
85687 fc_assert(B_LAST < MAX_UINT16);
85688
85689 for (i = 0; i < B_LAST; i++) {
85690 differ = (old->built[i] != real_packet->built[i]);
85691
85692 if (differ) {
85693#ifdef FREECIV_JSON_CONNECTION
85694 /* Append next diff array element. */
85695 field_addr.sub_location->number = -1;
85696
85697 /* Create the diff array element. */
85698 e |= DIO_PUT(farray, &dout, &field_addr, 2);
85699
85700 /* Enter diff array element (start at the index address). */
85701 field_addr.sub_location->number = count_i++;
85702 field_addr.sub_location->sub_location = plocation_elem_new(0);
85703#endif /* FREECIV_JSON_CONNECTION */
85704 e |= DIO_PUT(uint16, &dout, &field_addr, i);
85705
85706#ifdef FREECIV_JSON_CONNECTION
85707 /* Content address. */
85708 field_addr.sub_location->sub_location->number = 1;
85709#endif /* FREECIV_JSON_CONNECTION */
85710 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
85711
85712#ifdef FREECIV_JSON_CONNECTION
85713 /* Exit diff array element. */
85714 FC_FREE(field_addr.sub_location->sub_location);
85715#endif /* FREECIV_JSON_CONNECTION */
85716 }
85717 }
85718#ifdef FREECIV_JSON_CONNECTION
85719 /* Append diff array element. */
85720 field_addr.sub_location->number = -1;
85721
85722 /* Create the terminating diff array element. */
85723 e |= DIO_PUT(farray, &dout, &field_addr, 1);
85724
85725 /* Enter diff array element (start at the index address). */
85726 field_addr.sub_location->number = count_i;
85727 field_addr.sub_location->sub_location = plocation_elem_new(0);
85728#endif /* FREECIV_JSON_CONNECTION */
85729 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
85730
85731#ifdef FREECIV_JSON_CONNECTION
85732 /* Exit diff array element. */
85733 FC_FREE(field_addr.sub_location->sub_location);
85734
85735 /* Exit array. */
85736 FC_FREE(field_addr.sub_location);
85737#endif /* FREECIV_JSON_CONNECTION */
85738 }
85739 if (e) {
85740 log_packet_detailed("'built' field error detected");
85741 }
85742 }
85743 if (BV_ISSET(fields, 25)) {
85744 log_packet_detailed(" field 'production_kind' has changed");
85745#ifdef FREECIV_JSON_CONNECTION
85746 field_addr.name = "production_kind";
85747#endif /* FREECIV_JSON_CONNECTION */
85748 e = 0;
85749 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
85750 if (e) {
85751 log_packet_detailed("'production_kind' field error detected");
85752 }
85753 }
85754 if (BV_ISSET(fields, 26)) {
85755 log_packet_detailed(" field 'production_value' has changed");
85756#ifdef FREECIV_JSON_CONNECTION
85757 field_addr.name = "production_value";
85758#endif /* FREECIV_JSON_CONNECTION */
85759 e = 0;
85760 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
85761 if (e) {
85762 log_packet_detailed("'production_value' field error detected");
85763 }
85764 }
85765 if (BV_ISSET(fields, 27)) {
85766 log_packet_detailed(" field 'city_options' has changed");
85767#ifdef FREECIV_JSON_CONNECTION
85768 field_addr.name = "city_options";
85769#endif /* FREECIV_JSON_CONNECTION */
85770 e = 0;
85771 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
85772 if (e) {
85773 log_packet_detailed("'city_options' field error detected");
85774 }
85775 }
85776
85777 *old = *real_packet;
85778#endif /* FREECIV_DELTA_PROTOCOL */
85779#ifndef FREECIV_DELTA_PROTOCOL
85780#ifdef FREECIV_JSON_CONNECTION
85781 field_addr.name = "id";
85782#endif /* FREECIV_JSON_CONNECTION */
85783 e = 0;
85784 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
85785 if (e) {
85786 log_packet_detailed("'id' field error detected");
85787 }
85788#ifdef FREECIV_JSON_CONNECTION
85789 field_addr.name = "name";
85790#endif /* FREECIV_JSON_CONNECTION */
85791 e = 0;
85792 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
85793 if (e) {
85794 log_packet_detailed("'name' field error detected");
85795 }
85796#ifdef FREECIV_JSON_CONNECTION
85797 field_addr.name = "owner";
85798#endif /* FREECIV_JSON_CONNECTION */
85799 e = 0;
85800 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->owner);
85801 if (e) {
85802 log_packet_detailed("'owner' field error detected");
85803 }
85804#ifdef FREECIV_JSON_CONNECTION
85805 field_addr.name = "original";
85806#endif /* FREECIV_JSON_CONNECTION */
85807 e = 0;
85808 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->original);
85809 if (e) {
85810 log_packet_detailed("'original' field error detected");
85811 }
85812#ifdef FREECIV_JSON_CONNECTION
85813 field_addr.name = "size";
85814#endif /* FREECIV_JSON_CONNECTION */
85815 e = 0;
85816 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
85817 if (e) {
85818 log_packet_detailed("'size' field error detected");
85819 }
85820#ifdef FREECIV_JSON_CONNECTION
85821 field_addr.name = "history";
85822#endif /* FREECIV_JSON_CONNECTION */
85823 e = 0;
85824 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
85825 if (e) {
85826 log_packet_detailed("'history' field error detected");
85827 }
85828#ifdef FREECIV_JSON_CONNECTION
85829 field_addr.name = "ppl_happy";
85830#endif /* FREECIV_JSON_CONNECTION */
85831 e = 0;
85832 {
85833 int i;
85834
85835#ifdef FREECIV_JSON_CONNECTION
85836 /* Create the array. */
85837 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85838
85839 /* Enter the array. */
85840 field_addr.sub_location = plocation_elem_new(0);
85841#endif /* FREECIV_JSON_CONNECTION */
85842
85843 for (i = 0; i < 5; i++) {
85844#ifdef FREECIV_JSON_CONNECTION
85845 /* Next array element. */
85846 field_addr.sub_location->number = i;
85847#endif /* FREECIV_JSON_CONNECTION */
85848 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
85849 }
85850
85851#ifdef FREECIV_JSON_CONNECTION
85852 /* Exit array. */
85853 FC_FREE(field_addr.sub_location);
85854#endif /* FREECIV_JSON_CONNECTION */
85855 }
85856 if (e) {
85857 log_packet_detailed("'ppl_happy' field error detected");
85858 }
85859#ifdef FREECIV_JSON_CONNECTION
85860 field_addr.name = "ppl_content";
85861#endif /* FREECIV_JSON_CONNECTION */
85862 e = 0;
85863 {
85864 int i;
85865
85866#ifdef FREECIV_JSON_CONNECTION
85867 /* Create the array. */
85868 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85869
85870 /* Enter the array. */
85871 field_addr.sub_location = plocation_elem_new(0);
85872#endif /* FREECIV_JSON_CONNECTION */
85873
85874 for (i = 0; i < 5; i++) {
85875#ifdef FREECIV_JSON_CONNECTION
85876 /* Next array element. */
85877 field_addr.sub_location->number = i;
85878#endif /* FREECIV_JSON_CONNECTION */
85879 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
85880 }
85881
85882#ifdef FREECIV_JSON_CONNECTION
85883 /* Exit array. */
85884 FC_FREE(field_addr.sub_location);
85885#endif /* FREECIV_JSON_CONNECTION */
85886 }
85887 if (e) {
85888 log_packet_detailed("'ppl_content' field error detected");
85889 }
85890#ifdef FREECIV_JSON_CONNECTION
85891 field_addr.name = "ppl_unhappy";
85892#endif /* FREECIV_JSON_CONNECTION */
85893 e = 0;
85894 {
85895 int i;
85896
85897#ifdef FREECIV_JSON_CONNECTION
85898 /* Create the array. */
85899 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85900
85901 /* Enter the array. */
85902 field_addr.sub_location = plocation_elem_new(0);
85903#endif /* FREECIV_JSON_CONNECTION */
85904
85905 for (i = 0; i < 5; i++) {
85906#ifdef FREECIV_JSON_CONNECTION
85907 /* Next array element. */
85908 field_addr.sub_location->number = i;
85909#endif /* FREECIV_JSON_CONNECTION */
85910 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
85911 }
85912
85913#ifdef FREECIV_JSON_CONNECTION
85914 /* Exit array. */
85915 FC_FREE(field_addr.sub_location);
85916#endif /* FREECIV_JSON_CONNECTION */
85917 }
85918 if (e) {
85919 log_packet_detailed("'ppl_unhappy' field error detected");
85920 }
85921#ifdef FREECIV_JSON_CONNECTION
85922 field_addr.name = "ppl_angry";
85923#endif /* FREECIV_JSON_CONNECTION */
85924 e = 0;
85925 {
85926 int i;
85927
85928#ifdef FREECIV_JSON_CONNECTION
85929 /* Create the array. */
85930 e |= DIO_PUT(farray, &dout, &field_addr, 5);
85931
85932 /* Enter the array. */
85933 field_addr.sub_location = plocation_elem_new(0);
85934#endif /* FREECIV_JSON_CONNECTION */
85935
85936 for (i = 0; i < 5; i++) {
85937#ifdef FREECIV_JSON_CONNECTION
85938 /* Next array element. */
85939 field_addr.sub_location->number = i;
85940#endif /* FREECIV_JSON_CONNECTION */
85941 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
85942 }
85943
85944#ifdef FREECIV_JSON_CONNECTION
85945 /* Exit array. */
85946 FC_FREE(field_addr.sub_location);
85947#endif /* FREECIV_JSON_CONNECTION */
85948 }
85949 if (e) {
85950 log_packet_detailed("'ppl_angry' field error detected");
85951 }
85952#ifdef FREECIV_JSON_CONNECTION
85953 field_addr.name = "specialists_size";
85954#endif /* FREECIV_JSON_CONNECTION */
85955 e = 0;
85956 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
85957 if (e) {
85958 log_packet_detailed("'specialists_size' field error detected");
85959 }
85960#ifdef FREECIV_JSON_CONNECTION
85961 field_addr.name = "specialists";
85962#endif /* FREECIV_JSON_CONNECTION */
85963 e = 0;
85964 {
85965 int i;
85966
85967#ifdef FREECIV_JSON_CONNECTION
85968 /* Create the array. */
85969 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
85970
85971 /* Enter the array. */
85972 field_addr.sub_location = plocation_elem_new(0);
85973#endif /* FREECIV_JSON_CONNECTION */
85974
85975 for (i = 0; i < real_packet->specialists_size; i++) {
85976#ifdef FREECIV_JSON_CONNECTION
85977 /* Next array element. */
85978 field_addr.sub_location->number = i;
85979#endif /* FREECIV_JSON_CONNECTION */
85980 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
85981 }
85982
85983#ifdef FREECIV_JSON_CONNECTION
85984 /* Exit array. */
85985 FC_FREE(field_addr.sub_location);
85986#endif /* FREECIV_JSON_CONNECTION */
85987 }
85988 if (e) {
85989 log_packet_detailed("'specialists' field error detected");
85990 }
85991#ifdef FREECIV_JSON_CONNECTION
85992 field_addr.name = "food_stock";
85993#endif /* FREECIV_JSON_CONNECTION */
85994 e = 0;
85995 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
85996 if (e) {
85997 log_packet_detailed("'food_stock' field error detected");
85998 }
85999#ifdef FREECIV_JSON_CONNECTION
86000 field_addr.name = "shield_stock";
86001#endif /* FREECIV_JSON_CONNECTION */
86002 e = 0;
86003 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
86004 if (e) {
86005 log_packet_detailed("'shield_stock' field error detected");
86006 }
86007#ifdef FREECIV_JSON_CONNECTION
86008 field_addr.name = "airlift";
86009#endif /* FREECIV_JSON_CONNECTION */
86010 e = 0;
86011 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift);
86012 if (e) {
86013 log_packet_detailed("'airlift' field error detected");
86014 }
86015#ifdef FREECIV_JSON_CONNECTION
86016 field_addr.name = "debug";
86017#endif /* FREECIV_JSON_CONNECTION */
86018 e = 0;
86019 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
86020 if (e) {
86021 log_packet_detailed("'debug' field error detected");
86022 }
86023#ifdef FREECIV_JSON_CONNECTION
86024 field_addr.name = "did_buy";
86025#endif /* FREECIV_JSON_CONNECTION */
86026 e = 0;
86027 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
86028 if (e) {
86029 log_packet_detailed("'did_buy' field error detected");
86030 }
86031#ifdef FREECIV_JSON_CONNECTION
86032 field_addr.name = "did_sell";
86033#endif /* FREECIV_JSON_CONNECTION */
86034 e = 0;
86035 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
86036 if (e) {
86037 log_packet_detailed("'did_sell' field error detected");
86038 }
86039#ifdef FREECIV_JSON_CONNECTION
86040 field_addr.name = "was_happy";
86041#endif /* FREECIV_JSON_CONNECTION */
86042 e = 0;
86043 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
86044 if (e) {
86045 log_packet_detailed("'was_happy' field error detected");
86046 }
86047#ifdef FREECIV_JSON_CONNECTION
86048 field_addr.name = "had_famine";
86049#endif /* FREECIV_JSON_CONNECTION */
86050 e = 0;
86051 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->had_famine);
86052 if (e) {
86053 log_packet_detailed("'had_famine' field error detected");
86054 }
86055#ifdef FREECIV_JSON_CONNECTION
86056 field_addr.name = "anarchy";
86057#endif /* FREECIV_JSON_CONNECTION */
86058 e = 0;
86059 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
86060 if (e) {
86061 log_packet_detailed("'anarchy' field error detected");
86062 }
86063#ifdef FREECIV_JSON_CONNECTION
86064 field_addr.name = "rapture";
86065#endif /* FREECIV_JSON_CONNECTION */
86066 e = 0;
86067 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
86068 if (e) {
86069 log_packet_detailed("'rapture' field error detected");
86070 }
86071#ifdef FREECIV_JSON_CONNECTION
86072 field_addr.name = "steal";
86073#endif /* FREECIV_JSON_CONNECTION */
86074 e = 0;
86075 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
86076 if (e) {
86077 log_packet_detailed("'steal' field error detected");
86078 }
86079#ifdef FREECIV_JSON_CONNECTION
86080 field_addr.name = "turn_founded";
86081#endif /* FREECIV_JSON_CONNECTION */
86082 e = 0;
86083 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
86084 if (e) {
86085 log_packet_detailed("'turn_founded' field error detected");
86086 }
86087#ifdef FREECIV_JSON_CONNECTION
86088 field_addr.name = "turn_last_built";
86089#endif /* FREECIV_JSON_CONNECTION */
86090 e = 0;
86091 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
86092 if (e) {
86093 log_packet_detailed("'turn_last_built' field error detected");
86094 }
86095#ifdef FREECIV_JSON_CONNECTION
86096 field_addr.name = "built";
86097#endif /* FREECIV_JSON_CONNECTION */
86098 e = 0;
86099 {
86100 int i;
86101
86102#ifdef FREECIV_JSON_CONNECTION
86103 /* Create the array. */
86104 e |= DIO_PUT(farray, &dout, &field_addr, B_LAST);
86105
86106 /* Enter the array. */
86107 field_addr.sub_location = plocation_elem_new(0);
86108#endif /* FREECIV_JSON_CONNECTION */
86109
86110 for (i = 0; i < B_LAST; i++) {
86111#ifdef FREECIV_JSON_CONNECTION
86112 /* Next array element. */
86113 field_addr.sub_location->number = i;
86114#endif /* FREECIV_JSON_CONNECTION */
86115 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
86116 }
86117
86118#ifdef FREECIV_JSON_CONNECTION
86119 /* Exit array. */
86120 FC_FREE(field_addr.sub_location);
86121#endif /* FREECIV_JSON_CONNECTION */
86122 }
86123 if (e) {
86124 log_packet_detailed("'built' field error detected");
86125 }
86126#ifdef FREECIV_JSON_CONNECTION
86127 field_addr.name = "production_kind";
86128#endif /* FREECIV_JSON_CONNECTION */
86129 e = 0;
86130 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
86131 if (e) {
86132 log_packet_detailed("'production_kind' field error detected");
86133 }
86134#ifdef FREECIV_JSON_CONNECTION
86135 field_addr.name = "production_value";
86136#endif /* FREECIV_JSON_CONNECTION */
86137 e = 0;
86138 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
86139 if (e) {
86140 log_packet_detailed("'production_value' field error detected");
86141 }
86142#ifdef FREECIV_JSON_CONNECTION
86143 field_addr.name = "city_options";
86144#endif /* FREECIV_JSON_CONNECTION */
86145 e = 0;
86146 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
86147 if (e) {
86148 log_packet_detailed("'city_options' field error detected");
86149 }
86150
86151#endif
86152 SEND_PACKET_END(PACKET_EDIT_CITY);
86153}
86154
86155 int send_packet_edit_city(struct connection *pc, const struct packet_edit_city *packet)
86156{
86157 if (!pc->used) {
86158 log_error("WARNING: trying to send data to the closed connection %s",
86159 conn_description(pc));
86160 return -1;
86161 }
86162 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY].packet != nullptr, -1,
86163 "Handler for PACKET_EDIT_CITY not installed");
86164 return pc->phs.handlers->send[PACKET_EDIT_CITY].packet(pc, packet);
86165}
86166
86167 static inline void init_packet_edit_player_create(struct packet_edit_player_create *packet)
86168{
86169 memset(packet, 0, sizeof(*packet));
86170}
86171
86172#define free_packet_edit_player_create(_packet) (void) 0
86173#define destroy_packet_edit_player_create free
86174
86175#ifdef FREECIV_DELTA_PROTOCOL
86176#define hash_packet_edit_player_create_100 hash_const
86177
86178#define cmp_packet_edit_player_create_100 cmp_const
86179
86180 BV_DEFINE(packet_edit_player_create_100_fields, 1);
86181#endif /* FREECIV_DELTA_PROTOCOL */
86182
86183 static struct packet_edit_player_create *receive_packet_edit_player_create_100(struct connection *pc)
86184{
86185#define FREE_PACKET_STRUCT(_packet) free_packet_edit_player_create(_packet)
86186#ifdef FREECIV_DELTA_PROTOCOL
86187 packet_edit_player_create_100_fields fields;
86188 struct packet_edit_player_create *old;
86189 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_CREATE;
86190#endif /* FREECIV_DELTA_PROTOCOL */
86191 RECEIVE_PACKET_START(packet_edit_player_create, real_packet);
86192#ifdef FREECIV_JSON_CONNECTION
86193 struct plocation field_addr;
86194 {
86195 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
86196 field_addr = *field_addr_tmp;
86197 FC_FREE(field_addr_tmp);
86198 }
86199#endif /* FREECIV_JSON_CONNECTION */
86200
86201#ifdef FREECIV_DELTA_PROTOCOL
86202#ifdef FREECIV_JSON_CONNECTION
86203 field_addr.name = "fields";
86204#endif /* FREECIV_JSON_CONNECTION */
86205 DIO_BV_GET(&din, &field_addr, fields);
86206
86207#else /* FREECIV_DELTA_PROTOCOL */
86208#ifdef FREECIV_JSON_CONNECTION
86209 field_addr.name = "tag";
86210#endif /* FREECIV_JSON_CONNECTION */
86211 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
86212 RECEIVE_PACKET_FIELD_ERROR(tag);
86213 }
86214#endif
86215 log_packet_detailed("packet_edit_player_create_100: got info about ()");
86216
86217#ifdef FREECIV_DELTA_PROTOCOL
86218 if (nullptr == *hash) {
86219 *hash = genhash_new_full(hash_packet_edit_player_create_100, cmp_packet_edit_player_create_100,
86220 nullptr, nullptr, nullptr, destroy_packet_edit_player_create);
86221 }
86222
86223 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
86224 *real_packet = *old;
86225 } else {
86226 /* packet is already initialized empty */
86227 log_packet_detailed(" no old info");
86228 }
86229
86230 if (BV_ISSET(fields, 0)) {
86231 log_packet_detailed(" got field 'tag'");
86232#ifdef FREECIV_JSON_CONNECTION
86233 field_addr.name = "tag";
86234#endif /* FREECIV_JSON_CONNECTION */
86235 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
86236 RECEIVE_PACKET_FIELD_ERROR(tag);
86237 }
86238 }
86239
86240 if (nullptr == old) {
86241 old = fc_malloc(sizeof(*old));
86242 init_packet_edit_player_create(old);
86243 *old = *real_packet;
86244 genhash_insert(*hash, old, old);
86245 } else {
86246 *old = *real_packet;
86247 }
86248
86249#endif /* FREECIV_DELTA_PROTOCOL */
86250 RECEIVE_PACKET_END(real_packet);
86251#undef FREE_PACKET_STRUCT
86252}
86253
86254 static int send_packet_edit_player_create_100(struct connection *pc, const struct packet_edit_player_create *packet)
86255{
86256 const struct packet_edit_player_create *real_packet = packet;
86257 int e;
86258#ifdef FREECIV_DELTA_PROTOCOL
86259 packet_edit_player_create_100_fields fields;
86260 struct packet_edit_player_create *old;
86261 bool differ;
86262 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_CREATE;
86263#endif /* FREECIV_DELTA_PROTOCOL */
86264 SEND_PACKET_START(PACKET_EDIT_PLAYER_CREATE);
86265#ifdef FREECIV_JSON_CONNECTION
86266 struct plocation field_addr;
86267 {
86268 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
86269 field_addr = *field_addr_tmp;
86270 FC_FREE(field_addr_tmp);
86271 }
86272#endif /* FREECIV_JSON_CONNECTION */
86273
86274 log_packet_detailed("packet_edit_player_create_100: sending info about ()");
86275
86276#ifdef FREECIV_DELTA_PROTOCOL
86277 if (nullptr == *hash) {
86278 *hash = genhash_new_full(hash_packet_edit_player_create_100, cmp_packet_edit_player_create_100,
86279 nullptr, nullptr, nullptr, destroy_packet_edit_player_create);
86280 }
86281 BV_CLR_ALL(fields);
86282
86283 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
86284 old = fc_malloc(sizeof(*old));
86285 /* temporary bitcopy just to insert correctly */
86286 *old = *real_packet;
86287 genhash_insert(*hash, old, old);
86288 init_packet_edit_player_create(old);
86289 }
86290 differ = (old->tag != real_packet->tag);
86291 if (differ) {
86292 BV_SET(fields, 0);
86293 }
86294
86295
86296#ifdef FREECIV_JSON_CONNECTION
86297 field_addr.name = "fields";
86298#endif /* FREECIV_JSON_CONNECTION */
86299 e = 0;
86300 e |= DIO_BV_PUT(&dout, &field_addr, fields);
86301 if (e) {
86302 log_packet_detailed("fields bitvector error detected");
86303 }
86304
86305 if (BV_ISSET(fields, 0)) {
86306 log_packet_detailed(" field 'tag' has changed");
86307#ifdef FREECIV_JSON_CONNECTION
86308 field_addr.name = "tag";
86309#endif /* FREECIV_JSON_CONNECTION */
86310 e = 0;
86311 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
86312 if (e) {
86313 log_packet_detailed("'tag' field error detected");
86314 }
86315 }
86316
86317 *old = *real_packet;
86318#endif /* FREECIV_DELTA_PROTOCOL */
86319#ifndef FREECIV_DELTA_PROTOCOL
86320#ifdef FREECIV_JSON_CONNECTION
86321 field_addr.name = "tag";
86322#endif /* FREECIV_JSON_CONNECTION */
86323 e = 0;
86324 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
86325 if (e) {
86326 log_packet_detailed("'tag' field error detected");
86327 }
86328
86329#endif
86330 SEND_PACKET_END(PACKET_EDIT_PLAYER_CREATE);
86331}
86332
86333 int send_packet_edit_player_create(struct connection *pc, const struct packet_edit_player_create *packet)
86334{
86335 if (!pc->used) {
86336 log_error("WARNING: trying to send data to the closed connection %s",
86337 conn_description(pc));
86338 return -1;
86339 }
86340 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_CREATE].packet != nullptr, -1,
86341 "Handler for PACKET_EDIT_PLAYER_CREATE not installed");
86342 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_CREATE].packet(pc, packet);
86343}
86344
86345 int dsend_packet_edit_player_create(struct connection *pc, int tag)
86346{
86347 struct packet_edit_player_create packet, *real_packet = &packet;
86348
86349 real_packet->tag = tag;
86350
86351 return send_packet_edit_player_create(pc, real_packet);
86352}
86353
86354 static inline void init_packet_edit_player_remove(struct packet_edit_player_remove *packet)
86355{
86356 memset(packet, 0, sizeof(*packet));
86357}
86358
86359#define free_packet_edit_player_remove(_packet) (void) 0
86360#define destroy_packet_edit_player_remove free
86361
86362#ifdef FREECIV_DELTA_PROTOCOL
86363#define hash_packet_edit_player_remove_100 hash_const
86364
86365#define cmp_packet_edit_player_remove_100 cmp_const
86366
86367 BV_DEFINE(packet_edit_player_remove_100_fields, 1);
86368#endif /* FREECIV_DELTA_PROTOCOL */
86369
86370 static struct packet_edit_player_remove *receive_packet_edit_player_remove_100(struct connection *pc)
86371{
86372#define FREE_PACKET_STRUCT(_packet) free_packet_edit_player_remove(_packet)
86373#ifdef FREECIV_DELTA_PROTOCOL
86374 packet_edit_player_remove_100_fields fields;
86375 struct packet_edit_player_remove *old;
86376 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_REMOVE;
86377#endif /* FREECIV_DELTA_PROTOCOL */
86378 RECEIVE_PACKET_START(packet_edit_player_remove, real_packet);
86379#ifdef FREECIV_JSON_CONNECTION
86380 struct plocation field_addr;
86381 {
86382 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
86383 field_addr = *field_addr_tmp;
86384 FC_FREE(field_addr_tmp);
86385 }
86386#endif /* FREECIV_JSON_CONNECTION */
86387
86388#ifdef FREECIV_DELTA_PROTOCOL
86389#ifdef FREECIV_JSON_CONNECTION
86390 field_addr.name = "fields";
86391#endif /* FREECIV_JSON_CONNECTION */
86392 DIO_BV_GET(&din, &field_addr, fields);
86393
86394#else /* FREECIV_DELTA_PROTOCOL */
86395#ifdef FREECIV_JSON_CONNECTION
86396 field_addr.name = "id";
86397#endif /* FREECIV_JSON_CONNECTION */
86398 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
86399 RECEIVE_PACKET_FIELD_ERROR(id);
86400 }
86401#endif
86402 log_packet_detailed("packet_edit_player_remove_100: got info about ()");
86403
86404#ifdef FREECIV_DELTA_PROTOCOL
86405 if (nullptr == *hash) {
86406 *hash = genhash_new_full(hash_packet_edit_player_remove_100, cmp_packet_edit_player_remove_100,
86407 nullptr, nullptr, nullptr, destroy_packet_edit_player_remove);
86408 }
86409
86410 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
86411 *real_packet = *old;
86412 } else {
86413 /* packet is already initialized empty */
86414 log_packet_detailed(" no old info");
86415 }
86416
86417 if (BV_ISSET(fields, 0)) {
86418 log_packet_detailed(" got field 'id'");
86419#ifdef FREECIV_JSON_CONNECTION
86420 field_addr.name = "id";
86421#endif /* FREECIV_JSON_CONNECTION */
86422 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
86423 RECEIVE_PACKET_FIELD_ERROR(id);
86424 }
86425 }
86426
86427 if (nullptr == old) {
86428 old = fc_malloc(sizeof(*old));
86429 init_packet_edit_player_remove(old);
86430 *old = *real_packet;
86431 genhash_insert(*hash, old, old);
86432 } else {
86433 *old = *real_packet;
86434 }
86435
86436#endif /* FREECIV_DELTA_PROTOCOL */
86437 RECEIVE_PACKET_END(real_packet);
86438#undef FREE_PACKET_STRUCT
86439}
86440
86441 static int send_packet_edit_player_remove_100(struct connection *pc, const struct packet_edit_player_remove *packet)
86442{
86443 const struct packet_edit_player_remove *real_packet = packet;
86444 int e;
86445#ifdef FREECIV_DELTA_PROTOCOL
86446 packet_edit_player_remove_100_fields fields;
86447 struct packet_edit_player_remove *old;
86448 bool differ;
86449 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_REMOVE;
86450#endif /* FREECIV_DELTA_PROTOCOL */
86451 SEND_PACKET_START(PACKET_EDIT_PLAYER_REMOVE);
86452#ifdef FREECIV_JSON_CONNECTION
86453 struct plocation field_addr;
86454 {
86455 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
86456 field_addr = *field_addr_tmp;
86457 FC_FREE(field_addr_tmp);
86458 }
86459#endif /* FREECIV_JSON_CONNECTION */
86460
86461 log_packet_detailed("packet_edit_player_remove_100: sending info about ()");
86462
86463#ifdef FREECIV_DELTA_PROTOCOL
86464 if (nullptr == *hash) {
86465 *hash = genhash_new_full(hash_packet_edit_player_remove_100, cmp_packet_edit_player_remove_100,
86466 nullptr, nullptr, nullptr, destroy_packet_edit_player_remove);
86467 }
86468 BV_CLR_ALL(fields);
86469
86470 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
86471 old = fc_malloc(sizeof(*old));
86472 /* temporary bitcopy just to insert correctly */
86473 *old = *real_packet;
86474 genhash_insert(*hash, old, old);
86475 init_packet_edit_player_remove(old);
86476 }
86477 differ = (old->id != real_packet->id);
86478 if (differ) {
86479 BV_SET(fields, 0);
86480 }
86481
86482
86483#ifdef FREECIV_JSON_CONNECTION
86484 field_addr.name = "fields";
86485#endif /* FREECIV_JSON_CONNECTION */
86486 e = 0;
86487 e |= DIO_BV_PUT(&dout, &field_addr, fields);
86488 if (e) {
86489 log_packet_detailed("fields bitvector error detected");
86490 }
86491
86492 if (BV_ISSET(fields, 0)) {
86493 log_packet_detailed(" field 'id' has changed");
86494#ifdef FREECIV_JSON_CONNECTION
86495 field_addr.name = "id";
86496#endif /* FREECIV_JSON_CONNECTION */
86497 e = 0;
86498 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
86499 if (e) {
86500 log_packet_detailed("'id' field error detected");
86501 }
86502 }
86503
86504 *old = *real_packet;
86505#endif /* FREECIV_DELTA_PROTOCOL */
86506#ifndef FREECIV_DELTA_PROTOCOL
86507#ifdef FREECIV_JSON_CONNECTION
86508 field_addr.name = "id";
86509#endif /* FREECIV_JSON_CONNECTION */
86510 e = 0;
86511 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
86512 if (e) {
86513 log_packet_detailed("'id' field error detected");
86514 }
86515
86516#endif
86517 SEND_PACKET_END(PACKET_EDIT_PLAYER_REMOVE);
86518}
86519
86520 int send_packet_edit_player_remove(struct connection *pc, const struct packet_edit_player_remove *packet)
86521{
86522 if (!pc->used) {
86523 log_error("WARNING: trying to send data to the closed connection %s",
86524 conn_description(pc));
86525 return -1;
86526 }
86527 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_REMOVE].packet != nullptr, -1,
86528 "Handler for PACKET_EDIT_PLAYER_REMOVE not installed");
86529 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_REMOVE].packet(pc, packet);
86530}
86531
86532 int dsend_packet_edit_player_remove(struct connection *pc, int id)
86533{
86534 struct packet_edit_player_remove packet, *real_packet = &packet;
86535
86536 real_packet->id = id;
86537
86538 return send_packet_edit_player_remove(pc, real_packet);
86539}
86540
86541 static inline void init_packet_edit_player(struct packet_edit_player *packet)
86542{
86543 memset(packet, 0, sizeof(*packet));
86544}
86545
86546#define free_packet_edit_player(_packet) (void) 0
86547#define destroy_packet_edit_player free
86548
86549#ifdef FREECIV_DELTA_PROTOCOL
86550static genhash_val_t hash_packet_edit_player_100(const void *vkey)
86551{
86552 const struct packet_edit_player *key = (const struct packet_edit_player *) vkey;
86553 genhash_val_t result = 0;
86554
86555 result += key->id;
86556
86557 result &= 0xFFFFFFFF;
86558 return result;
86559}
86560
86561static bool cmp_packet_edit_player_100(const void *vkey1, const void *vkey2)
86562{
86563 const struct packet_edit_player *old = (const struct packet_edit_player *) vkey1;
86564 const struct packet_edit_player *real_packet = (const struct packet_edit_player *) vkey2;
86565 bool differ;
86566
86567 differ = (old->id != real_packet->id);
86568
86569 return !differ;
86570}
86571 BV_DEFINE(packet_edit_player_100_fields, 25);
86572#endif /* FREECIV_DELTA_PROTOCOL */
86573
86574 static struct packet_edit_player *receive_packet_edit_player_100(struct connection *pc)
86575{
86576#define FREE_PACKET_STRUCT(_packet) free_packet_edit_player(_packet)
86577#ifdef FREECIV_DELTA_PROTOCOL
86578 packet_edit_player_100_fields fields;
86579 struct packet_edit_player *old;
86580 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER;
86581#endif /* FREECIV_DELTA_PROTOCOL */
86582 RECEIVE_PACKET_START(packet_edit_player, real_packet);
86583#ifdef FREECIV_JSON_CONNECTION
86584 struct plocation field_addr;
86585 {
86586 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
86587 field_addr = *field_addr_tmp;
86588 FC_FREE(field_addr_tmp);
86589 }
86590#endif /* FREECIV_JSON_CONNECTION */
86591
86592#ifdef FREECIV_DELTA_PROTOCOL
86593#ifdef FREECIV_JSON_CONNECTION
86594 field_addr.name = "fields";
86595#endif /* FREECIV_JSON_CONNECTION */
86596 DIO_BV_GET(&din, &field_addr, fields);
86597#ifdef FREECIV_JSON_CONNECTION
86598 field_addr.name = "id";
86599#endif /* FREECIV_JSON_CONNECTION */
86600 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
86601 RECEIVE_PACKET_FIELD_ERROR(id);
86602 }
86603
86604#else /* FREECIV_DELTA_PROTOCOL */
86605#ifdef FREECIV_JSON_CONNECTION
86606 field_addr.name = "id";
86607#endif /* FREECIV_JSON_CONNECTION */
86608 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
86609 RECEIVE_PACKET_FIELD_ERROR(id);
86610 }
86611#ifdef FREECIV_JSON_CONNECTION
86612 field_addr.name = "name";
86613#endif /* FREECIV_JSON_CONNECTION */
86614 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
86615 RECEIVE_PACKET_FIELD_ERROR(name);
86616 }
86617#ifdef FREECIV_JSON_CONNECTION
86618 field_addr.name = "username";
86619#endif /* FREECIV_JSON_CONNECTION */
86620 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
86621 RECEIVE_PACKET_FIELD_ERROR(username);
86622 }
86623#ifdef FREECIV_JSON_CONNECTION
86624 field_addr.name = "ranked_username";
86625#endif /* FREECIV_JSON_CONNECTION */
86626 if (!DIO_GET(string, &din, &field_addr, real_packet->ranked_username, sizeof(real_packet->ranked_username))) {
86627 RECEIVE_PACKET_FIELD_ERROR(ranked_username);
86628 }
86629#ifdef FREECIV_JSON_CONNECTION
86630 field_addr.name = "user_turns";
86631#endif /* FREECIV_JSON_CONNECTION */
86632 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->user_turns)) {
86633 RECEIVE_PACKET_FIELD_ERROR(user_turns);
86634 }
86635#ifdef FREECIV_JSON_CONNECTION
86636 field_addr.name = "is_male";
86637#endif /* FREECIV_JSON_CONNECTION */
86638 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
86639 RECEIVE_PACKET_FIELD_ERROR(is_male);
86640 }
86641#ifdef FREECIV_JSON_CONNECTION
86642 field_addr.name = "government";
86643#endif /* FREECIV_JSON_CONNECTION */
86644 {
86645 int readin;
86646
86647 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
86648 RECEIVE_PACKET_FIELD_ERROR(government);
86649 }
86650 real_packet->government = readin;
86651 }
86652#ifdef FREECIV_JSON_CONNECTION
86653 field_addr.name = "target_government";
86654#endif /* FREECIV_JSON_CONNECTION */
86655 {
86656 int readin;
86657
86658 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
86659 RECEIVE_PACKET_FIELD_ERROR(target_government);
86660 }
86661 real_packet->target_government = readin;
86662 }
86663#ifdef FREECIV_JSON_CONNECTION
86664 field_addr.name = "nation";
86665#endif /* FREECIV_JSON_CONNECTION */
86666 {
86667 int readin;
86668
86669 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
86670 RECEIVE_PACKET_FIELD_ERROR(nation);
86671 }
86672 real_packet->nation = readin;
86673 }
86674#ifdef FREECIV_JSON_CONNECTION
86675 field_addr.name = "team";
86676#endif /* FREECIV_JSON_CONNECTION */
86677 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->team)) {
86678 RECEIVE_PACKET_FIELD_ERROR(team);
86679 }
86680#ifdef FREECIV_JSON_CONNECTION
86681 field_addr.name = "phase_done";
86682#endif /* FREECIV_JSON_CONNECTION */
86683 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->phase_done)) {
86684 RECEIVE_PACKET_FIELD_ERROR(phase_done);
86685 }
86686#ifdef FREECIV_JSON_CONNECTION
86687 field_addr.name = "nturns_idle";
86688#endif /* FREECIV_JSON_CONNECTION */
86689 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
86690 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
86691 }
86692#ifdef FREECIV_JSON_CONNECTION
86693 field_addr.name = "is_alive";
86694#endif /* FREECIV_JSON_CONNECTION */
86695 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_alive)) {
86696 RECEIVE_PACKET_FIELD_ERROR(is_alive);
86697 }
86698#ifdef FREECIV_JSON_CONNECTION
86699 field_addr.name = "revolution_finishes";
86700#endif /* FREECIV_JSON_CONNECTION */
86701 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
86702 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
86703 }
86704#ifdef FREECIV_JSON_CONNECTION
86705 field_addr.name = "autoselect_weight";
86706#endif /* FREECIV_JSON_CONNECTION */
86707 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
86708 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
86709 }
86710#ifdef FREECIV_JSON_CONNECTION
86711 field_addr.name = "embassy";
86712#endif /* FREECIV_JSON_CONNECTION */
86713 if (!DIO_BV_GET(&din, &field_addr, real_packet->embassy)) {
86714 RECEIVE_PACKET_FIELD_ERROR(embassy);
86715 }
86716#ifdef FREECIV_JSON_CONNECTION
86717 field_addr.name = "gold";
86718#endif /* FREECIV_JSON_CONNECTION */
86719 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
86720 RECEIVE_PACKET_FIELD_ERROR(gold);
86721 }
86722#ifdef FREECIV_JSON_CONNECTION
86723 field_addr.name = "tax";
86724#endif /* FREECIV_JSON_CONNECTION */
86725 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
86726 RECEIVE_PACKET_FIELD_ERROR(tax);
86727 }
86728#ifdef FREECIV_JSON_CONNECTION
86729 field_addr.name = "science";
86730#endif /* FREECIV_JSON_CONNECTION */
86731 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
86732 RECEIVE_PACKET_FIELD_ERROR(science);
86733 }
86734#ifdef FREECIV_JSON_CONNECTION
86735 field_addr.name = "luxury";
86736#endif /* FREECIV_JSON_CONNECTION */
86737 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
86738 RECEIVE_PACKET_FIELD_ERROR(luxury);
86739 }
86740#ifdef FREECIV_JSON_CONNECTION
86741 field_addr.name = "future_tech";
86742#endif /* FREECIV_JSON_CONNECTION */
86743 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
86744 RECEIVE_PACKET_FIELD_ERROR(future_tech);
86745 }
86746#ifdef FREECIV_JSON_CONNECTION
86747 field_addr.name = "researching";
86748#endif /* FREECIV_JSON_CONNECTION */
86749 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
86750 RECEIVE_PACKET_FIELD_ERROR(researching);
86751 }
86752#ifdef FREECIV_JSON_CONNECTION
86753 field_addr.name = "bulbs_researched";
86754#endif /* FREECIV_JSON_CONNECTION */
86755 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
86756 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
86757 }
86758#ifdef FREECIV_JSON_CONNECTION
86759 field_addr.name = "inventions";
86760#endif /* FREECIV_JSON_CONNECTION */
86761 {
86762 int i;
86763
86764#ifdef FREECIV_JSON_CONNECTION
86765 /* Enter array. */
86766 field_addr.sub_location = plocation_elem_new(0);
86767#endif /* FREECIV_JSON_CONNECTION */
86768
86769 for (i = 0; i < A_LAST + 1; i++) {
86770#ifdef FREECIV_JSON_CONNECTION
86771 field_addr.sub_location->number = i;
86772#endif /* FREECIV_JSON_CONNECTION */
86773 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->inventions[i])) {
86774 RECEIVE_PACKET_FIELD_ERROR(inventions);
86775 }
86776 }
86777
86778#ifdef FREECIV_JSON_CONNECTION
86779 /* Exit array. */
86780 FC_FREE(field_addr.sub_location);
86781#endif /* FREECIV_JSON_CONNECTION */
86782 }
86783#ifdef FREECIV_JSON_CONNECTION
86784 field_addr.name = "ai";
86785#endif /* FREECIV_JSON_CONNECTION */
86786 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ai)) {
86787 RECEIVE_PACKET_FIELD_ERROR(ai);
86788 }
86789#ifdef FREECIV_JSON_CONNECTION
86790 field_addr.name = "scenario_reserved";
86791#endif /* FREECIV_JSON_CONNECTION */
86792 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_reserved)) {
86793 RECEIVE_PACKET_FIELD_ERROR(scenario_reserved);
86794 }
86795#endif
86796 log_packet_detailed("packet_edit_player_100: got info about (%d)",
86797 real_packet->id);
86798
86799#ifdef FREECIV_DELTA_PROTOCOL
86800 if (nullptr == *hash) {
86801 *hash = genhash_new_full(hash_packet_edit_player_100, cmp_packet_edit_player_100,
86802 nullptr, nullptr, nullptr, destroy_packet_edit_player);
86803 }
86804
86805 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
86806 *real_packet = *old;
86807 } else {
86808 /* packet is already initialized empty */
86809 log_packet_detailed(" no old info");
86810 }
86811
86812 if (BV_ISSET(fields, 0)) {
86813 log_packet_detailed(" got field 'name'");
86814#ifdef FREECIV_JSON_CONNECTION
86815 field_addr.name = "name";
86816#endif /* FREECIV_JSON_CONNECTION */
86817 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
86818 RECEIVE_PACKET_FIELD_ERROR(name);
86819 }
86820 }
86821 if (BV_ISSET(fields, 1)) {
86822 log_packet_detailed(" got field 'username'");
86823#ifdef FREECIV_JSON_CONNECTION
86824 field_addr.name = "username";
86825#endif /* FREECIV_JSON_CONNECTION */
86826 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
86827 RECEIVE_PACKET_FIELD_ERROR(username);
86828 }
86829 }
86830 if (BV_ISSET(fields, 2)) {
86831 log_packet_detailed(" got field 'ranked_username'");
86832#ifdef FREECIV_JSON_CONNECTION
86833 field_addr.name = "ranked_username";
86834#endif /* FREECIV_JSON_CONNECTION */
86835 if (!DIO_GET(string, &din, &field_addr, real_packet->ranked_username, sizeof(real_packet->ranked_username))) {
86836 RECEIVE_PACKET_FIELD_ERROR(ranked_username);
86837 }
86838 }
86839 if (BV_ISSET(fields, 3)) {
86840 log_packet_detailed(" got field 'user_turns'");
86841#ifdef FREECIV_JSON_CONNECTION
86842 field_addr.name = "user_turns";
86843#endif /* FREECIV_JSON_CONNECTION */
86844 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->user_turns)) {
86845 RECEIVE_PACKET_FIELD_ERROR(user_turns);
86846 }
86847 }
86848 real_packet->is_male = BV_ISSET(fields, 4);
86849 if (BV_ISSET(fields, 5)) {
86850 log_packet_detailed(" got field 'government'");
86851#ifdef FREECIV_JSON_CONNECTION
86852 field_addr.name = "government";
86853#endif /* FREECIV_JSON_CONNECTION */
86854 {
86855 int readin;
86856
86857 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
86858 RECEIVE_PACKET_FIELD_ERROR(government);
86859 }
86860 real_packet->government = readin;
86861 }
86862 }
86863 if (BV_ISSET(fields, 6)) {
86864 log_packet_detailed(" got field 'target_government'");
86865#ifdef FREECIV_JSON_CONNECTION
86866 field_addr.name = "target_government";
86867#endif /* FREECIV_JSON_CONNECTION */
86868 {
86869 int readin;
86870
86871 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
86872 RECEIVE_PACKET_FIELD_ERROR(target_government);
86873 }
86874 real_packet->target_government = readin;
86875 }
86876 }
86877 if (BV_ISSET(fields, 7)) {
86878 log_packet_detailed(" got field 'nation'");
86879#ifdef FREECIV_JSON_CONNECTION
86880 field_addr.name = "nation";
86881#endif /* FREECIV_JSON_CONNECTION */
86882 {
86883 int readin;
86884
86885 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
86886 RECEIVE_PACKET_FIELD_ERROR(nation);
86887 }
86888 real_packet->nation = readin;
86889 }
86890 }
86891 if (BV_ISSET(fields, 8)) {
86892 log_packet_detailed(" got field 'team'");
86893#ifdef FREECIV_JSON_CONNECTION
86894 field_addr.name = "team";
86895#endif /* FREECIV_JSON_CONNECTION */
86896 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->team)) {
86897 RECEIVE_PACKET_FIELD_ERROR(team);
86898 }
86899 }
86900 real_packet->phase_done = BV_ISSET(fields, 9);
86901 if (BV_ISSET(fields, 10)) {
86902 log_packet_detailed(" got field 'nturns_idle'");
86903#ifdef FREECIV_JSON_CONNECTION
86904 field_addr.name = "nturns_idle";
86905#endif /* FREECIV_JSON_CONNECTION */
86906 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
86907 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
86908 }
86909 }
86910 real_packet->is_alive = BV_ISSET(fields, 11);
86911 if (BV_ISSET(fields, 12)) {
86912 log_packet_detailed(" got field 'revolution_finishes'");
86913#ifdef FREECIV_JSON_CONNECTION
86914 field_addr.name = "revolution_finishes";
86915#endif /* FREECIV_JSON_CONNECTION */
86916 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
86917 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
86918 }
86919 }
86920 if (BV_ISSET(fields, 13)) {
86921 log_packet_detailed(" got field 'autoselect_weight'");
86922#ifdef FREECIV_JSON_CONNECTION
86923 field_addr.name = "autoselect_weight";
86924#endif /* FREECIV_JSON_CONNECTION */
86925 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
86926 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
86927 }
86928 }
86929 if (BV_ISSET(fields, 14)) {
86930 log_packet_detailed(" got field 'embassy'");
86931#ifdef FREECIV_JSON_CONNECTION
86932 field_addr.name = "embassy";
86933#endif /* FREECIV_JSON_CONNECTION */
86934 if (!DIO_BV_GET(&din, &field_addr, real_packet->embassy)) {
86935 RECEIVE_PACKET_FIELD_ERROR(embassy);
86936 }
86937 }
86938 if (BV_ISSET(fields, 15)) {
86939 log_packet_detailed(" got field 'gold'");
86940#ifdef FREECIV_JSON_CONNECTION
86941 field_addr.name = "gold";
86942#endif /* FREECIV_JSON_CONNECTION */
86943 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
86944 RECEIVE_PACKET_FIELD_ERROR(gold);
86945 }
86946 }
86947 if (BV_ISSET(fields, 16)) {
86948 log_packet_detailed(" got field 'tax'");
86949#ifdef FREECIV_JSON_CONNECTION
86950 field_addr.name = "tax";
86951#endif /* FREECIV_JSON_CONNECTION */
86952 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
86953 RECEIVE_PACKET_FIELD_ERROR(tax);
86954 }
86955 }
86956 if (BV_ISSET(fields, 17)) {
86957 log_packet_detailed(" got field 'science'");
86958#ifdef FREECIV_JSON_CONNECTION
86959 field_addr.name = "science";
86960#endif /* FREECIV_JSON_CONNECTION */
86961 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
86962 RECEIVE_PACKET_FIELD_ERROR(science);
86963 }
86964 }
86965 if (BV_ISSET(fields, 18)) {
86966 log_packet_detailed(" got field 'luxury'");
86967#ifdef FREECIV_JSON_CONNECTION
86968 field_addr.name = "luxury";
86969#endif /* FREECIV_JSON_CONNECTION */
86970 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
86971 RECEIVE_PACKET_FIELD_ERROR(luxury);
86972 }
86973 }
86974 if (BV_ISSET(fields, 19)) {
86975 log_packet_detailed(" got field 'future_tech'");
86976#ifdef FREECIV_JSON_CONNECTION
86977 field_addr.name = "future_tech";
86978#endif /* FREECIV_JSON_CONNECTION */
86979 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
86980 RECEIVE_PACKET_FIELD_ERROR(future_tech);
86981 }
86982 }
86983 if (BV_ISSET(fields, 20)) {
86984 log_packet_detailed(" got field 'researching'");
86985#ifdef FREECIV_JSON_CONNECTION
86986 field_addr.name = "researching";
86987#endif /* FREECIV_JSON_CONNECTION */
86988 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
86989 RECEIVE_PACKET_FIELD_ERROR(researching);
86990 }
86991 }
86992 if (BV_ISSET(fields, 21)) {
86993 log_packet_detailed(" got field 'bulbs_researched'");
86994#ifdef FREECIV_JSON_CONNECTION
86995 field_addr.name = "bulbs_researched";
86996#endif /* FREECIV_JSON_CONNECTION */
86997 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
86998 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
86999 }
87000 }
87001 if (BV_ISSET(fields, 22)) {
87002 log_packet_detailed(" got field 'inventions'");
87003#ifdef FREECIV_JSON_CONNECTION
87004 field_addr.name = "inventions";
87005#endif /* FREECIV_JSON_CONNECTION */
87006 {
87007#ifdef FREECIV_JSON_CONNECTION
87008 int count_i;
87009
87010 /* Enter array. */
87011 field_addr.sub_location = plocation_elem_new(0);
87012
87013 for (count_i = 0;; count_i++) {
87014 int i;
87015
87016 field_addr.sub_location->number = count_i;
87017
87018 /* Enter diff array element (start at the index address). */
87019 field_addr.sub_location->sub_location = plocation_elem_new(0);
87020#else /* FREECIV_JSON_CONNECTION */
87021 while (TRUE) {
87022 int i;
87023#endif /* FREECIV_JSON_CONNECTION */
87024
87025 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
87026 RECEIVE_PACKET_FIELD_ERROR(inventions);
87027 }
87028 if (i == MAX_UINT16) {
87029#ifdef FREECIV_JSON_CONNECTION
87030 /* Exit diff array element. */
87031 FC_FREE(field_addr.sub_location->sub_location);
87032
87033 /* Exit diff array. */
87034 FC_FREE(field_addr.sub_location);
87035#endif /* FREECIV_JSON_CONNECTION */
87036
87037 break;
87038 }
87039 if (i > A_LAST + 1) {
87040 RECEIVE_PACKET_FIELD_ERROR(inventions,
87041 ": unexpected value %d "
87042 "(> A_LAST + 1) in array diff",
87043 i);
87044 } else {
87045#ifdef FREECIV_JSON_CONNECTION
87046 /* Content address. */
87047 field_addr.sub_location->sub_location->number = 1;
87048#endif /* FREECIV_JSON_CONNECTION */
87049 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->inventions[i])) {
87050 RECEIVE_PACKET_FIELD_ERROR(inventions);
87051 }
87052 }
87053
87054#ifdef FREECIV_JSON_CONNECTION
87055 /* Exit diff array element. */
87056 FC_FREE(field_addr.sub_location->sub_location);
87057#endif /* FREECIV_JSON_CONNECTION */
87058 }
87059
87060#ifdef FREECIV_JSON_CONNECTION
87061 /* Exit array. */
87062 FC_FREE(field_addr.sub_location);
87063#endif /* FREECIV_JSON_CONNECTION */
87064 }
87065 }
87066 real_packet->ai = BV_ISSET(fields, 23);
87067 real_packet->scenario_reserved = BV_ISSET(fields, 24);
87068
87069 if (nullptr == old) {
87070 old = fc_malloc(sizeof(*old));
87071 init_packet_edit_player(old);
87072 *old = *real_packet;
87073 genhash_insert(*hash, old, old);
87074 } else {
87075 *old = *real_packet;
87076 }
87077
87078#endif /* FREECIV_DELTA_PROTOCOL */
87079 RECEIVE_PACKET_END(real_packet);
87080#undef FREE_PACKET_STRUCT
87081}
87082
87083 static int send_packet_edit_player_100(struct connection *pc, const struct packet_edit_player *packet)
87084{
87085 const struct packet_edit_player *real_packet = packet;
87086 int e;
87087#ifdef FREECIV_DELTA_PROTOCOL
87088 packet_edit_player_100_fields fields;
87089 struct packet_edit_player *old;
87090 bool differ;
87091 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER;
87092#endif /* FREECIV_DELTA_PROTOCOL */
87093 SEND_PACKET_START(PACKET_EDIT_PLAYER);
87094#ifdef FREECIV_JSON_CONNECTION
87095 struct plocation field_addr;
87096 {
87097 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
87098 field_addr = *field_addr_tmp;
87099 FC_FREE(field_addr_tmp);
87100 }
87101#endif /* FREECIV_JSON_CONNECTION */
87102
87103 log_packet_detailed("packet_edit_player_100: sending info about (%d)",
87104 real_packet->id);
87105
87106#ifdef FREECIV_DELTA_PROTOCOL
87107 if (nullptr == *hash) {
87108 *hash = genhash_new_full(hash_packet_edit_player_100, cmp_packet_edit_player_100,
87109 nullptr, nullptr, nullptr, destroy_packet_edit_player);
87110 }
87111 BV_CLR_ALL(fields);
87112
87113 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
87114 old = fc_malloc(sizeof(*old));
87115 /* temporary bitcopy just to insert correctly */
87116 *old = *real_packet;
87117 genhash_insert(*hash, old, old);
87118 init_packet_edit_player(old);
87119 }
87120 differ = (strcmp(old->name, real_packet->name) != 0);
87121 if (differ) {
87122 BV_SET(fields, 0);
87123 }
87124
87125 differ = (strcmp(old->username, real_packet->username) != 0);
87126 if (differ) {
87127 BV_SET(fields, 1);
87128 }
87129
87130 differ = (strcmp(old->ranked_username, real_packet->ranked_username) != 0);
87131 if (differ) {
87132 BV_SET(fields, 2);
87133 }
87134
87135 differ = (old->user_turns != real_packet->user_turns);
87136 if (differ) {
87137 BV_SET(fields, 3);
87138 }
87139
87140 if (packet->is_male) {
87141 BV_SET(fields, 4);
87142 }
87143
87144 differ = (old->government != real_packet->government);
87145 if (differ) {
87146 BV_SET(fields, 5);
87147 }
87148
87149 differ = (old->target_government != real_packet->target_government);
87150 if (differ) {
87151 BV_SET(fields, 6);
87152 }
87153
87154 differ = (old->nation != real_packet->nation);
87155 if (differ) {
87156 BV_SET(fields, 7);
87157 }
87158
87159 differ = (old->team != real_packet->team);
87160 if (differ) {
87161 BV_SET(fields, 8);
87162 }
87163
87164 if (packet->phase_done) {
87165 BV_SET(fields, 9);
87166 }
87167
87168 differ = (old->nturns_idle != real_packet->nturns_idle);
87169 if (differ) {
87170 BV_SET(fields, 10);
87171 }
87172
87173 if (packet->is_alive) {
87174 BV_SET(fields, 11);
87175 }
87176
87177 differ = (old->revolution_finishes != real_packet->revolution_finishes);
87178 if (differ) {
87179 BV_SET(fields, 12);
87180 }
87181
87182 differ = (old->autoselect_weight != real_packet->autoselect_weight);
87183 if (differ) {
87184 BV_SET(fields, 13);
87185 }
87186
87187 differ = !BV_ARE_EQUAL(old->embassy, real_packet->embassy);
87188 if (differ) {
87189 BV_SET(fields, 14);
87190 }
87191
87192 differ = (old->gold != real_packet->gold);
87193 if (differ) {
87194 BV_SET(fields, 15);
87195 }
87196
87197 differ = (old->tax != real_packet->tax);
87198 if (differ) {
87199 BV_SET(fields, 16);
87200 }
87201
87202 differ = (old->science != real_packet->science);
87203 if (differ) {
87204 BV_SET(fields, 17);
87205 }
87206
87207 differ = (old->luxury != real_packet->luxury);
87208 if (differ) {
87209 BV_SET(fields, 18);
87210 }
87211
87212 differ = (old->future_tech != real_packet->future_tech);
87213 if (differ) {
87214 BV_SET(fields, 19);
87215 }
87216
87217 differ = (old->researching != real_packet->researching);
87218 if (differ) {
87219 BV_SET(fields, 20);
87220 }
87221
87222 differ = (old->bulbs_researched != real_packet->bulbs_researched);
87223 if (differ) {
87224 BV_SET(fields, 21);
87225 }
87226
87227 differ = FALSE;
87228 {
87229 int i;
87230
87231 for (i = 0; i < A_LAST + 1; i++) {
87232 differ = (old->inventions[i] != real_packet->inventions[i]);
87233 if (differ) {
87234 break;
87235 }
87236 }
87237 }
87238 if (differ) {
87239 BV_SET(fields, 22);
87240 }
87241
87242 if (packet->ai) {
87243 BV_SET(fields, 23);
87244 }
87245
87246 if (packet->scenario_reserved) {
87247 BV_SET(fields, 24);
87248 }
87249
87250
87251#ifdef FREECIV_JSON_CONNECTION
87252 field_addr.name = "fields";
87253#endif /* FREECIV_JSON_CONNECTION */
87254 e = 0;
87255 e |= DIO_BV_PUT(&dout, &field_addr, fields);
87256 if (e) {
87257 log_packet_detailed("fields bitvector error detected");
87258 }
87259#ifdef FREECIV_JSON_CONNECTION
87260 field_addr.name = "id";
87261#endif /* FREECIV_JSON_CONNECTION */
87262 e = 0;
87263 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
87264 if (e) {
87265 log_packet_detailed("'id' field error detected");
87266 }
87267
87268 if (BV_ISSET(fields, 0)) {
87269 log_packet_detailed(" field 'name' has changed");
87270#ifdef FREECIV_JSON_CONNECTION
87271 field_addr.name = "name";
87272#endif /* FREECIV_JSON_CONNECTION */
87273 e = 0;
87274 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
87275 if (e) {
87276 log_packet_detailed("'name' field error detected");
87277 }
87278 }
87279 if (BV_ISSET(fields, 1)) {
87280 log_packet_detailed(" field 'username' has changed");
87281#ifdef FREECIV_JSON_CONNECTION
87282 field_addr.name = "username";
87283#endif /* FREECIV_JSON_CONNECTION */
87284 e = 0;
87285 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
87286 if (e) {
87287 log_packet_detailed("'username' field error detected");
87288 }
87289 }
87290 if (BV_ISSET(fields, 2)) {
87291 log_packet_detailed(" field 'ranked_username' has changed");
87292#ifdef FREECIV_JSON_CONNECTION
87293 field_addr.name = "ranked_username";
87294#endif /* FREECIV_JSON_CONNECTION */
87295 e = 0;
87296 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ranked_username);
87297 if (e) {
87298 log_packet_detailed("'ranked_username' field error detected");
87299 }
87300 }
87301 if (BV_ISSET(fields, 3)) {
87302 log_packet_detailed(" field 'user_turns' has changed");
87303#ifdef FREECIV_JSON_CONNECTION
87304 field_addr.name = "user_turns";
87305#endif /* FREECIV_JSON_CONNECTION */
87306 e = 0;
87307 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->user_turns);
87308 if (e) {
87309 log_packet_detailed("'user_turns' field error detected");
87310 }
87311 }
87312 /* field 4 is folded into the header */
87313 if (BV_ISSET(fields, 5)) {
87314 log_packet_detailed(" field 'government' has changed");
87315#ifdef FREECIV_JSON_CONNECTION
87316 field_addr.name = "government";
87317#endif /* FREECIV_JSON_CONNECTION */
87318 e = 0;
87319 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
87320 if (e) {
87321 log_packet_detailed("'government' field error detected");
87322 }
87323 }
87324 if (BV_ISSET(fields, 6)) {
87325 log_packet_detailed(" field 'target_government' has changed");
87326#ifdef FREECIV_JSON_CONNECTION
87327 field_addr.name = "target_government";
87328#endif /* FREECIV_JSON_CONNECTION */
87329 e = 0;
87330 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
87331 if (e) {
87332 log_packet_detailed("'target_government' field error detected");
87333 }
87334 }
87335 if (BV_ISSET(fields, 7)) {
87336 log_packet_detailed(" field 'nation' has changed");
87337#ifdef FREECIV_JSON_CONNECTION
87338 field_addr.name = "nation";
87339#endif /* FREECIV_JSON_CONNECTION */
87340 e = 0;
87341 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
87342 if (e) {
87343 log_packet_detailed("'nation' field error detected");
87344 }
87345 }
87346 if (BV_ISSET(fields, 8)) {
87347 log_packet_detailed(" field 'team' has changed");
87348#ifdef FREECIV_JSON_CONNECTION
87349 field_addr.name = "team";
87350#endif /* FREECIV_JSON_CONNECTION */
87351 e = 0;
87352 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->team);
87353 if (e) {
87354 log_packet_detailed("'team' field error detected");
87355 }
87356 }
87357 /* field 9 is folded into the header */
87358 if (BV_ISSET(fields, 10)) {
87359 log_packet_detailed(" field 'nturns_idle' has changed");
87360#ifdef FREECIV_JSON_CONNECTION
87361 field_addr.name = "nturns_idle";
87362#endif /* FREECIV_JSON_CONNECTION */
87363 e = 0;
87364 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
87365 if (e) {
87366 log_packet_detailed("'nturns_idle' field error detected");
87367 }
87368 }
87369 /* field 11 is folded into the header */
87370 if (BV_ISSET(fields, 12)) {
87371 log_packet_detailed(" field 'revolution_finishes' has changed");
87372#ifdef FREECIV_JSON_CONNECTION
87373 field_addr.name = "revolution_finishes";
87374#endif /* FREECIV_JSON_CONNECTION */
87375 e = 0;
87376 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
87377 if (e) {
87378 log_packet_detailed("'revolution_finishes' field error detected");
87379 }
87380 }
87381 if (BV_ISSET(fields, 13)) {
87382 log_packet_detailed(" field 'autoselect_weight' has changed");
87383#ifdef FREECIV_JSON_CONNECTION
87384 field_addr.name = "autoselect_weight";
87385#endif /* FREECIV_JSON_CONNECTION */
87386 e = 0;
87387 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
87388 if (e) {
87389 log_packet_detailed("'autoselect_weight' field error detected");
87390 }
87391 }
87392 if (BV_ISSET(fields, 14)) {
87393 log_packet_detailed(" field 'embassy' has changed");
87394#ifdef FREECIV_JSON_CONNECTION
87395 field_addr.name = "embassy";
87396#endif /* FREECIV_JSON_CONNECTION */
87397 e = 0;
87398 e |= DIO_BV_PUT(&dout, &field_addr, packet->embassy);
87399 if (e) {
87400 log_packet_detailed("'embassy' field error detected");
87401 }
87402 }
87403 if (BV_ISSET(fields, 15)) {
87404 log_packet_detailed(" field 'gold' has changed");
87405#ifdef FREECIV_JSON_CONNECTION
87406 field_addr.name = "gold";
87407#endif /* FREECIV_JSON_CONNECTION */
87408 e = 0;
87409 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
87410 if (e) {
87411 log_packet_detailed("'gold' field error detected");
87412 }
87413 }
87414 if (BV_ISSET(fields, 16)) {
87415 log_packet_detailed(" field 'tax' has changed");
87416#ifdef FREECIV_JSON_CONNECTION
87417 field_addr.name = "tax";
87418#endif /* FREECIV_JSON_CONNECTION */
87419 e = 0;
87420 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
87421 if (e) {
87422 log_packet_detailed("'tax' field error detected");
87423 }
87424 }
87425 if (BV_ISSET(fields, 17)) {
87426 log_packet_detailed(" field 'science' has changed");
87427#ifdef FREECIV_JSON_CONNECTION
87428 field_addr.name = "science";
87429#endif /* FREECIV_JSON_CONNECTION */
87430 e = 0;
87431 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
87432 if (e) {
87433 log_packet_detailed("'science' field error detected");
87434 }
87435 }
87436 if (BV_ISSET(fields, 18)) {
87437 log_packet_detailed(" field 'luxury' has changed");
87438#ifdef FREECIV_JSON_CONNECTION
87439 field_addr.name = "luxury";
87440#endif /* FREECIV_JSON_CONNECTION */
87441 e = 0;
87442 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
87443 if (e) {
87444 log_packet_detailed("'luxury' field error detected");
87445 }
87446 }
87447 if (BV_ISSET(fields, 19)) {
87448 log_packet_detailed(" field 'future_tech' has changed");
87449#ifdef FREECIV_JSON_CONNECTION
87450 field_addr.name = "future_tech";
87451#endif /* FREECIV_JSON_CONNECTION */
87452 e = 0;
87453 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
87454 if (e) {
87455 log_packet_detailed("'future_tech' field error detected");
87456 }
87457 }
87458 if (BV_ISSET(fields, 20)) {
87459 log_packet_detailed(" field 'researching' has changed");
87460#ifdef FREECIV_JSON_CONNECTION
87461 field_addr.name = "researching";
87462#endif /* FREECIV_JSON_CONNECTION */
87463 e = 0;
87464 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
87465 if (e) {
87466 log_packet_detailed("'researching' field error detected");
87467 }
87468 }
87469 if (BV_ISSET(fields, 21)) {
87470 log_packet_detailed(" field 'bulbs_researched' has changed");
87471#ifdef FREECIV_JSON_CONNECTION
87472 field_addr.name = "bulbs_researched";
87473#endif /* FREECIV_JSON_CONNECTION */
87474 e = 0;
87475 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
87476 if (e) {
87477 log_packet_detailed("'bulbs_researched' field error detected");
87478 }
87479 }
87480 if (BV_ISSET(fields, 22)) {
87481 log_packet_detailed(" field 'inventions' has changed");
87482#ifdef FREECIV_JSON_CONNECTION
87483 field_addr.name = "inventions";
87484#endif /* FREECIV_JSON_CONNECTION */
87485 e = 0;
87486 {
87487 int i;
87488
87489#ifdef FREECIV_JSON_CONNECTION
87490 size_t count_i = 0;
87491
87492 /* Create the array. */
87493 e |= DIO_PUT(farray, &dout, &field_addr, 0);
87494
87495 /* Enter array. */
87496 field_addr.sub_location = plocation_elem_new(0);
87497#endif /* FREECIV_JSON_CONNECTION */
87498
87499 fc_assert(A_LAST + 1 < MAX_UINT16);
87500
87501 for (i = 0; i < A_LAST + 1; i++) {
87502 differ = (old->inventions[i] != real_packet->inventions[i]);
87503
87504 if (differ) {
87505#ifdef FREECIV_JSON_CONNECTION
87506 /* Append next diff array element. */
87507 field_addr.sub_location->number = -1;
87508
87509 /* Create the diff array element. */
87510 e |= DIO_PUT(farray, &dout, &field_addr, 2);
87511
87512 /* Enter diff array element (start at the index address). */
87513 field_addr.sub_location->number = count_i++;
87514 field_addr.sub_location->sub_location = plocation_elem_new(0);
87515#endif /* FREECIV_JSON_CONNECTION */
87516 e |= DIO_PUT(uint16, &dout, &field_addr, i);
87517
87518#ifdef FREECIV_JSON_CONNECTION
87519 /* Content address. */
87520 field_addr.sub_location->sub_location->number = 1;
87521#endif /* FREECIV_JSON_CONNECTION */
87522 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->inventions[i]);
87523
87524#ifdef FREECIV_JSON_CONNECTION
87525 /* Exit diff array element. */
87526 FC_FREE(field_addr.sub_location->sub_location);
87527#endif /* FREECIV_JSON_CONNECTION */
87528 }
87529 }
87530#ifdef FREECIV_JSON_CONNECTION
87531 /* Append diff array element. */
87532 field_addr.sub_location->number = -1;
87533
87534 /* Create the terminating diff array element. */
87535 e |= DIO_PUT(farray, &dout, &field_addr, 1);
87536
87537 /* Enter diff array element (start at the index address). */
87538 field_addr.sub_location->number = count_i;
87539 field_addr.sub_location->sub_location = plocation_elem_new(0);
87540#endif /* FREECIV_JSON_CONNECTION */
87541 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
87542
87543#ifdef FREECIV_JSON_CONNECTION
87544 /* Exit diff array element. */
87545 FC_FREE(field_addr.sub_location->sub_location);
87546
87547 /* Exit array. */
87548 FC_FREE(field_addr.sub_location);
87549#endif /* FREECIV_JSON_CONNECTION */
87550 }
87551 if (e) {
87552 log_packet_detailed("'inventions' field error detected");
87553 }
87554 }
87555 /* field 23 is folded into the header */
87556 /* field 24 is folded into the header */
87557
87558 *old = *real_packet;
87559#endif /* FREECIV_DELTA_PROTOCOL */
87560#ifndef FREECIV_DELTA_PROTOCOL
87561#ifdef FREECIV_JSON_CONNECTION
87562 field_addr.name = "id";
87563#endif /* FREECIV_JSON_CONNECTION */
87564 e = 0;
87565 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
87566 if (e) {
87567 log_packet_detailed("'id' field error detected");
87568 }
87569#ifdef FREECIV_JSON_CONNECTION
87570 field_addr.name = "name";
87571#endif /* FREECIV_JSON_CONNECTION */
87572 e = 0;
87573 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
87574 if (e) {
87575 log_packet_detailed("'name' field error detected");
87576 }
87577#ifdef FREECIV_JSON_CONNECTION
87578 field_addr.name = "username";
87579#endif /* FREECIV_JSON_CONNECTION */
87580 e = 0;
87581 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
87582 if (e) {
87583 log_packet_detailed("'username' field error detected");
87584 }
87585#ifdef FREECIV_JSON_CONNECTION
87586 field_addr.name = "ranked_username";
87587#endif /* FREECIV_JSON_CONNECTION */
87588 e = 0;
87589 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ranked_username);
87590 if (e) {
87591 log_packet_detailed("'ranked_username' field error detected");
87592 }
87593#ifdef FREECIV_JSON_CONNECTION
87594 field_addr.name = "user_turns";
87595#endif /* FREECIV_JSON_CONNECTION */
87596 e = 0;
87597 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->user_turns);
87598 if (e) {
87599 log_packet_detailed("'user_turns' field error detected");
87600 }
87601#ifdef FREECIV_JSON_CONNECTION
87602 field_addr.name = "is_male";
87603#endif /* FREECIV_JSON_CONNECTION */
87604 e = 0;
87605 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
87606 if (e) {
87607 log_packet_detailed("'is_male' field error detected");
87608 }
87609#ifdef FREECIV_JSON_CONNECTION
87610 field_addr.name = "government";
87611#endif /* FREECIV_JSON_CONNECTION */
87612 e = 0;
87613 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
87614 if (e) {
87615 log_packet_detailed("'government' field error detected");
87616 }
87617#ifdef FREECIV_JSON_CONNECTION
87618 field_addr.name = "target_government";
87619#endif /* FREECIV_JSON_CONNECTION */
87620 e = 0;
87621 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
87622 if (e) {
87623 log_packet_detailed("'target_government' field error detected");
87624 }
87625#ifdef FREECIV_JSON_CONNECTION
87626 field_addr.name = "nation";
87627#endif /* FREECIV_JSON_CONNECTION */
87628 e = 0;
87629 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
87630 if (e) {
87631 log_packet_detailed("'nation' field error detected");
87632 }
87633#ifdef FREECIV_JSON_CONNECTION
87634 field_addr.name = "team";
87635#endif /* FREECIV_JSON_CONNECTION */
87636 e = 0;
87637 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->team);
87638 if (e) {
87639 log_packet_detailed("'team' field error detected");
87640 }
87641#ifdef FREECIV_JSON_CONNECTION
87642 field_addr.name = "phase_done";
87643#endif /* FREECIV_JSON_CONNECTION */
87644 e = 0;
87645 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->phase_done);
87646 if (e) {
87647 log_packet_detailed("'phase_done' field error detected");
87648 }
87649#ifdef FREECIV_JSON_CONNECTION
87650 field_addr.name = "nturns_idle";
87651#endif /* FREECIV_JSON_CONNECTION */
87652 e = 0;
87653 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
87654 if (e) {
87655 log_packet_detailed("'nturns_idle' field error detected");
87656 }
87657#ifdef FREECIV_JSON_CONNECTION
87658 field_addr.name = "is_alive";
87659#endif /* FREECIV_JSON_CONNECTION */
87660 e = 0;
87661 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_alive);
87662 if (e) {
87663 log_packet_detailed("'is_alive' field error detected");
87664 }
87665#ifdef FREECIV_JSON_CONNECTION
87666 field_addr.name = "revolution_finishes";
87667#endif /* FREECIV_JSON_CONNECTION */
87668 e = 0;
87669 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
87670 if (e) {
87671 log_packet_detailed("'revolution_finishes' field error detected");
87672 }
87673#ifdef FREECIV_JSON_CONNECTION
87674 field_addr.name = "autoselect_weight";
87675#endif /* FREECIV_JSON_CONNECTION */
87676 e = 0;
87677 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
87678 if (e) {
87679 log_packet_detailed("'autoselect_weight' field error detected");
87680 }
87681#ifdef FREECIV_JSON_CONNECTION
87682 field_addr.name = "embassy";
87683#endif /* FREECIV_JSON_CONNECTION */
87684 e = 0;
87685 e |= DIO_BV_PUT(&dout, &field_addr, packet->embassy);
87686 if (e) {
87687 log_packet_detailed("'embassy' field error detected");
87688 }
87689#ifdef FREECIV_JSON_CONNECTION
87690 field_addr.name = "gold";
87691#endif /* FREECIV_JSON_CONNECTION */
87692 e = 0;
87693 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
87694 if (e) {
87695 log_packet_detailed("'gold' field error detected");
87696 }
87697#ifdef FREECIV_JSON_CONNECTION
87698 field_addr.name = "tax";
87699#endif /* FREECIV_JSON_CONNECTION */
87700 e = 0;
87701 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
87702 if (e) {
87703 log_packet_detailed("'tax' field error detected");
87704 }
87705#ifdef FREECIV_JSON_CONNECTION
87706 field_addr.name = "science";
87707#endif /* FREECIV_JSON_CONNECTION */
87708 e = 0;
87709 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
87710 if (e) {
87711 log_packet_detailed("'science' field error detected");
87712 }
87713#ifdef FREECIV_JSON_CONNECTION
87714 field_addr.name = "luxury";
87715#endif /* FREECIV_JSON_CONNECTION */
87716 e = 0;
87717 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
87718 if (e) {
87719 log_packet_detailed("'luxury' field error detected");
87720 }
87721#ifdef FREECIV_JSON_CONNECTION
87722 field_addr.name = "future_tech";
87723#endif /* FREECIV_JSON_CONNECTION */
87724 e = 0;
87725 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
87726 if (e) {
87727 log_packet_detailed("'future_tech' field error detected");
87728 }
87729#ifdef FREECIV_JSON_CONNECTION
87730 field_addr.name = "researching";
87731#endif /* FREECIV_JSON_CONNECTION */
87732 e = 0;
87733 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
87734 if (e) {
87735 log_packet_detailed("'researching' field error detected");
87736 }
87737#ifdef FREECIV_JSON_CONNECTION
87738 field_addr.name = "bulbs_researched";
87739#endif /* FREECIV_JSON_CONNECTION */
87740 e = 0;
87741 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
87742 if (e) {
87743 log_packet_detailed("'bulbs_researched' field error detected");
87744 }
87745#ifdef FREECIV_JSON_CONNECTION
87746 field_addr.name = "inventions";
87747#endif /* FREECIV_JSON_CONNECTION */
87748 e = 0;
87749 {
87750 int i;
87751
87752#ifdef FREECIV_JSON_CONNECTION
87753 /* Create the array. */
87754 e |= DIO_PUT(farray, &dout, &field_addr, A_LAST + 1);
87755
87756 /* Enter the array. */
87757 field_addr.sub_location = plocation_elem_new(0);
87758#endif /* FREECIV_JSON_CONNECTION */
87759
87760 for (i = 0; i < A_LAST + 1; i++) {
87761#ifdef FREECIV_JSON_CONNECTION
87762 /* Next array element. */
87763 field_addr.sub_location->number = i;
87764#endif /* FREECIV_JSON_CONNECTION */
87765 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->inventions[i]);
87766 }
87767
87768#ifdef FREECIV_JSON_CONNECTION
87769 /* Exit array. */
87770 FC_FREE(field_addr.sub_location);
87771#endif /* FREECIV_JSON_CONNECTION */
87772 }
87773 if (e) {
87774 log_packet_detailed("'inventions' field error detected");
87775 }
87776#ifdef FREECIV_JSON_CONNECTION
87777 field_addr.name = "ai";
87778#endif /* FREECIV_JSON_CONNECTION */
87779 e = 0;
87780 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->ai);
87781 if (e) {
87782 log_packet_detailed("'ai' field error detected");
87783 }
87784#ifdef FREECIV_JSON_CONNECTION
87785 field_addr.name = "scenario_reserved";
87786#endif /* FREECIV_JSON_CONNECTION */
87787 e = 0;
87788 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_reserved);
87789 if (e) {
87790 log_packet_detailed("'scenario_reserved' field error detected");
87791 }
87792
87793#endif
87794 SEND_PACKET_END(PACKET_EDIT_PLAYER);
87795}
87796
87797 int send_packet_edit_player(struct connection *pc, const struct packet_edit_player *packet)
87798{
87799 if (!pc->used) {
87800 log_error("WARNING: trying to send data to the closed connection %s",
87801 conn_description(pc));
87802 return -1;
87803 }
87804 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER].packet != nullptr, -1,
87805 "Handler for PACKET_EDIT_PLAYER not installed");
87806 return pc->phs.handlers->send[PACKET_EDIT_PLAYER].packet(pc, packet);
87807}
87808
87809 void lsend_packet_edit_player(struct conn_list *dest, const struct packet_edit_player *packet)
87810{
87811 conn_list_iterate(dest, pconn) {
87812 send_packet_edit_player(pconn, packet);
87813 } conn_list_iterate_end;
87814}
87815
87816 static inline void init_packet_edit_player_vision(struct packet_edit_player_vision *packet)
87817{
87818 memset(packet, 0, sizeof(*packet));
87819}
87820
87821#define free_packet_edit_player_vision(_packet) (void) 0
87822#define destroy_packet_edit_player_vision free
87823
87824#ifdef FREECIV_DELTA_PROTOCOL
87825#define hash_packet_edit_player_vision_100 hash_const
87826
87827#define cmp_packet_edit_player_vision_100 cmp_const
87828
87829 BV_DEFINE(packet_edit_player_vision_100_fields, 4);
87830#endif /* FREECIV_DELTA_PROTOCOL */
87831
87832 static struct packet_edit_player_vision *receive_packet_edit_player_vision_100(struct connection *pc)
87833{
87834#define FREE_PACKET_STRUCT(_packet) free_packet_edit_player_vision(_packet)
87835#ifdef FREECIV_DELTA_PROTOCOL
87836 packet_edit_player_vision_100_fields fields;
87837 struct packet_edit_player_vision *old;
87838 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_VISION;
87839#endif /* FREECIV_DELTA_PROTOCOL */
87840 RECEIVE_PACKET_START(packet_edit_player_vision, real_packet);
87841#ifdef FREECIV_JSON_CONNECTION
87842 struct plocation field_addr;
87843 {
87844 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
87845 field_addr = *field_addr_tmp;
87846 FC_FREE(field_addr_tmp);
87847 }
87848#endif /* FREECIV_JSON_CONNECTION */
87849
87850#ifdef FREECIV_DELTA_PROTOCOL
87851#ifdef FREECIV_JSON_CONNECTION
87852 field_addr.name = "fields";
87853#endif /* FREECIV_JSON_CONNECTION */
87854 DIO_BV_GET(&din, &field_addr, fields);
87855
87856#else /* FREECIV_DELTA_PROTOCOL */
87857#ifdef FREECIV_JSON_CONNECTION
87858 field_addr.name = "player";
87859#endif /* FREECIV_JSON_CONNECTION */
87860 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player)) {
87861 RECEIVE_PACKET_FIELD_ERROR(player);
87862 }
87863#ifdef FREECIV_JSON_CONNECTION
87864 field_addr.name = "tile";
87865#endif /* FREECIV_JSON_CONNECTION */
87866 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
87867 RECEIVE_PACKET_FIELD_ERROR(tile);
87868 }
87869#ifdef FREECIV_JSON_CONNECTION
87870 field_addr.name = "known";
87871#endif /* FREECIV_JSON_CONNECTION */
87872 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->known)) {
87873 RECEIVE_PACKET_FIELD_ERROR(known);
87874 }
87875#ifdef FREECIV_JSON_CONNECTION
87876 field_addr.name = "size";
87877#endif /* FREECIV_JSON_CONNECTION */
87878 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
87879 RECEIVE_PACKET_FIELD_ERROR(size);
87880 }
87881#endif
87882 log_packet_detailed("packet_edit_player_vision_100: got info about ()");
87883
87884#ifdef FREECIV_DELTA_PROTOCOL
87885 if (nullptr == *hash) {
87886 *hash = genhash_new_full(hash_packet_edit_player_vision_100, cmp_packet_edit_player_vision_100,
87887 nullptr, nullptr, nullptr, destroy_packet_edit_player_vision);
87888 }
87889
87890 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
87891 *real_packet = *old;
87892 } else {
87893 /* packet is already initialized empty */
87894 log_packet_detailed(" no old info");
87895 }
87896
87897 if (BV_ISSET(fields, 0)) {
87898 log_packet_detailed(" got field 'player'");
87899#ifdef FREECIV_JSON_CONNECTION
87900 field_addr.name = "player";
87901#endif /* FREECIV_JSON_CONNECTION */
87902 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->player)) {
87903 RECEIVE_PACKET_FIELD_ERROR(player);
87904 }
87905 }
87906 if (BV_ISSET(fields, 1)) {
87907 log_packet_detailed(" got field 'tile'");
87908#ifdef FREECIV_JSON_CONNECTION
87909 field_addr.name = "tile";
87910#endif /* FREECIV_JSON_CONNECTION */
87911 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
87912 RECEIVE_PACKET_FIELD_ERROR(tile);
87913 }
87914 }
87915 real_packet->known = BV_ISSET(fields, 2);
87916 if (BV_ISSET(fields, 3)) {
87917 log_packet_detailed(" got field 'size'");
87918#ifdef FREECIV_JSON_CONNECTION
87919 field_addr.name = "size";
87920#endif /* FREECIV_JSON_CONNECTION */
87921 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
87922 RECEIVE_PACKET_FIELD_ERROR(size);
87923 }
87924 }
87925
87926 if (nullptr == old) {
87927 old = fc_malloc(sizeof(*old));
87928 init_packet_edit_player_vision(old);
87929 *old = *real_packet;
87930 genhash_insert(*hash, old, old);
87931 } else {
87932 *old = *real_packet;
87933 }
87934
87935#endif /* FREECIV_DELTA_PROTOCOL */
87936 RECEIVE_PACKET_END(real_packet);
87937#undef FREE_PACKET_STRUCT
87938}
87939
87940 static int send_packet_edit_player_vision_100(struct connection *pc, const struct packet_edit_player_vision *packet)
87941{
87942 const struct packet_edit_player_vision *real_packet = packet;
87943 int e;
87944#ifdef FREECIV_DELTA_PROTOCOL
87945 packet_edit_player_vision_100_fields fields;
87946 struct packet_edit_player_vision *old;
87947 bool differ;
87948 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_VISION;
87949#endif /* FREECIV_DELTA_PROTOCOL */
87950 SEND_PACKET_START(PACKET_EDIT_PLAYER_VISION);
87951#ifdef FREECIV_JSON_CONNECTION
87952 struct plocation field_addr;
87953 {
87954 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
87955 field_addr = *field_addr_tmp;
87956 FC_FREE(field_addr_tmp);
87957 }
87958#endif /* FREECIV_JSON_CONNECTION */
87959
87960 log_packet_detailed("packet_edit_player_vision_100: sending info about ()");
87961
87962#ifdef FREECIV_DELTA_PROTOCOL
87963 if (nullptr == *hash) {
87964 *hash = genhash_new_full(hash_packet_edit_player_vision_100, cmp_packet_edit_player_vision_100,
87965 nullptr, nullptr, nullptr, destroy_packet_edit_player_vision);
87966 }
87967 BV_CLR_ALL(fields);
87968
87969 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
87970 old = fc_malloc(sizeof(*old));
87971 /* temporary bitcopy just to insert correctly */
87972 *old = *real_packet;
87973 genhash_insert(*hash, old, old);
87974 init_packet_edit_player_vision(old);
87975 }
87976 differ = (old->player != real_packet->player);
87977 if (differ) {
87978 BV_SET(fields, 0);
87979 }
87980
87981 differ = (old->tile != real_packet->tile);
87982 if (differ) {
87983 BV_SET(fields, 1);
87984 }
87985
87986 if (packet->known) {
87987 BV_SET(fields, 2);
87988 }
87989
87990 differ = (old->size != real_packet->size);
87991 if (differ) {
87992 BV_SET(fields, 3);
87993 }
87994
87995
87996#ifdef FREECIV_JSON_CONNECTION
87997 field_addr.name = "fields";
87998#endif /* FREECIV_JSON_CONNECTION */
87999 e = 0;
88000 e |= DIO_BV_PUT(&dout, &field_addr, fields);
88001 if (e) {
88002 log_packet_detailed("fields bitvector error detected");
88003 }
88004
88005 if (BV_ISSET(fields, 0)) {
88006 log_packet_detailed(" field 'player' has changed");
88007#ifdef FREECIV_JSON_CONNECTION
88008 field_addr.name = "player";
88009#endif /* FREECIV_JSON_CONNECTION */
88010 e = 0;
88011 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player);
88012 if (e) {
88013 log_packet_detailed("'player' field error detected");
88014 }
88015 }
88016 if (BV_ISSET(fields, 1)) {
88017 log_packet_detailed(" field 'tile' has changed");
88018#ifdef FREECIV_JSON_CONNECTION
88019 field_addr.name = "tile";
88020#endif /* FREECIV_JSON_CONNECTION */
88021 e = 0;
88022 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
88023 if (e) {
88024 log_packet_detailed("'tile' field error detected");
88025 }
88026 }
88027 /* field 2 is folded into the header */
88028 if (BV_ISSET(fields, 3)) {
88029 log_packet_detailed(" field 'size' has changed");
88030#ifdef FREECIV_JSON_CONNECTION
88031 field_addr.name = "size";
88032#endif /* FREECIV_JSON_CONNECTION */
88033 e = 0;
88034 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
88035 if (e) {
88036 log_packet_detailed("'size' field error detected");
88037 }
88038 }
88039
88040 *old = *real_packet;
88041#endif /* FREECIV_DELTA_PROTOCOL */
88042#ifndef FREECIV_DELTA_PROTOCOL
88043#ifdef FREECIV_JSON_CONNECTION
88044 field_addr.name = "player";
88045#endif /* FREECIV_JSON_CONNECTION */
88046 e = 0;
88047 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->player);
88048 if (e) {
88049 log_packet_detailed("'player' field error detected");
88050 }
88051#ifdef FREECIV_JSON_CONNECTION
88052 field_addr.name = "tile";
88053#endif /* FREECIV_JSON_CONNECTION */
88054 e = 0;
88055 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
88056 if (e) {
88057 log_packet_detailed("'tile' field error detected");
88058 }
88059#ifdef FREECIV_JSON_CONNECTION
88060 field_addr.name = "known";
88061#endif /* FREECIV_JSON_CONNECTION */
88062 e = 0;
88063 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->known);
88064 if (e) {
88065 log_packet_detailed("'known' field error detected");
88066 }
88067#ifdef FREECIV_JSON_CONNECTION
88068 field_addr.name = "size";
88069#endif /* FREECIV_JSON_CONNECTION */
88070 e = 0;
88071 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
88072 if (e) {
88073 log_packet_detailed("'size' field error detected");
88074 }
88075
88076#endif
88077 SEND_PACKET_END(PACKET_EDIT_PLAYER_VISION);
88078}
88079
88080 int send_packet_edit_player_vision(struct connection *pc, const struct packet_edit_player_vision *packet)
88081{
88082 if (!pc->used) {
88083 log_error("WARNING: trying to send data to the closed connection %s",
88084 conn_description(pc));
88085 return -1;
88086 }
88087 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_VISION].packet != nullptr, -1,
88088 "Handler for PACKET_EDIT_PLAYER_VISION not installed");
88089 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_VISION].packet(pc, packet);
88090}
88091
88092 int dsend_packet_edit_player_vision(struct connection *pc, int player, int tile, bool known, int size)
88093{
88094 struct packet_edit_player_vision packet, *real_packet = &packet;
88095
88096 real_packet->player = player;
88097 real_packet->tile = tile;
88098 real_packet->known = known;
88099 real_packet->size = size;
88100
88101 return send_packet_edit_player_vision(pc, real_packet);
88102}
88103
88104 static inline void init_packet_edit_game(struct packet_edit_game *packet)
88105{
88106 memset(packet, 0, sizeof(*packet));
88107}
88108
88109#define free_packet_edit_game(_packet) (void) 0
88110#define destroy_packet_edit_game free
88111
88112#ifdef FREECIV_DELTA_PROTOCOL
88113#define hash_packet_edit_game_100 hash_const
88114
88115#define cmp_packet_edit_game_100 cmp_const
88116
88117 BV_DEFINE(packet_edit_game_100_fields, 9);
88118#endif /* FREECIV_DELTA_PROTOCOL */
88119
88120 static struct packet_edit_game *receive_packet_edit_game_100(struct connection *pc)
88121{
88122#define FREE_PACKET_STRUCT(_packet) free_packet_edit_game(_packet)
88123#ifdef FREECIV_DELTA_PROTOCOL
88124 packet_edit_game_100_fields fields;
88125 struct packet_edit_game *old;
88126 struct genhash **hash = pc->phs.received + PACKET_EDIT_GAME;
88127#endif /* FREECIV_DELTA_PROTOCOL */
88128 RECEIVE_PACKET_START(packet_edit_game, real_packet);
88129#ifdef FREECIV_JSON_CONNECTION
88130 struct plocation field_addr;
88131 {
88132 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88133 field_addr = *field_addr_tmp;
88134 FC_FREE(field_addr_tmp);
88135 }
88136#endif /* FREECIV_JSON_CONNECTION */
88137
88138#ifdef FREECIV_DELTA_PROTOCOL
88139#ifdef FREECIV_JSON_CONNECTION
88140 field_addr.name = "fields";
88141#endif /* FREECIV_JSON_CONNECTION */
88142 DIO_BV_GET(&din, &field_addr, fields);
88143
88144#else /* FREECIV_DELTA_PROTOCOL */
88145#ifdef FREECIV_JSON_CONNECTION
88146 field_addr.name = "scenario";
88147#endif /* FREECIV_JSON_CONNECTION */
88148 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario)) {
88149 RECEIVE_PACKET_FIELD_ERROR(scenario);
88150 }
88151#ifdef FREECIV_JSON_CONNECTION
88152 field_addr.name = "scenario_name";
88153#endif /* FREECIV_JSON_CONNECTION */
88154 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_name, sizeof(real_packet->scenario_name))) {
88155 RECEIVE_PACKET_FIELD_ERROR(scenario_name);
88156 }
88157#ifdef FREECIV_JSON_CONNECTION
88158 field_addr.name = "scenario_authors";
88159#endif /* FREECIV_JSON_CONNECTION */
88160 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_authors, sizeof(real_packet->scenario_authors))) {
88161 RECEIVE_PACKET_FIELD_ERROR(scenario_authors);
88162 }
88163#ifdef FREECIV_JSON_CONNECTION
88164 field_addr.name = "scenario_random";
88165#endif /* FREECIV_JSON_CONNECTION */
88166 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_random)) {
88167 RECEIVE_PACKET_FIELD_ERROR(scenario_random);
88168 }
88169#ifdef FREECIV_JSON_CONNECTION
88170 field_addr.name = "scenario_players";
88171#endif /* FREECIV_JSON_CONNECTION */
88172 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_players)) {
88173 RECEIVE_PACKET_FIELD_ERROR(scenario_players);
88174 }
88175#ifdef FREECIV_JSON_CONNECTION
88176 field_addr.name = "startpos_nations";
88177#endif /* FREECIV_JSON_CONNECTION */
88178 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->startpos_nations)) {
88179 RECEIVE_PACKET_FIELD_ERROR(startpos_nations);
88180 }
88181#ifdef FREECIV_JSON_CONNECTION
88182 field_addr.name = "prevent_new_cities";
88183#endif /* FREECIV_JSON_CONNECTION */
88184 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->prevent_new_cities)) {
88185 RECEIVE_PACKET_FIELD_ERROR(prevent_new_cities);
88186 }
88187#ifdef FREECIV_JSON_CONNECTION
88188 field_addr.name = "lake_flooding";
88189#endif /* FREECIV_JSON_CONNECTION */
88190 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->lake_flooding)) {
88191 RECEIVE_PACKET_FIELD_ERROR(lake_flooding);
88192 }
88193#ifdef FREECIV_JSON_CONNECTION
88194 field_addr.name = "ruleset_locked";
88195#endif /* FREECIV_JSON_CONNECTION */
88196 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ruleset_locked)) {
88197 RECEIVE_PACKET_FIELD_ERROR(ruleset_locked);
88198 }
88199#endif
88200 log_packet_detailed("packet_edit_game_100: got info about ()");
88201
88202#ifdef FREECIV_DELTA_PROTOCOL
88203 if (nullptr == *hash) {
88204 *hash = genhash_new_full(hash_packet_edit_game_100, cmp_packet_edit_game_100,
88205 nullptr, nullptr, nullptr, destroy_packet_edit_game);
88206 }
88207
88208 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
88209 *real_packet = *old;
88210 } else {
88211 /* packet is already initialized empty */
88212 log_packet_detailed(" no old info");
88213 }
88214
88215 real_packet->scenario = BV_ISSET(fields, 0);
88216 if (BV_ISSET(fields, 1)) {
88217 log_packet_detailed(" got field 'scenario_name'");
88218#ifdef FREECIV_JSON_CONNECTION
88219 field_addr.name = "scenario_name";
88220#endif /* FREECIV_JSON_CONNECTION */
88221 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_name, sizeof(real_packet->scenario_name))) {
88222 RECEIVE_PACKET_FIELD_ERROR(scenario_name);
88223 }
88224 }
88225 if (BV_ISSET(fields, 2)) {
88226 log_packet_detailed(" got field 'scenario_authors'");
88227#ifdef FREECIV_JSON_CONNECTION
88228 field_addr.name = "scenario_authors";
88229#endif /* FREECIV_JSON_CONNECTION */
88230 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_authors, sizeof(real_packet->scenario_authors))) {
88231 RECEIVE_PACKET_FIELD_ERROR(scenario_authors);
88232 }
88233 }
88234 real_packet->scenario_random = BV_ISSET(fields, 3);
88235 real_packet->scenario_players = BV_ISSET(fields, 4);
88236 real_packet->startpos_nations = BV_ISSET(fields, 5);
88237 real_packet->prevent_new_cities = BV_ISSET(fields, 6);
88238 real_packet->lake_flooding = BV_ISSET(fields, 7);
88239 real_packet->ruleset_locked = BV_ISSET(fields, 8);
88240
88241 if (nullptr == old) {
88242 old = fc_malloc(sizeof(*old));
88243 init_packet_edit_game(old);
88244 *old = *real_packet;
88245 genhash_insert(*hash, old, old);
88246 } else {
88247 *old = *real_packet;
88248 }
88249
88250#endif /* FREECIV_DELTA_PROTOCOL */
88251 RECEIVE_PACKET_END(real_packet);
88252#undef FREE_PACKET_STRUCT
88253}
88254
88255 static int send_packet_edit_game_100(struct connection *pc, const struct packet_edit_game *packet)
88256{
88257 const struct packet_edit_game *real_packet = packet;
88258 int e;
88259#ifdef FREECIV_DELTA_PROTOCOL
88260 packet_edit_game_100_fields fields;
88261 struct packet_edit_game *old;
88262 bool differ;
88263 struct genhash **hash = pc->phs.sent + PACKET_EDIT_GAME;
88264#endif /* FREECIV_DELTA_PROTOCOL */
88265 SEND_PACKET_START(PACKET_EDIT_GAME);
88266#ifdef FREECIV_JSON_CONNECTION
88267 struct plocation field_addr;
88268 {
88269 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88270 field_addr = *field_addr_tmp;
88271 FC_FREE(field_addr_tmp);
88272 }
88273#endif /* FREECIV_JSON_CONNECTION */
88274
88275 log_packet_detailed("packet_edit_game_100: sending info about ()");
88276
88277#ifdef FREECIV_DELTA_PROTOCOL
88278 if (nullptr == *hash) {
88279 *hash = genhash_new_full(hash_packet_edit_game_100, cmp_packet_edit_game_100,
88280 nullptr, nullptr, nullptr, destroy_packet_edit_game);
88281 }
88282 BV_CLR_ALL(fields);
88283
88284 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
88285 old = fc_malloc(sizeof(*old));
88286 /* temporary bitcopy just to insert correctly */
88287 *old = *real_packet;
88288 genhash_insert(*hash, old, old);
88289 init_packet_edit_game(old);
88290 }
88291 if (packet->scenario) {
88292 BV_SET(fields, 0);
88293 }
88294
88295 differ = (strcmp(old->scenario_name, real_packet->scenario_name) != 0);
88296 if (differ) {
88297 BV_SET(fields, 1);
88298 }
88299
88300 differ = (strcmp(old->scenario_authors, real_packet->scenario_authors) != 0);
88301 if (differ) {
88302 BV_SET(fields, 2);
88303 }
88304
88305 if (packet->scenario_random) {
88306 BV_SET(fields, 3);
88307 }
88308
88309 if (packet->scenario_players) {
88310 BV_SET(fields, 4);
88311 }
88312
88313 if (packet->startpos_nations) {
88314 BV_SET(fields, 5);
88315 }
88316
88317 if (packet->prevent_new_cities) {
88318 BV_SET(fields, 6);
88319 }
88320
88321 if (packet->lake_flooding) {
88322 BV_SET(fields, 7);
88323 }
88324
88325 if (packet->ruleset_locked) {
88326 BV_SET(fields, 8);
88327 }
88328
88329
88330#ifdef FREECIV_JSON_CONNECTION
88331 field_addr.name = "fields";
88332#endif /* FREECIV_JSON_CONNECTION */
88333 e = 0;
88334 e |= DIO_BV_PUT(&dout, &field_addr, fields);
88335 if (e) {
88336 log_packet_detailed("fields bitvector error detected");
88337 }
88338
88339 /* field 0 is folded into the header */
88340 if (BV_ISSET(fields, 1)) {
88341 log_packet_detailed(" field 'scenario_name' has changed");
88342#ifdef FREECIV_JSON_CONNECTION
88343 field_addr.name = "scenario_name";
88344#endif /* FREECIV_JSON_CONNECTION */
88345 e = 0;
88346 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_name);
88347 if (e) {
88348 log_packet_detailed("'scenario_name' field error detected");
88349 }
88350 }
88351 if (BV_ISSET(fields, 2)) {
88352 log_packet_detailed(" field 'scenario_authors' has changed");
88353#ifdef FREECIV_JSON_CONNECTION
88354 field_addr.name = "scenario_authors";
88355#endif /* FREECIV_JSON_CONNECTION */
88356 e = 0;
88357 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_authors);
88358 if (e) {
88359 log_packet_detailed("'scenario_authors' field error detected");
88360 }
88361 }
88362 /* field 3 is folded into the header */
88363 /* field 4 is folded into the header */
88364 /* field 5 is folded into the header */
88365 /* field 6 is folded into the header */
88366 /* field 7 is folded into the header */
88367 /* field 8 is folded into the header */
88368
88369 *old = *real_packet;
88370#endif /* FREECIV_DELTA_PROTOCOL */
88371#ifndef FREECIV_DELTA_PROTOCOL
88372#ifdef FREECIV_JSON_CONNECTION
88373 field_addr.name = "scenario";
88374#endif /* FREECIV_JSON_CONNECTION */
88375 e = 0;
88376 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario);
88377 if (e) {
88378 log_packet_detailed("'scenario' field error detected");
88379 }
88380#ifdef FREECIV_JSON_CONNECTION
88381 field_addr.name = "scenario_name";
88382#endif /* FREECIV_JSON_CONNECTION */
88383 e = 0;
88384 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_name);
88385 if (e) {
88386 log_packet_detailed("'scenario_name' field error detected");
88387 }
88388#ifdef FREECIV_JSON_CONNECTION
88389 field_addr.name = "scenario_authors";
88390#endif /* FREECIV_JSON_CONNECTION */
88391 e = 0;
88392 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_authors);
88393 if (e) {
88394 log_packet_detailed("'scenario_authors' field error detected");
88395 }
88396#ifdef FREECIV_JSON_CONNECTION
88397 field_addr.name = "scenario_random";
88398#endif /* FREECIV_JSON_CONNECTION */
88399 e = 0;
88400 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_random);
88401 if (e) {
88402 log_packet_detailed("'scenario_random' field error detected");
88403 }
88404#ifdef FREECIV_JSON_CONNECTION
88405 field_addr.name = "scenario_players";
88406#endif /* FREECIV_JSON_CONNECTION */
88407 e = 0;
88408 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_players);
88409 if (e) {
88410 log_packet_detailed("'scenario_players' field error detected");
88411 }
88412#ifdef FREECIV_JSON_CONNECTION
88413 field_addr.name = "startpos_nations";
88414#endif /* FREECIV_JSON_CONNECTION */
88415 e = 0;
88416 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->startpos_nations);
88417 if (e) {
88418 log_packet_detailed("'startpos_nations' field error detected");
88419 }
88420#ifdef FREECIV_JSON_CONNECTION
88421 field_addr.name = "prevent_new_cities";
88422#endif /* FREECIV_JSON_CONNECTION */
88423 e = 0;
88424 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->prevent_new_cities);
88425 if (e) {
88426 log_packet_detailed("'prevent_new_cities' field error detected");
88427 }
88428#ifdef FREECIV_JSON_CONNECTION
88429 field_addr.name = "lake_flooding";
88430#endif /* FREECIV_JSON_CONNECTION */
88431 e = 0;
88432 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->lake_flooding);
88433 if (e) {
88434 log_packet_detailed("'lake_flooding' field error detected");
88435 }
88436#ifdef FREECIV_JSON_CONNECTION
88437 field_addr.name = "ruleset_locked";
88438#endif /* FREECIV_JSON_CONNECTION */
88439 e = 0;
88440 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->ruleset_locked);
88441 if (e) {
88442 log_packet_detailed("'ruleset_locked' field error detected");
88443 }
88444
88445#endif
88446 SEND_PACKET_END(PACKET_EDIT_GAME);
88447}
88448
88449 int send_packet_edit_game(struct connection *pc, const struct packet_edit_game *packet)
88450{
88451 if (!pc->used) {
88452 log_error("WARNING: trying to send data to the closed connection %s",
88453 conn_description(pc));
88454 return -1;
88455 }
88456 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_GAME].packet != nullptr, -1,
88457 "Handler for PACKET_EDIT_GAME not installed");
88458 return pc->phs.handlers->send[PACKET_EDIT_GAME].packet(pc, packet);
88459}
88460
88461 static inline void init_packet_edit_scenario_desc(struct packet_edit_scenario_desc *packet)
88462{
88463 memset(packet, 0, sizeof(*packet));
88464}
88465
88466#define free_packet_edit_scenario_desc(_packet) (void) 0
88467#define destroy_packet_edit_scenario_desc free
88468
88469#ifdef FREECIV_DELTA_PROTOCOL
88470#define hash_packet_edit_scenario_desc_100 hash_const
88471
88472#define cmp_packet_edit_scenario_desc_100 cmp_const
88473
88474 BV_DEFINE(packet_edit_scenario_desc_100_fields, 1);
88475#endif /* FREECIV_DELTA_PROTOCOL */
88476
88477 static struct packet_edit_scenario_desc *receive_packet_edit_scenario_desc_100(struct connection *pc)
88478{
88479#define FREE_PACKET_STRUCT(_packet) free_packet_edit_scenario_desc(_packet)
88480#ifdef FREECIV_DELTA_PROTOCOL
88481 packet_edit_scenario_desc_100_fields fields;
88482 struct packet_edit_scenario_desc *old;
88483 struct genhash **hash = pc->phs.received + PACKET_EDIT_SCENARIO_DESC;
88484#endif /* FREECIV_DELTA_PROTOCOL */
88485 RECEIVE_PACKET_START(packet_edit_scenario_desc, real_packet);
88486#ifdef FREECIV_JSON_CONNECTION
88487 struct plocation field_addr;
88488 {
88489 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88490 field_addr = *field_addr_tmp;
88491 FC_FREE(field_addr_tmp);
88492 }
88493#endif /* FREECIV_JSON_CONNECTION */
88494
88495#ifdef FREECIV_DELTA_PROTOCOL
88496#ifdef FREECIV_JSON_CONNECTION
88497 field_addr.name = "fields";
88498#endif /* FREECIV_JSON_CONNECTION */
88499 DIO_BV_GET(&din, &field_addr, fields);
88500
88501#else /* FREECIV_DELTA_PROTOCOL */
88502#ifdef FREECIV_JSON_CONNECTION
88503 field_addr.name = "scenario_desc";
88504#endif /* FREECIV_JSON_CONNECTION */
88505 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_desc, sizeof(real_packet->scenario_desc))) {
88506 RECEIVE_PACKET_FIELD_ERROR(scenario_desc);
88507 }
88508#endif
88509 log_packet_detailed("packet_edit_scenario_desc_100: got info about ()");
88510
88511#ifdef FREECIV_DELTA_PROTOCOL
88512 if (nullptr == *hash) {
88513 *hash = genhash_new_full(hash_packet_edit_scenario_desc_100, cmp_packet_edit_scenario_desc_100,
88514 nullptr, nullptr, nullptr, destroy_packet_edit_scenario_desc);
88515 }
88516
88517 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
88518 *real_packet = *old;
88519 } else {
88520 /* packet is already initialized empty */
88521 log_packet_detailed(" no old info");
88522 }
88523
88524 if (BV_ISSET(fields, 0)) {
88525 log_packet_detailed(" got field 'scenario_desc'");
88526#ifdef FREECIV_JSON_CONNECTION
88527 field_addr.name = "scenario_desc";
88528#endif /* FREECIV_JSON_CONNECTION */
88529 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_desc, sizeof(real_packet->scenario_desc))) {
88530 RECEIVE_PACKET_FIELD_ERROR(scenario_desc);
88531 }
88532 }
88533
88534 if (nullptr == old) {
88535 old = fc_malloc(sizeof(*old));
88536 init_packet_edit_scenario_desc(old);
88537 *old = *real_packet;
88538 genhash_insert(*hash, old, old);
88539 } else {
88540 *old = *real_packet;
88541 }
88542
88543#endif /* FREECIV_DELTA_PROTOCOL */
88544 RECEIVE_PACKET_END(real_packet);
88545#undef FREE_PACKET_STRUCT
88546}
88547
88548 static int send_packet_edit_scenario_desc_100(struct connection *pc, const struct packet_edit_scenario_desc *packet)
88549{
88550 const struct packet_edit_scenario_desc *real_packet = packet;
88551 int e;
88552#ifdef FREECIV_DELTA_PROTOCOL
88553 packet_edit_scenario_desc_100_fields fields;
88554 struct packet_edit_scenario_desc *old;
88555 bool differ;
88556 struct genhash **hash = pc->phs.sent + PACKET_EDIT_SCENARIO_DESC;
88557#endif /* FREECIV_DELTA_PROTOCOL */
88558 SEND_PACKET_START(PACKET_EDIT_SCENARIO_DESC);
88559#ifdef FREECIV_JSON_CONNECTION
88560 struct plocation field_addr;
88561 {
88562 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88563 field_addr = *field_addr_tmp;
88564 FC_FREE(field_addr_tmp);
88565 }
88566#endif /* FREECIV_JSON_CONNECTION */
88567
88568 log_packet_detailed("packet_edit_scenario_desc_100: sending info about ()");
88569
88570#ifdef FREECIV_DELTA_PROTOCOL
88571 if (nullptr == *hash) {
88572 *hash = genhash_new_full(hash_packet_edit_scenario_desc_100, cmp_packet_edit_scenario_desc_100,
88573 nullptr, nullptr, nullptr, destroy_packet_edit_scenario_desc);
88574 }
88575 BV_CLR_ALL(fields);
88576
88577 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
88578 old = fc_malloc(sizeof(*old));
88579 /* temporary bitcopy just to insert correctly */
88580 *old = *real_packet;
88581 genhash_insert(*hash, old, old);
88582 init_packet_edit_scenario_desc(old);
88583 }
88584 differ = (strcmp(old->scenario_desc, real_packet->scenario_desc) != 0);
88585 if (differ) {
88586 BV_SET(fields, 0);
88587 }
88588
88589
88590#ifdef FREECIV_JSON_CONNECTION
88591 field_addr.name = "fields";
88592#endif /* FREECIV_JSON_CONNECTION */
88593 e = 0;
88594 e |= DIO_BV_PUT(&dout, &field_addr, fields);
88595 if (e) {
88596 log_packet_detailed("fields bitvector error detected");
88597 }
88598
88599 if (BV_ISSET(fields, 0)) {
88600 log_packet_detailed(" field 'scenario_desc' has changed");
88601#ifdef FREECIV_JSON_CONNECTION
88602 field_addr.name = "scenario_desc";
88603#endif /* FREECIV_JSON_CONNECTION */
88604 e = 0;
88605 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_desc);
88606 if (e) {
88607 log_packet_detailed("'scenario_desc' field error detected");
88608 }
88609 }
88610
88611 *old = *real_packet;
88612#endif /* FREECIV_DELTA_PROTOCOL */
88613#ifndef FREECIV_DELTA_PROTOCOL
88614#ifdef FREECIV_JSON_CONNECTION
88615 field_addr.name = "scenario_desc";
88616#endif /* FREECIV_JSON_CONNECTION */
88617 e = 0;
88618 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_desc);
88619 if (e) {
88620 log_packet_detailed("'scenario_desc' field error detected");
88621 }
88622
88623#endif
88624 SEND_PACKET_END(PACKET_EDIT_SCENARIO_DESC);
88625}
88626
88627 int send_packet_edit_scenario_desc(struct connection *pc, const struct packet_edit_scenario_desc *packet)
88628{
88629 if (!pc->used) {
88630 log_error("WARNING: trying to send data to the closed connection %s",
88631 conn_description(pc));
88632 return -1;
88633 }
88634 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_SCENARIO_DESC].packet != nullptr, -1,
88635 "Handler for PACKET_EDIT_SCENARIO_DESC not installed");
88636 return pc->phs.handlers->send[PACKET_EDIT_SCENARIO_DESC].packet(pc, packet);
88637}
88638
88639 static inline void init_packet_edit_object_created(struct packet_edit_object_created *packet)
88640{
88641 memset(packet, 0, sizeof(*packet));
88642}
88643
88644#define free_packet_edit_object_created(_packet) (void) 0
88645#define destroy_packet_edit_object_created free
88646
88647#ifdef FREECIV_DELTA_PROTOCOL
88648#define hash_packet_edit_object_created_100 hash_const
88649
88650#define cmp_packet_edit_object_created_100 cmp_const
88651
88652 BV_DEFINE(packet_edit_object_created_100_fields, 2);
88653#endif /* FREECIV_DELTA_PROTOCOL */
88654
88655 static struct packet_edit_object_created *receive_packet_edit_object_created_100(struct connection *pc)
88656{
88657#define FREE_PACKET_STRUCT(_packet) free_packet_edit_object_created(_packet)
88658#ifdef FREECIV_DELTA_PROTOCOL
88659 packet_edit_object_created_100_fields fields;
88660 struct packet_edit_object_created *old;
88661 struct genhash **hash = pc->phs.received + PACKET_EDIT_OBJECT_CREATED;
88662#endif /* FREECIV_DELTA_PROTOCOL */
88663 RECEIVE_PACKET_START(packet_edit_object_created, real_packet);
88664#ifdef FREECIV_JSON_CONNECTION
88665 struct plocation field_addr;
88666 {
88667 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88668 field_addr = *field_addr_tmp;
88669 FC_FREE(field_addr_tmp);
88670 }
88671#endif /* FREECIV_JSON_CONNECTION */
88672
88673#ifdef FREECIV_DELTA_PROTOCOL
88674#ifdef FREECIV_JSON_CONNECTION
88675 field_addr.name = "fields";
88676#endif /* FREECIV_JSON_CONNECTION */
88677 DIO_BV_GET(&din, &field_addr, fields);
88678
88679#else /* FREECIV_DELTA_PROTOCOL */
88680#ifdef FREECIV_JSON_CONNECTION
88681 field_addr.name = "tag";
88682#endif /* FREECIV_JSON_CONNECTION */
88683 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
88684 RECEIVE_PACKET_FIELD_ERROR(tag);
88685 }
88686#ifdef FREECIV_JSON_CONNECTION
88687 field_addr.name = "id";
88688#endif /* FREECIV_JSON_CONNECTION */
88689 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
88690 RECEIVE_PACKET_FIELD_ERROR(id);
88691 }
88692#endif
88693 log_packet_detailed("packet_edit_object_created_100: got info about ()");
88694
88695#ifdef FREECIV_DELTA_PROTOCOL
88696 if (nullptr == *hash) {
88697 *hash = genhash_new_full(hash_packet_edit_object_created_100, cmp_packet_edit_object_created_100,
88698 nullptr, nullptr, nullptr, destroy_packet_edit_object_created);
88699 }
88700
88701 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
88702 *real_packet = *old;
88703 } else {
88704 /* packet is already initialized empty */
88705 log_packet_detailed(" no old info");
88706 }
88707
88708 if (BV_ISSET(fields, 0)) {
88709 log_packet_detailed(" got field 'tag'");
88710#ifdef FREECIV_JSON_CONNECTION
88711 field_addr.name = "tag";
88712#endif /* FREECIV_JSON_CONNECTION */
88713 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
88714 RECEIVE_PACKET_FIELD_ERROR(tag);
88715 }
88716 }
88717 if (BV_ISSET(fields, 1)) {
88718 log_packet_detailed(" got field 'id'");
88719#ifdef FREECIV_JSON_CONNECTION
88720 field_addr.name = "id";
88721#endif /* FREECIV_JSON_CONNECTION */
88722 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
88723 RECEIVE_PACKET_FIELD_ERROR(id);
88724 }
88725 }
88726
88727 if (nullptr == old) {
88728 old = fc_malloc(sizeof(*old));
88729 init_packet_edit_object_created(old);
88730 *old = *real_packet;
88731 genhash_insert(*hash, old, old);
88732 } else {
88733 *old = *real_packet;
88734 }
88735
88736#endif /* FREECIV_DELTA_PROTOCOL */
88737 RECEIVE_PACKET_END(real_packet);
88738#undef FREE_PACKET_STRUCT
88739}
88740
88741 static int send_packet_edit_object_created_100(struct connection *pc, const struct packet_edit_object_created *packet)
88742{
88743 const struct packet_edit_object_created *real_packet = packet;
88744 int e;
88745#ifdef FREECIV_DELTA_PROTOCOL
88746 packet_edit_object_created_100_fields fields;
88747 struct packet_edit_object_created *old;
88748 bool differ;
88749 struct genhash **hash = pc->phs.sent + PACKET_EDIT_OBJECT_CREATED;
88750#endif /* FREECIV_DELTA_PROTOCOL */
88751 SEND_PACKET_START(PACKET_EDIT_OBJECT_CREATED);
88752#ifdef FREECIV_JSON_CONNECTION
88753 struct plocation field_addr;
88754 {
88755 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88756 field_addr = *field_addr_tmp;
88757 FC_FREE(field_addr_tmp);
88758 }
88759#endif /* FREECIV_JSON_CONNECTION */
88760
88761 log_packet_detailed("packet_edit_object_created_100: sending info about ()");
88762
88763#ifdef FREECIV_DELTA_PROTOCOL
88764 if (nullptr == *hash) {
88765 *hash = genhash_new_full(hash_packet_edit_object_created_100, cmp_packet_edit_object_created_100,
88766 nullptr, nullptr, nullptr, destroy_packet_edit_object_created);
88767 }
88768 BV_CLR_ALL(fields);
88769
88770 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
88771 old = fc_malloc(sizeof(*old));
88772 /* temporary bitcopy just to insert correctly */
88773 *old = *real_packet;
88774 genhash_insert(*hash, old, old);
88775 init_packet_edit_object_created(old);
88776 }
88777 differ = (old->tag != real_packet->tag);
88778 if (differ) {
88779 BV_SET(fields, 0);
88780 }
88781
88782 differ = (old->id != real_packet->id);
88783 if (differ) {
88784 BV_SET(fields, 1);
88785 }
88786
88787
88788#ifdef FREECIV_JSON_CONNECTION
88789 field_addr.name = "fields";
88790#endif /* FREECIV_JSON_CONNECTION */
88791 e = 0;
88792 e |= DIO_BV_PUT(&dout, &field_addr, fields);
88793 if (e) {
88794 log_packet_detailed("fields bitvector error detected");
88795 }
88796
88797 if (BV_ISSET(fields, 0)) {
88798 log_packet_detailed(" field 'tag' has changed");
88799#ifdef FREECIV_JSON_CONNECTION
88800 field_addr.name = "tag";
88801#endif /* FREECIV_JSON_CONNECTION */
88802 e = 0;
88803 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
88804 if (e) {
88805 log_packet_detailed("'tag' field error detected");
88806 }
88807 }
88808 if (BV_ISSET(fields, 1)) {
88809 log_packet_detailed(" field 'id' has changed");
88810#ifdef FREECIV_JSON_CONNECTION
88811 field_addr.name = "id";
88812#endif /* FREECIV_JSON_CONNECTION */
88813 e = 0;
88814 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
88815 if (e) {
88816 log_packet_detailed("'id' field error detected");
88817 }
88818 }
88819
88820 *old = *real_packet;
88821#endif /* FREECIV_DELTA_PROTOCOL */
88822#ifndef FREECIV_DELTA_PROTOCOL
88823#ifdef FREECIV_JSON_CONNECTION
88824 field_addr.name = "tag";
88825#endif /* FREECIV_JSON_CONNECTION */
88826 e = 0;
88827 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
88828 if (e) {
88829 log_packet_detailed("'tag' field error detected");
88830 }
88831#ifdef FREECIV_JSON_CONNECTION
88832 field_addr.name = "id";
88833#endif /* FREECIV_JSON_CONNECTION */
88834 e = 0;
88835 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
88836 if (e) {
88837 log_packet_detailed("'id' field error detected");
88838 }
88839
88840#endif
88841 SEND_PACKET_END(PACKET_EDIT_OBJECT_CREATED);
88842}
88843
88844 int send_packet_edit_object_created(struct connection *pc, const struct packet_edit_object_created *packet)
88845{
88846 if (!pc->used) {
88847 log_error("WARNING: trying to send data to the closed connection %s",
88848 conn_description(pc));
88849 return -1;
88850 }
88851 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_OBJECT_CREATED].packet != nullptr, -1,
88852 "Handler for PACKET_EDIT_OBJECT_CREATED not installed");
88853 return pc->phs.handlers->send[PACKET_EDIT_OBJECT_CREATED].packet(pc, packet);
88854}
88855
88856 int dsend_packet_edit_object_created(struct connection *pc, int tag, int id)
88857{
88858 struct packet_edit_object_created packet, *real_packet = &packet;
88859
88860 real_packet->tag = tag;
88861 real_packet->id = id;
88862
88863 return send_packet_edit_object_created(pc, real_packet);
88864}
88865
88866 static inline void init_packet_play_music(struct packet_play_music *packet)
88867{
88868 memset(packet, 0, sizeof(*packet));
88869}
88870
88871#define free_packet_play_music(_packet) (void) 0
88872#define destroy_packet_play_music free
88873
88874#ifdef FREECIV_DELTA_PROTOCOL
88875#define hash_packet_play_music_100 hash_const
88876
88877#define cmp_packet_play_music_100 cmp_const
88878
88879 BV_DEFINE(packet_play_music_100_fields, 1);
88880#endif /* FREECIV_DELTA_PROTOCOL */
88881
88882 static struct packet_play_music *receive_packet_play_music_100(struct connection *pc)
88883{
88884#define FREE_PACKET_STRUCT(_packet) free_packet_play_music(_packet)
88885#ifdef FREECIV_DELTA_PROTOCOL
88886 packet_play_music_100_fields fields;
88887 struct packet_play_music *old;
88888 struct genhash **hash = pc->phs.received + PACKET_PLAY_MUSIC;
88889#endif /* FREECIV_DELTA_PROTOCOL */
88890 RECEIVE_PACKET_START(packet_play_music, real_packet);
88891#ifdef FREECIV_JSON_CONNECTION
88892 struct plocation field_addr;
88893 {
88894 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88895 field_addr = *field_addr_tmp;
88896 FC_FREE(field_addr_tmp);
88897 }
88898#endif /* FREECIV_JSON_CONNECTION */
88899
88900#ifdef FREECIV_DELTA_PROTOCOL
88901#ifdef FREECIV_JSON_CONNECTION
88902 field_addr.name = "fields";
88903#endif /* FREECIV_JSON_CONNECTION */
88904 DIO_BV_GET(&din, &field_addr, fields);
88905
88906#else /* FREECIV_DELTA_PROTOCOL */
88907#ifdef FREECIV_JSON_CONNECTION
88908 field_addr.name = "tag";
88909#endif /* FREECIV_JSON_CONNECTION */
88910 if (!DIO_GET(string, &din, &field_addr, real_packet->tag, sizeof(real_packet->tag))) {
88911 RECEIVE_PACKET_FIELD_ERROR(tag);
88912 }
88913#endif
88914 log_packet_detailed("packet_play_music_100: got info about ()");
88915
88916#ifdef FREECIV_DELTA_PROTOCOL
88917 if (nullptr == *hash) {
88918 *hash = genhash_new_full(hash_packet_play_music_100, cmp_packet_play_music_100,
88919 nullptr, nullptr, nullptr, destroy_packet_play_music);
88920 }
88921
88922 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
88923 *real_packet = *old;
88924 } else {
88925 /* packet is already initialized empty */
88926 log_packet_detailed(" no old info");
88927 }
88928
88929 if (BV_ISSET(fields, 0)) {
88930 log_packet_detailed(" got field 'tag'");
88931#ifdef FREECIV_JSON_CONNECTION
88932 field_addr.name = "tag";
88933#endif /* FREECIV_JSON_CONNECTION */
88934 if (!DIO_GET(string, &din, &field_addr, real_packet->tag, sizeof(real_packet->tag))) {
88935 RECEIVE_PACKET_FIELD_ERROR(tag);
88936 }
88937 }
88938
88939 if (nullptr == old) {
88940 old = fc_malloc(sizeof(*old));
88941 init_packet_play_music(old);
88942 *old = *real_packet;
88943 genhash_insert(*hash, old, old);
88944 } else {
88945 *old = *real_packet;
88946 }
88947
88948#endif /* FREECIV_DELTA_PROTOCOL */
88949 RECEIVE_PACKET_END(real_packet);
88950#undef FREE_PACKET_STRUCT
88951}
88952
88953 static int send_packet_play_music_100(struct connection *pc, const struct packet_play_music *packet)
88954{
88955 const struct packet_play_music *real_packet = packet;
88956 int e;
88957#ifdef FREECIV_DELTA_PROTOCOL
88958 packet_play_music_100_fields fields;
88959 struct packet_play_music *old;
88960 bool differ;
88961 struct genhash **hash = pc->phs.sent + PACKET_PLAY_MUSIC;
88962#endif /* FREECIV_DELTA_PROTOCOL */
88963 SEND_PACKET_START(PACKET_PLAY_MUSIC);
88964#ifdef FREECIV_JSON_CONNECTION
88965 struct plocation field_addr;
88966 {
88967 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
88968 field_addr = *field_addr_tmp;
88969 FC_FREE(field_addr_tmp);
88970 }
88971#endif /* FREECIV_JSON_CONNECTION */
88972
88973 log_packet_detailed("packet_play_music_100: sending info about ()");
88974
88975#ifdef FREECIV_DELTA_PROTOCOL
88976 if (nullptr == *hash) {
88977 *hash = genhash_new_full(hash_packet_play_music_100, cmp_packet_play_music_100,
88978 nullptr, nullptr, nullptr, destroy_packet_play_music);
88979 }
88980 BV_CLR_ALL(fields);
88981
88982 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
88983 old = fc_malloc(sizeof(*old));
88984 /* temporary bitcopy just to insert correctly */
88985 *old = *real_packet;
88986 genhash_insert(*hash, old, old);
88987 init_packet_play_music(old);
88988 }
88989 differ = (strcmp(old->tag, real_packet->tag) != 0);
88990 if (differ) {
88991 BV_SET(fields, 0);
88992 }
88993
88994
88995#ifdef FREECIV_JSON_CONNECTION
88996 field_addr.name = "fields";
88997#endif /* FREECIV_JSON_CONNECTION */
88998 e = 0;
88999 e |= DIO_BV_PUT(&dout, &field_addr, fields);
89000 if (e) {
89001 log_packet_detailed("fields bitvector error detected");
89002 }
89003
89004 if (BV_ISSET(fields, 0)) {
89005 log_packet_detailed(" field 'tag' has changed");
89006#ifdef FREECIV_JSON_CONNECTION
89007 field_addr.name = "tag";
89008#endif /* FREECIV_JSON_CONNECTION */
89009 e = 0;
89010 e |= DIO_PUT(string, &dout, &field_addr, real_packet->tag);
89011 if (e) {
89012 log_packet_detailed("'tag' field error detected");
89013 }
89014 }
89015
89016 *old = *real_packet;
89017#endif /* FREECIV_DELTA_PROTOCOL */
89018#ifndef FREECIV_DELTA_PROTOCOL
89019#ifdef FREECIV_JSON_CONNECTION
89020 field_addr.name = "tag";
89021#endif /* FREECIV_JSON_CONNECTION */
89022 e = 0;
89023 e |= DIO_PUT(string, &dout, &field_addr, real_packet->tag);
89024 if (e) {
89025 log_packet_detailed("'tag' field error detected");
89026 }
89027
89028#endif
89029 SEND_PACKET_END(PACKET_PLAY_MUSIC);
89030}
89031
89032 int send_packet_play_music(struct connection *pc, const struct packet_play_music *packet)
89033{
89034 if (!pc->used) {
89035 log_error("WARNING: trying to send data to the closed connection %s",
89036 conn_description(pc));
89037 return -1;
89038 }
89039 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAY_MUSIC].packet != nullptr, -1,
89040 "Handler for PACKET_PLAY_MUSIC not installed");
89041 return pc->phs.handlers->send[PACKET_PLAY_MUSIC].packet(pc, packet);
89042}
89043
89044 void lsend_packet_play_music(struct conn_list *dest, const struct packet_play_music *packet)
89045{
89046 conn_list_iterate(dest, pconn) {
89047 send_packet_play_music(pconn, packet);
89048 } conn_list_iterate_end;
89049}
89050
89051 static inline void init_packet_web_city_info_addition(struct packet_web_city_info_addition *packet)
89052{
89053 memset(packet, 0, sizeof(*packet));
89054}
89055
89056#define free_packet_web_city_info_addition(_packet) (void) 0
89057#define destroy_packet_web_city_info_addition free
89058
89059#ifdef FREECIV_DELTA_PROTOCOL
89060static genhash_val_t hash_packet_web_city_info_addition_100(const void *vkey)
89061{
89062 const struct packet_web_city_info_addition *key = (const struct packet_web_city_info_addition *) vkey;
89063 genhash_val_t result = 0;
89064
89065 result += key->id;
89066
89067 result &= 0xFFFFFFFF;
89068 return result;
89069}
89070
89071static bool cmp_packet_web_city_info_addition_100(const void *vkey1, const void *vkey2)
89072{
89073 const struct packet_web_city_info_addition *old = (const struct packet_web_city_info_addition *) vkey1;
89074 const struct packet_web_city_info_addition *real_packet = (const struct packet_web_city_info_addition *) vkey2;
89075 bool differ;
89076
89077 differ = (old->id != real_packet->id);
89078
89079 return !differ;
89080}
89081 BV_DEFINE(packet_web_city_info_addition_100_fields, 9);
89082#endif /* FREECIV_DELTA_PROTOCOL */
89083
89084 static struct packet_web_city_info_addition *receive_packet_web_city_info_addition_100(struct connection *pc)
89085{
89086#define FREE_PACKET_STRUCT(_packet) free_packet_web_city_info_addition(_packet)
89087#ifdef FREECIV_DELTA_PROTOCOL
89088 packet_web_city_info_addition_100_fields fields;
89089 struct packet_web_city_info_addition *old;
89090 struct genhash **hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
89091#endif /* FREECIV_DELTA_PROTOCOL */
89092 RECEIVE_PACKET_START(packet_web_city_info_addition, real_packet);
89093#ifdef FREECIV_JSON_CONNECTION
89094 struct plocation field_addr;
89095 {
89096 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
89097 field_addr = *field_addr_tmp;
89098 FC_FREE(field_addr_tmp);
89099 }
89100#endif /* FREECIV_JSON_CONNECTION */
89101
89102#ifdef FREECIV_DELTA_PROTOCOL
89103#ifdef FREECIV_JSON_CONNECTION
89104 field_addr.name = "fields";
89105#endif /* FREECIV_JSON_CONNECTION */
89106 DIO_BV_GET(&din, &field_addr, fields);
89107#ifdef FREECIV_JSON_CONNECTION
89108 field_addr.name = "id";
89109#endif /* FREECIV_JSON_CONNECTION */
89110 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
89111 RECEIVE_PACKET_FIELD_ERROR(id);
89112 }
89113
89114#else /* FREECIV_DELTA_PROTOCOL */
89115#ifdef FREECIV_JSON_CONNECTION
89116 field_addr.name = "id";
89117#endif /* FREECIV_JSON_CONNECTION */
89118 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
89119 RECEIVE_PACKET_FIELD_ERROR(id);
89120 }
89121#ifdef FREECIV_JSON_CONNECTION
89122 field_addr.name = "cma_enabled";
89123#endif /* FREECIV_JSON_CONNECTION */
89124 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->cma_enabled)) {
89125 RECEIVE_PACKET_FIELD_ERROR(cma_enabled);
89126 }
89127#ifdef FREECIV_JSON_CONNECTION
89128 field_addr.name = "cm_parameter";
89129#endif /* FREECIV_JSON_CONNECTION */
89130 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
89131 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
89132 }
89133#ifdef FREECIV_JSON_CONNECTION
89134 field_addr.name = "granary_size";
89135#endif /* FREECIV_JSON_CONNECTION */
89136 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
89137 RECEIVE_PACKET_FIELD_ERROR(granary_size);
89138 }
89139#ifdef FREECIV_JSON_CONNECTION
89140 field_addr.name = "granary_turns";
89141#endif /* FREECIV_JSON_CONNECTION */
89142 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
89143 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
89144 }
89145#ifdef FREECIV_JSON_CONNECTION
89146 field_addr.name = "can_build_unit";
89147#endif /* FREECIV_JSON_CONNECTION */
89148 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_unit)) {
89149 RECEIVE_PACKET_FIELD_ERROR(can_build_unit);
89150 }
89151#ifdef FREECIV_JSON_CONNECTION
89152 field_addr.name = "can_build_improvement";
89153#endif /* FREECIV_JSON_CONNECTION */
89154 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_improvement)) {
89155 RECEIVE_PACKET_FIELD_ERROR(can_build_improvement);
89156 }
89157#ifdef FREECIV_JSON_CONNECTION
89158 field_addr.name = "output_food";
89159#endif /* FREECIV_JSON_CONNECTION */
89160 {
89161 int i;
89162
89163#ifdef FREECIV_JSON_CONNECTION
89164 /* Enter array. */
89165 field_addr.sub_location = plocation_elem_new(0);
89166#endif /* FREECIV_JSON_CONNECTION */
89167
89168 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89169#ifdef FREECIV_JSON_CONNECTION
89170 field_addr.sub_location->number = i;
89171#endif /* FREECIV_JSON_CONNECTION */
89172 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_food[i])) {
89173 RECEIVE_PACKET_FIELD_ERROR(output_food);
89174 }
89175 }
89176
89177#ifdef FREECIV_JSON_CONNECTION
89178 /* Exit array. */
89179 FC_FREE(field_addr.sub_location);
89180#endif /* FREECIV_JSON_CONNECTION */
89181 }
89182#ifdef FREECIV_JSON_CONNECTION
89183 field_addr.name = "output_shield";
89184#endif /* FREECIV_JSON_CONNECTION */
89185 {
89186 int i;
89187
89188#ifdef FREECIV_JSON_CONNECTION
89189 /* Enter array. */
89190 field_addr.sub_location = plocation_elem_new(0);
89191#endif /* FREECIV_JSON_CONNECTION */
89192
89193 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89194#ifdef FREECIV_JSON_CONNECTION
89195 field_addr.sub_location->number = i;
89196#endif /* FREECIV_JSON_CONNECTION */
89197 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_shield[i])) {
89198 RECEIVE_PACKET_FIELD_ERROR(output_shield);
89199 }
89200 }
89201
89202#ifdef FREECIV_JSON_CONNECTION
89203 /* Exit array. */
89204 FC_FREE(field_addr.sub_location);
89205#endif /* FREECIV_JSON_CONNECTION */
89206 }
89207#ifdef FREECIV_JSON_CONNECTION
89208 field_addr.name = "output_trade";
89209#endif /* FREECIV_JSON_CONNECTION */
89210 {
89211 int i;
89212
89213#ifdef FREECIV_JSON_CONNECTION
89214 /* Enter array. */
89215 field_addr.sub_location = plocation_elem_new(0);
89216#endif /* FREECIV_JSON_CONNECTION */
89217
89218 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89219#ifdef FREECIV_JSON_CONNECTION
89220 field_addr.sub_location->number = i;
89221#endif /* FREECIV_JSON_CONNECTION */
89222 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_trade[i])) {
89223 RECEIVE_PACKET_FIELD_ERROR(output_trade);
89224 }
89225 }
89226
89227#ifdef FREECIV_JSON_CONNECTION
89228 /* Exit array. */
89229 FC_FREE(field_addr.sub_location);
89230#endif /* FREECIV_JSON_CONNECTION */
89231 }
89232#endif
89233 log_packet_detailed("packet_web_city_info_addition_100: got info about (%d)",
89234 real_packet->id);
89235
89236#ifdef FREECIV_DELTA_PROTOCOL
89237 if (nullptr == *hash) {
89238 *hash = genhash_new_full(hash_packet_web_city_info_addition_100, cmp_packet_web_city_info_addition_100,
89239 nullptr, nullptr, nullptr, destroy_packet_web_city_info_addition);
89240 }
89241
89242 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
89243 *real_packet = *old;
89244 } else {
89245 /* packet is already initialized empty */
89246 log_packet_detailed(" no old info");
89247 }
89248
89249 real_packet->cma_enabled = BV_ISSET(fields, 0);
89250 if (BV_ISSET(fields, 1)) {
89251 log_packet_detailed(" got field 'cm_parameter'");
89252#ifdef FREECIV_JSON_CONNECTION
89253 field_addr.name = "cm_parameter";
89254#endif /* FREECIV_JSON_CONNECTION */
89255 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
89256 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
89257 }
89258 }
89259 if (BV_ISSET(fields, 2)) {
89260 log_packet_detailed(" got field 'granary_size'");
89261#ifdef FREECIV_JSON_CONNECTION
89262 field_addr.name = "granary_size";
89263#endif /* FREECIV_JSON_CONNECTION */
89264 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
89265 RECEIVE_PACKET_FIELD_ERROR(granary_size);
89266 }
89267 }
89268 if (BV_ISSET(fields, 3)) {
89269 log_packet_detailed(" got field 'granary_turns'");
89270#ifdef FREECIV_JSON_CONNECTION
89271 field_addr.name = "granary_turns";
89272#endif /* FREECIV_JSON_CONNECTION */
89273 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
89274 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
89275 }
89276 }
89277 if (BV_ISSET(fields, 4)) {
89278 log_packet_detailed(" got field 'can_build_unit'");
89279#ifdef FREECIV_JSON_CONNECTION
89280 field_addr.name = "can_build_unit";
89281#endif /* FREECIV_JSON_CONNECTION */
89282 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_unit)) {
89283 RECEIVE_PACKET_FIELD_ERROR(can_build_unit);
89284 }
89285 }
89286 if (BV_ISSET(fields, 5)) {
89287 log_packet_detailed(" got field 'can_build_improvement'");
89288#ifdef FREECIV_JSON_CONNECTION
89289 field_addr.name = "can_build_improvement";
89290#endif /* FREECIV_JSON_CONNECTION */
89291 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_improvement)) {
89292 RECEIVE_PACKET_FIELD_ERROR(can_build_improvement);
89293 }
89294 }
89295 if (BV_ISSET(fields, 6)) {
89296 log_packet_detailed(" got field 'output_food'");
89297#ifdef FREECIV_JSON_CONNECTION
89298 field_addr.name = "output_food";
89299#endif /* FREECIV_JSON_CONNECTION */
89300 {
89301 int i;
89302
89303#ifdef FREECIV_JSON_CONNECTION
89304 /* Enter array. */
89305 field_addr.sub_location = plocation_elem_new(0);
89306#endif /* FREECIV_JSON_CONNECTION */
89307
89308 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89309#ifdef FREECIV_JSON_CONNECTION
89310 field_addr.sub_location->number = i;
89311#endif /* FREECIV_JSON_CONNECTION */
89312 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_food[i])) {
89313 RECEIVE_PACKET_FIELD_ERROR(output_food);
89314 }
89315 }
89316
89317#ifdef FREECIV_JSON_CONNECTION
89318 /* Exit array. */
89319 FC_FREE(field_addr.sub_location);
89320#endif /* FREECIV_JSON_CONNECTION */
89321 }
89322 }
89323 if (BV_ISSET(fields, 7)) {
89324 log_packet_detailed(" got field 'output_shield'");
89325#ifdef FREECIV_JSON_CONNECTION
89326 field_addr.name = "output_shield";
89327#endif /* FREECIV_JSON_CONNECTION */
89328 {
89329 int i;
89330
89331#ifdef FREECIV_JSON_CONNECTION
89332 /* Enter array. */
89333 field_addr.sub_location = plocation_elem_new(0);
89334#endif /* FREECIV_JSON_CONNECTION */
89335
89336 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89337#ifdef FREECIV_JSON_CONNECTION
89338 field_addr.sub_location->number = i;
89339#endif /* FREECIV_JSON_CONNECTION */
89340 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_shield[i])) {
89341 RECEIVE_PACKET_FIELD_ERROR(output_shield);
89342 }
89343 }
89344
89345#ifdef FREECIV_JSON_CONNECTION
89346 /* Exit array. */
89347 FC_FREE(field_addr.sub_location);
89348#endif /* FREECIV_JSON_CONNECTION */
89349 }
89350 }
89351 if (BV_ISSET(fields, 8)) {
89352 log_packet_detailed(" got field 'output_trade'");
89353#ifdef FREECIV_JSON_CONNECTION
89354 field_addr.name = "output_trade";
89355#endif /* FREECIV_JSON_CONNECTION */
89356 {
89357 int i;
89358
89359#ifdef FREECIV_JSON_CONNECTION
89360 /* Enter array. */
89361 field_addr.sub_location = plocation_elem_new(0);
89362#endif /* FREECIV_JSON_CONNECTION */
89363
89364 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89365#ifdef FREECIV_JSON_CONNECTION
89366 field_addr.sub_location->number = i;
89367#endif /* FREECIV_JSON_CONNECTION */
89368 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_trade[i])) {
89369 RECEIVE_PACKET_FIELD_ERROR(output_trade);
89370 }
89371 }
89372
89373#ifdef FREECIV_JSON_CONNECTION
89374 /* Exit array. */
89375 FC_FREE(field_addr.sub_location);
89376#endif /* FREECIV_JSON_CONNECTION */
89377 }
89378 }
89379
89380 if (nullptr == old) {
89381 old = fc_malloc(sizeof(*old));
89382 init_packet_web_city_info_addition(old);
89383 *old = *real_packet;
89384 genhash_insert(*hash, old, old);
89385 } else {
89386 *old = *real_packet;
89387 }
89388
89389 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
89390 if (nullptr != *hash) {
89391 genhash_remove(*hash, real_packet);
89392 }
89393
89394#endif /* FREECIV_DELTA_PROTOCOL */
89395 RECEIVE_PACKET_END(real_packet);
89396#undef FREE_PACKET_STRUCT
89397}
89398
89399 static int send_packet_web_city_info_addition_100(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
89400{
89401 const struct packet_web_city_info_addition *real_packet = packet;
89402 int e;
89403#ifdef FREECIV_DELTA_PROTOCOL
89404 packet_web_city_info_addition_100_fields fields;
89405 struct packet_web_city_info_addition *old;
89406 bool differ;
89407 struct genhash **hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
89408 int different = force_to_send;
89409#endif /* FREECIV_DELTA_PROTOCOL */
89410 SEND_PACKET_START(PACKET_WEB_CITY_INFO_ADDITION);
89411#ifdef FREECIV_JSON_CONNECTION
89412 struct plocation field_addr;
89413 {
89414 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
89415 field_addr = *field_addr_tmp;
89416 FC_FREE(field_addr_tmp);
89417 }
89418#endif /* FREECIV_JSON_CONNECTION */
89419
89420 log_packet_detailed("packet_web_city_info_addition_100: sending info about (%d)",
89421 real_packet->id);
89422
89423#ifdef FREECIV_DELTA_PROTOCOL
89424 if (nullptr == *hash) {
89425 *hash = genhash_new_full(hash_packet_web_city_info_addition_100, cmp_packet_web_city_info_addition_100,
89426 nullptr, nullptr, nullptr, destroy_packet_web_city_info_addition);
89427 }
89428 BV_CLR_ALL(fields);
89429
89430 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
89431 old = fc_malloc(sizeof(*old));
89432 /* temporary bitcopy just to insert correctly */
89433 *old = *real_packet;
89434 genhash_insert(*hash, old, old);
89435 init_packet_web_city_info_addition(old);
89436 different = 1; /* Force to send. */
89437 }
89438 differ = (old->cma_enabled != real_packet->cma_enabled);
89439 if (differ) {
89440 different++;
89441 }
89442 if (packet->cma_enabled) {
89443 BV_SET(fields, 0);
89444 }
89445
89446 differ = !cm_are_parameter_equal(&old->cm_parameter, &real_packet->cm_parameter);
89447 if (differ) {
89448 different++;
89449 BV_SET(fields, 1);
89450 }
89451
89452 differ = (old->granary_size != real_packet->granary_size);
89453 if (differ) {
89454 different++;
89455 BV_SET(fields, 2);
89456 }
89457
89458 differ = (old->granary_turns != real_packet->granary_turns);
89459 if (differ) {
89460 different++;
89461 BV_SET(fields, 3);
89462 }
89463
89464 differ = !BV_ARE_EQUAL(old->can_build_unit, real_packet->can_build_unit);
89465 if (differ) {
89466 different++;
89467 BV_SET(fields, 4);
89468 }
89469
89470 differ = !BV_ARE_EQUAL(old->can_build_improvement, real_packet->can_build_improvement);
89471 if (differ) {
89472 different++;
89473 BV_SET(fields, 5);
89474 }
89475
89476 differ = FALSE;
89477 {
89478 int i;
89479
89480 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89481 differ = (old->output_food[i] != real_packet->output_food[i]);
89482 if (differ) {
89483 break;
89484 }
89485 }
89486 }
89487 if (differ) {
89488 different++;
89489 BV_SET(fields, 6);
89490 }
89491
89492 differ = FALSE;
89493 {
89494 int i;
89495
89496 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89497 differ = (old->output_shield[i] != real_packet->output_shield[i]);
89498 if (differ) {
89499 break;
89500 }
89501 }
89502 }
89503 if (differ) {
89504 different++;
89505 BV_SET(fields, 7);
89506 }
89507
89508 differ = FALSE;
89509 {
89510 int i;
89511
89512 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89513 differ = (old->output_trade[i] != real_packet->output_trade[i]);
89514 if (differ) {
89515 break;
89516 }
89517 }
89518 }
89519 if (differ) {
89520 different++;
89521 BV_SET(fields, 8);
89522 }
89523
89524 if (different == 0) {
89525 log_packet_detailed(" no change -> discard");
89526 return 0;
89527 }
89528
89529#ifdef FREECIV_JSON_CONNECTION
89530 field_addr.name = "fields";
89531#endif /* FREECIV_JSON_CONNECTION */
89532 e = 0;
89533 e |= DIO_BV_PUT(&dout, &field_addr, fields);
89534 if (e) {
89535 log_packet_detailed("fields bitvector error detected");
89536 }
89537#ifdef FREECIV_JSON_CONNECTION
89538 field_addr.name = "id";
89539#endif /* FREECIV_JSON_CONNECTION */
89540 e = 0;
89541 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
89542 if (e) {
89543 log_packet_detailed("'id' field error detected");
89544 }
89545
89546 /* field 0 is folded into the header */
89547 if (BV_ISSET(fields, 1)) {
89548 log_packet_detailed(" field 'cm_parameter' has changed");
89549#ifdef FREECIV_JSON_CONNECTION
89550 field_addr.name = "cm_parameter";
89551#endif /* FREECIV_JSON_CONNECTION */
89552 e = 0;
89553 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
89554 if (e) {
89555 log_packet_detailed("'cm_parameter' field error detected");
89556 }
89557 }
89558 if (BV_ISSET(fields, 2)) {
89559 log_packet_detailed(" field 'granary_size' has changed");
89560#ifdef FREECIV_JSON_CONNECTION
89561 field_addr.name = "granary_size";
89562#endif /* FREECIV_JSON_CONNECTION */
89563 e = 0;
89564 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
89565 if (e) {
89566 log_packet_detailed("'granary_size' field error detected");
89567 }
89568 }
89569 if (BV_ISSET(fields, 3)) {
89570 log_packet_detailed(" field 'granary_turns' has changed");
89571#ifdef FREECIV_JSON_CONNECTION
89572 field_addr.name = "granary_turns";
89573#endif /* FREECIV_JSON_CONNECTION */
89574 e = 0;
89575 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
89576 if (e) {
89577 log_packet_detailed("'granary_turns' field error detected");
89578 }
89579 }
89580 if (BV_ISSET(fields, 4)) {
89581 log_packet_detailed(" field 'can_build_unit' has changed");
89582#ifdef FREECIV_JSON_CONNECTION
89583 field_addr.name = "can_build_unit";
89584#endif /* FREECIV_JSON_CONNECTION */
89585 e = 0;
89586 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_unit);
89587 if (e) {
89588 log_packet_detailed("'can_build_unit' field error detected");
89589 }
89590 }
89591 if (BV_ISSET(fields, 5)) {
89592 log_packet_detailed(" field 'can_build_improvement' has changed");
89593#ifdef FREECIV_JSON_CONNECTION
89594 field_addr.name = "can_build_improvement";
89595#endif /* FREECIV_JSON_CONNECTION */
89596 e = 0;
89597 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_improvement);
89598 if (e) {
89599 log_packet_detailed("'can_build_improvement' field error detected");
89600 }
89601 }
89602 if (BV_ISSET(fields, 6)) {
89603 log_packet_detailed(" field 'output_food' has changed");
89604#ifdef FREECIV_JSON_CONNECTION
89605 field_addr.name = "output_food";
89606#endif /* FREECIV_JSON_CONNECTION */
89607 e = 0;
89608 {
89609 int i;
89610
89611#ifdef FREECIV_JSON_CONNECTION
89612 /* Create the array. */
89613 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
89614
89615 /* Enter the array. */
89616 field_addr.sub_location = plocation_elem_new(0);
89617#endif /* FREECIV_JSON_CONNECTION */
89618
89619 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89620#ifdef FREECIV_JSON_CONNECTION
89621 /* Next array element. */
89622 field_addr.sub_location->number = i;
89623#endif /* FREECIV_JSON_CONNECTION */
89624 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_food[i]);
89625 }
89626
89627#ifdef FREECIV_JSON_CONNECTION
89628 /* Exit array. */
89629 FC_FREE(field_addr.sub_location);
89630#endif /* FREECIV_JSON_CONNECTION */
89631 }
89632 if (e) {
89633 log_packet_detailed("'output_food' field error detected");
89634 }
89635 }
89636 if (BV_ISSET(fields, 7)) {
89637 log_packet_detailed(" field 'output_shield' has changed");
89638#ifdef FREECIV_JSON_CONNECTION
89639 field_addr.name = "output_shield";
89640#endif /* FREECIV_JSON_CONNECTION */
89641 e = 0;
89642 {
89643 int i;
89644
89645#ifdef FREECIV_JSON_CONNECTION
89646 /* Create the array. */
89647 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
89648
89649 /* Enter the array. */
89650 field_addr.sub_location = plocation_elem_new(0);
89651#endif /* FREECIV_JSON_CONNECTION */
89652
89653 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89654#ifdef FREECIV_JSON_CONNECTION
89655 /* Next array element. */
89656 field_addr.sub_location->number = i;
89657#endif /* FREECIV_JSON_CONNECTION */
89658 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_shield[i]);
89659 }
89660
89661#ifdef FREECIV_JSON_CONNECTION
89662 /* Exit array. */
89663 FC_FREE(field_addr.sub_location);
89664#endif /* FREECIV_JSON_CONNECTION */
89665 }
89666 if (e) {
89667 log_packet_detailed("'output_shield' field error detected");
89668 }
89669 }
89670 if (BV_ISSET(fields, 8)) {
89671 log_packet_detailed(" field 'output_trade' has changed");
89672#ifdef FREECIV_JSON_CONNECTION
89673 field_addr.name = "output_trade";
89674#endif /* FREECIV_JSON_CONNECTION */
89675 e = 0;
89676 {
89677 int i;
89678
89679#ifdef FREECIV_JSON_CONNECTION
89680 /* Create the array. */
89681 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
89682
89683 /* Enter the array. */
89684 field_addr.sub_location = plocation_elem_new(0);
89685#endif /* FREECIV_JSON_CONNECTION */
89686
89687 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89688#ifdef FREECIV_JSON_CONNECTION
89689 /* Next array element. */
89690 field_addr.sub_location->number = i;
89691#endif /* FREECIV_JSON_CONNECTION */
89692 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_trade[i]);
89693 }
89694
89695#ifdef FREECIV_JSON_CONNECTION
89696 /* Exit array. */
89697 FC_FREE(field_addr.sub_location);
89698#endif /* FREECIV_JSON_CONNECTION */
89699 }
89700 if (e) {
89701 log_packet_detailed("'output_trade' field error detected");
89702 }
89703 }
89704
89705 *old = *real_packet;
89706
89707 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
89708 if (nullptr != *hash) {
89709 genhash_remove(*hash, real_packet);
89710 }
89711#endif /* FREECIV_DELTA_PROTOCOL */
89712#ifndef FREECIV_DELTA_PROTOCOL
89713#ifdef FREECIV_JSON_CONNECTION
89714 field_addr.name = "id";
89715#endif /* FREECIV_JSON_CONNECTION */
89716 e = 0;
89717 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
89718 if (e) {
89719 log_packet_detailed("'id' field error detected");
89720 }
89721#ifdef FREECIV_JSON_CONNECTION
89722 field_addr.name = "cma_enabled";
89723#endif /* FREECIV_JSON_CONNECTION */
89724 e = 0;
89725 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->cma_enabled);
89726 if (e) {
89727 log_packet_detailed("'cma_enabled' field error detected");
89728 }
89729#ifdef FREECIV_JSON_CONNECTION
89730 field_addr.name = "cm_parameter";
89731#endif /* FREECIV_JSON_CONNECTION */
89732 e = 0;
89733 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
89734 if (e) {
89735 log_packet_detailed("'cm_parameter' field error detected");
89736 }
89737#ifdef FREECIV_JSON_CONNECTION
89738 field_addr.name = "granary_size";
89739#endif /* FREECIV_JSON_CONNECTION */
89740 e = 0;
89741 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
89742 if (e) {
89743 log_packet_detailed("'granary_size' field error detected");
89744 }
89745#ifdef FREECIV_JSON_CONNECTION
89746 field_addr.name = "granary_turns";
89747#endif /* FREECIV_JSON_CONNECTION */
89748 e = 0;
89749 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
89750 if (e) {
89751 log_packet_detailed("'granary_turns' field error detected");
89752 }
89753#ifdef FREECIV_JSON_CONNECTION
89754 field_addr.name = "can_build_unit";
89755#endif /* FREECIV_JSON_CONNECTION */
89756 e = 0;
89757 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_unit);
89758 if (e) {
89759 log_packet_detailed("'can_build_unit' field error detected");
89760 }
89761#ifdef FREECIV_JSON_CONNECTION
89762 field_addr.name = "can_build_improvement";
89763#endif /* FREECIV_JSON_CONNECTION */
89764 e = 0;
89765 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_improvement);
89766 if (e) {
89767 log_packet_detailed("'can_build_improvement' field error detected");
89768 }
89769#ifdef FREECIV_JSON_CONNECTION
89770 field_addr.name = "output_food";
89771#endif /* FREECIV_JSON_CONNECTION */
89772 e = 0;
89773 {
89774 int i;
89775
89776#ifdef FREECIV_JSON_CONNECTION
89777 /* Create the array. */
89778 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
89779
89780 /* Enter the array. */
89781 field_addr.sub_location = plocation_elem_new(0);
89782#endif /* FREECIV_JSON_CONNECTION */
89783
89784 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89785#ifdef FREECIV_JSON_CONNECTION
89786 /* Next array element. */
89787 field_addr.sub_location->number = i;
89788#endif /* FREECIV_JSON_CONNECTION */
89789 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_food[i]);
89790 }
89791
89792#ifdef FREECIV_JSON_CONNECTION
89793 /* Exit array. */
89794 FC_FREE(field_addr.sub_location);
89795#endif /* FREECIV_JSON_CONNECTION */
89796 }
89797 if (e) {
89798 log_packet_detailed("'output_food' field error detected");
89799 }
89800#ifdef FREECIV_JSON_CONNECTION
89801 field_addr.name = "output_shield";
89802#endif /* FREECIV_JSON_CONNECTION */
89803 e = 0;
89804 {
89805 int i;
89806
89807#ifdef FREECIV_JSON_CONNECTION
89808 /* Create the array. */
89809 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
89810
89811 /* Enter the array. */
89812 field_addr.sub_location = plocation_elem_new(0);
89813#endif /* FREECIV_JSON_CONNECTION */
89814
89815 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89816#ifdef FREECIV_JSON_CONNECTION
89817 /* Next array element. */
89818 field_addr.sub_location->number = i;
89819#endif /* FREECIV_JSON_CONNECTION */
89820 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_shield[i]);
89821 }
89822
89823#ifdef FREECIV_JSON_CONNECTION
89824 /* Exit array. */
89825 FC_FREE(field_addr.sub_location);
89826#endif /* FREECIV_JSON_CONNECTION */
89827 }
89828 if (e) {
89829 log_packet_detailed("'output_shield' field error detected");
89830 }
89831#ifdef FREECIV_JSON_CONNECTION
89832 field_addr.name = "output_trade";
89833#endif /* FREECIV_JSON_CONNECTION */
89834 e = 0;
89835 {
89836 int i;
89837
89838#ifdef FREECIV_JSON_CONNECTION
89839 /* Create the array. */
89840 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
89841
89842 /* Enter the array. */
89843 field_addr.sub_location = plocation_elem_new(0);
89844#endif /* FREECIV_JSON_CONNECTION */
89845
89846 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
89847#ifdef FREECIV_JSON_CONNECTION
89848 /* Next array element. */
89849 field_addr.sub_location->number = i;
89850#endif /* FREECIV_JSON_CONNECTION */
89851 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_trade[i]);
89852 }
89853
89854#ifdef FREECIV_JSON_CONNECTION
89855 /* Exit array. */
89856 FC_FREE(field_addr.sub_location);
89857#endif /* FREECIV_JSON_CONNECTION */
89858 }
89859 if (e) {
89860 log_packet_detailed("'output_trade' field error detected");
89861 }
89862
89863#endif
89864 SEND_PACKET_END(PACKET_WEB_CITY_INFO_ADDITION);
89865}
89866
89867 int send_packet_web_city_info_addition(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
89868{
89869 if (!pc->used) {
89870 log_error("WARNING: trying to send data to the closed connection %s",
89871 conn_description(pc));
89872 return -1;
89873 }
89874 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send != nullptr, -1,
89875 "Handler for PACKET_WEB_CITY_INFO_ADDITION not installed");
89876 return pc->phs.handlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send(pc, packet, force_to_send);
89877}
89878
89879 void lsend_packet_web_city_info_addition(struct conn_list *dest, const struct packet_web_city_info_addition *packet, bool force_to_send)
89880{
89881 conn_list_iterate(dest, pconn) {
89882 send_packet_web_city_info_addition(pconn, packet, force_to_send);
89883 } conn_list_iterate_end;
89884}
89885
89886 static inline void init_packet_web_cma_set(struct packet_web_cma_set *packet)
89887{
89888 memset(packet, 0, sizeof(*packet));
89889}
89890
89891#define free_packet_web_cma_set(_packet) (void) 0
89892#define destroy_packet_web_cma_set free
89893
89894#ifdef FREECIV_DELTA_PROTOCOL
89895static genhash_val_t hash_packet_web_cma_set_100(const void *vkey)
89896{
89897 const struct packet_web_cma_set *key = (const struct packet_web_cma_set *) vkey;
89898 genhash_val_t result = 0;
89899
89900 result += key->id;
89901
89902 result &= 0xFFFFFFFF;
89903 return result;
89904}
89905
89906static bool cmp_packet_web_cma_set_100(const void *vkey1, const void *vkey2)
89907{
89908 const struct packet_web_cma_set *old = (const struct packet_web_cma_set *) vkey1;
89909 const struct packet_web_cma_set *real_packet = (const struct packet_web_cma_set *) vkey2;
89910 bool differ;
89911
89912 differ = (old->id != real_packet->id);
89913
89914 return !differ;
89915}
89916 BV_DEFINE(packet_web_cma_set_100_fields, 1);
89917#endif /* FREECIV_DELTA_PROTOCOL */
89918
89919 static struct packet_web_cma_set *receive_packet_web_cma_set_100(struct connection *pc)
89920{
89921#define FREE_PACKET_STRUCT(_packet) free_packet_web_cma_set(_packet)
89922#ifdef FREECIV_DELTA_PROTOCOL
89923 packet_web_cma_set_100_fields fields;
89924 struct packet_web_cma_set *old;
89925 struct genhash **hash = pc->phs.received + PACKET_WEB_CMA_SET;
89926#endif /* FREECIV_DELTA_PROTOCOL */
89927 RECEIVE_PACKET_START(packet_web_cma_set, real_packet);
89928#ifdef FREECIV_JSON_CONNECTION
89929 struct plocation field_addr;
89930 {
89931 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
89932 field_addr = *field_addr_tmp;
89933 FC_FREE(field_addr_tmp);
89934 }
89935#endif /* FREECIV_JSON_CONNECTION */
89936
89937#ifdef FREECIV_DELTA_PROTOCOL
89938#ifdef FREECIV_JSON_CONNECTION
89939 field_addr.name = "fields";
89940#endif /* FREECIV_JSON_CONNECTION */
89941 DIO_BV_GET(&din, &field_addr, fields);
89942#ifdef FREECIV_JSON_CONNECTION
89943 field_addr.name = "id";
89944#endif /* FREECIV_JSON_CONNECTION */
89945 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
89946 RECEIVE_PACKET_FIELD_ERROR(id);
89947 }
89948
89949#else /* FREECIV_DELTA_PROTOCOL */
89950#ifdef FREECIV_JSON_CONNECTION
89951 field_addr.name = "id";
89952#endif /* FREECIV_JSON_CONNECTION */
89953 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
89954 RECEIVE_PACKET_FIELD_ERROR(id);
89955 }
89956#ifdef FREECIV_JSON_CONNECTION
89957 field_addr.name = "cm_parameter";
89958#endif /* FREECIV_JSON_CONNECTION */
89959 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
89960 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
89961 }
89962#endif
89963 log_packet_detailed("packet_web_cma_set_100: got info about (%d)",
89964 real_packet->id);
89965
89966#ifdef FREECIV_DELTA_PROTOCOL
89967 if (nullptr == *hash) {
89968 *hash = genhash_new_full(hash_packet_web_cma_set_100, cmp_packet_web_cma_set_100,
89969 nullptr, nullptr, nullptr, destroy_packet_web_cma_set);
89970 }
89971
89972 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
89973 *real_packet = *old;
89974 } else {
89975 /* packet is already initialized empty */
89976 log_packet_detailed(" no old info");
89977 }
89978
89979 if (BV_ISSET(fields, 0)) {
89980 log_packet_detailed(" got field 'cm_parameter'");
89981#ifdef FREECIV_JSON_CONNECTION
89982 field_addr.name = "cm_parameter";
89983#endif /* FREECIV_JSON_CONNECTION */
89984 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
89985 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
89986 }
89987 }
89988
89989 if (nullptr == old) {
89990 old = fc_malloc(sizeof(*old));
89991 init_packet_web_cma_set(old);
89992 *old = *real_packet;
89993 genhash_insert(*hash, old, old);
89994 } else {
89995 *old = *real_packet;
89996 }
89997
89998#endif /* FREECIV_DELTA_PROTOCOL */
89999 RECEIVE_PACKET_END(real_packet);
90000#undef FREE_PACKET_STRUCT
90001}
90002
90003 static int send_packet_web_cma_set_100(struct connection *pc, const struct packet_web_cma_set *packet)
90004{
90005 const struct packet_web_cma_set *real_packet = packet;
90006 int e;
90007#ifdef FREECIV_DELTA_PROTOCOL
90008 packet_web_cma_set_100_fields fields;
90009 struct packet_web_cma_set *old;
90010 bool differ;
90011 struct genhash **hash = pc->phs.sent + PACKET_WEB_CMA_SET;
90012#endif /* FREECIV_DELTA_PROTOCOL */
90013 SEND_PACKET_START(PACKET_WEB_CMA_SET);
90014#ifdef FREECIV_JSON_CONNECTION
90015 struct plocation field_addr;
90016 {
90017 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
90018 field_addr = *field_addr_tmp;
90019 FC_FREE(field_addr_tmp);
90020 }
90021#endif /* FREECIV_JSON_CONNECTION */
90022
90023 log_packet_detailed("packet_web_cma_set_100: sending info about (%d)",
90024 real_packet->id);
90025
90026#ifdef FREECIV_DELTA_PROTOCOL
90027 if (nullptr == *hash) {
90028 *hash = genhash_new_full(hash_packet_web_cma_set_100, cmp_packet_web_cma_set_100,
90029 nullptr, nullptr, nullptr, destroy_packet_web_cma_set);
90030 }
90031 BV_CLR_ALL(fields);
90032
90033 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
90034 old = fc_malloc(sizeof(*old));
90035 /* temporary bitcopy just to insert correctly */
90036 *old = *real_packet;
90037 genhash_insert(*hash, old, old);
90038 init_packet_web_cma_set(old);
90039 }
90040 differ = !cm_are_parameter_equal(&old->cm_parameter, &real_packet->cm_parameter);
90041 if (differ) {
90042 BV_SET(fields, 0);
90043 }
90044
90045
90046#ifdef FREECIV_JSON_CONNECTION
90047 field_addr.name = "fields";
90048#endif /* FREECIV_JSON_CONNECTION */
90049 e = 0;
90050 e |= DIO_BV_PUT(&dout, &field_addr, fields);
90051 if (e) {
90052 log_packet_detailed("fields bitvector error detected");
90053 }
90054#ifdef FREECIV_JSON_CONNECTION
90055 field_addr.name = "id";
90056#endif /* FREECIV_JSON_CONNECTION */
90057 e = 0;
90058 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
90059 if (e) {
90060 log_packet_detailed("'id' field error detected");
90061 }
90062
90063 if (BV_ISSET(fields, 0)) {
90064 log_packet_detailed(" field 'cm_parameter' has changed");
90065#ifdef FREECIV_JSON_CONNECTION
90066 field_addr.name = "cm_parameter";
90067#endif /* FREECIV_JSON_CONNECTION */
90068 e = 0;
90069 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
90070 if (e) {
90071 log_packet_detailed("'cm_parameter' field error detected");
90072 }
90073 }
90074
90075 *old = *real_packet;
90076#endif /* FREECIV_DELTA_PROTOCOL */
90077#ifndef FREECIV_DELTA_PROTOCOL
90078#ifdef FREECIV_JSON_CONNECTION
90079 field_addr.name = "id";
90080#endif /* FREECIV_JSON_CONNECTION */
90081 e = 0;
90082 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
90083 if (e) {
90084 log_packet_detailed("'id' field error detected");
90085 }
90086#ifdef FREECIV_JSON_CONNECTION
90087 field_addr.name = "cm_parameter";
90088#endif /* FREECIV_JSON_CONNECTION */
90089 e = 0;
90090 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
90091 if (e) {
90092 log_packet_detailed("'cm_parameter' field error detected");
90093 }
90094
90095#endif
90096 SEND_PACKET_END(PACKET_WEB_CMA_SET);
90097}
90098
90099 int send_packet_web_cma_set(struct connection *pc, const struct packet_web_cma_set *packet)
90100{
90101 if (!pc->used) {
90102 log_error("WARNING: trying to send data to the closed connection %s",
90103 conn_description(pc));
90104 return -1;
90105 }
90106 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_CMA_SET].packet != nullptr, -1,
90107 "Handler for PACKET_WEB_CMA_SET not installed");
90108 return pc->phs.handlers->send[PACKET_WEB_CMA_SET].packet(pc, packet);
90109}
90110
90111 static inline void init_packet_web_cma_clear(struct packet_web_cma_clear *packet)
90112{
90113 memset(packet, 0, sizeof(*packet));
90114}
90115
90116#define free_packet_web_cma_clear(_packet) (void) 0
90117#define destroy_packet_web_cma_clear free
90118
90119#ifdef FREECIV_DELTA_PROTOCOL
90120#define hash_packet_web_cma_clear_100 hash_const
90121
90122#define cmp_packet_web_cma_clear_100 cmp_const
90123
90124 BV_DEFINE(packet_web_cma_clear_100_fields, 1);
90125#endif /* FREECIV_DELTA_PROTOCOL */
90126
90127 static struct packet_web_cma_clear *receive_packet_web_cma_clear_100(struct connection *pc)
90128{
90129#define FREE_PACKET_STRUCT(_packet) free_packet_web_cma_clear(_packet)
90130#ifdef FREECIV_DELTA_PROTOCOL
90131 packet_web_cma_clear_100_fields fields;
90132 struct packet_web_cma_clear *old;
90133 struct genhash **hash = pc->phs.received + PACKET_WEB_CMA_CLEAR;
90134#endif /* FREECIV_DELTA_PROTOCOL */
90135 RECEIVE_PACKET_START(packet_web_cma_clear, real_packet);
90136#ifdef FREECIV_JSON_CONNECTION
90137 struct plocation field_addr;
90138 {
90139 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
90140 field_addr = *field_addr_tmp;
90141 FC_FREE(field_addr_tmp);
90142 }
90143#endif /* FREECIV_JSON_CONNECTION */
90144
90145#ifdef FREECIV_DELTA_PROTOCOL
90146#ifdef FREECIV_JSON_CONNECTION
90147 field_addr.name = "fields";
90148#endif /* FREECIV_JSON_CONNECTION */
90149 DIO_BV_GET(&din, &field_addr, fields);
90150
90151#else /* FREECIV_DELTA_PROTOCOL */
90152#ifdef FREECIV_JSON_CONNECTION
90153 field_addr.name = "id";
90154#endif /* FREECIV_JSON_CONNECTION */
90155 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
90156 RECEIVE_PACKET_FIELD_ERROR(id);
90157 }
90158#endif
90159 log_packet_detailed("packet_web_cma_clear_100: got info about ()");
90160
90161#ifdef FREECIV_DELTA_PROTOCOL
90162 if (nullptr == *hash) {
90163 *hash = genhash_new_full(hash_packet_web_cma_clear_100, cmp_packet_web_cma_clear_100,
90164 nullptr, nullptr, nullptr, destroy_packet_web_cma_clear);
90165 }
90166
90167 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
90168 *real_packet = *old;
90169 } else {
90170 /* packet is already initialized empty */
90171 log_packet_detailed(" no old info");
90172 }
90173
90174 if (BV_ISSET(fields, 0)) {
90175 log_packet_detailed(" got field 'id'");
90176#ifdef FREECIV_JSON_CONNECTION
90177 field_addr.name = "id";
90178#endif /* FREECIV_JSON_CONNECTION */
90179 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
90180 RECEIVE_PACKET_FIELD_ERROR(id);
90181 }
90182 }
90183
90184 if (nullptr == old) {
90185 old = fc_malloc(sizeof(*old));
90186 init_packet_web_cma_clear(old);
90187 *old = *real_packet;
90188 genhash_insert(*hash, old, old);
90189 } else {
90190 *old = *real_packet;
90191 }
90192
90193#endif /* FREECIV_DELTA_PROTOCOL */
90194 RECEIVE_PACKET_END(real_packet);
90195#undef FREE_PACKET_STRUCT
90196}
90197
90198 static int send_packet_web_cma_clear_100(struct connection *pc, const struct packet_web_cma_clear *packet)
90199{
90200 const struct packet_web_cma_clear *real_packet = packet;
90201 int e;
90202#ifdef FREECIV_DELTA_PROTOCOL
90203 packet_web_cma_clear_100_fields fields;
90204 struct packet_web_cma_clear *old;
90205 bool differ;
90206 struct genhash **hash = pc->phs.sent + PACKET_WEB_CMA_CLEAR;
90207#endif /* FREECIV_DELTA_PROTOCOL */
90208 SEND_PACKET_START(PACKET_WEB_CMA_CLEAR);
90209#ifdef FREECIV_JSON_CONNECTION
90210 struct plocation field_addr;
90211 {
90212 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
90213 field_addr = *field_addr_tmp;
90214 FC_FREE(field_addr_tmp);
90215 }
90216#endif /* FREECIV_JSON_CONNECTION */
90217
90218 log_packet_detailed("packet_web_cma_clear_100: sending info about ()");
90219
90220#ifdef FREECIV_DELTA_PROTOCOL
90221 if (nullptr == *hash) {
90222 *hash = genhash_new_full(hash_packet_web_cma_clear_100, cmp_packet_web_cma_clear_100,
90223 nullptr, nullptr, nullptr, destroy_packet_web_cma_clear);
90224 }
90225 BV_CLR_ALL(fields);
90226
90227 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
90228 old = fc_malloc(sizeof(*old));
90229 /* temporary bitcopy just to insert correctly */
90230 *old = *real_packet;
90231 genhash_insert(*hash, old, old);
90232 init_packet_web_cma_clear(old);
90233 }
90234 differ = (old->id != real_packet->id);
90235 if (differ) {
90236 BV_SET(fields, 0);
90237 }
90238
90239
90240#ifdef FREECIV_JSON_CONNECTION
90241 field_addr.name = "fields";
90242#endif /* FREECIV_JSON_CONNECTION */
90243 e = 0;
90244 e |= DIO_BV_PUT(&dout, &field_addr, fields);
90245 if (e) {
90246 log_packet_detailed("fields bitvector error detected");
90247 }
90248
90249 if (BV_ISSET(fields, 0)) {
90250 log_packet_detailed(" field 'id' has changed");
90251#ifdef FREECIV_JSON_CONNECTION
90252 field_addr.name = "id";
90253#endif /* FREECIV_JSON_CONNECTION */
90254 e = 0;
90255 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
90256 if (e) {
90257 log_packet_detailed("'id' field error detected");
90258 }
90259 }
90260
90261 *old = *real_packet;
90262#endif /* FREECIV_DELTA_PROTOCOL */
90263#ifndef FREECIV_DELTA_PROTOCOL
90264#ifdef FREECIV_JSON_CONNECTION
90265 field_addr.name = "id";
90266#endif /* FREECIV_JSON_CONNECTION */
90267 e = 0;
90268 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
90269 if (e) {
90270 log_packet_detailed("'id' field error detected");
90271 }
90272
90273#endif
90274 SEND_PACKET_END(PACKET_WEB_CMA_CLEAR);
90275}
90276
90277 int send_packet_web_cma_clear(struct connection *pc, const struct packet_web_cma_clear *packet)
90278{
90279 if (!pc->used) {
90280 log_error("WARNING: trying to send data to the closed connection %s",
90281 conn_description(pc));
90282 return -1;
90283 }
90284 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_CMA_CLEAR].packet != nullptr, -1,
90285 "Handler for PACKET_WEB_CMA_CLEAR not installed");
90286 return pc->phs.handlers->send[PACKET_WEB_CMA_CLEAR].packet(pc, packet);
90287}
90288
90289 static inline void init_packet_web_player_info_addition(struct packet_web_player_info_addition *packet)
90290{
90291 memset(packet, 0, sizeof(*packet));
90292}
90293
90294#define free_packet_web_player_info_addition(_packet) (void) 0
90295#define destroy_packet_web_player_info_addition free
90296
90297#ifdef FREECIV_DELTA_PROTOCOL
90298static genhash_val_t hash_packet_web_player_info_addition_100(const void *vkey)
90299{
90300 const struct packet_web_player_info_addition *key = (const struct packet_web_player_info_addition *) vkey;
90301 genhash_val_t result = 0;
90302
90303 result += key->playerno;
90304
90305 result &= 0xFFFFFFFF;
90306 return result;
90307}
90308
90309static bool cmp_packet_web_player_info_addition_100(const void *vkey1, const void *vkey2)
90310{
90311 const struct packet_web_player_info_addition *old = (const struct packet_web_player_info_addition *) vkey1;
90312 const struct packet_web_player_info_addition *real_packet = (const struct packet_web_player_info_addition *) vkey2;
90313 bool differ;
90314
90315 differ = (old->playerno != real_packet->playerno);
90316
90317 return !differ;
90318}
90319 BV_DEFINE(packet_web_player_info_addition_100_fields, 1);
90320#endif /* FREECIV_DELTA_PROTOCOL */
90321
90322 static struct packet_web_player_info_addition *receive_packet_web_player_info_addition_100(struct connection *pc)
90323{
90324#define FREE_PACKET_STRUCT(_packet) free_packet_web_player_info_addition(_packet)
90325#ifdef FREECIV_DELTA_PROTOCOL
90326 packet_web_player_info_addition_100_fields fields;
90327 struct packet_web_player_info_addition *old;
90328 struct genhash **hash = pc->phs.received + PACKET_WEB_PLAYER_INFO_ADDITION;
90329#endif /* FREECIV_DELTA_PROTOCOL */
90330 RECEIVE_PACKET_START(packet_web_player_info_addition, real_packet);
90331#ifdef FREECIV_JSON_CONNECTION
90332 struct plocation field_addr;
90333 {
90334 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
90335 field_addr = *field_addr_tmp;
90336 FC_FREE(field_addr_tmp);
90337 }
90338#endif /* FREECIV_JSON_CONNECTION */
90339
90340#ifdef FREECIV_DELTA_PROTOCOL
90341#ifdef FREECIV_JSON_CONNECTION
90342 field_addr.name = "fields";
90343#endif /* FREECIV_JSON_CONNECTION */
90344 DIO_BV_GET(&din, &field_addr, fields);
90345#ifdef FREECIV_JSON_CONNECTION
90346 field_addr.name = "playerno";
90347#endif /* FREECIV_JSON_CONNECTION */
90348 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->playerno)) {
90349 RECEIVE_PACKET_FIELD_ERROR(playerno);
90350 }
90351
90352#else /* FREECIV_DELTA_PROTOCOL */
90353#ifdef FREECIV_JSON_CONNECTION
90354 field_addr.name = "playerno";
90355#endif /* FREECIV_JSON_CONNECTION */
90356 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->playerno)) {
90357 RECEIVE_PACKET_FIELD_ERROR(playerno);
90358 }
90359#ifdef FREECIV_JSON_CONNECTION
90360 field_addr.name = "expected_income";
90361#endif /* FREECIV_JSON_CONNECTION */
90362 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->expected_income)) {
90363 RECEIVE_PACKET_FIELD_ERROR(expected_income);
90364 }
90365#endif
90366 log_packet_detailed("packet_web_player_info_addition_100: got info about (%d)",
90367 real_packet->playerno);
90368
90369#ifdef FREECIV_DELTA_PROTOCOL
90370 if (nullptr == *hash) {
90371 *hash = genhash_new_full(hash_packet_web_player_info_addition_100, cmp_packet_web_player_info_addition_100,
90372 nullptr, nullptr, nullptr, destroy_packet_web_player_info_addition);
90373 }
90374
90375 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
90376 *real_packet = *old;
90377 } else {
90378 /* packet is already initialized empty */
90379 log_packet_detailed(" no old info");
90380 }
90381
90382 if (BV_ISSET(fields, 0)) {
90383 log_packet_detailed(" got field 'expected_income'");
90384#ifdef FREECIV_JSON_CONNECTION
90385 field_addr.name = "expected_income";
90386#endif /* FREECIV_JSON_CONNECTION */
90387 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->expected_income)) {
90388 RECEIVE_PACKET_FIELD_ERROR(expected_income);
90389 }
90390 }
90391
90392 if (nullptr == old) {
90393 old = fc_malloc(sizeof(*old));
90394 init_packet_web_player_info_addition(old);
90395 *old = *real_packet;
90396 genhash_insert(*hash, old, old);
90397 } else {
90398 *old = *real_packet;
90399 }
90400
90401#endif /* FREECIV_DELTA_PROTOCOL */
90402 RECEIVE_PACKET_END(real_packet);
90403#undef FREE_PACKET_STRUCT
90404}
90405
90406 static int send_packet_web_player_info_addition_100(struct connection *pc, const struct packet_web_player_info_addition *packet)
90407{
90408 const struct packet_web_player_info_addition *real_packet = packet;
90409 int e;
90410#ifdef FREECIV_DELTA_PROTOCOL
90411 packet_web_player_info_addition_100_fields fields;
90412 struct packet_web_player_info_addition *old;
90413 bool differ;
90414 struct genhash **hash = pc->phs.sent + PACKET_WEB_PLAYER_INFO_ADDITION;
90415 int different = 0;
90416#endif /* FREECIV_DELTA_PROTOCOL */
90417 SEND_PACKET_START(PACKET_WEB_PLAYER_INFO_ADDITION);
90418#ifdef FREECIV_JSON_CONNECTION
90419 struct plocation field_addr;
90420 {
90421 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
90422 field_addr = *field_addr_tmp;
90423 FC_FREE(field_addr_tmp);
90424 }
90425#endif /* FREECIV_JSON_CONNECTION */
90426
90427 log_packet_detailed("packet_web_player_info_addition_100: sending info about (%d)",
90428 real_packet->playerno);
90429
90430#ifdef FREECIV_DELTA_PROTOCOL
90431 if (nullptr == *hash) {
90432 *hash = genhash_new_full(hash_packet_web_player_info_addition_100, cmp_packet_web_player_info_addition_100,
90433 nullptr, nullptr, nullptr, destroy_packet_web_player_info_addition);
90434 }
90435 BV_CLR_ALL(fields);
90436
90437 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
90438 old = fc_malloc(sizeof(*old));
90439 /* temporary bitcopy just to insert correctly */
90440 *old = *real_packet;
90441 genhash_insert(*hash, old, old);
90442 init_packet_web_player_info_addition(old);
90443 different = 1; /* Force to send. */
90444 }
90445 differ = (old->expected_income != real_packet->expected_income);
90446 if (differ) {
90447 different++;
90448 BV_SET(fields, 0);
90449 }
90450
90451 if (different == 0) {
90452 log_packet_detailed(" no change -> discard");
90453 return 0;
90454 }
90455
90456#ifdef FREECIV_JSON_CONNECTION
90457 field_addr.name = "fields";
90458#endif /* FREECIV_JSON_CONNECTION */
90459 e = 0;
90460 e |= DIO_BV_PUT(&dout, &field_addr, fields);
90461 if (e) {
90462 log_packet_detailed("fields bitvector error detected");
90463 }
90464#ifdef FREECIV_JSON_CONNECTION
90465 field_addr.name = "playerno";
90466#endif /* FREECIV_JSON_CONNECTION */
90467 e = 0;
90468 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->playerno);
90469 if (e) {
90470 log_packet_detailed("'playerno' field error detected");
90471 }
90472
90473 if (BV_ISSET(fields, 0)) {
90474 log_packet_detailed(" field 'expected_income' has changed");
90475#ifdef FREECIV_JSON_CONNECTION
90476 field_addr.name = "expected_income";
90477#endif /* FREECIV_JSON_CONNECTION */
90478 e = 0;
90479 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->expected_income);
90480 if (e) {
90481 log_packet_detailed("'expected_income' field error detected");
90482 }
90483 }
90484
90485 *old = *real_packet;
90486#endif /* FREECIV_DELTA_PROTOCOL */
90487#ifndef FREECIV_DELTA_PROTOCOL
90488#ifdef FREECIV_JSON_CONNECTION
90489 field_addr.name = "playerno";
90490#endif /* FREECIV_JSON_CONNECTION */
90491 e = 0;
90492 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->playerno);
90493 if (e) {
90494 log_packet_detailed("'playerno' field error detected");
90495 }
90496#ifdef FREECIV_JSON_CONNECTION
90497 field_addr.name = "expected_income";
90498#endif /* FREECIV_JSON_CONNECTION */
90499 e = 0;
90500 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->expected_income);
90501 if (e) {
90502 log_packet_detailed("'expected_income' field error detected");
90503 }
90504
90505#endif
90506 SEND_PACKET_END(PACKET_WEB_PLAYER_INFO_ADDITION);
90507}
90508
90509 int send_packet_web_player_info_addition(struct connection *pc, const struct packet_web_player_info_addition *packet)
90510{
90511 if (!pc->used) {
90512 log_error("WARNING: trying to send data to the closed connection %s",
90513 conn_description(pc));
90514 return -1;
90515 }
90516 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet != nullptr, -1,
90517 "Handler for PACKET_WEB_PLAYER_INFO_ADDITION not installed");
90518 return pc->phs.handlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet(pc, packet);
90519}
90520
90521 static inline void init_packet_web_ruleset_unit_addition(struct packet_web_ruleset_unit_addition *packet)
90522{
90523 memset(packet, 0, sizeof(*packet));
90524}
90525
90526#define free_packet_web_ruleset_unit_addition(_packet) (void) 0
90527#define destroy_packet_web_ruleset_unit_addition free
90528
90529#ifdef FREECIV_DELTA_PROTOCOL
90530static genhash_val_t hash_packet_web_ruleset_unit_addition_100(const void *vkey)
90531{
90532 const struct packet_web_ruleset_unit_addition *key = (const struct packet_web_ruleset_unit_addition *) vkey;
90533 genhash_val_t result = 0;
90534
90535 result += key->id;
90536
90537 result &= 0xFFFFFFFF;
90538 return result;
90539}
90540
90541static bool cmp_packet_web_ruleset_unit_addition_100(const void *vkey1, const void *vkey2)
90542{
90543 const struct packet_web_ruleset_unit_addition *old = (const struct packet_web_ruleset_unit_addition *) vkey1;
90544 const struct packet_web_ruleset_unit_addition *real_packet = (const struct packet_web_ruleset_unit_addition *) vkey2;
90545 bool differ;
90546
90547 differ = (old->id != real_packet->id);
90548
90549 return !differ;
90550}
90551 BV_DEFINE(packet_web_ruleset_unit_addition_100_fields, 1);
90552#endif /* FREECIV_DELTA_PROTOCOL */
90553
90554 static struct packet_web_ruleset_unit_addition *receive_packet_web_ruleset_unit_addition_100(struct connection *pc)
90555{
90556#define FREE_PACKET_STRUCT(_packet) free_packet_web_ruleset_unit_addition(_packet)
90557#ifdef FREECIV_DELTA_PROTOCOL
90558 packet_web_ruleset_unit_addition_100_fields fields;
90559 struct packet_web_ruleset_unit_addition *old;
90560 struct genhash **hash = pc->phs.received + PACKET_WEB_RULESET_UNIT_ADDITION;
90561#endif /* FREECIV_DELTA_PROTOCOL */
90562 RECEIVE_PACKET_START(packet_web_ruleset_unit_addition, real_packet);
90563#ifdef FREECIV_JSON_CONNECTION
90564 struct plocation field_addr;
90565 {
90566 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
90567 field_addr = *field_addr_tmp;
90568 FC_FREE(field_addr_tmp);
90569 }
90570#endif /* FREECIV_JSON_CONNECTION */
90571
90572#ifdef FREECIV_DELTA_PROTOCOL
90573#ifdef FREECIV_JSON_CONNECTION
90574 field_addr.name = "fields";
90575#endif /* FREECIV_JSON_CONNECTION */
90576 DIO_BV_GET(&din, &field_addr, fields);
90577#ifdef FREECIV_JSON_CONNECTION
90578 field_addr.name = "id";
90579#endif /* FREECIV_JSON_CONNECTION */
90580 {
90581 int readin;
90582
90583 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
90584 RECEIVE_PACKET_FIELD_ERROR(id);
90585 }
90586 real_packet->id = readin;
90587 }
90588
90589#else /* FREECIV_DELTA_PROTOCOL */
90590#ifdef FREECIV_JSON_CONNECTION
90591 field_addr.name = "id";
90592#endif /* FREECIV_JSON_CONNECTION */
90593 {
90594 int readin;
90595
90596 if (!DIO_GET(uint16, &din, &field_addr, &readin)) {
90597 RECEIVE_PACKET_FIELD_ERROR(id);
90598 }
90599 real_packet->id = readin;
90600 }
90601#ifdef FREECIV_JSON_CONNECTION
90602 field_addr.name = "utype_actions";
90603#endif /* FREECIV_JSON_CONNECTION */
90604 if (!DIO_BV_GET(&din, &field_addr, real_packet->utype_actions)) {
90605 RECEIVE_PACKET_FIELD_ERROR(utype_actions);
90606 }
90607#endif
90608 log_packet_detailed("packet_web_ruleset_unit_addition_100: got info about (%d)",
90609 real_packet->id);
90610
90611#ifdef FREECIV_DELTA_PROTOCOL
90612 if (nullptr == *hash) {
90613 *hash = genhash_new_full(hash_packet_web_ruleset_unit_addition_100, cmp_packet_web_ruleset_unit_addition_100,
90614 nullptr, nullptr, nullptr, destroy_packet_web_ruleset_unit_addition);
90615 }
90616
90617 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
90618 *real_packet = *old;
90619 } else {
90620 /* packet is already initialized empty */
90621 log_packet_detailed(" no old info");
90622 }
90623
90624 if (BV_ISSET(fields, 0)) {
90625 log_packet_detailed(" got field 'utype_actions'");
90626#ifdef FREECIV_JSON_CONNECTION
90627 field_addr.name = "utype_actions";
90628#endif /* FREECIV_JSON_CONNECTION */
90629 if (!DIO_BV_GET(&din, &field_addr, real_packet->utype_actions)) {
90630 RECEIVE_PACKET_FIELD_ERROR(utype_actions);
90631 }
90632 }
90633
90634 if (nullptr == old) {
90635 old = fc_malloc(sizeof(*old));
90636 init_packet_web_ruleset_unit_addition(old);
90637 *old = *real_packet;
90638 genhash_insert(*hash, old, old);
90639 } else {
90640 *old = *real_packet;
90641 }
90642
90643#endif /* FREECIV_DELTA_PROTOCOL */
90644 RECEIVE_PACKET_END(real_packet);
90645#undef FREE_PACKET_STRUCT
90646}
90647
90648 static int send_packet_web_ruleset_unit_addition_100(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
90649{
90650 const struct packet_web_ruleset_unit_addition *real_packet = packet;
90651 int e;
90652#ifdef FREECIV_DELTA_PROTOCOL
90653 packet_web_ruleset_unit_addition_100_fields fields;
90654 struct packet_web_ruleset_unit_addition *old;
90655 bool differ;
90656 struct genhash **hash = pc->phs.sent + PACKET_WEB_RULESET_UNIT_ADDITION;
90657#endif /* FREECIV_DELTA_PROTOCOL */
90658 SEND_PACKET_START(PACKET_WEB_RULESET_UNIT_ADDITION);
90659#ifdef FREECIV_JSON_CONNECTION
90660 struct plocation field_addr;
90661 {
90662 struct plocation *field_addr_tmp = plocation_field_new(nullptr);
90663 field_addr = *field_addr_tmp;
90664 FC_FREE(field_addr_tmp);
90665 }
90666#endif /* FREECIV_JSON_CONNECTION */
90667
90668 log_packet_detailed("packet_web_ruleset_unit_addition_100: sending info about (%d)",
90669 real_packet->id);
90670
90671#ifdef FREECIV_DELTA_PROTOCOL
90672 if (nullptr == *hash) {
90673 *hash = genhash_new_full(hash_packet_web_ruleset_unit_addition_100, cmp_packet_web_ruleset_unit_addition_100,
90674 nullptr, nullptr, nullptr, destroy_packet_web_ruleset_unit_addition);
90675 }
90676 BV_CLR_ALL(fields);
90677
90678 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
90679 old = fc_malloc(sizeof(*old));
90680 /* temporary bitcopy just to insert correctly */
90681 *old = *real_packet;
90682 genhash_insert(*hash, old, old);
90683 init_packet_web_ruleset_unit_addition(old);
90684 }
90685 differ = !BV_ARE_EQUAL(old->utype_actions, real_packet->utype_actions);
90686 if (differ) {
90687 BV_SET(fields, 0);
90688 }
90689
90690
90691#ifdef FREECIV_JSON_CONNECTION
90692 field_addr.name = "fields";
90693#endif /* FREECIV_JSON_CONNECTION */
90694 e = 0;
90695 e |= DIO_BV_PUT(&dout, &field_addr, fields);
90696 if (e) {
90697 log_packet_detailed("fields bitvector error detected");
90698 }
90699#ifdef FREECIV_JSON_CONNECTION
90700 field_addr.name = "id";
90701#endif /* FREECIV_JSON_CONNECTION */
90702 e = 0;
90703 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
90704 if (e) {
90705 log_packet_detailed("'id' field error detected");
90706 }
90707
90708 if (BV_ISSET(fields, 0)) {
90709 log_packet_detailed(" field 'utype_actions' has changed");
90710#ifdef FREECIV_JSON_CONNECTION
90711 field_addr.name = "utype_actions";
90712#endif /* FREECIV_JSON_CONNECTION */
90713 e = 0;
90714 e |= DIO_BV_PUT(&dout, &field_addr, packet->utype_actions);
90715 if (e) {
90716 log_packet_detailed("'utype_actions' field error detected");
90717 }
90718 }
90719
90720 *old = *real_packet;
90721#endif /* FREECIV_DELTA_PROTOCOL */
90722#ifndef FREECIV_DELTA_PROTOCOL
90723#ifdef FREECIV_JSON_CONNECTION
90724 field_addr.name = "id";
90725#endif /* FREECIV_JSON_CONNECTION */
90726 e = 0;
90727 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
90728 if (e) {
90729 log_packet_detailed("'id' field error detected");
90730 }
90731#ifdef FREECIV_JSON_CONNECTION
90732 field_addr.name = "utype_actions";
90733#endif /* FREECIV_JSON_CONNECTION */
90734 e = 0;
90735 e |= DIO_BV_PUT(&dout, &field_addr, packet->utype_actions);
90736 if (e) {
90737 log_packet_detailed("'utype_actions' field error detected");
90738 }
90739
90740#endif
90741 SEND_PACKET_END(PACKET_WEB_RULESET_UNIT_ADDITION);
90742}
90743
90744 int send_packet_web_ruleset_unit_addition(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
90745{
90746 if (!pc->used) {
90747 log_error("WARNING: trying to send data to the closed connection %s",
90748 conn_description(pc));
90749 return -1;
90750 }
90751 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet != nullptr, -1,
90752 "Handler for PACKET_WEB_RULESET_UNIT_ADDITION not installed");
90753 return pc->phs.handlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet(pc, packet);
90754}
90755
90756 void lsend_packet_web_ruleset_unit_addition(struct conn_list *dest, const struct packet_web_ruleset_unit_addition *packet)
90757{
90758 conn_list_iterate(dest, pconn) {
90759 send_packet_web_ruleset_unit_addition(pconn, packet);
90760 } conn_list_iterate_end;
90761}
90762
90763 void packet_handlers_fill_initial(struct packet_handlers *phandlers)
90764{
90765 phandlers->send[PACKET_CITY_RALLY_POINT].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_rally_point_100;
90766 phandlers->receive[PACKET_CITY_RALLY_POINT] = (void *(*)(struct connection *)) receive_packet_city_rally_point_100;
90767 phandlers->send[PACKET_WORKER_TASK].packet = (int(*)(struct connection *, const void *)) send_packet_worker_task_100;
90768 phandlers->receive[PACKET_WORKER_TASK] = (void *(*)(struct connection *)) receive_packet_worker_task_100;
90769 phandlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet = (int(*)(struct connection *, const void *)) send_packet_player_attribute_chunk_100;
90770 phandlers->receive[PACKET_PLAYER_ATTRIBUTE_CHUNK] = (void *(*)(struct connection *)) receive_packet_player_attribute_chunk_100;
90771 phandlers->send[PACKET_EDIT_STARTPOS].packet = (int(*)(struct connection *, const void *)) send_packet_edit_startpos_100;
90772 phandlers->receive[PACKET_EDIT_STARTPOS] = (void *(*)(struct connection *)) receive_packet_edit_startpos_100;
90773 phandlers->send[PACKET_EDIT_STARTPOS_FULL].packet = (int(*)(struct connection *, const void *)) send_packet_edit_startpos_full_100;
90774 phandlers->receive[PACKET_EDIT_STARTPOS_FULL] = (void *(*)(struct connection *)) receive_packet_edit_startpos_full_100;
90775 if (is_server()) {
90776 phandlers->send[PACKET_PROCESSING_STARTED].no_packet = (int(*)(struct connection *)) send_packet_processing_started_100;
90777 phandlers->send[PACKET_PROCESSING_FINISHED].no_packet = (int(*)(struct connection *)) send_packet_processing_finished_100;
90778 phandlers->send[PACKET_INVESTIGATE_STARTED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_started_100;
90779 phandlers->send[PACKET_INVESTIGATE_FINISHED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_finished_100;
90780 phandlers->send[PACKET_SERVER_JOIN_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_server_join_reply_100;
90781 phandlers->send[PACKET_AUTHENTICATION_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_authentication_req_100;
90782 phandlers->send[PACKET_SERVER_SHUTDOWN].no_packet = (int(*)(struct connection *)) send_packet_server_shutdown_100;
90783 phandlers->send[PACKET_ENDGAME_REPORT].packet = (int(*)(struct connection *, const void *)) send_packet_endgame_report_100;
90784 phandlers->send[PACKET_ENDGAME_PLAYER].packet = (int(*)(struct connection *, const void *)) send_packet_endgame_player_100;
90785 phandlers->send[PACKET_TILE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_tile_info_100;
90786 phandlers->send[PACKET_GAME_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_game_info_100;
90787 phandlers->send[PACKET_CALENDAR_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_calendar_info_100;
90788 phandlers->send[PACKET_TIMEOUT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_timeout_info_100;
90789 phandlers->send[PACKET_MAP_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_map_info_100;
90790 phandlers->send[PACKET_NUKE_TILE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_nuke_tile_info_100;
90791 phandlers->send[PACKET_TEAM_NAME_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_team_name_info_100;
90792 phandlers->send[PACKET_ACHIEVEMENT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_achievement_info_100;
90793 phandlers->send[PACKET_CHAT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_chat_msg_100;
90794 phandlers->send[PACKET_EARLY_CHAT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_early_chat_msg_100;
90795 phandlers->send[PACKET_CONNECT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_connect_msg_100;
90796 phandlers->send[PACKET_SERVER_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_server_info_100;
90797 phandlers->send[PACKET_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_city_remove_100;
90798 phandlers->send[PACKET_CITY_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_info_100;
90799 phandlers->send[PACKET_CITY_NATIONALITIES].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_nationalities_100;
90800 phandlers->send[PACKET_CITY_UPDATE_COUNTERS].packet = (int(*)(struct connection *, const void *)) send_packet_city_update_counters_100;
90801 phandlers->send[PACKET_CITY_SHORT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_short_info_100;
90802 phandlers->send[PACKET_TRADE_ROUTE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_trade_route_info_100;
90803 phandlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_info_100;
90804 phandlers->send[PACKET_CITY_SABOTAGE_LIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_sabotage_list_100;
90805 phandlers->send[PACKET_PLAYER_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_player_remove_100;
90806 phandlers->send[PACKET_PLAYER_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_player_info_100;
90807 phandlers->send[PACKET_PLAYER_DIPLSTATE].packet = (int(*)(struct connection *, const void *)) send_packet_player_diplstate_100;
90808 phandlers->send[PACKET_RESEARCH_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_research_info_100;
90809 phandlers->send[PACKET_UNKNOWN_RESEARCH].packet = (int(*)(struct connection *, const void *)) send_packet_unknown_research_100;
90810 phandlers->send[PACKET_UNIT_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_unit_remove_100;
90811 phandlers->send[PACKET_UNIT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_info_100;
90812 phandlers->send[PACKET_UNIT_SHORT_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_unit_short_info_100;
90813 phandlers->send[PACKET_UNIT_COMBAT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_combat_info_100;
90814 phandlers->send[PACKET_UNIT_ACTION_ANSWER].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_answer_100;
90815 phandlers->send[PACKET_UNIT_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_actions_100;
90816 phandlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_init_meeting_100;
90817 phandlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_meeting_100;
90818 phandlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_create_clause_100;
90819 phandlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_remove_clause_100;
90820 phandlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_accept_treaty_100;
90821 phandlers->send[PACKET_PAGE_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_page_msg_100;
90822 phandlers->send[PACKET_PAGE_MSG_PART].packet = (int(*)(struct connection *, const void *)) send_packet_page_msg_part_100;
90823 phandlers->send[PACKET_CONN_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_conn_info_100;
90824 phandlers->send[PACKET_CONN_PING_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_conn_ping_info_100;
90825 phandlers->send[PACKET_CONN_PING].no_packet = (int(*)(struct connection *)) send_packet_conn_ping_100;
90826 phandlers->send[PACKET_END_PHASE].no_packet = (int(*)(struct connection *)) send_packet_end_phase_100;
90827 phandlers->send[PACKET_START_PHASE].packet = (int(*)(struct connection *, const void *)) send_packet_start_phase_100;
90828 phandlers->send[PACKET_NEW_YEAR].packet = (int(*)(struct connection *, const void *)) send_packet_new_year_100;
90829 phandlers->send[PACKET_BEGIN_TURN].no_packet = (int(*)(struct connection *)) send_packet_begin_turn_100;
90830 phandlers->send[PACKET_END_TURN].no_packet = (int(*)(struct connection *)) send_packet_end_turn_100;
90831 phandlers->send[PACKET_FREEZE_CLIENT].no_packet = (int(*)(struct connection *)) send_packet_freeze_client_100;
90832 phandlers->send[PACKET_THAW_CLIENT].no_packet = (int(*)(struct connection *)) send_packet_thaw_client_100;
90833 phandlers->send[PACKET_SPACESHIP_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_spaceship_info_100;
90834 phandlers->send[PACKET_RULESET_UNIT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_100;
90835 phandlers->send[PACKET_RULESET_UNIT_BONUS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_bonus_100;
90836 phandlers->send[PACKET_RULESET_UNIT_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_flag_100;
90837 phandlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_class_flag_100;
90838 phandlers->send[PACKET_RULESET_GAME].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_game_100;
90839 phandlers->send[PACKET_RULESET_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_specialist_100;
90840 phandlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_government_ruler_title_100;
90841 phandlers->send[PACKET_RULESET_TECH].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_100;
90842 phandlers->send[PACKET_RULESET_TECH_CLASS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_class_100;
90843 phandlers->send[PACKET_RULESET_TECH_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_flag_100;
90844 phandlers->send[PACKET_RULESET_GOVERNMENT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_government_100;
90845 phandlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_control_100;
90846 phandlers->send[PACKET_RULESETS_READY].no_packet = (int(*)(struct connection *)) send_packet_rulesets_ready_100;
90847 phandlers->send[PACKET_RULESET_NATION_SETS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_sets_100;
90848 phandlers->send[PACKET_RULESET_NATION_GROUPS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_groups_100;
90849 phandlers->send[PACKET_RULESET_NATION].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_100;
90850 phandlers->send[PACKET_NATION_AVAILABILITY].packet = (int(*)(struct connection *, const void *)) send_packet_nation_availability_100;
90851 phandlers->send[PACKET_RULESET_STYLE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_style_100;
90852 phandlers->send[PACKET_RULESET_CITY].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_city_100;
90853 phandlers->send[PACKET_RULESET_BUILDING].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_building_100;
90854 phandlers->send[PACKET_RULESET_IMPR_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_impr_flag_100;
90855 phandlers->send[PACKET_RULESET_TERRAIN].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_100;
90856 phandlers->send[PACKET_RULESET_TERRAIN_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_flag_100;
90857 phandlers->send[PACKET_RULESET_UNIT_CLASS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_class_100;
90858 phandlers->send[PACKET_RULESET_EXTRA].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_extra_100;
90859 phandlers->send[PACKET_RULESET_EXTRA_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_extra_flag_100;
90860 phandlers->send[PACKET_RULESET_BASE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_base_100;
90861 phandlers->send[PACKET_RULESET_ROAD].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_road_100;
90862 phandlers->send[PACKET_RULESET_GOODS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_goods_100;
90863 phandlers->send[PACKET_RULESET_DISASTER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_disaster_100;
90864 phandlers->send[PACKET_RULESET_ACHIEVEMENT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_achievement_100;
90865 phandlers->send[PACKET_RULESET_TRADE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_trade_100;
90866 phandlers->send[PACKET_RULESET_ACTION].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_100;
90867 phandlers->send[PACKET_RULESET_ACTION_ENABLER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_enabler_100;
90868 phandlers->send[PACKET_RULESET_ACTION_AUTO].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_auto_100;
90869 phandlers->send[PACKET_RULESET_COUNTER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_counter_100;
90870 phandlers->send[PACKET_RULESET_MUSIC].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_music_100;
90871 phandlers->send[PACKET_RULESET_MULTIPLIER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_multiplier_100;
90872 phandlers->send[PACKET_RULESET_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_clause_100;
90873 phandlers->send[PACKET_RULESET_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_control_100;
90874 phandlers->send[PACKET_RULESET_SUMMARY].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_summary_100;
90875 phandlers->send[PACKET_RULESET_DESCRIPTION_PART].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_description_part_100;
90876 phandlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_single_want_hack_reply_100;
90877 phandlers->send[PACKET_RULESET_CHOICES].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_choices_100;
90878 phandlers->send[PACKET_GAME_LOAD].packet = (int(*)(struct connection *, const void *)) send_packet_game_load_100;
90879 phandlers->send[PACKET_SERVER_SETTING_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_control_100;
90880 phandlers->send[PACKET_SERVER_SETTING_CONST].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_const_100;
90881 phandlers->send[PACKET_SERVER_SETTING_BOOL].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_bool_100;
90882 phandlers->send[PACKET_SERVER_SETTING_INT].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_int_100;
90883 phandlers->send[PACKET_SERVER_SETTING_STR].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_str_100;
90884 phandlers->send[PACKET_SERVER_SETTING_ENUM].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_enum_100;
90885 phandlers->send[PACKET_SERVER_SETTING_BITWISE].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_bitwise_100;
90886 phandlers->send[PACKET_SET_TOPOLOGY].packet = (int(*)(struct connection *, const void *)) send_packet_set_topology_100;
90887 phandlers->send[PACKET_RULESET_EFFECT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_effect_100;
90888 phandlers->send[PACKET_RULESET_RESOURCE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_resource_100;
90889 phandlers->send[PACKET_SCENARIO_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_scenario_info_100;
90890 phandlers->send[PACKET_SCENARIO_DESCRIPTION].packet = (int(*)(struct connection *, const void *)) send_packet_scenario_description_100;
90891 phandlers->send[PACKET_VOTE_NEW].packet = (int(*)(struct connection *, const void *)) send_packet_vote_new_100;
90892 phandlers->send[PACKET_VOTE_UPDATE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_update_100;
90893 phandlers->send[PACKET_VOTE_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_remove_100;
90894 phandlers->send[PACKET_VOTE_RESOLVE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_resolve_100;
90895 phandlers->send[PACKET_EDIT_OBJECT_CREATED].packet = (int(*)(struct connection *, const void *)) send_packet_edit_object_created_100;
90896 phandlers->send[PACKET_PLAY_MUSIC].packet = (int(*)(struct connection *, const void *)) send_packet_play_music_100;
90897 phandlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_web_city_info_addition_100;
90898 phandlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet = (int(*)(struct connection *, const void *)) send_packet_web_player_info_addition_100;
90899 phandlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet = (int(*)(struct connection *, const void *)) send_packet_web_ruleset_unit_addition_100;
90900 phandlers->receive[PACKET_SERVER_JOIN_REQ] = (void *(*)(struct connection *)) receive_packet_server_join_req_100;
90901 phandlers->receive[PACKET_AUTHENTICATION_REPLY] = (void *(*)(struct connection *)) receive_packet_authentication_reply_100;
90902 phandlers->receive[PACKET_NATION_SELECT_REQ] = (void *(*)(struct connection *)) receive_packet_nation_select_req_100;
90903 phandlers->receive[PACKET_PLAYER_READY] = (void *(*)(struct connection *)) receive_packet_player_ready_100;
90904 phandlers->receive[PACKET_CHAT_MSG_REQ] = (void *(*)(struct connection *)) receive_packet_chat_msg_req_100;
90905 phandlers->receive[PACKET_CITY_SELL] = (void *(*)(struct connection *)) receive_packet_city_sell_100;
90906 phandlers->receive[PACKET_CITY_BUY] = (void *(*)(struct connection *)) receive_packet_city_buy_100;
90907 phandlers->receive[PACKET_CITY_CHANGE] = (void *(*)(struct connection *)) receive_packet_city_change_100;
90908 phandlers->receive[PACKET_CITY_WORKLIST] = (void *(*)(struct connection *)) receive_packet_city_worklist_100;
90909 phandlers->receive[PACKET_CITY_MAKE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_make_specialist_100;
90910 phandlers->receive[PACKET_CITY_MAKE_WORKER] = (void *(*)(struct connection *)) receive_packet_city_make_worker_100;
90911 phandlers->receive[PACKET_CITY_CHANGE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_change_specialist_100;
90912 phandlers->receive[PACKET_CITY_RENAME] = (void *(*)(struct connection *)) receive_packet_city_rename_100;
90913 phandlers->receive[PACKET_CITY_OPTIONS_REQ] = (void *(*)(struct connection *)) receive_packet_city_options_req_100;
90914 phandlers->receive[PACKET_CITY_REFRESH] = (void *(*)(struct connection *)) receive_packet_city_refresh_100;
90915 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_REQ] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_req_100;
90916 phandlers->receive[PACKET_PLAYER_PHASE_DONE] = (void *(*)(struct connection *)) receive_packet_player_phase_done_100;
90917 phandlers->receive[PACKET_PLAYER_RATES] = (void *(*)(struct connection *)) receive_packet_player_rates_100;
90918 phandlers->receive[PACKET_PLAYER_CHANGE_GOVERNMENT] = (void *(*)(struct connection *)) receive_packet_player_change_government_100;
90919 phandlers->receive[PACKET_PLAYER_PLACE_INFRA] = (void *(*)(struct connection *)) receive_packet_player_place_infra_100;
90920 phandlers->receive[PACKET_PLAYER_ATTRIBUTE_BLOCK] = (void *(*)(struct connection *)) receive_packet_player_attribute_block_100;
90921 phandlers->receive[PACKET_PLAYER_MULTIPLIER] = (void *(*)(struct connection *)) receive_packet_player_multiplier_100;
90922 phandlers->receive[PACKET_PLAYER_RESEARCH] = (void *(*)(struct connection *)) receive_packet_player_research_100;
90923 phandlers->receive[PACKET_PLAYER_TECH_GOAL] = (void *(*)(struct connection *)) receive_packet_player_tech_goal_100;
90924 phandlers->receive[PACKET_UNIT_SSCS_SET] = (void *(*)(struct connection *)) receive_packet_unit_sscs_set_100;
90925 phandlers->receive[PACKET_UNIT_ORDERS] = (void *(*)(struct connection *)) receive_packet_unit_orders_100;
90926 phandlers->receive[PACKET_UNIT_SERVER_SIDE_AGENT_SET] = (void *(*)(struct connection *)) receive_packet_unit_server_side_agent_set_100;
90927 phandlers->receive[PACKET_UNIT_ACTION_QUERY] = (void *(*)(struct connection *)) receive_packet_unit_action_query_100;
90928 phandlers->receive[PACKET_UNIT_TYPE_UPGRADE] = (void *(*)(struct connection *)) receive_packet_unit_type_upgrade_100;
90929 phandlers->receive[PACKET_UNIT_DO_ACTION] = (void *(*)(struct connection *)) receive_packet_unit_do_action_100;
90930 phandlers->receive[PACKET_UNIT_GET_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_get_actions_100;
90931 phandlers->receive[PACKET_UNIT_CHANGE_ACTIVITY] = (void *(*)(struct connection *)) receive_packet_unit_change_activity_100;
90932 phandlers->receive[PACKET_DIPLOMACY_INIT_MEETING_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_init_meeting_req_100;
90933 phandlers->receive[PACKET_DIPLOMACY_CANCEL_MEETING_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_meeting_req_100;
90934 phandlers->receive[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_create_clause_req_100;
90935 phandlers->receive[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_remove_clause_req_100;
90936 phandlers->receive[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_accept_treaty_req_100;
90937 phandlers->receive[PACKET_DIPLOMACY_CANCEL_PACT] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_pact_100;
90938 phandlers->receive[PACKET_REPORT_REQ] = (void *(*)(struct connection *)) receive_packet_report_req_100;
90939 phandlers->receive[PACKET_CONN_PONG] = (void *(*)(struct connection *)) receive_packet_conn_pong_100;
90940 phandlers->receive[PACKET_CLIENT_HEARTBEAT] = (void *(*)(struct connection *)) receive_packet_client_heartbeat_100;
90941 phandlers->receive[PACKET_CLIENT_INFO] = (void *(*)(struct connection *)) receive_packet_client_info_100;
90942 phandlers->receive[PACKET_SPACESHIP_LAUNCH] = (void *(*)(struct connection *)) receive_packet_spaceship_launch_100;
90943 phandlers->receive[PACKET_SPACESHIP_PLACE] = (void *(*)(struct connection *)) receive_packet_spaceship_place_100;
90944 phandlers->receive[PACKET_SINGLE_WANT_HACK_REQ] = (void *(*)(struct connection *)) receive_packet_single_want_hack_req_100;
90945 phandlers->receive[PACKET_RULESET_SELECT] = (void *(*)(struct connection *)) receive_packet_ruleset_select_100;
90946 phandlers->receive[PACKET_SAVE_SCENARIO] = (void *(*)(struct connection *)) receive_packet_save_scenario_100;
90947 phandlers->receive[PACKET_VOTE_SUBMIT] = (void *(*)(struct connection *)) receive_packet_vote_submit_100;
90948 phandlers->receive[PACKET_EDIT_MODE] = (void *(*)(struct connection *)) receive_packet_edit_mode_100;
90949 phandlers->receive[PACKET_EDIT_RECALCULATE_BORDERS] = (void *(*)(struct connection *)) receive_packet_edit_recalculate_borders_100;
90950 phandlers->receive[PACKET_EDIT_CHECK_TILES] = (void *(*)(struct connection *)) receive_packet_edit_check_tiles_100;
90951 phandlers->receive[PACKET_EDIT_TOGGLE_FOGOFWAR] = (void *(*)(struct connection *)) receive_packet_edit_toggle_fogofwar_100;
90952 phandlers->receive[PACKET_EDIT_TILE_TERRAIN] = (void *(*)(struct connection *)) receive_packet_edit_tile_terrain_100;
90953 phandlers->receive[PACKET_EDIT_TILE_EXTRA] = (void *(*)(struct connection *)) receive_packet_edit_tile_extra_100;
90954 phandlers->receive[PACKET_EDIT_TILE] = (void *(*)(struct connection *)) receive_packet_edit_tile_100;
90955 phandlers->receive[PACKET_EDIT_UNIT_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_unit_create_100;
90956 phandlers->receive[PACKET_EDIT_UNIT_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_unit_remove_100;
90957 phandlers->receive[PACKET_EDIT_UNIT_REMOVE_BY_ID] = (void *(*)(struct connection *)) receive_packet_edit_unit_remove_by_id_100;
90958 phandlers->receive[PACKET_EDIT_UNIT] = (void *(*)(struct connection *)) receive_packet_edit_unit_100;
90959 phandlers->receive[PACKET_EDIT_CITY_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_city_create_100;
90960 phandlers->receive[PACKET_EDIT_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_city_remove_100;
90961 phandlers->receive[PACKET_EDIT_CITY] = (void *(*)(struct connection *)) receive_packet_edit_city_100;
90962 phandlers->receive[PACKET_EDIT_PLAYER_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_player_create_100;
90963 phandlers->receive[PACKET_EDIT_PLAYER_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_player_remove_100;
90964 phandlers->receive[PACKET_EDIT_PLAYER] = (void *(*)(struct connection *)) receive_packet_edit_player_100;
90965 phandlers->receive[PACKET_EDIT_PLAYER_VISION] = (void *(*)(struct connection *)) receive_packet_edit_player_vision_100;
90966 phandlers->receive[PACKET_EDIT_GAME] = (void *(*)(struct connection *)) receive_packet_edit_game_100;
90967 phandlers->receive[PACKET_EDIT_SCENARIO_DESC] = (void *(*)(struct connection *)) receive_packet_edit_scenario_desc_100;
90968 phandlers->receive[PACKET_WEB_CMA_SET] = (void *(*)(struct connection *)) receive_packet_web_cma_set_100;
90969 phandlers->receive[PACKET_WEB_CMA_CLEAR] = (void *(*)(struct connection *)) receive_packet_web_cma_clear_100;
90970 } else {
90971 phandlers->send[PACKET_SERVER_JOIN_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_server_join_req_100;
90972 phandlers->send[PACKET_AUTHENTICATION_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_authentication_reply_100;
90973 phandlers->send[PACKET_NATION_SELECT_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_nation_select_req_100;
90974 phandlers->send[PACKET_PLAYER_READY].packet = (int(*)(struct connection *, const void *)) send_packet_player_ready_100;
90975 phandlers->send[PACKET_CHAT_MSG_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_chat_msg_req_100;
90976 phandlers->send[PACKET_CITY_SELL].packet = (int(*)(struct connection *, const void *)) send_packet_city_sell_100;
90977 phandlers->send[PACKET_CITY_BUY].packet = (int(*)(struct connection *, const void *)) send_packet_city_buy_100;
90978 phandlers->send[PACKET_CITY_CHANGE].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_100;
90979 phandlers->send[PACKET_CITY_WORKLIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_worklist_100;
90980 phandlers->send[PACKET_CITY_MAKE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_specialist_100;
90981 phandlers->send[PACKET_CITY_MAKE_WORKER].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_worker_100;
90982 phandlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_specialist_100;
90983 phandlers->send[PACKET_CITY_RENAME].packet = (int(*)(struct connection *, const void *)) send_packet_city_rename_100;
90984 phandlers->send[PACKET_CITY_OPTIONS_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_options_req_100;
90985 phandlers->send[PACKET_CITY_REFRESH].packet = (int(*)(struct connection *, const void *)) send_packet_city_refresh_100;
90986 phandlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_req_100;
90987 phandlers->send[PACKET_PLAYER_PHASE_DONE].packet = (int(*)(struct connection *, const void *)) send_packet_player_phase_done_100;
90988 phandlers->send[PACKET_PLAYER_RATES].packet = (int(*)(struct connection *, const void *)) send_packet_player_rates_100;
90989 phandlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet = (int(*)(struct connection *, const void *)) send_packet_player_change_government_100;
90990 phandlers->send[PACKET_PLAYER_PLACE_INFRA].packet = (int(*)(struct connection *, const void *)) send_packet_player_place_infra_100;
90991 phandlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet = (int(*)(struct connection *)) send_packet_player_attribute_block_100;
90992 phandlers->send[PACKET_PLAYER_MULTIPLIER].packet = (int(*)(struct connection *, const void *)) send_packet_player_multiplier_100;
90993 phandlers->send[PACKET_PLAYER_RESEARCH].packet = (int(*)(struct connection *, const void *)) send_packet_player_research_100;
90994 phandlers->send[PACKET_PLAYER_TECH_GOAL].packet = (int(*)(struct connection *, const void *)) send_packet_player_tech_goal_100;
90995 phandlers->send[PACKET_UNIT_SSCS_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_sscs_set_100;
90996 phandlers->send[PACKET_UNIT_ORDERS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_orders_100;
90997 phandlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_server_side_agent_set_100;
90998 phandlers->send[PACKET_UNIT_ACTION_QUERY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_query_100;
90999 phandlers->send[PACKET_UNIT_TYPE_UPGRADE].packet = (int(*)(struct connection *, const void *)) send_packet_unit_type_upgrade_100;
91000 phandlers->send[PACKET_UNIT_DO_ACTION].packet = (int(*)(struct connection *, const void *)) send_packet_unit_do_action_100;
91001 phandlers->send[PACKET_UNIT_GET_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_get_actions_100;
91002 phandlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_change_activity_100;
91003 phandlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_init_meeting_req_100;
91004 phandlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_meeting_req_100;
91005 phandlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_create_clause_req_100;
91006 phandlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_remove_clause_req_100;
91007 phandlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_accept_treaty_req_100;
91008 phandlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_pact_100;
91009 phandlers->send[PACKET_REPORT_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_report_req_100;
91010 phandlers->send[PACKET_CONN_PONG].no_packet = (int(*)(struct connection *)) send_packet_conn_pong_100;
91011 phandlers->send[PACKET_CLIENT_HEARTBEAT].no_packet = (int(*)(struct connection *)) send_packet_client_heartbeat_100;
91012 phandlers->send[PACKET_CLIENT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_client_info_100;
91013 phandlers->send[PACKET_SPACESHIP_LAUNCH].no_packet = (int(*)(struct connection *)) send_packet_spaceship_launch_100;
91014 phandlers->send[PACKET_SPACESHIP_PLACE].packet = (int(*)(struct connection *, const void *)) send_packet_spaceship_place_100;
91015 phandlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_single_want_hack_req_100;
91016 phandlers->send[PACKET_RULESET_SELECT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_select_100;
91017 phandlers->send[PACKET_SAVE_SCENARIO].packet = (int(*)(struct connection *, const void *)) send_packet_save_scenario_100;
91018 phandlers->send[PACKET_VOTE_SUBMIT].packet = (int(*)(struct connection *, const void *)) send_packet_vote_submit_100;
91019 phandlers->send[PACKET_EDIT_MODE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_mode_100;
91020 phandlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet = (int(*)(struct connection *)) send_packet_edit_recalculate_borders_100;
91021 phandlers->send[PACKET_EDIT_CHECK_TILES].no_packet = (int(*)(struct connection *)) send_packet_edit_check_tiles_100;
91022 phandlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet = (int(*)(struct connection *, const void *)) send_packet_edit_toggle_fogofwar_100;
91023 phandlers->send[PACKET_EDIT_TILE_TERRAIN].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_terrain_100;
91024 phandlers->send[PACKET_EDIT_TILE_EXTRA].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_extra_100;
91025 phandlers->send[PACKET_EDIT_TILE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_100;
91026 phandlers->send[PACKET_EDIT_UNIT_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_create_100;
91027 phandlers->send[PACKET_EDIT_UNIT_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_remove_100;
91028 phandlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_remove_by_id_100;
91029 phandlers->send[PACKET_EDIT_UNIT].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_100;
91030 phandlers->send[PACKET_EDIT_CITY_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_create_100;
91031 phandlers->send[PACKET_EDIT_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_remove_100;
91032 phandlers->send[PACKET_EDIT_CITY].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_100;
91033 phandlers->send[PACKET_EDIT_PLAYER_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_create_100;
91034 phandlers->send[PACKET_EDIT_PLAYER_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_remove_100;
91035 phandlers->send[PACKET_EDIT_PLAYER].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_100;
91036 phandlers->send[PACKET_EDIT_PLAYER_VISION].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_vision_100;
91037 phandlers->send[PACKET_EDIT_GAME].packet = (int(*)(struct connection *, const void *)) send_packet_edit_game_100;
91038 phandlers->send[PACKET_EDIT_SCENARIO_DESC].packet = (int(*)(struct connection *, const void *)) send_packet_edit_scenario_desc_100;
91039 phandlers->send[PACKET_WEB_CMA_SET].packet = (int(*)(struct connection *, const void *)) send_packet_web_cma_set_100;
91040 phandlers->send[PACKET_WEB_CMA_CLEAR].packet = (int(*)(struct connection *, const void *)) send_packet_web_cma_clear_100;
91041 phandlers->receive[PACKET_PROCESSING_STARTED] = (void *(*)(struct connection *)) receive_packet_processing_started_100;
91042 phandlers->receive[PACKET_PROCESSING_FINISHED] = (void *(*)(struct connection *)) receive_packet_processing_finished_100;
91043 phandlers->receive[PACKET_INVESTIGATE_STARTED] = (void *(*)(struct connection *)) receive_packet_investigate_started_100;
91044 phandlers->receive[PACKET_INVESTIGATE_FINISHED] = (void *(*)(struct connection *)) receive_packet_investigate_finished_100;
91045 phandlers->receive[PACKET_SERVER_JOIN_REPLY] = (void *(*)(struct connection *)) receive_packet_server_join_reply_100;
91046 phandlers->receive[PACKET_AUTHENTICATION_REQ] = (void *(*)(struct connection *)) receive_packet_authentication_req_100;
91047 phandlers->receive[PACKET_SERVER_SHUTDOWN] = (void *(*)(struct connection *)) receive_packet_server_shutdown_100;
91048 phandlers->receive[PACKET_ENDGAME_REPORT] = (void *(*)(struct connection *)) receive_packet_endgame_report_100;
91049 phandlers->receive[PACKET_ENDGAME_PLAYER] = (void *(*)(struct connection *)) receive_packet_endgame_player_100;
91050 phandlers->receive[PACKET_TILE_INFO] = (void *(*)(struct connection *)) receive_packet_tile_info_100;
91051 phandlers->receive[PACKET_GAME_INFO] = (void *(*)(struct connection *)) receive_packet_game_info_100;
91052 phandlers->receive[PACKET_CALENDAR_INFO] = (void *(*)(struct connection *)) receive_packet_calendar_info_100;
91053 phandlers->receive[PACKET_TIMEOUT_INFO] = (void *(*)(struct connection *)) receive_packet_timeout_info_100;
91054 phandlers->receive[PACKET_MAP_INFO] = (void *(*)(struct connection *)) receive_packet_map_info_100;
91055 phandlers->receive[PACKET_NUKE_TILE_INFO] = (void *(*)(struct connection *)) receive_packet_nuke_tile_info_100;
91056 phandlers->receive[PACKET_TEAM_NAME_INFO] = (void *(*)(struct connection *)) receive_packet_team_name_info_100;
91057 phandlers->receive[PACKET_ACHIEVEMENT_INFO] = (void *(*)(struct connection *)) receive_packet_achievement_info_100;
91058 phandlers->receive[PACKET_CHAT_MSG] = (void *(*)(struct connection *)) receive_packet_chat_msg_100;
91059 phandlers->receive[PACKET_EARLY_CHAT_MSG] = (void *(*)(struct connection *)) receive_packet_early_chat_msg_100;
91060 phandlers->receive[PACKET_CONNECT_MSG] = (void *(*)(struct connection *)) receive_packet_connect_msg_100;
91061 phandlers->receive[PACKET_SERVER_INFO] = (void *(*)(struct connection *)) receive_packet_server_info_100;
91062 phandlers->receive[PACKET_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_city_remove_100;
91063 phandlers->receive[PACKET_CITY_INFO] = (void *(*)(struct connection *)) receive_packet_city_info_100;
91064 phandlers->receive[PACKET_CITY_NATIONALITIES] = (void *(*)(struct connection *)) receive_packet_city_nationalities_100;
91065 phandlers->receive[PACKET_CITY_UPDATE_COUNTERS] = (void *(*)(struct connection *)) receive_packet_city_update_counters_100;
91066 phandlers->receive[PACKET_CITY_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_city_short_info_100;
91067 phandlers->receive[PACKET_TRADE_ROUTE_INFO] = (void *(*)(struct connection *)) receive_packet_trade_route_info_100;
91068 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_INFO] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_info_100;
91069 phandlers->receive[PACKET_CITY_SABOTAGE_LIST] = (void *(*)(struct connection *)) receive_packet_city_sabotage_list_100;
91070 phandlers->receive[PACKET_PLAYER_REMOVE] = (void *(*)(struct connection *)) receive_packet_player_remove_100;
91071 phandlers->receive[PACKET_PLAYER_INFO] = (void *(*)(struct connection *)) receive_packet_player_info_100;
91072 phandlers->receive[PACKET_PLAYER_DIPLSTATE] = (void *(*)(struct connection *)) receive_packet_player_diplstate_100;
91073 phandlers->receive[PACKET_RESEARCH_INFO] = (void *(*)(struct connection *)) receive_packet_research_info_100;
91074 phandlers->receive[PACKET_UNKNOWN_RESEARCH] = (void *(*)(struct connection *)) receive_packet_unknown_research_100;
91075 phandlers->receive[PACKET_UNIT_REMOVE] = (void *(*)(struct connection *)) receive_packet_unit_remove_100;
91076 phandlers->receive[PACKET_UNIT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_info_100;
91077 phandlers->receive[PACKET_UNIT_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_short_info_100;
91078 phandlers->receive[PACKET_UNIT_COMBAT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_combat_info_100;
91079 phandlers->receive[PACKET_UNIT_ACTION_ANSWER] = (void *(*)(struct connection *)) receive_packet_unit_action_answer_100;
91080 phandlers->receive[PACKET_UNIT_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_actions_100;
91081 phandlers->receive[PACKET_DIPLOMACY_INIT_MEETING] = (void *(*)(struct connection *)) receive_packet_diplomacy_init_meeting_100;
91082 phandlers->receive[PACKET_DIPLOMACY_CANCEL_MEETING] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_meeting_100;
91083 phandlers->receive[PACKET_DIPLOMACY_CREATE_CLAUSE] = (void *(*)(struct connection *)) receive_packet_diplomacy_create_clause_100;
91084 phandlers->receive[PACKET_DIPLOMACY_REMOVE_CLAUSE] = (void *(*)(struct connection *)) receive_packet_diplomacy_remove_clause_100;
91085 phandlers->receive[PACKET_DIPLOMACY_ACCEPT_TREATY] = (void *(*)(struct connection *)) receive_packet_diplomacy_accept_treaty_100;
91086 phandlers->receive[PACKET_PAGE_MSG] = (void *(*)(struct connection *)) receive_packet_page_msg_100;
91087 phandlers->receive[PACKET_PAGE_MSG_PART] = (void *(*)(struct connection *)) receive_packet_page_msg_part_100;
91088 phandlers->receive[PACKET_CONN_INFO] = (void *(*)(struct connection *)) receive_packet_conn_info_100;
91089 phandlers->receive[PACKET_CONN_PING_INFO] = (void *(*)(struct connection *)) receive_packet_conn_ping_info_100;
91090 phandlers->receive[PACKET_CONN_PING] = (void *(*)(struct connection *)) receive_packet_conn_ping_100;
91091 phandlers->receive[PACKET_END_PHASE] = (void *(*)(struct connection *)) receive_packet_end_phase_100;
91092 phandlers->receive[PACKET_START_PHASE] = (void *(*)(struct connection *)) receive_packet_start_phase_100;
91093 phandlers->receive[PACKET_NEW_YEAR] = (void *(*)(struct connection *)) receive_packet_new_year_100;
91094 phandlers->receive[PACKET_BEGIN_TURN] = (void *(*)(struct connection *)) receive_packet_begin_turn_100;
91095 phandlers->receive[PACKET_END_TURN] = (void *(*)(struct connection *)) receive_packet_end_turn_100;
91096 phandlers->receive[PACKET_FREEZE_CLIENT] = (void *(*)(struct connection *)) receive_packet_freeze_client_100;
91097 phandlers->receive[PACKET_THAW_CLIENT] = (void *(*)(struct connection *)) receive_packet_thaw_client_100;
91098 phandlers->receive[PACKET_SPACESHIP_INFO] = (void *(*)(struct connection *)) receive_packet_spaceship_info_100;
91099 phandlers->receive[PACKET_RULESET_UNIT] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_100;
91100 phandlers->receive[PACKET_RULESET_UNIT_BONUS] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_bonus_100;
91101 phandlers->receive[PACKET_RULESET_UNIT_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_flag_100;
91102 phandlers->receive[PACKET_RULESET_UNIT_CLASS_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_class_flag_100;
91103 phandlers->receive[PACKET_RULESET_GAME] = (void *(*)(struct connection *)) receive_packet_ruleset_game_100;
91104 phandlers->receive[PACKET_RULESET_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_ruleset_specialist_100;
91105 phandlers->receive[PACKET_RULESET_GOVERNMENT_RULER_TITLE] = (void *(*)(struct connection *)) receive_packet_ruleset_government_ruler_title_100;
91106 phandlers->receive[PACKET_RULESET_TECH] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_100;
91107 phandlers->receive[PACKET_RULESET_TECH_CLASS] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_class_100;
91108 phandlers->receive[PACKET_RULESET_TECH_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_flag_100;
91109 phandlers->receive[PACKET_RULESET_GOVERNMENT] = (void *(*)(struct connection *)) receive_packet_ruleset_government_100;
91110 phandlers->receive[PACKET_RULESET_TERRAIN_CONTROL] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_control_100;
91111 phandlers->receive[PACKET_RULESETS_READY] = (void *(*)(struct connection *)) receive_packet_rulesets_ready_100;
91112 phandlers->receive[PACKET_RULESET_NATION_SETS] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_sets_100;
91113 phandlers->receive[PACKET_RULESET_NATION_GROUPS] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_groups_100;
91114 phandlers->receive[PACKET_RULESET_NATION] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_100;
91115 phandlers->receive[PACKET_NATION_AVAILABILITY] = (void *(*)(struct connection *)) receive_packet_nation_availability_100;
91116 phandlers->receive[PACKET_RULESET_STYLE] = (void *(*)(struct connection *)) receive_packet_ruleset_style_100;
91117 phandlers->receive[PACKET_RULESET_CITY] = (void *(*)(struct connection *)) receive_packet_ruleset_city_100;
91118 phandlers->receive[PACKET_RULESET_BUILDING] = (void *(*)(struct connection *)) receive_packet_ruleset_building_100;
91119 phandlers->receive[PACKET_RULESET_IMPR_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_impr_flag_100;
91120 phandlers->receive[PACKET_RULESET_TERRAIN] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_100;
91121 phandlers->receive[PACKET_RULESET_TERRAIN_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_flag_100;
91122 phandlers->receive[PACKET_RULESET_UNIT_CLASS] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_class_100;
91123 phandlers->receive[PACKET_RULESET_EXTRA] = (void *(*)(struct connection *)) receive_packet_ruleset_extra_100;
91124 phandlers->receive[PACKET_RULESET_EXTRA_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_extra_flag_100;
91125 phandlers->receive[PACKET_RULESET_BASE] = (void *(*)(struct connection *)) receive_packet_ruleset_base_100;
91126 phandlers->receive[PACKET_RULESET_ROAD] = (void *(*)(struct connection *)) receive_packet_ruleset_road_100;
91127 phandlers->receive[PACKET_RULESET_GOODS] = (void *(*)(struct connection *)) receive_packet_ruleset_goods_100;
91128 phandlers->receive[PACKET_RULESET_DISASTER] = (void *(*)(struct connection *)) receive_packet_ruleset_disaster_100;
91129 phandlers->receive[PACKET_RULESET_ACHIEVEMENT] = (void *(*)(struct connection *)) receive_packet_ruleset_achievement_100;
91130 phandlers->receive[PACKET_RULESET_TRADE] = (void *(*)(struct connection *)) receive_packet_ruleset_trade_100;
91131 phandlers->receive[PACKET_RULESET_ACTION] = (void *(*)(struct connection *)) receive_packet_ruleset_action_100;
91132 phandlers->receive[PACKET_RULESET_ACTION_ENABLER] = (void *(*)(struct connection *)) receive_packet_ruleset_action_enabler_100;
91133 phandlers->receive[PACKET_RULESET_ACTION_AUTO] = (void *(*)(struct connection *)) receive_packet_ruleset_action_auto_100;
91134 phandlers->receive[PACKET_RULESET_COUNTER] = (void *(*)(struct connection *)) receive_packet_ruleset_counter_100;
91135 phandlers->receive[PACKET_RULESET_MUSIC] = (void *(*)(struct connection *)) receive_packet_ruleset_music_100;
91136 phandlers->receive[PACKET_RULESET_MULTIPLIER] = (void *(*)(struct connection *)) receive_packet_ruleset_multiplier_100;
91137 phandlers->receive[PACKET_RULESET_CLAUSE] = (void *(*)(struct connection *)) receive_packet_ruleset_clause_100;
91138 phandlers->receive[PACKET_RULESET_CONTROL] = (void *(*)(struct connection *)) receive_packet_ruleset_control_100;
91139 phandlers->receive[PACKET_RULESET_SUMMARY] = (void *(*)(struct connection *)) receive_packet_ruleset_summary_100;
91140 phandlers->receive[PACKET_RULESET_DESCRIPTION_PART] = (void *(*)(struct connection *)) receive_packet_ruleset_description_part_100;
91141 phandlers->receive[PACKET_SINGLE_WANT_HACK_REPLY] = (void *(*)(struct connection *)) receive_packet_single_want_hack_reply_100;
91142 phandlers->receive[PACKET_RULESET_CHOICES] = (void *(*)(struct connection *)) receive_packet_ruleset_choices_100;
91143 phandlers->receive[PACKET_GAME_LOAD] = (void *(*)(struct connection *)) receive_packet_game_load_100;
91144 phandlers->receive[PACKET_SERVER_SETTING_CONTROL] = (void *(*)(struct connection *)) receive_packet_server_setting_control_100;
91145 phandlers->receive[PACKET_SERVER_SETTING_CONST] = (void *(*)(struct connection *)) receive_packet_server_setting_const_100;
91146 phandlers->receive[PACKET_SERVER_SETTING_BOOL] = (void *(*)(struct connection *)) receive_packet_server_setting_bool_100;
91147 phandlers->receive[PACKET_SERVER_SETTING_INT] = (void *(*)(struct connection *)) receive_packet_server_setting_int_100;
91148 phandlers->receive[PACKET_SERVER_SETTING_STR] = (void *(*)(struct connection *)) receive_packet_server_setting_str_100;
91149 phandlers->receive[PACKET_SERVER_SETTING_ENUM] = (void *(*)(struct connection *)) receive_packet_server_setting_enum_100;
91150 phandlers->receive[PACKET_SERVER_SETTING_BITWISE] = (void *(*)(struct connection *)) receive_packet_server_setting_bitwise_100;
91151 phandlers->receive[PACKET_SET_TOPOLOGY] = (void *(*)(struct connection *)) receive_packet_set_topology_100;
91152 phandlers->receive[PACKET_RULESET_EFFECT] = (void *(*)(struct connection *)) receive_packet_ruleset_effect_100;
91153 phandlers->receive[PACKET_RULESET_RESOURCE] = (void *(*)(struct connection *)) receive_packet_ruleset_resource_100;
91154 phandlers->receive[PACKET_SCENARIO_INFO] = (void *(*)(struct connection *)) receive_packet_scenario_info_100;
91155 phandlers->receive[PACKET_SCENARIO_DESCRIPTION] = (void *(*)(struct connection *)) receive_packet_scenario_description_100;
91156 phandlers->receive[PACKET_VOTE_NEW] = (void *(*)(struct connection *)) receive_packet_vote_new_100;
91157 phandlers->receive[PACKET_VOTE_UPDATE] = (void *(*)(struct connection *)) receive_packet_vote_update_100;
91158 phandlers->receive[PACKET_VOTE_REMOVE] = (void *(*)(struct connection *)) receive_packet_vote_remove_100;
91159 phandlers->receive[PACKET_VOTE_RESOLVE] = (void *(*)(struct connection *)) receive_packet_vote_resolve_100;
91160 phandlers->receive[PACKET_EDIT_OBJECT_CREATED] = (void *(*)(struct connection *)) receive_packet_edit_object_created_100;
91161 phandlers->receive[PACKET_PLAY_MUSIC] = (void *(*)(struct connection *)) receive_packet_play_music_100;
91162 phandlers->receive[PACKET_WEB_CITY_INFO_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_city_info_addition_100;
91163 phandlers->receive[PACKET_WEB_PLAYER_INFO_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_player_info_addition_100;
91164 phandlers->receive[PACKET_WEB_RULESET_UNIT_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_ruleset_unit_addition_100;
91165 }
91166}
91167
91168 void packet_handlers_fill_capability(struct packet_handlers *phandlers,
91169 const char *capability)
91170{
91171}
91172
91173 void packet_destroy(void *packet, enum packet_type type)
91174{
91175 static void (*const destroy_handlers[PACKET_LAST])(void *packet) = {
91176 [PACKET_PROCESSING_STARTED] = destroy_packet_processing_started,
91177 [PACKET_PROCESSING_FINISHED] = destroy_packet_processing_finished,
91178 [PACKET_INVESTIGATE_STARTED] = destroy_packet_investigate_started,
91179 [PACKET_INVESTIGATE_FINISHED] = destroy_packet_investigate_finished,
91180 [PACKET_SERVER_JOIN_REQ] = destroy_packet_server_join_req,
91181 [PACKET_SERVER_JOIN_REPLY] = destroy_packet_server_join_reply,
91182 [PACKET_AUTHENTICATION_REQ] = destroy_packet_authentication_req,
91183 [PACKET_AUTHENTICATION_REPLY] = destroy_packet_authentication_reply,
91184 [PACKET_SERVER_SHUTDOWN] = destroy_packet_server_shutdown,
91185 [PACKET_NATION_SELECT_REQ] = destroy_packet_nation_select_req,
91186 [PACKET_PLAYER_READY] = destroy_packet_player_ready,
91187 [PACKET_ENDGAME_REPORT] = destroy_packet_endgame_report,
91188 [PACKET_ENDGAME_PLAYER] = destroy_packet_endgame_player,
91189 [PACKET_TILE_INFO] = destroy_packet_tile_info,
91190 [PACKET_GAME_INFO] = destroy_packet_game_info,
91191 [PACKET_CALENDAR_INFO] = destroy_packet_calendar_info,
91192 [PACKET_TIMEOUT_INFO] = destroy_packet_timeout_info,
91193 [PACKET_MAP_INFO] = destroy_packet_map_info,
91194 [PACKET_NUKE_TILE_INFO] = destroy_packet_nuke_tile_info,
91195 [PACKET_TEAM_NAME_INFO] = destroy_packet_team_name_info,
91196 [PACKET_ACHIEVEMENT_INFO] = destroy_packet_achievement_info,
91197 [PACKET_CHAT_MSG] = destroy_packet_chat_msg,
91198 [PACKET_EARLY_CHAT_MSG] = destroy_packet_early_chat_msg,
91199 [PACKET_CHAT_MSG_REQ] = destroy_packet_chat_msg_req,
91200 [PACKET_CONNECT_MSG] = destroy_packet_connect_msg,
91201 [PACKET_SERVER_INFO] = destroy_packet_server_info,
91202 [PACKET_CITY_REMOVE] = destroy_packet_city_remove,
91203 [PACKET_CITY_INFO] = destroy_packet_city_info,
91204 [PACKET_CITY_NATIONALITIES] = destroy_packet_city_nationalities,
91205 [PACKET_CITY_UPDATE_COUNTERS] = destroy_packet_city_update_counters,
91206 [PACKET_CITY_SHORT_INFO] = destroy_packet_city_short_info,
91207 [PACKET_TRADE_ROUTE_INFO] = destroy_packet_trade_route_info,
91208 [PACKET_CITY_SELL] = destroy_packet_city_sell,
91209 [PACKET_CITY_BUY] = destroy_packet_city_buy,
91210 [PACKET_CITY_CHANGE] = destroy_packet_city_change,
91211 [PACKET_CITY_WORKLIST] = destroy_packet_city_worklist,
91212 [PACKET_CITY_MAKE_SPECIALIST] = destroy_packet_city_make_specialist,
91213 [PACKET_CITY_MAKE_WORKER] = destroy_packet_city_make_worker,
91214 [PACKET_CITY_CHANGE_SPECIALIST] = destroy_packet_city_change_specialist,
91215 [PACKET_CITY_RENAME] = destroy_packet_city_rename,
91216 [PACKET_CITY_OPTIONS_REQ] = destroy_packet_city_options_req,
91217 [PACKET_CITY_REFRESH] = destroy_packet_city_refresh,
91218 [PACKET_CITY_NAME_SUGGESTION_REQ] = destroy_packet_city_name_suggestion_req,
91219 [PACKET_CITY_NAME_SUGGESTION_INFO] = destroy_packet_city_name_suggestion_info,
91220 [PACKET_CITY_SABOTAGE_LIST] = destroy_packet_city_sabotage_list,
91221 [PACKET_CITY_RALLY_POINT] = destroy_packet_city_rally_point,
91222 [PACKET_WORKER_TASK] = destroy_packet_worker_task,
91223 [PACKET_PLAYER_REMOVE] = destroy_packet_player_remove,
91224 [PACKET_PLAYER_INFO] = destroy_packet_player_info,
91225 [PACKET_PLAYER_PHASE_DONE] = destroy_packet_player_phase_done,
91226 [PACKET_PLAYER_RATES] = destroy_packet_player_rates,
91227 [PACKET_PLAYER_CHANGE_GOVERNMENT] = destroy_packet_player_change_government,
91228 [PACKET_PLAYER_PLACE_INFRA] = destroy_packet_player_place_infra,
91229 [PACKET_PLAYER_ATTRIBUTE_BLOCK] = destroy_packet_player_attribute_block,
91230 [PACKET_PLAYER_ATTRIBUTE_CHUNK] = destroy_packet_player_attribute_chunk,
91231 [PACKET_PLAYER_DIPLSTATE] = destroy_packet_player_diplstate,
91232 [PACKET_PLAYER_MULTIPLIER] = destroy_packet_player_multiplier,
91233 [PACKET_RESEARCH_INFO] = destroy_packet_research_info,
91234 [PACKET_UNKNOWN_RESEARCH] = destroy_packet_unknown_research,
91235 [PACKET_PLAYER_RESEARCH] = destroy_packet_player_research,
91236 [PACKET_PLAYER_TECH_GOAL] = destroy_packet_player_tech_goal,
91237 [PACKET_UNIT_REMOVE] = destroy_packet_unit_remove,
91238 [PACKET_UNIT_INFO] = destroy_packet_unit_info,
91239 [PACKET_UNIT_SHORT_INFO] = destroy_packet_unit_short_info,
91240 [PACKET_UNIT_COMBAT_INFO] = destroy_packet_unit_combat_info,
91241 [PACKET_UNIT_SSCS_SET] = destroy_packet_unit_sscs_set,
91242 [PACKET_UNIT_ORDERS] = destroy_packet_unit_orders,
91243 [PACKET_UNIT_SERVER_SIDE_AGENT_SET] = destroy_packet_unit_server_side_agent_set,
91244 [PACKET_UNIT_ACTION_QUERY] = destroy_packet_unit_action_query,
91245 [PACKET_UNIT_TYPE_UPGRADE] = destroy_packet_unit_type_upgrade,
91246 [PACKET_UNIT_DO_ACTION] = destroy_packet_unit_do_action,
91247 [PACKET_UNIT_ACTION_ANSWER] = destroy_packet_unit_action_answer,
91248 [PACKET_UNIT_GET_ACTIONS] = destroy_packet_unit_get_actions,
91249 [PACKET_UNIT_ACTIONS] = destroy_packet_unit_actions,
91250 [PACKET_UNIT_CHANGE_ACTIVITY] = destroy_packet_unit_change_activity,
91251 [PACKET_DIPLOMACY_INIT_MEETING_REQ] = destroy_packet_diplomacy_init_meeting_req,
91252 [PACKET_DIPLOMACY_INIT_MEETING] = destroy_packet_diplomacy_init_meeting,
91253 [PACKET_DIPLOMACY_CANCEL_MEETING_REQ] = destroy_packet_diplomacy_cancel_meeting_req,
91254 [PACKET_DIPLOMACY_CANCEL_MEETING] = destroy_packet_diplomacy_cancel_meeting,
91255 [PACKET_DIPLOMACY_CREATE_CLAUSE_REQ] = destroy_packet_diplomacy_create_clause_req,
91256 [PACKET_DIPLOMACY_CREATE_CLAUSE] = destroy_packet_diplomacy_create_clause,
91257 [PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ] = destroy_packet_diplomacy_remove_clause_req,
91258 [PACKET_DIPLOMACY_REMOVE_CLAUSE] = destroy_packet_diplomacy_remove_clause,
91259 [PACKET_DIPLOMACY_ACCEPT_TREATY_REQ] = destroy_packet_diplomacy_accept_treaty_req,
91260 [PACKET_DIPLOMACY_ACCEPT_TREATY] = destroy_packet_diplomacy_accept_treaty,
91261 [PACKET_DIPLOMACY_CANCEL_PACT] = destroy_packet_diplomacy_cancel_pact,
91262 [PACKET_PAGE_MSG] = destroy_packet_page_msg,
91263 [PACKET_PAGE_MSG_PART] = destroy_packet_page_msg_part,
91264 [PACKET_REPORT_REQ] = destroy_packet_report_req,
91265 [PACKET_CONN_INFO] = destroy_packet_conn_info,
91266 [PACKET_CONN_PING_INFO] = destroy_packet_conn_ping_info,
91267 [PACKET_CONN_PING] = destroy_packet_conn_ping,
91268 [PACKET_CONN_PONG] = destroy_packet_conn_pong,
91269 [PACKET_CLIENT_HEARTBEAT] = destroy_packet_client_heartbeat,
91270 [PACKET_CLIENT_INFO] = destroy_packet_client_info,
91271 [PACKET_END_PHASE] = destroy_packet_end_phase,
91272 [PACKET_START_PHASE] = destroy_packet_start_phase,
91273 [PACKET_NEW_YEAR] = destroy_packet_new_year,
91274 [PACKET_BEGIN_TURN] = destroy_packet_begin_turn,
91275 [PACKET_END_TURN] = destroy_packet_end_turn,
91276 [PACKET_FREEZE_CLIENT] = destroy_packet_freeze_client,
91277 [PACKET_THAW_CLIENT] = destroy_packet_thaw_client,
91278 [PACKET_SPACESHIP_LAUNCH] = destroy_packet_spaceship_launch,
91279 [PACKET_SPACESHIP_PLACE] = destroy_packet_spaceship_place,
91280 [PACKET_SPACESHIP_INFO] = destroy_packet_spaceship_info,
91281 [PACKET_RULESET_UNIT] = destroy_packet_ruleset_unit,
91282 [PACKET_RULESET_UNIT_BONUS] = destroy_packet_ruleset_unit_bonus,
91283 [PACKET_RULESET_UNIT_FLAG] = destroy_packet_ruleset_unit_flag,
91284 [PACKET_RULESET_UNIT_CLASS_FLAG] = destroy_packet_ruleset_unit_class_flag,
91285 [PACKET_RULESET_GAME] = destroy_packet_ruleset_game,
91286 [PACKET_RULESET_SPECIALIST] = destroy_packet_ruleset_specialist,
91287 [PACKET_RULESET_GOVERNMENT_RULER_TITLE] = destroy_packet_ruleset_government_ruler_title,
91288 [PACKET_RULESET_TECH] = destroy_packet_ruleset_tech,
91289 [PACKET_RULESET_TECH_CLASS] = destroy_packet_ruleset_tech_class,
91290 [PACKET_RULESET_TECH_FLAG] = destroy_packet_ruleset_tech_flag,
91291 [PACKET_RULESET_GOVERNMENT] = destroy_packet_ruleset_government,
91292 [PACKET_RULESET_TERRAIN_CONTROL] = destroy_packet_ruleset_terrain_control,
91293 [PACKET_RULESETS_READY] = destroy_packet_rulesets_ready,
91294 [PACKET_RULESET_NATION_SETS] = destroy_packet_ruleset_nation_sets,
91295 [PACKET_RULESET_NATION_GROUPS] = destroy_packet_ruleset_nation_groups,
91296 [PACKET_RULESET_NATION] = destroy_packet_ruleset_nation,
91297 [PACKET_NATION_AVAILABILITY] = destroy_packet_nation_availability,
91298 [PACKET_RULESET_STYLE] = destroy_packet_ruleset_style,
91299 [PACKET_RULESET_CITY] = destroy_packet_ruleset_city,
91300 [PACKET_RULESET_BUILDING] = destroy_packet_ruleset_building,
91301 [PACKET_RULESET_IMPR_FLAG] = destroy_packet_ruleset_impr_flag,
91302 [PACKET_RULESET_TERRAIN] = destroy_packet_ruleset_terrain,
91303 [PACKET_RULESET_TERRAIN_FLAG] = destroy_packet_ruleset_terrain_flag,
91304 [PACKET_RULESET_UNIT_CLASS] = destroy_packet_ruleset_unit_class,
91305 [PACKET_RULESET_EXTRA] = destroy_packet_ruleset_extra,
91306 [PACKET_RULESET_EXTRA_FLAG] = destroy_packet_ruleset_extra_flag,
91307 [PACKET_RULESET_BASE] = destroy_packet_ruleset_base,
91308 [PACKET_RULESET_ROAD] = destroy_packet_ruleset_road,
91309 [PACKET_RULESET_GOODS] = destroy_packet_ruleset_goods,
91310 [PACKET_RULESET_DISASTER] = destroy_packet_ruleset_disaster,
91311 [PACKET_RULESET_ACHIEVEMENT] = destroy_packet_ruleset_achievement,
91312 [PACKET_RULESET_TRADE] = destroy_packet_ruleset_trade,
91313 [PACKET_RULESET_ACTION] = destroy_packet_ruleset_action,
91314 [PACKET_RULESET_ACTION_ENABLER] = destroy_packet_ruleset_action_enabler,
91315 [PACKET_RULESET_ACTION_AUTO] = destroy_packet_ruleset_action_auto,
91316 [PACKET_RULESET_COUNTER] = destroy_packet_ruleset_counter,
91317 [PACKET_RULESET_MUSIC] = destroy_packet_ruleset_music,
91318 [PACKET_RULESET_MULTIPLIER] = destroy_packet_ruleset_multiplier,
91319 [PACKET_RULESET_CLAUSE] = destroy_packet_ruleset_clause,
91320 [PACKET_RULESET_CONTROL] = destroy_packet_ruleset_control,
91321 [PACKET_RULESET_SUMMARY] = destroy_packet_ruleset_summary,
91322 [PACKET_RULESET_DESCRIPTION_PART] = destroy_packet_ruleset_description_part,
91323 [PACKET_SINGLE_WANT_HACK_REQ] = destroy_packet_single_want_hack_req,
91324 [PACKET_SINGLE_WANT_HACK_REPLY] = destroy_packet_single_want_hack_reply,
91325 [PACKET_RULESET_CHOICES] = destroy_packet_ruleset_choices,
91326 [PACKET_RULESET_SELECT] = destroy_packet_ruleset_select,
91327 [PACKET_GAME_LOAD] = destroy_packet_game_load,
91328 [PACKET_SERVER_SETTING_CONTROL] = destroy_packet_server_setting_control,
91329 [PACKET_SERVER_SETTING_CONST] = destroy_packet_server_setting_const,
91330 [PACKET_SERVER_SETTING_BOOL] = destroy_packet_server_setting_bool,
91331 [PACKET_SERVER_SETTING_INT] = destroy_packet_server_setting_int,
91332 [PACKET_SERVER_SETTING_STR] = destroy_packet_server_setting_str,
91333 [PACKET_SERVER_SETTING_ENUM] = destroy_packet_server_setting_enum,
91334 [PACKET_SERVER_SETTING_BITWISE] = destroy_packet_server_setting_bitwise,
91335 [PACKET_SET_TOPOLOGY] = destroy_packet_set_topology,
91336 [PACKET_RULESET_EFFECT] = destroy_packet_ruleset_effect,
91337 [PACKET_RULESET_RESOURCE] = destroy_packet_ruleset_resource,
91338 [PACKET_SCENARIO_INFO] = destroy_packet_scenario_info,
91339 [PACKET_SCENARIO_DESCRIPTION] = destroy_packet_scenario_description,
91340 [PACKET_SAVE_SCENARIO] = destroy_packet_save_scenario,
91341 [PACKET_VOTE_NEW] = destroy_packet_vote_new,
91342 [PACKET_VOTE_UPDATE] = destroy_packet_vote_update,
91343 [PACKET_VOTE_REMOVE] = destroy_packet_vote_remove,
91344 [PACKET_VOTE_RESOLVE] = destroy_packet_vote_resolve,
91345 [PACKET_VOTE_SUBMIT] = destroy_packet_vote_submit,
91346 [PACKET_EDIT_MODE] = destroy_packet_edit_mode,
91347 [PACKET_EDIT_RECALCULATE_BORDERS] = destroy_packet_edit_recalculate_borders,
91348 [PACKET_EDIT_CHECK_TILES] = destroy_packet_edit_check_tiles,
91349 [PACKET_EDIT_TOGGLE_FOGOFWAR] = destroy_packet_edit_toggle_fogofwar,
91350 [PACKET_EDIT_TILE_TERRAIN] = destroy_packet_edit_tile_terrain,
91351 [PACKET_EDIT_TILE_EXTRA] = destroy_packet_edit_tile_extra,
91352 [PACKET_EDIT_STARTPOS] = destroy_packet_edit_startpos,
91353 [PACKET_EDIT_STARTPOS_FULL] = destroy_packet_edit_startpos_full,
91354 [PACKET_EDIT_TILE] = destroy_packet_edit_tile,
91355 [PACKET_EDIT_UNIT_CREATE] = destroy_packet_edit_unit_create,
91356 [PACKET_EDIT_UNIT_REMOVE] = destroy_packet_edit_unit_remove,
91357 [PACKET_EDIT_UNIT_REMOVE_BY_ID] = destroy_packet_edit_unit_remove_by_id,
91358 [PACKET_EDIT_UNIT] = destroy_packet_edit_unit,
91359 [PACKET_EDIT_CITY_CREATE] = destroy_packet_edit_city_create,
91360 [PACKET_EDIT_CITY_REMOVE] = destroy_packet_edit_city_remove,
91361 [PACKET_EDIT_CITY] = destroy_packet_edit_city,
91362 [PACKET_EDIT_PLAYER_CREATE] = destroy_packet_edit_player_create,
91363 [PACKET_EDIT_PLAYER_REMOVE] = destroy_packet_edit_player_remove,
91364 [PACKET_EDIT_PLAYER] = destroy_packet_edit_player,
91365 [PACKET_EDIT_PLAYER_VISION] = destroy_packet_edit_player_vision,
91366 [PACKET_EDIT_GAME] = destroy_packet_edit_game,
91367 [PACKET_EDIT_SCENARIO_DESC] = destroy_packet_edit_scenario_desc,
91368 [PACKET_EDIT_OBJECT_CREATED] = destroy_packet_edit_object_created,
91369 [PACKET_PLAY_MUSIC] = destroy_packet_play_music,
91370 [PACKET_WEB_CITY_INFO_ADDITION] = destroy_packet_web_city_info_addition,
91371 [PACKET_WEB_CMA_SET] = destroy_packet_web_cma_set,
91372 [PACKET_WEB_CMA_CLEAR] = destroy_packet_web_cma_clear,
91373 [PACKET_WEB_PLAYER_INFO_ADDITION] = destroy_packet_web_player_info_addition,
91374 [PACKET_WEB_RULESET_UNIT_ADDITION] = destroy_packet_web_ruleset_unit_addition,
91375 };
91376 void (*handler)(void *packet) = (type < PACKET_LAST ? destroy_handlers[type] : nullptr);
91377
91378 fc_assert_action_msg(handler != nullptr, handler = free,
91379 "packet_destroy(): invalid packet type %d", type);
91380
91381 handler(packet);
91382}
are_action_probabilitys_equal
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5085
MAX_NUM_ACTIONS
#define MAX_NUM_ACTIONS
Definition actions.h:58
bitvector.h
BV_DEFINE
#define BV_DEFINE(name, bits)
Definition bitvector.h:132
BV_CLR_ALL
#define BV_CLR_ALL(bv)
Definition bitvector.h:95
BV_SET
#define BV_SET(bv, bit)
Definition bitvector.h:81
BV_ARE_EQUAL
#define BV_ARE_EQUAL(vec1, vec2)
Definition bitvector.h:113
BV_ISSET
#define BV_ISSET(bv, bit)
Definition bitvector.h:78
capability.h
capstr.h
FEELING_LAST
@ FEELING_LAST
Definition city.h:285
cm_are_parameter_equal
bool cm_are_parameter_equal(const struct cm_parameter *const p1, const struct cm_parameter *const p2)
Definition cm.c:2138
calendar_fragments
char * calendar_fragments
Definition comments.c:100
resources
char * resources
Definition comments.c:36
world_peace_turns
char * world_peace_turns
Definition comments.c:99
disasters
char * disasters
Definition comments.c:45
culture_migration_pml
char * culture_migration_pml
Definition comments.c:98
incite_cost
char * incite_cost
Definition comments.c:74
ATTRIBUTE_CHUNK_SIZE
#define ATTRIBUTE_CHUNK_SIZE
Definition conn_types.h:66
MAX_LEN_PACKET
#define MAX_LEN_PACKET
Definition conn_types.h:29
report_type
report_type
Definition conn_types.h:49
MAX_LEN_ROUTE
#define MAX_LEN_ROUTE
Definition conn_types.h:38
authentication_type
authentication_type
Definition conn_types.h:41
conn_description
const char * conn_description(const struct connection *pconn)
Definition connection.c:474
connection.h
conn_list_iterate
#define conn_list_iterate(connlist, pconn)
Definition connection.h:108
conn_list_iterate_end
#define conn_list_iterate_end
Definition connection.h:110
counters
static struct counter counters[MAX_COUNTERS]
Definition counters.c:31
dataio.h
DIO_BV_PUT
#define DIO_BV_PUT(pdout, location, bv)
Definition dataio_json.h:196
DIO_BV_GET
#define DIO_BV_GET(pdin, location, bv)
Definition dataio_json.h:123
DIO_GET
#define DIO_GET(f, d, l,...)
Definition dataio_json.h:127
DIO_PUT
#define DIO_PUT(f, d, l,...)
Definition dataio_json.h:199
plocation_field_new
struct plocation * plocation_field_new(char *name)
Definition dataio_raw.c:1100
plocation_elem_new
struct plocation * plocation_elem_new(int number)
Definition dataio_raw.c:1114
airlift
static void airlift(QVariant data1, QVariant data2)
Definition dialogs.cpp:1838
caption
const char * caption
Definition dialogs_g.h:37
headline
const char const char * headline
Definition dialogs_g.h:38
cost
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int cost
Definition dialogs_g.h:74
diplomat_investigate
bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction)
Definition diplomats.c:324
id
int int id
Definition editgui_g.h:28
effects
struct effect_list * effects[EFT_COUNT]
Definition effects.c:127
reqs
struct @21::@22 reqs
event
enum event_type event
Definition events.c:81
extras
static struct extra_type extras[MAX_EXTRA_TYPES]
Definition extras.c:31
extra_count
int extra_count(void)
Definition extras.c:153
is_server
static bool is_server(void)
Definition fc_interface.h:69
MAX_NUM_CONNECTIONS
#define MAX_NUM_CONNECTIONS
Definition fc_types.h:38
MAX_CITY_NATIONALITIES
#define MAX_CITY_NATIONALITIES
Definition fc_types.h:89
MAX_VET_LEVELS
#define MAX_VET_LEVELS
Definition fc_types.h:49
MAX_GRANARY_INIS
#define MAX_GRANARY_INIS
Definition fc_types.h:72
MAX_NUM_NATIONS
#define MAX_NUM_NATIONS
Definition fc_types.h:60
MAX_NUM_RULESETS
#define MAX_NUM_RULESETS
Definition fc_types.h:416
MAX_NUM_NATION_SETS
#define MAX_NUM_NATION_SETS
Definition fc_types.h:57
MAX_NUM_BUILDING_LIST
#define MAX_NUM_BUILDING_LIST
Definition fc_types.h:46
MAX_NUM_REQS
#define MAX_NUM_REQS
Definition fc_types.h:414
Nation_type_id
int Nation_type_id
Definition fc_types.h:384
Terrain_type_id
int Terrain_type_id
Definition fc_types.h:377
action_id
int action_id
Definition fc_types.h:393
SP_MAX
#define SP_MAX
Definition fc_types.h:413
Specialist_type_id
int Specialist_type_id
Definition fc_types.h:379
Government_type_id
int Government_type_id
Definition fc_types.h:385
MAX_CALENDAR_FRAGMENTS
#define MAX_CALENDAR_FRAGMENTS
Definition fc_types.h:62
MAX_NUM_NATION_GROUPS
#define MAX_NUM_NATION_GROUPS
Definition fc_types.h:58
MAX_NUM_PLAYER_SLOTS
#define MAX_NUM_PLAYER_SLOTS
Definition fc_types.h:32
MAX_NUM_LEADERS
#define MAX_NUM_LEADERS
Definition fc_types.h:56
MAX_NUM_MULTIPLIERS
#define MAX_NUM_MULTIPLIERS
Definition fc_types.h:55
MAX_NUM_UNIT_LIST
#define MAX_NUM_UNIT_LIST
Definition fc_types.h:45
MAX_EXTRA_TYPES
#define MAX_EXTRA_TYPES
Definition fc_types.h:50
spaceship_place_type
spaceship_place_type
Definition fc_types.h:1307
Unit_type_id
int Unit_type_id
Definition fc_types.h:386
MAX_NUM_TECH_LIST
#define MAX_NUM_TECH_LIST
Definition fc_types.h:44
O_LAST
@ O_LAST
Definition fc_types.h:101
MAX_CITY_TILES
#define MAX_CITY_TILES
Definition fc_types.h:87
MAX_COUNTERS
#define MAX_COUNTERS
Definition fc_types.h:106
Multiplier_type_id
int Multiplier_type_id
Definition fc_types.h:390
game.h
genhash_new_full
struct genhash * genhash_new_full(genhash_val_fn_t key_val_func, genhash_comp_fn_t key_comp_func, genhash_copy_fn_t key_copy_func, genhash_free_fn_t key_free_func, genhash_copy_fn_t data_copy_func, genhash_free_fn_t data_free_func)
Definition genhash.c:268
genhash_insert
bool genhash_insert(struct genhash *pgenhash, const void *key, const void *data)
Definition genhash.c:604
genhash_lookup
bool genhash_lookup(const struct genhash *pgenhash, const void *key, void **pdata)
Definition genhash.c:681
genhash_remove
bool genhash_remove(struct genhash *pgenhash, const void *key)
Definition genhash.c:702
genhash.h
genhash_val_t
unsigned int genhash_val_t
Definition genhash.h:32
government_count
Government_type_id government_count(void)
Definition government.c:71
actor_unit_id
static int actor_unit_id
Definition action_dialog.c:68
target_extra_id
static int target_extra_id
Definition action_dialog.c:70
owner
struct city * owner
Definition citydlg.c:220
load_filename
static void load_filename(const char *filename)
Definition pages.c:2840
scenario_authors
static GtkWidget * scenario_authors
Definition pages.c:64
persistent
static GtkWidget * persistent
Definition rallypointdlg.c:40
type
GType type
Definition repodlgs.c:1313
hash
static GHashTable * hash
Definition wldlg.c:322
leader_name
static char * leader_name
Definition dialogs.c:97
B_LAST
#define B_LAST
Definition improvement.h:42
name
const char * name
Definition inputfile.c:127
log.h
log_packet_detailed
#define log_packet_detailed
Definition log.h:138
fc_assert
#define fc_assert(condition)
Definition log.h:176
fc_assert_action_msg
#define fc_assert_action_msg(condition, action, message,...)
Definition log.h:201
log_error
#define log_error(message,...)
Definition log.h:103
fc_assert_ret_val_msg
#define fc_assert_ret_val_msg(condition, val, message,...)
Definition log.h:208
nuclear_winter
void nuclear_winter(int effect)
Definition maphand.c:119
global_warming
void global_warming(int effect)
Definition maphand.c:106
mem.h
FC_FREE
#define FC_FREE(ptr)
Definition mem.h:41
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
gui
static mpgui * gui
Definition mpgui_qt.cpp:52
worker
static mpqt_worker * worker
Definition mpgui_qt.cpp:54
multipliers
static struct multiplier multipliers[MAX_NUM_MULTIPLIERS]
Definition multipliers.c:23
nation_count
Nation_type_id nation_count(void)
Definition nation.c:507
num_nation_sets
static int num_nation_sets
Definition nation.c:48
num_nation_groups
static int num_nation_groups
Definition nation.c:50
nations
static struct nation_type * nations
Definition nation.c:46
post_receive_packet_server_join_reply
void post_receive_packet_server_join_reply(struct connection *pconn, const struct packet_server_join_reply *packet)
Definition packets.c:652
pre_send_packet_player_attribute_chunk
void pre_send_packet_player_attribute_chunk(struct connection *pc, struct packet_player_attribute_chunk *packet)
Definition packets.c:793
post_send_packet_server_join_reply
void post_send_packet_server_join_reply(struct connection *pconn, const struct packet_server_join_reply *packet)
Definition packets.c:640
packets.h
SEND_PACKET_START
#define SEND_PACKET_START(packet_type)
Definition packets.h:129
RECEIVE_PACKET_START
#define RECEIVE_PACKET_START(packet_type, result)
Definition packets.h:147
SEND_PACKET_END
#define SEND_PACKET_END(packet_type)
Definition packets.h:137
RECEIVE_PACKET_FIELD_ERROR
#define RECEIVE_PACKET_FIELD_ERROR(field,...)
Definition packets.h:173
RECEIVE_PACKET_END
#define RECEIVE_PACKET_END(result)
Definition packets.h:163
init_packet_vote_update
static void init_packet_vote_update(struct packet_vote_update *packet)
Definition packets_gen.c:79719
destroy_packet_city_worklist
#define destroy_packet_city_worklist
Definition packets_gen.c:19097
send_packet_map_info_100
static int send_packet_map_info_100(struct connection *pc, const struct packet_map_info *packet)
Definition packets_gen.c:10607
init_packet_endgame_report
static void init_packet_endgame_report(struct packet_endgame_report *packet)
Definition packets_gen.c:2960
dlsend_packet_ruleset_multiplier
void dlsend_packet_ruleset_multiplier(struct conn_list *dest, Multiplier_type_id id, int start, int stop, int step, int def, int offset, int factor, int minimum_turns, const char *name, const char *rule_name, int reqs_count, const struct requirement *reqs, const struct strvec *helptext)
Definition packets_gen.c:70587
receive_packet_set_topology_100
static struct packet_set_topology * receive_packet_set_topology_100(struct connection *pc)
Definition packets_gen.c:77525
receive_packet_chat_msg_100
static struct packet_chat_msg * receive_packet_chat_msg_100(struct connection *pc)
Definition packets_gen.c:11514
send_packet_city_sabotage_list_100
static int send_packet_city_sabotage_list_100(struct connection *pc, const struct packet_city_sabotage_list *packet)
Definition packets_gen.c:21288
send_packet_ruleset_nation_100
static int send_packet_ruleset_nation_100(struct connection *pc, const struct packet_ruleset_nation *packet)
Definition packets_gen.c:52928
receive_packet_edit_tile_100
static struct packet_edit_tile * receive_packet_edit_tile_100(struct connection *pc)
Definition packets_gen.c:81838
send_packet_page_msg_part_100
static int send_packet_page_msg_part_100(struct connection *pc, const struct packet_page_msg_part *packet)
Definition packets_gen.c:37814
init_packet_authentication_req
static void init_packet_authentication_req(struct packet_authentication_req *packet)
Definition packets_gen.c:1952
dsend_packet_edit_city_create
int dsend_packet_edit_city_create(struct connection *pc, int owner, int tile, int size, int tag)
Definition packets_gen.c:84156
dsend_packet_unit_change_activity
int dsend_packet_unit_change_activity(struct connection *pc, int unit_id, enum unit_activity activity, int target)
Definition packets_gen.c:34526
send_packet_ruleset_unit_100
static int send_packet_ruleset_unit_100(struct connection *pc, const struct packet_ruleset_unit *packet)
Definition packets_gen.c:42852
lsend_packet_ruleset_summary
void lsend_packet_ruleset_summary(struct conn_list *dest, const struct packet_ruleset_summary *packet)
Definition packets_gen.c:72877
send_packet_diplomacy_remove_clause_req_100
static int send_packet_diplomacy_remove_clause_req_100(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
Definition packets_gen.c:36194
init_packet_achievement_info
static void init_packet_achievement_info(struct packet_achievement_info *packet)
Definition packets_gen.c:11273
receive_packet_thaw_client_100
static struct packet_thaw_client * receive_packet_thaw_client_100(struct connection *pc)
Definition packets_gen.c:40101
dsend_packet_diplomacy_create_clause_req
int dsend_packet_diplomacy_create_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:35704
init_packet_processing_finished
static void init_packet_processing_finished(struct packet_processing_finished *packet)
Definition packets_gen.c:1134
send_packet_conn_ping
int send_packet_conn_ping(struct connection *pc)
Definition packets_gen.c:39081
lsend_packet_diplomacy_create_clause
void lsend_packet_diplomacy_create_clause(struct conn_list *dest, const struct packet_diplomacy_create_clause *packet)
Definition packets_gen.c:36021
send_packet_endgame_player_100
static int send_packet_endgame_player_100(struct connection *pc, const struct packet_endgame_player *packet)
Definition packets_gen.c:3193
send_packet_diplomacy_cancel_meeting_100
static int send_packet_diplomacy_cancel_meeting_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
Definition packets_gen.c:35257
destroy_packet_ruleset_terrain_flag
#define destroy_packet_ruleset_terrain_flag
Definition packets_gen.c:59438
receive_packet_unit_actions_100
static struct packet_unit_actions * receive_packet_unit_actions_100(struct connection *pc)
Definition packets_gen.c:33749
init_packet_vote_submit
static void init_packet_vote_submit(struct packet_vote_submit *packet)
Definition packets_gen.c:80447
send_packet_player_change_government
int send_packet_player_change_government(struct connection *pc, const struct packet_player_change_government *packet)
Definition packets_gen.c:25634
send_packet_diplomacy_accept_treaty
int send_packet_diplomacy_accept_treaty(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
Definition packets_gen.c:37098
send_packet_ruleset_counter
int send_packet_ruleset_counter(struct connection *pc, const struct packet_ruleset_counter *packet)
Definition packets_gen.c:69090
destroy_packet_end_turn
#define destroy_packet_end_turn
Definition packets_gen.c:40005
destroy_packet_edit_recalculate_borders
#define destroy_packet_edit_recalculate_borders
Definition packets_gen.c:80708
send_packet_ruleset_terrain_100
static int send_packet_ruleset_terrain_100(struct connection *pc, const struct packet_ruleset_terrain *packet)
Definition packets_gen.c:58052
init_packet_ruleset_description_part
static void init_packet_ruleset_description_part(struct packet_ruleset_description_part *packet)
Definition packets_gen.c:72884
send_packet_player_attribute_chunk_100
static int send_packet_player_attribute_chunk_100(struct connection *pc, const struct packet_player_attribute_chunk *packet)
Definition packets_gen.c:26077
send_packet_city_rally_point
int send_packet_city_rally_point(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
Definition packets_gen.c:21883
delta_stats_reset
void delta_stats_reset(void)
Definition packets_gen.c:46
init_packet_authentication_reply
static void init_packet_authentication_reply(struct packet_authentication_reply *packet)
Definition packets_gen.c:2189
destroy_packet_scenario_description
#define destroy_packet_scenario_description
Definition packets_gen.c:79026
destroy_packet_ruleset_summary
#define destroy_packet_ruleset_summary
Definition packets_gen.c:72705
send_packet_connect_msg_100
static int send_packet_connect_msg_100(struct connection *pc, const struct packet_connect_msg *packet)
Definition packets_gen.c:12552
send_packet_vote_resolve
int send_packet_vote_resolve(struct connection *pc, const struct packet_vote_resolve *packet)
Definition packets_gen.c:80435
init_packet_single_want_hack_reply
static void init_packet_single_want_hack_reply(struct packet_single_want_hack_reply *packet)
Definition packets_gen.c:73247
lsend_packet_start_phase
void lsend_packet_start_phase(struct conn_list *dest, const struct packet_start_phase *packet)
Definition packets_gen.c:39664
lsend_packet_ruleset_building
void lsend_packet_ruleset_building(struct conn_list *dest, const struct packet_ruleset_building *packet)
Definition packets_gen.c:56548
destroy_packet_edit_game
#define destroy_packet_edit_game
Definition packets_gen.c:88110
send_packet_edit_city
int send_packet_edit_city(struct connection *pc, const struct packet_edit_city *packet)
Definition packets_gen.c:86155
init_packet_ruleset_tech_class
static void init_packet_ruleset_tech_class(struct packet_ruleset_tech_class *packet)
Definition packets_gen.c:49078
send_packet_server_setting_bitwise
int send_packet_server_setting_bitwise(struct connection *pc, const struct packet_server_setting_bitwise *packet)
Definition packets_gen.c:77497
lsend_packet_new_year
void lsend_packet_new_year(struct conn_list *dest, const struct packet_new_year *packet)
Definition packets_gen.c:39945
receive_packet_game_info_100
static struct packet_game_info * receive_packet_game_info_100(struct connection *pc)
Definition packets_gen.c:4071
send_packet_ruleset_choices_100
static int send_packet_ruleset_choices_100(struct connection *pc, const struct packet_ruleset_choices *packet)
Definition packets_gen.c:73560
destroy_packet_server_setting_int
#define destroy_packet_server_setting_int
Definition packets_gen.c:75219
lsend_packet_endgame_player
void lsend_packet_endgame_player(struct conn_list *dest, const struct packet_endgame_player *packet)
Definition packets_gen.c:3289
init_packet_player_diplstate
static void init_packet_player_diplstate(struct packet_player_diplstate *packet)
Definition packets_gen.c:26238
send_packet_player_attribute_block_100
static int send_packet_player_attribute_block_100(struct connection *pc)
Definition packets_gen.c:25902
send_packet_ruleset_music_100
static int send_packet_ruleset_music_100(struct connection *pc, const struct packet_ruleset_music *packet)
Definition packets_gen.c:69300
destroy_packet_authentication_reply
#define destroy_packet_authentication_reply
Definition packets_gen.c:2195
send_packet_conn_pong_100
static int send_packet_conn_pong_100(struct connection *pc)
Definition packets_gen.c:39113
send_packet_ruleset_game
int send_packet_ruleset_game(struct connection *pc, const struct packet_ruleset_game *packet)
Definition packets_gen.c:46881
lsend_packet_ruleset_unit_class_flag
void lsend_packet_ruleset_unit_class_flag(struct conn_list *dest, const struct packet_ruleset_unit_class_flag *packet)
Definition packets_gen.c:45491
send_packet_unknown_research
int send_packet_unknown_research(struct connection *pc, const struct packet_unknown_research *packet)
Definition packets_gen.c:27687
lsend_packet_tile_info
void lsend_packet_tile_info(struct conn_list *dest, const struct packet_tile_info *packet)
Definition packets_gen.c:4048
init_packet_end_phase
static void init_packet_end_phase(struct packet_end_phase *packet)
Definition packets_gen.c:39439
send_packet_player_diplstate_100
static int send_packet_player_diplstate_100(struct connection *pc, const struct packet_player_diplstate *packet)
Definition packets_gen.c:26440
receive_packet_ruleset_control_100
static struct packet_ruleset_control * receive_packet_ruleset_control_100(struct connection *pc)
Definition packets_gen.c:71379
init_packet_ruleset_impr_flag
static void init_packet_ruleset_impr_flag(struct packet_ruleset_impr_flag *packet)
Definition packets_gen.c:56555
send_packet_ruleset_resource
int send_packet_ruleset_resource(struct connection *pc, const struct packet_ruleset_resource *packet)
Definition packets_gen.c:78506
receive_packet_unit_action_query_100
static struct packet_unit_action_query * receive_packet_unit_action_query_100(struct connection *pc)
Definition packets_gen.c:32174
dsend_packet_player_rates
int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
Definition packets_gen.c:25447
dsend_packet_spaceship_place
int dsend_packet_spaceship_place(struct connection *pc, enum spaceship_place_type type, int num)
Definition packets_gen.c:40407
dlsend_packet_city_remove
void dlsend_packet_city_remove(struct conn_list *dest, int city_id)
Definition packets_gen.c:13243
send_packet_processing_finished_100
static int send_packet_processing_finished_100(struct connection *pc)
Definition packets_gen.c:1154
destroy_packet_edit_player_remove
#define destroy_packet_edit_player_remove
Definition packets_gen.c:86360
send_packet_ruleset_unit_bonus
int send_packet_ruleset_unit_bonus(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
Definition packets_gen.c:44953
init_packet_ruleset_road
static void init_packet_ruleset_road(struct packet_ruleset_road *packet)
Definition packets_gen.c:63603
send_packet_edit_unit_create
int send_packet_edit_unit_create(struct connection *pc, const struct packet_edit_unit_create *packet)
Definition packets_gen.c:82587
send_packet_spaceship_info_100
static int send_packet_spaceship_info_100(struct connection *pc, const struct packet_spaceship_info *packet)
Definition packets_gen.c:40774
lsend_packet_edit_player
void lsend_packet_edit_player(struct conn_list *dest, const struct packet_edit_player *packet)
Definition packets_gen.c:87809
receive_packet_ruleset_nation_sets_100
static struct packet_ruleset_nation_sets * receive_packet_ruleset_nation_sets_100(struct connection *pc)
Definition packets_gen.c:51067
send_packet_end_turn
int send_packet_end_turn(struct connection *pc)
Definition packets_gen.c:40027
send_packet_city_short_info_100
static int send_packet_city_short_info_100(struct connection *pc, const struct packet_city_short_info *packet)
Definition packets_gen.c:17617
init_packet_ruleset_nation_sets
static void init_packet_ruleset_nation_sets(struct packet_ruleset_nation_sets *packet)
Definition packets_gen.c:51051
send_packet_ruleset_achievement
int send_packet_ruleset_achievement(struct connection *pc, const struct packet_ruleset_achievement *packet)
Definition packets_gen.c:66365
destroy_packet_diplomacy_accept_treaty_req
#define destroy_packet_diplomacy_accept_treaty_req
Definition packets_gen.c:36711
init_packet_player_info
static void init_packet_player_info(struct packet_player_info *packet)
Definition packets_gen.c:22450
send_packet_ruleset_action_auto_100
static int send_packet_ruleset_action_auto_100(struct connection *pc, const struct packet_ruleset_action_auto *packet)
Definition packets_gen.c:68153
send_packet_edit_player_vision_100
static int send_packet_edit_player_vision_100(struct connection *pc, const struct packet_edit_player_vision *packet)
Definition packets_gen.c:87940
destroy_packet_ruleset_action
#define destroy_packet_ruleset_action
Definition packets_gen.c:66712
receive_packet_conn_ping_100
static struct packet_conn_ping * receive_packet_conn_ping_100(struct connection *pc)
Definition packets_gen.c:39061
send_packet_edit_city_create
int send_packet_edit_city_create(struct connection *pc, const struct packet_edit_city_create *packet)
Definition packets_gen.c:84144
init_packet_server_setting_bitwise
static void init_packet_server_setting_bitwise(struct packet_server_setting_bitwise *packet)
Definition packets_gen.c:76795
lsend_packet_research_info
void lsend_packet_research_info(struct conn_list *dest, const struct packet_research_info *packet)
Definition packets_gen.c:27497
send_packet_worker_task
int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
Definition packets_gen.c:22234
destroy_packet_edit_tile_extra
#define destroy_packet_edit_tile_extra
Definition packets_gen.c:81260
init_packet_edit_tile
static void init_packet_edit_tile(struct packet_edit_tile *packet)
Definition packets_gen.c:81805
lsend_packet_city_update_counters
void lsend_packet_city_update_counters(struct conn_list *dest, const struct packet_city_update_counters *packet)
Definition packets_gen.c:17322
lsend_packet_web_ruleset_unit_addition
void lsend_packet_web_ruleset_unit_addition(struct conn_list *dest, const struct packet_web_ruleset_unit_addition *packet)
Definition packets_gen.c:90756
init_packet_unit_short_info
static void init_packet_unit_short_info(struct packet_unit_short_info *packet)
Definition packets_gen.c:30111
lsend_packet_map_info
void lsend_packet_map_info(struct conn_list *dest, const struct packet_map_info *packet)
Definition packets_gen.c:10831
receive_packet_ruleset_nation_groups_100
static struct packet_ruleset_nation_groups * receive_packet_ruleset_nation_groups_100(struct connection *pc)
Definition packets_gen.c:51669
receive_packet_ruleset_city_100
static struct packet_ruleset_city * receive_packet_ruleset_city_100(struct connection *pc)
Definition packets_gen.c:54599
init_packet_unit_action_answer
static void init_packet_unit_action_answer(struct packet_unit_action_answer *packet)
Definition packets_gen.c:33029
receive_packet_ruleset_choices_100
static struct packet_ruleset_choices * receive_packet_ruleset_choices_100(struct connection *pc)
Definition packets_gen.c:73430
init_packet_ruleset_nation_groups
static void init_packet_ruleset_nation_groups(struct packet_ruleset_nation_groups *packet)
Definition packets_gen.c:51653
destroy_packet_ruleset_unit_class
static void destroy_packet_ruleset_unit_class(void *packet)
Definition packets_gen.c:59724
destroy_packet_player_info
#define destroy_packet_player_info
Definition packets_gen.c:22456
dsend_packet_connect_msg
int dsend_packet_connect_msg(struct connection *pc, const char *message)
Definition packets_gen.c:12643
receive_packet_rulesets_ready_100
static struct packet_rulesets_ready * receive_packet_rulesets_ready_100(struct connection *pc)
Definition packets_gen.c:51012
send_packet_edit_toggle_fogofwar
int send_packet_edit_toggle_fogofwar(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
Definition packets_gen.c:80948
lsend_packet_game_load
void lsend_packet_game_load(struct conn_list *dest, const struct packet_game_load *packet)
Definition packets_gen.c:74107
lsend_packet_ruleset_achievement
void lsend_packet_ruleset_achievement(struct conn_list *dest, const struct packet_ruleset_achievement *packet)
Definition packets_gen.c:66377
destroy_packet_unit_sscs_set
#define destroy_packet_unit_sscs_set
Definition packets_gen.c:31176
receive_packet_ruleset_unit_100
static struct packet_ruleset_unit * receive_packet_ruleset_unit_100(struct connection *pc)
Definition packets_gen.c:41419
receive_packet_report_req_100
static struct packet_report_req * receive_packet_report_req_100(struct connection *pc)
Definition packets_gen.c:37928
lsend_packet_ruleset_nation_sets
void lsend_packet_ruleset_nation_sets(struct conn_list *dest, const struct packet_ruleset_nation_sets *packet)
Definition packets_gen.c:51646
send_packet_city_name_suggestion_info
int send_packet_city_name_suggestion_info(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
Definition packets_gen.c:21092
send_packet_ruleset_government
int send_packet_ruleset_government(struct connection *pc, const struct packet_ruleset_government *packet)
Definition packets_gen.c:50409
receive_packet_city_info_100
static struct packet_city_info * receive_packet_city_info_100(struct connection *pc)
Definition packets_gen.c:13285
receive_packet_edit_object_created_100
static struct packet_edit_object_created * receive_packet_edit_object_created_100(struct connection *pc)
Definition packets_gen.c:88655
send_packet_unit_remove
int send_packet_unit_remove(struct connection *pc, const struct packet_unit_remove *packet)
Definition packets_gen.c:28259
send_packet_nation_select_req_100
static int send_packet_nation_select_req_100(struct connection *pc, const struct packet_nation_select_req *packet)
Definition packets_gen.c:2563
lsend_packet_city_nationalities
void lsend_packet_city_nationalities(struct conn_list *dest, const struct packet_city_nationalities *packet, bool force_to_send)
Definition packets_gen.c:16943
send_packet_web_cma_clear_100
static int send_packet_web_cma_clear_100(struct connection *pc, const struct packet_web_cma_clear *packet)
Definition packets_gen.c:90198
send_packet_player_phase_done
int send_packet_player_phase_done(struct connection *pc, const struct packet_player_phase_done *packet)
Definition packets_gen.c:25170
send_packet_scenario_info_100
static int send_packet_scenario_info_100(struct connection *pc, const struct packet_scenario_info *packet)
Definition packets_gen.c:78727
destroy_packet_server_join_req
#define destroy_packet_server_join_req
Definition packets_gen.c:1668
destroy_packet_unit_get_actions
#define destroy_packet_unit_get_actions
Definition packets_gen.c:33392
receive_packet_edit_startpos_full_100
static struct packet_edit_startpos_full * receive_packet_edit_startpos_full_100(struct connection *pc)
Definition packets_gen.c:81711
receive_packet_ruleset_multiplier_100
static struct packet_ruleset_multiplier * receive_packet_ruleset_multiplier_100(struct connection *pc)
Definition packets_gen.c:69603
init_packet_ruleset_tech
static void init_packet_ruleset_tech(struct packet_ruleset_tech *packet)
Definition packets_gen.c:48052
init_packet_unit_do_action
static void init_packet_unit_do_action(struct packet_unit_do_action *packet)
Definition packets_gen.c:32672
receive_packet_tile_info_100
static struct packet_tile_info * receive_packet_tile_info_100(struct connection *pc)
Definition packets_gen.c:3329
destroy_packet_diplomacy_remove_clause
#define destroy_packet_diplomacy_remove_clause
Definition packets_gen.c:36375
receive_packet_page_msg_100
static struct packet_page_msg * receive_packet_page_msg_100(struct connection *pc)
Definition packets_gen.c:37392
receive_packet_vote_update_100
static struct packet_vote_update * receive_packet_vote_update_100(struct connection *pc)
Definition packets_gen.c:79752
send_packet_edit_tile_100
static int send_packet_edit_tile_100(struct connection *pc, const struct packet_edit_tile *packet)
Definition packets_gen.c:82027
destroy_packet_edit_unit_remove
#define destroy_packet_edit_unit_remove
Definition packets_gen.c:82618
lsend_packet_ruleset_multiplier
void lsend_packet_ruleset_multiplier(struct conn_list *dest, const struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:70553
destroy_packet_ruleset_government_ruler_title
#define destroy_packet_ruleset_government_ruler_title
Definition packets_gen.c:47736
receive_packet_team_name_info_100
static struct packet_team_name_info * receive_packet_team_name_info_100(struct connection *pc)
Definition packets_gen.c:11074
send_packet_ruleset_clause_100
static int send_packet_ruleset_clause_100(struct connection *pc, const struct packet_ruleset_clause *packet)
Definition packets_gen.c:70940
init_packet_edit_player_vision
static void init_packet_edit_player_vision(struct packet_edit_player_vision *packet)
Definition packets_gen.c:87816
receive_packet_unit_do_action_100
static struct packet_unit_do_action * receive_packet_unit_do_action_100(struct connection *pc)
Definition packets_gen.c:32688
init_packet_diplomacy_cancel_meeting_req
static void init_packet_diplomacy_cancel_meeting_req(struct packet_diplomacy_cancel_meeting_req *packet)
Definition packets_gen.c:34968
send_packet_ruleset_tech_class_100
static int send_packet_ruleset_tech_class_100(struct connection *pc, const struct packet_ruleset_tech_class *packet)
Definition packets_gen.c:49210
send_packet_edit_check_tiles_100
static int send_packet_edit_check_tiles_100(struct connection *pc)
Definition packets_gen.c:80762
init_packet_server_setting_const
static void init_packet_server_setting_const(struct packet_server_setting_const *packet)
Definition packets_gen.c:74499
init_packet_diplomacy_accept_treaty
static void init_packet_diplomacy_accept_treaty(struct packet_diplomacy_accept_treaty *packet)
Definition packets_gen.c:36892
destroy_packet_player_change_government
#define destroy_packet_player_change_government
Definition packets_gen.c:25464
send_packet_player_ready_100
static int send_packet_player_ready_100(struct connection *pc, const struct packet_player_ready *packet)
Definition packets_gen.c:2846
init_packet_city_nationalities
static void init_packet_city_nationalities(struct packet_city_nationalities *packet)
Definition packets_gen.c:16431
send_packet_conn_ping_100
static int send_packet_conn_ping_100(struct connection *pc)
Definition packets_gen.c:39073
destroy_packet_edit_player_create
#define destroy_packet_edit_player_create
Definition packets_gen.c:86173
dsend_packet_diplomacy_cancel_meeting
int dsend_packet_diplomacy_cancel_meeting(struct connection *pc, int counterpart, int initiated_from)
Definition packets_gen.c:35379
destroy_packet_ruleset_disaster
#define destroy_packet_ruleset_disaster
Definition packets_gen.c:65500
receive_packet_endgame_report_100
static struct packet_endgame_report * receive_packet_endgame_report_100(struct connection *pc)
Definition packets_gen.c:2968
send_packet_game_load_100
static int send_packet_game_load_100(struct connection *pc, const struct packet_game_load *packet)
Definition packets_gen.c:74003
init_packet_ruleset_unit_bonus
static void init_packet_ruleset_unit_bonus(struct packet_ruleset_unit_bonus *packet)
Definition packets_gen.c:44620
receive_packet_ruleset_action_auto_100
static struct packet_ruleset_action_auto * receive_packet_ruleset_action_auto_100(struct connection *pc)
Definition packets_gen.c:67899
init_packet_edit_game
static void init_packet_edit_game(struct packet_edit_game *packet)
Definition packets_gen.c:88104
destroy_packet_vote_new
#define destroy_packet_vote_new
Definition packets_gen.c:79391
dsend_packet_player_remove
int dsend_packet_player_remove(struct connection *pc, int playerno)
Definition packets_gen.c:22441
init_packet_server_join_req
static void init_packet_server_join_req(struct packet_server_join_req *packet)
Definition packets_gen.c:1662
packet_has_game_info_flag
bool packet_has_game_info_flag(enum packet_type type)
Definition packets_gen.c:571
lsend_packet_ruleset_city
void lsend_packet_ruleset_city(struct conn_list *dest, const struct packet_ruleset_city *packet)
Definition packets_gen.c:55134
send_packet_edit_recalculate_borders_100
static int send_packet_edit_recalculate_borders_100(struct connection *pc)
Definition packets_gen.c:80722
send_packet_edit_game
int send_packet_edit_game(struct connection *pc, const struct packet_edit_game *packet)
Definition packets_gen.c:88449
destroy_packet_city_buy
#define destroy_packet_city_buy
Definition packets_gen.c:18643
receive_packet_unit_type_upgrade_100
static struct packet_unit_type_upgrade * receive_packet_unit_type_upgrade_100(struct connection *pc)
Definition packets_gen.c:32491
init_packet_city_options_req
static void init_packet_city_options_req(struct packet_city_options_req *packet)
Definition packets_gen.c:20286
init_packet_city_sabotage_list
static void init_packet_city_sabotage_list(struct packet_city_sabotage_list *packet)
Definition packets_gen.c:21131
lsend_packet_diplomacy_cancel_meeting
void lsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, const struct packet_diplomacy_cancel_meeting *packet)
Definition packets_gen.c:35372
init_packet_trade_route_info
static void init_packet_trade_route_info(struct packet_trade_route_info *packet)
Definition packets_gen.c:18010
dsend_packet_diplomacy_cancel_pact
int dsend_packet_diplomacy_cancel_pact(struct connection *pc, int other_player_id, enum clause_type clause)
Definition packets_gen.c:37366
receive_packet_unit_combat_info_100
static struct packet_unit_combat_info * receive_packet_unit_combat_info_100(struct connection *pc)
Definition packets_gen.c:30844
send_packet_nation_availability
int send_packet_nation_availability(struct connection *pc, const struct packet_nation_availability *packet)
Definition packets_gen.c:54301
send_packet_ruleset_terrain_control_100
static int send_packet_ruleset_terrain_control_100(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
Definition packets_gen.c:50664
dsend_packet_authentication_req
int dsend_packet_authentication_req(struct connection *pc, enum authentication_type type, const char *message)
Definition packets_gen.c:2179
send_packet_ruleset_nation_sets
int send_packet_ruleset_nation_sets(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
Definition packets_gen.c:51634
dsend_packet_city_sell
int dsend_packet_city_sell(struct connection *pc, int city_id, int build_id)
Definition packets_gen.c:18627
destroy_packet_diplomacy_cancel_meeting_req
#define destroy_packet_diplomacy_cancel_meeting_req
Definition packets_gen.c:34974
destroy_packet_server_join_reply
#define destroy_packet_server_join_reply
Definition packets_gen.c:1826
receive_packet_city_rally_point_100
static struct packet_city_rally_point * receive_packet_city_rally_point_100(struct connection *pc)
Definition packets_gen.c:21498
lsend_packet_ruleset_unit
void lsend_packet_ruleset_unit(struct conn_list *dest, const struct packet_ruleset_unit *packet)
Definition packets_gen.c:44613
destroy_packet_ruleset_style
#define destroy_packet_ruleset_style
Definition packets_gen.c:54326
destroy_packet_nuke_tile_info
#define destroy_packet_nuke_tile_info
Definition packets_gen.c:10844
destroy_packet_trade_route_info
#define destroy_packet_trade_route_info
Definition packets_gen.c:18016
send_packet_server_setting_int_100
static int send_packet_server_setting_int_100(struct connection *pc, const struct packet_server_setting_int *packet)
Definition packets_gen.c:75421
destroy_packet_city_update_counters
#define destroy_packet_city_update_counters
Definition packets_gen.c:16956
send_packet_unit_action_query
int send_packet_unit_action_query(struct connection *pc, const struct packet_unit_action_query *packet)
Definition packets_gen.c:32451
init_packet_ruleset_extra
static void init_packet_ruleset_extra(struct packet_ruleset_extra *packet)
Definition packets_gen.c:60346
dsend_packet_diplomacy_init_meeting_req
int dsend_packet_diplomacy_init_meeting_req(struct connection *pc, int counterpart)
Definition packets_gen.c:34715
send_packet_ruleset_control_100
static int send_packet_ruleset_control_100(struct connection *pc, const struct packet_ruleset_control *packet)
Definition packets_gen.c:71892
init_packet_edit_city_create
static void init_packet_edit_city_create(struct packet_edit_city_create *packet)
Definition packets_gen.c:83861
destroy_packet_ruleset_terrain
static void destroy_packet_ruleset_terrain(void *packet)
Definition packets_gen.c:56905
dsend_packet_unit_do_action
int dsend_packet_unit_do_action(struct connection *pc, int actor_id, int target_id, int sub_tgt_id, const char *name, action_id action_type)
Definition packets_gen.c:33016
send_packet_city_make_specialist
int send_packet_city_make_specialist(struct connection *pc, const struct packet_city_make_specialist *packet)
Definition packets_gen.c:19523
receive_packet_server_setting_bitwise_100
static struct packet_server_setting_bitwise * receive_packet_server_setting_bitwise_100(struct connection *pc)
Definition packets_gen.c:76828
destroy_packet_ruleset_game
#define destroy_packet_ruleset_game
Definition packets_gen.c:45504
send_packet_ruleset_unit_class
int send_packet_ruleset_unit_class(struct connection *pc, const struct packet_ruleset_unit_class *packet)
Definition packets_gen.c:60327
receive_packet_spaceship_info_100
static struct packet_spaceship_info * receive_packet_spaceship_info_100(struct connection *pc)
Definition packets_gen.c:40450
destroy_packet_server_setting_str
#define destroy_packet_server_setting_str
Definition packets_gen.c:75693
destroy_packet_server_setting_const
#define destroy_packet_server_setting_const
Definition packets_gen.c:74505
destroy_packet_unit_remove
#define destroy_packet_unit_remove
Definition packets_gen.c:28079
send_packet_ruleset_multiplier
int send_packet_ruleset_multiplier(struct connection *pc, const struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:70541
receive_packet_city_worklist_100
static struct packet_city_worklist * receive_packet_city_worklist_100(struct connection *pc)
Definition packets_gen.c:19107
send_packet_ruleset_extra_flag
int send_packet_ruleset_extra_flag(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
Definition packets_gen.c:63194
init_packet_begin_turn
static void init_packet_begin_turn(struct packet_begin_turn *packet)
Definition packets_gen.c:39952
lsend_packet_unit_remove
void lsend_packet_unit_remove(struct conn_list *dest, const struct packet_unit_remove *packet)
Definition packets_gen.c:28271
dsend_packet_diplomacy_remove_clause
int dsend_packet_diplomacy_remove_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:36681
send_packet_city_rename
int send_packet_city_rename(struct connection *pc, const struct packet_city_rename *packet)
Definition packets_gen.c:20264
send_packet_edit_unit_remove_100
static int send_packet_edit_unit_remove_100(struct connection *pc, const struct packet_edit_unit_remove *packet)
Definition packets_gen.c:82754
receive_packet_ruleset_game_100
static struct packet_ruleset_game * receive_packet_ruleset_game_100(struct connection *pc)
Definition packets_gen.c:45514
dlsend_packet_diplomacy_init_meeting
void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:34958
send_packet_ruleset_select
int send_packet_ruleset_select(struct connection *pc, const struct packet_ruleset_select *packet)
Definition packets_gen.c:73897
receive_packet_ruleset_unit_flag_100
static struct packet_ruleset_unit_flag * receive_packet_ruleset_unit_flag_100(struct connection *pc)
Definition packets_gen.c:44988
send_packet_city_nationalities_100
static int send_packet_city_nationalities_100(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
Definition packets_gen.c:16666
receive_packet_diplomacy_cancel_pact_100
static struct packet_diplomacy_cancel_pact * receive_packet_diplomacy_cancel_pact_100(struct connection *pc)
Definition packets_gen.c:37155
send_packet_chat_msg_100
static int send_packet_chat_msg_100(struct connection *pc, const struct packet_chat_msg *packet)
Definition packets_gen.c:11670
destroy_packet_ruleset_description_part
#define destroy_packet_ruleset_description_part
Definition packets_gen.c:72890
destroy_packet_ruleset_unit_bonus
#define destroy_packet_ruleset_unit_bonus
Definition packets_gen.c:44626
send_packet_endgame_player
int send_packet_endgame_player(struct connection *pc, const struct packet_endgame_player *packet)
Definition packets_gen.c:3277
lsend_packet_ruleset_clause
void lsend_packet_ruleset_clause(struct conn_list *dest, const struct packet_ruleset_clause *packet)
Definition packets_gen.c:71356
send_packet_new_year
int send_packet_new_year(struct connection *pc, const struct packet_new_year *packet)
Definition packets_gen.c:39933
receive_packet_edit_mode_100
static struct packet_edit_mode * receive_packet_edit_mode_100(struct connection *pc)
Definition packets_gen.c:80551
receive_packet_spaceship_place_100
static struct packet_spaceship_place * receive_packet_spaceship_place_100(struct connection *pc)
Definition packets_gen.c:40196
receive_packet_single_want_hack_reply_100
static struct packet_single_want_hack_reply * receive_packet_single_want_hack_reply_100(struct connection *pc)
Definition packets_gen.c:73263
send_packet_ruleset_road_100
static int send_packet_ruleset_road_100(struct connection *pc, const struct packet_ruleset_road *packet)
Definition packets_gen.c:64043
send_packet_server_setting_str
int send_packet_server_setting_str(struct connection *pc, const struct packet_server_setting_str *packet)
Definition packets_gen.c:76069
destroy_packet_chat_msg_req
#define destroy_packet_chat_msg_req
Definition packets_gen.c:12284
send_packet_ruleset_road
int send_packet_ruleset_road(struct connection *pc, const struct packet_ruleset_road *packet)
Definition packets_gen.c:64610
lsend_packet_chat_msg
void lsend_packet_chat_msg(struct conn_list *dest, const struct packet_chat_msg *packet)
Definition packets_gen.c:11881
init_packet_ruleset_effect
static void init_packet_ruleset_effect(struct packet_ruleset_effect *packet)
Definition packets_gen.c:77726
send_packet_ruleset_unit_flag
int send_packet_ruleset_unit_flag(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
Definition packets_gen.c:45216
init_packet_diplomacy_remove_clause_req
static void init_packet_diplomacy_remove_clause_req(struct packet_diplomacy_remove_clause_req *packet)
Definition packets_gen.c:36052
init_packet_server_join_reply
static void init_packet_server_join_reply(struct packet_server_join_reply *packet)
Definition packets_gen.c:1820
init_packet_edit_unit_create
static void init_packet_edit_unit_create(struct packet_edit_unit_create *packet)
Definition packets_gen.c:82255
send_packet_edit_game_100
static int send_packet_edit_game_100(struct connection *pc, const struct packet_edit_game *packet)
Definition packets_gen.c:88255
destroy_packet_unit_action_query
#define destroy_packet_unit_action_query
Definition packets_gen.c:32164
send_packet_ruleset_city
int send_packet_ruleset_city(struct connection *pc, const struct packet_ruleset_city *packet)
Definition packets_gen.c:55122
send_packet_ruleset_goods
int send_packet_ruleset_goods(struct connection *pc, const struct packet_ruleset_goods *packet)
Definition packets_gen.c:65475
destroy_packet_edit_player_vision
#define destroy_packet_edit_player_vision
Definition packets_gen.c:87822
receive_packet_server_join_req_100
static struct packet_server_join_req * receive_packet_server_join_req_100(struct connection *pc)
Definition packets_gen.c:1670
destroy_packet_edit_city_create
#define destroy_packet_edit_city_create
Definition packets_gen.c:83867
lsend_packet_begin_turn
void lsend_packet_begin_turn(struct conn_list *dest)
Definition packets_gen.c:39992
send_packet_thaw_client_100
static int send_packet_thaw_client_100(struct connection *pc)
Definition packets_gen.c:40113
init_packet_map_info
static void init_packet_map_info(struct packet_map_info *packet)
Definition packets_gen.c:10438
send_packet_unit_type_upgrade
int send_packet_unit_type_upgrade(struct connection *pc, const struct packet_unit_type_upgrade *packet)
Definition packets_gen.c:32651
destroy_packet_edit_tile
#define destroy_packet_edit_tile
Definition packets_gen.c:81811
init_packet_diplomacy_init_meeting
static void init_packet_diplomacy_init_meeting(struct packet_diplomacy_init_meeting *packet)
Definition packets_gen.c:34724
receive_packet_ruleset_building_100
static struct packet_ruleset_building * receive_packet_ruleset_building_100(struct connection *pc)
Definition packets_gen.c:55206
init_packet_conn_ping
static void init_packet_conn_ping(struct packet_conn_ping *packet)
Definition packets_gen.c:39053
receive_packet_ruleset_description_part_100
static struct packet_ruleset_description_part * receive_packet_ruleset_description_part_100(struct connection *pc)
Definition packets_gen.c:72900
destroy_packet_ruleset_action_enabler
#define destroy_packet_ruleset_action_enabler
Definition packets_gen.c:67338
init_packet_player_change_government
static void init_packet_player_change_government(struct packet_player_change_government *packet)
Definition packets_gen.c:25458
delta_stats_report
void delta_stats_report(void)
Definition packets_gen.c:44
send_packet_processing_finished
int send_packet_processing_finished(struct connection *pc)
Definition packets_gen.c:1162
send_packet_authentication_reply_100
static int send_packet_authentication_reply_100(struct connection *pc, const struct packet_authentication_reply *packet)
Definition packets_gen.c:2276
lsend_packet_ruleset_unit_flag
void lsend_packet_ruleset_unit_flag(struct conn_list *dest, const struct packet_ruleset_unit_flag *packet)
Definition packets_gen.c:45228
send_packet_player_rates_100
static int send_packet_player_rates_100(struct connection *pc, const struct packet_player_rates *packet)
Definition packets_gen.c:25308
destroy_packet_ruleset_unit_flag
#define destroy_packet_ruleset_unit_flag
Definition packets_gen.c:44978
send_packet_page_msg
int send_packet_page_msg(struct connection *pc, const struct packet_page_msg *packet)
Definition packets_gen.c:37708
destroy_packet_player_phase_done
#define destroy_packet_player_phase_done
Definition packets_gen.c:25010
destroy_packet_edit_startpos_full
#define destroy_packet_edit_startpos_full
Definition packets_gen.c:81709
send_packet_conn_pong
int send_packet_conn_pong(struct connection *pc)
Definition packets_gen.c:39121
send_packet_trade_route_info_100
static int send_packet_trade_route_info_100(struct connection *pc, const struct packet_trade_route_info *packet)
Definition packets_gen.c:18192
init_packet_edit_tile_extra
static void init_packet_edit_tile_extra(struct packet_edit_tile_extra *packet)
Definition packets_gen.c:81254
send_packet_player_multiplier
int send_packet_player_multiplier(struct connection *pc, const struct packet_player_multiplier *packet)
Definition packets_gen.c:26973
send_packet_ruleset_style_100
static int send_packet_ruleset_style_100(struct connection *pc, const struct packet_ruleset_style *packet)
Definition packets_gen.c:54437
send_packet_ruleset_counter_100
static int send_packet_ruleset_counter_100(struct connection *pc, const struct packet_ruleset_counter *packet)
Definition packets_gen.c:68789
send_packet_server_join_req
int send_packet_server_join_req(struct connection *pc, const struct packet_server_join_req *packet)
Definition packets_gen.c:1794
lsend_packet_endgame_report
void lsend_packet_endgame_report(struct conn_list *dest, const struct packet_endgame_report *packet)
Definition packets_gen.c:3107
send_packet_endgame_report
int send_packet_endgame_report(struct connection *pc, const struct packet_endgame_report *packet)
Definition packets_gen.c:3095
send_packet_ruleset_city_100
static int send_packet_ruleset_city_100(struct connection *pc, const struct packet_ruleset_city *packet)
Definition packets_gen.c:54819
init_packet_unit_sscs_set
static void init_packet_unit_sscs_set(struct packet_unit_sscs_set *packet)
Definition packets_gen.c:31170
send_packet_vote_remove_100
static int send_packet_vote_remove_100(struct connection *pc, const struct packet_vote_remove *packet)
Definition packets_gen.c:80158
destroy_packet_research_info
#define destroy_packet_research_info
Definition packets_gen.c:26991
send_packet_server_setting_const
int send_packet_server_setting_const(struct connection *pc, const struct packet_server_setting_const *packet)
Definition packets_gen.c:74839
init_packet_nation_availability
static void init_packet_nation_availability(struct packet_nation_availability *packet)
Definition packets_gen.c:53976
send_packet_city_remove_100
static int send_packet_city_remove_100(struct connection *pc, const struct packet_city_remove *packet)
Definition packets_gen.c:13111
receive_packet_edit_city_remove_100
static struct packet_edit_city_remove * receive_packet_edit_city_remove_100(struct connection *pc)
Definition packets_gen.c:84184
destroy_packet_save_scenario
#define destroy_packet_save_scenario
Definition packets_gen.c:79204
send_packet_city_remove
int send_packet_city_remove(struct connection *pc, const struct packet_city_remove *packet)
Definition packets_gen.c:13215
destroy_packet_worker_task
#define destroy_packet_worker_task
Definition packets_gen.c:21908
destroy_packet_conn_ping
#define destroy_packet_conn_ping
Definition packets_gen.c:39059
init_packet_ruleset_city
static void init_packet_ruleset_city(struct packet_ruleset_city *packet)
Definition packets_gen.c:54583
send_packet_server_setting_bool_100
static int send_packet_server_setting_bool_100(struct connection *pc, const struct packet_server_setting_bool *packet)
Definition packets_gen.c:75013
destroy_packet_early_chat_msg
#define destroy_packet_early_chat_msg
Definition packets_gen.c:11894
destroy_packet_ruleset_choices
#define destroy_packet_ruleset_choices
Definition packets_gen.c:73420
send_packet_ruleset_government_ruler_title_100
static int send_packet_ruleset_government_ruler_title_100(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
Definition packets_gen.c:47882
destroy_packet_city_refresh
#define destroy_packet_city_refresh
Definition packets_gen.c:20519
dsend_packet_city_options_req
int dsend_packet_city_options_req(struct connection *pc, int city_id, bv_city_options options)
Definition packets_gen.c:20503
lsend_packet_conn_info
void lsend_packet_conn_info(struct conn_list *dest, const struct packet_conn_info *packet)
Definition packets_gen.c:38583
init_packet_diplomacy_remove_clause
static void init_packet_diplomacy_remove_clause(struct packet_diplomacy_remove_clause *packet)
Definition packets_gen.c:36369
send_packet_edit_tile_terrain_100
static int send_packet_edit_tile_terrain_100(struct connection *pc, const struct packet_edit_tile_terrain *packet)
Definition packets_gen.c:81111
send_packet_unit_orders_100
static int send_packet_unit_orders_100(struct connection *pc, const struct packet_unit_orders *packet)
Definition packets_gen.c:31652
send_packet_server_info
int send_packet_server_info(struct connection *pc, const struct packet_server_info *packet)
Definition packets_gen.c:12974
receive_packet_achievement_info_100
static struct packet_achievement_info * receive_packet_achievement_info_100(struct connection *pc)
Definition packets_gen.c:11289
receive_packet_authentication_reply_100
static struct packet_authentication_reply * receive_packet_authentication_reply_100(struct connection *pc)
Definition packets_gen.c:2205
send_packet_server_join_reply_100
static int send_packet_server_join_reply_100(struct connection *pc, const struct packet_server_join_reply *packet)
Definition packets_gen.c:1878
init_packet_chat_msg_req
static void init_packet_chat_msg_req(struct packet_chat_msg_req *packet)
Definition packets_gen.c:12278
destroy_packet_single_want_hack_reply
#define destroy_packet_single_want_hack_reply
Definition packets_gen.c:73253
destroy_packet_unit_action_answer
#define destroy_packet_unit_action_answer
Definition packets_gen.c:33035
init_packet_rulesets_ready
static void init_packet_rulesets_ready(struct packet_rulesets_ready *packet)
Definition packets_gen.c:51004
receive_packet_map_info_100
static struct packet_map_info * receive_packet_map_info_100(struct connection *pc)
Definition packets_gen.c:10454
receive_packet_server_info_100
static struct packet_server_info * receive_packet_server_info_100(struct connection *pc)
Definition packets_gen.c:12668
send_packet_single_want_hack_reply_100
static int send_packet_single_want_hack_reply_100(struct connection *pc, const struct packet_single_want_hack_reply *packet)
Definition packets_gen.c:73326
init_packet_client_info
static void init_packet_client_info(struct packet_client_info *packet)
Definition packets_gen.c:39173
init_packet_web_city_info_addition
static void init_packet_web_city_info_addition(struct packet_web_city_info_addition *packet)
Definition packets_gen.c:89051
receive_packet_city_remove_100
static struct packet_city_remove * receive_packet_city_remove_100(struct connection *pc)
Definition packets_gen.c:13015
receive_packet_server_setting_enum_100
static struct packet_server_setting_enum * receive_packet_server_setting_enum_100(struct connection *pc)
Definition packets_gen.c:76114
dsend_packet_ruleset_multiplier
int dsend_packet_ruleset_multiplier(struct connection *pc, Multiplier_type_id id, int start, int stop, int step, int def, int offset, int factor, int minimum_turns, const char *name, const char *rule_name, int reqs_count, const struct requirement *reqs, const struct strvec *helptext)
Definition packets_gen.c:70560
init_packet_edit_mode
static void init_packet_edit_mode(struct packet_edit_mode *packet)
Definition packets_gen.c:80535
receive_packet_unit_action_answer_100
static struct packet_unit_action_answer * receive_packet_unit_action_answer_100(struct connection *pc)
Definition packets_gen.c:33045
send_packet_edit_unit_remove
int send_packet_edit_unit_remove(struct connection *pc, const struct packet_edit_unit_remove *packet)
Definition packets_gen.c:82905
init_packet_unit_server_side_agent_set
static void init_packet_unit_server_side_agent_set(struct packet_unit_server_side_agent_set *packet)
Definition packets_gen.c:31921
send_packet_game_info_100
static int send_packet_game_info_100(struct connection *pc, const struct packet_game_info *packet)
Definition packets_gen.c:6306
init_packet_diplomacy_cancel_meeting
static void init_packet_diplomacy_cancel_meeting(struct packet_diplomacy_cancel_meeting *packet)
Definition packets_gen.c:35155
send_packet_freeze_client_100
static int send_packet_freeze_client_100(struct connection *pc)
Definition packets_gen.c:40066
destroy_packet_unit_info
#define destroy_packet_unit_info
Definition packets_gen.c:28302
receive_packet_spaceship_launch_100
static struct packet_spaceship_launch * receive_packet_spaceship_launch_100(struct connection *pc)
Definition packets_gen.c:40148
send_packet_unit_server_side_agent_set
int send_packet_unit_server_side_agent_set(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
Definition packets_gen.c:32136
destroy_packet_ruleset_nation
#define destroy_packet_ruleset_nation
Definition packets_gen.c:52122
dsend_packet_investigate_finished
int dsend_packet_investigate_finished(struct connection *pc, int unit_id, int city_id)
Definition packets_gen.c:1642
lsend_packet_early_chat_msg
void lsend_packet_early_chat_msg(struct conn_list *dest, const struct packet_early_chat_msg *packet)
Definition packets_gen.c:12271
send_packet_city_name_suggestion_req
int send_packet_city_name_suggestion_req(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
Definition packets_gen.c:20866
free_packet_ruleset_counter
static void free_packet_ruleset_counter(struct packet_ruleset_counter *packet)
Definition packets_gen.c:68496
destroy_packet_web_player_info_addition
#define destroy_packet_web_player_info_addition
Definition packets_gen.c:90295
free_packet_ruleset_unit_class
static void free_packet_ruleset_unit_class(struct packet_ruleset_unit_class *packet)
Definition packets_gen.c:59709
init_packet_ruleset_summary
static void init_packet_ruleset_summary(struct packet_ruleset_summary *packet)
Definition packets_gen.c:72699
init_packet_set_topology
static void init_packet_set_topology(struct packet_set_topology *packet)
Definition packets_gen.c:77509
receive_packet_nation_availability_100
static struct packet_nation_availability * receive_packet_nation_availability_100(struct connection *pc)
Definition packets_gen.c:53992
init_packet_spaceship_launch
static void init_packet_spaceship_launch(struct packet_spaceship_launch *packet)
Definition packets_gen.c:40140
send_packet_ruleset_extra
int send_packet_ruleset_extra(struct connection *pc, const struct packet_ruleset_extra *packet)
Definition packets_gen.c:62931
send_packet_city_info
int send_packet_city_info(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
Definition packets_gen.c:16412
lsend_packet_ruleset_action
void lsend_packet_ruleset_action(struct conn_list *dest, const struct packet_ruleset_action *packet)
Definition packets_gen.c:67325
receive_packet_ruleset_effect_100
static struct packet_ruleset_effect * receive_packet_ruleset_effect_100(struct connection *pc)
Definition packets_gen.c:77742
send_packet_unit_actions
int send_packet_unit_actions(struct connection *pc, const struct packet_unit_actions *packet)
Definition packets_gen.c:34227
destroy_packet_ruleset_road
#define destroy_packet_ruleset_road
Definition packets_gen.c:63609
receive_packet_player_multiplier_100
static struct packet_player_multiplier * receive_packet_player_multiplier_100(struct connection *pc)
Definition packets_gen.c:26684
init_packet_investigate_started
static void init_packet_investigate_started(struct packet_investigate_started *packet)
Definition packets_gen.c:1174
init_packet_ruleset_achievement
static void init_packet_ruleset_achievement(struct packet_ruleset_achievement *packet)
Definition packets_gen.c:66013
send_packet_ruleset_tech_class
int send_packet_ruleset_tech_class(struct connection *pc, const struct packet_ruleset_tech_class *packet)
Definition packets_gen.c:49361
send_packet_ruleset_tech_flag_100
static int send_packet_ruleset_tech_flag_100(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
Definition packets_gen.c:49497
destroy_packet_server_setting_enum
#define destroy_packet_server_setting_enum
Definition packets_gen.c:76087
receive_packet_unit_server_side_agent_set_100
static struct packet_unit_server_side_agent_set * receive_packet_unit_server_side_agent_set_100(struct connection *pc)
Definition packets_gen.c:31937
destroy_packet_player_attribute_block
#define destroy_packet_player_attribute_block
Definition packets_gen.c:25888
receive_packet_save_scenario_100
static struct packet_save_scenario * receive_packet_save_scenario_100(struct connection *pc)
Definition packets_gen.c:79214
receive_packet_edit_tile_terrain_100
static struct packet_edit_tile_terrain * receive_packet_edit_tile_terrain_100(struct connection *pc)
Definition packets_gen.c:81002
lsend_packet_trade_route_info
void lsend_packet_trade_route_info(struct conn_list *dest, const struct packet_trade_route_info *packet)
Definition packets_gen.c:18403
lsend_packet_diplomacy_accept_treaty
void lsend_packet_diplomacy_accept_treaty(struct conn_list *dest, const struct packet_diplomacy_accept_treaty *packet)
Definition packets_gen.c:37110
dsend_packet_server_join_req
int dsend_packet_server_join_req(struct connection *pc, const char *username, const char *capability, const char *version_label, int major_version, int minor_version, int patch_version)
Definition packets_gen.c:1806
receive_packet_city_update_counters_100
static struct packet_city_update_counters * receive_packet_city_update_counters_100(struct connection *pc)
Definition packets_gen.c:16983
destroy_packet_conn_pong
#define destroy_packet_conn_pong
Definition packets_gen.c:39099
destroy_packet_player_rates
#define destroy_packet_player_rates
Definition packets_gen.c:25197
send_packet_ruleset_summary
int send_packet_ruleset_summary(struct connection *pc, const struct packet_ruleset_summary *packet)
Definition packets_gen.c:72865
lsend_packet_ruleset_extra
void lsend_packet_ruleset_extra(struct conn_list *dest, const struct packet_ruleset_extra *packet)
Definition packets_gen.c:62943
send_packet_edit_tile_extra
int send_packet_edit_tile_extra(struct connection *pc, const struct packet_edit_tile_extra *packet)
Definition packets_gen.c:81565
receive_packet_edit_game_100
static struct packet_edit_game * receive_packet_edit_game_100(struct connection *pc)
Definition packets_gen.c:88120
destroy_packet_diplomacy_remove_clause_req
#define destroy_packet_diplomacy_remove_clause_req
Definition packets_gen.c:36058
packet_handlers_fill_capability
void packet_handlers_fill_capability(struct packet_handlers *phandlers, const char *capability)
Definition packets_gen.c:91168
dsend_packet_server_info
int dsend_packet_server_info(struct connection *pc, const char *version_label, int major_version, int minor_version, int patch_version, int emerg_version)
Definition packets_gen.c:12986
destroy_packet_end_phase
#define destroy_packet_end_phase
Definition packets_gen.c:39445
lsend_packet_ruleset_nation_groups
void lsend_packet_ruleset_nation_groups(struct conn_list *dest, const struct packet_ruleset_nation_groups *packet)
Definition packets_gen.c:52109
send_packet_edit_unit_remove_by_id_100
static int send_packet_edit_unit_remove_by_id_100(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
Definition packets_gen.c:83016
init_packet_ruleset_tech_flag
static void init_packet_ruleset_tech_flag(struct packet_ruleset_tech_flag *packet)
Definition packets_gen.c:49380
destroy_packet_player_research
#define destroy_packet_player_research
Definition packets_gen.c:27705
receive_packet_ruleset_counter_100
static struct packet_ruleset_counter * receive_packet_ruleset_counter_100(struct connection *pc)
Definition packets_gen.c:68524
init_packet_ruleset_unit_flag
static void init_packet_ruleset_unit_flag(struct packet_ruleset_unit_flag *packet)
Definition packets_gen.c:44972
receive_packet_edit_player_100
static struct packet_edit_player * receive_packet_edit_player_100(struct connection *pc)
Definition packets_gen.c:86574
init_packet_server_setting_int
static void init_packet_server_setting_int(struct packet_server_setting_int *packet)
Definition packets_gen.c:75213
init_packet_ruleset_control
static void init_packet_ruleset_control(struct packet_ruleset_control *packet)
Definition packets_gen.c:71363
lsend_packet_ruleset_terrain_control
void lsend_packet_ruleset_terrain_control(struct conn_list *dest, const struct packet_ruleset_terrain_control *packet)
Definition packets_gen.c:50997
send_packet_single_want_hack_req
int send_packet_single_want_hack_req(struct connection *pc, const struct packet_single_want_hack_req *packet)
Definition packets_gen.c:73235
dlsend_packet_diplomacy_remove_clause
void dlsend_packet_diplomacy_remove_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:36693
send_packet_unit_change_activity_100
static int send_packet_unit_change_activity_100(struct connection *pc, const struct packet_unit_change_activity *packet)
Definition packets_gen.c:34387
receive_packet_ruleset_trade_100
static struct packet_ruleset_trade * receive_packet_ruleset_trade_100(struct connection *pc)
Definition packets_gen.c:66400
lsend_packet_ruleset_government_ruler_title
void lsend_packet_ruleset_government_ruler_title(struct conn_list *dest, const struct packet_ruleset_government_ruler_title *packet)
Definition packets_gen.c:48045
send_packet_scenario_info
int send_packet_scenario_info(struct connection *pc, const struct packet_scenario_info *packet)
Definition packets_gen.c:79008
destroy_packet_ruleset_nation_groups
#define destroy_packet_ruleset_nation_groups
Definition packets_gen.c:51659
init_packet_play_music
static void init_packet_play_music(struct packet_play_music *packet)
Definition packets_gen.c:88866
receive_packet_server_setting_str_100
static struct packet_server_setting_str * receive_packet_server_setting_str_100(struct connection *pc)
Definition packets_gen.c:75720
destroy_packet_edit_unit_create
#define destroy_packet_edit_unit_create
Definition packets_gen.c:82261
send_packet_ruleset_base
int send_packet_ruleset_base(struct connection *pc, const struct packet_ruleset_base *packet)
Definition packets_gen.c:63584
destroy_packet_unit_do_action
#define destroy_packet_unit_do_action
Definition packets_gen.c:32678
receive_packet_edit_unit_remove_100
static struct packet_edit_unit_remove * receive_packet_edit_unit_remove_100(struct connection *pc)
Definition packets_gen.c:82628
receive_packet_ruleset_extra_flag_100
static struct packet_ruleset_extra_flag * receive_packet_ruleset_extra_flag_100(struct connection *pc)
Definition packets_gen.c:62966
destroy_packet_city_rally_point
#define destroy_packet_city_rally_point
Definition packets_gen.c:21488
destroy_packet_authentication_req
#define destroy_packet_authentication_req
Definition packets_gen.c:1958
destroy_packet_edit_player
#define destroy_packet_edit_player
Definition packets_gen.c:86547
dlsend_packet_unit_remove
void dlsend_packet_unit_remove(struct conn_list *dest, int unit_id)
Definition packets_gen.c:28287
init_packet_ruleset_game
static void init_packet_ruleset_game(struct packet_ruleset_game *packet)
Definition packets_gen.c:45498
receive_packet_edit_player_vision_100
static struct packet_edit_player_vision * receive_packet_edit_player_vision_100(struct connection *pc)
Definition packets_gen.c:87832
init_packet_city_rename
static void init_packet_city_rename(struct packet_city_rename *packet)
Definition packets_gen.c:20059
receive_packet_nuke_tile_info_100
static struct packet_nuke_tile_info * receive_packet_nuke_tile_info_100(struct connection *pc)
Definition packets_gen.c:10854
init_packet_unit_orders
static void init_packet_unit_orders(struct packet_unit_orders *packet)
Definition packets_gen.c:31447
destroy_packet_ruleset_impr_flag
#define destroy_packet_ruleset_impr_flag
Definition packets_gen.c:56561
destroy_packet_ruleset_action_auto
#define destroy_packet_ruleset_action_auto
Definition packets_gen.c:67889
send_packet_server_setting_int
int send_packet_server_setting_int(struct connection *pc, const struct packet_server_setting_int *packet)
Definition packets_gen.c:75675
send_packet_web_ruleset_unit_addition
int send_packet_web_ruleset_unit_addition(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
Definition packets_gen.c:90744
init_packet_ruleset_specialist
static void init_packet_ruleset_specialist(struct packet_ruleset_specialist *packet)
Definition packets_gen.c:46900
destroy_packet_chat_msg
#define destroy_packet_chat_msg
Definition packets_gen.c:11504
init_packet_timeout_info
static void init_packet_timeout_info(struct packet_timeout_info *packet)
Definition packets_gen.c:10221
destroy_packet_diplomacy_init_meeting_req
#define destroy_packet_diplomacy_init_meeting_req
Definition packets_gen.c:34543
lsend_packet_ruleset_music
void lsend_packet_ruleset_music(struct conn_list *dest, const struct packet_ruleset_music *packet)
Definition packets_gen.c:69543
send_packet_ruleset_choices
int send_packet_ruleset_choices(struct connection *pc, const struct packet_ruleset_choices *packet)
Definition packets_gen.c:73719
destroy_packet_city_short_info
#define destroy_packet_city_short_info
Definition packets_gen.c:17335
receive_packet_edit_city_create_100
static struct packet_edit_city_create * receive_packet_edit_city_create_100(struct connection *pc)
Definition packets_gen.c:83877
init_packet_ruleset_select
static void init_packet_ruleset_select(struct packet_ruleset_select *packet)
Definition packets_gen.c:73731
send_packet_server_setting_control
int send_packet_server_setting_control(struct connection *pc, const struct packet_server_setting_control *packet)
Definition packets_gen.c:74487
receive_packet_timeout_info_100
static struct packet_timeout_info * receive_packet_timeout_info_100(struct connection *pc)
Definition packets_gen.c:10237
init_packet_worker_task
static void init_packet_worker_task(struct packet_worker_task *packet)
Definition packets_gen.c:21902
send_packet_ruleset_trade_100
static int send_packet_ruleset_trade_100(struct connection *pc, const struct packet_ruleset_trade *packet)
Definition packets_gen.c:66536
receive_packet_ruleset_tech_100
static struct packet_ruleset_tech * receive_packet_ruleset_tech_100(struct connection *pc)
Definition packets_gen.c:48107
send_packet_diplomacy_init_meeting_req_100
static int send_packet_diplomacy_init_meeting_req_100(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
Definition packets_gen.c:34624
destroy_packet_spaceship_place
#define destroy_packet_spaceship_place
Definition packets_gen.c:40186
init_packet_research_info
static void init_packet_research_info(struct packet_research_info *packet)
Definition packets_gen.c:26985
dsend_packet_chat_msg_req
int dsend_packet_chat_msg_req(struct connection *pc, const char *message)
Definition packets_gen.c:12456
receive_packet_server_join_reply_100
static struct packet_server_join_reply * receive_packet_server_join_reply_100(struct connection *pc)
Definition packets_gen.c:1828
send_packet_play_music
int send_packet_play_music(struct connection *pc, const struct packet_play_music *packet)
Definition packets_gen.c:89032
init_packet_ruleset_building
static void init_packet_ruleset_building(struct packet_ruleset_building *packet)
Definition packets_gen.c:55141
send_packet_unit_short_info_100
static int send_packet_unit_short_info_100(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
Definition packets_gen.c:30417
send_packet_server_setting_bool
int send_packet_server_setting_bool(struct connection *pc, const struct packet_server_setting_bool *packet)
Definition packets_gen.c:75201
init_packet_ruleset_terrain
static void init_packet_ruleset_terrain(struct packet_ruleset_terrain *packet)
Definition packets_gen.c:56818
receive_packet_player_tech_goal_100
static struct packet_player_tech_goal * receive_packet_player_tech_goal_100(struct connection *pc)
Definition packets_gen.c:27902
dsend_packet_unit_remove
int dsend_packet_unit_remove(struct connection *pc, int unit_id)
Definition packets_gen.c:28278
dsend_packet_city_worklist
int dsend_packet_city_worklist(struct connection *pc, int city_id, const struct worklist *worklist)
Definition packets_gen.c:19308
receive_packet_city_change_specialist_100
static struct packet_city_change_specialist * receive_packet_city_change_specialist_100(struct connection *pc)
Definition packets_gen.c:19788
send_packet_tile_info_100
static int send_packet_tile_info_100(struct connection *pc, const struct packet_tile_info *packet)
Definition packets_gen.c:3633
receive_packet_city_rename_100
static struct packet_city_rename * receive_packet_city_rename_100(struct connection *pc)
Definition packets_gen.c:20075
init_packet_web_ruleset_unit_addition
static void init_packet_web_ruleset_unit_addition(struct packet_web_ruleset_unit_addition *packet)
Definition packets_gen.c:90521
receive_packet_investigate_started_100
static struct packet_investigate_started * receive_packet_investigate_started_100(struct connection *pc)
Definition packets_gen.c:1190
init_packet_unit_action_query
static void init_packet_unit_action_query(struct packet_unit_action_query *packet)
Definition packets_gen.c:32158
init_packet_new_year
static void init_packet_new_year(struct packet_new_year *packet)
Definition packets_gen.c:39689
send_packet_edit_startpos_full_100
static int send_packet_edit_startpos_full_100(struct connection *pc, const struct packet_edit_startpos_full *packet)
Definition packets_gen.c:81748
destroy_packet_ruleset_base
#define destroy_packet_ruleset_base
Definition packets_gen.c:63219
send_packet_city_change
int send_packet_city_change(struct connection *pc, const struct packet_city_change *packet)
Definition packets_gen.c:19068
destroy_packet_ruleset_city
#define destroy_packet_ruleset_city
Definition packets_gen.c:54589
receive_packet_server_setting_const_100
static struct packet_server_setting_const * receive_packet_server_setting_const_100(struct connection *pc)
Definition packets_gen.c:74532
send_packet_processing_started
int send_packet_processing_started(struct connection *pc)
Definition packets_gen.c:1122
destroy_packet_thaw_client
#define destroy_packet_thaw_client
Definition packets_gen.c:40099
receive_packet_vote_new_100
static struct packet_vote_new * receive_packet_vote_new_100(struct connection *pc)
Definition packets_gen.c:79401
receive_packet_unit_orders_100
static struct packet_unit_orders * receive_packet_unit_orders_100(struct connection *pc)
Definition packets_gen.c:31463
send_packet_report_req
int send_packet_report_req(struct connection *pc, const struct packet_report_req *packet)
Definition packets_gen.c:38088
dsend_packet_diplomacy_create_clause
int dsend_packet_diplomacy_create_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:36028
send_packet_edit_player_100
static int send_packet_edit_player_100(struct connection *pc, const struct packet_edit_player *packet)
Definition packets_gen.c:87083
init_packet_edit_city
static void init_packet_edit_city(struct packet_edit_city *packet)
Definition packets_gen.c:84355
send_packet_vote_submit
int send_packet_vote_submit(struct connection *pc, const struct packet_vote_submit *packet)
Definition packets_gen.c:80523
init_packet_early_chat_msg
static void init_packet_early_chat_msg(struct packet_early_chat_msg *packet)
Definition packets_gen.c:11888
send_packet_trade_route_info
int send_packet_trade_route_info(struct connection *pc, const struct packet_trade_route_info *packet)
Definition packets_gen.c:18391
init_packet_ruleset_terrain_flag
static void init_packet_ruleset_terrain_flag(struct packet_ruleset_terrain_flag *packet)
Definition packets_gen.c:59432
receive_packet_unit_info_100
static struct packet_unit_info * receive_packet_unit_info_100(struct connection *pc)
Definition packets_gen.c:28329
receive_packet_new_year_100
static struct packet_new_year * receive_packet_new_year_100(struct connection *pc)
Definition packets_gen.c:39705
lsend_packet_city_info
void lsend_packet_city_info(struct conn_list *dest, const struct packet_city_info *packet, bool force_to_send)
Definition packets_gen.c:16424
free_packet_ruleset_specialist
static void free_packet_ruleset_specialist(struct packet_ruleset_specialist *packet)
Definition packets_gen.c:46915
packet_functional_capability
const char *const packet_functional_capability
Definition packets_gen.c:30
init_packet_unit_type_upgrade
static void init_packet_unit_type_upgrade(struct packet_unit_type_upgrade *packet)
Definition packets_gen.c:32475
destroy_packet_edit_city
#define destroy_packet_edit_city
Definition packets_gen.c:84361
send_packet_server_join_req_100
static int send_packet_server_join_req_100(struct connection *pc, const struct packet_server_join_req *packet)
Definition packets_gen.c:1725
dsend_packet_city_make_specialist
int dsend_packet_city_make_specialist(struct connection *pc, int city_id, int tile_id)
Definition packets_gen.c:19535
destroy_packet_client_info
#define destroy_packet_client_info
Definition packets_gen.c:39179
send_packet_chat_msg
int send_packet_chat_msg(struct connection *pc, const struct packet_chat_msg *packet)
Definition packets_gen.c:11869
send_packet_diplomacy_accept_treaty_req_100
static int send_packet_diplomacy_accept_treaty_req_100(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
Definition packets_gen.c:36792
lsend_packet_ruleset_control
void lsend_packet_ruleset_control(struct conn_list *dest, const struct packet_ruleset_control *packet)
Definition packets_gen.c:72692
destroy_packet_player_multiplier
#define destroy_packet_player_multiplier
Definition packets_gen.c:26674
init_packet_player_multiplier
static void init_packet_player_multiplier(struct packet_player_multiplier *packet)
Definition packets_gen.c:26668
init_packet_player_phase_done
static void init_packet_player_phase_done(struct packet_player_phase_done *packet)
Definition packets_gen.c:25004
init_packet_ruleset_base
static void init_packet_ruleset_base(struct packet_ruleset_base *packet)
Definition packets_gen.c:63213
destroy_packet_unit_type_upgrade
#define destroy_packet_unit_type_upgrade
Definition packets_gen.c:32481
init_packet_player_place_infra
static void init_packet_player_place_infra(struct packet_player_place_infra *packet)
Definition packets_gen.c:25655
send_packet_edit_startpos_100
static int send_packet_edit_startpos_100(struct connection *pc, const struct packet_edit_startpos *packet)
Definition packets_gen.c:81635
send_packet_unit_do_action
int send_packet_unit_do_action(struct connection *pc, const struct packet_unit_do_action *packet)
Definition packets_gen.c:33004
send_packet_diplomacy_accept_treaty_100
static int send_packet_diplomacy_accept_treaty_100(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
Definition packets_gen.c:36993
receive_packet_nation_select_req_100
static struct packet_nation_select_req * receive_packet_nation_select_req_100(struct connection *pc)
Definition packets_gen.c:2430
send_packet_early_chat_msg
int send_packet_early_chat_msg(struct connection *pc, const struct packet_early_chat_msg *packet)
Definition packets_gen.c:12259
send_packet_ruleset_tech_100
static int send_packet_ruleset_tech_100(struct connection *pc, const struct packet_ruleset_tech *packet)
Definition packets_gen.c:48532
receive_packet_city_buy_100
static struct packet_city_buy * receive_packet_city_buy_100(struct connection *pc)
Definition packets_gen.c:18653
destroy_packet_ruleset_tech
static void destroy_packet_ruleset_tech(void *packet)
Definition packets_gen.c:48093
receive_packet_edit_unit_remove_by_id_100
static struct packet_edit_unit_remove_by_id * receive_packet_edit_unit_remove_by_id_100(struct connection *pc)
Definition packets_gen.c:82945
send_packet_ruleset_select_100
static int send_packet_ruleset_select_100(struct connection *pc, const struct packet_ruleset_select *packet)
Definition packets_gen.c:73818
send_packet_ruleset_action_auto
int send_packet_ruleset_action_auto(struct connection *pc, const struct packet_ruleset_action_auto *packet)
Definition packets_gen.c:68464
dsend_packet_nuke_tile_info
int dsend_packet_nuke_tile_info(struct connection *pc, int tile)
Definition packets_gen.c:11023
send_packet_research_info_100
static int send_packet_research_info_100(struct connection *pc, const struct packet_research_info *packet)
Definition packets_gen.c:27207
send_packet_city_make_worker
int send_packet_city_make_worker(struct connection *pc, const struct packet_city_make_worker *packet)
Definition packets_gen.c:19750
free_packet_ruleset_tech
static void free_packet_ruleset_tech(struct packet_ruleset_tech *packet)
Definition packets_gen.c:48072
send_packet_ruleset_description_part_100
static int send_packet_ruleset_description_part_100(struct connection *pc, const struct packet_ruleset_description_part *packet)
Definition packets_gen.c:72971
send_packet_calendar_info_100
static int send_packet_calendar_info_100(struct connection *pc, const struct packet_calendar_info *packet)
Definition packets_gen.c:9975
destroy_packet_scenario_info
#define destroy_packet_scenario_info
Definition packets_gen.c:78531
send_packet_diplomacy_remove_clause_req
int send_packet_diplomacy_remove_clause_req(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
Definition packets_gen.c:36345
dsend_packet_diplomacy_cancel_meeting_req
int dsend_packet_diplomacy_cancel_meeting_req(struct connection *pc, int counterpart)
Definition packets_gen.c:35146
send_packet_unit_orders
int send_packet_unit_orders(struct connection *pc, const struct packet_unit_orders *packet)
Definition packets_gen.c:31909
send_packet_conn_ping_info
int send_packet_conn_ping_info(struct connection *pc, const struct packet_conn_ping_info *packet)
Definition packets_gen.c:39034
dsend_packet_unit_get_actions
int dsend_packet_unit_get_actions(struct connection *pc, int actor_unit_id, int target_unit_id, int target_tile_id, int target_extra_id, int request_kind)
Definition packets_gen.c:33720
dsend_packet_player_tech_goal
int dsend_packet_player_tech_goal(struct connection *pc, int tech)
Definition packets_gen.c:28064
send_packet_ruleset_action_enabler_100
static int send_packet_ruleset_action_enabler_100(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
Definition packets_gen.c:67577
send_packet_player_rates
int send_packet_player_rates(struct connection *pc, const struct packet_player_rates *packet)
Definition packets_gen.c:25435
send_packet_player_diplstate
int send_packet_player_diplstate(struct connection *pc, const struct packet_player_diplstate *packet)
Definition packets_gen.c:26656
dsend_packet_city_change
int dsend_packet_city_change(struct connection *pc, int city_id, int production_kind, int production_value)
Definition packets_gen.c:19080
destroy_packet_vote_resolve
#define destroy_packet_vote_resolve
Definition packets_gen.c:80255
init_packet_calendar_info
static void init_packet_calendar_info(struct packet_calendar_info *packet)
Definition packets_gen.c:9798
send_packet_edit_player_remove
int send_packet_edit_player_remove(struct connection *pc, const struct packet_edit_player_remove *packet)
Definition packets_gen.c:86520
receive_packet_web_cma_clear_100
static struct packet_web_cma_clear * receive_packet_web_cma_clear_100(struct connection *pc)
Definition packets_gen.c:90127
receive_packet_server_setting_bool_100
static struct packet_server_setting_bool * receive_packet_server_setting_bool_100(struct connection *pc)
Definition packets_gen.c:74884
receive_packet_endgame_player_100
static struct packet_endgame_player * receive_packet_endgame_player_100(struct connection *pc)
Definition packets_gen.c:3122
init_packet_page_msg
static void init_packet_page_msg(struct packet_page_msg *packet)
Definition packets_gen.c:37376
init_packet_unit_info
static void init_packet_unit_info(struct packet_unit_info *packet)
Definition packets_gen.c:28296
send_packet_city_make_specialist_100
static int send_packet_city_make_specialist_100(struct connection *pc, const struct packet_city_make_specialist *packet)
Definition packets_gen.c:19420
send_packet_edit_toggle_fogofwar_100
static int send_packet_edit_toggle_fogofwar_100(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
Definition packets_gen.c:80869
receive_packet_diplomacy_cancel_meeting_100
static struct packet_diplomacy_cancel_meeting * receive_packet_diplomacy_cancel_meeting_100(struct connection *pc)
Definition packets_gen.c:35171
send_packet_city_sabotage_list
int send_packet_city_sabotage_list(struct connection *pc, const struct packet_city_sabotage_list *packet)
Definition packets_gen.c:21463
send_packet_edit_unit_create_100
static int send_packet_edit_unit_create_100(struct connection *pc, const struct packet_edit_unit_create *packet)
Definition packets_gen.c:82412
free_packet_ruleset_extra
static void free_packet_ruleset_extra(struct packet_ruleset_extra *packet)
Definition packets_gen.c:60393
send_packet_city_refresh_100
static int send_packet_city_refresh_100(struct connection *pc, const struct packet_city_refresh *packet)
Definition packets_gen.c:20600
send_packet_conn_ping_info_100
static int send_packet_conn_ping_info_100(struct connection *pc, const struct packet_conn_ping_info *packet)
Definition packets_gen.c:38795
send_packet_diplomacy_create_clause_req_100
static int send_packet_diplomacy_create_clause_req_100(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
Definition packets_gen.c:35541
lsend_packet_team_name_info
void lsend_packet_team_name_info(struct conn_list *dest, const struct packet_team_name_info *packet)
Definition packets_gen.c:11266
send_packet_client_info_100
static int send_packet_client_info_100(struct connection *pc, const struct packet_client_info *packet)
Definition packets_gen.c:39300
dlsend_packet_investigate_finished
void dlsend_packet_investigate_finished(struct conn_list *dest, int unit_id, int city_id)
Definition packets_gen.c:1652
receive_packet_edit_unit_create_100
static struct packet_edit_unit_create * receive_packet_edit_unit_create_100(struct connection *pc)
Definition packets_gen.c:82271
receive_packet_city_nationalities_100
static struct packet_city_nationalities * receive_packet_city_nationalities_100(struct connection *pc)
Definition packets_gen.c:16464
destroy_packet_page_msg_part
#define destroy_packet_page_msg_part
Definition packets_gen.c:37733
send_packet_web_cma_clear
int send_packet_web_cma_clear(struct connection *pc, const struct packet_web_cma_clear *packet)
Definition packets_gen.c:90277
lsend_packet_ruleset_effect
void lsend_packet_ruleset_effect(struct conn_list *dest, const struct packet_ruleset_effect *packet)
Definition packets_gen.c:78200
send_packet_vote_new_100
static int send_packet_vote_new_100(struct connection *pc, const struct packet_vote_new *packet)
Definition packets_gen.c:79532
destroy_packet_diplomacy_cancel_pact
#define destroy_packet_diplomacy_cancel_pact
Definition packets_gen.c:37145
init_packet_edit_player_create
static void init_packet_edit_player_create(struct packet_edit_player_create *packet)
Definition packets_gen.c:86167
send_packet_city_refresh
int send_packet_city_refresh(struct connection *pc, const struct packet_city_refresh *packet)
Definition packets_gen.c:20679
init_packet_ruleset_multiplier
static void init_packet_ruleset_multiplier(struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:69550
destroy_packet_ruleset_terrain_control
#define destroy_packet_ruleset_terrain_control
Definition packets_gen.c:50434
init_packet_edit_object_created
static void init_packet_edit_object_created(struct packet_edit_object_created *packet)
Definition packets_gen.c:88639
lsend_packet_unit_short_info
void lsend_packet_unit_short_info(struct conn_list *dest, const struct packet_unit_short_info *packet, bool force_to_send)
Definition packets_gen.c:30821
send_packet_city_buy_100
static int send_packet_city_buy_100(struct connection *pc, const struct packet_city_buy *packet)
Definition packets_gen.c:18724
init_packet_game_info
static void init_packet_game_info(struct packet_game_info *packet)
Definition packets_gen.c:4055
send_packet_city_name_suggestion_req_100
static int send_packet_city_name_suggestion_req_100(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
Definition packets_gen.c:20787
send_packet_diplomacy_accept_treaty_req
int send_packet_diplomacy_accept_treaty_req(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
Definition packets_gen.c:36871
destroy_packet_investigate_started
#define destroy_packet_investigate_started
Definition packets_gen.c:1180
send_packet_unit_action_answer
int send_packet_unit_action_answer(struct connection *pc, const struct packet_unit_action_answer *packet)
Definition packets_gen.c:33361
send_packet_scenario_description_100
static int send_packet_scenario_description_100(struct connection *pc, const struct packet_scenario_description *packet)
Definition packets_gen.c:79107
init_packet_nation_select_req
static void init_packet_nation_select_req(struct packet_nation_select_req *packet)
Definition packets_gen.c:2414
lsend_packet_ruleset_terrain_flag
void lsend_packet_ruleset_terrain_flag(struct conn_list *dest, const struct packet_ruleset_terrain_flag *packet)
Definition packets_gen.c:59688
init_packet_scenario_info
static void init_packet_scenario_info(struct packet_scenario_info *packet)
Definition packets_gen.c:78525
lsend_packet_ruleset_unit_class
void lsend_packet_ruleset_unit_class(struct conn_list *dest, const struct packet_ruleset_unit_class *packet)
Definition packets_gen.c:60339
send_packet_city_update_counters_100
static int send_packet_city_update_counters_100(struct connection *pc, const struct packet_city_update_counters *packet)
Definition packets_gen.c:17126
receive_packet_chat_msg_req_100
static struct packet_chat_msg_req * receive_packet_chat_msg_req_100(struct connection *pc)
Definition packets_gen.c:12294
receive_packet_web_cma_set_100
static struct packet_web_cma_set * receive_packet_web_cma_set_100(struct connection *pc)
Definition packets_gen.c:89919
send_packet_timeout_info_100
static int send_packet_timeout_info_100(struct connection *pc, const struct packet_timeout_info *packet)
Definition packets_gen.c:10323
receive_packet_diplomacy_create_clause_req_100
static struct packet_diplomacy_create_clause_req * receive_packet_diplomacy_create_clause_req_100(struct connection *pc)
Definition packets_gen.c:35415
dsend_packet_unit_server_side_agent_set
int dsend_packet_unit_server_side_agent_set(struct connection *pc, int unit_id, enum server_side_agent agent)
Definition packets_gen.c:32148
destroy_packet_edit_startpos
#define destroy_packet_edit_startpos
Definition packets_gen.c:81596
send_packet_edit_player_vision
int send_packet_edit_player_vision(struct connection *pc, const struct packet_edit_player_vision *packet)
Definition packets_gen.c:88080
send_packet_single_want_hack_reply
int send_packet_single_want_hack_reply(struct connection *pc, const struct packet_single_want_hack_reply *packet)
Definition packets_gen.c:73393
destroy_packet_ruleset_trade
#define destroy_packet_ruleset_trade
Definition packets_gen.c:66390
receive_packet_ruleset_terrain_100
static struct packet_ruleset_terrain * receive_packet_ruleset_terrain_100(struct connection *pc)
Definition packets_gen.c:56919
send_packet_ruleset_unit_class_100
static int send_packet_ruleset_unit_class_100(struct connection *pc, const struct packet_ruleset_unit_class *packet)
Definition packets_gen.c:60001
init_packet_client_heartbeat
static void init_packet_client_heartbeat(struct packet_client_heartbeat *packet)
Definition packets_gen.c:39133
send_packet_player_info_100
static int send_packet_player_info_100(struct connection *pc, const struct packet_player_info *packet)
Definition packets_gen.c:23490
destroy_packet_edit_mode
#define destroy_packet_edit_mode
Definition packets_gen.c:80541
send_packet_end_phase
int send_packet_end_phase(struct connection *pc)
Definition packets_gen.c:39467
init_packet_tile_info
static void init_packet_tile_info(struct packet_tile_info *packet)
Definition packets_gen.c:3296
init_packet_end_turn
static void init_packet_end_turn(struct packet_end_turn *packet)
Definition packets_gen.c:39999
init_packet_server_setting_str
static void init_packet_server_setting_str(struct packet_server_setting_str *packet)
Definition packets_gen.c:75687
destroy_packet_processing_started
#define destroy_packet_processing_started
Definition packets_gen.c:1100
send_packet_edit_startpos_full
int send_packet_edit_startpos_full(struct connection *pc, const struct packet_edit_startpos_full *packet)
Definition packets_gen.c:81793
lsend_packet_ruleset_disaster
void lsend_packet_ruleset_disaster(struct conn_list *dest, const struct packet_ruleset_disaster *packet)
Definition packets_gen.c:66006
lsend_packet_spaceship_info
void lsend_packet_spaceship_info(struct conn_list *dest, const struct packet_spaceship_info *packet)
Definition packets_gen.c:41289
dsend_packet_diplomacy_init_meeting
int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
Definition packets_gen.c:34948
receive_packet_trade_route_info_100
static struct packet_trade_route_info * receive_packet_trade_route_info_100(struct connection *pc)
Definition packets_gen.c:18026
receive_packet_edit_player_create_100
static struct packet_edit_player_create * receive_packet_edit_player_create_100(struct connection *pc)
Definition packets_gen.c:86183
send_packet_save_scenario_100
static int send_packet_save_scenario_100(struct connection *pc, const struct packet_save_scenario *packet)
Definition packets_gen.c:79285
dsend_packet_city_change_specialist
int dsend_packet_city_change_specialist(struct connection *pc, int city_id, Specialist_type_id from, Specialist_type_id to)
Definition packets_gen.c:20048
send_packet_ruleset_terrain
int send_packet_ruleset_terrain(struct connection *pc, const struct packet_ruleset_terrain *packet)
Definition packets_gen.c:59413
send_packet_ruleset_unit_class_flag_100
static int send_packet_ruleset_unit_class_flag_100(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
Definition packets_gen.c:45352
send_packet_edit_tile_extra_100
static int send_packet_edit_tile_extra_100(struct connection *pc, const struct packet_edit_tile_extra *packet)
Definition packets_gen.c:81408
send_packet_city_name_suggestion_info_100
static int send_packet_city_name_suggestion_info_100(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
Definition packets_gen.c:20989
lsend_packet_page_msg
void lsend_packet_page_msg(struct conn_list *dest, const struct packet_page_msg *packet)
Definition packets_gen.c:37720
send_packet_unit_type_upgrade_100
static int send_packet_unit_type_upgrade_100(struct connection *pc, const struct packet_unit_type_upgrade *packet)
Definition packets_gen.c:32572
send_packet_player_info
int send_packet_player_info(struct connection *pc, const struct packet_player_info *packet)
Definition packets_gen.c:24992
init_packet_ruleset_unit_class_flag
static void init_packet_ruleset_unit_class_flag(struct packet_ruleset_unit_class_flag *packet)
Definition packets_gen.c:45235
send_packet_player_place_infra_100
static int send_packet_player_place_infra_100(struct connection *pc, const struct packet_player_place_infra *packet)
Definition packets_gen.c:25757
destroy_packet_ruleset_resource
#define destroy_packet_ruleset_resource
Definition packets_gen.c:78213
send_packet_city_options_req
int send_packet_city_options_req(struct connection *pc, const struct packet_city_options_req *packet)
Definition packets_gen.c:20491
send_packet_end_phase_100
static int send_packet_end_phase_100(struct connection *pc)
Definition packets_gen.c:39459
dsend_packet_nation_select_req
int dsend_packet_nation_select_req(struct connection *pc, int player_no, Nation_type_id nation_no, bool is_male, const char *name, int style)
Definition packets_gen.c:2739
send_packet_ruleset_clause
int send_packet_ruleset_clause(struct connection *pc, const struct packet_ruleset_clause *packet)
Definition packets_gen.c:71344
send_packet_diplomacy_create_clause_req
int send_packet_diplomacy_create_clause_req(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
Definition packets_gen.c:35692
send_packet_worker_task_100
static int send_packet_worker_task_100(struct connection *pc, const struct packet_worker_task *packet)
Definition packets_gen.c:22059
receive_packet_ruleset_government_100
static struct packet_ruleset_government * receive_packet_ruleset_government_100(struct connection *pc)
Definition packets_gen.c:49686
send_packet_spaceship_launch_100
static int send_packet_spaceship_launch_100(struct connection *pc)
Definition packets_gen.c:40160
send_packet_city_nationalities
int send_packet_city_nationalities(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
Definition packets_gen.c:16931
destroy_packet_unit_combat_info
#define destroy_packet_unit_combat_info
Definition packets_gen.c:30834
send_packet_edit_player_remove_100
static int send_packet_edit_player_remove_100(struct connection *pc, const struct packet_edit_player_remove *packet)
Definition packets_gen.c:86441
dsend_packet_edit_startpos
int dsend_packet_edit_startpos(struct connection *pc, int id, bool removal, int tag)
Definition packets_gen.c:81692
receive_packet_ruleset_music_100
static struct packet_ruleset_music * receive_packet_ruleset_music_100(struct connection *pc)
Definition packets_gen.c:69125
send_packet_unit_do_action_100
static int send_packet_unit_do_action_100(struct connection *pc, const struct packet_unit_do_action *packet)
Definition packets_gen.c:32829
send_packet_nation_select_req
int send_packet_nation_select_req(struct connection *pc, const struct packet_nation_select_req *packet)
Definition packets_gen.c:2727
receive_packet_ruleset_unit_class_100
static struct packet_ruleset_unit_class * receive_packet_ruleset_unit_class_100(struct connection *pc)
Definition packets_gen.c:59738
lsend_packet_ruleset_description_part
void lsend_packet_ruleset_description_part(struct conn_list *dest, const struct packet_ruleset_description_part *packet)
Definition packets_gen.c:73062
destroy_packet_ruleset_tech_flag
#define destroy_packet_ruleset_tech_flag
Definition packets_gen.c:49386
send_packet_end_turn_100
static int send_packet_end_turn_100(struct connection *pc)
Definition packets_gen.c:40019
destroy_packet_web_cma_set
#define destroy_packet_web_cma_set
Definition packets_gen.c:89892
receive_packet_connect_msg_100
static struct packet_connect_msg * receive_packet_connect_msg_100(struct connection *pc)
Definition packets_gen.c:12481
lsend_packet_city_short_info
void lsend_packet_city_short_info(struct conn_list *dest, const struct packet_city_short_info *packet)
Definition packets_gen.c:18003
dsend_packet_city_refresh
int dsend_packet_city_refresh(struct connection *pc, int city_id)
Definition packets_gen.c:20691
lsend_packet_ruleset_government
void lsend_packet_ruleset_government(struct conn_list *dest, const struct packet_ruleset_government *packet)
Definition packets_gen.c:50421
send_packet_ruleset_tech
int send_packet_ruleset_tech(struct connection *pc, const struct packet_ruleset_tech *packet)
Definition packets_gen.c:49059
destroy_packet_timeout_info
#define destroy_packet_timeout_info
Definition packets_gen.c:10227
send_packet_nuke_tile_info_100
static int send_packet_nuke_tile_info_100(struct connection *pc, const struct packet_nuke_tile_info *packet)
Definition packets_gen.c:10925
init_packet_server_setting_bool
static void init_packet_server_setting_bool(struct packet_server_setting_bool *packet)
Definition packets_gen.c:74851
send_packet_server_setting_enum_100
static int send_packet_server_setting_enum_100(struct connection *pc, const struct packet_server_setting_enum *packet)
Definition packets_gen.c:76392
destroy_packet_tile_info
#define destroy_packet_tile_info
Definition packets_gen.c:3302
receive_packet_ruleset_action_enabler_100
static struct packet_ruleset_action_enabler * receive_packet_ruleset_action_enabler_100(struct connection *pc)
Definition packets_gen.c:67348
init_packet_ruleset_action_enabler
static void init_packet_ruleset_action_enabler(struct packet_ruleset_action_enabler *packet)
Definition packets_gen.c:67332
receive_packet_unit_change_activity_100
static struct packet_unit_change_activity * receive_packet_unit_change_activity_100(struct connection *pc)
Definition packets_gen.c:34276
send_packet_diplomacy_remove_clause_100
static int send_packet_diplomacy_remove_clause_100(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
Definition packets_gen.c:36511
send_packet_player_phase_done_100
static int send_packet_player_phase_done_100(struct connection *pc, const struct packet_player_phase_done *packet)
Definition packets_gen.c:25091
send_packet_player_place_infra
int send_packet_player_place_infra(struct connection *pc, const struct packet_player_place_infra *packet)
Definition packets_gen.c:25860
destroy_packet_ruleset_unit_class_flag
#define destroy_packet_ruleset_unit_class_flag
Definition packets_gen.c:45241
destroy_packet_begin_turn
#define destroy_packet_begin_turn
Definition packets_gen.c:39958
destroy_packet_game_load
#define destroy_packet_game_load
Definition packets_gen.c:73915
destroy_packet_single_want_hack_req
#define destroy_packet_single_want_hack_req
Definition packets_gen.c:73075
destroy_packet_start_phase
#define destroy_packet_start_phase
Definition packets_gen.c:39492
send_packet_ruleset_nation
int send_packet_ruleset_nation(struct connection *pc, const struct packet_ruleset_nation *packet)
Definition packets_gen.c:53957
destroy_packet_city_name_suggestion_info
#define destroy_packet_city_name_suggestion_info
Definition packets_gen.c:20893
send_packet_city_make_worker_100
static int send_packet_city_make_worker_100(struct connection *pc, const struct packet_city_make_worker *packet)
Definition packets_gen.c:19647
init_packet_unit_remove
static void init_packet_unit_remove(struct packet_unit_remove *packet)
Definition packets_gen.c:28073
send_packet_server_shutdown_100
static int send_packet_server_shutdown_100(struct connection *pc)
Definition packets_gen.c:2387
send_packet_begin_turn
int send_packet_begin_turn(struct connection *pc)
Definition packets_gen.c:39980
free_packet_ruleset_multiplier
static void free_packet_ruleset_multiplier(struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:69569
lsend_packet_ruleset_unit_bonus
void lsend_packet_ruleset_unit_bonus(struct conn_list *dest, const struct packet_ruleset_unit_bonus *packet)
Definition packets_gen.c:44965
destroy_packet_vote_remove
#define destroy_packet_vote_remove
Definition packets_gen.c:80077
destroy_packet_city_make_specialist
#define destroy_packet_city_make_specialist
Definition packets_gen.c:19324
destroy_packet_city_rename
#define destroy_packet_city_rename
Definition packets_gen.c:20065
receive_packet_unit_sscs_set_100
static struct packet_unit_sscs_set * receive_packet_unit_sscs_set_100(struct connection *pc)
Definition packets_gen.c:31186
send_packet_ruleset_base_100
static int send_packet_ruleset_base_100(struct connection *pc, const struct packet_ruleset_base *packet)
Definition packets_gen.c:63385
dlsend_packet_nuke_tile_info
void dlsend_packet_nuke_tile_info(struct conn_list *dest, int tile)
Definition packets_gen.c:11032
receive_packet_client_info_100
static struct packet_client_info * receive_packet_client_info_100(struct connection *pc)
Definition packets_gen.c:39189
destroy_packet_ruleset_goods
static void destroy_packet_ruleset_goods(void *packet)
Definition packets_gen.c:64662
send_packet_connect_msg
int send_packet_connect_msg(struct connection *pc, const struct packet_connect_msg *packet)
Definition packets_gen.c:12631
receive_packet_unit_remove_100
static struct packet_unit_remove * receive_packet_unit_remove_100(struct connection *pc)
Definition packets_gen.c:28089
dsend_packet_city_make_worker
int dsend_packet_city_make_worker(struct connection *pc, int city_id, int tile_id)
Definition packets_gen.c:19762
send_packet_ruleset_effect_100
static int send_packet_ruleset_effect_100(struct connection *pc, const struct packet_ruleset_effect *packet)
Definition packets_gen.c:77944
send_packet_ruleset_game_100
static int send_packet_ruleset_game_100(struct connection *pc, const struct packet_ruleset_game *packet)
Definition packets_gen.c:46098
init_packet_city_remove
static void init_packet_city_remove(struct packet_city_remove *packet)
Definition packets_gen.c:12999
receive_packet_calendar_info_100
static struct packet_calendar_info * receive_packet_calendar_info_100(struct connection *pc)
Definition packets_gen.c:9814
destroy_packet_ruleset_control
#define destroy_packet_ruleset_control
Definition packets_gen.c:71369
send_packet_player_remove
int send_packet_player_remove(struct connection *pc, const struct packet_player_remove *packet)
Definition packets_gen.c:22429
receive_packet_diplomacy_create_clause_100
static struct packet_diplomacy_create_clause * receive_packet_diplomacy_create_clause_100(struct connection *pc)
Definition packets_gen.c:35732
init_packet_player_remove
static void init_packet_player_remove(struct packet_player_remove *packet)
Definition packets_gen.c:22253
receive_packet_web_player_info_addition_100
static struct packet_web_player_info_addition * receive_packet_web_player_info_addition_100(struct connection *pc)
Definition packets_gen.c:90322
destroy_packet_connect_msg
#define destroy_packet_connect_msg
Definition packets_gen.c:12471
send_packet_diplomacy_cancel_meeting_req
int send_packet_diplomacy_cancel_meeting_req(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
Definition packets_gen.c:35134
receive_packet_play_music_100
static struct packet_play_music * receive_packet_play_music_100(struct connection *pc)
Definition packets_gen.c:88882
lsend_packet_worker_task
void lsend_packet_worker_task(struct conn_list *dest, const struct packet_worker_task *packet)
Definition packets_gen.c:22246
destroy_packet_edit_object_created
#define destroy_packet_edit_object_created
Definition packets_gen.c:88645
dsend_packet_player_phase_done
int dsend_packet_player_phase_done(struct connection *pc, int turn)
Definition packets_gen.c:25182
send_packet_unit_sscs_set_100
static int send_packet_unit_sscs_set_100(struct connection *pc, const struct packet_unit_sscs_set *packet)
Definition packets_gen.c:31297
send_packet_investigate_started
int send_packet_investigate_started(struct connection *pc, const struct packet_investigate_started *packet)
Definition packets_gen.c:1379
send_packet_early_chat_msg_100
static int send_packet_early_chat_msg_100(struct connection *pc, const struct packet_early_chat_msg *packet)
Definition packets_gen.c:12060
send_packet_unit_action_answer_100
static int send_packet_unit_action_answer_100(struct connection *pc, const struct packet_unit_action_answer *packet)
Definition packets_gen.c:33186
receive_packet_city_name_suggestion_info_100
static struct packet_city_name_suggestion_info * receive_packet_city_name_suggestion_info_100(struct connection *pc)
Definition packets_gen.c:20903
send_packet_investigate_finished
int send_packet_investigate_finished(struct connection *pc, const struct packet_investigate_finished *packet)
Definition packets_gen.c:1623
init_packet_diplomacy_accept_treaty_req
static void init_packet_diplomacy_accept_treaty_req(struct packet_diplomacy_accept_treaty_req *packet)
Definition packets_gen.c:36705
destroy_packet_player_diplstate
#define destroy_packet_player_diplstate
Definition packets_gen.c:26244
destroy_packet_ruleset_clause
#define destroy_packet_ruleset_clause
Definition packets_gen.c:70620
send_packet_play_music_100
static int send_packet_play_music_100(struct connection *pc, const struct packet_play_music *packet)
Definition packets_gen.c:88953
send_packet_client_heartbeat
int send_packet_client_heartbeat(struct connection *pc)
Definition packets_gen.c:39161
send_packet_city_short_info
int send_packet_city_short_info(struct connection *pc, const struct packet_city_short_info *packet)
Definition packets_gen.c:17991
send_packet_edit_object_created
int send_packet_edit_object_created(struct connection *pc, const struct packet_edit_object_created *packet)
Definition packets_gen.c:88844
init_packet_server_shutdown
static void init_packet_server_shutdown(struct packet_server_shutdown *packet)
Definition packets_gen.c:2367
send_packet_player_multiplier_100
static int send_packet_player_multiplier_100(struct connection *pc, const struct packet_player_multiplier *packet)
Definition packets_gen.c:26814
send_packet_authentication_reply
int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
Definition packets_gen.c:2355
send_packet_edit_player
int send_packet_edit_player(struct connection *pc, const struct packet_edit_player *packet)
Definition packets_gen.c:87797
send_packet_city_change_specialist_100
static int send_packet_city_change_specialist_100(struct connection *pc, const struct packet_city_change_specialist *packet)
Definition packets_gen.c:19909
send_packet_edit_city_remove_100
static int send_packet_edit_city_remove_100(struct connection *pc, const struct packet_edit_city_remove *packet)
Definition packets_gen.c:84255
receive_packet_ruleset_style_100
static struct packet_ruleset_style * receive_packet_ruleset_style_100(struct connection *pc)
Definition packets_gen.c:54336
destroy_packet_ruleset_specialist
static void destroy_packet_ruleset_specialist(void *packet)
Definition packets_gen.c:46931
destroy_packet_vote_update
#define destroy_packet_vote_update
Definition packets_gen.c:79725
init_packet_unit_get_actions
static void init_packet_unit_get_actions(struct packet_unit_get_actions *packet)
Definition packets_gen.c:33386
init_packet_player_ready
static void init_packet_player_ready(struct packet_player_ready *packet)
Definition packets_gen.c:2752
init_packet_city_change_specialist
static void init_packet_city_change_specialist(struct packet_city_change_specialist *packet)
Definition packets_gen.c:19772
destroy_packet_nation_select_req
#define destroy_packet_nation_select_req
Definition packets_gen.c:2420
destroy_packet_edit_city_remove
#define destroy_packet_edit_city_remove
Definition packets_gen.c:84174
send_packet_edit_city_100
static int send_packet_edit_city_100(struct connection *pc, const struct packet_edit_city *packet)
Definition packets_gen.c:85100
lsend_packet_ruleset_base
void lsend_packet_ruleset_base(struct conn_list *dest, const struct packet_ruleset_base *packet)
Definition packets_gen.c:63596
dsend_packet_game_load
int dsend_packet_game_load(struct connection *pc, bool load_successful, const char *load_filename)
Definition packets_gen.c:74114
destroy_packet_ruleset_extra_flag
#define destroy_packet_ruleset_extra_flag
Definition packets_gen.c:62956
dsend_packet_unit_actions
int dsend_packet_unit_actions(struct connection *pc, int actor_unit_id, int target_unit_id, int target_city_id, int target_tile_id, int target_extra_id, int request_kind, const struct act_prob *action_probabilities)
Definition packets_gen.c:34239
send_packet_diplomacy_create_clause_100
static int send_packet_diplomacy_create_clause_100(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
Definition packets_gen.c:35858
send_packet_ruleset_impr_flag_100
static int send_packet_ruleset_impr_flag_100(struct connection *pc, const struct packet_ruleset_impr_flag *packet)
Definition packets_gen.c:56672
send_packet_unit_short_info
int send_packet_unit_short_info(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
Definition packets_gen.c:30809
receive_packet_end_turn_100
static struct packet_end_turn * receive_packet_end_turn_100(struct connection *pc)
Definition packets_gen.c:40007
init_packet_spaceship_info
static void init_packet_spaceship_info(struct packet_spaceship_info *packet)
Definition packets_gen.c:40417
send_packet_ruleset_terrain_flag
int send_packet_ruleset_terrain_flag(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
Definition packets_gen.c:59676
lsend_packet_unit_info
void lsend_packet_unit_info(struct conn_list *dest, const struct packet_unit_info *packet)
Definition packets_gen.c:30104
free_packet_ruleset_terrain
static void free_packet_ruleset_terrain(struct packet_ruleset_terrain *packet)
Definition packets_gen.c:56861
dsend_packet_player_change_government
int dsend_packet_player_change_government(struct connection *pc, Government_type_id government)
Definition packets_gen.c:25646
destroy_packet_player_tech_goal
#define destroy_packet_player_tech_goal
Definition packets_gen.c:27892
lsend_packet_ruleset_resource
void lsend_packet_ruleset_resource(struct conn_list *dest, const struct packet_ruleset_resource *packet)
Definition packets_gen.c:78518
destroy_packet_unit_actions
#define destroy_packet_unit_actions
Definition packets_gen.c:33739
send_packet_vote_update_100
static int send_packet_vote_update_100(struct connection *pc, const struct packet_vote_update *packet)
Definition packets_gen.c:79881
dlsend_packet_diplomacy_create_clause
void dlsend_packet_diplomacy_create_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:36040
receive_packet_vote_remove_100
static struct packet_vote_remove * receive_packet_vote_remove_100(struct connection *pc)
Definition packets_gen.c:80087
send_packet_city_update_counters
int send_packet_city_update_counters(struct connection *pc, const struct packet_city_update_counters *packet)
Definition packets_gen.c:17310
lsend_packet_ruleset_specialist
void lsend_packet_ruleset_specialist(struct conn_list *dest, const struct packet_ruleset_specialist *packet)
Definition packets_gen.c:47723
send_packet_conn_info
int send_packet_conn_info(struct connection *pc, const struct packet_conn_info *packet)
Definition packets_gen.c:38571
lsend_packet_play_music
void lsend_packet_play_music(struct conn_list *dest, const struct packet_play_music *packet)
Definition packets_gen.c:89044
send_packet_player_tech_goal_100
static int send_packet_player_tech_goal_100(struct connection *pc, const struct packet_player_tech_goal *packet)
Definition packets_gen.c:27973
receive_packet_diplomacy_init_meeting_req_100
static struct packet_diplomacy_init_meeting_req * receive_packet_diplomacy_init_meeting_req_100(struct connection *pc)
Definition packets_gen.c:34553
send_packet_city_change_100
static int send_packet_city_change_100(struct connection *pc, const struct packet_city_change *packet)
Definition packets_gen.c:18941
send_packet_game_info
int send_packet_game_info(struct connection *pc, const struct packet_game_info *packet)
Definition packets_gen.c:9786
send_packet_ruleset_goods_100
static int send_packet_ruleset_goods_100(struct connection *pc, const struct packet_ruleset_goods *packet)
Definition packets_gen.c:65037
init_packet_ruleset_clause
static void init_packet_ruleset_clause(struct packet_ruleset_clause *packet)
Definition packets_gen.c:70614
dsend_packet_edit_player_create
int dsend_packet_edit_player_create(struct connection *pc, int tag)
Definition packets_gen.c:86345
destroy_packet_ruleset_effect
#define destroy_packet_ruleset_effect
Definition packets_gen.c:77732
lsend_packet_city_name_suggestion_info
void lsend_packet_city_name_suggestion_info(struct conn_list *dest, const struct packet_city_name_suggestion_info *packet)
Definition packets_gen.c:21104
destroy_packet_map_info
#define destroy_packet_map_info
Definition packets_gen.c:10444
send_packet_endgame_report_100
static int send_packet_endgame_report_100(struct connection *pc, const struct packet_endgame_report *packet)
Definition packets_gen.c:3027
send_packet_server_setting_bitwise_100
static int send_packet_server_setting_bitwise_100(struct connection *pc, const struct packet_server_setting_bitwise *packet)
Definition packets_gen.c:77106
send_packet_web_city_info_addition
int send_packet_web_city_info_addition(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
Definition packets_gen.c:89867
send_packet_edit_unit_remove_by_id
int send_packet_edit_unit_remove_by_id(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
Definition packets_gen.c:83095
destroy_packet_edit_unit
#define destroy_packet_edit_unit
Definition packets_gen.c:83122
send_packet_diplomacy_cancel_pact
int send_packet_diplomacy_cancel_pact(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
Definition packets_gen.c:37354
receive_packet_vote_resolve_100
static struct packet_vote_resolve * receive_packet_vote_resolve_100(struct connection *pc)
Definition packets_gen.c:80265
dlsend_packet_diplomacy_accept_treaty
void dlsend_packet_diplomacy_accept_treaty(struct conn_list *dest, int counterpart, bool I_accepted, bool other_accepted)
Definition packets_gen.c:37128
receive_packet_ruleset_resource_100
static struct packet_ruleset_resource * receive_packet_ruleset_resource_100(struct connection *pc)
Definition packets_gen.c:78223
receive_packet_research_info_100
static struct packet_research_info * receive_packet_research_info_100(struct connection *pc)
Definition packets_gen.c:27018
send_packet_report_req_100
static int send_packet_report_req_100(struct connection *pc, const struct packet_report_req *packet)
Definition packets_gen.c:38009
receive_packet_ruleset_goods_100
static struct packet_ruleset_goods * receive_packet_ruleset_goods_100(struct connection *pc)
Definition packets_gen.c:64676
send_packet_edit_recalculate_borders
int send_packet_edit_recalculate_borders(struct connection *pc)
Definition packets_gen.c:80730
send_packet_conn_info_100
static int send_packet_conn_info_100(struct connection *pc, const struct packet_conn_info *packet)
Definition packets_gen.c:38317
destroy_packet_city_sell
#define destroy_packet_city_sell
Definition packets_gen.c:18416
init_packet_ruleset_choices
static void init_packet_ruleset_choices(struct packet_ruleset_choices *packet)
Definition packets_gen.c:73414
send_packet_set_topology
int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
Definition packets_gen.c:77714
send_packet_web_city_info_addition_100
static int send_packet_web_city_info_addition_100(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
Definition packets_gen.c:89399
send_packet_spaceship_place
int send_packet_spaceship_place(struct connection *pc, const struct packet_spaceship_place *packet)
Definition packets_gen.c:40395
dlsend_packet_start_phase
void dlsend_packet_start_phase(struct conn_list *dest, int phase)
Definition packets_gen.c:39680
receive_packet_ruleset_tech_flag_100
static struct packet_ruleset_tech_flag * receive_packet_ruleset_tech_flag_100(struct connection *pc)
Definition packets_gen.c:49396
dlsend_packet_city_name_suggestion_info
void dlsend_packet_city_name_suggestion_info(struct conn_list *dest, int unit_id, const char *name)
Definition packets_gen.c:21121
lsend_packet_ruleset_tech
void lsend_packet_ruleset_tech(struct conn_list *dest, const struct packet_ruleset_tech *packet)
Definition packets_gen.c:49071
send_packet_authentication_req
int send_packet_authentication_req(struct connection *pc, const struct packet_authentication_req *packet)
Definition packets_gen.c:2167
lsend_packet_ruleset_trade
void lsend_packet_ruleset_trade(struct conn_list *dest, const struct packet_ruleset_trade *packet)
Definition packets_gen.c:66699
destroy_packet_game_info
#define destroy_packet_game_info
Definition packets_gen.c:4061
receive_packet_edit_recalculate_borders_100
static struct packet_edit_recalculate_borders * receive_packet_edit_recalculate_borders_100(struct connection *pc)
Definition packets_gen.c:80710
destroy_packet_set_topology
#define destroy_packet_set_topology
Definition packets_gen.c:77515
destroy_packet_report_req
#define destroy_packet_report_req
Definition packets_gen.c:37918
init_packet_server_setting_enum
static void init_packet_server_setting_enum(struct packet_server_setting_enum *packet)
Definition packets_gen.c:76081
send_packet_map_info
int send_packet_map_info(struct connection *pc, const struct packet_map_info *packet)
Definition packets_gen.c:10819
send_packet_freeze_client
int send_packet_freeze_client(struct connection *pc)
Definition packets_gen.c:40074
receive_packet_ruleset_impr_flag_100
static struct packet_ruleset_impr_flag * receive_packet_ruleset_impr_flag_100(struct connection *pc)
Definition packets_gen.c:56571
send_packet_player_attribute_chunk
int send_packet_player_attribute_chunk(struct connection *pc, const struct packet_player_attribute_chunk *packet)
Definition packets_gen.c:26226
send_packet_tile_info
int send_packet_tile_info(struct connection *pc, const struct packet_tile_info *packet)
Definition packets_gen.c:4036
send_packet_edit_unit
int send_packet_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
Definition packets_gen.c:83849
destroy_packet_web_cma_clear
#define destroy_packet_web_cma_clear
Definition packets_gen.c:90117
receive_packet_scenario_description_100
static struct packet_scenario_description * receive_packet_scenario_description_100(struct connection *pc)
Definition packets_gen.c:79036
send_packet_single_want_hack_req_100
static int send_packet_single_want_hack_req_100(struct connection *pc, const struct packet_single_want_hack_req *packet)
Definition packets_gen.c:73156
send_packet_start_phase_100
static int send_packet_start_phase_100(struct connection *pc, const struct packet_start_phase *packet)
Definition packets_gen.c:39573
dsend_packet_player_research
int dsend_packet_player_research(struct connection *pc, int tech)
Definition packets_gen.c:27877
init_packet_edit_player
static void init_packet_edit_player(struct packet_edit_player *packet)
Definition packets_gen.c:86541
receive_packet_ruleset_unit_class_flag_100
static struct packet_ruleset_unit_class_flag * receive_packet_ruleset_unit_class_flag_100(struct connection *pc)
Definition packets_gen.c:45251
receive_packet_city_options_req_100
static struct packet_city_options_req * receive_packet_city_options_req_100(struct connection *pc)
Definition packets_gen.c:20302
receive_packet_client_heartbeat_100
static struct packet_client_heartbeat * receive_packet_client_heartbeat_100(struct connection *pc)
Definition packets_gen.c:39141
init_packet_edit_toggle_fogofwar
static void init_packet_edit_toggle_fogofwar(struct packet_edit_toggle_fogofwar *packet)
Definition packets_gen.c:80782
receive_packet_begin_turn_100
static struct packet_begin_turn * receive_packet_begin_turn_100(struct connection *pc)
Definition packets_gen.c:39960
send_packet_investigate_finished_100
static int send_packet_investigate_finished_100(struct connection *pc, const struct packet_investigate_finished *packet)
Definition packets_gen.c:1520
init_packet_ruleset_goods
static void init_packet_ruleset_goods(struct packet_ruleset_goods *packet)
Definition packets_gen.c:64629
receive_packet_processing_started_100
static struct packet_processing_started * receive_packet_processing_started_100(struct connection *pc)
Definition packets_gen.c:1102
dsend_packet_unit_action_query
int dsend_packet_unit_action_query(struct connection *pc, int actor_id, int target_id, action_id action_type, int request_kind)
Definition packets_gen.c:32463
free_packet_ruleset_goods
static void free_packet_ruleset_goods(struct packet_ruleset_goods *packet)
Definition packets_gen.c:64645
dsend_packet_city_remove
int dsend_packet_city_remove(struct connection *pc, int city_id)
Definition packets_gen.c:13234
receive_packet_investigate_finished_100
static struct packet_investigate_finished * receive_packet_investigate_finished_100(struct connection *pc)
Definition packets_gen.c:1434
destroy_packet_diplomacy_cancel_meeting
#define destroy_packet_diplomacy_cancel_meeting
Definition packets_gen.c:35161
send_packet_nuke_tile_info
int send_packet_nuke_tile_info(struct connection *pc, const struct packet_nuke_tile_info *packet)
Definition packets_gen.c:11004
destroy_packet_diplomacy_create_clause_req
#define destroy_packet_diplomacy_create_clause_req
Definition packets_gen.c:35405
send_packet_ruleset_unit_class_flag
int send_packet_ruleset_unit_class_flag(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
Definition packets_gen.c:45479
receive_packet_edit_check_tiles_100
static struct packet_edit_check_tiles * receive_packet_edit_check_tiles_100(struct connection *pc)
Definition packets_gen.c:80750
dsend_packet_city_rename
int dsend_packet_city_rename(struct connection *pc, int city_id, const char *name)
Definition packets_gen.c:20276
send_packet_ruleset_specialist_100
static int send_packet_ruleset_specialist_100(struct connection *pc, const struct packet_ruleset_specialist *packet)
Definition packets_gen.c:47298
send_packet_set_topology_100
static int send_packet_set_topology_100(struct connection *pc, const struct packet_set_topology *packet)
Definition packets_gen.c:77611
send_packet_ruleset_extra_flag_100
static int send_packet_ruleset_extra_flag_100(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
Definition packets_gen.c:63067
send_packet_ruleset_disaster_100
static int send_packet_ruleset_disaster_100(struct connection *pc, const struct packet_ruleset_disaster *packet)
Definition packets_gen.c:65715
receive_packet_diplomacy_cancel_meeting_req_100
static struct packet_diplomacy_cancel_meeting_req * receive_packet_diplomacy_cancel_meeting_req_100(struct connection *pc)
Definition packets_gen.c:34984
init_packet_investigate_finished
static void init_packet_investigate_finished(struct packet_investigate_finished *packet)
Definition packets_gen.c:1418
destroy_packet_page_msg
#define destroy_packet_page_msg
Definition packets_gen.c:37382
init_packet_unit_change_activity
static void init_packet_unit_change_activity(struct packet_unit_change_activity *packet)
Definition packets_gen.c:34260
receive_packet_ruleset_disaster_100
static struct packet_ruleset_disaster * receive_packet_ruleset_disaster_100(struct connection *pc)
Definition packets_gen.c:65510
send_packet_ruleset_terrain_control
int send_packet_ruleset_terrain_control(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
Definition packets_gen.c:50985
receive_packet_diplomacy_remove_clause_100
static struct packet_diplomacy_remove_clause * receive_packet_diplomacy_remove_clause_100(struct connection *pc)
Definition packets_gen.c:36385
lsend_packet_ruleset_action_enabler
void lsend_packet_ruleset_action_enabler(struct conn_list *dest, const struct packet_ruleset_action_enabler *packet)
Definition packets_gen.c:67876
destroy_packet_unit_short_info
#define destroy_packet_unit_short_info
Definition packets_gen.c:30117
receive_packet_ruleset_nation_100
static struct packet_ruleset_nation * receive_packet_ruleset_nation_100(struct connection *pc)
Definition packets_gen.c:52149
send_packet_city_buy
int send_packet_city_buy(struct connection *pc, const struct packet_city_buy *packet)
Definition packets_gen.c:18803
init_packet_nuke_tile_info
static void init_packet_nuke_tile_info(struct packet_nuke_tile_info *packet)
Definition packets_gen.c:10838
destroy_packet_ruleset_counter
static void destroy_packet_ruleset_counter(void *packet)
Definition packets_gen.c:68510
dlsend_packet_game_load
void dlsend_packet_game_load(struct conn_list *dest, bool load_successful, const char *load_filename)
Definition packets_gen.c:74124
destroy_packet_player_ready
#define destroy_packet_player_ready
Definition packets_gen.c:2758
destroy_packet_rulesets_ready
#define destroy_packet_rulesets_ready
Definition packets_gen.c:51010
dsend_packet_edit_object_created
int dsend_packet_edit_object_created(struct connection *pc, int tag, int id)
Definition packets_gen.c:88856
init_packet_ruleset_resource
static void init_packet_ruleset_resource(struct packet_ruleset_resource *packet)
Definition packets_gen.c:78207
send_packet_ruleset_unit_flag_100
static int send_packet_ruleset_unit_flag_100(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
Definition packets_gen.c:45089
destroy_packet_unit_server_side_agent_set
#define destroy_packet_unit_server_side_agent_set
Definition packets_gen.c:31927
receive_packet_city_sell_100
static struct packet_city_sell * receive_packet_city_sell_100(struct connection *pc)
Definition packets_gen.c:18426
dlsend_packet_investigate_started
void dlsend_packet_investigate_started(struct conn_list *dest, int unit_id, int city_id)
Definition packets_gen.c:1408
send_packet_edit_scenario_desc
int send_packet_edit_scenario_desc(struct connection *pc, const struct packet_edit_scenario_desc *packet)
Definition packets_gen.c:88627
init_packet_city_update_counters
static void init_packet_city_update_counters(struct packet_city_update_counters *packet)
Definition packets_gen.c:16950
destroy_packet_web_ruleset_unit_addition
#define destroy_packet_web_ruleset_unit_addition
Definition packets_gen.c:90527
packet_name
const char * packet_name(enum packet_type type)
Definition packets_gen.c:48
send_packet_ruleset_multiplier_100
static int send_packet_ruleset_multiplier_100(struct connection *pc, const struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:70028
init_packet_city_buy
static void init_packet_city_buy(struct packet_city_buy *packet)
Definition packets_gen.c:18637
receive_packet_scenario_info_100
static struct packet_scenario_info * receive_packet_scenario_info_100(struct connection *pc)
Definition packets_gen.c:78541
send_packet_ruleset_extra_100
static int send_packet_ruleset_extra_100(struct connection *pc, const struct packet_ruleset_extra *packet)
Definition packets_gen.c:61554
send_packet_diplomacy_create_clause
int send_packet_diplomacy_create_clause(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
Definition packets_gen.c:36009
init_packet_conn_info
static void init_packet_conn_info(struct packet_conn_info *packet)
Definition packets_gen.c:38109
receive_packet_ruleset_select_100
static struct packet_ruleset_select * receive_packet_ruleset_select_100(struct connection *pc)
Definition packets_gen.c:73747
send_packet_ruleset_trade
int send_packet_ruleset_trade(struct connection *pc, const struct packet_ruleset_trade *packet)
Definition packets_gen.c:66687
send_packet_player_change_government_100
static int send_packet_player_change_government_100(struct connection *pc, const struct packet_player_change_government *packet)
Definition packets_gen.c:25555
send_packet_player_ready
int send_packet_player_ready(struct connection *pc, const struct packet_player_ready *packet)
Definition packets_gen.c:2938
destroy_packet_city_remove
#define destroy_packet_city_remove
Definition packets_gen.c:13005
destroy_packet_processing_finished
#define destroy_packet_processing_finished
Definition packets_gen.c:1140
receive_packet_edit_unit_100
static struct packet_edit_unit * receive_packet_edit_unit_100(struct connection *pc)
Definition packets_gen.c:83149
init_packet_player_attribute_chunk
static void init_packet_player_attribute_chunk(struct packet_player_attribute_chunk *packet)
Definition packets_gen.c:25922
receive_packet_diplomacy_accept_treaty_req_100
static struct packet_diplomacy_accept_treaty_req * receive_packet_diplomacy_accept_treaty_req_100(struct connection *pc)
Definition packets_gen.c:36721
init_packet_ruleset_nation
static void init_packet_ruleset_nation(struct packet_ruleset_nation *packet)
Definition packets_gen.c:52116
init_packet_connect_msg
static void init_packet_connect_msg(struct packet_connect_msg *packet)
Definition packets_gen.c:12465
destroy_packet_unknown_research
#define destroy_packet_unknown_research
Definition packets_gen.c:27510
receive_packet_server_setting_control_100
static struct packet_server_setting_control * receive_packet_server_setting_control_100(struct connection *pc)
Definition packets_gen.c:74150
destroy_packet_server_setting_bool
#define destroy_packet_server_setting_bool
Definition packets_gen.c:74857
receive_packet_player_remove_100
static struct packet_player_remove * receive_packet_player_remove_100(struct connection *pc)
Definition packets_gen.c:22269
receive_packet_vote_submit_100
static struct packet_vote_submit * receive_packet_vote_submit_100(struct connection *pc)
Definition packets_gen.c:80455
init_packet_ruleset_music
static void init_packet_ruleset_music(struct packet_ruleset_music *packet)
Definition packets_gen.c:69109
send_packet_diplomacy_cancel_pact_100
static int send_packet_diplomacy_cancel_pact_100(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
Definition packets_gen.c:37251
lsend_packet_nuke_tile_info
void lsend_packet_nuke_tile_info(struct conn_list *dest, const struct packet_nuke_tile_info *packet)
Definition packets_gen.c:11016
lsend_packet_freeze_client
void lsend_packet_freeze_client(struct conn_list *dest)
Definition packets_gen.c:40086
dlsend_packet_diplomacy_cancel_meeting
void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:35389
send_packet_ruleset_unit_bonus_100
static int send_packet_ruleset_unit_bonus_100(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
Definition packets_gen.c:44789
destroy_packet_city_info
#define destroy_packet_city_info
Definition packets_gen.c:13258
lsend_packet_nation_availability
void lsend_packet_nation_availability(struct conn_list *dest, const struct packet_nation_availability *packet)
Definition packets_gen.c:54313
init_packet_endgame_player
static void init_packet_endgame_player(struct packet_endgame_player *packet)
Definition packets_gen.c:3114
free_packet_ruleset_government
static void free_packet_ruleset_government(struct packet_ruleset_government *packet)
Definition packets_gen.c:49657
dsend_packet_edit_unit_remove
int dsend_packet_edit_unit_remove(struct connection *pc, int owner, int tile, Unit_type_id type, int count)
Definition packets_gen.c:82917
destroy_packet_city_change
#define destroy_packet_city_change
Definition packets_gen.c:18830
send_packet_edit_unit_100
static int send_packet_edit_unit_100(struct connection *pc, const struct packet_edit_unit *packet)
Definition packets_gen.c:83448
send_packet_city_change_specialist
int send_packet_city_change_specialist(struct connection *pc, const struct packet_city_change_specialist *packet)
Definition packets_gen.c:20036
send_packet_web_cma_set_100
static int send_packet_web_cma_set_100(struct connection *pc, const struct packet_web_cma_set *packet)
Definition packets_gen.c:90003
destroy_packet_edit_tile_terrain
#define destroy_packet_edit_tile_terrain
Definition packets_gen.c:80975
receive_packet_ruleset_terrain_flag_100
static struct packet_ruleset_terrain_flag * receive_packet_ruleset_terrain_flag_100(struct connection *pc)
Definition packets_gen.c:59448
lsend_packet_web_city_info_addition
void lsend_packet_web_city_info_addition(struct conn_list *dest, const struct packet_web_city_info_addition *packet, bool force_to_send)
Definition packets_gen.c:89879
init_packet_city_rally_point
static void init_packet_city_rally_point(struct packet_city_rally_point *packet)
Definition packets_gen.c:21482
send_packet_edit_object_created_100
static int send_packet_edit_object_created_100(struct connection *pc, const struct packet_edit_object_created *packet)
Definition packets_gen.c:88741
send_packet_calendar_info
int send_packet_calendar_info(struct connection *pc, const struct packet_calendar_info *packet)
Definition packets_gen.c:10209
init_packet_web_cma_clear
static void init_packet_web_cma_clear(struct packet_web_cma_clear *packet)
Definition packets_gen.c:90111
init_packet_diplomacy_create_clause_req
static void init_packet_diplomacy_create_clause_req(struct packet_diplomacy_create_clause_req *packet)
Definition packets_gen.c:35399
dsend_packet_investigate_started
int dsend_packet_investigate_started(struct connection *pc, int unit_id, int city_id)
Definition packets_gen.c:1398
dsend_packet_edit_unit_remove_by_id
int dsend_packet_edit_unit_remove_by_id(struct connection *pc, int id)
Definition packets_gen.c:83107
receive_packet_unknown_research_100
static struct packet_unknown_research * receive_packet_unknown_research_100(struct connection *pc)
Definition packets_gen.c:27520
receive_packet_player_place_infra_100
static struct packet_player_place_infra * receive_packet_player_place_infra_100(struct connection *pc)
Definition packets_gen.c:25671
send_packet_player_remove_100
static int send_packet_player_remove_100(struct connection *pc, const struct packet_player_remove *packet)
Definition packets_gen.c:22345
init_packet_server_setting_control
static void init_packet_server_setting_control(struct packet_server_setting_control *packet)
Definition packets_gen.c:74134
receive_packet_authentication_req_100
static struct packet_authentication_req * receive_packet_authentication_req_100(struct connection *pc)
Definition packets_gen.c:1968
dsend_packet_diplomacy_remove_clause_req
int dsend_packet_diplomacy_remove_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
Definition packets_gen.c:36357
receive_packet_edit_scenario_desc_100
static struct packet_edit_scenario_desc * receive_packet_edit_scenario_desc_100(struct connection *pc)
Definition packets_gen.c:88477
receive_packet_city_make_specialist_100
static struct packet_city_make_specialist * receive_packet_city_make_specialist_100(struct connection *pc)
Definition packets_gen.c:19334
receive_packet_edit_toggle_fogofwar_100
static struct packet_edit_toggle_fogofwar * receive_packet_edit_toggle_fogofwar_100(struct connection *pc)
Definition packets_gen.c:80798
receive_packet_player_ready_100
static struct packet_player_ready * receive_packet_player_ready_100(struct connection *pc)
Definition packets_gen.c:2768
send_packet_vote_remove
int send_packet_vote_remove(struct connection *pc, const struct packet_vote_remove *packet)
Definition packets_gen.c:80237
dsend_packet_city_buy
int dsend_packet_city_buy(struct connection *pc, int city_id)
Definition packets_gen.c:18815
send_packet_unit_get_actions
int send_packet_unit_get_actions(struct connection *pc, const struct packet_unit_get_actions *packet)
Definition packets_gen.c:33708
init_packet_edit_tile_terrain
static void init_packet_edit_tile_terrain(struct packet_edit_tile_terrain *packet)
Definition packets_gen.c:80969
send_packet_unit_change_activity
int send_packet_unit_change_activity(struct connection *pc, const struct packet_unit_change_activity *packet)
Definition packets_gen.c:34514
destroy_packet_city_nationalities
#define destroy_packet_city_nationalities
Definition packets_gen.c:16437
destroy_packet_web_city_info_addition
#define destroy_packet_web_city_info_addition
Definition packets_gen.c:89057
init_packet_city_sell
static void init_packet_city_sell(struct packet_city_sell *packet)
Definition packets_gen.c:18410
receive_packet_city_refresh_100
static struct packet_city_refresh * receive_packet_city_refresh_100(struct connection *pc)
Definition packets_gen.c:20529
dsend_packet_start_phase
int dsend_packet_start_phase(struct connection *pc, int phase)
Definition packets_gen.c:39671
send_packet_unit_server_side_agent_set_100
static int send_packet_unit_server_side_agent_set_100(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
Definition packets_gen.c:32033
receive_packet_game_load_100
static struct packet_game_load * receive_packet_game_load_100(struct connection *pc)
Definition packets_gen.c:73925
send_packet_edit_mode_100
static int send_packet_edit_mode_100(struct connection *pc, const struct packet_edit_mode *packet)
Definition packets_gen.c:80614
destroy_packet_investigate_finished
#define destroy_packet_investigate_finished
Definition packets_gen.c:1424
send_packet_server_setting_const_100
static int send_packet_server_setting_const_100(struct connection *pc, const struct packet_server_setting_const *packet)
Definition packets_gen.c:74661
lsend_packet_ruleset_style
void lsend_packet_ruleset_style(struct conn_list *dest, const struct packet_ruleset_style *packet)
Definition packets_gen.c:54576
send_packet_chat_msg_req
int send_packet_chat_msg_req(struct connection *pc, const struct packet_chat_msg_req *packet)
Definition packets_gen.c:12444
lsend_packet_conn_ping_info
void lsend_packet_conn_ping_info(struct conn_list *dest, const struct packet_conn_ping_info *packet)
Definition packets_gen.c:39046
send_packet_server_info_100
static int send_packet_server_info_100(struct connection *pc, const struct packet_server_info *packet)
Definition packets_gen.c:12799
send_packet_ruleset_building_100
static int send_packet_ruleset_building_100(struct connection *pc, const struct packet_ruleset_building *packet)
Definition packets_gen.c:55811
init_packet_ruleset_counter
static void init_packet_ruleset_counter(struct packet_ruleset_counter *packet)
Definition packets_gen.c:68483
lsend_packet_end_phase
void lsend_packet_end_phase(struct conn_list *dest)
Definition packets_gen.c:39479
dsend_packet_edit_unit_create
int dsend_packet_edit_unit_create(struct connection *pc, int owner, int tile, Unit_type_id type, int count, int tag)
Definition packets_gen.c:82599
dsend_packet_edit_player_remove
int dsend_packet_edit_player_remove(struct connection *pc, int id)
Definition packets_gen.c:86532
dsend_packet_unit_type_upgrade
int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
Definition packets_gen.c:32663
send_packet_ruleset_action
int send_packet_ruleset_action(struct connection *pc, const struct packet_ruleset_action *packet)
Definition packets_gen.c:67313
lsend_packet_unit_combat_info
void lsend_packet_unit_combat_info(struct conn_list *dest, const struct packet_unit_combat_info *packet)
Definition packets_gen.c:31163
send_packet_unit_get_actions_100
static int send_packet_unit_get_actions_100(struct connection *pc, const struct packet_unit_get_actions *packet)
Definition packets_gen.c:33533
init_packet_game_load
static void init_packet_game_load(struct packet_game_load *packet)
Definition packets_gen.c:73909
init_packet_vote_resolve
static void init_packet_vote_resolve(struct packet_vote_resolve *packet)
Definition packets_gen.c:80249
destroy_packet_spaceship_info
#define destroy_packet_spaceship_info
Definition packets_gen.c:40423
receive_packet_player_diplstate_100
static struct packet_player_diplstate * receive_packet_player_diplstate_100(struct connection *pc)
Definition packets_gen.c:26271
receive_packet_edit_city_100
static struct packet_edit_city * receive_packet_edit_city_100(struct connection *pc)
Definition packets_gen.c:84388
receive_packet_conn_pong_100
static struct packet_conn_pong * receive_packet_conn_pong_100(struct connection *pc)
Definition packets_gen.c:39101
init_packet_page_msg_part
static void init_packet_page_msg_part(struct packet_page_msg_part *packet)
Definition packets_gen.c:37727
init_packet_chat_msg
static void init_packet_chat_msg(struct packet_chat_msg *packet)
Definition packets_gen.c:11498
init_packet_edit_unit_remove
static void init_packet_edit_unit_remove(struct packet_edit_unit_remove *packet)
Definition packets_gen.c:82612
receive_packet_ruleset_tech_class_100
static struct packet_ruleset_tech_class * receive_packet_ruleset_tech_class_100(struct connection *pc)
Definition packets_gen.c:49094
init_packet_thaw_client
static void init_packet_thaw_client(struct packet_thaw_client *packet)
Definition packets_gen.c:40093
send_packet_edit_city_remove
int send_packet_edit_city_remove(struct connection *pc, const struct packet_edit_city_remove *packet)
Definition packets_gen.c:84334
receive_packet_diplomacy_init_meeting_100
static struct packet_diplomacy_init_meeting * receive_packet_diplomacy_init_meeting_100(struct connection *pc)
Definition packets_gen.c:34740
destroy_packet_diplomacy_create_clause
#define destroy_packet_diplomacy_create_clause
Definition packets_gen.c:35722
send_packet_ruleset_effect
int send_packet_ruleset_effect(struct connection *pc, const struct packet_ruleset_effect *packet)
Definition packets_gen.c:78188
destroy_packet_city_make_worker
#define destroy_packet_city_make_worker
Definition packets_gen.c:19551
send_packet_ruleset_action_100
static int send_packet_ruleset_action_100(struct connection *pc, const struct packet_ruleset_action *packet)
Definition packets_gen.c:66992
send_packet_server_setting_str_100
static int send_packet_server_setting_str_100(struct connection *pc, const struct packet_server_setting_str *packet)
Definition packets_gen.c:75865
receive_packet_ruleset_action_100
static struct packet_ruleset_action * receive_packet_ruleset_action_100(struct connection *pc)
Definition packets_gen.c:66722
destroy_packet_city_sabotage_list
#define destroy_packet_city_sabotage_list
Definition packets_gen.c:21137
init_packet_unknown_research
static void init_packet_unknown_research(struct packet_unknown_research *packet)
Definition packets_gen.c:27504
send_packet_edit_mode
int send_packet_edit_mode(struct connection *pc, const struct packet_edit_mode *packet)
Definition packets_gen.c:80681
destroy_packet_ruleset_extra
static void destroy_packet_ruleset_extra(void *packet)
Definition packets_gen.c:60441
send_packet_ruleset_summary_100
static int send_packet_ruleset_summary_100(struct connection *pc, const struct packet_ruleset_summary *packet)
Definition packets_gen.c:72786
init_packet_city_short_info
static void init_packet_city_short_info(struct packet_city_short_info *packet)
Definition packets_gen.c:17329
dsend_packet_player_place_infra
int dsend_packet_player_place_infra(struct connection *pc, int tile, int extra)
Definition packets_gen.c:25872
send_packet_ruleset_style
int send_packet_ruleset_style(struct connection *pc, const struct packet_ruleset_style *packet)
Definition packets_gen.c:54564
receive_packet_ruleset_road_100
static struct packet_ruleset_road * receive_packet_ruleset_road_100(struct connection *pc)
Definition packets_gen.c:63619
send_packet_ruleset_disaster
int send_packet_ruleset_disaster(struct connection *pc, const struct packet_ruleset_disaster *packet)
Definition packets_gen.c:65994
destroy_packet_freeze_client
#define destroy_packet_freeze_client
Definition packets_gen.c:40052
send_packet_unit_actions_100
static int send_packet_unit_actions_100(struct connection *pc, const struct packet_unit_actions *packet)
Definition packets_gen.c:33948
init_packet_city_info
static void init_packet_city_info(struct packet_city_info *packet)
Definition packets_gen.c:13252
packet_destroy
void packet_destroy(void *packet, enum packet_type type)
Definition packets_gen.c:91173
lsend_packet_server_shutdown
void lsend_packet_server_shutdown(struct conn_list *dest)
Definition packets_gen.c:2407
send_packet_edit_scenario_desc_100
static int send_packet_edit_scenario_desc_100(struct connection *pc, const struct packet_edit_scenario_desc *packet)
Definition packets_gen.c:88548
dsend_packet_diplomacy_accept_treaty
int dsend_packet_diplomacy_accept_treaty(struct connection *pc, int counterpart, bool I_accepted, bool other_accepted)
Definition packets_gen.c:37117
receive_packet_player_info_100
static struct packet_player_info * receive_packet_player_info_100(struct connection *pc)
Definition packets_gen.c:22483
init_packet_edit_city_remove
static void init_packet_edit_city_remove(struct packet_edit_city_remove *packet)
Definition packets_gen.c:84168
send_packet_ruleset_unit
int send_packet_ruleset_unit(struct connection *pc, const struct packet_ruleset_unit *packet)
Definition packets_gen.c:44601
init_packet_city_change
static void init_packet_city_change(struct packet_city_change *packet)
Definition packets_gen.c:18824
init_packet_single_want_hack_req
static void init_packet_single_want_hack_req(struct packet_single_want_hack_req *packet)
Definition packets_gen.c:73069
init_packet_conn_pong
static void init_packet_conn_pong(struct packet_conn_pong *packet)
Definition packets_gen.c:39093
send_packet_ruleset_achievement_100
static int send_packet_ruleset_achievement_100(struct connection *pc, const struct packet_ruleset_achievement *packet)
Definition packets_gen.c:66177
destroy_packet_server_info
#define destroy_packet_server_info
Definition packets_gen.c:12658
receive_packet_early_chat_msg_100
static struct packet_early_chat_msg * receive_packet_early_chat_msg_100(struct connection *pc)
Definition packets_gen.c:11904
send_packet_ruleset_terrain_flag_100
static int send_packet_ruleset_terrain_flag_100(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
Definition packets_gen.c:59549
receive_packet_edit_player_remove_100
static struct packet_edit_player_remove * receive_packet_edit_player_remove_100(struct connection *pc)
Definition packets_gen.c:86370
receive_packet_ruleset_government_ruler_title_100
static struct packet_ruleset_government_ruler_title * receive_packet_ruleset_government_ruler_title_100(struct connection *pc)
Definition packets_gen.c:47746
send_packet_vote_update
int send_packet_vote_update(struct connection *pc, const struct packet_vote_update *packet)
Definition packets_gen.c:80059
init_packet_spaceship_place
static void init_packet_spaceship_place(struct packet_spaceship_place *packet)
Definition packets_gen.c:40180
dsend_packet_save_scenario
int dsend_packet_save_scenario(struct connection *pc, const char *name)
Definition packets_gen.c:79376
receive_packet_player_phase_done_100
static struct packet_player_phase_done * receive_packet_player_phase_done_100(struct connection *pc)
Definition packets_gen.c:25020
init_packet_city_make_specialist
static void init_packet_city_make_specialist(struct packet_city_make_specialist *packet)
Definition packets_gen.c:19318
send_packet_investigate_started_100
static int send_packet_investigate_started_100(struct connection *pc, const struct packet_investigate_started *packet)
Definition packets_gen.c:1276
destroy_packet_server_shutdown
#define destroy_packet_server_shutdown
Definition packets_gen.c:2373
destroy_packet_edit_toggle_fogofwar
#define destroy_packet_edit_toggle_fogofwar
Definition packets_gen.c:80788
destroy_packet_ruleset_achievement
#define destroy_packet_ruleset_achievement
Definition packets_gen.c:66019
dsend_packet_edit_tile_extra
int dsend_packet_edit_tile_extra(struct connection *pc, int tile, int extra_type_id, bool removal, int eowner, int size)
Definition packets_gen.c:81577
send_packet_ruleset_nation_groups
int send_packet_ruleset_nation_groups(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
Definition packets_gen.c:52097
send_packet_server_join_reply
int send_packet_server_join_reply(struct connection *pc, const struct packet_server_join_reply *packet)
Definition packets_gen.c:1940
init_packet_ruleset_unit
static void init_packet_ruleset_unit(struct packet_ruleset_unit *packet)
Definition packets_gen.c:41296
send_packet_edit_startpos
int send_packet_edit_startpos(struct connection *pc, const struct packet_edit_startpos *packet)
Definition packets_gen.c:81680
lsend_packet_ruleset_tech_flag
void lsend_packet_ruleset_tech_flag(struct conn_list *dest, const struct packet_ruleset_tech_flag *packet)
Definition packets_gen.c:49636
destroy_packet_play_music
#define destroy_packet_play_music
Definition packets_gen.c:88872
lsend_packet_investigate_finished
void lsend_packet_investigate_finished(struct conn_list *dest, const struct packet_investigate_finished *packet)
Definition packets_gen.c:1635
dsend_packet_unit_action_answer
int dsend_packet_unit_action_answer(struct connection *pc, int actor_id, int target_id, int cost, action_id action_type, int request_kind)
Definition packets_gen.c:33373
send_packet_edit_tile_terrain
int send_packet_edit_tile_terrain(struct connection *pc, const struct packet_edit_tile_terrain *packet)
Definition packets_gen.c:81231
receive_packet_city_short_info_100
static struct packet_city_short_info * receive_packet_city_short_info_100(struct connection *pc)
Definition packets_gen.c:17362
send_packet_unit_action_query_100
static int send_packet_unit_action_query_100(struct connection *pc, const struct packet_unit_action_query *packet)
Definition packets_gen.c:32300
send_packet_edit_tile
int send_packet_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
Definition packets_gen.c:82243
receive_packet_diplomacy_remove_clause_req_100
static struct packet_diplomacy_remove_clause_req * receive_packet_diplomacy_remove_clause_req_100(struct connection *pc)
Definition packets_gen.c:36068
destroy_packet_player_remove
#define destroy_packet_player_remove
Definition packets_gen.c:22259
init_packet_edit_unit_remove_by_id
static void init_packet_edit_unit_remove_by_id(struct packet_edit_unit_remove_by_id *packet)
Definition packets_gen.c:82929
send_packet_server_setting_control_100
static int send_packet_server_setting_control_100(struct connection *pc, const struct packet_server_setting_control *packet)
Definition packets_gen.c:74295
init_packet_player_research
static void init_packet_player_research(struct packet_player_research *packet)
Definition packets_gen.c:27699
receive_packet_player_change_government_100
static struct packet_player_change_government * receive_packet_player_change_government_100(struct connection *pc)
Definition packets_gen.c:25474
send_packet_server_setting_enum
int send_packet_server_setting_enum(struct connection *pc, const struct packet_server_setting_enum *packet)
Definition packets_gen.c:76783
lsend_packet_achievement_info
void lsend_packet_achievement_info(struct conn_list *dest, const struct packet_achievement_info *packet)
Definition packets_gen.c:11491
send_packet_edit_check_tiles
int send_packet_edit_check_tiles(struct connection *pc)
Definition packets_gen.c:80770
destroy_packet_ruleset_select
#define destroy_packet_ruleset_select
Definition packets_gen.c:73737
send_packet_ruleset_control
int send_packet_ruleset_control(struct connection *pc, const struct packet_ruleset_control *packet)
Definition packets_gen.c:72680
send_packet_chat_msg_req_100
static int send_packet_chat_msg_req_100(struct connection *pc, const struct packet_chat_msg_req *packet)
Definition packets_gen.c:12365
destroy_packet_ruleset_government
static void destroy_packet_ruleset_government(void *packet)
Definition packets_gen.c:49672
init_packet_ruleset_action
static void init_packet_ruleset_action(struct packet_ruleset_action *packet)
Definition packets_gen.c:66706
init_packet_ruleset_terrain_control
static void init_packet_ruleset_terrain_control(struct packet_ruleset_terrain_control *packet)
Definition packets_gen.c:50428
lsend_packet_city_sabotage_list
void lsend_packet_city_sabotage_list(struct conn_list *dest, const struct packet_city_sabotage_list *packet)
Definition packets_gen.c:21475
receive_packet_web_city_info_addition_100
static struct packet_web_city_info_addition * receive_packet_web_city_info_addition_100(struct connection *pc)
Definition packets_gen.c:89084
destroy_packet_player_attribute_chunk
#define destroy_packet_player_attribute_chunk
Definition packets_gen.c:25928
receive_packet_player_attribute_chunk_100
static struct packet_player_attribute_chunk * receive_packet_player_attribute_chunk_100(struct connection *pc)
Definition packets_gen.c:25955
send_packet_diplomacy_remove_clause
int send_packet_diplomacy_remove_clause(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
Definition packets_gen.c:36662
send_packet_new_year_100
static int send_packet_new_year_100(struct connection *pc, const struct packet_new_year *packet)
Definition packets_gen.c:39806
send_packet_ruleset_government_ruler_title
int send_packet_ruleset_government_ruler_title(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
Definition packets_gen.c:48033
send_packet_diplomacy_cancel_meeting
int send_packet_diplomacy_cancel_meeting(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
Definition packets_gen.c:35360
send_packet_unit_combat_info_100
static int send_packet_unit_combat_info_100(struct connection *pc, const struct packet_unit_combat_info *packet)
Definition packets_gen.c:30974
receive_packet_conn_info_100
static struct packet_conn_info * receive_packet_conn_info_100(struct connection *pc)
Definition packets_gen.c:38142
send_packet_thaw_client
int send_packet_thaw_client(struct connection *pc)
Definition packets_gen.c:40121
send_packet_city_rename_100
static int send_packet_city_rename_100(struct connection *pc, const struct packet_city_rename *packet)
Definition packets_gen.c:20161
destroy_packet_ruleset_music
#define destroy_packet_ruleset_music
Definition packets_gen.c:69115
init_packet_ruleset_trade
static void init_packet_ruleset_trade(struct packet_ruleset_trade *packet)
Definition packets_gen.c:66384
receive_packet_ruleset_extra_100
static struct packet_ruleset_extra * receive_packet_ruleset_extra_100(struct connection *pc)
Definition packets_gen.c:60455
send_packet_edit_player_create
int send_packet_edit_player_create(struct connection *pc, const struct packet_edit_player_create *packet)
Definition packets_gen.c:86333
send_packet_unit_info
int send_packet_unit_info(struct connection *pc, const struct packet_unit_info *packet)
Definition packets_gen.c:30092
send_packet_ruleset_action_enabler
int send_packet_ruleset_action_enabler(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
Definition packets_gen.c:67864
send_packet_authentication_req_100
static int send_packet_authentication_req_100(struct connection *pc, const struct packet_authentication_req *packet)
Definition packets_gen.c:2064
destroy_packet_unit_change_activity
#define destroy_packet_unit_change_activity
Definition packets_gen.c:34266
send_packet_city_worklist_100
static int send_packet_city_worklist_100(struct connection *pc, const struct packet_city_worklist *packet)
Definition packets_gen.c:19193
init_packet_ruleset_style
static void init_packet_ruleset_style(struct packet_ruleset_style *packet)
Definition packets_gen.c:54320
init_packet_web_player_info_addition
static void init_packet_web_player_info_addition(struct packet_web_player_info_addition *packet)
Definition packets_gen.c:90289
destroy_packet_conn_ping_info
#define destroy_packet_conn_ping_info
Definition packets_gen.c:38596
init_packet_edit_player_remove
static void init_packet_edit_player_remove(struct packet_edit_player_remove *packet)
Definition packets_gen.c:86354
send_packet_rulesets_ready_100
static int send_packet_rulesets_ready_100(struct connection *pc)
Definition packets_gen.c:51024
init_packet_ruleset_government_ruler_title
static void init_packet_ruleset_government_ruler_title(struct packet_ruleset_government_ruler_title *packet)
Definition packets_gen.c:47730
init_packet_player_rates
static void init_packet_player_rates(struct packet_player_rates *packet)
Definition packets_gen.c:25191
send_packet_player_tech_goal
int send_packet_player_tech_goal(struct connection *pc, const struct packet_player_tech_goal *packet)
Definition packets_gen.c:28052
init_packet_diplomacy_create_clause
static void init_packet_diplomacy_create_clause(struct packet_diplomacy_create_clause *packet)
Definition packets_gen.c:35716
send_packet_diplomacy_init_meeting
int send_packet_diplomacy_init_meeting(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
Definition packets_gen.c:34929
receive_packet_diplomacy_accept_treaty_100
static struct packet_diplomacy_accept_treaty * receive_packet_diplomacy_accept_treaty_100(struct connection *pc)
Definition packets_gen.c:36908
destroy_packet_city_name_suggestion_req
#define destroy_packet_city_name_suggestion_req
Definition packets_gen.c:20706
init_packet_server_info
static void init_packet_server_info(struct packet_server_info *packet)
Definition packets_gen.c:12652
send_packet_unit_info_100
static int send_packet_unit_info_100(struct connection *pc, const struct packet_unit_info *packet)
Definition packets_gen.c:29036
init_packet_start_phase
static void init_packet_start_phase(struct packet_start_phase *packet)
Definition packets_gen.c:39486
send_packet_team_name_info
int send_packet_team_name_info(struct connection *pc, const struct packet_team_name_info *packet)
Definition packets_gen.c:11254
init_packet_city_make_worker
static void init_packet_city_make_worker(struct packet_city_make_worker *packet)
Definition packets_gen.c:19545
receive_packet_edit_tile_extra_100
static struct packet_edit_tile_extra * receive_packet_edit_tile_extra_100(struct connection *pc)
Definition packets_gen.c:81287
destroy_packet_team_name_info
#define destroy_packet_team_name_info
Definition packets_gen.c:11047
receive_packet_server_shutdown_100
static struct packet_server_shutdown * receive_packet_server_shutdown_100(struct connection *pc)
Definition packets_gen.c:2375
dsend_packet_single_want_hack_reply
int dsend_packet_single_want_hack_reply(struct connection *pc, bool you_have_hack)
Definition packets_gen.c:73405
send_packet_client_heartbeat_100
static int send_packet_client_heartbeat_100(struct connection *pc)
Definition packets_gen.c:39153
send_packet_server_shutdown
int send_packet_server_shutdown(struct connection *pc)
Definition packets_gen.c:2395
destroy_packet_nation_availability
#define destroy_packet_nation_availability
Definition packets_gen.c:53982
send_packet_city_options_req_100
static int send_packet_city_options_req_100(struct connection *pc, const struct packet_city_options_req *packet)
Definition packets_gen.c:20388
send_packet_research_info
int send_packet_research_info(struct connection *pc, const struct packet_research_info *packet)
Definition packets_gen.c:27485
receive_packet_server_setting_int_100
static struct packet_server_setting_int * receive_packet_server_setting_int_100(struct connection *pc)
Definition packets_gen.c:75246
init_packet_edit_unit
static void init_packet_edit_unit(struct packet_edit_unit *packet)
Definition packets_gen.c:83116
destroy_packet_unit_orders
#define destroy_packet_unit_orders
Definition packets_gen.c:31453
init_packet_web_cma_set
static void init_packet_web_cma_set(struct packet_web_cma_set *packet)
Definition packets_gen.c:89886
send_packet_player_research_100
static int send_packet_player_research_100(struct connection *pc, const struct packet_player_research *packet)
Definition packets_gen.c:27786
receive_packet_freeze_client_100
static struct packet_freeze_client * receive_packet_freeze_client_100(struct connection *pc)
Definition packets_gen.c:40054
send_packet_vote_new
int send_packet_vote_new(struct connection *pc, const struct packet_vote_new *packet)
Definition packets_gen.c:79707
destroy_packet_ruleset_building
static void destroy_packet_ruleset_building(void *packet)
Definition packets_gen.c:55192
send_packet_unit_sscs_set
int send_packet_unit_sscs_set(struct connection *pc, const struct packet_unit_sscs_set *packet)
Definition packets_gen.c:31424
lsend_packet_ruleset_tech_class
void lsend_packet_ruleset_tech_class(struct conn_list *dest, const struct packet_ruleset_tech_class *packet)
Definition packets_gen.c:49373
destroy_packet_edit_check_tiles
#define destroy_packet_edit_check_tiles
Definition packets_gen.c:80748
destroy_packet_endgame_report
#define destroy_packet_endgame_report
Definition packets_gen.c:2966
send_packet_scenario_description
int send_packet_scenario_description(struct connection *pc, const struct packet_scenario_description *packet)
Definition packets_gen.c:79186
send_packet_player_attribute_block
int send_packet_player_attribute_block(struct connection *pc)
Definition packets_gen.c:25910
send_packet_ruleset_nation_sets_100
static int send_packet_ruleset_nation_sets_100(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
Definition packets_gen.c:51315
send_packet_diplomacy_cancel_meeting_req_100
static int send_packet_diplomacy_cancel_meeting_req_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
Definition packets_gen.c:35055
send_packet_achievement_info
int send_packet_achievement_info(struct connection *pc, const struct packet_achievement_info *packet)
Definition packets_gen.c:11479
send_packet_web_player_info_addition
int send_packet_web_player_info_addition(struct connection *pc, const struct packet_web_player_info_addition *packet)
Definition packets_gen.c:90509
send_packet_web_cma_set
int send_packet_web_cma_set(struct connection *pc, const struct packet_web_cma_set *packet)
Definition packets_gen.c:90099
destroy_packet_diplomacy_init_meeting
#define destroy_packet_diplomacy_init_meeting
Definition packets_gen.c:34730
receive_packet_start_phase_100
static struct packet_start_phase * receive_packet_start_phase_100(struct connection *pc)
Definition packets_gen.c:39502
send_packet_web_player_info_addition_100
static int send_packet_web_player_info_addition_100(struct connection *pc, const struct packet_web_player_info_addition *packet)
Definition packets_gen.c:90406
receive_packet_unit_get_actions_100
static struct packet_unit_get_actions * receive_packet_unit_get_actions_100(struct connection *pc)
Definition packets_gen.c:33402
dsend_packet_report_req
int dsend_packet_report_req(struct connection *pc, enum report_type type)
Definition packets_gen.c:38100
destroy_packet_server_setting_control
#define destroy_packet_server_setting_control
Definition packets_gen.c:74140
destroy_packet_server_setting_bitwise
#define destroy_packet_server_setting_bitwise
Definition packets_gen.c:76801
receive_packet_player_research_100
static struct packet_player_research * receive_packet_player_research_100(struct connection *pc)
Definition packets_gen.c:27715
lsend_packet_ruleset_goods
void lsend_packet_ruleset_goods(struct conn_list *dest, const struct packet_ruleset_goods *packet)
Definition packets_gen.c:65487
send_packet_spaceship_launch
int send_packet_spaceship_launch(struct connection *pc)
Definition packets_gen.c:40168
send_packet_team_name_info_100
static int send_packet_team_name_info_100(struct connection *pc, const struct packet_team_name_info *packet)
Definition packets_gen.c:11158
lsend_packet_end_turn
void lsend_packet_end_turn(struct conn_list *dest)
Definition packets_gen.c:40039
send_packet_web_ruleset_unit_addition_100
static int send_packet_web_ruleset_unit_addition_100(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
Definition packets_gen.c:90648
lsend_packet_diplomacy_remove_clause
void lsend_packet_diplomacy_remove_clause(struct conn_list *dest, const struct packet_diplomacy_remove_clause *packet)
Definition packets_gen.c:36674
receive_packet_ruleset_terrain_control_100
static struct packet_ruleset_terrain_control * receive_packet_ruleset_terrain_control_100(struct connection *pc)
Definition packets_gen.c:50444
send_packet_spaceship_info
int send_packet_spaceship_info(struct connection *pc, const struct packet_spaceship_info *packet)
Definition packets_gen.c:41277
send_packet_nation_availability_100
static int send_packet_nation_availability_100(struct connection *pc, const struct packet_nation_availability *packet)
Definition packets_gen.c:54129
receive_packet_edit_startpos_100
static struct packet_edit_startpos * receive_packet_edit_startpos_100(struct connection *pc)
Definition packets_gen.c:81598
destroy_packet_city_options_req
#define destroy_packet_city_options_req
Definition packets_gen.c:20292
destroy_packet_diplomacy_accept_treaty
#define destroy_packet_diplomacy_accept_treaty
Definition packets_gen.c:36898
init_packet_ruleset_extra_flag
static void init_packet_ruleset_extra_flag(struct packet_ruleset_extra_flag *packet)
Definition packets_gen.c:62950
receive_packet_ruleset_specialist_100
static struct packet_ruleset_specialist * receive_packet_ruleset_specialist_100(struct connection *pc)
Definition packets_gen.c:46945
send_packet_page_msg_part
int send_packet_page_msg_part(struct connection *pc, const struct packet_page_msg_part *packet)
Definition packets_gen.c:37893
init_packet_city_refresh
static void init_packet_city_refresh(struct packet_city_refresh *packet)
Definition packets_gen.c:20513
lsend_packet_ruleset_game
void lsend_packet_ruleset_game(struct conn_list *dest, const struct packet_ruleset_game *packet)
Definition packets_gen.c:46893
send_packet_ruleset_building
int send_packet_ruleset_building(struct connection *pc, const struct packet_ruleset_building *packet)
Definition packets_gen.c:56536
send_packet_city_info_100
static int send_packet_city_info_100(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
Definition packets_gen.c:14503
send_packet_page_msg_100
static int send_packet_page_msg_100(struct connection *pc, const struct packet_page_msg *packet)
Definition packets_gen.c:37533
init_packet_scenario_description
static void init_packet_scenario_description(struct packet_scenario_description *packet)
Definition packets_gen.c:79020
lsend_packet_page_msg_part
void lsend_packet_page_msg_part(struct conn_list *dest, const struct packet_page_msg_part *packet)
Definition packets_gen.c:37905
destroy_packet_ruleset_nation_sets
#define destroy_packet_ruleset_nation_sets
Definition packets_gen.c:51057
lsend_packet_ruleset_nation
void lsend_packet_ruleset_nation(struct conn_list *dest, const struct packet_ruleset_nation *packet)
Definition packets_gen.c:53969
send_packet_diplomacy_init_meeting_req
int send_packet_diplomacy_init_meeting_req(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
Definition packets_gen.c:34703
init_packet_city_name_suggestion_req
static void init_packet_city_name_suggestion_req(struct packet_city_name_suggestion_req *packet)
Definition packets_gen.c:20700
send_packet_achievement_info_100
static int send_packet_achievement_info_100(struct connection *pc, const struct packet_achievement_info *packet)
Definition packets_gen.c:11374
dsend_packet_edit_tile_terrain
int dsend_packet_edit_tile_terrain(struct connection *pc, int tile, Terrain_type_id terrain, int size)
Definition packets_gen.c:81243
free_packet_ruleset_building
static void free_packet_ruleset_building(struct packet_ruleset_building *packet)
Definition packets_gen.c:55166
lsend_packet_ruleset_counter
void lsend_packet_ruleset_counter(struct conn_list *dest, const struct packet_ruleset_counter *packet)
Definition packets_gen.c:69102
init_packet_diplomacy_init_meeting_req
static void init_packet_diplomacy_init_meeting_req(struct packet_diplomacy_init_meeting_req *packet)
Definition packets_gen.c:34537
destroy_packet_endgame_player
#define destroy_packet_endgame_player
Definition packets_gen.c:3120
receive_packet_ruleset_summary_100
static struct packet_ruleset_summary * receive_packet_ruleset_summary_100(struct connection *pc)
Definition packets_gen.c:72715
lsend_packet_rulesets_ready
void lsend_packet_rulesets_ready(struct conn_list *dest)
Definition packets_gen.c:51044
send_packet_unknown_research_100
static int send_packet_unknown_research_100(struct connection *pc, const struct packet_unknown_research *packet)
Definition packets_gen.c:27596
send_packet_ruleset_nation_groups_100
static int send_packet_ruleset_nation_groups_100(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
Definition packets_gen.c:51858
dsend_packet_edit_city_remove
int dsend_packet_edit_city_remove(struct connection *pc, int id)
Definition packets_gen.c:84346
receive_packet_ruleset_clause_100
static struct packet_ruleset_clause * receive_packet_ruleset_clause_100(struct connection *pc)
Definition packets_gen.c:70630
free_packet_ruleset_unit
static void free_packet_ruleset_unit(struct packet_ruleset_unit *packet)
Definition packets_gen.c:41350
dsend_packet_diplomacy_accept_treaty_req
int dsend_packet_diplomacy_accept_treaty_req(struct connection *pc, int counterpart)
Definition packets_gen.c:36883
dsend_packet_city_name_suggestion_req
int dsend_packet_city_name_suggestion_req(struct connection *pc, int unit_id)
Definition packets_gen.c:20878
receive_packet_web_ruleset_unit_addition_100
static struct packet_web_ruleset_unit_addition * receive_packet_web_ruleset_unit_addition_100(struct connection *pc)
Definition packets_gen.c:90554
send_packet_vote_resolve_100
static int send_packet_vote_resolve_100(struct connection *pc, const struct packet_vote_resolve *packet)
Definition packets_gen.c:80343
init_packet_edit_startpos
static void init_packet_edit_startpos(struct packet_edit_startpos *packet)
Definition packets_gen.c:81590
receive_packet_end_phase_100
static struct packet_end_phase * receive_packet_end_phase_100(struct connection *pc)
Definition packets_gen.c:39447
send_packet_processing_started_100
static int send_packet_processing_started_100(struct connection *pc)
Definition packets_gen.c:1114
send_packet_rulesets_ready
int send_packet_rulesets_ready(struct connection *pc)
Definition packets_gen.c:51032
send_packet_edit_player_create_100
static int send_packet_edit_player_create_100(struct connection *pc, const struct packet_edit_player_create *packet)
Definition packets_gen.c:86254
init_packet_unit_actions
static void init_packet_unit_actions(struct packet_unit_actions *packet)
Definition packets_gen.c:33733
init_packet_vote_remove
static void init_packet_vote_remove(struct packet_vote_remove *packet)
Definition packets_gen.c:80071
lsend_packet_city_remove
void lsend_packet_city_remove(struct conn_list *dest, const struct packet_city_remove *packet)
Definition packets_gen.c:13227
send_packet_timeout_info
int send_packet_timeout_info(struct connection *pc, const struct packet_timeout_info *packet)
Definition packets_gen.c:10426
init_packet_player_tech_goal
static void init_packet_player_tech_goal(struct packet_player_tech_goal *packet)
Definition packets_gen.c:27886
destroy_packet_vote_submit
#define destroy_packet_vote_submit
Definition packets_gen.c:80453
send_packet_player_research
int send_packet_player_research(struct connection *pc, const struct packet_player_research *packet)
Definition packets_gen.c:27865
init_packet_team_name_info
static void init_packet_team_name_info(struct packet_team_name_info *packet)
Definition packets_gen.c:11041
lsend_packet_ruleset_impr_flag
void lsend_packet_ruleset_impr_flag(struct conn_list *dest, const struct packet_ruleset_impr_flag *packet)
Definition packets_gen.c:56811
send_packet_ruleset_music
int send_packet_ruleset_music(struct connection *pc, const struct packet_ruleset_music *packet)
Definition packets_gen.c:69531
send_packet_start_phase
int send_packet_start_phase(struct connection *pc, const struct packet_start_phase *packet)
Definition packets_gen.c:39652
destroy_packet_conn_info
#define destroy_packet_conn_info
Definition packets_gen.c:38115
destroy_packet_new_year
#define destroy_packet_new_year
Definition packets_gen.c:39695
send_packet_unit_remove_100
static int send_packet_unit_remove_100(struct connection *pc, const struct packet_unit_remove *packet)
Definition packets_gen.c:28170
destroy_packet_player_place_infra
#define destroy_packet_player_place_infra
Definition packets_gen.c:25661
init_packet_processing_started
static void init_packet_processing_started(struct packet_processing_started *packet)
Definition packets_gen.c:1094
receive_packet_worker_task_100
static struct packet_worker_task * receive_packet_worker_task_100(struct connection *pc)
Definition packets_gen.c:21918
init_packet_vote_new
static void init_packet_vote_new(struct packet_vote_new *packet)
Definition packets_gen.c:79385
init_packet_freeze_client
static void init_packet_freeze_client(struct packet_freeze_client *packet)
Definition packets_gen.c:40046
lsend_packet_ruleset_extra_flag
void lsend_packet_ruleset_extra_flag(struct conn_list *dest, const struct packet_ruleset_extra_flag *packet)
Definition packets_gen.c:63206
init_packet_diplomacy_cancel_pact
static void init_packet_diplomacy_cancel_pact(struct packet_diplomacy_cancel_pact *packet)
Definition packets_gen.c:37139
receive_packet_city_make_worker_100
static struct packet_city_make_worker * receive_packet_city_make_worker_100(struct connection *pc)
Definition packets_gen.c:19561
send_packet_city_worklist
int send_packet_city_worklist(struct connection *pc, const struct packet_city_worklist *packet)
Definition packets_gen.c:19296
send_packet_edit_city_create_100
static int send_packet_edit_city_create_100(struct connection *pc, const struct packet_edit_city_create *packet)
Definition packets_gen.c:83993
destroy_packet_ruleset_multiplier
static void destroy_packet_ruleset_multiplier(void *packet)
Definition packets_gen.c:69589
destroy_packet_calendar_info
#define destroy_packet_calendar_info
Definition packets_gen.c:9804
lsend_packet_diplomacy_init_meeting
void lsend_packet_diplomacy_init_meeting(struct conn_list *dest, const struct packet_diplomacy_init_meeting *packet)
Definition packets_gen.c:34941
destroy_packet_spaceship_launch
#define destroy_packet_spaceship_launch
Definition packets_gen.c:40146
lsend_packet_ruleset_road
void lsend_packet_ruleset_road(struct conn_list *dest, const struct packet_ruleset_road *packet)
Definition packets_gen.c:64622
send_packet_diplomacy_init_meeting_100
static int send_packet_diplomacy_init_meeting_100(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
Definition packets_gen.c:34826
destroy_packet_achievement_info
#define destroy_packet_achievement_info
Definition packets_gen.c:11279
destroy_packet_client_heartbeat
#define destroy_packet_client_heartbeat
Definition packets_gen.c:39139
lsend_packet_investigate_started
void lsend_packet_investigate_started(struct conn_list *dest, const struct packet_investigate_started *packet)
Definition packets_gen.c:1391
receive_packet_single_want_hack_req_100
static struct packet_single_want_hack_req * receive_packet_single_want_hack_req_100(struct connection *pc)
Definition packets_gen.c:73085
receive_packet_city_name_suggestion_req_100
static struct packet_city_name_suggestion_req * receive_packet_city_name_suggestion_req_100(struct connection *pc)
Definition packets_gen.c:20716
init_packet_ruleset_action_auto
static void init_packet_ruleset_action_auto(struct packet_ruleset_action_auto *packet)
Definition packets_gen.c:67883
send_packet_city_rally_point_100
static int send_packet_city_rally_point_100(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
Definition packets_gen.c:21657
send_packet_ruleset_tech_flag
int send_packet_ruleset_tech_flag(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
Definition packets_gen.c:49624
lsend_packet_thaw_client
void lsend_packet_thaw_client(struct conn_list *dest)
Definition packets_gen.c:40133
send_packet_ruleset_description_part
int send_packet_ruleset_description_part(struct connection *pc, const struct packet_ruleset_description_part *packet)
Definition packets_gen.c:73050
receive_packet_ruleset_base_100
static struct packet_ruleset_base * receive_packet_ruleset_base_100(struct connection *pc)
Definition packets_gen.c:63229
send_packet_vote_submit_100
static int send_packet_vote_submit_100(struct connection *pc, const struct packet_vote_submit *packet)
Definition packets_gen.c:80486
init_packet_city_worklist
static void init_packet_city_worklist(struct packet_city_worklist *packet)
Definition packets_gen.c:19091
init_packet_conn_ping_info
static void init_packet_conn_ping_info(struct packet_conn_ping_info *packet)
Definition packets_gen.c:38590
init_packet_edit_recalculate_borders
static void init_packet_edit_recalculate_borders(struct packet_edit_recalculate_borders *packet)
Definition packets_gen.c:80702
dsend_packet_edit_player_vision
int dsend_packet_edit_player_vision(struct connection *pc, int player, int tile, bool known, int size)
Definition packets_gen.c:88092
init_packet_player_attribute_block
static void init_packet_player_attribute_block(struct packet_player_attribute_block *packet)
Definition packets_gen.c:25882
dsend_packet_edit_toggle_fogofwar
int dsend_packet_edit_toggle_fogofwar(struct connection *pc, int player)
Definition packets_gen.c:80960
send_packet_spaceship_place_100
static int send_packet_spaceship_place_100(struct connection *pc, const struct packet_spaceship_place *packet)
Definition packets_gen.c:40292
destroy_packet_edit_scenario_desc
#define destroy_packet_edit_scenario_desc
Definition packets_gen.c:88467
lsend_packet_ruleset_terrain
void lsend_packet_ruleset_terrain(struct conn_list *dest, const struct packet_ruleset_terrain *packet)
Definition packets_gen.c:59425
init_packet_report_req
static void init_packet_report_req(struct packet_report_req *packet)
Definition packets_gen.c:37912
init_packet_ruleset_disaster
static void init_packet_ruleset_disaster(struct packet_ruleset_disaster *packet)
Definition packets_gen.c:65494
dsend_packet_unit_sscs_set
int dsend_packet_unit_sscs_set(struct connection *pc, int unit_id, enum unit_ss_data_type type, int value)
Definition packets_gen.c:31436
init_packet_edit_check_tiles
static void init_packet_edit_check_tiles(struct packet_edit_check_tiles *packet)
Definition packets_gen.c:80742
send_packet_city_sell_100
static int send_packet_city_sell_100(struct connection *pc, const struct packet_city_sell *packet)
Definition packets_gen.c:18512
receive_packet_conn_ping_info_100
static struct packet_conn_ping_info * receive_packet_conn_ping_info_100(struct connection *pc)
Definition packets_gen.c:38606
receive_packet_city_sabotage_list_100
static struct packet_city_sabotage_list * receive_packet_city_sabotage_list_100(struct connection *pc)
Definition packets_gen.c:21147
receive_packet_city_change_100
static struct packet_city_change * receive_packet_city_change_100(struct connection *pc)
Definition packets_gen.c:18840
receive_packet_processing_finished_100
static struct packet_processing_finished * receive_packet_processing_finished_100(struct connection *pc)
Definition packets_gen.c:1142
send_packet_begin_turn_100
static int send_packet_begin_turn_100(struct connection *pc)
Definition packets_gen.c:39972
destroy_packet_city_change_specialist
#define destroy_packet_city_change_specialist
Definition packets_gen.c:19778
init_packet_unit_combat_info
static void init_packet_unit_combat_info(struct packet_unit_combat_info *packet)
Definition packets_gen.c:30828
destroy_packet_ruleset_unit
static void destroy_packet_ruleset_unit(void *packet)
Definition packets_gen.c:41405
receive_packet_ruleset_achievement_100
static struct packet_ruleset_achievement * receive_packet_ruleset_achievement_100(struct connection *pc)
Definition packets_gen.c:66029
send_packet_ruleset_impr_flag
int send_packet_ruleset_impr_flag(struct connection *pc, const struct packet_ruleset_impr_flag *packet)
Definition packets_gen.c:56799
lsend_packet_ruleset_action_auto
void lsend_packet_ruleset_action_auto(struct conn_list *dest, const struct packet_ruleset_action_auto *packet)
Definition packets_gen.c:68476
init_packet_edit_startpos_full
static void init_packet_edit_startpos_full(struct packet_edit_startpos_full *packet)
Definition packets_gen.c:81703
init_packet_city_name_suggestion_info
static void init_packet_city_name_suggestion_info(struct packet_city_name_suggestion_info *packet)
Definition packets_gen.c:20887
receive_packet_ruleset_unit_bonus_100
static struct packet_ruleset_unit_bonus * receive_packet_ruleset_unit_bonus_100(struct connection *pc)
Definition packets_gen.c:44636
send_packet_ruleset_government_100
static int send_packet_ruleset_government_100(struct connection *pc, const struct packet_ruleset_government *packet)
Definition packets_gen.c:50021
send_packet_ruleset_specialist
int send_packet_ruleset_specialist(struct connection *pc, const struct packet_ruleset_specialist *packet)
Definition packets_gen.c:47711
dsend_packet_player_ready
int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
Definition packets_gen.c:2950
init_packet_ruleset_government
static void init_packet_ruleset_government(struct packet_ruleset_government *packet)
Definition packets_gen.c:49643
receive_packet_unit_short_info_100
static struct packet_unit_short_info * receive_packet_unit_short_info_100(struct connection *pc)
Definition packets_gen.c:30144
send_packet_client_info
int send_packet_client_info(struct connection *pc, const struct packet_client_info *packet)
Definition packets_gen.c:39427
send_packet_ruleset_resource_100
static int send_packet_ruleset_resource_100(struct connection *pc, const struct packet_ruleset_resource *packet)
Definition packets_gen.c:78347
packet_handlers_fill_initial
void packet_handlers_fill_initial(struct packet_handlers *phandlers)
Definition packets_gen.c:90763
send_packet_game_load
int send_packet_game_load(struct connection *pc, const struct packet_game_load *packet)
Definition packets_gen.c:74095
dsend_packet_edit_mode
int dsend_packet_edit_mode(struct connection *pc, bool state)
Definition packets_gen.c:80693
destroy_packet_edit_unit_remove_by_id
#define destroy_packet_edit_unit_remove_by_id
Definition packets_gen.c:82935
destroy_packet_ruleset_tech_class
#define destroy_packet_ruleset_tech_class
Definition packets_gen.c:49084
init_packet_save_scenario
static void init_packet_save_scenario(struct packet_save_scenario *packet)
Definition packets_gen.c:79198
receive_packet_player_attribute_block_100
static struct packet_player_attribute_block * receive_packet_player_attribute_block_100(struct connection *pc)
Definition packets_gen.c:25890
send_packet_city_sell
int send_packet_city_sell(struct connection *pc, const struct packet_city_sell *packet)
Definition packets_gen.c:18615
receive_packet_player_rates_100
static struct packet_player_rates * receive_packet_player_rates_100(struct connection *pc)
Definition packets_gen.c:25207
send_packet_save_scenario
int send_packet_save_scenario(struct connection *pc, const struct packet_save_scenario *packet)
Definition packets_gen.c:79364
receive_packet_page_msg_part_100
static struct packet_page_msg_part * receive_packet_page_msg_part_100(struct connection *pc)
Definition packets_gen.c:37743
init_packet_ruleset_unit_class
static void init_packet_ruleset_unit_class(struct packet_ruleset_unit_class *packet)
Definition packets_gen.c:59695
init_packet_edit_scenario_desc
static void init_packet_edit_scenario_desc(struct packet_edit_scenario_desc *packet)
Definition packets_gen.c:88461
dsend_packet_city_name_suggestion_info
int dsend_packet_city_name_suggestion_info(struct connection *pc, int unit_id, const char *name)
Definition packets_gen.c:21111
send_packet_unit_combat_info
int send_packet_unit_combat_info(struct connection *pc, const struct packet_unit_combat_info *packet)
Definition packets_gen.c:31151
lsend_packet_city_rally_point
void lsend_packet_city_rally_point(struct conn_list *dest, const struct packet_city_rally_point *packet, bool force_to_send)
Definition packets_gen.c:21895
packet_type
packet_type
Definition packets_gen.h:1902
PACKET_PLAYER_MULTIPLIER
@ PACKET_PLAYER_MULTIPLIER
Definition packets_gen.h:2080
PACKET_DIPLOMACY_ACCEPT_TREATY
@ PACKET_DIPLOMACY_ACCEPT_TREATY
Definition packets_gen.h:1983
PACKET_PLAYER_CHANGE_GOVERNMENT
@ PACKET_PLAYER_CHANGE_GOVERNMENT
Definition packets_gen.h:1950
PACKET_WEB_PLAYER_INFO_ADDITION
@ PACKET_WEB_PLAYER_INFO_ADDITION
Definition packets_gen.h:2097
PACKET_SAVE_SCENARIO
@ PACKET_SAVE_SCENARIO
Definition packets_gen.h:2031
PACKET_RULESET_MULTIPLIER
@ PACKET_RULESET_MULTIPLIER
Definition packets_gen.h:2081
PACKET_THAW_CLIENT
@ PACKET_THAW_CLIENT
Definition packets_gen.h:1996
PACKET_EDIT_TOGGLE_FOGOFWAR
@ PACKET_EDIT_TOGGLE_FOGOFWAR
Definition packets_gen.h:2040
PACKET_WEB_CMA_SET
@ PACKET_WEB_CMA_SET
Definition packets_gen.h:2095
PACKET_EDIT_MODE
@ PACKET_EDIT_MODE
Definition packets_gen.h:2037
PACKET_RULESET_MUSIC
@ PACKET_RULESET_MUSIC
Definition packets_gen.h:2078
PACKET_LAST
@ PACKET_LAST
Definition packets_gen.h:2103
PACKET_RULESET_GOODS
@ PACKET_RULESET_GOODS
Definition packets_gen.h:2086
PACKET_ENDGAME_PLAYER
@ PACKET_ENDGAME_PLAYER
Definition packets_gen.h:2061
PACKET_UNIT_ACTION_ANSWER
@ PACKET_UNIT_ACTION_ANSWER
Definition packets_gen.h:1969
PACKET_EDIT_PLAYER
@ PACKET_EDIT_PLAYER
Definition packets_gen.h:2055
PACKET_DIPLOMACY_CANCEL_MEETING_REQ
@ PACKET_DIPLOMACY_CANCEL_MEETING_REQ
Definition packets_gen.h:1976
PACKET_SERVER_SETTING_ENUM
@ PACKET_SERVER_SETTING_ENUM
Definition packets_gen.h:2025
PACKET_SET_TOPOLOGY
@ PACKET_SET_TOPOLOGY
Definition packets_gen.h:2091
PACKET_WEB_CITY_INFO_ADDITION
@ PACKET_WEB_CITY_INFO_ADDITION
Definition packets_gen.h:2094
PACKET_CONN_PING
@ PACKET_CONN_PING
Definition packets_gen.h:1971
PACKET_CITY_MAKE_WORKER
@ PACKET_CITY_MAKE_WORKER
Definition packets_gen.h:1937
PACKET_CITY_OPTIONS_REQ
@ PACKET_CITY_OPTIONS_REQ
Definition packets_gen.h:1940
PACKET_RULESET_COUNTER
@ PACKET_RULESET_COUNTER
Definition packets_gen.h:2100
PACKET_VOTE_UPDATE
@ PACKET_VOTE_UPDATE
Definition packets_gen.h:2033
PACKET_CITY_NAME_SUGGESTION_INFO
@ PACKET_CITY_NAME_SUGGESTION_INFO
Definition packets_gen.h:1943
PACKET_CITY_CHANGE
@ PACKET_CITY_CHANGE
Definition packets_gen.h:1934
PACKET_UNIT_SSCS_SET
@ PACKET_UNIT_SSCS_SET
Definition packets_gen.h:1963
PACKET_PROCESSING_STARTED
@ PACKET_PROCESSING_STARTED
Definition packets_gen.h:1903
PACKET_UNIT_DO_ACTION
@ PACKET_UNIT_DO_ACTION
Definition packets_gen.h:1968
PACKET_UNIT_REMOVE
@ PACKET_UNIT_REMOVE
Definition packets_gen.h:1958
PACKET_END_PHASE
@ PACKET_END_PHASE
Definition packets_gen.h:1990
PACKET_SERVER_SETTING_INT
@ PACKET_SERVER_SETTING_INT
Definition packets_gen.h:2023
PACKET_RULESET_EXTRA
@ PACKET_RULESET_EXTRA
Definition packets_gen.h:2070
PACKET_EDIT_PLAYER_CREATE
@ PACKET_EDIT_PLAYER_CREATE
Definition packets_gen.h:2053
PACKET_EDIT_GAME
@ PACKET_EDIT_GAME
Definition packets_gen.h:2057
PACKET_CONN_PING_INFO
@ PACKET_CONN_PING_INFO
Definition packets_gen.h:1988
PACKET_END_TURN
@ PACKET_END_TURN
Definition packets_gen.h:1994
PACKET_EDIT_TILE_EXTRA
@ PACKET_EDIT_TILE_EXTRA
Definition packets_gen.h:2042
PACKET_SPACESHIP_PLACE
@ PACKET_SPACESHIP_PLACE
Definition packets_gen.h:1998
PACKET_NEW_YEAR
@ PACKET_NEW_YEAR
Definition packets_gen.h:1992
PACKET_NATION_SELECT_REQ
@ PACKET_NATION_SELECT_REQ
Definition packets_gen.h:1911
PACKET_ENDGAME_REPORT
@ PACKET_ENDGAME_REPORT
Definition packets_gen.h:1913
PACKET_RULESET_ACTION_AUTO
@ PACKET_RULESET_ACTION_AUTO
Definition packets_gen.h:2090
PACKET_UNIT_COMBAT_INFO
@ PACKET_UNIT_COMBAT_INFO
Definition packets_gen.h:1961
PACKET_RULESETS_READY
@ PACKET_RULESETS_READY
Definition packets_gen.h:2063
PACKET_UNIT_SHORT_INFO
@ PACKET_UNIT_SHORT_INFO
Definition packets_gen.h:1960
PACKET_SERVER_JOIN_REQ
@ PACKET_SERVER_JOIN_REQ
Definition packets_gen.h:1905
PACKET_REPORT_REQ
@ PACKET_REPORT_REQ
Definition packets_gen.h:1986
PACKET_RULESET_UNIT_CLASS_FLAG
@ PACKET_RULESET_UNIT_CLASS_FLAG
Definition packets_gen.h:2068
PACKET_RULESET_TECH_CLASS
@ PACKET_RULESET_TECH_CLASS
Definition packets_gen.h:1910
PACKET_EDIT_CITY_CREATE
@ PACKET_EDIT_CITY_CREATE
Definition packets_gen.h:2050
PACKET_SINGLE_WANT_HACK_REPLY
@ PACKET_SINGLE_WANT_HACK_REPLY
Definition packets_gen.h:2017
PACKET_GAME_INFO
@ PACKET_GAME_INFO
Definition packets_gen.h:1917
PACKET_DIPLOMACY_INIT_MEETING_REQ
@ PACKET_DIPLOMACY_INIT_MEETING_REQ
Definition packets_gen.h:1974
PACKET_PROCESSING_FINISHED
@ PACKET_PROCESSING_FINISHED
Definition packets_gen.h:1904
PACKET_RULESET_ACTION
@ PACKET_RULESET_ACTION
Definition packets_gen.h:2084
PACKET_PLAYER_ATTRIBUTE_BLOCK
@ PACKET_PLAYER_ATTRIBUTE_BLOCK
Definition packets_gen.h:1953
PACKET_CITY_SELL
@ PACKET_CITY_SELL
Definition packets_gen.h:1932
PACKET_CITY_NAME_SUGGESTION_REQ
@ PACKET_CITY_NAME_SUGGESTION_REQ
Definition packets_gen.h:1942
PACKET_UNKNOWN_RESEARCH
@ PACKET_UNKNOWN_RESEARCH
Definition packets_gen.h:1962
PACKET_CHAT_MSG_REQ
@ PACKET_CHAT_MSG_REQ
Definition packets_gen.h:1925
PACKET_NUKE_TILE_INFO
@ PACKET_NUKE_TILE_INFO
Definition packets_gen.h:1919
PACKET_PLAYER_DIPLSTATE
@ PACKET_PLAYER_DIPLSTATE
Definition packets_gen.h:1955
PACKET_RULESET_IMPR_FLAG
@ PACKET_RULESET_IMPR_FLAG
Definition packets_gen.h:1921
PACKET_RULESET_TECH
@ PACKET_RULESET_TECH
Definition packets_gen.h:2005
PACKET_CLIENT_HEARTBEAT
@ PACKET_CLIENT_HEARTBEAT
Definition packets_gen.h:2092
PACKET_RULESET_ROAD
@ PACKET_RULESET_ROAD
Definition packets_gen.h:2059
PACKET_RULESET_NATION_SETS
@ PACKET_RULESET_NATION_SETS
Definition packets_gen.h:2074
PACKET_CITY_SABOTAGE_LIST
@ PACKET_CITY_SABOTAGE_LIST
Definition packets_gen.h:1944
PACKET_MAP_INFO
@ PACKET_MAP_INFO
Definition packets_gen.h:1918
PACKET_RULESET_CLAUSE
@ PACKET_RULESET_CLAUSE
Definition packets_gen.h:2099
PACKET_DIPLOMACY_CREATE_CLAUSE_REQ
@ PACKET_DIPLOMACY_CREATE_CLAUSE_REQ
Definition packets_gen.h:1978
PACKET_CITY_BUY
@ PACKET_CITY_BUY
Definition packets_gen.h:1933
PACKET_CHAT_MSG
@ PACKET_CHAT_MSG
Definition packets_gen.h:1924
PACKET_EDIT_CITY_REMOVE
@ PACKET_EDIT_CITY_REMOVE
Definition packets_gen.h:2051
PACKET_EDIT_STARTPOS
@ PACKET_EDIT_STARTPOS
Definition packets_gen.h:2043
PACKET_SERVER_SETTING_CONST
@ PACKET_SERVER_SETTING_CONST
Definition packets_gen.h:2021
PACKET_PLAYER_RESEARCH
@ PACKET_PLAYER_RESEARCH
Definition packets_gen.h:1951
PACKET_BEGIN_TURN
@ PACKET_BEGIN_TURN
Definition packets_gen.h:1993
PACKET_RULESET_TERRAIN_CONTROL
@ PACKET_RULESET_TERRAIN_CONTROL
Definition packets_gen.h:2007
PACKET_PLAYER_PHASE_DONE
@ PACKET_PLAYER_PHASE_DONE
Definition packets_gen.h:1948
PACKET_RULESET_SELECT
@ PACKET_RULESET_SELECT
Definition packets_gen.h:2027
PACKET_GAME_LOAD
@ PACKET_GAME_LOAD
Definition packets_gen.h:2019
PACKET_CITY_UPDATE_COUNTERS
@ PACKET_CITY_UPDATE_COUNTERS
Definition packets_gen.h:2101
PACKET_PLAYER_REMOVE
@ PACKET_PLAYER_REMOVE
Definition packets_gen.h:1946
PACKET_CLIENT_INFO
@ PACKET_CLIENT_INFO
Definition packets_gen.h:1989
PACKET_CITY_WORKLIST
@ PACKET_CITY_WORKLIST
Definition packets_gen.h:1935
PACKET_DIPLOMACY_CANCEL_MEETING
@ PACKET_DIPLOMACY_CANCEL_MEETING
Definition packets_gen.h:1977
PACKET_UNIT_TYPE_UPGRADE
@ PACKET_UNIT_TYPE_UPGRADE
Definition packets_gen.h:1967
PACKET_START_PHASE
@ PACKET_START_PHASE
Definition packets_gen.h:1991
PACKET_AUTHENTICATION_REPLY
@ PACKET_AUTHENTICATION_REPLY
Definition packets_gen.h:1908
PACKET_SPACESHIP_INFO
@ PACKET_SPACESHIP_INFO
Definition packets_gen.h:1999
PACKET_UNIT_GET_ACTIONS
@ PACKET_UNIT_GET_ACTIONS
Definition packets_gen.h:1970
PACKET_PLAYER_ATTRIBUTE_CHUNK
@ PACKET_PLAYER_ATTRIBUTE_CHUNK
Definition packets_gen.h:1954
PACKET_RULESET_TERRAIN_FLAG
@ PACKET_RULESET_TERRAIN_FLAG
Definition packets_gen.h:2069
PACKET_CITY_MAKE_SPECIALIST
@ PACKET_CITY_MAKE_SPECIALIST
Definition packets_gen.h:1936
PACKET_RULESET_ACHIEVEMENT
@ PACKET_RULESET_ACHIEVEMENT
Definition packets_gen.h:2071
PACKET_RULESET_EFFECT
@ PACKET_RULESET_EFFECT
Definition packets_gen.h:2028
PACKET_RULESET_DISASTER
@ PACKET_RULESET_DISASTER
Definition packets_gen.h:2062
PACKET_RULESET_CONTROL
@ PACKET_RULESET_CONTROL
Definition packets_gen.h:2015
PACKET_SINGLE_WANT_HACK_REQ
@ PACKET_SINGLE_WANT_HACK_REQ
Definition packets_gen.h:2016
PACKET_PLAYER_PLACE_INFRA
@ PACKET_PLAYER_PLACE_INFRA
Definition packets_gen.h:1957
PACKET_VOTE_NEW
@ PACKET_VOTE_NEW
Definition packets_gen.h:2032
PACKET_AUTHENTICATION_REQ
@ PACKET_AUTHENTICATION_REQ
Definition packets_gen.h:1907
PACKET_RULESET_TRADE
@ PACKET_RULESET_TRADE
Definition packets_gen.h:2065
PACKET_EDIT_PLAYER_REMOVE
@ PACKET_EDIT_PLAYER_REMOVE
Definition packets_gen.h:2054
PACKET_CONN_INFO
@ PACKET_CONN_INFO
Definition packets_gen.h:1987
PACKET_SERVER_SETTING_BITWISE
@ PACKET_SERVER_SETTING_BITWISE
Definition packets_gen.h:2026
PACKET_EDIT_TILE_TERRAIN
@ PACKET_EDIT_TILE_TERRAIN
Definition packets_gen.h:2041
PACKET_DIPLOMACY_INIT_MEETING
@ PACKET_DIPLOMACY_INIT_MEETING
Definition packets_gen.h:1975
PACKET_RULESET_SUMMARY
@ PACKET_RULESET_SUMMARY
Definition packets_gen.h:2089
PACKET_UNIT_ACTION_QUERY
@ PACKET_UNIT_ACTION_QUERY
Definition packets_gen.h:1966
PACKET_PLAY_MUSIC
@ PACKET_PLAY_MUSIC
Definition packets_gen.h:2083
PACKET_TRADE_ROUTE_INFO
@ PACKET_TRADE_ROUTE_INFO
Definition packets_gen.h:2087
PACKET_RULESET_STYLE
@ PACKET_RULESET_STYLE
Definition packets_gen.h:2077
PACKET_RULESET_CITY
@ PACKET_RULESET_CITY
Definition packets_gen.h:2010
PACKET_CITY_NATIONALITIES
@ PACKET_CITY_NATIONALITIES
Definition packets_gen.h:1945
PACKET_EDIT_SCENARIO_DESC
@ PACKET_EDIT_SCENARIO_DESC
Definition packets_gen.h:1915
PACKET_FREEZE_CLIENT
@ PACKET_FREEZE_CLIENT
Definition packets_gen.h:1995
PACKET_VOTE_RESOLVE
@ PACKET_VOTE_RESOLVE
Definition packets_gen.h:2035
PACKET_EDIT_UNIT_CREATE
@ PACKET_EDIT_UNIT_CREATE
Definition packets_gen.h:2046
PACKET_TIMEOUT_INFO
@ PACKET_TIMEOUT_INFO
Definition packets_gen.h:2082
PACKET_RULESET_GAME
@ PACKET_RULESET_GAME
Definition packets_gen.h:2002
PACKET_UNIT_CHANGE_ACTIVITY
@ PACKET_UNIT_CHANGE_ACTIVITY
Definition packets_gen.h:2060
PACKET_EDIT_UNIT_REMOVE
@ PACKET_EDIT_UNIT_REMOVE
Definition packets_gen.h:2047
PACKET_RULESET_UNIT_FLAG
@ PACKET_RULESET_UNIT_FLAG
Definition packets_gen.h:2067
PACKET_DIPLOMACY_REMOVE_CLAUSE
@ PACKET_DIPLOMACY_REMOVE_CLAUSE
Definition packets_gen.h:1981
PACKET_TILE_INFO
@ PACKET_TILE_INFO
Definition packets_gen.h:1916
PACKET_EDIT_OBJECT_CREATED
@ PACKET_EDIT_OBJECT_CREATED
Definition packets_gen.h:2058
PACKET_CITY_SHORT_INFO
@ PACKET_CITY_SHORT_INFO
Definition packets_gen.h:1931
PACKET_CALENDAR_INFO
@ PACKET_CALENDAR_INFO
Definition packets_gen.h:2093
PACKET_SERVER_JOIN_REPLY
@ PACKET_SERVER_JOIN_REPLY
Definition packets_gen.h:1906
PACKET_SERVER_SETTING_STR
@ PACKET_SERVER_SETTING_STR
Definition packets_gen.h:2024
PACKET_VOTE_SUBMIT
@ PACKET_VOTE_SUBMIT
Definition packets_gen.h:2036
PACKET_WEB_CMA_CLEAR
@ PACKET_WEB_CMA_CLEAR
Definition packets_gen.h:2096
PACKET_EDIT_PLAYER_VISION
@ PACKET_EDIT_PLAYER_VISION
Definition packets_gen.h:2056
PACKET_SCENARIO_INFO
@ PACKET_SCENARIO_INFO
Definition packets_gen.h:2030
PACKET_EDIT_CHECK_TILES
@ PACKET_EDIT_CHECK_TILES
Definition packets_gen.h:2039
PACKET_RULESET_CHOICES
@ PACKET_RULESET_CHOICES
Definition packets_gen.h:2018
PACKET_CITY_CHANGE_SPECIALIST
@ PACKET_CITY_CHANGE_SPECIALIST
Definition packets_gen.h:1938
PACKET_RULESET_SPECIALIST
@ PACKET_RULESET_SPECIALIST
Definition packets_gen.h:2003
PACKET_CITY_REFRESH
@ PACKET_CITY_REFRESH
Definition packets_gen.h:1941
PACKET_CITY_REMOVE
@ PACKET_CITY_REMOVE
Definition packets_gen.h:1929
PACKET_UNIT_INFO
@ PACKET_UNIT_INFO
Definition packets_gen.h:1959
PACKET_RULESET_NATION_GROUPS
@ PACKET_RULESET_NATION_GROUPS
Definition packets_gen.h:2008
PACKET_CONNECT_MSG
@ PACKET_CONNECT_MSG
Definition packets_gen.h:1926
PACKET_EARLY_CHAT_MSG
@ PACKET_EARLY_CHAT_MSG
Definition packets_gen.h:1927
PACKET_RULESET_UNIT_CLASS
@ PACKET_RULESET_UNIT_CLASS
Definition packets_gen.h:2013
PACKET_PLAYER_INFO
@ PACKET_PLAYER_INFO
Definition packets_gen.h:1947
PACKET_EDIT_TILE
@ PACKET_EDIT_TILE
Definition packets_gen.h:2045
PACKET_PLAYER_READY
@ PACKET_PLAYER_READY
Definition packets_gen.h:1912
PACKET_WEB_RULESET_UNIT_ADDITION
@ PACKET_WEB_RULESET_UNIT_ADDITION
Definition packets_gen.h:2098
PACKET_SERVER_SHUTDOWN
@ PACKET_SERVER_SHUTDOWN
Definition packets_gen.h:1909
PACKET_RULESET_TERRAIN
@ PACKET_RULESET_TERRAIN
Definition packets_gen.h:2012
PACKET_RULESET_EXTRA_FLAG
@ PACKET_RULESET_EXTRA_FLAG
Definition packets_gen.h:2064
PACKET_RULESET_DESCRIPTION_PART
@ PACKET_RULESET_DESCRIPTION_PART
Definition packets_gen.h:2085
PACKET_EDIT_UNIT
@ PACKET_EDIT_UNIT
Definition packets_gen.h:2049
PACKET_RULESET_BASE
@ PACKET_RULESET_BASE
Definition packets_gen.h:2014
PACKET_SERVER_SETTING_BOOL
@ PACKET_SERVER_SETTING_BOOL
Definition packets_gen.h:2022
PACKET_RESEARCH_INFO
@ PACKET_RESEARCH_INFO
Definition packets_gen.h:1956
PACKET_CONN_PONG
@ PACKET_CONN_PONG
Definition packets_gen.h:1972
PACKET_EDIT_RECALCULATE_BORDERS
@ PACKET_EDIT_RECALCULATE_BORDERS
Definition packets_gen.h:2038
PACKET_PAGE_MSG_PART
@ PACKET_PAGE_MSG_PART
Definition packets_gen.h:2088
PACKET_EDIT_CITY
@ PACKET_EDIT_CITY
Definition packets_gen.h:2052
PACKET_RULESET_UNIT
@ PACKET_RULESET_UNIT
Definition packets_gen.h:2001
PACKET_PLAYER_TECH_GOAL
@ PACKET_PLAYER_TECH_GOAL
Definition packets_gen.h:1952
PACKET_UNIT_ACTIONS
@ PACKET_UNIT_ACTIONS
Definition packets_gen.h:1973
PACKET_INVESTIGATE_FINISHED
@ PACKET_INVESTIGATE_FINISHED
Definition packets_gen.h:1923
PACKET_RULESET_ACTION_ENABLER
@ PACKET_RULESET_ACTION_ENABLER
Definition packets_gen.h:2073
PACKET_INVESTIGATE_STARTED
@ PACKET_INVESTIGATE_STARTED
Definition packets_gen.h:1922
PACKET_CITY_RALLY_POINT
@ PACKET_CITY_RALLY_POINT
Definition packets_gen.h:2000
PACKET_RULESET_UNIT_BONUS
@ PACKET_RULESET_UNIT_BONUS
Definition packets_gen.h:2066
PACKET_RULESET_BUILDING
@ PACKET_RULESET_BUILDING
Definition packets_gen.h:2011
PACKET_RULESET_NATION
@ PACKET_RULESET_NATION
Definition packets_gen.h:2009
PACKET_UNIT_SERVER_SIDE_AGENT_SET
@ PACKET_UNIT_SERVER_SIDE_AGENT_SET
Definition packets_gen.h:1965
PACKET_SERVER_INFO
@ PACKET_SERVER_INFO
Definition packets_gen.h:1928
PACKET_RULESET_GOVERNMENT_RULER_TITLE
@ PACKET_RULESET_GOVERNMENT_RULER_TITLE
Definition packets_gen.h:2004
PACKET_SPACESHIP_LAUNCH
@ PACKET_SPACESHIP_LAUNCH
Definition packets_gen.h:1997
PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ
@ PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ
Definition packets_gen.h:1980
PACKET_DIPLOMACY_ACCEPT_TREATY_REQ
@ PACKET_DIPLOMACY_ACCEPT_TREATY_REQ
Definition packets_gen.h:1982
PACKET_DIPLOMACY_CREATE_CLAUSE
@ PACKET_DIPLOMACY_CREATE_CLAUSE
Definition packets_gen.h:1979
PACKET_RULESET_GOVERNMENT
@ PACKET_RULESET_GOVERNMENT
Definition packets_gen.h:2006
PACKET_SCENARIO_DESCRIPTION
@ PACKET_SCENARIO_DESCRIPTION
Definition packets_gen.h:1914
PACKET_SERVER_SETTING_CONTROL
@ PACKET_SERVER_SETTING_CONTROL
Definition packets_gen.h:2020
PACKET_ACHIEVEMENT_INFO
@ PACKET_ACHIEVEMENT_INFO
Definition packets_gen.h:2076
PACKET_PAGE_MSG
@ PACKET_PAGE_MSG
Definition packets_gen.h:1985
PACKET_RULESET_TECH_FLAG
@ PACKET_RULESET_TECH_FLAG
Definition packets_gen.h:2072
PACKET_RULESET_RESOURCE
@ PACKET_RULESET_RESOURCE
Definition packets_gen.h:2029
PACKET_UNIT_ORDERS
@ PACKET_UNIT_ORDERS
Definition packets_gen.h:1964
PACKET_EDIT_UNIT_REMOVE_BY_ID
@ PACKET_EDIT_UNIT_REMOVE_BY_ID
Definition packets_gen.h:2048
PACKET_EDIT_STARTPOS_FULL
@ PACKET_EDIT_STARTPOS_FULL
Definition packets_gen.h:2044
PACKET_DIPLOMACY_CANCEL_PACT
@ PACKET_DIPLOMACY_CANCEL_PACT
Definition packets_gen.h:1984
PACKET_TEAM_NAME_INFO
@ PACKET_TEAM_NAME_INFO
Definition packets_gen.h:1920
PACKET_CITY_INFO
@ PACKET_CITY_INFO
Definition packets_gen.h:1930
PACKET_PLAYER_RATES
@ PACKET_PLAYER_RATES
Definition packets_gen.h:1949
PACKET_NATION_AVAILABILITY
@ PACKET_NATION_AVAILABILITY
Definition packets_gen.h:2075
PACKET_CITY_RENAME
@ PACKET_CITY_RENAME
Definition packets_gen.h:1939
PACKET_VOTE_REMOVE
@ PACKET_VOTE_REMOVE
Definition packets_gen.h:2034
PACKET_WORKER_TASK
@ PACKET_WORKER_TASK
Definition packets_gen.h:2079
parts
int parts
Definition packhand.c:132
lines
char * lines
Definition packhand.c:131
len
int len
Definition packhand.c:127
gives_shared_tiles
bool gives_shared_tiles(const struct player *me, const struct player *them)
Definition player.c:1497
gives_shared_vision
bool gives_shared_vision(const struct player *me, const struct player *them)
Definition player.c:1489
are_requirements_equal
bool are_requirements_equal(const struct requirement *req1, const struct requirement *req2)
Definition requirements.c:1469
compat
static struct compatibility compat[]
Definition savecompat.c:112
connections
static struct connection connections[MAX_NUM_CONNECTIONS]
Definition sernet.c:94
MAX_UINT16
#define MAX_UINT16
Definition shared.h:82
specialists
struct specialist specialists[SP_MAX]
Definition specialist.c:30
default_specialist
int default_specialist
Definition specialist.c:31
step
int step
Definition specpq.h:92
size
size_t size
Definition specvec.h:72
aifill
const char * aifill(int amount)
Definition srv_main.c:2503
strvec_destroy
void strvec_destroy(struct strvec *psv)
Definition string_vector.c:72
strvec_set
bool strvec_set(struct strvec *psv, size_t svindex, const char *string)
Definition string_vector.c:306
strvec_reserve
void strvec_reserve(struct strvec *psv, size_t reserve)
Definition string_vector.c:81
strvec_get
const char * strvec_get(const struct strvec *psv, size_t svindex)
Definition string_vector.c:389
strvec_copy
void strvec_copy(struct strvec *dest, const struct strvec *src)
Definition string_vector.c:238
strvec_new
struct strvec * strvec_new(void)
Definition string_vector.c:59
strvec_clear
void strvec_clear(struct strvec *psv)
Definition string_vector.c:160
strvec_size
size_t strvec_size(const struct strvec *psv)
Definition string_vector.c:344
are_strvecs_equal
bool are_strvecs_equal(const struct strvec *stv1, const struct strvec *stv2)
Definition string_vector.c:352
act_prob
Definition fc_types.h:1250
agent
Definition agents.h:40
city
Definition city.h:320
city::tile
struct tile * tile
Definition city.h:322
cm_parameter
Definition cm.h:40
connection
Definition connection.h:136
connection::capability
char capability[MAX_LEN_CAPSTR]
Definition connection.h:171
genhash
Definition genhash.c:83
government
Definition government.h:52
message
Definition messagewin_common.h:29
multiplier
Definition multipliers.h:31
music_style
Definition style.h:29
packet_achievement_info
Definition packets_gen.h:292
packet_achievement_info::id
int id
Definition packets_gen.h:293
packet_achievement_info::gained
bool gained
Definition packets_gen.h:294
packet_achievement_info::first
bool first
Definition packets_gen.h:295
packet_authentication_reply
Definition packets_gen.h:68
packet_authentication_reply::password
char password[MAX_LEN_PASSWORD]
Definition packets_gen.h:69
packet_authentication_req
Definition packets_gen.h:63
packet_authentication_req::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:65
packet_authentication_req::type
enum authentication_type type
Definition packets_gen.h:64
packet_begin_turn
Definition packets_gen.h:905
packet_calendar_info
Definition packets_gen.h:260
packet_calendar_info::positive_year_label
char positive_year_label[MAX_LEN_NAME]
Definition packets_gen.h:261
packet_calendar_info::calendar_skip_0
bool calendar_skip_0
Definition packets_gen.h:265
packet_calendar_info::negative_year_label
char negative_year_label[MAX_LEN_NAME]
Definition packets_gen.h:262
packet_calendar_info::calendar_fragments
int calendar_fragments
Definition packets_gen.h:263
packet_calendar_info::calendar_fragment_name
char calendar_fragment_name[MAX_CALENDAR_FRAGMENTS][MAX_LEN_NAME]
Definition packets_gen.h:264
packet_chat_msg_req
Definition packets_gen.h:316
packet_chat_msg_req::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:317
packet_chat_msg
Definition packets_gen.h:298
packet_chat_msg::phase
int phase
Definition packets_gen.h:303
packet_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:299
packet_chat_msg::conn_id
int conn_id
Definition packets_gen.h:304
packet_chat_msg::event
enum event_type event
Definition packets_gen.h:301
packet_chat_msg::turn
int turn
Definition packets_gen.h:302
packet_chat_msg::tile
int tile
Definition packets_gen.h:300
packet_city_buy
Definition packets_gen.h:433
packet_city_buy::city_id
int city_id
Definition packets_gen.h:434
packet_city_change_specialist
Definition packets_gen.h:458
packet_city_change_specialist::to
Specialist_type_id to
Definition packets_gen.h:461
packet_city_change_specialist::from
Specialist_type_id from
Definition packets_gen.h:460
packet_city_change_specialist::city_id
int city_id
Definition packets_gen.h:459
packet_city_change
Definition packets_gen.h:437
packet_city_change::city_id
int city_id
Definition packets_gen.h:438
packet_city_change::production_kind
int production_kind
Definition packets_gen.h:439
packet_city_change::production_value
int production_value
Definition packets_gen.h:440
packet_city_info
Definition packets_gen.h:336
packet_city_info::style
int style
Definition packets_gen.h:343
packet_city_info::last_turns_shield_surplus
int last_turns_shield_surplus
Definition packets_gen.h:374
packet_city_info::usage
int usage[O_LAST]
Definition packets_gen.h:359
packet_city_info::before_change_shields
int before_change_shields
Definition packets_gen.h:371
packet_city_info::ppl_content
int ppl_content[FEELING_LAST]
Definition packets_gen.h:346
packet_city_info::city_options
bv_city_options city_options
Definition packets_gen.h:386
packet_city_info::capital
enum capital_type capital
Definition packets_gen.h:344
packet_city_info::surplus
int surplus[O_LAST]
Definition packets_gen.h:354
packet_city_info::had_famine
bool had_famine
Definition packets_gen.h:379
packet_city_info::ppl_unhappy
int ppl_unhappy[FEELING_LAST]
Definition packets_gen.h:347
packet_city_info::original
int original
Definition packets_gen.h:340
packet_city_info::citizen_base
int citizen_base[O_LAST]
Definition packets_gen.h:358
packet_city_info::changed_from_kind
int changed_from_kind
Definition packets_gen.h:369
packet_city_info::specialists
int specialists[SP_MAX]
Definition packets_gen.h:350
packet_city_info::changed_from_value
int changed_from_value
Definition packets_gen.h:370
packet_city_info::ppl_angry
int ppl_angry[FEELING_LAST]
Definition packets_gen.h:348
packet_city_info::food_stock
int food_stock
Definition packets_gen.h:360
packet_city_info::id
int id
Definition packets_gen.h:337
packet_city_info::specialists_size
int specialists_size
Definition packets_gen.h:349
packet_city_info::owner
int owner
Definition packets_gen.h:339
packet_city_info::walls
int walls
Definition packets_gen.h:381
packet_city_info::improvements
bv_imprs improvements
Definition packets_gen.h:385
packet_city_info::shield_stock
int shield_stock
Definition packets_gen.h:361
packet_city_info::was_happy
bool was_happy
Definition packets_gen.h:378
packet_city_info::worklist
struct worklist worklist
Definition packets_gen.h:384
packet_city_info::steal
int steal
Definition packets_gen.h:383
packet_city_info::airlift
int airlift
Definition packets_gen.h:375
packet_city_info::did_buy
bool did_buy
Definition packets_gen.h:376
packet_city_info::turn_founded
int turn_founded
Definition packets_gen.h:367
packet_city_info::buy_cost
int buy_cost
Definition packets_gen.h:353
packet_city_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:387
packet_city_info::pollution
int pollution
Definition packets_gen.h:363
packet_city_info::trade_route_count
int trade_route_count
Definition packets_gen.h:362
packet_city_info::ppl_happy
int ppl_happy[FEELING_LAST]
Definition packets_gen.h:345
packet_city_info::did_sell
bool did_sell
Definition packets_gen.h:377
packet_city_info::production_value
int production_value
Definition packets_gen.h:366
packet_city_info::prod
int prod[O_LAST]
Definition packets_gen.h:357
packet_city_info::caravan_shields
int caravan_shields
Definition packets_gen.h:373
packet_city_info::illness_trade
int illness_trade
Definition packets_gen.h:364
packet_city_info::culture
int culture
Definition packets_gen.h:352
packet_city_info::diplomat_investigate
bool diplomat_investigate
Definition packets_gen.h:380
packet_city_info::unhappy_penalty
int unhappy_penalty[O_LAST]
Definition packets_gen.h:356
packet_city_info::history
int history
Definition packets_gen.h:351
packet_city_info::turn_last_built
int turn_last_built
Definition packets_gen.h:368
packet_city_info::city_image
int city_image
Definition packets_gen.h:382
packet_city_info::disbanded_shields
int disbanded_shields
Definition packets_gen.h:372
packet_city_info::production_kind
int production_kind
Definition packets_gen.h:365
packet_city_info::tile
int tile
Definition packets_gen.h:338
packet_city_info::size
int size
Definition packets_gen.h:341
packet_city_info::city_radius_sq
int city_radius_sq
Definition packets_gen.h:342
packet_city_info::waste
int waste[O_LAST]
Definition packets_gen.h:355
packet_city_make_specialist
Definition packets_gen.h:448
packet_city_make_specialist::tile_id
int tile_id
Definition packets_gen.h:450
packet_city_make_specialist::city_id
int city_id
Definition packets_gen.h:449
packet_city_make_worker
Definition packets_gen.h:453
packet_city_make_worker::city_id
int city_id
Definition packets_gen.h:454
packet_city_make_worker::tile_id
int tile_id
Definition packets_gen.h:455
packet_city_name_suggestion_info
Definition packets_gen.h:482
packet_city_name_suggestion_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:484
packet_city_name_suggestion_info::unit_id
int unit_id
Definition packets_gen.h:483
packet_city_name_suggestion_req
Definition packets_gen.h:478
packet_city_name_suggestion_req::unit_id
int unit_id
Definition packets_gen.h:479
packet_city_nationalities
Definition packets_gen.h:390
packet_city_nationalities::nation_id
int nation_id[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:393
packet_city_nationalities::id
int id
Definition packets_gen.h:391
packet_city_nationalities::nation_citizens
int nation_citizens[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:394
packet_city_nationalities::nationalities_count
int nationalities_count
Definition packets_gen.h:392
packet_city_options_req
Definition packets_gen.h:469
packet_city_options_req::city_id
int city_id
Definition packets_gen.h:470
packet_city_options_req::options
bv_city_options options
Definition packets_gen.h:471
packet_city_rally_point
Definition packets_gen.h:495
packet_city_rally_point::persistent
bool persistent
Definition packets_gen.h:498
packet_city_rally_point::id
int id
Definition packets_gen.h:496
packet_city_rally_point::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:500
packet_city_rally_point::vigilant
bool vigilant
Definition packets_gen.h:499
packet_city_rally_point::length
int length
Definition packets_gen.h:497
packet_city_refresh
Definition packets_gen.h:474
packet_city_refresh::city_id
int city_id
Definition packets_gen.h:475
packet_city_remove
Definition packets_gen.h:332
packet_city_remove::city_id
int city_id
Definition packets_gen.h:333
packet_city_rename
Definition packets_gen.h:464
packet_city_rename::city_id
int city_id
Definition packets_gen.h:465
packet_city_rename::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:466
packet_city_sabotage_list
Definition packets_gen.h:487
packet_city_sabotage_list::request_kind
int request_kind
Definition packets_gen.h:492
packet_city_sabotage_list::improvements
bv_imprs improvements
Definition packets_gen.h:490
packet_city_sabotage_list::actor_id
int actor_id
Definition packets_gen.h:488
packet_city_sabotage_list::city_id
int city_id
Definition packets_gen.h:489
packet_city_sabotage_list::act_id
action_id act_id
Definition packets_gen.h:491
packet_city_sell
Definition packets_gen.h:428
packet_city_sell::build_id
int build_id
Definition packets_gen.h:430
packet_city_sell::city_id
int city_id
Definition packets_gen.h:429
packet_city_short_info
Definition packets_gen.h:403
packet_city_short_info::walls
int walls
Definition packets_gen.h:411
packet_city_short_info::style
int style
Definition packets_gen.h:408
packet_city_short_info::size
int size
Definition packets_gen.h:407
packet_city_short_info::improvements
bv_imprs improvements
Definition packets_gen.h:415
packet_city_short_info::capital
enum capital_type capital
Definition packets_gen.h:409
packet_city_short_info::owner
int owner
Definition packets_gen.h:406
packet_city_short_info::id
int id
Definition packets_gen.h:404
packet_city_short_info::city_image
int city_image
Definition packets_gen.h:414
packet_city_short_info::happy
bool happy
Definition packets_gen.h:412
packet_city_short_info::unhappy
bool unhappy
Definition packets_gen.h:413
packet_city_short_info::tile
int tile
Definition packets_gen.h:405
packet_city_short_info::occupied
bool occupied
Definition packets_gen.h:410
packet_city_short_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:416
packet_city_update_counters
Definition packets_gen.h:397
packet_city_update_counters::count
int count
Definition packets_gen.h:399
packet_city_update_counters::counters
int counters[MAX_COUNTERS]
Definition packets_gen.h:400
packet_city_update_counters::city
int city
Definition packets_gen.h:398
packet_city_worklist
Definition packets_gen.h:443
packet_city_worklist::city_id
int city_id
Definition packets_gen.h:444
packet_city_worklist::worklist
struct worklist worklist
Definition packets_gen.h:445
packet_client_heartbeat
Definition packets_gen.h:881
packet_client_info
Definition packets_gen.h:885
packet_client_info::distribution
char distribution[MAX_LEN_NAME]
Definition packets_gen.h:888
packet_client_info::emerg_version
int emerg_version
Definition packets_gen.h:887
packet_client_info::gui
enum gui_type gui
Definition packets_gen.h:886
packet_conn_info
Definition packets_gen.h:855
packet_conn_info::capability
char capability[MAX_LEN_CAPSTR]
Definition packets_gen.h:864
packet_conn_info::established
bool established
Definition packets_gen.h:858
packet_conn_info::observer
bool observer
Definition packets_gen.h:859
packet_conn_info::used
bool used
Definition packets_gen.h:857
packet_conn_info::addr
char addr[MAX_LEN_ADDR]
Definition packets_gen.h:863
packet_conn_info::player_num
int player_num
Definition packets_gen.h:860
packet_conn_info::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:862
packet_conn_info::id
int id
Definition packets_gen.h:856
packet_conn_info::access_level
enum cmdlevel access_level
Definition packets_gen.h:861
packet_conn_ping_info
Definition packets_gen.h:867
packet_conn_ping_info::connections
int connections
Definition packets_gen.h:868
packet_conn_ping_info::ping_time
float ping_time[MAX_NUM_CONNECTIONS]
Definition packets_gen.h:870
packet_conn_ping_info::conn_id
int conn_id[MAX_NUM_CONNECTIONS]
Definition packets_gen.h:869
packet_conn_ping
Definition packets_gen.h:873
packet_conn_pong
Definition packets_gen.h:877
packet_connect_msg
Definition packets_gen.h:320
packet_connect_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:321
packet_diplomacy_accept_treaty_req
Definition packets_gen.h:824
packet_diplomacy_accept_treaty_req::counterpart
int counterpart
Definition packets_gen.h:825
packet_diplomacy_accept_treaty
Definition packets_gen.h:828
packet_diplomacy_accept_treaty::I_accepted
bool I_accepted
Definition packets_gen.h:830
packet_diplomacy_accept_treaty::counterpart
int counterpart
Definition packets_gen.h:829
packet_diplomacy_accept_treaty::other_accepted
bool other_accepted
Definition packets_gen.h:831
packet_diplomacy_cancel_meeting_req
Definition packets_gen.h:787
packet_diplomacy_cancel_meeting_req::counterpart
int counterpart
Definition packets_gen.h:788
packet_diplomacy_cancel_meeting
Definition packets_gen.h:791
packet_diplomacy_cancel_meeting::counterpart
int counterpart
Definition packets_gen.h:792
packet_diplomacy_cancel_meeting::initiated_from
int initiated_from
Definition packets_gen.h:793
packet_diplomacy_cancel_pact
Definition packets_gen.h:834
packet_diplomacy_cancel_pact::other_player_id
int other_player_id
Definition packets_gen.h:835
packet_diplomacy_cancel_pact::clause
enum clause_type clause
Definition packets_gen.h:836
packet_diplomacy_create_clause_req
Definition packets_gen.h:796
packet_diplomacy_create_clause_req::value
int value
Definition packets_gen.h:800
packet_diplomacy_create_clause_req::giver
int giver
Definition packets_gen.h:798
packet_diplomacy_create_clause_req::counterpart
int counterpart
Definition packets_gen.h:797
packet_diplomacy_create_clause_req::type
enum clause_type type
Definition packets_gen.h:799
packet_diplomacy_create_clause
Definition packets_gen.h:803
packet_diplomacy_create_clause::giver
int giver
Definition packets_gen.h:805
packet_diplomacy_create_clause::type
enum clause_type type
Definition packets_gen.h:806
packet_diplomacy_create_clause::counterpart
int counterpart
Definition packets_gen.h:804
packet_diplomacy_create_clause::value
int value
Definition packets_gen.h:807
packet_diplomacy_init_meeting_req
Definition packets_gen.h:778
packet_diplomacy_init_meeting_req::counterpart
int counterpart
Definition packets_gen.h:779
packet_diplomacy_init_meeting
Definition packets_gen.h:782
packet_diplomacy_init_meeting::initiated_from
int initiated_from
Definition packets_gen.h:784
packet_diplomacy_init_meeting::counterpart
int counterpart
Definition packets_gen.h:783
packet_diplomacy_remove_clause_req
Definition packets_gen.h:810
packet_diplomacy_remove_clause_req::type
enum clause_type type
Definition packets_gen.h:813
packet_diplomacy_remove_clause_req::giver
int giver
Definition packets_gen.h:812
packet_diplomacy_remove_clause_req::counterpart
int counterpart
Definition packets_gen.h:811
packet_diplomacy_remove_clause_req::value
int value
Definition packets_gen.h:814
packet_diplomacy_remove_clause
Definition packets_gen.h:817
packet_diplomacy_remove_clause::counterpart
int counterpart
Definition packets_gen.h:818
packet_diplomacy_remove_clause::value
int value
Definition packets_gen.h:821
packet_diplomacy_remove_clause::giver
int giver
Definition packets_gen.h:819
packet_diplomacy_remove_clause::type
enum clause_type type
Definition packets_gen.h:820
packet_early_chat_msg
Definition packets_gen.h:307
packet_early_chat_msg::event
enum event_type event
Definition packets_gen.h:310
packet_early_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:308
packet_early_chat_msg::phase
int phase
Definition packets_gen.h:312
packet_early_chat_msg::conn_id
int conn_id
Definition packets_gen.h:313
packet_early_chat_msg::turn
int turn
Definition packets_gen.h:311
packet_early_chat_msg::tile
int tile
Definition packets_gen.h:309
packet_edit_check_tiles
Definition packets_gen.h:1675
packet_edit_city_create
Definition packets_gen.h:1758
packet_edit_city_create::size
int size
Definition packets_gen.h:1761
packet_edit_city_create::tag
int tag
Definition packets_gen.h:1762
packet_edit_city_create::owner
int owner
Definition packets_gen.h:1759
packet_edit_city_create::tile
int tile
Definition packets_gen.h:1760
packet_edit_city_remove
Definition packets_gen.h:1765
packet_edit_city_remove::id
int id
Definition packets_gen.h:1766
packet_edit_city
Definition packets_gen.h:1769
packet_edit_city::turn_founded
int turn_founded
Definition packets_gen.h:1793
packet_edit_city::turn_last_built
int turn_last_built
Definition packets_gen.h:1794
packet_edit_city::production_value
int production_value
Definition packets_gen.h:1797
packet_edit_city::specialists_size
int specialists_size
Definition packets_gen.h:1780
packet_edit_city::ppl_content
int ppl_content[5]
Definition packets_gen.h:1777
packet_edit_city::shield_stock
int shield_stock
Definition packets_gen.h:1783
packet_edit_city::specialists
int specialists[SP_MAX]
Definition packets_gen.h:1781
packet_edit_city::built
int built[B_LAST]
Definition packets_gen.h:1795
packet_edit_city::steal
int steal
Definition packets_gen.h:1792
packet_edit_city::ppl_angry
int ppl_angry[5]
Definition packets_gen.h:1779
packet_edit_city::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:1771
packet_edit_city::ppl_happy
int ppl_happy[5]
Definition packets_gen.h:1776
packet_edit_city::was_happy
bool was_happy
Definition packets_gen.h:1788
packet_edit_city::anarchy
int anarchy
Definition packets_gen.h:1790
packet_edit_city::production_kind
int production_kind
Definition packets_gen.h:1796
packet_edit_city::did_sell
bool did_sell
Definition packets_gen.h:1787
packet_edit_city::debug
bool debug
Definition packets_gen.h:1785
packet_edit_city::did_buy
bool did_buy
Definition packets_gen.h:1786
packet_edit_city::history
int history
Definition packets_gen.h:1775
packet_edit_city::rapture
int rapture
Definition packets_gen.h:1791
packet_edit_city::original
int original
Definition packets_gen.h:1773
packet_edit_city::airlift
bool airlift
Definition packets_gen.h:1784
packet_edit_city::food_stock
int food_stock
Definition packets_gen.h:1782
packet_edit_city::had_famine
bool had_famine
Definition packets_gen.h:1789
packet_edit_city::city_options
bv_city_options city_options
Definition packets_gen.h:1798
packet_edit_city::owner
int owner
Definition packets_gen.h:1772
packet_edit_city::ppl_unhappy
int ppl_unhappy[5]
Definition packets_gen.h:1778
packet_edit_city::size
int size
Definition packets_gen.h:1774
packet_edit_city::id
int id
Definition packets_gen.h:1770
packet_edit_game
Definition packets_gen.h:1845
packet_edit_game::ruleset_locked
bool ruleset_locked
Definition packets_gen.h:1854
packet_edit_game::scenario_players
bool scenario_players
Definition packets_gen.h:1850
packet_edit_game::lake_flooding
bool lake_flooding
Definition packets_gen.h:1853
packet_edit_game::startpos_nations
bool startpos_nations
Definition packets_gen.h:1851
packet_edit_game::scenario_name
char scenario_name[256]
Definition packets_gen.h:1847
packet_edit_game::prevent_new_cities
bool prevent_new_cities
Definition packets_gen.h:1852
packet_edit_game::scenario
bool scenario
Definition packets_gen.h:1846
packet_edit_game::scenario_authors
char scenario_authors[MAX_LEN_PACKET/3]
Definition packets_gen.h:1848
packet_edit_game::scenario_random
bool scenario_random
Definition packets_gen.h:1849
packet_edit_mode
Definition packets_gen.h:1667
packet_edit_mode::state
bool state
Definition packets_gen.h:1668
packet_edit_object_created
Definition packets_gen.h:1861
packet_edit_object_created::id
int id
Definition packets_gen.h:1863
packet_edit_object_created::tag
int tag
Definition packets_gen.h:1862
packet_edit_player_create
Definition packets_gen.h:1801
packet_edit_player_create::tag
int tag
Definition packets_gen.h:1802
packet_edit_player_remove
Definition packets_gen.h:1805
packet_edit_player_remove::id
int id
Definition packets_gen.h:1806
packet_edit_player_vision
Definition packets_gen.h:1838
packet_edit_player_vision::tile
int tile
Definition packets_gen.h:1840
packet_edit_player_vision::known
bool known
Definition packets_gen.h:1841
packet_edit_player_vision::player
int player
Definition packets_gen.h:1839
packet_edit_player_vision::size
int size
Definition packets_gen.h:1842
packet_edit_player
Definition packets_gen.h:1809
packet_edit_player::ranked_username
char ranked_username[MAX_LEN_NAME]
Definition packets_gen.h:1813
packet_edit_player::gold
int gold
Definition packets_gen.h:1826
packet_edit_player::team
int team
Definition packets_gen.h:1819
packet_edit_player::scenario_reserved
bool scenario_reserved
Definition packets_gen.h:1835
packet_edit_player::nation
Nation_type_id nation
Definition packets_gen.h:1818
packet_edit_player::user_turns
int user_turns
Definition packets_gen.h:1814
packet_edit_player::tax
int tax
Definition packets_gen.h:1827
packet_edit_player::ai
bool ai
Definition packets_gen.h:1834
packet_edit_player::luxury
int luxury
Definition packets_gen.h:1829
packet_edit_player::nturns_idle
int nturns_idle
Definition packets_gen.h:1821
packet_edit_player::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:1812
packet_edit_player::revolution_finishes
int revolution_finishes
Definition packets_gen.h:1823
packet_edit_player::is_male
bool is_male
Definition packets_gen.h:1815
packet_edit_player::science
int science
Definition packets_gen.h:1828
packet_edit_player::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1811
packet_edit_player::embassy
bv_player embassy
Definition packets_gen.h:1825
packet_edit_player::phase_done
bool phase_done
Definition packets_gen.h:1820
packet_edit_player::autoselect_weight
int autoselect_weight
Definition packets_gen.h:1824
packet_edit_player::id
int id
Definition packets_gen.h:1810
packet_edit_player::government
Government_type_id government
Definition packets_gen.h:1816
packet_edit_player::inventions
bool inventions[A_LAST+1]
Definition packets_gen.h:1833
packet_edit_player::bulbs_researched
int bulbs_researched
Definition packets_gen.h:1832
packet_edit_player::is_alive
bool is_alive
Definition packets_gen.h:1822
packet_edit_player::researching
int researching
Definition packets_gen.h:1831
packet_edit_player::future_tech
int future_tech
Definition packets_gen.h:1830
packet_edit_player::target_government
Government_type_id target_government
Definition packets_gen.h:1817
packet_edit_recalculate_borders
Definition packets_gen.h:1671
packet_edit_scenario_desc
Definition packets_gen.h:1857
packet_edit_scenario_desc::scenario_desc
char scenario_desc[MAX_LEN_CONTENT]
Definition packets_gen.h:1858
packet_edit_startpos_full
Definition packets_gen.h:1703
packet_edit_startpos_full::nations
bv_startpos_nations nations
Definition packets_gen.h:1706
packet_edit_startpos
Definition packets_gen.h:1697
packet_edit_startpos::removal
bool removal
Definition packets_gen.h:1699
packet_edit_startpos::tag
int tag
Definition packets_gen.h:1700
packet_edit_startpos::id
int id
Definition packets_gen.h:1698
packet_edit_tile_extra
Definition packets_gen.h:1689
packet_edit_tile_extra::tile
int tile
Definition packets_gen.h:1690
packet_edit_tile_extra::extra_type_id
int extra_type_id
Definition packets_gen.h:1691
packet_edit_tile_extra::removal
bool removal
Definition packets_gen.h:1692
packet_edit_tile_extra::size
int size
Definition packets_gen.h:1694
packet_edit_tile_extra::eowner
int eowner
Definition packets_gen.h:1693
packet_edit_tile_terrain
Definition packets_gen.h:1683
packet_edit_tile_terrain::size
int size
Definition packets_gen.h:1686
packet_edit_tile_terrain::tile
int tile
Definition packets_gen.h:1684
packet_edit_tile_terrain::terrain
Terrain_type_id terrain
Definition packets_gen.h:1685
packet_edit_tile
Definition packets_gen.h:1709
packet_edit_tile::resource
Resource_type_id resource
Definition packets_gen.h:1712
packet_edit_tile::startpos_nation
Nation_type_id startpos_nation
Definition packets_gen.h:1714
packet_edit_tile::eowner
int eowner
Definition packets_gen.h:1715
packet_edit_tile::label
char label[MAX_LEN_NAME]
Definition packets_gen.h:1716
packet_edit_tile::extras
bv_extras extras
Definition packets_gen.h:1711
packet_edit_tile::tile
int tile
Definition packets_gen.h:1710
packet_edit_tile::terrain
Terrain_type_id terrain
Definition packets_gen.h:1713
packet_edit_toggle_fogofwar
Definition packets_gen.h:1679
packet_edit_toggle_fogofwar::player
int player
Definition packets_gen.h:1680
packet_edit_unit_create
Definition packets_gen.h:1719
packet_edit_unit_create::tag
int tag
Definition packets_gen.h:1724
packet_edit_unit_create::count
int count
Definition packets_gen.h:1723
packet_edit_unit_create::type
Unit_type_id type
Definition packets_gen.h:1722
packet_edit_unit_create::tile
int tile
Definition packets_gen.h:1721
packet_edit_unit_create::owner
int owner
Definition packets_gen.h:1720
packet_edit_unit_remove_by_id
Definition packets_gen.h:1734
packet_edit_unit_remove_by_id::id
int id
Definition packets_gen.h:1735
packet_edit_unit_remove
Definition packets_gen.h:1727
packet_edit_unit_remove::count
int count
Definition packets_gen.h:1731
packet_edit_unit_remove::tile
int tile
Definition packets_gen.h:1729
packet_edit_unit_remove::owner
int owner
Definition packets_gen.h:1728
packet_edit_unit_remove::type
Unit_type_id type
Definition packets_gen.h:1730
packet_edit_unit
Definition packets_gen.h:1738
packet_edit_unit::owner
int owner
Definition packets_gen.h:1741
packet_edit_unit::activity_count
int activity_count
Definition packets_gen.h:1748
packet_edit_unit::stay
bool stay
Definition packets_gen.h:1755
packet_edit_unit::moved
bool moved
Definition packets_gen.h:1751
packet_edit_unit::transported_by
int transported_by
Definition packets_gen.h:1754
packet_edit_unit::debug
bool debug
Definition packets_gen.h:1750
packet_edit_unit::paradropped
bool paradropped
Definition packets_gen.h:1752
packet_edit_unit::done_moving
bool done_moving
Definition packets_gen.h:1753
packet_edit_unit::homecity
int homecity
Definition packets_gen.h:1742
packet_edit_unit::moves_left
int moves_left
Definition packets_gen.h:1743
packet_edit_unit::id
int id
Definition packets_gen.h:1739
packet_edit_unit::hp
int hp
Definition packets_gen.h:1744
packet_edit_unit::utype
Unit_type_id utype
Definition packets_gen.h:1740
packet_edit_unit::activity
enum unit_activity activity
Definition packets_gen.h:1747
packet_edit_unit::fuel
int fuel
Definition packets_gen.h:1746
packet_edit_unit::veteran
int veteran
Definition packets_gen.h:1745
packet_edit_unit::activity_base
Base_type_id activity_base
Definition packets_gen.h:1749
packet_end_phase
Definition packets_gen.h:891
packet_end_turn
Definition packets_gen.h:909
packet_endgame_player
Definition packets_gen.h:95
packet_endgame_report
Definition packets_gen.h:89
packet_freeze_client
Definition packets_gen.h:913
packet_game_info
Definition packets_gen.h:120
packet_game_info::tech_steal_allow_holes
bool tech_steal_allow_holes
Definition packets_gen.h:217
packet_game_info::coolinglevel
int coolinglevel
Definition packets_gen.h:153
packet_game_info::min_trade_route_val
int min_trade_route_val
Definition packets_gen.h:164
packet_game_info::shieldbox
int shieldbox
Definition packets_gen.h:227
packet_game_info::illness_trade_infection
int illness_trade_infection
Definition packets_gen.h:189
packet_game_info::fulltradesize
int fulltradesize
Definition packets_gen.h:162
packet_game_info::gameloss_style
enum gameloss_style gameloss_style
Definition packets_gen.h:238
packet_game_info::history_interest_pml
int history_interest_pml
Definition packets_gen.h:141
packet_game_info::citizen_partisans_pct
int citizen_partisans_pct
Definition packets_gen.h:150
packet_game_info::restrictinfra
bool restrictinfra
Definition packets_gen.h:224
packet_game_info::celebratesize
int celebratesize
Definition packets_gen.h:143
packet_game_info::goods_selection
enum goods_selection_method goods_selection
Definition packets_gen.h:166
packet_game_info::borders
enum borders_mode borders
Definition packets_gen.h:135
packet_game_info::team_pooled_research
bool team_pooled_research
Definition packets_gen.h:230
packet_game_info::illness_base_factor
int illness_base_factor
Definition packets_gen.h:185
packet_game_info::illness_min_size
int illness_min_size
Definition packets_gen.h:186
packet_game_info::aifill
int aifill
Definition packets_gen.h:122
packet_game_info::happyborders
enum happyborders_type happyborders
Definition packets_gen.h:183
packet_game_info::add_to_size_limit
int add_to_size_limit
Definition packets_gen.h:121
packet_game_info::forced_science
int forced_science
Definition packets_gen.h:161
packet_game_info::disasters
int disasters
Definition packets_gen.h:223
packet_game_info::trading_city
bool trading_city
Definition packets_gen.h:244
packet_game_info::granary_num_inis
int granary_num_inis
Definition packets_gen.h:180
packet_game_info::government_during_revolution_id
Government_type_id government_during_revolution_id
Definition packets_gen.h:177
packet_game_info::first_timeout
int first_timeout
Definition packets_gen.h:240
packet_game_info::globalwarming
int globalwarming
Definition packets_gen.h:170
packet_game_info::gold_upkeep_style
enum gold_upkeep_style gold_upkeep_style
Definition packets_gen.h:172
packet_game_info::pop_report_zeroes
int pop_report_zeroes
Definition packets_gen.h:145
packet_game_info::nuclearwinter
int nuclearwinter
Definition packets_gen.h:211
packet_game_info::killstack
bool killstack
Definition packets_gen.h:194
packet_game_info::damage_reduces_bombard_rate
bool damage_reduces_bombard_rate
Definition packets_gen.h:198
packet_game_info::techloss_forgiveness
int techloss_forgiveness
Definition packets_gen.h:236
packet_game_info::citizen_nationality
bool citizen_nationality
Definition packets_gen.h:146
packet_game_info::nuke_pop_loss_pct
int nuke_pop_loss_pct
Definition packets_gen.h:203
packet_game_info::nuke_defender_survival_chance_pct
int nuke_defender_survival_chance_pct
Definition packets_gen.h:204
packet_game_info::angrycitizen
int angrycitizen
Definition packets_gen.h:127
packet_game_info::granary_food_inc
int granary_food_inc
Definition packets_gen.h:178
packet_game_info::tech_upkeep_style
enum tech_upkeep_style tech_upkeep_style
Definition packets_gen.h:235
packet_game_info::notradesize
int notradesize
Definition packets_gen.h:209
packet_game_info::tech_trade_loss_allow_holes
bool tech_trade_loss_allow_holes
Definition packets_gen.h:219
packet_game_info::granary_food_ini
int granary_food_ini[MAX_GRANARY_INIS]
Definition packets_gen.h:179
packet_game_info::culture_vic_lead
int culture_vic_lead
Definition packets_gen.h:139
packet_game_info::diplomacy
enum diplomacy_mode diplomacy
Definition packets_gen.h:155
packet_game_info::trading_gold
bool trading_gold
Definition packets_gen.h:245
packet_game_info::trade_world_rel_pct
int trade_world_rel_pct
Definition packets_gen.h:163
packet_game_info::free_tech_method
enum free_tech_method free_tech_method
Definition packets_gen.h:237
packet_game_info::changable_tax
bool changable_tax
Definition packets_gen.h:144
packet_game_info::rapturedelay
int rapturedelay
Definition packets_gen.h:222
packet_game_info::tech_leak_pct
int tech_leak_pct
Definition packets_gen.h:131
packet_game_info::steal_maps_reveals_all_cities
bool steal_maps_reveals_all_cities
Definition packets_gen.h:215
packet_game_info::init_city_radius_sq
int init_city_radius_sq
Definition packets_gen.h:190
packet_game_info::granularity
int granularity
Definition packets_gen.h:256
packet_game_info::conquest_convert_pct
int conquest_convert_pct
Definition packets_gen.h:149
packet_game_info::trade_revenue_style
enum trade_revenue_style trade_revenue_style
Definition packets_gen.h:243
packet_game_info::muuk_food_wipe
bool muuk_food_wipe
Definition packets_gen.h:206
packet_game_info::homeless_gold_upkeep
bool homeless_gold_upkeep
Definition packets_gen.h:173
packet_game_info::tired_attack
bool tired_attack
Definition packets_gen.h:241
packet_game_info::only_real_fight_makes_veteran
bool only_real_fight_makes_veteran
Definition packets_gen.h:196
packet_game_info::year_0_hack
bool year_0_hack
Definition packets_gen.h:250
packet_game_info::great_wonder_owners
int great_wonder_owners[B_LAST]
Definition packets_gen.h:181
packet_game_info::cooling
int cooling
Definition packets_gen.h:152
packet_game_info::low_firepower_pearl_harbour
int low_firepower_pearl_harbour
Definition packets_gen.h:200
packet_game_info::base_pollution
int base_pollution
Definition packets_gen.h:128
packet_game_info::is_edit_mode
bool is_edit_mode
Definition packets_gen.h:191
packet_game_info::trading_tech
bool trading_tech
Definition packets_gen.h:246
packet_game_info::citizen_convert_speed
int citizen_convert_speed
Definition packets_gen.h:148
packet_game_info::forced_gold
int forced_gold
Definition packets_gen.h:159
packet_game_info::global_advances
bool global_advances[A_LAST]
Definition packets_gen.h:168
packet_game_info::illness_pollution_factor
int illness_pollution_factor
Definition packets_gen.h:188
packet_game_info::is_new_game
bool is_new_game
Definition packets_gen.h:192
packet_game_info::fragment_count
int fragment_count
Definition packets_gen.h:252
packet_game_info::infrapoints
int infrapoints
Definition packets_gen.h:174
packet_game_info::base_tech_cost
int base_tech_cost
Definition packets_gen.h:129
packet_game_info::warminglevel
int warminglevel
Definition packets_gen.h:248
packet_game_info::airlifting_style
enum airlifting_style airlifting_style
Definition packets_gen.h:124
packet_game_info::happy_cost
int happy_cost
Definition packets_gen.h:182
packet_game_info::civil_war_enabled
bool civil_war_enabled
Definition packets_gen.h:253
packet_game_info::muuk_gold_wipe
bool muuk_gold_wipe
Definition packets_gen.h:207
packet_game_info::food_cost
int food_cost
Definition packets_gen.h:157
packet_game_info::tech_leakage
enum tech_leakage_style tech_leakage
Definition packets_gen.h:233
packet_game_info::world_peace_turns
int world_peace_turns
Definition packets_gen.h:142
packet_game_info::skill_level
enum ai_level skill_level
Definition packets_gen.h:228
packet_game_info::revolentype
enum revolen_type revolentype
Definition packets_gen.h:175
packet_game_info::gold
int gold
Definition packets_gen.h:171
packet_game_info::phase_mode
enum phase_mode_type phase_mode
Definition packets_gen.h:213
packet_game_info::reveal_trade_partner
bool reveal_trade_partner
Definition packets_gen.h:165
packet_game_info::airlift_from_always_enabled
bool airlift_from_always_enabled
Definition packets_gen.h:125
packet_game_info::caravan_bonus_style
enum caravan_bonus_style caravan_bonus_style
Definition packets_gen.h:137
packet_game_info::min_tech_cost
int min_tech_cost
Definition packets_gen.h:130
packet_game_info::tech
int tech
Definition packets_gen.h:231
packet_game_info::illness_on
bool illness_on
Definition packets_gen.h:187
packet_game_info::civil_war_bonus_unhappy
int civil_war_bonus_unhappy
Definition packets_gen.h:255
packet_game_info::only_killing_makes_veteran
bool only_killing_makes_veteran
Definition packets_gen.h:195
packet_game_info::poison_empties_food_stock
bool poison_empties_food_stock
Definition packets_gen.h:216
packet_game_info::tech_loss_allow_holes
bool tech_loss_allow_holes
Definition packets_gen.h:221
packet_game_info::diplchance_initial_odds
bv_actions diplchance_initial_odds
Definition packets_gen.h:154
packet_game_info::tech_trade_allow_holes
bool tech_trade_allow_holes
Definition packets_gen.h:218
packet_game_info::heating
int heating
Definition packets_gen.h:184
packet_game_info::turn
int turn
Definition packets_gen.h:247
packet_game_info::low_firepower_nonnat_bombard
int low_firepower_nonnat_bombard
Definition packets_gen.h:202
packet_game_info::year
int year
Definition packets_gen.h:249
packet_game_info::border_size_effect
int border_size_effect
Definition packets_gen.h:133
packet_game_info::tech_upkeep_divider
int tech_upkeep_divider
Definition packets_gen.h:234
packet_game_info::sciencebox
int sciencebox
Definition packets_gen.h:226
packet_game_info::pillage_select
bool pillage_select
Definition packets_gen.h:214
packet_game_info::top_cities_count
int top_cities_count
Definition packets_gen.h:251
packet_game_info::phase
int phase
Definition packets_gen.h:212
packet_game_info::tech_parasite_allow_holes
bool tech_parasite_allow_holes
Definition packets_gen.h:220
packet_game_info::muuk_shield_wipe
bool muuk_shield_wipe
Definition packets_gen.h:208
packet_game_info::base_bribe_cost
int base_bribe_cost
Definition packets_gen.h:136
packet_game_info::trademindist
int trademindist
Definition packets_gen.h:242
packet_game_info::nuclear_winter
bool nuclear_winter
Definition packets_gen.h:210
packet_game_info::low_firepower_combat_bonus
int low_firepower_combat_bonus
Definition packets_gen.h:201
packet_game_info::culture_migration_pml
int culture_migration_pml
Definition packets_gen.h:140
packet_game_info::border_city_permanent_radius_sq
int border_city_permanent_radius_sq
Definition packets_gen.h:134
packet_game_info::unreachable_protects
bool unreachable_protects
Definition packets_gen.h:225
packet_game_info::culture_vic_points
int culture_vic_points
Definition packets_gen.h:138
packet_game_info::persistent_ready
enum persistent_ready persistent_ready
Definition packets_gen.h:123
packet_game_info::low_firepower_badwallattacker
int low_firepower_badwallattacker
Definition packets_gen.h:199
packet_game_info::airlift_to_always_enabled
bool airlift_to_always_enabled
Definition packets_gen.h:126
packet_game_info::fogofwar
bool fogofwar
Definition packets_gen.h:156
packet_game_info::small_wonder_visibility
enum wonder_visib_type small_wonder_visibility
Definition packets_gen.h:257
packet_game_info::tech_cost_style
enum tech_cost_style tech_cost_style
Definition packets_gen.h:232
packet_game_info::foodbox
int foodbox
Definition packets_gen.h:158
packet_game_info::combat_odds_scaled_veterancy
bool combat_odds_scaled_veterancy
Definition packets_gen.h:197
packet_game_info::unit_builders_nationality
bool unit_builders_nationality
Definition packets_gen.h:147
packet_game_info::victory_conditions
enum victory_condition_type victory_conditions
Definition packets_gen.h:229
packet_game_info::civil_war_bonus_celebrating
int civil_war_bonus_celebrating
Definition packets_gen.h:254
packet_game_info::border_city_radius_sq
int border_city_radius_sq
Definition packets_gen.h:132
packet_game_info::global_warming
bool global_warming
Definition packets_gen.h:169
packet_game_info::citymindist
int citymindist
Definition packets_gen.h:151
packet_game_info::default_government_id
Government_type_id default_government_id
Definition packets_gen.h:176
packet_game_info::forced_luxury
int forced_luxury
Definition packets_gen.h:160
packet_game_info::global_advance_count
int global_advance_count
Definition packets_gen.h:167
packet_game_info::min_city_center_output
int min_city_center_output[O_LAST]
Definition packets_gen.h:205
packet_game_info::killcitizen
bool killcitizen
Definition packets_gen.h:193
packet_game_info::timeout
int timeout
Definition packets_gen.h:239
packet_game_load
Definition packets_gen.h:1516
packet_game_load::load_successful
bool load_successful
Definition packets_gen.h:1517
packet_game_load::load_filename
char load_filename[MAX_LEN_PACKET]
Definition packets_gen.h:1518
packet_handlers
Definition packets.h:74
packet_investigate_finished
Definition packets_gen.h:41
packet_investigate_finished::city_id
int city_id
Definition packets_gen.h:43
packet_investigate_finished::unit_id
int unit_id
Definition packets_gen.h:42
packet_investigate_started
Definition packets_gen.h:36
packet_investigate_started::city_id
int city_id
Definition packets_gen.h:38
packet_investigate_started::unit_id
int unit_id
Definition packets_gen.h:37
packet_map_info
Definition packets_gen.h:273
packet_map_info::wrap_id
int wrap_id
Definition packets_gen.h:277
packet_map_info::south_latitude
int south_latitude
Definition packets_gen.h:279
packet_map_info::ysize
int ysize
Definition packets_gen.h:275
packet_map_info::topology_id
int topology_id
Definition packets_gen.h:276
packet_map_info::xsize
int xsize
Definition packets_gen.h:274
packet_map_info::north_latitude
int north_latitude
Definition packets_gen.h:278
packet_map_info::altitude_info
bool altitude_info
Definition packets_gen.h:280
packet_nation_availability
Definition packets_gen.h:1159
packet_nation_availability::ncount
int ncount
Definition packets_gen.h:1160
packet_nation_availability::is_pickable
bool is_pickable[MAX_NUM_NATIONS]
Definition packets_gen.h:1161
packet_nation_availability::nationset_change
bool nationset_change
Definition packets_gen.h:1162
packet_nation_select_req
Definition packets_gen.h:76
packet_nation_select_req::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:80
packet_nation_select_req::nation_no
Nation_type_id nation_no
Definition packets_gen.h:78
packet_nation_select_req::player_no
int player_no
Definition packets_gen.h:77
packet_nation_select_req::is_male
bool is_male
Definition packets_gen.h:79
packet_nation_select_req::style
int style
Definition packets_gen.h:81
packet_new_year
Definition packets_gen.h:899
packet_new_year::year
int year
Definition packets_gen.h:900
packet_new_year::turn
int turn
Definition packets_gen.h:902
packet_new_year::fragments
int fragments
Definition packets_gen.h:901
packet_nuke_tile_info
Definition packets_gen.h:283
packet_nuke_tile_info::tile
int tile
Definition packets_gen.h:284
packet_page_msg_part
Definition packets_gen.h:847
packet_page_msg_part::lines
char lines[MAX_LEN_CONTENT]
Definition packets_gen.h:848
packet_page_msg
Definition packets_gen.h:839
packet_page_msg::event
enum event_type event
Definition packets_gen.h:842
packet_page_msg::headline
char headline[MAX_LEN_MSG]
Definition packets_gen.h:841
packet_page_msg::parts
int parts
Definition packets_gen.h:844
packet_page_msg::caption
char caption[MAX_LEN_MSG]
Definition packets_gen.h:840
packet_page_msg::len
int len
Definition packets_gen.h:843
packet_play_music
Definition packets_gen.h:1866
packet_play_music::tag
char tag[MAX_LEN_NAME]
Definition packets_gen.h:1867
packet_player_attribute_block
Definition packets_gen.h:585
packet_player_attribute_chunk
Definition packets_gen.h:589
packet_player_attribute_chunk::chunk_length
int chunk_length
Definition packets_gen.h:592
packet_player_attribute_chunk::data
unsigned char data[ATTRIBUTE_CHUNK_SIZE]
Definition packets_gen.h:593
packet_player_attribute_chunk::total_length
int total_length
Definition packets_gen.h:591
packet_player_attribute_chunk::offset
int offset
Definition packets_gen.h:590
packet_player_change_government
Definition packets_gen.h:576
packet_player_change_government::government
Government_type_id government
Definition packets_gen.h:577
packet_player_diplstate
Definition packets_gen.h:596
packet_player_diplstate::plr1
int plr1
Definition packets_gen.h:598
packet_player_diplstate::diplstate_id
int diplstate_id
Definition packets_gen.h:597
packet_player_diplstate::type
enum diplstate_type type
Definition packets_gen.h:600
packet_player_diplstate::has_reason_to_cancel
int has_reason_to_cancel
Definition packets_gen.h:602
packet_player_diplstate::turns_left
int turns_left
Definition packets_gen.h:601
packet_player_diplstate::plr2
int plr2
Definition packets_gen.h:599
packet_player_diplstate::contact_turns_left
int contact_turns_left
Definition packets_gen.h:603
packet_player_info
Definition packets_gen.h:515
packet_player_info::ai_skill_level
enum ai_level ai_skill_level
Definition packets_gen.h:546
packet_player_info::phase_done
bool phase_done
Definition packets_gen.h:532
packet_player_info::is_alive
bool is_alive
Definition packets_gen.h:535
packet_player_info::is_male
bool is_male
Definition packets_gen.h:521
packet_player_info::luxury
int luxury
Definition packets_gen.h:540
packet_player_info::turns_alive
int turns_alive
Definition packets_gen.h:534
packet_player_info::color_red
int color_red
Definition packets_gen.h:555
packet_player_info::is_ready
bool is_ready
Definition packets_gen.h:531
packet_player_info::multiplier
int multiplier[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:561
packet_player_info::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:518
packet_player_info::tech_upkeep
int tech_upkeep
Definition packets_gen.h:542
packet_player_info::style
int style
Definition packets_gen.h:527
packet_player_info::culture
int culture
Definition packets_gen.h:551
packet_player_info::flags
bv_plr_flags flags
Definition packets_gen.h:558
packet_player_info::mood
enum mood_type mood
Definition packets_gen.h:526
packet_player_info::color_green
int color_green
Definition packets_gen.h:556
packet_player_info::color_valid
bool color_valid
Definition packets_gen.h:553
packet_player_info::gives_shared_vision
bv_player gives_shared_vision
Definition packets_gen.h:548
packet_player_info::team
int team
Definition packets_gen.h:530
packet_player_info::love
int love[MAX_NUM_PLAYER_SLOTS]
Definition packets_gen.h:552
packet_player_info::autoselect_weight
int autoselect_weight
Definition packets_gen.h:536
packet_player_info::was_created
bool was_created
Definition packets_gen.h:522
packet_player_info::target_government
Government_type_id target_government
Definition packets_gen.h:524
packet_player_info::multiplier_target
int multiplier_target[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:562
packet_player_info::is_connected
bool is_connected
Definition packets_gen.h:544
packet_player_info::unassigned_user
bool unassigned_user
Definition packets_gen.h:519
packet_player_info::multiplier_changed
int multiplier_changed[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:563
packet_player_info::gives_shared_tiles
bv_player gives_shared_tiles
Definition packets_gen.h:549
packet_player_info::nturns_idle
int nturns_idle
Definition packets_gen.h:533
packet_player_info::score
int score
Definition packets_gen.h:520
packet_player_info::multip_count
int multip_count
Definition packets_gen.h:560
packet_player_info::nation
Nation_type_id nation
Definition packets_gen.h:529
packet_player_info::science_cost
int science_cost
Definition packets_gen.h:543
packet_player_info::barbarian_type
enum barbarian_type barbarian_type
Definition packets_gen.h:547
packet_player_info::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:517
packet_player_info::government
Government_type_id government
Definition packets_gen.h:523
packet_player_info::real_embassy
bv_player real_embassy
Definition packets_gen.h:525
packet_player_info::wonders
int wonders[B_LAST]
Definition packets_gen.h:559
packet_player_info::tax
int tax
Definition packets_gen.h:538
packet_player_info::music_style
int music_style
Definition packets_gen.h:528
packet_player_info::history
int history
Definition packets_gen.h:550
packet_player_info::science
int science
Definition packets_gen.h:539
packet_player_info::gold
int gold
Definition packets_gen.h:537
packet_player_info::revolution_finishes
int revolution_finishes
Definition packets_gen.h:545
packet_player_info::color_changeable
bool color_changeable
Definition packets_gen.h:554
packet_player_info::color_blue
int color_blue
Definition packets_gen.h:557
packet_player_info::infrapoints
int infrapoints
Definition packets_gen.h:541
packet_player_info::playerno
int playerno
Definition packets_gen.h:516
packet_player_multiplier
Definition packets_gen.h:606
packet_player_multiplier::count
int count
Definition packets_gen.h:607
packet_player_multiplier::multipliers
int multipliers[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:608
packet_player_phase_done
Definition packets_gen.h:566
packet_player_phase_done::turn
int turn
Definition packets_gen.h:567
packet_player_place_infra
Definition packets_gen.h:580
packet_player_place_infra::tile
int tile
Definition packets_gen.h:581
packet_player_place_infra::extra
int extra
Definition packets_gen.h:582
packet_player_rates
Definition packets_gen.h:570
packet_player_rates::science
int science
Definition packets_gen.h:573
packet_player_rates::luxury
int luxury
Definition packets_gen.h:572
packet_player_rates::tax
int tax
Definition packets_gen.h:571
packet_player_ready
Definition packets_gen.h:84
packet_player_ready::player_no
int player_no
Definition packets_gen.h:85
packet_player_ready::is_ready
bool is_ready
Definition packets_gen.h:86
packet_player_remove
Definition packets_gen.h:511
packet_player_remove::playerno
int playerno
Definition packets_gen.h:512
packet_player_research
Definition packets_gen.h:627
packet_player_research::tech
int tech
Definition packets_gen.h:628
packet_player_tech_goal
Definition packets_gen.h:631
packet_player_tech_goal::tech
int tech
Definition packets_gen.h:632
packet_processing_finished
Definition packets_gen.h:32
packet_processing_started
Definition packets_gen.h:28
packet_report_req
Definition packets_gen.h:851
packet_report_req::type
enum report_type type
Definition packets_gen.h:852
packet_research_info
Definition packets_gen.h:611
packet_research_info::tech_goal
int tech_goal
Definition packets_gen.h:618
packet_research_info::researching
int researching
Definition packets_gen.h:615
packet_research_info::inventions
char inventions[A_LAST+1]
Definition packets_gen.h:620
packet_research_info::techs_researched
int techs_researched
Definition packets_gen.h:613
packet_research_info::id
int id
Definition packets_gen.h:612
packet_research_info::future_tech
int future_tech
Definition packets_gen.h:614
packet_research_info::bulbs_researched
int bulbs_researched
Definition packets_gen.h:617
packet_research_info::researching_cost
int researching_cost
Definition packets_gen.h:616
packet_research_info::total_bulbs_prod
int total_bulbs_prod
Definition packets_gen.h:619
packet_ruleset_achievement
Definition packets_gen.h:1364
packet_ruleset_achievement::id
int id
Definition packets_gen.h:1365
packet_ruleset_achievement::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1367
packet_ruleset_achievement::unique
bool unique
Definition packets_gen.h:1369
packet_ruleset_achievement::value
int value
Definition packets_gen.h:1370
packet_ruleset_achievement::type
enum achievement_type type
Definition packets_gen.h:1368
packet_ruleset_achievement::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1366
packet_ruleset_action_auto
Definition packets_gen.h:1403
packet_ruleset_action_auto::id
int id
Definition packets_gen.h:1404
packet_ruleset_action_auto::alternatives
action_id alternatives[MAX_NUM_ACTIONS]
Definition packets_gen.h:1409
packet_ruleset_action_auto::reqs_count
int reqs_count
Definition packets_gen.h:1406
packet_ruleset_action_auto::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1407
packet_ruleset_action_auto::alternatives_count
int alternatives_count
Definition packets_gen.h:1408
packet_ruleset_action_auto::cause
enum action_auto_perf_cause cause
Definition packets_gen.h:1405
packet_ruleset_action_enabler
Definition packets_gen.h:1395
packet_ruleset_action_enabler::enabled_action
action_id enabled_action
Definition packets_gen.h:1396
packet_ruleset_action_enabler::actor_reqs_count
int actor_reqs_count
Definition packets_gen.h:1397
packet_ruleset_action_enabler::actor_reqs
struct requirement actor_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1398
packet_ruleset_action_enabler::target_reqs
struct requirement target_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1400
packet_ruleset_action_enabler::target_reqs_count
int target_reqs_count
Definition packets_gen.h:1399
packet_ruleset_action
Definition packets_gen.h:1380
packet_ruleset_action::quiet
bool quiet
Definition packets_gen.h:1383
packet_ruleset_action::sub_tgt_kind
enum action_sub_target_kind sub_tgt_kind
Definition packets_gen.h:1389
packet_ruleset_action::act_kind
enum action_actor_kind act_kind
Definition packets_gen.h:1387
packet_ruleset_action::actor_consuming_always
bool actor_consuming_always
Definition packets_gen.h:1386
packet_ruleset_action::blocked_by
bv_actions blocked_by
Definition packets_gen.h:1392
packet_ruleset_action::max_distance
int max_distance
Definition packets_gen.h:1391
packet_ruleset_action::id
action_id id
Definition packets_gen.h:1381
packet_ruleset_action::min_distance
int min_distance
Definition packets_gen.h:1390
packet_ruleset_action::sub_results
bv_action_sub_results sub_results
Definition packets_gen.h:1385
packet_ruleset_action::ui_name
char ui_name[MAX_LEN_NAME]
Definition packets_gen.h:1382
packet_ruleset_action::tgt_kind
enum action_target_kind tgt_kind
Definition packets_gen.h:1388
packet_ruleset_action::result
enum action_result result
Definition packets_gen.h:1384
packet_ruleset_base
Definition packets_gen.h:1317
packet_ruleset_base::vision_subs_sq
int vision_subs_sq
Definition packets_gen.h:1323
packet_ruleset_base::vision_invis_sq
int vision_invis_sq
Definition packets_gen.h:1322
packet_ruleset_base::border_sq
int border_sq
Definition packets_gen.h:1320
packet_ruleset_base::vision_main_sq
int vision_main_sq
Definition packets_gen.h:1321
packet_ruleset_base::gui_type
enum base_gui_type gui_type
Definition packets_gen.h:1319
packet_ruleset_base::id
int id
Definition packets_gen.h:1318
packet_ruleset_building
Definition packets_gen.h:1182
packet_ruleset_building::flags
bv_impr_flags flags
Definition packets_gen.h:1197
packet_ruleset_building::id
Impr_type_id id
Definition packets_gen.h:1183
packet_ruleset_building::helptext
struct strvec * helptext
Definition packets_gen.h:1201
packet_ruleset_building::build_cost
int build_cost
Definition packets_gen.h:1194
packet_ruleset_building::obs_reqs
struct requirement obs_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1193
packet_ruleset_building::upkeep
int upkeep
Definition packets_gen.h:1195
packet_ruleset_building::soundtag_alt
char soundtag_alt[MAX_LEN_NAME]
Definition packets_gen.h:1199
packet_ruleset_building::reqs_count
int reqs_count
Definition packets_gen.h:1190
packet_ruleset_building::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1191
packet_ruleset_building::genus
enum impr_genus_id genus
Definition packets_gen.h:1184
packet_ruleset_building::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1185
packet_ruleset_building::soundtag
char soundtag[MAX_LEN_NAME]
Definition packets_gen.h:1198
packet_ruleset_building::sabotage
int sabotage
Definition packets_gen.h:1196
packet_ruleset_building::soundtag_alt2
char soundtag_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1200
packet_ruleset_building::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1186
packet_ruleset_building::obs_count
int obs_count
Definition packets_gen.h:1192
packet_ruleset_building::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1189
packet_ruleset_building::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1187
packet_ruleset_building::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1188
packet_ruleset_choices
Definition packets_gen.h:1507
packet_ruleset_choices::ruleset_count
int ruleset_count
Definition packets_gen.h:1508
packet_ruleset_choices::rulesets
char rulesets[MAX_NUM_RULESETS][MAX_RULESET_NAME_LENGTH]
Definition packets_gen.h:1509
packet_ruleset_city
Definition packets_gen.h:1171
packet_ruleset_city::citizens_graphic
char citizens_graphic[MAX_LEN_NAME]
Definition packets_gen.h:1175
packet_ruleset_city::style_id
int style_id
Definition packets_gen.h:1172
packet_ruleset_city::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1173
packet_ruleset_city::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1174
packet_ruleset_city::reqs_count
int reqs_count
Definition packets_gen.h:1176
packet_ruleset_city::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1179
packet_ruleset_city::graphic
char graphic[MAX_LEN_NAME]
Definition packets_gen.h:1178
packet_ruleset_city::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1177
packet_ruleset_clause
Definition packets_gen.h:1446
packet_ruleset_clause::type
enum clause_type type
Definition packets_gen.h:1447
packet_ruleset_clause::either_reqs_count
int either_reqs_count
Definition packets_gen.h:1453
packet_ruleset_clause::either_reqs
struct requirement either_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1454
packet_ruleset_clause::receiver_reqs
struct requirement receiver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1452
packet_ruleset_clause::receiver_reqs_count
int receiver_reqs_count
Definition packets_gen.h:1451
packet_ruleset_clause::giver_reqs_count
int giver_reqs_count
Definition packets_gen.h:1449
packet_ruleset_clause::enabled
bool enabled
Definition packets_gen.h:1448
packet_ruleset_clause::giver_reqs
struct requirement giver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1450
packet_ruleset_control
Definition packets_gen.h:1457
packet_ruleset_control::num_goods_types
int num_goods_types
Definition packets_gen.h:1467
packet_ruleset_control::preferred_soundset
char preferred_soundset[MAX_LEN_NAME]
Definition packets_gen.h:1481
packet_ruleset_control::num_styles
int num_styles
Definition packets_gen.h:1471
packet_ruleset_control::num_extra_types
int num_extra_types
Definition packets_gen.h:1463
packet_ruleset_control::num_unit_types
int num_unit_types
Definition packets_gen.h:1459
packet_ruleset_control::version
char version[MAX_LEN_NAME]
Definition packets_gen.h:1485
packet_ruleset_control::num_impr_types
int num_impr_types
Definition packets_gen.h:1460
packet_ruleset_control::nation_count
int nation_count
Definition packets_gen.h:1474
packet_ruleset_control::num_road_types
int num_road_types
Definition packets_gen.h:1465
packet_ruleset_control::terrain_count
int terrain_count
Definition packets_gen.h:1476
packet_ruleset_control::preferred_tileset
char preferred_tileset[MAX_LEN_NAME]
Definition packets_gen.h:1480
packet_ruleset_control::popup_tech_help
bool popup_tech_help
Definition packets_gen.h:1483
packet_ruleset_control::num_music_styles
int num_music_styles
Definition packets_gen.h:1472
packet_ruleset_control::num_tech_types
int num_tech_types
Definition packets_gen.h:1462
packet_ruleset_control::government_count
int government_count
Definition packets_gen.h:1473
packet_ruleset_control::num_disaster_types
int num_disaster_types
Definition packets_gen.h:1468
packet_ruleset_control::alt_dir
char alt_dir[MAX_LEN_NAME]
Definition packets_gen.h:1486
packet_ruleset_control::num_achievement_types
int num_achievement_types
Definition packets_gen.h:1469
packet_ruleset_control::num_counters
int num_counters
Definition packets_gen.h:1488
packet_ruleset_control::num_specialist_types
int num_specialist_types
Definition packets_gen.h:1477
packet_ruleset_control::preferred_musicset
char preferred_musicset[MAX_LEN_NAME]
Definition packets_gen.h:1482
packet_ruleset_control::num_tech_classes
int num_tech_classes
Definition packets_gen.h:1461
packet_ruleset_control::num_unit_classes
int num_unit_classes
Definition packets_gen.h:1458
packet_ruleset_control::num_city_styles
int num_city_styles
Definition packets_gen.h:1475
packet_ruleset_control::num_resource_types
int num_resource_types
Definition packets_gen.h:1466
packet_ruleset_control::num_multipliers
int num_multipliers
Definition packets_gen.h:1470
packet_ruleset_control::num_nation_sets
int num_nation_sets
Definition packets_gen.h:1479
packet_ruleset_control::desc_length
int desc_length
Definition packets_gen.h:1487
packet_ruleset_control::num_nation_groups
int num_nation_groups
Definition packets_gen.h:1478
packet_ruleset_control::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1484
packet_ruleset_control::num_base_types
int num_base_types
Definition packets_gen.h:1464
packet_ruleset_counter
Definition packets_gen.h:1412
packet_ruleset_counter::checkpoint
int checkpoint
Definition packets_gen.h:1417
packet_ruleset_counter::behaviour
enum counter_behaviour behaviour
Definition packets_gen.h:1419
packet_ruleset_counter::type
enum counter_target type
Definition packets_gen.h:1418
packet_ruleset_counter::helptext
struct strvec * helptext
Definition packets_gen.h:1415
packet_ruleset_counter::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1413
packet_ruleset_counter::def
int def
Definition packets_gen.h:1416
packet_ruleset_counter::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1414
packet_ruleset_description_part
Definition packets_gen.h:1495
packet_ruleset_description_part::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1496
packet_ruleset_disaster
Definition packets_gen.h:1354
packet_ruleset_disaster::frequency
int frequency
Definition packets_gen.h:1360
packet_ruleset_disaster::id
int id
Definition packets_gen.h:1355
packet_ruleset_disaster::reqs_count
int reqs_count
Definition packets_gen.h:1358
packet_ruleset_disaster::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1357
packet_ruleset_disaster::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1359
packet_ruleset_disaster::effects
bv_disaster_effects effects
Definition packets_gen.h:1361
packet_ruleset_disaster::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1356
packet_ruleset_effect
Definition packets_gen.h:1598
packet_ruleset_effect::reqs_count
int reqs_count
Definition packets_gen.h:1603
packet_ruleset_effect::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1604
packet_ruleset_effect::multiplier
Multiplier_type_id multiplier
Definition packets_gen.h:1602
packet_ruleset_effect::effect_value
int effect_value
Definition packets_gen.h:1600
packet_ruleset_effect::has_multiplier
bool has_multiplier
Definition packets_gen.h:1601
packet_ruleset_effect::effect_type
enum effect_type effect_type
Definition packets_gen.h:1599
packet_ruleset_extra_flag
Definition packets_gen.h:1311
packet_ruleset_extra_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1314
packet_ruleset_extra_flag::id
int id
Definition packets_gen.h:1312
packet_ruleset_extra_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1313
packet_ruleset_extra
Definition packets_gen.h:1267
packet_ruleset_extra::id
int id
Definition packets_gen.h:1268
packet_ruleset_extra::removal_time
int removal_time
Definition packets_gen.h:1297
packet_ruleset_extra::defense_bonus
int defense_bonus
Definition packets_gen.h:1300
packet_ruleset_extra::infracost
int infracost
Definition packets_gen.h:1299
packet_ruleset_extra::native_to
bv_unit_classes native_to
Definition packets_gen.h:1302
packet_ruleset_extra::appearance_reqs_count
int appearance_reqs_count
Definition packets_gen.h:1287
packet_ruleset_extra::build_time_factor
int build_time_factor
Definition packets_gen.h:1296
packet_ruleset_extra::rmact_gfx_alt2
char rmact_gfx_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1279
packet_ruleset_extra::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1283
packet_ruleset_extra::generated
bool generated
Definition packets_gen.h:1294
packet_ruleset_extra::disappearance_reqs_count
int disappearance_reqs_count
Definition packets_gen.h:1290
packet_ruleset_extra::appearance_chance
int appearance_chance
Definition packets_gen.h:1286
packet_ruleset_extra::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1281
packet_ruleset_extra::rmcauses
bv_rmcauses rmcauses
Definition packets_gen.h:1273
packet_ruleset_extra::act_gfx_alt2
char act_gfx_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1276
packet_ruleset_extra::removal_time_factor
int removal_time_factor
Definition packets_gen.h:1298
packet_ruleset_extra::reqs_count
int reqs_count
Definition packets_gen.h:1282
packet_ruleset_extra::buildable
bool buildable
Definition packets_gen.h:1293
packet_ruleset_extra::disappearance_reqs
struct requirement disappearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1291
packet_ruleset_extra::flags
bv_extra_flags flags
Definition packets_gen.h:1303
packet_ruleset_extra::act_gfx_alt
char act_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1275
packet_ruleset_extra::hidden_by
bv_extras hidden_by
Definition packets_gen.h:1304
packet_ruleset_extra::activity_gfx
char activity_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1274
packet_ruleset_extra::build_time
int build_time
Definition packets_gen.h:1295
packet_ruleset_extra::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1270
packet_ruleset_extra::eus
enum extra_unit_seen_type eus
Definition packets_gen.h:1301
packet_ruleset_extra::appearance_reqs
struct requirement appearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1288
packet_ruleset_extra::category
int category
Definition packets_gen.h:1271
packet_ruleset_extra::disappearance_chance
int disappearance_chance
Definition packets_gen.h:1289
packet_ruleset_extra::rmreqs_count
int rmreqs_count
Definition packets_gen.h:1284
packet_ruleset_extra::bridged_over
bv_extras bridged_over
Definition packets_gen.h:1305
packet_ruleset_extra::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1269
packet_ruleset_extra::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1280
packet_ruleset_extra::no_aggr_near_city
int no_aggr_near_city
Definition packets_gen.h:1307
packet_ruleset_extra::rmact_gfx_alt
char rmact_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1278
packet_ruleset_extra::rmact_gfx
char rmact_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1277
packet_ruleset_extra::helptext
struct strvec * helptext
Definition packets_gen.h:1308
packet_ruleset_extra::conflicts
bv_extras conflicts
Definition packets_gen.h:1306
packet_ruleset_extra::rmreqs
struct requirement rmreqs[MAX_NUM_REQS]
Definition packets_gen.h:1285
packet_ruleset_extra::visibility_req
int visibility_req
Definition packets_gen.h:1292
packet_ruleset_extra::causes
bv_causes causes
Definition packets_gen.h:1272
packet_ruleset_game
Definition packets_gen.h:1022
packet_ruleset_game::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1033
packet_ruleset_game::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1032
packet_ruleset_game::global_init_techs
int global_init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1025
packet_ruleset_game::veteran_levels
int veteran_levels
Definition packets_gen.h:1028
packet_ruleset_game::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:1031
packet_ruleset_game::global_init_techs_count
int global_init_techs_count
Definition packets_gen.h:1024
packet_ruleset_game::background_red
int background_red
Definition packets_gen.h:1034
packet_ruleset_game::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:1029
packet_ruleset_game::global_init_buildings
Impr_type_id global_init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1027
packet_ruleset_game::global_init_buildings_count
int global_init_buildings_count
Definition packets_gen.h:1026
packet_ruleset_game::default_specialist
int default_specialist
Definition packets_gen.h:1023
packet_ruleset_game::background_green
int background_green
Definition packets_gen.h:1035
packet_ruleset_game::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:1030
packet_ruleset_game::background_blue
int background_blue
Definition packets_gen.h:1036
packet_ruleset_goods
Definition packets_gen.h:1341
packet_ruleset_goods::helptext
struct strvec * helptext
Definition packets_gen.h:1351
packet_ruleset_goods::flags
bv_goods_flags flags
Definition packets_gen.h:1350
packet_ruleset_goods::from_pct
int from_pct
Definition packets_gen.h:1347
packet_ruleset_goods::onetime_pct
int onetime_pct
Definition packets_gen.h:1349
packet_ruleset_goods::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1343
packet_ruleset_goods::reqs_count
int reqs_count
Definition packets_gen.h:1345
packet_ruleset_goods::to_pct
int to_pct
Definition packets_gen.h:1348
packet_ruleset_goods::id
int id
Definition packets_gen.h:1342
packet_ruleset_goods::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1344
packet_ruleset_goods::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1346
packet_ruleset_government_ruler_title
Definition packets_gen.h:1051
packet_ruleset_government_ruler_title::nation
Nation_type_id nation
Definition packets_gen.h:1053
packet_ruleset_government_ruler_title::female_title
char female_title[MAX_LEN_NAME]
Definition packets_gen.h:1055
packet_ruleset_government_ruler_title::gov
Government_type_id gov
Definition packets_gen.h:1052
packet_ruleset_government_ruler_title::male_title
char male_title[MAX_LEN_NAME]
Definition packets_gen.h:1054
packet_ruleset_government
Definition packets_gen.h:1088
packet_ruleset_government::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1095
packet_ruleset_government::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1093
packet_ruleset_government::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1092
packet_ruleset_government::id
Government_type_id id
Definition packets_gen.h:1089
packet_ruleset_government::helptext
struct strvec * helptext
Definition packets_gen.h:1096
packet_ruleset_government::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1094
packet_ruleset_government::reqs_count
int reqs_count
Definition packets_gen.h:1090
packet_ruleset_government::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1091
packet_ruleset_impr_flag
Definition packets_gen.h:1204
packet_ruleset_impr_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1206
packet_ruleset_impr_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1207
packet_ruleset_impr_flag::id
int id
Definition packets_gen.h:1205
packet_ruleset_multiplier
Definition packets_gen.h:1430
packet_ruleset_multiplier::stop
int stop
Definition packets_gen.h:1433
packet_ruleset_multiplier::step
int step
Definition packets_gen.h:1434
packet_ruleset_multiplier::helptext
struct strvec * helptext
Definition packets_gen.h:1443
packet_ruleset_multiplier::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1439
packet_ruleset_multiplier::id
Multiplier_type_id id
Definition packets_gen.h:1431
packet_ruleset_multiplier::offset
int offset
Definition packets_gen.h:1436
packet_ruleset_multiplier::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1442
packet_ruleset_multiplier::def
int def
Definition packets_gen.h:1435
packet_ruleset_multiplier::start
int start
Definition packets_gen.h:1432
packet_ruleset_multiplier::minimum_turns
int minimum_turns
Definition packets_gen.h:1438
packet_ruleset_multiplier::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1440
packet_ruleset_multiplier::factor
int factor
Definition packets_gen.h:1437
packet_ruleset_multiplier::reqs_count
int reqs_count
Definition packets_gen.h:1441
packet_ruleset_music
Definition packets_gen.h:1422
packet_ruleset_music::music_combat
char music_combat[MAX_LEN_NAME]
Definition packets_gen.h:1425
packet_ruleset_music::id
int id
Definition packets_gen.h:1423
packet_ruleset_music::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1427
packet_ruleset_music::reqs_count
int reqs_count
Definition packets_gen.h:1426
packet_ruleset_music::music_peaceful
char music_peaceful[MAX_LEN_NAME]
Definition packets_gen.h:1424
packet_ruleset_nation_groups
Definition packets_gen.h:1125
packet_ruleset_nation_groups::ngroups
int ngroups
Definition packets_gen.h:1126
packet_ruleset_nation_groups::groups
char groups[MAX_NUM_NATION_GROUPS][MAX_LEN_NAME]
Definition packets_gen.h:1127
packet_ruleset_nation_groups::hidden
bool hidden[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1128
packet_ruleset_nation_sets
Definition packets_gen.h:1118
packet_ruleset_nation_sets::rule_names
char rule_names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1121
packet_ruleset_nation_sets::names
char names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1120
packet_ruleset_nation_sets::nsets
int nsets
Definition packets_gen.h:1119
packet_ruleset_nation_sets::descriptions
char descriptions[MAX_NUM_NATION_SETS][MAX_LEN_MSG]
Definition packets_gen.h:1122
packet_ruleset_nation
Definition packets_gen.h:1131
packet_ruleset_nation::ngroups
int ngroups
Definition packets_gen.h:1148
packet_ruleset_nation::init_techs
int init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1152
packet_ruleset_nation::leader_name
char leader_name[MAX_NUM_LEADERS][MAX_LEN_NAME]
Definition packets_gen.h:1142
packet_ruleset_nation::style
int style
Definition packets_gen.h:1140
packet_ruleset_nation::is_playable
bool is_playable
Definition packets_gen.h:1144
packet_ruleset_nation::id
Nation_type_id id
Definition packets_gen.h:1132
packet_ruleset_nation::noun_plural
char noun_plural[MAX_LEN_NAME]
Definition packets_gen.h:1136
packet_ruleset_nation::init_units_count
int init_units_count
Definition packets_gen.h:1153
packet_ruleset_nation::adjective
char adjective[MAX_LEN_NAME]
Definition packets_gen.h:1134
packet_ruleset_nation::init_buildings
Impr_type_id init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1156
packet_ruleset_nation::init_units
Unit_type_id init_units[MAX_NUM_UNIT_LIST]
Definition packets_gen.h:1154
packet_ruleset_nation::init_techs_count
int init_techs_count
Definition packets_gen.h:1151
packet_ruleset_nation::leader_is_male
bool leader_is_male[MAX_NUM_LEADERS]
Definition packets_gen.h:1143
packet_ruleset_nation::translation_domain
char translation_domain[MAX_LEN_NAME]
Definition packets_gen.h:1133
packet_ruleset_nation::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1137
packet_ruleset_nation::init_government_id
Government_type_id init_government_id
Definition packets_gen.h:1150
packet_ruleset_nation::leader_count
int leader_count
Definition packets_gen.h:1141
packet_ruleset_nation::groups
int groups[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1149
packet_ruleset_nation::barbarian_type
enum barbarian_type barbarian_type
Definition packets_gen.h:1145
packet_ruleset_nation::sets
int sets[MAX_NUM_NATION_SETS]
Definition packets_gen.h:1147
packet_ruleset_nation::init_buildings_count
int init_buildings_count
Definition packets_gen.h:1155
packet_ruleset_nation::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1138
packet_ruleset_nation::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1135
packet_ruleset_nation::legend
char legend[MAX_LEN_MSG]
Definition packets_gen.h:1139
packet_ruleset_nation::nsets
int nsets
Definition packets_gen.h:1146
packet_ruleset_resource
Definition packets_gen.h:1607
packet_ruleset_resource::id
int id
Definition packets_gen.h:1608
packet_ruleset_resource::output
int output[O_LAST]
Definition packets_gen.h:1609
packet_ruleset_road
Definition packets_gen.h:1326
packet_ruleset_road::flags
bv_road_flags flags
Definition packets_gen.h:1338
packet_ruleset_road::tile_incr_const
int tile_incr_const[O_LAST]
Definition packets_gen.h:1333
packet_ruleset_road::gui_type
enum road_gui_type gui_type
Definition packets_gen.h:1328
packet_ruleset_road::integrates
bv_max_extras integrates
Definition packets_gen.h:1337
packet_ruleset_road::move_cost
int move_cost
Definition packets_gen.h:1331
packet_ruleset_road::compat
enum road_compat compat
Definition packets_gen.h:1336
packet_ruleset_road::move_mode
enum road_move_mode move_mode
Definition packets_gen.h:1332
packet_ruleset_road::first_reqs_count
int first_reqs_count
Definition packets_gen.h:1329
packet_ruleset_road::tile_bonus
int tile_bonus[O_LAST]
Definition packets_gen.h:1335
packet_ruleset_road::tile_incr
int tile_incr[O_LAST]
Definition packets_gen.h:1334
packet_ruleset_road::id
int id
Definition packets_gen.h:1327
packet_ruleset_road::first_reqs
struct requirement first_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1330
packet_ruleset_select
Definition packets_gen.h:1512
packet_ruleset_select::modpack
char modpack[MAX_RULESET_NAME_LENGTH]
Definition packets_gen.h:1513
packet_ruleset_specialist
Definition packets_gen.h:1039
packet_ruleset_specialist::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1042
packet_ruleset_specialist::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1045
packet_ruleset_specialist::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1047
packet_ruleset_specialist::id
Specialist_type_id id
Definition packets_gen.h:1040
packet_ruleset_specialist::reqs_count
int reqs_count
Definition packets_gen.h:1046
packet_ruleset_specialist::short_name
char short_name[MAX_LEN_NAME]
Definition packets_gen.h:1043
packet_ruleset_specialist::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1044
packet_ruleset_specialist::plural_name
char plural_name[MAX_LEN_NAME]
Definition packets_gen.h:1041
packet_ruleset_specialist::helptext
struct strvec * helptext
Definition packets_gen.h:1048
packet_ruleset_style
Definition packets_gen.h:1165
packet_ruleset_style::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1167
packet_ruleset_style::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1168
packet_ruleset_style::id
int id
Definition packets_gen.h:1166
packet_ruleset_summary
Definition packets_gen.h:1491
packet_ruleset_summary::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1492
packet_ruleset_tech_class
Definition packets_gen.h:1075
packet_ruleset_tech_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1077
packet_ruleset_tech_class::id
int id
Definition packets_gen.h:1076
packet_ruleset_tech_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1078
packet_ruleset_tech_class::cost_pct
int cost_pct
Definition packets_gen.h:1079
packet_ruleset_tech_flag
Definition packets_gen.h:1082
packet_ruleset_tech_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1084
packet_ruleset_tech_flag::id
int id
Definition packets_gen.h:1083
packet_ruleset_tech_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1085
packet_ruleset_tech
Definition packets_gen.h:1058
packet_ruleset_tech::research_reqs_count
int research_reqs_count
Definition packets_gen.h:1061
packet_ruleset_tech::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1068
packet_ruleset_tech::removed
bool removed
Definition packets_gen.h:1064
packet_ruleset_tech::research_reqs
struct requirement research_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1062
packet_ruleset_tech::id
int id
Definition packets_gen.h:1059
packet_ruleset_tech::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1071
packet_ruleset_tech::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1069
packet_ruleset_tech::num_reqs
int num_reqs
Definition packets_gen.h:1067
packet_ruleset_tech::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1072
packet_ruleset_tech::flags
bv_tech_flags flags
Definition packets_gen.h:1065
packet_ruleset_tech::helptext
struct strvec * helptext
Definition packets_gen.h:1070
packet_ruleset_tech::tclass
int tclass
Definition packets_gen.h:1063
packet_ruleset_tech::root_req
int root_req
Definition packets_gen.h:1060
packet_ruleset_tech::cost
float cost
Definition packets_gen.h:1066
packet_ruleset_terrain_control
Definition packets_gen.h:1099
packet_ruleset_terrain_control::lake_max_size
int lake_max_size
Definition packets_gen.h:1104
packet_ruleset_terrain_control::min_start_native_area
int min_start_native_area
Definition packets_gen.h:1105
packet_ruleset_terrain_control::ocean_reclaim_requirement_pct
int ocean_reclaim_requirement_pct
Definition packets_gen.h:1100
packet_ruleset_terrain_control::pythagorean_diagonal
bool pythagorean_diagonal
Definition packets_gen.h:1108
packet_ruleset_terrain_control::terrain_thaw_requirement_pct
int terrain_thaw_requirement_pct
Definition packets_gen.h:1102
packet_ruleset_terrain_control::infrapoints
bool infrapoints
Definition packets_gen.h:1109
packet_ruleset_terrain_control::gui_type_base0
char gui_type_base0[MAX_LEN_NAME]
Definition packets_gen.h:1110
packet_ruleset_terrain_control::move_fragments
int move_fragments
Definition packets_gen.h:1106
packet_ruleset_terrain_control::land_channel_requirement_pct
int land_channel_requirement_pct
Definition packets_gen.h:1101
packet_ruleset_terrain_control::igter_cost
int igter_cost
Definition packets_gen.h:1107
packet_ruleset_terrain_control::gui_type_base1
char gui_type_base1[MAX_LEN_NAME]
Definition packets_gen.h:1111
packet_ruleset_terrain_control::terrain_freeze_requirement_pct
int terrain_freeze_requirement_pct
Definition packets_gen.h:1103
packet_ruleset_terrain_flag
Definition packets_gen.h:1250
packet_ruleset_terrain_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1252
packet_ruleset_terrain_flag::id
int id
Definition packets_gen.h:1251
packet_ruleset_terrain_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1253
packet_ruleset_terrain
Definition packets_gen.h:1210
packet_ruleset_terrain::extra_removal_times
int extra_removal_times[MAX_EXTRA_TYPES]
Definition packets_gen.h:1243
packet_ruleset_terrain::cultivate_time
int cultivate_time
Definition packets_gen.h:1230
packet_ruleset_terrain::irrigation_food_incr
int irrigation_food_incr
Definition packets_gen.h:1233
packet_ruleset_terrain::base_time
int base_time
Definition packets_gen.h:1227
packet_ruleset_terrain::transform_result
Terrain_type_id transform_result
Definition packets_gen.h:1238
packet_ruleset_terrain::tclass
int tclass
Definition packets_gen.h:1212
packet_ruleset_terrain::extra_count
int extra_count
Definition packets_gen.h:1242
packet_ruleset_terrain::mining_shield_incr
int mining_shield_incr
Definition packets_gen.h:1235
packet_ruleset_terrain::resource_freq
int resource_freq[MAX_EXTRA_TYPES]
Definition packets_gen.h:1225
packet_ruleset_terrain::resources
Resource_type_id resources[MAX_EXTRA_TYPES]
Definition packets_gen.h:1224
packet_ruleset_terrain::irrigation_time
int irrigation_time
Definition packets_gen.h:1234
packet_ruleset_terrain::placing_time
int placing_time
Definition packets_gen.h:1240
packet_ruleset_terrain::flags
bv_terrain_flags flags
Definition packets_gen.h:1213
packet_ruleset_terrain::transform_time
int transform_time
Definition packets_gen.h:1239
packet_ruleset_terrain::defense_bonus
int defense_bonus
Definition packets_gen.h:1221
packet_ruleset_terrain::plant_time
int plant_time
Definition packets_gen.h:1232
packet_ruleset_terrain::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1217
packet_ruleset_terrain::num_resources
int num_resources
Definition packets_gen.h:1223
packet_ruleset_terrain::output
int output[O_LAST]
Definition packets_gen.h:1222
packet_ruleset_terrain::animal
int animal
Definition packets_gen.h:1237
packet_ruleset_terrain::color_red
int color_red
Definition packets_gen.h:1244
packet_ruleset_terrain::helptext
struct strvec * helptext
Definition packets_gen.h:1247
packet_ruleset_terrain::native_to
bv_unit_classes native_to
Definition packets_gen.h:1214
packet_ruleset_terrain::pillage_time
int pillage_time
Definition packets_gen.h:1241
packet_ruleset_terrain::cultivate_result
Terrain_type_id cultivate_result
Definition packets_gen.h:1229
packet_ruleset_terrain::color_green
int color_green
Definition packets_gen.h:1245
packet_ruleset_terrain::road_time
int road_time
Definition packets_gen.h:1228
packet_ruleset_terrain::plant_result
Terrain_type_id plant_result
Definition packets_gen.h:1231
packet_ruleset_terrain::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1215
packet_ruleset_terrain::road_output_incr_pct
int road_output_incr_pct[O_LAST]
Definition packets_gen.h:1226
packet_ruleset_terrain::movement_cost
int movement_cost
Definition packets_gen.h:1220
packet_ruleset_terrain::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1218
packet_ruleset_terrain::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1219
packet_ruleset_terrain::mining_time
int mining_time
Definition packets_gen.h:1236
packet_ruleset_terrain::id
Terrain_type_id id
Definition packets_gen.h:1211
packet_ruleset_terrain::color_blue
int color_blue
Definition packets_gen.h:1246
packet_ruleset_terrain::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1216
packet_ruleset_trade
Definition packets_gen.h:1373
packet_ruleset_trade::cancelling
enum trade_route_illegal_cancelling cancelling
Definition packets_gen.h:1376
packet_ruleset_trade::trade_pct
int trade_pct
Definition packets_gen.h:1375
packet_ruleset_trade::id
int id
Definition packets_gen.h:1374
packet_ruleset_trade::bonus_type
enum trade_route_bonus_type bonus_type
Definition packets_gen.h:1377
packet_ruleset_unit_bonus
Definition packets_gen.h:1002
packet_ruleset_unit_bonus::type
enum combat_bonus_type type
Definition packets_gen.h:1005
packet_ruleset_unit_bonus::unit
Unit_type_id unit
Definition packets_gen.h:1003
packet_ruleset_unit_bonus::quiet
bool quiet
Definition packets_gen.h:1007
packet_ruleset_unit_bonus::value
int value
Definition packets_gen.h:1006
packet_ruleset_unit_bonus::flag
enum unit_type_flag_id flag
Definition packets_gen.h:1004
packet_ruleset_unit_class_flag
Definition packets_gen.h:1016
packet_ruleset_unit_class_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1018
packet_ruleset_unit_class_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1019
packet_ruleset_unit_class_flag::id
int id
Definition packets_gen.h:1017
packet_ruleset_unit_class
Definition packets_gen.h:1256
packet_ruleset_unit_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1259
packet_ruleset_unit_class::helptext
struct strvec * helptext
Definition packets_gen.h:1264
packet_ruleset_unit_class::flags
bv_unit_class_flags flags
Definition packets_gen.h:1263
packet_ruleset_unit_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1258
packet_ruleset_unit_class::non_native_def_pct
int non_native_def_pct
Definition packets_gen.h:1262
packet_ruleset_unit_class::hp_loss_pct
int hp_loss_pct
Definition packets_gen.h:1261
packet_ruleset_unit_class::id
int id
Definition packets_gen.h:1257
packet_ruleset_unit_class::min_speed
int min_speed
Definition packets_gen.h:1260
packet_ruleset_unit_flag
Definition packets_gen.h:1010
packet_ruleset_unit_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1012
packet_ruleset_unit_flag::id
int id
Definition packets_gen.h:1011
packet_ruleset_unit_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1013
packet_ruleset_unit
Definition packets_gen.h:951
packet_ruleset_unit::paratroopers_range
int paratroopers_range
Definition packets_gen.h:980
packet_ruleset_unit::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:956
packet_ruleset_unit::vlayer
enum vision_layer vlayer
Definition packets_gen.h:995
packet_ruleset_unit::tp_defense
enum transp_def_type tp_defense
Definition packets_gen.h:990
packet_ruleset_unit::unit_class_id
int unit_class_id
Definition packets_gen.h:962
packet_ruleset_unit::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:954
packet_ruleset_unit::vision_radius_sq
int vision_radius_sq
Definition packets_gen.h:970
packet_ruleset_unit::obsoleted_by
int obsoleted_by
Definition packets_gen.h:974
packet_ruleset_unit::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:979
packet_ruleset_unit::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:983
packet_ruleset_unit::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:953
packet_ruleset_unit::hp
int hp
Definition packets_gen.h:972
packet_ruleset_unit::pop_cost
int pop_cost
Definition packets_gen.h:964
packet_ruleset_unit::city_slots
int city_slots
Definition packets_gen.h:989
packet_ruleset_unit::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:957
packet_ruleset_unit::firepower
int firepower
Definition packets_gen.h:973
packet_ruleset_unit::fuel
int fuel
Definition packets_gen.h:977
packet_ruleset_unit::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:955
packet_ruleset_unit::convert_time
int convert_time
Definition packets_gen.h:976
packet_ruleset_unit::helptext
struct strvec * helptext
Definition packets_gen.h:996
packet_ruleset_unit::sound_fight_alt
char sound_fight_alt[MAX_LEN_NAME]
Definition packets_gen.h:961
packet_ruleset_unit::disembarks
bv_unit_classes disembarks
Definition packets_gen.h:994
packet_ruleset_unit::veteran_levels
int veteran_levels
Definition packets_gen.h:981
packet_ruleset_unit::move_rate
int move_rate
Definition packets_gen.h:967
packet_ruleset_unit::attack_strength
int attack_strength
Definition packets_gen.h:965
packet_ruleset_unit::cargo
bv_unit_classes cargo
Definition packets_gen.h:991
packet_ruleset_unit::build_cost
int build_cost
Definition packets_gen.h:963
packet_ruleset_unit::transport_capacity
int transport_capacity
Definition packets_gen.h:971
packet_ruleset_unit::flags
bv_unit_type_flags flags
Definition packets_gen.h:997
packet_ruleset_unit::sound_move_alt
char sound_move_alt[MAX_LEN_NAME]
Definition packets_gen.h:959
packet_ruleset_unit::happy_cost
int happy_cost
Definition packets_gen.h:978
packet_ruleset_unit::worker
bool worker
Definition packets_gen.h:999
packet_ruleset_unit::targets
bv_unit_classes targets
Definition packets_gen.h:992
packet_ruleset_unit::defense_strength
int defense_strength
Definition packets_gen.h:966
packet_ruleset_unit::build_reqs
struct requirement build_reqs[MAX_NUM_REQS]
Definition packets_gen.h:969
packet_ruleset_unit::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:985
packet_ruleset_unit::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:986
packet_ruleset_unit::sound_fight
char sound_fight[MAX_LEN_NAME]
Definition packets_gen.h:960
packet_ruleset_unit::embarks
bv_unit_classes embarks
Definition packets_gen.h:993
packet_ruleset_unit::build_reqs_count
int build_reqs_count
Definition packets_gen.h:968
packet_ruleset_unit::city_size
int city_size
Definition packets_gen.h:988
packet_ruleset_unit::bombard_rate
int bombard_rate
Definition packets_gen.h:987
packet_ruleset_unit::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:982
packet_ruleset_unit::converted_to
int converted_to
Definition packets_gen.h:975
packet_ruleset_unit::sound_move
char sound_move[MAX_LEN_NAME]
Definition packets_gen.h:958
packet_ruleset_unit::roles
bv_unit_type_roles roles
Definition packets_gen.h:998
packet_ruleset_unit::id
Unit_type_id id
Definition packets_gen.h:952
packet_ruleset_unit::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:984
packet_rulesets_ready
Definition packets_gen.h:1114
packet_save_scenario
Definition packets_gen.h:1633
packet_save_scenario::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1634
packet_scenario_description
Definition packets_gen.h:1629
packet_scenario_description::description
char description[MAX_LEN_CONTENT]
Definition packets_gen.h:1630
packet_scenario_info
Definition packets_gen.h:1612
packet_scenario_info::lake_flooding
bool lake_flooding
Definition packets_gen.h:1620
packet_scenario_info::req_caps
char req_caps[257]
Definition packets_gen.h:1626
packet_scenario_info::datafile
char datafile[MAX_LEN_NAME]
Definition packets_gen.h:1624
packet_scenario_info::have_resources
bool have_resources
Definition packets_gen.h:1625
packet_scenario_info::is_scenario
bool is_scenario
Definition packets_gen.h:1613
packet_scenario_info::ruleset_locked
bool ruleset_locked
Definition packets_gen.h:1623
packet_scenario_info::allow_ai_type_fallback
bool allow_ai_type_fallback
Definition packets_gen.h:1622
packet_scenario_info::players
bool players
Definition packets_gen.h:1616
packet_scenario_info::authors
char authors[MAX_LEN_PACKET/3]
Definition packets_gen.h:1615
packet_scenario_info::name
char name[256]
Definition packets_gen.h:1614
packet_scenario_info::prevent_new_cities
bool prevent_new_cities
Definition packets_gen.h:1619
packet_scenario_info::handmade
bool handmade
Definition packets_gen.h:1621
packet_scenario_info::startpos_nations
bool startpos_nations
Definition packets_gen.h:1617
packet_scenario_info::save_random
bool save_random
Definition packets_gen.h:1618
packet_server_info
Definition packets_gen.h:324
packet_server_info::major_version
int major_version
Definition packets_gen.h:326
packet_server_info::version_label
char version_label[48]
Definition packets_gen.h:325
packet_server_info::patch_version
int patch_version
Definition packets_gen.h:328
packet_server_info::minor_version
int minor_version
Definition packets_gen.h:327
packet_server_info::emerg_version
int emerg_version
Definition packets_gen.h:329
packet_server_join_reply
Definition packets_gen.h:55
packet_server_join_req
Definition packets_gen.h:46
packet_server_join_req::version_label
char version_label[48]
Definition packets_gen.h:49
packet_server_join_req::capability
char capability[512]
Definition packets_gen.h:48
packet_server_join_req::minor_version
int minor_version
Definition packets_gen.h:51
packet_server_join_req::patch_version
int patch_version
Definition packets_gen.h:52
packet_server_join_req::major_version
int major_version
Definition packets_gen.h:50
packet_server_join_req::username
char username[48]
Definition packets_gen.h:47
packet_server_setting_bitwise
Definition packets_gen.h:1580
packet_server_setting_bitwise::support_names
char support_names[64][MAX_LEN_NAME]
Definition packets_gen.h:1589
packet_server_setting_bitwise::val
int val
Definition packets_gen.h:1586
packet_server_setting_bitwise::initial_setting
bool initial_setting
Definition packets_gen.h:1584
packet_server_setting_bitwise::bits_num
int bits_num
Definition packets_gen.h:1588
packet_server_setting_bitwise::default_val
int default_val
Definition packets_gen.h:1587
packet_server_setting_bitwise::is_changeable
bool is_changeable
Definition packets_gen.h:1583
packet_server_setting_bitwise::pretty_names
char pretty_names[64][MAX_LEN_ENUM]
Definition packets_gen.h:1590
packet_server_setting_bitwise::setdef
enum setting_default_level setdef
Definition packets_gen.h:1585
packet_server_setting_bitwise::is_visible
bool is_visible
Definition packets_gen.h:1582
packet_server_setting_bitwise::id
int id
Definition packets_gen.h:1581
packet_server_setting_bool
Definition packets_gen.h:1535
packet_server_setting_bool::val
bool val
Definition packets_gen.h:1541
packet_server_setting_bool::setdef
enum setting_default_level setdef
Definition packets_gen.h:1540
packet_server_setting_bool::is_changeable
bool is_changeable
Definition packets_gen.h:1538
packet_server_setting_bool::is_visible
bool is_visible
Definition packets_gen.h:1537
packet_server_setting_bool::default_val
bool default_val
Definition packets_gen.h:1542
packet_server_setting_bool::id
int id
Definition packets_gen.h:1536
packet_server_setting_bool::initial_setting
bool initial_setting
Definition packets_gen.h:1539
packet_server_setting_const
Definition packets_gen.h:1527
packet_server_setting_const::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1529
packet_server_setting_const::category
int category
Definition packets_gen.h:1532
packet_server_setting_const::short_help
char short_help[MAX_LEN_PACKET]
Definition packets_gen.h:1530
packet_server_setting_const::id
int id
Definition packets_gen.h:1528
packet_server_setting_const::extra_help
char extra_help[MAX_LEN_PACKET]
Definition packets_gen.h:1531
packet_server_setting_control
Definition packets_gen.h:1521
packet_server_setting_control::categories_num
int categories_num
Definition packets_gen.h:1523
packet_server_setting_control::settings_num
int settings_num
Definition packets_gen.h:1522
packet_server_setting_control::category_names
char category_names[256][MAX_LEN_NAME]
Definition packets_gen.h:1524
packet_server_setting_enum
Definition packets_gen.h:1567
packet_server_setting_enum::initial_setting
bool initial_setting
Definition packets_gen.h:1571
packet_server_setting_enum::is_visible
bool is_visible
Definition packets_gen.h:1569
packet_server_setting_enum::is_changeable
bool is_changeable
Definition packets_gen.h:1570
packet_server_setting_enum::setdef
enum setting_default_level setdef
Definition packets_gen.h:1572
packet_server_setting_enum::default_val
int default_val
Definition packets_gen.h:1574
packet_server_setting_enum::values_num
int values_num
Definition packets_gen.h:1575
packet_server_setting_enum::id
int id
Definition packets_gen.h:1568
packet_server_setting_enum::val
int val
Definition packets_gen.h:1573
packet_server_setting_enum::pretty_names
char pretty_names[64][MAX_LEN_ENUM]
Definition packets_gen.h:1577
packet_server_setting_enum::support_names
char support_names[64][MAX_LEN_NAME]
Definition packets_gen.h:1576
packet_server_setting_int
Definition packets_gen.h:1545
packet_server_setting_int::is_changeable
bool is_changeable
Definition packets_gen.h:1548
packet_server_setting_int::max_val
int max_val
Definition packets_gen.h:1554
packet_server_setting_int::is_visible
bool is_visible
Definition packets_gen.h:1547
packet_server_setting_int::min_val
int min_val
Definition packets_gen.h:1553
packet_server_setting_int::id
int id
Definition packets_gen.h:1546
packet_server_setting_int::val
int val
Definition packets_gen.h:1551
packet_server_setting_int::initial_setting
bool initial_setting
Definition packets_gen.h:1549
packet_server_setting_int::default_val
int default_val
Definition packets_gen.h:1552
packet_server_setting_int::setdef
enum setting_default_level setdef
Definition packets_gen.h:1550
packet_server_setting_str
Definition packets_gen.h:1557
packet_server_setting_str::default_val
char default_val[MAX_LEN_PACKET]
Definition packets_gen.h:1564
packet_server_setting_str::id
int id
Definition packets_gen.h:1558
packet_server_setting_str::val
char val[MAX_LEN_PACKET]
Definition packets_gen.h:1563
packet_server_setting_str::is_visible
bool is_visible
Definition packets_gen.h:1559
packet_server_setting_str::setdef
enum setting_default_level setdef
Definition packets_gen.h:1562
packet_server_setting_str::initial_setting
bool initial_setting
Definition packets_gen.h:1561
packet_server_setting_str::is_changeable
bool is_changeable
Definition packets_gen.h:1560
packet_server_shutdown
Definition packets_gen.h:72
packet_set_topology
Definition packets_gen.h:1593
packet_set_topology::wrap_id
int wrap_id
Definition packets_gen.h:1595
packet_set_topology::topology_id
int topology_id
Definition packets_gen.h:1594
packet_single_want_hack_reply
Definition packets_gen.h:1503
packet_single_want_hack_reply::you_have_hack
bool you_have_hack
Definition packets_gen.h:1504
packet_single_want_hack_req
Definition packets_gen.h:1499
packet_single_want_hack_req::token
char token[MAX_LEN_NAME]
Definition packets_gen.h:1500
packet_spaceship_info
Definition packets_gen.h:930
packet_spaceship_info::sship_state
int sship_state
Definition packets_gen.h:932
packet_spaceship_info::propulsion
int propulsion
Definition packets_gen.h:937
packet_spaceship_info::habitation
int habitation
Definition packets_gen.h:938
packet_spaceship_info::mass
int mass
Definition packets_gen.h:943
packet_spaceship_info::life_support
int life_support
Definition packets_gen.h:939
packet_spaceship_info::structure
bv_spaceship_structure structure
Definition packets_gen.h:944
packet_spaceship_info::structurals
int structurals
Definition packets_gen.h:933
packet_spaceship_info::fuel
int fuel
Definition packets_gen.h:936
packet_spaceship_info::population
int population
Definition packets_gen.h:942
packet_spaceship_info::success_rate
float success_rate
Definition packets_gen.h:947
packet_spaceship_info::player_num
int player_num
Definition packets_gen.h:931
packet_spaceship_info::launch_year
int launch_year
Definition packets_gen.h:941
packet_spaceship_info::travel_time
float travel_time
Definition packets_gen.h:948
packet_spaceship_info::energy_rate
float energy_rate
Definition packets_gen.h:946
packet_spaceship_info::solar_panels
int solar_panels
Definition packets_gen.h:940
packet_spaceship_info::support_rate
float support_rate
Definition packets_gen.h:945
packet_spaceship_info::modules
int modules
Definition packets_gen.h:935
packet_spaceship_info::components
int components
Definition packets_gen.h:934
packet_spaceship_launch
Definition packets_gen.h:921
packet_spaceship_place
Definition packets_gen.h:925
packet_spaceship_place::num
int num
Definition packets_gen.h:927
packet_spaceship_place::type
enum spaceship_place_type type
Definition packets_gen.h:926
packet_start_phase
Definition packets_gen.h:895
packet_start_phase::phase
int phase
Definition packets_gen.h:896
packet_team_name_info
Definition packets_gen.h:287
packet_team_name_info::team_name
char team_name[MAX_LEN_NAME]
Definition packets_gen.h:289
packet_team_name_info::team_id
int team_id
Definition packets_gen.h:288
packet_thaw_client
Definition packets_gen.h:917
packet_tile_info
Definition packets_gen.h:103
packet_tile_info::resource
Resource_type_id resource
Definition packets_gen.h:111
packet_tile_info::extras
bv_extras extras
Definition packets_gen.h:112
packet_tile_info::place_turn
int place_turn
Definition packets_gen.h:114
packet_tile_info::placing
int placing
Definition packets_gen.h:113
packet_tile_info::owner
int owner
Definition packets_gen.h:107
packet_tile_info::known
enum known_type known
Definition packets_gen.h:106
packet_tile_info::label
char label[MAX_LEN_MAP_LABEL]
Definition packets_gen.h:117
packet_tile_info::extras_owner
int extras_owner
Definition packets_gen.h:108
packet_tile_info::tile
int tile
Definition packets_gen.h:104
packet_tile_info::continent
Continent_id continent
Definition packets_gen.h:105
packet_tile_info::terrain
Terrain_type_id terrain
Definition packets_gen.h:110
packet_tile_info::worked
int worked
Definition packets_gen.h:109
packet_tile_info::altitude
int altitude
Definition packets_gen.h:115
packet_tile_info::spec_sprite
char spec_sprite[MAX_LEN_NAME]
Definition packets_gen.h:116
packet_timeout_info
Definition packets_gen.h:268
packet_timeout_info::seconds_to_phasedone
float seconds_to_phasedone
Definition packets_gen.h:269
packet_timeout_info::last_turn_change_time
float last_turn_change_time
Definition packets_gen.h:270
packet_trade_route_info
Definition packets_gen.h:419
packet_trade_route_info::city
int city
Definition packets_gen.h:420
packet_trade_route_info::value
int value
Definition packets_gen.h:423
packet_trade_route_info::partner
int partner
Definition packets_gen.h:422
packet_trade_route_info::goods
Goods_type_id goods
Definition packets_gen.h:425
packet_trade_route_info::direction
enum route_direction direction
Definition packets_gen.h:424
packet_trade_route_info::index
int index
Definition packets_gen.h:421
packet_unit_action_answer
Definition packets_gen.h:746
packet_unit_action_answer::request_kind
int request_kind
Definition packets_gen.h:751
packet_unit_action_answer::action_type
action_id action_type
Definition packets_gen.h:750
packet_unit_action_answer::cost
int cost
Definition packets_gen.h:749
packet_unit_action_answer::actor_id
int actor_id
Definition packets_gen.h:747
packet_unit_action_answer::target_id
int target_id
Definition packets_gen.h:748
packet_unit_action_query
Definition packets_gen.h:727
packet_unit_action_query::target_id
int target_id
Definition packets_gen.h:729
packet_unit_action_query::request_kind
int request_kind
Definition packets_gen.h:731
packet_unit_action_query::actor_id
int actor_id
Definition packets_gen.h:728
packet_unit_action_query::action_type
action_id action_type
Definition packets_gen.h:730
packet_unit_actions
Definition packets_gen.h:762
packet_unit_actions::target_unit_id
int target_unit_id
Definition packets_gen.h:764
packet_unit_actions::target_city_id
int target_city_id
Definition packets_gen.h:765
packet_unit_actions::action_probabilities
struct act_prob action_probabilities[MAX_NUM_ACTIONS]
Definition packets_gen.h:769
packet_unit_actions::target_extra_id
int target_extra_id
Definition packets_gen.h:767
packet_unit_actions::request_kind
int request_kind
Definition packets_gen.h:768
packet_unit_actions::actor_unit_id
int actor_unit_id
Definition packets_gen.h:763
packet_unit_actions::target_tile_id
int target_tile_id
Definition packets_gen.h:766
packet_unit_change_activity
Definition packets_gen.h:772
packet_unit_change_activity::activity
enum unit_activity activity
Definition packets_gen.h:774
packet_unit_change_activity::unit_id
int unit_id
Definition packets_gen.h:773
packet_unit_change_activity::target
int target
Definition packets_gen.h:775
packet_unit_combat_info
Definition packets_gen.h:697
packet_unit_combat_info::defender_hp
int defender_hp
Definition packets_gen.h:701
packet_unit_combat_info::attacker_hp
int attacker_hp
Definition packets_gen.h:700
packet_unit_combat_info::make_att_veteran
bool make_att_veteran
Definition packets_gen.h:702
packet_unit_combat_info::make_def_veteran
bool make_def_veteran
Definition packets_gen.h:703
packet_unit_combat_info::attacker_unit_id
int attacker_unit_id
Definition packets_gen.h:698
packet_unit_combat_info::defender_unit_id
int defender_unit_id
Definition packets_gen.h:699
packet_unit_do_action
Definition packets_gen.h:738
packet_unit_do_action::action_type
action_id action_type
Definition packets_gen.h:743
packet_unit_do_action::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:742
packet_unit_do_action::sub_tgt_id
int sub_tgt_id
Definition packets_gen.h:741
packet_unit_do_action::actor_id
int actor_id
Definition packets_gen.h:739
packet_unit_do_action::target_id
int target_id
Definition packets_gen.h:740
packet_unit_get_actions
Definition packets_gen.h:754
packet_unit_get_actions::target_extra_id
int target_extra_id
Definition packets_gen.h:758
packet_unit_get_actions::target_tile_id
int target_tile_id
Definition packets_gen.h:757
packet_unit_get_actions::actor_unit_id
int actor_unit_id
Definition packets_gen.h:755
packet_unit_get_actions::target_unit_id
int target_unit_id
Definition packets_gen.h:756
packet_unit_get_actions::request_kind
int request_kind
Definition packets_gen.h:759
packet_unit_info
Definition packets_gen.h:639
packet_unit_info::movesleft
int movesleft
Definition packets_gen.h:659
packet_unit_info::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:646
packet_unit_info::carrying
int carrying
Definition packets_gen.h:658
packet_unit_info::action_decision_want
enum action_decision action_decision_want
Definition packets_gen.h:676
packet_unit_info::owner
int owner
Definition packets_gen.h:641
packet_unit_info::has_orders
bool has_orders
Definition packets_gen.h:670
packet_unit_info::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:675
packet_unit_info::fuel
int fuel
Definition packets_gen.h:661
packet_unit_info::activity
enum unit_activity activity
Definition packets_gen.h:665
packet_unit_info::activity_tgt
int activity_tgt
Definition packets_gen.h:666
packet_unit_info::current_form_turn
int current_form_turn
Definition packets_gen.h:655
packet_unit_info::nationality
int nationality
Definition packets_gen.h:642
packet_unit_info::transported
bool transported
Definition packets_gen.h:651
packet_unit_info::goto_tile
int goto_tile
Definition packets_gen.h:664
packet_unit_info::orders_index
int orders_index
Definition packets_gen.h:672
packet_unit_info::type
Unit_type_id type
Definition packets_gen.h:656
packet_unit_info::changed_from
enum unit_activity changed_from
Definition packets_gen.h:667
packet_unit_info::homecity
int homecity
Definition packets_gen.h:645
packet_unit_info::orders_length
int orders_length
Definition packets_gen.h:671
packet_unit_info::transported_by
int transported_by
Definition packets_gen.h:657
packet_unit_info::veteran
int veteran
Definition packets_gen.h:647
packet_unit_info::orders_repeat
bool orders_repeat
Definition packets_gen.h:673
packet_unit_info::activity_count
int activity_count
Definition packets_gen.h:662
packet_unit_info::id
int id
Definition packets_gen.h:640
packet_unit_info::occupied
bool occupied
Definition packets_gen.h:650
packet_unit_info::action_decision_tile
int action_decision_tile
Definition packets_gen.h:677
packet_unit_info::battlegroup
int battlegroup
Definition packets_gen.h:669
packet_unit_info::facing
enum direction8 facing
Definition packets_gen.h:644
packet_unit_info::orders_vigilant
bool orders_vigilant
Definition packets_gen.h:674
packet_unit_info::hp
int hp
Definition packets_gen.h:660
packet_unit_info::changed_from_count
int changed_from_count
Definition packets_gen.h:663
packet_unit_info::stay
bool stay
Definition packets_gen.h:653
packet_unit_info::tile
int tile
Definition packets_gen.h:643
packet_unit_info::birth_turn
int birth_turn
Definition packets_gen.h:654
packet_unit_info::ssa_controller
enum server_side_agent ssa_controller
Definition packets_gen.h:648
packet_unit_info::done_moving
bool done_moving
Definition packets_gen.h:652
packet_unit_info::paradropped
bool paradropped
Definition packets_gen.h:649
packet_unit_info::changed_from_tgt
int changed_from_tgt
Definition packets_gen.h:668
packet_unit_orders
Definition packets_gen.h:712
packet_unit_orders::src_tile
int src_tile
Definition packets_gen.h:714
packet_unit_orders::length
int length
Definition packets_gen.h:715
packet_unit_orders::unit_id
int unit_id
Definition packets_gen.h:713
packet_unit_orders::dest_tile
int dest_tile
Definition packets_gen.h:719
packet_unit_orders::repeat
bool repeat
Definition packets_gen.h:716
packet_unit_orders::vigilant
bool vigilant
Definition packets_gen.h:717
packet_unit_orders::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:718
packet_unit_remove
Definition packets_gen.h:635
packet_unit_remove::unit_id
int unit_id
Definition packets_gen.h:636
packet_unit_server_side_agent_set
Definition packets_gen.h:722
packet_unit_server_side_agent_set::unit_id
int unit_id
Definition packets_gen.h:723
packet_unit_server_side_agent_set::agent
enum server_side_agent agent
Definition packets_gen.h:724
packet_unit_short_info
Definition packets_gen.h:680
packet_unit_short_info::activity
int activity
Definition packets_gen.h:690
packet_unit_short_info::packet_use
int packet_use
Definition packets_gen.h:693
packet_unit_short_info::tile
int tile
Definition packets_gen.h:683
packet_unit_short_info::transported
bool transported
Definition packets_gen.h:688
packet_unit_short_info::hp
int hp
Definition packets_gen.h:689
packet_unit_short_info::id
int id
Definition packets_gen.h:681
packet_unit_short_info::veteran
int veteran
Definition packets_gen.h:686
packet_unit_short_info::info_city_id
int info_city_id
Definition packets_gen.h:694
packet_unit_short_info::type
Unit_type_id type
Definition packets_gen.h:685
packet_unit_short_info::owner
int owner
Definition packets_gen.h:682
packet_unit_short_info::occupied
bool occupied
Definition packets_gen.h:687
packet_unit_short_info::transported_by
int transported_by
Definition packets_gen.h:692
packet_unit_short_info::facing
enum direction8 facing
Definition packets_gen.h:684
packet_unit_short_info::activity_tgt
int activity_tgt
Definition packets_gen.h:691
packet_unit_sscs_set
Definition packets_gen.h:706
packet_unit_sscs_set::type
enum unit_ss_data_type type
Definition packets_gen.h:708
packet_unit_sscs_set::unit_id
int unit_id
Definition packets_gen.h:707
packet_unit_sscs_set::value
int value
Definition packets_gen.h:709
packet_unit_type_upgrade
Definition packets_gen.h:734
packet_unit_type_upgrade::type
Unit_type_id type
Definition packets_gen.h:735
packet_unknown_research
Definition packets_gen.h:623
packet_unknown_research::id
int id
Definition packets_gen.h:624
packet_vote_new
Definition packets_gen.h:1637
packet_vote_new::flags
int flags
Definition packets_gen.h:1642
packet_vote_new::vote_no
int vote_no
Definition packets_gen.h:1638
packet_vote_new::desc
char desc[512]
Definition packets_gen.h:1640
packet_vote_new::percent_required
int percent_required
Definition packets_gen.h:1641
packet_vote_new::user
char user[MAX_LEN_NAME]
Definition packets_gen.h:1639
packet_vote_remove
Definition packets_gen.h:1653
packet_vote_remove::vote_no
int vote_no
Definition packets_gen.h:1654
packet_vote_resolve
Definition packets_gen.h:1657
packet_vote_resolve::passed
bool passed
Definition packets_gen.h:1659
packet_vote_resolve::vote_no
int vote_no
Definition packets_gen.h:1658
packet_vote_submit
Definition packets_gen.h:1662
packet_vote_update
Definition packets_gen.h:1645
packet_vote_update::abstain
int abstain
Definition packets_gen.h:1649
packet_vote_update::num_voters
int num_voters
Definition packets_gen.h:1650
packet_vote_update::yes
int yes
Definition packets_gen.h:1647
packet_vote_update::no
int no
Definition packets_gen.h:1648
packet_vote_update::vote_no
int vote_no
Definition packets_gen.h:1646
packet_web_city_info_addition
Definition packets_gen.h:1870
packet_web_city_info_addition::can_build_improvement
bv_imprs can_build_improvement
Definition packets_gen.h:1877
packet_web_city_info_addition::cm_parameter
struct cm_parameter cm_parameter
Definition packets_gen.h:1873
packet_web_city_info_addition::output_shield
int output_shield[MAX_CITY_TILES+1]
Definition packets_gen.h:1879
packet_web_city_info_addition::id
int id
Definition packets_gen.h:1871
packet_web_city_info_addition::cma_enabled
bool cma_enabled
Definition packets_gen.h:1872
packet_web_city_info_addition::output_trade
int output_trade[MAX_CITY_TILES+1]
Definition packets_gen.h:1880
packet_web_city_info_addition::output_food
int output_food[MAX_CITY_TILES+1]
Definition packets_gen.h:1878
packet_web_city_info_addition::granary_size
int granary_size
Definition packets_gen.h:1874
packet_web_city_info_addition::can_build_unit
bv_utypes can_build_unit
Definition packets_gen.h:1876
packet_web_city_info_addition::granary_turns
int granary_turns
Definition packets_gen.h:1875
packet_web_cma_clear
Definition packets_gen.h:1888
packet_web_cma_clear::id
int id
Definition packets_gen.h:1889
packet_web_cma_set
Definition packets_gen.h:1883
packet_web_cma_set::id
int id
Definition packets_gen.h:1884
packet_web_cma_set::cm_parameter
struct cm_parameter cm_parameter
Definition packets_gen.h:1885
packet_web_player_info_addition
Definition packets_gen.h:1892
packet_web_player_info_addition::expected_income
int expected_income
Definition packets_gen.h:1894
packet_web_player_info_addition::playerno
int playerno
Definition packets_gen.h:1893
packet_web_ruleset_unit_addition
Definition packets_gen.h:1897
packet_web_ruleset_unit_addition::utype_actions
bv_actions utype_actions
Definition packets_gen.h:1899
packet_web_ruleset_unit_addition::id
Unit_type_id id
Definition packets_gen.h:1898
packet_worker_task
Definition packets_gen.h:503
packet_worker_task::city_id
int city_id
Definition packets_gen.h:504
packet_worker_task::tile_id
int tile_id
Definition packets_gen.h:505
packet_worker_task::activity
enum unit_activity activity
Definition packets_gen.h:506
packet_worker_task::want
int want
Definition packets_gen.h:508
packet_worker_task::tgt
int tgt
Definition packets_gen.h:507
player
Definition player.h:249
plocation
Definition dataio_raw.h:63
requirement
Definition requirements.h:81
strvec
Definition string_vector.c:29
team
Definition team.c:40
terrain
Definition terrain.h:75
tile
Definition tile.h:50
unit_order
Definition unit.h:93
unit
Definition unit.h:140
worklist
Definition worklist.h:28
support.h
sz_strlcpy
#define sz_strlcpy(dest, src)
Definition support.h:189
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
bool
#define bool
Definition support.h:71
A_LAST
#define A_LAST
Definition tech.h:45
terrain_count
Terrain_type_id terrain_count(void)
Definition terrain.c:118
goods
static struct goods_type goods[MAX_GOODS_TYPES]
Definition traderoutes.c:43
are_unit_orders_equal
bool are_unit_orders_equal(const struct unit_order *order1, const struct unit_order *order2)
Definition unit.c:59
worklist_copy
void worklist_copy(struct worklist *dst, const struct worklist *src)
Definition worklist.c:112
are_worklists_equal
bool are_worklists_equal(const struct worklist *wlist1, const struct worklist *wlist2)
Definition worklist.c:192