Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/packets_gen.c Source File

Freeciv-3.2

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 struct packet_processing_started *receive_packet_processing_started_100(struct connection *pc)
1095{
1096 RECEIVE_PACKET_START(packet_processing_started, real_packet);
1097#if 1 /* To match endif */
1098 real_packet->__dummy = 0xff;
1099#endif
1100 log_packet_detailed("packet_processing_started_100: got info about ()");
1101 RECEIVE_PACKET_END(real_packet);
1102}
1103
1104 static int send_packet_processing_started_100(struct connection *pc)
1105{
1106 SEND_PACKET_START(PACKET_PROCESSING_STARTED);
1107
1108 log_packet_detailed("packet_processing_started_100: sending info about ()");
1109 SEND_PACKET_END(PACKET_PROCESSING_STARTED);
1110}
1111
1112 int send_packet_processing_started(struct connection *pc)
1113{
1114 if (!pc->used) {
1115 log_error("WARNING: trying to send data to the closed connection %s",
1116 conn_description(pc));
1117 return -1;
1118 }
1119 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PROCESSING_STARTED].no_packet != NULL, -1,
1120 "Handler for PACKET_PROCESSING_STARTED not installed");
1121 return pc->phs.handlers->send[PACKET_PROCESSING_STARTED].no_packet(pc);
1122}
1123
1124 static struct packet_processing_finished *receive_packet_processing_finished_100(struct connection *pc)
1125{
1126 RECEIVE_PACKET_START(packet_processing_finished, real_packet);
1127#if 1 /* To match endif */
1128 real_packet->__dummy = 0xff;
1129#endif
1130 log_packet_detailed("packet_processing_finished_100: got info about ()");
1131 RECEIVE_PACKET_END(real_packet);
1132}
1133
1134 static int send_packet_processing_finished_100(struct connection *pc)
1135{
1136 SEND_PACKET_START(PACKET_PROCESSING_FINISHED);
1137
1138 log_packet_detailed("packet_processing_finished_100: sending info about ()");
1139 SEND_PACKET_END(PACKET_PROCESSING_FINISHED);
1140}
1141
1142 int send_packet_processing_finished(struct connection *pc)
1143{
1144 if (!pc->used) {
1145 log_error("WARNING: trying to send data to the closed connection %s",
1146 conn_description(pc));
1147 return -1;
1148 }
1149 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PROCESSING_FINISHED].no_packet != NULL, -1,
1150 "Handler for PACKET_PROCESSING_FINISHED not installed");
1151 return pc->phs.handlers->send[PACKET_PROCESSING_FINISHED].no_packet(pc);
1152}
1153
1154#ifdef FREECIV_DELTA_PROTOCOL
1155#define hash_packet_investigate_started_100 hash_const
1156
1157#define cmp_packet_investigate_started_100 cmp_const
1158
1159 BV_DEFINE(packet_investigate_started_100_fields, 2);
1160#endif /* FREECIV_DELTA_PROTOCOL */
1161
1162 static struct packet_investigate_started *receive_packet_investigate_started_100(struct connection *pc)
1163{
1164#ifdef FREECIV_DELTA_PROTOCOL
1165 packet_investigate_started_100_fields fields;
1166 struct packet_investigate_started *old;
1167 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_STARTED;
1168#endif /* FREECIV_DELTA_PROTOCOL */
1169 RECEIVE_PACKET_START(packet_investigate_started, real_packet);
1170#ifdef FREECIV_JSON_CONNECTION
1171 struct plocation field_addr;
1172 {
1173 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1174 field_addr = *field_addr_tmp;
1175 FC_FREE(field_addr_tmp);
1176 }
1177#endif /* FREECIV_JSON_CONNECTION */
1178
1179#ifdef FREECIV_DELTA_PROTOCOL
1180#ifdef FREECIV_JSON_CONNECTION
1181 field_addr.name = "fields";
1182#endif /* FREECIV_JSON_CONNECTION */
1183 DIO_BV_GET(&din, &field_addr, fields);
1184
1185#else /* FREECIV_DELTA_PROTOCOL */
1186#ifdef FREECIV_JSON_CONNECTION
1187 field_addr.name = "unit_id";
1188#endif /* FREECIV_JSON_CONNECTION */
1189 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1190 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1191 }
1192#ifdef FREECIV_JSON_CONNECTION
1193 field_addr.name = "city_id";
1194#endif /* FREECIV_JSON_CONNECTION */
1195 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1196 RECEIVE_PACKET_FIELD_ERROR(city_id);
1197 }
1198#endif
1199 log_packet_detailed("packet_investigate_started_100: got info about ()");
1200
1201#ifdef FREECIV_DELTA_PROTOCOL
1202 if (NULL == *hash) {
1203 *hash = genhash_new_full(hash_packet_investigate_started_100, cmp_packet_investigate_started_100,
1204 NULL, NULL, NULL, free);
1205 }
1206
1207 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1208 *real_packet = *old;
1209 } else {
1210 log_packet_detailed(" no old info");
1211 memset(real_packet, 0, sizeof(*real_packet));
1212 }
1213
1214 if (BV_ISSET(fields, 0)) {
1215 log_packet_detailed(" got field 'unit_id'");
1216#ifdef FREECIV_JSON_CONNECTION
1217 field_addr.name = "unit_id";
1218#endif /* FREECIV_JSON_CONNECTION */
1219 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1220 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1221 }
1222 }
1223 if (BV_ISSET(fields, 1)) {
1224 log_packet_detailed(" got field 'city_id'");
1225#ifdef FREECIV_JSON_CONNECTION
1226 field_addr.name = "city_id";
1227#endif /* FREECIV_JSON_CONNECTION */
1228 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1229 RECEIVE_PACKET_FIELD_ERROR(city_id);
1230 }
1231 }
1232
1233 if (NULL == old) {
1234 old = fc_malloc(sizeof(*old));
1235 *old = *real_packet;
1236 genhash_insert(*hash, old, old);
1237 } else {
1238 *old = *real_packet;
1239 }
1240
1241#endif /* FREECIV_DELTA_PROTOCOL */
1242 RECEIVE_PACKET_END(real_packet);
1243}
1244
1245 static int send_packet_investigate_started_100(struct connection *pc, const struct packet_investigate_started *packet)
1246{
1247 const struct packet_investigate_started *real_packet = packet;
1248 int e;
1249#ifdef FREECIV_DELTA_PROTOCOL
1250 packet_investigate_started_100_fields fields;
1251 struct packet_investigate_started *old;
1252 bool differ;
1253 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_STARTED;
1254#endif /* FREECIV_DELTA_PROTOCOL */
1255 SEND_PACKET_START(PACKET_INVESTIGATE_STARTED);
1256#ifdef FREECIV_JSON_CONNECTION
1257 struct plocation field_addr;
1258 {
1259 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1260 field_addr = *field_addr_tmp;
1261 FC_FREE(field_addr_tmp);
1262 }
1263#endif /* FREECIV_JSON_CONNECTION */
1264
1265 log_packet_detailed("packet_investigate_started_100: sending info about ()");
1266
1267#ifdef FREECIV_DELTA_PROTOCOL
1268 if (NULL == *hash) {
1269 *hash = genhash_new_full(hash_packet_investigate_started_100, cmp_packet_investigate_started_100,
1270 NULL, NULL, NULL, free);
1271 }
1272 BV_CLR_ALL(fields);
1273
1274 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1275 old = fc_malloc(sizeof(*old));
1276 *old = *real_packet;
1277 genhash_insert(*hash, old, old);
1278 memset(old, 0, sizeof(*old));
1279 }
1280 differ = (old->unit_id != real_packet->unit_id);
1281 if (differ) {
1282 BV_SET(fields, 0);
1283 }
1284
1285 differ = (old->city_id != real_packet->city_id);
1286 if (differ) {
1287 BV_SET(fields, 1);
1288 }
1289
1290
1291#ifdef FREECIV_JSON_CONNECTION
1292 field_addr.name = "fields";
1293#endif /* FREECIV_JSON_CONNECTION */
1294 e = 0;
1295 e |= DIO_BV_PUT(&dout, &field_addr, fields);
1296 if (e) {
1297 log_packet_detailed("fields bitvector error detected");
1298 }
1299
1300 if (BV_ISSET(fields, 0)) {
1301 log_packet_detailed(" field 'unit_id' has changed");
1302#ifdef FREECIV_JSON_CONNECTION
1303 field_addr.name = "unit_id";
1304#endif /* FREECIV_JSON_CONNECTION */
1305 e = 0;
1306 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1307 if (e) {
1308 log_packet_detailed("'unit_id' field error detected");
1309 }
1310 }
1311 if (BV_ISSET(fields, 1)) {
1312 log_packet_detailed(" field 'city_id' has changed");
1313#ifdef FREECIV_JSON_CONNECTION
1314 field_addr.name = "city_id";
1315#endif /* FREECIV_JSON_CONNECTION */
1316 e = 0;
1317 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1318 if (e) {
1319 log_packet_detailed("'city_id' field error detected");
1320 }
1321 }
1322
1323 *old = *real_packet;
1324#endif /* FREECIV_DELTA_PROTOCOL */
1325#ifndef FREECIV_DELTA_PROTOCOL
1326#ifdef FREECIV_JSON_CONNECTION
1327 field_addr.name = "unit_id";
1328#endif /* FREECIV_JSON_CONNECTION */
1329 e = 0;
1330 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1331 if (e) {
1332 log_packet_detailed("'unit_id' field error detected");
1333 }
1334#ifdef FREECIV_JSON_CONNECTION
1335 field_addr.name = "city_id";
1336#endif /* FREECIV_JSON_CONNECTION */
1337 e = 0;
1338 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1339 if (e) {
1340 log_packet_detailed("'city_id' field error detected");
1341 }
1342
1343#endif
1344 SEND_PACKET_END(PACKET_INVESTIGATE_STARTED);
1345}
1346
1347 int send_packet_investigate_started(struct connection *pc, const struct packet_investigate_started *packet)
1348{
1349 if (!pc->used) {
1350 log_error("WARNING: trying to send data to the closed connection %s",
1351 conn_description(pc));
1352 return -1;
1353 }
1354 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_INVESTIGATE_STARTED].packet != NULL, -1,
1355 "Handler for PACKET_INVESTIGATE_STARTED not installed");
1356 return pc->phs.handlers->send[PACKET_INVESTIGATE_STARTED].packet(pc, packet);
1357}
1358
1359 void lsend_packet_investigate_started(struct conn_list *dest, const struct packet_investigate_started *packet)
1360{
1361 conn_list_iterate(dest, pconn) {
1362 send_packet_investigate_started(pconn, packet);
1363 } conn_list_iterate_end;
1364}
1365
1366 int dsend_packet_investigate_started(struct connection *pc, int unit_id, int city_id)
1367{
1368 struct packet_investigate_started packet, *real_packet = &packet;
1369
1370 real_packet->unit_id = unit_id;
1371 real_packet->city_id = city_id;
1372
1373 return send_packet_investigate_started(pc, real_packet);
1374}
1375
1376 void dlsend_packet_investigate_started(struct conn_list *dest, int unit_id, int city_id)
1377{
1378 struct packet_investigate_started packet, *real_packet = &packet;
1379
1380 real_packet->unit_id = unit_id;
1381 real_packet->city_id = city_id;
1382
1383 lsend_packet_investigate_started(dest, real_packet);
1384}
1385
1386#ifdef FREECIV_DELTA_PROTOCOL
1387#define hash_packet_investigate_finished_100 hash_const
1388
1389#define cmp_packet_investigate_finished_100 cmp_const
1390
1391 BV_DEFINE(packet_investigate_finished_100_fields, 2);
1392#endif /* FREECIV_DELTA_PROTOCOL */
1393
1394 static struct packet_investigate_finished *receive_packet_investigate_finished_100(struct connection *pc)
1395{
1396#ifdef FREECIV_DELTA_PROTOCOL
1397 packet_investigate_finished_100_fields fields;
1398 struct packet_investigate_finished *old;
1399 struct genhash **hash = pc->phs.received + PACKET_INVESTIGATE_FINISHED;
1400#endif /* FREECIV_DELTA_PROTOCOL */
1401 RECEIVE_PACKET_START(packet_investigate_finished, real_packet);
1402#ifdef FREECIV_JSON_CONNECTION
1403 struct plocation field_addr;
1404 {
1405 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1406 field_addr = *field_addr_tmp;
1407 FC_FREE(field_addr_tmp);
1408 }
1409#endif /* FREECIV_JSON_CONNECTION */
1410
1411#ifdef FREECIV_DELTA_PROTOCOL
1412#ifdef FREECIV_JSON_CONNECTION
1413 field_addr.name = "fields";
1414#endif /* FREECIV_JSON_CONNECTION */
1415 DIO_BV_GET(&din, &field_addr, fields);
1416
1417#else /* FREECIV_DELTA_PROTOCOL */
1418#ifdef FREECIV_JSON_CONNECTION
1419 field_addr.name = "unit_id";
1420#endif /* FREECIV_JSON_CONNECTION */
1421 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1422 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1423 }
1424#ifdef FREECIV_JSON_CONNECTION
1425 field_addr.name = "city_id";
1426#endif /* FREECIV_JSON_CONNECTION */
1427 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1428 RECEIVE_PACKET_FIELD_ERROR(city_id);
1429 }
1430#endif
1431 log_packet_detailed("packet_investigate_finished_100: got info about ()");
1432
1433#ifdef FREECIV_DELTA_PROTOCOL
1434 if (NULL == *hash) {
1435 *hash = genhash_new_full(hash_packet_investigate_finished_100, cmp_packet_investigate_finished_100,
1436 NULL, NULL, NULL, free);
1437 }
1438
1439 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1440 *real_packet = *old;
1441 } else {
1442 log_packet_detailed(" no old info");
1443 memset(real_packet, 0, sizeof(*real_packet));
1444 }
1445
1446 if (BV_ISSET(fields, 0)) {
1447 log_packet_detailed(" got field 'unit_id'");
1448#ifdef FREECIV_JSON_CONNECTION
1449 field_addr.name = "unit_id";
1450#endif /* FREECIV_JSON_CONNECTION */
1451 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
1452 RECEIVE_PACKET_FIELD_ERROR(unit_id);
1453 }
1454 }
1455 if (BV_ISSET(fields, 1)) {
1456 log_packet_detailed(" got field 'city_id'");
1457#ifdef FREECIV_JSON_CONNECTION
1458 field_addr.name = "city_id";
1459#endif /* FREECIV_JSON_CONNECTION */
1460 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
1461 RECEIVE_PACKET_FIELD_ERROR(city_id);
1462 }
1463 }
1464
1465 if (NULL == old) {
1466 old = fc_malloc(sizeof(*old));
1467 *old = *real_packet;
1468 genhash_insert(*hash, old, old);
1469 } else {
1470 *old = *real_packet;
1471 }
1472
1473#endif /* FREECIV_DELTA_PROTOCOL */
1474 RECEIVE_PACKET_END(real_packet);
1475}
1476
1477 static int send_packet_investigate_finished_100(struct connection *pc, const struct packet_investigate_finished *packet)
1478{
1479 const struct packet_investigate_finished *real_packet = packet;
1480 int e;
1481#ifdef FREECIV_DELTA_PROTOCOL
1482 packet_investigate_finished_100_fields fields;
1483 struct packet_investigate_finished *old;
1484 bool differ;
1485 struct genhash **hash = pc->phs.sent + PACKET_INVESTIGATE_FINISHED;
1486#endif /* FREECIV_DELTA_PROTOCOL */
1487 SEND_PACKET_START(PACKET_INVESTIGATE_FINISHED);
1488#ifdef FREECIV_JSON_CONNECTION
1489 struct plocation field_addr;
1490 {
1491 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1492 field_addr = *field_addr_tmp;
1493 FC_FREE(field_addr_tmp);
1494 }
1495#endif /* FREECIV_JSON_CONNECTION */
1496
1497 log_packet_detailed("packet_investigate_finished_100: sending info about ()");
1498
1499#ifdef FREECIV_DELTA_PROTOCOL
1500 if (NULL == *hash) {
1501 *hash = genhash_new_full(hash_packet_investigate_finished_100, cmp_packet_investigate_finished_100,
1502 NULL, NULL, NULL, free);
1503 }
1504 BV_CLR_ALL(fields);
1505
1506 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
1507 old = fc_malloc(sizeof(*old));
1508 *old = *real_packet;
1509 genhash_insert(*hash, old, old);
1510 memset(old, 0, sizeof(*old));
1511 }
1512 differ = (old->unit_id != real_packet->unit_id);
1513 if (differ) {
1514 BV_SET(fields, 0);
1515 }
1516
1517 differ = (old->city_id != real_packet->city_id);
1518 if (differ) {
1519 BV_SET(fields, 1);
1520 }
1521
1522
1523#ifdef FREECIV_JSON_CONNECTION
1524 field_addr.name = "fields";
1525#endif /* FREECIV_JSON_CONNECTION */
1526 e = 0;
1527 e |= DIO_BV_PUT(&dout, &field_addr, fields);
1528 if (e) {
1529 log_packet_detailed("fields bitvector error detected");
1530 }
1531
1532 if (BV_ISSET(fields, 0)) {
1533 log_packet_detailed(" field 'unit_id' has changed");
1534#ifdef FREECIV_JSON_CONNECTION
1535 field_addr.name = "unit_id";
1536#endif /* FREECIV_JSON_CONNECTION */
1537 e = 0;
1538 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1539 if (e) {
1540 log_packet_detailed("'unit_id' field error detected");
1541 }
1542 }
1543 if (BV_ISSET(fields, 1)) {
1544 log_packet_detailed(" field 'city_id' has changed");
1545#ifdef FREECIV_JSON_CONNECTION
1546 field_addr.name = "city_id";
1547#endif /* FREECIV_JSON_CONNECTION */
1548 e = 0;
1549 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1550 if (e) {
1551 log_packet_detailed("'city_id' field error detected");
1552 }
1553 }
1554
1555 *old = *real_packet;
1556#endif /* FREECIV_DELTA_PROTOCOL */
1557#ifndef FREECIV_DELTA_PROTOCOL
1558#ifdef FREECIV_JSON_CONNECTION
1559 field_addr.name = "unit_id";
1560#endif /* FREECIV_JSON_CONNECTION */
1561 e = 0;
1562 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
1563 if (e) {
1564 log_packet_detailed("'unit_id' field error detected");
1565 }
1566#ifdef FREECIV_JSON_CONNECTION
1567 field_addr.name = "city_id";
1568#endif /* FREECIV_JSON_CONNECTION */
1569 e = 0;
1570 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
1571 if (e) {
1572 log_packet_detailed("'city_id' field error detected");
1573 }
1574
1575#endif
1576 SEND_PACKET_END(PACKET_INVESTIGATE_FINISHED);
1577}
1578
1579 int send_packet_investigate_finished(struct connection *pc, const struct packet_investigate_finished *packet)
1580{
1581 if (!pc->used) {
1582 log_error("WARNING: trying to send data to the closed connection %s",
1583 conn_description(pc));
1584 return -1;
1585 }
1586 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_INVESTIGATE_FINISHED].packet != NULL, -1,
1587 "Handler for PACKET_INVESTIGATE_FINISHED not installed");
1588 return pc->phs.handlers->send[PACKET_INVESTIGATE_FINISHED].packet(pc, packet);
1589}
1590
1591 void lsend_packet_investigate_finished(struct conn_list *dest, const struct packet_investigate_finished *packet)
1592{
1593 conn_list_iterate(dest, pconn) {
1594 send_packet_investigate_finished(pconn, packet);
1595 } conn_list_iterate_end;
1596}
1597
1598 int dsend_packet_investigate_finished(struct connection *pc, int unit_id, int city_id)
1599{
1600 struct packet_investigate_finished packet, *real_packet = &packet;
1601
1602 real_packet->unit_id = unit_id;
1603 real_packet->city_id = city_id;
1604
1605 return send_packet_investigate_finished(pc, real_packet);
1606}
1607
1608 void dlsend_packet_investigate_finished(struct conn_list *dest, int unit_id, int city_id)
1609{
1610 struct packet_investigate_finished packet, *real_packet = &packet;
1611
1612 real_packet->unit_id = unit_id;
1613 real_packet->city_id = city_id;
1614
1615 lsend_packet_investigate_finished(dest, real_packet);
1616}
1617
1618 static struct packet_server_join_req *receive_packet_server_join_req_100(struct connection *pc)
1619{
1620 RECEIVE_PACKET_START(packet_server_join_req, real_packet);
1621#ifdef FREECIV_JSON_CONNECTION
1622 struct plocation field_addr;
1623 {
1624 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1625 field_addr = *field_addr_tmp;
1626 FC_FREE(field_addr_tmp);
1627 }
1628#endif /* FREECIV_JSON_CONNECTION */
1629#if 1 /* To match endif */
1630#ifdef FREECIV_JSON_CONNECTION
1631 field_addr.name = "username";
1632#endif /* FREECIV_JSON_CONNECTION */
1633 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
1634 RECEIVE_PACKET_FIELD_ERROR(username);
1635 }
1636#ifdef FREECIV_JSON_CONNECTION
1637 field_addr.name = "capability";
1638#endif /* FREECIV_JSON_CONNECTION */
1639 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
1640 RECEIVE_PACKET_FIELD_ERROR(capability);
1641 }
1642#ifdef FREECIV_JSON_CONNECTION
1643 field_addr.name = "version_label";
1644#endif /* FREECIV_JSON_CONNECTION */
1645 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
1646 RECEIVE_PACKET_FIELD_ERROR(version_label);
1647 }
1648#ifdef FREECIV_JSON_CONNECTION
1649 field_addr.name = "major_version";
1650#endif /* FREECIV_JSON_CONNECTION */
1651 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
1652 RECEIVE_PACKET_FIELD_ERROR(major_version);
1653 }
1654#ifdef FREECIV_JSON_CONNECTION
1655 field_addr.name = "minor_version";
1656#endif /* FREECIV_JSON_CONNECTION */
1657 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
1658 RECEIVE_PACKET_FIELD_ERROR(minor_version);
1659 }
1660#ifdef FREECIV_JSON_CONNECTION
1661 field_addr.name = "patch_version";
1662#endif /* FREECIV_JSON_CONNECTION */
1663 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
1664 RECEIVE_PACKET_FIELD_ERROR(patch_version);
1665 }
1666#endif
1667 log_packet_detailed("packet_server_join_req_100: got info about ()");
1668 RECEIVE_PACKET_END(real_packet);
1669}
1670
1671 static int send_packet_server_join_req_100(struct connection *pc, const struct packet_server_join_req *packet)
1672{
1673 const struct packet_server_join_req *real_packet = packet;
1674 int e;
1675 SEND_PACKET_START(PACKET_SERVER_JOIN_REQ);
1676#ifdef FREECIV_JSON_CONNECTION
1677 struct plocation field_addr;
1678 {
1679 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1680 field_addr = *field_addr_tmp;
1681 FC_FREE(field_addr_tmp);
1682 }
1683#endif /* FREECIV_JSON_CONNECTION */
1684
1685 log_packet_detailed("packet_server_join_req_100: sending info about ()");
1686#if 1 /* To match endif */
1687#ifdef FREECIV_JSON_CONNECTION
1688 field_addr.name = "username";
1689#endif /* FREECIV_JSON_CONNECTION */
1690 e = 0;
1691 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
1692 if (e) {
1693 log_packet_detailed("'username' field error detected");
1694 }
1695#ifdef FREECIV_JSON_CONNECTION
1696 field_addr.name = "capability";
1697#endif /* FREECIV_JSON_CONNECTION */
1698 e = 0;
1699 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
1700 if (e) {
1701 log_packet_detailed("'capability' field error detected");
1702 }
1703#ifdef FREECIV_JSON_CONNECTION
1704 field_addr.name = "version_label";
1705#endif /* FREECIV_JSON_CONNECTION */
1706 e = 0;
1707 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
1708 if (e) {
1709 log_packet_detailed("'version_label' field error detected");
1710 }
1711#ifdef FREECIV_JSON_CONNECTION
1712 field_addr.name = "major_version";
1713#endif /* FREECIV_JSON_CONNECTION */
1714 e = 0;
1715 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
1716 if (e) {
1717 log_packet_detailed("'major_version' field error detected");
1718 }
1719#ifdef FREECIV_JSON_CONNECTION
1720 field_addr.name = "minor_version";
1721#endif /* FREECIV_JSON_CONNECTION */
1722 e = 0;
1723 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
1724 if (e) {
1725 log_packet_detailed("'minor_version' field error detected");
1726 }
1727#ifdef FREECIV_JSON_CONNECTION
1728 field_addr.name = "patch_version";
1729#endif /* FREECIV_JSON_CONNECTION */
1730 e = 0;
1731 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
1732 if (e) {
1733 log_packet_detailed("'patch_version' field error detected");
1734 }
1735
1736#endif
1737 SEND_PACKET_END(PACKET_SERVER_JOIN_REQ);
1738}
1739
1740 int send_packet_server_join_req(struct connection *pc, const struct packet_server_join_req *packet)
1741{
1742 if (!pc->used) {
1743 log_error("WARNING: trying to send data to the closed connection %s",
1744 conn_description(pc));
1745 return -1;
1746 }
1747 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_JOIN_REQ].packet != NULL, -1,
1748 "Handler for PACKET_SERVER_JOIN_REQ not installed");
1749 return pc->phs.handlers->send[PACKET_SERVER_JOIN_REQ].packet(pc, packet);
1750}
1751
1752 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)
1753{
1754 struct packet_server_join_req packet, *real_packet = &packet;
1755
1756 sz_strlcpy(real_packet->username, username);
1757 sz_strlcpy(real_packet->capability, capability);
1758 sz_strlcpy(real_packet->version_label, version_label);
1759 real_packet->major_version = major_version;
1760 real_packet->minor_version = minor_version;
1761 real_packet->patch_version = patch_version;
1762
1763 return send_packet_server_join_req(pc, real_packet);
1764}
1765
1766 static struct packet_server_join_reply *receive_packet_server_join_reply_100(struct connection *pc)
1767{
1768 RECEIVE_PACKET_START(packet_server_join_reply, real_packet);
1769#ifdef FREECIV_JSON_CONNECTION
1770 struct plocation field_addr;
1771 {
1772 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1773 field_addr = *field_addr_tmp;
1774 FC_FREE(field_addr_tmp);
1775 }
1776#endif /* FREECIV_JSON_CONNECTION */
1777#if 1 /* To match endif */
1778#ifdef FREECIV_JSON_CONNECTION
1779 field_addr.name = "you_can_join";
1780#endif /* FREECIV_JSON_CONNECTION */
1781 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->you_can_join)) {
1782 RECEIVE_PACKET_FIELD_ERROR(you_can_join);
1783 }
1784#ifdef FREECIV_JSON_CONNECTION
1785 field_addr.name = "message";
1786#endif /* FREECIV_JSON_CONNECTION */
1787 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
1788 RECEIVE_PACKET_FIELD_ERROR(message);
1789 }
1790#ifdef FREECIV_JSON_CONNECTION
1791 field_addr.name = "capability";
1792#endif /* FREECIV_JSON_CONNECTION */
1793 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
1794 RECEIVE_PACKET_FIELD_ERROR(capability);
1795 }
1796#ifdef FREECIV_JSON_CONNECTION
1797 field_addr.name = "challenge_file";
1798#endif /* FREECIV_JSON_CONNECTION */
1799 if (!DIO_GET(string, &din, &field_addr, real_packet->challenge_file, sizeof(real_packet->challenge_file))) {
1800 RECEIVE_PACKET_FIELD_ERROR(challenge_file);
1801 }
1802#ifdef FREECIV_JSON_CONNECTION
1803 field_addr.name = "conn_id";
1804#endif /* FREECIV_JSON_CONNECTION */
1805 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
1806 RECEIVE_PACKET_FIELD_ERROR(conn_id);
1807 }
1808#endif
1809 log_packet_detailed("packet_server_join_reply_100: got info about ()");
1810 post_receive_packet_server_join_reply(pc, real_packet);
1811 RECEIVE_PACKET_END(real_packet);
1812}
1813
1814 static int send_packet_server_join_reply_100(struct connection *pc, const struct packet_server_join_reply *packet)
1815{
1816 const struct packet_server_join_reply *real_packet = packet;
1817 int e;
1818 SEND_PACKET_START(PACKET_SERVER_JOIN_REPLY);
1819#ifdef FREECIV_JSON_CONNECTION
1820 struct plocation field_addr;
1821 {
1822 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1823 field_addr = *field_addr_tmp;
1824 FC_FREE(field_addr_tmp);
1825 }
1826#endif /* FREECIV_JSON_CONNECTION */
1827
1828 log_packet_detailed("packet_server_join_reply_100: sending info about ()");
1829#if 1 /* To match endif */
1830#ifdef FREECIV_JSON_CONNECTION
1831 field_addr.name = "you_can_join";
1832#endif /* FREECIV_JSON_CONNECTION */
1833 e = 0;
1834 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->you_can_join);
1835 if (e) {
1836 log_packet_detailed("'you_can_join' field error detected");
1837 }
1838#ifdef FREECIV_JSON_CONNECTION
1839 field_addr.name = "message";
1840#endif /* FREECIV_JSON_CONNECTION */
1841 e = 0;
1842 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
1843 if (e) {
1844 log_packet_detailed("'message' field error detected");
1845 }
1846#ifdef FREECIV_JSON_CONNECTION
1847 field_addr.name = "capability";
1848#endif /* FREECIV_JSON_CONNECTION */
1849 e = 0;
1850 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
1851 if (e) {
1852 log_packet_detailed("'capability' field error detected");
1853 }
1854#ifdef FREECIV_JSON_CONNECTION
1855 field_addr.name = "challenge_file";
1856#endif /* FREECIV_JSON_CONNECTION */
1857 e = 0;
1858 e |= DIO_PUT(string, &dout, &field_addr, real_packet->challenge_file);
1859 if (e) {
1860 log_packet_detailed("'challenge_file' field error detected");
1861 }
1862#ifdef FREECIV_JSON_CONNECTION
1863 field_addr.name = "conn_id";
1864#endif /* FREECIV_JSON_CONNECTION */
1865 e = 0;
1866 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
1867 if (e) {
1868 log_packet_detailed("'conn_id' field error detected");
1869 }
1870
1871#endif
1872 post_send_packet_server_join_reply(pc, real_packet);
1873 SEND_PACKET_END(PACKET_SERVER_JOIN_REPLY);
1874}
1875
1876 int send_packet_server_join_reply(struct connection *pc, const struct packet_server_join_reply *packet)
1877{
1878 if (!pc->used) {
1879 log_error("WARNING: trying to send data to the closed connection %s",
1880 conn_description(pc));
1881 return -1;
1882 }
1883 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_JOIN_REPLY].packet != NULL, -1,
1884 "Handler for PACKET_SERVER_JOIN_REPLY not installed");
1885 return pc->phs.handlers->send[PACKET_SERVER_JOIN_REPLY].packet(pc, packet);
1886}
1887
1888#ifdef FREECIV_DELTA_PROTOCOL
1889#define hash_packet_authentication_req_100 hash_const
1890
1891#define cmp_packet_authentication_req_100 cmp_const
1892
1893 BV_DEFINE(packet_authentication_req_100_fields, 2);
1894#endif /* FREECIV_DELTA_PROTOCOL */
1895
1896 static struct packet_authentication_req *receive_packet_authentication_req_100(struct connection *pc)
1897{
1898#ifdef FREECIV_DELTA_PROTOCOL
1899 packet_authentication_req_100_fields fields;
1900 struct packet_authentication_req *old;
1901 struct genhash **hash = pc->phs.received + PACKET_AUTHENTICATION_REQ;
1902#endif /* FREECIV_DELTA_PROTOCOL */
1903 RECEIVE_PACKET_START(packet_authentication_req, real_packet);
1904#ifdef FREECIV_JSON_CONNECTION
1905 struct plocation field_addr;
1906 {
1907 struct plocation *field_addr_tmp = plocation_field_new(NULL);
1908 field_addr = *field_addr_tmp;
1909 FC_FREE(field_addr_tmp);
1910 }
1911#endif /* FREECIV_JSON_CONNECTION */
1912
1913#ifdef FREECIV_DELTA_PROTOCOL
1914#ifdef FREECIV_JSON_CONNECTION
1915 field_addr.name = "fields";
1916#endif /* FREECIV_JSON_CONNECTION */
1917 DIO_BV_GET(&din, &field_addr, fields);
1918
1919#else /* FREECIV_DELTA_PROTOCOL */
1920#ifdef FREECIV_JSON_CONNECTION
1921 field_addr.name = "type";
1922#endif /* FREECIV_JSON_CONNECTION */
1923 {
1924 int readin;
1925
1926 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
1927 RECEIVE_PACKET_FIELD_ERROR(type);
1928 }
1929 real_packet->type = readin;
1930 }
1931#ifdef FREECIV_JSON_CONNECTION
1932 field_addr.name = "message";
1933#endif /* FREECIV_JSON_CONNECTION */
1934 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
1935 RECEIVE_PACKET_FIELD_ERROR(message);
1936 }
1937#endif
1938 log_packet_detailed("packet_authentication_req_100: got info about ()");
1939
1940#ifdef FREECIV_DELTA_PROTOCOL
1941 if (NULL == *hash) {
1942 *hash = genhash_new_full(hash_packet_authentication_req_100, cmp_packet_authentication_req_100,
1943 NULL, NULL, NULL, free);
1944 }
1945
1946 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
1947 *real_packet = *old;
1948 } else {
1949 log_packet_detailed(" no old info");
1950 memset(real_packet, 0, sizeof(*real_packet));
1951 }
1952
1953 if (BV_ISSET(fields, 0)) {
1954 log_packet_detailed(" got field 'type'");
1955#ifdef FREECIV_JSON_CONNECTION
1956 field_addr.name = "type";
1957#endif /* FREECIV_JSON_CONNECTION */
1958 {
1959 int readin;
1960
1961 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
1962 RECEIVE_PACKET_FIELD_ERROR(type);
1963 }
1964 real_packet->type = readin;
1965 }
1966 }
1967 if (BV_ISSET(fields, 1)) {
1968 log_packet_detailed(" got field 'message'");
1969#ifdef FREECIV_JSON_CONNECTION
1970 field_addr.name = "message";
1971#endif /* FREECIV_JSON_CONNECTION */
1972 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
1973 RECEIVE_PACKET_FIELD_ERROR(message);
1974 }
1975 }
1976
1977 if (NULL == old) {
1978 old = fc_malloc(sizeof(*old));
1979 *old = *real_packet;
1980 genhash_insert(*hash, old, old);
1981 } else {
1982 *old = *real_packet;
1983 }
1984
1985#endif /* FREECIV_DELTA_PROTOCOL */
1986 RECEIVE_PACKET_END(real_packet);
1987}
1988
1989 static int send_packet_authentication_req_100(struct connection *pc, const struct packet_authentication_req *packet)
1990{
1991 const struct packet_authentication_req *real_packet = packet;
1992 int e;
1993#ifdef FREECIV_DELTA_PROTOCOL
1994 packet_authentication_req_100_fields fields;
1995 struct packet_authentication_req *old;
1996 bool differ;
1997 struct genhash **hash = pc->phs.sent + PACKET_AUTHENTICATION_REQ;
1998#endif /* FREECIV_DELTA_PROTOCOL */
1999 SEND_PACKET_START(PACKET_AUTHENTICATION_REQ);
2000#ifdef FREECIV_JSON_CONNECTION
2001 struct plocation field_addr;
2002 {
2003 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2004 field_addr = *field_addr_tmp;
2005 FC_FREE(field_addr_tmp);
2006 }
2007#endif /* FREECIV_JSON_CONNECTION */
2008
2009 log_packet_detailed("packet_authentication_req_100: sending info about ()");
2010
2011#ifdef FREECIV_DELTA_PROTOCOL
2012 if (NULL == *hash) {
2013 *hash = genhash_new_full(hash_packet_authentication_req_100, cmp_packet_authentication_req_100,
2014 NULL, NULL, NULL, free);
2015 }
2016 BV_CLR_ALL(fields);
2017
2018 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2019 old = fc_malloc(sizeof(*old));
2020 *old = *real_packet;
2021 genhash_insert(*hash, old, old);
2022 memset(old, 0, sizeof(*old));
2023 }
2024 differ = (old->type != real_packet->type);
2025 if (differ) {
2026 BV_SET(fields, 0);
2027 }
2028
2029 differ = (strcmp(old->message, real_packet->message) != 0);
2030 if (differ) {
2031 BV_SET(fields, 1);
2032 }
2033
2034
2035#ifdef FREECIV_JSON_CONNECTION
2036 field_addr.name = "fields";
2037#endif /* FREECIV_JSON_CONNECTION */
2038 e = 0;
2039 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2040 if (e) {
2041 log_packet_detailed("fields bitvector error detected");
2042 }
2043
2044 if (BV_ISSET(fields, 0)) {
2045 log_packet_detailed(" field 'type' has changed");
2046#ifdef FREECIV_JSON_CONNECTION
2047 field_addr.name = "type";
2048#endif /* FREECIV_JSON_CONNECTION */
2049 e = 0;
2050 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
2051 if (e) {
2052 log_packet_detailed("'type' field error detected");
2053 }
2054 }
2055 if (BV_ISSET(fields, 1)) {
2056 log_packet_detailed(" field 'message' has changed");
2057#ifdef FREECIV_JSON_CONNECTION
2058 field_addr.name = "message";
2059#endif /* FREECIV_JSON_CONNECTION */
2060 e = 0;
2061 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
2062 if (e) {
2063 log_packet_detailed("'message' field error detected");
2064 }
2065 }
2066
2067 *old = *real_packet;
2068#endif /* FREECIV_DELTA_PROTOCOL */
2069#ifndef FREECIV_DELTA_PROTOCOL
2070#ifdef FREECIV_JSON_CONNECTION
2071 field_addr.name = "type";
2072#endif /* FREECIV_JSON_CONNECTION */
2073 e = 0;
2074 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
2075 if (e) {
2076 log_packet_detailed("'type' field error detected");
2077 }
2078#ifdef FREECIV_JSON_CONNECTION
2079 field_addr.name = "message";
2080#endif /* FREECIV_JSON_CONNECTION */
2081 e = 0;
2082 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
2083 if (e) {
2084 log_packet_detailed("'message' field error detected");
2085 }
2086
2087#endif
2088 SEND_PACKET_END(PACKET_AUTHENTICATION_REQ);
2089}
2090
2091 int send_packet_authentication_req(struct connection *pc, const struct packet_authentication_req *packet)
2092{
2093 if (!pc->used) {
2094 log_error("WARNING: trying to send data to the closed connection %s",
2095 conn_description(pc));
2096 return -1;
2097 }
2098 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_AUTHENTICATION_REQ].packet != NULL, -1,
2099 "Handler for PACKET_AUTHENTICATION_REQ not installed");
2100 return pc->phs.handlers->send[PACKET_AUTHENTICATION_REQ].packet(pc, packet);
2101}
2102
2103 int dsend_packet_authentication_req(struct connection *pc, enum authentication_type type, const char *message)
2104{
2105 struct packet_authentication_req packet, *real_packet = &packet;
2106
2107 real_packet->type = type;
2108 sz_strlcpy(real_packet->message, message);
2109
2110 return send_packet_authentication_req(pc, real_packet);
2111}
2112
2113#ifdef FREECIV_DELTA_PROTOCOL
2114#define hash_packet_authentication_reply_100 hash_const
2115
2116#define cmp_packet_authentication_reply_100 cmp_const
2117
2118 BV_DEFINE(packet_authentication_reply_100_fields, 1);
2119#endif /* FREECIV_DELTA_PROTOCOL */
2120
2121 static struct packet_authentication_reply *receive_packet_authentication_reply_100(struct connection *pc)
2122{
2123#ifdef FREECIV_DELTA_PROTOCOL
2124 packet_authentication_reply_100_fields fields;
2125 struct packet_authentication_reply *old;
2126 struct genhash **hash = pc->phs.received + PACKET_AUTHENTICATION_REPLY;
2127#endif /* FREECIV_DELTA_PROTOCOL */
2128 RECEIVE_PACKET_START(packet_authentication_reply, real_packet);
2129#ifdef FREECIV_JSON_CONNECTION
2130 struct plocation field_addr;
2131 {
2132 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2133 field_addr = *field_addr_tmp;
2134 FC_FREE(field_addr_tmp);
2135 }
2136#endif /* FREECIV_JSON_CONNECTION */
2137
2138#ifdef FREECIV_DELTA_PROTOCOL
2139#ifdef FREECIV_JSON_CONNECTION
2140 field_addr.name = "fields";
2141#endif /* FREECIV_JSON_CONNECTION */
2142 DIO_BV_GET(&din, &field_addr, fields);
2143
2144#else /* FREECIV_DELTA_PROTOCOL */
2145#ifdef FREECIV_JSON_CONNECTION
2146 field_addr.name = "password";
2147#endif /* FREECIV_JSON_CONNECTION */
2148 if (!DIO_GET(string, &din, &field_addr, real_packet->password, sizeof(real_packet->password))) {
2149 RECEIVE_PACKET_FIELD_ERROR(password);
2150 }
2151#endif
2152 log_packet_detailed("packet_authentication_reply_100: got info about ()");
2153
2154#ifdef FREECIV_DELTA_PROTOCOL
2155 if (NULL == *hash) {
2156 *hash = genhash_new_full(hash_packet_authentication_reply_100, cmp_packet_authentication_reply_100,
2157 NULL, NULL, NULL, free);
2158 }
2159
2160 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2161 *real_packet = *old;
2162 } else {
2163 log_packet_detailed(" no old info");
2164 memset(real_packet, 0, sizeof(*real_packet));
2165 }
2166
2167 if (BV_ISSET(fields, 0)) {
2168 log_packet_detailed(" got field 'password'");
2169#ifdef FREECIV_JSON_CONNECTION
2170 field_addr.name = "password";
2171#endif /* FREECIV_JSON_CONNECTION */
2172 if (!DIO_GET(string, &din, &field_addr, real_packet->password, sizeof(real_packet->password))) {
2173 RECEIVE_PACKET_FIELD_ERROR(password);
2174 }
2175 }
2176
2177 if (NULL == old) {
2178 old = fc_malloc(sizeof(*old));
2179 *old = *real_packet;
2180 genhash_insert(*hash, old, old);
2181 } else {
2182 *old = *real_packet;
2183 }
2184
2185#endif /* FREECIV_DELTA_PROTOCOL */
2186 RECEIVE_PACKET_END(real_packet);
2187}
2188
2189 static int send_packet_authentication_reply_100(struct connection *pc, const struct packet_authentication_reply *packet)
2190{
2191 const struct packet_authentication_reply *real_packet = packet;
2192 int e;
2193#ifdef FREECIV_DELTA_PROTOCOL
2194 packet_authentication_reply_100_fields fields;
2195 struct packet_authentication_reply *old;
2196 bool differ;
2197 struct genhash **hash = pc->phs.sent + PACKET_AUTHENTICATION_REPLY;
2198#endif /* FREECIV_DELTA_PROTOCOL */
2199 SEND_PACKET_START(PACKET_AUTHENTICATION_REPLY);
2200#ifdef FREECIV_JSON_CONNECTION
2201 struct plocation field_addr;
2202 {
2203 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2204 field_addr = *field_addr_tmp;
2205 FC_FREE(field_addr_tmp);
2206 }
2207#endif /* FREECIV_JSON_CONNECTION */
2208
2209 log_packet_detailed("packet_authentication_reply_100: sending info about ()");
2210
2211#ifdef FREECIV_DELTA_PROTOCOL
2212 if (NULL == *hash) {
2213 *hash = genhash_new_full(hash_packet_authentication_reply_100, cmp_packet_authentication_reply_100,
2214 NULL, NULL, NULL, free);
2215 }
2216 BV_CLR_ALL(fields);
2217
2218 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2219 old = fc_malloc(sizeof(*old));
2220 *old = *real_packet;
2221 genhash_insert(*hash, old, old);
2222 memset(old, 0, sizeof(*old));
2223 }
2224 differ = (strcmp(old->password, real_packet->password) != 0);
2225 if (differ) {
2226 BV_SET(fields, 0);
2227 }
2228
2229
2230#ifdef FREECIV_JSON_CONNECTION
2231 field_addr.name = "fields";
2232#endif /* FREECIV_JSON_CONNECTION */
2233 e = 0;
2234 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2235 if (e) {
2236 log_packet_detailed("fields bitvector error detected");
2237 }
2238
2239 if (BV_ISSET(fields, 0)) {
2240 log_packet_detailed(" field 'password' has changed");
2241#ifdef FREECIV_JSON_CONNECTION
2242 field_addr.name = "password";
2243#endif /* FREECIV_JSON_CONNECTION */
2244 e = 0;
2245 e |= DIO_PUT(string, &dout, &field_addr, real_packet->password);
2246 if (e) {
2247 log_packet_detailed("'password' field error detected");
2248 }
2249 }
2250
2251 *old = *real_packet;
2252#endif /* FREECIV_DELTA_PROTOCOL */
2253#ifndef FREECIV_DELTA_PROTOCOL
2254#ifdef FREECIV_JSON_CONNECTION
2255 field_addr.name = "password";
2256#endif /* FREECIV_JSON_CONNECTION */
2257 e = 0;
2258 e |= DIO_PUT(string, &dout, &field_addr, real_packet->password);
2259 if (e) {
2260 log_packet_detailed("'password' field error detected");
2261 }
2262
2263#endif
2264 SEND_PACKET_END(PACKET_AUTHENTICATION_REPLY);
2265}
2266
2267 int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
2268{
2269 if (!pc->used) {
2270 log_error("WARNING: trying to send data to the closed connection %s",
2271 conn_description(pc));
2272 return -1;
2273 }
2274 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_AUTHENTICATION_REPLY].packet != NULL, -1,
2275 "Handler for PACKET_AUTHENTICATION_REPLY not installed");
2276 return pc->phs.handlers->send[PACKET_AUTHENTICATION_REPLY].packet(pc, packet);
2277}
2278
2279 static struct packet_server_shutdown *receive_packet_server_shutdown_100(struct connection *pc)
2280{
2281 RECEIVE_PACKET_START(packet_server_shutdown, real_packet);
2282#if 1 /* To match endif */
2283 real_packet->__dummy = 0xff;
2284#endif
2285 log_packet_detailed("packet_server_shutdown_100: got info about ()");
2286 RECEIVE_PACKET_END(real_packet);
2287}
2288
2289 static int send_packet_server_shutdown_100(struct connection *pc)
2290{
2291 SEND_PACKET_START(PACKET_SERVER_SHUTDOWN);
2292
2293 log_packet_detailed("packet_server_shutdown_100: sending info about ()");
2294 SEND_PACKET_END(PACKET_SERVER_SHUTDOWN);
2295}
2296
2297 int send_packet_server_shutdown(struct connection *pc)
2298{
2299 if (!pc->used) {
2300 log_error("WARNING: trying to send data to the closed connection %s",
2301 conn_description(pc));
2302 return -1;
2303 }
2304 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SHUTDOWN].no_packet != NULL, -1,
2305 "Handler for PACKET_SERVER_SHUTDOWN not installed");
2306 return pc->phs.handlers->send[PACKET_SERVER_SHUTDOWN].no_packet(pc);
2307}
2308
2309 void lsend_packet_server_shutdown(struct conn_list *dest)
2310{
2311 conn_list_iterate(dest, pconn) {
2312 send_packet_server_shutdown(pconn);
2313 } conn_list_iterate_end;
2314}
2315
2316#ifdef FREECIV_DELTA_PROTOCOL
2317#define hash_packet_nation_select_req_100 hash_const
2318
2319#define cmp_packet_nation_select_req_100 cmp_const
2320
2321 BV_DEFINE(packet_nation_select_req_100_fields, 5);
2322#endif /* FREECIV_DELTA_PROTOCOL */
2323
2324 static struct packet_nation_select_req *receive_packet_nation_select_req_100(struct connection *pc)
2325{
2326#ifdef FREECIV_DELTA_PROTOCOL
2327 packet_nation_select_req_100_fields fields;
2328 struct packet_nation_select_req *old;
2329 struct genhash **hash = pc->phs.received + PACKET_NATION_SELECT_REQ;
2330#endif /* FREECIV_DELTA_PROTOCOL */
2331 RECEIVE_PACKET_START(packet_nation_select_req, real_packet);
2332#ifdef FREECIV_JSON_CONNECTION
2333 struct plocation field_addr;
2334 {
2335 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2336 field_addr = *field_addr_tmp;
2337 FC_FREE(field_addr_tmp);
2338 }
2339#endif /* FREECIV_JSON_CONNECTION */
2340
2341#ifdef FREECIV_DELTA_PROTOCOL
2342#ifdef FREECIV_JSON_CONNECTION
2343 field_addr.name = "fields";
2344#endif /* FREECIV_JSON_CONNECTION */
2345 DIO_BV_GET(&din, &field_addr, fields);
2346
2347#else /* FREECIV_DELTA_PROTOCOL */
2348#ifdef FREECIV_JSON_CONNECTION
2349 field_addr.name = "player_no";
2350#endif /* FREECIV_JSON_CONNECTION */
2351 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2352 RECEIVE_PACKET_FIELD_ERROR(player_no);
2353 }
2354#ifdef FREECIV_JSON_CONNECTION
2355 field_addr.name = "nation_no";
2356#endif /* FREECIV_JSON_CONNECTION */
2357 {
2358 int readin;
2359
2360 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
2361 RECEIVE_PACKET_FIELD_ERROR(nation_no);
2362 }
2363 real_packet->nation_no = readin;
2364 }
2365#ifdef FREECIV_JSON_CONNECTION
2366 field_addr.name = "is_male";
2367#endif /* FREECIV_JSON_CONNECTION */
2368 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
2369 RECEIVE_PACKET_FIELD_ERROR(is_male);
2370 }
2371#ifdef FREECIV_JSON_CONNECTION
2372 field_addr.name = "name";
2373#endif /* FREECIV_JSON_CONNECTION */
2374 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
2375 RECEIVE_PACKET_FIELD_ERROR(name);
2376 }
2377#ifdef FREECIV_JSON_CONNECTION
2378 field_addr.name = "style";
2379#endif /* FREECIV_JSON_CONNECTION */
2380 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
2381 RECEIVE_PACKET_FIELD_ERROR(style);
2382 }
2383#endif
2384 log_packet_detailed("packet_nation_select_req_100: got info about ()");
2385
2386#ifdef FREECIV_DELTA_PROTOCOL
2387 if (NULL == *hash) {
2388 *hash = genhash_new_full(hash_packet_nation_select_req_100, cmp_packet_nation_select_req_100,
2389 NULL, NULL, NULL, free);
2390 }
2391
2392 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2393 *real_packet = *old;
2394 } else {
2395 log_packet_detailed(" no old info");
2396 memset(real_packet, 0, sizeof(*real_packet));
2397 }
2398
2399 if (BV_ISSET(fields, 0)) {
2400 log_packet_detailed(" got field 'player_no'");
2401#ifdef FREECIV_JSON_CONNECTION
2402 field_addr.name = "player_no";
2403#endif /* FREECIV_JSON_CONNECTION */
2404 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2405 RECEIVE_PACKET_FIELD_ERROR(player_no);
2406 }
2407 }
2408 if (BV_ISSET(fields, 1)) {
2409 log_packet_detailed(" got field 'nation_no'");
2410#ifdef FREECIV_JSON_CONNECTION
2411 field_addr.name = "nation_no";
2412#endif /* FREECIV_JSON_CONNECTION */
2413 {
2414 int readin;
2415
2416 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
2417 RECEIVE_PACKET_FIELD_ERROR(nation_no);
2418 }
2419 real_packet->nation_no = readin;
2420 }
2421 }
2422 real_packet->is_male = BV_ISSET(fields, 2);
2423 if (BV_ISSET(fields, 3)) {
2424 log_packet_detailed(" got field 'name'");
2425#ifdef FREECIV_JSON_CONNECTION
2426 field_addr.name = "name";
2427#endif /* FREECIV_JSON_CONNECTION */
2428 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
2429 RECEIVE_PACKET_FIELD_ERROR(name);
2430 }
2431 }
2432 if (BV_ISSET(fields, 4)) {
2433 log_packet_detailed(" got field 'style'");
2434#ifdef FREECIV_JSON_CONNECTION
2435 field_addr.name = "style";
2436#endif /* FREECIV_JSON_CONNECTION */
2437 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
2438 RECEIVE_PACKET_FIELD_ERROR(style);
2439 }
2440 }
2441
2442 if (NULL == old) {
2443 old = fc_malloc(sizeof(*old));
2444 *old = *real_packet;
2445 genhash_insert(*hash, old, old);
2446 } else {
2447 *old = *real_packet;
2448 }
2449
2450#endif /* FREECIV_DELTA_PROTOCOL */
2451 RECEIVE_PACKET_END(real_packet);
2452}
2453
2454 static int send_packet_nation_select_req_100(struct connection *pc, const struct packet_nation_select_req *packet)
2455{
2456 const struct packet_nation_select_req *real_packet = packet;
2457 int e;
2458#ifdef FREECIV_DELTA_PROTOCOL
2459 packet_nation_select_req_100_fields fields;
2460 struct packet_nation_select_req *old;
2461 bool differ;
2462 struct genhash **hash = pc->phs.sent + PACKET_NATION_SELECT_REQ;
2463#endif /* FREECIV_DELTA_PROTOCOL */
2464 SEND_PACKET_START(PACKET_NATION_SELECT_REQ);
2465#ifdef FREECIV_JSON_CONNECTION
2466 struct plocation field_addr;
2467 {
2468 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2469 field_addr = *field_addr_tmp;
2470 FC_FREE(field_addr_tmp);
2471 }
2472#endif /* FREECIV_JSON_CONNECTION */
2473
2474 log_packet_detailed("packet_nation_select_req_100: sending info about ()");
2475
2476#ifdef FREECIV_DELTA_PROTOCOL
2477 if (NULL == *hash) {
2478 *hash = genhash_new_full(hash_packet_nation_select_req_100, cmp_packet_nation_select_req_100,
2479 NULL, NULL, NULL, free);
2480 }
2481 BV_CLR_ALL(fields);
2482
2483 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2484 old = fc_malloc(sizeof(*old));
2485 *old = *real_packet;
2486 genhash_insert(*hash, old, old);
2487 memset(old, 0, sizeof(*old));
2488 }
2489 differ = (old->player_no != real_packet->player_no);
2490 if (differ) {
2491 BV_SET(fields, 0);
2492 }
2493
2494 differ = (old->nation_no != real_packet->nation_no);
2495 if (differ) {
2496 BV_SET(fields, 1);
2497 }
2498
2499 if (packet->is_male) {
2500 BV_SET(fields, 2);
2501 }
2502
2503 differ = (strcmp(old->name, real_packet->name) != 0);
2504 if (differ) {
2505 BV_SET(fields, 3);
2506 }
2507
2508 differ = (old->style != real_packet->style);
2509 if (differ) {
2510 BV_SET(fields, 4);
2511 }
2512
2513
2514#ifdef FREECIV_JSON_CONNECTION
2515 field_addr.name = "fields";
2516#endif /* FREECIV_JSON_CONNECTION */
2517 e = 0;
2518 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2519 if (e) {
2520 log_packet_detailed("fields bitvector error detected");
2521 }
2522
2523 if (BV_ISSET(fields, 0)) {
2524 log_packet_detailed(" field 'player_no' has changed");
2525#ifdef FREECIV_JSON_CONNECTION
2526 field_addr.name = "player_no";
2527#endif /* FREECIV_JSON_CONNECTION */
2528 e = 0;
2529 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2530 if (e) {
2531 log_packet_detailed("'player_no' field error detected");
2532 }
2533 }
2534 if (BV_ISSET(fields, 1)) {
2535 log_packet_detailed(" field 'nation_no' has changed");
2536#ifdef FREECIV_JSON_CONNECTION
2537 field_addr.name = "nation_no";
2538#endif /* FREECIV_JSON_CONNECTION */
2539 e = 0;
2540 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_no);
2541 if (e) {
2542 log_packet_detailed("'nation_no' field error detected");
2543 }
2544 }
2545 /* field 2 is folded into the header */
2546 if (BV_ISSET(fields, 3)) {
2547 log_packet_detailed(" field 'name' has changed");
2548#ifdef FREECIV_JSON_CONNECTION
2549 field_addr.name = "name";
2550#endif /* FREECIV_JSON_CONNECTION */
2551 e = 0;
2552 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
2553 if (e) {
2554 log_packet_detailed("'name' field error detected");
2555 }
2556 }
2557 if (BV_ISSET(fields, 4)) {
2558 log_packet_detailed(" field 'style' has changed");
2559#ifdef FREECIV_JSON_CONNECTION
2560 field_addr.name = "style";
2561#endif /* FREECIV_JSON_CONNECTION */
2562 e = 0;
2563 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
2564 if (e) {
2565 log_packet_detailed("'style' field error detected");
2566 }
2567 }
2568
2569 *old = *real_packet;
2570#endif /* FREECIV_DELTA_PROTOCOL */
2571#ifndef FREECIV_DELTA_PROTOCOL
2572#ifdef FREECIV_JSON_CONNECTION
2573 field_addr.name = "player_no";
2574#endif /* FREECIV_JSON_CONNECTION */
2575 e = 0;
2576 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2577 if (e) {
2578 log_packet_detailed("'player_no' field error detected");
2579 }
2580#ifdef FREECIV_JSON_CONNECTION
2581 field_addr.name = "nation_no";
2582#endif /* FREECIV_JSON_CONNECTION */
2583 e = 0;
2584 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation_no);
2585 if (e) {
2586 log_packet_detailed("'nation_no' field error detected");
2587 }
2588#ifdef FREECIV_JSON_CONNECTION
2589 field_addr.name = "is_male";
2590#endif /* FREECIV_JSON_CONNECTION */
2591 e = 0;
2592 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
2593 if (e) {
2594 log_packet_detailed("'is_male' field error detected");
2595 }
2596#ifdef FREECIV_JSON_CONNECTION
2597 field_addr.name = "name";
2598#endif /* FREECIV_JSON_CONNECTION */
2599 e = 0;
2600 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
2601 if (e) {
2602 log_packet_detailed("'name' field error detected");
2603 }
2604#ifdef FREECIV_JSON_CONNECTION
2605 field_addr.name = "style";
2606#endif /* FREECIV_JSON_CONNECTION */
2607 e = 0;
2608 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
2609 if (e) {
2610 log_packet_detailed("'style' field error detected");
2611 }
2612
2613#endif
2614 SEND_PACKET_END(PACKET_NATION_SELECT_REQ);
2615}
2616
2617 int send_packet_nation_select_req(struct connection *pc, const struct packet_nation_select_req *packet)
2618{
2619 if (!pc->used) {
2620 log_error("WARNING: trying to send data to the closed connection %s",
2621 conn_description(pc));
2622 return -1;
2623 }
2624 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NATION_SELECT_REQ].packet != NULL, -1,
2625 "Handler for PACKET_NATION_SELECT_REQ not installed");
2626 return pc->phs.handlers->send[PACKET_NATION_SELECT_REQ].packet(pc, packet);
2627}
2628
2629 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)
2630{
2631 struct packet_nation_select_req packet, *real_packet = &packet;
2632
2633 real_packet->player_no = player_no;
2634 real_packet->nation_no = nation_no;
2635 real_packet->is_male = is_male;
2636 sz_strlcpy(real_packet->name, name);
2637 real_packet->style = style;
2638
2639 return send_packet_nation_select_req(pc, real_packet);
2640}
2641
2642#ifdef FREECIV_DELTA_PROTOCOL
2643#define hash_packet_player_ready_100 hash_const
2644
2645#define cmp_packet_player_ready_100 cmp_const
2646
2647 BV_DEFINE(packet_player_ready_100_fields, 2);
2648#endif /* FREECIV_DELTA_PROTOCOL */
2649
2650 static struct packet_player_ready *receive_packet_player_ready_100(struct connection *pc)
2651{
2652#ifdef FREECIV_DELTA_PROTOCOL
2653 packet_player_ready_100_fields fields;
2654 struct packet_player_ready *old;
2655 struct genhash **hash = pc->phs.received + PACKET_PLAYER_READY;
2656#endif /* FREECIV_DELTA_PROTOCOL */
2657 RECEIVE_PACKET_START(packet_player_ready, real_packet);
2658#ifdef FREECIV_JSON_CONNECTION
2659 struct plocation field_addr;
2660 {
2661 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2662 field_addr = *field_addr_tmp;
2663 FC_FREE(field_addr_tmp);
2664 }
2665#endif /* FREECIV_JSON_CONNECTION */
2666
2667#ifdef FREECIV_DELTA_PROTOCOL
2668#ifdef FREECIV_JSON_CONNECTION
2669 field_addr.name = "fields";
2670#endif /* FREECIV_JSON_CONNECTION */
2671 DIO_BV_GET(&din, &field_addr, fields);
2672
2673#else /* FREECIV_DELTA_PROTOCOL */
2674#ifdef FREECIV_JSON_CONNECTION
2675 field_addr.name = "player_no";
2676#endif /* FREECIV_JSON_CONNECTION */
2677 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2678 RECEIVE_PACKET_FIELD_ERROR(player_no);
2679 }
2680#ifdef FREECIV_JSON_CONNECTION
2681 field_addr.name = "is_ready";
2682#endif /* FREECIV_JSON_CONNECTION */
2683 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_ready)) {
2684 RECEIVE_PACKET_FIELD_ERROR(is_ready);
2685 }
2686#endif
2687 log_packet_detailed("packet_player_ready_100: got info about ()");
2688
2689#ifdef FREECIV_DELTA_PROTOCOL
2690 if (NULL == *hash) {
2691 *hash = genhash_new_full(hash_packet_player_ready_100, cmp_packet_player_ready_100,
2692 NULL, NULL, NULL, free);
2693 }
2694
2695 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
2696 *real_packet = *old;
2697 } else {
2698 log_packet_detailed(" no old info");
2699 memset(real_packet, 0, sizeof(*real_packet));
2700 }
2701
2702 if (BV_ISSET(fields, 0)) {
2703 log_packet_detailed(" got field 'player_no'");
2704#ifdef FREECIV_JSON_CONNECTION
2705 field_addr.name = "player_no";
2706#endif /* FREECIV_JSON_CONNECTION */
2707 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_no)) {
2708 RECEIVE_PACKET_FIELD_ERROR(player_no);
2709 }
2710 }
2711 real_packet->is_ready = BV_ISSET(fields, 1);
2712
2713 if (NULL == old) {
2714 old = fc_malloc(sizeof(*old));
2715 *old = *real_packet;
2716 genhash_insert(*hash, old, old);
2717 } else {
2718 *old = *real_packet;
2719 }
2720
2721#endif /* FREECIV_DELTA_PROTOCOL */
2722 RECEIVE_PACKET_END(real_packet);
2723}
2724
2725 static int send_packet_player_ready_100(struct connection *pc, const struct packet_player_ready *packet)
2726{
2727 const struct packet_player_ready *real_packet = packet;
2728 int e;
2729#ifdef FREECIV_DELTA_PROTOCOL
2730 packet_player_ready_100_fields fields;
2731 struct packet_player_ready *old;
2732 bool differ;
2733 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_READY;
2734#endif /* FREECIV_DELTA_PROTOCOL */
2735 SEND_PACKET_START(PACKET_PLAYER_READY);
2736#ifdef FREECIV_JSON_CONNECTION
2737 struct plocation field_addr;
2738 {
2739 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2740 field_addr = *field_addr_tmp;
2741 FC_FREE(field_addr_tmp);
2742 }
2743#endif /* FREECIV_JSON_CONNECTION */
2744
2745 log_packet_detailed("packet_player_ready_100: sending info about ()");
2746
2747#ifdef FREECIV_DELTA_PROTOCOL
2748 if (NULL == *hash) {
2749 *hash = genhash_new_full(hash_packet_player_ready_100, cmp_packet_player_ready_100,
2750 NULL, NULL, NULL, free);
2751 }
2752 BV_CLR_ALL(fields);
2753
2754 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
2755 old = fc_malloc(sizeof(*old));
2756 *old = *real_packet;
2757 genhash_insert(*hash, old, old);
2758 memset(old, 0, sizeof(*old));
2759 }
2760 differ = (old->player_no != real_packet->player_no);
2761 if (differ) {
2762 BV_SET(fields, 0);
2763 }
2764
2765 if (packet->is_ready) {
2766 BV_SET(fields, 1);
2767 }
2768
2769
2770#ifdef FREECIV_JSON_CONNECTION
2771 field_addr.name = "fields";
2772#endif /* FREECIV_JSON_CONNECTION */
2773 e = 0;
2774 e |= DIO_BV_PUT(&dout, &field_addr, fields);
2775 if (e) {
2776 log_packet_detailed("fields bitvector error detected");
2777 }
2778
2779 if (BV_ISSET(fields, 0)) {
2780 log_packet_detailed(" field 'player_no' has changed");
2781#ifdef FREECIV_JSON_CONNECTION
2782 field_addr.name = "player_no";
2783#endif /* FREECIV_JSON_CONNECTION */
2784 e = 0;
2785 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2786 if (e) {
2787 log_packet_detailed("'player_no' field error detected");
2788 }
2789 }
2790 /* field 1 is folded into the header */
2791
2792 *old = *real_packet;
2793#endif /* FREECIV_DELTA_PROTOCOL */
2794#ifndef FREECIV_DELTA_PROTOCOL
2795#ifdef FREECIV_JSON_CONNECTION
2796 field_addr.name = "player_no";
2797#endif /* FREECIV_JSON_CONNECTION */
2798 e = 0;
2799 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_no);
2800 if (e) {
2801 log_packet_detailed("'player_no' field error detected");
2802 }
2803#ifdef FREECIV_JSON_CONNECTION
2804 field_addr.name = "is_ready";
2805#endif /* FREECIV_JSON_CONNECTION */
2806 e = 0;
2807 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_ready);
2808 if (e) {
2809 log_packet_detailed("'is_ready' field error detected");
2810 }
2811
2812#endif
2813 SEND_PACKET_END(PACKET_PLAYER_READY);
2814}
2815
2816 int send_packet_player_ready(struct connection *pc, const struct packet_player_ready *packet)
2817{
2818 if (!pc->used) {
2819 log_error("WARNING: trying to send data to the closed connection %s",
2820 conn_description(pc));
2821 return -1;
2822 }
2823 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_READY].packet != NULL, -1,
2824 "Handler for PACKET_PLAYER_READY not installed");
2825 return pc->phs.handlers->send[PACKET_PLAYER_READY].packet(pc, packet);
2826}
2827
2828 int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
2829{
2830 struct packet_player_ready packet, *real_packet = &packet;
2831
2832 real_packet->player_no = player_no;
2833 real_packet->is_ready = is_ready;
2834
2835 return send_packet_player_ready(pc, real_packet);
2836}
2837
2838 static struct packet_endgame_report *receive_packet_endgame_report_100(struct connection *pc)
2839{
2840 RECEIVE_PACKET_START(packet_endgame_report, real_packet);
2841#ifdef FREECIV_JSON_CONNECTION
2842 struct plocation field_addr;
2843 {
2844 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2845 field_addr = *field_addr_tmp;
2846 FC_FREE(field_addr_tmp);
2847 }
2848#endif /* FREECIV_JSON_CONNECTION */
2849#if 1 /* To match endif */
2850#ifdef FREECIV_JSON_CONNECTION
2851 field_addr.name = "category_num";
2852#endif /* FREECIV_JSON_CONNECTION */
2853 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category_num)) {
2854 RECEIVE_PACKET_FIELD_ERROR(category_num);
2855 }
2856#ifdef FREECIV_JSON_CONNECTION
2857 field_addr.name = "category_name";
2858#endif /* FREECIV_JSON_CONNECTION */
2859 {
2860 int i;
2861
2862#ifdef FREECIV_JSON_CONNECTION
2863 /* Enter array. */
2864 field_addr.sub_location = plocation_elem_new(0);
2865#endif /* FREECIV_JSON_CONNECTION */
2866
2867 if (real_packet->category_num > 32) {
2868 RECEIVE_PACKET_FIELD_ERROR(category_name, ": truncation array");
2869 }
2870 for (i = 0; i < real_packet->category_num; i++) {
2871#ifdef FREECIV_JSON_CONNECTION
2872 field_addr.sub_location->number = i;
2873#endif /* FREECIV_JSON_CONNECTION */
2874 if (!DIO_GET(string, &din, &field_addr, real_packet->category_name[i], sizeof(real_packet->category_name[i]))) {
2875 RECEIVE_PACKET_FIELD_ERROR(category_name);
2876 }
2877 }
2878
2879#ifdef FREECIV_JSON_CONNECTION
2880 /* Exit array. */
2881 FC_FREE(field_addr.sub_location);
2882#endif /* FREECIV_JSON_CONNECTION */
2883 }
2884#ifdef FREECIV_JSON_CONNECTION
2885 field_addr.name = "player_num";
2886#endif /* FREECIV_JSON_CONNECTION */
2887 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
2888 RECEIVE_PACKET_FIELD_ERROR(player_num);
2889 }
2890#endif
2891 log_packet_detailed("packet_endgame_report_100: got info about ()");
2892 RECEIVE_PACKET_END(real_packet);
2893}
2894
2895 static int send_packet_endgame_report_100(struct connection *pc, const struct packet_endgame_report *packet)
2896{
2897 const struct packet_endgame_report *real_packet = packet;
2898 int e;
2899 SEND_PACKET_START(PACKET_ENDGAME_REPORT);
2900#ifdef FREECIV_JSON_CONNECTION
2901 struct plocation field_addr;
2902 {
2903 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2904 field_addr = *field_addr_tmp;
2905 FC_FREE(field_addr_tmp);
2906 }
2907#endif /* FREECIV_JSON_CONNECTION */
2908
2909 log_packet_detailed("packet_endgame_report_100: sending info about ()");
2910#if 1 /* To match endif */
2911#ifdef FREECIV_JSON_CONNECTION
2912 field_addr.name = "category_num";
2913#endif /* FREECIV_JSON_CONNECTION */
2914 e = 0;
2915 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category_num);
2916 if (e) {
2917 log_packet_detailed("'category_num' field error detected");
2918 }
2919#ifdef FREECIV_JSON_CONNECTION
2920 field_addr.name = "category_name";
2921#endif /* FREECIV_JSON_CONNECTION */
2922 e = 0;
2923 {
2924 int i;
2925
2926#ifdef FREECIV_JSON_CONNECTION
2927 /* Create the array. */
2928 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->category_num);
2929
2930 /* Enter the array. */
2931 field_addr.sub_location = plocation_elem_new(0);
2932#endif /* FREECIV_JSON_CONNECTION */
2933
2934 for (i = 0; i < real_packet->category_num; i++) {
2935#ifdef FREECIV_JSON_CONNECTION
2936 /* Next array element. */
2937 field_addr.sub_location->number = i;
2938#endif /* FREECIV_JSON_CONNECTION */
2939 e |= DIO_PUT(string, &dout, &field_addr, real_packet->category_name[i]);
2940 }
2941
2942#ifdef FREECIV_JSON_CONNECTION
2943 /* Exit array. */
2944 FC_FREE(field_addr.sub_location);
2945#endif /* FREECIV_JSON_CONNECTION */
2946 }
2947 if (e) {
2948 log_packet_detailed("'category_name' field error detected");
2949 }
2950#ifdef FREECIV_JSON_CONNECTION
2951 field_addr.name = "player_num";
2952#endif /* FREECIV_JSON_CONNECTION */
2953 e = 0;
2954 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
2955 if (e) {
2956 log_packet_detailed("'player_num' field error detected");
2957 }
2958
2959#endif
2960 SEND_PACKET_END(PACKET_ENDGAME_REPORT);
2961}
2962
2963 int send_packet_endgame_report(struct connection *pc, const struct packet_endgame_report *packet)
2964{
2965 if (!pc->used) {
2966 log_error("WARNING: trying to send data to the closed connection %s",
2967 conn_description(pc));
2968 return -1;
2969 }
2970 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ENDGAME_REPORT].packet != NULL, -1,
2971 "Handler for PACKET_ENDGAME_REPORT not installed");
2972 return pc->phs.handlers->send[PACKET_ENDGAME_REPORT].packet(pc, packet);
2973}
2974
2975 void lsend_packet_endgame_report(struct conn_list *dest, const struct packet_endgame_report *packet)
2976{
2977 conn_list_iterate(dest, pconn) {
2978 send_packet_endgame_report(pconn, packet);
2979 } conn_list_iterate_end;
2980}
2981
2982 static struct packet_endgame_player *receive_packet_endgame_player_100(struct connection *pc)
2983{
2984 RECEIVE_PACKET_START(packet_endgame_player, real_packet);
2985#ifdef FREECIV_JSON_CONNECTION
2986 struct plocation field_addr;
2987 {
2988 struct plocation *field_addr_tmp = plocation_field_new(NULL);
2989 field_addr = *field_addr_tmp;
2990 FC_FREE(field_addr_tmp);
2991 }
2992#endif /* FREECIV_JSON_CONNECTION */
2993#if 1 /* To match endif */
2994#ifdef FREECIV_JSON_CONNECTION
2995 field_addr.name = "category_num";
2996#endif /* FREECIV_JSON_CONNECTION */
2997 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category_num)) {
2998 RECEIVE_PACKET_FIELD_ERROR(category_num);
2999 }
3000#ifdef FREECIV_JSON_CONNECTION
3001 field_addr.name = "player_id";
3002#endif /* FREECIV_JSON_CONNECTION */
3003 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_id)) {
3004 RECEIVE_PACKET_FIELD_ERROR(player_id);
3005 }
3006#ifdef FREECIV_JSON_CONNECTION
3007 field_addr.name = "score";
3008#endif /* FREECIV_JSON_CONNECTION */
3009 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
3010 RECEIVE_PACKET_FIELD_ERROR(score);
3011 }
3012#ifdef FREECIV_JSON_CONNECTION
3013 field_addr.name = "category_score";
3014#endif /* FREECIV_JSON_CONNECTION */
3015 {
3016 int i;
3017
3018#ifdef FREECIV_JSON_CONNECTION
3019 /* Enter array. */
3020 field_addr.sub_location = plocation_elem_new(0);
3021#endif /* FREECIV_JSON_CONNECTION */
3022
3023 if (real_packet->category_num > 32) {
3024 RECEIVE_PACKET_FIELD_ERROR(category_score, ": truncation array");
3025 }
3026 for (i = 0; i < real_packet->category_num; i++) {
3027#ifdef FREECIV_JSON_CONNECTION
3028 field_addr.sub_location->number = i;
3029#endif /* FREECIV_JSON_CONNECTION */
3030 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->category_score[i])) {
3031 RECEIVE_PACKET_FIELD_ERROR(category_score);
3032 }
3033 }
3034
3035#ifdef FREECIV_JSON_CONNECTION
3036 /* Exit array. */
3037 FC_FREE(field_addr.sub_location);
3038#endif /* FREECIV_JSON_CONNECTION */
3039 }
3040#ifdef FREECIV_JSON_CONNECTION
3041 field_addr.name = "winner";
3042#endif /* FREECIV_JSON_CONNECTION */
3043 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->winner)) {
3044 RECEIVE_PACKET_FIELD_ERROR(winner);
3045 }
3046#endif
3047 log_packet_detailed("packet_endgame_player_100: got info about ()");
3048 RECEIVE_PACKET_END(real_packet);
3049}
3050
3051 static int send_packet_endgame_player_100(struct connection *pc, const struct packet_endgame_player *packet)
3052{
3053 const struct packet_endgame_player *real_packet = packet;
3054 int e;
3055 SEND_PACKET_START(PACKET_ENDGAME_PLAYER);
3056#ifdef FREECIV_JSON_CONNECTION
3057 struct plocation field_addr;
3058 {
3059 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3060 field_addr = *field_addr_tmp;
3061 FC_FREE(field_addr_tmp);
3062 }
3063#endif /* FREECIV_JSON_CONNECTION */
3064
3065 log_packet_detailed("packet_endgame_player_100: sending info about ()");
3066#if 1 /* To match endif */
3067#ifdef FREECIV_JSON_CONNECTION
3068 field_addr.name = "category_num";
3069#endif /* FREECIV_JSON_CONNECTION */
3070 e = 0;
3071 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category_num);
3072 if (e) {
3073 log_packet_detailed("'category_num' field error detected");
3074 }
3075#ifdef FREECIV_JSON_CONNECTION
3076 field_addr.name = "player_id";
3077#endif /* FREECIV_JSON_CONNECTION */
3078 e = 0;
3079 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_id);
3080 if (e) {
3081 log_packet_detailed("'player_id' field error detected");
3082 }
3083#ifdef FREECIV_JSON_CONNECTION
3084 field_addr.name = "score";
3085#endif /* FREECIV_JSON_CONNECTION */
3086 e = 0;
3087 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
3088 if (e) {
3089 log_packet_detailed("'score' field error detected");
3090 }
3091#ifdef FREECIV_JSON_CONNECTION
3092 field_addr.name = "category_score";
3093#endif /* FREECIV_JSON_CONNECTION */
3094 e = 0;
3095 {
3096 int i;
3097
3098#ifdef FREECIV_JSON_CONNECTION
3099 /* Create the array. */
3100 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->category_num);
3101
3102 /* Enter the array. */
3103 field_addr.sub_location = plocation_elem_new(0);
3104#endif /* FREECIV_JSON_CONNECTION */
3105
3106 for (i = 0; i < real_packet->category_num; i++) {
3107#ifdef FREECIV_JSON_CONNECTION
3108 /* Next array element. */
3109 field_addr.sub_location->number = i;
3110#endif /* FREECIV_JSON_CONNECTION */
3111 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->category_score[i]);
3112 }
3113
3114#ifdef FREECIV_JSON_CONNECTION
3115 /* Exit array. */
3116 FC_FREE(field_addr.sub_location);
3117#endif /* FREECIV_JSON_CONNECTION */
3118 }
3119 if (e) {
3120 log_packet_detailed("'category_score' field error detected");
3121 }
3122#ifdef FREECIV_JSON_CONNECTION
3123 field_addr.name = "winner";
3124#endif /* FREECIV_JSON_CONNECTION */
3125 e = 0;
3126 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->winner);
3127 if (e) {
3128 log_packet_detailed("'winner' field error detected");
3129 }
3130
3131#endif
3132 SEND_PACKET_END(PACKET_ENDGAME_PLAYER);
3133}
3134
3135 int send_packet_endgame_player(struct connection *pc, const struct packet_endgame_player *packet)
3136{
3137 if (!pc->used) {
3138 log_error("WARNING: trying to send data to the closed connection %s",
3139 conn_description(pc));
3140 return -1;
3141 }
3142 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ENDGAME_PLAYER].packet != NULL, -1,
3143 "Handler for PACKET_ENDGAME_PLAYER not installed");
3144 return pc->phs.handlers->send[PACKET_ENDGAME_PLAYER].packet(pc, packet);
3145}
3146
3147 void lsend_packet_endgame_player(struct conn_list *dest, const struct packet_endgame_player *packet)
3148{
3149 conn_list_iterate(dest, pconn) {
3150 send_packet_endgame_player(pconn, packet);
3151 } conn_list_iterate_end;
3152}
3153
3154#ifdef FREECIV_DELTA_PROTOCOL
3155static genhash_val_t hash_packet_tile_info_100(const void *vkey)
3156{
3157 const struct packet_tile_info *key = (const struct packet_tile_info *) vkey;
3158 genhash_val_t result = 0;
3159
3160 result += key->tile;
3161
3162 result &= 0xFFFFFFFF;
3163 return result;
3164}
3165
3166static bool cmp_packet_tile_info_100(const void *vkey1, const void *vkey2)
3167{
3168 const struct packet_tile_info *old = (const struct packet_tile_info *) vkey1;
3169 const struct packet_tile_info *real_packet = (const struct packet_tile_info *) vkey2;
3170 bool differ;
3171
3172 differ = (old->tile != real_packet->tile);
3173
3174 return !differ;
3175}
3176 BV_DEFINE(packet_tile_info_100_fields, 12);
3177#endif /* FREECIV_DELTA_PROTOCOL */
3178
3179 static struct packet_tile_info *receive_packet_tile_info_100(struct connection *pc)
3180{
3181#ifdef FREECIV_DELTA_PROTOCOL
3182 packet_tile_info_100_fields fields;
3183 struct packet_tile_info *old;
3184 struct genhash **hash = pc->phs.received + PACKET_TILE_INFO;
3185#endif /* FREECIV_DELTA_PROTOCOL */
3186 RECEIVE_PACKET_START(packet_tile_info, real_packet);
3187#ifdef FREECIV_JSON_CONNECTION
3188 struct plocation field_addr;
3189 {
3190 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3191 field_addr = *field_addr_tmp;
3192 FC_FREE(field_addr_tmp);
3193 }
3194#endif /* FREECIV_JSON_CONNECTION */
3195
3196#ifdef FREECIV_DELTA_PROTOCOL
3197#ifdef FREECIV_JSON_CONNECTION
3198 field_addr.name = "fields";
3199#endif /* FREECIV_JSON_CONNECTION */
3200 DIO_BV_GET(&din, &field_addr, fields);
3201#ifdef FREECIV_JSON_CONNECTION
3202 field_addr.name = "tile";
3203#endif /* FREECIV_JSON_CONNECTION */
3204 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3205 RECEIVE_PACKET_FIELD_ERROR(tile);
3206 }
3207
3208#else /* FREECIV_DELTA_PROTOCOL */
3209#ifdef FREECIV_JSON_CONNECTION
3210 field_addr.name = "tile";
3211#endif /* FREECIV_JSON_CONNECTION */
3212 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
3213 RECEIVE_PACKET_FIELD_ERROR(tile);
3214 }
3215#ifdef FREECIV_JSON_CONNECTION
3216 field_addr.name = "continent";
3217#endif /* FREECIV_JSON_CONNECTION */
3218 {
3219 int readin;
3220
3221 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
3222 RECEIVE_PACKET_FIELD_ERROR(continent);
3223 }
3224 real_packet->continent = readin;
3225 }
3226#ifdef FREECIV_JSON_CONNECTION
3227 field_addr.name = "known";
3228#endif /* FREECIV_JSON_CONNECTION */
3229 {
3230 int readin;
3231
3232 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3233 RECEIVE_PACKET_FIELD_ERROR(known);
3234 }
3235 real_packet->known = readin;
3236 }
3237#ifdef FREECIV_JSON_CONNECTION
3238 field_addr.name = "owner";
3239#endif /* FREECIV_JSON_CONNECTION */
3240 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
3241 RECEIVE_PACKET_FIELD_ERROR(owner);
3242 }
3243#ifdef FREECIV_JSON_CONNECTION
3244 field_addr.name = "extras_owner";
3245#endif /* FREECIV_JSON_CONNECTION */
3246 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->extras_owner)) {
3247 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
3248 }
3249#ifdef FREECIV_JSON_CONNECTION
3250 field_addr.name = "worked";
3251#endif /* FREECIV_JSON_CONNECTION */
3252 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->worked)) {
3253 RECEIVE_PACKET_FIELD_ERROR(worked);
3254 }
3255#ifdef FREECIV_JSON_CONNECTION
3256 field_addr.name = "terrain";
3257#endif /* FREECIV_JSON_CONNECTION */
3258 {
3259 int readin;
3260
3261 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3262 RECEIVE_PACKET_FIELD_ERROR(terrain);
3263 }
3264 real_packet->terrain = readin;
3265 }
3266#ifdef FREECIV_JSON_CONNECTION
3267 field_addr.name = "resource";
3268#endif /* FREECIV_JSON_CONNECTION */
3269 {
3270 int readin;
3271
3272 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3273 RECEIVE_PACKET_FIELD_ERROR(resource);
3274 }
3275 real_packet->resource = readin;
3276 }
3277#ifdef FREECIV_JSON_CONNECTION
3278 field_addr.name = "extras";
3279#endif /* FREECIV_JSON_CONNECTION */
3280 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
3281 RECEIVE_PACKET_FIELD_ERROR(extras);
3282 }
3283#ifdef FREECIV_JSON_CONNECTION
3284 field_addr.name = "placing";
3285#endif /* FREECIV_JSON_CONNECTION */
3286 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
3287 RECEIVE_PACKET_FIELD_ERROR(placing);
3288 }
3289#ifdef FREECIV_JSON_CONNECTION
3290 field_addr.name = "place_turn";
3291#endif /* FREECIV_JSON_CONNECTION */
3292 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
3293 RECEIVE_PACKET_FIELD_ERROR(place_turn);
3294 }
3295#ifdef FREECIV_JSON_CONNECTION
3296 field_addr.name = "spec_sprite";
3297#endif /* FREECIV_JSON_CONNECTION */
3298 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
3299 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
3300 }
3301#ifdef FREECIV_JSON_CONNECTION
3302 field_addr.name = "label";
3303#endif /* FREECIV_JSON_CONNECTION */
3304 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
3305 RECEIVE_PACKET_FIELD_ERROR(label);
3306 }
3307#endif
3308 log_packet_detailed("packet_tile_info_100: got info about (%d)",
3309 real_packet->tile);
3310
3311#ifdef FREECIV_DELTA_PROTOCOL
3312 if (NULL == *hash) {
3313 *hash = genhash_new_full(hash_packet_tile_info_100, cmp_packet_tile_info_100,
3314 NULL, NULL, NULL, free);
3315 }
3316
3317 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
3318 *real_packet = *old;
3319 } else {
3320 int tile;
3321
3322 tile = real_packet->tile;
3323
3324 log_packet_detailed(" no old info");
3325 memset(real_packet, 0, sizeof(*real_packet));
3326
3327 real_packet->tile = tile;
3328 }
3329
3330 if (BV_ISSET(fields, 0)) {
3331 log_packet_detailed(" got field 'continent'");
3332#ifdef FREECIV_JSON_CONNECTION
3333 field_addr.name = "continent";
3334#endif /* FREECIV_JSON_CONNECTION */
3335 {
3336 int readin;
3337
3338 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
3339 RECEIVE_PACKET_FIELD_ERROR(continent);
3340 }
3341 real_packet->continent = readin;
3342 }
3343 }
3344 if (BV_ISSET(fields, 1)) {
3345 log_packet_detailed(" got field 'known'");
3346#ifdef FREECIV_JSON_CONNECTION
3347 field_addr.name = "known";
3348#endif /* FREECIV_JSON_CONNECTION */
3349 {
3350 int readin;
3351
3352 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3353 RECEIVE_PACKET_FIELD_ERROR(known);
3354 }
3355 real_packet->known = readin;
3356 }
3357 }
3358 if (BV_ISSET(fields, 2)) {
3359 log_packet_detailed(" got field 'owner'");
3360#ifdef FREECIV_JSON_CONNECTION
3361 field_addr.name = "owner";
3362#endif /* FREECIV_JSON_CONNECTION */
3363 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
3364 RECEIVE_PACKET_FIELD_ERROR(owner);
3365 }
3366 }
3367 if (BV_ISSET(fields, 3)) {
3368 log_packet_detailed(" got field 'extras_owner'");
3369#ifdef FREECIV_JSON_CONNECTION
3370 field_addr.name = "extras_owner";
3371#endif /* FREECIV_JSON_CONNECTION */
3372 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->extras_owner)) {
3373 RECEIVE_PACKET_FIELD_ERROR(extras_owner);
3374 }
3375 }
3376 if (BV_ISSET(fields, 4)) {
3377 log_packet_detailed(" got field 'worked'");
3378#ifdef FREECIV_JSON_CONNECTION
3379 field_addr.name = "worked";
3380#endif /* FREECIV_JSON_CONNECTION */
3381 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->worked)) {
3382 RECEIVE_PACKET_FIELD_ERROR(worked);
3383 }
3384 }
3385 if (BV_ISSET(fields, 5)) {
3386 log_packet_detailed(" got field 'terrain'");
3387#ifdef FREECIV_JSON_CONNECTION
3388 field_addr.name = "terrain";
3389#endif /* FREECIV_JSON_CONNECTION */
3390 {
3391 int readin;
3392
3393 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3394 RECEIVE_PACKET_FIELD_ERROR(terrain);
3395 }
3396 real_packet->terrain = readin;
3397 }
3398 }
3399 if (BV_ISSET(fields, 6)) {
3400 log_packet_detailed(" got field 'resource'");
3401#ifdef FREECIV_JSON_CONNECTION
3402 field_addr.name = "resource";
3403#endif /* FREECIV_JSON_CONNECTION */
3404 {
3405 int readin;
3406
3407 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3408 RECEIVE_PACKET_FIELD_ERROR(resource);
3409 }
3410 real_packet->resource = readin;
3411 }
3412 }
3413 if (BV_ISSET(fields, 7)) {
3414 log_packet_detailed(" got field 'extras'");
3415#ifdef FREECIV_JSON_CONNECTION
3416 field_addr.name = "extras";
3417#endif /* FREECIV_JSON_CONNECTION */
3418 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
3419 RECEIVE_PACKET_FIELD_ERROR(extras);
3420 }
3421 }
3422 if (BV_ISSET(fields, 8)) {
3423 log_packet_detailed(" got field 'placing'");
3424#ifdef FREECIV_JSON_CONNECTION
3425 field_addr.name = "placing";
3426#endif /* FREECIV_JSON_CONNECTION */
3427 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->placing)) {
3428 RECEIVE_PACKET_FIELD_ERROR(placing);
3429 }
3430 }
3431 if (BV_ISSET(fields, 9)) {
3432 log_packet_detailed(" got field 'place_turn'");
3433#ifdef FREECIV_JSON_CONNECTION
3434 field_addr.name = "place_turn";
3435#endif /* FREECIV_JSON_CONNECTION */
3436 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->place_turn)) {
3437 RECEIVE_PACKET_FIELD_ERROR(place_turn);
3438 }
3439 }
3440 if (BV_ISSET(fields, 10)) {
3441 log_packet_detailed(" got field 'spec_sprite'");
3442#ifdef FREECIV_JSON_CONNECTION
3443 field_addr.name = "spec_sprite";
3444#endif /* FREECIV_JSON_CONNECTION */
3445 if (!DIO_GET(string, &din, &field_addr, real_packet->spec_sprite, sizeof(real_packet->spec_sprite))) {
3446 RECEIVE_PACKET_FIELD_ERROR(spec_sprite);
3447 }
3448 }
3449 if (BV_ISSET(fields, 11)) {
3450 log_packet_detailed(" got field 'label'");
3451#ifdef FREECIV_JSON_CONNECTION
3452 field_addr.name = "label";
3453#endif /* FREECIV_JSON_CONNECTION */
3454 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
3455 RECEIVE_PACKET_FIELD_ERROR(label);
3456 }
3457 }
3458
3459 if (NULL == old) {
3460 old = fc_malloc(sizeof(*old));
3461 *old = *real_packet;
3462 genhash_insert(*hash, old, old);
3463 } else {
3464 *old = *real_packet;
3465 }
3466
3467#endif /* FREECIV_DELTA_PROTOCOL */
3468 RECEIVE_PACKET_END(real_packet);
3469}
3470
3471 static int send_packet_tile_info_100(struct connection *pc, const struct packet_tile_info *packet)
3472{
3473 const struct packet_tile_info *real_packet = packet;
3474 int e;
3475#ifdef FREECIV_DELTA_PROTOCOL
3476 packet_tile_info_100_fields fields;
3477 struct packet_tile_info *old;
3478 bool differ;
3479 struct genhash **hash = pc->phs.sent + PACKET_TILE_INFO;
3480 int different = 0;
3481#endif /* FREECIV_DELTA_PROTOCOL */
3482 SEND_PACKET_START(PACKET_TILE_INFO);
3483#ifdef FREECIV_JSON_CONNECTION
3484 struct plocation field_addr;
3485 {
3486 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3487 field_addr = *field_addr_tmp;
3488 FC_FREE(field_addr_tmp);
3489 }
3490#endif /* FREECIV_JSON_CONNECTION */
3491
3492 log_packet_detailed("packet_tile_info_100: sending info about (%d)",
3493 real_packet->tile);
3494
3495#ifdef FREECIV_DELTA_PROTOCOL
3496 if (NULL == *hash) {
3497 *hash = genhash_new_full(hash_packet_tile_info_100, cmp_packet_tile_info_100,
3498 NULL, NULL, NULL, free);
3499 }
3500 BV_CLR_ALL(fields);
3501
3502 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
3503 old = fc_malloc(sizeof(*old));
3504 *old = *real_packet;
3505 genhash_insert(*hash, old, old);
3506 memset(old, 0, sizeof(*old));
3507 different = 1; /* Force to send. */
3508 }
3509 differ = (old->continent != real_packet->continent);
3510 if (differ) {
3511 different++;
3512 BV_SET(fields, 0);
3513 }
3514
3515 differ = (old->known != real_packet->known);
3516 if (differ) {
3517 different++;
3518 BV_SET(fields, 1);
3519 }
3520
3521 differ = (old->owner != real_packet->owner);
3522 if (differ) {
3523 different++;
3524 BV_SET(fields, 2);
3525 }
3526
3527 differ = (old->extras_owner != real_packet->extras_owner);
3528 if (differ) {
3529 different++;
3530 BV_SET(fields, 3);
3531 }
3532
3533 differ = (old->worked != real_packet->worked);
3534 if (differ) {
3535 different++;
3536 BV_SET(fields, 4);
3537 }
3538
3539 differ = (old->terrain != real_packet->terrain);
3540 if (differ) {
3541 different++;
3542 BV_SET(fields, 5);
3543 }
3544
3545 differ = (old->resource != real_packet->resource);
3546 if (differ) {
3547 different++;
3548 BV_SET(fields, 6);
3549 }
3550
3551 differ = !BV_ARE_EQUAL(old->extras, real_packet->extras);
3552 if (differ) {
3553 different++;
3554 BV_SET(fields, 7);
3555 }
3556
3557 differ = (old->placing != real_packet->placing);
3558 if (differ) {
3559 different++;
3560 BV_SET(fields, 8);
3561 }
3562
3563 differ = (old->place_turn != real_packet->place_turn);
3564 if (differ) {
3565 different++;
3566 BV_SET(fields, 9);
3567 }
3568
3569 differ = (strcmp(old->spec_sprite, real_packet->spec_sprite) != 0);
3570 if (differ) {
3571 different++;
3572 BV_SET(fields, 10);
3573 }
3574
3575 differ = (strcmp(old->label, real_packet->label) != 0);
3576 if (differ) {
3577 different++;
3578 BV_SET(fields, 11);
3579 }
3580
3581 if (different == 0) {
3582 log_packet_detailed(" no change -> discard");
3583 return 0;
3584 }
3585
3586#ifdef FREECIV_JSON_CONNECTION
3587 field_addr.name = "fields";
3588#endif /* FREECIV_JSON_CONNECTION */
3589 e = 0;
3590 e |= DIO_BV_PUT(&dout, &field_addr, fields);
3591 if (e) {
3592 log_packet_detailed("fields bitvector error detected");
3593 }
3594#ifdef FREECIV_JSON_CONNECTION
3595 field_addr.name = "tile";
3596#endif /* FREECIV_JSON_CONNECTION */
3597 e = 0;
3598 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
3599 if (e) {
3600 log_packet_detailed("'tile' field error detected");
3601 }
3602
3603 if (BV_ISSET(fields, 0)) {
3604 log_packet_detailed(" field 'continent' has changed");
3605#ifdef FREECIV_JSON_CONNECTION
3606 field_addr.name = "continent";
3607#endif /* FREECIV_JSON_CONNECTION */
3608 e = 0;
3609 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
3610 if (e) {
3611 log_packet_detailed("'continent' field error detected");
3612 }
3613 }
3614 if (BV_ISSET(fields, 1)) {
3615 log_packet_detailed(" field 'known' has changed");
3616#ifdef FREECIV_JSON_CONNECTION
3617 field_addr.name = "known";
3618#endif /* FREECIV_JSON_CONNECTION */
3619 e = 0;
3620 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
3621 if (e) {
3622 log_packet_detailed("'known' field error detected");
3623 }
3624 }
3625 if (BV_ISSET(fields, 2)) {
3626 log_packet_detailed(" field 'owner' has changed");
3627#ifdef FREECIV_JSON_CONNECTION
3628 field_addr.name = "owner";
3629#endif /* FREECIV_JSON_CONNECTION */
3630 e = 0;
3631 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
3632 if (e) {
3633 log_packet_detailed("'owner' field error detected");
3634 }
3635 }
3636 if (BV_ISSET(fields, 3)) {
3637 log_packet_detailed(" field 'extras_owner' has changed");
3638#ifdef FREECIV_JSON_CONNECTION
3639 field_addr.name = "extras_owner";
3640#endif /* FREECIV_JSON_CONNECTION */
3641 e = 0;
3642 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->extras_owner);
3643 if (e) {
3644 log_packet_detailed("'extras_owner' field error detected");
3645 }
3646 }
3647 if (BV_ISSET(fields, 4)) {
3648 log_packet_detailed(" field 'worked' has changed");
3649#ifdef FREECIV_JSON_CONNECTION
3650 field_addr.name = "worked";
3651#endif /* FREECIV_JSON_CONNECTION */
3652 e = 0;
3653 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->worked);
3654 if (e) {
3655 log_packet_detailed("'worked' field error detected");
3656 }
3657 }
3658 if (BV_ISSET(fields, 5)) {
3659 log_packet_detailed(" field 'terrain' has changed");
3660#ifdef FREECIV_JSON_CONNECTION
3661 field_addr.name = "terrain";
3662#endif /* FREECIV_JSON_CONNECTION */
3663 e = 0;
3664 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
3665 if (e) {
3666 log_packet_detailed("'terrain' field error detected");
3667 }
3668 }
3669 if (BV_ISSET(fields, 6)) {
3670 log_packet_detailed(" field 'resource' has changed");
3671#ifdef FREECIV_JSON_CONNECTION
3672 field_addr.name = "resource";
3673#endif /* FREECIV_JSON_CONNECTION */
3674 e = 0;
3675 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
3676 if (e) {
3677 log_packet_detailed("'resource' field error detected");
3678 }
3679 }
3680 if (BV_ISSET(fields, 7)) {
3681 log_packet_detailed(" field 'extras' has changed");
3682#ifdef FREECIV_JSON_CONNECTION
3683 field_addr.name = "extras";
3684#endif /* FREECIV_JSON_CONNECTION */
3685 e = 0;
3686 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
3687 if (e) {
3688 log_packet_detailed("'extras' field error detected");
3689 }
3690 }
3691 if (BV_ISSET(fields, 8)) {
3692 log_packet_detailed(" field 'placing' has changed");
3693#ifdef FREECIV_JSON_CONNECTION
3694 field_addr.name = "placing";
3695#endif /* FREECIV_JSON_CONNECTION */
3696 e = 0;
3697 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
3698 if (e) {
3699 log_packet_detailed("'placing' field error detected");
3700 }
3701 }
3702 if (BV_ISSET(fields, 9)) {
3703 log_packet_detailed(" field 'place_turn' has changed");
3704#ifdef FREECIV_JSON_CONNECTION
3705 field_addr.name = "place_turn";
3706#endif /* FREECIV_JSON_CONNECTION */
3707 e = 0;
3708 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
3709 if (e) {
3710 log_packet_detailed("'place_turn' field error detected");
3711 }
3712 }
3713 if (BV_ISSET(fields, 10)) {
3714 log_packet_detailed(" field 'spec_sprite' has changed");
3715#ifdef FREECIV_JSON_CONNECTION
3716 field_addr.name = "spec_sprite";
3717#endif /* FREECIV_JSON_CONNECTION */
3718 e = 0;
3719 e |= DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
3720 if (e) {
3721 log_packet_detailed("'spec_sprite' field error detected");
3722 }
3723 }
3724 if (BV_ISSET(fields, 11)) {
3725 log_packet_detailed(" field 'label' has changed");
3726#ifdef FREECIV_JSON_CONNECTION
3727 field_addr.name = "label";
3728#endif /* FREECIV_JSON_CONNECTION */
3729 e = 0;
3730 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
3731 if (e) {
3732 log_packet_detailed("'label' field error detected");
3733 }
3734 }
3735
3736 *old = *real_packet;
3737#endif /* FREECIV_DELTA_PROTOCOL */
3738#ifndef FREECIV_DELTA_PROTOCOL
3739#ifdef FREECIV_JSON_CONNECTION
3740 field_addr.name = "tile";
3741#endif /* FREECIV_JSON_CONNECTION */
3742 e = 0;
3743 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
3744 if (e) {
3745 log_packet_detailed("'tile' field error detected");
3746 }
3747#ifdef FREECIV_JSON_CONNECTION
3748 field_addr.name = "continent";
3749#endif /* FREECIV_JSON_CONNECTION */
3750 e = 0;
3751 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->continent);
3752 if (e) {
3753 log_packet_detailed("'continent' field error detected");
3754 }
3755#ifdef FREECIV_JSON_CONNECTION
3756 field_addr.name = "known";
3757#endif /* FREECIV_JSON_CONNECTION */
3758 e = 0;
3759 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->known);
3760 if (e) {
3761 log_packet_detailed("'known' field error detected");
3762 }
3763#ifdef FREECIV_JSON_CONNECTION
3764 field_addr.name = "owner";
3765#endif /* FREECIV_JSON_CONNECTION */
3766 e = 0;
3767 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
3768 if (e) {
3769 log_packet_detailed("'owner' field error detected");
3770 }
3771#ifdef FREECIV_JSON_CONNECTION
3772 field_addr.name = "extras_owner";
3773#endif /* FREECIV_JSON_CONNECTION */
3774 e = 0;
3775 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->extras_owner);
3776 if (e) {
3777 log_packet_detailed("'extras_owner' field error detected");
3778 }
3779#ifdef FREECIV_JSON_CONNECTION
3780 field_addr.name = "worked";
3781#endif /* FREECIV_JSON_CONNECTION */
3782 e = 0;
3783 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->worked);
3784 if (e) {
3785 log_packet_detailed("'worked' field error detected");
3786 }
3787#ifdef FREECIV_JSON_CONNECTION
3788 field_addr.name = "terrain";
3789#endif /* FREECIV_JSON_CONNECTION */
3790 e = 0;
3791 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
3792 if (e) {
3793 log_packet_detailed("'terrain' field error detected");
3794 }
3795#ifdef FREECIV_JSON_CONNECTION
3796 field_addr.name = "resource";
3797#endif /* FREECIV_JSON_CONNECTION */
3798 e = 0;
3799 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
3800 if (e) {
3801 log_packet_detailed("'resource' field error detected");
3802 }
3803#ifdef FREECIV_JSON_CONNECTION
3804 field_addr.name = "extras";
3805#endif /* FREECIV_JSON_CONNECTION */
3806 e = 0;
3807 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
3808 if (e) {
3809 log_packet_detailed("'extras' field error detected");
3810 }
3811#ifdef FREECIV_JSON_CONNECTION
3812 field_addr.name = "placing";
3813#endif /* FREECIV_JSON_CONNECTION */
3814 e = 0;
3815 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->placing);
3816 if (e) {
3817 log_packet_detailed("'placing' field error detected");
3818 }
3819#ifdef FREECIV_JSON_CONNECTION
3820 field_addr.name = "place_turn";
3821#endif /* FREECIV_JSON_CONNECTION */
3822 e = 0;
3823 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->place_turn);
3824 if (e) {
3825 log_packet_detailed("'place_turn' field error detected");
3826 }
3827#ifdef FREECIV_JSON_CONNECTION
3828 field_addr.name = "spec_sprite";
3829#endif /* FREECIV_JSON_CONNECTION */
3830 e = 0;
3831 e |= DIO_PUT(string, &dout, &field_addr, real_packet->spec_sprite);
3832 if (e) {
3833 log_packet_detailed("'spec_sprite' field error detected");
3834 }
3835#ifdef FREECIV_JSON_CONNECTION
3836 field_addr.name = "label";
3837#endif /* FREECIV_JSON_CONNECTION */
3838 e = 0;
3839 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
3840 if (e) {
3841 log_packet_detailed("'label' field error detected");
3842 }
3843
3844#endif
3845 SEND_PACKET_END(PACKET_TILE_INFO);
3846}
3847
3848 int send_packet_tile_info(struct connection *pc, const struct packet_tile_info *packet)
3849{
3850 if (!pc->used) {
3851 log_error("WARNING: trying to send data to the closed connection %s",
3852 conn_description(pc));
3853 return -1;
3854 }
3855 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TILE_INFO].packet != NULL, -1,
3856 "Handler for PACKET_TILE_INFO not installed");
3857 return pc->phs.handlers->send[PACKET_TILE_INFO].packet(pc, packet);
3858}
3859
3860 void lsend_packet_tile_info(struct conn_list *dest, const struct packet_tile_info *packet)
3861{
3862 conn_list_iterate(dest, pconn) {
3863 send_packet_tile_info(pconn, packet);
3864 } conn_list_iterate_end;
3865}
3866
3867#ifdef FREECIV_DELTA_PROTOCOL
3868#define hash_packet_game_info_100 hash_const
3869
3870#define cmp_packet_game_info_100 cmp_const
3871
3872 BV_DEFINE(packet_game_info_100_fields, 136);
3873#endif /* FREECIV_DELTA_PROTOCOL */
3874
3875 static struct packet_game_info *receive_packet_game_info_100(struct connection *pc)
3876{
3877#ifdef FREECIV_DELTA_PROTOCOL
3878 packet_game_info_100_fields fields;
3879 struct packet_game_info *old;
3880 struct genhash **hash = pc->phs.received + PACKET_GAME_INFO;
3881#endif /* FREECIV_DELTA_PROTOCOL */
3882 RECEIVE_PACKET_START(packet_game_info, real_packet);
3883#ifdef FREECIV_JSON_CONNECTION
3884 struct plocation field_addr;
3885 {
3886 struct plocation *field_addr_tmp = plocation_field_new(NULL);
3887 field_addr = *field_addr_tmp;
3888 FC_FREE(field_addr_tmp);
3889 }
3890#endif /* FREECIV_JSON_CONNECTION */
3891
3892#ifdef FREECIV_DELTA_PROTOCOL
3893#ifdef FREECIV_JSON_CONNECTION
3894 field_addr.name = "fields";
3895#endif /* FREECIV_JSON_CONNECTION */
3896 DIO_BV_GET(&din, &field_addr, fields);
3897
3898#else /* FREECIV_DELTA_PROTOCOL */
3899#ifdef FREECIV_JSON_CONNECTION
3900 field_addr.name = "add_to_size_limit";
3901#endif /* FREECIV_JSON_CONNECTION */
3902 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->add_to_size_limit)) {
3903 RECEIVE_PACKET_FIELD_ERROR(add_to_size_limit);
3904 }
3905#ifdef FREECIV_JSON_CONNECTION
3906 field_addr.name = "aifill";
3907#endif /* FREECIV_JSON_CONNECTION */
3908 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->aifill)) {
3909 RECEIVE_PACKET_FIELD_ERROR(aifill);
3910 }
3911#ifdef FREECIV_JSON_CONNECTION
3912 field_addr.name = "persistent_ready";
3913#endif /* FREECIV_JSON_CONNECTION */
3914 {
3915 int readin;
3916
3917 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3918 RECEIVE_PACKET_FIELD_ERROR(persistent_ready);
3919 }
3920 real_packet->persistent_ready = readin;
3921 }
3922#ifdef FREECIV_JSON_CONNECTION
3923 field_addr.name = "airlifting_style";
3924#endif /* FREECIV_JSON_CONNECTION */
3925 {
3926 int readin;
3927
3928 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
3929 RECEIVE_PACKET_FIELD_ERROR(airlifting_style);
3930 }
3931 real_packet->airlifting_style = readin;
3932 }
3933#ifdef FREECIV_JSON_CONNECTION
3934 field_addr.name = "airlift_from_always_enabled";
3935#endif /* FREECIV_JSON_CONNECTION */
3936 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift_from_always_enabled)) {
3937 RECEIVE_PACKET_FIELD_ERROR(airlift_from_always_enabled);
3938 }
3939#ifdef FREECIV_JSON_CONNECTION
3940 field_addr.name = "airlift_to_always_enabled";
3941#endif /* FREECIV_JSON_CONNECTION */
3942 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift_to_always_enabled)) {
3943 RECEIVE_PACKET_FIELD_ERROR(airlift_to_always_enabled);
3944 }
3945#ifdef FREECIV_JSON_CONNECTION
3946 field_addr.name = "angrycitizen";
3947#endif /* FREECIV_JSON_CONNECTION */
3948 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->angrycitizen)) {
3949 RECEIVE_PACKET_FIELD_ERROR(angrycitizen);
3950 }
3951#ifdef FREECIV_JSON_CONNECTION
3952 field_addr.name = "base_pollution";
3953#endif /* FREECIV_JSON_CONNECTION */
3954 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->base_pollution)) {
3955 RECEIVE_PACKET_FIELD_ERROR(base_pollution);
3956 }
3957#ifdef FREECIV_JSON_CONNECTION
3958 field_addr.name = "base_tech_cost";
3959#endif /* FREECIV_JSON_CONNECTION */
3960 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->base_tech_cost)) {
3961 RECEIVE_PACKET_FIELD_ERROR(base_tech_cost);
3962 }
3963#ifdef FREECIV_JSON_CONNECTION
3964 field_addr.name = "min_tech_cost";
3965#endif /* FREECIV_JSON_CONNECTION */
3966 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_tech_cost)) {
3967 RECEIVE_PACKET_FIELD_ERROR(min_tech_cost);
3968 }
3969#ifdef FREECIV_JSON_CONNECTION
3970 field_addr.name = "tech_leak_pct";
3971#endif /* FREECIV_JSON_CONNECTION */
3972 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_leak_pct)) {
3973 RECEIVE_PACKET_FIELD_ERROR(tech_leak_pct);
3974 }
3975#ifdef FREECIV_JSON_CONNECTION
3976 field_addr.name = "border_city_radius_sq";
3977#endif /* FREECIV_JSON_CONNECTION */
3978 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->border_city_radius_sq)) {
3979 RECEIVE_PACKET_FIELD_ERROR(border_city_radius_sq);
3980 }
3981#ifdef FREECIV_JSON_CONNECTION
3982 field_addr.name = "border_size_effect";
3983#endif /* FREECIV_JSON_CONNECTION */
3984 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->border_size_effect)) {
3985 RECEIVE_PACKET_FIELD_ERROR(border_size_effect);
3986 }
3987#ifdef FREECIV_JSON_CONNECTION
3988 field_addr.name = "border_city_permanent_radius_sq";
3989#endif /* FREECIV_JSON_CONNECTION */
3990 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->border_city_permanent_radius_sq)) {
3991 RECEIVE_PACKET_FIELD_ERROR(border_city_permanent_radius_sq);
3992 }
3993#ifdef FREECIV_JSON_CONNECTION
3994 field_addr.name = "borders";
3995#endif /* FREECIV_JSON_CONNECTION */
3996 {
3997 int readin;
3998
3999 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4000 RECEIVE_PACKET_FIELD_ERROR(borders);
4001 }
4002 real_packet->borders = readin;
4003 }
4004#ifdef FREECIV_JSON_CONNECTION
4005 field_addr.name = "base_bribe_cost";
4006#endif /* FREECIV_JSON_CONNECTION */
4007 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->base_bribe_cost)) {
4008 RECEIVE_PACKET_FIELD_ERROR(base_bribe_cost);
4009 }
4010#ifdef FREECIV_JSON_CONNECTION
4011 field_addr.name = "caravan_bonus_style";
4012#endif /* FREECIV_JSON_CONNECTION */
4013 {
4014 int readin;
4015
4016 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4017 RECEIVE_PACKET_FIELD_ERROR(caravan_bonus_style);
4018 }
4019 real_packet->caravan_bonus_style = readin;
4020 }
4021#ifdef FREECIV_JSON_CONNECTION
4022 field_addr.name = "culture_vic_points";
4023#endif /* FREECIV_JSON_CONNECTION */
4024 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture_vic_points)) {
4025 RECEIVE_PACKET_FIELD_ERROR(culture_vic_points);
4026 }
4027#ifdef FREECIV_JSON_CONNECTION
4028 field_addr.name = "culture_vic_lead";
4029#endif /* FREECIV_JSON_CONNECTION */
4030 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_vic_lead)) {
4031 RECEIVE_PACKET_FIELD_ERROR(culture_vic_lead);
4032 }
4033#ifdef FREECIV_JSON_CONNECTION
4034 field_addr.name = "culture_migration_pml";
4035#endif /* FREECIV_JSON_CONNECTION */
4036 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_migration_pml)) {
4037 RECEIVE_PACKET_FIELD_ERROR(culture_migration_pml);
4038 }
4039#ifdef FREECIV_JSON_CONNECTION
4040 field_addr.name = "history_interest_pml";
4041#endif /* FREECIV_JSON_CONNECTION */
4042 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->history_interest_pml)) {
4043 RECEIVE_PACKET_FIELD_ERROR(history_interest_pml);
4044 }
4045#ifdef FREECIV_JSON_CONNECTION
4046 field_addr.name = "celebratesize";
4047#endif /* FREECIV_JSON_CONNECTION */
4048 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->celebratesize)) {
4049 RECEIVE_PACKET_FIELD_ERROR(celebratesize);
4050 }
4051#ifdef FREECIV_JSON_CONNECTION
4052 field_addr.name = "changable_tax";
4053#endif /* FREECIV_JSON_CONNECTION */
4054 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->changable_tax)) {
4055 RECEIVE_PACKET_FIELD_ERROR(changable_tax);
4056 }
4057#ifdef FREECIV_JSON_CONNECTION
4058 field_addr.name = "pop_report_zeroes";
4059#endif /* FREECIV_JSON_CONNECTION */
4060 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_report_zeroes)) {
4061 RECEIVE_PACKET_FIELD_ERROR(pop_report_zeroes);
4062 }
4063#ifdef FREECIV_JSON_CONNECTION
4064 field_addr.name = "citizen_nationality";
4065#endif /* FREECIV_JSON_CONNECTION */
4066 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->citizen_nationality)) {
4067 RECEIVE_PACKET_FIELD_ERROR(citizen_nationality);
4068 }
4069#ifdef FREECIV_JSON_CONNECTION
4070 field_addr.name = "unit_builders_nationality";
4071#endif /* FREECIV_JSON_CONNECTION */
4072 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unit_builders_nationality)) {
4073 RECEIVE_PACKET_FIELD_ERROR(unit_builders_nationality);
4074 }
4075#ifdef FREECIV_JSON_CONNECTION
4076 field_addr.name = "citizen_convert_speed";
4077#endif /* FREECIV_JSON_CONNECTION */
4078 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->citizen_convert_speed)) {
4079 RECEIVE_PACKET_FIELD_ERROR(citizen_convert_speed);
4080 }
4081#ifdef FREECIV_JSON_CONNECTION
4082 field_addr.name = "conquest_convert_pct";
4083#endif /* FREECIV_JSON_CONNECTION */
4084 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->conquest_convert_pct)) {
4085 RECEIVE_PACKET_FIELD_ERROR(conquest_convert_pct);
4086 }
4087#ifdef FREECIV_JSON_CONNECTION
4088 field_addr.name = "citizen_partisans_pct";
4089#endif /* FREECIV_JSON_CONNECTION */
4090 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citizen_partisans_pct)) {
4091 RECEIVE_PACKET_FIELD_ERROR(citizen_partisans_pct);
4092 }
4093#ifdef FREECIV_JSON_CONNECTION
4094 field_addr.name = "citymindist";
4095#endif /* FREECIV_JSON_CONNECTION */
4096 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citymindist)) {
4097 RECEIVE_PACKET_FIELD_ERROR(citymindist);
4098 }
4099#ifdef FREECIV_JSON_CONNECTION
4100 field_addr.name = "cooling";
4101#endif /* FREECIV_JSON_CONNECTION */
4102 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cooling)) {
4103 RECEIVE_PACKET_FIELD_ERROR(cooling);
4104 }
4105#ifdef FREECIV_JSON_CONNECTION
4106 field_addr.name = "coolinglevel";
4107#endif /* FREECIV_JSON_CONNECTION */
4108 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->coolinglevel)) {
4109 RECEIVE_PACKET_FIELD_ERROR(coolinglevel);
4110 }
4111#ifdef FREECIV_JSON_CONNECTION
4112 field_addr.name = "diplchance_initial_odds";
4113#endif /* FREECIV_JSON_CONNECTION */
4114 if (!DIO_BV_GET(&din, &field_addr, real_packet->diplchance_initial_odds)) {
4115 RECEIVE_PACKET_FIELD_ERROR(diplchance_initial_odds);
4116 }
4117#ifdef FREECIV_JSON_CONNECTION
4118 field_addr.name = "diplomacy";
4119#endif /* FREECIV_JSON_CONNECTION */
4120 {
4121 int readin;
4122
4123 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4124 RECEIVE_PACKET_FIELD_ERROR(diplomacy);
4125 }
4126 real_packet->diplomacy = readin;
4127 }
4128#ifdef FREECIV_JSON_CONNECTION
4129 field_addr.name = "fogofwar";
4130#endif /* FREECIV_JSON_CONNECTION */
4131 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->fogofwar)) {
4132 RECEIVE_PACKET_FIELD_ERROR(fogofwar);
4133 }
4134#ifdef FREECIV_JSON_CONNECTION
4135 field_addr.name = "food_cost";
4136#endif /* FREECIV_JSON_CONNECTION */
4137 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_cost)) {
4138 RECEIVE_PACKET_FIELD_ERROR(food_cost);
4139 }
4140#ifdef FREECIV_JSON_CONNECTION
4141 field_addr.name = "foodbox";
4142#endif /* FREECIV_JSON_CONNECTION */
4143 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->foodbox)) {
4144 RECEIVE_PACKET_FIELD_ERROR(foodbox);
4145 }
4146#ifdef FREECIV_JSON_CONNECTION
4147 field_addr.name = "forced_gold";
4148#endif /* FREECIV_JSON_CONNECTION */
4149 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_gold)) {
4150 RECEIVE_PACKET_FIELD_ERROR(forced_gold);
4151 }
4152#ifdef FREECIV_JSON_CONNECTION
4153 field_addr.name = "forced_luxury";
4154#endif /* FREECIV_JSON_CONNECTION */
4155 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_luxury)) {
4156 RECEIVE_PACKET_FIELD_ERROR(forced_luxury);
4157 }
4158#ifdef FREECIV_JSON_CONNECTION
4159 field_addr.name = "forced_science";
4160#endif /* FREECIV_JSON_CONNECTION */
4161 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_science)) {
4162 RECEIVE_PACKET_FIELD_ERROR(forced_science);
4163 }
4164#ifdef FREECIV_JSON_CONNECTION
4165 field_addr.name = "fulltradesize";
4166#endif /* FREECIV_JSON_CONNECTION */
4167 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fulltradesize)) {
4168 RECEIVE_PACKET_FIELD_ERROR(fulltradesize);
4169 }
4170#ifdef FREECIV_JSON_CONNECTION
4171 field_addr.name = "trade_world_rel_pct";
4172#endif /* FREECIV_JSON_CONNECTION */
4173 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_world_rel_pct)) {
4174 RECEIVE_PACKET_FIELD_ERROR(trade_world_rel_pct);
4175 }
4176#ifdef FREECIV_JSON_CONNECTION
4177 field_addr.name = "min_trade_route_val";
4178#endif /* FREECIV_JSON_CONNECTION */
4179 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_trade_route_val)) {
4180 RECEIVE_PACKET_FIELD_ERROR(min_trade_route_val);
4181 }
4182#ifdef FREECIV_JSON_CONNECTION
4183 field_addr.name = "reveal_trade_partner";
4184#endif /* FREECIV_JSON_CONNECTION */
4185 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->reveal_trade_partner)) {
4186 RECEIVE_PACKET_FIELD_ERROR(reveal_trade_partner);
4187 }
4188#ifdef FREECIV_JSON_CONNECTION
4189 field_addr.name = "goods_selection";
4190#endif /* FREECIV_JSON_CONNECTION */
4191 {
4192 int readin;
4193
4194 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4195 RECEIVE_PACKET_FIELD_ERROR(goods_selection);
4196 }
4197 real_packet->goods_selection = readin;
4198 }
4199#ifdef FREECIV_JSON_CONNECTION
4200 field_addr.name = "global_advance_count";
4201#endif /* FREECIV_JSON_CONNECTION */
4202 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_advance_count)) {
4203 RECEIVE_PACKET_FIELD_ERROR(global_advance_count);
4204 }
4205#ifdef FREECIV_JSON_CONNECTION
4206 field_addr.name = "global_advances";
4207#endif /* FREECIV_JSON_CONNECTION */
4208 {
4209 int i;
4210
4211#ifdef FREECIV_JSON_CONNECTION
4212 /* Enter array. */
4213 field_addr.sub_location = plocation_elem_new(0);
4214#endif /* FREECIV_JSON_CONNECTION */
4215
4216 for (i = 0; i < A_LAST; i++) {
4217#ifdef FREECIV_JSON_CONNECTION
4218 field_addr.sub_location->number = i;
4219#endif /* FREECIV_JSON_CONNECTION */
4220 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_advances[i])) {
4221 RECEIVE_PACKET_FIELD_ERROR(global_advances);
4222 }
4223 }
4224
4225#ifdef FREECIV_JSON_CONNECTION
4226 /* Exit array. */
4227 FC_FREE(field_addr.sub_location);
4228#endif /* FREECIV_JSON_CONNECTION */
4229 }
4230#ifdef FREECIV_JSON_CONNECTION
4231 field_addr.name = "global_warming";
4232#endif /* FREECIV_JSON_CONNECTION */
4233 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_warming)) {
4234 RECEIVE_PACKET_FIELD_ERROR(global_warming);
4235 }
4236#ifdef FREECIV_JSON_CONNECTION
4237 field_addr.name = "globalwarming";
4238#endif /* FREECIV_JSON_CONNECTION */
4239 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->globalwarming)) {
4240 RECEIVE_PACKET_FIELD_ERROR(globalwarming);
4241 }
4242#ifdef FREECIV_JSON_CONNECTION
4243 field_addr.name = "gold";
4244#endif /* FREECIV_JSON_CONNECTION */
4245 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
4246 RECEIVE_PACKET_FIELD_ERROR(gold);
4247 }
4248#ifdef FREECIV_JSON_CONNECTION
4249 field_addr.name = "gold_upkeep_style";
4250#endif /* FREECIV_JSON_CONNECTION */
4251 {
4252 int readin;
4253
4254 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4255 RECEIVE_PACKET_FIELD_ERROR(gold_upkeep_style);
4256 }
4257 real_packet->gold_upkeep_style = readin;
4258 }
4259#ifdef FREECIV_JSON_CONNECTION
4260 field_addr.name = "homeless_gold_upkeep";
4261#endif /* FREECIV_JSON_CONNECTION */
4262 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->homeless_gold_upkeep)) {
4263 RECEIVE_PACKET_FIELD_ERROR(homeless_gold_upkeep);
4264 }
4265#ifdef FREECIV_JSON_CONNECTION
4266 field_addr.name = "infrapoints";
4267#endif /* FREECIV_JSON_CONNECTION */
4268 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
4269 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
4270 }
4271#ifdef FREECIV_JSON_CONNECTION
4272 field_addr.name = "revolentype";
4273#endif /* FREECIV_JSON_CONNECTION */
4274 {
4275 int readin;
4276
4277 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4278 RECEIVE_PACKET_FIELD_ERROR(revolentype);
4279 }
4280 real_packet->revolentype = readin;
4281 }
4282#ifdef FREECIV_JSON_CONNECTION
4283 field_addr.name = "default_government_id";
4284#endif /* FREECIV_JSON_CONNECTION */
4285 {
4286 int readin;
4287
4288 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
4289 RECEIVE_PACKET_FIELD_ERROR(default_government_id);
4290 }
4291 real_packet->default_government_id = readin;
4292 }
4293#ifdef FREECIV_JSON_CONNECTION
4294 field_addr.name = "government_during_revolution_id";
4295#endif /* FREECIV_JSON_CONNECTION */
4296 {
4297 int readin;
4298
4299 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
4300 RECEIVE_PACKET_FIELD_ERROR(government_during_revolution_id);
4301 }
4302 real_packet->government_during_revolution_id = readin;
4303 }
4304#ifdef FREECIV_JSON_CONNECTION
4305 field_addr.name = "granary_food_inc";
4306#endif /* FREECIV_JSON_CONNECTION */
4307 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_inc)) {
4308 RECEIVE_PACKET_FIELD_ERROR(granary_food_inc);
4309 }
4310#ifdef FREECIV_JSON_CONNECTION
4311 field_addr.name = "granary_food_ini";
4312#endif /* FREECIV_JSON_CONNECTION */
4313 {
4314 int i;
4315
4316#ifdef FREECIV_JSON_CONNECTION
4317 /* Enter array. */
4318 field_addr.sub_location = plocation_elem_new(0);
4319#endif /* FREECIV_JSON_CONNECTION */
4320
4321 for (i = 0; i < MAX_GRANARY_INIS; i++) {
4322#ifdef FREECIV_JSON_CONNECTION
4323 field_addr.sub_location->number = i;
4324#endif /* FREECIV_JSON_CONNECTION */
4325 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_ini[i])) {
4326 RECEIVE_PACKET_FIELD_ERROR(granary_food_ini);
4327 }
4328 }
4329
4330#ifdef FREECIV_JSON_CONNECTION
4331 /* Exit array. */
4332 FC_FREE(field_addr.sub_location);
4333#endif /* FREECIV_JSON_CONNECTION */
4334 }
4335#ifdef FREECIV_JSON_CONNECTION
4336 field_addr.name = "granary_num_inis";
4337#endif /* FREECIV_JSON_CONNECTION */
4338 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->granary_num_inis)) {
4339 RECEIVE_PACKET_FIELD_ERROR(granary_num_inis);
4340 }
4341#ifdef FREECIV_JSON_CONNECTION
4342 field_addr.name = "great_wonder_owners";
4343#endif /* FREECIV_JSON_CONNECTION */
4344 {
4345 int i;
4346
4347#ifdef FREECIV_JSON_CONNECTION
4348 /* Enter array. */
4349 field_addr.sub_location = plocation_elem_new(0);
4350#endif /* FREECIV_JSON_CONNECTION */
4351
4352 for (i = 0; i < B_LAST; i++) {
4353#ifdef FREECIV_JSON_CONNECTION
4354 field_addr.sub_location->number = i;
4355#endif /* FREECIV_JSON_CONNECTION */
4356 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->great_wonder_owners[i])) {
4357 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
4358 }
4359 }
4360
4361#ifdef FREECIV_JSON_CONNECTION
4362 /* Exit array. */
4363 FC_FREE(field_addr.sub_location);
4364#endif /* FREECIV_JSON_CONNECTION */
4365 }
4366#ifdef FREECIV_JSON_CONNECTION
4367 field_addr.name = "happy_cost";
4368#endif /* FREECIV_JSON_CONNECTION */
4369 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->happy_cost)) {
4370 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
4371 }
4372#ifdef FREECIV_JSON_CONNECTION
4373 field_addr.name = "happyborders";
4374#endif /* FREECIV_JSON_CONNECTION */
4375 {
4376 int readin;
4377
4378 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4379 RECEIVE_PACKET_FIELD_ERROR(happyborders);
4380 }
4381 real_packet->happyborders = readin;
4382 }
4383#ifdef FREECIV_JSON_CONNECTION
4384 field_addr.name = "heating";
4385#endif /* FREECIV_JSON_CONNECTION */
4386 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->heating)) {
4387 RECEIVE_PACKET_FIELD_ERROR(heating);
4388 }
4389#ifdef FREECIV_JSON_CONNECTION
4390 field_addr.name = "illness_base_factor";
4391#endif /* FREECIV_JSON_CONNECTION */
4392 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_base_factor)) {
4393 RECEIVE_PACKET_FIELD_ERROR(illness_base_factor);
4394 }
4395#ifdef FREECIV_JSON_CONNECTION
4396 field_addr.name = "illness_min_size";
4397#endif /* FREECIV_JSON_CONNECTION */
4398 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->illness_min_size)) {
4399 RECEIVE_PACKET_FIELD_ERROR(illness_min_size);
4400 }
4401#ifdef FREECIV_JSON_CONNECTION
4402 field_addr.name = "illness_on";
4403#endif /* FREECIV_JSON_CONNECTION */
4404 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->illness_on)) {
4405 RECEIVE_PACKET_FIELD_ERROR(illness_on);
4406 }
4407#ifdef FREECIV_JSON_CONNECTION
4408 field_addr.name = "illness_pollution_factor";
4409#endif /* FREECIV_JSON_CONNECTION */
4410 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_pollution_factor)) {
4411 RECEIVE_PACKET_FIELD_ERROR(illness_pollution_factor);
4412 }
4413#ifdef FREECIV_JSON_CONNECTION
4414 field_addr.name = "illness_trade_infection";
4415#endif /* FREECIV_JSON_CONNECTION */
4416 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade_infection)) {
4417 RECEIVE_PACKET_FIELD_ERROR(illness_trade_infection);
4418 }
4419#ifdef FREECIV_JSON_CONNECTION
4420 field_addr.name = "init_city_radius_sq";
4421#endif /* FREECIV_JSON_CONNECTION */
4422 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_city_radius_sq)) {
4423 RECEIVE_PACKET_FIELD_ERROR(init_city_radius_sq);
4424 }
4425#ifdef FREECIV_JSON_CONNECTION
4426 field_addr.name = "is_edit_mode";
4427#endif /* FREECIV_JSON_CONNECTION */
4428 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_edit_mode)) {
4429 RECEIVE_PACKET_FIELD_ERROR(is_edit_mode);
4430 }
4431#ifdef FREECIV_JSON_CONNECTION
4432 field_addr.name = "is_new_game";
4433#endif /* FREECIV_JSON_CONNECTION */
4434 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_new_game)) {
4435 RECEIVE_PACKET_FIELD_ERROR(is_new_game);
4436 }
4437#ifdef FREECIV_JSON_CONNECTION
4438 field_addr.name = "killcitizen";
4439#endif /* FREECIV_JSON_CONNECTION */
4440 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->killcitizen)) {
4441 RECEIVE_PACKET_FIELD_ERROR(killcitizen);
4442 }
4443#ifdef FREECIV_JSON_CONNECTION
4444 field_addr.name = "killstack";
4445#endif /* FREECIV_JSON_CONNECTION */
4446 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->killstack)) {
4447 RECEIVE_PACKET_FIELD_ERROR(killstack);
4448 }
4449#ifdef FREECIV_JSON_CONNECTION
4450 field_addr.name = "only_killing_makes_veteran";
4451#endif /* FREECIV_JSON_CONNECTION */
4452 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->only_killing_makes_veteran)) {
4453 RECEIVE_PACKET_FIELD_ERROR(only_killing_makes_veteran);
4454 }
4455#ifdef FREECIV_JSON_CONNECTION
4456 field_addr.name = "only_real_fight_makes_veteran";
4457#endif /* FREECIV_JSON_CONNECTION */
4458 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->only_real_fight_makes_veteran)) {
4459 RECEIVE_PACKET_FIELD_ERROR(only_real_fight_makes_veteran);
4460 }
4461#ifdef FREECIV_JSON_CONNECTION
4462 field_addr.name = "combat_odds_scaled_veterancy";
4463#endif /* FREECIV_JSON_CONNECTION */
4464 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->combat_odds_scaled_veterancy)) {
4465 RECEIVE_PACKET_FIELD_ERROR(combat_odds_scaled_veterancy);
4466 }
4467#ifdef FREECIV_JSON_CONNECTION
4468 field_addr.name = "damage_reduces_bombard_rate";
4469#endif /* FREECIV_JSON_CONNECTION */
4470 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->damage_reduces_bombard_rate)) {
4471 RECEIVE_PACKET_FIELD_ERROR(damage_reduces_bombard_rate);
4472 }
4473#ifdef FREECIV_JSON_CONNECTION
4474 field_addr.name = "low_firepower_badwallattacker";
4475#endif /* FREECIV_JSON_CONNECTION */
4476 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_badwallattacker)) {
4477 RECEIVE_PACKET_FIELD_ERROR(low_firepower_badwallattacker);
4478 }
4479#ifdef FREECIV_JSON_CONNECTION
4480 field_addr.name = "low_firepower_pearl_harbour";
4481#endif /* FREECIV_JSON_CONNECTION */
4482 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_pearl_harbour)) {
4483 RECEIVE_PACKET_FIELD_ERROR(low_firepower_pearl_harbour);
4484 }
4485#ifdef FREECIV_JSON_CONNECTION
4486 field_addr.name = "low_firepower_combat_bonus";
4487#endif /* FREECIV_JSON_CONNECTION */
4488 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_combat_bonus)) {
4489 RECEIVE_PACKET_FIELD_ERROR(low_firepower_combat_bonus);
4490 }
4491#ifdef FREECIV_JSON_CONNECTION
4492 field_addr.name = "low_firepower_nonnat_bombard";
4493#endif /* FREECIV_JSON_CONNECTION */
4494 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_nonnat_bombard)) {
4495 RECEIVE_PACKET_FIELD_ERROR(low_firepower_nonnat_bombard);
4496 }
4497#ifdef FREECIV_JSON_CONNECTION
4498 field_addr.name = "nuke_pop_loss_pct";
4499#endif /* FREECIV_JSON_CONNECTION */
4500 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_pop_loss_pct)) {
4501 RECEIVE_PACKET_FIELD_ERROR(nuke_pop_loss_pct);
4502 }
4503#ifdef FREECIV_JSON_CONNECTION
4504 field_addr.name = "nuke_defender_survival_chance_pct";
4505#endif /* FREECIV_JSON_CONNECTION */
4506 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_defender_survival_chance_pct)) {
4507 RECEIVE_PACKET_FIELD_ERROR(nuke_defender_survival_chance_pct);
4508 }
4509#ifdef FREECIV_JSON_CONNECTION
4510 field_addr.name = "min_city_center_output";
4511#endif /* FREECIV_JSON_CONNECTION */
4512 {
4513 int i;
4514
4515#ifdef FREECIV_JSON_CONNECTION
4516 /* Enter array. */
4517 field_addr.sub_location = plocation_elem_new(0);
4518#endif /* FREECIV_JSON_CONNECTION */
4519
4520 for (i = 0; i < O_LAST; i++) {
4521#ifdef FREECIV_JSON_CONNECTION
4522 field_addr.sub_location->number = i;
4523#endif /* FREECIV_JSON_CONNECTION */
4524 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_city_center_output[i])) {
4525 RECEIVE_PACKET_FIELD_ERROR(min_city_center_output);
4526 }
4527 }
4528
4529#ifdef FREECIV_JSON_CONNECTION
4530 /* Exit array. */
4531 FC_FREE(field_addr.sub_location);
4532#endif /* FREECIV_JSON_CONNECTION */
4533 }
4534#ifdef FREECIV_JSON_CONNECTION
4535 field_addr.name = "muuk_food_wipe";
4536#endif /* FREECIV_JSON_CONNECTION */
4537 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_food_wipe)) {
4538 RECEIVE_PACKET_FIELD_ERROR(muuk_food_wipe);
4539 }
4540#ifdef FREECIV_JSON_CONNECTION
4541 field_addr.name = "muuk_gold_wipe";
4542#endif /* FREECIV_JSON_CONNECTION */
4543 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_gold_wipe)) {
4544 RECEIVE_PACKET_FIELD_ERROR(muuk_gold_wipe);
4545 }
4546#ifdef FREECIV_JSON_CONNECTION
4547 field_addr.name = "muuk_shield_wipe";
4548#endif /* FREECIV_JSON_CONNECTION */
4549 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->muuk_shield_wipe)) {
4550 RECEIVE_PACKET_FIELD_ERROR(muuk_shield_wipe);
4551 }
4552#ifdef FREECIV_JSON_CONNECTION
4553 field_addr.name = "notradesize";
4554#endif /* FREECIV_JSON_CONNECTION */
4555 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->notradesize)) {
4556 RECEIVE_PACKET_FIELD_ERROR(notradesize);
4557 }
4558#ifdef FREECIV_JSON_CONNECTION
4559 field_addr.name = "nuclear_winter";
4560#endif /* FREECIV_JSON_CONNECTION */
4561 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->nuclear_winter)) {
4562 RECEIVE_PACKET_FIELD_ERROR(nuclear_winter);
4563 }
4564#ifdef FREECIV_JSON_CONNECTION
4565 field_addr.name = "nuclearwinter";
4566#endif /* FREECIV_JSON_CONNECTION */
4567 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->nuclearwinter)) {
4568 RECEIVE_PACKET_FIELD_ERROR(nuclearwinter);
4569 }
4570#ifdef FREECIV_JSON_CONNECTION
4571 field_addr.name = "phase";
4572#endif /* FREECIV_JSON_CONNECTION */
4573 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
4574 RECEIVE_PACKET_FIELD_ERROR(phase);
4575 }
4576#ifdef FREECIV_JSON_CONNECTION
4577 field_addr.name = "phase_mode";
4578#endif /* FREECIV_JSON_CONNECTION */
4579 {
4580 int readin;
4581
4582 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4583 RECEIVE_PACKET_FIELD_ERROR(phase_mode);
4584 }
4585 real_packet->phase_mode = readin;
4586 }
4587#ifdef FREECIV_JSON_CONNECTION
4588 field_addr.name = "pillage_select";
4589#endif /* FREECIV_JSON_CONNECTION */
4590 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->pillage_select)) {
4591 RECEIVE_PACKET_FIELD_ERROR(pillage_select);
4592 }
4593#ifdef FREECIV_JSON_CONNECTION
4594 field_addr.name = "steal_maps_reveals_all_cities";
4595#endif /* FREECIV_JSON_CONNECTION */
4596 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->steal_maps_reveals_all_cities)) {
4597 RECEIVE_PACKET_FIELD_ERROR(steal_maps_reveals_all_cities);
4598 }
4599#ifdef FREECIV_JSON_CONNECTION
4600 field_addr.name = "poison_empties_food_stock";
4601#endif /* FREECIV_JSON_CONNECTION */
4602 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->poison_empties_food_stock)) {
4603 RECEIVE_PACKET_FIELD_ERROR(poison_empties_food_stock);
4604 }
4605#ifdef FREECIV_JSON_CONNECTION
4606 field_addr.name = "tech_steal_allow_holes";
4607#endif /* FREECIV_JSON_CONNECTION */
4608 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_steal_allow_holes)) {
4609 RECEIVE_PACKET_FIELD_ERROR(tech_steal_allow_holes);
4610 }
4611#ifdef FREECIV_JSON_CONNECTION
4612 field_addr.name = "tech_trade_allow_holes";
4613#endif /* FREECIV_JSON_CONNECTION */
4614 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_trade_allow_holes)) {
4615 RECEIVE_PACKET_FIELD_ERROR(tech_trade_allow_holes);
4616 }
4617#ifdef FREECIV_JSON_CONNECTION
4618 field_addr.name = "tech_trade_loss_allow_holes";
4619#endif /* FREECIV_JSON_CONNECTION */
4620 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_trade_loss_allow_holes)) {
4621 RECEIVE_PACKET_FIELD_ERROR(tech_trade_loss_allow_holes);
4622 }
4623#ifdef FREECIV_JSON_CONNECTION
4624 field_addr.name = "tech_parasite_allow_holes";
4625#endif /* FREECIV_JSON_CONNECTION */
4626 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_parasite_allow_holes)) {
4627 RECEIVE_PACKET_FIELD_ERROR(tech_parasite_allow_holes);
4628 }
4629#ifdef FREECIV_JSON_CONNECTION
4630 field_addr.name = "tech_loss_allow_holes";
4631#endif /* FREECIV_JSON_CONNECTION */
4632 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tech_loss_allow_holes)) {
4633 RECEIVE_PACKET_FIELD_ERROR(tech_loss_allow_holes);
4634 }
4635#ifdef FREECIV_JSON_CONNECTION
4636 field_addr.name = "rapturedelay";
4637#endif /* FREECIV_JSON_CONNECTION */
4638 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapturedelay)) {
4639 RECEIVE_PACKET_FIELD_ERROR(rapturedelay);
4640 }
4641#ifdef FREECIV_JSON_CONNECTION
4642 field_addr.name = "disasters";
4643#endif /* FREECIV_JSON_CONNECTION */
4644 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disasters)) {
4645 RECEIVE_PACKET_FIELD_ERROR(disasters);
4646 }
4647#ifdef FREECIV_JSON_CONNECTION
4648 field_addr.name = "restrictinfra";
4649#endif /* FREECIV_JSON_CONNECTION */
4650 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->restrictinfra)) {
4651 RECEIVE_PACKET_FIELD_ERROR(restrictinfra);
4652 }
4653#ifdef FREECIV_JSON_CONNECTION
4654 field_addr.name = "unreachable_protects";
4655#endif /* FREECIV_JSON_CONNECTION */
4656 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unreachable_protects)) {
4657 RECEIVE_PACKET_FIELD_ERROR(unreachable_protects);
4658 }
4659#ifdef FREECIV_JSON_CONNECTION
4660 field_addr.name = "sciencebox";
4661#endif /* FREECIV_JSON_CONNECTION */
4662 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->sciencebox)) {
4663 RECEIVE_PACKET_FIELD_ERROR(sciencebox);
4664 }
4665#ifdef FREECIV_JSON_CONNECTION
4666 field_addr.name = "shieldbox";
4667#endif /* FREECIV_JSON_CONNECTION */
4668 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->shieldbox)) {
4669 RECEIVE_PACKET_FIELD_ERROR(shieldbox);
4670 }
4671#ifdef FREECIV_JSON_CONNECTION
4672 field_addr.name = "skill_level";
4673#endif /* FREECIV_JSON_CONNECTION */
4674 {
4675 int readin;
4676
4677 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4678 RECEIVE_PACKET_FIELD_ERROR(skill_level);
4679 }
4680 real_packet->skill_level = readin;
4681 }
4682#ifdef FREECIV_JSON_CONNECTION
4683 field_addr.name = "victory_conditions";
4684#endif /* FREECIV_JSON_CONNECTION */
4685 {
4686 int readin;
4687
4688 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4689 RECEIVE_PACKET_FIELD_ERROR(victory_conditions);
4690 }
4691 real_packet->victory_conditions = readin;
4692 }
4693#ifdef FREECIV_JSON_CONNECTION
4694 field_addr.name = "team_pooled_research";
4695#endif /* FREECIV_JSON_CONNECTION */
4696 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->team_pooled_research)) {
4697 RECEIVE_PACKET_FIELD_ERROR(team_pooled_research);
4698 }
4699#ifdef FREECIV_JSON_CONNECTION
4700 field_addr.name = "tech";
4701#endif /* FREECIV_JSON_CONNECTION */
4702 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->tech)) {
4703 RECEIVE_PACKET_FIELD_ERROR(tech);
4704 }
4705#ifdef FREECIV_JSON_CONNECTION
4706 field_addr.name = "tech_cost_style";
4707#endif /* FREECIV_JSON_CONNECTION */
4708 {
4709 int readin;
4710
4711 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4712 RECEIVE_PACKET_FIELD_ERROR(tech_cost_style);
4713 }
4714 real_packet->tech_cost_style = readin;
4715 }
4716#ifdef FREECIV_JSON_CONNECTION
4717 field_addr.name = "tech_leakage";
4718#endif /* FREECIV_JSON_CONNECTION */
4719 {
4720 int readin;
4721
4722 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4723 RECEIVE_PACKET_FIELD_ERROR(tech_leakage);
4724 }
4725 real_packet->tech_leakage = readin;
4726 }
4727#ifdef FREECIV_JSON_CONNECTION
4728 field_addr.name = "tech_upkeep_divider";
4729#endif /* FREECIV_JSON_CONNECTION */
4730 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep_divider)) {
4731 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_divider);
4732 }
4733#ifdef FREECIV_JSON_CONNECTION
4734 field_addr.name = "tech_upkeep_style";
4735#endif /* FREECIV_JSON_CONNECTION */
4736 {
4737 int readin;
4738
4739 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4740 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_style);
4741 }
4742 real_packet->tech_upkeep_style = readin;
4743 }
4744#ifdef FREECIV_JSON_CONNECTION
4745 field_addr.name = "techloss_forgiveness";
4746#endif /* FREECIV_JSON_CONNECTION */
4747 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->techloss_forgiveness)) {
4748 RECEIVE_PACKET_FIELD_ERROR(techloss_forgiveness);
4749 }
4750#ifdef FREECIV_JSON_CONNECTION
4751 field_addr.name = "free_tech_method";
4752#endif /* FREECIV_JSON_CONNECTION */
4753 {
4754 int readin;
4755
4756 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4757 RECEIVE_PACKET_FIELD_ERROR(free_tech_method);
4758 }
4759 real_packet->free_tech_method = readin;
4760 }
4761#ifdef FREECIV_JSON_CONNECTION
4762 field_addr.name = "gameloss_style";
4763#endif /* FREECIV_JSON_CONNECTION */
4764 {
4765 int readin;
4766
4767 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4768 RECEIVE_PACKET_FIELD_ERROR(gameloss_style);
4769 }
4770 real_packet->gameloss_style = readin;
4771 }
4772#ifdef FREECIV_JSON_CONNECTION
4773 field_addr.name = "timeout";
4774#endif /* FREECIV_JSON_CONNECTION */
4775 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->timeout)) {
4776 RECEIVE_PACKET_FIELD_ERROR(timeout);
4777 }
4778#ifdef FREECIV_JSON_CONNECTION
4779 field_addr.name = "first_timeout";
4780#endif /* FREECIV_JSON_CONNECTION */
4781 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->first_timeout)) {
4782 RECEIVE_PACKET_FIELD_ERROR(first_timeout);
4783 }
4784#ifdef FREECIV_JSON_CONNECTION
4785 field_addr.name = "tired_attack";
4786#endif /* FREECIV_JSON_CONNECTION */
4787 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->tired_attack)) {
4788 RECEIVE_PACKET_FIELD_ERROR(tired_attack);
4789 }
4790#ifdef FREECIV_JSON_CONNECTION
4791 field_addr.name = "trademindist";
4792#endif /* FREECIV_JSON_CONNECTION */
4793 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trademindist)) {
4794 RECEIVE_PACKET_FIELD_ERROR(trademindist);
4795 }
4796#ifdef FREECIV_JSON_CONNECTION
4797 field_addr.name = "trade_revenue_style";
4798#endif /* FREECIV_JSON_CONNECTION */
4799 {
4800 int readin;
4801
4802 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4803 RECEIVE_PACKET_FIELD_ERROR(trade_revenue_style);
4804 }
4805 real_packet->trade_revenue_style = readin;
4806 }
4807#ifdef FREECIV_JSON_CONNECTION
4808 field_addr.name = "trading_city";
4809#endif /* FREECIV_JSON_CONNECTION */
4810 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_city)) {
4811 RECEIVE_PACKET_FIELD_ERROR(trading_city);
4812 }
4813#ifdef FREECIV_JSON_CONNECTION
4814 field_addr.name = "trading_gold";
4815#endif /* FREECIV_JSON_CONNECTION */
4816 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_gold)) {
4817 RECEIVE_PACKET_FIELD_ERROR(trading_gold);
4818 }
4819#ifdef FREECIV_JSON_CONNECTION
4820 field_addr.name = "trading_tech";
4821#endif /* FREECIV_JSON_CONNECTION */
4822 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->trading_tech)) {
4823 RECEIVE_PACKET_FIELD_ERROR(trading_tech);
4824 }
4825#ifdef FREECIV_JSON_CONNECTION
4826 field_addr.name = "turn";
4827#endif /* FREECIV_JSON_CONNECTION */
4828 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
4829 RECEIVE_PACKET_FIELD_ERROR(turn);
4830 }
4831#ifdef FREECIV_JSON_CONNECTION
4832 field_addr.name = "warminglevel";
4833#endif /* FREECIV_JSON_CONNECTION */
4834 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->warminglevel)) {
4835 RECEIVE_PACKET_FIELD_ERROR(warminglevel);
4836 }
4837#ifdef FREECIV_JSON_CONNECTION
4838 field_addr.name = "year";
4839#endif /* FREECIV_JSON_CONNECTION */
4840 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
4841 RECEIVE_PACKET_FIELD_ERROR(year);
4842 }
4843#ifdef FREECIV_JSON_CONNECTION
4844 field_addr.name = "year_0_hack";
4845#endif /* FREECIV_JSON_CONNECTION */
4846 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->year_0_hack)) {
4847 RECEIVE_PACKET_FIELD_ERROR(year_0_hack);
4848 }
4849#ifdef FREECIV_JSON_CONNECTION
4850 field_addr.name = "top_cities_count";
4851#endif /* FREECIV_JSON_CONNECTION */
4852 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->top_cities_count)) {
4853 RECEIVE_PACKET_FIELD_ERROR(top_cities_count);
4854 }
4855#ifdef FREECIV_JSON_CONNECTION
4856 field_addr.name = "fragment_count";
4857#endif /* FREECIV_JSON_CONNECTION */
4858 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragment_count)) {
4859 RECEIVE_PACKET_FIELD_ERROR(fragment_count);
4860 }
4861#ifdef FREECIV_JSON_CONNECTION
4862 field_addr.name = "civil_war_enabled";
4863#endif /* FREECIV_JSON_CONNECTION */
4864 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->civil_war_enabled)) {
4865 RECEIVE_PACKET_FIELD_ERROR(civil_war_enabled);
4866 }
4867#ifdef FREECIV_JSON_CONNECTION
4868 field_addr.name = "civil_war_bonus_celebrating";
4869#endif /* FREECIV_JSON_CONNECTION */
4870 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_celebrating)) {
4871 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_celebrating);
4872 }
4873#ifdef FREECIV_JSON_CONNECTION
4874 field_addr.name = "civil_war_bonus_unhappy";
4875#endif /* FREECIV_JSON_CONNECTION */
4876 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_unhappy)) {
4877 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_unhappy);
4878 }
4879#ifdef FREECIV_JSON_CONNECTION
4880 field_addr.name = "granularity";
4881#endif /* FREECIV_JSON_CONNECTION */
4882 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granularity)) {
4883 RECEIVE_PACKET_FIELD_ERROR(granularity);
4884 }
4885#ifdef FREECIV_JSON_CONNECTION
4886 field_addr.name = "small_wonder_visibility";
4887#endif /* FREECIV_JSON_CONNECTION */
4888 {
4889 int readin;
4890
4891 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4892 RECEIVE_PACKET_FIELD_ERROR(small_wonder_visibility);
4893 }
4894 real_packet->small_wonder_visibility = readin;
4895 }
4896#endif
4897 log_packet_detailed("packet_game_info_100: got info about ()");
4898
4899#ifdef FREECIV_DELTA_PROTOCOL
4900 if (NULL == *hash) {
4901 *hash = genhash_new_full(hash_packet_game_info_100, cmp_packet_game_info_100,
4902 NULL, NULL, NULL, free);
4903 }
4904
4905 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
4906 *real_packet = *old;
4907 } else {
4908 log_packet_detailed(" no old info");
4909 memset(real_packet, 0, sizeof(*real_packet));
4910 }
4911
4912 if (BV_ISSET(fields, 0)) {
4913 log_packet_detailed(" got field 'add_to_size_limit'");
4914#ifdef FREECIV_JSON_CONNECTION
4915 field_addr.name = "add_to_size_limit";
4916#endif /* FREECIV_JSON_CONNECTION */
4917 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->add_to_size_limit)) {
4918 RECEIVE_PACKET_FIELD_ERROR(add_to_size_limit);
4919 }
4920 }
4921 if (BV_ISSET(fields, 1)) {
4922 log_packet_detailed(" got field 'aifill'");
4923#ifdef FREECIV_JSON_CONNECTION
4924 field_addr.name = "aifill";
4925#endif /* FREECIV_JSON_CONNECTION */
4926 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->aifill)) {
4927 RECEIVE_PACKET_FIELD_ERROR(aifill);
4928 }
4929 }
4930 if (BV_ISSET(fields, 2)) {
4931 log_packet_detailed(" got field 'persistent_ready'");
4932#ifdef FREECIV_JSON_CONNECTION
4933 field_addr.name = "persistent_ready";
4934#endif /* FREECIV_JSON_CONNECTION */
4935 {
4936 int readin;
4937
4938 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4939 RECEIVE_PACKET_FIELD_ERROR(persistent_ready);
4940 }
4941 real_packet->persistent_ready = readin;
4942 }
4943 }
4944 if (BV_ISSET(fields, 3)) {
4945 log_packet_detailed(" got field 'airlifting_style'");
4946#ifdef FREECIV_JSON_CONNECTION
4947 field_addr.name = "airlifting_style";
4948#endif /* FREECIV_JSON_CONNECTION */
4949 {
4950 int readin;
4951
4952 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
4953 RECEIVE_PACKET_FIELD_ERROR(airlifting_style);
4954 }
4955 real_packet->airlifting_style = readin;
4956 }
4957 }
4958 real_packet->airlift_from_always_enabled = BV_ISSET(fields, 4);
4959 real_packet->airlift_to_always_enabled = BV_ISSET(fields, 5);
4960 if (BV_ISSET(fields, 6)) {
4961 log_packet_detailed(" got field 'angrycitizen'");
4962#ifdef FREECIV_JSON_CONNECTION
4963 field_addr.name = "angrycitizen";
4964#endif /* FREECIV_JSON_CONNECTION */
4965 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->angrycitizen)) {
4966 RECEIVE_PACKET_FIELD_ERROR(angrycitizen);
4967 }
4968 }
4969 if (BV_ISSET(fields, 7)) {
4970 log_packet_detailed(" got field 'base_pollution'");
4971#ifdef FREECIV_JSON_CONNECTION
4972 field_addr.name = "base_pollution";
4973#endif /* FREECIV_JSON_CONNECTION */
4974 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->base_pollution)) {
4975 RECEIVE_PACKET_FIELD_ERROR(base_pollution);
4976 }
4977 }
4978 if (BV_ISSET(fields, 8)) {
4979 log_packet_detailed(" got field 'base_tech_cost'");
4980#ifdef FREECIV_JSON_CONNECTION
4981 field_addr.name = "base_tech_cost";
4982#endif /* FREECIV_JSON_CONNECTION */
4983 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->base_tech_cost)) {
4984 RECEIVE_PACKET_FIELD_ERROR(base_tech_cost);
4985 }
4986 }
4987 if (BV_ISSET(fields, 9)) {
4988 log_packet_detailed(" got field 'min_tech_cost'");
4989#ifdef FREECIV_JSON_CONNECTION
4990 field_addr.name = "min_tech_cost";
4991#endif /* FREECIV_JSON_CONNECTION */
4992 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_tech_cost)) {
4993 RECEIVE_PACKET_FIELD_ERROR(min_tech_cost);
4994 }
4995 }
4996 if (BV_ISSET(fields, 10)) {
4997 log_packet_detailed(" got field 'tech_leak_pct'");
4998#ifdef FREECIV_JSON_CONNECTION
4999 field_addr.name = "tech_leak_pct";
5000#endif /* FREECIV_JSON_CONNECTION */
5001 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tech_leak_pct)) {
5002 RECEIVE_PACKET_FIELD_ERROR(tech_leak_pct);
5003 }
5004 }
5005 if (BV_ISSET(fields, 11)) {
5006 log_packet_detailed(" got field 'border_city_radius_sq'");
5007#ifdef FREECIV_JSON_CONNECTION
5008 field_addr.name = "border_city_radius_sq";
5009#endif /* FREECIV_JSON_CONNECTION */
5010 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->border_city_radius_sq)) {
5011 RECEIVE_PACKET_FIELD_ERROR(border_city_radius_sq);
5012 }
5013 }
5014 if (BV_ISSET(fields, 12)) {
5015 log_packet_detailed(" got field 'border_size_effect'");
5016#ifdef FREECIV_JSON_CONNECTION
5017 field_addr.name = "border_size_effect";
5018#endif /* FREECIV_JSON_CONNECTION */
5019 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->border_size_effect)) {
5020 RECEIVE_PACKET_FIELD_ERROR(border_size_effect);
5021 }
5022 }
5023 if (BV_ISSET(fields, 13)) {
5024 log_packet_detailed(" got field 'border_city_permanent_radius_sq'");
5025#ifdef FREECIV_JSON_CONNECTION
5026 field_addr.name = "border_city_permanent_radius_sq";
5027#endif /* FREECIV_JSON_CONNECTION */
5028 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->border_city_permanent_radius_sq)) {
5029 RECEIVE_PACKET_FIELD_ERROR(border_city_permanent_radius_sq);
5030 }
5031 }
5032 if (BV_ISSET(fields, 14)) {
5033 log_packet_detailed(" got field 'borders'");
5034#ifdef FREECIV_JSON_CONNECTION
5035 field_addr.name = "borders";
5036#endif /* FREECIV_JSON_CONNECTION */
5037 {
5038 int readin;
5039
5040 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5041 RECEIVE_PACKET_FIELD_ERROR(borders);
5042 }
5043 real_packet->borders = readin;
5044 }
5045 }
5046 if (BV_ISSET(fields, 15)) {
5047 log_packet_detailed(" got field 'base_bribe_cost'");
5048#ifdef FREECIV_JSON_CONNECTION
5049 field_addr.name = "base_bribe_cost";
5050#endif /* FREECIV_JSON_CONNECTION */
5051 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->base_bribe_cost)) {
5052 RECEIVE_PACKET_FIELD_ERROR(base_bribe_cost);
5053 }
5054 }
5055 if (BV_ISSET(fields, 16)) {
5056 log_packet_detailed(" got field 'caravan_bonus_style'");
5057#ifdef FREECIV_JSON_CONNECTION
5058 field_addr.name = "caravan_bonus_style";
5059#endif /* FREECIV_JSON_CONNECTION */
5060 {
5061 int readin;
5062
5063 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5064 RECEIVE_PACKET_FIELD_ERROR(caravan_bonus_style);
5065 }
5066 real_packet->caravan_bonus_style = readin;
5067 }
5068 }
5069 if (BV_ISSET(fields, 17)) {
5070 log_packet_detailed(" got field 'culture_vic_points'");
5071#ifdef FREECIV_JSON_CONNECTION
5072 field_addr.name = "culture_vic_points";
5073#endif /* FREECIV_JSON_CONNECTION */
5074 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture_vic_points)) {
5075 RECEIVE_PACKET_FIELD_ERROR(culture_vic_points);
5076 }
5077 }
5078 if (BV_ISSET(fields, 18)) {
5079 log_packet_detailed(" got field 'culture_vic_lead'");
5080#ifdef FREECIV_JSON_CONNECTION
5081 field_addr.name = "culture_vic_lead";
5082#endif /* FREECIV_JSON_CONNECTION */
5083 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_vic_lead)) {
5084 RECEIVE_PACKET_FIELD_ERROR(culture_vic_lead);
5085 }
5086 }
5087 if (BV_ISSET(fields, 19)) {
5088 log_packet_detailed(" got field 'culture_migration_pml'");
5089#ifdef FREECIV_JSON_CONNECTION
5090 field_addr.name = "culture_migration_pml";
5091#endif /* FREECIV_JSON_CONNECTION */
5092 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->culture_migration_pml)) {
5093 RECEIVE_PACKET_FIELD_ERROR(culture_migration_pml);
5094 }
5095 }
5096 if (BV_ISSET(fields, 20)) {
5097 log_packet_detailed(" got field 'history_interest_pml'");
5098#ifdef FREECIV_JSON_CONNECTION
5099 field_addr.name = "history_interest_pml";
5100#endif /* FREECIV_JSON_CONNECTION */
5101 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->history_interest_pml)) {
5102 RECEIVE_PACKET_FIELD_ERROR(history_interest_pml);
5103 }
5104 }
5105 if (BV_ISSET(fields, 21)) {
5106 log_packet_detailed(" got field 'celebratesize'");
5107#ifdef FREECIV_JSON_CONNECTION
5108 field_addr.name = "celebratesize";
5109#endif /* FREECIV_JSON_CONNECTION */
5110 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->celebratesize)) {
5111 RECEIVE_PACKET_FIELD_ERROR(celebratesize);
5112 }
5113 }
5114 real_packet->changable_tax = BV_ISSET(fields, 22);
5115 if (BV_ISSET(fields, 23)) {
5116 log_packet_detailed(" got field 'pop_report_zeroes'");
5117#ifdef FREECIV_JSON_CONNECTION
5118 field_addr.name = "pop_report_zeroes";
5119#endif /* FREECIV_JSON_CONNECTION */
5120 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_report_zeroes)) {
5121 RECEIVE_PACKET_FIELD_ERROR(pop_report_zeroes);
5122 }
5123 }
5124 real_packet->citizen_nationality = BV_ISSET(fields, 24);
5125 real_packet->unit_builders_nationality = BV_ISSET(fields, 25);
5126 if (BV_ISSET(fields, 26)) {
5127 log_packet_detailed(" got field 'citizen_convert_speed'");
5128#ifdef FREECIV_JSON_CONNECTION
5129 field_addr.name = "citizen_convert_speed";
5130#endif /* FREECIV_JSON_CONNECTION */
5131 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->citizen_convert_speed)) {
5132 RECEIVE_PACKET_FIELD_ERROR(citizen_convert_speed);
5133 }
5134 }
5135 if (BV_ISSET(fields, 27)) {
5136 log_packet_detailed(" got field 'conquest_convert_pct'");
5137#ifdef FREECIV_JSON_CONNECTION
5138 field_addr.name = "conquest_convert_pct";
5139#endif /* FREECIV_JSON_CONNECTION */
5140 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->conquest_convert_pct)) {
5141 RECEIVE_PACKET_FIELD_ERROR(conquest_convert_pct);
5142 }
5143 }
5144 if (BV_ISSET(fields, 28)) {
5145 log_packet_detailed(" got field 'citizen_partisans_pct'");
5146#ifdef FREECIV_JSON_CONNECTION
5147 field_addr.name = "citizen_partisans_pct";
5148#endif /* FREECIV_JSON_CONNECTION */
5149 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citizen_partisans_pct)) {
5150 RECEIVE_PACKET_FIELD_ERROR(citizen_partisans_pct);
5151 }
5152 }
5153 if (BV_ISSET(fields, 29)) {
5154 log_packet_detailed(" got field 'citymindist'");
5155#ifdef FREECIV_JSON_CONNECTION
5156 field_addr.name = "citymindist";
5157#endif /* FREECIV_JSON_CONNECTION */
5158 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->citymindist)) {
5159 RECEIVE_PACKET_FIELD_ERROR(citymindist);
5160 }
5161 }
5162 if (BV_ISSET(fields, 30)) {
5163 log_packet_detailed(" got field 'cooling'");
5164#ifdef FREECIV_JSON_CONNECTION
5165 field_addr.name = "cooling";
5166#endif /* FREECIV_JSON_CONNECTION */
5167 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cooling)) {
5168 RECEIVE_PACKET_FIELD_ERROR(cooling);
5169 }
5170 }
5171 if (BV_ISSET(fields, 31)) {
5172 log_packet_detailed(" got field 'coolinglevel'");
5173#ifdef FREECIV_JSON_CONNECTION
5174 field_addr.name = "coolinglevel";
5175#endif /* FREECIV_JSON_CONNECTION */
5176 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->coolinglevel)) {
5177 RECEIVE_PACKET_FIELD_ERROR(coolinglevel);
5178 }
5179 }
5180 if (BV_ISSET(fields, 32)) {
5181 log_packet_detailed(" got field 'diplchance_initial_odds'");
5182#ifdef FREECIV_JSON_CONNECTION
5183 field_addr.name = "diplchance_initial_odds";
5184#endif /* FREECIV_JSON_CONNECTION */
5185 if (!DIO_BV_GET(&din, &field_addr, real_packet->diplchance_initial_odds)) {
5186 RECEIVE_PACKET_FIELD_ERROR(diplchance_initial_odds);
5187 }
5188 }
5189 if (BV_ISSET(fields, 33)) {
5190 log_packet_detailed(" got field 'diplomacy'");
5191#ifdef FREECIV_JSON_CONNECTION
5192 field_addr.name = "diplomacy";
5193#endif /* FREECIV_JSON_CONNECTION */
5194 {
5195 int readin;
5196
5197 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5198 RECEIVE_PACKET_FIELD_ERROR(diplomacy);
5199 }
5200 real_packet->diplomacy = readin;
5201 }
5202 }
5203 real_packet->fogofwar = BV_ISSET(fields, 34);
5204 if (BV_ISSET(fields, 35)) {
5205 log_packet_detailed(" got field 'food_cost'");
5206#ifdef FREECIV_JSON_CONNECTION
5207 field_addr.name = "food_cost";
5208#endif /* FREECIV_JSON_CONNECTION */
5209 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_cost)) {
5210 RECEIVE_PACKET_FIELD_ERROR(food_cost);
5211 }
5212 }
5213 if (BV_ISSET(fields, 36)) {
5214 log_packet_detailed(" got field 'foodbox'");
5215#ifdef FREECIV_JSON_CONNECTION
5216 field_addr.name = "foodbox";
5217#endif /* FREECIV_JSON_CONNECTION */
5218 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->foodbox)) {
5219 RECEIVE_PACKET_FIELD_ERROR(foodbox);
5220 }
5221 }
5222 if (BV_ISSET(fields, 37)) {
5223 log_packet_detailed(" got field 'forced_gold'");
5224#ifdef FREECIV_JSON_CONNECTION
5225 field_addr.name = "forced_gold";
5226#endif /* FREECIV_JSON_CONNECTION */
5227 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_gold)) {
5228 RECEIVE_PACKET_FIELD_ERROR(forced_gold);
5229 }
5230 }
5231 if (BV_ISSET(fields, 38)) {
5232 log_packet_detailed(" got field 'forced_luxury'");
5233#ifdef FREECIV_JSON_CONNECTION
5234 field_addr.name = "forced_luxury";
5235#endif /* FREECIV_JSON_CONNECTION */
5236 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_luxury)) {
5237 RECEIVE_PACKET_FIELD_ERROR(forced_luxury);
5238 }
5239 }
5240 if (BV_ISSET(fields, 39)) {
5241 log_packet_detailed(" got field 'forced_science'");
5242#ifdef FREECIV_JSON_CONNECTION
5243 field_addr.name = "forced_science";
5244#endif /* FREECIV_JSON_CONNECTION */
5245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->forced_science)) {
5246 RECEIVE_PACKET_FIELD_ERROR(forced_science);
5247 }
5248 }
5249 if (BV_ISSET(fields, 40)) {
5250 log_packet_detailed(" got field 'fulltradesize'");
5251#ifdef FREECIV_JSON_CONNECTION
5252 field_addr.name = "fulltradesize";
5253#endif /* FREECIV_JSON_CONNECTION */
5254 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fulltradesize)) {
5255 RECEIVE_PACKET_FIELD_ERROR(fulltradesize);
5256 }
5257 }
5258 if (BV_ISSET(fields, 41)) {
5259 log_packet_detailed(" got field 'trade_world_rel_pct'");
5260#ifdef FREECIV_JSON_CONNECTION
5261 field_addr.name = "trade_world_rel_pct";
5262#endif /* FREECIV_JSON_CONNECTION */
5263 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_world_rel_pct)) {
5264 RECEIVE_PACKET_FIELD_ERROR(trade_world_rel_pct);
5265 }
5266 }
5267 if (BV_ISSET(fields, 42)) {
5268 log_packet_detailed(" got field 'min_trade_route_val'");
5269#ifdef FREECIV_JSON_CONNECTION
5270 field_addr.name = "min_trade_route_val";
5271#endif /* FREECIV_JSON_CONNECTION */
5272 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_trade_route_val)) {
5273 RECEIVE_PACKET_FIELD_ERROR(min_trade_route_val);
5274 }
5275 }
5276 real_packet->reveal_trade_partner = BV_ISSET(fields, 43);
5277 if (BV_ISSET(fields, 44)) {
5278 log_packet_detailed(" got field 'goods_selection'");
5279#ifdef FREECIV_JSON_CONNECTION
5280 field_addr.name = "goods_selection";
5281#endif /* FREECIV_JSON_CONNECTION */
5282 {
5283 int readin;
5284
5285 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5286 RECEIVE_PACKET_FIELD_ERROR(goods_selection);
5287 }
5288 real_packet->goods_selection = readin;
5289 }
5290 }
5291 if (BV_ISSET(fields, 45)) {
5292 log_packet_detailed(" got field 'global_advance_count'");
5293#ifdef FREECIV_JSON_CONNECTION
5294 field_addr.name = "global_advance_count";
5295#endif /* FREECIV_JSON_CONNECTION */
5296 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_advance_count)) {
5297 RECEIVE_PACKET_FIELD_ERROR(global_advance_count);
5298 }
5299 }
5300 if (BV_ISSET(fields, 46)) {
5301 log_packet_detailed(" got field 'global_advances'");
5302#ifdef FREECIV_JSON_CONNECTION
5303 field_addr.name = "global_advances";
5304#endif /* FREECIV_JSON_CONNECTION */
5305 {
5306#ifdef FREECIV_JSON_CONNECTION
5307 int count;
5308
5309 /* Enter array. */
5310 field_addr.sub_location = plocation_elem_new(0);
5311
5312 for (count = 0;; count++) {
5313 int i;
5314
5315 field_addr.sub_location->number = count;
5316
5317 /* Enter diff array element (start at the index address). */
5318 field_addr.sub_location->sub_location = plocation_elem_new(0);
5319#else /* FREECIV_JSON_CONNECTION */
5320 while (TRUE) {
5321 int i;
5322#endif /* FREECIV_JSON_CONNECTION */
5323
5324 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
5325 RECEIVE_PACKET_FIELD_ERROR(global_advances);
5326 }
5327 if (i == MAX_UINT16) {
5328#ifdef FREECIV_JSON_CONNECTION
5329 /* Exit diff array element. */
5330 FC_FREE(field_addr.sub_location->sub_location);
5331
5332 /* Exit diff array. */
5333 FC_FREE(field_addr.sub_location);
5334#endif /* FREECIV_JSON_CONNECTION */
5335
5336 break;
5337 }
5338 if (i > A_LAST) {
5339 RECEIVE_PACKET_FIELD_ERROR(global_advances,
5340 ": unexpected value %d "
5341 "(> A_LAST) in array diff",
5342 i);
5343 } else {
5344#ifdef FREECIV_JSON_CONNECTION
5345 /* Content address. */
5346 field_addr.sub_location->sub_location->number = 1;
5347#endif /* FREECIV_JSON_CONNECTION */
5348 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->global_advances[i])) {
5349 RECEIVE_PACKET_FIELD_ERROR(global_advances);
5350 }
5351 }
5352
5353#ifdef FREECIV_JSON_CONNECTION
5354 /* Exit diff array element. */
5355 FC_FREE(field_addr.sub_location->sub_location);
5356#endif /* FREECIV_JSON_CONNECTION */
5357 }
5358
5359#ifdef FREECIV_JSON_CONNECTION
5360 /* Exit array. */
5361 FC_FREE(field_addr.sub_location);
5362#endif /* FREECIV_JSON_CONNECTION */
5363 }
5364 }
5365 real_packet->global_warming = BV_ISSET(fields, 47);
5366 if (BV_ISSET(fields, 48)) {
5367 log_packet_detailed(" got field 'globalwarming'");
5368#ifdef FREECIV_JSON_CONNECTION
5369 field_addr.name = "globalwarming";
5370#endif /* FREECIV_JSON_CONNECTION */
5371 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->globalwarming)) {
5372 RECEIVE_PACKET_FIELD_ERROR(globalwarming);
5373 }
5374 }
5375 if (BV_ISSET(fields, 49)) {
5376 log_packet_detailed(" got field 'gold'");
5377#ifdef FREECIV_JSON_CONNECTION
5378 field_addr.name = "gold";
5379#endif /* FREECIV_JSON_CONNECTION */
5380 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
5381 RECEIVE_PACKET_FIELD_ERROR(gold);
5382 }
5383 }
5384 if (BV_ISSET(fields, 50)) {
5385 log_packet_detailed(" got field 'gold_upkeep_style'");
5386#ifdef FREECIV_JSON_CONNECTION
5387 field_addr.name = "gold_upkeep_style";
5388#endif /* FREECIV_JSON_CONNECTION */
5389 {
5390 int readin;
5391
5392 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5393 RECEIVE_PACKET_FIELD_ERROR(gold_upkeep_style);
5394 }
5395 real_packet->gold_upkeep_style = readin;
5396 }
5397 }
5398 real_packet->homeless_gold_upkeep = BV_ISSET(fields, 51);
5399 if (BV_ISSET(fields, 52)) {
5400 log_packet_detailed(" got field 'infrapoints'");
5401#ifdef FREECIV_JSON_CONNECTION
5402 field_addr.name = "infrapoints";
5403#endif /* FREECIV_JSON_CONNECTION */
5404 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
5405 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
5406 }
5407 }
5408 if (BV_ISSET(fields, 53)) {
5409 log_packet_detailed(" got field 'revolentype'");
5410#ifdef FREECIV_JSON_CONNECTION
5411 field_addr.name = "revolentype";
5412#endif /* FREECIV_JSON_CONNECTION */
5413 {
5414 int readin;
5415
5416 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5417 RECEIVE_PACKET_FIELD_ERROR(revolentype);
5418 }
5419 real_packet->revolentype = readin;
5420 }
5421 }
5422 if (BV_ISSET(fields, 54)) {
5423 log_packet_detailed(" got field 'default_government_id'");
5424#ifdef FREECIV_JSON_CONNECTION
5425 field_addr.name = "default_government_id";
5426#endif /* FREECIV_JSON_CONNECTION */
5427 {
5428 int readin;
5429
5430 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
5431 RECEIVE_PACKET_FIELD_ERROR(default_government_id);
5432 }
5433 real_packet->default_government_id = readin;
5434 }
5435 }
5436 if (BV_ISSET(fields, 55)) {
5437 log_packet_detailed(" got field 'government_during_revolution_id'");
5438#ifdef FREECIV_JSON_CONNECTION
5439 field_addr.name = "government_during_revolution_id";
5440#endif /* FREECIV_JSON_CONNECTION */
5441 {
5442 int readin;
5443
5444 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
5445 RECEIVE_PACKET_FIELD_ERROR(government_during_revolution_id);
5446 }
5447 real_packet->government_during_revolution_id = readin;
5448 }
5449 }
5450 if (BV_ISSET(fields, 56)) {
5451 log_packet_detailed(" got field 'granary_food_inc'");
5452#ifdef FREECIV_JSON_CONNECTION
5453 field_addr.name = "granary_food_inc";
5454#endif /* FREECIV_JSON_CONNECTION */
5455 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_inc)) {
5456 RECEIVE_PACKET_FIELD_ERROR(granary_food_inc);
5457 }
5458 }
5459 if (BV_ISSET(fields, 57)) {
5460 log_packet_detailed(" got field 'granary_food_ini'");
5461#ifdef FREECIV_JSON_CONNECTION
5462 field_addr.name = "granary_food_ini";
5463#endif /* FREECIV_JSON_CONNECTION */
5464 {
5465 int i;
5466
5467#ifdef FREECIV_JSON_CONNECTION
5468 /* Enter array. */
5469 field_addr.sub_location = plocation_elem_new(0);
5470#endif /* FREECIV_JSON_CONNECTION */
5471
5472 for (i = 0; i < MAX_GRANARY_INIS; i++) {
5473#ifdef FREECIV_JSON_CONNECTION
5474 field_addr.sub_location->number = i;
5475#endif /* FREECIV_JSON_CONNECTION */
5476 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_food_ini[i])) {
5477 RECEIVE_PACKET_FIELD_ERROR(granary_food_ini);
5478 }
5479 }
5480
5481#ifdef FREECIV_JSON_CONNECTION
5482 /* Exit array. */
5483 FC_FREE(field_addr.sub_location);
5484#endif /* FREECIV_JSON_CONNECTION */
5485 }
5486 }
5487 if (BV_ISSET(fields, 58)) {
5488 log_packet_detailed(" got field 'granary_num_inis'");
5489#ifdef FREECIV_JSON_CONNECTION
5490 field_addr.name = "granary_num_inis";
5491#endif /* FREECIV_JSON_CONNECTION */
5492 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->granary_num_inis)) {
5493 RECEIVE_PACKET_FIELD_ERROR(granary_num_inis);
5494 }
5495 }
5496 if (BV_ISSET(fields, 59)) {
5497 log_packet_detailed(" got field 'great_wonder_owners'");
5498#ifdef FREECIV_JSON_CONNECTION
5499 field_addr.name = "great_wonder_owners";
5500#endif /* FREECIV_JSON_CONNECTION */
5501 {
5502#ifdef FREECIV_JSON_CONNECTION
5503 int count;
5504
5505 /* Enter array. */
5506 field_addr.sub_location = plocation_elem_new(0);
5507
5508 for (count = 0;; count++) {
5509 int i;
5510
5511 field_addr.sub_location->number = count;
5512
5513 /* Enter diff array element (start at the index address). */
5514 field_addr.sub_location->sub_location = plocation_elem_new(0);
5515#else /* FREECIV_JSON_CONNECTION */
5516 while (TRUE) {
5517 int i;
5518#endif /* FREECIV_JSON_CONNECTION */
5519
5520 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
5521 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
5522 }
5523 if (i == MAX_UINT16) {
5524#ifdef FREECIV_JSON_CONNECTION
5525 /* Exit diff array element. */
5526 FC_FREE(field_addr.sub_location->sub_location);
5527
5528 /* Exit diff array. */
5529 FC_FREE(field_addr.sub_location);
5530#endif /* FREECIV_JSON_CONNECTION */
5531
5532 break;
5533 }
5534 if (i > B_LAST) {
5535 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners,
5536 ": unexpected value %d "
5537 "(> B_LAST) in array diff",
5538 i);
5539 } else {
5540#ifdef FREECIV_JSON_CONNECTION
5541 /* Content address. */
5542 field_addr.sub_location->sub_location->number = 1;
5543#endif /* FREECIV_JSON_CONNECTION */
5544 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->great_wonder_owners[i])) {
5545 RECEIVE_PACKET_FIELD_ERROR(great_wonder_owners);
5546 }
5547 }
5548
5549#ifdef FREECIV_JSON_CONNECTION
5550 /* Exit diff array element. */
5551 FC_FREE(field_addr.sub_location->sub_location);
5552#endif /* FREECIV_JSON_CONNECTION */
5553 }
5554
5555#ifdef FREECIV_JSON_CONNECTION
5556 /* Exit array. */
5557 FC_FREE(field_addr.sub_location);
5558#endif /* FREECIV_JSON_CONNECTION */
5559 }
5560 }
5561 if (BV_ISSET(fields, 60)) {
5562 log_packet_detailed(" got field 'happy_cost'");
5563#ifdef FREECIV_JSON_CONNECTION
5564 field_addr.name = "happy_cost";
5565#endif /* FREECIV_JSON_CONNECTION */
5566 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->happy_cost)) {
5567 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
5568 }
5569 }
5570 if (BV_ISSET(fields, 61)) {
5571 log_packet_detailed(" got field 'happyborders'");
5572#ifdef FREECIV_JSON_CONNECTION
5573 field_addr.name = "happyborders";
5574#endif /* FREECIV_JSON_CONNECTION */
5575 {
5576 int readin;
5577
5578 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5579 RECEIVE_PACKET_FIELD_ERROR(happyborders);
5580 }
5581 real_packet->happyborders = readin;
5582 }
5583 }
5584 if (BV_ISSET(fields, 62)) {
5585 log_packet_detailed(" got field 'heating'");
5586#ifdef FREECIV_JSON_CONNECTION
5587 field_addr.name = "heating";
5588#endif /* FREECIV_JSON_CONNECTION */
5589 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->heating)) {
5590 RECEIVE_PACKET_FIELD_ERROR(heating);
5591 }
5592 }
5593 if (BV_ISSET(fields, 63)) {
5594 log_packet_detailed(" got field 'illness_base_factor'");
5595#ifdef FREECIV_JSON_CONNECTION
5596 field_addr.name = "illness_base_factor";
5597#endif /* FREECIV_JSON_CONNECTION */
5598 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_base_factor)) {
5599 RECEIVE_PACKET_FIELD_ERROR(illness_base_factor);
5600 }
5601 }
5602 if (BV_ISSET(fields, 64)) {
5603 log_packet_detailed(" got field 'illness_min_size'");
5604#ifdef FREECIV_JSON_CONNECTION
5605 field_addr.name = "illness_min_size";
5606#endif /* FREECIV_JSON_CONNECTION */
5607 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->illness_min_size)) {
5608 RECEIVE_PACKET_FIELD_ERROR(illness_min_size);
5609 }
5610 }
5611 real_packet->illness_on = BV_ISSET(fields, 65);
5612 if (BV_ISSET(fields, 66)) {
5613 log_packet_detailed(" got field 'illness_pollution_factor'");
5614#ifdef FREECIV_JSON_CONNECTION
5615 field_addr.name = "illness_pollution_factor";
5616#endif /* FREECIV_JSON_CONNECTION */
5617 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_pollution_factor)) {
5618 RECEIVE_PACKET_FIELD_ERROR(illness_pollution_factor);
5619 }
5620 }
5621 if (BV_ISSET(fields, 67)) {
5622 log_packet_detailed(" got field 'illness_trade_infection'");
5623#ifdef FREECIV_JSON_CONNECTION
5624 field_addr.name = "illness_trade_infection";
5625#endif /* FREECIV_JSON_CONNECTION */
5626 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade_infection)) {
5627 RECEIVE_PACKET_FIELD_ERROR(illness_trade_infection);
5628 }
5629 }
5630 if (BV_ISSET(fields, 68)) {
5631 log_packet_detailed(" got field 'init_city_radius_sq'");
5632#ifdef FREECIV_JSON_CONNECTION
5633 field_addr.name = "init_city_radius_sq";
5634#endif /* FREECIV_JSON_CONNECTION */
5635 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_city_radius_sq)) {
5636 RECEIVE_PACKET_FIELD_ERROR(init_city_radius_sq);
5637 }
5638 }
5639 real_packet->is_edit_mode = BV_ISSET(fields, 69);
5640 real_packet->is_new_game = BV_ISSET(fields, 70);
5641 real_packet->killcitizen = BV_ISSET(fields, 71);
5642 real_packet->killstack = BV_ISSET(fields, 72);
5643 real_packet->only_killing_makes_veteran = BV_ISSET(fields, 73);
5644 real_packet->only_real_fight_makes_veteran = BV_ISSET(fields, 74);
5645 real_packet->combat_odds_scaled_veterancy = BV_ISSET(fields, 75);
5646 real_packet->damage_reduces_bombard_rate = BV_ISSET(fields, 76);
5647 if (BV_ISSET(fields, 77)) {
5648 log_packet_detailed(" got field 'low_firepower_badwallattacker'");
5649#ifdef FREECIV_JSON_CONNECTION
5650 field_addr.name = "low_firepower_badwallattacker";
5651#endif /* FREECIV_JSON_CONNECTION */
5652 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_badwallattacker)) {
5653 RECEIVE_PACKET_FIELD_ERROR(low_firepower_badwallattacker);
5654 }
5655 }
5656 if (BV_ISSET(fields, 78)) {
5657 log_packet_detailed(" got field 'low_firepower_pearl_harbour'");
5658#ifdef FREECIV_JSON_CONNECTION
5659 field_addr.name = "low_firepower_pearl_harbour";
5660#endif /* FREECIV_JSON_CONNECTION */
5661 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_pearl_harbour)) {
5662 RECEIVE_PACKET_FIELD_ERROR(low_firepower_pearl_harbour);
5663 }
5664 }
5665 if (BV_ISSET(fields, 79)) {
5666 log_packet_detailed(" got field 'low_firepower_combat_bonus'");
5667#ifdef FREECIV_JSON_CONNECTION
5668 field_addr.name = "low_firepower_combat_bonus";
5669#endif /* FREECIV_JSON_CONNECTION */
5670 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_combat_bonus)) {
5671 RECEIVE_PACKET_FIELD_ERROR(low_firepower_combat_bonus);
5672 }
5673 }
5674 if (BV_ISSET(fields, 80)) {
5675 log_packet_detailed(" got field 'low_firepower_nonnat_bombard'");
5676#ifdef FREECIV_JSON_CONNECTION
5677 field_addr.name = "low_firepower_nonnat_bombard";
5678#endif /* FREECIV_JSON_CONNECTION */
5679 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->low_firepower_nonnat_bombard)) {
5680 RECEIVE_PACKET_FIELD_ERROR(low_firepower_nonnat_bombard);
5681 }
5682 }
5683 if (BV_ISSET(fields, 81)) {
5684 log_packet_detailed(" got field 'nuke_pop_loss_pct'");
5685#ifdef FREECIV_JSON_CONNECTION
5686 field_addr.name = "nuke_pop_loss_pct";
5687#endif /* FREECIV_JSON_CONNECTION */
5688 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_pop_loss_pct)) {
5689 RECEIVE_PACKET_FIELD_ERROR(nuke_pop_loss_pct);
5690 }
5691 }
5692 if (BV_ISSET(fields, 82)) {
5693 log_packet_detailed(" got field 'nuke_defender_survival_chance_pct'");
5694#ifdef FREECIV_JSON_CONNECTION
5695 field_addr.name = "nuke_defender_survival_chance_pct";
5696#endif /* FREECIV_JSON_CONNECTION */
5697 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nuke_defender_survival_chance_pct)) {
5698 RECEIVE_PACKET_FIELD_ERROR(nuke_defender_survival_chance_pct);
5699 }
5700 }
5701 if (BV_ISSET(fields, 83)) {
5702 log_packet_detailed(" got field 'min_city_center_output'");
5703#ifdef FREECIV_JSON_CONNECTION
5704 field_addr.name = "min_city_center_output";
5705#endif /* FREECIV_JSON_CONNECTION */
5706 {
5707 int i;
5708
5709#ifdef FREECIV_JSON_CONNECTION
5710 /* Enter array. */
5711 field_addr.sub_location = plocation_elem_new(0);
5712#endif /* FREECIV_JSON_CONNECTION */
5713
5714 for (i = 0; i < O_LAST; i++) {
5715#ifdef FREECIV_JSON_CONNECTION
5716 field_addr.sub_location->number = i;
5717#endif /* FREECIV_JSON_CONNECTION */
5718 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->min_city_center_output[i])) {
5719 RECEIVE_PACKET_FIELD_ERROR(min_city_center_output);
5720 }
5721 }
5722
5723#ifdef FREECIV_JSON_CONNECTION
5724 /* Exit array. */
5725 FC_FREE(field_addr.sub_location);
5726#endif /* FREECIV_JSON_CONNECTION */
5727 }
5728 }
5729 real_packet->muuk_food_wipe = BV_ISSET(fields, 84);
5730 real_packet->muuk_gold_wipe = BV_ISSET(fields, 85);
5731 real_packet->muuk_shield_wipe = BV_ISSET(fields, 86);
5732 if (BV_ISSET(fields, 87)) {
5733 log_packet_detailed(" got field 'notradesize'");
5734#ifdef FREECIV_JSON_CONNECTION
5735 field_addr.name = "notradesize";
5736#endif /* FREECIV_JSON_CONNECTION */
5737 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->notradesize)) {
5738 RECEIVE_PACKET_FIELD_ERROR(notradesize);
5739 }
5740 }
5741 real_packet->nuclear_winter = BV_ISSET(fields, 88);
5742 if (BV_ISSET(fields, 89)) {
5743 log_packet_detailed(" got field 'nuclearwinter'");
5744#ifdef FREECIV_JSON_CONNECTION
5745 field_addr.name = "nuclearwinter";
5746#endif /* FREECIV_JSON_CONNECTION */
5747 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->nuclearwinter)) {
5748 RECEIVE_PACKET_FIELD_ERROR(nuclearwinter);
5749 }
5750 }
5751 if (BV_ISSET(fields, 90)) {
5752 log_packet_detailed(" got field 'phase'");
5753#ifdef FREECIV_JSON_CONNECTION
5754 field_addr.name = "phase";
5755#endif /* FREECIV_JSON_CONNECTION */
5756 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
5757 RECEIVE_PACKET_FIELD_ERROR(phase);
5758 }
5759 }
5760 if (BV_ISSET(fields, 91)) {
5761 log_packet_detailed(" got field 'phase_mode'");
5762#ifdef FREECIV_JSON_CONNECTION
5763 field_addr.name = "phase_mode";
5764#endif /* FREECIV_JSON_CONNECTION */
5765 {
5766 int readin;
5767
5768 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5769 RECEIVE_PACKET_FIELD_ERROR(phase_mode);
5770 }
5771 real_packet->phase_mode = readin;
5772 }
5773 }
5774 real_packet->pillage_select = BV_ISSET(fields, 92);
5775 real_packet->steal_maps_reveals_all_cities = BV_ISSET(fields, 93);
5776 real_packet->poison_empties_food_stock = BV_ISSET(fields, 94);
5777 real_packet->tech_steal_allow_holes = BV_ISSET(fields, 95);
5778 real_packet->tech_trade_allow_holes = BV_ISSET(fields, 96);
5779 real_packet->tech_trade_loss_allow_holes = BV_ISSET(fields, 97);
5780 real_packet->tech_parasite_allow_holes = BV_ISSET(fields, 98);
5781 real_packet->tech_loss_allow_holes = BV_ISSET(fields, 99);
5782 if (BV_ISSET(fields, 100)) {
5783 log_packet_detailed(" got field 'rapturedelay'");
5784#ifdef FREECIV_JSON_CONNECTION
5785 field_addr.name = "rapturedelay";
5786#endif /* FREECIV_JSON_CONNECTION */
5787 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapturedelay)) {
5788 RECEIVE_PACKET_FIELD_ERROR(rapturedelay);
5789 }
5790 }
5791 if (BV_ISSET(fields, 101)) {
5792 log_packet_detailed(" got field 'disasters'");
5793#ifdef FREECIV_JSON_CONNECTION
5794 field_addr.name = "disasters";
5795#endif /* FREECIV_JSON_CONNECTION */
5796 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disasters)) {
5797 RECEIVE_PACKET_FIELD_ERROR(disasters);
5798 }
5799 }
5800 real_packet->restrictinfra = BV_ISSET(fields, 102);
5801 real_packet->unreachable_protects = BV_ISSET(fields, 103);
5802 if (BV_ISSET(fields, 104)) {
5803 log_packet_detailed(" got field 'sciencebox'");
5804#ifdef FREECIV_JSON_CONNECTION
5805 field_addr.name = "sciencebox";
5806#endif /* FREECIV_JSON_CONNECTION */
5807 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->sciencebox)) {
5808 RECEIVE_PACKET_FIELD_ERROR(sciencebox);
5809 }
5810 }
5811 if (BV_ISSET(fields, 105)) {
5812 log_packet_detailed(" got field 'shieldbox'");
5813#ifdef FREECIV_JSON_CONNECTION
5814 field_addr.name = "shieldbox";
5815#endif /* FREECIV_JSON_CONNECTION */
5816 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->shieldbox)) {
5817 RECEIVE_PACKET_FIELD_ERROR(shieldbox);
5818 }
5819 }
5820 if (BV_ISSET(fields, 106)) {
5821 log_packet_detailed(" got field 'skill_level'");
5822#ifdef FREECIV_JSON_CONNECTION
5823 field_addr.name = "skill_level";
5824#endif /* FREECIV_JSON_CONNECTION */
5825 {
5826 int readin;
5827
5828 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5829 RECEIVE_PACKET_FIELD_ERROR(skill_level);
5830 }
5831 real_packet->skill_level = readin;
5832 }
5833 }
5834 if (BV_ISSET(fields, 107)) {
5835 log_packet_detailed(" got field 'victory_conditions'");
5836#ifdef FREECIV_JSON_CONNECTION
5837 field_addr.name = "victory_conditions";
5838#endif /* FREECIV_JSON_CONNECTION */
5839 {
5840 int readin;
5841
5842 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5843 RECEIVE_PACKET_FIELD_ERROR(victory_conditions);
5844 }
5845 real_packet->victory_conditions = readin;
5846 }
5847 }
5848 real_packet->team_pooled_research = BV_ISSET(fields, 108);
5849 if (BV_ISSET(fields, 109)) {
5850 log_packet_detailed(" got field 'tech'");
5851#ifdef FREECIV_JSON_CONNECTION
5852 field_addr.name = "tech";
5853#endif /* FREECIV_JSON_CONNECTION */
5854 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->tech)) {
5855 RECEIVE_PACKET_FIELD_ERROR(tech);
5856 }
5857 }
5858 if (BV_ISSET(fields, 110)) {
5859 log_packet_detailed(" got field 'tech_cost_style'");
5860#ifdef FREECIV_JSON_CONNECTION
5861 field_addr.name = "tech_cost_style";
5862#endif /* FREECIV_JSON_CONNECTION */
5863 {
5864 int readin;
5865
5866 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5867 RECEIVE_PACKET_FIELD_ERROR(tech_cost_style);
5868 }
5869 real_packet->tech_cost_style = readin;
5870 }
5871 }
5872 if (BV_ISSET(fields, 111)) {
5873 log_packet_detailed(" got field 'tech_leakage'");
5874#ifdef FREECIV_JSON_CONNECTION
5875 field_addr.name = "tech_leakage";
5876#endif /* FREECIV_JSON_CONNECTION */
5877 {
5878 int readin;
5879
5880 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5881 RECEIVE_PACKET_FIELD_ERROR(tech_leakage);
5882 }
5883 real_packet->tech_leakage = readin;
5884 }
5885 }
5886 if (BV_ISSET(fields, 112)) {
5887 log_packet_detailed(" got field 'tech_upkeep_divider'");
5888#ifdef FREECIV_JSON_CONNECTION
5889 field_addr.name = "tech_upkeep_divider";
5890#endif /* FREECIV_JSON_CONNECTION */
5891 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep_divider)) {
5892 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_divider);
5893 }
5894 }
5895 if (BV_ISSET(fields, 113)) {
5896 log_packet_detailed(" got field 'tech_upkeep_style'");
5897#ifdef FREECIV_JSON_CONNECTION
5898 field_addr.name = "tech_upkeep_style";
5899#endif /* FREECIV_JSON_CONNECTION */
5900 {
5901 int readin;
5902
5903 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5904 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep_style);
5905 }
5906 real_packet->tech_upkeep_style = readin;
5907 }
5908 }
5909 if (BV_ISSET(fields, 114)) {
5910 log_packet_detailed(" got field 'techloss_forgiveness'");
5911#ifdef FREECIV_JSON_CONNECTION
5912 field_addr.name = "techloss_forgiveness";
5913#endif /* FREECIV_JSON_CONNECTION */
5914 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->techloss_forgiveness)) {
5915 RECEIVE_PACKET_FIELD_ERROR(techloss_forgiveness);
5916 }
5917 }
5918 if (BV_ISSET(fields, 115)) {
5919 log_packet_detailed(" got field 'free_tech_method'");
5920#ifdef FREECIV_JSON_CONNECTION
5921 field_addr.name = "free_tech_method";
5922#endif /* FREECIV_JSON_CONNECTION */
5923 {
5924 int readin;
5925
5926 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5927 RECEIVE_PACKET_FIELD_ERROR(free_tech_method);
5928 }
5929 real_packet->free_tech_method = readin;
5930 }
5931 }
5932 if (BV_ISSET(fields, 116)) {
5933 log_packet_detailed(" got field 'gameloss_style'");
5934#ifdef FREECIV_JSON_CONNECTION
5935 field_addr.name = "gameloss_style";
5936#endif /* FREECIV_JSON_CONNECTION */
5937 {
5938 int readin;
5939
5940 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5941 RECEIVE_PACKET_FIELD_ERROR(gameloss_style);
5942 }
5943 real_packet->gameloss_style = readin;
5944 }
5945 }
5946 if (BV_ISSET(fields, 117)) {
5947 log_packet_detailed(" got field 'timeout'");
5948#ifdef FREECIV_JSON_CONNECTION
5949 field_addr.name = "timeout";
5950#endif /* FREECIV_JSON_CONNECTION */
5951 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->timeout)) {
5952 RECEIVE_PACKET_FIELD_ERROR(timeout);
5953 }
5954 }
5955 if (BV_ISSET(fields, 118)) {
5956 log_packet_detailed(" got field 'first_timeout'");
5957#ifdef FREECIV_JSON_CONNECTION
5958 field_addr.name = "first_timeout";
5959#endif /* FREECIV_JSON_CONNECTION */
5960 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->first_timeout)) {
5961 RECEIVE_PACKET_FIELD_ERROR(first_timeout);
5962 }
5963 }
5964 real_packet->tired_attack = BV_ISSET(fields, 119);
5965 if (BV_ISSET(fields, 120)) {
5966 log_packet_detailed(" got field 'trademindist'");
5967#ifdef FREECIV_JSON_CONNECTION
5968 field_addr.name = "trademindist";
5969#endif /* FREECIV_JSON_CONNECTION */
5970 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trademindist)) {
5971 RECEIVE_PACKET_FIELD_ERROR(trademindist);
5972 }
5973 }
5974 if (BV_ISSET(fields, 121)) {
5975 log_packet_detailed(" got field 'trade_revenue_style'");
5976#ifdef FREECIV_JSON_CONNECTION
5977 field_addr.name = "trade_revenue_style";
5978#endif /* FREECIV_JSON_CONNECTION */
5979 {
5980 int readin;
5981
5982 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
5983 RECEIVE_PACKET_FIELD_ERROR(trade_revenue_style);
5984 }
5985 real_packet->trade_revenue_style = readin;
5986 }
5987 }
5988 real_packet->trading_city = BV_ISSET(fields, 122);
5989 real_packet->trading_gold = BV_ISSET(fields, 123);
5990 real_packet->trading_tech = BV_ISSET(fields, 124);
5991 if (BV_ISSET(fields, 125)) {
5992 log_packet_detailed(" got field 'turn'");
5993#ifdef FREECIV_JSON_CONNECTION
5994 field_addr.name = "turn";
5995#endif /* FREECIV_JSON_CONNECTION */
5996 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
5997 RECEIVE_PACKET_FIELD_ERROR(turn);
5998 }
5999 }
6000 if (BV_ISSET(fields, 126)) {
6001 log_packet_detailed(" got field 'warminglevel'");
6002#ifdef FREECIV_JSON_CONNECTION
6003 field_addr.name = "warminglevel";
6004#endif /* FREECIV_JSON_CONNECTION */
6005 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->warminglevel)) {
6006 RECEIVE_PACKET_FIELD_ERROR(warminglevel);
6007 }
6008 }
6009 if (BV_ISSET(fields, 127)) {
6010 log_packet_detailed(" got field 'year'");
6011#ifdef FREECIV_JSON_CONNECTION
6012 field_addr.name = "year";
6013#endif /* FREECIV_JSON_CONNECTION */
6014 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
6015 RECEIVE_PACKET_FIELD_ERROR(year);
6016 }
6017 }
6018 real_packet->year_0_hack = BV_ISSET(fields, 128);
6019 if (BV_ISSET(fields, 129)) {
6020 log_packet_detailed(" got field 'top_cities_count'");
6021#ifdef FREECIV_JSON_CONNECTION
6022 field_addr.name = "top_cities_count";
6023#endif /* FREECIV_JSON_CONNECTION */
6024 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->top_cities_count)) {
6025 RECEIVE_PACKET_FIELD_ERROR(top_cities_count);
6026 }
6027 }
6028 if (BV_ISSET(fields, 130)) {
6029 log_packet_detailed(" got field 'fragment_count'");
6030#ifdef FREECIV_JSON_CONNECTION
6031 field_addr.name = "fragment_count";
6032#endif /* FREECIV_JSON_CONNECTION */
6033 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragment_count)) {
6034 RECEIVE_PACKET_FIELD_ERROR(fragment_count);
6035 }
6036 }
6037 real_packet->civil_war_enabled = BV_ISSET(fields, 131);
6038 if (BV_ISSET(fields, 132)) {
6039 log_packet_detailed(" got field 'civil_war_bonus_celebrating'");
6040#ifdef FREECIV_JSON_CONNECTION
6041 field_addr.name = "civil_war_bonus_celebrating";
6042#endif /* FREECIV_JSON_CONNECTION */
6043 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_celebrating)) {
6044 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_celebrating);
6045 }
6046 }
6047 if (BV_ISSET(fields, 133)) {
6048 log_packet_detailed(" got field 'civil_war_bonus_unhappy'");
6049#ifdef FREECIV_JSON_CONNECTION
6050 field_addr.name = "civil_war_bonus_unhappy";
6051#endif /* FREECIV_JSON_CONNECTION */
6052 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->civil_war_bonus_unhappy)) {
6053 RECEIVE_PACKET_FIELD_ERROR(civil_war_bonus_unhappy);
6054 }
6055 }
6056 if (BV_ISSET(fields, 134)) {
6057 log_packet_detailed(" got field 'granularity'");
6058#ifdef FREECIV_JSON_CONNECTION
6059 field_addr.name = "granularity";
6060#endif /* FREECIV_JSON_CONNECTION */
6061 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granularity)) {
6062 RECEIVE_PACKET_FIELD_ERROR(granularity);
6063 }
6064 }
6065 if (BV_ISSET(fields, 135)) {
6066 log_packet_detailed(" got field 'small_wonder_visibility'");
6067#ifdef FREECIV_JSON_CONNECTION
6068 field_addr.name = "small_wonder_visibility";
6069#endif /* FREECIV_JSON_CONNECTION */
6070 {
6071 int readin;
6072
6073 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
6074 RECEIVE_PACKET_FIELD_ERROR(small_wonder_visibility);
6075 }
6076 real_packet->small_wonder_visibility = readin;
6077 }
6078 }
6079
6080 if (NULL == old) {
6081 old = fc_malloc(sizeof(*old));
6082 *old = *real_packet;
6083 genhash_insert(*hash, old, old);
6084 } else {
6085 *old = *real_packet;
6086 }
6087
6088#endif /* FREECIV_DELTA_PROTOCOL */
6089 RECEIVE_PACKET_END(real_packet);
6090}
6091
6092 static int send_packet_game_info_100(struct connection *pc, const struct packet_game_info *packet)
6093{
6094 const struct packet_game_info *real_packet = packet;
6095 int e;
6096#ifdef FREECIV_DELTA_PROTOCOL
6097 packet_game_info_100_fields fields;
6098 struct packet_game_info *old;
6099 bool differ;
6100 struct genhash **hash = pc->phs.sent + PACKET_GAME_INFO;
6101 int different = 0;
6102#endif /* FREECIV_DELTA_PROTOCOL */
6103 SEND_PACKET_START(PACKET_GAME_INFO);
6104#ifdef FREECIV_JSON_CONNECTION
6105 struct plocation field_addr;
6106 {
6107 struct plocation *field_addr_tmp = plocation_field_new(NULL);
6108 field_addr = *field_addr_tmp;
6109 FC_FREE(field_addr_tmp);
6110 }
6111#endif /* FREECIV_JSON_CONNECTION */
6112
6113 log_packet_detailed("packet_game_info_100: sending info about ()");
6114
6115#ifdef FREECIV_DELTA_PROTOCOL
6116 if (NULL == *hash) {
6117 *hash = genhash_new_full(hash_packet_game_info_100, cmp_packet_game_info_100,
6118 NULL, NULL, NULL, free);
6119 }
6120 BV_CLR_ALL(fields);
6121
6122 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
6123 old = fc_malloc(sizeof(*old));
6124 *old = *real_packet;
6125 genhash_insert(*hash, old, old);
6126 memset(old, 0, sizeof(*old));
6127 different = 1; /* Force to send. */
6128 }
6129 differ = (old->add_to_size_limit != real_packet->add_to_size_limit);
6130 if (differ) {
6131 different++;
6132 BV_SET(fields, 0);
6133 }
6134
6135 differ = (old->aifill != real_packet->aifill);
6136 if (differ) {
6137 different++;
6138 BV_SET(fields, 1);
6139 }
6140
6141 differ = (old->persistent_ready != real_packet->persistent_ready);
6142 if (differ) {
6143 different++;
6144 BV_SET(fields, 2);
6145 }
6146
6147 differ = (old->airlifting_style != real_packet->airlifting_style);
6148 if (differ) {
6149 different++;
6150 BV_SET(fields, 3);
6151 }
6152
6153 differ = (old->airlift_from_always_enabled != real_packet->airlift_from_always_enabled);
6154 if (differ) {
6155 different++;
6156 }
6157 if (packet->airlift_from_always_enabled) {
6158 BV_SET(fields, 4);
6159 }
6160
6161 differ = (old->airlift_to_always_enabled != real_packet->airlift_to_always_enabled);
6162 if (differ) {
6163 different++;
6164 }
6165 if (packet->airlift_to_always_enabled) {
6166 BV_SET(fields, 5);
6167 }
6168
6169 differ = (old->angrycitizen != real_packet->angrycitizen);
6170 if (differ) {
6171 different++;
6172 BV_SET(fields, 6);
6173 }
6174
6175 differ = (old->base_pollution != real_packet->base_pollution);
6176 if (differ) {
6177 different++;
6178 BV_SET(fields, 7);
6179 }
6180
6181 differ = (old->base_tech_cost != real_packet->base_tech_cost);
6182 if (differ) {
6183 different++;
6184 BV_SET(fields, 8);
6185 }
6186
6187 differ = (old->min_tech_cost != real_packet->min_tech_cost);
6188 if (differ) {
6189 different++;
6190 BV_SET(fields, 9);
6191 }
6192
6193 differ = (old->tech_leak_pct != real_packet->tech_leak_pct);
6194 if (differ) {
6195 different++;
6196 BV_SET(fields, 10);
6197 }
6198
6199 differ = (old->border_city_radius_sq != real_packet->border_city_radius_sq);
6200 if (differ) {
6201 different++;
6202 BV_SET(fields, 11);
6203 }
6204
6205 differ = (old->border_size_effect != real_packet->border_size_effect);
6206 if (differ) {
6207 different++;
6208 BV_SET(fields, 12);
6209 }
6210
6211 differ = (old->border_city_permanent_radius_sq != real_packet->border_city_permanent_radius_sq);
6212 if (differ) {
6213 different++;
6214 BV_SET(fields, 13);
6215 }
6216
6217 differ = (old->borders != real_packet->borders);
6218 if (differ) {
6219 different++;
6220 BV_SET(fields, 14);
6221 }
6222
6223 differ = (old->base_bribe_cost != real_packet->base_bribe_cost);
6224 if (differ) {
6225 different++;
6226 BV_SET(fields, 15);
6227 }
6228
6229 differ = (old->caravan_bonus_style != real_packet->caravan_bonus_style);
6230 if (differ) {
6231 different++;
6232 BV_SET(fields, 16);
6233 }
6234
6235 differ = (old->culture_vic_points != real_packet->culture_vic_points);
6236 if (differ) {
6237 different++;
6238 BV_SET(fields, 17);
6239 }
6240
6241 differ = (old->culture_vic_lead != real_packet->culture_vic_lead);
6242 if (differ) {
6243 different++;
6244 BV_SET(fields, 18);
6245 }
6246
6247 differ = (old->culture_migration_pml != real_packet->culture_migration_pml);
6248 if (differ) {
6249 different++;
6250 BV_SET(fields, 19);
6251 }
6252
6253 differ = (old->history_interest_pml != real_packet->history_interest_pml);
6254 if (differ) {
6255 different++;
6256 BV_SET(fields, 20);
6257 }
6258
6259 differ = (old->celebratesize != real_packet->celebratesize);
6260 if (differ) {
6261 different++;
6262 BV_SET(fields, 21);
6263 }
6264
6265 differ = (old->changable_tax != real_packet->changable_tax);
6266 if (differ) {
6267 different++;
6268 }
6269 if (packet->changable_tax) {
6270 BV_SET(fields, 22);
6271 }
6272
6273 differ = (old->pop_report_zeroes != real_packet->pop_report_zeroes);
6274 if (differ) {
6275 different++;
6276 BV_SET(fields, 23);
6277 }
6278
6279 differ = (old->citizen_nationality != real_packet->citizen_nationality);
6280 if (differ) {
6281 different++;
6282 }
6283 if (packet->citizen_nationality) {
6284 BV_SET(fields, 24);
6285 }
6286
6287 differ = (old->unit_builders_nationality != real_packet->unit_builders_nationality);
6288 if (differ) {
6289 different++;
6290 }
6291 if (packet->unit_builders_nationality) {
6292 BV_SET(fields, 25);
6293 }
6294
6295 differ = (old->citizen_convert_speed != real_packet->citizen_convert_speed);
6296 if (differ) {
6297 different++;
6298 BV_SET(fields, 26);
6299 }
6300
6301 differ = (old->conquest_convert_pct != real_packet->conquest_convert_pct);
6302 if (differ) {
6303 different++;
6304 BV_SET(fields, 27);
6305 }
6306
6307 differ = (old->citizen_partisans_pct != real_packet->citizen_partisans_pct);
6308 if (differ) {
6309 different++;
6310 BV_SET(fields, 28);
6311 }
6312
6313 differ = (old->citymindist != real_packet->citymindist);
6314 if (differ) {
6315 different++;
6316 BV_SET(fields, 29);
6317 }
6318
6319 differ = (old->cooling != real_packet->cooling);
6320 if (differ) {
6321 different++;
6322 BV_SET(fields, 30);
6323 }
6324
6325 differ = (old->coolinglevel != real_packet->coolinglevel);
6326 if (differ) {
6327 different++;
6328 BV_SET(fields, 31);
6329 }
6330
6331 differ = !BV_ARE_EQUAL(old->diplchance_initial_odds, real_packet->diplchance_initial_odds);
6332 if (differ) {
6333 different++;
6334 BV_SET(fields, 32);
6335 }
6336
6337 differ = (old->diplomacy != real_packet->diplomacy);
6338 if (differ) {
6339 different++;
6340 BV_SET(fields, 33);
6341 }
6342
6343 differ = (old->fogofwar != real_packet->fogofwar);
6344 if (differ) {
6345 different++;
6346 }
6347 if (packet->fogofwar) {
6348 BV_SET(fields, 34);
6349 }
6350
6351 differ = (old->food_cost != real_packet->food_cost);
6352 if (differ) {
6353 different++;
6354 BV_SET(fields, 35);
6355 }
6356
6357 differ = (old->foodbox != real_packet->foodbox);
6358 if (differ) {
6359 different++;
6360 BV_SET(fields, 36);
6361 }
6362
6363 differ = (old->forced_gold != real_packet->forced_gold);
6364 if (differ) {
6365 different++;
6366 BV_SET(fields, 37);
6367 }
6368
6369 differ = (old->forced_luxury != real_packet->forced_luxury);
6370 if (differ) {
6371 different++;
6372 BV_SET(fields, 38);
6373 }
6374
6375 differ = (old->forced_science != real_packet->forced_science);
6376 if (differ) {
6377 different++;
6378 BV_SET(fields, 39);
6379 }
6380
6381 differ = (old->fulltradesize != real_packet->fulltradesize);
6382 if (differ) {
6383 different++;
6384 BV_SET(fields, 40);
6385 }
6386
6387 differ = (old->trade_world_rel_pct != real_packet->trade_world_rel_pct);
6388 if (differ) {
6389 different++;
6390 BV_SET(fields, 41);
6391 }
6392
6393 differ = (old->min_trade_route_val != real_packet->min_trade_route_val);
6394 if (differ) {
6395 different++;
6396 BV_SET(fields, 42);
6397 }
6398
6399 differ = (old->reveal_trade_partner != real_packet->reveal_trade_partner);
6400 if (differ) {
6401 different++;
6402 }
6403 if (packet->reveal_trade_partner) {
6404 BV_SET(fields, 43);
6405 }
6406
6407 differ = (old->goods_selection != real_packet->goods_selection);
6408 if (differ) {
6409 different++;
6410 BV_SET(fields, 44);
6411 }
6412
6413 differ = (old->global_advance_count != real_packet->global_advance_count);
6414 if (differ) {
6415 different++;
6416 BV_SET(fields, 45);
6417 }
6418
6419 differ = FALSE;
6420 {
6421 int i;
6422
6423 for (i = 0; i < A_LAST; i++) {
6424 differ = (old->global_advances[i] != real_packet->global_advances[i]);
6425 if (differ) {
6426 break;
6427 }
6428 }
6429 }
6430 if (differ) {
6431 different++;
6432 BV_SET(fields, 46);
6433 }
6434
6435 differ = (old->global_warming != real_packet->global_warming);
6436 if (differ) {
6437 different++;
6438 }
6439 if (packet->global_warming) {
6440 BV_SET(fields, 47);
6441 }
6442
6443 differ = (old->globalwarming != real_packet->globalwarming);
6444 if (differ) {
6445 different++;
6446 BV_SET(fields, 48);
6447 }
6448
6449 differ = (old->gold != real_packet->gold);
6450 if (differ) {
6451 different++;
6452 BV_SET(fields, 49);
6453 }
6454
6455 differ = (old->gold_upkeep_style != real_packet->gold_upkeep_style);
6456 if (differ) {
6457 different++;
6458 BV_SET(fields, 50);
6459 }
6460
6461 differ = (old->homeless_gold_upkeep != real_packet->homeless_gold_upkeep);
6462 if (differ) {
6463 different++;
6464 }
6465 if (packet->homeless_gold_upkeep) {
6466 BV_SET(fields, 51);
6467 }
6468
6469 differ = (old->infrapoints != real_packet->infrapoints);
6470 if (differ) {
6471 different++;
6472 BV_SET(fields, 52);
6473 }
6474
6475 differ = (old->revolentype != real_packet->revolentype);
6476 if (differ) {
6477 different++;
6478 BV_SET(fields, 53);
6479 }
6480
6481 differ = (old->default_government_id != real_packet->default_government_id);
6482 if (differ) {
6483 different++;
6484 BV_SET(fields, 54);
6485 }
6486
6487 differ = (old->government_during_revolution_id != real_packet->government_during_revolution_id);
6488 if (differ) {
6489 different++;
6490 BV_SET(fields, 55);
6491 }
6492
6493 differ = (old->granary_food_inc != real_packet->granary_food_inc);
6494 if (differ) {
6495 different++;
6496 BV_SET(fields, 56);
6497 }
6498
6499 differ = FALSE;
6500 {
6501 int i;
6502
6503 for (i = 0; i < MAX_GRANARY_INIS; i++) {
6504 differ = (old->granary_food_ini[i] != real_packet->granary_food_ini[i]);
6505 if (differ) {
6506 break;
6507 }
6508 }
6509 }
6510 if (differ) {
6511 different++;
6512 BV_SET(fields, 57);
6513 }
6514
6515 differ = (old->granary_num_inis != real_packet->granary_num_inis);
6516 if (differ) {
6517 different++;
6518 BV_SET(fields, 58);
6519 }
6520
6521 differ = FALSE;
6522 {
6523 int i;
6524
6525 for (i = 0; i < B_LAST; i++) {
6526 differ = (old->great_wonder_owners[i] != real_packet->great_wonder_owners[i]);
6527 if (differ) {
6528 break;
6529 }
6530 }
6531 }
6532 if (differ) {
6533 different++;
6534 BV_SET(fields, 59);
6535 }
6536
6537 differ = (old->happy_cost != real_packet->happy_cost);
6538 if (differ) {
6539 different++;
6540 BV_SET(fields, 60);
6541 }
6542
6543 differ = (old->happyborders != real_packet->happyborders);
6544 if (differ) {
6545 different++;
6546 BV_SET(fields, 61);
6547 }
6548
6549 differ = (old->heating != real_packet->heating);
6550 if (differ) {
6551 different++;
6552 BV_SET(fields, 62);
6553 }
6554
6555 differ = (old->illness_base_factor != real_packet->illness_base_factor);
6556 if (differ) {
6557 different++;
6558 BV_SET(fields, 63);
6559 }
6560
6561 differ = (old->illness_min_size != real_packet->illness_min_size);
6562 if (differ) {
6563 different++;
6564 BV_SET(fields, 64);
6565 }
6566
6567 differ = (old->illness_on != real_packet->illness_on);
6568 if (differ) {
6569 different++;
6570 }
6571 if (packet->illness_on) {
6572 BV_SET(fields, 65);
6573 }
6574
6575 differ = (old->illness_pollution_factor != real_packet->illness_pollution_factor);
6576 if (differ) {
6577 different++;
6578 BV_SET(fields, 66);
6579 }
6580
6581 differ = (old->illness_trade_infection != real_packet->illness_trade_infection);
6582 if (differ) {
6583 different++;
6584 BV_SET(fields, 67);
6585 }
6586
6587 differ = (old->init_city_radius_sq != real_packet->init_city_radius_sq);
6588 if (differ) {
6589 different++;
6590 BV_SET(fields, 68);
6591 }
6592
6593 differ = (old->is_edit_mode != real_packet->is_edit_mode);
6594 if (differ) {
6595 different++;
6596 }
6597 if (packet->is_edit_mode) {
6598 BV_SET(fields, 69);
6599 }
6600
6601 differ = (old->is_new_game != real_packet->is_new_game);
6602 if (differ) {
6603 different++;
6604 }
6605 if (packet->is_new_game) {
6606 BV_SET(fields, 70);
6607 }
6608
6609 differ = (old->killcitizen != real_packet->killcitizen);
6610 if (differ) {
6611 different++;
6612 }
6613 if (packet->killcitizen) {
6614 BV_SET(fields, 71);
6615 }
6616
6617 differ = (old->killstack != real_packet->killstack);
6618 if (differ) {
6619 different++;
6620 }
6621 if (packet->killstack) {
6622 BV_SET(fields, 72);
6623 }
6624
6625 differ = (old->only_killing_makes_veteran != real_packet->only_killing_makes_veteran);
6626 if (differ) {
6627 different++;
6628 }
6629 if (packet->only_killing_makes_veteran) {
6630 BV_SET(fields, 73);
6631 }
6632
6633 differ = (old->only_real_fight_makes_veteran != real_packet->only_real_fight_makes_veteran);
6634 if (differ) {
6635 different++;
6636 }
6637 if (packet->only_real_fight_makes_veteran) {
6638 BV_SET(fields, 74);
6639 }
6640
6641 differ = (old->combat_odds_scaled_veterancy != real_packet->combat_odds_scaled_veterancy);
6642 if (differ) {
6643 different++;
6644 }
6645 if (packet->combat_odds_scaled_veterancy) {
6646 BV_SET(fields, 75);
6647 }
6648
6649 differ = (old->damage_reduces_bombard_rate != real_packet->damage_reduces_bombard_rate);
6650 if (differ) {
6651 different++;
6652 }
6653 if (packet->damage_reduces_bombard_rate) {
6654 BV_SET(fields, 76);
6655 }
6656
6657 differ = (old->low_firepower_badwallattacker != real_packet->low_firepower_badwallattacker);
6658 if (differ) {
6659 different++;
6660 BV_SET(fields, 77);
6661 }
6662
6663 differ = (old->low_firepower_pearl_harbour != real_packet->low_firepower_pearl_harbour);
6664 if (differ) {
6665 different++;
6666 BV_SET(fields, 78);
6667 }
6668
6669 differ = (old->low_firepower_combat_bonus != real_packet->low_firepower_combat_bonus);
6670 if (differ) {
6671 different++;
6672 BV_SET(fields, 79);
6673 }
6674
6675 differ = (old->low_firepower_nonnat_bombard != real_packet->low_firepower_nonnat_bombard);
6676 if (differ) {
6677 different++;
6678 BV_SET(fields, 80);
6679 }
6680
6681 differ = (old->nuke_pop_loss_pct != real_packet->nuke_pop_loss_pct);
6682 if (differ) {
6683 different++;
6684 BV_SET(fields, 81);
6685 }
6686
6687 differ = (old->nuke_defender_survival_chance_pct != real_packet->nuke_defender_survival_chance_pct);
6688 if (differ) {
6689 different++;
6690 BV_SET(fields, 82);
6691 }
6692
6693 differ = FALSE;
6694 {
6695 int i;
6696
6697 for (i = 0; i < O_LAST; i++) {
6698 differ = (old->min_city_center_output[i] != real_packet->min_city_center_output[i]);
6699 if (differ) {
6700 break;
6701 }
6702 }
6703 }
6704 if (differ) {
6705 different++;
6706 BV_SET(fields, 83);
6707 }
6708
6709 differ = (old->muuk_food_wipe != real_packet->muuk_food_wipe);
6710 if (differ) {
6711 different++;
6712 }
6713 if (packet->muuk_food_wipe) {
6714 BV_SET(fields, 84);
6715 }
6716
6717 differ = (old->muuk_gold_wipe != real_packet->muuk_gold_wipe);
6718 if (differ) {
6719 different++;
6720 }
6721 if (packet->muuk_gold_wipe) {
6722 BV_SET(fields, 85);
6723 }
6724
6725 differ = (old->muuk_shield_wipe != real_packet->muuk_shield_wipe);
6726 if (differ) {
6727 different++;
6728 }
6729 if (packet->muuk_shield_wipe) {
6730 BV_SET(fields, 86);
6731 }
6732
6733 differ = (old->notradesize != real_packet->notradesize);
6734 if (differ) {
6735 different++;
6736 BV_SET(fields, 87);
6737 }
6738
6739 differ = (old->nuclear_winter != real_packet->nuclear_winter);
6740 if (differ) {
6741 different++;
6742 }
6743 if (packet->nuclear_winter) {
6744 BV_SET(fields, 88);
6745 }
6746
6747 differ = (old->nuclearwinter != real_packet->nuclearwinter);
6748 if (differ) {
6749 different++;
6750 BV_SET(fields, 89);
6751 }
6752
6753 differ = (old->phase != real_packet->phase);
6754 if (differ) {
6755 different++;
6756 BV_SET(fields, 90);
6757 }
6758
6759 differ = (old->phase_mode != real_packet->phase_mode);
6760 if (differ) {
6761 different++;
6762 BV_SET(fields, 91);
6763 }
6764
6765 differ = (old->pillage_select != real_packet->pillage_select);
6766 if (differ) {
6767 different++;
6768 }
6769 if (packet->pillage_select) {
6770 BV_SET(fields, 92);
6771 }
6772
6773 differ = (old->steal_maps_reveals_all_cities != real_packet->steal_maps_reveals_all_cities);
6774 if (differ) {
6775 different++;
6776 }
6777 if (packet->steal_maps_reveals_all_cities) {
6778 BV_SET(fields, 93);
6779 }
6780
6781 differ = (old->poison_empties_food_stock != real_packet->poison_empties_food_stock);
6782 if (differ) {
6783 different++;
6784 }
6785 if (packet->poison_empties_food_stock) {
6786 BV_SET(fields, 94);
6787 }
6788
6789 differ = (old->tech_steal_allow_holes != real_packet->tech_steal_allow_holes);
6790 if (differ) {
6791 different++;
6792 }
6793 if (packet->tech_steal_allow_holes) {
6794 BV_SET(fields, 95);
6795 }
6796
6797 differ = (old->tech_trade_allow_holes != real_packet->tech_trade_allow_holes);
6798 if (differ) {
6799 different++;
6800 }
6801 if (packet->tech_trade_allow_holes) {
6802 BV_SET(fields, 96);
6803 }
6804
6805 differ = (old->tech_trade_loss_allow_holes != real_packet->tech_trade_loss_allow_holes);
6806 if (differ) {
6807 different++;
6808 }
6809 if (packet->tech_trade_loss_allow_holes) {
6810 BV_SET(fields, 97);
6811 }
6812
6813 differ = (old->tech_parasite_allow_holes != real_packet->tech_parasite_allow_holes);
6814 if (differ) {
6815 different++;
6816 }
6817 if (packet->tech_parasite_allow_holes) {
6818 BV_SET(fields, 98);
6819 }
6820
6821 differ = (old->tech_loss_allow_holes != real_packet->tech_loss_allow_holes);
6822 if (differ) {
6823 different++;
6824 }
6825 if (packet->tech_loss_allow_holes) {
6826 BV_SET(fields, 99);
6827 }
6828
6829 differ = (old->rapturedelay != real_packet->rapturedelay);
6830 if (differ) {
6831 different++;
6832 BV_SET(fields, 100);
6833 }
6834
6835 differ = (old->disasters != real_packet->disasters);
6836 if (differ) {
6837 different++;
6838 BV_SET(fields, 101);
6839 }
6840
6841 differ = (old->restrictinfra != real_packet->restrictinfra);
6842 if (differ) {
6843 different++;
6844 }
6845 if (packet->restrictinfra) {
6846 BV_SET(fields, 102);
6847 }
6848
6849 differ = (old->unreachable_protects != real_packet->unreachable_protects);
6850 if (differ) {
6851 different++;
6852 }
6853 if (packet->unreachable_protects) {
6854 BV_SET(fields, 103);
6855 }
6856
6857 differ = (old->sciencebox != real_packet->sciencebox);
6858 if (differ) {
6859 different++;
6860 BV_SET(fields, 104);
6861 }
6862
6863 differ = (old->shieldbox != real_packet->shieldbox);
6864 if (differ) {
6865 different++;
6866 BV_SET(fields, 105);
6867 }
6868
6869 differ = (old->skill_level != real_packet->skill_level);
6870 if (differ) {
6871 different++;
6872 BV_SET(fields, 106);
6873 }
6874
6875 differ = (old->victory_conditions != real_packet->victory_conditions);
6876 if (differ) {
6877 different++;
6878 BV_SET(fields, 107);
6879 }
6880
6881 differ = (old->team_pooled_research != real_packet->team_pooled_research);
6882 if (differ) {
6883 different++;
6884 }
6885 if (packet->team_pooled_research) {
6886 BV_SET(fields, 108);
6887 }
6888
6889 differ = (old->tech != real_packet->tech);
6890 if (differ) {
6891 different++;
6892 BV_SET(fields, 109);
6893 }
6894
6895 differ = (old->tech_cost_style != real_packet->tech_cost_style);
6896 if (differ) {
6897 different++;
6898 BV_SET(fields, 110);
6899 }
6900
6901 differ = (old->tech_leakage != real_packet->tech_leakage);
6902 if (differ) {
6903 different++;
6904 BV_SET(fields, 111);
6905 }
6906
6907 differ = (old->tech_upkeep_divider != real_packet->tech_upkeep_divider);
6908 if (differ) {
6909 different++;
6910 BV_SET(fields, 112);
6911 }
6912
6913 differ = (old->tech_upkeep_style != real_packet->tech_upkeep_style);
6914 if (differ) {
6915 different++;
6916 BV_SET(fields, 113);
6917 }
6918
6919 differ = (old->techloss_forgiveness != real_packet->techloss_forgiveness);
6920 if (differ) {
6921 different++;
6922 BV_SET(fields, 114);
6923 }
6924
6925 differ = (old->free_tech_method != real_packet->free_tech_method);
6926 if (differ) {
6927 different++;
6928 BV_SET(fields, 115);
6929 }
6930
6931 differ = (old->gameloss_style != real_packet->gameloss_style);
6932 if (differ) {
6933 different++;
6934 BV_SET(fields, 116);
6935 }
6936
6937 differ = (old->timeout != real_packet->timeout);
6938 if (differ) {
6939 different++;
6940 BV_SET(fields, 117);
6941 }
6942
6943 differ = (old->first_timeout != real_packet->first_timeout);
6944 if (differ) {
6945 different++;
6946 BV_SET(fields, 118);
6947 }
6948
6949 differ = (old->tired_attack != real_packet->tired_attack);
6950 if (differ) {
6951 different++;
6952 }
6953 if (packet->tired_attack) {
6954 BV_SET(fields, 119);
6955 }
6956
6957 differ = (old->trademindist != real_packet->trademindist);
6958 if (differ) {
6959 different++;
6960 BV_SET(fields, 120);
6961 }
6962
6963 differ = (old->trade_revenue_style != real_packet->trade_revenue_style);
6964 if (differ) {
6965 different++;
6966 BV_SET(fields, 121);
6967 }
6968
6969 differ = (old->trading_city != real_packet->trading_city);
6970 if (differ) {
6971 different++;
6972 }
6973 if (packet->trading_city) {
6974 BV_SET(fields, 122);
6975 }
6976
6977 differ = (old->trading_gold != real_packet->trading_gold);
6978 if (differ) {
6979 different++;
6980 }
6981 if (packet->trading_gold) {
6982 BV_SET(fields, 123);
6983 }
6984
6985 differ = (old->trading_tech != real_packet->trading_tech);
6986 if (differ) {
6987 different++;
6988 }
6989 if (packet->trading_tech) {
6990 BV_SET(fields, 124);
6991 }
6992
6993 differ = (old->turn != real_packet->turn);
6994 if (differ) {
6995 different++;
6996 BV_SET(fields, 125);
6997 }
6998
6999 differ = (old->warminglevel != real_packet->warminglevel);
7000 if (differ) {
7001 different++;
7002 BV_SET(fields, 126);
7003 }
7004
7005 differ = (old->year != real_packet->year);
7006 if (differ) {
7007 different++;
7008 BV_SET(fields, 127);
7009 }
7010
7011 differ = (old->year_0_hack != real_packet->year_0_hack);
7012 if (differ) {
7013 different++;
7014 }
7015 if (packet->year_0_hack) {
7016 BV_SET(fields, 128);
7017 }
7018
7019 differ = (old->top_cities_count != real_packet->top_cities_count);
7020 if (differ) {
7021 different++;
7022 BV_SET(fields, 129);
7023 }
7024
7025 differ = (old->fragment_count != real_packet->fragment_count);
7026 if (differ) {
7027 different++;
7028 BV_SET(fields, 130);
7029 }
7030
7031 differ = (old->civil_war_enabled != real_packet->civil_war_enabled);
7032 if (differ) {
7033 different++;
7034 }
7035 if (packet->civil_war_enabled) {
7036 BV_SET(fields, 131);
7037 }
7038
7039 differ = (old->civil_war_bonus_celebrating != real_packet->civil_war_bonus_celebrating);
7040 if (differ) {
7041 different++;
7042 BV_SET(fields, 132);
7043 }
7044
7045 differ = (old->civil_war_bonus_unhappy != real_packet->civil_war_bonus_unhappy);
7046 if (differ) {
7047 different++;
7048 BV_SET(fields, 133);
7049 }
7050
7051 differ = (old->granularity != real_packet->granularity);
7052 if (differ) {
7053 different++;
7054 BV_SET(fields, 134);
7055 }
7056
7057 differ = (old->small_wonder_visibility != real_packet->small_wonder_visibility);
7058 if (differ) {
7059 different++;
7060 BV_SET(fields, 135);
7061 }
7062
7063 if (different == 0) {
7064 log_packet_detailed(" no change -> discard");
7065 return 0;
7066 }
7067
7068#ifdef FREECIV_JSON_CONNECTION
7069 field_addr.name = "fields";
7070#endif /* FREECIV_JSON_CONNECTION */
7071 e = 0;
7072 e |= DIO_BV_PUT(&dout, &field_addr, fields);
7073 if (e) {
7074 log_packet_detailed("fields bitvector error detected");
7075 }
7076
7077 if (BV_ISSET(fields, 0)) {
7078 log_packet_detailed(" field 'add_to_size_limit' has changed");
7079#ifdef FREECIV_JSON_CONNECTION
7080 field_addr.name = "add_to_size_limit";
7081#endif /* FREECIV_JSON_CONNECTION */
7082 e = 0;
7083 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->add_to_size_limit);
7084 if (e) {
7085 log_packet_detailed("'add_to_size_limit' field error detected");
7086 }
7087 }
7088 if (BV_ISSET(fields, 1)) {
7089 log_packet_detailed(" field 'aifill' has changed");
7090#ifdef FREECIV_JSON_CONNECTION
7091 field_addr.name = "aifill";
7092#endif /* FREECIV_JSON_CONNECTION */
7093 e = 0;
7094 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->aifill);
7095 if (e) {
7096 log_packet_detailed("'aifill' field error detected");
7097 }
7098 }
7099 if (BV_ISSET(fields, 2)) {
7100 log_packet_detailed(" field 'persistent_ready' has changed");
7101#ifdef FREECIV_JSON_CONNECTION
7102 field_addr.name = "persistent_ready";
7103#endif /* FREECIV_JSON_CONNECTION */
7104 e = 0;
7105 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->persistent_ready);
7106 if (e) {
7107 log_packet_detailed("'persistent_ready' field error detected");
7108 }
7109 }
7110 if (BV_ISSET(fields, 3)) {
7111 log_packet_detailed(" field 'airlifting_style' has changed");
7112#ifdef FREECIV_JSON_CONNECTION
7113 field_addr.name = "airlifting_style";
7114#endif /* FREECIV_JSON_CONNECTION */
7115 e = 0;
7116 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlifting_style);
7117 if (e) {
7118 log_packet_detailed("'airlifting_style' field error detected");
7119 }
7120 }
7121 /* field 4 is folded into the header */
7122 /* field 5 is folded into the header */
7123 if (BV_ISSET(fields, 6)) {
7124 log_packet_detailed(" field 'angrycitizen' has changed");
7125#ifdef FREECIV_JSON_CONNECTION
7126 field_addr.name = "angrycitizen";
7127#endif /* FREECIV_JSON_CONNECTION */
7128 e = 0;
7129 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->angrycitizen);
7130 if (e) {
7131 log_packet_detailed("'angrycitizen' field error detected");
7132 }
7133 }
7134 if (BV_ISSET(fields, 7)) {
7135 log_packet_detailed(" field 'base_pollution' has changed");
7136#ifdef FREECIV_JSON_CONNECTION
7137 field_addr.name = "base_pollution";
7138#endif /* FREECIV_JSON_CONNECTION */
7139 e = 0;
7140 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->base_pollution);
7141 if (e) {
7142 log_packet_detailed("'base_pollution' field error detected");
7143 }
7144 }
7145 if (BV_ISSET(fields, 8)) {
7146 log_packet_detailed(" field 'base_tech_cost' has changed");
7147#ifdef FREECIV_JSON_CONNECTION
7148 field_addr.name = "base_tech_cost";
7149#endif /* FREECIV_JSON_CONNECTION */
7150 e = 0;
7151 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->base_tech_cost);
7152 if (e) {
7153 log_packet_detailed("'base_tech_cost' field error detected");
7154 }
7155 }
7156 if (BV_ISSET(fields, 9)) {
7157 log_packet_detailed(" field 'min_tech_cost' has changed");
7158#ifdef FREECIV_JSON_CONNECTION
7159 field_addr.name = "min_tech_cost";
7160#endif /* FREECIV_JSON_CONNECTION */
7161 e = 0;
7162 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_tech_cost);
7163 if (e) {
7164 log_packet_detailed("'min_tech_cost' field error detected");
7165 }
7166 }
7167 if (BV_ISSET(fields, 10)) {
7168 log_packet_detailed(" field 'tech_leak_pct' has changed");
7169#ifdef FREECIV_JSON_CONNECTION
7170 field_addr.name = "tech_leak_pct";
7171#endif /* FREECIV_JSON_CONNECTION */
7172 e = 0;
7173 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leak_pct);
7174 if (e) {
7175 log_packet_detailed("'tech_leak_pct' field error detected");
7176 }
7177 }
7178 if (BV_ISSET(fields, 11)) {
7179 log_packet_detailed(" field 'border_city_radius_sq' has changed");
7180#ifdef FREECIV_JSON_CONNECTION
7181 field_addr.name = "border_city_radius_sq";
7182#endif /* FREECIV_JSON_CONNECTION */
7183 e = 0;
7184 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->border_city_radius_sq);
7185 if (e) {
7186 log_packet_detailed("'border_city_radius_sq' field error detected");
7187 }
7188 }
7189 if (BV_ISSET(fields, 12)) {
7190 log_packet_detailed(" field 'border_size_effect' has changed");
7191#ifdef FREECIV_JSON_CONNECTION
7192 field_addr.name = "border_size_effect";
7193#endif /* FREECIV_JSON_CONNECTION */
7194 e = 0;
7195 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->border_size_effect);
7196 if (e) {
7197 log_packet_detailed("'border_size_effect' field error detected");
7198 }
7199 }
7200 if (BV_ISSET(fields, 13)) {
7201 log_packet_detailed(" field 'border_city_permanent_radius_sq' has changed");
7202#ifdef FREECIV_JSON_CONNECTION
7203 field_addr.name = "border_city_permanent_radius_sq";
7204#endif /* FREECIV_JSON_CONNECTION */
7205 e = 0;
7206 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->border_city_permanent_radius_sq);
7207 if (e) {
7208 log_packet_detailed("'border_city_permanent_radius_sq' field error detected");
7209 }
7210 }
7211 if (BV_ISSET(fields, 14)) {
7212 log_packet_detailed(" field 'borders' has changed");
7213#ifdef FREECIV_JSON_CONNECTION
7214 field_addr.name = "borders";
7215#endif /* FREECIV_JSON_CONNECTION */
7216 e = 0;
7217 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->borders);
7218 if (e) {
7219 log_packet_detailed("'borders' field error detected");
7220 }
7221 }
7222 if (BV_ISSET(fields, 15)) {
7223 log_packet_detailed(" field 'base_bribe_cost' has changed");
7224#ifdef FREECIV_JSON_CONNECTION
7225 field_addr.name = "base_bribe_cost";
7226#endif /* FREECIV_JSON_CONNECTION */
7227 e = 0;
7228 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->base_bribe_cost);
7229 if (e) {
7230 log_packet_detailed("'base_bribe_cost' field error detected");
7231 }
7232 }
7233 if (BV_ISSET(fields, 16)) {
7234 log_packet_detailed(" field 'caravan_bonus_style' has changed");
7235#ifdef FREECIV_JSON_CONNECTION
7236 field_addr.name = "caravan_bonus_style";
7237#endif /* FREECIV_JSON_CONNECTION */
7238 e = 0;
7239 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->caravan_bonus_style);
7240 if (e) {
7241 log_packet_detailed("'caravan_bonus_style' field error detected");
7242 }
7243 }
7244 if (BV_ISSET(fields, 17)) {
7245 log_packet_detailed(" field 'culture_vic_points' has changed");
7246#ifdef FREECIV_JSON_CONNECTION
7247 field_addr.name = "culture_vic_points";
7248#endif /* FREECIV_JSON_CONNECTION */
7249 e = 0;
7250 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture_vic_points);
7251 if (e) {
7252 log_packet_detailed("'culture_vic_points' field error detected");
7253 }
7254 }
7255 if (BV_ISSET(fields, 18)) {
7256 log_packet_detailed(" field 'culture_vic_lead' has changed");
7257#ifdef FREECIV_JSON_CONNECTION
7258 field_addr.name = "culture_vic_lead";
7259#endif /* FREECIV_JSON_CONNECTION */
7260 e = 0;
7261 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_vic_lead);
7262 if (e) {
7263 log_packet_detailed("'culture_vic_lead' field error detected");
7264 }
7265 }
7266 if (BV_ISSET(fields, 19)) {
7267 log_packet_detailed(" field 'culture_migration_pml' has changed");
7268#ifdef FREECIV_JSON_CONNECTION
7269 field_addr.name = "culture_migration_pml";
7270#endif /* FREECIV_JSON_CONNECTION */
7271 e = 0;
7272 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_migration_pml);
7273 if (e) {
7274 log_packet_detailed("'culture_migration_pml' field error detected");
7275 }
7276 }
7277 if (BV_ISSET(fields, 20)) {
7278 log_packet_detailed(" field 'history_interest_pml' has changed");
7279#ifdef FREECIV_JSON_CONNECTION
7280 field_addr.name = "history_interest_pml";
7281#endif /* FREECIV_JSON_CONNECTION */
7282 e = 0;
7283 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->history_interest_pml);
7284 if (e) {
7285 log_packet_detailed("'history_interest_pml' field error detected");
7286 }
7287 }
7288 if (BV_ISSET(fields, 21)) {
7289 log_packet_detailed(" field 'celebratesize' has changed");
7290#ifdef FREECIV_JSON_CONNECTION
7291 field_addr.name = "celebratesize";
7292#endif /* FREECIV_JSON_CONNECTION */
7293 e = 0;
7294 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->celebratesize);
7295 if (e) {
7296 log_packet_detailed("'celebratesize' field error detected");
7297 }
7298 }
7299 /* field 22 is folded into the header */
7300 if (BV_ISSET(fields, 23)) {
7301 log_packet_detailed(" field 'pop_report_zeroes' has changed");
7302#ifdef FREECIV_JSON_CONNECTION
7303 field_addr.name = "pop_report_zeroes";
7304#endif /* FREECIV_JSON_CONNECTION */
7305 e = 0;
7306 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_report_zeroes);
7307 if (e) {
7308 log_packet_detailed("'pop_report_zeroes' field error detected");
7309 }
7310 }
7311 /* field 24 is folded into the header */
7312 /* field 25 is folded into the header */
7313 if (BV_ISSET(fields, 26)) {
7314 log_packet_detailed(" field 'citizen_convert_speed' has changed");
7315#ifdef FREECIV_JSON_CONNECTION
7316 field_addr.name = "citizen_convert_speed";
7317#endif /* FREECIV_JSON_CONNECTION */
7318 e = 0;
7319 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->citizen_convert_speed);
7320 if (e) {
7321 log_packet_detailed("'citizen_convert_speed' field error detected");
7322 }
7323 }
7324 if (BV_ISSET(fields, 27)) {
7325 log_packet_detailed(" field 'conquest_convert_pct' has changed");
7326#ifdef FREECIV_JSON_CONNECTION
7327 field_addr.name = "conquest_convert_pct";
7328#endif /* FREECIV_JSON_CONNECTION */
7329 e = 0;
7330 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->conquest_convert_pct);
7331 if (e) {
7332 log_packet_detailed("'conquest_convert_pct' field error detected");
7333 }
7334 }
7335 if (BV_ISSET(fields, 28)) {
7336 log_packet_detailed(" field 'citizen_partisans_pct' has changed");
7337#ifdef FREECIV_JSON_CONNECTION
7338 field_addr.name = "citizen_partisans_pct";
7339#endif /* FREECIV_JSON_CONNECTION */
7340 e = 0;
7341 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citizen_partisans_pct);
7342 if (e) {
7343 log_packet_detailed("'citizen_partisans_pct' field error detected");
7344 }
7345 }
7346 if (BV_ISSET(fields, 29)) {
7347 log_packet_detailed(" field 'citymindist' has changed");
7348#ifdef FREECIV_JSON_CONNECTION
7349 field_addr.name = "citymindist";
7350#endif /* FREECIV_JSON_CONNECTION */
7351 e = 0;
7352 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citymindist);
7353 if (e) {
7354 log_packet_detailed("'citymindist' field error detected");
7355 }
7356 }
7357 if (BV_ISSET(fields, 30)) {
7358 log_packet_detailed(" field 'cooling' has changed");
7359#ifdef FREECIV_JSON_CONNECTION
7360 field_addr.name = "cooling";
7361#endif /* FREECIV_JSON_CONNECTION */
7362 e = 0;
7363 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cooling);
7364 if (e) {
7365 log_packet_detailed("'cooling' field error detected");
7366 }
7367 }
7368 if (BV_ISSET(fields, 31)) {
7369 log_packet_detailed(" field 'coolinglevel' has changed");
7370#ifdef FREECIV_JSON_CONNECTION
7371 field_addr.name = "coolinglevel";
7372#endif /* FREECIV_JSON_CONNECTION */
7373 e = 0;
7374 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->coolinglevel);
7375 if (e) {
7376 log_packet_detailed("'coolinglevel' field error detected");
7377 }
7378 }
7379 if (BV_ISSET(fields, 32)) {
7380 log_packet_detailed(" field 'diplchance_initial_odds' has changed");
7381#ifdef FREECIV_JSON_CONNECTION
7382 field_addr.name = "diplchance_initial_odds";
7383#endif /* FREECIV_JSON_CONNECTION */
7384 e = 0;
7385 e |= DIO_BV_PUT(&dout, &field_addr, packet->diplchance_initial_odds);
7386 if (e) {
7387 log_packet_detailed("'diplchance_initial_odds' field error detected");
7388 }
7389 }
7390 if (BV_ISSET(fields, 33)) {
7391 log_packet_detailed(" field 'diplomacy' has changed");
7392#ifdef FREECIV_JSON_CONNECTION
7393 field_addr.name = "diplomacy";
7394#endif /* FREECIV_JSON_CONNECTION */
7395 e = 0;
7396 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->diplomacy);
7397 if (e) {
7398 log_packet_detailed("'diplomacy' field error detected");
7399 }
7400 }
7401 /* field 34 is folded into the header */
7402 if (BV_ISSET(fields, 35)) {
7403 log_packet_detailed(" field 'food_cost' has changed");
7404#ifdef FREECIV_JSON_CONNECTION
7405 field_addr.name = "food_cost";
7406#endif /* FREECIV_JSON_CONNECTION */
7407 e = 0;
7408 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_cost);
7409 if (e) {
7410 log_packet_detailed("'food_cost' field error detected");
7411 }
7412 }
7413 if (BV_ISSET(fields, 36)) {
7414 log_packet_detailed(" field 'foodbox' has changed");
7415#ifdef FREECIV_JSON_CONNECTION
7416 field_addr.name = "foodbox";
7417#endif /* FREECIV_JSON_CONNECTION */
7418 e = 0;
7419 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->foodbox);
7420 if (e) {
7421 log_packet_detailed("'foodbox' field error detected");
7422 }
7423 }
7424 if (BV_ISSET(fields, 37)) {
7425 log_packet_detailed(" field 'forced_gold' has changed");
7426#ifdef FREECIV_JSON_CONNECTION
7427 field_addr.name = "forced_gold";
7428#endif /* FREECIV_JSON_CONNECTION */
7429 e = 0;
7430 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_gold);
7431 if (e) {
7432 log_packet_detailed("'forced_gold' field error detected");
7433 }
7434 }
7435 if (BV_ISSET(fields, 38)) {
7436 log_packet_detailed(" field 'forced_luxury' has changed");
7437#ifdef FREECIV_JSON_CONNECTION
7438 field_addr.name = "forced_luxury";
7439#endif /* FREECIV_JSON_CONNECTION */
7440 e = 0;
7441 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_luxury);
7442 if (e) {
7443 log_packet_detailed("'forced_luxury' field error detected");
7444 }
7445 }
7446 if (BV_ISSET(fields, 39)) {
7447 log_packet_detailed(" field 'forced_science' has changed");
7448#ifdef FREECIV_JSON_CONNECTION
7449 field_addr.name = "forced_science";
7450#endif /* FREECIV_JSON_CONNECTION */
7451 e = 0;
7452 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_science);
7453 if (e) {
7454 log_packet_detailed("'forced_science' field error detected");
7455 }
7456 }
7457 if (BV_ISSET(fields, 40)) {
7458 log_packet_detailed(" field 'fulltradesize' has changed");
7459#ifdef FREECIV_JSON_CONNECTION
7460 field_addr.name = "fulltradesize";
7461#endif /* FREECIV_JSON_CONNECTION */
7462 e = 0;
7463 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fulltradesize);
7464 if (e) {
7465 log_packet_detailed("'fulltradesize' field error detected");
7466 }
7467 }
7468 if (BV_ISSET(fields, 41)) {
7469 log_packet_detailed(" field 'trade_world_rel_pct' has changed");
7470#ifdef FREECIV_JSON_CONNECTION
7471 field_addr.name = "trade_world_rel_pct";
7472#endif /* FREECIV_JSON_CONNECTION */
7473 e = 0;
7474 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_world_rel_pct);
7475 if (e) {
7476 log_packet_detailed("'trade_world_rel_pct' field error detected");
7477 }
7478 }
7479 if (BV_ISSET(fields, 42)) {
7480 log_packet_detailed(" field 'min_trade_route_val' has changed");
7481#ifdef FREECIV_JSON_CONNECTION
7482 field_addr.name = "min_trade_route_val";
7483#endif /* FREECIV_JSON_CONNECTION */
7484 e = 0;
7485 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_trade_route_val);
7486 if (e) {
7487 log_packet_detailed("'min_trade_route_val' field error detected");
7488 }
7489 }
7490 /* field 43 is folded into the header */
7491 if (BV_ISSET(fields, 44)) {
7492 log_packet_detailed(" field 'goods_selection' has changed");
7493#ifdef FREECIV_JSON_CONNECTION
7494 field_addr.name = "goods_selection";
7495#endif /* FREECIV_JSON_CONNECTION */
7496 e = 0;
7497 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods_selection);
7498 if (e) {
7499 log_packet_detailed("'goods_selection' field error detected");
7500 }
7501 }
7502 if (BV_ISSET(fields, 45)) {
7503 log_packet_detailed(" field 'global_advance_count' has changed");
7504#ifdef FREECIV_JSON_CONNECTION
7505 field_addr.name = "global_advance_count";
7506#endif /* FREECIV_JSON_CONNECTION */
7507 e = 0;
7508 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_advance_count);
7509 if (e) {
7510 log_packet_detailed("'global_advance_count' field error detected");
7511 }
7512 }
7513 if (BV_ISSET(fields, 46)) {
7514 log_packet_detailed(" field 'global_advances' has changed");
7515#ifdef FREECIV_JSON_CONNECTION
7516 field_addr.name = "global_advances";
7517#endif /* FREECIV_JSON_CONNECTION */
7518 e = 0;
7519 {
7520 int i;
7521
7522#ifdef FREECIV_JSON_CONNECTION
7523 size_t count_i = 0;
7524
7525 /* Create the array. */
7526 e |= DIO_PUT(farray, &dout, &field_addr, 0);
7527
7528 /* Enter array. */
7529 field_addr.sub_location = plocation_elem_new(0);
7530#endif /* FREECIV_JSON_CONNECTION */
7531
7532 fc_assert(A_LAST < MAX_UINT16);
7533
7534 for (i = 0; i < A_LAST; i++) {
7535 differ = (old->global_advances[i] != real_packet->global_advances[i]);
7536
7537 if (differ) {
7538#ifdef FREECIV_JSON_CONNECTION
7539 /* Append next diff array element. */
7540 field_addr.sub_location->number = -1;
7541
7542 /* Create the diff array element. */
7543 e |= DIO_PUT(farray, &dout, &field_addr, 2);
7544
7545 /* Enter diff array element (start at the index address). */
7546 field_addr.sub_location->number = count_i++;
7547 field_addr.sub_location->sub_location = plocation_elem_new(0);
7548#endif /* FREECIV_JSON_CONNECTION */
7549 e |= DIO_PUT(uint16, &dout, &field_addr, i);
7550
7551#ifdef FREECIV_JSON_CONNECTION
7552 /* Content address. */
7553 field_addr.sub_location->sub_location->number = 1;
7554#endif /* FREECIV_JSON_CONNECTION */
7555 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->global_advances[i]);
7556
7557#ifdef FREECIV_JSON_CONNECTION
7558 /* Exit diff array element. */
7559 FC_FREE(field_addr.sub_location->sub_location);
7560#endif /* FREECIV_JSON_CONNECTION */
7561 }
7562 }
7563#ifdef FREECIV_JSON_CONNECTION
7564 /* Append diff array element. */
7565 field_addr.sub_location->number = -1;
7566
7567 /* Create the terminating diff array element. */
7568 e |= DIO_PUT(farray, &dout, &field_addr, 1);
7569
7570 /* Enter diff array element (start at the index address). */
7571 field_addr.sub_location->number = count_i;
7572 field_addr.sub_location->sub_location = plocation_elem_new(0);
7573#endif /* FREECIV_JSON_CONNECTION */
7574 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
7575
7576#ifdef FREECIV_JSON_CONNECTION
7577 /* Exit diff array element. */
7578 FC_FREE(field_addr.sub_location->sub_location);
7579
7580 /* Exit array. */
7581 FC_FREE(field_addr.sub_location);
7582#endif /* FREECIV_JSON_CONNECTION */
7583 }
7584 if (e) {
7585 log_packet_detailed("'global_advances' field error detected");
7586 }
7587 }
7588 /* field 47 is folded into the header */
7589 if (BV_ISSET(fields, 48)) {
7590 log_packet_detailed(" field 'globalwarming' has changed");
7591#ifdef FREECIV_JSON_CONNECTION
7592 field_addr.name = "globalwarming";
7593#endif /* FREECIV_JSON_CONNECTION */
7594 e = 0;
7595 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->globalwarming);
7596 if (e) {
7597 log_packet_detailed("'globalwarming' field error detected");
7598 }
7599 }
7600 if (BV_ISSET(fields, 49)) {
7601 log_packet_detailed(" field 'gold' has changed");
7602#ifdef FREECIV_JSON_CONNECTION
7603 field_addr.name = "gold";
7604#endif /* FREECIV_JSON_CONNECTION */
7605 e = 0;
7606 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
7607 if (e) {
7608 log_packet_detailed("'gold' field error detected");
7609 }
7610 }
7611 if (BV_ISSET(fields, 50)) {
7612 log_packet_detailed(" field 'gold_upkeep_style' has changed");
7613#ifdef FREECIV_JSON_CONNECTION
7614 field_addr.name = "gold_upkeep_style";
7615#endif /* FREECIV_JSON_CONNECTION */
7616 e = 0;
7617 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gold_upkeep_style);
7618 if (e) {
7619 log_packet_detailed("'gold_upkeep_style' field error detected");
7620 }
7621 }
7622 /* field 51 is folded into the header */
7623 if (BV_ISSET(fields, 52)) {
7624 log_packet_detailed(" field 'infrapoints' has changed");
7625#ifdef FREECIV_JSON_CONNECTION
7626 field_addr.name = "infrapoints";
7627#endif /* FREECIV_JSON_CONNECTION */
7628 e = 0;
7629 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
7630 if (e) {
7631 log_packet_detailed("'infrapoints' field error detected");
7632 }
7633 }
7634 if (BV_ISSET(fields, 53)) {
7635 log_packet_detailed(" field 'revolentype' has changed");
7636#ifdef FREECIV_JSON_CONNECTION
7637 field_addr.name = "revolentype";
7638#endif /* FREECIV_JSON_CONNECTION */
7639 e = 0;
7640 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->revolentype);
7641 if (e) {
7642 log_packet_detailed("'revolentype' field error detected");
7643 }
7644 }
7645 if (BV_ISSET(fields, 54)) {
7646 log_packet_detailed(" field 'default_government_id' has changed");
7647#ifdef FREECIV_JSON_CONNECTION
7648 field_addr.name = "default_government_id";
7649#endif /* FREECIV_JSON_CONNECTION */
7650 e = 0;
7651 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_government_id);
7652 if (e) {
7653 log_packet_detailed("'default_government_id' field error detected");
7654 }
7655 }
7656 if (BV_ISSET(fields, 55)) {
7657 log_packet_detailed(" field 'government_during_revolution_id' has changed");
7658#ifdef FREECIV_JSON_CONNECTION
7659 field_addr.name = "government_during_revolution_id";
7660#endif /* FREECIV_JSON_CONNECTION */
7661 e = 0;
7662 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government_during_revolution_id);
7663 if (e) {
7664 log_packet_detailed("'government_during_revolution_id' field error detected");
7665 }
7666 }
7667 if (BV_ISSET(fields, 56)) {
7668 log_packet_detailed(" field 'granary_food_inc' has changed");
7669#ifdef FREECIV_JSON_CONNECTION
7670 field_addr.name = "granary_food_inc";
7671#endif /* FREECIV_JSON_CONNECTION */
7672 e = 0;
7673 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_inc);
7674 if (e) {
7675 log_packet_detailed("'granary_food_inc' field error detected");
7676 }
7677 }
7678 if (BV_ISSET(fields, 57)) {
7679 log_packet_detailed(" field 'granary_food_ini' has changed");
7680#ifdef FREECIV_JSON_CONNECTION
7681 field_addr.name = "granary_food_ini";
7682#endif /* FREECIV_JSON_CONNECTION */
7683 e = 0;
7684 {
7685 int i;
7686
7687#ifdef FREECIV_JSON_CONNECTION
7688 /* Create the array. */
7689 e |= DIO_PUT(farray, &dout, &field_addr, MAX_GRANARY_INIS);
7690
7691 /* Enter the array. */
7692 field_addr.sub_location = plocation_elem_new(0);
7693#endif /* FREECIV_JSON_CONNECTION */
7694
7695 for (i = 0; i < MAX_GRANARY_INIS; i++) {
7696#ifdef FREECIV_JSON_CONNECTION
7697 /* Next array element. */
7698 field_addr.sub_location->number = i;
7699#endif /* FREECIV_JSON_CONNECTION */
7700 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_ini[i]);
7701 }
7702
7703#ifdef FREECIV_JSON_CONNECTION
7704 /* Exit array. */
7705 FC_FREE(field_addr.sub_location);
7706#endif /* FREECIV_JSON_CONNECTION */
7707 }
7708 if (e) {
7709 log_packet_detailed("'granary_food_ini' field error detected");
7710 }
7711 }
7712 if (BV_ISSET(fields, 58)) {
7713 log_packet_detailed(" field 'granary_num_inis' has changed");
7714#ifdef FREECIV_JSON_CONNECTION
7715 field_addr.name = "granary_num_inis";
7716#endif /* FREECIV_JSON_CONNECTION */
7717 e = 0;
7718 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->granary_num_inis);
7719 if (e) {
7720 log_packet_detailed("'granary_num_inis' field error detected");
7721 }
7722 }
7723 if (BV_ISSET(fields, 59)) {
7724 log_packet_detailed(" field 'great_wonder_owners' has changed");
7725#ifdef FREECIV_JSON_CONNECTION
7726 field_addr.name = "great_wonder_owners";
7727#endif /* FREECIV_JSON_CONNECTION */
7728 e = 0;
7729 {
7730 int i;
7731
7732#ifdef FREECIV_JSON_CONNECTION
7733 size_t count_i = 0;
7734
7735 /* Create the array. */
7736 e |= DIO_PUT(farray, &dout, &field_addr, 0);
7737
7738 /* Enter array. */
7739 field_addr.sub_location = plocation_elem_new(0);
7740#endif /* FREECIV_JSON_CONNECTION */
7741
7742 fc_assert(B_LAST < MAX_UINT16);
7743
7744 for (i = 0; i < B_LAST; i++) {
7745 differ = (old->great_wonder_owners[i] != real_packet->great_wonder_owners[i]);
7746
7747 if (differ) {
7748#ifdef FREECIV_JSON_CONNECTION
7749 /* Append next diff array element. */
7750 field_addr.sub_location->number = -1;
7751
7752 /* Create the diff array element. */
7753 e |= DIO_PUT(farray, &dout, &field_addr, 2);
7754
7755 /* Enter diff array element (start at the index address). */
7756 field_addr.sub_location->number = count_i++;
7757 field_addr.sub_location->sub_location = plocation_elem_new(0);
7758#endif /* FREECIV_JSON_CONNECTION */
7759 e |= DIO_PUT(uint16, &dout, &field_addr, i);
7760
7761#ifdef FREECIV_JSON_CONNECTION
7762 /* Content address. */
7763 field_addr.sub_location->sub_location->number = 1;
7764#endif /* FREECIV_JSON_CONNECTION */
7765 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->great_wonder_owners[i]);
7766
7767#ifdef FREECIV_JSON_CONNECTION
7768 /* Exit diff array element. */
7769 FC_FREE(field_addr.sub_location->sub_location);
7770#endif /* FREECIV_JSON_CONNECTION */
7771 }
7772 }
7773#ifdef FREECIV_JSON_CONNECTION
7774 /* Append diff array element. */
7775 field_addr.sub_location->number = -1;
7776
7777 /* Create the terminating diff array element. */
7778 e |= DIO_PUT(farray, &dout, &field_addr, 1);
7779
7780 /* Enter diff array element (start at the index address). */
7781 field_addr.sub_location->number = count_i;
7782 field_addr.sub_location->sub_location = plocation_elem_new(0);
7783#endif /* FREECIV_JSON_CONNECTION */
7784 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
7785
7786#ifdef FREECIV_JSON_CONNECTION
7787 /* Exit diff array element. */
7788 FC_FREE(field_addr.sub_location->sub_location);
7789
7790 /* Exit array. */
7791 FC_FREE(field_addr.sub_location);
7792#endif /* FREECIV_JSON_CONNECTION */
7793 }
7794 if (e) {
7795 log_packet_detailed("'great_wonder_owners' field error detected");
7796 }
7797 }
7798 if (BV_ISSET(fields, 60)) {
7799 log_packet_detailed(" field 'happy_cost' has changed");
7800#ifdef FREECIV_JSON_CONNECTION
7801 field_addr.name = "happy_cost";
7802#endif /* FREECIV_JSON_CONNECTION */
7803 e = 0;
7804 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->happy_cost);
7805 if (e) {
7806 log_packet_detailed("'happy_cost' field error detected");
7807 }
7808 }
7809 if (BV_ISSET(fields, 61)) {
7810 log_packet_detailed(" field 'happyborders' has changed");
7811#ifdef FREECIV_JSON_CONNECTION
7812 field_addr.name = "happyborders";
7813#endif /* FREECIV_JSON_CONNECTION */
7814 e = 0;
7815 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happyborders);
7816 if (e) {
7817 log_packet_detailed("'happyborders' field error detected");
7818 }
7819 }
7820 if (BV_ISSET(fields, 62)) {
7821 log_packet_detailed(" field 'heating' has changed");
7822#ifdef FREECIV_JSON_CONNECTION
7823 field_addr.name = "heating";
7824#endif /* FREECIV_JSON_CONNECTION */
7825 e = 0;
7826 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->heating);
7827 if (e) {
7828 log_packet_detailed("'heating' field error detected");
7829 }
7830 }
7831 if (BV_ISSET(fields, 63)) {
7832 log_packet_detailed(" field 'illness_base_factor' has changed");
7833#ifdef FREECIV_JSON_CONNECTION
7834 field_addr.name = "illness_base_factor";
7835#endif /* FREECIV_JSON_CONNECTION */
7836 e = 0;
7837 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_base_factor);
7838 if (e) {
7839 log_packet_detailed("'illness_base_factor' field error detected");
7840 }
7841 }
7842 if (BV_ISSET(fields, 64)) {
7843 log_packet_detailed(" field 'illness_min_size' has changed");
7844#ifdef FREECIV_JSON_CONNECTION
7845 field_addr.name = "illness_min_size";
7846#endif /* FREECIV_JSON_CONNECTION */
7847 e = 0;
7848 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->illness_min_size);
7849 if (e) {
7850 log_packet_detailed("'illness_min_size' field error detected");
7851 }
7852 }
7853 /* field 65 is folded into the header */
7854 if (BV_ISSET(fields, 66)) {
7855 log_packet_detailed(" field 'illness_pollution_factor' has changed");
7856#ifdef FREECIV_JSON_CONNECTION
7857 field_addr.name = "illness_pollution_factor";
7858#endif /* FREECIV_JSON_CONNECTION */
7859 e = 0;
7860 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_pollution_factor);
7861 if (e) {
7862 log_packet_detailed("'illness_pollution_factor' field error detected");
7863 }
7864 }
7865 if (BV_ISSET(fields, 67)) {
7866 log_packet_detailed(" field 'illness_trade_infection' has changed");
7867#ifdef FREECIV_JSON_CONNECTION
7868 field_addr.name = "illness_trade_infection";
7869#endif /* FREECIV_JSON_CONNECTION */
7870 e = 0;
7871 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade_infection);
7872 if (e) {
7873 log_packet_detailed("'illness_trade_infection' field error detected");
7874 }
7875 }
7876 if (BV_ISSET(fields, 68)) {
7877 log_packet_detailed(" field 'init_city_radius_sq' has changed");
7878#ifdef FREECIV_JSON_CONNECTION
7879 field_addr.name = "init_city_radius_sq";
7880#endif /* FREECIV_JSON_CONNECTION */
7881 e = 0;
7882 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_city_radius_sq);
7883 if (e) {
7884 log_packet_detailed("'init_city_radius_sq' field error detected");
7885 }
7886 }
7887 /* field 69 is folded into the header */
7888 /* field 70 is folded into the header */
7889 /* field 71 is folded into the header */
7890 /* field 72 is folded into the header */
7891 /* field 73 is folded into the header */
7892 /* field 74 is folded into the header */
7893 /* field 75 is folded into the header */
7894 /* field 76 is folded into the header */
7895 if (BV_ISSET(fields, 77)) {
7896 log_packet_detailed(" field 'low_firepower_badwallattacker' has changed");
7897#ifdef FREECIV_JSON_CONNECTION
7898 field_addr.name = "low_firepower_badwallattacker";
7899#endif /* FREECIV_JSON_CONNECTION */
7900 e = 0;
7901 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_badwallattacker);
7902 if (e) {
7903 log_packet_detailed("'low_firepower_badwallattacker' field error detected");
7904 }
7905 }
7906 if (BV_ISSET(fields, 78)) {
7907 log_packet_detailed(" field 'low_firepower_pearl_harbour' has changed");
7908#ifdef FREECIV_JSON_CONNECTION
7909 field_addr.name = "low_firepower_pearl_harbour";
7910#endif /* FREECIV_JSON_CONNECTION */
7911 e = 0;
7912 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_pearl_harbour);
7913 if (e) {
7914 log_packet_detailed("'low_firepower_pearl_harbour' field error detected");
7915 }
7916 }
7917 if (BV_ISSET(fields, 79)) {
7918 log_packet_detailed(" field 'low_firepower_combat_bonus' has changed");
7919#ifdef FREECIV_JSON_CONNECTION
7920 field_addr.name = "low_firepower_combat_bonus";
7921#endif /* FREECIV_JSON_CONNECTION */
7922 e = 0;
7923 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_combat_bonus);
7924 if (e) {
7925 log_packet_detailed("'low_firepower_combat_bonus' field error detected");
7926 }
7927 }
7928 if (BV_ISSET(fields, 80)) {
7929 log_packet_detailed(" field 'low_firepower_nonnat_bombard' has changed");
7930#ifdef FREECIV_JSON_CONNECTION
7931 field_addr.name = "low_firepower_nonnat_bombard";
7932#endif /* FREECIV_JSON_CONNECTION */
7933 e = 0;
7934 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_nonnat_bombard);
7935 if (e) {
7936 log_packet_detailed("'low_firepower_nonnat_bombard' field error detected");
7937 }
7938 }
7939 if (BV_ISSET(fields, 81)) {
7940 log_packet_detailed(" field 'nuke_pop_loss_pct' has changed");
7941#ifdef FREECIV_JSON_CONNECTION
7942 field_addr.name = "nuke_pop_loss_pct";
7943#endif /* FREECIV_JSON_CONNECTION */
7944 e = 0;
7945 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_pop_loss_pct);
7946 if (e) {
7947 log_packet_detailed("'nuke_pop_loss_pct' field error detected");
7948 }
7949 }
7950 if (BV_ISSET(fields, 82)) {
7951 log_packet_detailed(" field 'nuke_defender_survival_chance_pct' has changed");
7952#ifdef FREECIV_JSON_CONNECTION
7953 field_addr.name = "nuke_defender_survival_chance_pct";
7954#endif /* FREECIV_JSON_CONNECTION */
7955 e = 0;
7956 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_defender_survival_chance_pct);
7957 if (e) {
7958 log_packet_detailed("'nuke_defender_survival_chance_pct' field error detected");
7959 }
7960 }
7961 if (BV_ISSET(fields, 83)) {
7962 log_packet_detailed(" field 'min_city_center_output' has changed");
7963#ifdef FREECIV_JSON_CONNECTION
7964 field_addr.name = "min_city_center_output";
7965#endif /* FREECIV_JSON_CONNECTION */
7966 e = 0;
7967 {
7968 int i;
7969
7970#ifdef FREECIV_JSON_CONNECTION
7971 /* Create the array. */
7972 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
7973
7974 /* Enter the array. */
7975 field_addr.sub_location = plocation_elem_new(0);
7976#endif /* FREECIV_JSON_CONNECTION */
7977
7978 for (i = 0; i < O_LAST; i++) {
7979#ifdef FREECIV_JSON_CONNECTION
7980 /* Next array element. */
7981 field_addr.sub_location->number = i;
7982#endif /* FREECIV_JSON_CONNECTION */
7983 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_city_center_output[i]);
7984 }
7985
7986#ifdef FREECIV_JSON_CONNECTION
7987 /* Exit array. */
7988 FC_FREE(field_addr.sub_location);
7989#endif /* FREECIV_JSON_CONNECTION */
7990 }
7991 if (e) {
7992 log_packet_detailed("'min_city_center_output' field error detected");
7993 }
7994 }
7995 /* field 84 is folded into the header */
7996 /* field 85 is folded into the header */
7997 /* field 86 is folded into the header */
7998 if (BV_ISSET(fields, 87)) {
7999 log_packet_detailed(" field 'notradesize' has changed");
8000#ifdef FREECIV_JSON_CONNECTION
8001 field_addr.name = "notradesize";
8002#endif /* FREECIV_JSON_CONNECTION */
8003 e = 0;
8004 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->notradesize);
8005 if (e) {
8006 log_packet_detailed("'notradesize' field error detected");
8007 }
8008 }
8009 /* field 88 is folded into the header */
8010 if (BV_ISSET(fields, 89)) {
8011 log_packet_detailed(" field 'nuclearwinter' has changed");
8012#ifdef FREECIV_JSON_CONNECTION
8013 field_addr.name = "nuclearwinter";
8014#endif /* FREECIV_JSON_CONNECTION */
8015 e = 0;
8016 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->nuclearwinter);
8017 if (e) {
8018 log_packet_detailed("'nuclearwinter' field error detected");
8019 }
8020 }
8021 if (BV_ISSET(fields, 90)) {
8022 log_packet_detailed(" field 'phase' has changed");
8023#ifdef FREECIV_JSON_CONNECTION
8024 field_addr.name = "phase";
8025#endif /* FREECIV_JSON_CONNECTION */
8026 e = 0;
8027 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
8028 if (e) {
8029 log_packet_detailed("'phase' field error detected");
8030 }
8031 }
8032 if (BV_ISSET(fields, 91)) {
8033 log_packet_detailed(" field 'phase_mode' has changed");
8034#ifdef FREECIV_JSON_CONNECTION
8035 field_addr.name = "phase_mode";
8036#endif /* FREECIV_JSON_CONNECTION */
8037 e = 0;
8038 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->phase_mode);
8039 if (e) {
8040 log_packet_detailed("'phase_mode' field error detected");
8041 }
8042 }
8043 /* field 92 is folded into the header */
8044 /* field 93 is folded into the header */
8045 /* field 94 is folded into the header */
8046 /* field 95 is folded into the header */
8047 /* field 96 is folded into the header */
8048 /* field 97 is folded into the header */
8049 /* field 98 is folded into the header */
8050 /* field 99 is folded into the header */
8051 if (BV_ISSET(fields, 100)) {
8052 log_packet_detailed(" field 'rapturedelay' has changed");
8053#ifdef FREECIV_JSON_CONNECTION
8054 field_addr.name = "rapturedelay";
8055#endif /* FREECIV_JSON_CONNECTION */
8056 e = 0;
8057 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapturedelay);
8058 if (e) {
8059 log_packet_detailed("'rapturedelay' field error detected");
8060 }
8061 }
8062 if (BV_ISSET(fields, 101)) {
8063 log_packet_detailed(" field 'disasters' has changed");
8064#ifdef FREECIV_JSON_CONNECTION
8065 field_addr.name = "disasters";
8066#endif /* FREECIV_JSON_CONNECTION */
8067 e = 0;
8068 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disasters);
8069 if (e) {
8070 log_packet_detailed("'disasters' field error detected");
8071 }
8072 }
8073 /* field 102 is folded into the header */
8074 /* field 103 is folded into the header */
8075 if (BV_ISSET(fields, 104)) {
8076 log_packet_detailed(" field 'sciencebox' has changed");
8077#ifdef FREECIV_JSON_CONNECTION
8078 field_addr.name = "sciencebox";
8079#endif /* FREECIV_JSON_CONNECTION */
8080 e = 0;
8081 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->sciencebox);
8082 if (e) {
8083 log_packet_detailed("'sciencebox' field error detected");
8084 }
8085 }
8086 if (BV_ISSET(fields, 105)) {
8087 log_packet_detailed(" field 'shieldbox' has changed");
8088#ifdef FREECIV_JSON_CONNECTION
8089 field_addr.name = "shieldbox";
8090#endif /* FREECIV_JSON_CONNECTION */
8091 e = 0;
8092 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->shieldbox);
8093 if (e) {
8094 log_packet_detailed("'shieldbox' field error detected");
8095 }
8096 }
8097 if (BV_ISSET(fields, 106)) {
8098 log_packet_detailed(" field 'skill_level' has changed");
8099#ifdef FREECIV_JSON_CONNECTION
8100 field_addr.name = "skill_level";
8101#endif /* FREECIV_JSON_CONNECTION */
8102 e = 0;
8103 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->skill_level);
8104 if (e) {
8105 log_packet_detailed("'skill_level' field error detected");
8106 }
8107 }
8108 if (BV_ISSET(fields, 107)) {
8109 log_packet_detailed(" field 'victory_conditions' has changed");
8110#ifdef FREECIV_JSON_CONNECTION
8111 field_addr.name = "victory_conditions";
8112#endif /* FREECIV_JSON_CONNECTION */
8113 e = 0;
8114 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->victory_conditions);
8115 if (e) {
8116 log_packet_detailed("'victory_conditions' field error detected");
8117 }
8118 }
8119 /* field 108 is folded into the header */
8120 if (BV_ISSET(fields, 109)) {
8121 log_packet_detailed(" field 'tech' has changed");
8122#ifdef FREECIV_JSON_CONNECTION
8123 field_addr.name = "tech";
8124#endif /* FREECIV_JSON_CONNECTION */
8125 e = 0;
8126 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->tech);
8127 if (e) {
8128 log_packet_detailed("'tech' field error detected");
8129 }
8130 }
8131 if (BV_ISSET(fields, 110)) {
8132 log_packet_detailed(" field 'tech_cost_style' has changed");
8133#ifdef FREECIV_JSON_CONNECTION
8134 field_addr.name = "tech_cost_style";
8135#endif /* FREECIV_JSON_CONNECTION */
8136 e = 0;
8137 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_cost_style);
8138 if (e) {
8139 log_packet_detailed("'tech_cost_style' field error detected");
8140 }
8141 }
8142 if (BV_ISSET(fields, 111)) {
8143 log_packet_detailed(" field 'tech_leakage' has changed");
8144#ifdef FREECIV_JSON_CONNECTION
8145 field_addr.name = "tech_leakage";
8146#endif /* FREECIV_JSON_CONNECTION */
8147 e = 0;
8148 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leakage);
8149 if (e) {
8150 log_packet_detailed("'tech_leakage' field error detected");
8151 }
8152 }
8153 if (BV_ISSET(fields, 112)) {
8154 log_packet_detailed(" field 'tech_upkeep_divider' has changed");
8155#ifdef FREECIV_JSON_CONNECTION
8156 field_addr.name = "tech_upkeep_divider";
8157#endif /* FREECIV_JSON_CONNECTION */
8158 e = 0;
8159 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep_divider);
8160 if (e) {
8161 log_packet_detailed("'tech_upkeep_divider' field error detected");
8162 }
8163 }
8164 if (BV_ISSET(fields, 113)) {
8165 log_packet_detailed(" field 'tech_upkeep_style' has changed");
8166#ifdef FREECIV_JSON_CONNECTION
8167 field_addr.name = "tech_upkeep_style";
8168#endif /* FREECIV_JSON_CONNECTION */
8169 e = 0;
8170 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_upkeep_style);
8171 if (e) {
8172 log_packet_detailed("'tech_upkeep_style' field error detected");
8173 }
8174 }
8175 if (BV_ISSET(fields, 114)) {
8176 log_packet_detailed(" field 'techloss_forgiveness' has changed");
8177#ifdef FREECIV_JSON_CONNECTION
8178 field_addr.name = "techloss_forgiveness";
8179#endif /* FREECIV_JSON_CONNECTION */
8180 e = 0;
8181 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->techloss_forgiveness);
8182 if (e) {
8183 log_packet_detailed("'techloss_forgiveness' field error detected");
8184 }
8185 }
8186 if (BV_ISSET(fields, 115)) {
8187 log_packet_detailed(" field 'free_tech_method' has changed");
8188#ifdef FREECIV_JSON_CONNECTION
8189 field_addr.name = "free_tech_method";
8190#endif /* FREECIV_JSON_CONNECTION */
8191 e = 0;
8192 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->free_tech_method);
8193 if (e) {
8194 log_packet_detailed("'free_tech_method' field error detected");
8195 }
8196 }
8197 if (BV_ISSET(fields, 116)) {
8198 log_packet_detailed(" field 'gameloss_style' has changed");
8199#ifdef FREECIV_JSON_CONNECTION
8200 field_addr.name = "gameloss_style";
8201#endif /* FREECIV_JSON_CONNECTION */
8202 e = 0;
8203 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gameloss_style);
8204 if (e) {
8205 log_packet_detailed("'gameloss_style' field error detected");
8206 }
8207 }
8208 if (BV_ISSET(fields, 117)) {
8209 log_packet_detailed(" field 'timeout' has changed");
8210#ifdef FREECIV_JSON_CONNECTION
8211 field_addr.name = "timeout";
8212#endif /* FREECIV_JSON_CONNECTION */
8213 e = 0;
8214 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->timeout);
8215 if (e) {
8216 log_packet_detailed("'timeout' field error detected");
8217 }
8218 }
8219 if (BV_ISSET(fields, 118)) {
8220 log_packet_detailed(" field 'first_timeout' has changed");
8221#ifdef FREECIV_JSON_CONNECTION
8222 field_addr.name = "first_timeout";
8223#endif /* FREECIV_JSON_CONNECTION */
8224 e = 0;
8225 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->first_timeout);
8226 if (e) {
8227 log_packet_detailed("'first_timeout' field error detected");
8228 }
8229 }
8230 /* field 119 is folded into the header */
8231 if (BV_ISSET(fields, 120)) {
8232 log_packet_detailed(" field 'trademindist' has changed");
8233#ifdef FREECIV_JSON_CONNECTION
8234 field_addr.name = "trademindist";
8235#endif /* FREECIV_JSON_CONNECTION */
8236 e = 0;
8237 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trademindist);
8238 if (e) {
8239 log_packet_detailed("'trademindist' field error detected");
8240 }
8241 }
8242 if (BV_ISSET(fields, 121)) {
8243 log_packet_detailed(" field 'trade_revenue_style' has changed");
8244#ifdef FREECIV_JSON_CONNECTION
8245 field_addr.name = "trade_revenue_style";
8246#endif /* FREECIV_JSON_CONNECTION */
8247 e = 0;
8248 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_revenue_style);
8249 if (e) {
8250 log_packet_detailed("'trade_revenue_style' field error detected");
8251 }
8252 }
8253 /* field 122 is folded into the header */
8254 /* field 123 is folded into the header */
8255 /* field 124 is folded into the header */
8256 if (BV_ISSET(fields, 125)) {
8257 log_packet_detailed(" field 'turn' has changed");
8258#ifdef FREECIV_JSON_CONNECTION
8259 field_addr.name = "turn";
8260#endif /* FREECIV_JSON_CONNECTION */
8261 e = 0;
8262 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
8263 if (e) {
8264 log_packet_detailed("'turn' field error detected");
8265 }
8266 }
8267 if (BV_ISSET(fields, 126)) {
8268 log_packet_detailed(" field 'warminglevel' has changed");
8269#ifdef FREECIV_JSON_CONNECTION
8270 field_addr.name = "warminglevel";
8271#endif /* FREECIV_JSON_CONNECTION */
8272 e = 0;
8273 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->warminglevel);
8274 if (e) {
8275 log_packet_detailed("'warminglevel' field error detected");
8276 }
8277 }
8278 if (BV_ISSET(fields, 127)) {
8279 log_packet_detailed(" field 'year' has changed");
8280#ifdef FREECIV_JSON_CONNECTION
8281 field_addr.name = "year";
8282#endif /* FREECIV_JSON_CONNECTION */
8283 e = 0;
8284 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
8285 if (e) {
8286 log_packet_detailed("'year' field error detected");
8287 }
8288 }
8289 /* field 128 is folded into the header */
8290 if (BV_ISSET(fields, 129)) {
8291 log_packet_detailed(" field 'top_cities_count' has changed");
8292#ifdef FREECIV_JSON_CONNECTION
8293 field_addr.name = "top_cities_count";
8294#endif /* FREECIV_JSON_CONNECTION */
8295 e = 0;
8296 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->top_cities_count);
8297 if (e) {
8298 log_packet_detailed("'top_cities_count' field error detected");
8299 }
8300 }
8301 if (BV_ISSET(fields, 130)) {
8302 log_packet_detailed(" field 'fragment_count' has changed");
8303#ifdef FREECIV_JSON_CONNECTION
8304 field_addr.name = "fragment_count";
8305#endif /* FREECIV_JSON_CONNECTION */
8306 e = 0;
8307 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragment_count);
8308 if (e) {
8309 log_packet_detailed("'fragment_count' field error detected");
8310 }
8311 }
8312 /* field 131 is folded into the header */
8313 if (BV_ISSET(fields, 132)) {
8314 log_packet_detailed(" field 'civil_war_bonus_celebrating' has changed");
8315#ifdef FREECIV_JSON_CONNECTION
8316 field_addr.name = "civil_war_bonus_celebrating";
8317#endif /* FREECIV_JSON_CONNECTION */
8318 e = 0;
8319 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_celebrating);
8320 if (e) {
8321 log_packet_detailed("'civil_war_bonus_celebrating' field error detected");
8322 }
8323 }
8324 if (BV_ISSET(fields, 133)) {
8325 log_packet_detailed(" field 'civil_war_bonus_unhappy' has changed");
8326#ifdef FREECIV_JSON_CONNECTION
8327 field_addr.name = "civil_war_bonus_unhappy";
8328#endif /* FREECIV_JSON_CONNECTION */
8329 e = 0;
8330 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_unhappy);
8331 if (e) {
8332 log_packet_detailed("'civil_war_bonus_unhappy' field error detected");
8333 }
8334 }
8335 if (BV_ISSET(fields, 134)) {
8336 log_packet_detailed(" field 'granularity' has changed");
8337#ifdef FREECIV_JSON_CONNECTION
8338 field_addr.name = "granularity";
8339#endif /* FREECIV_JSON_CONNECTION */
8340 e = 0;
8341 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granularity);
8342 if (e) {
8343 log_packet_detailed("'granularity' field error detected");
8344 }
8345 }
8346 if (BV_ISSET(fields, 135)) {
8347 log_packet_detailed(" field 'small_wonder_visibility' has changed");
8348#ifdef FREECIV_JSON_CONNECTION
8349 field_addr.name = "small_wonder_visibility";
8350#endif /* FREECIV_JSON_CONNECTION */
8351 e = 0;
8352 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->small_wonder_visibility);
8353 if (e) {
8354 log_packet_detailed("'small_wonder_visibility' field error detected");
8355 }
8356 }
8357
8358 *old = *real_packet;
8359#endif /* FREECIV_DELTA_PROTOCOL */
8360#ifndef FREECIV_DELTA_PROTOCOL
8361#ifdef FREECIV_JSON_CONNECTION
8362 field_addr.name = "add_to_size_limit";
8363#endif /* FREECIV_JSON_CONNECTION */
8364 e = 0;
8365 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->add_to_size_limit);
8366 if (e) {
8367 log_packet_detailed("'add_to_size_limit' field error detected");
8368 }
8369#ifdef FREECIV_JSON_CONNECTION
8370 field_addr.name = "aifill";
8371#endif /* FREECIV_JSON_CONNECTION */
8372 e = 0;
8373 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->aifill);
8374 if (e) {
8375 log_packet_detailed("'aifill' field error detected");
8376 }
8377#ifdef FREECIV_JSON_CONNECTION
8378 field_addr.name = "persistent_ready";
8379#endif /* FREECIV_JSON_CONNECTION */
8380 e = 0;
8381 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->persistent_ready);
8382 if (e) {
8383 log_packet_detailed("'persistent_ready' field error detected");
8384 }
8385#ifdef FREECIV_JSON_CONNECTION
8386 field_addr.name = "airlifting_style";
8387#endif /* FREECIV_JSON_CONNECTION */
8388 e = 0;
8389 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlifting_style);
8390 if (e) {
8391 log_packet_detailed("'airlifting_style' field error detected");
8392 }
8393#ifdef FREECIV_JSON_CONNECTION
8394 field_addr.name = "airlift_from_always_enabled";
8395#endif /* FREECIV_JSON_CONNECTION */
8396 e = 0;
8397 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift_from_always_enabled);
8398 if (e) {
8399 log_packet_detailed("'airlift_from_always_enabled' field error detected");
8400 }
8401#ifdef FREECIV_JSON_CONNECTION
8402 field_addr.name = "airlift_to_always_enabled";
8403#endif /* FREECIV_JSON_CONNECTION */
8404 e = 0;
8405 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift_to_always_enabled);
8406 if (e) {
8407 log_packet_detailed("'airlift_to_always_enabled' field error detected");
8408 }
8409#ifdef FREECIV_JSON_CONNECTION
8410 field_addr.name = "angrycitizen";
8411#endif /* FREECIV_JSON_CONNECTION */
8412 e = 0;
8413 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->angrycitizen);
8414 if (e) {
8415 log_packet_detailed("'angrycitizen' field error detected");
8416 }
8417#ifdef FREECIV_JSON_CONNECTION
8418 field_addr.name = "base_pollution";
8419#endif /* FREECIV_JSON_CONNECTION */
8420 e = 0;
8421 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->base_pollution);
8422 if (e) {
8423 log_packet_detailed("'base_pollution' field error detected");
8424 }
8425#ifdef FREECIV_JSON_CONNECTION
8426 field_addr.name = "base_tech_cost";
8427#endif /* FREECIV_JSON_CONNECTION */
8428 e = 0;
8429 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->base_tech_cost);
8430 if (e) {
8431 log_packet_detailed("'base_tech_cost' field error detected");
8432 }
8433#ifdef FREECIV_JSON_CONNECTION
8434 field_addr.name = "min_tech_cost";
8435#endif /* FREECIV_JSON_CONNECTION */
8436 e = 0;
8437 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_tech_cost);
8438 if (e) {
8439 log_packet_detailed("'min_tech_cost' field error detected");
8440 }
8441#ifdef FREECIV_JSON_CONNECTION
8442 field_addr.name = "tech_leak_pct";
8443#endif /* FREECIV_JSON_CONNECTION */
8444 e = 0;
8445 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leak_pct);
8446 if (e) {
8447 log_packet_detailed("'tech_leak_pct' field error detected");
8448 }
8449#ifdef FREECIV_JSON_CONNECTION
8450 field_addr.name = "border_city_radius_sq";
8451#endif /* FREECIV_JSON_CONNECTION */
8452 e = 0;
8453 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->border_city_radius_sq);
8454 if (e) {
8455 log_packet_detailed("'border_city_radius_sq' field error detected");
8456 }
8457#ifdef FREECIV_JSON_CONNECTION
8458 field_addr.name = "border_size_effect";
8459#endif /* FREECIV_JSON_CONNECTION */
8460 e = 0;
8461 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->border_size_effect);
8462 if (e) {
8463 log_packet_detailed("'border_size_effect' field error detected");
8464 }
8465#ifdef FREECIV_JSON_CONNECTION
8466 field_addr.name = "border_city_permanent_radius_sq";
8467#endif /* FREECIV_JSON_CONNECTION */
8468 e = 0;
8469 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->border_city_permanent_radius_sq);
8470 if (e) {
8471 log_packet_detailed("'border_city_permanent_radius_sq' field error detected");
8472 }
8473#ifdef FREECIV_JSON_CONNECTION
8474 field_addr.name = "borders";
8475#endif /* FREECIV_JSON_CONNECTION */
8476 e = 0;
8477 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->borders);
8478 if (e) {
8479 log_packet_detailed("'borders' field error detected");
8480 }
8481#ifdef FREECIV_JSON_CONNECTION
8482 field_addr.name = "base_bribe_cost";
8483#endif /* FREECIV_JSON_CONNECTION */
8484 e = 0;
8485 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->base_bribe_cost);
8486 if (e) {
8487 log_packet_detailed("'base_bribe_cost' field error detected");
8488 }
8489#ifdef FREECIV_JSON_CONNECTION
8490 field_addr.name = "caravan_bonus_style";
8491#endif /* FREECIV_JSON_CONNECTION */
8492 e = 0;
8493 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->caravan_bonus_style);
8494 if (e) {
8495 log_packet_detailed("'caravan_bonus_style' field error detected");
8496 }
8497#ifdef FREECIV_JSON_CONNECTION
8498 field_addr.name = "culture_vic_points";
8499#endif /* FREECIV_JSON_CONNECTION */
8500 e = 0;
8501 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture_vic_points);
8502 if (e) {
8503 log_packet_detailed("'culture_vic_points' field error detected");
8504 }
8505#ifdef FREECIV_JSON_CONNECTION
8506 field_addr.name = "culture_vic_lead";
8507#endif /* FREECIV_JSON_CONNECTION */
8508 e = 0;
8509 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_vic_lead);
8510 if (e) {
8511 log_packet_detailed("'culture_vic_lead' field error detected");
8512 }
8513#ifdef FREECIV_JSON_CONNECTION
8514 field_addr.name = "culture_migration_pml";
8515#endif /* FREECIV_JSON_CONNECTION */
8516 e = 0;
8517 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->culture_migration_pml);
8518 if (e) {
8519 log_packet_detailed("'culture_migration_pml' field error detected");
8520 }
8521#ifdef FREECIV_JSON_CONNECTION
8522 field_addr.name = "history_interest_pml";
8523#endif /* FREECIV_JSON_CONNECTION */
8524 e = 0;
8525 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->history_interest_pml);
8526 if (e) {
8527 log_packet_detailed("'history_interest_pml' field error detected");
8528 }
8529#ifdef FREECIV_JSON_CONNECTION
8530 field_addr.name = "celebratesize";
8531#endif /* FREECIV_JSON_CONNECTION */
8532 e = 0;
8533 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->celebratesize);
8534 if (e) {
8535 log_packet_detailed("'celebratesize' field error detected");
8536 }
8537#ifdef FREECIV_JSON_CONNECTION
8538 field_addr.name = "changable_tax";
8539#endif /* FREECIV_JSON_CONNECTION */
8540 e = 0;
8541 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->changable_tax);
8542 if (e) {
8543 log_packet_detailed("'changable_tax' field error detected");
8544 }
8545#ifdef FREECIV_JSON_CONNECTION
8546 field_addr.name = "pop_report_zeroes";
8547#endif /* FREECIV_JSON_CONNECTION */
8548 e = 0;
8549 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_report_zeroes);
8550 if (e) {
8551 log_packet_detailed("'pop_report_zeroes' field error detected");
8552 }
8553#ifdef FREECIV_JSON_CONNECTION
8554 field_addr.name = "citizen_nationality";
8555#endif /* FREECIV_JSON_CONNECTION */
8556 e = 0;
8557 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->citizen_nationality);
8558 if (e) {
8559 log_packet_detailed("'citizen_nationality' field error detected");
8560 }
8561#ifdef FREECIV_JSON_CONNECTION
8562 field_addr.name = "unit_builders_nationality";
8563#endif /* FREECIV_JSON_CONNECTION */
8564 e = 0;
8565 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unit_builders_nationality);
8566 if (e) {
8567 log_packet_detailed("'unit_builders_nationality' field error detected");
8568 }
8569#ifdef FREECIV_JSON_CONNECTION
8570 field_addr.name = "citizen_convert_speed";
8571#endif /* FREECIV_JSON_CONNECTION */
8572 e = 0;
8573 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->citizen_convert_speed);
8574 if (e) {
8575 log_packet_detailed("'citizen_convert_speed' field error detected");
8576 }
8577#ifdef FREECIV_JSON_CONNECTION
8578 field_addr.name = "conquest_convert_pct";
8579#endif /* FREECIV_JSON_CONNECTION */
8580 e = 0;
8581 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->conquest_convert_pct);
8582 if (e) {
8583 log_packet_detailed("'conquest_convert_pct' field error detected");
8584 }
8585#ifdef FREECIV_JSON_CONNECTION
8586 field_addr.name = "citizen_partisans_pct";
8587#endif /* FREECIV_JSON_CONNECTION */
8588 e = 0;
8589 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citizen_partisans_pct);
8590 if (e) {
8591 log_packet_detailed("'citizen_partisans_pct' field error detected");
8592 }
8593#ifdef FREECIV_JSON_CONNECTION
8594 field_addr.name = "citymindist";
8595#endif /* FREECIV_JSON_CONNECTION */
8596 e = 0;
8597 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->citymindist);
8598 if (e) {
8599 log_packet_detailed("'citymindist' field error detected");
8600 }
8601#ifdef FREECIV_JSON_CONNECTION
8602 field_addr.name = "cooling";
8603#endif /* FREECIV_JSON_CONNECTION */
8604 e = 0;
8605 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cooling);
8606 if (e) {
8607 log_packet_detailed("'cooling' field error detected");
8608 }
8609#ifdef FREECIV_JSON_CONNECTION
8610 field_addr.name = "coolinglevel";
8611#endif /* FREECIV_JSON_CONNECTION */
8612 e = 0;
8613 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->coolinglevel);
8614 if (e) {
8615 log_packet_detailed("'coolinglevel' field error detected");
8616 }
8617#ifdef FREECIV_JSON_CONNECTION
8618 field_addr.name = "diplchance_initial_odds";
8619#endif /* FREECIV_JSON_CONNECTION */
8620 e = 0;
8621 e |= DIO_BV_PUT(&dout, &field_addr, packet->diplchance_initial_odds);
8622 if (e) {
8623 log_packet_detailed("'diplchance_initial_odds' field error detected");
8624 }
8625#ifdef FREECIV_JSON_CONNECTION
8626 field_addr.name = "diplomacy";
8627#endif /* FREECIV_JSON_CONNECTION */
8628 e = 0;
8629 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->diplomacy);
8630 if (e) {
8631 log_packet_detailed("'diplomacy' field error detected");
8632 }
8633#ifdef FREECIV_JSON_CONNECTION
8634 field_addr.name = "fogofwar";
8635#endif /* FREECIV_JSON_CONNECTION */
8636 e = 0;
8637 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->fogofwar);
8638 if (e) {
8639 log_packet_detailed("'fogofwar' field error detected");
8640 }
8641#ifdef FREECIV_JSON_CONNECTION
8642 field_addr.name = "food_cost";
8643#endif /* FREECIV_JSON_CONNECTION */
8644 e = 0;
8645 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_cost);
8646 if (e) {
8647 log_packet_detailed("'food_cost' field error detected");
8648 }
8649#ifdef FREECIV_JSON_CONNECTION
8650 field_addr.name = "foodbox";
8651#endif /* FREECIV_JSON_CONNECTION */
8652 e = 0;
8653 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->foodbox);
8654 if (e) {
8655 log_packet_detailed("'foodbox' field error detected");
8656 }
8657#ifdef FREECIV_JSON_CONNECTION
8658 field_addr.name = "forced_gold";
8659#endif /* FREECIV_JSON_CONNECTION */
8660 e = 0;
8661 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_gold);
8662 if (e) {
8663 log_packet_detailed("'forced_gold' field error detected");
8664 }
8665#ifdef FREECIV_JSON_CONNECTION
8666 field_addr.name = "forced_luxury";
8667#endif /* FREECIV_JSON_CONNECTION */
8668 e = 0;
8669 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_luxury);
8670 if (e) {
8671 log_packet_detailed("'forced_luxury' field error detected");
8672 }
8673#ifdef FREECIV_JSON_CONNECTION
8674 field_addr.name = "forced_science";
8675#endif /* FREECIV_JSON_CONNECTION */
8676 e = 0;
8677 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->forced_science);
8678 if (e) {
8679 log_packet_detailed("'forced_science' field error detected");
8680 }
8681#ifdef FREECIV_JSON_CONNECTION
8682 field_addr.name = "fulltradesize";
8683#endif /* FREECIV_JSON_CONNECTION */
8684 e = 0;
8685 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fulltradesize);
8686 if (e) {
8687 log_packet_detailed("'fulltradesize' field error detected");
8688 }
8689#ifdef FREECIV_JSON_CONNECTION
8690 field_addr.name = "trade_world_rel_pct";
8691#endif /* FREECIV_JSON_CONNECTION */
8692 e = 0;
8693 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_world_rel_pct);
8694 if (e) {
8695 log_packet_detailed("'trade_world_rel_pct' field error detected");
8696 }
8697#ifdef FREECIV_JSON_CONNECTION
8698 field_addr.name = "min_trade_route_val";
8699#endif /* FREECIV_JSON_CONNECTION */
8700 e = 0;
8701 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_trade_route_val);
8702 if (e) {
8703 log_packet_detailed("'min_trade_route_val' field error detected");
8704 }
8705#ifdef FREECIV_JSON_CONNECTION
8706 field_addr.name = "reveal_trade_partner";
8707#endif /* FREECIV_JSON_CONNECTION */
8708 e = 0;
8709 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->reveal_trade_partner);
8710 if (e) {
8711 log_packet_detailed("'reveal_trade_partner' field error detected");
8712 }
8713#ifdef FREECIV_JSON_CONNECTION
8714 field_addr.name = "goods_selection";
8715#endif /* FREECIV_JSON_CONNECTION */
8716 e = 0;
8717 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods_selection);
8718 if (e) {
8719 log_packet_detailed("'goods_selection' field error detected");
8720 }
8721#ifdef FREECIV_JSON_CONNECTION
8722 field_addr.name = "global_advance_count";
8723#endif /* FREECIV_JSON_CONNECTION */
8724 e = 0;
8725 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_advance_count);
8726 if (e) {
8727 log_packet_detailed("'global_advance_count' field error detected");
8728 }
8729#ifdef FREECIV_JSON_CONNECTION
8730 field_addr.name = "global_advances";
8731#endif /* FREECIV_JSON_CONNECTION */
8732 e = 0;
8733 {
8734 int i;
8735
8736#ifdef FREECIV_JSON_CONNECTION
8737 /* Create the array. */
8738 e |= DIO_PUT(farray, &dout, &field_addr, A_LAST);
8739
8740 /* Enter the array. */
8741 field_addr.sub_location = plocation_elem_new(0);
8742#endif /* FREECIV_JSON_CONNECTION */
8743
8744 for (i = 0; i < A_LAST; i++) {
8745#ifdef FREECIV_JSON_CONNECTION
8746 /* Next array element. */
8747 field_addr.sub_location->number = i;
8748#endif /* FREECIV_JSON_CONNECTION */
8749 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->global_advances[i]);
8750 }
8751
8752#ifdef FREECIV_JSON_CONNECTION
8753 /* Exit array. */
8754 FC_FREE(field_addr.sub_location);
8755#endif /* FREECIV_JSON_CONNECTION */
8756 }
8757 if (e) {
8758 log_packet_detailed("'global_advances' field error detected");
8759 }
8760#ifdef FREECIV_JSON_CONNECTION
8761 field_addr.name = "global_warming";
8762#endif /* FREECIV_JSON_CONNECTION */
8763 e = 0;
8764 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->global_warming);
8765 if (e) {
8766 log_packet_detailed("'global_warming' field error detected");
8767 }
8768#ifdef FREECIV_JSON_CONNECTION
8769 field_addr.name = "globalwarming";
8770#endif /* FREECIV_JSON_CONNECTION */
8771 e = 0;
8772 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->globalwarming);
8773 if (e) {
8774 log_packet_detailed("'globalwarming' field error detected");
8775 }
8776#ifdef FREECIV_JSON_CONNECTION
8777 field_addr.name = "gold";
8778#endif /* FREECIV_JSON_CONNECTION */
8779 e = 0;
8780 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
8781 if (e) {
8782 log_packet_detailed("'gold' field error detected");
8783 }
8784#ifdef FREECIV_JSON_CONNECTION
8785 field_addr.name = "gold_upkeep_style";
8786#endif /* FREECIV_JSON_CONNECTION */
8787 e = 0;
8788 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gold_upkeep_style);
8789 if (e) {
8790 log_packet_detailed("'gold_upkeep_style' field error detected");
8791 }
8792#ifdef FREECIV_JSON_CONNECTION
8793 field_addr.name = "homeless_gold_upkeep";
8794#endif /* FREECIV_JSON_CONNECTION */
8795 e = 0;
8796 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->homeless_gold_upkeep);
8797 if (e) {
8798 log_packet_detailed("'homeless_gold_upkeep' field error detected");
8799 }
8800#ifdef FREECIV_JSON_CONNECTION
8801 field_addr.name = "infrapoints";
8802#endif /* FREECIV_JSON_CONNECTION */
8803 e = 0;
8804 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
8805 if (e) {
8806 log_packet_detailed("'infrapoints' field error detected");
8807 }
8808#ifdef FREECIV_JSON_CONNECTION
8809 field_addr.name = "revolentype";
8810#endif /* FREECIV_JSON_CONNECTION */
8811 e = 0;
8812 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->revolentype);
8813 if (e) {
8814 log_packet_detailed("'revolentype' field error detected");
8815 }
8816#ifdef FREECIV_JSON_CONNECTION
8817 field_addr.name = "default_government_id";
8818#endif /* FREECIV_JSON_CONNECTION */
8819 e = 0;
8820 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_government_id);
8821 if (e) {
8822 log_packet_detailed("'default_government_id' field error detected");
8823 }
8824#ifdef FREECIV_JSON_CONNECTION
8825 field_addr.name = "government_during_revolution_id";
8826#endif /* FREECIV_JSON_CONNECTION */
8827 e = 0;
8828 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government_during_revolution_id);
8829 if (e) {
8830 log_packet_detailed("'government_during_revolution_id' field error detected");
8831 }
8832#ifdef FREECIV_JSON_CONNECTION
8833 field_addr.name = "granary_food_inc";
8834#endif /* FREECIV_JSON_CONNECTION */
8835 e = 0;
8836 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_inc);
8837 if (e) {
8838 log_packet_detailed("'granary_food_inc' field error detected");
8839 }
8840#ifdef FREECIV_JSON_CONNECTION
8841 field_addr.name = "granary_food_ini";
8842#endif /* FREECIV_JSON_CONNECTION */
8843 e = 0;
8844 {
8845 int i;
8846
8847#ifdef FREECIV_JSON_CONNECTION
8848 /* Create the array. */
8849 e |= DIO_PUT(farray, &dout, &field_addr, MAX_GRANARY_INIS);
8850
8851 /* Enter the array. */
8852 field_addr.sub_location = plocation_elem_new(0);
8853#endif /* FREECIV_JSON_CONNECTION */
8854
8855 for (i = 0; i < MAX_GRANARY_INIS; i++) {
8856#ifdef FREECIV_JSON_CONNECTION
8857 /* Next array element. */
8858 field_addr.sub_location->number = i;
8859#endif /* FREECIV_JSON_CONNECTION */
8860 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_food_ini[i]);
8861 }
8862
8863#ifdef FREECIV_JSON_CONNECTION
8864 /* Exit array. */
8865 FC_FREE(field_addr.sub_location);
8866#endif /* FREECIV_JSON_CONNECTION */
8867 }
8868 if (e) {
8869 log_packet_detailed("'granary_food_ini' field error detected");
8870 }
8871#ifdef FREECIV_JSON_CONNECTION
8872 field_addr.name = "granary_num_inis";
8873#endif /* FREECIV_JSON_CONNECTION */
8874 e = 0;
8875 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->granary_num_inis);
8876 if (e) {
8877 log_packet_detailed("'granary_num_inis' field error detected");
8878 }
8879#ifdef FREECIV_JSON_CONNECTION
8880 field_addr.name = "great_wonder_owners";
8881#endif /* FREECIV_JSON_CONNECTION */
8882 e = 0;
8883 {
8884 int i;
8885
8886#ifdef FREECIV_JSON_CONNECTION
8887 /* Create the array. */
8888 e |= DIO_PUT(farray, &dout, &field_addr, B_LAST);
8889
8890 /* Enter the array. */
8891 field_addr.sub_location = plocation_elem_new(0);
8892#endif /* FREECIV_JSON_CONNECTION */
8893
8894 for (i = 0; i < B_LAST; i++) {
8895#ifdef FREECIV_JSON_CONNECTION
8896 /* Next array element. */
8897 field_addr.sub_location->number = i;
8898#endif /* FREECIV_JSON_CONNECTION */
8899 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->great_wonder_owners[i]);
8900 }
8901
8902#ifdef FREECIV_JSON_CONNECTION
8903 /* Exit array. */
8904 FC_FREE(field_addr.sub_location);
8905#endif /* FREECIV_JSON_CONNECTION */
8906 }
8907 if (e) {
8908 log_packet_detailed("'great_wonder_owners' field error detected");
8909 }
8910#ifdef FREECIV_JSON_CONNECTION
8911 field_addr.name = "happy_cost";
8912#endif /* FREECIV_JSON_CONNECTION */
8913 e = 0;
8914 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->happy_cost);
8915 if (e) {
8916 log_packet_detailed("'happy_cost' field error detected");
8917 }
8918#ifdef FREECIV_JSON_CONNECTION
8919 field_addr.name = "happyborders";
8920#endif /* FREECIV_JSON_CONNECTION */
8921 e = 0;
8922 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happyborders);
8923 if (e) {
8924 log_packet_detailed("'happyborders' field error detected");
8925 }
8926#ifdef FREECIV_JSON_CONNECTION
8927 field_addr.name = "heating";
8928#endif /* FREECIV_JSON_CONNECTION */
8929 e = 0;
8930 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->heating);
8931 if (e) {
8932 log_packet_detailed("'heating' field error detected");
8933 }
8934#ifdef FREECIV_JSON_CONNECTION
8935 field_addr.name = "illness_base_factor";
8936#endif /* FREECIV_JSON_CONNECTION */
8937 e = 0;
8938 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_base_factor);
8939 if (e) {
8940 log_packet_detailed("'illness_base_factor' field error detected");
8941 }
8942#ifdef FREECIV_JSON_CONNECTION
8943 field_addr.name = "illness_min_size";
8944#endif /* FREECIV_JSON_CONNECTION */
8945 e = 0;
8946 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->illness_min_size);
8947 if (e) {
8948 log_packet_detailed("'illness_min_size' field error detected");
8949 }
8950#ifdef FREECIV_JSON_CONNECTION
8951 field_addr.name = "illness_on";
8952#endif /* FREECIV_JSON_CONNECTION */
8953 e = 0;
8954 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->illness_on);
8955 if (e) {
8956 log_packet_detailed("'illness_on' field error detected");
8957 }
8958#ifdef FREECIV_JSON_CONNECTION
8959 field_addr.name = "illness_pollution_factor";
8960#endif /* FREECIV_JSON_CONNECTION */
8961 e = 0;
8962 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_pollution_factor);
8963 if (e) {
8964 log_packet_detailed("'illness_pollution_factor' field error detected");
8965 }
8966#ifdef FREECIV_JSON_CONNECTION
8967 field_addr.name = "illness_trade_infection";
8968#endif /* FREECIV_JSON_CONNECTION */
8969 e = 0;
8970 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade_infection);
8971 if (e) {
8972 log_packet_detailed("'illness_trade_infection' field error detected");
8973 }
8974#ifdef FREECIV_JSON_CONNECTION
8975 field_addr.name = "init_city_radius_sq";
8976#endif /* FREECIV_JSON_CONNECTION */
8977 e = 0;
8978 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_city_radius_sq);
8979 if (e) {
8980 log_packet_detailed("'init_city_radius_sq' field error detected");
8981 }
8982#ifdef FREECIV_JSON_CONNECTION
8983 field_addr.name = "is_edit_mode";
8984#endif /* FREECIV_JSON_CONNECTION */
8985 e = 0;
8986 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_edit_mode);
8987 if (e) {
8988 log_packet_detailed("'is_edit_mode' field error detected");
8989 }
8990#ifdef FREECIV_JSON_CONNECTION
8991 field_addr.name = "is_new_game";
8992#endif /* FREECIV_JSON_CONNECTION */
8993 e = 0;
8994 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_new_game);
8995 if (e) {
8996 log_packet_detailed("'is_new_game' field error detected");
8997 }
8998#ifdef FREECIV_JSON_CONNECTION
8999 field_addr.name = "killcitizen";
9000#endif /* FREECIV_JSON_CONNECTION */
9001 e = 0;
9002 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->killcitizen);
9003 if (e) {
9004 log_packet_detailed("'killcitizen' field error detected");
9005 }
9006#ifdef FREECIV_JSON_CONNECTION
9007 field_addr.name = "killstack";
9008#endif /* FREECIV_JSON_CONNECTION */
9009 e = 0;
9010 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->killstack);
9011 if (e) {
9012 log_packet_detailed("'killstack' field error detected");
9013 }
9014#ifdef FREECIV_JSON_CONNECTION
9015 field_addr.name = "only_killing_makes_veteran";
9016#endif /* FREECIV_JSON_CONNECTION */
9017 e = 0;
9018 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->only_killing_makes_veteran);
9019 if (e) {
9020 log_packet_detailed("'only_killing_makes_veteran' field error detected");
9021 }
9022#ifdef FREECIV_JSON_CONNECTION
9023 field_addr.name = "only_real_fight_makes_veteran";
9024#endif /* FREECIV_JSON_CONNECTION */
9025 e = 0;
9026 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->only_real_fight_makes_veteran);
9027 if (e) {
9028 log_packet_detailed("'only_real_fight_makes_veteran' field error detected");
9029 }
9030#ifdef FREECIV_JSON_CONNECTION
9031 field_addr.name = "combat_odds_scaled_veterancy";
9032#endif /* FREECIV_JSON_CONNECTION */
9033 e = 0;
9034 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->combat_odds_scaled_veterancy);
9035 if (e) {
9036 log_packet_detailed("'combat_odds_scaled_veterancy' field error detected");
9037 }
9038#ifdef FREECIV_JSON_CONNECTION
9039 field_addr.name = "damage_reduces_bombard_rate";
9040#endif /* FREECIV_JSON_CONNECTION */
9041 e = 0;
9042 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->damage_reduces_bombard_rate);
9043 if (e) {
9044 log_packet_detailed("'damage_reduces_bombard_rate' field error detected");
9045 }
9046#ifdef FREECIV_JSON_CONNECTION
9047 field_addr.name = "low_firepower_badwallattacker";
9048#endif /* FREECIV_JSON_CONNECTION */
9049 e = 0;
9050 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_badwallattacker);
9051 if (e) {
9052 log_packet_detailed("'low_firepower_badwallattacker' field error detected");
9053 }
9054#ifdef FREECIV_JSON_CONNECTION
9055 field_addr.name = "low_firepower_pearl_harbour";
9056#endif /* FREECIV_JSON_CONNECTION */
9057 e = 0;
9058 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_pearl_harbour);
9059 if (e) {
9060 log_packet_detailed("'low_firepower_pearl_harbour' field error detected");
9061 }
9062#ifdef FREECIV_JSON_CONNECTION
9063 field_addr.name = "low_firepower_combat_bonus";
9064#endif /* FREECIV_JSON_CONNECTION */
9065 e = 0;
9066 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_combat_bonus);
9067 if (e) {
9068 log_packet_detailed("'low_firepower_combat_bonus' field error detected");
9069 }
9070#ifdef FREECIV_JSON_CONNECTION
9071 field_addr.name = "low_firepower_nonnat_bombard";
9072#endif /* FREECIV_JSON_CONNECTION */
9073 e = 0;
9074 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->low_firepower_nonnat_bombard);
9075 if (e) {
9076 log_packet_detailed("'low_firepower_nonnat_bombard' field error detected");
9077 }
9078#ifdef FREECIV_JSON_CONNECTION
9079 field_addr.name = "nuke_pop_loss_pct";
9080#endif /* FREECIV_JSON_CONNECTION */
9081 e = 0;
9082 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_pop_loss_pct);
9083 if (e) {
9084 log_packet_detailed("'nuke_pop_loss_pct' field error detected");
9085 }
9086#ifdef FREECIV_JSON_CONNECTION
9087 field_addr.name = "nuke_defender_survival_chance_pct";
9088#endif /* FREECIV_JSON_CONNECTION */
9089 e = 0;
9090 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nuke_defender_survival_chance_pct);
9091 if (e) {
9092 log_packet_detailed("'nuke_defender_survival_chance_pct' field error detected");
9093 }
9094#ifdef FREECIV_JSON_CONNECTION
9095 field_addr.name = "min_city_center_output";
9096#endif /* FREECIV_JSON_CONNECTION */
9097 e = 0;
9098 {
9099 int i;
9100
9101#ifdef FREECIV_JSON_CONNECTION
9102 /* Create the array. */
9103 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
9104
9105 /* Enter the array. */
9106 field_addr.sub_location = plocation_elem_new(0);
9107#endif /* FREECIV_JSON_CONNECTION */
9108
9109 for (i = 0; i < O_LAST; i++) {
9110#ifdef FREECIV_JSON_CONNECTION
9111 /* Next array element. */
9112 field_addr.sub_location->number = i;
9113#endif /* FREECIV_JSON_CONNECTION */
9114 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->min_city_center_output[i]);
9115 }
9116
9117#ifdef FREECIV_JSON_CONNECTION
9118 /* Exit array. */
9119 FC_FREE(field_addr.sub_location);
9120#endif /* FREECIV_JSON_CONNECTION */
9121 }
9122 if (e) {
9123 log_packet_detailed("'min_city_center_output' field error detected");
9124 }
9125#ifdef FREECIV_JSON_CONNECTION
9126 field_addr.name = "muuk_food_wipe";
9127#endif /* FREECIV_JSON_CONNECTION */
9128 e = 0;
9129 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_food_wipe);
9130 if (e) {
9131 log_packet_detailed("'muuk_food_wipe' field error detected");
9132 }
9133#ifdef FREECIV_JSON_CONNECTION
9134 field_addr.name = "muuk_gold_wipe";
9135#endif /* FREECIV_JSON_CONNECTION */
9136 e = 0;
9137 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_gold_wipe);
9138 if (e) {
9139 log_packet_detailed("'muuk_gold_wipe' field error detected");
9140 }
9141#ifdef FREECIV_JSON_CONNECTION
9142 field_addr.name = "muuk_shield_wipe";
9143#endif /* FREECIV_JSON_CONNECTION */
9144 e = 0;
9145 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->muuk_shield_wipe);
9146 if (e) {
9147 log_packet_detailed("'muuk_shield_wipe' field error detected");
9148 }
9149#ifdef FREECIV_JSON_CONNECTION
9150 field_addr.name = "notradesize";
9151#endif /* FREECIV_JSON_CONNECTION */
9152 e = 0;
9153 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->notradesize);
9154 if (e) {
9155 log_packet_detailed("'notradesize' field error detected");
9156 }
9157#ifdef FREECIV_JSON_CONNECTION
9158 field_addr.name = "nuclear_winter";
9159#endif /* FREECIV_JSON_CONNECTION */
9160 e = 0;
9161 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->nuclear_winter);
9162 if (e) {
9163 log_packet_detailed("'nuclear_winter' field error detected");
9164 }
9165#ifdef FREECIV_JSON_CONNECTION
9166 field_addr.name = "nuclearwinter";
9167#endif /* FREECIV_JSON_CONNECTION */
9168 e = 0;
9169 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->nuclearwinter);
9170 if (e) {
9171 log_packet_detailed("'nuclearwinter' field error detected");
9172 }
9173#ifdef FREECIV_JSON_CONNECTION
9174 field_addr.name = "phase";
9175#endif /* FREECIV_JSON_CONNECTION */
9176 e = 0;
9177 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
9178 if (e) {
9179 log_packet_detailed("'phase' field error detected");
9180 }
9181#ifdef FREECIV_JSON_CONNECTION
9182 field_addr.name = "phase_mode";
9183#endif /* FREECIV_JSON_CONNECTION */
9184 e = 0;
9185 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->phase_mode);
9186 if (e) {
9187 log_packet_detailed("'phase_mode' field error detected");
9188 }
9189#ifdef FREECIV_JSON_CONNECTION
9190 field_addr.name = "pillage_select";
9191#endif /* FREECIV_JSON_CONNECTION */
9192 e = 0;
9193 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->pillage_select);
9194 if (e) {
9195 log_packet_detailed("'pillage_select' field error detected");
9196 }
9197#ifdef FREECIV_JSON_CONNECTION
9198 field_addr.name = "steal_maps_reveals_all_cities";
9199#endif /* FREECIV_JSON_CONNECTION */
9200 e = 0;
9201 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->steal_maps_reveals_all_cities);
9202 if (e) {
9203 log_packet_detailed("'steal_maps_reveals_all_cities' field error detected");
9204 }
9205#ifdef FREECIV_JSON_CONNECTION
9206 field_addr.name = "poison_empties_food_stock";
9207#endif /* FREECIV_JSON_CONNECTION */
9208 e = 0;
9209 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->poison_empties_food_stock);
9210 if (e) {
9211 log_packet_detailed("'poison_empties_food_stock' field error detected");
9212 }
9213#ifdef FREECIV_JSON_CONNECTION
9214 field_addr.name = "tech_steal_allow_holes";
9215#endif /* FREECIV_JSON_CONNECTION */
9216 e = 0;
9217 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_steal_allow_holes);
9218 if (e) {
9219 log_packet_detailed("'tech_steal_allow_holes' field error detected");
9220 }
9221#ifdef FREECIV_JSON_CONNECTION
9222 field_addr.name = "tech_trade_allow_holes";
9223#endif /* FREECIV_JSON_CONNECTION */
9224 e = 0;
9225 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_trade_allow_holes);
9226 if (e) {
9227 log_packet_detailed("'tech_trade_allow_holes' field error detected");
9228 }
9229#ifdef FREECIV_JSON_CONNECTION
9230 field_addr.name = "tech_trade_loss_allow_holes";
9231#endif /* FREECIV_JSON_CONNECTION */
9232 e = 0;
9233 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_trade_loss_allow_holes);
9234 if (e) {
9235 log_packet_detailed("'tech_trade_loss_allow_holes' field error detected");
9236 }
9237#ifdef FREECIV_JSON_CONNECTION
9238 field_addr.name = "tech_parasite_allow_holes";
9239#endif /* FREECIV_JSON_CONNECTION */
9240 e = 0;
9241 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_parasite_allow_holes);
9242 if (e) {
9243 log_packet_detailed("'tech_parasite_allow_holes' field error detected");
9244 }
9245#ifdef FREECIV_JSON_CONNECTION
9246 field_addr.name = "tech_loss_allow_holes";
9247#endif /* FREECIV_JSON_CONNECTION */
9248 e = 0;
9249 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tech_loss_allow_holes);
9250 if (e) {
9251 log_packet_detailed("'tech_loss_allow_holes' field error detected");
9252 }
9253#ifdef FREECIV_JSON_CONNECTION
9254 field_addr.name = "rapturedelay";
9255#endif /* FREECIV_JSON_CONNECTION */
9256 e = 0;
9257 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapturedelay);
9258 if (e) {
9259 log_packet_detailed("'rapturedelay' field error detected");
9260 }
9261#ifdef FREECIV_JSON_CONNECTION
9262 field_addr.name = "disasters";
9263#endif /* FREECIV_JSON_CONNECTION */
9264 e = 0;
9265 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disasters);
9266 if (e) {
9267 log_packet_detailed("'disasters' field error detected");
9268 }
9269#ifdef FREECIV_JSON_CONNECTION
9270 field_addr.name = "restrictinfra";
9271#endif /* FREECIV_JSON_CONNECTION */
9272 e = 0;
9273 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->restrictinfra);
9274 if (e) {
9275 log_packet_detailed("'restrictinfra' field error detected");
9276 }
9277#ifdef FREECIV_JSON_CONNECTION
9278 field_addr.name = "unreachable_protects";
9279#endif /* FREECIV_JSON_CONNECTION */
9280 e = 0;
9281 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unreachable_protects);
9282 if (e) {
9283 log_packet_detailed("'unreachable_protects' field error detected");
9284 }
9285#ifdef FREECIV_JSON_CONNECTION
9286 field_addr.name = "sciencebox";
9287#endif /* FREECIV_JSON_CONNECTION */
9288 e = 0;
9289 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->sciencebox);
9290 if (e) {
9291 log_packet_detailed("'sciencebox' field error detected");
9292 }
9293#ifdef FREECIV_JSON_CONNECTION
9294 field_addr.name = "shieldbox";
9295#endif /* FREECIV_JSON_CONNECTION */
9296 e = 0;
9297 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->shieldbox);
9298 if (e) {
9299 log_packet_detailed("'shieldbox' field error detected");
9300 }
9301#ifdef FREECIV_JSON_CONNECTION
9302 field_addr.name = "skill_level";
9303#endif /* FREECIV_JSON_CONNECTION */
9304 e = 0;
9305 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->skill_level);
9306 if (e) {
9307 log_packet_detailed("'skill_level' field error detected");
9308 }
9309#ifdef FREECIV_JSON_CONNECTION
9310 field_addr.name = "victory_conditions";
9311#endif /* FREECIV_JSON_CONNECTION */
9312 e = 0;
9313 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->victory_conditions);
9314 if (e) {
9315 log_packet_detailed("'victory_conditions' field error detected");
9316 }
9317#ifdef FREECIV_JSON_CONNECTION
9318 field_addr.name = "team_pooled_research";
9319#endif /* FREECIV_JSON_CONNECTION */
9320 e = 0;
9321 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->team_pooled_research);
9322 if (e) {
9323 log_packet_detailed("'team_pooled_research' field error detected");
9324 }
9325#ifdef FREECIV_JSON_CONNECTION
9326 field_addr.name = "tech";
9327#endif /* FREECIV_JSON_CONNECTION */
9328 e = 0;
9329 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->tech);
9330 if (e) {
9331 log_packet_detailed("'tech' field error detected");
9332 }
9333#ifdef FREECIV_JSON_CONNECTION
9334 field_addr.name = "tech_cost_style";
9335#endif /* FREECIV_JSON_CONNECTION */
9336 e = 0;
9337 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_cost_style);
9338 if (e) {
9339 log_packet_detailed("'tech_cost_style' field error detected");
9340 }
9341#ifdef FREECIV_JSON_CONNECTION
9342 field_addr.name = "tech_leakage";
9343#endif /* FREECIV_JSON_CONNECTION */
9344 e = 0;
9345 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_leakage);
9346 if (e) {
9347 log_packet_detailed("'tech_leakage' field error detected");
9348 }
9349#ifdef FREECIV_JSON_CONNECTION
9350 field_addr.name = "tech_upkeep_divider";
9351#endif /* FREECIV_JSON_CONNECTION */
9352 e = 0;
9353 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep_divider);
9354 if (e) {
9355 log_packet_detailed("'tech_upkeep_divider' field error detected");
9356 }
9357#ifdef FREECIV_JSON_CONNECTION
9358 field_addr.name = "tech_upkeep_style";
9359#endif /* FREECIV_JSON_CONNECTION */
9360 e = 0;
9361 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tech_upkeep_style);
9362 if (e) {
9363 log_packet_detailed("'tech_upkeep_style' field error detected");
9364 }
9365#ifdef FREECIV_JSON_CONNECTION
9366 field_addr.name = "techloss_forgiveness";
9367#endif /* FREECIV_JSON_CONNECTION */
9368 e = 0;
9369 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->techloss_forgiveness);
9370 if (e) {
9371 log_packet_detailed("'techloss_forgiveness' field error detected");
9372 }
9373#ifdef FREECIV_JSON_CONNECTION
9374 field_addr.name = "free_tech_method";
9375#endif /* FREECIV_JSON_CONNECTION */
9376 e = 0;
9377 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->free_tech_method);
9378 if (e) {
9379 log_packet_detailed("'free_tech_method' field error detected");
9380 }
9381#ifdef FREECIV_JSON_CONNECTION
9382 field_addr.name = "gameloss_style";
9383#endif /* FREECIV_JSON_CONNECTION */
9384 e = 0;
9385 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gameloss_style);
9386 if (e) {
9387 log_packet_detailed("'gameloss_style' field error detected");
9388 }
9389#ifdef FREECIV_JSON_CONNECTION
9390 field_addr.name = "timeout";
9391#endif /* FREECIV_JSON_CONNECTION */
9392 e = 0;
9393 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->timeout);
9394 if (e) {
9395 log_packet_detailed("'timeout' field error detected");
9396 }
9397#ifdef FREECIV_JSON_CONNECTION
9398 field_addr.name = "first_timeout";
9399#endif /* FREECIV_JSON_CONNECTION */
9400 e = 0;
9401 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->first_timeout);
9402 if (e) {
9403 log_packet_detailed("'first_timeout' field error detected");
9404 }
9405#ifdef FREECIV_JSON_CONNECTION
9406 field_addr.name = "tired_attack";
9407#endif /* FREECIV_JSON_CONNECTION */
9408 e = 0;
9409 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->tired_attack);
9410 if (e) {
9411 log_packet_detailed("'tired_attack' field error detected");
9412 }
9413#ifdef FREECIV_JSON_CONNECTION
9414 field_addr.name = "trademindist";
9415#endif /* FREECIV_JSON_CONNECTION */
9416 e = 0;
9417 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trademindist);
9418 if (e) {
9419 log_packet_detailed("'trademindist' field error detected");
9420 }
9421#ifdef FREECIV_JSON_CONNECTION
9422 field_addr.name = "trade_revenue_style";
9423#endif /* FREECIV_JSON_CONNECTION */
9424 e = 0;
9425 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_revenue_style);
9426 if (e) {
9427 log_packet_detailed("'trade_revenue_style' field error detected");
9428 }
9429#ifdef FREECIV_JSON_CONNECTION
9430 field_addr.name = "trading_city";
9431#endif /* FREECIV_JSON_CONNECTION */
9432 e = 0;
9433 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_city);
9434 if (e) {
9435 log_packet_detailed("'trading_city' field error detected");
9436 }
9437#ifdef FREECIV_JSON_CONNECTION
9438 field_addr.name = "trading_gold";
9439#endif /* FREECIV_JSON_CONNECTION */
9440 e = 0;
9441 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_gold);
9442 if (e) {
9443 log_packet_detailed("'trading_gold' field error detected");
9444 }
9445#ifdef FREECIV_JSON_CONNECTION
9446 field_addr.name = "trading_tech";
9447#endif /* FREECIV_JSON_CONNECTION */
9448 e = 0;
9449 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->trading_tech);
9450 if (e) {
9451 log_packet_detailed("'trading_tech' field error detected");
9452 }
9453#ifdef FREECIV_JSON_CONNECTION
9454 field_addr.name = "turn";
9455#endif /* FREECIV_JSON_CONNECTION */
9456 e = 0;
9457 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
9458 if (e) {
9459 log_packet_detailed("'turn' field error detected");
9460 }
9461#ifdef FREECIV_JSON_CONNECTION
9462 field_addr.name = "warminglevel";
9463#endif /* FREECIV_JSON_CONNECTION */
9464 e = 0;
9465 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->warminglevel);
9466 if (e) {
9467 log_packet_detailed("'warminglevel' field error detected");
9468 }
9469#ifdef FREECIV_JSON_CONNECTION
9470 field_addr.name = "year";
9471#endif /* FREECIV_JSON_CONNECTION */
9472 e = 0;
9473 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
9474 if (e) {
9475 log_packet_detailed("'year' field error detected");
9476 }
9477#ifdef FREECIV_JSON_CONNECTION
9478 field_addr.name = "year_0_hack";
9479#endif /* FREECIV_JSON_CONNECTION */
9480 e = 0;
9481 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->year_0_hack);
9482 if (e) {
9483 log_packet_detailed("'year_0_hack' field error detected");
9484 }
9485#ifdef FREECIV_JSON_CONNECTION
9486 field_addr.name = "top_cities_count";
9487#endif /* FREECIV_JSON_CONNECTION */
9488 e = 0;
9489 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->top_cities_count);
9490 if (e) {
9491 log_packet_detailed("'top_cities_count' field error detected");
9492 }
9493#ifdef FREECIV_JSON_CONNECTION
9494 field_addr.name = "fragment_count";
9495#endif /* FREECIV_JSON_CONNECTION */
9496 e = 0;
9497 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragment_count);
9498 if (e) {
9499 log_packet_detailed("'fragment_count' field error detected");
9500 }
9501#ifdef FREECIV_JSON_CONNECTION
9502 field_addr.name = "civil_war_enabled";
9503#endif /* FREECIV_JSON_CONNECTION */
9504 e = 0;
9505 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->civil_war_enabled);
9506 if (e) {
9507 log_packet_detailed("'civil_war_enabled' field error detected");
9508 }
9509#ifdef FREECIV_JSON_CONNECTION
9510 field_addr.name = "civil_war_bonus_celebrating";
9511#endif /* FREECIV_JSON_CONNECTION */
9512 e = 0;
9513 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_celebrating);
9514 if (e) {
9515 log_packet_detailed("'civil_war_bonus_celebrating' field error detected");
9516 }
9517#ifdef FREECIV_JSON_CONNECTION
9518 field_addr.name = "civil_war_bonus_unhappy";
9519#endif /* FREECIV_JSON_CONNECTION */
9520 e = 0;
9521 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->civil_war_bonus_unhappy);
9522 if (e) {
9523 log_packet_detailed("'civil_war_bonus_unhappy' field error detected");
9524 }
9525#ifdef FREECIV_JSON_CONNECTION
9526 field_addr.name = "granularity";
9527#endif /* FREECIV_JSON_CONNECTION */
9528 e = 0;
9529 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granularity);
9530 if (e) {
9531 log_packet_detailed("'granularity' field error detected");
9532 }
9533#ifdef FREECIV_JSON_CONNECTION
9534 field_addr.name = "small_wonder_visibility";
9535#endif /* FREECIV_JSON_CONNECTION */
9536 e = 0;
9537 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->small_wonder_visibility);
9538 if (e) {
9539 log_packet_detailed("'small_wonder_visibility' field error detected");
9540 }
9541
9542#endif
9543 SEND_PACKET_END(PACKET_GAME_INFO);
9544}
9545
9546 int send_packet_game_info(struct connection *pc, const struct packet_game_info *packet)
9547{
9548 if (!pc->used) {
9549 log_error("WARNING: trying to send data to the closed connection %s",
9550 conn_description(pc));
9551 return -1;
9552 }
9553 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_GAME_INFO].packet != NULL, -1,
9554 "Handler for PACKET_GAME_INFO not installed");
9555 return pc->phs.handlers->send[PACKET_GAME_INFO].packet(pc, packet);
9556}
9557
9558#ifdef FREECIV_DELTA_PROTOCOL
9559#define hash_packet_calendar_info_100 hash_const
9560
9561#define cmp_packet_calendar_info_100 cmp_const
9562
9563 BV_DEFINE(packet_calendar_info_100_fields, 5);
9564#endif /* FREECIV_DELTA_PROTOCOL */
9565
9566 static struct packet_calendar_info *receive_packet_calendar_info_100(struct connection *pc)
9567{
9568#ifdef FREECIV_DELTA_PROTOCOL
9569 packet_calendar_info_100_fields fields;
9570 struct packet_calendar_info *old;
9571 struct genhash **hash = pc->phs.received + PACKET_CALENDAR_INFO;
9572#endif /* FREECIV_DELTA_PROTOCOL */
9573 RECEIVE_PACKET_START(packet_calendar_info, real_packet);
9574#ifdef FREECIV_JSON_CONNECTION
9575 struct plocation field_addr;
9576 {
9577 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9578 field_addr = *field_addr_tmp;
9579 FC_FREE(field_addr_tmp);
9580 }
9581#endif /* FREECIV_JSON_CONNECTION */
9582
9583#ifdef FREECIV_DELTA_PROTOCOL
9584#ifdef FREECIV_JSON_CONNECTION
9585 field_addr.name = "fields";
9586#endif /* FREECIV_JSON_CONNECTION */
9587 DIO_BV_GET(&din, &field_addr, fields);
9588
9589#else /* FREECIV_DELTA_PROTOCOL */
9590#ifdef FREECIV_JSON_CONNECTION
9591 field_addr.name = "positive_year_label";
9592#endif /* FREECIV_JSON_CONNECTION */
9593 if (!DIO_GET(string, &din, &field_addr, real_packet->positive_year_label, sizeof(real_packet->positive_year_label))) {
9594 RECEIVE_PACKET_FIELD_ERROR(positive_year_label);
9595 }
9596#ifdef FREECIV_JSON_CONNECTION
9597 field_addr.name = "negative_year_label";
9598#endif /* FREECIV_JSON_CONNECTION */
9599 if (!DIO_GET(string, &din, &field_addr, real_packet->negative_year_label, sizeof(real_packet->negative_year_label))) {
9600 RECEIVE_PACKET_FIELD_ERROR(negative_year_label);
9601 }
9602#ifdef FREECIV_JSON_CONNECTION
9603 field_addr.name = "calendar_fragments";
9604#endif /* FREECIV_JSON_CONNECTION */
9605 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->calendar_fragments)) {
9606 RECEIVE_PACKET_FIELD_ERROR(calendar_fragments);
9607 }
9608#ifdef FREECIV_JSON_CONNECTION
9609 field_addr.name = "calendar_fragment_name";
9610#endif /* FREECIV_JSON_CONNECTION */
9611 {
9612 int i;
9613
9614#ifdef FREECIV_JSON_CONNECTION
9615 /* Enter array. */
9616 field_addr.sub_location = plocation_elem_new(0);
9617#endif /* FREECIV_JSON_CONNECTION */
9618
9619 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9620#ifdef FREECIV_JSON_CONNECTION
9621 field_addr.sub_location->number = i;
9622#endif /* FREECIV_JSON_CONNECTION */
9623 if (!DIO_GET(string, &din, &field_addr, real_packet->calendar_fragment_name[i], sizeof(real_packet->calendar_fragment_name[i]))) {
9624 RECEIVE_PACKET_FIELD_ERROR(calendar_fragment_name);
9625 }
9626 }
9627
9628#ifdef FREECIV_JSON_CONNECTION
9629 /* Exit array. */
9630 FC_FREE(field_addr.sub_location);
9631#endif /* FREECIV_JSON_CONNECTION */
9632 }
9633#ifdef FREECIV_JSON_CONNECTION
9634 field_addr.name = "calendar_skip_0";
9635#endif /* FREECIV_JSON_CONNECTION */
9636 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->calendar_skip_0)) {
9637 RECEIVE_PACKET_FIELD_ERROR(calendar_skip_0);
9638 }
9639#endif
9640 log_packet_detailed("packet_calendar_info_100: got info about ()");
9641
9642#ifdef FREECIV_DELTA_PROTOCOL
9643 if (NULL == *hash) {
9644 *hash = genhash_new_full(hash_packet_calendar_info_100, cmp_packet_calendar_info_100,
9645 NULL, NULL, NULL, free);
9646 }
9647
9648 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
9649 *real_packet = *old;
9650 } else {
9651 log_packet_detailed(" no old info");
9652 memset(real_packet, 0, sizeof(*real_packet));
9653 }
9654
9655 if (BV_ISSET(fields, 0)) {
9656 log_packet_detailed(" got field 'positive_year_label'");
9657#ifdef FREECIV_JSON_CONNECTION
9658 field_addr.name = "positive_year_label";
9659#endif /* FREECIV_JSON_CONNECTION */
9660 if (!DIO_GET(string, &din, &field_addr, real_packet->positive_year_label, sizeof(real_packet->positive_year_label))) {
9661 RECEIVE_PACKET_FIELD_ERROR(positive_year_label);
9662 }
9663 }
9664 if (BV_ISSET(fields, 1)) {
9665 log_packet_detailed(" got field 'negative_year_label'");
9666#ifdef FREECIV_JSON_CONNECTION
9667 field_addr.name = "negative_year_label";
9668#endif /* FREECIV_JSON_CONNECTION */
9669 if (!DIO_GET(string, &din, &field_addr, real_packet->negative_year_label, sizeof(real_packet->negative_year_label))) {
9670 RECEIVE_PACKET_FIELD_ERROR(negative_year_label);
9671 }
9672 }
9673 if (BV_ISSET(fields, 2)) {
9674 log_packet_detailed(" got field 'calendar_fragments'");
9675#ifdef FREECIV_JSON_CONNECTION
9676 field_addr.name = "calendar_fragments";
9677#endif /* FREECIV_JSON_CONNECTION */
9678 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->calendar_fragments)) {
9679 RECEIVE_PACKET_FIELD_ERROR(calendar_fragments);
9680 }
9681 }
9682 if (BV_ISSET(fields, 3)) {
9683 log_packet_detailed(" got field 'calendar_fragment_name'");
9684#ifdef FREECIV_JSON_CONNECTION
9685 field_addr.name = "calendar_fragment_name";
9686#endif /* FREECIV_JSON_CONNECTION */
9687 {
9688 int i;
9689
9690#ifdef FREECIV_JSON_CONNECTION
9691 /* Enter array. */
9692 field_addr.sub_location = plocation_elem_new(0);
9693#endif /* FREECIV_JSON_CONNECTION */
9694
9695 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9696#ifdef FREECIV_JSON_CONNECTION
9697 field_addr.sub_location->number = i;
9698#endif /* FREECIV_JSON_CONNECTION */
9699 if (!DIO_GET(string, &din, &field_addr, real_packet->calendar_fragment_name[i], sizeof(real_packet->calendar_fragment_name[i]))) {
9700 RECEIVE_PACKET_FIELD_ERROR(calendar_fragment_name);
9701 }
9702 }
9703
9704#ifdef FREECIV_JSON_CONNECTION
9705 /* Exit array. */
9706 FC_FREE(field_addr.sub_location);
9707#endif /* FREECIV_JSON_CONNECTION */
9708 }
9709 }
9710 real_packet->calendar_skip_0 = BV_ISSET(fields, 4);
9711
9712 if (NULL == old) {
9713 old = fc_malloc(sizeof(*old));
9714 *old = *real_packet;
9715 genhash_insert(*hash, old, old);
9716 } else {
9717 *old = *real_packet;
9718 }
9719
9720#endif /* FREECIV_DELTA_PROTOCOL */
9721 RECEIVE_PACKET_END(real_packet);
9722}
9723
9724 static int send_packet_calendar_info_100(struct connection *pc, const struct packet_calendar_info *packet)
9725{
9726 const struct packet_calendar_info *real_packet = packet;
9727 int e;
9728#ifdef FREECIV_DELTA_PROTOCOL
9729 packet_calendar_info_100_fields fields;
9730 struct packet_calendar_info *old;
9731 bool differ;
9732 struct genhash **hash = pc->phs.sent + PACKET_CALENDAR_INFO;
9733 int different = 0;
9734#endif /* FREECIV_DELTA_PROTOCOL */
9735 SEND_PACKET_START(PACKET_CALENDAR_INFO);
9736#ifdef FREECIV_JSON_CONNECTION
9737 struct plocation field_addr;
9738 {
9739 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9740 field_addr = *field_addr_tmp;
9741 FC_FREE(field_addr_tmp);
9742 }
9743#endif /* FREECIV_JSON_CONNECTION */
9744
9745 log_packet_detailed("packet_calendar_info_100: sending info about ()");
9746
9747#ifdef FREECIV_DELTA_PROTOCOL
9748 if (NULL == *hash) {
9749 *hash = genhash_new_full(hash_packet_calendar_info_100, cmp_packet_calendar_info_100,
9750 NULL, NULL, NULL, free);
9751 }
9752 BV_CLR_ALL(fields);
9753
9754 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
9755 old = fc_malloc(sizeof(*old));
9756 *old = *real_packet;
9757 genhash_insert(*hash, old, old);
9758 memset(old, 0, sizeof(*old));
9759 different = 1; /* Force to send. */
9760 }
9761 differ = (strcmp(old->positive_year_label, real_packet->positive_year_label) != 0);
9762 if (differ) {
9763 different++;
9764 BV_SET(fields, 0);
9765 }
9766
9767 differ = (strcmp(old->negative_year_label, real_packet->negative_year_label) != 0);
9768 if (differ) {
9769 different++;
9770 BV_SET(fields, 1);
9771 }
9772
9773 differ = (old->calendar_fragments != real_packet->calendar_fragments);
9774 if (differ) {
9775 different++;
9776 BV_SET(fields, 2);
9777 }
9778
9779 differ = FALSE;
9780 {
9781 int i;
9782
9783 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9784 differ = (strcmp(old->calendar_fragment_name[i], real_packet->calendar_fragment_name[i]) != 0);
9785 if (differ) {
9786 break;
9787 }
9788 }
9789 }
9790 if (differ) {
9791 different++;
9792 BV_SET(fields, 3);
9793 }
9794
9795 differ = (old->calendar_skip_0 != real_packet->calendar_skip_0);
9796 if (differ) {
9797 different++;
9798 }
9799 if (packet->calendar_skip_0) {
9800 BV_SET(fields, 4);
9801 }
9802
9803 if (different == 0) {
9804 log_packet_detailed(" no change -> discard");
9805 return 0;
9806 }
9807
9808#ifdef FREECIV_JSON_CONNECTION
9809 field_addr.name = "fields";
9810#endif /* FREECIV_JSON_CONNECTION */
9811 e = 0;
9812 e |= DIO_BV_PUT(&dout, &field_addr, fields);
9813 if (e) {
9814 log_packet_detailed("fields bitvector error detected");
9815 }
9816
9817 if (BV_ISSET(fields, 0)) {
9818 log_packet_detailed(" field 'positive_year_label' has changed");
9819#ifdef FREECIV_JSON_CONNECTION
9820 field_addr.name = "positive_year_label";
9821#endif /* FREECIV_JSON_CONNECTION */
9822 e = 0;
9823 e |= DIO_PUT(string, &dout, &field_addr, real_packet->positive_year_label);
9824 if (e) {
9825 log_packet_detailed("'positive_year_label' field error detected");
9826 }
9827 }
9828 if (BV_ISSET(fields, 1)) {
9829 log_packet_detailed(" field 'negative_year_label' has changed");
9830#ifdef FREECIV_JSON_CONNECTION
9831 field_addr.name = "negative_year_label";
9832#endif /* FREECIV_JSON_CONNECTION */
9833 e = 0;
9834 e |= DIO_PUT(string, &dout, &field_addr, real_packet->negative_year_label);
9835 if (e) {
9836 log_packet_detailed("'negative_year_label' field error detected");
9837 }
9838 }
9839 if (BV_ISSET(fields, 2)) {
9840 log_packet_detailed(" field 'calendar_fragments' has changed");
9841#ifdef FREECIV_JSON_CONNECTION
9842 field_addr.name = "calendar_fragments";
9843#endif /* FREECIV_JSON_CONNECTION */
9844 e = 0;
9845 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->calendar_fragments);
9846 if (e) {
9847 log_packet_detailed("'calendar_fragments' field error detected");
9848 }
9849 }
9850 if (BV_ISSET(fields, 3)) {
9851 log_packet_detailed(" field 'calendar_fragment_name' has changed");
9852#ifdef FREECIV_JSON_CONNECTION
9853 field_addr.name = "calendar_fragment_name";
9854#endif /* FREECIV_JSON_CONNECTION */
9855 e = 0;
9856 {
9857 int i;
9858
9859#ifdef FREECIV_JSON_CONNECTION
9860 /* Create the array. */
9861 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CALENDAR_FRAGMENTS);
9862
9863 /* Enter the array. */
9864 field_addr.sub_location = plocation_elem_new(0);
9865#endif /* FREECIV_JSON_CONNECTION */
9866
9867 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9868#ifdef FREECIV_JSON_CONNECTION
9869 /* Next array element. */
9870 field_addr.sub_location->number = i;
9871#endif /* FREECIV_JSON_CONNECTION */
9872 e |= DIO_PUT(string, &dout, &field_addr, real_packet->calendar_fragment_name[i]);
9873 }
9874
9875#ifdef FREECIV_JSON_CONNECTION
9876 /* Exit array. */
9877 FC_FREE(field_addr.sub_location);
9878#endif /* FREECIV_JSON_CONNECTION */
9879 }
9880 if (e) {
9881 log_packet_detailed("'calendar_fragment_name' field error detected");
9882 }
9883 }
9884 /* field 4 is folded into the header */
9885
9886 *old = *real_packet;
9887#endif /* FREECIV_DELTA_PROTOCOL */
9888#ifndef FREECIV_DELTA_PROTOCOL
9889#ifdef FREECIV_JSON_CONNECTION
9890 field_addr.name = "positive_year_label";
9891#endif /* FREECIV_JSON_CONNECTION */
9892 e = 0;
9893 e |= DIO_PUT(string, &dout, &field_addr, real_packet->positive_year_label);
9894 if (e) {
9895 log_packet_detailed("'positive_year_label' field error detected");
9896 }
9897#ifdef FREECIV_JSON_CONNECTION
9898 field_addr.name = "negative_year_label";
9899#endif /* FREECIV_JSON_CONNECTION */
9900 e = 0;
9901 e |= DIO_PUT(string, &dout, &field_addr, real_packet->negative_year_label);
9902 if (e) {
9903 log_packet_detailed("'negative_year_label' field error detected");
9904 }
9905#ifdef FREECIV_JSON_CONNECTION
9906 field_addr.name = "calendar_fragments";
9907#endif /* FREECIV_JSON_CONNECTION */
9908 e = 0;
9909 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->calendar_fragments);
9910 if (e) {
9911 log_packet_detailed("'calendar_fragments' field error detected");
9912 }
9913#ifdef FREECIV_JSON_CONNECTION
9914 field_addr.name = "calendar_fragment_name";
9915#endif /* FREECIV_JSON_CONNECTION */
9916 e = 0;
9917 {
9918 int i;
9919
9920#ifdef FREECIV_JSON_CONNECTION
9921 /* Create the array. */
9922 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CALENDAR_FRAGMENTS);
9923
9924 /* Enter the array. */
9925 field_addr.sub_location = plocation_elem_new(0);
9926#endif /* FREECIV_JSON_CONNECTION */
9927
9928 for (i = 0; i < MAX_CALENDAR_FRAGMENTS; i++) {
9929#ifdef FREECIV_JSON_CONNECTION
9930 /* Next array element. */
9931 field_addr.sub_location->number = i;
9932#endif /* FREECIV_JSON_CONNECTION */
9933 e |= DIO_PUT(string, &dout, &field_addr, real_packet->calendar_fragment_name[i]);
9934 }
9935
9936#ifdef FREECIV_JSON_CONNECTION
9937 /* Exit array. */
9938 FC_FREE(field_addr.sub_location);
9939#endif /* FREECIV_JSON_CONNECTION */
9940 }
9941 if (e) {
9942 log_packet_detailed("'calendar_fragment_name' field error detected");
9943 }
9944#ifdef FREECIV_JSON_CONNECTION
9945 field_addr.name = "calendar_skip_0";
9946#endif /* FREECIV_JSON_CONNECTION */
9947 e = 0;
9948 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->calendar_skip_0);
9949 if (e) {
9950 log_packet_detailed("'calendar_skip_0' field error detected");
9951 }
9952
9953#endif
9954 SEND_PACKET_END(PACKET_CALENDAR_INFO);
9955}
9956
9957 int send_packet_calendar_info(struct connection *pc, const struct packet_calendar_info *packet)
9958{
9959 if (!pc->used) {
9960 log_error("WARNING: trying to send data to the closed connection %s",
9961 conn_description(pc));
9962 return -1;
9963 }
9964 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CALENDAR_INFO].packet != NULL, -1,
9965 "Handler for PACKET_CALENDAR_INFO not installed");
9966 return pc->phs.handlers->send[PACKET_CALENDAR_INFO].packet(pc, packet);
9967}
9968
9969#ifdef FREECIV_DELTA_PROTOCOL
9970#define hash_packet_timeout_info_100 hash_const
9971
9972#define cmp_packet_timeout_info_100 cmp_const
9973
9974 BV_DEFINE(packet_timeout_info_100_fields, 2);
9975#endif /* FREECIV_DELTA_PROTOCOL */
9976
9977 static struct packet_timeout_info *receive_packet_timeout_info_100(struct connection *pc)
9978{
9979#ifdef FREECIV_DELTA_PROTOCOL
9980 packet_timeout_info_100_fields fields;
9981 struct packet_timeout_info *old;
9982 struct genhash **hash = pc->phs.received + PACKET_TIMEOUT_INFO;
9983#endif /* FREECIV_DELTA_PROTOCOL */
9984 RECEIVE_PACKET_START(packet_timeout_info, real_packet);
9985#ifdef FREECIV_JSON_CONNECTION
9986 struct plocation field_addr;
9987 {
9988 struct plocation *field_addr_tmp = plocation_field_new(NULL);
9989 field_addr = *field_addr_tmp;
9990 FC_FREE(field_addr_tmp);
9991 }
9992#endif /* FREECIV_JSON_CONNECTION */
9993
9994#ifdef FREECIV_DELTA_PROTOCOL
9995#ifdef FREECIV_JSON_CONNECTION
9996 field_addr.name = "fields";
9997#endif /* FREECIV_JSON_CONNECTION */
9998 DIO_BV_GET(&din, &field_addr, fields);
9999
10000#else /* FREECIV_DELTA_PROTOCOL */
10001#ifdef FREECIV_JSON_CONNECTION
10002 field_addr.name = "seconds_to_phasedone";
10003#endif /* FREECIV_JSON_CONNECTION */
10004 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->seconds_to_phasedone, 100)) {
10005 RECEIVE_PACKET_FIELD_ERROR(seconds_to_phasedone);
10006 }
10007#ifdef FREECIV_JSON_CONNECTION
10008 field_addr.name = "last_turn_change_time";
10009#endif /* FREECIV_JSON_CONNECTION */
10010 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->last_turn_change_time, 100)) {
10011 RECEIVE_PACKET_FIELD_ERROR(last_turn_change_time);
10012 }
10013#endif
10014 log_packet_detailed("packet_timeout_info_100: got info about ()");
10015
10016#ifdef FREECIV_DELTA_PROTOCOL
10017 if (NULL == *hash) {
10018 *hash = genhash_new_full(hash_packet_timeout_info_100, cmp_packet_timeout_info_100,
10019 NULL, NULL, NULL, free);
10020 }
10021
10022 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10023 *real_packet = *old;
10024 } else {
10025 log_packet_detailed(" no old info");
10026 memset(real_packet, 0, sizeof(*real_packet));
10027 }
10028
10029 if (BV_ISSET(fields, 0)) {
10030 log_packet_detailed(" got field 'seconds_to_phasedone'");
10031#ifdef FREECIV_JSON_CONNECTION
10032 field_addr.name = "seconds_to_phasedone";
10033#endif /* FREECIV_JSON_CONNECTION */
10034 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->seconds_to_phasedone, 100)) {
10035 RECEIVE_PACKET_FIELD_ERROR(seconds_to_phasedone);
10036 }
10037 }
10038 if (BV_ISSET(fields, 1)) {
10039 log_packet_detailed(" got field 'last_turn_change_time'");
10040#ifdef FREECIV_JSON_CONNECTION
10041 field_addr.name = "last_turn_change_time";
10042#endif /* FREECIV_JSON_CONNECTION */
10043 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->last_turn_change_time, 100)) {
10044 RECEIVE_PACKET_FIELD_ERROR(last_turn_change_time);
10045 }
10046 }
10047
10048 if (NULL == old) {
10049 old = fc_malloc(sizeof(*old));
10050 *old = *real_packet;
10051 genhash_insert(*hash, old, old);
10052 } else {
10053 *old = *real_packet;
10054 }
10055
10056#endif /* FREECIV_DELTA_PROTOCOL */
10057 RECEIVE_PACKET_END(real_packet);
10058}
10059
10060 static int send_packet_timeout_info_100(struct connection *pc, const struct packet_timeout_info *packet)
10061{
10062 const struct packet_timeout_info *real_packet = packet;
10063 int e;
10064#ifdef FREECIV_DELTA_PROTOCOL
10065 packet_timeout_info_100_fields fields;
10066 struct packet_timeout_info *old;
10067 bool differ;
10068 struct genhash **hash = pc->phs.sent + PACKET_TIMEOUT_INFO;
10069#endif /* FREECIV_DELTA_PROTOCOL */
10070 SEND_PACKET_START(PACKET_TIMEOUT_INFO);
10071#ifdef FREECIV_JSON_CONNECTION
10072 struct plocation field_addr;
10073 {
10074 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10075 field_addr = *field_addr_tmp;
10076 FC_FREE(field_addr_tmp);
10077 }
10078#endif /* FREECIV_JSON_CONNECTION */
10079
10080 log_packet_detailed("packet_timeout_info_100: sending info about ()");
10081
10082#ifdef FREECIV_DELTA_PROTOCOL
10083 if (NULL == *hash) {
10084 *hash = genhash_new_full(hash_packet_timeout_info_100, cmp_packet_timeout_info_100,
10085 NULL, NULL, NULL, free);
10086 }
10087 BV_CLR_ALL(fields);
10088
10089 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10090 old = fc_malloc(sizeof(*old));
10091 *old = *real_packet;
10092 genhash_insert(*hash, old, old);
10093 memset(old, 0, sizeof(*old));
10094 }
10095 differ = (old->seconds_to_phasedone != real_packet->seconds_to_phasedone);
10096 if (differ) {
10097 BV_SET(fields, 0);
10098 }
10099
10100 differ = (old->last_turn_change_time != real_packet->last_turn_change_time);
10101 if (differ) {
10102 BV_SET(fields, 1);
10103 }
10104
10105
10106#ifdef FREECIV_JSON_CONNECTION
10107 field_addr.name = "fields";
10108#endif /* FREECIV_JSON_CONNECTION */
10109 e = 0;
10110 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10111 if (e) {
10112 log_packet_detailed("fields bitvector error detected");
10113 }
10114
10115 if (BV_ISSET(fields, 0)) {
10116 log_packet_detailed(" field 'seconds_to_phasedone' has changed");
10117#ifdef FREECIV_JSON_CONNECTION
10118 field_addr.name = "seconds_to_phasedone";
10119#endif /* FREECIV_JSON_CONNECTION */
10120 e = 0;
10121 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->seconds_to_phasedone, 100);
10122 if (e) {
10123 log_packet_detailed("'seconds_to_phasedone' field error detected");
10124 }
10125 }
10126 if (BV_ISSET(fields, 1)) {
10127 log_packet_detailed(" field 'last_turn_change_time' has changed");
10128#ifdef FREECIV_JSON_CONNECTION
10129 field_addr.name = "last_turn_change_time";
10130#endif /* FREECIV_JSON_CONNECTION */
10131 e = 0;
10132 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->last_turn_change_time, 100);
10133 if (e) {
10134 log_packet_detailed("'last_turn_change_time' field error detected");
10135 }
10136 }
10137
10138 *old = *real_packet;
10139#endif /* FREECIV_DELTA_PROTOCOL */
10140#ifndef FREECIV_DELTA_PROTOCOL
10141#ifdef FREECIV_JSON_CONNECTION
10142 field_addr.name = "seconds_to_phasedone";
10143#endif /* FREECIV_JSON_CONNECTION */
10144 e = 0;
10145 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->seconds_to_phasedone, 100);
10146 if (e) {
10147 log_packet_detailed("'seconds_to_phasedone' field error detected");
10148 }
10149#ifdef FREECIV_JSON_CONNECTION
10150 field_addr.name = "last_turn_change_time";
10151#endif /* FREECIV_JSON_CONNECTION */
10152 e = 0;
10153 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->last_turn_change_time, 100);
10154 if (e) {
10155 log_packet_detailed("'last_turn_change_time' field error detected");
10156 }
10157
10158#endif
10159 SEND_PACKET_END(PACKET_TIMEOUT_INFO);
10160}
10161
10162 int send_packet_timeout_info(struct connection *pc, const struct packet_timeout_info *packet)
10163{
10164 if (!pc->used) {
10165 log_error("WARNING: trying to send data to the closed connection %s",
10166 conn_description(pc));
10167 return -1;
10168 }
10169 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TIMEOUT_INFO].packet != NULL, -1,
10170 "Handler for PACKET_TIMEOUT_INFO not installed");
10171 return pc->phs.handlers->send[PACKET_TIMEOUT_INFO].packet(pc, packet);
10172}
10173
10174#ifdef FREECIV_DELTA_PROTOCOL
10175#define hash_packet_map_info_100 hash_const
10176
10177#define cmp_packet_map_info_100 cmp_const
10178
10179 BV_DEFINE(packet_map_info_100_fields, 6);
10180#endif /* FREECIV_DELTA_PROTOCOL */
10181
10182 static struct packet_map_info *receive_packet_map_info_100(struct connection *pc)
10183{
10184#ifdef FREECIV_DELTA_PROTOCOL
10185 packet_map_info_100_fields fields;
10186 struct packet_map_info *old;
10187 struct genhash **hash = pc->phs.received + PACKET_MAP_INFO;
10188#endif /* FREECIV_DELTA_PROTOCOL */
10189 RECEIVE_PACKET_START(packet_map_info, real_packet);
10190#ifdef FREECIV_JSON_CONNECTION
10191 struct plocation field_addr;
10192 {
10193 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10194 field_addr = *field_addr_tmp;
10195 FC_FREE(field_addr_tmp);
10196 }
10197#endif /* FREECIV_JSON_CONNECTION */
10198
10199#ifdef FREECIV_DELTA_PROTOCOL
10200#ifdef FREECIV_JSON_CONNECTION
10201 field_addr.name = "fields";
10202#endif /* FREECIV_JSON_CONNECTION */
10203 DIO_BV_GET(&din, &field_addr, fields);
10204
10205#else /* FREECIV_DELTA_PROTOCOL */
10206#ifdef FREECIV_JSON_CONNECTION
10207 field_addr.name = "xsize";
10208#endif /* FREECIV_JSON_CONNECTION */
10209 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->xsize)) {
10210 RECEIVE_PACKET_FIELD_ERROR(xsize);
10211 }
10212#ifdef FREECIV_JSON_CONNECTION
10213 field_addr.name = "ysize";
10214#endif /* FREECIV_JSON_CONNECTION */
10215 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ysize)) {
10216 RECEIVE_PACKET_FIELD_ERROR(ysize);
10217 }
10218#ifdef FREECIV_JSON_CONNECTION
10219 field_addr.name = "topology_id";
10220#endif /* FREECIV_JSON_CONNECTION */
10221 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
10222 RECEIVE_PACKET_FIELD_ERROR(topology_id);
10223 }
10224#ifdef FREECIV_JSON_CONNECTION
10225 field_addr.name = "wrap_id";
10226#endif /* FREECIV_JSON_CONNECTION */
10227 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
10228 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
10229 }
10230#ifdef FREECIV_JSON_CONNECTION
10231 field_addr.name = "north_latitude";
10232#endif /* FREECIV_JSON_CONNECTION */
10233 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->north_latitude)) {
10234 RECEIVE_PACKET_FIELD_ERROR(north_latitude);
10235 }
10236#ifdef FREECIV_JSON_CONNECTION
10237 field_addr.name = "south_latitude";
10238#endif /* FREECIV_JSON_CONNECTION */
10239 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->south_latitude)) {
10240 RECEIVE_PACKET_FIELD_ERROR(south_latitude);
10241 }
10242#endif
10243 log_packet_detailed("packet_map_info_100: got info about ()");
10244
10245#ifdef FREECIV_DELTA_PROTOCOL
10246 if (NULL == *hash) {
10247 *hash = genhash_new_full(hash_packet_map_info_100, cmp_packet_map_info_100,
10248 NULL, NULL, NULL, free);
10249 }
10250
10251 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10252 *real_packet = *old;
10253 } else {
10254 log_packet_detailed(" no old info");
10255 memset(real_packet, 0, sizeof(*real_packet));
10256 }
10257
10258 if (BV_ISSET(fields, 0)) {
10259 log_packet_detailed(" got field 'xsize'");
10260#ifdef FREECIV_JSON_CONNECTION
10261 field_addr.name = "xsize";
10262#endif /* FREECIV_JSON_CONNECTION */
10263 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->xsize)) {
10264 RECEIVE_PACKET_FIELD_ERROR(xsize);
10265 }
10266 }
10267 if (BV_ISSET(fields, 1)) {
10268 log_packet_detailed(" got field 'ysize'");
10269#ifdef FREECIV_JSON_CONNECTION
10270 field_addr.name = "ysize";
10271#endif /* FREECIV_JSON_CONNECTION */
10272 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ysize)) {
10273 RECEIVE_PACKET_FIELD_ERROR(ysize);
10274 }
10275 }
10276 if (BV_ISSET(fields, 2)) {
10277 log_packet_detailed(" got field 'topology_id'");
10278#ifdef FREECIV_JSON_CONNECTION
10279 field_addr.name = "topology_id";
10280#endif /* FREECIV_JSON_CONNECTION */
10281 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
10282 RECEIVE_PACKET_FIELD_ERROR(topology_id);
10283 }
10284 }
10285 if (BV_ISSET(fields, 3)) {
10286 log_packet_detailed(" got field 'wrap_id'");
10287#ifdef FREECIV_JSON_CONNECTION
10288 field_addr.name = "wrap_id";
10289#endif /* FREECIV_JSON_CONNECTION */
10290 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
10291 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
10292 }
10293 }
10294 if (BV_ISSET(fields, 4)) {
10295 log_packet_detailed(" got field 'north_latitude'");
10296#ifdef FREECIV_JSON_CONNECTION
10297 field_addr.name = "north_latitude";
10298#endif /* FREECIV_JSON_CONNECTION */
10299 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->north_latitude)) {
10300 RECEIVE_PACKET_FIELD_ERROR(north_latitude);
10301 }
10302 }
10303 if (BV_ISSET(fields, 5)) {
10304 log_packet_detailed(" got field 'south_latitude'");
10305#ifdef FREECIV_JSON_CONNECTION
10306 field_addr.name = "south_latitude";
10307#endif /* FREECIV_JSON_CONNECTION */
10308 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->south_latitude)) {
10309 RECEIVE_PACKET_FIELD_ERROR(south_latitude);
10310 }
10311 }
10312
10313 if (NULL == old) {
10314 old = fc_malloc(sizeof(*old));
10315 *old = *real_packet;
10316 genhash_insert(*hash, old, old);
10317 } else {
10318 *old = *real_packet;
10319 }
10320
10321#endif /* FREECIV_DELTA_PROTOCOL */
10322 RECEIVE_PACKET_END(real_packet);
10323}
10324
10325 static int send_packet_map_info_100(struct connection *pc, const struct packet_map_info *packet)
10326{
10327 const struct packet_map_info *real_packet = packet;
10328 int e;
10329#ifdef FREECIV_DELTA_PROTOCOL
10330 packet_map_info_100_fields fields;
10331 struct packet_map_info *old;
10332 bool differ;
10333 struct genhash **hash = pc->phs.sent + PACKET_MAP_INFO;
10334#endif /* FREECIV_DELTA_PROTOCOL */
10335 SEND_PACKET_START(PACKET_MAP_INFO);
10336#ifdef FREECIV_JSON_CONNECTION
10337 struct plocation field_addr;
10338 {
10339 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10340 field_addr = *field_addr_tmp;
10341 FC_FREE(field_addr_tmp);
10342 }
10343#endif /* FREECIV_JSON_CONNECTION */
10344
10345 log_packet_detailed("packet_map_info_100: sending info about ()");
10346
10347#ifdef FREECIV_DELTA_PROTOCOL
10348 if (NULL == *hash) {
10349 *hash = genhash_new_full(hash_packet_map_info_100, cmp_packet_map_info_100,
10350 NULL, NULL, NULL, free);
10351 }
10352 BV_CLR_ALL(fields);
10353
10354 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10355 old = fc_malloc(sizeof(*old));
10356 *old = *real_packet;
10357 genhash_insert(*hash, old, old);
10358 memset(old, 0, sizeof(*old));
10359 }
10360 differ = (old->xsize != real_packet->xsize);
10361 if (differ) {
10362 BV_SET(fields, 0);
10363 }
10364
10365 differ = (old->ysize != real_packet->ysize);
10366 if (differ) {
10367 BV_SET(fields, 1);
10368 }
10369
10370 differ = (old->topology_id != real_packet->topology_id);
10371 if (differ) {
10372 BV_SET(fields, 2);
10373 }
10374
10375 differ = (old->wrap_id != real_packet->wrap_id);
10376 if (differ) {
10377 BV_SET(fields, 3);
10378 }
10379
10380 differ = (old->north_latitude != real_packet->north_latitude);
10381 if (differ) {
10382 BV_SET(fields, 4);
10383 }
10384
10385 differ = (old->south_latitude != real_packet->south_latitude);
10386 if (differ) {
10387 BV_SET(fields, 5);
10388 }
10389
10390
10391#ifdef FREECIV_JSON_CONNECTION
10392 field_addr.name = "fields";
10393#endif /* FREECIV_JSON_CONNECTION */
10394 e = 0;
10395 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10396 if (e) {
10397 log_packet_detailed("fields bitvector error detected");
10398 }
10399
10400 if (BV_ISSET(fields, 0)) {
10401 log_packet_detailed(" field 'xsize' has changed");
10402#ifdef FREECIV_JSON_CONNECTION
10403 field_addr.name = "xsize";
10404#endif /* FREECIV_JSON_CONNECTION */
10405 e = 0;
10406 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->xsize);
10407 if (e) {
10408 log_packet_detailed("'xsize' field error detected");
10409 }
10410 }
10411 if (BV_ISSET(fields, 1)) {
10412 log_packet_detailed(" field 'ysize' has changed");
10413#ifdef FREECIV_JSON_CONNECTION
10414 field_addr.name = "ysize";
10415#endif /* FREECIV_JSON_CONNECTION */
10416 e = 0;
10417 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ysize);
10418 if (e) {
10419 log_packet_detailed("'ysize' field error detected");
10420 }
10421 }
10422 if (BV_ISSET(fields, 2)) {
10423 log_packet_detailed(" field 'topology_id' has changed");
10424#ifdef FREECIV_JSON_CONNECTION
10425 field_addr.name = "topology_id";
10426#endif /* FREECIV_JSON_CONNECTION */
10427 e = 0;
10428 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
10429 if (e) {
10430 log_packet_detailed("'topology_id' field error detected");
10431 }
10432 }
10433 if (BV_ISSET(fields, 3)) {
10434 log_packet_detailed(" field 'wrap_id' has changed");
10435#ifdef FREECIV_JSON_CONNECTION
10436 field_addr.name = "wrap_id";
10437#endif /* FREECIV_JSON_CONNECTION */
10438 e = 0;
10439 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
10440 if (e) {
10441 log_packet_detailed("'wrap_id' field error detected");
10442 }
10443 }
10444 if (BV_ISSET(fields, 4)) {
10445 log_packet_detailed(" field 'north_latitude' has changed");
10446#ifdef FREECIV_JSON_CONNECTION
10447 field_addr.name = "north_latitude";
10448#endif /* FREECIV_JSON_CONNECTION */
10449 e = 0;
10450 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->north_latitude);
10451 if (e) {
10452 log_packet_detailed("'north_latitude' field error detected");
10453 }
10454 }
10455 if (BV_ISSET(fields, 5)) {
10456 log_packet_detailed(" field 'south_latitude' has changed");
10457#ifdef FREECIV_JSON_CONNECTION
10458 field_addr.name = "south_latitude";
10459#endif /* FREECIV_JSON_CONNECTION */
10460 e = 0;
10461 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->south_latitude);
10462 if (e) {
10463 log_packet_detailed("'south_latitude' field error detected");
10464 }
10465 }
10466
10467 *old = *real_packet;
10468#endif /* FREECIV_DELTA_PROTOCOL */
10469#ifndef FREECIV_DELTA_PROTOCOL
10470#ifdef FREECIV_JSON_CONNECTION
10471 field_addr.name = "xsize";
10472#endif /* FREECIV_JSON_CONNECTION */
10473 e = 0;
10474 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->xsize);
10475 if (e) {
10476 log_packet_detailed("'xsize' field error detected");
10477 }
10478#ifdef FREECIV_JSON_CONNECTION
10479 field_addr.name = "ysize";
10480#endif /* FREECIV_JSON_CONNECTION */
10481 e = 0;
10482 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ysize);
10483 if (e) {
10484 log_packet_detailed("'ysize' field error detected");
10485 }
10486#ifdef FREECIV_JSON_CONNECTION
10487 field_addr.name = "topology_id";
10488#endif /* FREECIV_JSON_CONNECTION */
10489 e = 0;
10490 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
10491 if (e) {
10492 log_packet_detailed("'topology_id' field error detected");
10493 }
10494#ifdef FREECIV_JSON_CONNECTION
10495 field_addr.name = "wrap_id";
10496#endif /* FREECIV_JSON_CONNECTION */
10497 e = 0;
10498 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
10499 if (e) {
10500 log_packet_detailed("'wrap_id' field error detected");
10501 }
10502#ifdef FREECIV_JSON_CONNECTION
10503 field_addr.name = "north_latitude";
10504#endif /* FREECIV_JSON_CONNECTION */
10505 e = 0;
10506 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->north_latitude);
10507 if (e) {
10508 log_packet_detailed("'north_latitude' field error detected");
10509 }
10510#ifdef FREECIV_JSON_CONNECTION
10511 field_addr.name = "south_latitude";
10512#endif /* FREECIV_JSON_CONNECTION */
10513 e = 0;
10514 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->south_latitude);
10515 if (e) {
10516 log_packet_detailed("'south_latitude' field error detected");
10517 }
10518
10519#endif
10520 SEND_PACKET_END(PACKET_MAP_INFO);
10521}
10522
10523 int send_packet_map_info(struct connection *pc, const struct packet_map_info *packet)
10524{
10525 if (!pc->used) {
10526 log_error("WARNING: trying to send data to the closed connection %s",
10527 conn_description(pc));
10528 return -1;
10529 }
10530 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_MAP_INFO].packet != NULL, -1,
10531 "Handler for PACKET_MAP_INFO not installed");
10532 return pc->phs.handlers->send[PACKET_MAP_INFO].packet(pc, packet);
10533}
10534
10535 void lsend_packet_map_info(struct conn_list *dest, const struct packet_map_info *packet)
10536{
10537 conn_list_iterate(dest, pconn) {
10538 send_packet_map_info(pconn, packet);
10539 } conn_list_iterate_end;
10540}
10541
10542#ifdef FREECIV_DELTA_PROTOCOL
10543#define hash_packet_nuke_tile_info_100 hash_const
10544
10545#define cmp_packet_nuke_tile_info_100 cmp_const
10546
10547 BV_DEFINE(packet_nuke_tile_info_100_fields, 1);
10548#endif /* FREECIV_DELTA_PROTOCOL */
10549
10550 static struct packet_nuke_tile_info *receive_packet_nuke_tile_info_100(struct connection *pc)
10551{
10552#ifdef FREECIV_DELTA_PROTOCOL
10553 packet_nuke_tile_info_100_fields fields;
10554 struct packet_nuke_tile_info *old;
10555 struct genhash **hash = pc->phs.received + PACKET_NUKE_TILE_INFO;
10556#endif /* FREECIV_DELTA_PROTOCOL */
10557 RECEIVE_PACKET_START(packet_nuke_tile_info, real_packet);
10558#ifdef FREECIV_JSON_CONNECTION
10559 struct plocation field_addr;
10560 {
10561 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10562 field_addr = *field_addr_tmp;
10563 FC_FREE(field_addr_tmp);
10564 }
10565#endif /* FREECIV_JSON_CONNECTION */
10566
10567#ifdef FREECIV_DELTA_PROTOCOL
10568#ifdef FREECIV_JSON_CONNECTION
10569 field_addr.name = "fields";
10570#endif /* FREECIV_JSON_CONNECTION */
10571 DIO_BV_GET(&din, &field_addr, fields);
10572
10573#else /* FREECIV_DELTA_PROTOCOL */
10574#ifdef FREECIV_JSON_CONNECTION
10575 field_addr.name = "tile";
10576#endif /* FREECIV_JSON_CONNECTION */
10577 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10578 RECEIVE_PACKET_FIELD_ERROR(tile);
10579 }
10580#endif
10581 log_packet_detailed("packet_nuke_tile_info_100: got info about ()");
10582
10583#ifdef FREECIV_DELTA_PROTOCOL
10584 if (NULL == *hash) {
10585 *hash = genhash_new_full(hash_packet_nuke_tile_info_100, cmp_packet_nuke_tile_info_100,
10586 NULL, NULL, NULL, free);
10587 }
10588
10589 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10590 *real_packet = *old;
10591 } else {
10592 log_packet_detailed(" no old info");
10593 memset(real_packet, 0, sizeof(*real_packet));
10594 }
10595
10596 if (BV_ISSET(fields, 0)) {
10597 log_packet_detailed(" got field 'tile'");
10598#ifdef FREECIV_JSON_CONNECTION
10599 field_addr.name = "tile";
10600#endif /* FREECIV_JSON_CONNECTION */
10601 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
10602 RECEIVE_PACKET_FIELD_ERROR(tile);
10603 }
10604 }
10605
10606 if (NULL == old) {
10607 old = fc_malloc(sizeof(*old));
10608 *old = *real_packet;
10609 genhash_insert(*hash, old, old);
10610 } else {
10611 *old = *real_packet;
10612 }
10613
10614#endif /* FREECIV_DELTA_PROTOCOL */
10615 RECEIVE_PACKET_END(real_packet);
10616}
10617
10618 static int send_packet_nuke_tile_info_100(struct connection *pc, const struct packet_nuke_tile_info *packet)
10619{
10620 const struct packet_nuke_tile_info *real_packet = packet;
10621 int e;
10622#ifdef FREECIV_DELTA_PROTOCOL
10623 packet_nuke_tile_info_100_fields fields;
10624 struct packet_nuke_tile_info *old;
10625 bool differ;
10626 struct genhash **hash = pc->phs.sent + PACKET_NUKE_TILE_INFO;
10627#endif /* FREECIV_DELTA_PROTOCOL */
10628 SEND_PACKET_START(PACKET_NUKE_TILE_INFO);
10629#ifdef FREECIV_JSON_CONNECTION
10630 struct plocation field_addr;
10631 {
10632 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10633 field_addr = *field_addr_tmp;
10634 FC_FREE(field_addr_tmp);
10635 }
10636#endif /* FREECIV_JSON_CONNECTION */
10637
10638 log_packet_detailed("packet_nuke_tile_info_100: sending info about ()");
10639
10640#ifdef FREECIV_DELTA_PROTOCOL
10641 if (NULL == *hash) {
10642 *hash = genhash_new_full(hash_packet_nuke_tile_info_100, cmp_packet_nuke_tile_info_100,
10643 NULL, NULL, NULL, free);
10644 }
10645 BV_CLR_ALL(fields);
10646
10647 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10648 old = fc_malloc(sizeof(*old));
10649 *old = *real_packet;
10650 genhash_insert(*hash, old, old);
10651 memset(old, 0, sizeof(*old));
10652 }
10653 differ = (old->tile != real_packet->tile);
10654 if (differ) {
10655 BV_SET(fields, 0);
10656 }
10657
10658
10659#ifdef FREECIV_JSON_CONNECTION
10660 field_addr.name = "fields";
10661#endif /* FREECIV_JSON_CONNECTION */
10662 e = 0;
10663 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10664 if (e) {
10665 log_packet_detailed("fields bitvector error detected");
10666 }
10667
10668 if (BV_ISSET(fields, 0)) {
10669 log_packet_detailed(" field 'tile' has changed");
10670#ifdef FREECIV_JSON_CONNECTION
10671 field_addr.name = "tile";
10672#endif /* FREECIV_JSON_CONNECTION */
10673 e = 0;
10674 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10675 if (e) {
10676 log_packet_detailed("'tile' field error detected");
10677 }
10678 }
10679
10680 *old = *real_packet;
10681#endif /* FREECIV_DELTA_PROTOCOL */
10682#ifndef FREECIV_DELTA_PROTOCOL
10683#ifdef FREECIV_JSON_CONNECTION
10684 field_addr.name = "tile";
10685#endif /* FREECIV_JSON_CONNECTION */
10686 e = 0;
10687 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
10688 if (e) {
10689 log_packet_detailed("'tile' field error detected");
10690 }
10691
10692#endif
10693 SEND_PACKET_END(PACKET_NUKE_TILE_INFO);
10694}
10695
10696 int send_packet_nuke_tile_info(struct connection *pc, const struct packet_nuke_tile_info *packet)
10697{
10698 if (!pc->used) {
10699 log_error("WARNING: trying to send data to the closed connection %s",
10700 conn_description(pc));
10701 return -1;
10702 }
10703 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NUKE_TILE_INFO].packet != NULL, -1,
10704 "Handler for PACKET_NUKE_TILE_INFO not installed");
10705 return pc->phs.handlers->send[PACKET_NUKE_TILE_INFO].packet(pc, packet);
10706}
10707
10708 void lsend_packet_nuke_tile_info(struct conn_list *dest, const struct packet_nuke_tile_info *packet)
10709{
10710 conn_list_iterate(dest, pconn) {
10711 send_packet_nuke_tile_info(pconn, packet);
10712 } conn_list_iterate_end;
10713}
10714
10715 int dsend_packet_nuke_tile_info(struct connection *pc, int tile)
10716{
10717 struct packet_nuke_tile_info packet, *real_packet = &packet;
10718
10719 real_packet->tile = tile;
10720
10721 return send_packet_nuke_tile_info(pc, real_packet);
10722}
10723
10724 void dlsend_packet_nuke_tile_info(struct conn_list *dest, int tile)
10725{
10726 struct packet_nuke_tile_info packet, *real_packet = &packet;
10727
10728 real_packet->tile = tile;
10729
10730 lsend_packet_nuke_tile_info(dest, real_packet);
10731}
10732
10733#ifdef FREECIV_DELTA_PROTOCOL
10734static genhash_val_t hash_packet_team_name_info_100(const void *vkey)
10735{
10736 const struct packet_team_name_info *key = (const struct packet_team_name_info *) vkey;
10737 genhash_val_t result = 0;
10738
10739 result += key->team_id;
10740
10741 result &= 0xFFFFFFFF;
10742 return result;
10743}
10744
10745static bool cmp_packet_team_name_info_100(const void *vkey1, const void *vkey2)
10746{
10747 const struct packet_team_name_info *old = (const struct packet_team_name_info *) vkey1;
10748 const struct packet_team_name_info *real_packet = (const struct packet_team_name_info *) vkey2;
10749 bool differ;
10750
10751 differ = (old->team_id != real_packet->team_id);
10752
10753 return !differ;
10754}
10755 BV_DEFINE(packet_team_name_info_100_fields, 1);
10756#endif /* FREECIV_DELTA_PROTOCOL */
10757
10758 static struct packet_team_name_info *receive_packet_team_name_info_100(struct connection *pc)
10759{
10760#ifdef FREECIV_DELTA_PROTOCOL
10761 packet_team_name_info_100_fields fields;
10762 struct packet_team_name_info *old;
10763 struct genhash **hash = pc->phs.received + PACKET_TEAM_NAME_INFO;
10764#endif /* FREECIV_DELTA_PROTOCOL */
10765 RECEIVE_PACKET_START(packet_team_name_info, real_packet);
10766#ifdef FREECIV_JSON_CONNECTION
10767 struct plocation field_addr;
10768 {
10769 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10770 field_addr = *field_addr_tmp;
10771 FC_FREE(field_addr_tmp);
10772 }
10773#endif /* FREECIV_JSON_CONNECTION */
10774
10775#ifdef FREECIV_DELTA_PROTOCOL
10776#ifdef FREECIV_JSON_CONNECTION
10777 field_addr.name = "fields";
10778#endif /* FREECIV_JSON_CONNECTION */
10779 DIO_BV_GET(&din, &field_addr, fields);
10780#ifdef FREECIV_JSON_CONNECTION
10781 field_addr.name = "team_id";
10782#endif /* FREECIV_JSON_CONNECTION */
10783 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team_id)) {
10784 RECEIVE_PACKET_FIELD_ERROR(team_id);
10785 }
10786
10787#else /* FREECIV_DELTA_PROTOCOL */
10788#ifdef FREECIV_JSON_CONNECTION
10789 field_addr.name = "team_id";
10790#endif /* FREECIV_JSON_CONNECTION */
10791 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team_id)) {
10792 RECEIVE_PACKET_FIELD_ERROR(team_id);
10793 }
10794#ifdef FREECIV_JSON_CONNECTION
10795 field_addr.name = "team_name";
10796#endif /* FREECIV_JSON_CONNECTION */
10797 if (!DIO_GET(string, &din, &field_addr, real_packet->team_name, sizeof(real_packet->team_name))) {
10798 RECEIVE_PACKET_FIELD_ERROR(team_name);
10799 }
10800#endif
10801 log_packet_detailed("packet_team_name_info_100: got info about (%d)",
10802 real_packet->team_id);
10803
10804#ifdef FREECIV_DELTA_PROTOCOL
10805 if (NULL == *hash) {
10806 *hash = genhash_new_full(hash_packet_team_name_info_100, cmp_packet_team_name_info_100,
10807 NULL, NULL, NULL, free);
10808 }
10809
10810 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
10811 *real_packet = *old;
10812 } else {
10813 int team_id;
10814
10815 team_id = real_packet->team_id;
10816
10817 log_packet_detailed(" no old info");
10818 memset(real_packet, 0, sizeof(*real_packet));
10819
10820 real_packet->team_id = team_id;
10821 }
10822
10823 if (BV_ISSET(fields, 0)) {
10824 log_packet_detailed(" got field 'team_name'");
10825#ifdef FREECIV_JSON_CONNECTION
10826 field_addr.name = "team_name";
10827#endif /* FREECIV_JSON_CONNECTION */
10828 if (!DIO_GET(string, &din, &field_addr, real_packet->team_name, sizeof(real_packet->team_name))) {
10829 RECEIVE_PACKET_FIELD_ERROR(team_name);
10830 }
10831 }
10832
10833 if (NULL == old) {
10834 old = fc_malloc(sizeof(*old));
10835 *old = *real_packet;
10836 genhash_insert(*hash, old, old);
10837 } else {
10838 *old = *real_packet;
10839 }
10840
10841#endif /* FREECIV_DELTA_PROTOCOL */
10842 RECEIVE_PACKET_END(real_packet);
10843}
10844
10845 static int send_packet_team_name_info_100(struct connection *pc, const struct packet_team_name_info *packet)
10846{
10847 const struct packet_team_name_info *real_packet = packet;
10848 int e;
10849#ifdef FREECIV_DELTA_PROTOCOL
10850 packet_team_name_info_100_fields fields;
10851 struct packet_team_name_info *old;
10852 bool differ;
10853 struct genhash **hash = pc->phs.sent + PACKET_TEAM_NAME_INFO;
10854#endif /* FREECIV_DELTA_PROTOCOL */
10855 SEND_PACKET_START(PACKET_TEAM_NAME_INFO);
10856#ifdef FREECIV_JSON_CONNECTION
10857 struct plocation field_addr;
10858 {
10859 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10860 field_addr = *field_addr_tmp;
10861 FC_FREE(field_addr_tmp);
10862 }
10863#endif /* FREECIV_JSON_CONNECTION */
10864
10865 log_packet_detailed("packet_team_name_info_100: sending info about (%d)",
10866 real_packet->team_id);
10867
10868#ifdef FREECIV_DELTA_PROTOCOL
10869 if (NULL == *hash) {
10870 *hash = genhash_new_full(hash_packet_team_name_info_100, cmp_packet_team_name_info_100,
10871 NULL, NULL, NULL, free);
10872 }
10873 BV_CLR_ALL(fields);
10874
10875 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
10876 old = fc_malloc(sizeof(*old));
10877 *old = *real_packet;
10878 genhash_insert(*hash, old, old);
10879 memset(old, 0, sizeof(*old));
10880 }
10881 differ = (strcmp(old->team_name, real_packet->team_name) != 0);
10882 if (differ) {
10883 BV_SET(fields, 0);
10884 }
10885
10886
10887#ifdef FREECIV_JSON_CONNECTION
10888 field_addr.name = "fields";
10889#endif /* FREECIV_JSON_CONNECTION */
10890 e = 0;
10891 e |= DIO_BV_PUT(&dout, &field_addr, fields);
10892 if (e) {
10893 log_packet_detailed("fields bitvector error detected");
10894 }
10895#ifdef FREECIV_JSON_CONNECTION
10896 field_addr.name = "team_id";
10897#endif /* FREECIV_JSON_CONNECTION */
10898 e = 0;
10899 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->team_id);
10900 if (e) {
10901 log_packet_detailed("'team_id' field error detected");
10902 }
10903
10904 if (BV_ISSET(fields, 0)) {
10905 log_packet_detailed(" field 'team_name' has changed");
10906#ifdef FREECIV_JSON_CONNECTION
10907 field_addr.name = "team_name";
10908#endif /* FREECIV_JSON_CONNECTION */
10909 e = 0;
10910 e |= DIO_PUT(string, &dout, &field_addr, real_packet->team_name);
10911 if (e) {
10912 log_packet_detailed("'team_name' field error detected");
10913 }
10914 }
10915
10916 *old = *real_packet;
10917#endif /* FREECIV_DELTA_PROTOCOL */
10918#ifndef FREECIV_DELTA_PROTOCOL
10919#ifdef FREECIV_JSON_CONNECTION
10920 field_addr.name = "team_id";
10921#endif /* FREECIV_JSON_CONNECTION */
10922 e = 0;
10923 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->team_id);
10924 if (e) {
10925 log_packet_detailed("'team_id' field error detected");
10926 }
10927#ifdef FREECIV_JSON_CONNECTION
10928 field_addr.name = "team_name";
10929#endif /* FREECIV_JSON_CONNECTION */
10930 e = 0;
10931 e |= DIO_PUT(string, &dout, &field_addr, real_packet->team_name);
10932 if (e) {
10933 log_packet_detailed("'team_name' field error detected");
10934 }
10935
10936#endif
10937 SEND_PACKET_END(PACKET_TEAM_NAME_INFO);
10938}
10939
10940 int send_packet_team_name_info(struct connection *pc, const struct packet_team_name_info *packet)
10941{
10942 if (!pc->used) {
10943 log_error("WARNING: trying to send data to the closed connection %s",
10944 conn_description(pc));
10945 return -1;
10946 }
10947 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TEAM_NAME_INFO].packet != NULL, -1,
10948 "Handler for PACKET_TEAM_NAME_INFO not installed");
10949 return pc->phs.handlers->send[PACKET_TEAM_NAME_INFO].packet(pc, packet);
10950}
10951
10952 void lsend_packet_team_name_info(struct conn_list *dest, const struct packet_team_name_info *packet)
10953{
10954 conn_list_iterate(dest, pconn) {
10955 send_packet_team_name_info(pconn, packet);
10956 } conn_list_iterate_end;
10957}
10958
10959#ifdef FREECIV_DELTA_PROTOCOL
10960#define hash_packet_achievement_info_100 hash_const
10961
10962#define cmp_packet_achievement_info_100 cmp_const
10963
10964 BV_DEFINE(packet_achievement_info_100_fields, 3);
10965#endif /* FREECIV_DELTA_PROTOCOL */
10966
10967 static struct packet_achievement_info *receive_packet_achievement_info_100(struct connection *pc)
10968{
10969#ifdef FREECIV_DELTA_PROTOCOL
10970 packet_achievement_info_100_fields fields;
10971 struct packet_achievement_info *old;
10972 struct genhash **hash = pc->phs.received + PACKET_ACHIEVEMENT_INFO;
10973#endif /* FREECIV_DELTA_PROTOCOL */
10974 RECEIVE_PACKET_START(packet_achievement_info, real_packet);
10975#ifdef FREECIV_JSON_CONNECTION
10976 struct plocation field_addr;
10977 {
10978 struct plocation *field_addr_tmp = plocation_field_new(NULL);
10979 field_addr = *field_addr_tmp;
10980 FC_FREE(field_addr_tmp);
10981 }
10982#endif /* FREECIV_JSON_CONNECTION */
10983
10984#ifdef FREECIV_DELTA_PROTOCOL
10985#ifdef FREECIV_JSON_CONNECTION
10986 field_addr.name = "fields";
10987#endif /* FREECIV_JSON_CONNECTION */
10988 DIO_BV_GET(&din, &field_addr, fields);
10989
10990#else /* FREECIV_DELTA_PROTOCOL */
10991#ifdef FREECIV_JSON_CONNECTION
10992 field_addr.name = "id";
10993#endif /* FREECIV_JSON_CONNECTION */
10994 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
10995 RECEIVE_PACKET_FIELD_ERROR(id);
10996 }
10997#ifdef FREECIV_JSON_CONNECTION
10998 field_addr.name = "gained";
10999#endif /* FREECIV_JSON_CONNECTION */
11000 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->gained)) {
11001 RECEIVE_PACKET_FIELD_ERROR(gained);
11002 }
11003#ifdef FREECIV_JSON_CONNECTION
11004 field_addr.name = "first";
11005#endif /* FREECIV_JSON_CONNECTION */
11006 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->first)) {
11007 RECEIVE_PACKET_FIELD_ERROR(first);
11008 }
11009#endif
11010 log_packet_detailed("packet_achievement_info_100: got info about ()");
11011
11012#ifdef FREECIV_DELTA_PROTOCOL
11013 if (NULL == *hash) {
11014 *hash = genhash_new_full(hash_packet_achievement_info_100, cmp_packet_achievement_info_100,
11015 NULL, NULL, NULL, free);
11016 }
11017
11018 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11019 *real_packet = *old;
11020 } else {
11021 log_packet_detailed(" no old info");
11022 memset(real_packet, 0, sizeof(*real_packet));
11023 }
11024
11025 if (BV_ISSET(fields, 0)) {
11026 log_packet_detailed(" got field 'id'");
11027#ifdef FREECIV_JSON_CONNECTION
11028 field_addr.name = "id";
11029#endif /* FREECIV_JSON_CONNECTION */
11030 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
11031 RECEIVE_PACKET_FIELD_ERROR(id);
11032 }
11033 }
11034 real_packet->gained = BV_ISSET(fields, 1);
11035 real_packet->first = BV_ISSET(fields, 2);
11036
11037 if (NULL == old) {
11038 old = fc_malloc(sizeof(*old));
11039 *old = *real_packet;
11040 genhash_insert(*hash, old, old);
11041 } else {
11042 *old = *real_packet;
11043 }
11044
11045#endif /* FREECIV_DELTA_PROTOCOL */
11046 RECEIVE_PACKET_END(real_packet);
11047}
11048
11049 static int send_packet_achievement_info_100(struct connection *pc, const struct packet_achievement_info *packet)
11050{
11051 const struct packet_achievement_info *real_packet = packet;
11052 int e;
11053#ifdef FREECIV_DELTA_PROTOCOL
11054 packet_achievement_info_100_fields fields;
11055 struct packet_achievement_info *old;
11056 bool differ;
11057 struct genhash **hash = pc->phs.sent + PACKET_ACHIEVEMENT_INFO;
11058#endif /* FREECIV_DELTA_PROTOCOL */
11059 SEND_PACKET_START(PACKET_ACHIEVEMENT_INFO);
11060#ifdef FREECIV_JSON_CONNECTION
11061 struct plocation field_addr;
11062 {
11063 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11064 field_addr = *field_addr_tmp;
11065 FC_FREE(field_addr_tmp);
11066 }
11067#endif /* FREECIV_JSON_CONNECTION */
11068
11069 log_packet_detailed("packet_achievement_info_100: sending info about ()");
11070
11071#ifdef FREECIV_DELTA_PROTOCOL
11072 if (NULL == *hash) {
11073 *hash = genhash_new_full(hash_packet_achievement_info_100, cmp_packet_achievement_info_100,
11074 NULL, NULL, NULL, free);
11075 }
11076 BV_CLR_ALL(fields);
11077
11078 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11079 old = fc_malloc(sizeof(*old));
11080 *old = *real_packet;
11081 genhash_insert(*hash, old, old);
11082 memset(old, 0, sizeof(*old));
11083 }
11084 differ = (old->id != real_packet->id);
11085 if (differ) {
11086 BV_SET(fields, 0);
11087 }
11088
11089 if (packet->gained) {
11090 BV_SET(fields, 1);
11091 }
11092
11093 if (packet->first) {
11094 BV_SET(fields, 2);
11095 }
11096
11097
11098#ifdef FREECIV_JSON_CONNECTION
11099 field_addr.name = "fields";
11100#endif /* FREECIV_JSON_CONNECTION */
11101 e = 0;
11102 e |= DIO_BV_PUT(&dout, &field_addr, fields);
11103 if (e) {
11104 log_packet_detailed("fields bitvector error detected");
11105 }
11106
11107 if (BV_ISSET(fields, 0)) {
11108 log_packet_detailed(" field 'id' has changed");
11109#ifdef FREECIV_JSON_CONNECTION
11110 field_addr.name = "id";
11111#endif /* FREECIV_JSON_CONNECTION */
11112 e = 0;
11113 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
11114 if (e) {
11115 log_packet_detailed("'id' field error detected");
11116 }
11117 }
11118 /* field 1 is folded into the header */
11119 /* field 2 is folded into the header */
11120
11121 *old = *real_packet;
11122#endif /* FREECIV_DELTA_PROTOCOL */
11123#ifndef FREECIV_DELTA_PROTOCOL
11124#ifdef FREECIV_JSON_CONNECTION
11125 field_addr.name = "id";
11126#endif /* FREECIV_JSON_CONNECTION */
11127 e = 0;
11128 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
11129 if (e) {
11130 log_packet_detailed("'id' field error detected");
11131 }
11132#ifdef FREECIV_JSON_CONNECTION
11133 field_addr.name = "gained";
11134#endif /* FREECIV_JSON_CONNECTION */
11135 e = 0;
11136 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->gained);
11137 if (e) {
11138 log_packet_detailed("'gained' field error detected");
11139 }
11140#ifdef FREECIV_JSON_CONNECTION
11141 field_addr.name = "first";
11142#endif /* FREECIV_JSON_CONNECTION */
11143 e = 0;
11144 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->first);
11145 if (e) {
11146 log_packet_detailed("'first' field error detected");
11147 }
11148
11149#endif
11150 SEND_PACKET_END(PACKET_ACHIEVEMENT_INFO);
11151}
11152
11153 int send_packet_achievement_info(struct connection *pc, const struct packet_achievement_info *packet)
11154{
11155 if (!pc->used) {
11156 log_error("WARNING: trying to send data to the closed connection %s",
11157 conn_description(pc));
11158 return -1;
11159 }
11160 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_ACHIEVEMENT_INFO].packet != NULL, -1,
11161 "Handler for PACKET_ACHIEVEMENT_INFO not installed");
11162 return pc->phs.handlers->send[PACKET_ACHIEVEMENT_INFO].packet(pc, packet);
11163}
11164
11165 void lsend_packet_achievement_info(struct conn_list *dest, const struct packet_achievement_info *packet)
11166{
11167 conn_list_iterate(dest, pconn) {
11168 send_packet_achievement_info(pconn, packet);
11169 } conn_list_iterate_end;
11170}
11171
11172#ifdef FREECIV_DELTA_PROTOCOL
11173#define hash_packet_chat_msg_100 hash_const
11174
11175#define cmp_packet_chat_msg_100 cmp_const
11176
11177 BV_DEFINE(packet_chat_msg_100_fields, 6);
11178#endif /* FREECIV_DELTA_PROTOCOL */
11179
11180 static struct packet_chat_msg *receive_packet_chat_msg_100(struct connection *pc)
11181{
11182#ifdef FREECIV_DELTA_PROTOCOL
11183 packet_chat_msg_100_fields fields;
11184 struct packet_chat_msg *old;
11185 struct genhash **hash = pc->phs.received + PACKET_CHAT_MSG;
11186#endif /* FREECIV_DELTA_PROTOCOL */
11187 RECEIVE_PACKET_START(packet_chat_msg, real_packet);
11188#ifdef FREECIV_JSON_CONNECTION
11189 struct plocation field_addr;
11190 {
11191 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11192 field_addr = *field_addr_tmp;
11193 FC_FREE(field_addr_tmp);
11194 }
11195#endif /* FREECIV_JSON_CONNECTION */
11196
11197#ifdef FREECIV_DELTA_PROTOCOL
11198#ifdef FREECIV_JSON_CONNECTION
11199 field_addr.name = "fields";
11200#endif /* FREECIV_JSON_CONNECTION */
11201 DIO_BV_GET(&din, &field_addr, fields);
11202
11203#else /* FREECIV_DELTA_PROTOCOL */
11204#ifdef FREECIV_JSON_CONNECTION
11205 field_addr.name = "message";
11206#endif /* FREECIV_JSON_CONNECTION */
11207 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11208 RECEIVE_PACKET_FIELD_ERROR(message);
11209 }
11210#ifdef FREECIV_JSON_CONNECTION
11211 field_addr.name = "tile";
11212#endif /* FREECIV_JSON_CONNECTION */
11213 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
11214 RECEIVE_PACKET_FIELD_ERROR(tile);
11215 }
11216#ifdef FREECIV_JSON_CONNECTION
11217 field_addr.name = "event";
11218#endif /* FREECIV_JSON_CONNECTION */
11219 {
11220 int readin;
11221
11222 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
11223 RECEIVE_PACKET_FIELD_ERROR(event);
11224 }
11225 real_packet->event = readin;
11226 }
11227#ifdef FREECIV_JSON_CONNECTION
11228 field_addr.name = "turn";
11229#endif /* FREECIV_JSON_CONNECTION */
11230 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
11231 RECEIVE_PACKET_FIELD_ERROR(turn);
11232 }
11233#ifdef FREECIV_JSON_CONNECTION
11234 field_addr.name = "phase";
11235#endif /* FREECIV_JSON_CONNECTION */
11236 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
11237 RECEIVE_PACKET_FIELD_ERROR(phase);
11238 }
11239#ifdef FREECIV_JSON_CONNECTION
11240 field_addr.name = "conn_id";
11241#endif /* FREECIV_JSON_CONNECTION */
11242 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
11243 RECEIVE_PACKET_FIELD_ERROR(conn_id);
11244 }
11245#endif
11246 log_packet_detailed("packet_chat_msg_100: got info about ()");
11247
11248#ifdef FREECIV_DELTA_PROTOCOL
11249 if (NULL == *hash) {
11250 *hash = genhash_new_full(hash_packet_chat_msg_100, cmp_packet_chat_msg_100,
11251 NULL, NULL, NULL, free);
11252 }
11253
11254 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11255 *real_packet = *old;
11256 } else {
11257 log_packet_detailed(" no old info");
11258 memset(real_packet, 0, sizeof(*real_packet));
11259 }
11260
11261 if (BV_ISSET(fields, 0)) {
11262 log_packet_detailed(" got field 'message'");
11263#ifdef FREECIV_JSON_CONNECTION
11264 field_addr.name = "message";
11265#endif /* FREECIV_JSON_CONNECTION */
11266 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11267 RECEIVE_PACKET_FIELD_ERROR(message);
11268 }
11269 }
11270 if (BV_ISSET(fields, 1)) {
11271 log_packet_detailed(" got field 'tile'");
11272#ifdef FREECIV_JSON_CONNECTION
11273 field_addr.name = "tile";
11274#endif /* FREECIV_JSON_CONNECTION */
11275 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
11276 RECEIVE_PACKET_FIELD_ERROR(tile);
11277 }
11278 }
11279 if (BV_ISSET(fields, 2)) {
11280 log_packet_detailed(" got field 'event'");
11281#ifdef FREECIV_JSON_CONNECTION
11282 field_addr.name = "event";
11283#endif /* FREECIV_JSON_CONNECTION */
11284 {
11285 int readin;
11286
11287 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
11288 RECEIVE_PACKET_FIELD_ERROR(event);
11289 }
11290 real_packet->event = readin;
11291 }
11292 }
11293 if (BV_ISSET(fields, 3)) {
11294 log_packet_detailed(" got field 'turn'");
11295#ifdef FREECIV_JSON_CONNECTION
11296 field_addr.name = "turn";
11297#endif /* FREECIV_JSON_CONNECTION */
11298 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
11299 RECEIVE_PACKET_FIELD_ERROR(turn);
11300 }
11301 }
11302 if (BV_ISSET(fields, 4)) {
11303 log_packet_detailed(" got field 'phase'");
11304#ifdef FREECIV_JSON_CONNECTION
11305 field_addr.name = "phase";
11306#endif /* FREECIV_JSON_CONNECTION */
11307 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
11308 RECEIVE_PACKET_FIELD_ERROR(phase);
11309 }
11310 }
11311 if (BV_ISSET(fields, 5)) {
11312 log_packet_detailed(" got field 'conn_id'");
11313#ifdef FREECIV_JSON_CONNECTION
11314 field_addr.name = "conn_id";
11315#endif /* FREECIV_JSON_CONNECTION */
11316 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
11317 RECEIVE_PACKET_FIELD_ERROR(conn_id);
11318 }
11319 }
11320
11321 if (NULL == old) {
11322 old = fc_malloc(sizeof(*old));
11323 *old = *real_packet;
11324 genhash_insert(*hash, old, old);
11325 } else {
11326 *old = *real_packet;
11327 }
11328
11329#endif /* FREECIV_DELTA_PROTOCOL */
11330 RECEIVE_PACKET_END(real_packet);
11331}
11332
11333 static int send_packet_chat_msg_100(struct connection *pc, const struct packet_chat_msg *packet)
11334{
11335 const struct packet_chat_msg *real_packet = packet;
11336 int e;
11337#ifdef FREECIV_DELTA_PROTOCOL
11338 packet_chat_msg_100_fields fields;
11339 struct packet_chat_msg *old;
11340 bool differ;
11341 struct genhash **hash = pc->phs.sent + PACKET_CHAT_MSG;
11342#endif /* FREECIV_DELTA_PROTOCOL */
11343 SEND_PACKET_START(PACKET_CHAT_MSG);
11344#ifdef FREECIV_JSON_CONNECTION
11345 struct plocation field_addr;
11346 {
11347 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11348 field_addr = *field_addr_tmp;
11349 FC_FREE(field_addr_tmp);
11350 }
11351#endif /* FREECIV_JSON_CONNECTION */
11352
11353 log_packet_detailed("packet_chat_msg_100: sending info about ()");
11354
11355#ifdef FREECIV_DELTA_PROTOCOL
11356 if (NULL == *hash) {
11357 *hash = genhash_new_full(hash_packet_chat_msg_100, cmp_packet_chat_msg_100,
11358 NULL, NULL, NULL, free);
11359 }
11360 BV_CLR_ALL(fields);
11361
11362 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11363 old = fc_malloc(sizeof(*old));
11364 *old = *real_packet;
11365 genhash_insert(*hash, old, old);
11366 memset(old, 0, sizeof(*old));
11367 }
11368 differ = (strcmp(old->message, real_packet->message) != 0);
11369 if (differ) {
11370 BV_SET(fields, 0);
11371 }
11372
11373 differ = (old->tile != real_packet->tile);
11374 if (differ) {
11375 BV_SET(fields, 1);
11376 }
11377
11378 differ = (old->event != real_packet->event);
11379 if (differ) {
11380 BV_SET(fields, 2);
11381 }
11382
11383 differ = (old->turn != real_packet->turn);
11384 if (differ) {
11385 BV_SET(fields, 3);
11386 }
11387
11388 differ = (old->phase != real_packet->phase);
11389 if (differ) {
11390 BV_SET(fields, 4);
11391 }
11392
11393 differ = (old->conn_id != real_packet->conn_id);
11394 if (differ) {
11395 BV_SET(fields, 5);
11396 }
11397
11398
11399#ifdef FREECIV_JSON_CONNECTION
11400 field_addr.name = "fields";
11401#endif /* FREECIV_JSON_CONNECTION */
11402 e = 0;
11403 e |= DIO_BV_PUT(&dout, &field_addr, fields);
11404 if (e) {
11405 log_packet_detailed("fields bitvector error detected");
11406 }
11407
11408 if (BV_ISSET(fields, 0)) {
11409 log_packet_detailed(" field 'message' has changed");
11410#ifdef FREECIV_JSON_CONNECTION
11411 field_addr.name = "message";
11412#endif /* FREECIV_JSON_CONNECTION */
11413 e = 0;
11414 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
11415 if (e) {
11416 log_packet_detailed("'message' field error detected");
11417 }
11418 }
11419 if (BV_ISSET(fields, 1)) {
11420 log_packet_detailed(" field 'tile' has changed");
11421#ifdef FREECIV_JSON_CONNECTION
11422 field_addr.name = "tile";
11423#endif /* FREECIV_JSON_CONNECTION */
11424 e = 0;
11425 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11426 if (e) {
11427 log_packet_detailed("'tile' field error detected");
11428 }
11429 }
11430 if (BV_ISSET(fields, 2)) {
11431 log_packet_detailed(" field 'event' has changed");
11432#ifdef FREECIV_JSON_CONNECTION
11433 field_addr.name = "event";
11434#endif /* FREECIV_JSON_CONNECTION */
11435 e = 0;
11436 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11437 if (e) {
11438 log_packet_detailed("'event' field error detected");
11439 }
11440 }
11441 if (BV_ISSET(fields, 3)) {
11442 log_packet_detailed(" field 'turn' has changed");
11443#ifdef FREECIV_JSON_CONNECTION
11444 field_addr.name = "turn";
11445#endif /* FREECIV_JSON_CONNECTION */
11446 e = 0;
11447 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11448 if (e) {
11449 log_packet_detailed("'turn' field error detected");
11450 }
11451 }
11452 if (BV_ISSET(fields, 4)) {
11453 log_packet_detailed(" field 'phase' has changed");
11454#ifdef FREECIV_JSON_CONNECTION
11455 field_addr.name = "phase";
11456#endif /* FREECIV_JSON_CONNECTION */
11457 e = 0;
11458 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11459 if (e) {
11460 log_packet_detailed("'phase' field error detected");
11461 }
11462 }
11463 if (BV_ISSET(fields, 5)) {
11464 log_packet_detailed(" field 'conn_id' has changed");
11465#ifdef FREECIV_JSON_CONNECTION
11466 field_addr.name = "conn_id";
11467#endif /* FREECIV_JSON_CONNECTION */
11468 e = 0;
11469 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11470 if (e) {
11471 log_packet_detailed("'conn_id' field error detected");
11472 }
11473 }
11474
11475 *old = *real_packet;
11476#endif /* FREECIV_DELTA_PROTOCOL */
11477#ifndef FREECIV_DELTA_PROTOCOL
11478#ifdef FREECIV_JSON_CONNECTION
11479 field_addr.name = "message";
11480#endif /* FREECIV_JSON_CONNECTION */
11481 e = 0;
11482 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
11483 if (e) {
11484 log_packet_detailed("'message' field error detected");
11485 }
11486#ifdef FREECIV_JSON_CONNECTION
11487 field_addr.name = "tile";
11488#endif /* FREECIV_JSON_CONNECTION */
11489 e = 0;
11490 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11491 if (e) {
11492 log_packet_detailed("'tile' field error detected");
11493 }
11494#ifdef FREECIV_JSON_CONNECTION
11495 field_addr.name = "event";
11496#endif /* FREECIV_JSON_CONNECTION */
11497 e = 0;
11498 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11499 if (e) {
11500 log_packet_detailed("'event' field error detected");
11501 }
11502#ifdef FREECIV_JSON_CONNECTION
11503 field_addr.name = "turn";
11504#endif /* FREECIV_JSON_CONNECTION */
11505 e = 0;
11506 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11507 if (e) {
11508 log_packet_detailed("'turn' field error detected");
11509 }
11510#ifdef FREECIV_JSON_CONNECTION
11511 field_addr.name = "phase";
11512#endif /* FREECIV_JSON_CONNECTION */
11513 e = 0;
11514 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11515 if (e) {
11516 log_packet_detailed("'phase' field error detected");
11517 }
11518#ifdef FREECIV_JSON_CONNECTION
11519 field_addr.name = "conn_id";
11520#endif /* FREECIV_JSON_CONNECTION */
11521 e = 0;
11522 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11523 if (e) {
11524 log_packet_detailed("'conn_id' field error detected");
11525 }
11526
11527#endif
11528 SEND_PACKET_END(PACKET_CHAT_MSG);
11529}
11530
11531 int send_packet_chat_msg(struct connection *pc, const struct packet_chat_msg *packet)
11532{
11533 if (!pc->used) {
11534 log_error("WARNING: trying to send data to the closed connection %s",
11535 conn_description(pc));
11536 return -1;
11537 }
11538 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CHAT_MSG].packet != NULL, -1,
11539 "Handler for PACKET_CHAT_MSG not installed");
11540 return pc->phs.handlers->send[PACKET_CHAT_MSG].packet(pc, packet);
11541}
11542
11543 void lsend_packet_chat_msg(struct conn_list *dest, const struct packet_chat_msg *packet)
11544{
11545 conn_list_iterate(dest, pconn) {
11546 send_packet_chat_msg(pconn, packet);
11547 } conn_list_iterate_end;
11548}
11549
11550#ifdef FREECIV_DELTA_PROTOCOL
11551#define hash_packet_early_chat_msg_100 hash_const
11552
11553#define cmp_packet_early_chat_msg_100 cmp_const
11554
11555 BV_DEFINE(packet_early_chat_msg_100_fields, 6);
11556#endif /* FREECIV_DELTA_PROTOCOL */
11557
11558 static struct packet_early_chat_msg *receive_packet_early_chat_msg_100(struct connection *pc)
11559{
11560#ifdef FREECIV_DELTA_PROTOCOL
11561 packet_early_chat_msg_100_fields fields;
11562 struct packet_early_chat_msg *old;
11563 struct genhash **hash = pc->phs.received + PACKET_EARLY_CHAT_MSG;
11564#endif /* FREECIV_DELTA_PROTOCOL */
11565 RECEIVE_PACKET_START(packet_early_chat_msg, real_packet);
11566#ifdef FREECIV_JSON_CONNECTION
11567 struct plocation field_addr;
11568 {
11569 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11570 field_addr = *field_addr_tmp;
11571 FC_FREE(field_addr_tmp);
11572 }
11573#endif /* FREECIV_JSON_CONNECTION */
11574
11575#ifdef FREECIV_DELTA_PROTOCOL
11576#ifdef FREECIV_JSON_CONNECTION
11577 field_addr.name = "fields";
11578#endif /* FREECIV_JSON_CONNECTION */
11579 DIO_BV_GET(&din, &field_addr, fields);
11580
11581#else /* FREECIV_DELTA_PROTOCOL */
11582#ifdef FREECIV_JSON_CONNECTION
11583 field_addr.name = "message";
11584#endif /* FREECIV_JSON_CONNECTION */
11585 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11586 RECEIVE_PACKET_FIELD_ERROR(message);
11587 }
11588#ifdef FREECIV_JSON_CONNECTION
11589 field_addr.name = "tile";
11590#endif /* FREECIV_JSON_CONNECTION */
11591 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
11592 RECEIVE_PACKET_FIELD_ERROR(tile);
11593 }
11594#ifdef FREECIV_JSON_CONNECTION
11595 field_addr.name = "event";
11596#endif /* FREECIV_JSON_CONNECTION */
11597 {
11598 int readin;
11599
11600 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
11601 RECEIVE_PACKET_FIELD_ERROR(event);
11602 }
11603 real_packet->event = readin;
11604 }
11605#ifdef FREECIV_JSON_CONNECTION
11606 field_addr.name = "turn";
11607#endif /* FREECIV_JSON_CONNECTION */
11608 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
11609 RECEIVE_PACKET_FIELD_ERROR(turn);
11610 }
11611#ifdef FREECIV_JSON_CONNECTION
11612 field_addr.name = "phase";
11613#endif /* FREECIV_JSON_CONNECTION */
11614 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
11615 RECEIVE_PACKET_FIELD_ERROR(phase);
11616 }
11617#ifdef FREECIV_JSON_CONNECTION
11618 field_addr.name = "conn_id";
11619#endif /* FREECIV_JSON_CONNECTION */
11620 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
11621 RECEIVE_PACKET_FIELD_ERROR(conn_id);
11622 }
11623#endif
11624 log_packet_detailed("packet_early_chat_msg_100: got info about ()");
11625
11626#ifdef FREECIV_DELTA_PROTOCOL
11627 if (NULL == *hash) {
11628 *hash = genhash_new_full(hash_packet_early_chat_msg_100, cmp_packet_early_chat_msg_100,
11629 NULL, NULL, NULL, free);
11630 }
11631
11632 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11633 *real_packet = *old;
11634 } else {
11635 log_packet_detailed(" no old info");
11636 memset(real_packet, 0, sizeof(*real_packet));
11637 }
11638
11639 if (BV_ISSET(fields, 0)) {
11640 log_packet_detailed(" got field 'message'");
11641#ifdef FREECIV_JSON_CONNECTION
11642 field_addr.name = "message";
11643#endif /* FREECIV_JSON_CONNECTION */
11644 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11645 RECEIVE_PACKET_FIELD_ERROR(message);
11646 }
11647 }
11648 if (BV_ISSET(fields, 1)) {
11649 log_packet_detailed(" got field 'tile'");
11650#ifdef FREECIV_JSON_CONNECTION
11651 field_addr.name = "tile";
11652#endif /* FREECIV_JSON_CONNECTION */
11653 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
11654 RECEIVE_PACKET_FIELD_ERROR(tile);
11655 }
11656 }
11657 if (BV_ISSET(fields, 2)) {
11658 log_packet_detailed(" got field 'event'");
11659#ifdef FREECIV_JSON_CONNECTION
11660 field_addr.name = "event";
11661#endif /* FREECIV_JSON_CONNECTION */
11662 {
11663 int readin;
11664
11665 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
11666 RECEIVE_PACKET_FIELD_ERROR(event);
11667 }
11668 real_packet->event = readin;
11669 }
11670 }
11671 if (BV_ISSET(fields, 3)) {
11672 log_packet_detailed(" got field 'turn'");
11673#ifdef FREECIV_JSON_CONNECTION
11674 field_addr.name = "turn";
11675#endif /* FREECIV_JSON_CONNECTION */
11676 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
11677 RECEIVE_PACKET_FIELD_ERROR(turn);
11678 }
11679 }
11680 if (BV_ISSET(fields, 4)) {
11681 log_packet_detailed(" got field 'phase'");
11682#ifdef FREECIV_JSON_CONNECTION
11683 field_addr.name = "phase";
11684#endif /* FREECIV_JSON_CONNECTION */
11685 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
11686 RECEIVE_PACKET_FIELD_ERROR(phase);
11687 }
11688 }
11689 if (BV_ISSET(fields, 5)) {
11690 log_packet_detailed(" got field 'conn_id'");
11691#ifdef FREECIV_JSON_CONNECTION
11692 field_addr.name = "conn_id";
11693#endif /* FREECIV_JSON_CONNECTION */
11694 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id)) {
11695 RECEIVE_PACKET_FIELD_ERROR(conn_id);
11696 }
11697 }
11698
11699 if (NULL == old) {
11700 old = fc_malloc(sizeof(*old));
11701 *old = *real_packet;
11702 genhash_insert(*hash, old, old);
11703 } else {
11704 *old = *real_packet;
11705 }
11706
11707#endif /* FREECIV_DELTA_PROTOCOL */
11708 RECEIVE_PACKET_END(real_packet);
11709}
11710
11711 static int send_packet_early_chat_msg_100(struct connection *pc, const struct packet_early_chat_msg *packet)
11712{
11713 const struct packet_early_chat_msg *real_packet = packet;
11714 int e;
11715#ifdef FREECIV_DELTA_PROTOCOL
11716 packet_early_chat_msg_100_fields fields;
11717 struct packet_early_chat_msg *old;
11718 bool differ;
11719 struct genhash **hash = pc->phs.sent + PACKET_EARLY_CHAT_MSG;
11720#endif /* FREECIV_DELTA_PROTOCOL */
11721 SEND_PACKET_START(PACKET_EARLY_CHAT_MSG);
11722#ifdef FREECIV_JSON_CONNECTION
11723 struct plocation field_addr;
11724 {
11725 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11726 field_addr = *field_addr_tmp;
11727 FC_FREE(field_addr_tmp);
11728 }
11729#endif /* FREECIV_JSON_CONNECTION */
11730
11731 log_packet_detailed("packet_early_chat_msg_100: sending info about ()");
11732
11733#ifdef FREECIV_DELTA_PROTOCOL
11734 if (NULL == *hash) {
11735 *hash = genhash_new_full(hash_packet_early_chat_msg_100, cmp_packet_early_chat_msg_100,
11736 NULL, NULL, NULL, free);
11737 }
11738 BV_CLR_ALL(fields);
11739
11740 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
11741 old = fc_malloc(sizeof(*old));
11742 *old = *real_packet;
11743 genhash_insert(*hash, old, old);
11744 memset(old, 0, sizeof(*old));
11745 }
11746 differ = (strcmp(old->message, real_packet->message) != 0);
11747 if (differ) {
11748 BV_SET(fields, 0);
11749 }
11750
11751 differ = (old->tile != real_packet->tile);
11752 if (differ) {
11753 BV_SET(fields, 1);
11754 }
11755
11756 differ = (old->event != real_packet->event);
11757 if (differ) {
11758 BV_SET(fields, 2);
11759 }
11760
11761 differ = (old->turn != real_packet->turn);
11762 if (differ) {
11763 BV_SET(fields, 3);
11764 }
11765
11766 differ = (old->phase != real_packet->phase);
11767 if (differ) {
11768 BV_SET(fields, 4);
11769 }
11770
11771 differ = (old->conn_id != real_packet->conn_id);
11772 if (differ) {
11773 BV_SET(fields, 5);
11774 }
11775
11776
11777#ifdef FREECIV_JSON_CONNECTION
11778 field_addr.name = "fields";
11779#endif /* FREECIV_JSON_CONNECTION */
11780 e = 0;
11781 e |= DIO_BV_PUT(&dout, &field_addr, fields);
11782 if (e) {
11783 log_packet_detailed("fields bitvector error detected");
11784 }
11785
11786 if (BV_ISSET(fields, 0)) {
11787 log_packet_detailed(" field 'message' has changed");
11788#ifdef FREECIV_JSON_CONNECTION
11789 field_addr.name = "message";
11790#endif /* FREECIV_JSON_CONNECTION */
11791 e = 0;
11792 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
11793 if (e) {
11794 log_packet_detailed("'message' field error detected");
11795 }
11796 }
11797 if (BV_ISSET(fields, 1)) {
11798 log_packet_detailed(" field 'tile' has changed");
11799#ifdef FREECIV_JSON_CONNECTION
11800 field_addr.name = "tile";
11801#endif /* FREECIV_JSON_CONNECTION */
11802 e = 0;
11803 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11804 if (e) {
11805 log_packet_detailed("'tile' field error detected");
11806 }
11807 }
11808 if (BV_ISSET(fields, 2)) {
11809 log_packet_detailed(" field 'event' has changed");
11810#ifdef FREECIV_JSON_CONNECTION
11811 field_addr.name = "event";
11812#endif /* FREECIV_JSON_CONNECTION */
11813 e = 0;
11814 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11815 if (e) {
11816 log_packet_detailed("'event' field error detected");
11817 }
11818 }
11819 if (BV_ISSET(fields, 3)) {
11820 log_packet_detailed(" field 'turn' has changed");
11821#ifdef FREECIV_JSON_CONNECTION
11822 field_addr.name = "turn";
11823#endif /* FREECIV_JSON_CONNECTION */
11824 e = 0;
11825 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11826 if (e) {
11827 log_packet_detailed("'turn' field error detected");
11828 }
11829 }
11830 if (BV_ISSET(fields, 4)) {
11831 log_packet_detailed(" field 'phase' has changed");
11832#ifdef FREECIV_JSON_CONNECTION
11833 field_addr.name = "phase";
11834#endif /* FREECIV_JSON_CONNECTION */
11835 e = 0;
11836 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11837 if (e) {
11838 log_packet_detailed("'phase' field error detected");
11839 }
11840 }
11841 if (BV_ISSET(fields, 5)) {
11842 log_packet_detailed(" field 'conn_id' has changed");
11843#ifdef FREECIV_JSON_CONNECTION
11844 field_addr.name = "conn_id";
11845#endif /* FREECIV_JSON_CONNECTION */
11846 e = 0;
11847 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11848 if (e) {
11849 log_packet_detailed("'conn_id' field error detected");
11850 }
11851 }
11852
11853 *old = *real_packet;
11854#endif /* FREECIV_DELTA_PROTOCOL */
11855#ifndef FREECIV_DELTA_PROTOCOL
11856#ifdef FREECIV_JSON_CONNECTION
11857 field_addr.name = "message";
11858#endif /* FREECIV_JSON_CONNECTION */
11859 e = 0;
11860 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
11861 if (e) {
11862 log_packet_detailed("'message' field error detected");
11863 }
11864#ifdef FREECIV_JSON_CONNECTION
11865 field_addr.name = "tile";
11866#endif /* FREECIV_JSON_CONNECTION */
11867 e = 0;
11868 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
11869 if (e) {
11870 log_packet_detailed("'tile' field error detected");
11871 }
11872#ifdef FREECIV_JSON_CONNECTION
11873 field_addr.name = "event";
11874#endif /* FREECIV_JSON_CONNECTION */
11875 e = 0;
11876 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
11877 if (e) {
11878 log_packet_detailed("'event' field error detected");
11879 }
11880#ifdef FREECIV_JSON_CONNECTION
11881 field_addr.name = "turn";
11882#endif /* FREECIV_JSON_CONNECTION */
11883 e = 0;
11884 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
11885 if (e) {
11886 log_packet_detailed("'turn' field error detected");
11887 }
11888#ifdef FREECIV_JSON_CONNECTION
11889 field_addr.name = "phase";
11890#endif /* FREECIV_JSON_CONNECTION */
11891 e = 0;
11892 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
11893 if (e) {
11894 log_packet_detailed("'phase' field error detected");
11895 }
11896#ifdef FREECIV_JSON_CONNECTION
11897 field_addr.name = "conn_id";
11898#endif /* FREECIV_JSON_CONNECTION */
11899 e = 0;
11900 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id);
11901 if (e) {
11902 log_packet_detailed("'conn_id' field error detected");
11903 }
11904
11905#endif
11906 SEND_PACKET_END(PACKET_EARLY_CHAT_MSG);
11907}
11908
11909 int send_packet_early_chat_msg(struct connection *pc, const struct packet_early_chat_msg *packet)
11910{
11911 if (!pc->used) {
11912 log_error("WARNING: trying to send data to the closed connection %s",
11913 conn_description(pc));
11914 return -1;
11915 }
11916 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EARLY_CHAT_MSG].packet != NULL, -1,
11917 "Handler for PACKET_EARLY_CHAT_MSG not installed");
11918 return pc->phs.handlers->send[PACKET_EARLY_CHAT_MSG].packet(pc, packet);
11919}
11920
11921 void lsend_packet_early_chat_msg(struct conn_list *dest, const struct packet_early_chat_msg *packet)
11922{
11923 conn_list_iterate(dest, pconn) {
11924 send_packet_early_chat_msg(pconn, packet);
11925 } conn_list_iterate_end;
11926}
11927
11928#ifdef FREECIV_DELTA_PROTOCOL
11929#define hash_packet_chat_msg_req_100 hash_const
11930
11931#define cmp_packet_chat_msg_req_100 cmp_const
11932
11933 BV_DEFINE(packet_chat_msg_req_100_fields, 1);
11934#endif /* FREECIV_DELTA_PROTOCOL */
11935
11936 static struct packet_chat_msg_req *receive_packet_chat_msg_req_100(struct connection *pc)
11937{
11938#ifdef FREECIV_DELTA_PROTOCOL
11939 packet_chat_msg_req_100_fields fields;
11940 struct packet_chat_msg_req *old;
11941 struct genhash **hash = pc->phs.received + PACKET_CHAT_MSG_REQ;
11942#endif /* FREECIV_DELTA_PROTOCOL */
11943 RECEIVE_PACKET_START(packet_chat_msg_req, real_packet);
11944#ifdef FREECIV_JSON_CONNECTION
11945 struct plocation field_addr;
11946 {
11947 struct plocation *field_addr_tmp = plocation_field_new(NULL);
11948 field_addr = *field_addr_tmp;
11949 FC_FREE(field_addr_tmp);
11950 }
11951#endif /* FREECIV_JSON_CONNECTION */
11952
11953#ifdef FREECIV_DELTA_PROTOCOL
11954#ifdef FREECIV_JSON_CONNECTION
11955 field_addr.name = "fields";
11956#endif /* FREECIV_JSON_CONNECTION */
11957 DIO_BV_GET(&din, &field_addr, fields);
11958
11959#else /* FREECIV_DELTA_PROTOCOL */
11960#ifdef FREECIV_JSON_CONNECTION
11961 field_addr.name = "message";
11962#endif /* FREECIV_JSON_CONNECTION */
11963 if (!DIO_GET(estring, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11964 RECEIVE_PACKET_FIELD_ERROR(message);
11965 }
11966#endif
11967 log_packet_detailed("packet_chat_msg_req_100: got info about ()");
11968
11969#ifdef FREECIV_DELTA_PROTOCOL
11970 if (NULL == *hash) {
11971 *hash = genhash_new_full(hash_packet_chat_msg_req_100, cmp_packet_chat_msg_req_100,
11972 NULL, NULL, NULL, free);
11973 }
11974
11975 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
11976 *real_packet = *old;
11977 } else {
11978 log_packet_detailed(" no old info");
11979 memset(real_packet, 0, sizeof(*real_packet));
11980 }
11981
11982 if (BV_ISSET(fields, 0)) {
11983 log_packet_detailed(" got field 'message'");
11984#ifdef FREECIV_JSON_CONNECTION
11985 field_addr.name = "message";
11986#endif /* FREECIV_JSON_CONNECTION */
11987 if (!DIO_GET(estring, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
11988 RECEIVE_PACKET_FIELD_ERROR(message);
11989 }
11990 }
11991
11992 if (NULL == old) {
11993 old = fc_malloc(sizeof(*old));
11994 *old = *real_packet;
11995 genhash_insert(*hash, old, old);
11996 } else {
11997 *old = *real_packet;
11998 }
11999
12000#endif /* FREECIV_DELTA_PROTOCOL */
12001 RECEIVE_PACKET_END(real_packet);
12002}
12003
12004 static int send_packet_chat_msg_req_100(struct connection *pc, const struct packet_chat_msg_req *packet)
12005{
12006 const struct packet_chat_msg_req *real_packet = packet;
12007 int e;
12008#ifdef FREECIV_DELTA_PROTOCOL
12009 packet_chat_msg_req_100_fields fields;
12010 struct packet_chat_msg_req *old;
12011 bool differ;
12012 struct genhash **hash = pc->phs.sent + PACKET_CHAT_MSG_REQ;
12013#endif /* FREECIV_DELTA_PROTOCOL */
12014 SEND_PACKET_START(PACKET_CHAT_MSG_REQ);
12015#ifdef FREECIV_JSON_CONNECTION
12016 struct plocation field_addr;
12017 {
12018 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12019 field_addr = *field_addr_tmp;
12020 FC_FREE(field_addr_tmp);
12021 }
12022#endif /* FREECIV_JSON_CONNECTION */
12023
12024 log_packet_detailed("packet_chat_msg_req_100: sending info about ()");
12025
12026#ifdef FREECIV_DELTA_PROTOCOL
12027 if (NULL == *hash) {
12028 *hash = genhash_new_full(hash_packet_chat_msg_req_100, cmp_packet_chat_msg_req_100,
12029 NULL, NULL, NULL, free);
12030 }
12031 BV_CLR_ALL(fields);
12032
12033 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12034 old = fc_malloc(sizeof(*old));
12035 *old = *real_packet;
12036 genhash_insert(*hash, old, old);
12037 memset(old, 0, sizeof(*old));
12038 }
12039 differ = (strcmp(old->message, real_packet->message) != 0);
12040 if (differ) {
12041 BV_SET(fields, 0);
12042 }
12043
12044
12045#ifdef FREECIV_JSON_CONNECTION
12046 field_addr.name = "fields";
12047#endif /* FREECIV_JSON_CONNECTION */
12048 e = 0;
12049 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12050 if (e) {
12051 log_packet_detailed("fields bitvector error detected");
12052 }
12053
12054 if (BV_ISSET(fields, 0)) {
12055 log_packet_detailed(" field 'message' has changed");
12056#ifdef FREECIV_JSON_CONNECTION
12057 field_addr.name = "message";
12058#endif /* FREECIV_JSON_CONNECTION */
12059 e = 0;
12060 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->message);
12061 if (e) {
12062 log_packet_detailed("'message' field error detected");
12063 }
12064 }
12065
12066 *old = *real_packet;
12067#endif /* FREECIV_DELTA_PROTOCOL */
12068#ifndef FREECIV_DELTA_PROTOCOL
12069#ifdef FREECIV_JSON_CONNECTION
12070 field_addr.name = "message";
12071#endif /* FREECIV_JSON_CONNECTION */
12072 e = 0;
12073 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->message);
12074 if (e) {
12075 log_packet_detailed("'message' field error detected");
12076 }
12077
12078#endif
12079 SEND_PACKET_END(PACKET_CHAT_MSG_REQ);
12080}
12081
12082 int send_packet_chat_msg_req(struct connection *pc, const struct packet_chat_msg_req *packet)
12083{
12084 if (!pc->used) {
12085 log_error("WARNING: trying to send data to the closed connection %s",
12086 conn_description(pc));
12087 return -1;
12088 }
12089 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CHAT_MSG_REQ].packet != NULL, -1,
12090 "Handler for PACKET_CHAT_MSG_REQ not installed");
12091 return pc->phs.handlers->send[PACKET_CHAT_MSG_REQ].packet(pc, packet);
12092}
12093
12094 int dsend_packet_chat_msg_req(struct connection *pc, const char *message)
12095{
12096 struct packet_chat_msg_req packet, *real_packet = &packet;
12097
12098 sz_strlcpy(real_packet->message, message);
12099
12100 return send_packet_chat_msg_req(pc, real_packet);
12101}
12102
12103#ifdef FREECIV_DELTA_PROTOCOL
12104#define hash_packet_connect_msg_100 hash_const
12105
12106#define cmp_packet_connect_msg_100 cmp_const
12107
12108 BV_DEFINE(packet_connect_msg_100_fields, 1);
12109#endif /* FREECIV_DELTA_PROTOCOL */
12110
12111 static struct packet_connect_msg *receive_packet_connect_msg_100(struct connection *pc)
12112{
12113#ifdef FREECIV_DELTA_PROTOCOL
12114 packet_connect_msg_100_fields fields;
12115 struct packet_connect_msg *old;
12116 struct genhash **hash = pc->phs.received + PACKET_CONNECT_MSG;
12117#endif /* FREECIV_DELTA_PROTOCOL */
12118 RECEIVE_PACKET_START(packet_connect_msg, real_packet);
12119#ifdef FREECIV_JSON_CONNECTION
12120 struct plocation field_addr;
12121 {
12122 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12123 field_addr = *field_addr_tmp;
12124 FC_FREE(field_addr_tmp);
12125 }
12126#endif /* FREECIV_JSON_CONNECTION */
12127
12128#ifdef FREECIV_DELTA_PROTOCOL
12129#ifdef FREECIV_JSON_CONNECTION
12130 field_addr.name = "fields";
12131#endif /* FREECIV_JSON_CONNECTION */
12132 DIO_BV_GET(&din, &field_addr, fields);
12133
12134#else /* FREECIV_DELTA_PROTOCOL */
12135#ifdef FREECIV_JSON_CONNECTION
12136 field_addr.name = "message";
12137#endif /* FREECIV_JSON_CONNECTION */
12138 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
12139 RECEIVE_PACKET_FIELD_ERROR(message);
12140 }
12141#endif
12142 log_packet_detailed("packet_connect_msg_100: got info about ()");
12143
12144#ifdef FREECIV_DELTA_PROTOCOL
12145 if (NULL == *hash) {
12146 *hash = genhash_new_full(hash_packet_connect_msg_100, cmp_packet_connect_msg_100,
12147 NULL, NULL, NULL, free);
12148 }
12149
12150 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
12151 *real_packet = *old;
12152 } else {
12153 log_packet_detailed(" no old info");
12154 memset(real_packet, 0, sizeof(*real_packet));
12155 }
12156
12157 if (BV_ISSET(fields, 0)) {
12158 log_packet_detailed(" got field 'message'");
12159#ifdef FREECIV_JSON_CONNECTION
12160 field_addr.name = "message";
12161#endif /* FREECIV_JSON_CONNECTION */
12162 if (!DIO_GET(string, &din, &field_addr, real_packet->message, sizeof(real_packet->message))) {
12163 RECEIVE_PACKET_FIELD_ERROR(message);
12164 }
12165 }
12166
12167 if (NULL == old) {
12168 old = fc_malloc(sizeof(*old));
12169 *old = *real_packet;
12170 genhash_insert(*hash, old, old);
12171 } else {
12172 *old = *real_packet;
12173 }
12174
12175#endif /* FREECIV_DELTA_PROTOCOL */
12176 RECEIVE_PACKET_END(real_packet);
12177}
12178
12179 static int send_packet_connect_msg_100(struct connection *pc, const struct packet_connect_msg *packet)
12180{
12181 const struct packet_connect_msg *real_packet = packet;
12182 int e;
12183#ifdef FREECIV_DELTA_PROTOCOL
12184 packet_connect_msg_100_fields fields;
12185 struct packet_connect_msg *old;
12186 bool differ;
12187 struct genhash **hash = pc->phs.sent + PACKET_CONNECT_MSG;
12188#endif /* FREECIV_DELTA_PROTOCOL */
12189 SEND_PACKET_START(PACKET_CONNECT_MSG);
12190#ifdef FREECIV_JSON_CONNECTION
12191 struct plocation field_addr;
12192 {
12193 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12194 field_addr = *field_addr_tmp;
12195 FC_FREE(field_addr_tmp);
12196 }
12197#endif /* FREECIV_JSON_CONNECTION */
12198
12199 log_packet_detailed("packet_connect_msg_100: sending info about ()");
12200
12201#ifdef FREECIV_DELTA_PROTOCOL
12202 if (NULL == *hash) {
12203 *hash = genhash_new_full(hash_packet_connect_msg_100, cmp_packet_connect_msg_100,
12204 NULL, NULL, NULL, free);
12205 }
12206 BV_CLR_ALL(fields);
12207
12208 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12209 old = fc_malloc(sizeof(*old));
12210 *old = *real_packet;
12211 genhash_insert(*hash, old, old);
12212 memset(old, 0, sizeof(*old));
12213 }
12214 differ = (strcmp(old->message, real_packet->message) != 0);
12215 if (differ) {
12216 BV_SET(fields, 0);
12217 }
12218
12219
12220#ifdef FREECIV_JSON_CONNECTION
12221 field_addr.name = "fields";
12222#endif /* FREECIV_JSON_CONNECTION */
12223 e = 0;
12224 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12225 if (e) {
12226 log_packet_detailed("fields bitvector error detected");
12227 }
12228
12229 if (BV_ISSET(fields, 0)) {
12230 log_packet_detailed(" field 'message' has changed");
12231#ifdef FREECIV_JSON_CONNECTION
12232 field_addr.name = "message";
12233#endif /* FREECIV_JSON_CONNECTION */
12234 e = 0;
12235 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
12236 if (e) {
12237 log_packet_detailed("'message' field error detected");
12238 }
12239 }
12240
12241 *old = *real_packet;
12242#endif /* FREECIV_DELTA_PROTOCOL */
12243#ifndef FREECIV_DELTA_PROTOCOL
12244#ifdef FREECIV_JSON_CONNECTION
12245 field_addr.name = "message";
12246#endif /* FREECIV_JSON_CONNECTION */
12247 e = 0;
12248 e |= DIO_PUT(string, &dout, &field_addr, real_packet->message);
12249 if (e) {
12250 log_packet_detailed("'message' field error detected");
12251 }
12252
12253#endif
12254 SEND_PACKET_END(PACKET_CONNECT_MSG);
12255}
12256
12257 int send_packet_connect_msg(struct connection *pc, const struct packet_connect_msg *packet)
12258{
12259 if (!pc->used) {
12260 log_error("WARNING: trying to send data to the closed connection %s",
12261 conn_description(pc));
12262 return -1;
12263 }
12264 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONNECT_MSG].packet != NULL, -1,
12265 "Handler for PACKET_CONNECT_MSG not installed");
12266 return pc->phs.handlers->send[PACKET_CONNECT_MSG].packet(pc, packet);
12267}
12268
12269 int dsend_packet_connect_msg(struct connection *pc, const char *message)
12270{
12271 struct packet_connect_msg packet, *real_packet = &packet;
12272
12273 sz_strlcpy(real_packet->message, message);
12274
12275 return send_packet_connect_msg(pc, real_packet);
12276}
12277
12278#ifdef FREECIV_DELTA_PROTOCOL
12279#define hash_packet_server_info_100 hash_const
12280
12281#define cmp_packet_server_info_100 cmp_const
12282
12283 BV_DEFINE(packet_server_info_100_fields, 5);
12284#endif /* FREECIV_DELTA_PROTOCOL */
12285
12286 static struct packet_server_info *receive_packet_server_info_100(struct connection *pc)
12287{
12288#ifdef FREECIV_DELTA_PROTOCOL
12289 packet_server_info_100_fields fields;
12290 struct packet_server_info *old;
12291 struct genhash **hash = pc->phs.received + PACKET_SERVER_INFO;
12292#endif /* FREECIV_DELTA_PROTOCOL */
12293 RECEIVE_PACKET_START(packet_server_info, real_packet);
12294#ifdef FREECIV_JSON_CONNECTION
12295 struct plocation field_addr;
12296 {
12297 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12298 field_addr = *field_addr_tmp;
12299 FC_FREE(field_addr_tmp);
12300 }
12301#endif /* FREECIV_JSON_CONNECTION */
12302
12303#ifdef FREECIV_DELTA_PROTOCOL
12304#ifdef FREECIV_JSON_CONNECTION
12305 field_addr.name = "fields";
12306#endif /* FREECIV_JSON_CONNECTION */
12307 DIO_BV_GET(&din, &field_addr, fields);
12308
12309#else /* FREECIV_DELTA_PROTOCOL */
12310#ifdef FREECIV_JSON_CONNECTION
12311 field_addr.name = "version_label";
12312#endif /* FREECIV_JSON_CONNECTION */
12313 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
12314 RECEIVE_PACKET_FIELD_ERROR(version_label);
12315 }
12316#ifdef FREECIV_JSON_CONNECTION
12317 field_addr.name = "major_version";
12318#endif /* FREECIV_JSON_CONNECTION */
12319 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
12320 RECEIVE_PACKET_FIELD_ERROR(major_version);
12321 }
12322#ifdef FREECIV_JSON_CONNECTION
12323 field_addr.name = "minor_version";
12324#endif /* FREECIV_JSON_CONNECTION */
12325 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
12326 RECEIVE_PACKET_FIELD_ERROR(minor_version);
12327 }
12328#ifdef FREECIV_JSON_CONNECTION
12329 field_addr.name = "patch_version";
12330#endif /* FREECIV_JSON_CONNECTION */
12331 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
12332 RECEIVE_PACKET_FIELD_ERROR(patch_version);
12333 }
12334#ifdef FREECIV_JSON_CONNECTION
12335 field_addr.name = "emerg_version";
12336#endif /* FREECIV_JSON_CONNECTION */
12337 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
12338 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
12339 }
12340#endif
12341 log_packet_detailed("packet_server_info_100: got info about ()");
12342
12343#ifdef FREECIV_DELTA_PROTOCOL
12344 if (NULL == *hash) {
12345 *hash = genhash_new_full(hash_packet_server_info_100, cmp_packet_server_info_100,
12346 NULL, NULL, NULL, free);
12347 }
12348
12349 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
12350 *real_packet = *old;
12351 } else {
12352 log_packet_detailed(" no old info");
12353 memset(real_packet, 0, sizeof(*real_packet));
12354 }
12355
12356 if (BV_ISSET(fields, 0)) {
12357 log_packet_detailed(" got field 'version_label'");
12358#ifdef FREECIV_JSON_CONNECTION
12359 field_addr.name = "version_label";
12360#endif /* FREECIV_JSON_CONNECTION */
12361 if (!DIO_GET(string, &din, &field_addr, real_packet->version_label, sizeof(real_packet->version_label))) {
12362 RECEIVE_PACKET_FIELD_ERROR(version_label);
12363 }
12364 }
12365 if (BV_ISSET(fields, 1)) {
12366 log_packet_detailed(" got field 'major_version'");
12367#ifdef FREECIV_JSON_CONNECTION
12368 field_addr.name = "major_version";
12369#endif /* FREECIV_JSON_CONNECTION */
12370 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->major_version)) {
12371 RECEIVE_PACKET_FIELD_ERROR(major_version);
12372 }
12373 }
12374 if (BV_ISSET(fields, 2)) {
12375 log_packet_detailed(" got field 'minor_version'");
12376#ifdef FREECIV_JSON_CONNECTION
12377 field_addr.name = "minor_version";
12378#endif /* FREECIV_JSON_CONNECTION */
12379 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->minor_version)) {
12380 RECEIVE_PACKET_FIELD_ERROR(minor_version);
12381 }
12382 }
12383 if (BV_ISSET(fields, 3)) {
12384 log_packet_detailed(" got field 'patch_version'");
12385#ifdef FREECIV_JSON_CONNECTION
12386 field_addr.name = "patch_version";
12387#endif /* FREECIV_JSON_CONNECTION */
12388 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->patch_version)) {
12389 RECEIVE_PACKET_FIELD_ERROR(patch_version);
12390 }
12391 }
12392 if (BV_ISSET(fields, 4)) {
12393 log_packet_detailed(" got field 'emerg_version'");
12394#ifdef FREECIV_JSON_CONNECTION
12395 field_addr.name = "emerg_version";
12396#endif /* FREECIV_JSON_CONNECTION */
12397 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
12398 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
12399 }
12400 }
12401
12402 if (NULL == old) {
12403 old = fc_malloc(sizeof(*old));
12404 *old = *real_packet;
12405 genhash_insert(*hash, old, old);
12406 } else {
12407 *old = *real_packet;
12408 }
12409
12410#endif /* FREECIV_DELTA_PROTOCOL */
12411 RECEIVE_PACKET_END(real_packet);
12412}
12413
12414 static int send_packet_server_info_100(struct connection *pc, const struct packet_server_info *packet)
12415{
12416 const struct packet_server_info *real_packet = packet;
12417 int e;
12418#ifdef FREECIV_DELTA_PROTOCOL
12419 packet_server_info_100_fields fields;
12420 struct packet_server_info *old;
12421 bool differ;
12422 struct genhash **hash = pc->phs.sent + PACKET_SERVER_INFO;
12423#endif /* FREECIV_DELTA_PROTOCOL */
12424 SEND_PACKET_START(PACKET_SERVER_INFO);
12425#ifdef FREECIV_JSON_CONNECTION
12426 struct plocation field_addr;
12427 {
12428 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12429 field_addr = *field_addr_tmp;
12430 FC_FREE(field_addr_tmp);
12431 }
12432#endif /* FREECIV_JSON_CONNECTION */
12433
12434 log_packet_detailed("packet_server_info_100: sending info about ()");
12435
12436#ifdef FREECIV_DELTA_PROTOCOL
12437 if (NULL == *hash) {
12438 *hash = genhash_new_full(hash_packet_server_info_100, cmp_packet_server_info_100,
12439 NULL, NULL, NULL, free);
12440 }
12441 BV_CLR_ALL(fields);
12442
12443 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12444 old = fc_malloc(sizeof(*old));
12445 *old = *real_packet;
12446 genhash_insert(*hash, old, old);
12447 memset(old, 0, sizeof(*old));
12448 }
12449 differ = (strcmp(old->version_label, real_packet->version_label) != 0);
12450 if (differ) {
12451 BV_SET(fields, 0);
12452 }
12453
12454 differ = (old->major_version != real_packet->major_version);
12455 if (differ) {
12456 BV_SET(fields, 1);
12457 }
12458
12459 differ = (old->minor_version != real_packet->minor_version);
12460 if (differ) {
12461 BV_SET(fields, 2);
12462 }
12463
12464 differ = (old->patch_version != real_packet->patch_version);
12465 if (differ) {
12466 BV_SET(fields, 3);
12467 }
12468
12469 differ = (old->emerg_version != real_packet->emerg_version);
12470 if (differ) {
12471 BV_SET(fields, 4);
12472 }
12473
12474
12475#ifdef FREECIV_JSON_CONNECTION
12476 field_addr.name = "fields";
12477#endif /* FREECIV_JSON_CONNECTION */
12478 e = 0;
12479 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12480 if (e) {
12481 log_packet_detailed("fields bitvector error detected");
12482 }
12483
12484 if (BV_ISSET(fields, 0)) {
12485 log_packet_detailed(" field 'version_label' has changed");
12486#ifdef FREECIV_JSON_CONNECTION
12487 field_addr.name = "version_label";
12488#endif /* FREECIV_JSON_CONNECTION */
12489 e = 0;
12490 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
12491 if (e) {
12492 log_packet_detailed("'version_label' field error detected");
12493 }
12494 }
12495 if (BV_ISSET(fields, 1)) {
12496 log_packet_detailed(" field 'major_version' has changed");
12497#ifdef FREECIV_JSON_CONNECTION
12498 field_addr.name = "major_version";
12499#endif /* FREECIV_JSON_CONNECTION */
12500 e = 0;
12501 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
12502 if (e) {
12503 log_packet_detailed("'major_version' field error detected");
12504 }
12505 }
12506 if (BV_ISSET(fields, 2)) {
12507 log_packet_detailed(" field 'minor_version' has changed");
12508#ifdef FREECIV_JSON_CONNECTION
12509 field_addr.name = "minor_version";
12510#endif /* FREECIV_JSON_CONNECTION */
12511 e = 0;
12512 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
12513 if (e) {
12514 log_packet_detailed("'minor_version' field error detected");
12515 }
12516 }
12517 if (BV_ISSET(fields, 3)) {
12518 log_packet_detailed(" field 'patch_version' has changed");
12519#ifdef FREECIV_JSON_CONNECTION
12520 field_addr.name = "patch_version";
12521#endif /* FREECIV_JSON_CONNECTION */
12522 e = 0;
12523 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
12524 if (e) {
12525 log_packet_detailed("'patch_version' field error detected");
12526 }
12527 }
12528 if (BV_ISSET(fields, 4)) {
12529 log_packet_detailed(" field 'emerg_version' has changed");
12530#ifdef FREECIV_JSON_CONNECTION
12531 field_addr.name = "emerg_version";
12532#endif /* FREECIV_JSON_CONNECTION */
12533 e = 0;
12534 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
12535 if (e) {
12536 log_packet_detailed("'emerg_version' field error detected");
12537 }
12538 }
12539
12540 *old = *real_packet;
12541#endif /* FREECIV_DELTA_PROTOCOL */
12542#ifndef FREECIV_DELTA_PROTOCOL
12543#ifdef FREECIV_JSON_CONNECTION
12544 field_addr.name = "version_label";
12545#endif /* FREECIV_JSON_CONNECTION */
12546 e = 0;
12547 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version_label);
12548 if (e) {
12549 log_packet_detailed("'version_label' field error detected");
12550 }
12551#ifdef FREECIV_JSON_CONNECTION
12552 field_addr.name = "major_version";
12553#endif /* FREECIV_JSON_CONNECTION */
12554 e = 0;
12555 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->major_version);
12556 if (e) {
12557 log_packet_detailed("'major_version' field error detected");
12558 }
12559#ifdef FREECIV_JSON_CONNECTION
12560 field_addr.name = "minor_version";
12561#endif /* FREECIV_JSON_CONNECTION */
12562 e = 0;
12563 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->minor_version);
12564 if (e) {
12565 log_packet_detailed("'minor_version' field error detected");
12566 }
12567#ifdef FREECIV_JSON_CONNECTION
12568 field_addr.name = "patch_version";
12569#endif /* FREECIV_JSON_CONNECTION */
12570 e = 0;
12571 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->patch_version);
12572 if (e) {
12573 log_packet_detailed("'patch_version' field error detected");
12574 }
12575#ifdef FREECIV_JSON_CONNECTION
12576 field_addr.name = "emerg_version";
12577#endif /* FREECIV_JSON_CONNECTION */
12578 e = 0;
12579 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
12580 if (e) {
12581 log_packet_detailed("'emerg_version' field error detected");
12582 }
12583
12584#endif
12585 SEND_PACKET_END(PACKET_SERVER_INFO);
12586}
12587
12588 int send_packet_server_info(struct connection *pc, const struct packet_server_info *packet)
12589{
12590 if (!pc->used) {
12591 log_error("WARNING: trying to send data to the closed connection %s",
12592 conn_description(pc));
12593 return -1;
12594 }
12595 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_INFO].packet != NULL, -1,
12596 "Handler for PACKET_SERVER_INFO not installed");
12597 return pc->phs.handlers->send[PACKET_SERVER_INFO].packet(pc, packet);
12598}
12599
12600 int dsend_packet_server_info(struct connection *pc, const char *version_label, int major_version, int minor_version, int patch_version, int emerg_version)
12601{
12602 struct packet_server_info packet, *real_packet = &packet;
12603
12604 sz_strlcpy(real_packet->version_label, version_label);
12605 real_packet->major_version = major_version;
12606 real_packet->minor_version = minor_version;
12607 real_packet->patch_version = patch_version;
12608 real_packet->emerg_version = emerg_version;
12609
12610 return send_packet_server_info(pc, real_packet);
12611}
12612
12613#ifdef FREECIV_DELTA_PROTOCOL
12614#define hash_packet_city_remove_100 hash_const
12615
12616#define cmp_packet_city_remove_100 cmp_const
12617
12618 BV_DEFINE(packet_city_remove_100_fields, 1);
12619#endif /* FREECIV_DELTA_PROTOCOL */
12620
12621 static struct packet_city_remove *receive_packet_city_remove_100(struct connection *pc)
12622{
12623#ifdef FREECIV_DELTA_PROTOCOL
12624 packet_city_remove_100_fields fields;
12625 struct packet_city_remove *old;
12626 struct genhash **hash = pc->phs.received + PACKET_CITY_REMOVE;
12627#endif /* FREECIV_DELTA_PROTOCOL */
12628 RECEIVE_PACKET_START(packet_city_remove, real_packet);
12629#ifdef FREECIV_JSON_CONNECTION
12630 struct plocation field_addr;
12631 {
12632 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12633 field_addr = *field_addr_tmp;
12634 FC_FREE(field_addr_tmp);
12635 }
12636#endif /* FREECIV_JSON_CONNECTION */
12637
12638#ifdef FREECIV_DELTA_PROTOCOL
12639#ifdef FREECIV_JSON_CONNECTION
12640 field_addr.name = "fields";
12641#endif /* FREECIV_JSON_CONNECTION */
12642 DIO_BV_GET(&din, &field_addr, fields);
12643
12644#else /* FREECIV_DELTA_PROTOCOL */
12645#ifdef FREECIV_JSON_CONNECTION
12646 field_addr.name = "city_id";
12647#endif /* FREECIV_JSON_CONNECTION */
12648 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
12649 RECEIVE_PACKET_FIELD_ERROR(city_id);
12650 }
12651#endif
12652 log_packet_detailed("packet_city_remove_100: got info about ()");
12653
12654#ifdef FREECIV_DELTA_PROTOCOL
12655 if (NULL == *hash) {
12656 *hash = genhash_new_full(hash_packet_city_remove_100, cmp_packet_city_remove_100,
12657 NULL, NULL, NULL, free);
12658 }
12659
12660 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
12661 *real_packet = *old;
12662 } else {
12663 log_packet_detailed(" no old info");
12664 memset(real_packet, 0, sizeof(*real_packet));
12665 }
12666
12667 if (BV_ISSET(fields, 0)) {
12668 log_packet_detailed(" got field 'city_id'");
12669#ifdef FREECIV_JSON_CONNECTION
12670 field_addr.name = "city_id";
12671#endif /* FREECIV_JSON_CONNECTION */
12672 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
12673 RECEIVE_PACKET_FIELD_ERROR(city_id);
12674 }
12675 }
12676
12677 if (NULL == old) {
12678 old = fc_malloc(sizeof(*old));
12679 *old = *real_packet;
12680 genhash_insert(*hash, old, old);
12681 } else {
12682 *old = *real_packet;
12683 }
12684
12685 hash = pc->phs.received + PACKET_CITY_INFO;
12686 if (NULL != *hash) {
12687 genhash_remove(*hash, real_packet);
12688 }
12689
12690 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
12691 if (NULL != *hash) {
12692 genhash_remove(*hash, real_packet);
12693 }
12694
12695 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
12696 if (NULL != *hash) {
12697 genhash_remove(*hash, real_packet);
12698 }
12699
12700 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
12701 if (NULL != *hash) {
12702 genhash_remove(*hash, real_packet);
12703 }
12704
12705 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
12706 if (NULL != *hash) {
12707 genhash_remove(*hash, real_packet);
12708 }
12709
12710#endif /* FREECIV_DELTA_PROTOCOL */
12711 RECEIVE_PACKET_END(real_packet);
12712}
12713
12714 static int send_packet_city_remove_100(struct connection *pc, const struct packet_city_remove *packet)
12715{
12716 const struct packet_city_remove *real_packet = packet;
12717 int e;
12718#ifdef FREECIV_DELTA_PROTOCOL
12719 packet_city_remove_100_fields fields;
12720 struct packet_city_remove *old;
12721 bool differ;
12722 struct genhash **hash = pc->phs.sent + PACKET_CITY_REMOVE;
12723#endif /* FREECIV_DELTA_PROTOCOL */
12724 SEND_PACKET_START(PACKET_CITY_REMOVE);
12725#ifdef FREECIV_JSON_CONNECTION
12726 struct plocation field_addr;
12727 {
12728 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12729 field_addr = *field_addr_tmp;
12730 FC_FREE(field_addr_tmp);
12731 }
12732#endif /* FREECIV_JSON_CONNECTION */
12733
12734 log_packet_detailed("packet_city_remove_100: sending info about ()");
12735
12736#ifdef FREECIV_DELTA_PROTOCOL
12737 if (NULL == *hash) {
12738 *hash = genhash_new_full(hash_packet_city_remove_100, cmp_packet_city_remove_100,
12739 NULL, NULL, NULL, free);
12740 }
12741 BV_CLR_ALL(fields);
12742
12743 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
12744 old = fc_malloc(sizeof(*old));
12745 *old = *real_packet;
12746 genhash_insert(*hash, old, old);
12747 memset(old, 0, sizeof(*old));
12748 }
12749 differ = (old->city_id != real_packet->city_id);
12750 if (differ) {
12751 BV_SET(fields, 0);
12752 }
12753
12754
12755#ifdef FREECIV_JSON_CONNECTION
12756 field_addr.name = "fields";
12757#endif /* FREECIV_JSON_CONNECTION */
12758 e = 0;
12759 e |= DIO_BV_PUT(&dout, &field_addr, fields);
12760 if (e) {
12761 log_packet_detailed("fields bitvector error detected");
12762 }
12763
12764 if (BV_ISSET(fields, 0)) {
12765 log_packet_detailed(" field 'city_id' has changed");
12766#ifdef FREECIV_JSON_CONNECTION
12767 field_addr.name = "city_id";
12768#endif /* FREECIV_JSON_CONNECTION */
12769 e = 0;
12770 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
12771 if (e) {
12772 log_packet_detailed("'city_id' field error detected");
12773 }
12774 }
12775
12776 *old = *real_packet;
12777
12778 hash = pc->phs.sent + PACKET_CITY_INFO;
12779 if (NULL != *hash) {
12780 genhash_remove(*hash, real_packet);
12781 }
12782
12783 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
12784 if (NULL != *hash) {
12785 genhash_remove(*hash, real_packet);
12786 }
12787
12788 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
12789 if (NULL != *hash) {
12790 genhash_remove(*hash, real_packet);
12791 }
12792
12793 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
12794 if (NULL != *hash) {
12795 genhash_remove(*hash, real_packet);
12796 }
12797
12798 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
12799 if (NULL != *hash) {
12800 genhash_remove(*hash, real_packet);
12801 }
12802#endif /* FREECIV_DELTA_PROTOCOL */
12803#ifndef FREECIV_DELTA_PROTOCOL
12804#ifdef FREECIV_JSON_CONNECTION
12805 field_addr.name = "city_id";
12806#endif /* FREECIV_JSON_CONNECTION */
12807 e = 0;
12808 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
12809 if (e) {
12810 log_packet_detailed("'city_id' field error detected");
12811 }
12812
12813#endif
12814 SEND_PACKET_END(PACKET_CITY_REMOVE);
12815}
12816
12817 int send_packet_city_remove(struct connection *pc, const struct packet_city_remove *packet)
12818{
12819 if (!pc->used) {
12820 log_error("WARNING: trying to send data to the closed connection %s",
12821 conn_description(pc));
12822 return -1;
12823 }
12824 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_REMOVE].packet != NULL, -1,
12825 "Handler for PACKET_CITY_REMOVE not installed");
12826 return pc->phs.handlers->send[PACKET_CITY_REMOVE].packet(pc, packet);
12827}
12828
12829 void lsend_packet_city_remove(struct conn_list *dest, const struct packet_city_remove *packet)
12830{
12831 conn_list_iterate(dest, pconn) {
12832 send_packet_city_remove(pconn, packet);
12833 } conn_list_iterate_end;
12834}
12835
12836 int dsend_packet_city_remove(struct connection *pc, int city_id)
12837{
12838 struct packet_city_remove packet, *real_packet = &packet;
12839
12840 real_packet->city_id = city_id;
12841
12842 return send_packet_city_remove(pc, real_packet);
12843}
12844
12845 void dlsend_packet_city_remove(struct conn_list *dest, int city_id)
12846{
12847 struct packet_city_remove packet, *real_packet = &packet;
12848
12849 real_packet->city_id = city_id;
12850
12851 lsend_packet_city_remove(dest, real_packet);
12852}
12853
12854#ifdef FREECIV_DELTA_PROTOCOL
12855static genhash_val_t hash_packet_city_info_100(const void *vkey)
12856{
12857 const struct packet_city_info *key = (const struct packet_city_info *) vkey;
12858 genhash_val_t result = 0;
12859
12860 result += key->id;
12861
12862 result &= 0xFFFFFFFF;
12863 return result;
12864}
12865
12866static bool cmp_packet_city_info_100(const void *vkey1, const void *vkey2)
12867{
12868 const struct packet_city_info *old = (const struct packet_city_info *) vkey1;
12869 const struct packet_city_info *real_packet = (const struct packet_city_info *) vkey2;
12870 bool differ;
12871
12872 differ = (old->id != real_packet->id);
12873
12874 return !differ;
12875}
12876 BV_DEFINE(packet_city_info_100_fields, 50);
12877#endif /* FREECIV_DELTA_PROTOCOL */
12878
12879 static struct packet_city_info *receive_packet_city_info_100(struct connection *pc)
12880{
12881#ifdef FREECIV_DELTA_PROTOCOL
12882 packet_city_info_100_fields fields;
12883 struct packet_city_info *old;
12884 struct genhash **hash = pc->phs.received + PACKET_CITY_INFO;
12885#endif /* FREECIV_DELTA_PROTOCOL */
12886 RECEIVE_PACKET_START(packet_city_info, real_packet);
12887#ifdef FREECIV_JSON_CONNECTION
12888 struct plocation field_addr;
12889 {
12890 struct plocation *field_addr_tmp = plocation_field_new(NULL);
12891 field_addr = *field_addr_tmp;
12892 FC_FREE(field_addr_tmp);
12893 }
12894#endif /* FREECIV_JSON_CONNECTION */
12895
12896#ifdef FREECIV_DELTA_PROTOCOL
12897#ifdef FREECIV_JSON_CONNECTION
12898 field_addr.name = "fields";
12899#endif /* FREECIV_JSON_CONNECTION */
12900 DIO_BV_GET(&din, &field_addr, fields);
12901#ifdef FREECIV_JSON_CONNECTION
12902 field_addr.name = "id";
12903#endif /* FREECIV_JSON_CONNECTION */
12904 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
12905 RECEIVE_PACKET_FIELD_ERROR(id);
12906 }
12907
12908#else /* FREECIV_DELTA_PROTOCOL */
12909#ifdef FREECIV_JSON_CONNECTION
12910 field_addr.name = "id";
12911#endif /* FREECIV_JSON_CONNECTION */
12912 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
12913 RECEIVE_PACKET_FIELD_ERROR(id);
12914 }
12915#ifdef FREECIV_JSON_CONNECTION
12916 field_addr.name = "tile";
12917#endif /* FREECIV_JSON_CONNECTION */
12918 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
12919 RECEIVE_PACKET_FIELD_ERROR(tile);
12920 }
12921#ifdef FREECIV_JSON_CONNECTION
12922 field_addr.name = "owner";
12923#endif /* FREECIV_JSON_CONNECTION */
12924 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
12925 RECEIVE_PACKET_FIELD_ERROR(owner);
12926 }
12927#ifdef FREECIV_JSON_CONNECTION
12928 field_addr.name = "original";
12929#endif /* FREECIV_JSON_CONNECTION */
12930 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
12931 RECEIVE_PACKET_FIELD_ERROR(original);
12932 }
12933#ifdef FREECIV_JSON_CONNECTION
12934 field_addr.name = "size";
12935#endif /* FREECIV_JSON_CONNECTION */
12936 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
12937 RECEIVE_PACKET_FIELD_ERROR(size);
12938 }
12939#ifdef FREECIV_JSON_CONNECTION
12940 field_addr.name = "city_radius_sq";
12941#endif /* FREECIV_JSON_CONNECTION */
12942 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
12943 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
12944 }
12945#ifdef FREECIV_JSON_CONNECTION
12946 field_addr.name = "style";
12947#endif /* FREECIV_JSON_CONNECTION */
12948 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
12949 RECEIVE_PACKET_FIELD_ERROR(style);
12950 }
12951#ifdef FREECIV_JSON_CONNECTION
12952 field_addr.name = "capital";
12953#endif /* FREECIV_JSON_CONNECTION */
12954 {
12955 int readin;
12956
12957 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
12958 RECEIVE_PACKET_FIELD_ERROR(capital);
12959 }
12960 real_packet->capital = readin;
12961 }
12962#ifdef FREECIV_JSON_CONNECTION
12963 field_addr.name = "ppl_happy";
12964#endif /* FREECIV_JSON_CONNECTION */
12965 {
12966 int i;
12967
12968#ifdef FREECIV_JSON_CONNECTION
12969 /* Enter array. */
12970 field_addr.sub_location = plocation_elem_new(0);
12971#endif /* FREECIV_JSON_CONNECTION */
12972
12973 for (i = 0; i < FEELING_LAST; i++) {
12974#ifdef FREECIV_JSON_CONNECTION
12975 field_addr.sub_location->number = i;
12976#endif /* FREECIV_JSON_CONNECTION */
12977 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
12978 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
12979 }
12980 }
12981
12982#ifdef FREECIV_JSON_CONNECTION
12983 /* Exit array. */
12984 FC_FREE(field_addr.sub_location);
12985#endif /* FREECIV_JSON_CONNECTION */
12986 }
12987#ifdef FREECIV_JSON_CONNECTION
12988 field_addr.name = "ppl_content";
12989#endif /* FREECIV_JSON_CONNECTION */
12990 {
12991 int i;
12992
12993#ifdef FREECIV_JSON_CONNECTION
12994 /* Enter array. */
12995 field_addr.sub_location = plocation_elem_new(0);
12996#endif /* FREECIV_JSON_CONNECTION */
12997
12998 for (i = 0; i < FEELING_LAST; i++) {
12999#ifdef FREECIV_JSON_CONNECTION
13000 field_addr.sub_location->number = i;
13001#endif /* FREECIV_JSON_CONNECTION */
13002 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
13003 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
13004 }
13005 }
13006
13007#ifdef FREECIV_JSON_CONNECTION
13008 /* Exit array. */
13009 FC_FREE(field_addr.sub_location);
13010#endif /* FREECIV_JSON_CONNECTION */
13011 }
13012#ifdef FREECIV_JSON_CONNECTION
13013 field_addr.name = "ppl_unhappy";
13014#endif /* FREECIV_JSON_CONNECTION */
13015 {
13016 int i;
13017
13018#ifdef FREECIV_JSON_CONNECTION
13019 /* Enter array. */
13020 field_addr.sub_location = plocation_elem_new(0);
13021#endif /* FREECIV_JSON_CONNECTION */
13022
13023 for (i = 0; i < FEELING_LAST; i++) {
13024#ifdef FREECIV_JSON_CONNECTION
13025 field_addr.sub_location->number = i;
13026#endif /* FREECIV_JSON_CONNECTION */
13027 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
13028 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
13029 }
13030 }
13031
13032#ifdef FREECIV_JSON_CONNECTION
13033 /* Exit array. */
13034 FC_FREE(field_addr.sub_location);
13035#endif /* FREECIV_JSON_CONNECTION */
13036 }
13037#ifdef FREECIV_JSON_CONNECTION
13038 field_addr.name = "ppl_angry";
13039#endif /* FREECIV_JSON_CONNECTION */
13040 {
13041 int i;
13042
13043#ifdef FREECIV_JSON_CONNECTION
13044 /* Enter array. */
13045 field_addr.sub_location = plocation_elem_new(0);
13046#endif /* FREECIV_JSON_CONNECTION */
13047
13048 for (i = 0; i < FEELING_LAST; i++) {
13049#ifdef FREECIV_JSON_CONNECTION
13050 field_addr.sub_location->number = i;
13051#endif /* FREECIV_JSON_CONNECTION */
13052 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
13053 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
13054 }
13055 }
13056
13057#ifdef FREECIV_JSON_CONNECTION
13058 /* Exit array. */
13059 FC_FREE(field_addr.sub_location);
13060#endif /* FREECIV_JSON_CONNECTION */
13061 }
13062#ifdef FREECIV_JSON_CONNECTION
13063 field_addr.name = "specialists_size";
13064#endif /* FREECIV_JSON_CONNECTION */
13065 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
13066 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
13067 }
13068#ifdef FREECIV_JSON_CONNECTION
13069 field_addr.name = "specialists";
13070#endif /* FREECIV_JSON_CONNECTION */
13071 {
13072 int i;
13073
13074#ifdef FREECIV_JSON_CONNECTION
13075 /* Enter array. */
13076 field_addr.sub_location = plocation_elem_new(0);
13077#endif /* FREECIV_JSON_CONNECTION */
13078
13079 if (real_packet->specialists_size > SP_MAX) {
13080 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
13081 }
13082 for (i = 0; i < real_packet->specialists_size; i++) {
13083#ifdef FREECIV_JSON_CONNECTION
13084 field_addr.sub_location->number = i;
13085#endif /* FREECIV_JSON_CONNECTION */
13086 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
13087 RECEIVE_PACKET_FIELD_ERROR(specialists);
13088 }
13089 }
13090
13091#ifdef FREECIV_JSON_CONNECTION
13092 /* Exit array. */
13093 FC_FREE(field_addr.sub_location);
13094#endif /* FREECIV_JSON_CONNECTION */
13095 }
13096#ifdef FREECIV_JSON_CONNECTION
13097 field_addr.name = "history";
13098#endif /* FREECIV_JSON_CONNECTION */
13099 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
13100 RECEIVE_PACKET_FIELD_ERROR(history);
13101 }
13102#ifdef FREECIV_JSON_CONNECTION
13103 field_addr.name = "culture";
13104#endif /* FREECIV_JSON_CONNECTION */
13105 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
13106 RECEIVE_PACKET_FIELD_ERROR(culture);
13107 }
13108#ifdef FREECIV_JSON_CONNECTION
13109 field_addr.name = "buy_cost";
13110#endif /* FREECIV_JSON_CONNECTION */
13111 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
13112 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
13113 }
13114#ifdef FREECIV_JSON_CONNECTION
13115 field_addr.name = "surplus";
13116#endif /* FREECIV_JSON_CONNECTION */
13117 {
13118 int i;
13119
13120#ifdef FREECIV_JSON_CONNECTION
13121 /* Enter array. */
13122 field_addr.sub_location = plocation_elem_new(0);
13123#endif /* FREECIV_JSON_CONNECTION */
13124
13125 for (i = 0; i < O_LAST; i++) {
13126#ifdef FREECIV_JSON_CONNECTION
13127 field_addr.sub_location->number = i;
13128#endif /* FREECIV_JSON_CONNECTION */
13129 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
13130 RECEIVE_PACKET_FIELD_ERROR(surplus);
13131 }
13132 }
13133
13134#ifdef FREECIV_JSON_CONNECTION
13135 /* Exit array. */
13136 FC_FREE(field_addr.sub_location);
13137#endif /* FREECIV_JSON_CONNECTION */
13138 }
13139#ifdef FREECIV_JSON_CONNECTION
13140 field_addr.name = "waste";
13141#endif /* FREECIV_JSON_CONNECTION */
13142 {
13143 int i;
13144
13145#ifdef FREECIV_JSON_CONNECTION
13146 /* Enter array. */
13147 field_addr.sub_location = plocation_elem_new(0);
13148#endif /* FREECIV_JSON_CONNECTION */
13149
13150 for (i = 0; i < O_LAST; i++) {
13151#ifdef FREECIV_JSON_CONNECTION
13152 field_addr.sub_location->number = i;
13153#endif /* FREECIV_JSON_CONNECTION */
13154 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
13155 RECEIVE_PACKET_FIELD_ERROR(waste);
13156 }
13157 }
13158
13159#ifdef FREECIV_JSON_CONNECTION
13160 /* Exit array. */
13161 FC_FREE(field_addr.sub_location);
13162#endif /* FREECIV_JSON_CONNECTION */
13163 }
13164#ifdef FREECIV_JSON_CONNECTION
13165 field_addr.name = "unhappy_penalty";
13166#endif /* FREECIV_JSON_CONNECTION */
13167 {
13168 int i;
13169
13170#ifdef FREECIV_JSON_CONNECTION
13171 /* Enter array. */
13172 field_addr.sub_location = plocation_elem_new(0);
13173#endif /* FREECIV_JSON_CONNECTION */
13174
13175 for (i = 0; i < O_LAST; i++) {
13176#ifdef FREECIV_JSON_CONNECTION
13177 field_addr.sub_location->number = i;
13178#endif /* FREECIV_JSON_CONNECTION */
13179 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
13180 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
13181 }
13182 }
13183
13184#ifdef FREECIV_JSON_CONNECTION
13185 /* Exit array. */
13186 FC_FREE(field_addr.sub_location);
13187#endif /* FREECIV_JSON_CONNECTION */
13188 }
13189#ifdef FREECIV_JSON_CONNECTION
13190 field_addr.name = "prod";
13191#endif /* FREECIV_JSON_CONNECTION */
13192 {
13193 int i;
13194
13195#ifdef FREECIV_JSON_CONNECTION
13196 /* Enter array. */
13197 field_addr.sub_location = plocation_elem_new(0);
13198#endif /* FREECIV_JSON_CONNECTION */
13199
13200 for (i = 0; i < O_LAST; i++) {
13201#ifdef FREECIV_JSON_CONNECTION
13202 field_addr.sub_location->number = i;
13203#endif /* FREECIV_JSON_CONNECTION */
13204 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
13205 RECEIVE_PACKET_FIELD_ERROR(prod);
13206 }
13207 }
13208
13209#ifdef FREECIV_JSON_CONNECTION
13210 /* Exit array. */
13211 FC_FREE(field_addr.sub_location);
13212#endif /* FREECIV_JSON_CONNECTION */
13213 }
13214#ifdef FREECIV_JSON_CONNECTION
13215 field_addr.name = "citizen_base";
13216#endif /* FREECIV_JSON_CONNECTION */
13217 {
13218 int i;
13219
13220#ifdef FREECIV_JSON_CONNECTION
13221 /* Enter array. */
13222 field_addr.sub_location = plocation_elem_new(0);
13223#endif /* FREECIV_JSON_CONNECTION */
13224
13225 for (i = 0; i < O_LAST; i++) {
13226#ifdef FREECIV_JSON_CONNECTION
13227 field_addr.sub_location->number = i;
13228#endif /* FREECIV_JSON_CONNECTION */
13229 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
13230 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
13231 }
13232 }
13233
13234#ifdef FREECIV_JSON_CONNECTION
13235 /* Exit array. */
13236 FC_FREE(field_addr.sub_location);
13237#endif /* FREECIV_JSON_CONNECTION */
13238 }
13239#ifdef FREECIV_JSON_CONNECTION
13240 field_addr.name = "usage";
13241#endif /* FREECIV_JSON_CONNECTION */
13242 {
13243 int i;
13244
13245#ifdef FREECIV_JSON_CONNECTION
13246 /* Enter array. */
13247 field_addr.sub_location = plocation_elem_new(0);
13248#endif /* FREECIV_JSON_CONNECTION */
13249
13250 for (i = 0; i < O_LAST; i++) {
13251#ifdef FREECIV_JSON_CONNECTION
13252 field_addr.sub_location->number = i;
13253#endif /* FREECIV_JSON_CONNECTION */
13254 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
13255 RECEIVE_PACKET_FIELD_ERROR(usage);
13256 }
13257 }
13258
13259#ifdef FREECIV_JSON_CONNECTION
13260 /* Exit array. */
13261 FC_FREE(field_addr.sub_location);
13262#endif /* FREECIV_JSON_CONNECTION */
13263 }
13264#ifdef FREECIV_JSON_CONNECTION
13265 field_addr.name = "food_stock";
13266#endif /* FREECIV_JSON_CONNECTION */
13267 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
13268 RECEIVE_PACKET_FIELD_ERROR(food_stock);
13269 }
13270#ifdef FREECIV_JSON_CONNECTION
13271 field_addr.name = "shield_stock";
13272#endif /* FREECIV_JSON_CONNECTION */
13273 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
13274 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
13275 }
13276#ifdef FREECIV_JSON_CONNECTION
13277 field_addr.name = "trade_route_count";
13278#endif /* FREECIV_JSON_CONNECTION */
13279 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
13280 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
13281 }
13282#ifdef FREECIV_JSON_CONNECTION
13283 field_addr.name = "pollution";
13284#endif /* FREECIV_JSON_CONNECTION */
13285 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
13286 RECEIVE_PACKET_FIELD_ERROR(pollution);
13287 }
13288#ifdef FREECIV_JSON_CONNECTION
13289 field_addr.name = "illness_trade";
13290#endif /* FREECIV_JSON_CONNECTION */
13291 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
13292 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
13293 }
13294#ifdef FREECIV_JSON_CONNECTION
13295 field_addr.name = "production_kind";
13296#endif /* FREECIV_JSON_CONNECTION */
13297 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
13298 RECEIVE_PACKET_FIELD_ERROR(production_kind);
13299 }
13300#ifdef FREECIV_JSON_CONNECTION
13301 field_addr.name = "production_value";
13302#endif /* FREECIV_JSON_CONNECTION */
13303 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
13304 RECEIVE_PACKET_FIELD_ERROR(production_value);
13305 }
13306#ifdef FREECIV_JSON_CONNECTION
13307 field_addr.name = "turn_founded";
13308#endif /* FREECIV_JSON_CONNECTION */
13309 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
13310 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
13311 }
13312#ifdef FREECIV_JSON_CONNECTION
13313 field_addr.name = "turn_last_built";
13314#endif /* FREECIV_JSON_CONNECTION */
13315 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
13316 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
13317 }
13318#ifdef FREECIV_JSON_CONNECTION
13319 field_addr.name = "changed_from_kind";
13320#endif /* FREECIV_JSON_CONNECTION */
13321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
13322 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
13323 }
13324#ifdef FREECIV_JSON_CONNECTION
13325 field_addr.name = "changed_from_value";
13326#endif /* FREECIV_JSON_CONNECTION */
13327 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
13328 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
13329 }
13330#ifdef FREECIV_JSON_CONNECTION
13331 field_addr.name = "before_change_shields";
13332#endif /* FREECIV_JSON_CONNECTION */
13333 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
13334 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
13335 }
13336#ifdef FREECIV_JSON_CONNECTION
13337 field_addr.name = "disbanded_shields";
13338#endif /* FREECIV_JSON_CONNECTION */
13339 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
13340 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
13341 }
13342#ifdef FREECIV_JSON_CONNECTION
13343 field_addr.name = "caravan_shields";
13344#endif /* FREECIV_JSON_CONNECTION */
13345 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
13346 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
13347 }
13348#ifdef FREECIV_JSON_CONNECTION
13349 field_addr.name = "last_turns_shield_surplus";
13350#endif /* FREECIV_JSON_CONNECTION */
13351 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
13352 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
13353 }
13354#ifdef FREECIV_JSON_CONNECTION
13355 field_addr.name = "airlift";
13356#endif /* FREECIV_JSON_CONNECTION */
13357 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
13358 RECEIVE_PACKET_FIELD_ERROR(airlift);
13359 }
13360#ifdef FREECIV_JSON_CONNECTION
13361 field_addr.name = "did_buy";
13362#endif /* FREECIV_JSON_CONNECTION */
13363 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
13364 RECEIVE_PACKET_FIELD_ERROR(did_buy);
13365 }
13366#ifdef FREECIV_JSON_CONNECTION
13367 field_addr.name = "did_sell";
13368#endif /* FREECIV_JSON_CONNECTION */
13369 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
13370 RECEIVE_PACKET_FIELD_ERROR(did_sell);
13371 }
13372#ifdef FREECIV_JSON_CONNECTION
13373 field_addr.name = "was_happy";
13374#endif /* FREECIV_JSON_CONNECTION */
13375 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
13376 RECEIVE_PACKET_FIELD_ERROR(was_happy);
13377 }
13378#ifdef FREECIV_JSON_CONNECTION
13379 field_addr.name = "had_famine";
13380#endif /* FREECIV_JSON_CONNECTION */
13381 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->had_famine)) {
13382 RECEIVE_PACKET_FIELD_ERROR(had_famine);
13383 }
13384#ifdef FREECIV_JSON_CONNECTION
13385 field_addr.name = "diplomat_investigate";
13386#endif /* FREECIV_JSON_CONNECTION */
13387 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->diplomat_investigate)) {
13388 RECEIVE_PACKET_FIELD_ERROR(diplomat_investigate);
13389 }
13390#ifdef FREECIV_JSON_CONNECTION
13391 field_addr.name = "walls";
13392#endif /* FREECIV_JSON_CONNECTION */
13393 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
13394 RECEIVE_PACKET_FIELD_ERROR(walls);
13395 }
13396#ifdef FREECIV_JSON_CONNECTION
13397 field_addr.name = "city_image";
13398#endif /* FREECIV_JSON_CONNECTION */
13399 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
13400 RECEIVE_PACKET_FIELD_ERROR(city_image);
13401 }
13402#ifdef FREECIV_JSON_CONNECTION
13403 field_addr.name = "steal";
13404#endif /* FREECIV_JSON_CONNECTION */
13405 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
13406 RECEIVE_PACKET_FIELD_ERROR(steal);
13407 }
13408#ifdef FREECIV_JSON_CONNECTION
13409 field_addr.name = "worklist";
13410#endif /* FREECIV_JSON_CONNECTION */
13411 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
13412 RECEIVE_PACKET_FIELD_ERROR(worklist);
13413 }
13414#ifdef FREECIV_JSON_CONNECTION
13415 field_addr.name = "improvements";
13416#endif /* FREECIV_JSON_CONNECTION */
13417 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
13418 RECEIVE_PACKET_FIELD_ERROR(improvements);
13419 }
13420#ifdef FREECIV_JSON_CONNECTION
13421 field_addr.name = "city_options";
13422#endif /* FREECIV_JSON_CONNECTION */
13423 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
13424 RECEIVE_PACKET_FIELD_ERROR(city_options);
13425 }
13426#ifdef FREECIV_JSON_CONNECTION
13427 field_addr.name = "name";
13428#endif /* FREECIV_JSON_CONNECTION */
13429 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
13430 RECEIVE_PACKET_FIELD_ERROR(name);
13431 }
13432#endif
13433 log_packet_detailed("packet_city_info_100: got info about (%d)",
13434 real_packet->id);
13435
13436#ifdef FREECIV_DELTA_PROTOCOL
13437 if (NULL == *hash) {
13438 *hash = genhash_new_full(hash_packet_city_info_100, cmp_packet_city_info_100,
13439 NULL, NULL, NULL, free);
13440 }
13441
13442 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
13443 *real_packet = *old;
13444 } else {
13445 int id;
13446
13447 id = real_packet->id;
13448
13449 log_packet_detailed(" no old info");
13450 memset(real_packet, 0, sizeof(*real_packet));
13451
13452 real_packet->id = id;
13453 }
13454
13455 if (BV_ISSET(fields, 0)) {
13456 log_packet_detailed(" got field 'tile'");
13457#ifdef FREECIV_JSON_CONNECTION
13458 field_addr.name = "tile";
13459#endif /* FREECIV_JSON_CONNECTION */
13460 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
13461 RECEIVE_PACKET_FIELD_ERROR(tile);
13462 }
13463 }
13464 if (BV_ISSET(fields, 1)) {
13465 log_packet_detailed(" got field 'owner'");
13466#ifdef FREECIV_JSON_CONNECTION
13467 field_addr.name = "owner";
13468#endif /* FREECIV_JSON_CONNECTION */
13469 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
13470 RECEIVE_PACKET_FIELD_ERROR(owner);
13471 }
13472 }
13473 if (BV_ISSET(fields, 2)) {
13474 log_packet_detailed(" got field 'original'");
13475#ifdef FREECIV_JSON_CONNECTION
13476 field_addr.name = "original";
13477#endif /* FREECIV_JSON_CONNECTION */
13478 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
13479 RECEIVE_PACKET_FIELD_ERROR(original);
13480 }
13481 }
13482 if (BV_ISSET(fields, 3)) {
13483 log_packet_detailed(" got field 'size'");
13484#ifdef FREECIV_JSON_CONNECTION
13485 field_addr.name = "size";
13486#endif /* FREECIV_JSON_CONNECTION */
13487 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
13488 RECEIVE_PACKET_FIELD_ERROR(size);
13489 }
13490 }
13491 if (BV_ISSET(fields, 4)) {
13492 log_packet_detailed(" got field 'city_radius_sq'");
13493#ifdef FREECIV_JSON_CONNECTION
13494 field_addr.name = "city_radius_sq";
13495#endif /* FREECIV_JSON_CONNECTION */
13496 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_radius_sq)) {
13497 RECEIVE_PACKET_FIELD_ERROR(city_radius_sq);
13498 }
13499 }
13500 if (BV_ISSET(fields, 5)) {
13501 log_packet_detailed(" got field 'style'");
13502#ifdef FREECIV_JSON_CONNECTION
13503 field_addr.name = "style";
13504#endif /* FREECIV_JSON_CONNECTION */
13505 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
13506 RECEIVE_PACKET_FIELD_ERROR(style);
13507 }
13508 }
13509 if (BV_ISSET(fields, 6)) {
13510 log_packet_detailed(" got field 'capital'");
13511#ifdef FREECIV_JSON_CONNECTION
13512 field_addr.name = "capital";
13513#endif /* FREECIV_JSON_CONNECTION */
13514 {
13515 int readin;
13516
13517 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
13518 RECEIVE_PACKET_FIELD_ERROR(capital);
13519 }
13520 real_packet->capital = readin;
13521 }
13522 }
13523 if (BV_ISSET(fields, 7)) {
13524 log_packet_detailed(" got field 'ppl_happy'");
13525#ifdef FREECIV_JSON_CONNECTION
13526 field_addr.name = "ppl_happy";
13527#endif /* FREECIV_JSON_CONNECTION */
13528 {
13529 int i;
13530
13531#ifdef FREECIV_JSON_CONNECTION
13532 /* Enter array. */
13533 field_addr.sub_location = plocation_elem_new(0);
13534#endif /* FREECIV_JSON_CONNECTION */
13535
13536 for (i = 0; i < FEELING_LAST; i++) {
13537#ifdef FREECIV_JSON_CONNECTION
13538 field_addr.sub_location->number = i;
13539#endif /* FREECIV_JSON_CONNECTION */
13540 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
13541 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
13542 }
13543 }
13544
13545#ifdef FREECIV_JSON_CONNECTION
13546 /* Exit array. */
13547 FC_FREE(field_addr.sub_location);
13548#endif /* FREECIV_JSON_CONNECTION */
13549 }
13550 }
13551 if (BV_ISSET(fields, 8)) {
13552 log_packet_detailed(" got field 'ppl_content'");
13553#ifdef FREECIV_JSON_CONNECTION
13554 field_addr.name = "ppl_content";
13555#endif /* FREECIV_JSON_CONNECTION */
13556 {
13557 int i;
13558
13559#ifdef FREECIV_JSON_CONNECTION
13560 /* Enter array. */
13561 field_addr.sub_location = plocation_elem_new(0);
13562#endif /* FREECIV_JSON_CONNECTION */
13563
13564 for (i = 0; i < FEELING_LAST; i++) {
13565#ifdef FREECIV_JSON_CONNECTION
13566 field_addr.sub_location->number = i;
13567#endif /* FREECIV_JSON_CONNECTION */
13568 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
13569 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
13570 }
13571 }
13572
13573#ifdef FREECIV_JSON_CONNECTION
13574 /* Exit array. */
13575 FC_FREE(field_addr.sub_location);
13576#endif /* FREECIV_JSON_CONNECTION */
13577 }
13578 }
13579 if (BV_ISSET(fields, 9)) {
13580 log_packet_detailed(" got field 'ppl_unhappy'");
13581#ifdef FREECIV_JSON_CONNECTION
13582 field_addr.name = "ppl_unhappy";
13583#endif /* FREECIV_JSON_CONNECTION */
13584 {
13585 int i;
13586
13587#ifdef FREECIV_JSON_CONNECTION
13588 /* Enter array. */
13589 field_addr.sub_location = plocation_elem_new(0);
13590#endif /* FREECIV_JSON_CONNECTION */
13591
13592 for (i = 0; i < FEELING_LAST; i++) {
13593#ifdef FREECIV_JSON_CONNECTION
13594 field_addr.sub_location->number = i;
13595#endif /* FREECIV_JSON_CONNECTION */
13596 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
13597 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
13598 }
13599 }
13600
13601#ifdef FREECIV_JSON_CONNECTION
13602 /* Exit array. */
13603 FC_FREE(field_addr.sub_location);
13604#endif /* FREECIV_JSON_CONNECTION */
13605 }
13606 }
13607 if (BV_ISSET(fields, 10)) {
13608 log_packet_detailed(" got field 'ppl_angry'");
13609#ifdef FREECIV_JSON_CONNECTION
13610 field_addr.name = "ppl_angry";
13611#endif /* FREECIV_JSON_CONNECTION */
13612 {
13613 int i;
13614
13615#ifdef FREECIV_JSON_CONNECTION
13616 /* Enter array. */
13617 field_addr.sub_location = plocation_elem_new(0);
13618#endif /* FREECIV_JSON_CONNECTION */
13619
13620 for (i = 0; i < FEELING_LAST; i++) {
13621#ifdef FREECIV_JSON_CONNECTION
13622 field_addr.sub_location->number = i;
13623#endif /* FREECIV_JSON_CONNECTION */
13624 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
13625 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
13626 }
13627 }
13628
13629#ifdef FREECIV_JSON_CONNECTION
13630 /* Exit array. */
13631 FC_FREE(field_addr.sub_location);
13632#endif /* FREECIV_JSON_CONNECTION */
13633 }
13634 }
13635 if (BV_ISSET(fields, 11)) {
13636 log_packet_detailed(" got field 'specialists_size'");
13637#ifdef FREECIV_JSON_CONNECTION
13638 field_addr.name = "specialists_size";
13639#endif /* FREECIV_JSON_CONNECTION */
13640 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
13641 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
13642 }
13643 }
13644 if (BV_ISSET(fields, 12)) {
13645 log_packet_detailed(" got field 'specialists'");
13646#ifdef FREECIV_JSON_CONNECTION
13647 field_addr.name = "specialists";
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 if (real_packet->specialists_size > SP_MAX) {
13658 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
13659 }
13660 for (i = 0; i < real_packet->specialists_size; i++) {
13661#ifdef FREECIV_JSON_CONNECTION
13662 field_addr.sub_location->number = i;
13663#endif /* FREECIV_JSON_CONNECTION */
13664 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
13665 RECEIVE_PACKET_FIELD_ERROR(specialists);
13666 }
13667 }
13668
13669#ifdef FREECIV_JSON_CONNECTION
13670 /* Exit array. */
13671 FC_FREE(field_addr.sub_location);
13672#endif /* FREECIV_JSON_CONNECTION */
13673 }
13674 }
13675 if (BV_ISSET(fields, 13)) {
13676 log_packet_detailed(" got field 'history'");
13677#ifdef FREECIV_JSON_CONNECTION
13678 field_addr.name = "history";
13679#endif /* FREECIV_JSON_CONNECTION */
13680 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
13681 RECEIVE_PACKET_FIELD_ERROR(history);
13682 }
13683 }
13684 if (BV_ISSET(fields, 14)) {
13685 log_packet_detailed(" got field 'culture'");
13686#ifdef FREECIV_JSON_CONNECTION
13687 field_addr.name = "culture";
13688#endif /* FREECIV_JSON_CONNECTION */
13689 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
13690 RECEIVE_PACKET_FIELD_ERROR(culture);
13691 }
13692 }
13693 if (BV_ISSET(fields, 15)) {
13694 log_packet_detailed(" got field 'buy_cost'");
13695#ifdef FREECIV_JSON_CONNECTION
13696 field_addr.name = "buy_cost";
13697#endif /* FREECIV_JSON_CONNECTION */
13698 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->buy_cost)) {
13699 RECEIVE_PACKET_FIELD_ERROR(buy_cost);
13700 }
13701 }
13702 if (BV_ISSET(fields, 16)) {
13703 log_packet_detailed(" got field 'surplus'");
13704#ifdef FREECIV_JSON_CONNECTION
13705 field_addr.name = "surplus";
13706#endif /* FREECIV_JSON_CONNECTION */
13707 {
13708 int i;
13709
13710#ifdef FREECIV_JSON_CONNECTION
13711 /* Enter array. */
13712 field_addr.sub_location = plocation_elem_new(0);
13713#endif /* FREECIV_JSON_CONNECTION */
13714
13715 for (i = 0; i < O_LAST; i++) {
13716#ifdef FREECIV_JSON_CONNECTION
13717 field_addr.sub_location->number = i;
13718#endif /* FREECIV_JSON_CONNECTION */
13719 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->surplus[i])) {
13720 RECEIVE_PACKET_FIELD_ERROR(surplus);
13721 }
13722 }
13723
13724#ifdef FREECIV_JSON_CONNECTION
13725 /* Exit array. */
13726 FC_FREE(field_addr.sub_location);
13727#endif /* FREECIV_JSON_CONNECTION */
13728 }
13729 }
13730 if (BV_ISSET(fields, 17)) {
13731 log_packet_detailed(" got field 'waste'");
13732#ifdef FREECIV_JSON_CONNECTION
13733 field_addr.name = "waste";
13734#endif /* FREECIV_JSON_CONNECTION */
13735 {
13736 int i;
13737
13738#ifdef FREECIV_JSON_CONNECTION
13739 /* Enter array. */
13740 field_addr.sub_location = plocation_elem_new(0);
13741#endif /* FREECIV_JSON_CONNECTION */
13742
13743 for (i = 0; i < O_LAST; i++) {
13744#ifdef FREECIV_JSON_CONNECTION
13745 field_addr.sub_location->number = i;
13746#endif /* FREECIV_JSON_CONNECTION */
13747 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->waste[i])) {
13748 RECEIVE_PACKET_FIELD_ERROR(waste);
13749 }
13750 }
13751
13752#ifdef FREECIV_JSON_CONNECTION
13753 /* Exit array. */
13754 FC_FREE(field_addr.sub_location);
13755#endif /* FREECIV_JSON_CONNECTION */
13756 }
13757 }
13758 if (BV_ISSET(fields, 18)) {
13759 log_packet_detailed(" got field 'unhappy_penalty'");
13760#ifdef FREECIV_JSON_CONNECTION
13761 field_addr.name = "unhappy_penalty";
13762#endif /* FREECIV_JSON_CONNECTION */
13763 {
13764 int i;
13765
13766#ifdef FREECIV_JSON_CONNECTION
13767 /* Enter array. */
13768 field_addr.sub_location = plocation_elem_new(0);
13769#endif /* FREECIV_JSON_CONNECTION */
13770
13771 for (i = 0; i < O_LAST; i++) {
13772#ifdef FREECIV_JSON_CONNECTION
13773 field_addr.sub_location->number = i;
13774#endif /* FREECIV_JSON_CONNECTION */
13775 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->unhappy_penalty[i])) {
13776 RECEIVE_PACKET_FIELD_ERROR(unhappy_penalty);
13777 }
13778 }
13779
13780#ifdef FREECIV_JSON_CONNECTION
13781 /* Exit array. */
13782 FC_FREE(field_addr.sub_location);
13783#endif /* FREECIV_JSON_CONNECTION */
13784 }
13785 }
13786 if (BV_ISSET(fields, 19)) {
13787 log_packet_detailed(" got field 'prod'");
13788#ifdef FREECIV_JSON_CONNECTION
13789 field_addr.name = "prod";
13790#endif /* FREECIV_JSON_CONNECTION */
13791 {
13792 int i;
13793
13794#ifdef FREECIV_JSON_CONNECTION
13795 /* Enter array. */
13796 field_addr.sub_location = plocation_elem_new(0);
13797#endif /* FREECIV_JSON_CONNECTION */
13798
13799 for (i = 0; i < O_LAST; i++) {
13800#ifdef FREECIV_JSON_CONNECTION
13801 field_addr.sub_location->number = i;
13802#endif /* FREECIV_JSON_CONNECTION */
13803 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->prod[i])) {
13804 RECEIVE_PACKET_FIELD_ERROR(prod);
13805 }
13806 }
13807
13808#ifdef FREECIV_JSON_CONNECTION
13809 /* Exit array. */
13810 FC_FREE(field_addr.sub_location);
13811#endif /* FREECIV_JSON_CONNECTION */
13812 }
13813 }
13814 if (BV_ISSET(fields, 20)) {
13815 log_packet_detailed(" got field 'citizen_base'");
13816#ifdef FREECIV_JSON_CONNECTION
13817 field_addr.name = "citizen_base";
13818#endif /* FREECIV_JSON_CONNECTION */
13819 {
13820 int i;
13821
13822#ifdef FREECIV_JSON_CONNECTION
13823 /* Enter array. */
13824 field_addr.sub_location = plocation_elem_new(0);
13825#endif /* FREECIV_JSON_CONNECTION */
13826
13827 for (i = 0; i < O_LAST; i++) {
13828#ifdef FREECIV_JSON_CONNECTION
13829 field_addr.sub_location->number = i;
13830#endif /* FREECIV_JSON_CONNECTION */
13831 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->citizen_base[i])) {
13832 RECEIVE_PACKET_FIELD_ERROR(citizen_base);
13833 }
13834 }
13835
13836#ifdef FREECIV_JSON_CONNECTION
13837 /* Exit array. */
13838 FC_FREE(field_addr.sub_location);
13839#endif /* FREECIV_JSON_CONNECTION */
13840 }
13841 }
13842 if (BV_ISSET(fields, 21)) {
13843 log_packet_detailed(" got field 'usage'");
13844#ifdef FREECIV_JSON_CONNECTION
13845 field_addr.name = "usage";
13846#endif /* FREECIV_JSON_CONNECTION */
13847 {
13848 int i;
13849
13850#ifdef FREECIV_JSON_CONNECTION
13851 /* Enter array. */
13852 field_addr.sub_location = plocation_elem_new(0);
13853#endif /* FREECIV_JSON_CONNECTION */
13854
13855 for (i = 0; i < O_LAST; i++) {
13856#ifdef FREECIV_JSON_CONNECTION
13857 field_addr.sub_location->number = i;
13858#endif /* FREECIV_JSON_CONNECTION */
13859 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->usage[i])) {
13860 RECEIVE_PACKET_FIELD_ERROR(usage);
13861 }
13862 }
13863
13864#ifdef FREECIV_JSON_CONNECTION
13865 /* Exit array. */
13866 FC_FREE(field_addr.sub_location);
13867#endif /* FREECIV_JSON_CONNECTION */
13868 }
13869 }
13870 if (BV_ISSET(fields, 22)) {
13871 log_packet_detailed(" got field 'food_stock'");
13872#ifdef FREECIV_JSON_CONNECTION
13873 field_addr.name = "food_stock";
13874#endif /* FREECIV_JSON_CONNECTION */
13875 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->food_stock)) {
13876 RECEIVE_PACKET_FIELD_ERROR(food_stock);
13877 }
13878 }
13879 if (BV_ISSET(fields, 23)) {
13880 log_packet_detailed(" got field 'shield_stock'");
13881#ifdef FREECIV_JSON_CONNECTION
13882 field_addr.name = "shield_stock";
13883#endif /* FREECIV_JSON_CONNECTION */
13884 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
13885 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
13886 }
13887 }
13888 if (BV_ISSET(fields, 24)) {
13889 log_packet_detailed(" got field 'trade_route_count'");
13890#ifdef FREECIV_JSON_CONNECTION
13891 field_addr.name = "trade_route_count";
13892#endif /* FREECIV_JSON_CONNECTION */
13893 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->trade_route_count)) {
13894 RECEIVE_PACKET_FIELD_ERROR(trade_route_count);
13895 }
13896 }
13897 if (BV_ISSET(fields, 25)) {
13898 log_packet_detailed(" got field 'pollution'");
13899#ifdef FREECIV_JSON_CONNECTION
13900 field_addr.name = "pollution";
13901#endif /* FREECIV_JSON_CONNECTION */
13902 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->pollution)) {
13903 RECEIVE_PACKET_FIELD_ERROR(pollution);
13904 }
13905 }
13906 if (BV_ISSET(fields, 26)) {
13907 log_packet_detailed(" got field 'illness_trade'");
13908#ifdef FREECIV_JSON_CONNECTION
13909 field_addr.name = "illness_trade";
13910#endif /* FREECIV_JSON_CONNECTION */
13911 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->illness_trade)) {
13912 RECEIVE_PACKET_FIELD_ERROR(illness_trade);
13913 }
13914 }
13915 if (BV_ISSET(fields, 27)) {
13916 log_packet_detailed(" got field 'production_kind'");
13917#ifdef FREECIV_JSON_CONNECTION
13918 field_addr.name = "production_kind";
13919#endif /* FREECIV_JSON_CONNECTION */
13920 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
13921 RECEIVE_PACKET_FIELD_ERROR(production_kind);
13922 }
13923 }
13924 if (BV_ISSET(fields, 28)) {
13925 log_packet_detailed(" got field 'production_value'");
13926#ifdef FREECIV_JSON_CONNECTION
13927 field_addr.name = "production_value";
13928#endif /* FREECIV_JSON_CONNECTION */
13929 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
13930 RECEIVE_PACKET_FIELD_ERROR(production_value);
13931 }
13932 }
13933 if (BV_ISSET(fields, 29)) {
13934 log_packet_detailed(" got field 'turn_founded'");
13935#ifdef FREECIV_JSON_CONNECTION
13936 field_addr.name = "turn_founded";
13937#endif /* FREECIV_JSON_CONNECTION */
13938 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
13939 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
13940 }
13941 }
13942 if (BV_ISSET(fields, 30)) {
13943 log_packet_detailed(" got field 'turn_last_built'");
13944#ifdef FREECIV_JSON_CONNECTION
13945 field_addr.name = "turn_last_built";
13946#endif /* FREECIV_JSON_CONNECTION */
13947 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
13948 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
13949 }
13950 }
13951 if (BV_ISSET(fields, 31)) {
13952 log_packet_detailed(" got field 'changed_from_kind'");
13953#ifdef FREECIV_JSON_CONNECTION
13954 field_addr.name = "changed_from_kind";
13955#endif /* FREECIV_JSON_CONNECTION */
13956 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_kind)) {
13957 RECEIVE_PACKET_FIELD_ERROR(changed_from_kind);
13958 }
13959 }
13960 if (BV_ISSET(fields, 32)) {
13961 log_packet_detailed(" got field 'changed_from_value'");
13962#ifdef FREECIV_JSON_CONNECTION
13963 field_addr.name = "changed_from_value";
13964#endif /* FREECIV_JSON_CONNECTION */
13965 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->changed_from_value)) {
13966 RECEIVE_PACKET_FIELD_ERROR(changed_from_value);
13967 }
13968 }
13969 if (BV_ISSET(fields, 33)) {
13970 log_packet_detailed(" got field 'before_change_shields'");
13971#ifdef FREECIV_JSON_CONNECTION
13972 field_addr.name = "before_change_shields";
13973#endif /* FREECIV_JSON_CONNECTION */
13974 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->before_change_shields)) {
13975 RECEIVE_PACKET_FIELD_ERROR(before_change_shields);
13976 }
13977 }
13978 if (BV_ISSET(fields, 34)) {
13979 log_packet_detailed(" got field 'disbanded_shields'");
13980#ifdef FREECIV_JSON_CONNECTION
13981 field_addr.name = "disbanded_shields";
13982#endif /* FREECIV_JSON_CONNECTION */
13983 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disbanded_shields)) {
13984 RECEIVE_PACKET_FIELD_ERROR(disbanded_shields);
13985 }
13986 }
13987 if (BV_ISSET(fields, 35)) {
13988 log_packet_detailed(" got field 'caravan_shields'");
13989#ifdef FREECIV_JSON_CONNECTION
13990 field_addr.name = "caravan_shields";
13991#endif /* FREECIV_JSON_CONNECTION */
13992 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->caravan_shields)) {
13993 RECEIVE_PACKET_FIELD_ERROR(caravan_shields);
13994 }
13995 }
13996 if (BV_ISSET(fields, 36)) {
13997 log_packet_detailed(" got field 'last_turns_shield_surplus'");
13998#ifdef FREECIV_JSON_CONNECTION
13999 field_addr.name = "last_turns_shield_surplus";
14000#endif /* FREECIV_JSON_CONNECTION */
14001 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->last_turns_shield_surplus)) {
14002 RECEIVE_PACKET_FIELD_ERROR(last_turns_shield_surplus);
14003 }
14004 }
14005 if (BV_ISSET(fields, 37)) {
14006 log_packet_detailed(" got field 'airlift'");
14007#ifdef FREECIV_JSON_CONNECTION
14008 field_addr.name = "airlift";
14009#endif /* FREECIV_JSON_CONNECTION */
14010 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->airlift)) {
14011 RECEIVE_PACKET_FIELD_ERROR(airlift);
14012 }
14013 }
14014 real_packet->did_buy = BV_ISSET(fields, 38);
14015 real_packet->did_sell = BV_ISSET(fields, 39);
14016 real_packet->was_happy = BV_ISSET(fields, 40);
14017 real_packet->had_famine = BV_ISSET(fields, 41);
14018 real_packet->diplomat_investigate = BV_ISSET(fields, 42);
14019 if (BV_ISSET(fields, 43)) {
14020 log_packet_detailed(" got field 'walls'");
14021#ifdef FREECIV_JSON_CONNECTION
14022 field_addr.name = "walls";
14023#endif /* FREECIV_JSON_CONNECTION */
14024 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
14025 RECEIVE_PACKET_FIELD_ERROR(walls);
14026 }
14027 }
14028 if (BV_ISSET(fields, 44)) {
14029 log_packet_detailed(" got field 'city_image'");
14030#ifdef FREECIV_JSON_CONNECTION
14031 field_addr.name = "city_image";
14032#endif /* FREECIV_JSON_CONNECTION */
14033 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
14034 RECEIVE_PACKET_FIELD_ERROR(city_image);
14035 }
14036 }
14037 if (BV_ISSET(fields, 45)) {
14038 log_packet_detailed(" got field 'steal'");
14039#ifdef FREECIV_JSON_CONNECTION
14040 field_addr.name = "steal";
14041#endif /* FREECIV_JSON_CONNECTION */
14042 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->steal)) {
14043 RECEIVE_PACKET_FIELD_ERROR(steal);
14044 }
14045 }
14046 if (BV_ISSET(fields, 46)) {
14047 log_packet_detailed(" got field 'worklist'");
14048#ifdef FREECIV_JSON_CONNECTION
14049 field_addr.name = "worklist";
14050#endif /* FREECIV_JSON_CONNECTION */
14051 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
14052 RECEIVE_PACKET_FIELD_ERROR(worklist);
14053 }
14054 }
14055 if (BV_ISSET(fields, 47)) {
14056 log_packet_detailed(" got field 'improvements'");
14057#ifdef FREECIV_JSON_CONNECTION
14058 field_addr.name = "improvements";
14059#endif /* FREECIV_JSON_CONNECTION */
14060 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
14061 RECEIVE_PACKET_FIELD_ERROR(improvements);
14062 }
14063 }
14064 if (BV_ISSET(fields, 48)) {
14065 log_packet_detailed(" got field 'city_options'");
14066#ifdef FREECIV_JSON_CONNECTION
14067 field_addr.name = "city_options";
14068#endif /* FREECIV_JSON_CONNECTION */
14069 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
14070 RECEIVE_PACKET_FIELD_ERROR(city_options);
14071 }
14072 }
14073 if (BV_ISSET(fields, 49)) {
14074 log_packet_detailed(" got field 'name'");
14075#ifdef FREECIV_JSON_CONNECTION
14076 field_addr.name = "name";
14077#endif /* FREECIV_JSON_CONNECTION */
14078 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
14079 RECEIVE_PACKET_FIELD_ERROR(name);
14080 }
14081 }
14082
14083 if (NULL == old) {
14084 old = fc_malloc(sizeof(*old));
14085 *old = *real_packet;
14086 genhash_insert(*hash, old, old);
14087 } else {
14088 *old = *real_packet;
14089 }
14090
14091 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
14092 if (NULL != *hash) {
14093 genhash_remove(*hash, real_packet);
14094 }
14095
14096#endif /* FREECIV_DELTA_PROTOCOL */
14097 RECEIVE_PACKET_END(real_packet);
14098}
14099
14100 static int send_packet_city_info_100(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
14101{
14102 const struct packet_city_info *real_packet = packet;
14103 int e;
14104#ifdef FREECIV_DELTA_PROTOCOL
14105 packet_city_info_100_fields fields;
14106 struct packet_city_info *old;
14107 bool differ;
14108 struct genhash **hash = pc->phs.sent + PACKET_CITY_INFO;
14109 int different = force_to_send;
14110#endif /* FREECIV_DELTA_PROTOCOL */
14111 SEND_PACKET_START(PACKET_CITY_INFO);
14112#ifdef FREECIV_JSON_CONNECTION
14113 struct plocation field_addr;
14114 {
14115 struct plocation *field_addr_tmp = plocation_field_new(NULL);
14116 field_addr = *field_addr_tmp;
14117 FC_FREE(field_addr_tmp);
14118 }
14119#endif /* FREECIV_JSON_CONNECTION */
14120
14121 log_packet_detailed("packet_city_info_100: sending info about (%d)",
14122 real_packet->id);
14123
14124#ifdef FREECIV_DELTA_PROTOCOL
14125 if (NULL == *hash) {
14126 *hash = genhash_new_full(hash_packet_city_info_100, cmp_packet_city_info_100,
14127 NULL, NULL, NULL, free);
14128 }
14129 BV_CLR_ALL(fields);
14130
14131 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
14132 old = fc_malloc(sizeof(*old));
14133 *old = *real_packet;
14134 genhash_insert(*hash, old, old);
14135 memset(old, 0, sizeof(*old));
14136 different = 1; /* Force to send. */
14137 }
14138 differ = (old->tile != real_packet->tile);
14139 if (differ) {
14140 different++;
14141 BV_SET(fields, 0);
14142 }
14143
14144 differ = (old->owner != real_packet->owner);
14145 if (differ) {
14146 different++;
14147 BV_SET(fields, 1);
14148 }
14149
14150 differ = (old->original != real_packet->original);
14151 if (differ) {
14152 different++;
14153 BV_SET(fields, 2);
14154 }
14155
14156 differ = (old->size != real_packet->size);
14157 if (differ) {
14158 different++;
14159 BV_SET(fields, 3);
14160 }
14161
14162 differ = (old->city_radius_sq != real_packet->city_radius_sq);
14163 if (differ) {
14164 different++;
14165 BV_SET(fields, 4);
14166 }
14167
14168 differ = (old->style != real_packet->style);
14169 if (differ) {
14170 different++;
14171 BV_SET(fields, 5);
14172 }
14173
14174 differ = (old->capital != real_packet->capital);
14175 if (differ) {
14176 different++;
14177 BV_SET(fields, 6);
14178 }
14179
14180 differ = FALSE;
14181 {
14182 int i;
14183
14184 for (i = 0; i < FEELING_LAST; i++) {
14185 differ = (old->ppl_happy[i] != real_packet->ppl_happy[i]);
14186 if (differ) {
14187 break;
14188 }
14189 }
14190 }
14191 if (differ) {
14192 different++;
14193 BV_SET(fields, 7);
14194 }
14195
14196 differ = FALSE;
14197 {
14198 int i;
14199
14200 for (i = 0; i < FEELING_LAST; i++) {
14201 differ = (old->ppl_content[i] != real_packet->ppl_content[i]);
14202 if (differ) {
14203 break;
14204 }
14205 }
14206 }
14207 if (differ) {
14208 different++;
14209 BV_SET(fields, 8);
14210 }
14211
14212 differ = FALSE;
14213 {
14214 int i;
14215
14216 for (i = 0; i < FEELING_LAST; i++) {
14217 differ = (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]);
14218 if (differ) {
14219 break;
14220 }
14221 }
14222 }
14223 if (differ) {
14224 different++;
14225 BV_SET(fields, 9);
14226 }
14227
14228 differ = FALSE;
14229 {
14230 int i;
14231
14232 for (i = 0; i < FEELING_LAST; i++) {
14233 differ = (old->ppl_angry[i] != real_packet->ppl_angry[i]);
14234 if (differ) {
14235 break;
14236 }
14237 }
14238 }
14239 if (differ) {
14240 different++;
14241 BV_SET(fields, 10);
14242 }
14243
14244 differ = (old->specialists_size != real_packet->specialists_size);
14245 if (differ) {
14246 different++;
14247 BV_SET(fields, 11);
14248 }
14249
14250 differ = (old->specialists_size != real_packet->specialists_size);
14251 if (!differ) {
14252 int i;
14253
14254 for (i = 0; i < real_packet->specialists_size; i++) {
14255 differ = (old->specialists[i] != real_packet->specialists[i]);
14256 if (differ) {
14257 break;
14258 }
14259 }
14260 }
14261 if (differ) {
14262 different++;
14263 BV_SET(fields, 12);
14264 }
14265
14266 differ = (old->history != real_packet->history);
14267 if (differ) {
14268 different++;
14269 BV_SET(fields, 13);
14270 }
14271
14272 differ = (old->culture != real_packet->culture);
14273 if (differ) {
14274 different++;
14275 BV_SET(fields, 14);
14276 }
14277
14278 differ = (old->buy_cost != real_packet->buy_cost);
14279 if (differ) {
14280 different++;
14281 BV_SET(fields, 15);
14282 }
14283
14284 differ = FALSE;
14285 {
14286 int i;
14287
14288 for (i = 0; i < O_LAST; i++) {
14289 differ = (old->surplus[i] != real_packet->surplus[i]);
14290 if (differ) {
14291 break;
14292 }
14293 }
14294 }
14295 if (differ) {
14296 different++;
14297 BV_SET(fields, 16);
14298 }
14299
14300 differ = FALSE;
14301 {
14302 int i;
14303
14304 for (i = 0; i < O_LAST; i++) {
14305 differ = (old->waste[i] != real_packet->waste[i]);
14306 if (differ) {
14307 break;
14308 }
14309 }
14310 }
14311 if (differ) {
14312 different++;
14313 BV_SET(fields, 17);
14314 }
14315
14316 differ = FALSE;
14317 {
14318 int i;
14319
14320 for (i = 0; i < O_LAST; i++) {
14321 differ = (old->unhappy_penalty[i] != real_packet->unhappy_penalty[i]);
14322 if (differ) {
14323 break;
14324 }
14325 }
14326 }
14327 if (differ) {
14328 different++;
14329 BV_SET(fields, 18);
14330 }
14331
14332 differ = FALSE;
14333 {
14334 int i;
14335
14336 for (i = 0; i < O_LAST; i++) {
14337 differ = (old->prod[i] != real_packet->prod[i]);
14338 if (differ) {
14339 break;
14340 }
14341 }
14342 }
14343 if (differ) {
14344 different++;
14345 BV_SET(fields, 19);
14346 }
14347
14348 differ = FALSE;
14349 {
14350 int i;
14351
14352 for (i = 0; i < O_LAST; i++) {
14353 differ = (old->citizen_base[i] != real_packet->citizen_base[i]);
14354 if (differ) {
14355 break;
14356 }
14357 }
14358 }
14359 if (differ) {
14360 different++;
14361 BV_SET(fields, 20);
14362 }
14363
14364 differ = FALSE;
14365 {
14366 int i;
14367
14368 for (i = 0; i < O_LAST; i++) {
14369 differ = (old->usage[i] != real_packet->usage[i]);
14370 if (differ) {
14371 break;
14372 }
14373 }
14374 }
14375 if (differ) {
14376 different++;
14377 BV_SET(fields, 21);
14378 }
14379
14380 differ = (old->food_stock != real_packet->food_stock);
14381 if (differ) {
14382 different++;
14383 BV_SET(fields, 22);
14384 }
14385
14386 differ = (old->shield_stock != real_packet->shield_stock);
14387 if (differ) {
14388 different++;
14389 BV_SET(fields, 23);
14390 }
14391
14392 differ = (old->trade_route_count != real_packet->trade_route_count);
14393 if (differ) {
14394 different++;
14395 BV_SET(fields, 24);
14396 }
14397
14398 differ = (old->pollution != real_packet->pollution);
14399 if (differ) {
14400 different++;
14401 BV_SET(fields, 25);
14402 }
14403
14404 differ = (old->illness_trade != real_packet->illness_trade);
14405 if (differ) {
14406 different++;
14407 BV_SET(fields, 26);
14408 }
14409
14410 differ = (old->production_kind != real_packet->production_kind);
14411 if (differ) {
14412 different++;
14413 BV_SET(fields, 27);
14414 }
14415
14416 differ = (old->production_value != real_packet->production_value);
14417 if (differ) {
14418 different++;
14419 BV_SET(fields, 28);
14420 }
14421
14422 differ = (old->turn_founded != real_packet->turn_founded);
14423 if (differ) {
14424 different++;
14425 BV_SET(fields, 29);
14426 }
14427
14428 differ = (old->turn_last_built != real_packet->turn_last_built);
14429 if (differ) {
14430 different++;
14431 BV_SET(fields, 30);
14432 }
14433
14434 differ = (old->changed_from_kind != real_packet->changed_from_kind);
14435 if (differ) {
14436 different++;
14437 BV_SET(fields, 31);
14438 }
14439
14440 differ = (old->changed_from_value != real_packet->changed_from_value);
14441 if (differ) {
14442 different++;
14443 BV_SET(fields, 32);
14444 }
14445
14446 differ = (old->before_change_shields != real_packet->before_change_shields);
14447 if (differ) {
14448 different++;
14449 BV_SET(fields, 33);
14450 }
14451
14452 differ = (old->disbanded_shields != real_packet->disbanded_shields);
14453 if (differ) {
14454 different++;
14455 BV_SET(fields, 34);
14456 }
14457
14458 differ = (old->caravan_shields != real_packet->caravan_shields);
14459 if (differ) {
14460 different++;
14461 BV_SET(fields, 35);
14462 }
14463
14464 differ = (old->last_turns_shield_surplus != real_packet->last_turns_shield_surplus);
14465 if (differ) {
14466 different++;
14467 BV_SET(fields, 36);
14468 }
14469
14470 differ = (old->airlift != real_packet->airlift);
14471 if (differ) {
14472 different++;
14473 BV_SET(fields, 37);
14474 }
14475
14476 differ = (old->did_buy != real_packet->did_buy);
14477 if (differ) {
14478 different++;
14479 }
14480 if (packet->did_buy) {
14481 BV_SET(fields, 38);
14482 }
14483
14484 differ = (old->did_sell != real_packet->did_sell);
14485 if (differ) {
14486 different++;
14487 }
14488 if (packet->did_sell) {
14489 BV_SET(fields, 39);
14490 }
14491
14492 differ = (old->was_happy != real_packet->was_happy);
14493 if (differ) {
14494 different++;
14495 }
14496 if (packet->was_happy) {
14497 BV_SET(fields, 40);
14498 }
14499
14500 differ = (old->had_famine != real_packet->had_famine);
14501 if (differ) {
14502 different++;
14503 }
14504 if (packet->had_famine) {
14505 BV_SET(fields, 41);
14506 }
14507
14508 differ = (old->diplomat_investigate != real_packet->diplomat_investigate);
14509 if (differ) {
14510 different++;
14511 }
14512 if (packet->diplomat_investigate) {
14513 BV_SET(fields, 42);
14514 }
14515
14516 differ = (old->walls != real_packet->walls);
14517 if (differ) {
14518 different++;
14519 BV_SET(fields, 43);
14520 }
14521
14522 differ = (old->city_image != real_packet->city_image);
14523 if (differ) {
14524 different++;
14525 BV_SET(fields, 44);
14526 }
14527
14528 differ = (old->steal != real_packet->steal);
14529 if (differ) {
14530 different++;
14531 BV_SET(fields, 45);
14532 }
14533
14534 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
14535 if (differ) {
14536 different++;
14537 BV_SET(fields, 46);
14538 }
14539
14540 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
14541 if (differ) {
14542 different++;
14543 BV_SET(fields, 47);
14544 }
14545
14546 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
14547 if (differ) {
14548 different++;
14549 BV_SET(fields, 48);
14550 }
14551
14552 differ = (strcmp(old->name, real_packet->name) != 0);
14553 if (differ) {
14554 different++;
14555 BV_SET(fields, 49);
14556 }
14557
14558 if (different == 0) {
14559 log_packet_detailed(" no change -> discard");
14560 return 0;
14561 }
14562
14563#ifdef FREECIV_JSON_CONNECTION
14564 field_addr.name = "fields";
14565#endif /* FREECIV_JSON_CONNECTION */
14566 e = 0;
14567 e |= DIO_BV_PUT(&dout, &field_addr, fields);
14568 if (e) {
14569 log_packet_detailed("fields bitvector error detected");
14570 }
14571#ifdef FREECIV_JSON_CONNECTION
14572 field_addr.name = "id";
14573#endif /* FREECIV_JSON_CONNECTION */
14574 e = 0;
14575 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
14576 if (e) {
14577 log_packet_detailed("'id' field error detected");
14578 }
14579
14580 if (BV_ISSET(fields, 0)) {
14581 log_packet_detailed(" field 'tile' has changed");
14582#ifdef FREECIV_JSON_CONNECTION
14583 field_addr.name = "tile";
14584#endif /* FREECIV_JSON_CONNECTION */
14585 e = 0;
14586 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
14587 if (e) {
14588 log_packet_detailed("'tile' field error detected");
14589 }
14590 }
14591 if (BV_ISSET(fields, 1)) {
14592 log_packet_detailed(" field 'owner' has changed");
14593#ifdef FREECIV_JSON_CONNECTION
14594 field_addr.name = "owner";
14595#endif /* FREECIV_JSON_CONNECTION */
14596 e = 0;
14597 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
14598 if (e) {
14599 log_packet_detailed("'owner' field error detected");
14600 }
14601 }
14602 if (BV_ISSET(fields, 2)) {
14603 log_packet_detailed(" field 'original' has changed");
14604#ifdef FREECIV_JSON_CONNECTION
14605 field_addr.name = "original";
14606#endif /* FREECIV_JSON_CONNECTION */
14607 e = 0;
14608 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
14609 if (e) {
14610 log_packet_detailed("'original' field error detected");
14611 }
14612 }
14613 if (BV_ISSET(fields, 3)) {
14614 log_packet_detailed(" field 'size' has changed");
14615#ifdef FREECIV_JSON_CONNECTION
14616 field_addr.name = "size";
14617#endif /* FREECIV_JSON_CONNECTION */
14618 e = 0;
14619 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
14620 if (e) {
14621 log_packet_detailed("'size' field error detected");
14622 }
14623 }
14624 if (BV_ISSET(fields, 4)) {
14625 log_packet_detailed(" field 'city_radius_sq' has changed");
14626#ifdef FREECIV_JSON_CONNECTION
14627 field_addr.name = "city_radius_sq";
14628#endif /* FREECIV_JSON_CONNECTION */
14629 e = 0;
14630 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
14631 if (e) {
14632 log_packet_detailed("'city_radius_sq' field error detected");
14633 }
14634 }
14635 if (BV_ISSET(fields, 5)) {
14636 log_packet_detailed(" field 'style' has changed");
14637#ifdef FREECIV_JSON_CONNECTION
14638 field_addr.name = "style";
14639#endif /* FREECIV_JSON_CONNECTION */
14640 e = 0;
14641 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
14642 if (e) {
14643 log_packet_detailed("'style' field error detected");
14644 }
14645 }
14646 if (BV_ISSET(fields, 6)) {
14647 log_packet_detailed(" field 'capital' has changed");
14648#ifdef FREECIV_JSON_CONNECTION
14649 field_addr.name = "capital";
14650#endif /* FREECIV_JSON_CONNECTION */
14651 e = 0;
14652 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
14653 if (e) {
14654 log_packet_detailed("'capital' field error detected");
14655 }
14656 }
14657 if (BV_ISSET(fields, 7)) {
14658 log_packet_detailed(" field 'ppl_happy' has changed");
14659#ifdef FREECIV_JSON_CONNECTION
14660 field_addr.name = "ppl_happy";
14661#endif /* FREECIV_JSON_CONNECTION */
14662 e = 0;
14663 {
14664 int i;
14665
14666#ifdef FREECIV_JSON_CONNECTION
14667 /* Create the array. */
14668 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14669
14670 /* Enter the array. */
14671 field_addr.sub_location = plocation_elem_new(0);
14672#endif /* FREECIV_JSON_CONNECTION */
14673
14674 for (i = 0; i < FEELING_LAST; i++) {
14675#ifdef FREECIV_JSON_CONNECTION
14676 /* Next array element. */
14677 field_addr.sub_location->number = i;
14678#endif /* FREECIV_JSON_CONNECTION */
14679 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
14680 }
14681
14682#ifdef FREECIV_JSON_CONNECTION
14683 /* Exit array. */
14684 FC_FREE(field_addr.sub_location);
14685#endif /* FREECIV_JSON_CONNECTION */
14686 }
14687 if (e) {
14688 log_packet_detailed("'ppl_happy' field error detected");
14689 }
14690 }
14691 if (BV_ISSET(fields, 8)) {
14692 log_packet_detailed(" field 'ppl_content' has changed");
14693#ifdef FREECIV_JSON_CONNECTION
14694 field_addr.name = "ppl_content";
14695#endif /* FREECIV_JSON_CONNECTION */
14696 e = 0;
14697 {
14698 int i;
14699
14700#ifdef FREECIV_JSON_CONNECTION
14701 /* Create the array. */
14702 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14703
14704 /* Enter the array. */
14705 field_addr.sub_location = plocation_elem_new(0);
14706#endif /* FREECIV_JSON_CONNECTION */
14707
14708 for (i = 0; i < FEELING_LAST; i++) {
14709#ifdef FREECIV_JSON_CONNECTION
14710 /* Next array element. */
14711 field_addr.sub_location->number = i;
14712#endif /* FREECIV_JSON_CONNECTION */
14713 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
14714 }
14715
14716#ifdef FREECIV_JSON_CONNECTION
14717 /* Exit array. */
14718 FC_FREE(field_addr.sub_location);
14719#endif /* FREECIV_JSON_CONNECTION */
14720 }
14721 if (e) {
14722 log_packet_detailed("'ppl_content' field error detected");
14723 }
14724 }
14725 if (BV_ISSET(fields, 9)) {
14726 log_packet_detailed(" field 'ppl_unhappy' has changed");
14727#ifdef FREECIV_JSON_CONNECTION
14728 field_addr.name = "ppl_unhappy";
14729#endif /* FREECIV_JSON_CONNECTION */
14730 e = 0;
14731 {
14732 int i;
14733
14734#ifdef FREECIV_JSON_CONNECTION
14735 /* Create the array. */
14736 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14737
14738 /* Enter the array. */
14739 field_addr.sub_location = plocation_elem_new(0);
14740#endif /* FREECIV_JSON_CONNECTION */
14741
14742 for (i = 0; i < FEELING_LAST; i++) {
14743#ifdef FREECIV_JSON_CONNECTION
14744 /* Next array element. */
14745 field_addr.sub_location->number = i;
14746#endif /* FREECIV_JSON_CONNECTION */
14747 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
14748 }
14749
14750#ifdef FREECIV_JSON_CONNECTION
14751 /* Exit array. */
14752 FC_FREE(field_addr.sub_location);
14753#endif /* FREECIV_JSON_CONNECTION */
14754 }
14755 if (e) {
14756 log_packet_detailed("'ppl_unhappy' field error detected");
14757 }
14758 }
14759 if (BV_ISSET(fields, 10)) {
14760 log_packet_detailed(" field 'ppl_angry' has changed");
14761#ifdef FREECIV_JSON_CONNECTION
14762 field_addr.name = "ppl_angry";
14763#endif /* FREECIV_JSON_CONNECTION */
14764 e = 0;
14765 {
14766 int i;
14767
14768#ifdef FREECIV_JSON_CONNECTION
14769 /* Create the array. */
14770 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
14771
14772 /* Enter the array. */
14773 field_addr.sub_location = plocation_elem_new(0);
14774#endif /* FREECIV_JSON_CONNECTION */
14775
14776 for (i = 0; i < FEELING_LAST; i++) {
14777#ifdef FREECIV_JSON_CONNECTION
14778 /* Next array element. */
14779 field_addr.sub_location->number = i;
14780#endif /* FREECIV_JSON_CONNECTION */
14781 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
14782 }
14783
14784#ifdef FREECIV_JSON_CONNECTION
14785 /* Exit array. */
14786 FC_FREE(field_addr.sub_location);
14787#endif /* FREECIV_JSON_CONNECTION */
14788 }
14789 if (e) {
14790 log_packet_detailed("'ppl_angry' field error detected");
14791 }
14792 }
14793 if (BV_ISSET(fields, 11)) {
14794 log_packet_detailed(" field 'specialists_size' has changed");
14795#ifdef FREECIV_JSON_CONNECTION
14796 field_addr.name = "specialists_size";
14797#endif /* FREECIV_JSON_CONNECTION */
14798 e = 0;
14799 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
14800 if (e) {
14801 log_packet_detailed("'specialists_size' field error detected");
14802 }
14803 }
14804 if (BV_ISSET(fields, 12)) {
14805 log_packet_detailed(" field 'specialists' has changed");
14806#ifdef FREECIV_JSON_CONNECTION
14807 field_addr.name = "specialists";
14808#endif /* FREECIV_JSON_CONNECTION */
14809 e = 0;
14810 {
14811 int i;
14812
14813#ifdef FREECIV_JSON_CONNECTION
14814 /* Create the array. */
14815 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
14816
14817 /* Enter the array. */
14818 field_addr.sub_location = plocation_elem_new(0);
14819#endif /* FREECIV_JSON_CONNECTION */
14820
14821 for (i = 0; i < real_packet->specialists_size; i++) {
14822#ifdef FREECIV_JSON_CONNECTION
14823 /* Next array element. */
14824 field_addr.sub_location->number = i;
14825#endif /* FREECIV_JSON_CONNECTION */
14826 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
14827 }
14828
14829#ifdef FREECIV_JSON_CONNECTION
14830 /* Exit array. */
14831 FC_FREE(field_addr.sub_location);
14832#endif /* FREECIV_JSON_CONNECTION */
14833 }
14834 if (e) {
14835 log_packet_detailed("'specialists' field error detected");
14836 }
14837 }
14838 if (BV_ISSET(fields, 13)) {
14839 log_packet_detailed(" field 'history' has changed");
14840#ifdef FREECIV_JSON_CONNECTION
14841 field_addr.name = "history";
14842#endif /* FREECIV_JSON_CONNECTION */
14843 e = 0;
14844 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
14845 if (e) {
14846 log_packet_detailed("'history' field error detected");
14847 }
14848 }
14849 if (BV_ISSET(fields, 14)) {
14850 log_packet_detailed(" field 'culture' has changed");
14851#ifdef FREECIV_JSON_CONNECTION
14852 field_addr.name = "culture";
14853#endif /* FREECIV_JSON_CONNECTION */
14854 e = 0;
14855 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
14856 if (e) {
14857 log_packet_detailed("'culture' field error detected");
14858 }
14859 }
14860 if (BV_ISSET(fields, 15)) {
14861 log_packet_detailed(" field 'buy_cost' has changed");
14862#ifdef FREECIV_JSON_CONNECTION
14863 field_addr.name = "buy_cost";
14864#endif /* FREECIV_JSON_CONNECTION */
14865 e = 0;
14866 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
14867 if (e) {
14868 log_packet_detailed("'buy_cost' field error detected");
14869 }
14870 }
14871 if (BV_ISSET(fields, 16)) {
14872 log_packet_detailed(" field 'surplus' has changed");
14873#ifdef FREECIV_JSON_CONNECTION
14874 field_addr.name = "surplus";
14875#endif /* FREECIV_JSON_CONNECTION */
14876 e = 0;
14877 {
14878 int i;
14879
14880#ifdef FREECIV_JSON_CONNECTION
14881 /* Create the array. */
14882 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
14883
14884 /* Enter the array. */
14885 field_addr.sub_location = plocation_elem_new(0);
14886#endif /* FREECIV_JSON_CONNECTION */
14887
14888 for (i = 0; i < O_LAST; i++) {
14889#ifdef FREECIV_JSON_CONNECTION
14890 /* Next array element. */
14891 field_addr.sub_location->number = i;
14892#endif /* FREECIV_JSON_CONNECTION */
14893 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
14894 }
14895
14896#ifdef FREECIV_JSON_CONNECTION
14897 /* Exit array. */
14898 FC_FREE(field_addr.sub_location);
14899#endif /* FREECIV_JSON_CONNECTION */
14900 }
14901 if (e) {
14902 log_packet_detailed("'surplus' field error detected");
14903 }
14904 }
14905 if (BV_ISSET(fields, 17)) {
14906 log_packet_detailed(" field 'waste' has changed");
14907#ifdef FREECIV_JSON_CONNECTION
14908 field_addr.name = "waste";
14909#endif /* FREECIV_JSON_CONNECTION */
14910 e = 0;
14911 {
14912 int i;
14913
14914#ifdef FREECIV_JSON_CONNECTION
14915 /* Create the array. */
14916 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
14917
14918 /* Enter the array. */
14919 field_addr.sub_location = plocation_elem_new(0);
14920#endif /* FREECIV_JSON_CONNECTION */
14921
14922 for (i = 0; i < O_LAST; i++) {
14923#ifdef FREECIV_JSON_CONNECTION
14924 /* Next array element. */
14925 field_addr.sub_location->number = i;
14926#endif /* FREECIV_JSON_CONNECTION */
14927 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
14928 }
14929
14930#ifdef FREECIV_JSON_CONNECTION
14931 /* Exit array. */
14932 FC_FREE(field_addr.sub_location);
14933#endif /* FREECIV_JSON_CONNECTION */
14934 }
14935 if (e) {
14936 log_packet_detailed("'waste' field error detected");
14937 }
14938 }
14939 if (BV_ISSET(fields, 18)) {
14940 log_packet_detailed(" field 'unhappy_penalty' has changed");
14941#ifdef FREECIV_JSON_CONNECTION
14942 field_addr.name = "unhappy_penalty";
14943#endif /* FREECIV_JSON_CONNECTION */
14944 e = 0;
14945 {
14946 int i;
14947
14948#ifdef FREECIV_JSON_CONNECTION
14949 /* Create the array. */
14950 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
14951
14952 /* Enter the array. */
14953 field_addr.sub_location = plocation_elem_new(0);
14954#endif /* FREECIV_JSON_CONNECTION */
14955
14956 for (i = 0; i < O_LAST; i++) {
14957#ifdef FREECIV_JSON_CONNECTION
14958 /* Next array element. */
14959 field_addr.sub_location->number = i;
14960#endif /* FREECIV_JSON_CONNECTION */
14961 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
14962 }
14963
14964#ifdef FREECIV_JSON_CONNECTION
14965 /* Exit array. */
14966 FC_FREE(field_addr.sub_location);
14967#endif /* FREECIV_JSON_CONNECTION */
14968 }
14969 if (e) {
14970 log_packet_detailed("'unhappy_penalty' field error detected");
14971 }
14972 }
14973 if (BV_ISSET(fields, 19)) {
14974 log_packet_detailed(" field 'prod' has changed");
14975#ifdef FREECIV_JSON_CONNECTION
14976 field_addr.name = "prod";
14977#endif /* FREECIV_JSON_CONNECTION */
14978 e = 0;
14979 {
14980 int i;
14981
14982#ifdef FREECIV_JSON_CONNECTION
14983 /* Create the array. */
14984 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
14985
14986 /* Enter the array. */
14987 field_addr.sub_location = plocation_elem_new(0);
14988#endif /* FREECIV_JSON_CONNECTION */
14989
14990 for (i = 0; i < O_LAST; i++) {
14991#ifdef FREECIV_JSON_CONNECTION
14992 /* Next array element. */
14993 field_addr.sub_location->number = i;
14994#endif /* FREECIV_JSON_CONNECTION */
14995 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
14996 }
14997
14998#ifdef FREECIV_JSON_CONNECTION
14999 /* Exit array. */
15000 FC_FREE(field_addr.sub_location);
15001#endif /* FREECIV_JSON_CONNECTION */
15002 }
15003 if (e) {
15004 log_packet_detailed("'prod' field error detected");
15005 }
15006 }
15007 if (BV_ISSET(fields, 20)) {
15008 log_packet_detailed(" field 'citizen_base' has changed");
15009#ifdef FREECIV_JSON_CONNECTION
15010 field_addr.name = "citizen_base";
15011#endif /* FREECIV_JSON_CONNECTION */
15012 e = 0;
15013 {
15014 int i;
15015
15016#ifdef FREECIV_JSON_CONNECTION
15017 /* Create the array. */
15018 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15019
15020 /* Enter the array. */
15021 field_addr.sub_location = plocation_elem_new(0);
15022#endif /* FREECIV_JSON_CONNECTION */
15023
15024 for (i = 0; i < O_LAST; i++) {
15025#ifdef FREECIV_JSON_CONNECTION
15026 /* Next array element. */
15027 field_addr.sub_location->number = i;
15028#endif /* FREECIV_JSON_CONNECTION */
15029 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
15030 }
15031
15032#ifdef FREECIV_JSON_CONNECTION
15033 /* Exit array. */
15034 FC_FREE(field_addr.sub_location);
15035#endif /* FREECIV_JSON_CONNECTION */
15036 }
15037 if (e) {
15038 log_packet_detailed("'citizen_base' field error detected");
15039 }
15040 }
15041 if (BV_ISSET(fields, 21)) {
15042 log_packet_detailed(" field 'usage' has changed");
15043#ifdef FREECIV_JSON_CONNECTION
15044 field_addr.name = "usage";
15045#endif /* FREECIV_JSON_CONNECTION */
15046 e = 0;
15047 {
15048 int i;
15049
15050#ifdef FREECIV_JSON_CONNECTION
15051 /* Create the array. */
15052 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15053
15054 /* Enter the array. */
15055 field_addr.sub_location = plocation_elem_new(0);
15056#endif /* FREECIV_JSON_CONNECTION */
15057
15058 for (i = 0; i < O_LAST; i++) {
15059#ifdef FREECIV_JSON_CONNECTION
15060 /* Next array element. */
15061 field_addr.sub_location->number = i;
15062#endif /* FREECIV_JSON_CONNECTION */
15063 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
15064 }
15065
15066#ifdef FREECIV_JSON_CONNECTION
15067 /* Exit array. */
15068 FC_FREE(field_addr.sub_location);
15069#endif /* FREECIV_JSON_CONNECTION */
15070 }
15071 if (e) {
15072 log_packet_detailed("'usage' field error detected");
15073 }
15074 }
15075 if (BV_ISSET(fields, 22)) {
15076 log_packet_detailed(" field 'food_stock' has changed");
15077#ifdef FREECIV_JSON_CONNECTION
15078 field_addr.name = "food_stock";
15079#endif /* FREECIV_JSON_CONNECTION */
15080 e = 0;
15081 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
15082 if (e) {
15083 log_packet_detailed("'food_stock' field error detected");
15084 }
15085 }
15086 if (BV_ISSET(fields, 23)) {
15087 log_packet_detailed(" field 'shield_stock' has changed");
15088#ifdef FREECIV_JSON_CONNECTION
15089 field_addr.name = "shield_stock";
15090#endif /* FREECIV_JSON_CONNECTION */
15091 e = 0;
15092 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
15093 if (e) {
15094 log_packet_detailed("'shield_stock' field error detected");
15095 }
15096 }
15097 if (BV_ISSET(fields, 24)) {
15098 log_packet_detailed(" field 'trade_route_count' has changed");
15099#ifdef FREECIV_JSON_CONNECTION
15100 field_addr.name = "trade_route_count";
15101#endif /* FREECIV_JSON_CONNECTION */
15102 e = 0;
15103 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
15104 if (e) {
15105 log_packet_detailed("'trade_route_count' field error detected");
15106 }
15107 }
15108 if (BV_ISSET(fields, 25)) {
15109 log_packet_detailed(" field 'pollution' has changed");
15110#ifdef FREECIV_JSON_CONNECTION
15111 field_addr.name = "pollution";
15112#endif /* FREECIV_JSON_CONNECTION */
15113 e = 0;
15114 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
15115 if (e) {
15116 log_packet_detailed("'pollution' field error detected");
15117 }
15118 }
15119 if (BV_ISSET(fields, 26)) {
15120 log_packet_detailed(" field 'illness_trade' has changed");
15121#ifdef FREECIV_JSON_CONNECTION
15122 field_addr.name = "illness_trade";
15123#endif /* FREECIV_JSON_CONNECTION */
15124 e = 0;
15125 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
15126 if (e) {
15127 log_packet_detailed("'illness_trade' field error detected");
15128 }
15129 }
15130 if (BV_ISSET(fields, 27)) {
15131 log_packet_detailed(" field 'production_kind' has changed");
15132#ifdef FREECIV_JSON_CONNECTION
15133 field_addr.name = "production_kind";
15134#endif /* FREECIV_JSON_CONNECTION */
15135 e = 0;
15136 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
15137 if (e) {
15138 log_packet_detailed("'production_kind' field error detected");
15139 }
15140 }
15141 if (BV_ISSET(fields, 28)) {
15142 log_packet_detailed(" field 'production_value' has changed");
15143#ifdef FREECIV_JSON_CONNECTION
15144 field_addr.name = "production_value";
15145#endif /* FREECIV_JSON_CONNECTION */
15146 e = 0;
15147 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
15148 if (e) {
15149 log_packet_detailed("'production_value' field error detected");
15150 }
15151 }
15152 if (BV_ISSET(fields, 29)) {
15153 log_packet_detailed(" field 'turn_founded' has changed");
15154#ifdef FREECIV_JSON_CONNECTION
15155 field_addr.name = "turn_founded";
15156#endif /* FREECIV_JSON_CONNECTION */
15157 e = 0;
15158 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
15159 if (e) {
15160 log_packet_detailed("'turn_founded' field error detected");
15161 }
15162 }
15163 if (BV_ISSET(fields, 30)) {
15164 log_packet_detailed(" field 'turn_last_built' has changed");
15165#ifdef FREECIV_JSON_CONNECTION
15166 field_addr.name = "turn_last_built";
15167#endif /* FREECIV_JSON_CONNECTION */
15168 e = 0;
15169 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
15170 if (e) {
15171 log_packet_detailed("'turn_last_built' field error detected");
15172 }
15173 }
15174 if (BV_ISSET(fields, 31)) {
15175 log_packet_detailed(" field 'changed_from_kind' has changed");
15176#ifdef FREECIV_JSON_CONNECTION
15177 field_addr.name = "changed_from_kind";
15178#endif /* FREECIV_JSON_CONNECTION */
15179 e = 0;
15180 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
15181 if (e) {
15182 log_packet_detailed("'changed_from_kind' field error detected");
15183 }
15184 }
15185 if (BV_ISSET(fields, 32)) {
15186 log_packet_detailed(" field 'changed_from_value' has changed");
15187#ifdef FREECIV_JSON_CONNECTION
15188 field_addr.name = "changed_from_value";
15189#endif /* FREECIV_JSON_CONNECTION */
15190 e = 0;
15191 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
15192 if (e) {
15193 log_packet_detailed("'changed_from_value' field error detected");
15194 }
15195 }
15196 if (BV_ISSET(fields, 33)) {
15197 log_packet_detailed(" field 'before_change_shields' has changed");
15198#ifdef FREECIV_JSON_CONNECTION
15199 field_addr.name = "before_change_shields";
15200#endif /* FREECIV_JSON_CONNECTION */
15201 e = 0;
15202 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
15203 if (e) {
15204 log_packet_detailed("'before_change_shields' field error detected");
15205 }
15206 }
15207 if (BV_ISSET(fields, 34)) {
15208 log_packet_detailed(" field 'disbanded_shields' has changed");
15209#ifdef FREECIV_JSON_CONNECTION
15210 field_addr.name = "disbanded_shields";
15211#endif /* FREECIV_JSON_CONNECTION */
15212 e = 0;
15213 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
15214 if (e) {
15215 log_packet_detailed("'disbanded_shields' field error detected");
15216 }
15217 }
15218 if (BV_ISSET(fields, 35)) {
15219 log_packet_detailed(" field 'caravan_shields' has changed");
15220#ifdef FREECIV_JSON_CONNECTION
15221 field_addr.name = "caravan_shields";
15222#endif /* FREECIV_JSON_CONNECTION */
15223 e = 0;
15224 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
15225 if (e) {
15226 log_packet_detailed("'caravan_shields' field error detected");
15227 }
15228 }
15229 if (BV_ISSET(fields, 36)) {
15230 log_packet_detailed(" field 'last_turns_shield_surplus' has changed");
15231#ifdef FREECIV_JSON_CONNECTION
15232 field_addr.name = "last_turns_shield_surplus";
15233#endif /* FREECIV_JSON_CONNECTION */
15234 e = 0;
15235 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
15236 if (e) {
15237 log_packet_detailed("'last_turns_shield_surplus' field error detected");
15238 }
15239 }
15240 if (BV_ISSET(fields, 37)) {
15241 log_packet_detailed(" field 'airlift' has changed");
15242#ifdef FREECIV_JSON_CONNECTION
15243 field_addr.name = "airlift";
15244#endif /* FREECIV_JSON_CONNECTION */
15245 e = 0;
15246 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
15247 if (e) {
15248 log_packet_detailed("'airlift' field error detected");
15249 }
15250 }
15251 /* field 38 is folded into the header */
15252 /* field 39 is folded into the header */
15253 /* field 40 is folded into the header */
15254 /* field 41 is folded into the header */
15255 /* field 42 is folded into the header */
15256 if (BV_ISSET(fields, 43)) {
15257 log_packet_detailed(" field 'walls' has changed");
15258#ifdef FREECIV_JSON_CONNECTION
15259 field_addr.name = "walls";
15260#endif /* FREECIV_JSON_CONNECTION */
15261 e = 0;
15262 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
15263 if (e) {
15264 log_packet_detailed("'walls' field error detected");
15265 }
15266 }
15267 if (BV_ISSET(fields, 44)) {
15268 log_packet_detailed(" field 'city_image' has changed");
15269#ifdef FREECIV_JSON_CONNECTION
15270 field_addr.name = "city_image";
15271#endif /* FREECIV_JSON_CONNECTION */
15272 e = 0;
15273 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
15274 if (e) {
15275 log_packet_detailed("'city_image' field error detected");
15276 }
15277 }
15278 if (BV_ISSET(fields, 45)) {
15279 log_packet_detailed(" field 'steal' has changed");
15280#ifdef FREECIV_JSON_CONNECTION
15281 field_addr.name = "steal";
15282#endif /* FREECIV_JSON_CONNECTION */
15283 e = 0;
15284 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
15285 if (e) {
15286 log_packet_detailed("'steal' field error detected");
15287 }
15288 }
15289 if (BV_ISSET(fields, 46)) {
15290 log_packet_detailed(" field 'worklist' has changed");
15291#ifdef FREECIV_JSON_CONNECTION
15292 field_addr.name = "worklist";
15293#endif /* FREECIV_JSON_CONNECTION */
15294 e = 0;
15295 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
15296 if (e) {
15297 log_packet_detailed("'worklist' field error detected");
15298 }
15299 }
15300 if (BV_ISSET(fields, 47)) {
15301 log_packet_detailed(" field 'improvements' has changed");
15302#ifdef FREECIV_JSON_CONNECTION
15303 field_addr.name = "improvements";
15304#endif /* FREECIV_JSON_CONNECTION */
15305 e = 0;
15306 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
15307 if (e) {
15308 log_packet_detailed("'improvements' field error detected");
15309 }
15310 }
15311 if (BV_ISSET(fields, 48)) {
15312 log_packet_detailed(" field 'city_options' has changed");
15313#ifdef FREECIV_JSON_CONNECTION
15314 field_addr.name = "city_options";
15315#endif /* FREECIV_JSON_CONNECTION */
15316 e = 0;
15317 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
15318 if (e) {
15319 log_packet_detailed("'city_options' field error detected");
15320 }
15321 }
15322 if (BV_ISSET(fields, 49)) {
15323 log_packet_detailed(" field 'name' has changed");
15324#ifdef FREECIV_JSON_CONNECTION
15325 field_addr.name = "name";
15326#endif /* FREECIV_JSON_CONNECTION */
15327 e = 0;
15328 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
15329 if (e) {
15330 log_packet_detailed("'name' field error detected");
15331 }
15332 }
15333
15334 *old = *real_packet;
15335
15336 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
15337 if (NULL != *hash) {
15338 genhash_remove(*hash, real_packet);
15339 }
15340#endif /* FREECIV_DELTA_PROTOCOL */
15341#ifndef FREECIV_DELTA_PROTOCOL
15342#ifdef FREECIV_JSON_CONNECTION
15343 field_addr.name = "id";
15344#endif /* FREECIV_JSON_CONNECTION */
15345 e = 0;
15346 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
15347 if (e) {
15348 log_packet_detailed("'id' field error detected");
15349 }
15350#ifdef FREECIV_JSON_CONNECTION
15351 field_addr.name = "tile";
15352#endif /* FREECIV_JSON_CONNECTION */
15353 e = 0;
15354 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
15355 if (e) {
15356 log_packet_detailed("'tile' field error detected");
15357 }
15358#ifdef FREECIV_JSON_CONNECTION
15359 field_addr.name = "owner";
15360#endif /* FREECIV_JSON_CONNECTION */
15361 e = 0;
15362 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
15363 if (e) {
15364 log_packet_detailed("'owner' field error detected");
15365 }
15366#ifdef FREECIV_JSON_CONNECTION
15367 field_addr.name = "original";
15368#endif /* FREECIV_JSON_CONNECTION */
15369 e = 0;
15370 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
15371 if (e) {
15372 log_packet_detailed("'original' field error detected");
15373 }
15374#ifdef FREECIV_JSON_CONNECTION
15375 field_addr.name = "size";
15376#endif /* FREECIV_JSON_CONNECTION */
15377 e = 0;
15378 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
15379 if (e) {
15380 log_packet_detailed("'size' field error detected");
15381 }
15382#ifdef FREECIV_JSON_CONNECTION
15383 field_addr.name = "city_radius_sq";
15384#endif /* FREECIV_JSON_CONNECTION */
15385 e = 0;
15386 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_radius_sq);
15387 if (e) {
15388 log_packet_detailed("'city_radius_sq' field error detected");
15389 }
15390#ifdef FREECIV_JSON_CONNECTION
15391 field_addr.name = "style";
15392#endif /* FREECIV_JSON_CONNECTION */
15393 e = 0;
15394 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
15395 if (e) {
15396 log_packet_detailed("'style' field error detected");
15397 }
15398#ifdef FREECIV_JSON_CONNECTION
15399 field_addr.name = "capital";
15400#endif /* FREECIV_JSON_CONNECTION */
15401 e = 0;
15402 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
15403 if (e) {
15404 log_packet_detailed("'capital' field error detected");
15405 }
15406#ifdef FREECIV_JSON_CONNECTION
15407 field_addr.name = "ppl_happy";
15408#endif /* FREECIV_JSON_CONNECTION */
15409 e = 0;
15410 {
15411 int i;
15412
15413#ifdef FREECIV_JSON_CONNECTION
15414 /* Create the array. */
15415 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15416
15417 /* Enter the array. */
15418 field_addr.sub_location = plocation_elem_new(0);
15419#endif /* FREECIV_JSON_CONNECTION */
15420
15421 for (i = 0; i < FEELING_LAST; i++) {
15422#ifdef FREECIV_JSON_CONNECTION
15423 /* Next array element. */
15424 field_addr.sub_location->number = i;
15425#endif /* FREECIV_JSON_CONNECTION */
15426 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
15427 }
15428
15429#ifdef FREECIV_JSON_CONNECTION
15430 /* Exit array. */
15431 FC_FREE(field_addr.sub_location);
15432#endif /* FREECIV_JSON_CONNECTION */
15433 }
15434 if (e) {
15435 log_packet_detailed("'ppl_happy' field error detected");
15436 }
15437#ifdef FREECIV_JSON_CONNECTION
15438 field_addr.name = "ppl_content";
15439#endif /* FREECIV_JSON_CONNECTION */
15440 e = 0;
15441 {
15442 int i;
15443
15444#ifdef FREECIV_JSON_CONNECTION
15445 /* Create the array. */
15446 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15447
15448 /* Enter the array. */
15449 field_addr.sub_location = plocation_elem_new(0);
15450#endif /* FREECIV_JSON_CONNECTION */
15451
15452 for (i = 0; i < FEELING_LAST; i++) {
15453#ifdef FREECIV_JSON_CONNECTION
15454 /* Next array element. */
15455 field_addr.sub_location->number = i;
15456#endif /* FREECIV_JSON_CONNECTION */
15457 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
15458 }
15459
15460#ifdef FREECIV_JSON_CONNECTION
15461 /* Exit array. */
15462 FC_FREE(field_addr.sub_location);
15463#endif /* FREECIV_JSON_CONNECTION */
15464 }
15465 if (e) {
15466 log_packet_detailed("'ppl_content' field error detected");
15467 }
15468#ifdef FREECIV_JSON_CONNECTION
15469 field_addr.name = "ppl_unhappy";
15470#endif /* FREECIV_JSON_CONNECTION */
15471 e = 0;
15472 {
15473 int i;
15474
15475#ifdef FREECIV_JSON_CONNECTION
15476 /* Create the array. */
15477 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15478
15479 /* Enter the array. */
15480 field_addr.sub_location = plocation_elem_new(0);
15481#endif /* FREECIV_JSON_CONNECTION */
15482
15483 for (i = 0; i < FEELING_LAST; i++) {
15484#ifdef FREECIV_JSON_CONNECTION
15485 /* Next array element. */
15486 field_addr.sub_location->number = i;
15487#endif /* FREECIV_JSON_CONNECTION */
15488 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
15489 }
15490
15491#ifdef FREECIV_JSON_CONNECTION
15492 /* Exit array. */
15493 FC_FREE(field_addr.sub_location);
15494#endif /* FREECIV_JSON_CONNECTION */
15495 }
15496 if (e) {
15497 log_packet_detailed("'ppl_unhappy' field error detected");
15498 }
15499#ifdef FREECIV_JSON_CONNECTION
15500 field_addr.name = "ppl_angry";
15501#endif /* FREECIV_JSON_CONNECTION */
15502 e = 0;
15503 {
15504 int i;
15505
15506#ifdef FREECIV_JSON_CONNECTION
15507 /* Create the array. */
15508 e |= DIO_PUT(farray, &dout, &field_addr, FEELING_LAST);
15509
15510 /* Enter the array. */
15511 field_addr.sub_location = plocation_elem_new(0);
15512#endif /* FREECIV_JSON_CONNECTION */
15513
15514 for (i = 0; i < FEELING_LAST; i++) {
15515#ifdef FREECIV_JSON_CONNECTION
15516 /* Next array element. */
15517 field_addr.sub_location->number = i;
15518#endif /* FREECIV_JSON_CONNECTION */
15519 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
15520 }
15521
15522#ifdef FREECIV_JSON_CONNECTION
15523 /* Exit array. */
15524 FC_FREE(field_addr.sub_location);
15525#endif /* FREECIV_JSON_CONNECTION */
15526 }
15527 if (e) {
15528 log_packet_detailed("'ppl_angry' field error detected");
15529 }
15530#ifdef FREECIV_JSON_CONNECTION
15531 field_addr.name = "specialists_size";
15532#endif /* FREECIV_JSON_CONNECTION */
15533 e = 0;
15534 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
15535 if (e) {
15536 log_packet_detailed("'specialists_size' field error detected");
15537 }
15538#ifdef FREECIV_JSON_CONNECTION
15539 field_addr.name = "specialists";
15540#endif /* FREECIV_JSON_CONNECTION */
15541 e = 0;
15542 {
15543 int i;
15544
15545#ifdef FREECIV_JSON_CONNECTION
15546 /* Create the array. */
15547 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
15548
15549 /* Enter the array. */
15550 field_addr.sub_location = plocation_elem_new(0);
15551#endif /* FREECIV_JSON_CONNECTION */
15552
15553 for (i = 0; i < real_packet->specialists_size; i++) {
15554#ifdef FREECIV_JSON_CONNECTION
15555 /* Next array element. */
15556 field_addr.sub_location->number = i;
15557#endif /* FREECIV_JSON_CONNECTION */
15558 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
15559 }
15560
15561#ifdef FREECIV_JSON_CONNECTION
15562 /* Exit array. */
15563 FC_FREE(field_addr.sub_location);
15564#endif /* FREECIV_JSON_CONNECTION */
15565 }
15566 if (e) {
15567 log_packet_detailed("'specialists' field error detected");
15568 }
15569#ifdef FREECIV_JSON_CONNECTION
15570 field_addr.name = "history";
15571#endif /* FREECIV_JSON_CONNECTION */
15572 e = 0;
15573 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
15574 if (e) {
15575 log_packet_detailed("'history' field error detected");
15576 }
15577#ifdef FREECIV_JSON_CONNECTION
15578 field_addr.name = "culture";
15579#endif /* FREECIV_JSON_CONNECTION */
15580 e = 0;
15581 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
15582 if (e) {
15583 log_packet_detailed("'culture' field error detected");
15584 }
15585#ifdef FREECIV_JSON_CONNECTION
15586 field_addr.name = "buy_cost";
15587#endif /* FREECIV_JSON_CONNECTION */
15588 e = 0;
15589 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->buy_cost);
15590 if (e) {
15591 log_packet_detailed("'buy_cost' field error detected");
15592 }
15593#ifdef FREECIV_JSON_CONNECTION
15594 field_addr.name = "surplus";
15595#endif /* FREECIV_JSON_CONNECTION */
15596 e = 0;
15597 {
15598 int i;
15599
15600#ifdef FREECIV_JSON_CONNECTION
15601 /* Create the array. */
15602 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15603
15604 /* Enter the array. */
15605 field_addr.sub_location = plocation_elem_new(0);
15606#endif /* FREECIV_JSON_CONNECTION */
15607
15608 for (i = 0; i < O_LAST; i++) {
15609#ifdef FREECIV_JSON_CONNECTION
15610 /* Next array element. */
15611 field_addr.sub_location->number = i;
15612#endif /* FREECIV_JSON_CONNECTION */
15613 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->surplus[i]);
15614 }
15615
15616#ifdef FREECIV_JSON_CONNECTION
15617 /* Exit array. */
15618 FC_FREE(field_addr.sub_location);
15619#endif /* FREECIV_JSON_CONNECTION */
15620 }
15621 if (e) {
15622 log_packet_detailed("'surplus' field error detected");
15623 }
15624#ifdef FREECIV_JSON_CONNECTION
15625 field_addr.name = "waste";
15626#endif /* FREECIV_JSON_CONNECTION */
15627 e = 0;
15628 {
15629 int i;
15630
15631#ifdef FREECIV_JSON_CONNECTION
15632 /* Create the array. */
15633 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15634
15635 /* Enter the array. */
15636 field_addr.sub_location = plocation_elem_new(0);
15637#endif /* FREECIV_JSON_CONNECTION */
15638
15639 for (i = 0; i < O_LAST; i++) {
15640#ifdef FREECIV_JSON_CONNECTION
15641 /* Next array element. */
15642 field_addr.sub_location->number = i;
15643#endif /* FREECIV_JSON_CONNECTION */
15644 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->waste[i]);
15645 }
15646
15647#ifdef FREECIV_JSON_CONNECTION
15648 /* Exit array. */
15649 FC_FREE(field_addr.sub_location);
15650#endif /* FREECIV_JSON_CONNECTION */
15651 }
15652 if (e) {
15653 log_packet_detailed("'waste' field error detected");
15654 }
15655#ifdef FREECIV_JSON_CONNECTION
15656 field_addr.name = "unhappy_penalty";
15657#endif /* FREECIV_JSON_CONNECTION */
15658 e = 0;
15659 {
15660 int i;
15661
15662#ifdef FREECIV_JSON_CONNECTION
15663 /* Create the array. */
15664 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15665
15666 /* Enter the array. */
15667 field_addr.sub_location = plocation_elem_new(0);
15668#endif /* FREECIV_JSON_CONNECTION */
15669
15670 for (i = 0; i < O_LAST; i++) {
15671#ifdef FREECIV_JSON_CONNECTION
15672 /* Next array element. */
15673 field_addr.sub_location->number = i;
15674#endif /* FREECIV_JSON_CONNECTION */
15675 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->unhappy_penalty[i]);
15676 }
15677
15678#ifdef FREECIV_JSON_CONNECTION
15679 /* Exit array. */
15680 FC_FREE(field_addr.sub_location);
15681#endif /* FREECIV_JSON_CONNECTION */
15682 }
15683 if (e) {
15684 log_packet_detailed("'unhappy_penalty' field error detected");
15685 }
15686#ifdef FREECIV_JSON_CONNECTION
15687 field_addr.name = "prod";
15688#endif /* FREECIV_JSON_CONNECTION */
15689 e = 0;
15690 {
15691 int i;
15692
15693#ifdef FREECIV_JSON_CONNECTION
15694 /* Create the array. */
15695 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15696
15697 /* Enter the array. */
15698 field_addr.sub_location = plocation_elem_new(0);
15699#endif /* FREECIV_JSON_CONNECTION */
15700
15701 for (i = 0; i < O_LAST; i++) {
15702#ifdef FREECIV_JSON_CONNECTION
15703 /* Next array element. */
15704 field_addr.sub_location->number = i;
15705#endif /* FREECIV_JSON_CONNECTION */
15706 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->prod[i]);
15707 }
15708
15709#ifdef FREECIV_JSON_CONNECTION
15710 /* Exit array. */
15711 FC_FREE(field_addr.sub_location);
15712#endif /* FREECIV_JSON_CONNECTION */
15713 }
15714 if (e) {
15715 log_packet_detailed("'prod' field error detected");
15716 }
15717#ifdef FREECIV_JSON_CONNECTION
15718 field_addr.name = "citizen_base";
15719#endif /* FREECIV_JSON_CONNECTION */
15720 e = 0;
15721 {
15722 int i;
15723
15724#ifdef FREECIV_JSON_CONNECTION
15725 /* Create the array. */
15726 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15727
15728 /* Enter the array. */
15729 field_addr.sub_location = plocation_elem_new(0);
15730#endif /* FREECIV_JSON_CONNECTION */
15731
15732 for (i = 0; i < O_LAST; i++) {
15733#ifdef FREECIV_JSON_CONNECTION
15734 /* Next array element. */
15735 field_addr.sub_location->number = i;
15736#endif /* FREECIV_JSON_CONNECTION */
15737 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->citizen_base[i]);
15738 }
15739
15740#ifdef FREECIV_JSON_CONNECTION
15741 /* Exit array. */
15742 FC_FREE(field_addr.sub_location);
15743#endif /* FREECIV_JSON_CONNECTION */
15744 }
15745 if (e) {
15746 log_packet_detailed("'citizen_base' field error detected");
15747 }
15748#ifdef FREECIV_JSON_CONNECTION
15749 field_addr.name = "usage";
15750#endif /* FREECIV_JSON_CONNECTION */
15751 e = 0;
15752 {
15753 int i;
15754
15755#ifdef FREECIV_JSON_CONNECTION
15756 /* Create the array. */
15757 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
15758
15759 /* Enter the array. */
15760 field_addr.sub_location = plocation_elem_new(0);
15761#endif /* FREECIV_JSON_CONNECTION */
15762
15763 for (i = 0; i < O_LAST; i++) {
15764#ifdef FREECIV_JSON_CONNECTION
15765 /* Next array element. */
15766 field_addr.sub_location->number = i;
15767#endif /* FREECIV_JSON_CONNECTION */
15768 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->usage[i]);
15769 }
15770
15771#ifdef FREECIV_JSON_CONNECTION
15772 /* Exit array. */
15773 FC_FREE(field_addr.sub_location);
15774#endif /* FREECIV_JSON_CONNECTION */
15775 }
15776 if (e) {
15777 log_packet_detailed("'usage' field error detected");
15778 }
15779#ifdef FREECIV_JSON_CONNECTION
15780 field_addr.name = "food_stock";
15781#endif /* FREECIV_JSON_CONNECTION */
15782 e = 0;
15783 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->food_stock);
15784 if (e) {
15785 log_packet_detailed("'food_stock' field error detected");
15786 }
15787#ifdef FREECIV_JSON_CONNECTION
15788 field_addr.name = "shield_stock";
15789#endif /* FREECIV_JSON_CONNECTION */
15790 e = 0;
15791 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
15792 if (e) {
15793 log_packet_detailed("'shield_stock' field error detected");
15794 }
15795#ifdef FREECIV_JSON_CONNECTION
15796 field_addr.name = "trade_route_count";
15797#endif /* FREECIV_JSON_CONNECTION */
15798 e = 0;
15799 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->trade_route_count);
15800 if (e) {
15801 log_packet_detailed("'trade_route_count' field error detected");
15802 }
15803#ifdef FREECIV_JSON_CONNECTION
15804 field_addr.name = "pollution";
15805#endif /* FREECIV_JSON_CONNECTION */
15806 e = 0;
15807 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->pollution);
15808 if (e) {
15809 log_packet_detailed("'pollution' field error detected");
15810 }
15811#ifdef FREECIV_JSON_CONNECTION
15812 field_addr.name = "illness_trade";
15813#endif /* FREECIV_JSON_CONNECTION */
15814 e = 0;
15815 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->illness_trade);
15816 if (e) {
15817 log_packet_detailed("'illness_trade' field error detected");
15818 }
15819#ifdef FREECIV_JSON_CONNECTION
15820 field_addr.name = "production_kind";
15821#endif /* FREECIV_JSON_CONNECTION */
15822 e = 0;
15823 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
15824 if (e) {
15825 log_packet_detailed("'production_kind' field error detected");
15826 }
15827#ifdef FREECIV_JSON_CONNECTION
15828 field_addr.name = "production_value";
15829#endif /* FREECIV_JSON_CONNECTION */
15830 e = 0;
15831 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
15832 if (e) {
15833 log_packet_detailed("'production_value' field error detected");
15834 }
15835#ifdef FREECIV_JSON_CONNECTION
15836 field_addr.name = "turn_founded";
15837#endif /* FREECIV_JSON_CONNECTION */
15838 e = 0;
15839 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
15840 if (e) {
15841 log_packet_detailed("'turn_founded' field error detected");
15842 }
15843#ifdef FREECIV_JSON_CONNECTION
15844 field_addr.name = "turn_last_built";
15845#endif /* FREECIV_JSON_CONNECTION */
15846 e = 0;
15847 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
15848 if (e) {
15849 log_packet_detailed("'turn_last_built' field error detected");
15850 }
15851#ifdef FREECIV_JSON_CONNECTION
15852 field_addr.name = "changed_from_kind";
15853#endif /* FREECIV_JSON_CONNECTION */
15854 e = 0;
15855 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_kind);
15856 if (e) {
15857 log_packet_detailed("'changed_from_kind' field error detected");
15858 }
15859#ifdef FREECIV_JSON_CONNECTION
15860 field_addr.name = "changed_from_value";
15861#endif /* FREECIV_JSON_CONNECTION */
15862 e = 0;
15863 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from_value);
15864 if (e) {
15865 log_packet_detailed("'changed_from_value' field error detected");
15866 }
15867#ifdef FREECIV_JSON_CONNECTION
15868 field_addr.name = "before_change_shields";
15869#endif /* FREECIV_JSON_CONNECTION */
15870 e = 0;
15871 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->before_change_shields);
15872 if (e) {
15873 log_packet_detailed("'before_change_shields' field error detected");
15874 }
15875#ifdef FREECIV_JSON_CONNECTION
15876 field_addr.name = "disbanded_shields";
15877#endif /* FREECIV_JSON_CONNECTION */
15878 e = 0;
15879 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disbanded_shields);
15880 if (e) {
15881 log_packet_detailed("'disbanded_shields' field error detected");
15882 }
15883#ifdef FREECIV_JSON_CONNECTION
15884 field_addr.name = "caravan_shields";
15885#endif /* FREECIV_JSON_CONNECTION */
15886 e = 0;
15887 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->caravan_shields);
15888 if (e) {
15889 log_packet_detailed("'caravan_shields' field error detected");
15890 }
15891#ifdef FREECIV_JSON_CONNECTION
15892 field_addr.name = "last_turns_shield_surplus";
15893#endif /* FREECIV_JSON_CONNECTION */
15894 e = 0;
15895 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->last_turns_shield_surplus);
15896 if (e) {
15897 log_packet_detailed("'last_turns_shield_surplus' field error detected");
15898 }
15899#ifdef FREECIV_JSON_CONNECTION
15900 field_addr.name = "airlift";
15901#endif /* FREECIV_JSON_CONNECTION */
15902 e = 0;
15903 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->airlift);
15904 if (e) {
15905 log_packet_detailed("'airlift' field error detected");
15906 }
15907#ifdef FREECIV_JSON_CONNECTION
15908 field_addr.name = "did_buy";
15909#endif /* FREECIV_JSON_CONNECTION */
15910 e = 0;
15911 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
15912 if (e) {
15913 log_packet_detailed("'did_buy' field error detected");
15914 }
15915#ifdef FREECIV_JSON_CONNECTION
15916 field_addr.name = "did_sell";
15917#endif /* FREECIV_JSON_CONNECTION */
15918 e = 0;
15919 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
15920 if (e) {
15921 log_packet_detailed("'did_sell' field error detected");
15922 }
15923#ifdef FREECIV_JSON_CONNECTION
15924 field_addr.name = "was_happy";
15925#endif /* FREECIV_JSON_CONNECTION */
15926 e = 0;
15927 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
15928 if (e) {
15929 log_packet_detailed("'was_happy' field error detected");
15930 }
15931#ifdef FREECIV_JSON_CONNECTION
15932 field_addr.name = "had_famine";
15933#endif /* FREECIV_JSON_CONNECTION */
15934 e = 0;
15935 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->had_famine);
15936 if (e) {
15937 log_packet_detailed("'had_famine' field error detected");
15938 }
15939#ifdef FREECIV_JSON_CONNECTION
15940 field_addr.name = "diplomat_investigate";
15941#endif /* FREECIV_JSON_CONNECTION */
15942 e = 0;
15943 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->diplomat_investigate);
15944 if (e) {
15945 log_packet_detailed("'diplomat_investigate' field error detected");
15946 }
15947#ifdef FREECIV_JSON_CONNECTION
15948 field_addr.name = "walls";
15949#endif /* FREECIV_JSON_CONNECTION */
15950 e = 0;
15951 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
15952 if (e) {
15953 log_packet_detailed("'walls' field error detected");
15954 }
15955#ifdef FREECIV_JSON_CONNECTION
15956 field_addr.name = "city_image";
15957#endif /* FREECIV_JSON_CONNECTION */
15958 e = 0;
15959 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
15960 if (e) {
15961 log_packet_detailed("'city_image' field error detected");
15962 }
15963#ifdef FREECIV_JSON_CONNECTION
15964 field_addr.name = "steal";
15965#endif /* FREECIV_JSON_CONNECTION */
15966 e = 0;
15967 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->steal);
15968 if (e) {
15969 log_packet_detailed("'steal' field error detected");
15970 }
15971#ifdef FREECIV_JSON_CONNECTION
15972 field_addr.name = "worklist";
15973#endif /* FREECIV_JSON_CONNECTION */
15974 e = 0;
15975 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
15976 if (e) {
15977 log_packet_detailed("'worklist' field error detected");
15978 }
15979#ifdef FREECIV_JSON_CONNECTION
15980 field_addr.name = "improvements";
15981#endif /* FREECIV_JSON_CONNECTION */
15982 e = 0;
15983 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
15984 if (e) {
15985 log_packet_detailed("'improvements' field error detected");
15986 }
15987#ifdef FREECIV_JSON_CONNECTION
15988 field_addr.name = "city_options";
15989#endif /* FREECIV_JSON_CONNECTION */
15990 e = 0;
15991 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
15992 if (e) {
15993 log_packet_detailed("'city_options' field error detected");
15994 }
15995#ifdef FREECIV_JSON_CONNECTION
15996 field_addr.name = "name";
15997#endif /* FREECIV_JSON_CONNECTION */
15998 e = 0;
15999 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
16000 if (e) {
16001 log_packet_detailed("'name' field error detected");
16002 }
16003
16004#endif
16005 SEND_PACKET_END(PACKET_CITY_INFO);
16006}
16007
16008 int send_packet_city_info(struct connection *pc, const struct packet_city_info *packet, bool force_to_send)
16009{
16010 if (!pc->used) {
16011 log_error("WARNING: trying to send data to the closed connection %s",
16012 conn_description(pc));
16013 return -1;
16014 }
16015 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_INFO].force_to_send != NULL, -1,
16016 "Handler for PACKET_CITY_INFO not installed");
16017 return pc->phs.handlers->send[PACKET_CITY_INFO].force_to_send(pc, packet, force_to_send);
16018}
16019
16020 void lsend_packet_city_info(struct conn_list *dest, const struct packet_city_info *packet, bool force_to_send)
16021{
16022 conn_list_iterate(dest, pconn) {
16023 send_packet_city_info(pconn, packet, force_to_send);
16024 } conn_list_iterate_end;
16025}
16026
16027#ifdef FREECIV_DELTA_PROTOCOL
16028static genhash_val_t hash_packet_city_nationalities_100(const void *vkey)
16029{
16030 const struct packet_city_nationalities *key = (const struct packet_city_nationalities *) vkey;
16031 genhash_val_t result = 0;
16032
16033 result += key->id;
16034
16035 result &= 0xFFFFFFFF;
16036 return result;
16037}
16038
16039static bool cmp_packet_city_nationalities_100(const void *vkey1, const void *vkey2)
16040{
16041 const struct packet_city_nationalities *old = (const struct packet_city_nationalities *) vkey1;
16042 const struct packet_city_nationalities *real_packet = (const struct packet_city_nationalities *) vkey2;
16043 bool differ;
16044
16045 differ = (old->id != real_packet->id);
16046
16047 return !differ;
16048}
16049 BV_DEFINE(packet_city_nationalities_100_fields, 3);
16050#endif /* FREECIV_DELTA_PROTOCOL */
16051
16052 static struct packet_city_nationalities *receive_packet_city_nationalities_100(struct connection *pc)
16053{
16054#ifdef FREECIV_DELTA_PROTOCOL
16055 packet_city_nationalities_100_fields fields;
16056 struct packet_city_nationalities *old;
16057 struct genhash **hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
16058#endif /* FREECIV_DELTA_PROTOCOL */
16059 RECEIVE_PACKET_START(packet_city_nationalities, real_packet);
16060#ifdef FREECIV_JSON_CONNECTION
16061 struct plocation field_addr;
16062 {
16063 struct plocation *field_addr_tmp = plocation_field_new(NULL);
16064 field_addr = *field_addr_tmp;
16065 FC_FREE(field_addr_tmp);
16066 }
16067#endif /* FREECIV_JSON_CONNECTION */
16068
16069#ifdef FREECIV_DELTA_PROTOCOL
16070#ifdef FREECIV_JSON_CONNECTION
16071 field_addr.name = "fields";
16072#endif /* FREECIV_JSON_CONNECTION */
16073 DIO_BV_GET(&din, &field_addr, fields);
16074#ifdef FREECIV_JSON_CONNECTION
16075 field_addr.name = "id";
16076#endif /* FREECIV_JSON_CONNECTION */
16077 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
16078 RECEIVE_PACKET_FIELD_ERROR(id);
16079 }
16080
16081#else /* FREECIV_DELTA_PROTOCOL */
16082#ifdef FREECIV_JSON_CONNECTION
16083 field_addr.name = "id";
16084#endif /* FREECIV_JSON_CONNECTION */
16085 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
16086 RECEIVE_PACKET_FIELD_ERROR(id);
16087 }
16088#ifdef FREECIV_JSON_CONNECTION
16089 field_addr.name = "nationalities_count";
16090#endif /* FREECIV_JSON_CONNECTION */
16091 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
16092 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
16093 }
16094#ifdef FREECIV_JSON_CONNECTION
16095 field_addr.name = "nation_id";
16096#endif /* FREECIV_JSON_CONNECTION */
16097 {
16098 int i;
16099
16100#ifdef FREECIV_JSON_CONNECTION
16101 /* Enter array. */
16102 field_addr.sub_location = plocation_elem_new(0);
16103#endif /* FREECIV_JSON_CONNECTION */
16104
16105 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16106 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
16107 }
16108 for (i = 0; i < real_packet->nationalities_count; i++) {
16109#ifdef FREECIV_JSON_CONNECTION
16110 field_addr.sub_location->number = i;
16111#endif /* FREECIV_JSON_CONNECTION */
16112 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_id[i])) {
16113 RECEIVE_PACKET_FIELD_ERROR(nation_id);
16114 }
16115 }
16116
16117#ifdef FREECIV_JSON_CONNECTION
16118 /* Exit array. */
16119 FC_FREE(field_addr.sub_location);
16120#endif /* FREECIV_JSON_CONNECTION */
16121 }
16122#ifdef FREECIV_JSON_CONNECTION
16123 field_addr.name = "nation_citizens";
16124#endif /* FREECIV_JSON_CONNECTION */
16125 {
16126 int i;
16127
16128#ifdef FREECIV_JSON_CONNECTION
16129 /* Enter array. */
16130 field_addr.sub_location = plocation_elem_new(0);
16131#endif /* FREECIV_JSON_CONNECTION */
16132
16133 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16134 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
16135 }
16136 for (i = 0; i < real_packet->nationalities_count; i++) {
16137#ifdef FREECIV_JSON_CONNECTION
16138 field_addr.sub_location->number = i;
16139#endif /* FREECIV_JSON_CONNECTION */
16140 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
16141 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
16142 }
16143 }
16144
16145#ifdef FREECIV_JSON_CONNECTION
16146 /* Exit array. */
16147 FC_FREE(field_addr.sub_location);
16148#endif /* FREECIV_JSON_CONNECTION */
16149 }
16150#endif
16151 log_packet_detailed("packet_city_nationalities_100: got info about (%d)",
16152 real_packet->id);
16153
16154#ifdef FREECIV_DELTA_PROTOCOL
16155 if (NULL == *hash) {
16156 *hash = genhash_new_full(hash_packet_city_nationalities_100, cmp_packet_city_nationalities_100,
16157 NULL, NULL, NULL, free);
16158 }
16159
16160 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
16161 *real_packet = *old;
16162 } else {
16163 int id;
16164
16165 id = real_packet->id;
16166
16167 log_packet_detailed(" no old info");
16168 memset(real_packet, 0, sizeof(*real_packet));
16169
16170 real_packet->id = id;
16171 }
16172
16173 if (BV_ISSET(fields, 0)) {
16174 log_packet_detailed(" got field 'nationalities_count'");
16175#ifdef FREECIV_JSON_CONNECTION
16176 field_addr.name = "nationalities_count";
16177#endif /* FREECIV_JSON_CONNECTION */
16178 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nationalities_count)) {
16179 RECEIVE_PACKET_FIELD_ERROR(nationalities_count);
16180 }
16181 }
16182 if (BV_ISSET(fields, 1)) {
16183 log_packet_detailed(" got field 'nation_id'");
16184#ifdef FREECIV_JSON_CONNECTION
16185 field_addr.name = "nation_id";
16186#endif /* FREECIV_JSON_CONNECTION */
16187 {
16188 int i;
16189
16190#ifdef FREECIV_JSON_CONNECTION
16191 /* Enter array. */
16192 field_addr.sub_location = plocation_elem_new(0);
16193#endif /* FREECIV_JSON_CONNECTION */
16194
16195 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16196 RECEIVE_PACKET_FIELD_ERROR(nation_id, ": truncation array");
16197 }
16198 for (i = 0; i < real_packet->nationalities_count; i++) {
16199#ifdef FREECIV_JSON_CONNECTION
16200 field_addr.sub_location->number = i;
16201#endif /* FREECIV_JSON_CONNECTION */
16202 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_id[i])) {
16203 RECEIVE_PACKET_FIELD_ERROR(nation_id);
16204 }
16205 }
16206
16207#ifdef FREECIV_JSON_CONNECTION
16208 /* Exit array. */
16209 FC_FREE(field_addr.sub_location);
16210#endif /* FREECIV_JSON_CONNECTION */
16211 }
16212 }
16213 if (BV_ISSET(fields, 2)) {
16214 log_packet_detailed(" got field 'nation_citizens'");
16215#ifdef FREECIV_JSON_CONNECTION
16216 field_addr.name = "nation_citizens";
16217#endif /* FREECIV_JSON_CONNECTION */
16218 {
16219 int i;
16220
16221#ifdef FREECIV_JSON_CONNECTION
16222 /* Enter array. */
16223 field_addr.sub_location = plocation_elem_new(0);
16224#endif /* FREECIV_JSON_CONNECTION */
16225
16226 if (real_packet->nationalities_count > MAX_CITY_NATIONALITIES) {
16227 RECEIVE_PACKET_FIELD_ERROR(nation_citizens, ": truncation array");
16228 }
16229 for (i = 0; i < real_packet->nationalities_count; i++) {
16230#ifdef FREECIV_JSON_CONNECTION
16231 field_addr.sub_location->number = i;
16232#endif /* FREECIV_JSON_CONNECTION */
16233 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nation_citizens[i])) {
16234 RECEIVE_PACKET_FIELD_ERROR(nation_citizens);
16235 }
16236 }
16237
16238#ifdef FREECIV_JSON_CONNECTION
16239 /* Exit array. */
16240 FC_FREE(field_addr.sub_location);
16241#endif /* FREECIV_JSON_CONNECTION */
16242 }
16243 }
16244
16245 if (NULL == old) {
16246 old = fc_malloc(sizeof(*old));
16247 *old = *real_packet;
16248 genhash_insert(*hash, old, old);
16249 } else {
16250 *old = *real_packet;
16251 }
16252
16253#endif /* FREECIV_DELTA_PROTOCOL */
16254 RECEIVE_PACKET_END(real_packet);
16255}
16256
16257 static int send_packet_city_nationalities_100(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
16258{
16259 const struct packet_city_nationalities *real_packet = packet;
16260 int e;
16261#ifdef FREECIV_DELTA_PROTOCOL
16262 packet_city_nationalities_100_fields fields;
16263 struct packet_city_nationalities *old;
16264 bool differ;
16265 struct genhash **hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
16266 int different = force_to_send;
16267#endif /* FREECIV_DELTA_PROTOCOL */
16268 SEND_PACKET_START(PACKET_CITY_NATIONALITIES);
16269#ifdef FREECIV_JSON_CONNECTION
16270 struct plocation field_addr;
16271 {
16272 struct plocation *field_addr_tmp = plocation_field_new(NULL);
16273 field_addr = *field_addr_tmp;
16274 FC_FREE(field_addr_tmp);
16275 }
16276#endif /* FREECIV_JSON_CONNECTION */
16277
16278 log_packet_detailed("packet_city_nationalities_100: sending info about (%d)",
16279 real_packet->id);
16280
16281#ifdef FREECIV_DELTA_PROTOCOL
16282 if (NULL == *hash) {
16283 *hash = genhash_new_full(hash_packet_city_nationalities_100, cmp_packet_city_nationalities_100,
16284 NULL, NULL, NULL, free);
16285 }
16286 BV_CLR_ALL(fields);
16287
16288 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
16289 old = fc_malloc(sizeof(*old));
16290 *old = *real_packet;
16291 genhash_insert(*hash, old, old);
16292 memset(old, 0, sizeof(*old));
16293 different = 1; /* Force to send. */
16294 }
16295 differ = (old->nationalities_count != real_packet->nationalities_count);
16296 if (differ) {
16297 different++;
16298 BV_SET(fields, 0);
16299 }
16300
16301 differ = (old->nationalities_count != real_packet->nationalities_count);
16302 if (!differ) {
16303 int i;
16304
16305 for (i = 0; i < real_packet->nationalities_count; i++) {
16306 differ = (old->nation_id[i] != real_packet->nation_id[i]);
16307 if (differ) {
16308 break;
16309 }
16310 }
16311 }
16312 if (differ) {
16313 different++;
16314 BV_SET(fields, 1);
16315 }
16316
16317 differ = (old->nationalities_count != real_packet->nationalities_count);
16318 if (!differ) {
16319 int i;
16320
16321 for (i = 0; i < real_packet->nationalities_count; i++) {
16322 differ = (old->nation_citizens[i] != real_packet->nation_citizens[i]);
16323 if (differ) {
16324 break;
16325 }
16326 }
16327 }
16328 if (differ) {
16329 different++;
16330 BV_SET(fields, 2);
16331 }
16332
16333 if (different == 0) {
16334 log_packet_detailed(" no change -> discard");
16335 return 0;
16336 }
16337
16338#ifdef FREECIV_JSON_CONNECTION
16339 field_addr.name = "fields";
16340#endif /* FREECIV_JSON_CONNECTION */
16341 e = 0;
16342 e |= DIO_BV_PUT(&dout, &field_addr, fields);
16343 if (e) {
16344 log_packet_detailed("fields bitvector error detected");
16345 }
16346#ifdef FREECIV_JSON_CONNECTION
16347 field_addr.name = "id";
16348#endif /* FREECIV_JSON_CONNECTION */
16349 e = 0;
16350 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
16351 if (e) {
16352 log_packet_detailed("'id' field error detected");
16353 }
16354
16355 if (BV_ISSET(fields, 0)) {
16356 log_packet_detailed(" field 'nationalities_count' has changed");
16357#ifdef FREECIV_JSON_CONNECTION
16358 field_addr.name = "nationalities_count";
16359#endif /* FREECIV_JSON_CONNECTION */
16360 e = 0;
16361 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
16362 if (e) {
16363 log_packet_detailed("'nationalities_count' field error detected");
16364 }
16365 }
16366 if (BV_ISSET(fields, 1)) {
16367 log_packet_detailed(" field 'nation_id' has changed");
16368#ifdef FREECIV_JSON_CONNECTION
16369 field_addr.name = "nation_id";
16370#endif /* FREECIV_JSON_CONNECTION */
16371 e = 0;
16372 {
16373 int i;
16374
16375#ifdef FREECIV_JSON_CONNECTION
16376 /* Create the array. */
16377 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16378
16379 /* Enter the array. */
16380 field_addr.sub_location = plocation_elem_new(0);
16381#endif /* FREECIV_JSON_CONNECTION */
16382
16383 for (i = 0; i < real_packet->nationalities_count; i++) {
16384#ifdef FREECIV_JSON_CONNECTION
16385 /* Next array element. */
16386 field_addr.sub_location->number = i;
16387#endif /* FREECIV_JSON_CONNECTION */
16388 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_id[i]);
16389 }
16390
16391#ifdef FREECIV_JSON_CONNECTION
16392 /* Exit array. */
16393 FC_FREE(field_addr.sub_location);
16394#endif /* FREECIV_JSON_CONNECTION */
16395 }
16396 if (e) {
16397 log_packet_detailed("'nation_id' field error detected");
16398 }
16399 }
16400 if (BV_ISSET(fields, 2)) {
16401 log_packet_detailed(" field 'nation_citizens' has changed");
16402#ifdef FREECIV_JSON_CONNECTION
16403 field_addr.name = "nation_citizens";
16404#endif /* FREECIV_JSON_CONNECTION */
16405 e = 0;
16406 {
16407 int i;
16408
16409#ifdef FREECIV_JSON_CONNECTION
16410 /* Create the array. */
16411 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16412
16413 /* Enter the array. */
16414 field_addr.sub_location = plocation_elem_new(0);
16415#endif /* FREECIV_JSON_CONNECTION */
16416
16417 for (i = 0; i < real_packet->nationalities_count; i++) {
16418#ifdef FREECIV_JSON_CONNECTION
16419 /* Next array element. */
16420 field_addr.sub_location->number = i;
16421#endif /* FREECIV_JSON_CONNECTION */
16422 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
16423 }
16424
16425#ifdef FREECIV_JSON_CONNECTION
16426 /* Exit array. */
16427 FC_FREE(field_addr.sub_location);
16428#endif /* FREECIV_JSON_CONNECTION */
16429 }
16430 if (e) {
16431 log_packet_detailed("'nation_citizens' field error detected");
16432 }
16433 }
16434
16435 *old = *real_packet;
16436#endif /* FREECIV_DELTA_PROTOCOL */
16437#ifndef FREECIV_DELTA_PROTOCOL
16438#ifdef FREECIV_JSON_CONNECTION
16439 field_addr.name = "id";
16440#endif /* FREECIV_JSON_CONNECTION */
16441 e = 0;
16442 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
16443 if (e) {
16444 log_packet_detailed("'id' field error detected");
16445 }
16446#ifdef FREECIV_JSON_CONNECTION
16447 field_addr.name = "nationalities_count";
16448#endif /* FREECIV_JSON_CONNECTION */
16449 e = 0;
16450 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nationalities_count);
16451 if (e) {
16452 log_packet_detailed("'nationalities_count' field error detected");
16453 }
16454#ifdef FREECIV_JSON_CONNECTION
16455 field_addr.name = "nation_id";
16456#endif /* FREECIV_JSON_CONNECTION */
16457 e = 0;
16458 {
16459 int i;
16460
16461#ifdef FREECIV_JSON_CONNECTION
16462 /* Create the array. */
16463 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16464
16465 /* Enter the array. */
16466 field_addr.sub_location = plocation_elem_new(0);
16467#endif /* FREECIV_JSON_CONNECTION */
16468
16469 for (i = 0; i < real_packet->nationalities_count; i++) {
16470#ifdef FREECIV_JSON_CONNECTION
16471 /* Next array element. */
16472 field_addr.sub_location->number = i;
16473#endif /* FREECIV_JSON_CONNECTION */
16474 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_id[i]);
16475 }
16476
16477#ifdef FREECIV_JSON_CONNECTION
16478 /* Exit array. */
16479 FC_FREE(field_addr.sub_location);
16480#endif /* FREECIV_JSON_CONNECTION */
16481 }
16482 if (e) {
16483 log_packet_detailed("'nation_id' field error detected");
16484 }
16485#ifdef FREECIV_JSON_CONNECTION
16486 field_addr.name = "nation_citizens";
16487#endif /* FREECIV_JSON_CONNECTION */
16488 e = 0;
16489 {
16490 int i;
16491
16492#ifdef FREECIV_JSON_CONNECTION
16493 /* Create the array. */
16494 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nationalities_count);
16495
16496 /* Enter the array. */
16497 field_addr.sub_location = plocation_elem_new(0);
16498#endif /* FREECIV_JSON_CONNECTION */
16499
16500 for (i = 0; i < real_packet->nationalities_count; i++) {
16501#ifdef FREECIV_JSON_CONNECTION
16502 /* Next array element. */
16503 field_addr.sub_location->number = i;
16504#endif /* FREECIV_JSON_CONNECTION */
16505 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nation_citizens[i]);
16506 }
16507
16508#ifdef FREECIV_JSON_CONNECTION
16509 /* Exit array. */
16510 FC_FREE(field_addr.sub_location);
16511#endif /* FREECIV_JSON_CONNECTION */
16512 }
16513 if (e) {
16514 log_packet_detailed("'nation_citizens' field error detected");
16515 }
16516
16517#endif
16518 SEND_PACKET_END(PACKET_CITY_NATIONALITIES);
16519}
16520
16521 int send_packet_city_nationalities(struct connection *pc, const struct packet_city_nationalities *packet, bool force_to_send)
16522{
16523 if (!pc->used) {
16524 log_error("WARNING: trying to send data to the closed connection %s",
16525 conn_description(pc));
16526 return -1;
16527 }
16528 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NATIONALITIES].force_to_send != NULL, -1,
16529 "Handler for PACKET_CITY_NATIONALITIES not installed");
16530 return pc->phs.handlers->send[PACKET_CITY_NATIONALITIES].force_to_send(pc, packet, force_to_send);
16531}
16532
16533 void lsend_packet_city_nationalities(struct conn_list *dest, const struct packet_city_nationalities *packet, bool force_to_send)
16534{
16535 conn_list_iterate(dest, pconn) {
16536 send_packet_city_nationalities(pconn, packet, force_to_send);
16537 } conn_list_iterate_end;
16538}
16539
16540#ifdef FREECIV_DELTA_PROTOCOL
16541static genhash_val_t hash_packet_city_update_counters_100(const void *vkey)
16542{
16543 const struct packet_city_update_counters *key = (const struct packet_city_update_counters *) vkey;
16544 genhash_val_t result = 0;
16545
16546 result += key->city;
16547
16548 result &= 0xFFFFFFFF;
16549 return result;
16550}
16551
16552static bool cmp_packet_city_update_counters_100(const void *vkey1, const void *vkey2)
16553{
16554 const struct packet_city_update_counters *old = (const struct packet_city_update_counters *) vkey1;
16555 const struct packet_city_update_counters *real_packet = (const struct packet_city_update_counters *) vkey2;
16556 bool differ;
16557
16558 differ = (old->city != real_packet->city);
16559
16560 return !differ;
16561}
16562 BV_DEFINE(packet_city_update_counters_100_fields, 2);
16563#endif /* FREECIV_DELTA_PROTOCOL */
16564
16565 static struct packet_city_update_counters *receive_packet_city_update_counters_100(struct connection *pc)
16566{
16567#ifdef FREECIV_DELTA_PROTOCOL
16568 packet_city_update_counters_100_fields fields;
16569 struct packet_city_update_counters *old;
16570 struct genhash **hash = pc->phs.received + PACKET_CITY_UPDATE_COUNTERS;
16571#endif /* FREECIV_DELTA_PROTOCOL */
16572 RECEIVE_PACKET_START(packet_city_update_counters, real_packet);
16573#ifdef FREECIV_JSON_CONNECTION
16574 struct plocation field_addr;
16575 {
16576 struct plocation *field_addr_tmp = plocation_field_new(NULL);
16577 field_addr = *field_addr_tmp;
16578 FC_FREE(field_addr_tmp);
16579 }
16580#endif /* FREECIV_JSON_CONNECTION */
16581
16582#ifdef FREECIV_DELTA_PROTOCOL
16583#ifdef FREECIV_JSON_CONNECTION
16584 field_addr.name = "fields";
16585#endif /* FREECIV_JSON_CONNECTION */
16586 DIO_BV_GET(&din, &field_addr, fields);
16587#ifdef FREECIV_JSON_CONNECTION
16588 field_addr.name = "city";
16589#endif /* FREECIV_JSON_CONNECTION */
16590 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
16591 RECEIVE_PACKET_FIELD_ERROR(city);
16592 }
16593
16594#else /* FREECIV_DELTA_PROTOCOL */
16595#ifdef FREECIV_JSON_CONNECTION
16596 field_addr.name = "city";
16597#endif /* FREECIV_JSON_CONNECTION */
16598 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
16599 RECEIVE_PACKET_FIELD_ERROR(city);
16600 }
16601#ifdef FREECIV_JSON_CONNECTION
16602 field_addr.name = "count";
16603#endif /* FREECIV_JSON_CONNECTION */
16604 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
16605 RECEIVE_PACKET_FIELD_ERROR(count);
16606 }
16607#ifdef FREECIV_JSON_CONNECTION
16608 field_addr.name = "counters";
16609#endif /* FREECIV_JSON_CONNECTION */
16610 {
16611 int i;
16612
16613#ifdef FREECIV_JSON_CONNECTION
16614 /* Enter array. */
16615 field_addr.sub_location = plocation_elem_new(0);
16616#endif /* FREECIV_JSON_CONNECTION */
16617
16618 if (real_packet->count > MAX_COUNTERS) {
16619 RECEIVE_PACKET_FIELD_ERROR(counters, ": truncation array");
16620 }
16621 for (i = 0; i < real_packet->count; i++) {
16622#ifdef FREECIV_JSON_CONNECTION
16623 field_addr.sub_location->number = i;
16624#endif /* FREECIV_JSON_CONNECTION */
16625 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->counters[i])) {
16626 RECEIVE_PACKET_FIELD_ERROR(counters);
16627 }
16628 }
16629
16630#ifdef FREECIV_JSON_CONNECTION
16631 /* Exit array. */
16632 FC_FREE(field_addr.sub_location);
16633#endif /* FREECIV_JSON_CONNECTION */
16634 }
16635#endif
16636 log_packet_detailed("packet_city_update_counters_100: got info about (%d)",
16637 real_packet->city);
16638
16639#ifdef FREECIV_DELTA_PROTOCOL
16640 if (NULL == *hash) {
16641 *hash = genhash_new_full(hash_packet_city_update_counters_100, cmp_packet_city_update_counters_100,
16642 NULL, NULL, NULL, free);
16643 }
16644
16645 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
16646 *real_packet = *old;
16647 } else {
16648 int city;
16649
16650 city = real_packet->city;
16651
16652 log_packet_detailed(" no old info");
16653 memset(real_packet, 0, sizeof(*real_packet));
16654
16655 real_packet->city = city;
16656 }
16657
16658 if (BV_ISSET(fields, 0)) {
16659 log_packet_detailed(" got field 'count'");
16660#ifdef FREECIV_JSON_CONNECTION
16661 field_addr.name = "count";
16662#endif /* FREECIV_JSON_CONNECTION */
16663 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
16664 RECEIVE_PACKET_FIELD_ERROR(count);
16665 }
16666 }
16667 if (BV_ISSET(fields, 1)) {
16668 log_packet_detailed(" got field 'counters'");
16669#ifdef FREECIV_JSON_CONNECTION
16670 field_addr.name = "counters";
16671#endif /* FREECIV_JSON_CONNECTION */
16672 {
16673 int i;
16674
16675#ifdef FREECIV_JSON_CONNECTION
16676 /* Enter array. */
16677 field_addr.sub_location = plocation_elem_new(0);
16678#endif /* FREECIV_JSON_CONNECTION */
16679
16680 if (real_packet->count > MAX_COUNTERS) {
16681 RECEIVE_PACKET_FIELD_ERROR(counters, ": truncation array");
16682 }
16683 for (i = 0; i < real_packet->count; i++) {
16684#ifdef FREECIV_JSON_CONNECTION
16685 field_addr.sub_location->number = i;
16686#endif /* FREECIV_JSON_CONNECTION */
16687 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->counters[i])) {
16688 RECEIVE_PACKET_FIELD_ERROR(counters);
16689 }
16690 }
16691
16692#ifdef FREECIV_JSON_CONNECTION
16693 /* Exit array. */
16694 FC_FREE(field_addr.sub_location);
16695#endif /* FREECIV_JSON_CONNECTION */
16696 }
16697 }
16698
16699 if (NULL == old) {
16700 old = fc_malloc(sizeof(*old));
16701 *old = *real_packet;
16702 genhash_insert(*hash, old, old);
16703 } else {
16704 *old = *real_packet;
16705 }
16706
16707#endif /* FREECIV_DELTA_PROTOCOL */
16708 RECEIVE_PACKET_END(real_packet);
16709}
16710
16711 static int send_packet_city_update_counters_100(struct connection *pc, const struct packet_city_update_counters *packet)
16712{
16713 const struct packet_city_update_counters *real_packet = packet;
16714 int e;
16715#ifdef FREECIV_DELTA_PROTOCOL
16716 packet_city_update_counters_100_fields fields;
16717 struct packet_city_update_counters *old;
16718 bool differ;
16719 struct genhash **hash = pc->phs.sent + PACKET_CITY_UPDATE_COUNTERS;
16720 int different = 0;
16721#endif /* FREECIV_DELTA_PROTOCOL */
16722 SEND_PACKET_START(PACKET_CITY_UPDATE_COUNTERS);
16723#ifdef FREECIV_JSON_CONNECTION
16724 struct plocation field_addr;
16725 {
16726 struct plocation *field_addr_tmp = plocation_field_new(NULL);
16727 field_addr = *field_addr_tmp;
16728 FC_FREE(field_addr_tmp);
16729 }
16730#endif /* FREECIV_JSON_CONNECTION */
16731
16732 log_packet_detailed("packet_city_update_counters_100: sending info about (%d)",
16733 real_packet->city);
16734
16735#ifdef FREECIV_DELTA_PROTOCOL
16736 if (NULL == *hash) {
16737 *hash = genhash_new_full(hash_packet_city_update_counters_100, cmp_packet_city_update_counters_100,
16738 NULL, NULL, NULL, free);
16739 }
16740 BV_CLR_ALL(fields);
16741
16742 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
16743 old = fc_malloc(sizeof(*old));
16744 *old = *real_packet;
16745 genhash_insert(*hash, old, old);
16746 memset(old, 0, sizeof(*old));
16747 different = 1; /* Force to send. */
16748 }
16749 differ = (old->count != real_packet->count);
16750 if (differ) {
16751 different++;
16752 BV_SET(fields, 0);
16753 }
16754
16755 differ = (old->count != real_packet->count);
16756 if (!differ) {
16757 int i;
16758
16759 for (i = 0; i < real_packet->count; i++) {
16760 differ = (old->counters[i] != real_packet->counters[i]);
16761 if (differ) {
16762 break;
16763 }
16764 }
16765 }
16766 if (differ) {
16767 different++;
16768 BV_SET(fields, 1);
16769 }
16770
16771 if (different == 0) {
16772 log_packet_detailed(" no change -> discard");
16773 return 0;
16774 }
16775
16776#ifdef FREECIV_JSON_CONNECTION
16777 field_addr.name = "fields";
16778#endif /* FREECIV_JSON_CONNECTION */
16779 e = 0;
16780 e |= DIO_BV_PUT(&dout, &field_addr, fields);
16781 if (e) {
16782 log_packet_detailed("fields bitvector error detected");
16783 }
16784#ifdef FREECIV_JSON_CONNECTION
16785 field_addr.name = "city";
16786#endif /* FREECIV_JSON_CONNECTION */
16787 e = 0;
16788 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
16789 if (e) {
16790 log_packet_detailed("'city' field error detected");
16791 }
16792
16793 if (BV_ISSET(fields, 0)) {
16794 log_packet_detailed(" field 'count' has changed");
16795#ifdef FREECIV_JSON_CONNECTION
16796 field_addr.name = "count";
16797#endif /* FREECIV_JSON_CONNECTION */
16798 e = 0;
16799 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
16800 if (e) {
16801 log_packet_detailed("'count' field error detected");
16802 }
16803 }
16804 if (BV_ISSET(fields, 1)) {
16805 log_packet_detailed(" field 'counters' has changed");
16806#ifdef FREECIV_JSON_CONNECTION
16807 field_addr.name = "counters";
16808#endif /* FREECIV_JSON_CONNECTION */
16809 e = 0;
16810 {
16811 int i;
16812
16813#ifdef FREECIV_JSON_CONNECTION
16814 /* Create the array. */
16815 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
16816
16817 /* Enter the array. */
16818 field_addr.sub_location = plocation_elem_new(0);
16819#endif /* FREECIV_JSON_CONNECTION */
16820
16821 for (i = 0; i < real_packet->count; i++) {
16822#ifdef FREECIV_JSON_CONNECTION
16823 /* Next array element. */
16824 field_addr.sub_location->number = i;
16825#endif /* FREECIV_JSON_CONNECTION */
16826 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->counters[i]);
16827 }
16828
16829#ifdef FREECIV_JSON_CONNECTION
16830 /* Exit array. */
16831 FC_FREE(field_addr.sub_location);
16832#endif /* FREECIV_JSON_CONNECTION */
16833 }
16834 if (e) {
16835 log_packet_detailed("'counters' field error detected");
16836 }
16837 }
16838
16839 *old = *real_packet;
16840#endif /* FREECIV_DELTA_PROTOCOL */
16841#ifndef FREECIV_DELTA_PROTOCOL
16842#ifdef FREECIV_JSON_CONNECTION
16843 field_addr.name = "city";
16844#endif /* FREECIV_JSON_CONNECTION */
16845 e = 0;
16846 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
16847 if (e) {
16848 log_packet_detailed("'city' field error detected");
16849 }
16850#ifdef FREECIV_JSON_CONNECTION
16851 field_addr.name = "count";
16852#endif /* FREECIV_JSON_CONNECTION */
16853 e = 0;
16854 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
16855 if (e) {
16856 log_packet_detailed("'count' field error detected");
16857 }
16858#ifdef FREECIV_JSON_CONNECTION
16859 field_addr.name = "counters";
16860#endif /* FREECIV_JSON_CONNECTION */
16861 e = 0;
16862 {
16863 int i;
16864
16865#ifdef FREECIV_JSON_CONNECTION
16866 /* Create the array. */
16867 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
16868
16869 /* Enter the array. */
16870 field_addr.sub_location = plocation_elem_new(0);
16871#endif /* FREECIV_JSON_CONNECTION */
16872
16873 for (i = 0; i < real_packet->count; i++) {
16874#ifdef FREECIV_JSON_CONNECTION
16875 /* Next array element. */
16876 field_addr.sub_location->number = i;
16877#endif /* FREECIV_JSON_CONNECTION */
16878 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->counters[i]);
16879 }
16880
16881#ifdef FREECIV_JSON_CONNECTION
16882 /* Exit array. */
16883 FC_FREE(field_addr.sub_location);
16884#endif /* FREECIV_JSON_CONNECTION */
16885 }
16886 if (e) {
16887 log_packet_detailed("'counters' field error detected");
16888 }
16889
16890#endif
16891 SEND_PACKET_END(PACKET_CITY_UPDATE_COUNTERS);
16892}
16893
16894 int send_packet_city_update_counters(struct connection *pc, const struct packet_city_update_counters *packet)
16895{
16896 if (!pc->used) {
16897 log_error("WARNING: trying to send data to the closed connection %s",
16898 conn_description(pc));
16899 return -1;
16900 }
16901 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_UPDATE_COUNTERS].packet != NULL, -1,
16902 "Handler for PACKET_CITY_UPDATE_COUNTERS not installed");
16903 return pc->phs.handlers->send[PACKET_CITY_UPDATE_COUNTERS].packet(pc, packet);
16904}
16905
16906 void lsend_packet_city_update_counters(struct conn_list *dest, const struct packet_city_update_counters *packet)
16907{
16908 conn_list_iterate(dest, pconn) {
16909 send_packet_city_update_counters(pconn, packet);
16910 } conn_list_iterate_end;
16911}
16912
16913#ifdef FREECIV_DELTA_PROTOCOL
16914static genhash_val_t hash_packet_city_short_info_100(const void *vkey)
16915{
16916 const struct packet_city_short_info *key = (const struct packet_city_short_info *) vkey;
16917 genhash_val_t result = 0;
16918
16919 result += key->id;
16920
16921 result &= 0xFFFFFFFF;
16922 return result;
16923}
16924
16925static bool cmp_packet_city_short_info_100(const void *vkey1, const void *vkey2)
16926{
16927 const struct packet_city_short_info *old = (const struct packet_city_short_info *) vkey1;
16928 const struct packet_city_short_info *real_packet = (const struct packet_city_short_info *) vkey2;
16929 bool differ;
16930
16931 differ = (old->id != real_packet->id);
16932
16933 return !differ;
16934}
16935 BV_DEFINE(packet_city_short_info_100_fields, 12);
16936#endif /* FREECIV_DELTA_PROTOCOL */
16937
16938 static struct packet_city_short_info *receive_packet_city_short_info_100(struct connection *pc)
16939{
16940#ifdef FREECIV_DELTA_PROTOCOL
16941 packet_city_short_info_100_fields fields;
16942 struct packet_city_short_info *old;
16943 struct genhash **hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
16944#endif /* FREECIV_DELTA_PROTOCOL */
16945 RECEIVE_PACKET_START(packet_city_short_info, real_packet);
16946#ifdef FREECIV_JSON_CONNECTION
16947 struct plocation field_addr;
16948 {
16949 struct plocation *field_addr_tmp = plocation_field_new(NULL);
16950 field_addr = *field_addr_tmp;
16951 FC_FREE(field_addr_tmp);
16952 }
16953#endif /* FREECIV_JSON_CONNECTION */
16954
16955#ifdef FREECIV_DELTA_PROTOCOL
16956#ifdef FREECIV_JSON_CONNECTION
16957 field_addr.name = "fields";
16958#endif /* FREECIV_JSON_CONNECTION */
16959 DIO_BV_GET(&din, &field_addr, fields);
16960#ifdef FREECIV_JSON_CONNECTION
16961 field_addr.name = "id";
16962#endif /* FREECIV_JSON_CONNECTION */
16963 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
16964 RECEIVE_PACKET_FIELD_ERROR(id);
16965 }
16966
16967#else /* FREECIV_DELTA_PROTOCOL */
16968#ifdef FREECIV_JSON_CONNECTION
16969 field_addr.name = "id";
16970#endif /* FREECIV_JSON_CONNECTION */
16971 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
16972 RECEIVE_PACKET_FIELD_ERROR(id);
16973 }
16974#ifdef FREECIV_JSON_CONNECTION
16975 field_addr.name = "tile";
16976#endif /* FREECIV_JSON_CONNECTION */
16977 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
16978 RECEIVE_PACKET_FIELD_ERROR(tile);
16979 }
16980#ifdef FREECIV_JSON_CONNECTION
16981 field_addr.name = "owner";
16982#endif /* FREECIV_JSON_CONNECTION */
16983 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
16984 RECEIVE_PACKET_FIELD_ERROR(owner);
16985 }
16986#ifdef FREECIV_JSON_CONNECTION
16987 field_addr.name = "size";
16988#endif /* FREECIV_JSON_CONNECTION */
16989 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
16990 RECEIVE_PACKET_FIELD_ERROR(size);
16991 }
16992#ifdef FREECIV_JSON_CONNECTION
16993 field_addr.name = "style";
16994#endif /* FREECIV_JSON_CONNECTION */
16995 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
16996 RECEIVE_PACKET_FIELD_ERROR(style);
16997 }
16998#ifdef FREECIV_JSON_CONNECTION
16999 field_addr.name = "capital";
17000#endif /* FREECIV_JSON_CONNECTION */
17001 {
17002 int readin;
17003
17004 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17005 RECEIVE_PACKET_FIELD_ERROR(capital);
17006 }
17007 real_packet->capital = readin;
17008 }
17009#ifdef FREECIV_JSON_CONNECTION
17010 field_addr.name = "occupied";
17011#endif /* FREECIV_JSON_CONNECTION */
17012 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
17013 RECEIVE_PACKET_FIELD_ERROR(occupied);
17014 }
17015#ifdef FREECIV_JSON_CONNECTION
17016 field_addr.name = "walls";
17017#endif /* FREECIV_JSON_CONNECTION */
17018 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
17019 RECEIVE_PACKET_FIELD_ERROR(walls);
17020 }
17021#ifdef FREECIV_JSON_CONNECTION
17022 field_addr.name = "happy";
17023#endif /* FREECIV_JSON_CONNECTION */
17024 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->happy)) {
17025 RECEIVE_PACKET_FIELD_ERROR(happy);
17026 }
17027#ifdef FREECIV_JSON_CONNECTION
17028 field_addr.name = "unhappy";
17029#endif /* FREECIV_JSON_CONNECTION */
17030 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unhappy)) {
17031 RECEIVE_PACKET_FIELD_ERROR(unhappy);
17032 }
17033#ifdef FREECIV_JSON_CONNECTION
17034 field_addr.name = "city_image";
17035#endif /* FREECIV_JSON_CONNECTION */
17036 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
17037 RECEIVE_PACKET_FIELD_ERROR(city_image);
17038 }
17039#ifdef FREECIV_JSON_CONNECTION
17040 field_addr.name = "improvements";
17041#endif /* FREECIV_JSON_CONNECTION */
17042 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
17043 RECEIVE_PACKET_FIELD_ERROR(improvements);
17044 }
17045#ifdef FREECIV_JSON_CONNECTION
17046 field_addr.name = "name";
17047#endif /* FREECIV_JSON_CONNECTION */
17048 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
17049 RECEIVE_PACKET_FIELD_ERROR(name);
17050 }
17051#endif
17052 log_packet_detailed("packet_city_short_info_100: got info about (%d)",
17053 real_packet->id);
17054
17055#ifdef FREECIV_DELTA_PROTOCOL
17056 if (NULL == *hash) {
17057 *hash = genhash_new_full(hash_packet_city_short_info_100, cmp_packet_city_short_info_100,
17058 NULL, NULL, NULL, free);
17059 }
17060
17061 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
17062 *real_packet = *old;
17063 } else {
17064 int id;
17065
17066 id = real_packet->id;
17067
17068 log_packet_detailed(" no old info");
17069 memset(real_packet, 0, sizeof(*real_packet));
17070
17071 real_packet->id = id;
17072 }
17073
17074 if (BV_ISSET(fields, 0)) {
17075 log_packet_detailed(" got field 'tile'");
17076#ifdef FREECIV_JSON_CONNECTION
17077 field_addr.name = "tile";
17078#endif /* FREECIV_JSON_CONNECTION */
17079 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
17080 RECEIVE_PACKET_FIELD_ERROR(tile);
17081 }
17082 }
17083 if (BV_ISSET(fields, 1)) {
17084 log_packet_detailed(" got field 'owner'");
17085#ifdef FREECIV_JSON_CONNECTION
17086 field_addr.name = "owner";
17087#endif /* FREECIV_JSON_CONNECTION */
17088 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
17089 RECEIVE_PACKET_FIELD_ERROR(owner);
17090 }
17091 }
17092 if (BV_ISSET(fields, 2)) {
17093 log_packet_detailed(" got field 'size'");
17094#ifdef FREECIV_JSON_CONNECTION
17095 field_addr.name = "size";
17096#endif /* FREECIV_JSON_CONNECTION */
17097 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
17098 RECEIVE_PACKET_FIELD_ERROR(size);
17099 }
17100 }
17101 if (BV_ISSET(fields, 3)) {
17102 log_packet_detailed(" got field 'style'");
17103#ifdef FREECIV_JSON_CONNECTION
17104 field_addr.name = "style";
17105#endif /* FREECIV_JSON_CONNECTION */
17106 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
17107 RECEIVE_PACKET_FIELD_ERROR(style);
17108 }
17109 }
17110 if (BV_ISSET(fields, 4)) {
17111 log_packet_detailed(" got field 'capital'");
17112#ifdef FREECIV_JSON_CONNECTION
17113 field_addr.name = "capital";
17114#endif /* FREECIV_JSON_CONNECTION */
17115 {
17116 int readin;
17117
17118 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17119 RECEIVE_PACKET_FIELD_ERROR(capital);
17120 }
17121 real_packet->capital = readin;
17122 }
17123 }
17124 real_packet->occupied = BV_ISSET(fields, 5);
17125 if (BV_ISSET(fields, 6)) {
17126 log_packet_detailed(" got field 'walls'");
17127#ifdef FREECIV_JSON_CONNECTION
17128 field_addr.name = "walls";
17129#endif /* FREECIV_JSON_CONNECTION */
17130 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->walls)) {
17131 RECEIVE_PACKET_FIELD_ERROR(walls);
17132 }
17133 }
17134 real_packet->happy = BV_ISSET(fields, 7);
17135 real_packet->unhappy = BV_ISSET(fields, 8);
17136 if (BV_ISSET(fields, 9)) {
17137 log_packet_detailed(" got field 'city_image'");
17138#ifdef FREECIV_JSON_CONNECTION
17139 field_addr.name = "city_image";
17140#endif /* FREECIV_JSON_CONNECTION */
17141 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->city_image)) {
17142 RECEIVE_PACKET_FIELD_ERROR(city_image);
17143 }
17144 }
17145 if (BV_ISSET(fields, 10)) {
17146 log_packet_detailed(" got field 'improvements'");
17147#ifdef FREECIV_JSON_CONNECTION
17148 field_addr.name = "improvements";
17149#endif /* FREECIV_JSON_CONNECTION */
17150 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
17151 RECEIVE_PACKET_FIELD_ERROR(improvements);
17152 }
17153 }
17154 if (BV_ISSET(fields, 11)) {
17155 log_packet_detailed(" got field 'name'");
17156#ifdef FREECIV_JSON_CONNECTION
17157 field_addr.name = "name";
17158#endif /* FREECIV_JSON_CONNECTION */
17159 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
17160 RECEIVE_PACKET_FIELD_ERROR(name);
17161 }
17162 }
17163
17164 if (NULL == old) {
17165 old = fc_malloc(sizeof(*old));
17166 *old = *real_packet;
17167 genhash_insert(*hash, old, old);
17168 } else {
17169 *old = *real_packet;
17170 }
17171
17172 hash = pc->phs.received + PACKET_CITY_INFO;
17173 if (NULL != *hash) {
17174 genhash_remove(*hash, real_packet);
17175 }
17176
17177 hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
17178 if (NULL != *hash) {
17179 genhash_remove(*hash, real_packet);
17180 }
17181
17182 hash = pc->phs.received + PACKET_CITY_NATIONALITIES;
17183 if (NULL != *hash) {
17184 genhash_remove(*hash, real_packet);
17185 }
17186
17187 hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
17188 if (NULL != *hash) {
17189 genhash_remove(*hash, real_packet);
17190 }
17191
17192#endif /* FREECIV_DELTA_PROTOCOL */
17193 RECEIVE_PACKET_END(real_packet);
17194}
17195
17196 static int send_packet_city_short_info_100(struct connection *pc, const struct packet_city_short_info *packet)
17197{
17198 const struct packet_city_short_info *real_packet = packet;
17199 int e;
17200#ifdef FREECIV_DELTA_PROTOCOL
17201 packet_city_short_info_100_fields fields;
17202 struct packet_city_short_info *old;
17203 bool differ;
17204 struct genhash **hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
17205 int different = 0;
17206#endif /* FREECIV_DELTA_PROTOCOL */
17207 SEND_PACKET_START(PACKET_CITY_SHORT_INFO);
17208#ifdef FREECIV_JSON_CONNECTION
17209 struct plocation field_addr;
17210 {
17211 struct plocation *field_addr_tmp = plocation_field_new(NULL);
17212 field_addr = *field_addr_tmp;
17213 FC_FREE(field_addr_tmp);
17214 }
17215#endif /* FREECIV_JSON_CONNECTION */
17216
17217 log_packet_detailed("packet_city_short_info_100: sending info about (%d)",
17218 real_packet->id);
17219
17220#ifdef FREECIV_DELTA_PROTOCOL
17221 if (NULL == *hash) {
17222 *hash = genhash_new_full(hash_packet_city_short_info_100, cmp_packet_city_short_info_100,
17223 NULL, NULL, NULL, free);
17224 }
17225 BV_CLR_ALL(fields);
17226
17227 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
17228 old = fc_malloc(sizeof(*old));
17229 *old = *real_packet;
17230 genhash_insert(*hash, old, old);
17231 memset(old, 0, sizeof(*old));
17232 different = 1; /* Force to send. */
17233 }
17234 differ = (old->tile != real_packet->tile);
17235 if (differ) {
17236 different++;
17237 BV_SET(fields, 0);
17238 }
17239
17240 differ = (old->owner != real_packet->owner);
17241 if (differ) {
17242 different++;
17243 BV_SET(fields, 1);
17244 }
17245
17246 differ = (old->size != real_packet->size);
17247 if (differ) {
17248 different++;
17249 BV_SET(fields, 2);
17250 }
17251
17252 differ = (old->style != real_packet->style);
17253 if (differ) {
17254 different++;
17255 BV_SET(fields, 3);
17256 }
17257
17258 differ = (old->capital != real_packet->capital);
17259 if (differ) {
17260 different++;
17261 BV_SET(fields, 4);
17262 }
17263
17264 differ = (old->occupied != real_packet->occupied);
17265 if (differ) {
17266 different++;
17267 }
17268 if (packet->occupied) {
17269 BV_SET(fields, 5);
17270 }
17271
17272 differ = (old->walls != real_packet->walls);
17273 if (differ) {
17274 different++;
17275 BV_SET(fields, 6);
17276 }
17277
17278 differ = (old->happy != real_packet->happy);
17279 if (differ) {
17280 different++;
17281 }
17282 if (packet->happy) {
17283 BV_SET(fields, 7);
17284 }
17285
17286 differ = (old->unhappy != real_packet->unhappy);
17287 if (differ) {
17288 different++;
17289 }
17290 if (packet->unhappy) {
17291 BV_SET(fields, 8);
17292 }
17293
17294 differ = (old->city_image != real_packet->city_image);
17295 if (differ) {
17296 different++;
17297 BV_SET(fields, 9);
17298 }
17299
17300 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
17301 if (differ) {
17302 different++;
17303 BV_SET(fields, 10);
17304 }
17305
17306 differ = (strcmp(old->name, real_packet->name) != 0);
17307 if (differ) {
17308 different++;
17309 BV_SET(fields, 11);
17310 }
17311
17312 if (different == 0) {
17313 log_packet_detailed(" no change -> discard");
17314 return 0;
17315 }
17316
17317#ifdef FREECIV_JSON_CONNECTION
17318 field_addr.name = "fields";
17319#endif /* FREECIV_JSON_CONNECTION */
17320 e = 0;
17321 e |= DIO_BV_PUT(&dout, &field_addr, fields);
17322 if (e) {
17323 log_packet_detailed("fields bitvector error detected");
17324 }
17325#ifdef FREECIV_JSON_CONNECTION
17326 field_addr.name = "id";
17327#endif /* FREECIV_JSON_CONNECTION */
17328 e = 0;
17329 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
17330 if (e) {
17331 log_packet_detailed("'id' field error detected");
17332 }
17333
17334 if (BV_ISSET(fields, 0)) {
17335 log_packet_detailed(" field 'tile' has changed");
17336#ifdef FREECIV_JSON_CONNECTION
17337 field_addr.name = "tile";
17338#endif /* FREECIV_JSON_CONNECTION */
17339 e = 0;
17340 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
17341 if (e) {
17342 log_packet_detailed("'tile' field error detected");
17343 }
17344 }
17345 if (BV_ISSET(fields, 1)) {
17346 log_packet_detailed(" field 'owner' has changed");
17347#ifdef FREECIV_JSON_CONNECTION
17348 field_addr.name = "owner";
17349#endif /* FREECIV_JSON_CONNECTION */
17350 e = 0;
17351 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
17352 if (e) {
17353 log_packet_detailed("'owner' field error detected");
17354 }
17355 }
17356 if (BV_ISSET(fields, 2)) {
17357 log_packet_detailed(" field 'size' has changed");
17358#ifdef FREECIV_JSON_CONNECTION
17359 field_addr.name = "size";
17360#endif /* FREECIV_JSON_CONNECTION */
17361 e = 0;
17362 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
17363 if (e) {
17364 log_packet_detailed("'size' field error detected");
17365 }
17366 }
17367 if (BV_ISSET(fields, 3)) {
17368 log_packet_detailed(" field 'style' has changed");
17369#ifdef FREECIV_JSON_CONNECTION
17370 field_addr.name = "style";
17371#endif /* FREECIV_JSON_CONNECTION */
17372 e = 0;
17373 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
17374 if (e) {
17375 log_packet_detailed("'style' field error detected");
17376 }
17377 }
17378 if (BV_ISSET(fields, 4)) {
17379 log_packet_detailed(" field 'capital' has changed");
17380#ifdef FREECIV_JSON_CONNECTION
17381 field_addr.name = "capital";
17382#endif /* FREECIV_JSON_CONNECTION */
17383 e = 0;
17384 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
17385 if (e) {
17386 log_packet_detailed("'capital' field error detected");
17387 }
17388 }
17389 /* field 5 is folded into the header */
17390 if (BV_ISSET(fields, 6)) {
17391 log_packet_detailed(" field 'walls' has changed");
17392#ifdef FREECIV_JSON_CONNECTION
17393 field_addr.name = "walls";
17394#endif /* FREECIV_JSON_CONNECTION */
17395 e = 0;
17396 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
17397 if (e) {
17398 log_packet_detailed("'walls' field error detected");
17399 }
17400 }
17401 /* field 7 is folded into the header */
17402 /* field 8 is folded into the header */
17403 if (BV_ISSET(fields, 9)) {
17404 log_packet_detailed(" field 'city_image' has changed");
17405#ifdef FREECIV_JSON_CONNECTION
17406 field_addr.name = "city_image";
17407#endif /* FREECIV_JSON_CONNECTION */
17408 e = 0;
17409 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
17410 if (e) {
17411 log_packet_detailed("'city_image' field error detected");
17412 }
17413 }
17414 if (BV_ISSET(fields, 10)) {
17415 log_packet_detailed(" field 'improvements' has changed");
17416#ifdef FREECIV_JSON_CONNECTION
17417 field_addr.name = "improvements";
17418#endif /* FREECIV_JSON_CONNECTION */
17419 e = 0;
17420 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
17421 if (e) {
17422 log_packet_detailed("'improvements' field error detected");
17423 }
17424 }
17425 if (BV_ISSET(fields, 11)) {
17426 log_packet_detailed(" field 'name' has changed");
17427#ifdef FREECIV_JSON_CONNECTION
17428 field_addr.name = "name";
17429#endif /* FREECIV_JSON_CONNECTION */
17430 e = 0;
17431 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
17432 if (e) {
17433 log_packet_detailed("'name' field error detected");
17434 }
17435 }
17436
17437 *old = *real_packet;
17438
17439 hash = pc->phs.sent + PACKET_CITY_INFO;
17440 if (NULL != *hash) {
17441 genhash_remove(*hash, real_packet);
17442 }
17443
17444 hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
17445 if (NULL != *hash) {
17446 genhash_remove(*hash, real_packet);
17447 }
17448
17449 hash = pc->phs.sent + PACKET_CITY_NATIONALITIES;
17450 if (NULL != *hash) {
17451 genhash_remove(*hash, real_packet);
17452 }
17453
17454 hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
17455 if (NULL != *hash) {
17456 genhash_remove(*hash, real_packet);
17457 }
17458#endif /* FREECIV_DELTA_PROTOCOL */
17459#ifndef FREECIV_DELTA_PROTOCOL
17460#ifdef FREECIV_JSON_CONNECTION
17461 field_addr.name = "id";
17462#endif /* FREECIV_JSON_CONNECTION */
17463 e = 0;
17464 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
17465 if (e) {
17466 log_packet_detailed("'id' field error detected");
17467 }
17468#ifdef FREECIV_JSON_CONNECTION
17469 field_addr.name = "tile";
17470#endif /* FREECIV_JSON_CONNECTION */
17471 e = 0;
17472 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
17473 if (e) {
17474 log_packet_detailed("'tile' field error detected");
17475 }
17476#ifdef FREECIV_JSON_CONNECTION
17477 field_addr.name = "owner";
17478#endif /* FREECIV_JSON_CONNECTION */
17479 e = 0;
17480 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
17481 if (e) {
17482 log_packet_detailed("'owner' field error detected");
17483 }
17484#ifdef FREECIV_JSON_CONNECTION
17485 field_addr.name = "size";
17486#endif /* FREECIV_JSON_CONNECTION */
17487 e = 0;
17488 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
17489 if (e) {
17490 log_packet_detailed("'size' field error detected");
17491 }
17492#ifdef FREECIV_JSON_CONNECTION
17493 field_addr.name = "style";
17494#endif /* FREECIV_JSON_CONNECTION */
17495 e = 0;
17496 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
17497 if (e) {
17498 log_packet_detailed("'style' field error detected");
17499 }
17500#ifdef FREECIV_JSON_CONNECTION
17501 field_addr.name = "capital";
17502#endif /* FREECIV_JSON_CONNECTION */
17503 e = 0;
17504 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->capital);
17505 if (e) {
17506 log_packet_detailed("'capital' field error detected");
17507 }
17508#ifdef FREECIV_JSON_CONNECTION
17509 field_addr.name = "occupied";
17510#endif /* FREECIV_JSON_CONNECTION */
17511 e = 0;
17512 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
17513 if (e) {
17514 log_packet_detailed("'occupied' field error detected");
17515 }
17516#ifdef FREECIV_JSON_CONNECTION
17517 field_addr.name = "walls";
17518#endif /* FREECIV_JSON_CONNECTION */
17519 e = 0;
17520 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->walls);
17521 if (e) {
17522 log_packet_detailed("'walls' field error detected");
17523 }
17524#ifdef FREECIV_JSON_CONNECTION
17525 field_addr.name = "happy";
17526#endif /* FREECIV_JSON_CONNECTION */
17527 e = 0;
17528 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->happy);
17529 if (e) {
17530 log_packet_detailed("'happy' field error detected");
17531 }
17532#ifdef FREECIV_JSON_CONNECTION
17533 field_addr.name = "unhappy";
17534#endif /* FREECIV_JSON_CONNECTION */
17535 e = 0;
17536 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unhappy);
17537 if (e) {
17538 log_packet_detailed("'unhappy' field error detected");
17539 }
17540#ifdef FREECIV_JSON_CONNECTION
17541 field_addr.name = "city_image";
17542#endif /* FREECIV_JSON_CONNECTION */
17543 e = 0;
17544 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->city_image);
17545 if (e) {
17546 log_packet_detailed("'city_image' field error detected");
17547 }
17548#ifdef FREECIV_JSON_CONNECTION
17549 field_addr.name = "improvements";
17550#endif /* FREECIV_JSON_CONNECTION */
17551 e = 0;
17552 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
17553 if (e) {
17554 log_packet_detailed("'improvements' field error detected");
17555 }
17556#ifdef FREECIV_JSON_CONNECTION
17557 field_addr.name = "name";
17558#endif /* FREECIV_JSON_CONNECTION */
17559 e = 0;
17560 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
17561 if (e) {
17562 log_packet_detailed("'name' field error detected");
17563 }
17564
17565#endif
17566 SEND_PACKET_END(PACKET_CITY_SHORT_INFO);
17567}
17568
17569 int send_packet_city_short_info(struct connection *pc, const struct packet_city_short_info *packet)
17570{
17571 if (!pc->used) {
17572 log_error("WARNING: trying to send data to the closed connection %s",
17573 conn_description(pc));
17574 return -1;
17575 }
17576 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SHORT_INFO].packet != NULL, -1,
17577 "Handler for PACKET_CITY_SHORT_INFO not installed");
17578 return pc->phs.handlers->send[PACKET_CITY_SHORT_INFO].packet(pc, packet);
17579}
17580
17581 void lsend_packet_city_short_info(struct conn_list *dest, const struct packet_city_short_info *packet)
17582{
17583 conn_list_iterate(dest, pconn) {
17584 send_packet_city_short_info(pconn, packet);
17585 } conn_list_iterate_end;
17586}
17587
17588#ifdef FREECIV_DELTA_PROTOCOL
17589#define hash_packet_trade_route_info_100 hash_const
17590
17591#define cmp_packet_trade_route_info_100 cmp_const
17592
17593 BV_DEFINE(packet_trade_route_info_100_fields, 6);
17594#endif /* FREECIV_DELTA_PROTOCOL */
17595
17596 static struct packet_trade_route_info *receive_packet_trade_route_info_100(struct connection *pc)
17597{
17598#ifdef FREECIV_DELTA_PROTOCOL
17599 packet_trade_route_info_100_fields fields;
17600 struct packet_trade_route_info *old;
17601 struct genhash **hash = pc->phs.received + PACKET_TRADE_ROUTE_INFO;
17602#endif /* FREECIV_DELTA_PROTOCOL */
17603 RECEIVE_PACKET_START(packet_trade_route_info, real_packet);
17604#ifdef FREECIV_JSON_CONNECTION
17605 struct plocation field_addr;
17606 {
17607 struct plocation *field_addr_tmp = plocation_field_new(NULL);
17608 field_addr = *field_addr_tmp;
17609 FC_FREE(field_addr_tmp);
17610 }
17611#endif /* FREECIV_JSON_CONNECTION */
17612
17613#ifdef FREECIV_DELTA_PROTOCOL
17614#ifdef FREECIV_JSON_CONNECTION
17615 field_addr.name = "fields";
17616#endif /* FREECIV_JSON_CONNECTION */
17617 DIO_BV_GET(&din, &field_addr, fields);
17618
17619#else /* FREECIV_DELTA_PROTOCOL */
17620#ifdef FREECIV_JSON_CONNECTION
17621 field_addr.name = "city";
17622#endif /* FREECIV_JSON_CONNECTION */
17623 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
17624 RECEIVE_PACKET_FIELD_ERROR(city);
17625 }
17626#ifdef FREECIV_JSON_CONNECTION
17627 field_addr.name = "index";
17628#endif /* FREECIV_JSON_CONNECTION */
17629 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
17630 RECEIVE_PACKET_FIELD_ERROR(index);
17631 }
17632#ifdef FREECIV_JSON_CONNECTION
17633 field_addr.name = "partner";
17634#endif /* FREECIV_JSON_CONNECTION */
17635 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->partner)) {
17636 RECEIVE_PACKET_FIELD_ERROR(partner);
17637 }
17638#ifdef FREECIV_JSON_CONNECTION
17639 field_addr.name = "value";
17640#endif /* FREECIV_JSON_CONNECTION */
17641 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
17642 RECEIVE_PACKET_FIELD_ERROR(value);
17643 }
17644#ifdef FREECIV_JSON_CONNECTION
17645 field_addr.name = "direction";
17646#endif /* FREECIV_JSON_CONNECTION */
17647 {
17648 int readin;
17649
17650 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17651 RECEIVE_PACKET_FIELD_ERROR(direction);
17652 }
17653 real_packet->direction = readin;
17654 }
17655#ifdef FREECIV_JSON_CONNECTION
17656 field_addr.name = "goods";
17657#endif /* FREECIV_JSON_CONNECTION */
17658 {
17659 int readin;
17660
17661 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17662 RECEIVE_PACKET_FIELD_ERROR(goods);
17663 }
17664 real_packet->goods = readin;
17665 }
17666#endif
17667 log_packet_detailed("packet_trade_route_info_100: got info about ()");
17668
17669#ifdef FREECIV_DELTA_PROTOCOL
17670 if (NULL == *hash) {
17671 *hash = genhash_new_full(hash_packet_trade_route_info_100, cmp_packet_trade_route_info_100,
17672 NULL, NULL, NULL, free);
17673 }
17674
17675 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
17676 *real_packet = *old;
17677 } else {
17678 log_packet_detailed(" no old info");
17679 memset(real_packet, 0, sizeof(*real_packet));
17680 }
17681
17682 if (BV_ISSET(fields, 0)) {
17683 log_packet_detailed(" got field 'city'");
17684#ifdef FREECIV_JSON_CONNECTION
17685 field_addr.name = "city";
17686#endif /* FREECIV_JSON_CONNECTION */
17687 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city)) {
17688 RECEIVE_PACKET_FIELD_ERROR(city);
17689 }
17690 }
17691 if (BV_ISSET(fields, 1)) {
17692 log_packet_detailed(" got field 'index'");
17693#ifdef FREECIV_JSON_CONNECTION
17694 field_addr.name = "index";
17695#endif /* FREECIV_JSON_CONNECTION */
17696 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->index)) {
17697 RECEIVE_PACKET_FIELD_ERROR(index);
17698 }
17699 }
17700 if (BV_ISSET(fields, 2)) {
17701 log_packet_detailed(" got field 'partner'");
17702#ifdef FREECIV_JSON_CONNECTION
17703 field_addr.name = "partner";
17704#endif /* FREECIV_JSON_CONNECTION */
17705 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->partner)) {
17706 RECEIVE_PACKET_FIELD_ERROR(partner);
17707 }
17708 }
17709 if (BV_ISSET(fields, 3)) {
17710 log_packet_detailed(" got field 'value'");
17711#ifdef FREECIV_JSON_CONNECTION
17712 field_addr.name = "value";
17713#endif /* FREECIV_JSON_CONNECTION */
17714 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
17715 RECEIVE_PACKET_FIELD_ERROR(value);
17716 }
17717 }
17718 if (BV_ISSET(fields, 4)) {
17719 log_packet_detailed(" got field 'direction'");
17720#ifdef FREECIV_JSON_CONNECTION
17721 field_addr.name = "direction";
17722#endif /* FREECIV_JSON_CONNECTION */
17723 {
17724 int readin;
17725
17726 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17727 RECEIVE_PACKET_FIELD_ERROR(direction);
17728 }
17729 real_packet->direction = readin;
17730 }
17731 }
17732 if (BV_ISSET(fields, 5)) {
17733 log_packet_detailed(" got field 'goods'");
17734#ifdef FREECIV_JSON_CONNECTION
17735 field_addr.name = "goods";
17736#endif /* FREECIV_JSON_CONNECTION */
17737 {
17738 int readin;
17739
17740 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
17741 RECEIVE_PACKET_FIELD_ERROR(goods);
17742 }
17743 real_packet->goods = readin;
17744 }
17745 }
17746
17747 if (NULL == old) {
17748 old = fc_malloc(sizeof(*old));
17749 *old = *real_packet;
17750 genhash_insert(*hash, old, old);
17751 } else {
17752 *old = *real_packet;
17753 }
17754
17755#endif /* FREECIV_DELTA_PROTOCOL */
17756 RECEIVE_PACKET_END(real_packet);
17757}
17758
17759 static int send_packet_trade_route_info_100(struct connection *pc, const struct packet_trade_route_info *packet)
17760{
17761 const struct packet_trade_route_info *real_packet = packet;
17762 int e;
17763#ifdef FREECIV_DELTA_PROTOCOL
17764 packet_trade_route_info_100_fields fields;
17765 struct packet_trade_route_info *old;
17766 bool differ;
17767 struct genhash **hash = pc->phs.sent + PACKET_TRADE_ROUTE_INFO;
17768#endif /* FREECIV_DELTA_PROTOCOL */
17769 SEND_PACKET_START(PACKET_TRADE_ROUTE_INFO);
17770#ifdef FREECIV_JSON_CONNECTION
17771 struct plocation field_addr;
17772 {
17773 struct plocation *field_addr_tmp = plocation_field_new(NULL);
17774 field_addr = *field_addr_tmp;
17775 FC_FREE(field_addr_tmp);
17776 }
17777#endif /* FREECIV_JSON_CONNECTION */
17778
17779 log_packet_detailed("packet_trade_route_info_100: sending info about ()");
17780
17781#ifdef FREECIV_DELTA_PROTOCOL
17782 if (NULL == *hash) {
17783 *hash = genhash_new_full(hash_packet_trade_route_info_100, cmp_packet_trade_route_info_100,
17784 NULL, NULL, NULL, free);
17785 }
17786 BV_CLR_ALL(fields);
17787
17788 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
17789 old = fc_malloc(sizeof(*old));
17790 *old = *real_packet;
17791 genhash_insert(*hash, old, old);
17792 memset(old, 0, sizeof(*old));
17793 }
17794 differ = (old->city != real_packet->city);
17795 if (differ) {
17796 BV_SET(fields, 0);
17797 }
17798
17799 differ = (old->index != real_packet->index);
17800 if (differ) {
17801 BV_SET(fields, 1);
17802 }
17803
17804 differ = (old->partner != real_packet->partner);
17805 if (differ) {
17806 BV_SET(fields, 2);
17807 }
17808
17809 differ = (old->value != real_packet->value);
17810 if (differ) {
17811 BV_SET(fields, 3);
17812 }
17813
17814 differ = (old->direction != real_packet->direction);
17815 if (differ) {
17816 BV_SET(fields, 4);
17817 }
17818
17819 differ = (old->goods != real_packet->goods);
17820 if (differ) {
17821 BV_SET(fields, 5);
17822 }
17823
17824
17825#ifdef FREECIV_JSON_CONNECTION
17826 field_addr.name = "fields";
17827#endif /* FREECIV_JSON_CONNECTION */
17828 e = 0;
17829 e |= DIO_BV_PUT(&dout, &field_addr, fields);
17830 if (e) {
17831 log_packet_detailed("fields bitvector error detected");
17832 }
17833
17834 if (BV_ISSET(fields, 0)) {
17835 log_packet_detailed(" field 'city' has changed");
17836#ifdef FREECIV_JSON_CONNECTION
17837 field_addr.name = "city";
17838#endif /* FREECIV_JSON_CONNECTION */
17839 e = 0;
17840 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
17841 if (e) {
17842 log_packet_detailed("'city' field error detected");
17843 }
17844 }
17845 if (BV_ISSET(fields, 1)) {
17846 log_packet_detailed(" field 'index' has changed");
17847#ifdef FREECIV_JSON_CONNECTION
17848 field_addr.name = "index";
17849#endif /* FREECIV_JSON_CONNECTION */
17850 e = 0;
17851 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
17852 if (e) {
17853 log_packet_detailed("'index' field error detected");
17854 }
17855 }
17856 if (BV_ISSET(fields, 2)) {
17857 log_packet_detailed(" field 'partner' has changed");
17858#ifdef FREECIV_JSON_CONNECTION
17859 field_addr.name = "partner";
17860#endif /* FREECIV_JSON_CONNECTION */
17861 e = 0;
17862 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->partner);
17863 if (e) {
17864 log_packet_detailed("'partner' field error detected");
17865 }
17866 }
17867 if (BV_ISSET(fields, 3)) {
17868 log_packet_detailed(" field 'value' has changed");
17869#ifdef FREECIV_JSON_CONNECTION
17870 field_addr.name = "value";
17871#endif /* FREECIV_JSON_CONNECTION */
17872 e = 0;
17873 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
17874 if (e) {
17875 log_packet_detailed("'value' field error detected");
17876 }
17877 }
17878 if (BV_ISSET(fields, 4)) {
17879 log_packet_detailed(" field 'direction' has changed");
17880#ifdef FREECIV_JSON_CONNECTION
17881 field_addr.name = "direction";
17882#endif /* FREECIV_JSON_CONNECTION */
17883 e = 0;
17884 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
17885 if (e) {
17886 log_packet_detailed("'direction' field error detected");
17887 }
17888 }
17889 if (BV_ISSET(fields, 5)) {
17890 log_packet_detailed(" field 'goods' has changed");
17891#ifdef FREECIV_JSON_CONNECTION
17892 field_addr.name = "goods";
17893#endif /* FREECIV_JSON_CONNECTION */
17894 e = 0;
17895 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
17896 if (e) {
17897 log_packet_detailed("'goods' field error detected");
17898 }
17899 }
17900
17901 *old = *real_packet;
17902#endif /* FREECIV_DELTA_PROTOCOL */
17903#ifndef FREECIV_DELTA_PROTOCOL
17904#ifdef FREECIV_JSON_CONNECTION
17905 field_addr.name = "city";
17906#endif /* FREECIV_JSON_CONNECTION */
17907 e = 0;
17908 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city);
17909 if (e) {
17910 log_packet_detailed("'city' field error detected");
17911 }
17912#ifdef FREECIV_JSON_CONNECTION
17913 field_addr.name = "index";
17914#endif /* FREECIV_JSON_CONNECTION */
17915 e = 0;
17916 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->index);
17917 if (e) {
17918 log_packet_detailed("'index' field error detected");
17919 }
17920#ifdef FREECIV_JSON_CONNECTION
17921 field_addr.name = "partner";
17922#endif /* FREECIV_JSON_CONNECTION */
17923 e = 0;
17924 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->partner);
17925 if (e) {
17926 log_packet_detailed("'partner' field error detected");
17927 }
17928#ifdef FREECIV_JSON_CONNECTION
17929 field_addr.name = "value";
17930#endif /* FREECIV_JSON_CONNECTION */
17931 e = 0;
17932 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
17933 if (e) {
17934 log_packet_detailed("'value' field error detected");
17935 }
17936#ifdef FREECIV_JSON_CONNECTION
17937 field_addr.name = "direction";
17938#endif /* FREECIV_JSON_CONNECTION */
17939 e = 0;
17940 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->direction);
17941 if (e) {
17942 log_packet_detailed("'direction' field error detected");
17943 }
17944#ifdef FREECIV_JSON_CONNECTION
17945 field_addr.name = "goods";
17946#endif /* FREECIV_JSON_CONNECTION */
17947 e = 0;
17948 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->goods);
17949 if (e) {
17950 log_packet_detailed("'goods' field error detected");
17951 }
17952
17953#endif
17954 SEND_PACKET_END(PACKET_TRADE_ROUTE_INFO);
17955}
17956
17957 int send_packet_trade_route_info(struct connection *pc, const struct packet_trade_route_info *packet)
17958{
17959 if (!pc->used) {
17960 log_error("WARNING: trying to send data to the closed connection %s",
17961 conn_description(pc));
17962 return -1;
17963 }
17964 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_TRADE_ROUTE_INFO].packet != NULL, -1,
17965 "Handler for PACKET_TRADE_ROUTE_INFO not installed");
17966 return pc->phs.handlers->send[PACKET_TRADE_ROUTE_INFO].packet(pc, packet);
17967}
17968
17969 void lsend_packet_trade_route_info(struct conn_list *dest, const struct packet_trade_route_info *packet)
17970{
17971 conn_list_iterate(dest, pconn) {
17972 send_packet_trade_route_info(pconn, packet);
17973 } conn_list_iterate_end;
17974}
17975
17976#ifdef FREECIV_DELTA_PROTOCOL
17977#define hash_packet_city_sell_100 hash_const
17978
17979#define cmp_packet_city_sell_100 cmp_const
17980
17981 BV_DEFINE(packet_city_sell_100_fields, 2);
17982#endif /* FREECIV_DELTA_PROTOCOL */
17983
17984 static struct packet_city_sell *receive_packet_city_sell_100(struct connection *pc)
17985{
17986#ifdef FREECIV_DELTA_PROTOCOL
17987 packet_city_sell_100_fields fields;
17988 struct packet_city_sell *old;
17989 struct genhash **hash = pc->phs.received + PACKET_CITY_SELL;
17990#endif /* FREECIV_DELTA_PROTOCOL */
17991 RECEIVE_PACKET_START(packet_city_sell, real_packet);
17992#ifdef FREECIV_JSON_CONNECTION
17993 struct plocation field_addr;
17994 {
17995 struct plocation *field_addr_tmp = plocation_field_new(NULL);
17996 field_addr = *field_addr_tmp;
17997 FC_FREE(field_addr_tmp);
17998 }
17999#endif /* FREECIV_JSON_CONNECTION */
18000
18001#ifdef FREECIV_DELTA_PROTOCOL
18002#ifdef FREECIV_JSON_CONNECTION
18003 field_addr.name = "fields";
18004#endif /* FREECIV_JSON_CONNECTION */
18005 DIO_BV_GET(&din, &field_addr, fields);
18006
18007#else /* FREECIV_DELTA_PROTOCOL */
18008#ifdef FREECIV_JSON_CONNECTION
18009 field_addr.name = "city_id";
18010#endif /* FREECIV_JSON_CONNECTION */
18011 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18012 RECEIVE_PACKET_FIELD_ERROR(city_id);
18013 }
18014#ifdef FREECIV_JSON_CONNECTION
18015 field_addr.name = "build_id";
18016#endif /* FREECIV_JSON_CONNECTION */
18017 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
18018 RECEIVE_PACKET_FIELD_ERROR(build_id);
18019 }
18020#endif
18021 log_packet_detailed("packet_city_sell_100: got info about ()");
18022
18023#ifdef FREECIV_DELTA_PROTOCOL
18024 if (NULL == *hash) {
18025 *hash = genhash_new_full(hash_packet_city_sell_100, cmp_packet_city_sell_100,
18026 NULL, NULL, NULL, free);
18027 }
18028
18029 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18030 *real_packet = *old;
18031 } else {
18032 log_packet_detailed(" no old info");
18033 memset(real_packet, 0, sizeof(*real_packet));
18034 }
18035
18036 if (BV_ISSET(fields, 0)) {
18037 log_packet_detailed(" got field 'city_id'");
18038#ifdef FREECIV_JSON_CONNECTION
18039 field_addr.name = "city_id";
18040#endif /* FREECIV_JSON_CONNECTION */
18041 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18042 RECEIVE_PACKET_FIELD_ERROR(city_id);
18043 }
18044 }
18045 if (BV_ISSET(fields, 1)) {
18046 log_packet_detailed(" got field 'build_id'");
18047#ifdef FREECIV_JSON_CONNECTION
18048 field_addr.name = "build_id";
18049#endif /* FREECIV_JSON_CONNECTION */
18050 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_id)) {
18051 RECEIVE_PACKET_FIELD_ERROR(build_id);
18052 }
18053 }
18054
18055 if (NULL == old) {
18056 old = fc_malloc(sizeof(*old));
18057 *old = *real_packet;
18058 genhash_insert(*hash, old, old);
18059 } else {
18060 *old = *real_packet;
18061 }
18062
18063#endif /* FREECIV_DELTA_PROTOCOL */
18064 RECEIVE_PACKET_END(real_packet);
18065}
18066
18067 static int send_packet_city_sell_100(struct connection *pc, const struct packet_city_sell *packet)
18068{
18069 const struct packet_city_sell *real_packet = packet;
18070 int e;
18071#ifdef FREECIV_DELTA_PROTOCOL
18072 packet_city_sell_100_fields fields;
18073 struct packet_city_sell *old;
18074 bool differ;
18075 struct genhash **hash = pc->phs.sent + PACKET_CITY_SELL;
18076#endif /* FREECIV_DELTA_PROTOCOL */
18077 SEND_PACKET_START(PACKET_CITY_SELL);
18078#ifdef FREECIV_JSON_CONNECTION
18079 struct plocation field_addr;
18080 {
18081 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18082 field_addr = *field_addr_tmp;
18083 FC_FREE(field_addr_tmp);
18084 }
18085#endif /* FREECIV_JSON_CONNECTION */
18086
18087 log_packet_detailed("packet_city_sell_100: sending info about ()");
18088
18089#ifdef FREECIV_DELTA_PROTOCOL
18090 if (NULL == *hash) {
18091 *hash = genhash_new_full(hash_packet_city_sell_100, cmp_packet_city_sell_100,
18092 NULL, NULL, NULL, free);
18093 }
18094 BV_CLR_ALL(fields);
18095
18096 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18097 old = fc_malloc(sizeof(*old));
18098 *old = *real_packet;
18099 genhash_insert(*hash, old, old);
18100 memset(old, 0, sizeof(*old));
18101 }
18102 differ = (old->city_id != real_packet->city_id);
18103 if (differ) {
18104 BV_SET(fields, 0);
18105 }
18106
18107 differ = (old->build_id != real_packet->build_id);
18108 if (differ) {
18109 BV_SET(fields, 1);
18110 }
18111
18112
18113#ifdef FREECIV_JSON_CONNECTION
18114 field_addr.name = "fields";
18115#endif /* FREECIV_JSON_CONNECTION */
18116 e = 0;
18117 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18118 if (e) {
18119 log_packet_detailed("fields bitvector error detected");
18120 }
18121
18122 if (BV_ISSET(fields, 0)) {
18123 log_packet_detailed(" field 'city_id' has changed");
18124#ifdef FREECIV_JSON_CONNECTION
18125 field_addr.name = "city_id";
18126#endif /* FREECIV_JSON_CONNECTION */
18127 e = 0;
18128 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18129 if (e) {
18130 log_packet_detailed("'city_id' field error detected");
18131 }
18132 }
18133 if (BV_ISSET(fields, 1)) {
18134 log_packet_detailed(" field 'build_id' has changed");
18135#ifdef FREECIV_JSON_CONNECTION
18136 field_addr.name = "build_id";
18137#endif /* FREECIV_JSON_CONNECTION */
18138 e = 0;
18139 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
18140 if (e) {
18141 log_packet_detailed("'build_id' field error detected");
18142 }
18143 }
18144
18145 *old = *real_packet;
18146#endif /* FREECIV_DELTA_PROTOCOL */
18147#ifndef FREECIV_DELTA_PROTOCOL
18148#ifdef FREECIV_JSON_CONNECTION
18149 field_addr.name = "city_id";
18150#endif /* FREECIV_JSON_CONNECTION */
18151 e = 0;
18152 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18153 if (e) {
18154 log_packet_detailed("'city_id' field error detected");
18155 }
18156#ifdef FREECIV_JSON_CONNECTION
18157 field_addr.name = "build_id";
18158#endif /* FREECIV_JSON_CONNECTION */
18159 e = 0;
18160 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_id);
18161 if (e) {
18162 log_packet_detailed("'build_id' field error detected");
18163 }
18164
18165#endif
18166 SEND_PACKET_END(PACKET_CITY_SELL);
18167}
18168
18169 int send_packet_city_sell(struct connection *pc, const struct packet_city_sell *packet)
18170{
18171 if (!pc->used) {
18172 log_error("WARNING: trying to send data to the closed connection %s",
18173 conn_description(pc));
18174 return -1;
18175 }
18176 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SELL].packet != NULL, -1,
18177 "Handler for PACKET_CITY_SELL not installed");
18178 return pc->phs.handlers->send[PACKET_CITY_SELL].packet(pc, packet);
18179}
18180
18181 int dsend_packet_city_sell(struct connection *pc, int city_id, int build_id)
18182{
18183 struct packet_city_sell packet, *real_packet = &packet;
18184
18185 real_packet->city_id = city_id;
18186 real_packet->build_id = build_id;
18187
18188 return send_packet_city_sell(pc, real_packet);
18189}
18190
18191#ifdef FREECIV_DELTA_PROTOCOL
18192#define hash_packet_city_buy_100 hash_const
18193
18194#define cmp_packet_city_buy_100 cmp_const
18195
18196 BV_DEFINE(packet_city_buy_100_fields, 1);
18197#endif /* FREECIV_DELTA_PROTOCOL */
18198
18199 static struct packet_city_buy *receive_packet_city_buy_100(struct connection *pc)
18200{
18201#ifdef FREECIV_DELTA_PROTOCOL
18202 packet_city_buy_100_fields fields;
18203 struct packet_city_buy *old;
18204 struct genhash **hash = pc->phs.received + PACKET_CITY_BUY;
18205#endif /* FREECIV_DELTA_PROTOCOL */
18206 RECEIVE_PACKET_START(packet_city_buy, real_packet);
18207#ifdef FREECIV_JSON_CONNECTION
18208 struct plocation field_addr;
18209 {
18210 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18211 field_addr = *field_addr_tmp;
18212 FC_FREE(field_addr_tmp);
18213 }
18214#endif /* FREECIV_JSON_CONNECTION */
18215
18216#ifdef FREECIV_DELTA_PROTOCOL
18217#ifdef FREECIV_JSON_CONNECTION
18218 field_addr.name = "fields";
18219#endif /* FREECIV_JSON_CONNECTION */
18220 DIO_BV_GET(&din, &field_addr, fields);
18221
18222#else /* FREECIV_DELTA_PROTOCOL */
18223#ifdef FREECIV_JSON_CONNECTION
18224 field_addr.name = "city_id";
18225#endif /* FREECIV_JSON_CONNECTION */
18226 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18227 RECEIVE_PACKET_FIELD_ERROR(city_id);
18228 }
18229#endif
18230 log_packet_detailed("packet_city_buy_100: got info about ()");
18231
18232#ifdef FREECIV_DELTA_PROTOCOL
18233 if (NULL == *hash) {
18234 *hash = genhash_new_full(hash_packet_city_buy_100, cmp_packet_city_buy_100,
18235 NULL, NULL, NULL, free);
18236 }
18237
18238 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18239 *real_packet = *old;
18240 } else {
18241 log_packet_detailed(" no old info");
18242 memset(real_packet, 0, sizeof(*real_packet));
18243 }
18244
18245 if (BV_ISSET(fields, 0)) {
18246 log_packet_detailed(" got field 'city_id'");
18247#ifdef FREECIV_JSON_CONNECTION
18248 field_addr.name = "city_id";
18249#endif /* FREECIV_JSON_CONNECTION */
18250 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18251 RECEIVE_PACKET_FIELD_ERROR(city_id);
18252 }
18253 }
18254
18255 if (NULL == old) {
18256 old = fc_malloc(sizeof(*old));
18257 *old = *real_packet;
18258 genhash_insert(*hash, old, old);
18259 } else {
18260 *old = *real_packet;
18261 }
18262
18263#endif /* FREECIV_DELTA_PROTOCOL */
18264 RECEIVE_PACKET_END(real_packet);
18265}
18266
18267 static int send_packet_city_buy_100(struct connection *pc, const struct packet_city_buy *packet)
18268{
18269 const struct packet_city_buy *real_packet = packet;
18270 int e;
18271#ifdef FREECIV_DELTA_PROTOCOL
18272 packet_city_buy_100_fields fields;
18273 struct packet_city_buy *old;
18274 bool differ;
18275 struct genhash **hash = pc->phs.sent + PACKET_CITY_BUY;
18276#endif /* FREECIV_DELTA_PROTOCOL */
18277 SEND_PACKET_START(PACKET_CITY_BUY);
18278#ifdef FREECIV_JSON_CONNECTION
18279 struct plocation field_addr;
18280 {
18281 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18282 field_addr = *field_addr_tmp;
18283 FC_FREE(field_addr_tmp);
18284 }
18285#endif /* FREECIV_JSON_CONNECTION */
18286
18287 log_packet_detailed("packet_city_buy_100: sending info about ()");
18288
18289#ifdef FREECIV_DELTA_PROTOCOL
18290 if (NULL == *hash) {
18291 *hash = genhash_new_full(hash_packet_city_buy_100, cmp_packet_city_buy_100,
18292 NULL, NULL, NULL, free);
18293 }
18294 BV_CLR_ALL(fields);
18295
18296 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18297 old = fc_malloc(sizeof(*old));
18298 *old = *real_packet;
18299 genhash_insert(*hash, old, old);
18300 memset(old, 0, sizeof(*old));
18301 }
18302 differ = (old->city_id != real_packet->city_id);
18303 if (differ) {
18304 BV_SET(fields, 0);
18305 }
18306
18307
18308#ifdef FREECIV_JSON_CONNECTION
18309 field_addr.name = "fields";
18310#endif /* FREECIV_JSON_CONNECTION */
18311 e = 0;
18312 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18313 if (e) {
18314 log_packet_detailed("fields bitvector error detected");
18315 }
18316
18317 if (BV_ISSET(fields, 0)) {
18318 log_packet_detailed(" field 'city_id' has changed");
18319#ifdef FREECIV_JSON_CONNECTION
18320 field_addr.name = "city_id";
18321#endif /* FREECIV_JSON_CONNECTION */
18322 e = 0;
18323 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18324 if (e) {
18325 log_packet_detailed("'city_id' field error detected");
18326 }
18327 }
18328
18329 *old = *real_packet;
18330#endif /* FREECIV_DELTA_PROTOCOL */
18331#ifndef FREECIV_DELTA_PROTOCOL
18332#ifdef FREECIV_JSON_CONNECTION
18333 field_addr.name = "city_id";
18334#endif /* FREECIV_JSON_CONNECTION */
18335 e = 0;
18336 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18337 if (e) {
18338 log_packet_detailed("'city_id' field error detected");
18339 }
18340
18341#endif
18342 SEND_PACKET_END(PACKET_CITY_BUY);
18343}
18344
18345 int send_packet_city_buy(struct connection *pc, const struct packet_city_buy *packet)
18346{
18347 if (!pc->used) {
18348 log_error("WARNING: trying to send data to the closed connection %s",
18349 conn_description(pc));
18350 return -1;
18351 }
18352 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_BUY].packet != NULL, -1,
18353 "Handler for PACKET_CITY_BUY not installed");
18354 return pc->phs.handlers->send[PACKET_CITY_BUY].packet(pc, packet);
18355}
18356
18357 int dsend_packet_city_buy(struct connection *pc, int city_id)
18358{
18359 struct packet_city_buy packet, *real_packet = &packet;
18360
18361 real_packet->city_id = city_id;
18362
18363 return send_packet_city_buy(pc, real_packet);
18364}
18365
18366#ifdef FREECIV_DELTA_PROTOCOL
18367#define hash_packet_city_change_100 hash_const
18368
18369#define cmp_packet_city_change_100 cmp_const
18370
18371 BV_DEFINE(packet_city_change_100_fields, 3);
18372#endif /* FREECIV_DELTA_PROTOCOL */
18373
18374 static struct packet_city_change *receive_packet_city_change_100(struct connection *pc)
18375{
18376#ifdef FREECIV_DELTA_PROTOCOL
18377 packet_city_change_100_fields fields;
18378 struct packet_city_change *old;
18379 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE;
18380#endif /* FREECIV_DELTA_PROTOCOL */
18381 RECEIVE_PACKET_START(packet_city_change, real_packet);
18382#ifdef FREECIV_JSON_CONNECTION
18383 struct plocation field_addr;
18384 {
18385 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18386 field_addr = *field_addr_tmp;
18387 FC_FREE(field_addr_tmp);
18388 }
18389#endif /* FREECIV_JSON_CONNECTION */
18390
18391#ifdef FREECIV_DELTA_PROTOCOL
18392#ifdef FREECIV_JSON_CONNECTION
18393 field_addr.name = "fields";
18394#endif /* FREECIV_JSON_CONNECTION */
18395 DIO_BV_GET(&din, &field_addr, fields);
18396
18397#else /* FREECIV_DELTA_PROTOCOL */
18398#ifdef FREECIV_JSON_CONNECTION
18399 field_addr.name = "city_id";
18400#endif /* FREECIV_JSON_CONNECTION */
18401 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18402 RECEIVE_PACKET_FIELD_ERROR(city_id);
18403 }
18404#ifdef FREECIV_JSON_CONNECTION
18405 field_addr.name = "production_kind";
18406#endif /* FREECIV_JSON_CONNECTION */
18407 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
18408 RECEIVE_PACKET_FIELD_ERROR(production_kind);
18409 }
18410#ifdef FREECIV_JSON_CONNECTION
18411 field_addr.name = "production_value";
18412#endif /* FREECIV_JSON_CONNECTION */
18413 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
18414 RECEIVE_PACKET_FIELD_ERROR(production_value);
18415 }
18416#endif
18417 log_packet_detailed("packet_city_change_100: got info about ()");
18418
18419#ifdef FREECIV_DELTA_PROTOCOL
18420 if (NULL == *hash) {
18421 *hash = genhash_new_full(hash_packet_city_change_100, cmp_packet_city_change_100,
18422 NULL, NULL, NULL, free);
18423 }
18424
18425 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18426 *real_packet = *old;
18427 } else {
18428 log_packet_detailed(" no old info");
18429 memset(real_packet, 0, sizeof(*real_packet));
18430 }
18431
18432 if (BV_ISSET(fields, 0)) {
18433 log_packet_detailed(" got field 'city_id'");
18434#ifdef FREECIV_JSON_CONNECTION
18435 field_addr.name = "city_id";
18436#endif /* FREECIV_JSON_CONNECTION */
18437 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18438 RECEIVE_PACKET_FIELD_ERROR(city_id);
18439 }
18440 }
18441 if (BV_ISSET(fields, 1)) {
18442 log_packet_detailed(" got field 'production_kind'");
18443#ifdef FREECIV_JSON_CONNECTION
18444 field_addr.name = "production_kind";
18445#endif /* FREECIV_JSON_CONNECTION */
18446 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
18447 RECEIVE_PACKET_FIELD_ERROR(production_kind);
18448 }
18449 }
18450 if (BV_ISSET(fields, 2)) {
18451 log_packet_detailed(" got field 'production_value'");
18452#ifdef FREECIV_JSON_CONNECTION
18453 field_addr.name = "production_value";
18454#endif /* FREECIV_JSON_CONNECTION */
18455 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
18456 RECEIVE_PACKET_FIELD_ERROR(production_value);
18457 }
18458 }
18459
18460 if (NULL == old) {
18461 old = fc_malloc(sizeof(*old));
18462 *old = *real_packet;
18463 genhash_insert(*hash, old, old);
18464 } else {
18465 *old = *real_packet;
18466 }
18467
18468#endif /* FREECIV_DELTA_PROTOCOL */
18469 RECEIVE_PACKET_END(real_packet);
18470}
18471
18472 static int send_packet_city_change_100(struct connection *pc, const struct packet_city_change *packet)
18473{
18474 const struct packet_city_change *real_packet = packet;
18475 int e;
18476#ifdef FREECIV_DELTA_PROTOCOL
18477 packet_city_change_100_fields fields;
18478 struct packet_city_change *old;
18479 bool differ;
18480 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE;
18481#endif /* FREECIV_DELTA_PROTOCOL */
18482 SEND_PACKET_START(PACKET_CITY_CHANGE);
18483#ifdef FREECIV_JSON_CONNECTION
18484 struct plocation field_addr;
18485 {
18486 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18487 field_addr = *field_addr_tmp;
18488 FC_FREE(field_addr_tmp);
18489 }
18490#endif /* FREECIV_JSON_CONNECTION */
18491
18492 log_packet_detailed("packet_city_change_100: sending info about ()");
18493
18494#ifdef FREECIV_DELTA_PROTOCOL
18495 if (NULL == *hash) {
18496 *hash = genhash_new_full(hash_packet_city_change_100, cmp_packet_city_change_100,
18497 NULL, NULL, NULL, free);
18498 }
18499 BV_CLR_ALL(fields);
18500
18501 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18502 old = fc_malloc(sizeof(*old));
18503 *old = *real_packet;
18504 genhash_insert(*hash, old, old);
18505 memset(old, 0, sizeof(*old));
18506 }
18507 differ = (old->city_id != real_packet->city_id);
18508 if (differ) {
18509 BV_SET(fields, 0);
18510 }
18511
18512 differ = (old->production_kind != real_packet->production_kind);
18513 if (differ) {
18514 BV_SET(fields, 1);
18515 }
18516
18517 differ = (old->production_value != real_packet->production_value);
18518 if (differ) {
18519 BV_SET(fields, 2);
18520 }
18521
18522
18523#ifdef FREECIV_JSON_CONNECTION
18524 field_addr.name = "fields";
18525#endif /* FREECIV_JSON_CONNECTION */
18526 e = 0;
18527 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18528 if (e) {
18529 log_packet_detailed("fields bitvector error detected");
18530 }
18531
18532 if (BV_ISSET(fields, 0)) {
18533 log_packet_detailed(" field 'city_id' has changed");
18534#ifdef FREECIV_JSON_CONNECTION
18535 field_addr.name = "city_id";
18536#endif /* FREECIV_JSON_CONNECTION */
18537 e = 0;
18538 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18539 if (e) {
18540 log_packet_detailed("'city_id' field error detected");
18541 }
18542 }
18543 if (BV_ISSET(fields, 1)) {
18544 log_packet_detailed(" field 'production_kind' has changed");
18545#ifdef FREECIV_JSON_CONNECTION
18546 field_addr.name = "production_kind";
18547#endif /* FREECIV_JSON_CONNECTION */
18548 e = 0;
18549 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
18550 if (e) {
18551 log_packet_detailed("'production_kind' field error detected");
18552 }
18553 }
18554 if (BV_ISSET(fields, 2)) {
18555 log_packet_detailed(" field 'production_value' has changed");
18556#ifdef FREECIV_JSON_CONNECTION
18557 field_addr.name = "production_value";
18558#endif /* FREECIV_JSON_CONNECTION */
18559 e = 0;
18560 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
18561 if (e) {
18562 log_packet_detailed("'production_value' field error detected");
18563 }
18564 }
18565
18566 *old = *real_packet;
18567#endif /* FREECIV_DELTA_PROTOCOL */
18568#ifndef FREECIV_DELTA_PROTOCOL
18569#ifdef FREECIV_JSON_CONNECTION
18570 field_addr.name = "city_id";
18571#endif /* FREECIV_JSON_CONNECTION */
18572 e = 0;
18573 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18574 if (e) {
18575 log_packet_detailed("'city_id' field error detected");
18576 }
18577#ifdef FREECIV_JSON_CONNECTION
18578 field_addr.name = "production_kind";
18579#endif /* FREECIV_JSON_CONNECTION */
18580 e = 0;
18581 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
18582 if (e) {
18583 log_packet_detailed("'production_kind' field error detected");
18584 }
18585#ifdef FREECIV_JSON_CONNECTION
18586 field_addr.name = "production_value";
18587#endif /* FREECIV_JSON_CONNECTION */
18588 e = 0;
18589 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
18590 if (e) {
18591 log_packet_detailed("'production_value' field error detected");
18592 }
18593
18594#endif
18595 SEND_PACKET_END(PACKET_CITY_CHANGE);
18596}
18597
18598 int send_packet_city_change(struct connection *pc, const struct packet_city_change *packet)
18599{
18600 if (!pc->used) {
18601 log_error("WARNING: trying to send data to the closed connection %s",
18602 conn_description(pc));
18603 return -1;
18604 }
18605 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_CHANGE].packet != NULL, -1,
18606 "Handler for PACKET_CITY_CHANGE not installed");
18607 return pc->phs.handlers->send[PACKET_CITY_CHANGE].packet(pc, packet);
18608}
18609
18610 int dsend_packet_city_change(struct connection *pc, int city_id, int production_kind, int production_value)
18611{
18612 struct packet_city_change packet, *real_packet = &packet;
18613
18614 real_packet->city_id = city_id;
18615 real_packet->production_kind = production_kind;
18616 real_packet->production_value = production_value;
18617
18618 return send_packet_city_change(pc, real_packet);
18619}
18620
18621#ifdef FREECIV_DELTA_PROTOCOL
18622#define hash_packet_city_worklist_100 hash_const
18623
18624#define cmp_packet_city_worklist_100 cmp_const
18625
18626 BV_DEFINE(packet_city_worklist_100_fields, 2);
18627#endif /* FREECIV_DELTA_PROTOCOL */
18628
18629 static struct packet_city_worklist *receive_packet_city_worklist_100(struct connection *pc)
18630{
18631#ifdef FREECIV_DELTA_PROTOCOL
18632 packet_city_worklist_100_fields fields;
18633 struct packet_city_worklist *old;
18634 struct genhash **hash = pc->phs.received + PACKET_CITY_WORKLIST;
18635#endif /* FREECIV_DELTA_PROTOCOL */
18636 RECEIVE_PACKET_START(packet_city_worklist, real_packet);
18637#ifdef FREECIV_JSON_CONNECTION
18638 struct plocation field_addr;
18639 {
18640 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18641 field_addr = *field_addr_tmp;
18642 FC_FREE(field_addr_tmp);
18643 }
18644#endif /* FREECIV_JSON_CONNECTION */
18645
18646#ifdef FREECIV_DELTA_PROTOCOL
18647#ifdef FREECIV_JSON_CONNECTION
18648 field_addr.name = "fields";
18649#endif /* FREECIV_JSON_CONNECTION */
18650 DIO_BV_GET(&din, &field_addr, fields);
18651
18652#else /* FREECIV_DELTA_PROTOCOL */
18653#ifdef FREECIV_JSON_CONNECTION
18654 field_addr.name = "city_id";
18655#endif /* FREECIV_JSON_CONNECTION */
18656 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18657 RECEIVE_PACKET_FIELD_ERROR(city_id);
18658 }
18659#ifdef FREECIV_JSON_CONNECTION
18660 field_addr.name = "worklist";
18661#endif /* FREECIV_JSON_CONNECTION */
18662 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
18663 RECEIVE_PACKET_FIELD_ERROR(worklist);
18664 }
18665#endif
18666 log_packet_detailed("packet_city_worklist_100: got info about ()");
18667
18668#ifdef FREECIV_DELTA_PROTOCOL
18669 if (NULL == *hash) {
18670 *hash = genhash_new_full(hash_packet_city_worklist_100, cmp_packet_city_worklist_100,
18671 NULL, NULL, NULL, free);
18672 }
18673
18674 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18675 *real_packet = *old;
18676 } else {
18677 log_packet_detailed(" no old info");
18678 memset(real_packet, 0, sizeof(*real_packet));
18679 }
18680
18681 if (BV_ISSET(fields, 0)) {
18682 log_packet_detailed(" got field 'city_id'");
18683#ifdef FREECIV_JSON_CONNECTION
18684 field_addr.name = "city_id";
18685#endif /* FREECIV_JSON_CONNECTION */
18686 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18687 RECEIVE_PACKET_FIELD_ERROR(city_id);
18688 }
18689 }
18690 if (BV_ISSET(fields, 1)) {
18691 log_packet_detailed(" got field 'worklist'");
18692#ifdef FREECIV_JSON_CONNECTION
18693 field_addr.name = "worklist";
18694#endif /* FREECIV_JSON_CONNECTION */
18695 if (!DIO_GET(worklist, &din, &field_addr, &real_packet->worklist)) {
18696 RECEIVE_PACKET_FIELD_ERROR(worklist);
18697 }
18698 }
18699
18700 if (NULL == old) {
18701 old = fc_malloc(sizeof(*old));
18702 *old = *real_packet;
18703 genhash_insert(*hash, old, old);
18704 } else {
18705 *old = *real_packet;
18706 }
18707
18708#endif /* FREECIV_DELTA_PROTOCOL */
18709 RECEIVE_PACKET_END(real_packet);
18710}
18711
18712 static int send_packet_city_worklist_100(struct connection *pc, const struct packet_city_worklist *packet)
18713{
18714 const struct packet_city_worklist *real_packet = packet;
18715 int e;
18716#ifdef FREECIV_DELTA_PROTOCOL
18717 packet_city_worklist_100_fields fields;
18718 struct packet_city_worklist *old;
18719 bool differ;
18720 struct genhash **hash = pc->phs.sent + PACKET_CITY_WORKLIST;
18721#endif /* FREECIV_DELTA_PROTOCOL */
18722 SEND_PACKET_START(PACKET_CITY_WORKLIST);
18723#ifdef FREECIV_JSON_CONNECTION
18724 struct plocation field_addr;
18725 {
18726 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18727 field_addr = *field_addr_tmp;
18728 FC_FREE(field_addr_tmp);
18729 }
18730#endif /* FREECIV_JSON_CONNECTION */
18731
18732 log_packet_detailed("packet_city_worklist_100: sending info about ()");
18733
18734#ifdef FREECIV_DELTA_PROTOCOL
18735 if (NULL == *hash) {
18736 *hash = genhash_new_full(hash_packet_city_worklist_100, cmp_packet_city_worklist_100,
18737 NULL, NULL, NULL, free);
18738 }
18739 BV_CLR_ALL(fields);
18740
18741 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18742 old = fc_malloc(sizeof(*old));
18743 *old = *real_packet;
18744 genhash_insert(*hash, old, old);
18745 memset(old, 0, sizeof(*old));
18746 }
18747 differ = (old->city_id != real_packet->city_id);
18748 if (differ) {
18749 BV_SET(fields, 0);
18750 }
18751
18752 differ = !are_worklists_equal(&old->worklist, &real_packet->worklist);
18753 if (differ) {
18754 BV_SET(fields, 1);
18755 }
18756
18757
18758#ifdef FREECIV_JSON_CONNECTION
18759 field_addr.name = "fields";
18760#endif /* FREECIV_JSON_CONNECTION */
18761 e = 0;
18762 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18763 if (e) {
18764 log_packet_detailed("fields bitvector error detected");
18765 }
18766
18767 if (BV_ISSET(fields, 0)) {
18768 log_packet_detailed(" field 'city_id' has changed");
18769#ifdef FREECIV_JSON_CONNECTION
18770 field_addr.name = "city_id";
18771#endif /* FREECIV_JSON_CONNECTION */
18772 e = 0;
18773 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18774 if (e) {
18775 log_packet_detailed("'city_id' field error detected");
18776 }
18777 }
18778 if (BV_ISSET(fields, 1)) {
18779 log_packet_detailed(" field 'worklist' has changed");
18780#ifdef FREECIV_JSON_CONNECTION
18781 field_addr.name = "worklist";
18782#endif /* FREECIV_JSON_CONNECTION */
18783 e = 0;
18784 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
18785 if (e) {
18786 log_packet_detailed("'worklist' field error detected");
18787 }
18788 }
18789
18790 *old = *real_packet;
18791#endif /* FREECIV_DELTA_PROTOCOL */
18792#ifndef FREECIV_DELTA_PROTOCOL
18793#ifdef FREECIV_JSON_CONNECTION
18794 field_addr.name = "city_id";
18795#endif /* FREECIV_JSON_CONNECTION */
18796 e = 0;
18797 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18798 if (e) {
18799 log_packet_detailed("'city_id' field error detected");
18800 }
18801#ifdef FREECIV_JSON_CONNECTION
18802 field_addr.name = "worklist";
18803#endif /* FREECIV_JSON_CONNECTION */
18804 e = 0;
18805 e |= DIO_PUT(worklist, &dout, &field_addr, &real_packet->worklist);
18806 if (e) {
18807 log_packet_detailed("'worklist' field error detected");
18808 }
18809
18810#endif
18811 SEND_PACKET_END(PACKET_CITY_WORKLIST);
18812}
18813
18814 int send_packet_city_worklist(struct connection *pc, const struct packet_city_worklist *packet)
18815{
18816 if (!pc->used) {
18817 log_error("WARNING: trying to send data to the closed connection %s",
18818 conn_description(pc));
18819 return -1;
18820 }
18821 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_WORKLIST].packet != NULL, -1,
18822 "Handler for PACKET_CITY_WORKLIST not installed");
18823 return pc->phs.handlers->send[PACKET_CITY_WORKLIST].packet(pc, packet);
18824}
18825
18826 int dsend_packet_city_worklist(struct connection *pc, int city_id, const struct worklist *worklist)
18827{
18828 struct packet_city_worklist packet, *real_packet = &packet;
18829
18830 real_packet->city_id = city_id;
18831 worklist_copy(&real_packet->worklist, worklist);
18832
18833 return send_packet_city_worklist(pc, real_packet);
18834}
18835
18836#ifdef FREECIV_DELTA_PROTOCOL
18837#define hash_packet_city_make_specialist_100 hash_const
18838
18839#define cmp_packet_city_make_specialist_100 cmp_const
18840
18841 BV_DEFINE(packet_city_make_specialist_100_fields, 2);
18842#endif /* FREECIV_DELTA_PROTOCOL */
18843
18844 static struct packet_city_make_specialist *receive_packet_city_make_specialist_100(struct connection *pc)
18845{
18846#ifdef FREECIV_DELTA_PROTOCOL
18847 packet_city_make_specialist_100_fields fields;
18848 struct packet_city_make_specialist *old;
18849 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_SPECIALIST;
18850#endif /* FREECIV_DELTA_PROTOCOL */
18851 RECEIVE_PACKET_START(packet_city_make_specialist, real_packet);
18852#ifdef FREECIV_JSON_CONNECTION
18853 struct plocation field_addr;
18854 {
18855 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18856 field_addr = *field_addr_tmp;
18857 FC_FREE(field_addr_tmp);
18858 }
18859#endif /* FREECIV_JSON_CONNECTION */
18860
18861#ifdef FREECIV_DELTA_PROTOCOL
18862#ifdef FREECIV_JSON_CONNECTION
18863 field_addr.name = "fields";
18864#endif /* FREECIV_JSON_CONNECTION */
18865 DIO_BV_GET(&din, &field_addr, fields);
18866
18867#else /* FREECIV_DELTA_PROTOCOL */
18868#ifdef FREECIV_JSON_CONNECTION
18869 field_addr.name = "city_id";
18870#endif /* FREECIV_JSON_CONNECTION */
18871 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18872 RECEIVE_PACKET_FIELD_ERROR(city_id);
18873 }
18874#ifdef FREECIV_JSON_CONNECTION
18875 field_addr.name = "tile_id";
18876#endif /* FREECIV_JSON_CONNECTION */
18877 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
18878 RECEIVE_PACKET_FIELD_ERROR(tile_id);
18879 }
18880#endif
18881 log_packet_detailed("packet_city_make_specialist_100: got info about ()");
18882
18883#ifdef FREECIV_DELTA_PROTOCOL
18884 if (NULL == *hash) {
18885 *hash = genhash_new_full(hash_packet_city_make_specialist_100, cmp_packet_city_make_specialist_100,
18886 NULL, NULL, NULL, free);
18887 }
18888
18889 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
18890 *real_packet = *old;
18891 } else {
18892 log_packet_detailed(" no old info");
18893 memset(real_packet, 0, sizeof(*real_packet));
18894 }
18895
18896 if (BV_ISSET(fields, 0)) {
18897 log_packet_detailed(" got field 'city_id'");
18898#ifdef FREECIV_JSON_CONNECTION
18899 field_addr.name = "city_id";
18900#endif /* FREECIV_JSON_CONNECTION */
18901 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
18902 RECEIVE_PACKET_FIELD_ERROR(city_id);
18903 }
18904 }
18905 if (BV_ISSET(fields, 1)) {
18906 log_packet_detailed(" got field 'tile_id'");
18907#ifdef FREECIV_JSON_CONNECTION
18908 field_addr.name = "tile_id";
18909#endif /* FREECIV_JSON_CONNECTION */
18910 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
18911 RECEIVE_PACKET_FIELD_ERROR(tile_id);
18912 }
18913 }
18914
18915 if (NULL == old) {
18916 old = fc_malloc(sizeof(*old));
18917 *old = *real_packet;
18918 genhash_insert(*hash, old, old);
18919 } else {
18920 *old = *real_packet;
18921 }
18922
18923#endif /* FREECIV_DELTA_PROTOCOL */
18924 RECEIVE_PACKET_END(real_packet);
18925}
18926
18927 static int send_packet_city_make_specialist_100(struct connection *pc, const struct packet_city_make_specialist *packet)
18928{
18929 const struct packet_city_make_specialist *real_packet = packet;
18930 int e;
18931#ifdef FREECIV_DELTA_PROTOCOL
18932 packet_city_make_specialist_100_fields fields;
18933 struct packet_city_make_specialist *old;
18934 bool differ;
18935 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_SPECIALIST;
18936#endif /* FREECIV_DELTA_PROTOCOL */
18937 SEND_PACKET_START(PACKET_CITY_MAKE_SPECIALIST);
18938#ifdef FREECIV_JSON_CONNECTION
18939 struct plocation field_addr;
18940 {
18941 struct plocation *field_addr_tmp = plocation_field_new(NULL);
18942 field_addr = *field_addr_tmp;
18943 FC_FREE(field_addr_tmp);
18944 }
18945#endif /* FREECIV_JSON_CONNECTION */
18946
18947 log_packet_detailed("packet_city_make_specialist_100: sending info about ()");
18948
18949#ifdef FREECIV_DELTA_PROTOCOL
18950 if (NULL == *hash) {
18951 *hash = genhash_new_full(hash_packet_city_make_specialist_100, cmp_packet_city_make_specialist_100,
18952 NULL, NULL, NULL, free);
18953 }
18954 BV_CLR_ALL(fields);
18955
18956 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
18957 old = fc_malloc(sizeof(*old));
18958 *old = *real_packet;
18959 genhash_insert(*hash, old, old);
18960 memset(old, 0, sizeof(*old));
18961 }
18962 differ = (old->city_id != real_packet->city_id);
18963 if (differ) {
18964 BV_SET(fields, 0);
18965 }
18966
18967 differ = (old->tile_id != real_packet->tile_id);
18968 if (differ) {
18969 BV_SET(fields, 1);
18970 }
18971
18972
18973#ifdef FREECIV_JSON_CONNECTION
18974 field_addr.name = "fields";
18975#endif /* FREECIV_JSON_CONNECTION */
18976 e = 0;
18977 e |= DIO_BV_PUT(&dout, &field_addr, fields);
18978 if (e) {
18979 log_packet_detailed("fields bitvector error detected");
18980 }
18981
18982 if (BV_ISSET(fields, 0)) {
18983 log_packet_detailed(" field 'city_id' has changed");
18984#ifdef FREECIV_JSON_CONNECTION
18985 field_addr.name = "city_id";
18986#endif /* FREECIV_JSON_CONNECTION */
18987 e = 0;
18988 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
18989 if (e) {
18990 log_packet_detailed("'city_id' field error detected");
18991 }
18992 }
18993 if (BV_ISSET(fields, 1)) {
18994 log_packet_detailed(" field 'tile_id' has changed");
18995#ifdef FREECIV_JSON_CONNECTION
18996 field_addr.name = "tile_id";
18997#endif /* FREECIV_JSON_CONNECTION */
18998 e = 0;
18999 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19000 if (e) {
19001 log_packet_detailed("'tile_id' field error detected");
19002 }
19003 }
19004
19005 *old = *real_packet;
19006#endif /* FREECIV_DELTA_PROTOCOL */
19007#ifndef FREECIV_DELTA_PROTOCOL
19008#ifdef FREECIV_JSON_CONNECTION
19009 field_addr.name = "city_id";
19010#endif /* FREECIV_JSON_CONNECTION */
19011 e = 0;
19012 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19013 if (e) {
19014 log_packet_detailed("'city_id' field error detected");
19015 }
19016#ifdef FREECIV_JSON_CONNECTION
19017 field_addr.name = "tile_id";
19018#endif /* FREECIV_JSON_CONNECTION */
19019 e = 0;
19020 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19021 if (e) {
19022 log_packet_detailed("'tile_id' field error detected");
19023 }
19024
19025#endif
19026 SEND_PACKET_END(PACKET_CITY_MAKE_SPECIALIST);
19027}
19028
19029 int send_packet_city_make_specialist(struct connection *pc, const struct packet_city_make_specialist *packet)
19030{
19031 if (!pc->used) {
19032 log_error("WARNING: trying to send data to the closed connection %s",
19033 conn_description(pc));
19034 return -1;
19035 }
19036 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_MAKE_SPECIALIST].packet != NULL, -1,
19037 "Handler for PACKET_CITY_MAKE_SPECIALIST not installed");
19038 return pc->phs.handlers->send[PACKET_CITY_MAKE_SPECIALIST].packet(pc, packet);
19039}
19040
19041 int dsend_packet_city_make_specialist(struct connection *pc, int city_id, int tile_id)
19042{
19043 struct packet_city_make_specialist packet, *real_packet = &packet;
19044
19045 real_packet->city_id = city_id;
19046 real_packet->tile_id = tile_id;
19047
19048 return send_packet_city_make_specialist(pc, real_packet);
19049}
19050
19051#ifdef FREECIV_DELTA_PROTOCOL
19052#define hash_packet_city_make_worker_100 hash_const
19053
19054#define cmp_packet_city_make_worker_100 cmp_const
19055
19056 BV_DEFINE(packet_city_make_worker_100_fields, 2);
19057#endif /* FREECIV_DELTA_PROTOCOL */
19058
19059 static struct packet_city_make_worker *receive_packet_city_make_worker_100(struct connection *pc)
19060{
19061#ifdef FREECIV_DELTA_PROTOCOL
19062 packet_city_make_worker_100_fields fields;
19063 struct packet_city_make_worker *old;
19064 struct genhash **hash = pc->phs.received + PACKET_CITY_MAKE_WORKER;
19065#endif /* FREECIV_DELTA_PROTOCOL */
19066 RECEIVE_PACKET_START(packet_city_make_worker, real_packet);
19067#ifdef FREECIV_JSON_CONNECTION
19068 struct plocation field_addr;
19069 {
19070 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19071 field_addr = *field_addr_tmp;
19072 FC_FREE(field_addr_tmp);
19073 }
19074#endif /* FREECIV_JSON_CONNECTION */
19075
19076#ifdef FREECIV_DELTA_PROTOCOL
19077#ifdef FREECIV_JSON_CONNECTION
19078 field_addr.name = "fields";
19079#endif /* FREECIV_JSON_CONNECTION */
19080 DIO_BV_GET(&din, &field_addr, fields);
19081
19082#else /* FREECIV_DELTA_PROTOCOL */
19083#ifdef FREECIV_JSON_CONNECTION
19084 field_addr.name = "city_id";
19085#endif /* FREECIV_JSON_CONNECTION */
19086 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19087 RECEIVE_PACKET_FIELD_ERROR(city_id);
19088 }
19089#ifdef FREECIV_JSON_CONNECTION
19090 field_addr.name = "tile_id";
19091#endif /* FREECIV_JSON_CONNECTION */
19092 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
19093 RECEIVE_PACKET_FIELD_ERROR(tile_id);
19094 }
19095#endif
19096 log_packet_detailed("packet_city_make_worker_100: got info about ()");
19097
19098#ifdef FREECIV_DELTA_PROTOCOL
19099 if (NULL == *hash) {
19100 *hash = genhash_new_full(hash_packet_city_make_worker_100, cmp_packet_city_make_worker_100,
19101 NULL, NULL, NULL, free);
19102 }
19103
19104 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19105 *real_packet = *old;
19106 } else {
19107 log_packet_detailed(" no old info");
19108 memset(real_packet, 0, sizeof(*real_packet));
19109 }
19110
19111 if (BV_ISSET(fields, 0)) {
19112 log_packet_detailed(" got field 'city_id'");
19113#ifdef FREECIV_JSON_CONNECTION
19114 field_addr.name = "city_id";
19115#endif /* FREECIV_JSON_CONNECTION */
19116 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19117 RECEIVE_PACKET_FIELD_ERROR(city_id);
19118 }
19119 }
19120 if (BV_ISSET(fields, 1)) {
19121 log_packet_detailed(" got field 'tile_id'");
19122#ifdef FREECIV_JSON_CONNECTION
19123 field_addr.name = "tile_id";
19124#endif /* FREECIV_JSON_CONNECTION */
19125 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
19126 RECEIVE_PACKET_FIELD_ERROR(tile_id);
19127 }
19128 }
19129
19130 if (NULL == old) {
19131 old = fc_malloc(sizeof(*old));
19132 *old = *real_packet;
19133 genhash_insert(*hash, old, old);
19134 } else {
19135 *old = *real_packet;
19136 }
19137
19138#endif /* FREECIV_DELTA_PROTOCOL */
19139 RECEIVE_PACKET_END(real_packet);
19140}
19141
19142 static int send_packet_city_make_worker_100(struct connection *pc, const struct packet_city_make_worker *packet)
19143{
19144 const struct packet_city_make_worker *real_packet = packet;
19145 int e;
19146#ifdef FREECIV_DELTA_PROTOCOL
19147 packet_city_make_worker_100_fields fields;
19148 struct packet_city_make_worker *old;
19149 bool differ;
19150 struct genhash **hash = pc->phs.sent + PACKET_CITY_MAKE_WORKER;
19151#endif /* FREECIV_DELTA_PROTOCOL */
19152 SEND_PACKET_START(PACKET_CITY_MAKE_WORKER);
19153#ifdef FREECIV_JSON_CONNECTION
19154 struct plocation field_addr;
19155 {
19156 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19157 field_addr = *field_addr_tmp;
19158 FC_FREE(field_addr_tmp);
19159 }
19160#endif /* FREECIV_JSON_CONNECTION */
19161
19162 log_packet_detailed("packet_city_make_worker_100: sending info about ()");
19163
19164#ifdef FREECIV_DELTA_PROTOCOL
19165 if (NULL == *hash) {
19166 *hash = genhash_new_full(hash_packet_city_make_worker_100, cmp_packet_city_make_worker_100,
19167 NULL, NULL, NULL, free);
19168 }
19169 BV_CLR_ALL(fields);
19170
19171 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19172 old = fc_malloc(sizeof(*old));
19173 *old = *real_packet;
19174 genhash_insert(*hash, old, old);
19175 memset(old, 0, sizeof(*old));
19176 }
19177 differ = (old->city_id != real_packet->city_id);
19178 if (differ) {
19179 BV_SET(fields, 0);
19180 }
19181
19182 differ = (old->tile_id != real_packet->tile_id);
19183 if (differ) {
19184 BV_SET(fields, 1);
19185 }
19186
19187
19188#ifdef FREECIV_JSON_CONNECTION
19189 field_addr.name = "fields";
19190#endif /* FREECIV_JSON_CONNECTION */
19191 e = 0;
19192 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19193 if (e) {
19194 log_packet_detailed("fields bitvector error detected");
19195 }
19196
19197 if (BV_ISSET(fields, 0)) {
19198 log_packet_detailed(" field 'city_id' has changed");
19199#ifdef FREECIV_JSON_CONNECTION
19200 field_addr.name = "city_id";
19201#endif /* FREECIV_JSON_CONNECTION */
19202 e = 0;
19203 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19204 if (e) {
19205 log_packet_detailed("'city_id' field error detected");
19206 }
19207 }
19208 if (BV_ISSET(fields, 1)) {
19209 log_packet_detailed(" field 'tile_id' has changed");
19210#ifdef FREECIV_JSON_CONNECTION
19211 field_addr.name = "tile_id";
19212#endif /* FREECIV_JSON_CONNECTION */
19213 e = 0;
19214 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19215 if (e) {
19216 log_packet_detailed("'tile_id' field error detected");
19217 }
19218 }
19219
19220 *old = *real_packet;
19221#endif /* FREECIV_DELTA_PROTOCOL */
19222#ifndef FREECIV_DELTA_PROTOCOL
19223#ifdef FREECIV_JSON_CONNECTION
19224 field_addr.name = "city_id";
19225#endif /* FREECIV_JSON_CONNECTION */
19226 e = 0;
19227 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19228 if (e) {
19229 log_packet_detailed("'city_id' field error detected");
19230 }
19231#ifdef FREECIV_JSON_CONNECTION
19232 field_addr.name = "tile_id";
19233#endif /* FREECIV_JSON_CONNECTION */
19234 e = 0;
19235 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
19236 if (e) {
19237 log_packet_detailed("'tile_id' field error detected");
19238 }
19239
19240#endif
19241 SEND_PACKET_END(PACKET_CITY_MAKE_WORKER);
19242}
19243
19244 int send_packet_city_make_worker(struct connection *pc, const struct packet_city_make_worker *packet)
19245{
19246 if (!pc->used) {
19247 log_error("WARNING: trying to send data to the closed connection %s",
19248 conn_description(pc));
19249 return -1;
19250 }
19251 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_MAKE_WORKER].packet != NULL, -1,
19252 "Handler for PACKET_CITY_MAKE_WORKER not installed");
19253 return pc->phs.handlers->send[PACKET_CITY_MAKE_WORKER].packet(pc, packet);
19254}
19255
19256 int dsend_packet_city_make_worker(struct connection *pc, int city_id, int tile_id)
19257{
19258 struct packet_city_make_worker packet, *real_packet = &packet;
19259
19260 real_packet->city_id = city_id;
19261 real_packet->tile_id = tile_id;
19262
19263 return send_packet_city_make_worker(pc, real_packet);
19264}
19265
19266#ifdef FREECIV_DELTA_PROTOCOL
19267#define hash_packet_city_change_specialist_100 hash_const
19268
19269#define cmp_packet_city_change_specialist_100 cmp_const
19270
19271 BV_DEFINE(packet_city_change_specialist_100_fields, 3);
19272#endif /* FREECIV_DELTA_PROTOCOL */
19273
19274 static struct packet_city_change_specialist *receive_packet_city_change_specialist_100(struct connection *pc)
19275{
19276#ifdef FREECIV_DELTA_PROTOCOL
19277 packet_city_change_specialist_100_fields fields;
19278 struct packet_city_change_specialist *old;
19279 struct genhash **hash = pc->phs.received + PACKET_CITY_CHANGE_SPECIALIST;
19280#endif /* FREECIV_DELTA_PROTOCOL */
19281 RECEIVE_PACKET_START(packet_city_change_specialist, real_packet);
19282#ifdef FREECIV_JSON_CONNECTION
19283 struct plocation field_addr;
19284 {
19285 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19286 field_addr = *field_addr_tmp;
19287 FC_FREE(field_addr_tmp);
19288 }
19289#endif /* FREECIV_JSON_CONNECTION */
19290
19291#ifdef FREECIV_DELTA_PROTOCOL
19292#ifdef FREECIV_JSON_CONNECTION
19293 field_addr.name = "fields";
19294#endif /* FREECIV_JSON_CONNECTION */
19295 DIO_BV_GET(&din, &field_addr, fields);
19296
19297#else /* FREECIV_DELTA_PROTOCOL */
19298#ifdef FREECIV_JSON_CONNECTION
19299 field_addr.name = "city_id";
19300#endif /* FREECIV_JSON_CONNECTION */
19301 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19302 RECEIVE_PACKET_FIELD_ERROR(city_id);
19303 }
19304#ifdef FREECIV_JSON_CONNECTION
19305 field_addr.name = "from";
19306#endif /* FREECIV_JSON_CONNECTION */
19307 {
19308 int readin;
19309
19310 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19311 RECEIVE_PACKET_FIELD_ERROR(from);
19312 }
19313 real_packet->from = readin;
19314 }
19315#ifdef FREECIV_JSON_CONNECTION
19316 field_addr.name = "to";
19317#endif /* FREECIV_JSON_CONNECTION */
19318 {
19319 int readin;
19320
19321 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19322 RECEIVE_PACKET_FIELD_ERROR(to);
19323 }
19324 real_packet->to = readin;
19325 }
19326#endif
19327 log_packet_detailed("packet_city_change_specialist_100: got info about ()");
19328
19329#ifdef FREECIV_DELTA_PROTOCOL
19330 if (NULL == *hash) {
19331 *hash = genhash_new_full(hash_packet_city_change_specialist_100, cmp_packet_city_change_specialist_100,
19332 NULL, NULL, NULL, free);
19333 }
19334
19335 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19336 *real_packet = *old;
19337 } else {
19338 log_packet_detailed(" no old info");
19339 memset(real_packet, 0, sizeof(*real_packet));
19340 }
19341
19342 if (BV_ISSET(fields, 0)) {
19343 log_packet_detailed(" got field 'city_id'");
19344#ifdef FREECIV_JSON_CONNECTION
19345 field_addr.name = "city_id";
19346#endif /* FREECIV_JSON_CONNECTION */
19347 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19348 RECEIVE_PACKET_FIELD_ERROR(city_id);
19349 }
19350 }
19351 if (BV_ISSET(fields, 1)) {
19352 log_packet_detailed(" got field 'from'");
19353#ifdef FREECIV_JSON_CONNECTION
19354 field_addr.name = "from";
19355#endif /* FREECIV_JSON_CONNECTION */
19356 {
19357 int readin;
19358
19359 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19360 RECEIVE_PACKET_FIELD_ERROR(from);
19361 }
19362 real_packet->from = readin;
19363 }
19364 }
19365 if (BV_ISSET(fields, 2)) {
19366 log_packet_detailed(" got field 'to'");
19367#ifdef FREECIV_JSON_CONNECTION
19368 field_addr.name = "to";
19369#endif /* FREECIV_JSON_CONNECTION */
19370 {
19371 int readin;
19372
19373 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
19374 RECEIVE_PACKET_FIELD_ERROR(to);
19375 }
19376 real_packet->to = readin;
19377 }
19378 }
19379
19380 if (NULL == old) {
19381 old = fc_malloc(sizeof(*old));
19382 *old = *real_packet;
19383 genhash_insert(*hash, old, old);
19384 } else {
19385 *old = *real_packet;
19386 }
19387
19388#endif /* FREECIV_DELTA_PROTOCOL */
19389 RECEIVE_PACKET_END(real_packet);
19390}
19391
19392 static int send_packet_city_change_specialist_100(struct connection *pc, const struct packet_city_change_specialist *packet)
19393{
19394 const struct packet_city_change_specialist *real_packet = packet;
19395 int e;
19396#ifdef FREECIV_DELTA_PROTOCOL
19397 packet_city_change_specialist_100_fields fields;
19398 struct packet_city_change_specialist *old;
19399 bool differ;
19400 struct genhash **hash = pc->phs.sent + PACKET_CITY_CHANGE_SPECIALIST;
19401#endif /* FREECIV_DELTA_PROTOCOL */
19402 SEND_PACKET_START(PACKET_CITY_CHANGE_SPECIALIST);
19403#ifdef FREECIV_JSON_CONNECTION
19404 struct plocation field_addr;
19405 {
19406 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19407 field_addr = *field_addr_tmp;
19408 FC_FREE(field_addr_tmp);
19409 }
19410#endif /* FREECIV_JSON_CONNECTION */
19411
19412 log_packet_detailed("packet_city_change_specialist_100: sending info about ()");
19413
19414#ifdef FREECIV_DELTA_PROTOCOL
19415 if (NULL == *hash) {
19416 *hash = genhash_new_full(hash_packet_city_change_specialist_100, cmp_packet_city_change_specialist_100,
19417 NULL, NULL, NULL, free);
19418 }
19419 BV_CLR_ALL(fields);
19420
19421 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19422 old = fc_malloc(sizeof(*old));
19423 *old = *real_packet;
19424 genhash_insert(*hash, old, old);
19425 memset(old, 0, sizeof(*old));
19426 }
19427 differ = (old->city_id != real_packet->city_id);
19428 if (differ) {
19429 BV_SET(fields, 0);
19430 }
19431
19432 differ = (old->from != real_packet->from);
19433 if (differ) {
19434 BV_SET(fields, 1);
19435 }
19436
19437 differ = (old->to != real_packet->to);
19438 if (differ) {
19439 BV_SET(fields, 2);
19440 }
19441
19442
19443#ifdef FREECIV_JSON_CONNECTION
19444 field_addr.name = "fields";
19445#endif /* FREECIV_JSON_CONNECTION */
19446 e = 0;
19447 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19448 if (e) {
19449 log_packet_detailed("fields bitvector error detected");
19450 }
19451
19452 if (BV_ISSET(fields, 0)) {
19453 log_packet_detailed(" field 'city_id' has changed");
19454#ifdef FREECIV_JSON_CONNECTION
19455 field_addr.name = "city_id";
19456#endif /* FREECIV_JSON_CONNECTION */
19457 e = 0;
19458 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19459 if (e) {
19460 log_packet_detailed("'city_id' field error detected");
19461 }
19462 }
19463 if (BV_ISSET(fields, 1)) {
19464 log_packet_detailed(" field 'from' has changed");
19465#ifdef FREECIV_JSON_CONNECTION
19466 field_addr.name = "from";
19467#endif /* FREECIV_JSON_CONNECTION */
19468 e = 0;
19469 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
19470 if (e) {
19471 log_packet_detailed("'from' field error detected");
19472 }
19473 }
19474 if (BV_ISSET(fields, 2)) {
19475 log_packet_detailed(" field 'to' has changed");
19476#ifdef FREECIV_JSON_CONNECTION
19477 field_addr.name = "to";
19478#endif /* FREECIV_JSON_CONNECTION */
19479 e = 0;
19480 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
19481 if (e) {
19482 log_packet_detailed("'to' field error detected");
19483 }
19484 }
19485
19486 *old = *real_packet;
19487#endif /* FREECIV_DELTA_PROTOCOL */
19488#ifndef FREECIV_DELTA_PROTOCOL
19489#ifdef FREECIV_JSON_CONNECTION
19490 field_addr.name = "city_id";
19491#endif /* FREECIV_JSON_CONNECTION */
19492 e = 0;
19493 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19494 if (e) {
19495 log_packet_detailed("'city_id' field error detected");
19496 }
19497#ifdef FREECIV_JSON_CONNECTION
19498 field_addr.name = "from";
19499#endif /* FREECIV_JSON_CONNECTION */
19500 e = 0;
19501 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->from);
19502 if (e) {
19503 log_packet_detailed("'from' field error detected");
19504 }
19505#ifdef FREECIV_JSON_CONNECTION
19506 field_addr.name = "to";
19507#endif /* FREECIV_JSON_CONNECTION */
19508 e = 0;
19509 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->to);
19510 if (e) {
19511 log_packet_detailed("'to' field error detected");
19512 }
19513
19514#endif
19515 SEND_PACKET_END(PACKET_CITY_CHANGE_SPECIALIST);
19516}
19517
19518 int send_packet_city_change_specialist(struct connection *pc, const struct packet_city_change_specialist *packet)
19519{
19520 if (!pc->used) {
19521 log_error("WARNING: trying to send data to the closed connection %s",
19522 conn_description(pc));
19523 return -1;
19524 }
19525 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet != NULL, -1,
19526 "Handler for PACKET_CITY_CHANGE_SPECIALIST not installed");
19527 return pc->phs.handlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet(pc, packet);
19528}
19529
19530 int dsend_packet_city_change_specialist(struct connection *pc, int city_id, Specialist_type_id from, Specialist_type_id to)
19531{
19532 struct packet_city_change_specialist packet, *real_packet = &packet;
19533
19534 real_packet->city_id = city_id;
19535 real_packet->from = from;
19536 real_packet->to = to;
19537
19538 return send_packet_city_change_specialist(pc, real_packet);
19539}
19540
19541#ifdef FREECIV_DELTA_PROTOCOL
19542#define hash_packet_city_rename_100 hash_const
19543
19544#define cmp_packet_city_rename_100 cmp_const
19545
19546 BV_DEFINE(packet_city_rename_100_fields, 2);
19547#endif /* FREECIV_DELTA_PROTOCOL */
19548
19549 static struct packet_city_rename *receive_packet_city_rename_100(struct connection *pc)
19550{
19551#ifdef FREECIV_DELTA_PROTOCOL
19552 packet_city_rename_100_fields fields;
19553 struct packet_city_rename *old;
19554 struct genhash **hash = pc->phs.received + PACKET_CITY_RENAME;
19555#endif /* FREECIV_DELTA_PROTOCOL */
19556 RECEIVE_PACKET_START(packet_city_rename, real_packet);
19557#ifdef FREECIV_JSON_CONNECTION
19558 struct plocation field_addr;
19559 {
19560 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19561 field_addr = *field_addr_tmp;
19562 FC_FREE(field_addr_tmp);
19563 }
19564#endif /* FREECIV_JSON_CONNECTION */
19565
19566#ifdef FREECIV_DELTA_PROTOCOL
19567#ifdef FREECIV_JSON_CONNECTION
19568 field_addr.name = "fields";
19569#endif /* FREECIV_JSON_CONNECTION */
19570 DIO_BV_GET(&din, &field_addr, fields);
19571
19572#else /* FREECIV_DELTA_PROTOCOL */
19573#ifdef FREECIV_JSON_CONNECTION
19574 field_addr.name = "city_id";
19575#endif /* FREECIV_JSON_CONNECTION */
19576 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19577 RECEIVE_PACKET_FIELD_ERROR(city_id);
19578 }
19579#ifdef FREECIV_JSON_CONNECTION
19580 field_addr.name = "name";
19581#endif /* FREECIV_JSON_CONNECTION */
19582 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
19583 RECEIVE_PACKET_FIELD_ERROR(name);
19584 }
19585#endif
19586 log_packet_detailed("packet_city_rename_100: got info about ()");
19587
19588#ifdef FREECIV_DELTA_PROTOCOL
19589 if (NULL == *hash) {
19590 *hash = genhash_new_full(hash_packet_city_rename_100, cmp_packet_city_rename_100,
19591 NULL, NULL, NULL, free);
19592 }
19593
19594 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19595 *real_packet = *old;
19596 } else {
19597 log_packet_detailed(" no old info");
19598 memset(real_packet, 0, sizeof(*real_packet));
19599 }
19600
19601 if (BV_ISSET(fields, 0)) {
19602 log_packet_detailed(" got field 'city_id'");
19603#ifdef FREECIV_JSON_CONNECTION
19604 field_addr.name = "city_id";
19605#endif /* FREECIV_JSON_CONNECTION */
19606 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19607 RECEIVE_PACKET_FIELD_ERROR(city_id);
19608 }
19609 }
19610 if (BV_ISSET(fields, 1)) {
19611 log_packet_detailed(" got field 'name'");
19612#ifdef FREECIV_JSON_CONNECTION
19613 field_addr.name = "name";
19614#endif /* FREECIV_JSON_CONNECTION */
19615 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
19616 RECEIVE_PACKET_FIELD_ERROR(name);
19617 }
19618 }
19619
19620 if (NULL == old) {
19621 old = fc_malloc(sizeof(*old));
19622 *old = *real_packet;
19623 genhash_insert(*hash, old, old);
19624 } else {
19625 *old = *real_packet;
19626 }
19627
19628#endif /* FREECIV_DELTA_PROTOCOL */
19629 RECEIVE_PACKET_END(real_packet);
19630}
19631
19632 static int send_packet_city_rename_100(struct connection *pc, const struct packet_city_rename *packet)
19633{
19634 const struct packet_city_rename *real_packet = packet;
19635 int e;
19636#ifdef FREECIV_DELTA_PROTOCOL
19637 packet_city_rename_100_fields fields;
19638 struct packet_city_rename *old;
19639 bool differ;
19640 struct genhash **hash = pc->phs.sent + PACKET_CITY_RENAME;
19641#endif /* FREECIV_DELTA_PROTOCOL */
19642 SEND_PACKET_START(PACKET_CITY_RENAME);
19643#ifdef FREECIV_JSON_CONNECTION
19644 struct plocation field_addr;
19645 {
19646 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19647 field_addr = *field_addr_tmp;
19648 FC_FREE(field_addr_tmp);
19649 }
19650#endif /* FREECIV_JSON_CONNECTION */
19651
19652 log_packet_detailed("packet_city_rename_100: sending info about ()");
19653
19654#ifdef FREECIV_DELTA_PROTOCOL
19655 if (NULL == *hash) {
19656 *hash = genhash_new_full(hash_packet_city_rename_100, cmp_packet_city_rename_100,
19657 NULL, NULL, NULL, free);
19658 }
19659 BV_CLR_ALL(fields);
19660
19661 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19662 old = fc_malloc(sizeof(*old));
19663 *old = *real_packet;
19664 genhash_insert(*hash, old, old);
19665 memset(old, 0, sizeof(*old));
19666 }
19667 differ = (old->city_id != real_packet->city_id);
19668 if (differ) {
19669 BV_SET(fields, 0);
19670 }
19671
19672 differ = (strcmp(old->name, real_packet->name) != 0);
19673 if (differ) {
19674 BV_SET(fields, 1);
19675 }
19676
19677
19678#ifdef FREECIV_JSON_CONNECTION
19679 field_addr.name = "fields";
19680#endif /* FREECIV_JSON_CONNECTION */
19681 e = 0;
19682 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19683 if (e) {
19684 log_packet_detailed("fields bitvector error detected");
19685 }
19686
19687 if (BV_ISSET(fields, 0)) {
19688 log_packet_detailed(" field 'city_id' has changed");
19689#ifdef FREECIV_JSON_CONNECTION
19690 field_addr.name = "city_id";
19691#endif /* FREECIV_JSON_CONNECTION */
19692 e = 0;
19693 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19694 if (e) {
19695 log_packet_detailed("'city_id' field error detected");
19696 }
19697 }
19698 if (BV_ISSET(fields, 1)) {
19699 log_packet_detailed(" field 'name' has changed");
19700#ifdef FREECIV_JSON_CONNECTION
19701 field_addr.name = "name";
19702#endif /* FREECIV_JSON_CONNECTION */
19703 e = 0;
19704 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
19705 if (e) {
19706 log_packet_detailed("'name' field error detected");
19707 }
19708 }
19709
19710 *old = *real_packet;
19711#endif /* FREECIV_DELTA_PROTOCOL */
19712#ifndef FREECIV_DELTA_PROTOCOL
19713#ifdef FREECIV_JSON_CONNECTION
19714 field_addr.name = "city_id";
19715#endif /* FREECIV_JSON_CONNECTION */
19716 e = 0;
19717 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19718 if (e) {
19719 log_packet_detailed("'city_id' field error detected");
19720 }
19721#ifdef FREECIV_JSON_CONNECTION
19722 field_addr.name = "name";
19723#endif /* FREECIV_JSON_CONNECTION */
19724 e = 0;
19725 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
19726 if (e) {
19727 log_packet_detailed("'name' field error detected");
19728 }
19729
19730#endif
19731 SEND_PACKET_END(PACKET_CITY_RENAME);
19732}
19733
19734 int send_packet_city_rename(struct connection *pc, const struct packet_city_rename *packet)
19735{
19736 if (!pc->used) {
19737 log_error("WARNING: trying to send data to the closed connection %s",
19738 conn_description(pc));
19739 return -1;
19740 }
19741 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_RENAME].packet != NULL, -1,
19742 "Handler for PACKET_CITY_RENAME not installed");
19743 return pc->phs.handlers->send[PACKET_CITY_RENAME].packet(pc, packet);
19744}
19745
19746 int dsend_packet_city_rename(struct connection *pc, int city_id, const char *name)
19747{
19748 struct packet_city_rename packet, *real_packet = &packet;
19749
19750 real_packet->city_id = city_id;
19751 sz_strlcpy(real_packet->name, name);
19752
19753 return send_packet_city_rename(pc, real_packet);
19754}
19755
19756#ifdef FREECIV_DELTA_PROTOCOL
19757#define hash_packet_city_options_req_100 hash_const
19758
19759#define cmp_packet_city_options_req_100 cmp_const
19760
19761 BV_DEFINE(packet_city_options_req_100_fields, 2);
19762#endif /* FREECIV_DELTA_PROTOCOL */
19763
19764 static struct packet_city_options_req *receive_packet_city_options_req_100(struct connection *pc)
19765{
19766#ifdef FREECIV_DELTA_PROTOCOL
19767 packet_city_options_req_100_fields fields;
19768 struct packet_city_options_req *old;
19769 struct genhash **hash = pc->phs.received + PACKET_CITY_OPTIONS_REQ;
19770#endif /* FREECIV_DELTA_PROTOCOL */
19771 RECEIVE_PACKET_START(packet_city_options_req, real_packet);
19772#ifdef FREECIV_JSON_CONNECTION
19773 struct plocation field_addr;
19774 {
19775 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19776 field_addr = *field_addr_tmp;
19777 FC_FREE(field_addr_tmp);
19778 }
19779#endif /* FREECIV_JSON_CONNECTION */
19780
19781#ifdef FREECIV_DELTA_PROTOCOL
19782#ifdef FREECIV_JSON_CONNECTION
19783 field_addr.name = "fields";
19784#endif /* FREECIV_JSON_CONNECTION */
19785 DIO_BV_GET(&din, &field_addr, fields);
19786
19787#else /* FREECIV_DELTA_PROTOCOL */
19788#ifdef FREECIV_JSON_CONNECTION
19789 field_addr.name = "city_id";
19790#endif /* FREECIV_JSON_CONNECTION */
19791 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19792 RECEIVE_PACKET_FIELD_ERROR(city_id);
19793 }
19794#ifdef FREECIV_JSON_CONNECTION
19795 field_addr.name = "options";
19796#endif /* FREECIV_JSON_CONNECTION */
19797 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
19798 RECEIVE_PACKET_FIELD_ERROR(options);
19799 }
19800#endif
19801 log_packet_detailed("packet_city_options_req_100: got info about ()");
19802
19803#ifdef FREECIV_DELTA_PROTOCOL
19804 if (NULL == *hash) {
19805 *hash = genhash_new_full(hash_packet_city_options_req_100, cmp_packet_city_options_req_100,
19806 NULL, NULL, NULL, free);
19807 }
19808
19809 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
19810 *real_packet = *old;
19811 } else {
19812 log_packet_detailed(" no old info");
19813 memset(real_packet, 0, sizeof(*real_packet));
19814 }
19815
19816 if (BV_ISSET(fields, 0)) {
19817 log_packet_detailed(" got field 'city_id'");
19818#ifdef FREECIV_JSON_CONNECTION
19819 field_addr.name = "city_id";
19820#endif /* FREECIV_JSON_CONNECTION */
19821 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
19822 RECEIVE_PACKET_FIELD_ERROR(city_id);
19823 }
19824 }
19825 if (BV_ISSET(fields, 1)) {
19826 log_packet_detailed(" got field 'options'");
19827#ifdef FREECIV_JSON_CONNECTION
19828 field_addr.name = "options";
19829#endif /* FREECIV_JSON_CONNECTION */
19830 if (!DIO_BV_GET(&din, &field_addr, real_packet->options)) {
19831 RECEIVE_PACKET_FIELD_ERROR(options);
19832 }
19833 }
19834
19835 if (NULL == old) {
19836 old = fc_malloc(sizeof(*old));
19837 *old = *real_packet;
19838 genhash_insert(*hash, old, old);
19839 } else {
19840 *old = *real_packet;
19841 }
19842
19843#endif /* FREECIV_DELTA_PROTOCOL */
19844 RECEIVE_PACKET_END(real_packet);
19845}
19846
19847 static int send_packet_city_options_req_100(struct connection *pc, const struct packet_city_options_req *packet)
19848{
19849 const struct packet_city_options_req *real_packet = packet;
19850 int e;
19851#ifdef FREECIV_DELTA_PROTOCOL
19852 packet_city_options_req_100_fields fields;
19853 struct packet_city_options_req *old;
19854 bool differ;
19855 struct genhash **hash = pc->phs.sent + PACKET_CITY_OPTIONS_REQ;
19856#endif /* FREECIV_DELTA_PROTOCOL */
19857 SEND_PACKET_START(PACKET_CITY_OPTIONS_REQ);
19858#ifdef FREECIV_JSON_CONNECTION
19859 struct plocation field_addr;
19860 {
19861 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19862 field_addr = *field_addr_tmp;
19863 FC_FREE(field_addr_tmp);
19864 }
19865#endif /* FREECIV_JSON_CONNECTION */
19866
19867 log_packet_detailed("packet_city_options_req_100: sending info about ()");
19868
19869#ifdef FREECIV_DELTA_PROTOCOL
19870 if (NULL == *hash) {
19871 *hash = genhash_new_full(hash_packet_city_options_req_100, cmp_packet_city_options_req_100,
19872 NULL, NULL, NULL, free);
19873 }
19874 BV_CLR_ALL(fields);
19875
19876 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
19877 old = fc_malloc(sizeof(*old));
19878 *old = *real_packet;
19879 genhash_insert(*hash, old, old);
19880 memset(old, 0, sizeof(*old));
19881 }
19882 differ = (old->city_id != real_packet->city_id);
19883 if (differ) {
19884 BV_SET(fields, 0);
19885 }
19886
19887 differ = !BV_ARE_EQUAL(old->options, real_packet->options);
19888 if (differ) {
19889 BV_SET(fields, 1);
19890 }
19891
19892
19893#ifdef FREECIV_JSON_CONNECTION
19894 field_addr.name = "fields";
19895#endif /* FREECIV_JSON_CONNECTION */
19896 e = 0;
19897 e |= DIO_BV_PUT(&dout, &field_addr, fields);
19898 if (e) {
19899 log_packet_detailed("fields bitvector error detected");
19900 }
19901
19902 if (BV_ISSET(fields, 0)) {
19903 log_packet_detailed(" field 'city_id' has changed");
19904#ifdef FREECIV_JSON_CONNECTION
19905 field_addr.name = "city_id";
19906#endif /* FREECIV_JSON_CONNECTION */
19907 e = 0;
19908 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19909 if (e) {
19910 log_packet_detailed("'city_id' field error detected");
19911 }
19912 }
19913 if (BV_ISSET(fields, 1)) {
19914 log_packet_detailed(" field 'options' has changed");
19915#ifdef FREECIV_JSON_CONNECTION
19916 field_addr.name = "options";
19917#endif /* FREECIV_JSON_CONNECTION */
19918 e = 0;
19919 e |= DIO_BV_PUT(&dout, &field_addr, packet->options);
19920 if (e) {
19921 log_packet_detailed("'options' field error detected");
19922 }
19923 }
19924
19925 *old = *real_packet;
19926#endif /* FREECIV_DELTA_PROTOCOL */
19927#ifndef FREECIV_DELTA_PROTOCOL
19928#ifdef FREECIV_JSON_CONNECTION
19929 field_addr.name = "city_id";
19930#endif /* FREECIV_JSON_CONNECTION */
19931 e = 0;
19932 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
19933 if (e) {
19934 log_packet_detailed("'city_id' field error detected");
19935 }
19936#ifdef FREECIV_JSON_CONNECTION
19937 field_addr.name = "options";
19938#endif /* FREECIV_JSON_CONNECTION */
19939 e = 0;
19940 e |= DIO_BV_PUT(&dout, &field_addr, packet->options);
19941 if (e) {
19942 log_packet_detailed("'options' field error detected");
19943 }
19944
19945#endif
19946 SEND_PACKET_END(PACKET_CITY_OPTIONS_REQ);
19947}
19948
19949 int send_packet_city_options_req(struct connection *pc, const struct packet_city_options_req *packet)
19950{
19951 if (!pc->used) {
19952 log_error("WARNING: trying to send data to the closed connection %s",
19953 conn_description(pc));
19954 return -1;
19955 }
19956 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_OPTIONS_REQ].packet != NULL, -1,
19957 "Handler for PACKET_CITY_OPTIONS_REQ not installed");
19958 return pc->phs.handlers->send[PACKET_CITY_OPTIONS_REQ].packet(pc, packet);
19959}
19960
19961 int dsend_packet_city_options_req(struct connection *pc, int city_id, bv_city_options options)
19962{
19963 struct packet_city_options_req packet, *real_packet = &packet;
19964
19965 real_packet->city_id = city_id;
19966 real_packet->options = options;
19967
19968 return send_packet_city_options_req(pc, real_packet);
19969}
19970
19971#ifdef FREECIV_DELTA_PROTOCOL
19972#define hash_packet_city_refresh_100 hash_const
19973
19974#define cmp_packet_city_refresh_100 cmp_const
19975
19976 BV_DEFINE(packet_city_refresh_100_fields, 1);
19977#endif /* FREECIV_DELTA_PROTOCOL */
19978
19979 static struct packet_city_refresh *receive_packet_city_refresh_100(struct connection *pc)
19980{
19981#ifdef FREECIV_DELTA_PROTOCOL
19982 packet_city_refresh_100_fields fields;
19983 struct packet_city_refresh *old;
19984 struct genhash **hash = pc->phs.received + PACKET_CITY_REFRESH;
19985#endif /* FREECIV_DELTA_PROTOCOL */
19986 RECEIVE_PACKET_START(packet_city_refresh, real_packet);
19987#ifdef FREECIV_JSON_CONNECTION
19988 struct plocation field_addr;
19989 {
19990 struct plocation *field_addr_tmp = plocation_field_new(NULL);
19991 field_addr = *field_addr_tmp;
19992 FC_FREE(field_addr_tmp);
19993 }
19994#endif /* FREECIV_JSON_CONNECTION */
19995
19996#ifdef FREECIV_DELTA_PROTOCOL
19997#ifdef FREECIV_JSON_CONNECTION
19998 field_addr.name = "fields";
19999#endif /* FREECIV_JSON_CONNECTION */
20000 DIO_BV_GET(&din, &field_addr, fields);
20001
20002#else /* FREECIV_DELTA_PROTOCOL */
20003#ifdef FREECIV_JSON_CONNECTION
20004 field_addr.name = "city_id";
20005#endif /* FREECIV_JSON_CONNECTION */
20006 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20007 RECEIVE_PACKET_FIELD_ERROR(city_id);
20008 }
20009#endif
20010 log_packet_detailed("packet_city_refresh_100: got info about ()");
20011
20012#ifdef FREECIV_DELTA_PROTOCOL
20013 if (NULL == *hash) {
20014 *hash = genhash_new_full(hash_packet_city_refresh_100, cmp_packet_city_refresh_100,
20015 NULL, NULL, NULL, free);
20016 }
20017
20018 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20019 *real_packet = *old;
20020 } else {
20021 log_packet_detailed(" no old info");
20022 memset(real_packet, 0, sizeof(*real_packet));
20023 }
20024
20025 if (BV_ISSET(fields, 0)) {
20026 log_packet_detailed(" got field 'city_id'");
20027#ifdef FREECIV_JSON_CONNECTION
20028 field_addr.name = "city_id";
20029#endif /* FREECIV_JSON_CONNECTION */
20030 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20031 RECEIVE_PACKET_FIELD_ERROR(city_id);
20032 }
20033 }
20034
20035 if (NULL == old) {
20036 old = fc_malloc(sizeof(*old));
20037 *old = *real_packet;
20038 genhash_insert(*hash, old, old);
20039 } else {
20040 *old = *real_packet;
20041 }
20042
20043#endif /* FREECIV_DELTA_PROTOCOL */
20044 RECEIVE_PACKET_END(real_packet);
20045}
20046
20047 static int send_packet_city_refresh_100(struct connection *pc, const struct packet_city_refresh *packet)
20048{
20049 const struct packet_city_refresh *real_packet = packet;
20050 int e;
20051#ifdef FREECIV_DELTA_PROTOCOL
20052 packet_city_refresh_100_fields fields;
20053 struct packet_city_refresh *old;
20054 bool differ;
20055 struct genhash **hash = pc->phs.sent + PACKET_CITY_REFRESH;
20056#endif /* FREECIV_DELTA_PROTOCOL */
20057 SEND_PACKET_START(PACKET_CITY_REFRESH);
20058#ifdef FREECIV_JSON_CONNECTION
20059 struct plocation field_addr;
20060 {
20061 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20062 field_addr = *field_addr_tmp;
20063 FC_FREE(field_addr_tmp);
20064 }
20065#endif /* FREECIV_JSON_CONNECTION */
20066
20067 log_packet_detailed("packet_city_refresh_100: sending info about ()");
20068
20069#ifdef FREECIV_DELTA_PROTOCOL
20070 if (NULL == *hash) {
20071 *hash = genhash_new_full(hash_packet_city_refresh_100, cmp_packet_city_refresh_100,
20072 NULL, NULL, NULL, free);
20073 }
20074 BV_CLR_ALL(fields);
20075
20076 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20077 old = fc_malloc(sizeof(*old));
20078 *old = *real_packet;
20079 genhash_insert(*hash, old, old);
20080 memset(old, 0, sizeof(*old));
20081 }
20082 differ = (old->city_id != real_packet->city_id);
20083 if (differ) {
20084 BV_SET(fields, 0);
20085 }
20086
20087
20088#ifdef FREECIV_JSON_CONNECTION
20089 field_addr.name = "fields";
20090#endif /* FREECIV_JSON_CONNECTION */
20091 e = 0;
20092 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20093 if (e) {
20094 log_packet_detailed("fields bitvector error detected");
20095 }
20096
20097 if (BV_ISSET(fields, 0)) {
20098 log_packet_detailed(" field 'city_id' has changed");
20099#ifdef FREECIV_JSON_CONNECTION
20100 field_addr.name = "city_id";
20101#endif /* FREECIV_JSON_CONNECTION */
20102 e = 0;
20103 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20104 if (e) {
20105 log_packet_detailed("'city_id' field error detected");
20106 }
20107 }
20108
20109 *old = *real_packet;
20110#endif /* FREECIV_DELTA_PROTOCOL */
20111#ifndef FREECIV_DELTA_PROTOCOL
20112#ifdef FREECIV_JSON_CONNECTION
20113 field_addr.name = "city_id";
20114#endif /* FREECIV_JSON_CONNECTION */
20115 e = 0;
20116 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20117 if (e) {
20118 log_packet_detailed("'city_id' field error detected");
20119 }
20120
20121#endif
20122 SEND_PACKET_END(PACKET_CITY_REFRESH);
20123}
20124
20125 int send_packet_city_refresh(struct connection *pc, const struct packet_city_refresh *packet)
20126{
20127 if (!pc->used) {
20128 log_error("WARNING: trying to send data to the closed connection %s",
20129 conn_description(pc));
20130 return -1;
20131 }
20132 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_REFRESH].packet != NULL, -1,
20133 "Handler for PACKET_CITY_REFRESH not installed");
20134 return pc->phs.handlers->send[PACKET_CITY_REFRESH].packet(pc, packet);
20135}
20136
20137 int dsend_packet_city_refresh(struct connection *pc, int city_id)
20138{
20139 struct packet_city_refresh packet, *real_packet = &packet;
20140
20141 real_packet->city_id = city_id;
20142
20143 return send_packet_city_refresh(pc, real_packet);
20144}
20145
20146#ifdef FREECIV_DELTA_PROTOCOL
20147#define hash_packet_city_name_suggestion_req_100 hash_const
20148
20149#define cmp_packet_city_name_suggestion_req_100 cmp_const
20150
20151 BV_DEFINE(packet_city_name_suggestion_req_100_fields, 1);
20152#endif /* FREECIV_DELTA_PROTOCOL */
20153
20154 static struct packet_city_name_suggestion_req *receive_packet_city_name_suggestion_req_100(struct connection *pc)
20155{
20156#ifdef FREECIV_DELTA_PROTOCOL
20157 packet_city_name_suggestion_req_100_fields fields;
20158 struct packet_city_name_suggestion_req *old;
20159 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_REQ;
20160#endif /* FREECIV_DELTA_PROTOCOL */
20161 RECEIVE_PACKET_START(packet_city_name_suggestion_req, real_packet);
20162#ifdef FREECIV_JSON_CONNECTION
20163 struct plocation field_addr;
20164 {
20165 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20166 field_addr = *field_addr_tmp;
20167 FC_FREE(field_addr_tmp);
20168 }
20169#endif /* FREECIV_JSON_CONNECTION */
20170
20171#ifdef FREECIV_DELTA_PROTOCOL
20172#ifdef FREECIV_JSON_CONNECTION
20173 field_addr.name = "fields";
20174#endif /* FREECIV_JSON_CONNECTION */
20175 DIO_BV_GET(&din, &field_addr, fields);
20176
20177#else /* FREECIV_DELTA_PROTOCOL */
20178#ifdef FREECIV_JSON_CONNECTION
20179 field_addr.name = "unit_id";
20180#endif /* FREECIV_JSON_CONNECTION */
20181 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20182 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20183 }
20184#endif
20185 log_packet_detailed("packet_city_name_suggestion_req_100: got info about ()");
20186
20187#ifdef FREECIV_DELTA_PROTOCOL
20188 if (NULL == *hash) {
20189 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_100, cmp_packet_city_name_suggestion_req_100,
20190 NULL, NULL, NULL, free);
20191 }
20192
20193 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20194 *real_packet = *old;
20195 } else {
20196 log_packet_detailed(" no old info");
20197 memset(real_packet, 0, sizeof(*real_packet));
20198 }
20199
20200 if (BV_ISSET(fields, 0)) {
20201 log_packet_detailed(" got field 'unit_id'");
20202#ifdef FREECIV_JSON_CONNECTION
20203 field_addr.name = "unit_id";
20204#endif /* FREECIV_JSON_CONNECTION */
20205 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20206 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20207 }
20208 }
20209
20210 if (NULL == old) {
20211 old = fc_malloc(sizeof(*old));
20212 *old = *real_packet;
20213 genhash_insert(*hash, old, old);
20214 } else {
20215 *old = *real_packet;
20216 }
20217
20218#endif /* FREECIV_DELTA_PROTOCOL */
20219 RECEIVE_PACKET_END(real_packet);
20220}
20221
20222 static int send_packet_city_name_suggestion_req_100(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
20223{
20224 const struct packet_city_name_suggestion_req *real_packet = packet;
20225 int e;
20226#ifdef FREECIV_DELTA_PROTOCOL
20227 packet_city_name_suggestion_req_100_fields fields;
20228 struct packet_city_name_suggestion_req *old;
20229 bool differ;
20230 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_REQ;
20231#endif /* FREECIV_DELTA_PROTOCOL */
20232 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_REQ);
20233#ifdef FREECIV_JSON_CONNECTION
20234 struct plocation field_addr;
20235 {
20236 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20237 field_addr = *field_addr_tmp;
20238 FC_FREE(field_addr_tmp);
20239 }
20240#endif /* FREECIV_JSON_CONNECTION */
20241
20242 log_packet_detailed("packet_city_name_suggestion_req_100: sending info about ()");
20243
20244#ifdef FREECIV_DELTA_PROTOCOL
20245 if (NULL == *hash) {
20246 *hash = genhash_new_full(hash_packet_city_name_suggestion_req_100, cmp_packet_city_name_suggestion_req_100,
20247 NULL, NULL, NULL, free);
20248 }
20249 BV_CLR_ALL(fields);
20250
20251 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20252 old = fc_malloc(sizeof(*old));
20253 *old = *real_packet;
20254 genhash_insert(*hash, old, old);
20255 memset(old, 0, sizeof(*old));
20256 }
20257 differ = (old->unit_id != real_packet->unit_id);
20258 if (differ) {
20259 BV_SET(fields, 0);
20260 }
20261
20262
20263#ifdef FREECIV_JSON_CONNECTION
20264 field_addr.name = "fields";
20265#endif /* FREECIV_JSON_CONNECTION */
20266 e = 0;
20267 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20268 if (e) {
20269 log_packet_detailed("fields bitvector error detected");
20270 }
20271
20272 if (BV_ISSET(fields, 0)) {
20273 log_packet_detailed(" field 'unit_id' has changed");
20274#ifdef FREECIV_JSON_CONNECTION
20275 field_addr.name = "unit_id";
20276#endif /* FREECIV_JSON_CONNECTION */
20277 e = 0;
20278 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
20279 if (e) {
20280 log_packet_detailed("'unit_id' field error detected");
20281 }
20282 }
20283
20284 *old = *real_packet;
20285#endif /* FREECIV_DELTA_PROTOCOL */
20286#ifndef FREECIV_DELTA_PROTOCOL
20287#ifdef FREECIV_JSON_CONNECTION
20288 field_addr.name = "unit_id";
20289#endif /* FREECIV_JSON_CONNECTION */
20290 e = 0;
20291 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
20292 if (e) {
20293 log_packet_detailed("'unit_id' field error detected");
20294 }
20295
20296#endif
20297 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_REQ);
20298}
20299
20300 int send_packet_city_name_suggestion_req(struct connection *pc, const struct packet_city_name_suggestion_req *packet)
20301{
20302 if (!pc->used) {
20303 log_error("WARNING: trying to send data to the closed connection %s",
20304 conn_description(pc));
20305 return -1;
20306 }
20307 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet != NULL, -1,
20308 "Handler for PACKET_CITY_NAME_SUGGESTION_REQ not installed");
20309 return pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet(pc, packet);
20310}
20311
20312 int dsend_packet_city_name_suggestion_req(struct connection *pc, int unit_id)
20313{
20314 struct packet_city_name_suggestion_req packet, *real_packet = &packet;
20315
20316 real_packet->unit_id = unit_id;
20317
20318 return send_packet_city_name_suggestion_req(pc, real_packet);
20319}
20320
20321#ifdef FREECIV_DELTA_PROTOCOL
20322#define hash_packet_city_name_suggestion_info_100 hash_const
20323
20324#define cmp_packet_city_name_suggestion_info_100 cmp_const
20325
20326 BV_DEFINE(packet_city_name_suggestion_info_100_fields, 2);
20327#endif /* FREECIV_DELTA_PROTOCOL */
20328
20329 static struct packet_city_name_suggestion_info *receive_packet_city_name_suggestion_info_100(struct connection *pc)
20330{
20331#ifdef FREECIV_DELTA_PROTOCOL
20332 packet_city_name_suggestion_info_100_fields fields;
20333 struct packet_city_name_suggestion_info *old;
20334 struct genhash **hash = pc->phs.received + PACKET_CITY_NAME_SUGGESTION_INFO;
20335#endif /* FREECIV_DELTA_PROTOCOL */
20336 RECEIVE_PACKET_START(packet_city_name_suggestion_info, real_packet);
20337#ifdef FREECIV_JSON_CONNECTION
20338 struct plocation field_addr;
20339 {
20340 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20341 field_addr = *field_addr_tmp;
20342 FC_FREE(field_addr_tmp);
20343 }
20344#endif /* FREECIV_JSON_CONNECTION */
20345
20346#ifdef FREECIV_DELTA_PROTOCOL
20347#ifdef FREECIV_JSON_CONNECTION
20348 field_addr.name = "fields";
20349#endif /* FREECIV_JSON_CONNECTION */
20350 DIO_BV_GET(&din, &field_addr, fields);
20351
20352#else /* FREECIV_DELTA_PROTOCOL */
20353#ifdef FREECIV_JSON_CONNECTION
20354 field_addr.name = "unit_id";
20355#endif /* FREECIV_JSON_CONNECTION */
20356 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20357 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20358 }
20359#ifdef FREECIV_JSON_CONNECTION
20360 field_addr.name = "name";
20361#endif /* FREECIV_JSON_CONNECTION */
20362 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
20363 RECEIVE_PACKET_FIELD_ERROR(name);
20364 }
20365#endif
20366 log_packet_detailed("packet_city_name_suggestion_info_100: got info about ()");
20367
20368#ifdef FREECIV_DELTA_PROTOCOL
20369 if (NULL == *hash) {
20370 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_100, cmp_packet_city_name_suggestion_info_100,
20371 NULL, NULL, NULL, free);
20372 }
20373
20374 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20375 *real_packet = *old;
20376 } else {
20377 log_packet_detailed(" no old info");
20378 memset(real_packet, 0, sizeof(*real_packet));
20379 }
20380
20381 if (BV_ISSET(fields, 0)) {
20382 log_packet_detailed(" got field 'unit_id'");
20383#ifdef FREECIV_JSON_CONNECTION
20384 field_addr.name = "unit_id";
20385#endif /* FREECIV_JSON_CONNECTION */
20386 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
20387 RECEIVE_PACKET_FIELD_ERROR(unit_id);
20388 }
20389 }
20390 if (BV_ISSET(fields, 1)) {
20391 log_packet_detailed(" got field 'name'");
20392#ifdef FREECIV_JSON_CONNECTION
20393 field_addr.name = "name";
20394#endif /* FREECIV_JSON_CONNECTION */
20395 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
20396 RECEIVE_PACKET_FIELD_ERROR(name);
20397 }
20398 }
20399
20400 if (NULL == old) {
20401 old = fc_malloc(sizeof(*old));
20402 *old = *real_packet;
20403 genhash_insert(*hash, old, old);
20404 } else {
20405 *old = *real_packet;
20406 }
20407
20408#endif /* FREECIV_DELTA_PROTOCOL */
20409 RECEIVE_PACKET_END(real_packet);
20410}
20411
20412 static int send_packet_city_name_suggestion_info_100(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
20413{
20414 const struct packet_city_name_suggestion_info *real_packet = packet;
20415 int e;
20416#ifdef FREECIV_DELTA_PROTOCOL
20417 packet_city_name_suggestion_info_100_fields fields;
20418 struct packet_city_name_suggestion_info *old;
20419 bool differ;
20420 struct genhash **hash = pc->phs.sent + PACKET_CITY_NAME_SUGGESTION_INFO;
20421#endif /* FREECIV_DELTA_PROTOCOL */
20422 SEND_PACKET_START(PACKET_CITY_NAME_SUGGESTION_INFO);
20423#ifdef FREECIV_JSON_CONNECTION
20424 struct plocation field_addr;
20425 {
20426 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20427 field_addr = *field_addr_tmp;
20428 FC_FREE(field_addr_tmp);
20429 }
20430#endif /* FREECIV_JSON_CONNECTION */
20431
20432 log_packet_detailed("packet_city_name_suggestion_info_100: sending info about ()");
20433
20434#ifdef FREECIV_DELTA_PROTOCOL
20435 if (NULL == *hash) {
20436 *hash = genhash_new_full(hash_packet_city_name_suggestion_info_100, cmp_packet_city_name_suggestion_info_100,
20437 NULL, NULL, NULL, free);
20438 }
20439 BV_CLR_ALL(fields);
20440
20441 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20442 old = fc_malloc(sizeof(*old));
20443 *old = *real_packet;
20444 genhash_insert(*hash, old, old);
20445 memset(old, 0, sizeof(*old));
20446 }
20447 differ = (old->unit_id != real_packet->unit_id);
20448 if (differ) {
20449 BV_SET(fields, 0);
20450 }
20451
20452 differ = (strcmp(old->name, real_packet->name) != 0);
20453 if (differ) {
20454 BV_SET(fields, 1);
20455 }
20456
20457
20458#ifdef FREECIV_JSON_CONNECTION
20459 field_addr.name = "fields";
20460#endif /* FREECIV_JSON_CONNECTION */
20461 e = 0;
20462 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20463 if (e) {
20464 log_packet_detailed("fields bitvector error detected");
20465 }
20466
20467 if (BV_ISSET(fields, 0)) {
20468 log_packet_detailed(" field 'unit_id' has changed");
20469#ifdef FREECIV_JSON_CONNECTION
20470 field_addr.name = "unit_id";
20471#endif /* FREECIV_JSON_CONNECTION */
20472 e = 0;
20473 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
20474 if (e) {
20475 log_packet_detailed("'unit_id' field error detected");
20476 }
20477 }
20478 if (BV_ISSET(fields, 1)) {
20479 log_packet_detailed(" field 'name' has changed");
20480#ifdef FREECIV_JSON_CONNECTION
20481 field_addr.name = "name";
20482#endif /* FREECIV_JSON_CONNECTION */
20483 e = 0;
20484 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
20485 if (e) {
20486 log_packet_detailed("'name' field error detected");
20487 }
20488 }
20489
20490 *old = *real_packet;
20491#endif /* FREECIV_DELTA_PROTOCOL */
20492#ifndef FREECIV_DELTA_PROTOCOL
20493#ifdef FREECIV_JSON_CONNECTION
20494 field_addr.name = "unit_id";
20495#endif /* FREECIV_JSON_CONNECTION */
20496 e = 0;
20497 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
20498 if (e) {
20499 log_packet_detailed("'unit_id' field error detected");
20500 }
20501#ifdef FREECIV_JSON_CONNECTION
20502 field_addr.name = "name";
20503#endif /* FREECIV_JSON_CONNECTION */
20504 e = 0;
20505 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
20506 if (e) {
20507 log_packet_detailed("'name' field error detected");
20508 }
20509
20510#endif
20511 SEND_PACKET_END(PACKET_CITY_NAME_SUGGESTION_INFO);
20512}
20513
20514 int send_packet_city_name_suggestion_info(struct connection *pc, const struct packet_city_name_suggestion_info *packet)
20515{
20516 if (!pc->used) {
20517 log_error("WARNING: trying to send data to the closed connection %s",
20518 conn_description(pc));
20519 return -1;
20520 }
20521 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet != NULL, -1,
20522 "Handler for PACKET_CITY_NAME_SUGGESTION_INFO not installed");
20523 return pc->phs.handlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet(pc, packet);
20524}
20525
20526 void lsend_packet_city_name_suggestion_info(struct conn_list *dest, const struct packet_city_name_suggestion_info *packet)
20527{
20528 conn_list_iterate(dest, pconn) {
20529 send_packet_city_name_suggestion_info(pconn, packet);
20530 } conn_list_iterate_end;
20531}
20532
20533 int dsend_packet_city_name_suggestion_info(struct connection *pc, int unit_id, const char *name)
20534{
20535 struct packet_city_name_suggestion_info packet, *real_packet = &packet;
20536
20537 real_packet->unit_id = unit_id;
20538 sz_strlcpy(real_packet->name, name);
20539
20540 return send_packet_city_name_suggestion_info(pc, real_packet);
20541}
20542
20543 void dlsend_packet_city_name_suggestion_info(struct conn_list *dest, int unit_id, const char *name)
20544{
20545 struct packet_city_name_suggestion_info packet, *real_packet = &packet;
20546
20547 real_packet->unit_id = unit_id;
20548 sz_strlcpy(real_packet->name, name);
20549
20550 lsend_packet_city_name_suggestion_info(dest, real_packet);
20551}
20552
20553#ifdef FREECIV_DELTA_PROTOCOL
20554#define hash_packet_city_sabotage_list_100 hash_const
20555
20556#define cmp_packet_city_sabotage_list_100 cmp_const
20557
20558 BV_DEFINE(packet_city_sabotage_list_100_fields, 5);
20559#endif /* FREECIV_DELTA_PROTOCOL */
20560
20561 static struct packet_city_sabotage_list *receive_packet_city_sabotage_list_100(struct connection *pc)
20562{
20563#ifdef FREECIV_DELTA_PROTOCOL
20564 packet_city_sabotage_list_100_fields fields;
20565 struct packet_city_sabotage_list *old;
20566 struct genhash **hash = pc->phs.received + PACKET_CITY_SABOTAGE_LIST;
20567#endif /* FREECIV_DELTA_PROTOCOL */
20568 RECEIVE_PACKET_START(packet_city_sabotage_list, real_packet);
20569#ifdef FREECIV_JSON_CONNECTION
20570 struct plocation field_addr;
20571 {
20572 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20573 field_addr = *field_addr_tmp;
20574 FC_FREE(field_addr_tmp);
20575 }
20576#endif /* FREECIV_JSON_CONNECTION */
20577
20578#ifdef FREECIV_DELTA_PROTOCOL
20579#ifdef FREECIV_JSON_CONNECTION
20580 field_addr.name = "fields";
20581#endif /* FREECIV_JSON_CONNECTION */
20582 DIO_BV_GET(&din, &field_addr, fields);
20583
20584#else /* FREECIV_DELTA_PROTOCOL */
20585#ifdef FREECIV_JSON_CONNECTION
20586 field_addr.name = "actor_id";
20587#endif /* FREECIV_JSON_CONNECTION */
20588 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
20589 RECEIVE_PACKET_FIELD_ERROR(actor_id);
20590 }
20591#ifdef FREECIV_JSON_CONNECTION
20592 field_addr.name = "city_id";
20593#endif /* FREECIV_JSON_CONNECTION */
20594 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20595 RECEIVE_PACKET_FIELD_ERROR(city_id);
20596 }
20597#ifdef FREECIV_JSON_CONNECTION
20598 field_addr.name = "improvements";
20599#endif /* FREECIV_JSON_CONNECTION */
20600 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
20601 RECEIVE_PACKET_FIELD_ERROR(improvements);
20602 }
20603#ifdef FREECIV_JSON_CONNECTION
20604 field_addr.name = "act_id";
20605#endif /* FREECIV_JSON_CONNECTION */
20606 {
20607 int readin;
20608
20609 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
20610 RECEIVE_PACKET_FIELD_ERROR(act_id);
20611 }
20612 real_packet->act_id = readin;
20613 }
20614#ifdef FREECIV_JSON_CONNECTION
20615 field_addr.name = "request_kind";
20616#endif /* FREECIV_JSON_CONNECTION */
20617 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
20618 RECEIVE_PACKET_FIELD_ERROR(request_kind);
20619 }
20620#endif
20621 log_packet_detailed("packet_city_sabotage_list_100: got info about ()");
20622
20623#ifdef FREECIV_DELTA_PROTOCOL
20624 if (NULL == *hash) {
20625 *hash = genhash_new_full(hash_packet_city_sabotage_list_100, cmp_packet_city_sabotage_list_100,
20626 NULL, NULL, NULL, free);
20627 }
20628
20629 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20630 *real_packet = *old;
20631 } else {
20632 log_packet_detailed(" no old info");
20633 memset(real_packet, 0, sizeof(*real_packet));
20634 }
20635
20636 if (BV_ISSET(fields, 0)) {
20637 log_packet_detailed(" got field 'actor_id'");
20638#ifdef FREECIV_JSON_CONNECTION
20639 field_addr.name = "actor_id";
20640#endif /* FREECIV_JSON_CONNECTION */
20641 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
20642 RECEIVE_PACKET_FIELD_ERROR(actor_id);
20643 }
20644 }
20645 if (BV_ISSET(fields, 1)) {
20646 log_packet_detailed(" got field 'city_id'");
20647#ifdef FREECIV_JSON_CONNECTION
20648 field_addr.name = "city_id";
20649#endif /* FREECIV_JSON_CONNECTION */
20650 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
20651 RECEIVE_PACKET_FIELD_ERROR(city_id);
20652 }
20653 }
20654 if (BV_ISSET(fields, 2)) {
20655 log_packet_detailed(" got field 'improvements'");
20656#ifdef FREECIV_JSON_CONNECTION
20657 field_addr.name = "improvements";
20658#endif /* FREECIV_JSON_CONNECTION */
20659 if (!DIO_BV_GET(&din, &field_addr, real_packet->improvements)) {
20660 RECEIVE_PACKET_FIELD_ERROR(improvements);
20661 }
20662 }
20663 if (BV_ISSET(fields, 3)) {
20664 log_packet_detailed(" got field 'act_id'");
20665#ifdef FREECIV_JSON_CONNECTION
20666 field_addr.name = "act_id";
20667#endif /* FREECIV_JSON_CONNECTION */
20668 {
20669 int readin;
20670
20671 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
20672 RECEIVE_PACKET_FIELD_ERROR(act_id);
20673 }
20674 real_packet->act_id = readin;
20675 }
20676 }
20677 if (BV_ISSET(fields, 4)) {
20678 log_packet_detailed(" got field 'request_kind'");
20679#ifdef FREECIV_JSON_CONNECTION
20680 field_addr.name = "request_kind";
20681#endif /* FREECIV_JSON_CONNECTION */
20682 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
20683 RECEIVE_PACKET_FIELD_ERROR(request_kind);
20684 }
20685 }
20686
20687 if (NULL == old) {
20688 old = fc_malloc(sizeof(*old));
20689 *old = *real_packet;
20690 genhash_insert(*hash, old, old);
20691 } else {
20692 *old = *real_packet;
20693 }
20694
20695#endif /* FREECIV_DELTA_PROTOCOL */
20696 RECEIVE_PACKET_END(real_packet);
20697}
20698
20699 static int send_packet_city_sabotage_list_100(struct connection *pc, const struct packet_city_sabotage_list *packet)
20700{
20701 const struct packet_city_sabotage_list *real_packet = packet;
20702 int e;
20703#ifdef FREECIV_DELTA_PROTOCOL
20704 packet_city_sabotage_list_100_fields fields;
20705 struct packet_city_sabotage_list *old;
20706 bool differ;
20707 struct genhash **hash = pc->phs.sent + PACKET_CITY_SABOTAGE_LIST;
20708#endif /* FREECIV_DELTA_PROTOCOL */
20709 SEND_PACKET_START(PACKET_CITY_SABOTAGE_LIST);
20710#ifdef FREECIV_JSON_CONNECTION
20711 struct plocation field_addr;
20712 {
20713 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20714 field_addr = *field_addr_tmp;
20715 FC_FREE(field_addr_tmp);
20716 }
20717#endif /* FREECIV_JSON_CONNECTION */
20718
20719 log_packet_detailed("packet_city_sabotage_list_100: sending info about ()");
20720
20721#ifdef FREECIV_DELTA_PROTOCOL
20722 if (NULL == *hash) {
20723 *hash = genhash_new_full(hash_packet_city_sabotage_list_100, cmp_packet_city_sabotage_list_100,
20724 NULL, NULL, NULL, free);
20725 }
20726 BV_CLR_ALL(fields);
20727
20728 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
20729 old = fc_malloc(sizeof(*old));
20730 *old = *real_packet;
20731 genhash_insert(*hash, old, old);
20732 memset(old, 0, sizeof(*old));
20733 }
20734 differ = (old->actor_id != real_packet->actor_id);
20735 if (differ) {
20736 BV_SET(fields, 0);
20737 }
20738
20739 differ = (old->city_id != real_packet->city_id);
20740 if (differ) {
20741 BV_SET(fields, 1);
20742 }
20743
20744 differ = !BV_ARE_EQUAL(old->improvements, real_packet->improvements);
20745 if (differ) {
20746 BV_SET(fields, 2);
20747 }
20748
20749 differ = (old->act_id != real_packet->act_id);
20750 if (differ) {
20751 BV_SET(fields, 3);
20752 }
20753
20754 differ = (old->request_kind != real_packet->request_kind);
20755 if (differ) {
20756 BV_SET(fields, 4);
20757 }
20758
20759
20760#ifdef FREECIV_JSON_CONNECTION
20761 field_addr.name = "fields";
20762#endif /* FREECIV_JSON_CONNECTION */
20763 e = 0;
20764 e |= DIO_BV_PUT(&dout, &field_addr, fields);
20765 if (e) {
20766 log_packet_detailed("fields bitvector error detected");
20767 }
20768
20769 if (BV_ISSET(fields, 0)) {
20770 log_packet_detailed(" field 'actor_id' has changed");
20771#ifdef FREECIV_JSON_CONNECTION
20772 field_addr.name = "actor_id";
20773#endif /* FREECIV_JSON_CONNECTION */
20774 e = 0;
20775 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
20776 if (e) {
20777 log_packet_detailed("'actor_id' field error detected");
20778 }
20779 }
20780 if (BV_ISSET(fields, 1)) {
20781 log_packet_detailed(" field 'city_id' has changed");
20782#ifdef FREECIV_JSON_CONNECTION
20783 field_addr.name = "city_id";
20784#endif /* FREECIV_JSON_CONNECTION */
20785 e = 0;
20786 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20787 if (e) {
20788 log_packet_detailed("'city_id' field error detected");
20789 }
20790 }
20791 if (BV_ISSET(fields, 2)) {
20792 log_packet_detailed(" field 'improvements' has changed");
20793#ifdef FREECIV_JSON_CONNECTION
20794 field_addr.name = "improvements";
20795#endif /* FREECIV_JSON_CONNECTION */
20796 e = 0;
20797 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
20798 if (e) {
20799 log_packet_detailed("'improvements' field error detected");
20800 }
20801 }
20802 if (BV_ISSET(fields, 3)) {
20803 log_packet_detailed(" field 'act_id' has changed");
20804#ifdef FREECIV_JSON_CONNECTION
20805 field_addr.name = "act_id";
20806#endif /* FREECIV_JSON_CONNECTION */
20807 e = 0;
20808 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
20809 if (e) {
20810 log_packet_detailed("'act_id' field error detected");
20811 }
20812 }
20813 if (BV_ISSET(fields, 4)) {
20814 log_packet_detailed(" field 'request_kind' has changed");
20815#ifdef FREECIV_JSON_CONNECTION
20816 field_addr.name = "request_kind";
20817#endif /* FREECIV_JSON_CONNECTION */
20818 e = 0;
20819 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
20820 if (e) {
20821 log_packet_detailed("'request_kind' field error detected");
20822 }
20823 }
20824
20825 *old = *real_packet;
20826#endif /* FREECIV_DELTA_PROTOCOL */
20827#ifndef FREECIV_DELTA_PROTOCOL
20828#ifdef FREECIV_JSON_CONNECTION
20829 field_addr.name = "actor_id";
20830#endif /* FREECIV_JSON_CONNECTION */
20831 e = 0;
20832 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
20833 if (e) {
20834 log_packet_detailed("'actor_id' field error detected");
20835 }
20836#ifdef FREECIV_JSON_CONNECTION
20837 field_addr.name = "city_id";
20838#endif /* FREECIV_JSON_CONNECTION */
20839 e = 0;
20840 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
20841 if (e) {
20842 log_packet_detailed("'city_id' field error detected");
20843 }
20844#ifdef FREECIV_JSON_CONNECTION
20845 field_addr.name = "improvements";
20846#endif /* FREECIV_JSON_CONNECTION */
20847 e = 0;
20848 e |= DIO_BV_PUT(&dout, &field_addr, packet->improvements);
20849 if (e) {
20850 log_packet_detailed("'improvements' field error detected");
20851 }
20852#ifdef FREECIV_JSON_CONNECTION
20853 field_addr.name = "act_id";
20854#endif /* FREECIV_JSON_CONNECTION */
20855 e = 0;
20856 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_id);
20857 if (e) {
20858 log_packet_detailed("'act_id' field error detected");
20859 }
20860#ifdef FREECIV_JSON_CONNECTION
20861 field_addr.name = "request_kind";
20862#endif /* FREECIV_JSON_CONNECTION */
20863 e = 0;
20864 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
20865 if (e) {
20866 log_packet_detailed("'request_kind' field error detected");
20867 }
20868
20869#endif
20870 SEND_PACKET_END(PACKET_CITY_SABOTAGE_LIST);
20871}
20872
20873 int send_packet_city_sabotage_list(struct connection *pc, const struct packet_city_sabotage_list *packet)
20874{
20875 if (!pc->used) {
20876 log_error("WARNING: trying to send data to the closed connection %s",
20877 conn_description(pc));
20878 return -1;
20879 }
20880 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_SABOTAGE_LIST].packet != NULL, -1,
20881 "Handler for PACKET_CITY_SABOTAGE_LIST not installed");
20882 return pc->phs.handlers->send[PACKET_CITY_SABOTAGE_LIST].packet(pc, packet);
20883}
20884
20885 void lsend_packet_city_sabotage_list(struct conn_list *dest, const struct packet_city_sabotage_list *packet)
20886{
20887 conn_list_iterate(dest, pconn) {
20888 send_packet_city_sabotage_list(pconn, packet);
20889 } conn_list_iterate_end;
20890}
20891
20892#ifdef FREECIV_DELTA_PROTOCOL
20893#define hash_packet_city_rally_point_100 hash_const
20894
20895#define cmp_packet_city_rally_point_100 cmp_const
20896
20897 BV_DEFINE(packet_city_rally_point_100_fields, 5);
20898#endif /* FREECIV_DELTA_PROTOCOL */
20899
20900 static struct packet_city_rally_point *receive_packet_city_rally_point_100(struct connection *pc)
20901{
20902#ifdef FREECIV_DELTA_PROTOCOL
20903 packet_city_rally_point_100_fields fields;
20904 struct packet_city_rally_point *old;
20905 struct genhash **hash = pc->phs.received + PACKET_CITY_RALLY_POINT;
20906#endif /* FREECIV_DELTA_PROTOCOL */
20907 RECEIVE_PACKET_START(packet_city_rally_point, real_packet);
20908#ifdef FREECIV_JSON_CONNECTION
20909 struct plocation field_addr;
20910 {
20911 struct plocation *field_addr_tmp = plocation_field_new(NULL);
20912 field_addr = *field_addr_tmp;
20913 FC_FREE(field_addr_tmp);
20914 }
20915#endif /* FREECIV_JSON_CONNECTION */
20916
20917#ifdef FREECIV_DELTA_PROTOCOL
20918#ifdef FREECIV_JSON_CONNECTION
20919 field_addr.name = "fields";
20920#endif /* FREECIV_JSON_CONNECTION */
20921 DIO_BV_GET(&din, &field_addr, fields);
20922
20923#else /* FREECIV_DELTA_PROTOCOL */
20924#ifdef FREECIV_JSON_CONNECTION
20925 field_addr.name = "id";
20926#endif /* FREECIV_JSON_CONNECTION */
20927 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
20928 RECEIVE_PACKET_FIELD_ERROR(id);
20929 }
20930#ifdef FREECIV_JSON_CONNECTION
20931 field_addr.name = "length";
20932#endif /* FREECIV_JSON_CONNECTION */
20933 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
20934 RECEIVE_PACKET_FIELD_ERROR(length);
20935 }
20936#ifdef FREECIV_JSON_CONNECTION
20937 field_addr.name = "persistent";
20938#endif /* FREECIV_JSON_CONNECTION */
20939 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->persistent)) {
20940 RECEIVE_PACKET_FIELD_ERROR(persistent);
20941 }
20942#ifdef FREECIV_JSON_CONNECTION
20943 field_addr.name = "vigilant";
20944#endif /* FREECIV_JSON_CONNECTION */
20945 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
20946 RECEIVE_PACKET_FIELD_ERROR(vigilant);
20947 }
20948#ifdef FREECIV_JSON_CONNECTION
20949 field_addr.name = "orders";
20950#endif /* FREECIV_JSON_CONNECTION */
20951 {
20952 int i;
20953
20954#ifdef FREECIV_JSON_CONNECTION
20955 /* Enter array. */
20956 field_addr.sub_location = plocation_elem_new(0);
20957#endif /* FREECIV_JSON_CONNECTION */
20958
20959 if (real_packet->length > MAX_LEN_ROUTE) {
20960 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
20961 }
20962 for (i = 0; i < real_packet->length; i++) {
20963#ifdef FREECIV_JSON_CONNECTION
20964 field_addr.sub_location->number = i;
20965#endif /* FREECIV_JSON_CONNECTION */
20966 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
20967 RECEIVE_PACKET_FIELD_ERROR(orders);
20968 }
20969 }
20970
20971#ifdef FREECIV_JSON_CONNECTION
20972 /* Exit array. */
20973 FC_FREE(field_addr.sub_location);
20974#endif /* FREECIV_JSON_CONNECTION */
20975 }
20976#endif
20977 log_packet_detailed("packet_city_rally_point_100: got info about ()");
20978
20979#ifdef FREECIV_DELTA_PROTOCOL
20980 if (NULL == *hash) {
20981 *hash = genhash_new_full(hash_packet_city_rally_point_100, cmp_packet_city_rally_point_100,
20982 NULL, NULL, NULL, free);
20983 }
20984
20985 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
20986 *real_packet = *old;
20987 } else {
20988 log_packet_detailed(" no old info");
20989 memset(real_packet, 0, sizeof(*real_packet));
20990 }
20991
20992 if (BV_ISSET(fields, 0)) {
20993 log_packet_detailed(" got field 'id'");
20994#ifdef FREECIV_JSON_CONNECTION
20995 field_addr.name = "id";
20996#endif /* FREECIV_JSON_CONNECTION */
20997 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
20998 RECEIVE_PACKET_FIELD_ERROR(id);
20999 }
21000 }
21001 if (BV_ISSET(fields, 1)) {
21002 log_packet_detailed(" got field 'length'");
21003#ifdef FREECIV_JSON_CONNECTION
21004 field_addr.name = "length";
21005#endif /* FREECIV_JSON_CONNECTION */
21006 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
21007 RECEIVE_PACKET_FIELD_ERROR(length);
21008 }
21009 }
21010 real_packet->persistent = BV_ISSET(fields, 2);
21011 real_packet->vigilant = BV_ISSET(fields, 3);
21012 if (BV_ISSET(fields, 4)) {
21013 log_packet_detailed(" got field 'orders'");
21014#ifdef FREECIV_JSON_CONNECTION
21015 field_addr.name = "orders";
21016#endif /* FREECIV_JSON_CONNECTION */
21017 {
21018 int i;
21019
21020#ifdef FREECIV_JSON_CONNECTION
21021 /* Enter array. */
21022 field_addr.sub_location = plocation_elem_new(0);
21023#endif /* FREECIV_JSON_CONNECTION */
21024
21025 if (real_packet->length > MAX_LEN_ROUTE) {
21026 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
21027 }
21028 for (i = 0; i < real_packet->length; i++) {
21029#ifdef FREECIV_JSON_CONNECTION
21030 field_addr.sub_location->number = i;
21031#endif /* FREECIV_JSON_CONNECTION */
21032 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
21033 RECEIVE_PACKET_FIELD_ERROR(orders);
21034 }
21035 }
21036
21037#ifdef FREECIV_JSON_CONNECTION
21038 /* Exit array. */
21039 FC_FREE(field_addr.sub_location);
21040#endif /* FREECIV_JSON_CONNECTION */
21041 }
21042 }
21043
21044 if (NULL == old) {
21045 old = fc_malloc(sizeof(*old));
21046 *old = *real_packet;
21047 genhash_insert(*hash, old, old);
21048 } else {
21049 *old = *real_packet;
21050 }
21051
21052#endif /* FREECIV_DELTA_PROTOCOL */
21053 RECEIVE_PACKET_END(real_packet);
21054}
21055
21056 static int send_packet_city_rally_point_100(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
21057{
21058 const struct packet_city_rally_point *real_packet = packet;
21059 int e;
21060#ifdef FREECIV_DELTA_PROTOCOL
21061 packet_city_rally_point_100_fields fields;
21062 struct packet_city_rally_point *old;
21063 bool differ;
21064 struct genhash **hash = pc->phs.sent + PACKET_CITY_RALLY_POINT;
21065 int different = force_to_send;
21066#endif /* FREECIV_DELTA_PROTOCOL */
21067 SEND_PACKET_START(PACKET_CITY_RALLY_POINT);
21068#ifdef FREECIV_JSON_CONNECTION
21069 struct plocation field_addr;
21070 {
21071 struct plocation *field_addr_tmp = plocation_field_new(NULL);
21072 field_addr = *field_addr_tmp;
21073 FC_FREE(field_addr_tmp);
21074 }
21075#endif /* FREECIV_JSON_CONNECTION */
21076
21077 log_packet_detailed("packet_city_rally_point_100: sending info about ()");
21078
21079#ifdef FREECIV_DELTA_PROTOCOL
21080 if (NULL == *hash) {
21081 *hash = genhash_new_full(hash_packet_city_rally_point_100, cmp_packet_city_rally_point_100,
21082 NULL, NULL, NULL, free);
21083 }
21084 BV_CLR_ALL(fields);
21085
21086 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
21087 old = fc_malloc(sizeof(*old));
21088 *old = *real_packet;
21089 genhash_insert(*hash, old, old);
21090 memset(old, 0, sizeof(*old));
21091 different = 1; /* Force to send. */
21092 }
21093 differ = (old->id != real_packet->id);
21094 if (differ) {
21095 different++;
21096 BV_SET(fields, 0);
21097 }
21098
21099 differ = (old->length != real_packet->length);
21100 if (differ) {
21101 different++;
21102 BV_SET(fields, 1);
21103 }
21104
21105 differ = (old->persistent != real_packet->persistent);
21106 if (differ) {
21107 different++;
21108 }
21109 if (packet->persistent) {
21110 BV_SET(fields, 2);
21111 }
21112
21113 differ = (old->vigilant != real_packet->vigilant);
21114 if (differ) {
21115 different++;
21116 }
21117 if (packet->vigilant) {
21118 BV_SET(fields, 3);
21119 }
21120
21121 differ = (old->length != real_packet->length);
21122 if (!differ) {
21123 int i;
21124
21125 for (i = 0; i < real_packet->length; i++) {
21126 differ = !are_unit_orders_equal(&old->orders[i], &real_packet->orders[i]);
21127 if (differ) {
21128 break;
21129 }
21130 }
21131 }
21132 if (differ) {
21133 different++;
21134 BV_SET(fields, 4);
21135 }
21136
21137 if (different == 0) {
21138 log_packet_detailed(" no change -> discard");
21139 return 0;
21140 }
21141
21142#ifdef FREECIV_JSON_CONNECTION
21143 field_addr.name = "fields";
21144#endif /* FREECIV_JSON_CONNECTION */
21145 e = 0;
21146 e |= DIO_BV_PUT(&dout, &field_addr, fields);
21147 if (e) {
21148 log_packet_detailed("fields bitvector error detected");
21149 }
21150
21151 if (BV_ISSET(fields, 0)) {
21152 log_packet_detailed(" field 'id' has changed");
21153#ifdef FREECIV_JSON_CONNECTION
21154 field_addr.name = "id";
21155#endif /* FREECIV_JSON_CONNECTION */
21156 e = 0;
21157 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
21158 if (e) {
21159 log_packet_detailed("'id' field error detected");
21160 }
21161 }
21162 if (BV_ISSET(fields, 1)) {
21163 log_packet_detailed(" field 'length' has changed");
21164#ifdef FREECIV_JSON_CONNECTION
21165 field_addr.name = "length";
21166#endif /* FREECIV_JSON_CONNECTION */
21167 e = 0;
21168 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
21169 if (e) {
21170 log_packet_detailed("'length' field error detected");
21171 }
21172 }
21173 /* field 2 is folded into the header */
21174 /* field 3 is folded into the header */
21175 if (BV_ISSET(fields, 4)) {
21176 log_packet_detailed(" field 'orders' has changed");
21177#ifdef FREECIV_JSON_CONNECTION
21178 field_addr.name = "orders";
21179#endif /* FREECIV_JSON_CONNECTION */
21180 e = 0;
21181 {
21182 int i;
21183
21184#ifdef FREECIV_JSON_CONNECTION
21185 /* Create the array. */
21186 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
21187
21188 /* Enter the array. */
21189 field_addr.sub_location = plocation_elem_new(0);
21190#endif /* FREECIV_JSON_CONNECTION */
21191
21192 for (i = 0; i < real_packet->length; i++) {
21193#ifdef FREECIV_JSON_CONNECTION
21194 /* Next array element. */
21195 field_addr.sub_location->number = i;
21196#endif /* FREECIV_JSON_CONNECTION */
21197 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
21198 }
21199
21200#ifdef FREECIV_JSON_CONNECTION
21201 /* Exit array. */
21202 FC_FREE(field_addr.sub_location);
21203#endif /* FREECIV_JSON_CONNECTION */
21204 }
21205 if (e) {
21206 log_packet_detailed("'orders' field error detected");
21207 }
21208 }
21209
21210 *old = *real_packet;
21211#endif /* FREECIV_DELTA_PROTOCOL */
21212#ifndef FREECIV_DELTA_PROTOCOL
21213#ifdef FREECIV_JSON_CONNECTION
21214 field_addr.name = "id";
21215#endif /* FREECIV_JSON_CONNECTION */
21216 e = 0;
21217 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
21218 if (e) {
21219 log_packet_detailed("'id' field error detected");
21220 }
21221#ifdef FREECIV_JSON_CONNECTION
21222 field_addr.name = "length";
21223#endif /* FREECIV_JSON_CONNECTION */
21224 e = 0;
21225 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
21226 if (e) {
21227 log_packet_detailed("'length' field error detected");
21228 }
21229#ifdef FREECIV_JSON_CONNECTION
21230 field_addr.name = "persistent";
21231#endif /* FREECIV_JSON_CONNECTION */
21232 e = 0;
21233 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->persistent);
21234 if (e) {
21235 log_packet_detailed("'persistent' field error detected");
21236 }
21237#ifdef FREECIV_JSON_CONNECTION
21238 field_addr.name = "vigilant";
21239#endif /* FREECIV_JSON_CONNECTION */
21240 e = 0;
21241 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
21242 if (e) {
21243 log_packet_detailed("'vigilant' field error detected");
21244 }
21245#ifdef FREECIV_JSON_CONNECTION
21246 field_addr.name = "orders";
21247#endif /* FREECIV_JSON_CONNECTION */
21248 e = 0;
21249 {
21250 int i;
21251
21252#ifdef FREECIV_JSON_CONNECTION
21253 /* Create the array. */
21254 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
21255
21256 /* Enter the array. */
21257 field_addr.sub_location = plocation_elem_new(0);
21258#endif /* FREECIV_JSON_CONNECTION */
21259
21260 for (i = 0; i < real_packet->length; i++) {
21261#ifdef FREECIV_JSON_CONNECTION
21262 /* Next array element. */
21263 field_addr.sub_location->number = i;
21264#endif /* FREECIV_JSON_CONNECTION */
21265 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
21266 }
21267
21268#ifdef FREECIV_JSON_CONNECTION
21269 /* Exit array. */
21270 FC_FREE(field_addr.sub_location);
21271#endif /* FREECIV_JSON_CONNECTION */
21272 }
21273 if (e) {
21274 log_packet_detailed("'orders' field error detected");
21275 }
21276
21277#endif
21278 SEND_PACKET_END(PACKET_CITY_RALLY_POINT);
21279}
21280
21281 int send_packet_city_rally_point(struct connection *pc, const struct packet_city_rally_point *packet, bool force_to_send)
21282{
21283 if (!pc->used) {
21284 log_error("WARNING: trying to send data to the closed connection %s",
21285 conn_description(pc));
21286 return -1;
21287 }
21288 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CITY_RALLY_POINT].force_to_send != NULL, -1,
21289 "Handler for PACKET_CITY_RALLY_POINT not installed");
21290 return pc->phs.handlers->send[PACKET_CITY_RALLY_POINT].force_to_send(pc, packet, force_to_send);
21291}
21292
21293 void lsend_packet_city_rally_point(struct conn_list *dest, const struct packet_city_rally_point *packet, bool force_to_send)
21294{
21295 conn_list_iterate(dest, pconn) {
21296 send_packet_city_rally_point(pconn, packet, force_to_send);
21297 } conn_list_iterate_end;
21298}
21299
21300#ifdef FREECIV_DELTA_PROTOCOL
21301#define hash_packet_worker_task_100 hash_const
21302
21303#define cmp_packet_worker_task_100 cmp_const
21304
21305 BV_DEFINE(packet_worker_task_100_fields, 5);
21306#endif /* FREECIV_DELTA_PROTOCOL */
21307
21308 static struct packet_worker_task *receive_packet_worker_task_100(struct connection *pc)
21309{
21310#ifdef FREECIV_DELTA_PROTOCOL
21311 packet_worker_task_100_fields fields;
21312 struct packet_worker_task *old;
21313 struct genhash **hash = pc->phs.received + PACKET_WORKER_TASK;
21314#endif /* FREECIV_DELTA_PROTOCOL */
21315 RECEIVE_PACKET_START(packet_worker_task, real_packet);
21316#ifdef FREECIV_JSON_CONNECTION
21317 struct plocation field_addr;
21318 {
21319 struct plocation *field_addr_tmp = plocation_field_new(NULL);
21320 field_addr = *field_addr_tmp;
21321 FC_FREE(field_addr_tmp);
21322 }
21323#endif /* FREECIV_JSON_CONNECTION */
21324
21325#ifdef FREECIV_DELTA_PROTOCOL
21326#ifdef FREECIV_JSON_CONNECTION
21327 field_addr.name = "fields";
21328#endif /* FREECIV_JSON_CONNECTION */
21329 DIO_BV_GET(&din, &field_addr, fields);
21330
21331#else /* FREECIV_DELTA_PROTOCOL */
21332#ifdef FREECIV_JSON_CONNECTION
21333 field_addr.name = "city_id";
21334#endif /* FREECIV_JSON_CONNECTION */
21335 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
21336 RECEIVE_PACKET_FIELD_ERROR(city_id);
21337 }
21338#ifdef FREECIV_JSON_CONNECTION
21339 field_addr.name = "tile_id";
21340#endif /* FREECIV_JSON_CONNECTION */
21341 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
21342 RECEIVE_PACKET_FIELD_ERROR(tile_id);
21343 }
21344#ifdef FREECIV_JSON_CONNECTION
21345 field_addr.name = "activity";
21346#endif /* FREECIV_JSON_CONNECTION */
21347 {
21348 int readin;
21349
21350 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
21351 RECEIVE_PACKET_FIELD_ERROR(activity);
21352 }
21353 real_packet->activity = readin;
21354 }
21355#ifdef FREECIV_JSON_CONNECTION
21356 field_addr.name = "tgt";
21357#endif /* FREECIV_JSON_CONNECTION */
21358 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
21359 RECEIVE_PACKET_FIELD_ERROR(tgt);
21360 }
21361#ifdef FREECIV_JSON_CONNECTION
21362 field_addr.name = "want";
21363#endif /* FREECIV_JSON_CONNECTION */
21364 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
21365 RECEIVE_PACKET_FIELD_ERROR(want);
21366 }
21367#endif
21368 log_packet_detailed("packet_worker_task_100: got info about ()");
21369
21370#ifdef FREECIV_DELTA_PROTOCOL
21371 if (NULL == *hash) {
21372 *hash = genhash_new_full(hash_packet_worker_task_100, cmp_packet_worker_task_100,
21373 NULL, NULL, NULL, free);
21374 }
21375
21376 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
21377 *real_packet = *old;
21378 } else {
21379 log_packet_detailed(" no old info");
21380 memset(real_packet, 0, sizeof(*real_packet));
21381 }
21382
21383 if (BV_ISSET(fields, 0)) {
21384 log_packet_detailed(" got field 'city_id'");
21385#ifdef FREECIV_JSON_CONNECTION
21386 field_addr.name = "city_id";
21387#endif /* FREECIV_JSON_CONNECTION */
21388 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->city_id)) {
21389 RECEIVE_PACKET_FIELD_ERROR(city_id);
21390 }
21391 }
21392 if (BV_ISSET(fields, 1)) {
21393 log_packet_detailed(" got field 'tile_id'");
21394#ifdef FREECIV_JSON_CONNECTION
21395 field_addr.name = "tile_id";
21396#endif /* FREECIV_JSON_CONNECTION */
21397 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile_id)) {
21398 RECEIVE_PACKET_FIELD_ERROR(tile_id);
21399 }
21400 }
21401 if (BV_ISSET(fields, 2)) {
21402 log_packet_detailed(" got field 'activity'");
21403#ifdef FREECIV_JSON_CONNECTION
21404 field_addr.name = "activity";
21405#endif /* FREECIV_JSON_CONNECTION */
21406 {
21407 int readin;
21408
21409 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
21410 RECEIVE_PACKET_FIELD_ERROR(activity);
21411 }
21412 real_packet->activity = readin;
21413 }
21414 }
21415 if (BV_ISSET(fields, 3)) {
21416 log_packet_detailed(" got field 'tgt'");
21417#ifdef FREECIV_JSON_CONNECTION
21418 field_addr.name = "tgt";
21419#endif /* FREECIV_JSON_CONNECTION */
21420 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->tgt)) {
21421 RECEIVE_PACKET_FIELD_ERROR(tgt);
21422 }
21423 }
21424 if (BV_ISSET(fields, 4)) {
21425 log_packet_detailed(" got field 'want'");
21426#ifdef FREECIV_JSON_CONNECTION
21427 field_addr.name = "want";
21428#endif /* FREECIV_JSON_CONNECTION */
21429 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->want)) {
21430 RECEIVE_PACKET_FIELD_ERROR(want);
21431 }
21432 }
21433
21434 if (NULL == old) {
21435 old = fc_malloc(sizeof(*old));
21436 *old = *real_packet;
21437 genhash_insert(*hash, old, old);
21438 } else {
21439 *old = *real_packet;
21440 }
21441
21442#endif /* FREECIV_DELTA_PROTOCOL */
21443 RECEIVE_PACKET_END(real_packet);
21444}
21445
21446 static int send_packet_worker_task_100(struct connection *pc, const struct packet_worker_task *packet)
21447{
21448 const struct packet_worker_task *real_packet = packet;
21449 int e;
21450#ifdef FREECIV_DELTA_PROTOCOL
21451 packet_worker_task_100_fields fields;
21452 struct packet_worker_task *old;
21453 bool differ;
21454 struct genhash **hash = pc->phs.sent + PACKET_WORKER_TASK;
21455#endif /* FREECIV_DELTA_PROTOCOL */
21456 SEND_PACKET_START(PACKET_WORKER_TASK);
21457#ifdef FREECIV_JSON_CONNECTION
21458 struct plocation field_addr;
21459 {
21460 struct plocation *field_addr_tmp = plocation_field_new(NULL);
21461 field_addr = *field_addr_tmp;
21462 FC_FREE(field_addr_tmp);
21463 }
21464#endif /* FREECIV_JSON_CONNECTION */
21465
21466 log_packet_detailed("packet_worker_task_100: sending info about ()");
21467
21468#ifdef FREECIV_DELTA_PROTOCOL
21469 if (NULL == *hash) {
21470 *hash = genhash_new_full(hash_packet_worker_task_100, cmp_packet_worker_task_100,
21471 NULL, NULL, NULL, free);
21472 }
21473 BV_CLR_ALL(fields);
21474
21475 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
21476 old = fc_malloc(sizeof(*old));
21477 *old = *real_packet;
21478 genhash_insert(*hash, old, old);
21479 memset(old, 0, sizeof(*old));
21480 }
21481 differ = (old->city_id != real_packet->city_id);
21482 if (differ) {
21483 BV_SET(fields, 0);
21484 }
21485
21486 differ = (old->tile_id != real_packet->tile_id);
21487 if (differ) {
21488 BV_SET(fields, 1);
21489 }
21490
21491 differ = (old->activity != real_packet->activity);
21492 if (differ) {
21493 BV_SET(fields, 2);
21494 }
21495
21496 differ = (old->tgt != real_packet->tgt);
21497 if (differ) {
21498 BV_SET(fields, 3);
21499 }
21500
21501 differ = (old->want != real_packet->want);
21502 if (differ) {
21503 BV_SET(fields, 4);
21504 }
21505
21506
21507#ifdef FREECIV_JSON_CONNECTION
21508 field_addr.name = "fields";
21509#endif /* FREECIV_JSON_CONNECTION */
21510 e = 0;
21511 e |= DIO_BV_PUT(&dout, &field_addr, fields);
21512 if (e) {
21513 log_packet_detailed("fields bitvector error detected");
21514 }
21515
21516 if (BV_ISSET(fields, 0)) {
21517 log_packet_detailed(" field 'city_id' has changed");
21518#ifdef FREECIV_JSON_CONNECTION
21519 field_addr.name = "city_id";
21520#endif /* FREECIV_JSON_CONNECTION */
21521 e = 0;
21522 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
21523 if (e) {
21524 log_packet_detailed("'city_id' field error detected");
21525 }
21526 }
21527 if (BV_ISSET(fields, 1)) {
21528 log_packet_detailed(" field 'tile_id' has changed");
21529#ifdef FREECIV_JSON_CONNECTION
21530 field_addr.name = "tile_id";
21531#endif /* FREECIV_JSON_CONNECTION */
21532 e = 0;
21533 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
21534 if (e) {
21535 log_packet_detailed("'tile_id' field error detected");
21536 }
21537 }
21538 if (BV_ISSET(fields, 2)) {
21539 log_packet_detailed(" field 'activity' has changed");
21540#ifdef FREECIV_JSON_CONNECTION
21541 field_addr.name = "activity";
21542#endif /* FREECIV_JSON_CONNECTION */
21543 e = 0;
21544 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
21545 if (e) {
21546 log_packet_detailed("'activity' field error detected");
21547 }
21548 }
21549 if (BV_ISSET(fields, 3)) {
21550 log_packet_detailed(" field 'tgt' has changed");
21551#ifdef FREECIV_JSON_CONNECTION
21552 field_addr.name = "tgt";
21553#endif /* FREECIV_JSON_CONNECTION */
21554 e = 0;
21555 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
21556 if (e) {
21557 log_packet_detailed("'tgt' field error detected");
21558 }
21559 }
21560 if (BV_ISSET(fields, 4)) {
21561 log_packet_detailed(" field 'want' has changed");
21562#ifdef FREECIV_JSON_CONNECTION
21563 field_addr.name = "want";
21564#endif /* FREECIV_JSON_CONNECTION */
21565 e = 0;
21566 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
21567 if (e) {
21568 log_packet_detailed("'want' field error detected");
21569 }
21570 }
21571
21572 *old = *real_packet;
21573#endif /* FREECIV_DELTA_PROTOCOL */
21574#ifndef FREECIV_DELTA_PROTOCOL
21575#ifdef FREECIV_JSON_CONNECTION
21576 field_addr.name = "city_id";
21577#endif /* FREECIV_JSON_CONNECTION */
21578 e = 0;
21579 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->city_id);
21580 if (e) {
21581 log_packet_detailed("'city_id' field error detected");
21582 }
21583#ifdef FREECIV_JSON_CONNECTION
21584 field_addr.name = "tile_id";
21585#endif /* FREECIV_JSON_CONNECTION */
21586 e = 0;
21587 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile_id);
21588 if (e) {
21589 log_packet_detailed("'tile_id' field error detected");
21590 }
21591#ifdef FREECIV_JSON_CONNECTION
21592 field_addr.name = "activity";
21593#endif /* FREECIV_JSON_CONNECTION */
21594 e = 0;
21595 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
21596 if (e) {
21597 log_packet_detailed("'activity' field error detected");
21598 }
21599#ifdef FREECIV_JSON_CONNECTION
21600 field_addr.name = "tgt";
21601#endif /* FREECIV_JSON_CONNECTION */
21602 e = 0;
21603 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->tgt);
21604 if (e) {
21605 log_packet_detailed("'tgt' field error detected");
21606 }
21607#ifdef FREECIV_JSON_CONNECTION
21608 field_addr.name = "want";
21609#endif /* FREECIV_JSON_CONNECTION */
21610 e = 0;
21611 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->want);
21612 if (e) {
21613 log_packet_detailed("'want' field error detected");
21614 }
21615
21616#endif
21617 SEND_PACKET_END(PACKET_WORKER_TASK);
21618}
21619
21620 int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
21621{
21622 if (!pc->used) {
21623 log_error("WARNING: trying to send data to the closed connection %s",
21624 conn_description(pc));
21625 return -1;
21626 }
21627 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WORKER_TASK].packet != NULL, -1,
21628 "Handler for PACKET_WORKER_TASK not installed");
21629 return pc->phs.handlers->send[PACKET_WORKER_TASK].packet(pc, packet);
21630}
21631
21632 void lsend_packet_worker_task(struct conn_list *dest, const struct packet_worker_task *packet)
21633{
21634 conn_list_iterate(dest, pconn) {
21635 send_packet_worker_task(pconn, packet);
21636 } conn_list_iterate_end;
21637}
21638
21639#ifdef FREECIV_DELTA_PROTOCOL
21640#define hash_packet_player_remove_100 hash_const
21641
21642#define cmp_packet_player_remove_100 cmp_const
21643
21644 BV_DEFINE(packet_player_remove_100_fields, 1);
21645#endif /* FREECIV_DELTA_PROTOCOL */
21646
21647 static struct packet_player_remove *receive_packet_player_remove_100(struct connection *pc)
21648{
21649#ifdef FREECIV_DELTA_PROTOCOL
21650 packet_player_remove_100_fields fields;
21651 struct packet_player_remove *old;
21652 struct genhash **hash = pc->phs.received + PACKET_PLAYER_REMOVE;
21653#endif /* FREECIV_DELTA_PROTOCOL */
21654 RECEIVE_PACKET_START(packet_player_remove, real_packet);
21655#ifdef FREECIV_JSON_CONNECTION
21656 struct plocation field_addr;
21657 {
21658 struct plocation *field_addr_tmp = plocation_field_new(NULL);
21659 field_addr = *field_addr_tmp;
21660 FC_FREE(field_addr_tmp);
21661 }
21662#endif /* FREECIV_JSON_CONNECTION */
21663
21664#ifdef FREECIV_DELTA_PROTOCOL
21665#ifdef FREECIV_JSON_CONNECTION
21666 field_addr.name = "fields";
21667#endif /* FREECIV_JSON_CONNECTION */
21668 DIO_BV_GET(&din, &field_addr, fields);
21669
21670#else /* FREECIV_DELTA_PROTOCOL */
21671#ifdef FREECIV_JSON_CONNECTION
21672 field_addr.name = "playerno";
21673#endif /* FREECIV_JSON_CONNECTION */
21674 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
21675 RECEIVE_PACKET_FIELD_ERROR(playerno);
21676 }
21677#endif
21678 log_packet_detailed("packet_player_remove_100: got info about ()");
21679
21680#ifdef FREECIV_DELTA_PROTOCOL
21681 if (NULL == *hash) {
21682 *hash = genhash_new_full(hash_packet_player_remove_100, cmp_packet_player_remove_100,
21683 NULL, NULL, NULL, free);
21684 }
21685
21686 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
21687 *real_packet = *old;
21688 } else {
21689 log_packet_detailed(" no old info");
21690 memset(real_packet, 0, sizeof(*real_packet));
21691 }
21692
21693 if (BV_ISSET(fields, 0)) {
21694 log_packet_detailed(" got field 'playerno'");
21695#ifdef FREECIV_JSON_CONNECTION
21696 field_addr.name = "playerno";
21697#endif /* FREECIV_JSON_CONNECTION */
21698 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
21699 RECEIVE_PACKET_FIELD_ERROR(playerno);
21700 }
21701 }
21702
21703 if (NULL == old) {
21704 old = fc_malloc(sizeof(*old));
21705 *old = *real_packet;
21706 genhash_insert(*hash, old, old);
21707 } else {
21708 *old = *real_packet;
21709 }
21710
21711 hash = pc->phs.received + PACKET_PLAYER_INFO;
21712 if (NULL != *hash) {
21713 genhash_remove(*hash, real_packet);
21714 }
21715
21716#endif /* FREECIV_DELTA_PROTOCOL */
21717 RECEIVE_PACKET_END(real_packet);
21718}
21719
21720 static int send_packet_player_remove_100(struct connection *pc, const struct packet_player_remove *packet)
21721{
21722 const struct packet_player_remove *real_packet = packet;
21723 int e;
21724#ifdef FREECIV_DELTA_PROTOCOL
21725 packet_player_remove_100_fields fields;
21726 struct packet_player_remove *old;
21727 bool differ;
21728 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_REMOVE;
21729#endif /* FREECIV_DELTA_PROTOCOL */
21730 SEND_PACKET_START(PACKET_PLAYER_REMOVE);
21731#ifdef FREECIV_JSON_CONNECTION
21732 struct plocation field_addr;
21733 {
21734 struct plocation *field_addr_tmp = plocation_field_new(NULL);
21735 field_addr = *field_addr_tmp;
21736 FC_FREE(field_addr_tmp);
21737 }
21738#endif /* FREECIV_JSON_CONNECTION */
21739
21740 log_packet_detailed("packet_player_remove_100: sending info about ()");
21741
21742#ifdef FREECIV_DELTA_PROTOCOL
21743 if (NULL == *hash) {
21744 *hash = genhash_new_full(hash_packet_player_remove_100, cmp_packet_player_remove_100,
21745 NULL, NULL, NULL, free);
21746 }
21747 BV_CLR_ALL(fields);
21748
21749 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
21750 old = fc_malloc(sizeof(*old));
21751 *old = *real_packet;
21752 genhash_insert(*hash, old, old);
21753 memset(old, 0, sizeof(*old));
21754 }
21755 differ = (old->playerno != real_packet->playerno);
21756 if (differ) {
21757 BV_SET(fields, 0);
21758 }
21759
21760
21761#ifdef FREECIV_JSON_CONNECTION
21762 field_addr.name = "fields";
21763#endif /* FREECIV_JSON_CONNECTION */
21764 e = 0;
21765 e |= DIO_BV_PUT(&dout, &field_addr, fields);
21766 if (e) {
21767 log_packet_detailed("fields bitvector error detected");
21768 }
21769
21770 if (BV_ISSET(fields, 0)) {
21771 log_packet_detailed(" field 'playerno' has changed");
21772#ifdef FREECIV_JSON_CONNECTION
21773 field_addr.name = "playerno";
21774#endif /* FREECIV_JSON_CONNECTION */
21775 e = 0;
21776 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
21777 if (e) {
21778 log_packet_detailed("'playerno' field error detected");
21779 }
21780 }
21781
21782 *old = *real_packet;
21783
21784 hash = pc->phs.sent + PACKET_PLAYER_INFO;
21785 if (NULL != *hash) {
21786 genhash_remove(*hash, real_packet);
21787 }
21788#endif /* FREECIV_DELTA_PROTOCOL */
21789#ifndef FREECIV_DELTA_PROTOCOL
21790#ifdef FREECIV_JSON_CONNECTION
21791 field_addr.name = "playerno";
21792#endif /* FREECIV_JSON_CONNECTION */
21793 e = 0;
21794 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
21795 if (e) {
21796 log_packet_detailed("'playerno' field error detected");
21797 }
21798
21799#endif
21800 SEND_PACKET_END(PACKET_PLAYER_REMOVE);
21801}
21802
21803 int send_packet_player_remove(struct connection *pc, const struct packet_player_remove *packet)
21804{
21805 if (!pc->used) {
21806 log_error("WARNING: trying to send data to the closed connection %s",
21807 conn_description(pc));
21808 return -1;
21809 }
21810 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_REMOVE].packet != NULL, -1,
21811 "Handler for PACKET_PLAYER_REMOVE not installed");
21812 return pc->phs.handlers->send[PACKET_PLAYER_REMOVE].packet(pc, packet);
21813}
21814
21815 int dsend_packet_player_remove(struct connection *pc, int playerno)
21816{
21817 struct packet_player_remove packet, *real_packet = &packet;
21818
21819 real_packet->playerno = playerno;
21820
21821 return send_packet_player_remove(pc, real_packet);
21822}
21823
21824#ifdef FREECIV_DELTA_PROTOCOL
21825static genhash_val_t hash_packet_player_info_100(const void *vkey)
21826{
21827 const struct packet_player_info *key = (const struct packet_player_info *) vkey;
21828 genhash_val_t result = 0;
21829
21830 result += key->playerno;
21831
21832 result &= 0xFFFFFFFF;
21833 return result;
21834}
21835
21836static bool cmp_packet_player_info_100(const void *vkey1, const void *vkey2)
21837{
21838 const struct packet_player_info *old = (const struct packet_player_info *) vkey1;
21839 const struct packet_player_info *real_packet = (const struct packet_player_info *) vkey2;
21840 bool differ;
21841
21842 differ = (old->playerno != real_packet->playerno);
21843
21844 return !differ;
21845}
21846 BV_DEFINE(packet_player_info_100_fields, 47);
21847#endif /* FREECIV_DELTA_PROTOCOL */
21848
21849 static struct packet_player_info *receive_packet_player_info_100(struct connection *pc)
21850{
21851#ifdef FREECIV_DELTA_PROTOCOL
21852 packet_player_info_100_fields fields;
21853 struct packet_player_info *old;
21854 struct genhash **hash = pc->phs.received + PACKET_PLAYER_INFO;
21855#endif /* FREECIV_DELTA_PROTOCOL */
21856 RECEIVE_PACKET_START(packet_player_info, real_packet);
21857#ifdef FREECIV_JSON_CONNECTION
21858 struct plocation field_addr;
21859 {
21860 struct plocation *field_addr_tmp = plocation_field_new(NULL);
21861 field_addr = *field_addr_tmp;
21862 FC_FREE(field_addr_tmp);
21863 }
21864#endif /* FREECIV_JSON_CONNECTION */
21865
21866#ifdef FREECIV_DELTA_PROTOCOL
21867#ifdef FREECIV_JSON_CONNECTION
21868 field_addr.name = "fields";
21869#endif /* FREECIV_JSON_CONNECTION */
21870 DIO_BV_GET(&din, &field_addr, fields);
21871#ifdef FREECIV_JSON_CONNECTION
21872 field_addr.name = "playerno";
21873#endif /* FREECIV_JSON_CONNECTION */
21874 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
21875 RECEIVE_PACKET_FIELD_ERROR(playerno);
21876 }
21877
21878#else /* FREECIV_DELTA_PROTOCOL */
21879#ifdef FREECIV_JSON_CONNECTION
21880 field_addr.name = "playerno";
21881#endif /* FREECIV_JSON_CONNECTION */
21882 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
21883 RECEIVE_PACKET_FIELD_ERROR(playerno);
21884 }
21885#ifdef FREECIV_JSON_CONNECTION
21886 field_addr.name = "name";
21887#endif /* FREECIV_JSON_CONNECTION */
21888 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
21889 RECEIVE_PACKET_FIELD_ERROR(name);
21890 }
21891#ifdef FREECIV_JSON_CONNECTION
21892 field_addr.name = "username";
21893#endif /* FREECIV_JSON_CONNECTION */
21894 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
21895 RECEIVE_PACKET_FIELD_ERROR(username);
21896 }
21897#ifdef FREECIV_JSON_CONNECTION
21898 field_addr.name = "unassigned_user";
21899#endif /* FREECIV_JSON_CONNECTION */
21900 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unassigned_user)) {
21901 RECEIVE_PACKET_FIELD_ERROR(unassigned_user);
21902 }
21903#ifdef FREECIV_JSON_CONNECTION
21904 field_addr.name = "score";
21905#endif /* FREECIV_JSON_CONNECTION */
21906 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
21907 RECEIVE_PACKET_FIELD_ERROR(score);
21908 }
21909#ifdef FREECIV_JSON_CONNECTION
21910 field_addr.name = "is_male";
21911#endif /* FREECIV_JSON_CONNECTION */
21912 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
21913 RECEIVE_PACKET_FIELD_ERROR(is_male);
21914 }
21915#ifdef FREECIV_JSON_CONNECTION
21916 field_addr.name = "was_created";
21917#endif /* FREECIV_JSON_CONNECTION */
21918 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_created)) {
21919 RECEIVE_PACKET_FIELD_ERROR(was_created);
21920 }
21921#ifdef FREECIV_JSON_CONNECTION
21922 field_addr.name = "government";
21923#endif /* FREECIV_JSON_CONNECTION */
21924 {
21925 int readin;
21926
21927 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
21928 RECEIVE_PACKET_FIELD_ERROR(government);
21929 }
21930 real_packet->government = readin;
21931 }
21932#ifdef FREECIV_JSON_CONNECTION
21933 field_addr.name = "target_government";
21934#endif /* FREECIV_JSON_CONNECTION */
21935 {
21936 int readin;
21937
21938 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
21939 RECEIVE_PACKET_FIELD_ERROR(target_government);
21940 }
21941 real_packet->target_government = readin;
21942 }
21943#ifdef FREECIV_JSON_CONNECTION
21944 field_addr.name = "real_embassy";
21945#endif /* FREECIV_JSON_CONNECTION */
21946 if (!DIO_BV_GET(&din, &field_addr, real_packet->real_embassy)) {
21947 RECEIVE_PACKET_FIELD_ERROR(real_embassy);
21948 }
21949#ifdef FREECIV_JSON_CONNECTION
21950 field_addr.name = "mood";
21951#endif /* FREECIV_JSON_CONNECTION */
21952 {
21953 int readin;
21954
21955 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
21956 RECEIVE_PACKET_FIELD_ERROR(mood);
21957 }
21958 real_packet->mood = readin;
21959 }
21960#ifdef FREECIV_JSON_CONNECTION
21961 field_addr.name = "style";
21962#endif /* FREECIV_JSON_CONNECTION */
21963 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
21964 RECEIVE_PACKET_FIELD_ERROR(style);
21965 }
21966#ifdef FREECIV_JSON_CONNECTION
21967 field_addr.name = "music_style";
21968#endif /* FREECIV_JSON_CONNECTION */
21969 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->music_style)) {
21970 RECEIVE_PACKET_FIELD_ERROR(music_style);
21971 }
21972#ifdef FREECIV_JSON_CONNECTION
21973 field_addr.name = "nation";
21974#endif /* FREECIV_JSON_CONNECTION */
21975 {
21976 int readin;
21977
21978 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
21979 RECEIVE_PACKET_FIELD_ERROR(nation);
21980 }
21981 real_packet->nation = readin;
21982 }
21983#ifdef FREECIV_JSON_CONNECTION
21984 field_addr.name = "team";
21985#endif /* FREECIV_JSON_CONNECTION */
21986 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
21987 RECEIVE_PACKET_FIELD_ERROR(team);
21988 }
21989#ifdef FREECIV_JSON_CONNECTION
21990 field_addr.name = "is_ready";
21991#endif /* FREECIV_JSON_CONNECTION */
21992 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_ready)) {
21993 RECEIVE_PACKET_FIELD_ERROR(is_ready);
21994 }
21995#ifdef FREECIV_JSON_CONNECTION
21996 field_addr.name = "phase_done";
21997#endif /* FREECIV_JSON_CONNECTION */
21998 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->phase_done)) {
21999 RECEIVE_PACKET_FIELD_ERROR(phase_done);
22000 }
22001#ifdef FREECIV_JSON_CONNECTION
22002 field_addr.name = "nturns_idle";
22003#endif /* FREECIV_JSON_CONNECTION */
22004 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
22005 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
22006 }
22007#ifdef FREECIV_JSON_CONNECTION
22008 field_addr.name = "turns_alive";
22009#endif /* FREECIV_JSON_CONNECTION */
22010 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turns_alive)) {
22011 RECEIVE_PACKET_FIELD_ERROR(turns_alive);
22012 }
22013#ifdef FREECIV_JSON_CONNECTION
22014 field_addr.name = "is_alive";
22015#endif /* FREECIV_JSON_CONNECTION */
22016 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_alive)) {
22017 RECEIVE_PACKET_FIELD_ERROR(is_alive);
22018 }
22019#ifdef FREECIV_JSON_CONNECTION
22020 field_addr.name = "autoselect_weight";
22021#endif /* FREECIV_JSON_CONNECTION */
22022 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
22023 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
22024 }
22025#ifdef FREECIV_JSON_CONNECTION
22026 field_addr.name = "gold";
22027#endif /* FREECIV_JSON_CONNECTION */
22028 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
22029 RECEIVE_PACKET_FIELD_ERROR(gold);
22030 }
22031#ifdef FREECIV_JSON_CONNECTION
22032 field_addr.name = "tax";
22033#endif /* FREECIV_JSON_CONNECTION */
22034 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
22035 RECEIVE_PACKET_FIELD_ERROR(tax);
22036 }
22037#ifdef FREECIV_JSON_CONNECTION
22038 field_addr.name = "science";
22039#endif /* FREECIV_JSON_CONNECTION */
22040 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
22041 RECEIVE_PACKET_FIELD_ERROR(science);
22042 }
22043#ifdef FREECIV_JSON_CONNECTION
22044 field_addr.name = "luxury";
22045#endif /* FREECIV_JSON_CONNECTION */
22046 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
22047 RECEIVE_PACKET_FIELD_ERROR(luxury);
22048 }
22049#ifdef FREECIV_JSON_CONNECTION
22050 field_addr.name = "infrapoints";
22051#endif /* FREECIV_JSON_CONNECTION */
22052 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
22053 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
22054 }
22055#ifdef FREECIV_JSON_CONNECTION
22056 field_addr.name = "tech_upkeep";
22057#endif /* FREECIV_JSON_CONNECTION */
22058 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep)) {
22059 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep);
22060 }
22061#ifdef FREECIV_JSON_CONNECTION
22062 field_addr.name = "science_cost";
22063#endif /* FREECIV_JSON_CONNECTION */
22064 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->science_cost)) {
22065 RECEIVE_PACKET_FIELD_ERROR(science_cost);
22066 }
22067#ifdef FREECIV_JSON_CONNECTION
22068 field_addr.name = "is_connected";
22069#endif /* FREECIV_JSON_CONNECTION */
22070 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_connected)) {
22071 RECEIVE_PACKET_FIELD_ERROR(is_connected);
22072 }
22073#ifdef FREECIV_JSON_CONNECTION
22074 field_addr.name = "revolution_finishes";
22075#endif /* FREECIV_JSON_CONNECTION */
22076 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
22077 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
22078 }
22079#ifdef FREECIV_JSON_CONNECTION
22080 field_addr.name = "ai_skill_level";
22081#endif /* FREECIV_JSON_CONNECTION */
22082 {
22083 int readin;
22084
22085 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22086 RECEIVE_PACKET_FIELD_ERROR(ai_skill_level);
22087 }
22088 real_packet->ai_skill_level = readin;
22089 }
22090#ifdef FREECIV_JSON_CONNECTION
22091 field_addr.name = "barbarian_type";
22092#endif /* FREECIV_JSON_CONNECTION */
22093 {
22094 int readin;
22095
22096 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22097 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
22098 }
22099 real_packet->barbarian_type = readin;
22100 }
22101#ifdef FREECIV_JSON_CONNECTION
22102 field_addr.name = "gives_shared_vision";
22103#endif /* FREECIV_JSON_CONNECTION */
22104 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_vision)) {
22105 RECEIVE_PACKET_FIELD_ERROR(gives_shared_vision);
22106 }
22107#ifdef FREECIV_JSON_CONNECTION
22108 field_addr.name = "gives_shared_tiles";
22109#endif /* FREECIV_JSON_CONNECTION */
22110 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_tiles)) {
22111 RECEIVE_PACKET_FIELD_ERROR(gives_shared_tiles);
22112 }
22113#ifdef FREECIV_JSON_CONNECTION
22114 field_addr.name = "history";
22115#endif /* FREECIV_JSON_CONNECTION */
22116 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
22117 RECEIVE_PACKET_FIELD_ERROR(history);
22118 }
22119#ifdef FREECIV_JSON_CONNECTION
22120 field_addr.name = "culture";
22121#endif /* FREECIV_JSON_CONNECTION */
22122 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
22123 RECEIVE_PACKET_FIELD_ERROR(culture);
22124 }
22125#ifdef FREECIV_JSON_CONNECTION
22126 field_addr.name = "love";
22127#endif /* FREECIV_JSON_CONNECTION */
22128 {
22129 int i;
22130
22131#ifdef FREECIV_JSON_CONNECTION
22132 /* Enter array. */
22133 field_addr.sub_location = plocation_elem_new(0);
22134#endif /* FREECIV_JSON_CONNECTION */
22135
22136 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
22137#ifdef FREECIV_JSON_CONNECTION
22138 field_addr.sub_location->number = i;
22139#endif /* FREECIV_JSON_CONNECTION */
22140 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->love[i])) {
22141 RECEIVE_PACKET_FIELD_ERROR(love);
22142 }
22143 }
22144
22145#ifdef FREECIV_JSON_CONNECTION
22146 /* Exit array. */
22147 FC_FREE(field_addr.sub_location);
22148#endif /* FREECIV_JSON_CONNECTION */
22149 }
22150#ifdef FREECIV_JSON_CONNECTION
22151 field_addr.name = "color_valid";
22152#endif /* FREECIV_JSON_CONNECTION */
22153 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->color_valid)) {
22154 RECEIVE_PACKET_FIELD_ERROR(color_valid);
22155 }
22156#ifdef FREECIV_JSON_CONNECTION
22157 field_addr.name = "color_changeable";
22158#endif /* FREECIV_JSON_CONNECTION */
22159 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->color_changeable)) {
22160 RECEIVE_PACKET_FIELD_ERROR(color_changeable);
22161 }
22162#ifdef FREECIV_JSON_CONNECTION
22163 field_addr.name = "color_red";
22164#endif /* FREECIV_JSON_CONNECTION */
22165 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
22166 RECEIVE_PACKET_FIELD_ERROR(color_red);
22167 }
22168#ifdef FREECIV_JSON_CONNECTION
22169 field_addr.name = "color_green";
22170#endif /* FREECIV_JSON_CONNECTION */
22171 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
22172 RECEIVE_PACKET_FIELD_ERROR(color_green);
22173 }
22174#ifdef FREECIV_JSON_CONNECTION
22175 field_addr.name = "color_blue";
22176#endif /* FREECIV_JSON_CONNECTION */
22177 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
22178 RECEIVE_PACKET_FIELD_ERROR(color_blue);
22179 }
22180#ifdef FREECIV_JSON_CONNECTION
22181 field_addr.name = "flags";
22182#endif /* FREECIV_JSON_CONNECTION */
22183 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
22184 RECEIVE_PACKET_FIELD_ERROR(flags);
22185 }
22186#ifdef FREECIV_JSON_CONNECTION
22187 field_addr.name = "wonders";
22188#endif /* FREECIV_JSON_CONNECTION */
22189 {
22190 int i;
22191
22192#ifdef FREECIV_JSON_CONNECTION
22193 /* Enter array. */
22194 field_addr.sub_location = plocation_elem_new(0);
22195#endif /* FREECIV_JSON_CONNECTION */
22196
22197 for (i = 0; i < B_LAST; i++) {
22198#ifdef FREECIV_JSON_CONNECTION
22199 field_addr.sub_location->number = i;
22200#endif /* FREECIV_JSON_CONNECTION */
22201 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->wonders[i])) {
22202 RECEIVE_PACKET_FIELD_ERROR(wonders);
22203 }
22204 }
22205
22206#ifdef FREECIV_JSON_CONNECTION
22207 /* Exit array. */
22208 FC_FREE(field_addr.sub_location);
22209#endif /* FREECIV_JSON_CONNECTION */
22210 }
22211#ifdef FREECIV_JSON_CONNECTION
22212 field_addr.name = "multip_count";
22213#endif /* FREECIV_JSON_CONNECTION */
22214 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->multip_count)) {
22215 RECEIVE_PACKET_FIELD_ERROR(multip_count);
22216 }
22217#ifdef FREECIV_JSON_CONNECTION
22218 field_addr.name = "multiplier";
22219#endif /* FREECIV_JSON_CONNECTION */
22220 {
22221 int i;
22222
22223#ifdef FREECIV_JSON_CONNECTION
22224 /* Enter array. */
22225 field_addr.sub_location = plocation_elem_new(0);
22226#endif /* FREECIV_JSON_CONNECTION */
22227
22228 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22229 RECEIVE_PACKET_FIELD_ERROR(multiplier, ": truncation array");
22230 }
22231 for (i = 0; i < real_packet->multip_count; i++) {
22232#ifdef FREECIV_JSON_CONNECTION
22233 field_addr.sub_location->number = i;
22234#endif /* FREECIV_JSON_CONNECTION */
22235 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier[i])) {
22236 RECEIVE_PACKET_FIELD_ERROR(multiplier);
22237 }
22238 }
22239
22240#ifdef FREECIV_JSON_CONNECTION
22241 /* Exit array. */
22242 FC_FREE(field_addr.sub_location);
22243#endif /* FREECIV_JSON_CONNECTION */
22244 }
22245#ifdef FREECIV_JSON_CONNECTION
22246 field_addr.name = "multiplier_target";
22247#endif /* FREECIV_JSON_CONNECTION */
22248 {
22249 int i;
22250
22251#ifdef FREECIV_JSON_CONNECTION
22252 /* Enter array. */
22253 field_addr.sub_location = plocation_elem_new(0);
22254#endif /* FREECIV_JSON_CONNECTION */
22255
22256 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22257 RECEIVE_PACKET_FIELD_ERROR(multiplier_target, ": truncation array");
22258 }
22259 for (i = 0; i < real_packet->multip_count; i++) {
22260#ifdef FREECIV_JSON_CONNECTION
22261 field_addr.sub_location->number = i;
22262#endif /* FREECIV_JSON_CONNECTION */
22263 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier_target[i])) {
22264 RECEIVE_PACKET_FIELD_ERROR(multiplier_target);
22265 }
22266 }
22267
22268#ifdef FREECIV_JSON_CONNECTION
22269 /* Exit array. */
22270 FC_FREE(field_addr.sub_location);
22271#endif /* FREECIV_JSON_CONNECTION */
22272 }
22273#ifdef FREECIV_JSON_CONNECTION
22274 field_addr.name = "multiplier_changed";
22275#endif /* FREECIV_JSON_CONNECTION */
22276 {
22277 int i;
22278
22279#ifdef FREECIV_JSON_CONNECTION
22280 /* Enter array. */
22281 field_addr.sub_location = plocation_elem_new(0);
22282#endif /* FREECIV_JSON_CONNECTION */
22283
22284 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22285 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed, ": truncation array");
22286 }
22287 for (i = 0; i < real_packet->multip_count; i++) {
22288#ifdef FREECIV_JSON_CONNECTION
22289 field_addr.sub_location->number = i;
22290#endif /* FREECIV_JSON_CONNECTION */
22291 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->multiplier_changed[i])) {
22292 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed);
22293 }
22294 }
22295
22296#ifdef FREECIV_JSON_CONNECTION
22297 /* Exit array. */
22298 FC_FREE(field_addr.sub_location);
22299#endif /* FREECIV_JSON_CONNECTION */
22300 }
22301#endif
22302 log_packet_detailed("packet_player_info_100: got info about (%d)",
22303 real_packet->playerno);
22304
22305#ifdef FREECIV_DELTA_PROTOCOL
22306 if (NULL == *hash) {
22307 *hash = genhash_new_full(hash_packet_player_info_100, cmp_packet_player_info_100,
22308 NULL, NULL, NULL, free);
22309 }
22310
22311 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
22312 *real_packet = *old;
22313 } else {
22314 int playerno;
22315
22316 playerno = real_packet->playerno;
22317
22318 log_packet_detailed(" no old info");
22319 memset(real_packet, 0, sizeof(*real_packet));
22320
22321 real_packet->playerno = playerno;
22322 }
22323
22324 if (BV_ISSET(fields, 0)) {
22325 log_packet_detailed(" got field 'name'");
22326#ifdef FREECIV_JSON_CONNECTION
22327 field_addr.name = "name";
22328#endif /* FREECIV_JSON_CONNECTION */
22329 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
22330 RECEIVE_PACKET_FIELD_ERROR(name);
22331 }
22332 }
22333 if (BV_ISSET(fields, 1)) {
22334 log_packet_detailed(" got field 'username'");
22335#ifdef FREECIV_JSON_CONNECTION
22336 field_addr.name = "username";
22337#endif /* FREECIV_JSON_CONNECTION */
22338 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
22339 RECEIVE_PACKET_FIELD_ERROR(username);
22340 }
22341 }
22342 real_packet->unassigned_user = BV_ISSET(fields, 2);
22343 if (BV_ISSET(fields, 3)) {
22344 log_packet_detailed(" got field 'score'");
22345#ifdef FREECIV_JSON_CONNECTION
22346 field_addr.name = "score";
22347#endif /* FREECIV_JSON_CONNECTION */
22348 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->score)) {
22349 RECEIVE_PACKET_FIELD_ERROR(score);
22350 }
22351 }
22352 real_packet->is_male = BV_ISSET(fields, 4);
22353 real_packet->was_created = BV_ISSET(fields, 5);
22354 if (BV_ISSET(fields, 6)) {
22355 log_packet_detailed(" got field 'government'");
22356#ifdef FREECIV_JSON_CONNECTION
22357 field_addr.name = "government";
22358#endif /* FREECIV_JSON_CONNECTION */
22359 {
22360 int readin;
22361
22362 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
22363 RECEIVE_PACKET_FIELD_ERROR(government);
22364 }
22365 real_packet->government = readin;
22366 }
22367 }
22368 if (BV_ISSET(fields, 7)) {
22369 log_packet_detailed(" got field 'target_government'");
22370#ifdef FREECIV_JSON_CONNECTION
22371 field_addr.name = "target_government";
22372#endif /* FREECIV_JSON_CONNECTION */
22373 {
22374 int readin;
22375
22376 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
22377 RECEIVE_PACKET_FIELD_ERROR(target_government);
22378 }
22379 real_packet->target_government = readin;
22380 }
22381 }
22382 if (BV_ISSET(fields, 8)) {
22383 log_packet_detailed(" got field 'real_embassy'");
22384#ifdef FREECIV_JSON_CONNECTION
22385 field_addr.name = "real_embassy";
22386#endif /* FREECIV_JSON_CONNECTION */
22387 if (!DIO_BV_GET(&din, &field_addr, real_packet->real_embassy)) {
22388 RECEIVE_PACKET_FIELD_ERROR(real_embassy);
22389 }
22390 }
22391 if (BV_ISSET(fields, 9)) {
22392 log_packet_detailed(" got field 'mood'");
22393#ifdef FREECIV_JSON_CONNECTION
22394 field_addr.name = "mood";
22395#endif /* FREECIV_JSON_CONNECTION */
22396 {
22397 int readin;
22398
22399 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22400 RECEIVE_PACKET_FIELD_ERROR(mood);
22401 }
22402 real_packet->mood = readin;
22403 }
22404 }
22405 if (BV_ISSET(fields, 10)) {
22406 log_packet_detailed(" got field 'style'");
22407#ifdef FREECIV_JSON_CONNECTION
22408 field_addr.name = "style";
22409#endif /* FREECIV_JSON_CONNECTION */
22410 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
22411 RECEIVE_PACKET_FIELD_ERROR(style);
22412 }
22413 }
22414 if (BV_ISSET(fields, 11)) {
22415 log_packet_detailed(" got field 'music_style'");
22416#ifdef FREECIV_JSON_CONNECTION
22417 field_addr.name = "music_style";
22418#endif /* FREECIV_JSON_CONNECTION */
22419 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->music_style)) {
22420 RECEIVE_PACKET_FIELD_ERROR(music_style);
22421 }
22422 }
22423 if (BV_ISSET(fields, 12)) {
22424 log_packet_detailed(" got field 'nation'");
22425#ifdef FREECIV_JSON_CONNECTION
22426 field_addr.name = "nation";
22427#endif /* FREECIV_JSON_CONNECTION */
22428 {
22429 int readin;
22430
22431 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
22432 RECEIVE_PACKET_FIELD_ERROR(nation);
22433 }
22434 real_packet->nation = readin;
22435 }
22436 }
22437 if (BV_ISSET(fields, 13)) {
22438 log_packet_detailed(" got field 'team'");
22439#ifdef FREECIV_JSON_CONNECTION
22440 field_addr.name = "team";
22441#endif /* FREECIV_JSON_CONNECTION */
22442 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
22443 RECEIVE_PACKET_FIELD_ERROR(team);
22444 }
22445 }
22446 real_packet->is_ready = BV_ISSET(fields, 14);
22447 real_packet->phase_done = BV_ISSET(fields, 15);
22448 if (BV_ISSET(fields, 16)) {
22449 log_packet_detailed(" got field 'nturns_idle'");
22450#ifdef FREECIV_JSON_CONNECTION
22451 field_addr.name = "nturns_idle";
22452#endif /* FREECIV_JSON_CONNECTION */
22453 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
22454 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
22455 }
22456 }
22457 if (BV_ISSET(fields, 17)) {
22458 log_packet_detailed(" got field 'turns_alive'");
22459#ifdef FREECIV_JSON_CONNECTION
22460 field_addr.name = "turns_alive";
22461#endif /* FREECIV_JSON_CONNECTION */
22462 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turns_alive)) {
22463 RECEIVE_PACKET_FIELD_ERROR(turns_alive);
22464 }
22465 }
22466 real_packet->is_alive = BV_ISSET(fields, 18);
22467 if (BV_ISSET(fields, 19)) {
22468 log_packet_detailed(" got field 'autoselect_weight'");
22469#ifdef FREECIV_JSON_CONNECTION
22470 field_addr.name = "autoselect_weight";
22471#endif /* FREECIV_JSON_CONNECTION */
22472 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
22473 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
22474 }
22475 }
22476 if (BV_ISSET(fields, 20)) {
22477 log_packet_detailed(" got field 'gold'");
22478#ifdef FREECIV_JSON_CONNECTION
22479 field_addr.name = "gold";
22480#endif /* FREECIV_JSON_CONNECTION */
22481 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
22482 RECEIVE_PACKET_FIELD_ERROR(gold);
22483 }
22484 }
22485 if (BV_ISSET(fields, 21)) {
22486 log_packet_detailed(" got field 'tax'");
22487#ifdef FREECIV_JSON_CONNECTION
22488 field_addr.name = "tax";
22489#endif /* FREECIV_JSON_CONNECTION */
22490 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
22491 RECEIVE_PACKET_FIELD_ERROR(tax);
22492 }
22493 }
22494 if (BV_ISSET(fields, 22)) {
22495 log_packet_detailed(" got field 'science'");
22496#ifdef FREECIV_JSON_CONNECTION
22497 field_addr.name = "science";
22498#endif /* FREECIV_JSON_CONNECTION */
22499 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
22500 RECEIVE_PACKET_FIELD_ERROR(science);
22501 }
22502 }
22503 if (BV_ISSET(fields, 23)) {
22504 log_packet_detailed(" got field 'luxury'");
22505#ifdef FREECIV_JSON_CONNECTION
22506 field_addr.name = "luxury";
22507#endif /* FREECIV_JSON_CONNECTION */
22508 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
22509 RECEIVE_PACKET_FIELD_ERROR(luxury);
22510 }
22511 }
22512 if (BV_ISSET(fields, 24)) {
22513 log_packet_detailed(" got field 'infrapoints'");
22514#ifdef FREECIV_JSON_CONNECTION
22515 field_addr.name = "infrapoints";
22516#endif /* FREECIV_JSON_CONNECTION */
22517 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->infrapoints)) {
22518 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
22519 }
22520 }
22521 if (BV_ISSET(fields, 25)) {
22522 log_packet_detailed(" got field 'tech_upkeep'");
22523#ifdef FREECIV_JSON_CONNECTION
22524 field_addr.name = "tech_upkeep";
22525#endif /* FREECIV_JSON_CONNECTION */
22526 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_upkeep)) {
22527 RECEIVE_PACKET_FIELD_ERROR(tech_upkeep);
22528 }
22529 }
22530 if (BV_ISSET(fields, 26)) {
22531 log_packet_detailed(" got field 'science_cost'");
22532#ifdef FREECIV_JSON_CONNECTION
22533 field_addr.name = "science_cost";
22534#endif /* FREECIV_JSON_CONNECTION */
22535 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->science_cost)) {
22536 RECEIVE_PACKET_FIELD_ERROR(science_cost);
22537 }
22538 }
22539 real_packet->is_connected = BV_ISSET(fields, 27);
22540 if (BV_ISSET(fields, 28)) {
22541 log_packet_detailed(" got field 'revolution_finishes'");
22542#ifdef FREECIV_JSON_CONNECTION
22543 field_addr.name = "revolution_finishes";
22544#endif /* FREECIV_JSON_CONNECTION */
22545 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
22546 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
22547 }
22548 }
22549 if (BV_ISSET(fields, 29)) {
22550 log_packet_detailed(" got field 'ai_skill_level'");
22551#ifdef FREECIV_JSON_CONNECTION
22552 field_addr.name = "ai_skill_level";
22553#endif /* FREECIV_JSON_CONNECTION */
22554 {
22555 int readin;
22556
22557 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22558 RECEIVE_PACKET_FIELD_ERROR(ai_skill_level);
22559 }
22560 real_packet->ai_skill_level = readin;
22561 }
22562 }
22563 if (BV_ISSET(fields, 30)) {
22564 log_packet_detailed(" got field 'barbarian_type'");
22565#ifdef FREECIV_JSON_CONNECTION
22566 field_addr.name = "barbarian_type";
22567#endif /* FREECIV_JSON_CONNECTION */
22568 {
22569 int readin;
22570
22571 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
22572 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
22573 }
22574 real_packet->barbarian_type = readin;
22575 }
22576 }
22577 if (BV_ISSET(fields, 31)) {
22578 log_packet_detailed(" got field 'gives_shared_vision'");
22579#ifdef FREECIV_JSON_CONNECTION
22580 field_addr.name = "gives_shared_vision";
22581#endif /* FREECIV_JSON_CONNECTION */
22582 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_vision)) {
22583 RECEIVE_PACKET_FIELD_ERROR(gives_shared_vision);
22584 }
22585 }
22586 if (BV_ISSET(fields, 32)) {
22587 log_packet_detailed(" got field 'gives_shared_tiles'");
22588#ifdef FREECIV_JSON_CONNECTION
22589 field_addr.name = "gives_shared_tiles";
22590#endif /* FREECIV_JSON_CONNECTION */
22591 if (!DIO_BV_GET(&din, &field_addr, real_packet->gives_shared_tiles)) {
22592 RECEIVE_PACKET_FIELD_ERROR(gives_shared_tiles);
22593 }
22594 }
22595 if (BV_ISSET(fields, 33)) {
22596 log_packet_detailed(" got field 'history'");
22597#ifdef FREECIV_JSON_CONNECTION
22598 field_addr.name = "history";
22599#endif /* FREECIV_JSON_CONNECTION */
22600 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
22601 RECEIVE_PACKET_FIELD_ERROR(history);
22602 }
22603 }
22604 if (BV_ISSET(fields, 34)) {
22605 log_packet_detailed(" got field 'culture'");
22606#ifdef FREECIV_JSON_CONNECTION
22607 field_addr.name = "culture";
22608#endif /* FREECIV_JSON_CONNECTION */
22609 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->culture)) {
22610 RECEIVE_PACKET_FIELD_ERROR(culture);
22611 }
22612 }
22613 if (BV_ISSET(fields, 35)) {
22614 log_packet_detailed(" got field 'love'");
22615#ifdef FREECIV_JSON_CONNECTION
22616 field_addr.name = "love";
22617#endif /* FREECIV_JSON_CONNECTION */
22618 {
22619 int i;
22620
22621#ifdef FREECIV_JSON_CONNECTION
22622 /* Enter array. */
22623 field_addr.sub_location = plocation_elem_new(0);
22624#endif /* FREECIV_JSON_CONNECTION */
22625
22626 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
22627#ifdef FREECIV_JSON_CONNECTION
22628 field_addr.sub_location->number = i;
22629#endif /* FREECIV_JSON_CONNECTION */
22630 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->love[i])) {
22631 RECEIVE_PACKET_FIELD_ERROR(love);
22632 }
22633 }
22634
22635#ifdef FREECIV_JSON_CONNECTION
22636 /* Exit array. */
22637 FC_FREE(field_addr.sub_location);
22638#endif /* FREECIV_JSON_CONNECTION */
22639 }
22640 }
22641 real_packet->color_valid = BV_ISSET(fields, 36);
22642 real_packet->color_changeable = BV_ISSET(fields, 37);
22643 if (BV_ISSET(fields, 38)) {
22644 log_packet_detailed(" got field 'color_red'");
22645#ifdef FREECIV_JSON_CONNECTION
22646 field_addr.name = "color_red";
22647#endif /* FREECIV_JSON_CONNECTION */
22648 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
22649 RECEIVE_PACKET_FIELD_ERROR(color_red);
22650 }
22651 }
22652 if (BV_ISSET(fields, 39)) {
22653 log_packet_detailed(" got field 'color_green'");
22654#ifdef FREECIV_JSON_CONNECTION
22655 field_addr.name = "color_green";
22656#endif /* FREECIV_JSON_CONNECTION */
22657 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
22658 RECEIVE_PACKET_FIELD_ERROR(color_green);
22659 }
22660 }
22661 if (BV_ISSET(fields, 40)) {
22662 log_packet_detailed(" got field 'color_blue'");
22663#ifdef FREECIV_JSON_CONNECTION
22664 field_addr.name = "color_blue";
22665#endif /* FREECIV_JSON_CONNECTION */
22666 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
22667 RECEIVE_PACKET_FIELD_ERROR(color_blue);
22668 }
22669 }
22670 if (BV_ISSET(fields, 41)) {
22671 log_packet_detailed(" got field 'flags'");
22672#ifdef FREECIV_JSON_CONNECTION
22673 field_addr.name = "flags";
22674#endif /* FREECIV_JSON_CONNECTION */
22675 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
22676 RECEIVE_PACKET_FIELD_ERROR(flags);
22677 }
22678 }
22679 if (BV_ISSET(fields, 42)) {
22680 log_packet_detailed(" got field 'wonders'");
22681#ifdef FREECIV_JSON_CONNECTION
22682 field_addr.name = "wonders";
22683#endif /* FREECIV_JSON_CONNECTION */
22684 {
22685#ifdef FREECIV_JSON_CONNECTION
22686 int count;
22687
22688 /* Enter array. */
22689 field_addr.sub_location = plocation_elem_new(0);
22690
22691 for (count = 0;; count++) {
22692 int i;
22693
22694 field_addr.sub_location->number = count;
22695
22696 /* Enter diff array element (start at the index address). */
22697 field_addr.sub_location->sub_location = plocation_elem_new(0);
22698#else /* FREECIV_JSON_CONNECTION */
22699 while (TRUE) {
22700 int i;
22701#endif /* FREECIV_JSON_CONNECTION */
22702
22703 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
22704 RECEIVE_PACKET_FIELD_ERROR(wonders);
22705 }
22706 if (i == MAX_UINT16) {
22707#ifdef FREECIV_JSON_CONNECTION
22708 /* Exit diff array element. */
22709 FC_FREE(field_addr.sub_location->sub_location);
22710
22711 /* Exit diff array. */
22712 FC_FREE(field_addr.sub_location);
22713#endif /* FREECIV_JSON_CONNECTION */
22714
22715 break;
22716 }
22717 if (i > B_LAST) {
22718 RECEIVE_PACKET_FIELD_ERROR(wonders,
22719 ": unexpected value %d "
22720 "(> B_LAST) in array diff",
22721 i);
22722 } else {
22723#ifdef FREECIV_JSON_CONNECTION
22724 /* Content address. */
22725 field_addr.sub_location->sub_location->number = 1;
22726#endif /* FREECIV_JSON_CONNECTION */
22727 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->wonders[i])) {
22728 RECEIVE_PACKET_FIELD_ERROR(wonders);
22729 }
22730 }
22731
22732#ifdef FREECIV_JSON_CONNECTION
22733 /* Exit diff array element. */
22734 FC_FREE(field_addr.sub_location->sub_location);
22735#endif /* FREECIV_JSON_CONNECTION */
22736 }
22737
22738#ifdef FREECIV_JSON_CONNECTION
22739 /* Exit array. */
22740 FC_FREE(field_addr.sub_location);
22741#endif /* FREECIV_JSON_CONNECTION */
22742 }
22743 }
22744 if (BV_ISSET(fields, 43)) {
22745 log_packet_detailed(" got field 'multip_count'");
22746#ifdef FREECIV_JSON_CONNECTION
22747 field_addr.name = "multip_count";
22748#endif /* FREECIV_JSON_CONNECTION */
22749 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->multip_count)) {
22750 RECEIVE_PACKET_FIELD_ERROR(multip_count);
22751 }
22752 }
22753 if (BV_ISSET(fields, 44)) {
22754 log_packet_detailed(" got field 'multiplier'");
22755#ifdef FREECIV_JSON_CONNECTION
22756 field_addr.name = "multiplier";
22757#endif /* FREECIV_JSON_CONNECTION */
22758 {
22759 int i;
22760
22761#ifdef FREECIV_JSON_CONNECTION
22762 /* Enter array. */
22763 field_addr.sub_location = plocation_elem_new(0);
22764#endif /* FREECIV_JSON_CONNECTION */
22765
22766 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22767 RECEIVE_PACKET_FIELD_ERROR(multiplier, ": truncation array");
22768 }
22769 for (i = 0; i < real_packet->multip_count; i++) {
22770#ifdef FREECIV_JSON_CONNECTION
22771 field_addr.sub_location->number = i;
22772#endif /* FREECIV_JSON_CONNECTION */
22773 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier[i])) {
22774 RECEIVE_PACKET_FIELD_ERROR(multiplier);
22775 }
22776 }
22777
22778#ifdef FREECIV_JSON_CONNECTION
22779 /* Exit array. */
22780 FC_FREE(field_addr.sub_location);
22781#endif /* FREECIV_JSON_CONNECTION */
22782 }
22783 }
22784 if (BV_ISSET(fields, 45)) {
22785 log_packet_detailed(" got field 'multiplier_target'");
22786#ifdef FREECIV_JSON_CONNECTION
22787 field_addr.name = "multiplier_target";
22788#endif /* FREECIV_JSON_CONNECTION */
22789 {
22790 int i;
22791
22792#ifdef FREECIV_JSON_CONNECTION
22793 /* Enter array. */
22794 field_addr.sub_location = plocation_elem_new(0);
22795#endif /* FREECIV_JSON_CONNECTION */
22796
22797 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22798 RECEIVE_PACKET_FIELD_ERROR(multiplier_target, ": truncation array");
22799 }
22800 for (i = 0; i < real_packet->multip_count; i++) {
22801#ifdef FREECIV_JSON_CONNECTION
22802 field_addr.sub_location->number = i;
22803#endif /* FREECIV_JSON_CONNECTION */
22804 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multiplier_target[i])) {
22805 RECEIVE_PACKET_FIELD_ERROR(multiplier_target);
22806 }
22807 }
22808
22809#ifdef FREECIV_JSON_CONNECTION
22810 /* Exit array. */
22811 FC_FREE(field_addr.sub_location);
22812#endif /* FREECIV_JSON_CONNECTION */
22813 }
22814 }
22815 if (BV_ISSET(fields, 46)) {
22816 log_packet_detailed(" got field 'multiplier_changed'");
22817#ifdef FREECIV_JSON_CONNECTION
22818 field_addr.name = "multiplier_changed";
22819#endif /* FREECIV_JSON_CONNECTION */
22820 {
22821 int i;
22822
22823#ifdef FREECIV_JSON_CONNECTION
22824 /* Enter array. */
22825 field_addr.sub_location = plocation_elem_new(0);
22826#endif /* FREECIV_JSON_CONNECTION */
22827
22828 if (real_packet->multip_count > MAX_NUM_MULTIPLIERS) {
22829 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed, ": truncation array");
22830 }
22831 for (i = 0; i < real_packet->multip_count; i++) {
22832#ifdef FREECIV_JSON_CONNECTION
22833 field_addr.sub_location->number = i;
22834#endif /* FREECIV_JSON_CONNECTION */
22835 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->multiplier_changed[i])) {
22836 RECEIVE_PACKET_FIELD_ERROR(multiplier_changed);
22837 }
22838 }
22839
22840#ifdef FREECIV_JSON_CONNECTION
22841 /* Exit array. */
22842 FC_FREE(field_addr.sub_location);
22843#endif /* FREECIV_JSON_CONNECTION */
22844 }
22845 }
22846
22847 if (NULL == old) {
22848 old = fc_malloc(sizeof(*old));
22849 *old = *real_packet;
22850 genhash_insert(*hash, old, old);
22851 } else {
22852 *old = *real_packet;
22853 }
22854
22855#endif /* FREECIV_DELTA_PROTOCOL */
22856 RECEIVE_PACKET_END(real_packet);
22857}
22858
22859 static int send_packet_player_info_100(struct connection *pc, const struct packet_player_info *packet)
22860{
22861 const struct packet_player_info *real_packet = packet;
22862 int e;
22863#ifdef FREECIV_DELTA_PROTOCOL
22864 packet_player_info_100_fields fields;
22865 struct packet_player_info *old;
22866 bool differ;
22867 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_INFO;
22868 int different = 0;
22869#endif /* FREECIV_DELTA_PROTOCOL */
22870 SEND_PACKET_START(PACKET_PLAYER_INFO);
22871#ifdef FREECIV_JSON_CONNECTION
22872 struct plocation field_addr;
22873 {
22874 struct plocation *field_addr_tmp = plocation_field_new(NULL);
22875 field_addr = *field_addr_tmp;
22876 FC_FREE(field_addr_tmp);
22877 }
22878#endif /* FREECIV_JSON_CONNECTION */
22879
22880 log_packet_detailed("packet_player_info_100: sending info about (%d)",
22881 real_packet->playerno);
22882
22883#ifdef FREECIV_DELTA_PROTOCOL
22884 if (NULL == *hash) {
22885 *hash = genhash_new_full(hash_packet_player_info_100, cmp_packet_player_info_100,
22886 NULL, NULL, NULL, free);
22887 }
22888 BV_CLR_ALL(fields);
22889
22890 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
22891 old = fc_malloc(sizeof(*old));
22892 *old = *real_packet;
22893 genhash_insert(*hash, old, old);
22894 memset(old, 0, sizeof(*old));
22895 different = 1; /* Force to send. */
22896 }
22897 differ = (strcmp(old->name, real_packet->name) != 0);
22898 if (differ) {
22899 different++;
22900 BV_SET(fields, 0);
22901 }
22902
22903 differ = (strcmp(old->username, real_packet->username) != 0);
22904 if (differ) {
22905 different++;
22906 BV_SET(fields, 1);
22907 }
22908
22909 differ = (old->unassigned_user != real_packet->unassigned_user);
22910 if (differ) {
22911 different++;
22912 }
22913 if (packet->unassigned_user) {
22914 BV_SET(fields, 2);
22915 }
22916
22917 differ = (old->score != real_packet->score);
22918 if (differ) {
22919 different++;
22920 BV_SET(fields, 3);
22921 }
22922
22923 differ = (old->is_male != real_packet->is_male);
22924 if (differ) {
22925 different++;
22926 }
22927 if (packet->is_male) {
22928 BV_SET(fields, 4);
22929 }
22930
22931 differ = (old->was_created != real_packet->was_created);
22932 if (differ) {
22933 different++;
22934 }
22935 if (packet->was_created) {
22936 BV_SET(fields, 5);
22937 }
22938
22939 differ = (old->government != real_packet->government);
22940 if (differ) {
22941 different++;
22942 BV_SET(fields, 6);
22943 }
22944
22945 differ = (old->target_government != real_packet->target_government);
22946 if (differ) {
22947 different++;
22948 BV_SET(fields, 7);
22949 }
22950
22951 differ = !BV_ARE_EQUAL(old->real_embassy, real_packet->real_embassy);
22952 if (differ) {
22953 different++;
22954 BV_SET(fields, 8);
22955 }
22956
22957 differ = (old->mood != real_packet->mood);
22958 if (differ) {
22959 different++;
22960 BV_SET(fields, 9);
22961 }
22962
22963 differ = (old->style != real_packet->style);
22964 if (differ) {
22965 different++;
22966 BV_SET(fields, 10);
22967 }
22968
22969 differ = (old->music_style != real_packet->music_style);
22970 if (differ) {
22971 different++;
22972 BV_SET(fields, 11);
22973 }
22974
22975 differ = (old->nation != real_packet->nation);
22976 if (differ) {
22977 different++;
22978 BV_SET(fields, 12);
22979 }
22980
22981 differ = (old->team != real_packet->team);
22982 if (differ) {
22983 different++;
22984 BV_SET(fields, 13);
22985 }
22986
22987 differ = (old->is_ready != real_packet->is_ready);
22988 if (differ) {
22989 different++;
22990 }
22991 if (packet->is_ready) {
22992 BV_SET(fields, 14);
22993 }
22994
22995 differ = (old->phase_done != real_packet->phase_done);
22996 if (differ) {
22997 different++;
22998 }
22999 if (packet->phase_done) {
23000 BV_SET(fields, 15);
23001 }
23002
23003 differ = (old->nturns_idle != real_packet->nturns_idle);
23004 if (differ) {
23005 different++;
23006 BV_SET(fields, 16);
23007 }
23008
23009 differ = (old->turns_alive != real_packet->turns_alive);
23010 if (differ) {
23011 different++;
23012 BV_SET(fields, 17);
23013 }
23014
23015 differ = (old->is_alive != real_packet->is_alive);
23016 if (differ) {
23017 different++;
23018 }
23019 if (packet->is_alive) {
23020 BV_SET(fields, 18);
23021 }
23022
23023 differ = (old->autoselect_weight != real_packet->autoselect_weight);
23024 if (differ) {
23025 different++;
23026 BV_SET(fields, 19);
23027 }
23028
23029 differ = (old->gold != real_packet->gold);
23030 if (differ) {
23031 different++;
23032 BV_SET(fields, 20);
23033 }
23034
23035 differ = (old->tax != real_packet->tax);
23036 if (differ) {
23037 different++;
23038 BV_SET(fields, 21);
23039 }
23040
23041 differ = (old->science != real_packet->science);
23042 if (differ) {
23043 different++;
23044 BV_SET(fields, 22);
23045 }
23046
23047 differ = (old->luxury != real_packet->luxury);
23048 if (differ) {
23049 different++;
23050 BV_SET(fields, 23);
23051 }
23052
23053 differ = (old->infrapoints != real_packet->infrapoints);
23054 if (differ) {
23055 different++;
23056 BV_SET(fields, 24);
23057 }
23058
23059 differ = (old->tech_upkeep != real_packet->tech_upkeep);
23060 if (differ) {
23061 different++;
23062 BV_SET(fields, 25);
23063 }
23064
23065 differ = (old->science_cost != real_packet->science_cost);
23066 if (differ) {
23067 different++;
23068 BV_SET(fields, 26);
23069 }
23070
23071 differ = (old->is_connected != real_packet->is_connected);
23072 if (differ) {
23073 different++;
23074 }
23075 if (packet->is_connected) {
23076 BV_SET(fields, 27);
23077 }
23078
23079 differ = (old->revolution_finishes != real_packet->revolution_finishes);
23080 if (differ) {
23081 different++;
23082 BV_SET(fields, 28);
23083 }
23084
23085 differ = (old->ai_skill_level != real_packet->ai_skill_level);
23086 if (differ) {
23087 different++;
23088 BV_SET(fields, 29);
23089 }
23090
23091 differ = (old->barbarian_type != real_packet->barbarian_type);
23092 if (differ) {
23093 different++;
23094 BV_SET(fields, 30);
23095 }
23096
23097 differ = !BV_ARE_EQUAL(old->gives_shared_vision, real_packet->gives_shared_vision);
23098 if (differ) {
23099 different++;
23100 BV_SET(fields, 31);
23101 }
23102
23103 differ = !BV_ARE_EQUAL(old->gives_shared_tiles, real_packet->gives_shared_tiles);
23104 if (differ) {
23105 different++;
23106 BV_SET(fields, 32);
23107 }
23108
23109 differ = (old->history != real_packet->history);
23110 if (differ) {
23111 different++;
23112 BV_SET(fields, 33);
23113 }
23114
23115 differ = (old->culture != real_packet->culture);
23116 if (differ) {
23117 different++;
23118 BV_SET(fields, 34);
23119 }
23120
23121 differ = FALSE;
23122 {
23123 int i;
23124
23125 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
23126 differ = (old->love[i] != real_packet->love[i]);
23127 if (differ) {
23128 break;
23129 }
23130 }
23131 }
23132 if (differ) {
23133 different++;
23134 BV_SET(fields, 35);
23135 }
23136
23137 differ = (old->color_valid != real_packet->color_valid);
23138 if (differ) {
23139 different++;
23140 }
23141 if (packet->color_valid) {
23142 BV_SET(fields, 36);
23143 }
23144
23145 differ = (old->color_changeable != real_packet->color_changeable);
23146 if (differ) {
23147 different++;
23148 }
23149 if (packet->color_changeable) {
23150 BV_SET(fields, 37);
23151 }
23152
23153 differ = (old->color_red != real_packet->color_red);
23154 if (differ) {
23155 different++;
23156 BV_SET(fields, 38);
23157 }
23158
23159 differ = (old->color_green != real_packet->color_green);
23160 if (differ) {
23161 different++;
23162 BV_SET(fields, 39);
23163 }
23164
23165 differ = (old->color_blue != real_packet->color_blue);
23166 if (differ) {
23167 different++;
23168 BV_SET(fields, 40);
23169 }
23170
23171 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
23172 if (differ) {
23173 different++;
23174 BV_SET(fields, 41);
23175 }
23176
23177 differ = FALSE;
23178 {
23179 int i;
23180
23181 for (i = 0; i < B_LAST; i++) {
23182 differ = (old->wonders[i] != real_packet->wonders[i]);
23183 if (differ) {
23184 break;
23185 }
23186 }
23187 }
23188 if (differ) {
23189 different++;
23190 BV_SET(fields, 42);
23191 }
23192
23193 differ = (old->multip_count != real_packet->multip_count);
23194 if (differ) {
23195 different++;
23196 BV_SET(fields, 43);
23197 }
23198
23199 differ = (old->multip_count != real_packet->multip_count);
23200 if (!differ) {
23201 int i;
23202
23203 for (i = 0; i < real_packet->multip_count; i++) {
23204 differ = (old->multiplier[i] != real_packet->multiplier[i]);
23205 if (differ) {
23206 break;
23207 }
23208 }
23209 }
23210 if (differ) {
23211 different++;
23212 BV_SET(fields, 44);
23213 }
23214
23215 differ = (old->multip_count != real_packet->multip_count);
23216 if (!differ) {
23217 int i;
23218
23219 for (i = 0; i < real_packet->multip_count; i++) {
23220 differ = (old->multiplier_target[i] != real_packet->multiplier_target[i]);
23221 if (differ) {
23222 break;
23223 }
23224 }
23225 }
23226 if (differ) {
23227 different++;
23228 BV_SET(fields, 45);
23229 }
23230
23231 differ = (old->multip_count != real_packet->multip_count);
23232 if (!differ) {
23233 int i;
23234
23235 for (i = 0; i < real_packet->multip_count; i++) {
23236 differ = (old->multiplier_changed[i] != real_packet->multiplier_changed[i]);
23237 if (differ) {
23238 break;
23239 }
23240 }
23241 }
23242 if (differ) {
23243 different++;
23244 BV_SET(fields, 46);
23245 }
23246
23247 if (different == 0) {
23248 log_packet_detailed(" no change -> discard");
23249 return 0;
23250 }
23251
23252#ifdef FREECIV_JSON_CONNECTION
23253 field_addr.name = "fields";
23254#endif /* FREECIV_JSON_CONNECTION */
23255 e = 0;
23256 e |= DIO_BV_PUT(&dout, &field_addr, fields);
23257 if (e) {
23258 log_packet_detailed("fields bitvector error detected");
23259 }
23260#ifdef FREECIV_JSON_CONNECTION
23261 field_addr.name = "playerno";
23262#endif /* FREECIV_JSON_CONNECTION */
23263 e = 0;
23264 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
23265 if (e) {
23266 log_packet_detailed("'playerno' field error detected");
23267 }
23268
23269 if (BV_ISSET(fields, 0)) {
23270 log_packet_detailed(" field 'name' has changed");
23271#ifdef FREECIV_JSON_CONNECTION
23272 field_addr.name = "name";
23273#endif /* FREECIV_JSON_CONNECTION */
23274 e = 0;
23275 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
23276 if (e) {
23277 log_packet_detailed("'name' field error detected");
23278 }
23279 }
23280 if (BV_ISSET(fields, 1)) {
23281 log_packet_detailed(" field 'username' has changed");
23282#ifdef FREECIV_JSON_CONNECTION
23283 field_addr.name = "username";
23284#endif /* FREECIV_JSON_CONNECTION */
23285 e = 0;
23286 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
23287 if (e) {
23288 log_packet_detailed("'username' field error detected");
23289 }
23290 }
23291 /* field 2 is folded into the header */
23292 if (BV_ISSET(fields, 3)) {
23293 log_packet_detailed(" field 'score' has changed");
23294#ifdef FREECIV_JSON_CONNECTION
23295 field_addr.name = "score";
23296#endif /* FREECIV_JSON_CONNECTION */
23297 e = 0;
23298 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
23299 if (e) {
23300 log_packet_detailed("'score' field error detected");
23301 }
23302 }
23303 /* field 4 is folded into the header */
23304 /* field 5 is folded into the header */
23305 if (BV_ISSET(fields, 6)) {
23306 log_packet_detailed(" field 'government' has changed");
23307#ifdef FREECIV_JSON_CONNECTION
23308 field_addr.name = "government";
23309#endif /* FREECIV_JSON_CONNECTION */
23310 e = 0;
23311 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
23312 if (e) {
23313 log_packet_detailed("'government' field error detected");
23314 }
23315 }
23316 if (BV_ISSET(fields, 7)) {
23317 log_packet_detailed(" field 'target_government' has changed");
23318#ifdef FREECIV_JSON_CONNECTION
23319 field_addr.name = "target_government";
23320#endif /* FREECIV_JSON_CONNECTION */
23321 e = 0;
23322 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
23323 if (e) {
23324 log_packet_detailed("'target_government' field error detected");
23325 }
23326 }
23327 if (BV_ISSET(fields, 8)) {
23328 log_packet_detailed(" field 'real_embassy' has changed");
23329#ifdef FREECIV_JSON_CONNECTION
23330 field_addr.name = "real_embassy";
23331#endif /* FREECIV_JSON_CONNECTION */
23332 e = 0;
23333 e |= DIO_BV_PUT(&dout, &field_addr, packet->real_embassy);
23334 if (e) {
23335 log_packet_detailed("'real_embassy' field error detected");
23336 }
23337 }
23338 if (BV_ISSET(fields, 9)) {
23339 log_packet_detailed(" field 'mood' has changed");
23340#ifdef FREECIV_JSON_CONNECTION
23341 field_addr.name = "mood";
23342#endif /* FREECIV_JSON_CONNECTION */
23343 e = 0;
23344 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mood);
23345 if (e) {
23346 log_packet_detailed("'mood' field error detected");
23347 }
23348 }
23349 if (BV_ISSET(fields, 10)) {
23350 log_packet_detailed(" field 'style' has changed");
23351#ifdef FREECIV_JSON_CONNECTION
23352 field_addr.name = "style";
23353#endif /* FREECIV_JSON_CONNECTION */
23354 e = 0;
23355 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
23356 if (e) {
23357 log_packet_detailed("'style' field error detected");
23358 }
23359 }
23360 if (BV_ISSET(fields, 11)) {
23361 log_packet_detailed(" field 'music_style' has changed");
23362#ifdef FREECIV_JSON_CONNECTION
23363 field_addr.name = "music_style";
23364#endif /* FREECIV_JSON_CONNECTION */
23365 e = 0;
23366 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->music_style);
23367 if (e) {
23368 log_packet_detailed("'music_style' field error detected");
23369 }
23370 }
23371 if (BV_ISSET(fields, 12)) {
23372 log_packet_detailed(" field 'nation' has changed");
23373#ifdef FREECIV_JSON_CONNECTION
23374 field_addr.name = "nation";
23375#endif /* FREECIV_JSON_CONNECTION */
23376 e = 0;
23377 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
23378 if (e) {
23379 log_packet_detailed("'nation' field error detected");
23380 }
23381 }
23382 if (BV_ISSET(fields, 13)) {
23383 log_packet_detailed(" field 'team' has changed");
23384#ifdef FREECIV_JSON_CONNECTION
23385 field_addr.name = "team";
23386#endif /* FREECIV_JSON_CONNECTION */
23387 e = 0;
23388 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
23389 if (e) {
23390 log_packet_detailed("'team' field error detected");
23391 }
23392 }
23393 /* field 14 is folded into the header */
23394 /* field 15 is folded into the header */
23395 if (BV_ISSET(fields, 16)) {
23396 log_packet_detailed(" field 'nturns_idle' has changed");
23397#ifdef FREECIV_JSON_CONNECTION
23398 field_addr.name = "nturns_idle";
23399#endif /* FREECIV_JSON_CONNECTION */
23400 e = 0;
23401 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
23402 if (e) {
23403 log_packet_detailed("'nturns_idle' field error detected");
23404 }
23405 }
23406 if (BV_ISSET(fields, 17)) {
23407 log_packet_detailed(" field 'turns_alive' has changed");
23408#ifdef FREECIV_JSON_CONNECTION
23409 field_addr.name = "turns_alive";
23410#endif /* FREECIV_JSON_CONNECTION */
23411 e = 0;
23412 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turns_alive);
23413 if (e) {
23414 log_packet_detailed("'turns_alive' field error detected");
23415 }
23416 }
23417 /* field 18 is folded into the header */
23418 if (BV_ISSET(fields, 19)) {
23419 log_packet_detailed(" field 'autoselect_weight' has changed");
23420#ifdef FREECIV_JSON_CONNECTION
23421 field_addr.name = "autoselect_weight";
23422#endif /* FREECIV_JSON_CONNECTION */
23423 e = 0;
23424 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
23425 if (e) {
23426 log_packet_detailed("'autoselect_weight' field error detected");
23427 }
23428 }
23429 if (BV_ISSET(fields, 20)) {
23430 log_packet_detailed(" field 'gold' has changed");
23431#ifdef FREECIV_JSON_CONNECTION
23432 field_addr.name = "gold";
23433#endif /* FREECIV_JSON_CONNECTION */
23434 e = 0;
23435 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
23436 if (e) {
23437 log_packet_detailed("'gold' field error detected");
23438 }
23439 }
23440 if (BV_ISSET(fields, 21)) {
23441 log_packet_detailed(" field 'tax' has changed");
23442#ifdef FREECIV_JSON_CONNECTION
23443 field_addr.name = "tax";
23444#endif /* FREECIV_JSON_CONNECTION */
23445 e = 0;
23446 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
23447 if (e) {
23448 log_packet_detailed("'tax' field error detected");
23449 }
23450 }
23451 if (BV_ISSET(fields, 22)) {
23452 log_packet_detailed(" field 'science' has changed");
23453#ifdef FREECIV_JSON_CONNECTION
23454 field_addr.name = "science";
23455#endif /* FREECIV_JSON_CONNECTION */
23456 e = 0;
23457 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
23458 if (e) {
23459 log_packet_detailed("'science' field error detected");
23460 }
23461 }
23462 if (BV_ISSET(fields, 23)) {
23463 log_packet_detailed(" field 'luxury' has changed");
23464#ifdef FREECIV_JSON_CONNECTION
23465 field_addr.name = "luxury";
23466#endif /* FREECIV_JSON_CONNECTION */
23467 e = 0;
23468 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
23469 if (e) {
23470 log_packet_detailed("'luxury' field error detected");
23471 }
23472 }
23473 if (BV_ISSET(fields, 24)) {
23474 log_packet_detailed(" field 'infrapoints' has changed");
23475#ifdef FREECIV_JSON_CONNECTION
23476 field_addr.name = "infrapoints";
23477#endif /* FREECIV_JSON_CONNECTION */
23478 e = 0;
23479 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
23480 if (e) {
23481 log_packet_detailed("'infrapoints' field error detected");
23482 }
23483 }
23484 if (BV_ISSET(fields, 25)) {
23485 log_packet_detailed(" field 'tech_upkeep' has changed");
23486#ifdef FREECIV_JSON_CONNECTION
23487 field_addr.name = "tech_upkeep";
23488#endif /* FREECIV_JSON_CONNECTION */
23489 e = 0;
23490 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep);
23491 if (e) {
23492 log_packet_detailed("'tech_upkeep' field error detected");
23493 }
23494 }
23495 if (BV_ISSET(fields, 26)) {
23496 log_packet_detailed(" field 'science_cost' has changed");
23497#ifdef FREECIV_JSON_CONNECTION
23498 field_addr.name = "science_cost";
23499#endif /* FREECIV_JSON_CONNECTION */
23500 e = 0;
23501 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->science_cost);
23502 if (e) {
23503 log_packet_detailed("'science_cost' field error detected");
23504 }
23505 }
23506 /* field 27 is folded into the header */
23507 if (BV_ISSET(fields, 28)) {
23508 log_packet_detailed(" field 'revolution_finishes' has changed");
23509#ifdef FREECIV_JSON_CONNECTION
23510 field_addr.name = "revolution_finishes";
23511#endif /* FREECIV_JSON_CONNECTION */
23512 e = 0;
23513 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
23514 if (e) {
23515 log_packet_detailed("'revolution_finishes' field error detected");
23516 }
23517 }
23518 if (BV_ISSET(fields, 29)) {
23519 log_packet_detailed(" field 'ai_skill_level' has changed");
23520#ifdef FREECIV_JSON_CONNECTION
23521 field_addr.name = "ai_skill_level";
23522#endif /* FREECIV_JSON_CONNECTION */
23523 e = 0;
23524 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ai_skill_level);
23525 if (e) {
23526 log_packet_detailed("'ai_skill_level' field error detected");
23527 }
23528 }
23529 if (BV_ISSET(fields, 30)) {
23530 log_packet_detailed(" field 'barbarian_type' has changed");
23531#ifdef FREECIV_JSON_CONNECTION
23532 field_addr.name = "barbarian_type";
23533#endif /* FREECIV_JSON_CONNECTION */
23534 e = 0;
23535 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
23536 if (e) {
23537 log_packet_detailed("'barbarian_type' field error detected");
23538 }
23539 }
23540 if (BV_ISSET(fields, 31)) {
23541 log_packet_detailed(" field 'gives_shared_vision' has changed");
23542#ifdef FREECIV_JSON_CONNECTION
23543 field_addr.name = "gives_shared_vision";
23544#endif /* FREECIV_JSON_CONNECTION */
23545 e = 0;
23546 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_vision);
23547 if (e) {
23548 log_packet_detailed("'gives_shared_vision' field error detected");
23549 }
23550 }
23551 if (BV_ISSET(fields, 32)) {
23552 log_packet_detailed(" field 'gives_shared_tiles' has changed");
23553#ifdef FREECIV_JSON_CONNECTION
23554 field_addr.name = "gives_shared_tiles";
23555#endif /* FREECIV_JSON_CONNECTION */
23556 e = 0;
23557 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_tiles);
23558 if (e) {
23559 log_packet_detailed("'gives_shared_tiles' field error detected");
23560 }
23561 }
23562 if (BV_ISSET(fields, 33)) {
23563 log_packet_detailed(" field 'history' has changed");
23564#ifdef FREECIV_JSON_CONNECTION
23565 field_addr.name = "history";
23566#endif /* FREECIV_JSON_CONNECTION */
23567 e = 0;
23568 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
23569 if (e) {
23570 log_packet_detailed("'history' field error detected");
23571 }
23572 }
23573 if (BV_ISSET(fields, 34)) {
23574 log_packet_detailed(" field 'culture' has changed");
23575#ifdef FREECIV_JSON_CONNECTION
23576 field_addr.name = "culture";
23577#endif /* FREECIV_JSON_CONNECTION */
23578 e = 0;
23579 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
23580 if (e) {
23581 log_packet_detailed("'culture' field error detected");
23582 }
23583 }
23584 if (BV_ISSET(fields, 35)) {
23585 log_packet_detailed(" field 'love' has changed");
23586#ifdef FREECIV_JSON_CONNECTION
23587 field_addr.name = "love";
23588#endif /* FREECIV_JSON_CONNECTION */
23589 e = 0;
23590 {
23591 int i;
23592
23593#ifdef FREECIV_JSON_CONNECTION
23594 /* Create the array. */
23595 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
23596
23597 /* Enter the array. */
23598 field_addr.sub_location = plocation_elem_new(0);
23599#endif /* FREECIV_JSON_CONNECTION */
23600
23601 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
23602#ifdef FREECIV_JSON_CONNECTION
23603 /* Next array element. */
23604 field_addr.sub_location->number = i;
23605#endif /* FREECIV_JSON_CONNECTION */
23606 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->love[i]);
23607 }
23608
23609#ifdef FREECIV_JSON_CONNECTION
23610 /* Exit array. */
23611 FC_FREE(field_addr.sub_location);
23612#endif /* FREECIV_JSON_CONNECTION */
23613 }
23614 if (e) {
23615 log_packet_detailed("'love' field error detected");
23616 }
23617 }
23618 /* field 36 is folded into the header */
23619 /* field 37 is folded into the header */
23620 if (BV_ISSET(fields, 38)) {
23621 log_packet_detailed(" field 'color_red' has changed");
23622#ifdef FREECIV_JSON_CONNECTION
23623 field_addr.name = "color_red";
23624#endif /* FREECIV_JSON_CONNECTION */
23625 e = 0;
23626 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
23627 if (e) {
23628 log_packet_detailed("'color_red' field error detected");
23629 }
23630 }
23631 if (BV_ISSET(fields, 39)) {
23632 log_packet_detailed(" field 'color_green' has changed");
23633#ifdef FREECIV_JSON_CONNECTION
23634 field_addr.name = "color_green";
23635#endif /* FREECIV_JSON_CONNECTION */
23636 e = 0;
23637 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
23638 if (e) {
23639 log_packet_detailed("'color_green' field error detected");
23640 }
23641 }
23642 if (BV_ISSET(fields, 40)) {
23643 log_packet_detailed(" field 'color_blue' has changed");
23644#ifdef FREECIV_JSON_CONNECTION
23645 field_addr.name = "color_blue";
23646#endif /* FREECIV_JSON_CONNECTION */
23647 e = 0;
23648 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
23649 if (e) {
23650 log_packet_detailed("'color_blue' field error detected");
23651 }
23652 }
23653 if (BV_ISSET(fields, 41)) {
23654 log_packet_detailed(" field 'flags' has changed");
23655#ifdef FREECIV_JSON_CONNECTION
23656 field_addr.name = "flags";
23657#endif /* FREECIV_JSON_CONNECTION */
23658 e = 0;
23659 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
23660 if (e) {
23661 log_packet_detailed("'flags' field error detected");
23662 }
23663 }
23664 if (BV_ISSET(fields, 42)) {
23665 log_packet_detailed(" field 'wonders' has changed");
23666#ifdef FREECIV_JSON_CONNECTION
23667 field_addr.name = "wonders";
23668#endif /* FREECIV_JSON_CONNECTION */
23669 e = 0;
23670 {
23671 int i;
23672
23673#ifdef FREECIV_JSON_CONNECTION
23674 size_t count_i = 0;
23675
23676 /* Create the array. */
23677 e |= DIO_PUT(farray, &dout, &field_addr, 0);
23678
23679 /* Enter array. */
23680 field_addr.sub_location = plocation_elem_new(0);
23681#endif /* FREECIV_JSON_CONNECTION */
23682
23683 fc_assert(B_LAST < MAX_UINT16);
23684
23685 for (i = 0; i < B_LAST; i++) {
23686 differ = (old->wonders[i] != real_packet->wonders[i]);
23687
23688 if (differ) {
23689#ifdef FREECIV_JSON_CONNECTION
23690 /* Append next diff array element. */
23691 field_addr.sub_location->number = -1;
23692
23693 /* Create the diff array element. */
23694 e |= DIO_PUT(farray, &dout, &field_addr, 2);
23695
23696 /* Enter diff array element (start at the index address). */
23697 field_addr.sub_location->number = count_i++;
23698 field_addr.sub_location->sub_location = plocation_elem_new(0);
23699#endif /* FREECIV_JSON_CONNECTION */
23700 e |= DIO_PUT(uint16, &dout, &field_addr, i);
23701
23702#ifdef FREECIV_JSON_CONNECTION
23703 /* Content address. */
23704 field_addr.sub_location->sub_location->number = 1;
23705#endif /* FREECIV_JSON_CONNECTION */
23706 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->wonders[i]);
23707
23708#ifdef FREECIV_JSON_CONNECTION
23709 /* Exit diff array element. */
23710 FC_FREE(field_addr.sub_location->sub_location);
23711#endif /* FREECIV_JSON_CONNECTION */
23712 }
23713 }
23714#ifdef FREECIV_JSON_CONNECTION
23715 /* Append diff array element. */
23716 field_addr.sub_location->number = -1;
23717
23718 /* Create the terminating diff array element. */
23719 e |= DIO_PUT(farray, &dout, &field_addr, 1);
23720
23721 /* Enter diff array element (start at the index address). */
23722 field_addr.sub_location->number = count_i;
23723 field_addr.sub_location->sub_location = plocation_elem_new(0);
23724#endif /* FREECIV_JSON_CONNECTION */
23725 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
23726
23727#ifdef FREECIV_JSON_CONNECTION
23728 /* Exit diff array element. */
23729 FC_FREE(field_addr.sub_location->sub_location);
23730
23731 /* Exit array. */
23732 FC_FREE(field_addr.sub_location);
23733#endif /* FREECIV_JSON_CONNECTION */
23734 }
23735 if (e) {
23736 log_packet_detailed("'wonders' field error detected");
23737 }
23738 }
23739 if (BV_ISSET(fields, 43)) {
23740 log_packet_detailed(" field 'multip_count' has changed");
23741#ifdef FREECIV_JSON_CONNECTION
23742 field_addr.name = "multip_count";
23743#endif /* FREECIV_JSON_CONNECTION */
23744 e = 0;
23745 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multip_count);
23746 if (e) {
23747 log_packet_detailed("'multip_count' field error detected");
23748 }
23749 }
23750 if (BV_ISSET(fields, 44)) {
23751 log_packet_detailed(" field 'multiplier' has changed");
23752#ifdef FREECIV_JSON_CONNECTION
23753 field_addr.name = "multiplier";
23754#endif /* FREECIV_JSON_CONNECTION */
23755 e = 0;
23756 {
23757 int i;
23758
23759#ifdef FREECIV_JSON_CONNECTION
23760 /* Create the array. */
23761 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
23762
23763 /* Enter the array. */
23764 field_addr.sub_location = plocation_elem_new(0);
23765#endif /* FREECIV_JSON_CONNECTION */
23766
23767 for (i = 0; i < real_packet->multip_count; i++) {
23768#ifdef FREECIV_JSON_CONNECTION
23769 /* Next array element. */
23770 field_addr.sub_location->number = i;
23771#endif /* FREECIV_JSON_CONNECTION */
23772 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier[i]);
23773 }
23774
23775#ifdef FREECIV_JSON_CONNECTION
23776 /* Exit array. */
23777 FC_FREE(field_addr.sub_location);
23778#endif /* FREECIV_JSON_CONNECTION */
23779 }
23780 if (e) {
23781 log_packet_detailed("'multiplier' field error detected");
23782 }
23783 }
23784 if (BV_ISSET(fields, 45)) {
23785 log_packet_detailed(" field 'multiplier_target' has changed");
23786#ifdef FREECIV_JSON_CONNECTION
23787 field_addr.name = "multiplier_target";
23788#endif /* FREECIV_JSON_CONNECTION */
23789 e = 0;
23790 {
23791 int i;
23792
23793#ifdef FREECIV_JSON_CONNECTION
23794 /* Create the array. */
23795 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
23796
23797 /* Enter the array. */
23798 field_addr.sub_location = plocation_elem_new(0);
23799#endif /* FREECIV_JSON_CONNECTION */
23800
23801 for (i = 0; i < real_packet->multip_count; i++) {
23802#ifdef FREECIV_JSON_CONNECTION
23803 /* Next array element. */
23804 field_addr.sub_location->number = i;
23805#endif /* FREECIV_JSON_CONNECTION */
23806 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier_target[i]);
23807 }
23808
23809#ifdef FREECIV_JSON_CONNECTION
23810 /* Exit array. */
23811 FC_FREE(field_addr.sub_location);
23812#endif /* FREECIV_JSON_CONNECTION */
23813 }
23814 if (e) {
23815 log_packet_detailed("'multiplier_target' field error detected");
23816 }
23817 }
23818 if (BV_ISSET(fields, 46)) {
23819 log_packet_detailed(" field 'multiplier_changed' has changed");
23820#ifdef FREECIV_JSON_CONNECTION
23821 field_addr.name = "multiplier_changed";
23822#endif /* FREECIV_JSON_CONNECTION */
23823 e = 0;
23824 {
23825 int i;
23826
23827#ifdef FREECIV_JSON_CONNECTION
23828 /* Create the array. */
23829 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
23830
23831 /* Enter the array. */
23832 field_addr.sub_location = plocation_elem_new(0);
23833#endif /* FREECIV_JSON_CONNECTION */
23834
23835 for (i = 0; i < real_packet->multip_count; i++) {
23836#ifdef FREECIV_JSON_CONNECTION
23837 /* Next array element. */
23838 field_addr.sub_location->number = i;
23839#endif /* FREECIV_JSON_CONNECTION */
23840 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->multiplier_changed[i]);
23841 }
23842
23843#ifdef FREECIV_JSON_CONNECTION
23844 /* Exit array. */
23845 FC_FREE(field_addr.sub_location);
23846#endif /* FREECIV_JSON_CONNECTION */
23847 }
23848 if (e) {
23849 log_packet_detailed("'multiplier_changed' field error detected");
23850 }
23851 }
23852
23853 *old = *real_packet;
23854#endif /* FREECIV_DELTA_PROTOCOL */
23855#ifndef FREECIV_DELTA_PROTOCOL
23856#ifdef FREECIV_JSON_CONNECTION
23857 field_addr.name = "playerno";
23858#endif /* FREECIV_JSON_CONNECTION */
23859 e = 0;
23860 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
23861 if (e) {
23862 log_packet_detailed("'playerno' field error detected");
23863 }
23864#ifdef FREECIV_JSON_CONNECTION
23865 field_addr.name = "name";
23866#endif /* FREECIV_JSON_CONNECTION */
23867 e = 0;
23868 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
23869 if (e) {
23870 log_packet_detailed("'name' field error detected");
23871 }
23872#ifdef FREECIV_JSON_CONNECTION
23873 field_addr.name = "username";
23874#endif /* FREECIV_JSON_CONNECTION */
23875 e = 0;
23876 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
23877 if (e) {
23878 log_packet_detailed("'username' field error detected");
23879 }
23880#ifdef FREECIV_JSON_CONNECTION
23881 field_addr.name = "unassigned_user";
23882#endif /* FREECIV_JSON_CONNECTION */
23883 e = 0;
23884 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unassigned_user);
23885 if (e) {
23886 log_packet_detailed("'unassigned_user' field error detected");
23887 }
23888#ifdef FREECIV_JSON_CONNECTION
23889 field_addr.name = "score";
23890#endif /* FREECIV_JSON_CONNECTION */
23891 e = 0;
23892 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->score);
23893 if (e) {
23894 log_packet_detailed("'score' field error detected");
23895 }
23896#ifdef FREECIV_JSON_CONNECTION
23897 field_addr.name = "is_male";
23898#endif /* FREECIV_JSON_CONNECTION */
23899 e = 0;
23900 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
23901 if (e) {
23902 log_packet_detailed("'is_male' field error detected");
23903 }
23904#ifdef FREECIV_JSON_CONNECTION
23905 field_addr.name = "was_created";
23906#endif /* FREECIV_JSON_CONNECTION */
23907 e = 0;
23908 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->was_created);
23909 if (e) {
23910 log_packet_detailed("'was_created' field error detected");
23911 }
23912#ifdef FREECIV_JSON_CONNECTION
23913 field_addr.name = "government";
23914#endif /* FREECIV_JSON_CONNECTION */
23915 e = 0;
23916 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
23917 if (e) {
23918 log_packet_detailed("'government' field error detected");
23919 }
23920#ifdef FREECIV_JSON_CONNECTION
23921 field_addr.name = "target_government";
23922#endif /* FREECIV_JSON_CONNECTION */
23923 e = 0;
23924 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
23925 if (e) {
23926 log_packet_detailed("'target_government' field error detected");
23927 }
23928#ifdef FREECIV_JSON_CONNECTION
23929 field_addr.name = "real_embassy";
23930#endif /* FREECIV_JSON_CONNECTION */
23931 e = 0;
23932 e |= DIO_BV_PUT(&dout, &field_addr, packet->real_embassy);
23933 if (e) {
23934 log_packet_detailed("'real_embassy' field error detected");
23935 }
23936#ifdef FREECIV_JSON_CONNECTION
23937 field_addr.name = "mood";
23938#endif /* FREECIV_JSON_CONNECTION */
23939 e = 0;
23940 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mood);
23941 if (e) {
23942 log_packet_detailed("'mood' field error detected");
23943 }
23944#ifdef FREECIV_JSON_CONNECTION
23945 field_addr.name = "style";
23946#endif /* FREECIV_JSON_CONNECTION */
23947 e = 0;
23948 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
23949 if (e) {
23950 log_packet_detailed("'style' field error detected");
23951 }
23952#ifdef FREECIV_JSON_CONNECTION
23953 field_addr.name = "music_style";
23954#endif /* FREECIV_JSON_CONNECTION */
23955 e = 0;
23956 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->music_style);
23957 if (e) {
23958 log_packet_detailed("'music_style' field error detected");
23959 }
23960#ifdef FREECIV_JSON_CONNECTION
23961 field_addr.name = "nation";
23962#endif /* FREECIV_JSON_CONNECTION */
23963 e = 0;
23964 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
23965 if (e) {
23966 log_packet_detailed("'nation' field error detected");
23967 }
23968#ifdef FREECIV_JSON_CONNECTION
23969 field_addr.name = "team";
23970#endif /* FREECIV_JSON_CONNECTION */
23971 e = 0;
23972 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
23973 if (e) {
23974 log_packet_detailed("'team' field error detected");
23975 }
23976#ifdef FREECIV_JSON_CONNECTION
23977 field_addr.name = "is_ready";
23978#endif /* FREECIV_JSON_CONNECTION */
23979 e = 0;
23980 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_ready);
23981 if (e) {
23982 log_packet_detailed("'is_ready' field error detected");
23983 }
23984#ifdef FREECIV_JSON_CONNECTION
23985 field_addr.name = "phase_done";
23986#endif /* FREECIV_JSON_CONNECTION */
23987 e = 0;
23988 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->phase_done);
23989 if (e) {
23990 log_packet_detailed("'phase_done' field error detected");
23991 }
23992#ifdef FREECIV_JSON_CONNECTION
23993 field_addr.name = "nturns_idle";
23994#endif /* FREECIV_JSON_CONNECTION */
23995 e = 0;
23996 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
23997 if (e) {
23998 log_packet_detailed("'nturns_idle' field error detected");
23999 }
24000#ifdef FREECIV_JSON_CONNECTION
24001 field_addr.name = "turns_alive";
24002#endif /* FREECIV_JSON_CONNECTION */
24003 e = 0;
24004 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turns_alive);
24005 if (e) {
24006 log_packet_detailed("'turns_alive' field error detected");
24007 }
24008#ifdef FREECIV_JSON_CONNECTION
24009 field_addr.name = "is_alive";
24010#endif /* FREECIV_JSON_CONNECTION */
24011 e = 0;
24012 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_alive);
24013 if (e) {
24014 log_packet_detailed("'is_alive' field error detected");
24015 }
24016#ifdef FREECIV_JSON_CONNECTION
24017 field_addr.name = "autoselect_weight";
24018#endif /* FREECIV_JSON_CONNECTION */
24019 e = 0;
24020 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
24021 if (e) {
24022 log_packet_detailed("'autoselect_weight' field error detected");
24023 }
24024#ifdef FREECIV_JSON_CONNECTION
24025 field_addr.name = "gold";
24026#endif /* FREECIV_JSON_CONNECTION */
24027 e = 0;
24028 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
24029 if (e) {
24030 log_packet_detailed("'gold' field error detected");
24031 }
24032#ifdef FREECIV_JSON_CONNECTION
24033 field_addr.name = "tax";
24034#endif /* FREECIV_JSON_CONNECTION */
24035 e = 0;
24036 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
24037 if (e) {
24038 log_packet_detailed("'tax' field error detected");
24039 }
24040#ifdef FREECIV_JSON_CONNECTION
24041 field_addr.name = "science";
24042#endif /* FREECIV_JSON_CONNECTION */
24043 e = 0;
24044 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
24045 if (e) {
24046 log_packet_detailed("'science' field error detected");
24047 }
24048#ifdef FREECIV_JSON_CONNECTION
24049 field_addr.name = "luxury";
24050#endif /* FREECIV_JSON_CONNECTION */
24051 e = 0;
24052 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
24053 if (e) {
24054 log_packet_detailed("'luxury' field error detected");
24055 }
24056#ifdef FREECIV_JSON_CONNECTION
24057 field_addr.name = "infrapoints";
24058#endif /* FREECIV_JSON_CONNECTION */
24059 e = 0;
24060 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->infrapoints);
24061 if (e) {
24062 log_packet_detailed("'infrapoints' field error detected");
24063 }
24064#ifdef FREECIV_JSON_CONNECTION
24065 field_addr.name = "tech_upkeep";
24066#endif /* FREECIV_JSON_CONNECTION */
24067 e = 0;
24068 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_upkeep);
24069 if (e) {
24070 log_packet_detailed("'tech_upkeep' field error detected");
24071 }
24072#ifdef FREECIV_JSON_CONNECTION
24073 field_addr.name = "science_cost";
24074#endif /* FREECIV_JSON_CONNECTION */
24075 e = 0;
24076 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->science_cost);
24077 if (e) {
24078 log_packet_detailed("'science_cost' field error detected");
24079 }
24080#ifdef FREECIV_JSON_CONNECTION
24081 field_addr.name = "is_connected";
24082#endif /* FREECIV_JSON_CONNECTION */
24083 e = 0;
24084 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_connected);
24085 if (e) {
24086 log_packet_detailed("'is_connected' field error detected");
24087 }
24088#ifdef FREECIV_JSON_CONNECTION
24089 field_addr.name = "revolution_finishes";
24090#endif /* FREECIV_JSON_CONNECTION */
24091 e = 0;
24092 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
24093 if (e) {
24094 log_packet_detailed("'revolution_finishes' field error detected");
24095 }
24096#ifdef FREECIV_JSON_CONNECTION
24097 field_addr.name = "ai_skill_level";
24098#endif /* FREECIV_JSON_CONNECTION */
24099 e = 0;
24100 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ai_skill_level);
24101 if (e) {
24102 log_packet_detailed("'ai_skill_level' field error detected");
24103 }
24104#ifdef FREECIV_JSON_CONNECTION
24105 field_addr.name = "barbarian_type";
24106#endif /* FREECIV_JSON_CONNECTION */
24107 e = 0;
24108 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
24109 if (e) {
24110 log_packet_detailed("'barbarian_type' field error detected");
24111 }
24112#ifdef FREECIV_JSON_CONNECTION
24113 field_addr.name = "gives_shared_vision";
24114#endif /* FREECIV_JSON_CONNECTION */
24115 e = 0;
24116 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_vision);
24117 if (e) {
24118 log_packet_detailed("'gives_shared_vision' field error detected");
24119 }
24120#ifdef FREECIV_JSON_CONNECTION
24121 field_addr.name = "gives_shared_tiles";
24122#endif /* FREECIV_JSON_CONNECTION */
24123 e = 0;
24124 e |= DIO_BV_PUT(&dout, &field_addr, packet->gives_shared_tiles);
24125 if (e) {
24126 log_packet_detailed("'gives_shared_tiles' field error detected");
24127 }
24128#ifdef FREECIV_JSON_CONNECTION
24129 field_addr.name = "history";
24130#endif /* FREECIV_JSON_CONNECTION */
24131 e = 0;
24132 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
24133 if (e) {
24134 log_packet_detailed("'history' field error detected");
24135 }
24136#ifdef FREECIV_JSON_CONNECTION
24137 field_addr.name = "culture";
24138#endif /* FREECIV_JSON_CONNECTION */
24139 e = 0;
24140 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->culture);
24141 if (e) {
24142 log_packet_detailed("'culture' field error detected");
24143 }
24144#ifdef FREECIV_JSON_CONNECTION
24145 field_addr.name = "love";
24146#endif /* FREECIV_JSON_CONNECTION */
24147 e = 0;
24148 {
24149 int i;
24150
24151#ifdef FREECIV_JSON_CONNECTION
24152 /* Create the array. */
24153 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_PLAYER_SLOTS);
24154
24155 /* Enter the array. */
24156 field_addr.sub_location = plocation_elem_new(0);
24157#endif /* FREECIV_JSON_CONNECTION */
24158
24159 for (i = 0; i < MAX_NUM_PLAYER_SLOTS; i++) {
24160#ifdef FREECIV_JSON_CONNECTION
24161 /* Next array element. */
24162 field_addr.sub_location->number = i;
24163#endif /* FREECIV_JSON_CONNECTION */
24164 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->love[i]);
24165 }
24166
24167#ifdef FREECIV_JSON_CONNECTION
24168 /* Exit array. */
24169 FC_FREE(field_addr.sub_location);
24170#endif /* FREECIV_JSON_CONNECTION */
24171 }
24172 if (e) {
24173 log_packet_detailed("'love' field error detected");
24174 }
24175#ifdef FREECIV_JSON_CONNECTION
24176 field_addr.name = "color_valid";
24177#endif /* FREECIV_JSON_CONNECTION */
24178 e = 0;
24179 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->color_valid);
24180 if (e) {
24181 log_packet_detailed("'color_valid' field error detected");
24182 }
24183#ifdef FREECIV_JSON_CONNECTION
24184 field_addr.name = "color_changeable";
24185#endif /* FREECIV_JSON_CONNECTION */
24186 e = 0;
24187 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->color_changeable);
24188 if (e) {
24189 log_packet_detailed("'color_changeable' field error detected");
24190 }
24191#ifdef FREECIV_JSON_CONNECTION
24192 field_addr.name = "color_red";
24193#endif /* FREECIV_JSON_CONNECTION */
24194 e = 0;
24195 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
24196 if (e) {
24197 log_packet_detailed("'color_red' field error detected");
24198 }
24199#ifdef FREECIV_JSON_CONNECTION
24200 field_addr.name = "color_green";
24201#endif /* FREECIV_JSON_CONNECTION */
24202 e = 0;
24203 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
24204 if (e) {
24205 log_packet_detailed("'color_green' field error detected");
24206 }
24207#ifdef FREECIV_JSON_CONNECTION
24208 field_addr.name = "color_blue";
24209#endif /* FREECIV_JSON_CONNECTION */
24210 e = 0;
24211 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
24212 if (e) {
24213 log_packet_detailed("'color_blue' field error detected");
24214 }
24215#ifdef FREECIV_JSON_CONNECTION
24216 field_addr.name = "flags";
24217#endif /* FREECIV_JSON_CONNECTION */
24218 e = 0;
24219 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
24220 if (e) {
24221 log_packet_detailed("'flags' field error detected");
24222 }
24223#ifdef FREECIV_JSON_CONNECTION
24224 field_addr.name = "wonders";
24225#endif /* FREECIV_JSON_CONNECTION */
24226 e = 0;
24227 {
24228 int i;
24229
24230#ifdef FREECIV_JSON_CONNECTION
24231 /* Create the array. */
24232 e |= DIO_PUT(farray, &dout, &field_addr, B_LAST);
24233
24234 /* Enter the array. */
24235 field_addr.sub_location = plocation_elem_new(0);
24236#endif /* FREECIV_JSON_CONNECTION */
24237
24238 for (i = 0; i < B_LAST; i++) {
24239#ifdef FREECIV_JSON_CONNECTION
24240 /* Next array element. */
24241 field_addr.sub_location->number = i;
24242#endif /* FREECIV_JSON_CONNECTION */
24243 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->wonders[i]);
24244 }
24245
24246#ifdef FREECIV_JSON_CONNECTION
24247 /* Exit array. */
24248 FC_FREE(field_addr.sub_location);
24249#endif /* FREECIV_JSON_CONNECTION */
24250 }
24251 if (e) {
24252 log_packet_detailed("'wonders' field error detected");
24253 }
24254#ifdef FREECIV_JSON_CONNECTION
24255 field_addr.name = "multip_count";
24256#endif /* FREECIV_JSON_CONNECTION */
24257 e = 0;
24258 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multip_count);
24259 if (e) {
24260 log_packet_detailed("'multip_count' field error detected");
24261 }
24262#ifdef FREECIV_JSON_CONNECTION
24263 field_addr.name = "multiplier";
24264#endif /* FREECIV_JSON_CONNECTION */
24265 e = 0;
24266 {
24267 int i;
24268
24269#ifdef FREECIV_JSON_CONNECTION
24270 /* Create the array. */
24271 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24272
24273 /* Enter the array. */
24274 field_addr.sub_location = plocation_elem_new(0);
24275#endif /* FREECIV_JSON_CONNECTION */
24276
24277 for (i = 0; i < real_packet->multip_count; i++) {
24278#ifdef FREECIV_JSON_CONNECTION
24279 /* Next array element. */
24280 field_addr.sub_location->number = i;
24281#endif /* FREECIV_JSON_CONNECTION */
24282 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier[i]);
24283 }
24284
24285#ifdef FREECIV_JSON_CONNECTION
24286 /* Exit array. */
24287 FC_FREE(field_addr.sub_location);
24288#endif /* FREECIV_JSON_CONNECTION */
24289 }
24290 if (e) {
24291 log_packet_detailed("'multiplier' field error detected");
24292 }
24293#ifdef FREECIV_JSON_CONNECTION
24294 field_addr.name = "multiplier_target";
24295#endif /* FREECIV_JSON_CONNECTION */
24296 e = 0;
24297 {
24298 int i;
24299
24300#ifdef FREECIV_JSON_CONNECTION
24301 /* Create the array. */
24302 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24303
24304 /* Enter the array. */
24305 field_addr.sub_location = plocation_elem_new(0);
24306#endif /* FREECIV_JSON_CONNECTION */
24307
24308 for (i = 0; i < real_packet->multip_count; i++) {
24309#ifdef FREECIV_JSON_CONNECTION
24310 /* Next array element. */
24311 field_addr.sub_location->number = i;
24312#endif /* FREECIV_JSON_CONNECTION */
24313 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multiplier_target[i]);
24314 }
24315
24316#ifdef FREECIV_JSON_CONNECTION
24317 /* Exit array. */
24318 FC_FREE(field_addr.sub_location);
24319#endif /* FREECIV_JSON_CONNECTION */
24320 }
24321 if (e) {
24322 log_packet_detailed("'multiplier_target' field error detected");
24323 }
24324#ifdef FREECIV_JSON_CONNECTION
24325 field_addr.name = "multiplier_changed";
24326#endif /* FREECIV_JSON_CONNECTION */
24327 e = 0;
24328 {
24329 int i;
24330
24331#ifdef FREECIV_JSON_CONNECTION
24332 /* Create the array. */
24333 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->multip_count);
24334
24335 /* Enter the array. */
24336 field_addr.sub_location = plocation_elem_new(0);
24337#endif /* FREECIV_JSON_CONNECTION */
24338
24339 for (i = 0; i < real_packet->multip_count; i++) {
24340#ifdef FREECIV_JSON_CONNECTION
24341 /* Next array element. */
24342 field_addr.sub_location->number = i;
24343#endif /* FREECIV_JSON_CONNECTION */
24344 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->multiplier_changed[i]);
24345 }
24346
24347#ifdef FREECIV_JSON_CONNECTION
24348 /* Exit array. */
24349 FC_FREE(field_addr.sub_location);
24350#endif /* FREECIV_JSON_CONNECTION */
24351 }
24352 if (e) {
24353 log_packet_detailed("'multiplier_changed' field error detected");
24354 }
24355
24356#endif
24357 SEND_PACKET_END(PACKET_PLAYER_INFO);
24358}
24359
24360 int send_packet_player_info(struct connection *pc, const struct packet_player_info *packet)
24361{
24362 if (!pc->used) {
24363 log_error("WARNING: trying to send data to the closed connection %s",
24364 conn_description(pc));
24365 return -1;
24366 }
24367 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_INFO].packet != NULL, -1,
24368 "Handler for PACKET_PLAYER_INFO not installed");
24369 return pc->phs.handlers->send[PACKET_PLAYER_INFO].packet(pc, packet);
24370}
24371
24372#ifdef FREECIV_DELTA_PROTOCOL
24373#define hash_packet_player_phase_done_100 hash_const
24374
24375#define cmp_packet_player_phase_done_100 cmp_const
24376
24377 BV_DEFINE(packet_player_phase_done_100_fields, 1);
24378#endif /* FREECIV_DELTA_PROTOCOL */
24379
24380 static struct packet_player_phase_done *receive_packet_player_phase_done_100(struct connection *pc)
24381{
24382#ifdef FREECIV_DELTA_PROTOCOL
24383 packet_player_phase_done_100_fields fields;
24384 struct packet_player_phase_done *old;
24385 struct genhash **hash = pc->phs.received + PACKET_PLAYER_PHASE_DONE;
24386#endif /* FREECIV_DELTA_PROTOCOL */
24387 RECEIVE_PACKET_START(packet_player_phase_done, real_packet);
24388#ifdef FREECIV_JSON_CONNECTION
24389 struct plocation field_addr;
24390 {
24391 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24392 field_addr = *field_addr_tmp;
24393 FC_FREE(field_addr_tmp);
24394 }
24395#endif /* FREECIV_JSON_CONNECTION */
24396
24397#ifdef FREECIV_DELTA_PROTOCOL
24398#ifdef FREECIV_JSON_CONNECTION
24399 field_addr.name = "fields";
24400#endif /* FREECIV_JSON_CONNECTION */
24401 DIO_BV_GET(&din, &field_addr, fields);
24402
24403#else /* FREECIV_DELTA_PROTOCOL */
24404#ifdef FREECIV_JSON_CONNECTION
24405 field_addr.name = "turn";
24406#endif /* FREECIV_JSON_CONNECTION */
24407 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
24408 RECEIVE_PACKET_FIELD_ERROR(turn);
24409 }
24410#endif
24411 log_packet_detailed("packet_player_phase_done_100: got info about ()");
24412
24413#ifdef FREECIV_DELTA_PROTOCOL
24414 if (NULL == *hash) {
24415 *hash = genhash_new_full(hash_packet_player_phase_done_100, cmp_packet_player_phase_done_100,
24416 NULL, NULL, NULL, free);
24417 }
24418
24419 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
24420 *real_packet = *old;
24421 } else {
24422 log_packet_detailed(" no old info");
24423 memset(real_packet, 0, sizeof(*real_packet));
24424 }
24425
24426 if (BV_ISSET(fields, 0)) {
24427 log_packet_detailed(" got field 'turn'");
24428#ifdef FREECIV_JSON_CONNECTION
24429 field_addr.name = "turn";
24430#endif /* FREECIV_JSON_CONNECTION */
24431 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
24432 RECEIVE_PACKET_FIELD_ERROR(turn);
24433 }
24434 }
24435
24436 if (NULL == old) {
24437 old = fc_malloc(sizeof(*old));
24438 *old = *real_packet;
24439 genhash_insert(*hash, old, old);
24440 } else {
24441 *old = *real_packet;
24442 }
24443
24444#endif /* FREECIV_DELTA_PROTOCOL */
24445 RECEIVE_PACKET_END(real_packet);
24446}
24447
24448 static int send_packet_player_phase_done_100(struct connection *pc, const struct packet_player_phase_done *packet)
24449{
24450 const struct packet_player_phase_done *real_packet = packet;
24451 int e;
24452#ifdef FREECIV_DELTA_PROTOCOL
24453 packet_player_phase_done_100_fields fields;
24454 struct packet_player_phase_done *old;
24455 bool differ;
24456 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_PHASE_DONE;
24457#endif /* FREECIV_DELTA_PROTOCOL */
24458 SEND_PACKET_START(PACKET_PLAYER_PHASE_DONE);
24459#ifdef FREECIV_JSON_CONNECTION
24460 struct plocation field_addr;
24461 {
24462 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24463 field_addr = *field_addr_tmp;
24464 FC_FREE(field_addr_tmp);
24465 }
24466#endif /* FREECIV_JSON_CONNECTION */
24467
24468 log_packet_detailed("packet_player_phase_done_100: sending info about ()");
24469
24470#ifdef FREECIV_DELTA_PROTOCOL
24471 if (NULL == *hash) {
24472 *hash = genhash_new_full(hash_packet_player_phase_done_100, cmp_packet_player_phase_done_100,
24473 NULL, NULL, NULL, free);
24474 }
24475 BV_CLR_ALL(fields);
24476
24477 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
24478 old = fc_malloc(sizeof(*old));
24479 *old = *real_packet;
24480 genhash_insert(*hash, old, old);
24481 memset(old, 0, sizeof(*old));
24482 }
24483 differ = (old->turn != real_packet->turn);
24484 if (differ) {
24485 BV_SET(fields, 0);
24486 }
24487
24488
24489#ifdef FREECIV_JSON_CONNECTION
24490 field_addr.name = "fields";
24491#endif /* FREECIV_JSON_CONNECTION */
24492 e = 0;
24493 e |= DIO_BV_PUT(&dout, &field_addr, fields);
24494 if (e) {
24495 log_packet_detailed("fields bitvector error detected");
24496 }
24497
24498 if (BV_ISSET(fields, 0)) {
24499 log_packet_detailed(" field 'turn' has changed");
24500#ifdef FREECIV_JSON_CONNECTION
24501 field_addr.name = "turn";
24502#endif /* FREECIV_JSON_CONNECTION */
24503 e = 0;
24504 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
24505 if (e) {
24506 log_packet_detailed("'turn' field error detected");
24507 }
24508 }
24509
24510 *old = *real_packet;
24511#endif /* FREECIV_DELTA_PROTOCOL */
24512#ifndef FREECIV_DELTA_PROTOCOL
24513#ifdef FREECIV_JSON_CONNECTION
24514 field_addr.name = "turn";
24515#endif /* FREECIV_JSON_CONNECTION */
24516 e = 0;
24517 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
24518 if (e) {
24519 log_packet_detailed("'turn' field error detected");
24520 }
24521
24522#endif
24523 SEND_PACKET_END(PACKET_PLAYER_PHASE_DONE);
24524}
24525
24526 int send_packet_player_phase_done(struct connection *pc, const struct packet_player_phase_done *packet)
24527{
24528 if (!pc->used) {
24529 log_error("WARNING: trying to send data to the closed connection %s",
24530 conn_description(pc));
24531 return -1;
24532 }
24533 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_PHASE_DONE].packet != NULL, -1,
24534 "Handler for PACKET_PLAYER_PHASE_DONE not installed");
24535 return pc->phs.handlers->send[PACKET_PLAYER_PHASE_DONE].packet(pc, packet);
24536}
24537
24538 int dsend_packet_player_phase_done(struct connection *pc, int turn)
24539{
24540 struct packet_player_phase_done packet, *real_packet = &packet;
24541
24542 real_packet->turn = turn;
24543
24544 return send_packet_player_phase_done(pc, real_packet);
24545}
24546
24547#ifdef FREECIV_DELTA_PROTOCOL
24548#define hash_packet_player_rates_100 hash_const
24549
24550#define cmp_packet_player_rates_100 cmp_const
24551
24552 BV_DEFINE(packet_player_rates_100_fields, 3);
24553#endif /* FREECIV_DELTA_PROTOCOL */
24554
24555 static struct packet_player_rates *receive_packet_player_rates_100(struct connection *pc)
24556{
24557#ifdef FREECIV_DELTA_PROTOCOL
24558 packet_player_rates_100_fields fields;
24559 struct packet_player_rates *old;
24560 struct genhash **hash = pc->phs.received + PACKET_PLAYER_RATES;
24561#endif /* FREECIV_DELTA_PROTOCOL */
24562 RECEIVE_PACKET_START(packet_player_rates, real_packet);
24563#ifdef FREECIV_JSON_CONNECTION
24564 struct plocation field_addr;
24565 {
24566 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24567 field_addr = *field_addr_tmp;
24568 FC_FREE(field_addr_tmp);
24569 }
24570#endif /* FREECIV_JSON_CONNECTION */
24571
24572#ifdef FREECIV_DELTA_PROTOCOL
24573#ifdef FREECIV_JSON_CONNECTION
24574 field_addr.name = "fields";
24575#endif /* FREECIV_JSON_CONNECTION */
24576 DIO_BV_GET(&din, &field_addr, fields);
24577
24578#else /* FREECIV_DELTA_PROTOCOL */
24579#ifdef FREECIV_JSON_CONNECTION
24580 field_addr.name = "tax";
24581#endif /* FREECIV_JSON_CONNECTION */
24582 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
24583 RECEIVE_PACKET_FIELD_ERROR(tax);
24584 }
24585#ifdef FREECIV_JSON_CONNECTION
24586 field_addr.name = "luxury";
24587#endif /* FREECIV_JSON_CONNECTION */
24588 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
24589 RECEIVE_PACKET_FIELD_ERROR(luxury);
24590 }
24591#ifdef FREECIV_JSON_CONNECTION
24592 field_addr.name = "science";
24593#endif /* FREECIV_JSON_CONNECTION */
24594 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
24595 RECEIVE_PACKET_FIELD_ERROR(science);
24596 }
24597#endif
24598 log_packet_detailed("packet_player_rates_100: got info about ()");
24599
24600#ifdef FREECIV_DELTA_PROTOCOL
24601 if (NULL == *hash) {
24602 *hash = genhash_new_full(hash_packet_player_rates_100, cmp_packet_player_rates_100,
24603 NULL, NULL, NULL, free);
24604 }
24605
24606 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
24607 *real_packet = *old;
24608 } else {
24609 log_packet_detailed(" no old info");
24610 memset(real_packet, 0, sizeof(*real_packet));
24611 }
24612
24613 if (BV_ISSET(fields, 0)) {
24614 log_packet_detailed(" got field 'tax'");
24615#ifdef FREECIV_JSON_CONNECTION
24616 field_addr.name = "tax";
24617#endif /* FREECIV_JSON_CONNECTION */
24618 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
24619 RECEIVE_PACKET_FIELD_ERROR(tax);
24620 }
24621 }
24622 if (BV_ISSET(fields, 1)) {
24623 log_packet_detailed(" got field 'luxury'");
24624#ifdef FREECIV_JSON_CONNECTION
24625 field_addr.name = "luxury";
24626#endif /* FREECIV_JSON_CONNECTION */
24627 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
24628 RECEIVE_PACKET_FIELD_ERROR(luxury);
24629 }
24630 }
24631 if (BV_ISSET(fields, 2)) {
24632 log_packet_detailed(" got field 'science'");
24633#ifdef FREECIV_JSON_CONNECTION
24634 field_addr.name = "science";
24635#endif /* FREECIV_JSON_CONNECTION */
24636 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
24637 RECEIVE_PACKET_FIELD_ERROR(science);
24638 }
24639 }
24640
24641 if (NULL == old) {
24642 old = fc_malloc(sizeof(*old));
24643 *old = *real_packet;
24644 genhash_insert(*hash, old, old);
24645 } else {
24646 *old = *real_packet;
24647 }
24648
24649#endif /* FREECIV_DELTA_PROTOCOL */
24650 RECEIVE_PACKET_END(real_packet);
24651}
24652
24653 static int send_packet_player_rates_100(struct connection *pc, const struct packet_player_rates *packet)
24654{
24655 const struct packet_player_rates *real_packet = packet;
24656 int e;
24657#ifdef FREECIV_DELTA_PROTOCOL
24658 packet_player_rates_100_fields fields;
24659 struct packet_player_rates *old;
24660 bool differ;
24661 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_RATES;
24662#endif /* FREECIV_DELTA_PROTOCOL */
24663 SEND_PACKET_START(PACKET_PLAYER_RATES);
24664#ifdef FREECIV_JSON_CONNECTION
24665 struct plocation field_addr;
24666 {
24667 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24668 field_addr = *field_addr_tmp;
24669 FC_FREE(field_addr_tmp);
24670 }
24671#endif /* FREECIV_JSON_CONNECTION */
24672
24673 log_packet_detailed("packet_player_rates_100: sending info about ()");
24674
24675#ifdef FREECIV_DELTA_PROTOCOL
24676 if (NULL == *hash) {
24677 *hash = genhash_new_full(hash_packet_player_rates_100, cmp_packet_player_rates_100,
24678 NULL, NULL, NULL, free);
24679 }
24680 BV_CLR_ALL(fields);
24681
24682 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
24683 old = fc_malloc(sizeof(*old));
24684 *old = *real_packet;
24685 genhash_insert(*hash, old, old);
24686 memset(old, 0, sizeof(*old));
24687 }
24688 differ = (old->tax != real_packet->tax);
24689 if (differ) {
24690 BV_SET(fields, 0);
24691 }
24692
24693 differ = (old->luxury != real_packet->luxury);
24694 if (differ) {
24695 BV_SET(fields, 1);
24696 }
24697
24698 differ = (old->science != real_packet->science);
24699 if (differ) {
24700 BV_SET(fields, 2);
24701 }
24702
24703
24704#ifdef FREECIV_JSON_CONNECTION
24705 field_addr.name = "fields";
24706#endif /* FREECIV_JSON_CONNECTION */
24707 e = 0;
24708 e |= DIO_BV_PUT(&dout, &field_addr, fields);
24709 if (e) {
24710 log_packet_detailed("fields bitvector error detected");
24711 }
24712
24713 if (BV_ISSET(fields, 0)) {
24714 log_packet_detailed(" field 'tax' has changed");
24715#ifdef FREECIV_JSON_CONNECTION
24716 field_addr.name = "tax";
24717#endif /* FREECIV_JSON_CONNECTION */
24718 e = 0;
24719 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
24720 if (e) {
24721 log_packet_detailed("'tax' field error detected");
24722 }
24723 }
24724 if (BV_ISSET(fields, 1)) {
24725 log_packet_detailed(" field 'luxury' has changed");
24726#ifdef FREECIV_JSON_CONNECTION
24727 field_addr.name = "luxury";
24728#endif /* FREECIV_JSON_CONNECTION */
24729 e = 0;
24730 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
24731 if (e) {
24732 log_packet_detailed("'luxury' field error detected");
24733 }
24734 }
24735 if (BV_ISSET(fields, 2)) {
24736 log_packet_detailed(" field 'science' has changed");
24737#ifdef FREECIV_JSON_CONNECTION
24738 field_addr.name = "science";
24739#endif /* FREECIV_JSON_CONNECTION */
24740 e = 0;
24741 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
24742 if (e) {
24743 log_packet_detailed("'science' field error detected");
24744 }
24745 }
24746
24747 *old = *real_packet;
24748#endif /* FREECIV_DELTA_PROTOCOL */
24749#ifndef FREECIV_DELTA_PROTOCOL
24750#ifdef FREECIV_JSON_CONNECTION
24751 field_addr.name = "tax";
24752#endif /* FREECIV_JSON_CONNECTION */
24753 e = 0;
24754 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
24755 if (e) {
24756 log_packet_detailed("'tax' field error detected");
24757 }
24758#ifdef FREECIV_JSON_CONNECTION
24759 field_addr.name = "luxury";
24760#endif /* FREECIV_JSON_CONNECTION */
24761 e = 0;
24762 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
24763 if (e) {
24764 log_packet_detailed("'luxury' field error detected");
24765 }
24766#ifdef FREECIV_JSON_CONNECTION
24767 field_addr.name = "science";
24768#endif /* FREECIV_JSON_CONNECTION */
24769 e = 0;
24770 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
24771 if (e) {
24772 log_packet_detailed("'science' field error detected");
24773 }
24774
24775#endif
24776 SEND_PACKET_END(PACKET_PLAYER_RATES);
24777}
24778
24779 int send_packet_player_rates(struct connection *pc, const struct packet_player_rates *packet)
24780{
24781 if (!pc->used) {
24782 log_error("WARNING: trying to send data to the closed connection %s",
24783 conn_description(pc));
24784 return -1;
24785 }
24786 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_RATES].packet != NULL, -1,
24787 "Handler for PACKET_PLAYER_RATES not installed");
24788 return pc->phs.handlers->send[PACKET_PLAYER_RATES].packet(pc, packet);
24789}
24790
24791 int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
24792{
24793 struct packet_player_rates packet, *real_packet = &packet;
24794
24795 real_packet->tax = tax;
24796 real_packet->luxury = luxury;
24797 real_packet->science = science;
24798
24799 return send_packet_player_rates(pc, real_packet);
24800}
24801
24802#ifdef FREECIV_DELTA_PROTOCOL
24803#define hash_packet_player_change_government_100 hash_const
24804
24805#define cmp_packet_player_change_government_100 cmp_const
24806
24807 BV_DEFINE(packet_player_change_government_100_fields, 1);
24808#endif /* FREECIV_DELTA_PROTOCOL */
24809
24810 static struct packet_player_change_government *receive_packet_player_change_government_100(struct connection *pc)
24811{
24812#ifdef FREECIV_DELTA_PROTOCOL
24813 packet_player_change_government_100_fields fields;
24814 struct packet_player_change_government *old;
24815 struct genhash **hash = pc->phs.received + PACKET_PLAYER_CHANGE_GOVERNMENT;
24816#endif /* FREECIV_DELTA_PROTOCOL */
24817 RECEIVE_PACKET_START(packet_player_change_government, real_packet);
24818#ifdef FREECIV_JSON_CONNECTION
24819 struct plocation field_addr;
24820 {
24821 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24822 field_addr = *field_addr_tmp;
24823 FC_FREE(field_addr_tmp);
24824 }
24825#endif /* FREECIV_JSON_CONNECTION */
24826
24827#ifdef FREECIV_DELTA_PROTOCOL
24828#ifdef FREECIV_JSON_CONNECTION
24829 field_addr.name = "fields";
24830#endif /* FREECIV_JSON_CONNECTION */
24831 DIO_BV_GET(&din, &field_addr, fields);
24832
24833#else /* FREECIV_DELTA_PROTOCOL */
24834#ifdef FREECIV_JSON_CONNECTION
24835 field_addr.name = "government";
24836#endif /* FREECIV_JSON_CONNECTION */
24837 {
24838 int readin;
24839
24840 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
24841 RECEIVE_PACKET_FIELD_ERROR(government);
24842 }
24843 real_packet->government = readin;
24844 }
24845#endif
24846 log_packet_detailed("packet_player_change_government_100: got info about ()");
24847
24848#ifdef FREECIV_DELTA_PROTOCOL
24849 if (NULL == *hash) {
24850 *hash = genhash_new_full(hash_packet_player_change_government_100, cmp_packet_player_change_government_100,
24851 NULL, NULL, NULL, free);
24852 }
24853
24854 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
24855 *real_packet = *old;
24856 } else {
24857 log_packet_detailed(" no old info");
24858 memset(real_packet, 0, sizeof(*real_packet));
24859 }
24860
24861 if (BV_ISSET(fields, 0)) {
24862 log_packet_detailed(" got field 'government'");
24863#ifdef FREECIV_JSON_CONNECTION
24864 field_addr.name = "government";
24865#endif /* FREECIV_JSON_CONNECTION */
24866 {
24867 int readin;
24868
24869 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
24870 RECEIVE_PACKET_FIELD_ERROR(government);
24871 }
24872 real_packet->government = readin;
24873 }
24874 }
24875
24876 if (NULL == old) {
24877 old = fc_malloc(sizeof(*old));
24878 *old = *real_packet;
24879 genhash_insert(*hash, old, old);
24880 } else {
24881 *old = *real_packet;
24882 }
24883
24884#endif /* FREECIV_DELTA_PROTOCOL */
24885 RECEIVE_PACKET_END(real_packet);
24886}
24887
24888 static int send_packet_player_change_government_100(struct connection *pc, const struct packet_player_change_government *packet)
24889{
24890 const struct packet_player_change_government *real_packet = packet;
24891 int e;
24892#ifdef FREECIV_DELTA_PROTOCOL
24893 packet_player_change_government_100_fields fields;
24894 struct packet_player_change_government *old;
24895 bool differ;
24896 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_CHANGE_GOVERNMENT;
24897#endif /* FREECIV_DELTA_PROTOCOL */
24898 SEND_PACKET_START(PACKET_PLAYER_CHANGE_GOVERNMENT);
24899#ifdef FREECIV_JSON_CONNECTION
24900 struct plocation field_addr;
24901 {
24902 struct plocation *field_addr_tmp = plocation_field_new(NULL);
24903 field_addr = *field_addr_tmp;
24904 FC_FREE(field_addr_tmp);
24905 }
24906#endif /* FREECIV_JSON_CONNECTION */
24907
24908 log_packet_detailed("packet_player_change_government_100: sending info about ()");
24909
24910#ifdef FREECIV_DELTA_PROTOCOL
24911 if (NULL == *hash) {
24912 *hash = genhash_new_full(hash_packet_player_change_government_100, cmp_packet_player_change_government_100,
24913 NULL, NULL, NULL, free);
24914 }
24915 BV_CLR_ALL(fields);
24916
24917 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
24918 old = fc_malloc(sizeof(*old));
24919 *old = *real_packet;
24920 genhash_insert(*hash, old, old);
24921 memset(old, 0, sizeof(*old));
24922 }
24923 differ = (old->government != real_packet->government);
24924 if (differ) {
24925 BV_SET(fields, 0);
24926 }
24927
24928
24929#ifdef FREECIV_JSON_CONNECTION
24930 field_addr.name = "fields";
24931#endif /* FREECIV_JSON_CONNECTION */
24932 e = 0;
24933 e |= DIO_BV_PUT(&dout, &field_addr, fields);
24934 if (e) {
24935 log_packet_detailed("fields bitvector error detected");
24936 }
24937
24938 if (BV_ISSET(fields, 0)) {
24939 log_packet_detailed(" field 'government' has changed");
24940#ifdef FREECIV_JSON_CONNECTION
24941 field_addr.name = "government";
24942#endif /* FREECIV_JSON_CONNECTION */
24943 e = 0;
24944 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
24945 if (e) {
24946 log_packet_detailed("'government' field error detected");
24947 }
24948 }
24949
24950 *old = *real_packet;
24951#endif /* FREECIV_DELTA_PROTOCOL */
24952#ifndef FREECIV_DELTA_PROTOCOL
24953#ifdef FREECIV_JSON_CONNECTION
24954 field_addr.name = "government";
24955#endif /* FREECIV_JSON_CONNECTION */
24956 e = 0;
24957 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
24958 if (e) {
24959 log_packet_detailed("'government' field error detected");
24960 }
24961
24962#endif
24963 SEND_PACKET_END(PACKET_PLAYER_CHANGE_GOVERNMENT);
24964}
24965
24966 int send_packet_player_change_government(struct connection *pc, const struct packet_player_change_government *packet)
24967{
24968 if (!pc->used) {
24969 log_error("WARNING: trying to send data to the closed connection %s",
24970 conn_description(pc));
24971 return -1;
24972 }
24973 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet != NULL, -1,
24974 "Handler for PACKET_PLAYER_CHANGE_GOVERNMENT not installed");
24975 return pc->phs.handlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet(pc, packet);
24976}
24977
24978 int dsend_packet_player_change_government(struct connection *pc, Government_type_id government)
24979{
24980 struct packet_player_change_government packet, *real_packet = &packet;
24981
24982 real_packet->government = government;
24983
24984 return send_packet_player_change_government(pc, real_packet);
24985}
24986
24987#ifdef FREECIV_DELTA_PROTOCOL
24988#define hash_packet_player_place_infra_100 hash_const
24989
24990#define cmp_packet_player_place_infra_100 cmp_const
24991
24992 BV_DEFINE(packet_player_place_infra_100_fields, 2);
24993#endif /* FREECIV_DELTA_PROTOCOL */
24994
24995 static struct packet_player_place_infra *receive_packet_player_place_infra_100(struct connection *pc)
24996{
24997#ifdef FREECIV_DELTA_PROTOCOL
24998 packet_player_place_infra_100_fields fields;
24999 struct packet_player_place_infra *old;
25000 struct genhash **hash = pc->phs.received + PACKET_PLAYER_PLACE_INFRA;
25001#endif /* FREECIV_DELTA_PROTOCOL */
25002 RECEIVE_PACKET_START(packet_player_place_infra, real_packet);
25003#ifdef FREECIV_JSON_CONNECTION
25004 struct plocation field_addr;
25005 {
25006 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25007 field_addr = *field_addr_tmp;
25008 FC_FREE(field_addr_tmp);
25009 }
25010#endif /* FREECIV_JSON_CONNECTION */
25011
25012#ifdef FREECIV_DELTA_PROTOCOL
25013#ifdef FREECIV_JSON_CONNECTION
25014 field_addr.name = "fields";
25015#endif /* FREECIV_JSON_CONNECTION */
25016 DIO_BV_GET(&din, &field_addr, fields);
25017
25018#else /* FREECIV_DELTA_PROTOCOL */
25019#ifdef FREECIV_JSON_CONNECTION
25020 field_addr.name = "tile";
25021#endif /* FREECIV_JSON_CONNECTION */
25022 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
25023 RECEIVE_PACKET_FIELD_ERROR(tile);
25024 }
25025#ifdef FREECIV_JSON_CONNECTION
25026 field_addr.name = "extra";
25027#endif /* FREECIV_JSON_CONNECTION */
25028 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra)) {
25029 RECEIVE_PACKET_FIELD_ERROR(extra);
25030 }
25031#endif
25032 log_packet_detailed("packet_player_place_infra_100: got info about ()");
25033
25034#ifdef FREECIV_DELTA_PROTOCOL
25035 if (NULL == *hash) {
25036 *hash = genhash_new_full(hash_packet_player_place_infra_100, cmp_packet_player_place_infra_100,
25037 NULL, NULL, NULL, free);
25038 }
25039
25040 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25041 *real_packet = *old;
25042 } else {
25043 log_packet_detailed(" no old info");
25044 memset(real_packet, 0, sizeof(*real_packet));
25045 }
25046
25047 if (BV_ISSET(fields, 0)) {
25048 log_packet_detailed(" got field 'tile'");
25049#ifdef FREECIV_JSON_CONNECTION
25050 field_addr.name = "tile";
25051#endif /* FREECIV_JSON_CONNECTION */
25052 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
25053 RECEIVE_PACKET_FIELD_ERROR(tile);
25054 }
25055 }
25056 if (BV_ISSET(fields, 1)) {
25057 log_packet_detailed(" got field 'extra'");
25058#ifdef FREECIV_JSON_CONNECTION
25059 field_addr.name = "extra";
25060#endif /* FREECIV_JSON_CONNECTION */
25061 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra)) {
25062 RECEIVE_PACKET_FIELD_ERROR(extra);
25063 }
25064 }
25065
25066 if (NULL == old) {
25067 old = fc_malloc(sizeof(*old));
25068 *old = *real_packet;
25069 genhash_insert(*hash, old, old);
25070 } else {
25071 *old = *real_packet;
25072 }
25073
25074#endif /* FREECIV_DELTA_PROTOCOL */
25075 RECEIVE_PACKET_END(real_packet);
25076}
25077
25078 static int send_packet_player_place_infra_100(struct connection *pc, const struct packet_player_place_infra *packet)
25079{
25080 const struct packet_player_place_infra *real_packet = packet;
25081 int e;
25082#ifdef FREECIV_DELTA_PROTOCOL
25083 packet_player_place_infra_100_fields fields;
25084 struct packet_player_place_infra *old;
25085 bool differ;
25086 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_PLACE_INFRA;
25087#endif /* FREECIV_DELTA_PROTOCOL */
25088 SEND_PACKET_START(PACKET_PLAYER_PLACE_INFRA);
25089#ifdef FREECIV_JSON_CONNECTION
25090 struct plocation field_addr;
25091 {
25092 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25093 field_addr = *field_addr_tmp;
25094 FC_FREE(field_addr_tmp);
25095 }
25096#endif /* FREECIV_JSON_CONNECTION */
25097
25098 log_packet_detailed("packet_player_place_infra_100: sending info about ()");
25099
25100#ifdef FREECIV_DELTA_PROTOCOL
25101 if (NULL == *hash) {
25102 *hash = genhash_new_full(hash_packet_player_place_infra_100, cmp_packet_player_place_infra_100,
25103 NULL, NULL, NULL, free);
25104 }
25105 BV_CLR_ALL(fields);
25106
25107 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25108 old = fc_malloc(sizeof(*old));
25109 *old = *real_packet;
25110 genhash_insert(*hash, old, old);
25111 memset(old, 0, sizeof(*old));
25112 }
25113 differ = (old->tile != real_packet->tile);
25114 if (differ) {
25115 BV_SET(fields, 0);
25116 }
25117
25118 differ = (old->extra != real_packet->extra);
25119 if (differ) {
25120 BV_SET(fields, 1);
25121 }
25122
25123
25124#ifdef FREECIV_JSON_CONNECTION
25125 field_addr.name = "fields";
25126#endif /* FREECIV_JSON_CONNECTION */
25127 e = 0;
25128 e |= DIO_BV_PUT(&dout, &field_addr, fields);
25129 if (e) {
25130 log_packet_detailed("fields bitvector error detected");
25131 }
25132
25133 if (BV_ISSET(fields, 0)) {
25134 log_packet_detailed(" field 'tile' has changed");
25135#ifdef FREECIV_JSON_CONNECTION
25136 field_addr.name = "tile";
25137#endif /* FREECIV_JSON_CONNECTION */
25138 e = 0;
25139 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
25140 if (e) {
25141 log_packet_detailed("'tile' field error detected");
25142 }
25143 }
25144 if (BV_ISSET(fields, 1)) {
25145 log_packet_detailed(" field 'extra' has changed");
25146#ifdef FREECIV_JSON_CONNECTION
25147 field_addr.name = "extra";
25148#endif /* FREECIV_JSON_CONNECTION */
25149 e = 0;
25150 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra);
25151 if (e) {
25152 log_packet_detailed("'extra' field error detected");
25153 }
25154 }
25155
25156 *old = *real_packet;
25157#endif /* FREECIV_DELTA_PROTOCOL */
25158#ifndef FREECIV_DELTA_PROTOCOL
25159#ifdef FREECIV_JSON_CONNECTION
25160 field_addr.name = "tile";
25161#endif /* FREECIV_JSON_CONNECTION */
25162 e = 0;
25163 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
25164 if (e) {
25165 log_packet_detailed("'tile' field error detected");
25166 }
25167#ifdef FREECIV_JSON_CONNECTION
25168 field_addr.name = "extra";
25169#endif /* FREECIV_JSON_CONNECTION */
25170 e = 0;
25171 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra);
25172 if (e) {
25173 log_packet_detailed("'extra' field error detected");
25174 }
25175
25176#endif
25177 SEND_PACKET_END(PACKET_PLAYER_PLACE_INFRA);
25178}
25179
25180 int send_packet_player_place_infra(struct connection *pc, const struct packet_player_place_infra *packet)
25181{
25182 if (!pc->used) {
25183 log_error("WARNING: trying to send data to the closed connection %s",
25184 conn_description(pc));
25185 return -1;
25186 }
25187 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_PLACE_INFRA].packet != NULL, -1,
25188 "Handler for PACKET_PLAYER_PLACE_INFRA not installed");
25189 return pc->phs.handlers->send[PACKET_PLAYER_PLACE_INFRA].packet(pc, packet);
25190}
25191
25192 int dsend_packet_player_place_infra(struct connection *pc, int tile, int extra)
25193{
25194 struct packet_player_place_infra packet, *real_packet = &packet;
25195
25196 real_packet->tile = tile;
25197 real_packet->extra = extra;
25198
25199 return send_packet_player_place_infra(pc, real_packet);
25200}
25201
25202 static struct packet_player_attribute_block *receive_packet_player_attribute_block_100(struct connection *pc)
25203{
25204 RECEIVE_PACKET_START(packet_player_attribute_block, real_packet);
25205#if 1 /* To match endif */
25206 real_packet->__dummy = 0xff;
25207#endif
25208 log_packet_detailed("packet_player_attribute_block_100: got info about ()");
25209 RECEIVE_PACKET_END(real_packet);
25210}
25211
25212 static int send_packet_player_attribute_block_100(struct connection *pc)
25213{
25214 SEND_PACKET_START(PACKET_PLAYER_ATTRIBUTE_BLOCK);
25215
25216 log_packet_detailed("packet_player_attribute_block_100: sending info about ()");
25217 SEND_PACKET_END(PACKET_PLAYER_ATTRIBUTE_BLOCK);
25218}
25219
25220 int send_packet_player_attribute_block(struct connection *pc)
25221{
25222 if (!pc->used) {
25223 log_error("WARNING: trying to send data to the closed connection %s",
25224 conn_description(pc));
25225 return -1;
25226 }
25227 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet != NULL, -1,
25228 "Handler for PACKET_PLAYER_ATTRIBUTE_BLOCK not installed");
25229 return pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet(pc);
25230}
25231
25232#ifdef FREECIV_DELTA_PROTOCOL
25233static genhash_val_t hash_packet_player_attribute_chunk_100(const void *vkey)
25234{
25235 const struct packet_player_attribute_chunk *key = (const struct packet_player_attribute_chunk *) vkey;
25236 genhash_val_t result = 0;
25237
25238 result += key->offset;
25239
25240 result &= 0xFFFFFFFF;
25241 return result;
25242}
25243
25244static bool cmp_packet_player_attribute_chunk_100(const void *vkey1, const void *vkey2)
25245{
25246 const struct packet_player_attribute_chunk *old = (const struct packet_player_attribute_chunk *) vkey1;
25247 const struct packet_player_attribute_chunk *real_packet = (const struct packet_player_attribute_chunk *) vkey2;
25248 bool differ;
25249
25250 differ = (old->offset != real_packet->offset);
25251
25252 return !differ;
25253}
25254 BV_DEFINE(packet_player_attribute_chunk_100_fields, 3);
25255#endif /* FREECIV_DELTA_PROTOCOL */
25256
25257 static struct packet_player_attribute_chunk *receive_packet_player_attribute_chunk_100(struct connection *pc)
25258{
25259#ifdef FREECIV_DELTA_PROTOCOL
25260 packet_player_attribute_chunk_100_fields fields;
25261 struct packet_player_attribute_chunk *old;
25262 struct genhash **hash = pc->phs.received + PACKET_PLAYER_ATTRIBUTE_CHUNK;
25263#endif /* FREECIV_DELTA_PROTOCOL */
25264 RECEIVE_PACKET_START(packet_player_attribute_chunk, real_packet);
25265#ifdef FREECIV_JSON_CONNECTION
25266 struct plocation field_addr;
25267 {
25268 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25269 field_addr = *field_addr_tmp;
25270 FC_FREE(field_addr_tmp);
25271 }
25272#endif /* FREECIV_JSON_CONNECTION */
25273
25274#ifdef FREECIV_DELTA_PROTOCOL
25275#ifdef FREECIV_JSON_CONNECTION
25276 field_addr.name = "fields";
25277#endif /* FREECIV_JSON_CONNECTION */
25278 DIO_BV_GET(&din, &field_addr, fields);
25279#ifdef FREECIV_JSON_CONNECTION
25280 field_addr.name = "offset";
25281#endif /* FREECIV_JSON_CONNECTION */
25282 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->offset)) {
25283 RECEIVE_PACKET_FIELD_ERROR(offset);
25284 }
25285
25286#else /* FREECIV_DELTA_PROTOCOL */
25287#ifdef FREECIV_JSON_CONNECTION
25288 field_addr.name = "offset";
25289#endif /* FREECIV_JSON_CONNECTION */
25290 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->offset)) {
25291 RECEIVE_PACKET_FIELD_ERROR(offset);
25292 }
25293#ifdef FREECIV_JSON_CONNECTION
25294 field_addr.name = "total_length";
25295#endif /* FREECIV_JSON_CONNECTION */
25296 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->total_length)) {
25297 RECEIVE_PACKET_FIELD_ERROR(total_length);
25298 }
25299#ifdef FREECIV_JSON_CONNECTION
25300 field_addr.name = "chunk_length";
25301#endif /* FREECIV_JSON_CONNECTION */
25302 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->chunk_length)) {
25303 RECEIVE_PACKET_FIELD_ERROR(chunk_length);
25304 }
25305#ifdef FREECIV_JSON_CONNECTION
25306 field_addr.name = "data";
25307#endif /* FREECIV_JSON_CONNECTION */
25308
25309 if (real_packet->chunk_length > ATTRIBUTE_CHUNK_SIZE) {
25310 RECEIVE_PACKET_FIELD_ERROR(data, ": truncation array");
25311 }
25312 if (!DIO_GET(memory, &din, &field_addr, real_packet->data, real_packet->chunk_length)) {
25313 RECEIVE_PACKET_FIELD_ERROR(data);
25314 }
25315#endif
25316 log_packet_detailed("packet_player_attribute_chunk_100: got info about (%d)",
25317 real_packet->offset);
25318
25319#ifdef FREECIV_DELTA_PROTOCOL
25320 if (NULL == *hash) {
25321 *hash = genhash_new_full(hash_packet_player_attribute_chunk_100, cmp_packet_player_attribute_chunk_100,
25322 NULL, NULL, NULL, free);
25323 }
25324
25325 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25326 *real_packet = *old;
25327 } else {
25328 int offset;
25329
25330 offset = real_packet->offset;
25331
25332 log_packet_detailed(" no old info");
25333 memset(real_packet, 0, sizeof(*real_packet));
25334
25335 real_packet->offset = offset;
25336 }
25337
25338 if (BV_ISSET(fields, 0)) {
25339 log_packet_detailed(" got field 'total_length'");
25340#ifdef FREECIV_JSON_CONNECTION
25341 field_addr.name = "total_length";
25342#endif /* FREECIV_JSON_CONNECTION */
25343 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->total_length)) {
25344 RECEIVE_PACKET_FIELD_ERROR(total_length);
25345 }
25346 }
25347 if (BV_ISSET(fields, 1)) {
25348 log_packet_detailed(" got field 'chunk_length'");
25349#ifdef FREECIV_JSON_CONNECTION
25350 field_addr.name = "chunk_length";
25351#endif /* FREECIV_JSON_CONNECTION */
25352 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->chunk_length)) {
25353 RECEIVE_PACKET_FIELD_ERROR(chunk_length);
25354 }
25355 }
25356 if (BV_ISSET(fields, 2)) {
25357 log_packet_detailed(" got field 'data'");
25358#ifdef FREECIV_JSON_CONNECTION
25359 field_addr.name = "data";
25360#endif /* FREECIV_JSON_CONNECTION */
25361
25362 if (real_packet->chunk_length > ATTRIBUTE_CHUNK_SIZE) {
25363 RECEIVE_PACKET_FIELD_ERROR(data, ": truncation array");
25364 }
25365 if (!DIO_GET(memory, &din, &field_addr, real_packet->data, real_packet->chunk_length)) {
25366 RECEIVE_PACKET_FIELD_ERROR(data);
25367 }
25368 }
25369
25370 if (NULL == old) {
25371 old = fc_malloc(sizeof(*old));
25372 *old = *real_packet;
25373 genhash_insert(*hash, old, old);
25374 } else {
25375 *old = *real_packet;
25376 }
25377
25378#endif /* FREECIV_DELTA_PROTOCOL */
25379 RECEIVE_PACKET_END(real_packet);
25380}
25381
25382 static int send_packet_player_attribute_chunk_100(struct connection *pc, const struct packet_player_attribute_chunk *packet)
25383{
25384 /* copy packet for pre-send */
25385 struct packet_player_attribute_chunk packet_buf = *packet;
25386 const struct packet_player_attribute_chunk *real_packet = &packet_buf;
25387 int e;
25388#ifdef FREECIV_DELTA_PROTOCOL
25389 packet_player_attribute_chunk_100_fields fields;
25390 struct packet_player_attribute_chunk *old;
25391 bool differ;
25392 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_ATTRIBUTE_CHUNK;
25393#endif /* FREECIV_DELTA_PROTOCOL */
25394 SEND_PACKET_START(PACKET_PLAYER_ATTRIBUTE_CHUNK);
25395#ifdef FREECIV_JSON_CONNECTION
25396 struct plocation field_addr;
25397 {
25398 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25399 field_addr = *field_addr_tmp;
25400 FC_FREE(field_addr_tmp);
25401 }
25402#endif /* FREECIV_JSON_CONNECTION */
25403
25404 log_packet_detailed("packet_player_attribute_chunk_100: sending info about (%d)",
25405 real_packet->offset);
25406
25407 pre_send_packet_player_attribute_chunk(pc, &packet_buf);
25408
25409#ifdef FREECIV_DELTA_PROTOCOL
25410 if (NULL == *hash) {
25411 *hash = genhash_new_full(hash_packet_player_attribute_chunk_100, cmp_packet_player_attribute_chunk_100,
25412 NULL, NULL, NULL, free);
25413 }
25414 BV_CLR_ALL(fields);
25415
25416 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25417 old = fc_malloc(sizeof(*old));
25418 *old = *real_packet;
25419 genhash_insert(*hash, old, old);
25420 memset(old, 0, sizeof(*old));
25421 }
25422 differ = (old->total_length != real_packet->total_length);
25423 if (differ) {
25424 BV_SET(fields, 0);
25425 }
25426
25427 differ = (old->chunk_length != real_packet->chunk_length);
25428 if (differ) {
25429 BV_SET(fields, 1);
25430 }
25431
25432 differ = ((old->chunk_length != real_packet->chunk_length)
25433 || (memcmp(old->data, real_packet->data, real_packet->chunk_length) != 0));
25434 if (differ) {
25435 BV_SET(fields, 2);
25436 }
25437
25438
25439#ifdef FREECIV_JSON_CONNECTION
25440 field_addr.name = "fields";
25441#endif /* FREECIV_JSON_CONNECTION */
25442 e = 0;
25443 e |= DIO_BV_PUT(&dout, &field_addr, fields);
25444 if (e) {
25445 log_packet_detailed("fields bitvector error detected");
25446 }
25447#ifdef FREECIV_JSON_CONNECTION
25448 field_addr.name = "offset";
25449#endif /* FREECIV_JSON_CONNECTION */
25450 e = 0;
25451 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->offset);
25452 if (e) {
25453 log_packet_detailed("'offset' field error detected");
25454 }
25455
25456 if (BV_ISSET(fields, 0)) {
25457 log_packet_detailed(" field 'total_length' has changed");
25458#ifdef FREECIV_JSON_CONNECTION
25459 field_addr.name = "total_length";
25460#endif /* FREECIV_JSON_CONNECTION */
25461 e = 0;
25462 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->total_length);
25463 if (e) {
25464 log_packet_detailed("'total_length' field error detected");
25465 }
25466 }
25467 if (BV_ISSET(fields, 1)) {
25468 log_packet_detailed(" field 'chunk_length' has changed");
25469#ifdef FREECIV_JSON_CONNECTION
25470 field_addr.name = "chunk_length";
25471#endif /* FREECIV_JSON_CONNECTION */
25472 e = 0;
25473 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->chunk_length);
25474 if (e) {
25475 log_packet_detailed("'chunk_length' field error detected");
25476 }
25477 }
25478 if (BV_ISSET(fields, 2)) {
25479 log_packet_detailed(" field 'data' has changed");
25480#ifdef FREECIV_JSON_CONNECTION
25481 field_addr.name = "data";
25482#endif /* FREECIV_JSON_CONNECTION */
25483 e = 0;
25484 e |= DIO_PUT(memory, &dout, &field_addr, &real_packet->data, real_packet->chunk_length);
25485 if (e) {
25486 log_packet_detailed("'data' field error detected");
25487 }
25488 }
25489
25490 *old = *real_packet;
25491#endif /* FREECIV_DELTA_PROTOCOL */
25492#ifndef FREECIV_DELTA_PROTOCOL
25493#ifdef FREECIV_JSON_CONNECTION
25494 field_addr.name = "offset";
25495#endif /* FREECIV_JSON_CONNECTION */
25496 e = 0;
25497 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->offset);
25498 if (e) {
25499 log_packet_detailed("'offset' field error detected");
25500 }
25501#ifdef FREECIV_JSON_CONNECTION
25502 field_addr.name = "total_length";
25503#endif /* FREECIV_JSON_CONNECTION */
25504 e = 0;
25505 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->total_length);
25506 if (e) {
25507 log_packet_detailed("'total_length' field error detected");
25508 }
25509#ifdef FREECIV_JSON_CONNECTION
25510 field_addr.name = "chunk_length";
25511#endif /* FREECIV_JSON_CONNECTION */
25512 e = 0;
25513 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->chunk_length);
25514 if (e) {
25515 log_packet_detailed("'chunk_length' field error detected");
25516 }
25517#ifdef FREECIV_JSON_CONNECTION
25518 field_addr.name = "data";
25519#endif /* FREECIV_JSON_CONNECTION */
25520 e = 0;
25521 e |= DIO_PUT(memory, &dout, &field_addr, &real_packet->data, real_packet->chunk_length);
25522 if (e) {
25523 log_packet_detailed("'data' field error detected");
25524 }
25525
25526#endif
25527 SEND_PACKET_END(PACKET_PLAYER_ATTRIBUTE_CHUNK);
25528}
25529
25530 int send_packet_player_attribute_chunk(struct connection *pc, const struct packet_player_attribute_chunk *packet)
25531{
25532 if (!pc->used) {
25533 log_error("WARNING: trying to send data to the closed connection %s",
25534 conn_description(pc));
25535 return -1;
25536 }
25537 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet != NULL, -1,
25538 "Handler for PACKET_PLAYER_ATTRIBUTE_CHUNK not installed");
25539 return pc->phs.handlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet(pc, packet);
25540}
25541
25542#ifdef FREECIV_DELTA_PROTOCOL
25543static genhash_val_t hash_packet_player_diplstate_100(const void *vkey)
25544{
25545 const struct packet_player_diplstate *key = (const struct packet_player_diplstate *) vkey;
25546 genhash_val_t result = 0;
25547
25548 result += key->diplstate_id;
25549
25550 result &= 0xFFFFFFFF;
25551 return result;
25552}
25553
25554static bool cmp_packet_player_diplstate_100(const void *vkey1, const void *vkey2)
25555{
25556 const struct packet_player_diplstate *old = (const struct packet_player_diplstate *) vkey1;
25557 const struct packet_player_diplstate *real_packet = (const struct packet_player_diplstate *) vkey2;
25558 bool differ;
25559
25560 differ = (old->diplstate_id != real_packet->diplstate_id);
25561
25562 return !differ;
25563}
25564 BV_DEFINE(packet_player_diplstate_100_fields, 6);
25565#endif /* FREECIV_DELTA_PROTOCOL */
25566
25567 static struct packet_player_diplstate *receive_packet_player_diplstate_100(struct connection *pc)
25568{
25569#ifdef FREECIV_DELTA_PROTOCOL
25570 packet_player_diplstate_100_fields fields;
25571 struct packet_player_diplstate *old;
25572 struct genhash **hash = pc->phs.received + PACKET_PLAYER_DIPLSTATE;
25573#endif /* FREECIV_DELTA_PROTOCOL */
25574 RECEIVE_PACKET_START(packet_player_diplstate, real_packet);
25575#ifdef FREECIV_JSON_CONNECTION
25576 struct plocation field_addr;
25577 {
25578 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25579 field_addr = *field_addr_tmp;
25580 FC_FREE(field_addr_tmp);
25581 }
25582#endif /* FREECIV_JSON_CONNECTION */
25583
25584#ifdef FREECIV_DELTA_PROTOCOL
25585#ifdef FREECIV_JSON_CONNECTION
25586 field_addr.name = "fields";
25587#endif /* FREECIV_JSON_CONNECTION */
25588 DIO_BV_GET(&din, &field_addr, fields);
25589#ifdef FREECIV_JSON_CONNECTION
25590 field_addr.name = "diplstate_id";
25591#endif /* FREECIV_JSON_CONNECTION */
25592 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->diplstate_id)) {
25593 RECEIVE_PACKET_FIELD_ERROR(diplstate_id);
25594 }
25595
25596#else /* FREECIV_DELTA_PROTOCOL */
25597#ifdef FREECIV_JSON_CONNECTION
25598 field_addr.name = "diplstate_id";
25599#endif /* FREECIV_JSON_CONNECTION */
25600 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->diplstate_id)) {
25601 RECEIVE_PACKET_FIELD_ERROR(diplstate_id);
25602 }
25603#ifdef FREECIV_JSON_CONNECTION
25604 field_addr.name = "plr1";
25605#endif /* FREECIV_JSON_CONNECTION */
25606 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr1)) {
25607 RECEIVE_PACKET_FIELD_ERROR(plr1);
25608 }
25609#ifdef FREECIV_JSON_CONNECTION
25610 field_addr.name = "plr2";
25611#endif /* FREECIV_JSON_CONNECTION */
25612 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr2)) {
25613 RECEIVE_PACKET_FIELD_ERROR(plr2);
25614 }
25615#ifdef FREECIV_JSON_CONNECTION
25616 field_addr.name = "type";
25617#endif /* FREECIV_JSON_CONNECTION */
25618 {
25619 int readin;
25620
25621 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25622 RECEIVE_PACKET_FIELD_ERROR(type);
25623 }
25624 real_packet->type = readin;
25625 }
25626#ifdef FREECIV_JSON_CONNECTION
25627 field_addr.name = "turns_left";
25628#endif /* FREECIV_JSON_CONNECTION */
25629 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->turns_left)) {
25630 RECEIVE_PACKET_FIELD_ERROR(turns_left);
25631 }
25632#ifdef FREECIV_JSON_CONNECTION
25633 field_addr.name = "has_reason_to_cancel";
25634#endif /* FREECIV_JSON_CONNECTION */
25635 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->has_reason_to_cancel)) {
25636 RECEIVE_PACKET_FIELD_ERROR(has_reason_to_cancel);
25637 }
25638#ifdef FREECIV_JSON_CONNECTION
25639 field_addr.name = "contact_turns_left";
25640#endif /* FREECIV_JSON_CONNECTION */
25641 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->contact_turns_left)) {
25642 RECEIVE_PACKET_FIELD_ERROR(contact_turns_left);
25643 }
25644#endif
25645 log_packet_detailed("packet_player_diplstate_100: got info about (%d)",
25646 real_packet->diplstate_id);
25647
25648#ifdef FREECIV_DELTA_PROTOCOL
25649 if (NULL == *hash) {
25650 *hash = genhash_new_full(hash_packet_player_diplstate_100, cmp_packet_player_diplstate_100,
25651 NULL, NULL, NULL, free);
25652 }
25653
25654 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
25655 *real_packet = *old;
25656 } else {
25657 int diplstate_id;
25658
25659 diplstate_id = real_packet->diplstate_id;
25660
25661 log_packet_detailed(" no old info");
25662 memset(real_packet, 0, sizeof(*real_packet));
25663
25664 real_packet->diplstate_id = diplstate_id;
25665 }
25666
25667 if (BV_ISSET(fields, 0)) {
25668 log_packet_detailed(" got field 'plr1'");
25669#ifdef FREECIV_JSON_CONNECTION
25670 field_addr.name = "plr1";
25671#endif /* FREECIV_JSON_CONNECTION */
25672 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr1)) {
25673 RECEIVE_PACKET_FIELD_ERROR(plr1);
25674 }
25675 }
25676 if (BV_ISSET(fields, 1)) {
25677 log_packet_detailed(" got field 'plr2'");
25678#ifdef FREECIV_JSON_CONNECTION
25679 field_addr.name = "plr2";
25680#endif /* FREECIV_JSON_CONNECTION */
25681 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->plr2)) {
25682 RECEIVE_PACKET_FIELD_ERROR(plr2);
25683 }
25684 }
25685 if (BV_ISSET(fields, 2)) {
25686 log_packet_detailed(" got field 'type'");
25687#ifdef FREECIV_JSON_CONNECTION
25688 field_addr.name = "type";
25689#endif /* FREECIV_JSON_CONNECTION */
25690 {
25691 int readin;
25692
25693 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
25694 RECEIVE_PACKET_FIELD_ERROR(type);
25695 }
25696 real_packet->type = readin;
25697 }
25698 }
25699 if (BV_ISSET(fields, 3)) {
25700 log_packet_detailed(" got field 'turns_left'");
25701#ifdef FREECIV_JSON_CONNECTION
25702 field_addr.name = "turns_left";
25703#endif /* FREECIV_JSON_CONNECTION */
25704 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->turns_left)) {
25705 RECEIVE_PACKET_FIELD_ERROR(turns_left);
25706 }
25707 }
25708 if (BV_ISSET(fields, 4)) {
25709 log_packet_detailed(" got field 'has_reason_to_cancel'");
25710#ifdef FREECIV_JSON_CONNECTION
25711 field_addr.name = "has_reason_to_cancel";
25712#endif /* FREECIV_JSON_CONNECTION */
25713 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->has_reason_to_cancel)) {
25714 RECEIVE_PACKET_FIELD_ERROR(has_reason_to_cancel);
25715 }
25716 }
25717 if (BV_ISSET(fields, 5)) {
25718 log_packet_detailed(" got field 'contact_turns_left'");
25719#ifdef FREECIV_JSON_CONNECTION
25720 field_addr.name = "contact_turns_left";
25721#endif /* FREECIV_JSON_CONNECTION */
25722 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->contact_turns_left)) {
25723 RECEIVE_PACKET_FIELD_ERROR(contact_turns_left);
25724 }
25725 }
25726
25727 if (NULL == old) {
25728 old = fc_malloc(sizeof(*old));
25729 *old = *real_packet;
25730 genhash_insert(*hash, old, old);
25731 } else {
25732 *old = *real_packet;
25733 }
25734
25735#endif /* FREECIV_DELTA_PROTOCOL */
25736 RECEIVE_PACKET_END(real_packet);
25737}
25738
25739 static int send_packet_player_diplstate_100(struct connection *pc, const struct packet_player_diplstate *packet)
25740{
25741 const struct packet_player_diplstate *real_packet = packet;
25742 int e;
25743#ifdef FREECIV_DELTA_PROTOCOL
25744 packet_player_diplstate_100_fields fields;
25745 struct packet_player_diplstate *old;
25746 bool differ;
25747 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_DIPLSTATE;
25748#endif /* FREECIV_DELTA_PROTOCOL */
25749 SEND_PACKET_START(PACKET_PLAYER_DIPLSTATE);
25750#ifdef FREECIV_JSON_CONNECTION
25751 struct plocation field_addr;
25752 {
25753 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25754 field_addr = *field_addr_tmp;
25755 FC_FREE(field_addr_tmp);
25756 }
25757#endif /* FREECIV_JSON_CONNECTION */
25758
25759 log_packet_detailed("packet_player_diplstate_100: sending info about (%d)",
25760 real_packet->diplstate_id);
25761
25762#ifdef FREECIV_DELTA_PROTOCOL
25763 if (NULL == *hash) {
25764 *hash = genhash_new_full(hash_packet_player_diplstate_100, cmp_packet_player_diplstate_100,
25765 NULL, NULL, NULL, free);
25766 }
25767 BV_CLR_ALL(fields);
25768
25769 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
25770 old = fc_malloc(sizeof(*old));
25771 *old = *real_packet;
25772 genhash_insert(*hash, old, old);
25773 memset(old, 0, sizeof(*old));
25774 }
25775 differ = (old->plr1 != real_packet->plr1);
25776 if (differ) {
25777 BV_SET(fields, 0);
25778 }
25779
25780 differ = (old->plr2 != real_packet->plr2);
25781 if (differ) {
25782 BV_SET(fields, 1);
25783 }
25784
25785 differ = (old->type != real_packet->type);
25786 if (differ) {
25787 BV_SET(fields, 2);
25788 }
25789
25790 differ = (old->turns_left != real_packet->turns_left);
25791 if (differ) {
25792 BV_SET(fields, 3);
25793 }
25794
25795 differ = (old->has_reason_to_cancel != real_packet->has_reason_to_cancel);
25796 if (differ) {
25797 BV_SET(fields, 4);
25798 }
25799
25800 differ = (old->contact_turns_left != real_packet->contact_turns_left);
25801 if (differ) {
25802 BV_SET(fields, 5);
25803 }
25804
25805
25806#ifdef FREECIV_JSON_CONNECTION
25807 field_addr.name = "fields";
25808#endif /* FREECIV_JSON_CONNECTION */
25809 e = 0;
25810 e |= DIO_BV_PUT(&dout, &field_addr, fields);
25811 if (e) {
25812 log_packet_detailed("fields bitvector error detected");
25813 }
25814#ifdef FREECIV_JSON_CONNECTION
25815 field_addr.name = "diplstate_id";
25816#endif /* FREECIV_JSON_CONNECTION */
25817 e = 0;
25818 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->diplstate_id);
25819 if (e) {
25820 log_packet_detailed("'diplstate_id' field error detected");
25821 }
25822
25823 if (BV_ISSET(fields, 0)) {
25824 log_packet_detailed(" field 'plr1' has changed");
25825#ifdef FREECIV_JSON_CONNECTION
25826 field_addr.name = "plr1";
25827#endif /* FREECIV_JSON_CONNECTION */
25828 e = 0;
25829 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->plr1);
25830 if (e) {
25831 log_packet_detailed("'plr1' field error detected");
25832 }
25833 }
25834 if (BV_ISSET(fields, 1)) {
25835 log_packet_detailed(" field 'plr2' has changed");
25836#ifdef FREECIV_JSON_CONNECTION
25837 field_addr.name = "plr2";
25838#endif /* FREECIV_JSON_CONNECTION */
25839 e = 0;
25840 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->plr2);
25841 if (e) {
25842 log_packet_detailed("'plr2' field error detected");
25843 }
25844 }
25845 if (BV_ISSET(fields, 2)) {
25846 log_packet_detailed(" field 'type' has changed");
25847#ifdef FREECIV_JSON_CONNECTION
25848 field_addr.name = "type";
25849#endif /* FREECIV_JSON_CONNECTION */
25850 e = 0;
25851 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
25852 if (e) {
25853 log_packet_detailed("'type' field error detected");
25854 }
25855 }
25856 if (BV_ISSET(fields, 3)) {
25857 log_packet_detailed(" field 'turns_left' has changed");
25858#ifdef FREECIV_JSON_CONNECTION
25859 field_addr.name = "turns_left";
25860#endif /* FREECIV_JSON_CONNECTION */
25861 e = 0;
25862 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->turns_left);
25863 if (e) {
25864 log_packet_detailed("'turns_left' field error detected");
25865 }
25866 }
25867 if (BV_ISSET(fields, 4)) {
25868 log_packet_detailed(" field 'has_reason_to_cancel' has changed");
25869#ifdef FREECIV_JSON_CONNECTION
25870 field_addr.name = "has_reason_to_cancel";
25871#endif /* FREECIV_JSON_CONNECTION */
25872 e = 0;
25873 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->has_reason_to_cancel);
25874 if (e) {
25875 log_packet_detailed("'has_reason_to_cancel' field error detected");
25876 }
25877 }
25878 if (BV_ISSET(fields, 5)) {
25879 log_packet_detailed(" field 'contact_turns_left' has changed");
25880#ifdef FREECIV_JSON_CONNECTION
25881 field_addr.name = "contact_turns_left";
25882#endif /* FREECIV_JSON_CONNECTION */
25883 e = 0;
25884 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->contact_turns_left);
25885 if (e) {
25886 log_packet_detailed("'contact_turns_left' field error detected");
25887 }
25888 }
25889
25890 *old = *real_packet;
25891#endif /* FREECIV_DELTA_PROTOCOL */
25892#ifndef FREECIV_DELTA_PROTOCOL
25893#ifdef FREECIV_JSON_CONNECTION
25894 field_addr.name = "diplstate_id";
25895#endif /* FREECIV_JSON_CONNECTION */
25896 e = 0;
25897 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->diplstate_id);
25898 if (e) {
25899 log_packet_detailed("'diplstate_id' field error detected");
25900 }
25901#ifdef FREECIV_JSON_CONNECTION
25902 field_addr.name = "plr1";
25903#endif /* FREECIV_JSON_CONNECTION */
25904 e = 0;
25905 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->plr1);
25906 if (e) {
25907 log_packet_detailed("'plr1' field error detected");
25908 }
25909#ifdef FREECIV_JSON_CONNECTION
25910 field_addr.name = "plr2";
25911#endif /* FREECIV_JSON_CONNECTION */
25912 e = 0;
25913 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->plr2);
25914 if (e) {
25915 log_packet_detailed("'plr2' field error detected");
25916 }
25917#ifdef FREECIV_JSON_CONNECTION
25918 field_addr.name = "type";
25919#endif /* FREECIV_JSON_CONNECTION */
25920 e = 0;
25921 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
25922 if (e) {
25923 log_packet_detailed("'type' field error detected");
25924 }
25925#ifdef FREECIV_JSON_CONNECTION
25926 field_addr.name = "turns_left";
25927#endif /* FREECIV_JSON_CONNECTION */
25928 e = 0;
25929 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->turns_left);
25930 if (e) {
25931 log_packet_detailed("'turns_left' field error detected");
25932 }
25933#ifdef FREECIV_JSON_CONNECTION
25934 field_addr.name = "has_reason_to_cancel";
25935#endif /* FREECIV_JSON_CONNECTION */
25936 e = 0;
25937 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->has_reason_to_cancel);
25938 if (e) {
25939 log_packet_detailed("'has_reason_to_cancel' field error detected");
25940 }
25941#ifdef FREECIV_JSON_CONNECTION
25942 field_addr.name = "contact_turns_left";
25943#endif /* FREECIV_JSON_CONNECTION */
25944 e = 0;
25945 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->contact_turns_left);
25946 if (e) {
25947 log_packet_detailed("'contact_turns_left' field error detected");
25948 }
25949
25950#endif
25951 SEND_PACKET_END(PACKET_PLAYER_DIPLSTATE);
25952}
25953
25954 int send_packet_player_diplstate(struct connection *pc, const struct packet_player_diplstate *packet)
25955{
25956 if (!pc->used) {
25957 log_error("WARNING: trying to send data to the closed connection %s",
25958 conn_description(pc));
25959 return -1;
25960 }
25961 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_DIPLSTATE].packet != NULL, -1,
25962 "Handler for PACKET_PLAYER_DIPLSTATE not installed");
25963 return pc->phs.handlers->send[PACKET_PLAYER_DIPLSTATE].packet(pc, packet);
25964}
25965
25966#ifdef FREECIV_DELTA_PROTOCOL
25967#define hash_packet_player_multiplier_100 hash_const
25968
25969#define cmp_packet_player_multiplier_100 cmp_const
25970
25971 BV_DEFINE(packet_player_multiplier_100_fields, 2);
25972#endif /* FREECIV_DELTA_PROTOCOL */
25973
25974 static struct packet_player_multiplier *receive_packet_player_multiplier_100(struct connection *pc)
25975{
25976#ifdef FREECIV_DELTA_PROTOCOL
25977 packet_player_multiplier_100_fields fields;
25978 struct packet_player_multiplier *old;
25979 struct genhash **hash = pc->phs.received + PACKET_PLAYER_MULTIPLIER;
25980#endif /* FREECIV_DELTA_PROTOCOL */
25981 RECEIVE_PACKET_START(packet_player_multiplier, real_packet);
25982#ifdef FREECIV_JSON_CONNECTION
25983 struct plocation field_addr;
25984 {
25985 struct plocation *field_addr_tmp = plocation_field_new(NULL);
25986 field_addr = *field_addr_tmp;
25987 FC_FREE(field_addr_tmp);
25988 }
25989#endif /* FREECIV_JSON_CONNECTION */
25990
25991#ifdef FREECIV_DELTA_PROTOCOL
25992#ifdef FREECIV_JSON_CONNECTION
25993 field_addr.name = "fields";
25994#endif /* FREECIV_JSON_CONNECTION */
25995 DIO_BV_GET(&din, &field_addr, fields);
25996
25997#else /* FREECIV_DELTA_PROTOCOL */
25998#ifdef FREECIV_JSON_CONNECTION
25999 field_addr.name = "count";
26000#endif /* FREECIV_JSON_CONNECTION */
26001 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->count)) {
26002 RECEIVE_PACKET_FIELD_ERROR(count);
26003 }
26004#ifdef FREECIV_JSON_CONNECTION
26005 field_addr.name = "multipliers";
26006#endif /* FREECIV_JSON_CONNECTION */
26007 {
26008 int i;
26009
26010#ifdef FREECIV_JSON_CONNECTION
26011 /* Enter array. */
26012 field_addr.sub_location = plocation_elem_new(0);
26013#endif /* FREECIV_JSON_CONNECTION */
26014
26015 if (real_packet->count > MAX_NUM_MULTIPLIERS) {
26016 RECEIVE_PACKET_FIELD_ERROR(multipliers, ": truncation array");
26017 }
26018 for (i = 0; i < real_packet->count; i++) {
26019#ifdef FREECIV_JSON_CONNECTION
26020 field_addr.sub_location->number = i;
26021#endif /* FREECIV_JSON_CONNECTION */
26022 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multipliers[i])) {
26023 RECEIVE_PACKET_FIELD_ERROR(multipliers);
26024 }
26025 }
26026
26027#ifdef FREECIV_JSON_CONNECTION
26028 /* Exit array. */
26029 FC_FREE(field_addr.sub_location);
26030#endif /* FREECIV_JSON_CONNECTION */
26031 }
26032#endif
26033 log_packet_detailed("packet_player_multiplier_100: got info about ()");
26034
26035#ifdef FREECIV_DELTA_PROTOCOL
26036 if (NULL == *hash) {
26037 *hash = genhash_new_full(hash_packet_player_multiplier_100, cmp_packet_player_multiplier_100,
26038 NULL, NULL, NULL, free);
26039 }
26040
26041 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26042 *real_packet = *old;
26043 } else {
26044 log_packet_detailed(" no old info");
26045 memset(real_packet, 0, sizeof(*real_packet));
26046 }
26047
26048 if (BV_ISSET(fields, 0)) {
26049 log_packet_detailed(" got field 'count'");
26050#ifdef FREECIV_JSON_CONNECTION
26051 field_addr.name = "count";
26052#endif /* FREECIV_JSON_CONNECTION */
26053 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->count)) {
26054 RECEIVE_PACKET_FIELD_ERROR(count);
26055 }
26056 }
26057 if (BV_ISSET(fields, 1)) {
26058 log_packet_detailed(" got field 'multipliers'");
26059#ifdef FREECIV_JSON_CONNECTION
26060 field_addr.name = "multipliers";
26061#endif /* FREECIV_JSON_CONNECTION */
26062 {
26063 int i;
26064
26065#ifdef FREECIV_JSON_CONNECTION
26066 /* Enter array. */
26067 field_addr.sub_location = plocation_elem_new(0);
26068#endif /* FREECIV_JSON_CONNECTION */
26069
26070 if (real_packet->count > MAX_NUM_MULTIPLIERS) {
26071 RECEIVE_PACKET_FIELD_ERROR(multipliers, ": truncation array");
26072 }
26073 for (i = 0; i < real_packet->count; i++) {
26074#ifdef FREECIV_JSON_CONNECTION
26075 field_addr.sub_location->number = i;
26076#endif /* FREECIV_JSON_CONNECTION */
26077 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->multipliers[i])) {
26078 RECEIVE_PACKET_FIELD_ERROR(multipliers);
26079 }
26080 }
26081
26082#ifdef FREECIV_JSON_CONNECTION
26083 /* Exit array. */
26084 FC_FREE(field_addr.sub_location);
26085#endif /* FREECIV_JSON_CONNECTION */
26086 }
26087 }
26088
26089 if (NULL == old) {
26090 old = fc_malloc(sizeof(*old));
26091 *old = *real_packet;
26092 genhash_insert(*hash, old, old);
26093 } else {
26094 *old = *real_packet;
26095 }
26096
26097#endif /* FREECIV_DELTA_PROTOCOL */
26098 RECEIVE_PACKET_END(real_packet);
26099}
26100
26101 static int send_packet_player_multiplier_100(struct connection *pc, const struct packet_player_multiplier *packet)
26102{
26103 const struct packet_player_multiplier *real_packet = packet;
26104 int e;
26105#ifdef FREECIV_DELTA_PROTOCOL
26106 packet_player_multiplier_100_fields fields;
26107 struct packet_player_multiplier *old;
26108 bool differ;
26109 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_MULTIPLIER;
26110#endif /* FREECIV_DELTA_PROTOCOL */
26111 SEND_PACKET_START(PACKET_PLAYER_MULTIPLIER);
26112#ifdef FREECIV_JSON_CONNECTION
26113 struct plocation field_addr;
26114 {
26115 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26116 field_addr = *field_addr_tmp;
26117 FC_FREE(field_addr_tmp);
26118 }
26119#endif /* FREECIV_JSON_CONNECTION */
26120
26121 log_packet_detailed("packet_player_multiplier_100: sending info about ()");
26122
26123#ifdef FREECIV_DELTA_PROTOCOL
26124 if (NULL == *hash) {
26125 *hash = genhash_new_full(hash_packet_player_multiplier_100, cmp_packet_player_multiplier_100,
26126 NULL, NULL, NULL, free);
26127 }
26128 BV_CLR_ALL(fields);
26129
26130 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26131 old = fc_malloc(sizeof(*old));
26132 *old = *real_packet;
26133 genhash_insert(*hash, old, old);
26134 memset(old, 0, sizeof(*old));
26135 }
26136 differ = (old->count != real_packet->count);
26137 if (differ) {
26138 BV_SET(fields, 0);
26139 }
26140
26141 differ = (old->count != real_packet->count);
26142 if (!differ) {
26143 int i;
26144
26145 for (i = 0; i < real_packet->count; i++) {
26146 differ = (old->multipliers[i] != real_packet->multipliers[i]);
26147 if (differ) {
26148 break;
26149 }
26150 }
26151 }
26152 if (differ) {
26153 BV_SET(fields, 1);
26154 }
26155
26156
26157#ifdef FREECIV_JSON_CONNECTION
26158 field_addr.name = "fields";
26159#endif /* FREECIV_JSON_CONNECTION */
26160 e = 0;
26161 e |= DIO_BV_PUT(&dout, &field_addr, fields);
26162 if (e) {
26163 log_packet_detailed("fields bitvector error detected");
26164 }
26165
26166 if (BV_ISSET(fields, 0)) {
26167 log_packet_detailed(" field 'count' has changed");
26168#ifdef FREECIV_JSON_CONNECTION
26169 field_addr.name = "count";
26170#endif /* FREECIV_JSON_CONNECTION */
26171 e = 0;
26172 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->count);
26173 if (e) {
26174 log_packet_detailed("'count' field error detected");
26175 }
26176 }
26177 if (BV_ISSET(fields, 1)) {
26178 log_packet_detailed(" field 'multipliers' has changed");
26179#ifdef FREECIV_JSON_CONNECTION
26180 field_addr.name = "multipliers";
26181#endif /* FREECIV_JSON_CONNECTION */
26182 e = 0;
26183 {
26184 int i;
26185
26186#ifdef FREECIV_JSON_CONNECTION
26187 /* Create the array. */
26188 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
26189
26190 /* Enter the array. */
26191 field_addr.sub_location = plocation_elem_new(0);
26192#endif /* FREECIV_JSON_CONNECTION */
26193
26194 for (i = 0; i < real_packet->count; i++) {
26195#ifdef FREECIV_JSON_CONNECTION
26196 /* Next array element. */
26197 field_addr.sub_location->number = i;
26198#endif /* FREECIV_JSON_CONNECTION */
26199 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multipliers[i]);
26200 }
26201
26202#ifdef FREECIV_JSON_CONNECTION
26203 /* Exit array. */
26204 FC_FREE(field_addr.sub_location);
26205#endif /* FREECIV_JSON_CONNECTION */
26206 }
26207 if (e) {
26208 log_packet_detailed("'multipliers' field error detected");
26209 }
26210 }
26211
26212 *old = *real_packet;
26213#endif /* FREECIV_DELTA_PROTOCOL */
26214#ifndef FREECIV_DELTA_PROTOCOL
26215#ifdef FREECIV_JSON_CONNECTION
26216 field_addr.name = "count";
26217#endif /* FREECIV_JSON_CONNECTION */
26218 e = 0;
26219 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->count);
26220 if (e) {
26221 log_packet_detailed("'count' field error detected");
26222 }
26223#ifdef FREECIV_JSON_CONNECTION
26224 field_addr.name = "multipliers";
26225#endif /* FREECIV_JSON_CONNECTION */
26226 e = 0;
26227 {
26228 int i;
26229
26230#ifdef FREECIV_JSON_CONNECTION
26231 /* Create the array. */
26232 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->count);
26233
26234 /* Enter the array. */
26235 field_addr.sub_location = plocation_elem_new(0);
26236#endif /* FREECIV_JSON_CONNECTION */
26237
26238 for (i = 0; i < real_packet->count; i++) {
26239#ifdef FREECIV_JSON_CONNECTION
26240 /* Next array element. */
26241 field_addr.sub_location->number = i;
26242#endif /* FREECIV_JSON_CONNECTION */
26243 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->multipliers[i]);
26244 }
26245
26246#ifdef FREECIV_JSON_CONNECTION
26247 /* Exit array. */
26248 FC_FREE(field_addr.sub_location);
26249#endif /* FREECIV_JSON_CONNECTION */
26250 }
26251 if (e) {
26252 log_packet_detailed("'multipliers' field error detected");
26253 }
26254
26255#endif
26256 SEND_PACKET_END(PACKET_PLAYER_MULTIPLIER);
26257}
26258
26259 int send_packet_player_multiplier(struct connection *pc, const struct packet_player_multiplier *packet)
26260{
26261 if (!pc->used) {
26262 log_error("WARNING: trying to send data to the closed connection %s",
26263 conn_description(pc));
26264 return -1;
26265 }
26266 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_MULTIPLIER].packet != NULL, -1,
26267 "Handler for PACKET_PLAYER_MULTIPLIER not installed");
26268 return pc->phs.handlers->send[PACKET_PLAYER_MULTIPLIER].packet(pc, packet);
26269}
26270
26271#ifdef FREECIV_DELTA_PROTOCOL
26272static genhash_val_t hash_packet_research_info_100(const void *vkey)
26273{
26274 const struct packet_research_info *key = (const struct packet_research_info *) vkey;
26275 genhash_val_t result = 0;
26276
26277 result += key->id;
26278
26279 result &= 0xFFFFFFFF;
26280 return result;
26281}
26282
26283static bool cmp_packet_research_info_100(const void *vkey1, const void *vkey2)
26284{
26285 const struct packet_research_info *old = (const struct packet_research_info *) vkey1;
26286 const struct packet_research_info *real_packet = (const struct packet_research_info *) vkey2;
26287 bool differ;
26288
26289 differ = (old->id != real_packet->id);
26290
26291 return !differ;
26292}
26293 BV_DEFINE(packet_research_info_100_fields, 8);
26294#endif /* FREECIV_DELTA_PROTOCOL */
26295
26296 static struct packet_research_info *receive_packet_research_info_100(struct connection *pc)
26297{
26298#ifdef FREECIV_DELTA_PROTOCOL
26299 packet_research_info_100_fields fields;
26300 struct packet_research_info *old;
26301 struct genhash **hash = pc->phs.received + PACKET_RESEARCH_INFO;
26302#endif /* FREECIV_DELTA_PROTOCOL */
26303 RECEIVE_PACKET_START(packet_research_info, real_packet);
26304#ifdef FREECIV_JSON_CONNECTION
26305 struct plocation field_addr;
26306 {
26307 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26308 field_addr = *field_addr_tmp;
26309 FC_FREE(field_addr_tmp);
26310 }
26311#endif /* FREECIV_JSON_CONNECTION */
26312
26313#ifdef FREECIV_DELTA_PROTOCOL
26314#ifdef FREECIV_JSON_CONNECTION
26315 field_addr.name = "fields";
26316#endif /* FREECIV_JSON_CONNECTION */
26317 DIO_BV_GET(&din, &field_addr, fields);
26318#ifdef FREECIV_JSON_CONNECTION
26319 field_addr.name = "id";
26320#endif /* FREECIV_JSON_CONNECTION */
26321 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
26322 RECEIVE_PACKET_FIELD_ERROR(id);
26323 }
26324
26325#else /* FREECIV_DELTA_PROTOCOL */
26326#ifdef FREECIV_JSON_CONNECTION
26327 field_addr.name = "id";
26328#endif /* FREECIV_JSON_CONNECTION */
26329 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
26330 RECEIVE_PACKET_FIELD_ERROR(id);
26331 }
26332#ifdef FREECIV_JSON_CONNECTION
26333 field_addr.name = "techs_researched";
26334#endif /* FREECIV_JSON_CONNECTION */
26335 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->techs_researched)) {
26336 RECEIVE_PACKET_FIELD_ERROR(techs_researched);
26337 }
26338#ifdef FREECIV_JSON_CONNECTION
26339 field_addr.name = "future_tech";
26340#endif /* FREECIV_JSON_CONNECTION */
26341 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
26342 RECEIVE_PACKET_FIELD_ERROR(future_tech);
26343 }
26344#ifdef FREECIV_JSON_CONNECTION
26345 field_addr.name = "researching";
26346#endif /* FREECIV_JSON_CONNECTION */
26347 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
26348 RECEIVE_PACKET_FIELD_ERROR(researching);
26349 }
26350#ifdef FREECIV_JSON_CONNECTION
26351 field_addr.name = "researching_cost";
26352#endif /* FREECIV_JSON_CONNECTION */
26353 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->researching_cost)) {
26354 RECEIVE_PACKET_FIELD_ERROR(researching_cost);
26355 }
26356#ifdef FREECIV_JSON_CONNECTION
26357 field_addr.name = "bulbs_researched";
26358#endif /* FREECIV_JSON_CONNECTION */
26359 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
26360 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
26361 }
26362#ifdef FREECIV_JSON_CONNECTION
26363 field_addr.name = "tech_goal";
26364#endif /* FREECIV_JSON_CONNECTION */
26365 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_goal)) {
26366 RECEIVE_PACKET_FIELD_ERROR(tech_goal);
26367 }
26368#ifdef FREECIV_JSON_CONNECTION
26369 field_addr.name = "total_bulbs_prod";
26370#endif /* FREECIV_JSON_CONNECTION */
26371 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->total_bulbs_prod)) {
26372 RECEIVE_PACKET_FIELD_ERROR(total_bulbs_prod);
26373 }
26374#ifdef FREECIV_JSON_CONNECTION
26375 field_addr.name = "inventions";
26376#endif /* FREECIV_JSON_CONNECTION */
26377 if (!DIO_GET(string, &din, &field_addr, real_packet->inventions, sizeof(real_packet->inventions))) {
26378 RECEIVE_PACKET_FIELD_ERROR(inventions);
26379 }
26380#endif
26381 log_packet_detailed("packet_research_info_100: got info about (%d)",
26382 real_packet->id);
26383
26384#ifdef FREECIV_DELTA_PROTOCOL
26385 if (NULL == *hash) {
26386 *hash = genhash_new_full(hash_packet_research_info_100, cmp_packet_research_info_100,
26387 NULL, NULL, NULL, free);
26388 }
26389
26390 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26391 *real_packet = *old;
26392 } else {
26393 int id;
26394
26395 id = real_packet->id;
26396
26397 log_packet_detailed(" no old info");
26398 memset(real_packet, 0, sizeof(*real_packet));
26399
26400 real_packet->id = id;
26401 }
26402
26403 if (BV_ISSET(fields, 0)) {
26404 log_packet_detailed(" got field 'techs_researched'");
26405#ifdef FREECIV_JSON_CONNECTION
26406 field_addr.name = "techs_researched";
26407#endif /* FREECIV_JSON_CONNECTION */
26408 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->techs_researched)) {
26409 RECEIVE_PACKET_FIELD_ERROR(techs_researched);
26410 }
26411 }
26412 if (BV_ISSET(fields, 1)) {
26413 log_packet_detailed(" got field 'future_tech'");
26414#ifdef FREECIV_JSON_CONNECTION
26415 field_addr.name = "future_tech";
26416#endif /* FREECIV_JSON_CONNECTION */
26417 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
26418 RECEIVE_PACKET_FIELD_ERROR(future_tech);
26419 }
26420 }
26421 if (BV_ISSET(fields, 2)) {
26422 log_packet_detailed(" got field 'researching'");
26423#ifdef FREECIV_JSON_CONNECTION
26424 field_addr.name = "researching";
26425#endif /* FREECIV_JSON_CONNECTION */
26426 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
26427 RECEIVE_PACKET_FIELD_ERROR(researching);
26428 }
26429 }
26430 if (BV_ISSET(fields, 3)) {
26431 log_packet_detailed(" got field 'researching_cost'");
26432#ifdef FREECIV_JSON_CONNECTION
26433 field_addr.name = "researching_cost";
26434#endif /* FREECIV_JSON_CONNECTION */
26435 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->researching_cost)) {
26436 RECEIVE_PACKET_FIELD_ERROR(researching_cost);
26437 }
26438 }
26439 if (BV_ISSET(fields, 4)) {
26440 log_packet_detailed(" got field 'bulbs_researched'");
26441#ifdef FREECIV_JSON_CONNECTION
26442 field_addr.name = "bulbs_researched";
26443#endif /* FREECIV_JSON_CONNECTION */
26444 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
26445 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
26446 }
26447 }
26448 if (BV_ISSET(fields, 5)) {
26449 log_packet_detailed(" got field 'tech_goal'");
26450#ifdef FREECIV_JSON_CONNECTION
26451 field_addr.name = "tech_goal";
26452#endif /* FREECIV_JSON_CONNECTION */
26453 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech_goal)) {
26454 RECEIVE_PACKET_FIELD_ERROR(tech_goal);
26455 }
26456 }
26457 if (BV_ISSET(fields, 6)) {
26458 log_packet_detailed(" got field 'total_bulbs_prod'");
26459#ifdef FREECIV_JSON_CONNECTION
26460 field_addr.name = "total_bulbs_prod";
26461#endif /* FREECIV_JSON_CONNECTION */
26462 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->total_bulbs_prod)) {
26463 RECEIVE_PACKET_FIELD_ERROR(total_bulbs_prod);
26464 }
26465 }
26466 if (BV_ISSET(fields, 7)) {
26467 log_packet_detailed(" got field 'inventions'");
26468#ifdef FREECIV_JSON_CONNECTION
26469 field_addr.name = "inventions";
26470#endif /* FREECIV_JSON_CONNECTION */
26471 if (!DIO_GET(string, &din, &field_addr, real_packet->inventions, sizeof(real_packet->inventions))) {
26472 RECEIVE_PACKET_FIELD_ERROR(inventions);
26473 }
26474 }
26475
26476 if (NULL == old) {
26477 old = fc_malloc(sizeof(*old));
26478 *old = *real_packet;
26479 genhash_insert(*hash, old, old);
26480 } else {
26481 *old = *real_packet;
26482 }
26483
26484#endif /* FREECIV_DELTA_PROTOCOL */
26485 RECEIVE_PACKET_END(real_packet);
26486}
26487
26488 static int send_packet_research_info_100(struct connection *pc, const struct packet_research_info *packet)
26489{
26490 const struct packet_research_info *real_packet = packet;
26491 int e;
26492#ifdef FREECIV_DELTA_PROTOCOL
26493 packet_research_info_100_fields fields;
26494 struct packet_research_info *old;
26495 bool differ;
26496 struct genhash **hash = pc->phs.sent + PACKET_RESEARCH_INFO;
26497 int different = 0;
26498#endif /* FREECIV_DELTA_PROTOCOL */
26499 SEND_PACKET_START(PACKET_RESEARCH_INFO);
26500#ifdef FREECIV_JSON_CONNECTION
26501 struct plocation field_addr;
26502 {
26503 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26504 field_addr = *field_addr_tmp;
26505 FC_FREE(field_addr_tmp);
26506 }
26507#endif /* FREECIV_JSON_CONNECTION */
26508
26509 log_packet_detailed("packet_research_info_100: sending info about (%d)",
26510 real_packet->id);
26511
26512#ifdef FREECIV_DELTA_PROTOCOL
26513 if (NULL == *hash) {
26514 *hash = genhash_new_full(hash_packet_research_info_100, cmp_packet_research_info_100,
26515 NULL, NULL, NULL, free);
26516 }
26517 BV_CLR_ALL(fields);
26518
26519 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26520 old = fc_malloc(sizeof(*old));
26521 *old = *real_packet;
26522 genhash_insert(*hash, old, old);
26523 memset(old, 0, sizeof(*old));
26524 different = 1; /* Force to send. */
26525 }
26526 differ = (old->techs_researched != real_packet->techs_researched);
26527 if (differ) {
26528 different++;
26529 BV_SET(fields, 0);
26530 }
26531
26532 differ = (old->future_tech != real_packet->future_tech);
26533 if (differ) {
26534 different++;
26535 BV_SET(fields, 1);
26536 }
26537
26538 differ = (old->researching != real_packet->researching);
26539 if (differ) {
26540 different++;
26541 BV_SET(fields, 2);
26542 }
26543
26544 differ = (old->researching_cost != real_packet->researching_cost);
26545 if (differ) {
26546 different++;
26547 BV_SET(fields, 3);
26548 }
26549
26550 differ = (old->bulbs_researched != real_packet->bulbs_researched);
26551 if (differ) {
26552 different++;
26553 BV_SET(fields, 4);
26554 }
26555
26556 differ = (old->tech_goal != real_packet->tech_goal);
26557 if (differ) {
26558 different++;
26559 BV_SET(fields, 5);
26560 }
26561
26562 differ = (old->total_bulbs_prod != real_packet->total_bulbs_prod);
26563 if (differ) {
26564 different++;
26565 BV_SET(fields, 6);
26566 }
26567
26568 differ = (strcmp(old->inventions, real_packet->inventions) != 0);
26569 if (differ) {
26570 different++;
26571 BV_SET(fields, 7);
26572 }
26573
26574 if (different == 0) {
26575 log_packet_detailed(" no change -> discard");
26576 return 0;
26577 }
26578
26579#ifdef FREECIV_JSON_CONNECTION
26580 field_addr.name = "fields";
26581#endif /* FREECIV_JSON_CONNECTION */
26582 e = 0;
26583 e |= DIO_BV_PUT(&dout, &field_addr, fields);
26584 if (e) {
26585 log_packet_detailed("fields bitvector error detected");
26586 }
26587#ifdef FREECIV_JSON_CONNECTION
26588 field_addr.name = "id";
26589#endif /* FREECIV_JSON_CONNECTION */
26590 e = 0;
26591 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
26592 if (e) {
26593 log_packet_detailed("'id' field error detected");
26594 }
26595
26596 if (BV_ISSET(fields, 0)) {
26597 log_packet_detailed(" field 'techs_researched' has changed");
26598#ifdef FREECIV_JSON_CONNECTION
26599 field_addr.name = "techs_researched";
26600#endif /* FREECIV_JSON_CONNECTION */
26601 e = 0;
26602 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->techs_researched);
26603 if (e) {
26604 log_packet_detailed("'techs_researched' field error detected");
26605 }
26606 }
26607 if (BV_ISSET(fields, 1)) {
26608 log_packet_detailed(" field 'future_tech' has changed");
26609#ifdef FREECIV_JSON_CONNECTION
26610 field_addr.name = "future_tech";
26611#endif /* FREECIV_JSON_CONNECTION */
26612 e = 0;
26613 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
26614 if (e) {
26615 log_packet_detailed("'future_tech' field error detected");
26616 }
26617 }
26618 if (BV_ISSET(fields, 2)) {
26619 log_packet_detailed(" field 'researching' has changed");
26620#ifdef FREECIV_JSON_CONNECTION
26621 field_addr.name = "researching";
26622#endif /* FREECIV_JSON_CONNECTION */
26623 e = 0;
26624 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
26625 if (e) {
26626 log_packet_detailed("'researching' field error detected");
26627 }
26628 }
26629 if (BV_ISSET(fields, 3)) {
26630 log_packet_detailed(" field 'researching_cost' has changed");
26631#ifdef FREECIV_JSON_CONNECTION
26632 field_addr.name = "researching_cost";
26633#endif /* FREECIV_JSON_CONNECTION */
26634 e = 0;
26635 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->researching_cost);
26636 if (e) {
26637 log_packet_detailed("'researching_cost' field error detected");
26638 }
26639 }
26640 if (BV_ISSET(fields, 4)) {
26641 log_packet_detailed(" field 'bulbs_researched' has changed");
26642#ifdef FREECIV_JSON_CONNECTION
26643 field_addr.name = "bulbs_researched";
26644#endif /* FREECIV_JSON_CONNECTION */
26645 e = 0;
26646 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
26647 if (e) {
26648 log_packet_detailed("'bulbs_researched' field error detected");
26649 }
26650 }
26651 if (BV_ISSET(fields, 5)) {
26652 log_packet_detailed(" field 'tech_goal' has changed");
26653#ifdef FREECIV_JSON_CONNECTION
26654 field_addr.name = "tech_goal";
26655#endif /* FREECIV_JSON_CONNECTION */
26656 e = 0;
26657 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_goal);
26658 if (e) {
26659 log_packet_detailed("'tech_goal' field error detected");
26660 }
26661 }
26662 if (BV_ISSET(fields, 6)) {
26663 log_packet_detailed(" field 'total_bulbs_prod' has changed");
26664#ifdef FREECIV_JSON_CONNECTION
26665 field_addr.name = "total_bulbs_prod";
26666#endif /* FREECIV_JSON_CONNECTION */
26667 e = 0;
26668 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->total_bulbs_prod);
26669 if (e) {
26670 log_packet_detailed("'total_bulbs_prod' field error detected");
26671 }
26672 }
26673 if (BV_ISSET(fields, 7)) {
26674 log_packet_detailed(" field 'inventions' has changed");
26675#ifdef FREECIV_JSON_CONNECTION
26676 field_addr.name = "inventions";
26677#endif /* FREECIV_JSON_CONNECTION */
26678 e = 0;
26679 e |= DIO_PUT(string, &dout, &field_addr, real_packet->inventions);
26680 if (e) {
26681 log_packet_detailed("'inventions' field error detected");
26682 }
26683 }
26684
26685 *old = *real_packet;
26686#endif /* FREECIV_DELTA_PROTOCOL */
26687#ifndef FREECIV_DELTA_PROTOCOL
26688#ifdef FREECIV_JSON_CONNECTION
26689 field_addr.name = "id";
26690#endif /* FREECIV_JSON_CONNECTION */
26691 e = 0;
26692 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
26693 if (e) {
26694 log_packet_detailed("'id' field error detected");
26695 }
26696#ifdef FREECIV_JSON_CONNECTION
26697 field_addr.name = "techs_researched";
26698#endif /* FREECIV_JSON_CONNECTION */
26699 e = 0;
26700 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->techs_researched);
26701 if (e) {
26702 log_packet_detailed("'techs_researched' field error detected");
26703 }
26704#ifdef FREECIV_JSON_CONNECTION
26705 field_addr.name = "future_tech";
26706#endif /* FREECIV_JSON_CONNECTION */
26707 e = 0;
26708 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
26709 if (e) {
26710 log_packet_detailed("'future_tech' field error detected");
26711 }
26712#ifdef FREECIV_JSON_CONNECTION
26713 field_addr.name = "researching";
26714#endif /* FREECIV_JSON_CONNECTION */
26715 e = 0;
26716 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
26717 if (e) {
26718 log_packet_detailed("'researching' field error detected");
26719 }
26720#ifdef FREECIV_JSON_CONNECTION
26721 field_addr.name = "researching_cost";
26722#endif /* FREECIV_JSON_CONNECTION */
26723 e = 0;
26724 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->researching_cost);
26725 if (e) {
26726 log_packet_detailed("'researching_cost' field error detected");
26727 }
26728#ifdef FREECIV_JSON_CONNECTION
26729 field_addr.name = "bulbs_researched";
26730#endif /* FREECIV_JSON_CONNECTION */
26731 e = 0;
26732 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
26733 if (e) {
26734 log_packet_detailed("'bulbs_researched' field error detected");
26735 }
26736#ifdef FREECIV_JSON_CONNECTION
26737 field_addr.name = "tech_goal";
26738#endif /* FREECIV_JSON_CONNECTION */
26739 e = 0;
26740 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech_goal);
26741 if (e) {
26742 log_packet_detailed("'tech_goal' field error detected");
26743 }
26744#ifdef FREECIV_JSON_CONNECTION
26745 field_addr.name = "total_bulbs_prod";
26746#endif /* FREECIV_JSON_CONNECTION */
26747 e = 0;
26748 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->total_bulbs_prod);
26749 if (e) {
26750 log_packet_detailed("'total_bulbs_prod' field error detected");
26751 }
26752#ifdef FREECIV_JSON_CONNECTION
26753 field_addr.name = "inventions";
26754#endif /* FREECIV_JSON_CONNECTION */
26755 e = 0;
26756 e |= DIO_PUT(string, &dout, &field_addr, real_packet->inventions);
26757 if (e) {
26758 log_packet_detailed("'inventions' field error detected");
26759 }
26760
26761#endif
26762 SEND_PACKET_END(PACKET_RESEARCH_INFO);
26763}
26764
26765 int send_packet_research_info(struct connection *pc, const struct packet_research_info *packet)
26766{
26767 if (!pc->used) {
26768 log_error("WARNING: trying to send data to the closed connection %s",
26769 conn_description(pc));
26770 return -1;
26771 }
26772 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RESEARCH_INFO].packet != NULL, -1,
26773 "Handler for PACKET_RESEARCH_INFO not installed");
26774 return pc->phs.handlers->send[PACKET_RESEARCH_INFO].packet(pc, packet);
26775}
26776
26777 void lsend_packet_research_info(struct conn_list *dest, const struct packet_research_info *packet)
26778{
26779 conn_list_iterate(dest, pconn) {
26780 send_packet_research_info(pconn, packet);
26781 } conn_list_iterate_end;
26782}
26783
26784#ifdef FREECIV_DELTA_PROTOCOL
26785#define hash_packet_unknown_research_100 hash_const
26786
26787#define cmp_packet_unknown_research_100 cmp_const
26788
26789 BV_DEFINE(packet_unknown_research_100_fields, 1);
26790#endif /* FREECIV_DELTA_PROTOCOL */
26791
26792 static struct packet_unknown_research *receive_packet_unknown_research_100(struct connection *pc)
26793{
26794#ifdef FREECIV_DELTA_PROTOCOL
26795 packet_unknown_research_100_fields fields;
26796 struct packet_unknown_research *old;
26797 struct genhash **hash = pc->phs.received + PACKET_UNKNOWN_RESEARCH;
26798#endif /* FREECIV_DELTA_PROTOCOL */
26799 RECEIVE_PACKET_START(packet_unknown_research, real_packet);
26800#ifdef FREECIV_JSON_CONNECTION
26801 struct plocation field_addr;
26802 {
26803 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26804 field_addr = *field_addr_tmp;
26805 FC_FREE(field_addr_tmp);
26806 }
26807#endif /* FREECIV_JSON_CONNECTION */
26808
26809#ifdef FREECIV_DELTA_PROTOCOL
26810#ifdef FREECIV_JSON_CONNECTION
26811 field_addr.name = "fields";
26812#endif /* FREECIV_JSON_CONNECTION */
26813 DIO_BV_GET(&din, &field_addr, fields);
26814
26815#else /* FREECIV_DELTA_PROTOCOL */
26816#ifdef FREECIV_JSON_CONNECTION
26817 field_addr.name = "id";
26818#endif /* FREECIV_JSON_CONNECTION */
26819 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
26820 RECEIVE_PACKET_FIELD_ERROR(id);
26821 }
26822#endif
26823 log_packet_detailed("packet_unknown_research_100: got info about ()");
26824
26825#ifdef FREECIV_DELTA_PROTOCOL
26826 if (NULL == *hash) {
26827 *hash = genhash_new_full(hash_packet_unknown_research_100, cmp_packet_unknown_research_100,
26828 NULL, NULL, NULL, free);
26829 }
26830
26831 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
26832 *real_packet = *old;
26833 } else {
26834 log_packet_detailed(" no old info");
26835 memset(real_packet, 0, sizeof(*real_packet));
26836 }
26837
26838 if (BV_ISSET(fields, 0)) {
26839 log_packet_detailed(" got field 'id'");
26840#ifdef FREECIV_JSON_CONNECTION
26841 field_addr.name = "id";
26842#endif /* FREECIV_JSON_CONNECTION */
26843 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
26844 RECEIVE_PACKET_FIELD_ERROR(id);
26845 }
26846 }
26847
26848 if (NULL == old) {
26849 old = fc_malloc(sizeof(*old));
26850 *old = *real_packet;
26851 genhash_insert(*hash, old, old);
26852 } else {
26853 *old = *real_packet;
26854 }
26855
26856 hash = pc->phs.received + PACKET_RESEARCH_INFO;
26857 if (NULL != *hash) {
26858 genhash_remove(*hash, real_packet);
26859 }
26860
26861#endif /* FREECIV_DELTA_PROTOCOL */
26862 RECEIVE_PACKET_END(real_packet);
26863}
26864
26865 static int send_packet_unknown_research_100(struct connection *pc, const struct packet_unknown_research *packet)
26866{
26867 const struct packet_unknown_research *real_packet = packet;
26868 int e;
26869#ifdef FREECIV_DELTA_PROTOCOL
26870 packet_unknown_research_100_fields fields;
26871 struct packet_unknown_research *old;
26872 bool differ;
26873 struct genhash **hash = pc->phs.sent + PACKET_UNKNOWN_RESEARCH;
26874 int different = 0;
26875#endif /* FREECIV_DELTA_PROTOCOL */
26876 SEND_PACKET_START(PACKET_UNKNOWN_RESEARCH);
26877#ifdef FREECIV_JSON_CONNECTION
26878 struct plocation field_addr;
26879 {
26880 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26881 field_addr = *field_addr_tmp;
26882 FC_FREE(field_addr_tmp);
26883 }
26884#endif /* FREECIV_JSON_CONNECTION */
26885
26886 log_packet_detailed("packet_unknown_research_100: sending info about ()");
26887
26888#ifdef FREECIV_DELTA_PROTOCOL
26889 if (NULL == *hash) {
26890 *hash = genhash_new_full(hash_packet_unknown_research_100, cmp_packet_unknown_research_100,
26891 NULL, NULL, NULL, free);
26892 }
26893 BV_CLR_ALL(fields);
26894
26895 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
26896 old = fc_malloc(sizeof(*old));
26897 *old = *real_packet;
26898 genhash_insert(*hash, old, old);
26899 memset(old, 0, sizeof(*old));
26900 different = 1; /* Force to send. */
26901 }
26902 differ = (old->id != real_packet->id);
26903 if (differ) {
26904 different++;
26905 BV_SET(fields, 0);
26906 }
26907
26908 if (different == 0) {
26909 log_packet_detailed(" no change -> discard");
26910 return 0;
26911 }
26912
26913#ifdef FREECIV_JSON_CONNECTION
26914 field_addr.name = "fields";
26915#endif /* FREECIV_JSON_CONNECTION */
26916 e = 0;
26917 e |= DIO_BV_PUT(&dout, &field_addr, fields);
26918 if (e) {
26919 log_packet_detailed("fields bitvector error detected");
26920 }
26921
26922 if (BV_ISSET(fields, 0)) {
26923 log_packet_detailed(" field 'id' has changed");
26924#ifdef FREECIV_JSON_CONNECTION
26925 field_addr.name = "id";
26926#endif /* FREECIV_JSON_CONNECTION */
26927 e = 0;
26928 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
26929 if (e) {
26930 log_packet_detailed("'id' field error detected");
26931 }
26932 }
26933
26934 *old = *real_packet;
26935
26936 hash = pc->phs.sent + PACKET_RESEARCH_INFO;
26937 if (NULL != *hash) {
26938 genhash_remove(*hash, real_packet);
26939 }
26940#endif /* FREECIV_DELTA_PROTOCOL */
26941#ifndef FREECIV_DELTA_PROTOCOL
26942#ifdef FREECIV_JSON_CONNECTION
26943 field_addr.name = "id";
26944#endif /* FREECIV_JSON_CONNECTION */
26945 e = 0;
26946 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
26947 if (e) {
26948 log_packet_detailed("'id' field error detected");
26949 }
26950
26951#endif
26952 SEND_PACKET_END(PACKET_UNKNOWN_RESEARCH);
26953}
26954
26955 int send_packet_unknown_research(struct connection *pc, const struct packet_unknown_research *packet)
26956{
26957 if (!pc->used) {
26958 log_error("WARNING: trying to send data to the closed connection %s",
26959 conn_description(pc));
26960 return -1;
26961 }
26962 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNKNOWN_RESEARCH].packet != NULL, -1,
26963 "Handler for PACKET_UNKNOWN_RESEARCH not installed");
26964 return pc->phs.handlers->send[PACKET_UNKNOWN_RESEARCH].packet(pc, packet);
26965}
26966
26967#ifdef FREECIV_DELTA_PROTOCOL
26968#define hash_packet_player_research_100 hash_const
26969
26970#define cmp_packet_player_research_100 cmp_const
26971
26972 BV_DEFINE(packet_player_research_100_fields, 1);
26973#endif /* FREECIV_DELTA_PROTOCOL */
26974
26975 static struct packet_player_research *receive_packet_player_research_100(struct connection *pc)
26976{
26977#ifdef FREECIV_DELTA_PROTOCOL
26978 packet_player_research_100_fields fields;
26979 struct packet_player_research *old;
26980 struct genhash **hash = pc->phs.received + PACKET_PLAYER_RESEARCH;
26981#endif /* FREECIV_DELTA_PROTOCOL */
26982 RECEIVE_PACKET_START(packet_player_research, real_packet);
26983#ifdef FREECIV_JSON_CONNECTION
26984 struct plocation field_addr;
26985 {
26986 struct plocation *field_addr_tmp = plocation_field_new(NULL);
26987 field_addr = *field_addr_tmp;
26988 FC_FREE(field_addr_tmp);
26989 }
26990#endif /* FREECIV_JSON_CONNECTION */
26991
26992#ifdef FREECIV_DELTA_PROTOCOL
26993#ifdef FREECIV_JSON_CONNECTION
26994 field_addr.name = "fields";
26995#endif /* FREECIV_JSON_CONNECTION */
26996 DIO_BV_GET(&din, &field_addr, fields);
26997
26998#else /* FREECIV_DELTA_PROTOCOL */
26999#ifdef FREECIV_JSON_CONNECTION
27000 field_addr.name = "tech";
27001#endif /* FREECIV_JSON_CONNECTION */
27002 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27003 RECEIVE_PACKET_FIELD_ERROR(tech);
27004 }
27005#endif
27006 log_packet_detailed("packet_player_research_100: got info about ()");
27007
27008#ifdef FREECIV_DELTA_PROTOCOL
27009 if (NULL == *hash) {
27010 *hash = genhash_new_full(hash_packet_player_research_100, cmp_packet_player_research_100,
27011 NULL, NULL, NULL, free);
27012 }
27013
27014 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27015 *real_packet = *old;
27016 } else {
27017 log_packet_detailed(" no old info");
27018 memset(real_packet, 0, sizeof(*real_packet));
27019 }
27020
27021 if (BV_ISSET(fields, 0)) {
27022 log_packet_detailed(" got field 'tech'");
27023#ifdef FREECIV_JSON_CONNECTION
27024 field_addr.name = "tech";
27025#endif /* FREECIV_JSON_CONNECTION */
27026 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27027 RECEIVE_PACKET_FIELD_ERROR(tech);
27028 }
27029 }
27030
27031 if (NULL == old) {
27032 old = fc_malloc(sizeof(*old));
27033 *old = *real_packet;
27034 genhash_insert(*hash, old, old);
27035 } else {
27036 *old = *real_packet;
27037 }
27038
27039#endif /* FREECIV_DELTA_PROTOCOL */
27040 RECEIVE_PACKET_END(real_packet);
27041}
27042
27043 static int send_packet_player_research_100(struct connection *pc, const struct packet_player_research *packet)
27044{
27045 const struct packet_player_research *real_packet = packet;
27046 int e;
27047#ifdef FREECIV_DELTA_PROTOCOL
27048 packet_player_research_100_fields fields;
27049 struct packet_player_research *old;
27050 bool differ;
27051 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_RESEARCH;
27052#endif /* FREECIV_DELTA_PROTOCOL */
27053 SEND_PACKET_START(PACKET_PLAYER_RESEARCH);
27054#ifdef FREECIV_JSON_CONNECTION
27055 struct plocation field_addr;
27056 {
27057 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27058 field_addr = *field_addr_tmp;
27059 FC_FREE(field_addr_tmp);
27060 }
27061#endif /* FREECIV_JSON_CONNECTION */
27062
27063 log_packet_detailed("packet_player_research_100: sending info about ()");
27064
27065#ifdef FREECIV_DELTA_PROTOCOL
27066 if (NULL == *hash) {
27067 *hash = genhash_new_full(hash_packet_player_research_100, cmp_packet_player_research_100,
27068 NULL, NULL, NULL, free);
27069 }
27070 BV_CLR_ALL(fields);
27071
27072 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27073 old = fc_malloc(sizeof(*old));
27074 *old = *real_packet;
27075 genhash_insert(*hash, old, old);
27076 memset(old, 0, sizeof(*old));
27077 }
27078 differ = (old->tech != real_packet->tech);
27079 if (differ) {
27080 BV_SET(fields, 0);
27081 }
27082
27083
27084#ifdef FREECIV_JSON_CONNECTION
27085 field_addr.name = "fields";
27086#endif /* FREECIV_JSON_CONNECTION */
27087 e = 0;
27088 e |= DIO_BV_PUT(&dout, &field_addr, fields);
27089 if (e) {
27090 log_packet_detailed("fields bitvector error detected");
27091 }
27092
27093 if (BV_ISSET(fields, 0)) {
27094 log_packet_detailed(" field 'tech' has changed");
27095#ifdef FREECIV_JSON_CONNECTION
27096 field_addr.name = "tech";
27097#endif /* FREECIV_JSON_CONNECTION */
27098 e = 0;
27099 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
27100 if (e) {
27101 log_packet_detailed("'tech' field error detected");
27102 }
27103 }
27104
27105 *old = *real_packet;
27106#endif /* FREECIV_DELTA_PROTOCOL */
27107#ifndef FREECIV_DELTA_PROTOCOL
27108#ifdef FREECIV_JSON_CONNECTION
27109 field_addr.name = "tech";
27110#endif /* FREECIV_JSON_CONNECTION */
27111 e = 0;
27112 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
27113 if (e) {
27114 log_packet_detailed("'tech' field error detected");
27115 }
27116
27117#endif
27118 SEND_PACKET_END(PACKET_PLAYER_RESEARCH);
27119}
27120
27121 int send_packet_player_research(struct connection *pc, const struct packet_player_research *packet)
27122{
27123 if (!pc->used) {
27124 log_error("WARNING: trying to send data to the closed connection %s",
27125 conn_description(pc));
27126 return -1;
27127 }
27128 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_RESEARCH].packet != NULL, -1,
27129 "Handler for PACKET_PLAYER_RESEARCH not installed");
27130 return pc->phs.handlers->send[PACKET_PLAYER_RESEARCH].packet(pc, packet);
27131}
27132
27133 int dsend_packet_player_research(struct connection *pc, int tech)
27134{
27135 struct packet_player_research packet, *real_packet = &packet;
27136
27137 real_packet->tech = tech;
27138
27139 return send_packet_player_research(pc, real_packet);
27140}
27141
27142#ifdef FREECIV_DELTA_PROTOCOL
27143#define hash_packet_player_tech_goal_100 hash_const
27144
27145#define cmp_packet_player_tech_goal_100 cmp_const
27146
27147 BV_DEFINE(packet_player_tech_goal_100_fields, 1);
27148#endif /* FREECIV_DELTA_PROTOCOL */
27149
27150 static struct packet_player_tech_goal *receive_packet_player_tech_goal_100(struct connection *pc)
27151{
27152#ifdef FREECIV_DELTA_PROTOCOL
27153 packet_player_tech_goal_100_fields fields;
27154 struct packet_player_tech_goal *old;
27155 struct genhash **hash = pc->phs.received + PACKET_PLAYER_TECH_GOAL;
27156#endif /* FREECIV_DELTA_PROTOCOL */
27157 RECEIVE_PACKET_START(packet_player_tech_goal, real_packet);
27158#ifdef FREECIV_JSON_CONNECTION
27159 struct plocation field_addr;
27160 {
27161 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27162 field_addr = *field_addr_tmp;
27163 FC_FREE(field_addr_tmp);
27164 }
27165#endif /* FREECIV_JSON_CONNECTION */
27166
27167#ifdef FREECIV_DELTA_PROTOCOL
27168#ifdef FREECIV_JSON_CONNECTION
27169 field_addr.name = "fields";
27170#endif /* FREECIV_JSON_CONNECTION */
27171 DIO_BV_GET(&din, &field_addr, fields);
27172
27173#else /* FREECIV_DELTA_PROTOCOL */
27174#ifdef FREECIV_JSON_CONNECTION
27175 field_addr.name = "tech";
27176#endif /* FREECIV_JSON_CONNECTION */
27177 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27178 RECEIVE_PACKET_FIELD_ERROR(tech);
27179 }
27180#endif
27181 log_packet_detailed("packet_player_tech_goal_100: got info about ()");
27182
27183#ifdef FREECIV_DELTA_PROTOCOL
27184 if (NULL == *hash) {
27185 *hash = genhash_new_full(hash_packet_player_tech_goal_100, cmp_packet_player_tech_goal_100,
27186 NULL, NULL, NULL, free);
27187 }
27188
27189 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27190 *real_packet = *old;
27191 } else {
27192 log_packet_detailed(" no old info");
27193 memset(real_packet, 0, sizeof(*real_packet));
27194 }
27195
27196 if (BV_ISSET(fields, 0)) {
27197 log_packet_detailed(" got field 'tech'");
27198#ifdef FREECIV_JSON_CONNECTION
27199 field_addr.name = "tech";
27200#endif /* FREECIV_JSON_CONNECTION */
27201 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tech)) {
27202 RECEIVE_PACKET_FIELD_ERROR(tech);
27203 }
27204 }
27205
27206 if (NULL == old) {
27207 old = fc_malloc(sizeof(*old));
27208 *old = *real_packet;
27209 genhash_insert(*hash, old, old);
27210 } else {
27211 *old = *real_packet;
27212 }
27213
27214#endif /* FREECIV_DELTA_PROTOCOL */
27215 RECEIVE_PACKET_END(real_packet);
27216}
27217
27218 static int send_packet_player_tech_goal_100(struct connection *pc, const struct packet_player_tech_goal *packet)
27219{
27220 const struct packet_player_tech_goal *real_packet = packet;
27221 int e;
27222#ifdef FREECIV_DELTA_PROTOCOL
27223 packet_player_tech_goal_100_fields fields;
27224 struct packet_player_tech_goal *old;
27225 bool differ;
27226 struct genhash **hash = pc->phs.sent + PACKET_PLAYER_TECH_GOAL;
27227#endif /* FREECIV_DELTA_PROTOCOL */
27228 SEND_PACKET_START(PACKET_PLAYER_TECH_GOAL);
27229#ifdef FREECIV_JSON_CONNECTION
27230 struct plocation field_addr;
27231 {
27232 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27233 field_addr = *field_addr_tmp;
27234 FC_FREE(field_addr_tmp);
27235 }
27236#endif /* FREECIV_JSON_CONNECTION */
27237
27238 log_packet_detailed("packet_player_tech_goal_100: sending info about ()");
27239
27240#ifdef FREECIV_DELTA_PROTOCOL
27241 if (NULL == *hash) {
27242 *hash = genhash_new_full(hash_packet_player_tech_goal_100, cmp_packet_player_tech_goal_100,
27243 NULL, NULL, NULL, free);
27244 }
27245 BV_CLR_ALL(fields);
27246
27247 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27248 old = fc_malloc(sizeof(*old));
27249 *old = *real_packet;
27250 genhash_insert(*hash, old, old);
27251 memset(old, 0, sizeof(*old));
27252 }
27253 differ = (old->tech != real_packet->tech);
27254 if (differ) {
27255 BV_SET(fields, 0);
27256 }
27257
27258
27259#ifdef FREECIV_JSON_CONNECTION
27260 field_addr.name = "fields";
27261#endif /* FREECIV_JSON_CONNECTION */
27262 e = 0;
27263 e |= DIO_BV_PUT(&dout, &field_addr, fields);
27264 if (e) {
27265 log_packet_detailed("fields bitvector error detected");
27266 }
27267
27268 if (BV_ISSET(fields, 0)) {
27269 log_packet_detailed(" field 'tech' has changed");
27270#ifdef FREECIV_JSON_CONNECTION
27271 field_addr.name = "tech";
27272#endif /* FREECIV_JSON_CONNECTION */
27273 e = 0;
27274 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
27275 if (e) {
27276 log_packet_detailed("'tech' field error detected");
27277 }
27278 }
27279
27280 *old = *real_packet;
27281#endif /* FREECIV_DELTA_PROTOCOL */
27282#ifndef FREECIV_DELTA_PROTOCOL
27283#ifdef FREECIV_JSON_CONNECTION
27284 field_addr.name = "tech";
27285#endif /* FREECIV_JSON_CONNECTION */
27286 e = 0;
27287 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tech);
27288 if (e) {
27289 log_packet_detailed("'tech' field error detected");
27290 }
27291
27292#endif
27293 SEND_PACKET_END(PACKET_PLAYER_TECH_GOAL);
27294}
27295
27296 int send_packet_player_tech_goal(struct connection *pc, const struct packet_player_tech_goal *packet)
27297{
27298 if (!pc->used) {
27299 log_error("WARNING: trying to send data to the closed connection %s",
27300 conn_description(pc));
27301 return -1;
27302 }
27303 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAYER_TECH_GOAL].packet != NULL, -1,
27304 "Handler for PACKET_PLAYER_TECH_GOAL not installed");
27305 return pc->phs.handlers->send[PACKET_PLAYER_TECH_GOAL].packet(pc, packet);
27306}
27307
27308 int dsend_packet_player_tech_goal(struct connection *pc, int tech)
27309{
27310 struct packet_player_tech_goal packet, *real_packet = &packet;
27311
27312 real_packet->tech = tech;
27313
27314 return send_packet_player_tech_goal(pc, real_packet);
27315}
27316
27317#ifdef FREECIV_DELTA_PROTOCOL
27318#define hash_packet_unit_remove_100 hash_const
27319
27320#define cmp_packet_unit_remove_100 cmp_const
27321
27322 BV_DEFINE(packet_unit_remove_100_fields, 1);
27323#endif /* FREECIV_DELTA_PROTOCOL */
27324
27325 static struct packet_unit_remove *receive_packet_unit_remove_100(struct connection *pc)
27326{
27327#ifdef FREECIV_DELTA_PROTOCOL
27328 packet_unit_remove_100_fields fields;
27329 struct packet_unit_remove *old;
27330 struct genhash **hash = pc->phs.received + PACKET_UNIT_REMOVE;
27331#endif /* FREECIV_DELTA_PROTOCOL */
27332 RECEIVE_PACKET_START(packet_unit_remove, real_packet);
27333#ifdef FREECIV_JSON_CONNECTION
27334 struct plocation field_addr;
27335 {
27336 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27337 field_addr = *field_addr_tmp;
27338 FC_FREE(field_addr_tmp);
27339 }
27340#endif /* FREECIV_JSON_CONNECTION */
27341
27342#ifdef FREECIV_DELTA_PROTOCOL
27343#ifdef FREECIV_JSON_CONNECTION
27344 field_addr.name = "fields";
27345#endif /* FREECIV_JSON_CONNECTION */
27346 DIO_BV_GET(&din, &field_addr, fields);
27347
27348#else /* FREECIV_DELTA_PROTOCOL */
27349#ifdef FREECIV_JSON_CONNECTION
27350 field_addr.name = "unit_id";
27351#endif /* FREECIV_JSON_CONNECTION */
27352 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
27353 RECEIVE_PACKET_FIELD_ERROR(unit_id);
27354 }
27355#endif
27356 log_packet_detailed("packet_unit_remove_100: got info about ()");
27357
27358#ifdef FREECIV_DELTA_PROTOCOL
27359 if (NULL == *hash) {
27360 *hash = genhash_new_full(hash_packet_unit_remove_100, cmp_packet_unit_remove_100,
27361 NULL, NULL, NULL, free);
27362 }
27363
27364 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27365 *real_packet = *old;
27366 } else {
27367 log_packet_detailed(" no old info");
27368 memset(real_packet, 0, sizeof(*real_packet));
27369 }
27370
27371 if (BV_ISSET(fields, 0)) {
27372 log_packet_detailed(" got field 'unit_id'");
27373#ifdef FREECIV_JSON_CONNECTION
27374 field_addr.name = "unit_id";
27375#endif /* FREECIV_JSON_CONNECTION */
27376 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
27377 RECEIVE_PACKET_FIELD_ERROR(unit_id);
27378 }
27379 }
27380
27381 if (NULL == old) {
27382 old = fc_malloc(sizeof(*old));
27383 *old = *real_packet;
27384 genhash_insert(*hash, old, old);
27385 } else {
27386 *old = *real_packet;
27387 }
27388
27389 hash = pc->phs.received + PACKET_UNIT_INFO;
27390 if (NULL != *hash) {
27391 genhash_remove(*hash, real_packet);
27392 }
27393
27394 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
27395 if (NULL != *hash) {
27396 genhash_remove(*hash, real_packet);
27397 }
27398
27399#endif /* FREECIV_DELTA_PROTOCOL */
27400 RECEIVE_PACKET_END(real_packet);
27401}
27402
27403 static int send_packet_unit_remove_100(struct connection *pc, const struct packet_unit_remove *packet)
27404{
27405 const struct packet_unit_remove *real_packet = packet;
27406 int e;
27407#ifdef FREECIV_DELTA_PROTOCOL
27408 packet_unit_remove_100_fields fields;
27409 struct packet_unit_remove *old;
27410 bool differ;
27411 struct genhash **hash = pc->phs.sent + PACKET_UNIT_REMOVE;
27412#endif /* FREECIV_DELTA_PROTOCOL */
27413 SEND_PACKET_START(PACKET_UNIT_REMOVE);
27414#ifdef FREECIV_JSON_CONNECTION
27415 struct plocation field_addr;
27416 {
27417 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27418 field_addr = *field_addr_tmp;
27419 FC_FREE(field_addr_tmp);
27420 }
27421#endif /* FREECIV_JSON_CONNECTION */
27422
27423 log_packet_detailed("packet_unit_remove_100: sending info about ()");
27424
27425#ifdef FREECIV_DELTA_PROTOCOL
27426 if (NULL == *hash) {
27427 *hash = genhash_new_full(hash_packet_unit_remove_100, cmp_packet_unit_remove_100,
27428 NULL, NULL, NULL, free);
27429 }
27430 BV_CLR_ALL(fields);
27431
27432 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
27433 old = fc_malloc(sizeof(*old));
27434 *old = *real_packet;
27435 genhash_insert(*hash, old, old);
27436 memset(old, 0, sizeof(*old));
27437 }
27438 differ = (old->unit_id != real_packet->unit_id);
27439 if (differ) {
27440 BV_SET(fields, 0);
27441 }
27442
27443
27444#ifdef FREECIV_JSON_CONNECTION
27445 field_addr.name = "fields";
27446#endif /* FREECIV_JSON_CONNECTION */
27447 e = 0;
27448 e |= DIO_BV_PUT(&dout, &field_addr, fields);
27449 if (e) {
27450 log_packet_detailed("fields bitvector error detected");
27451 }
27452
27453 if (BV_ISSET(fields, 0)) {
27454 log_packet_detailed(" field 'unit_id' has changed");
27455#ifdef FREECIV_JSON_CONNECTION
27456 field_addr.name = "unit_id";
27457#endif /* FREECIV_JSON_CONNECTION */
27458 e = 0;
27459 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
27460 if (e) {
27461 log_packet_detailed("'unit_id' field error detected");
27462 }
27463 }
27464
27465 *old = *real_packet;
27466
27467 hash = pc->phs.sent + PACKET_UNIT_INFO;
27468 if (NULL != *hash) {
27469 genhash_remove(*hash, real_packet);
27470 }
27471
27472 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
27473 if (NULL != *hash) {
27474 genhash_remove(*hash, real_packet);
27475 }
27476#endif /* FREECIV_DELTA_PROTOCOL */
27477#ifndef FREECIV_DELTA_PROTOCOL
27478#ifdef FREECIV_JSON_CONNECTION
27479 field_addr.name = "unit_id";
27480#endif /* FREECIV_JSON_CONNECTION */
27481 e = 0;
27482 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
27483 if (e) {
27484 log_packet_detailed("'unit_id' field error detected");
27485 }
27486
27487#endif
27488 SEND_PACKET_END(PACKET_UNIT_REMOVE);
27489}
27490
27491 int send_packet_unit_remove(struct connection *pc, const struct packet_unit_remove *packet)
27492{
27493 if (!pc->used) {
27494 log_error("WARNING: trying to send data to the closed connection %s",
27495 conn_description(pc));
27496 return -1;
27497 }
27498 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_REMOVE].packet != NULL, -1,
27499 "Handler for PACKET_UNIT_REMOVE not installed");
27500 return pc->phs.handlers->send[PACKET_UNIT_REMOVE].packet(pc, packet);
27501}
27502
27503 void lsend_packet_unit_remove(struct conn_list *dest, const struct packet_unit_remove *packet)
27504{
27505 conn_list_iterate(dest, pconn) {
27506 send_packet_unit_remove(pconn, packet);
27507 } conn_list_iterate_end;
27508}
27509
27510 int dsend_packet_unit_remove(struct connection *pc, int unit_id)
27511{
27512 struct packet_unit_remove packet, *real_packet = &packet;
27513
27514 real_packet->unit_id = unit_id;
27515
27516 return send_packet_unit_remove(pc, real_packet);
27517}
27518
27519 void dlsend_packet_unit_remove(struct conn_list *dest, int unit_id)
27520{
27521 struct packet_unit_remove packet, *real_packet = &packet;
27522
27523 real_packet->unit_id = unit_id;
27524
27525 lsend_packet_unit_remove(dest, real_packet);
27526}
27527
27528#ifdef FREECIV_DELTA_PROTOCOL
27529static genhash_val_t hash_packet_unit_info_100(const void *vkey)
27530{
27531 const struct packet_unit_info *key = (const struct packet_unit_info *) vkey;
27532 genhash_val_t result = 0;
27533
27534 result += key->id;
27535
27536 result &= 0xFFFFFFFF;
27537 return result;
27538}
27539
27540static bool cmp_packet_unit_info_100(const void *vkey1, const void *vkey2)
27541{
27542 const struct packet_unit_info *old = (const struct packet_unit_info *) vkey1;
27543 const struct packet_unit_info *real_packet = (const struct packet_unit_info *) vkey2;
27544 bool differ;
27545
27546 differ = (old->id != real_packet->id);
27547
27548 return !differ;
27549}
27550 BV_DEFINE(packet_unit_info_100_fields, 37);
27551#endif /* FREECIV_DELTA_PROTOCOL */
27552
27553 static struct packet_unit_info *receive_packet_unit_info_100(struct connection *pc)
27554{
27555#ifdef FREECIV_DELTA_PROTOCOL
27556 packet_unit_info_100_fields fields;
27557 struct packet_unit_info *old;
27558 struct genhash **hash = pc->phs.received + PACKET_UNIT_INFO;
27559#endif /* FREECIV_DELTA_PROTOCOL */
27560 RECEIVE_PACKET_START(packet_unit_info, real_packet);
27561#ifdef FREECIV_JSON_CONNECTION
27562 struct plocation field_addr;
27563 {
27564 struct plocation *field_addr_tmp = plocation_field_new(NULL);
27565 field_addr = *field_addr_tmp;
27566 FC_FREE(field_addr_tmp);
27567 }
27568#endif /* FREECIV_JSON_CONNECTION */
27569
27570#ifdef FREECIV_DELTA_PROTOCOL
27571#ifdef FREECIV_JSON_CONNECTION
27572 field_addr.name = "fields";
27573#endif /* FREECIV_JSON_CONNECTION */
27574 DIO_BV_GET(&din, &field_addr, fields);
27575#ifdef FREECIV_JSON_CONNECTION
27576 field_addr.name = "id";
27577#endif /* FREECIV_JSON_CONNECTION */
27578 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
27579 RECEIVE_PACKET_FIELD_ERROR(id);
27580 }
27581
27582#else /* FREECIV_DELTA_PROTOCOL */
27583#ifdef FREECIV_JSON_CONNECTION
27584 field_addr.name = "id";
27585#endif /* FREECIV_JSON_CONNECTION */
27586 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
27587 RECEIVE_PACKET_FIELD_ERROR(id);
27588 }
27589#ifdef FREECIV_JSON_CONNECTION
27590 field_addr.name = "owner";
27591#endif /* FREECIV_JSON_CONNECTION */
27592 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
27593 RECEIVE_PACKET_FIELD_ERROR(owner);
27594 }
27595#ifdef FREECIV_JSON_CONNECTION
27596 field_addr.name = "nationality";
27597#endif /* FREECIV_JSON_CONNECTION */
27598 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nationality)) {
27599 RECEIVE_PACKET_FIELD_ERROR(nationality);
27600 }
27601#ifdef FREECIV_JSON_CONNECTION
27602 field_addr.name = "tile";
27603#endif /* FREECIV_JSON_CONNECTION */
27604 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
27605 RECEIVE_PACKET_FIELD_ERROR(tile);
27606 }
27607#ifdef FREECIV_JSON_CONNECTION
27608 field_addr.name = "facing";
27609#endif /* FREECIV_JSON_CONNECTION */
27610 {
27611 int readin;
27612
27613 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
27614 RECEIVE_PACKET_FIELD_ERROR(facing);
27615 }
27616 real_packet->facing = readin;
27617 }
27618#ifdef FREECIV_JSON_CONNECTION
27619 field_addr.name = "homecity";
27620#endif /* FREECIV_JSON_CONNECTION */
27621 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
27622 RECEIVE_PACKET_FIELD_ERROR(homecity);
27623 }
27624#ifdef FREECIV_JSON_CONNECTION
27625 field_addr.name = "upkeep";
27626#endif /* FREECIV_JSON_CONNECTION */
27627 {
27628 int i;
27629
27630#ifdef FREECIV_JSON_CONNECTION
27631 /* Enter array. */
27632 field_addr.sub_location = plocation_elem_new(0);
27633#endif /* FREECIV_JSON_CONNECTION */
27634
27635 for (i = 0; i < O_LAST; i++) {
27636#ifdef FREECIV_JSON_CONNECTION
27637 field_addr.sub_location->number = i;
27638#endif /* FREECIV_JSON_CONNECTION */
27639 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
27640 RECEIVE_PACKET_FIELD_ERROR(upkeep);
27641 }
27642 }
27643
27644#ifdef FREECIV_JSON_CONNECTION
27645 /* Exit array. */
27646 FC_FREE(field_addr.sub_location);
27647#endif /* FREECIV_JSON_CONNECTION */
27648 }
27649#ifdef FREECIV_JSON_CONNECTION
27650 field_addr.name = "veteran";
27651#endif /* FREECIV_JSON_CONNECTION */
27652 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
27653 RECEIVE_PACKET_FIELD_ERROR(veteran);
27654 }
27655#ifdef FREECIV_JSON_CONNECTION
27656 field_addr.name = "ssa_controller";
27657#endif /* FREECIV_JSON_CONNECTION */
27658 {
27659 int readin;
27660
27661 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
27662 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
27663 }
27664 real_packet->ssa_controller = readin;
27665 }
27666#ifdef FREECIV_JSON_CONNECTION
27667 field_addr.name = "paradropped";
27668#endif /* FREECIV_JSON_CONNECTION */
27669 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
27670 RECEIVE_PACKET_FIELD_ERROR(paradropped);
27671 }
27672#ifdef FREECIV_JSON_CONNECTION
27673 field_addr.name = "occupied";
27674#endif /* FREECIV_JSON_CONNECTION */
27675 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
27676 RECEIVE_PACKET_FIELD_ERROR(occupied);
27677 }
27678#ifdef FREECIV_JSON_CONNECTION
27679 field_addr.name = "transported";
27680#endif /* FREECIV_JSON_CONNECTION */
27681 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
27682 RECEIVE_PACKET_FIELD_ERROR(transported);
27683 }
27684#ifdef FREECIV_JSON_CONNECTION
27685 field_addr.name = "done_moving";
27686#endif /* FREECIV_JSON_CONNECTION */
27687 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
27688 RECEIVE_PACKET_FIELD_ERROR(done_moving);
27689 }
27690#ifdef FREECIV_JSON_CONNECTION
27691 field_addr.name = "stay";
27692#endif /* FREECIV_JSON_CONNECTION */
27693 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
27694 RECEIVE_PACKET_FIELD_ERROR(stay);
27695 }
27696#ifdef FREECIV_JSON_CONNECTION
27697 field_addr.name = "birth_turn";
27698#endif /* FREECIV_JSON_CONNECTION */
27699 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->birth_turn)) {
27700 RECEIVE_PACKET_FIELD_ERROR(birth_turn);
27701 }
27702#ifdef FREECIV_JSON_CONNECTION
27703 field_addr.name = "current_form_turn";
27704#endif /* FREECIV_JSON_CONNECTION */
27705 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->current_form_turn)) {
27706 RECEIVE_PACKET_FIELD_ERROR(current_form_turn);
27707 }
27708#ifdef FREECIV_JSON_CONNECTION
27709 field_addr.name = "type";
27710#endif /* FREECIV_JSON_CONNECTION */
27711 {
27712 int readin;
27713
27714 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
27715 RECEIVE_PACKET_FIELD_ERROR(type);
27716 }
27717 real_packet->type = readin;
27718 }
27719#ifdef FREECIV_JSON_CONNECTION
27720 field_addr.name = "transported_by";
27721#endif /* FREECIV_JSON_CONNECTION */
27722 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
27723 RECEIVE_PACKET_FIELD_ERROR(transported_by);
27724 }
27725#ifdef FREECIV_JSON_CONNECTION
27726 field_addr.name = "carrying";
27727#endif /* FREECIV_JSON_CONNECTION */
27728 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
27729 RECEIVE_PACKET_FIELD_ERROR(carrying);
27730 }
27731#ifdef FREECIV_JSON_CONNECTION
27732 field_addr.name = "movesleft";
27733#endif /* FREECIV_JSON_CONNECTION */
27734 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
27735 RECEIVE_PACKET_FIELD_ERROR(movesleft);
27736 }
27737#ifdef FREECIV_JSON_CONNECTION
27738 field_addr.name = "hp";
27739#endif /* FREECIV_JSON_CONNECTION */
27740 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
27741 RECEIVE_PACKET_FIELD_ERROR(hp);
27742 }
27743#ifdef FREECIV_JSON_CONNECTION
27744 field_addr.name = "fuel";
27745#endif /* FREECIV_JSON_CONNECTION */
27746 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
27747 RECEIVE_PACKET_FIELD_ERROR(fuel);
27748 }
27749#ifdef FREECIV_JSON_CONNECTION
27750 field_addr.name = "activity_count";
27751#endif /* FREECIV_JSON_CONNECTION */
27752 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
27753 RECEIVE_PACKET_FIELD_ERROR(activity_count);
27754 }
27755#ifdef FREECIV_JSON_CONNECTION
27756 field_addr.name = "changed_from_count";
27757#endif /* FREECIV_JSON_CONNECTION */
27758 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
27759 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
27760 }
27761#ifdef FREECIV_JSON_CONNECTION
27762 field_addr.name = "goto_tile";
27763#endif /* FREECIV_JSON_CONNECTION */
27764 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
27765 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
27766 }
27767#ifdef FREECIV_JSON_CONNECTION
27768 field_addr.name = "activity";
27769#endif /* FREECIV_JSON_CONNECTION */
27770 {
27771 int readin;
27772
27773 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
27774 RECEIVE_PACKET_FIELD_ERROR(activity);
27775 }
27776 real_packet->activity = readin;
27777 }
27778#ifdef FREECIV_JSON_CONNECTION
27779 field_addr.name = "activity_tgt";
27780#endif /* FREECIV_JSON_CONNECTION */
27781 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
27782 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
27783 }
27784#ifdef FREECIV_JSON_CONNECTION
27785 field_addr.name = "changed_from";
27786#endif /* FREECIV_JSON_CONNECTION */
27787 {
27788 int readin;
27789
27790 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
27791 RECEIVE_PACKET_FIELD_ERROR(changed_from);
27792 }
27793 real_packet->changed_from = readin;
27794 }
27795#ifdef FREECIV_JSON_CONNECTION
27796 field_addr.name = "changed_from_tgt";
27797#endif /* FREECIV_JSON_CONNECTION */
27798 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
27799 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
27800 }
27801#ifdef FREECIV_JSON_CONNECTION
27802 field_addr.name = "battlegroup";
27803#endif /* FREECIV_JSON_CONNECTION */
27804 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
27805 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
27806 }
27807#ifdef FREECIV_JSON_CONNECTION
27808 field_addr.name = "has_orders";
27809#endif /* FREECIV_JSON_CONNECTION */
27810 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->has_orders)) {
27811 RECEIVE_PACKET_FIELD_ERROR(has_orders);
27812 }
27813#ifdef FREECIV_JSON_CONNECTION
27814 field_addr.name = "orders_length";
27815#endif /* FREECIV_JSON_CONNECTION */
27816 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
27817 RECEIVE_PACKET_FIELD_ERROR(orders_length);
27818 }
27819#ifdef FREECIV_JSON_CONNECTION
27820 field_addr.name = "orders_index";
27821#endif /* FREECIV_JSON_CONNECTION */
27822 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
27823 RECEIVE_PACKET_FIELD_ERROR(orders_index);
27824 }
27825#ifdef FREECIV_JSON_CONNECTION
27826 field_addr.name = "orders_repeat";
27827#endif /* FREECIV_JSON_CONNECTION */
27828 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_repeat)) {
27829 RECEIVE_PACKET_FIELD_ERROR(orders_repeat);
27830 }
27831#ifdef FREECIV_JSON_CONNECTION
27832 field_addr.name = "orders_vigilant";
27833#endif /* FREECIV_JSON_CONNECTION */
27834 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->orders_vigilant)) {
27835 RECEIVE_PACKET_FIELD_ERROR(orders_vigilant);
27836 }
27837#ifdef FREECIV_JSON_CONNECTION
27838 field_addr.name = "orders";
27839#endif /* FREECIV_JSON_CONNECTION */
27840 {
27841 int i;
27842
27843#ifdef FREECIV_JSON_CONNECTION
27844 /* Enter array. */
27845 field_addr.sub_location = plocation_elem_new(0);
27846#endif /* FREECIV_JSON_CONNECTION */
27847
27848 if (real_packet->orders_length > MAX_LEN_ROUTE) {
27849 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
27850 }
27851 for (i = 0; i < real_packet->orders_length; i++) {
27852#ifdef FREECIV_JSON_CONNECTION
27853 field_addr.sub_location->number = i;
27854#endif /* FREECIV_JSON_CONNECTION */
27855 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
27856 RECEIVE_PACKET_FIELD_ERROR(orders);
27857 }
27858 }
27859
27860#ifdef FREECIV_JSON_CONNECTION
27861 /* Exit array. */
27862 FC_FREE(field_addr.sub_location);
27863#endif /* FREECIV_JSON_CONNECTION */
27864 }
27865#ifdef FREECIV_JSON_CONNECTION
27866 field_addr.name = "action_decision_want";
27867#endif /* FREECIV_JSON_CONNECTION */
27868 {
27869 int readin;
27870
27871 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
27872 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
27873 }
27874 real_packet->action_decision_want = readin;
27875 }
27876#ifdef FREECIV_JSON_CONNECTION
27877 field_addr.name = "action_decision_tile";
27878#endif /* FREECIV_JSON_CONNECTION */
27879 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
27880 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
27881 }
27882#endif
27883 log_packet_detailed("packet_unit_info_100: got info about (%d)",
27884 real_packet->id);
27885
27886#ifdef FREECIV_DELTA_PROTOCOL
27887 if (NULL == *hash) {
27888 *hash = genhash_new_full(hash_packet_unit_info_100, cmp_packet_unit_info_100,
27889 NULL, NULL, NULL, free);
27890 }
27891
27892 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
27893 *real_packet = *old;
27894 } else {
27895 int id;
27896
27897 id = real_packet->id;
27898
27899 log_packet_detailed(" no old info");
27900 memset(real_packet, 0, sizeof(*real_packet));
27901
27902 real_packet->id = id;
27903 }
27904
27905 if (BV_ISSET(fields, 0)) {
27906 log_packet_detailed(" got field 'owner'");
27907#ifdef FREECIV_JSON_CONNECTION
27908 field_addr.name = "owner";
27909#endif /* FREECIV_JSON_CONNECTION */
27910 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
27911 RECEIVE_PACKET_FIELD_ERROR(owner);
27912 }
27913 }
27914 if (BV_ISSET(fields, 1)) {
27915 log_packet_detailed(" got field 'nationality'");
27916#ifdef FREECIV_JSON_CONNECTION
27917 field_addr.name = "nationality";
27918#endif /* FREECIV_JSON_CONNECTION */
27919 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nationality)) {
27920 RECEIVE_PACKET_FIELD_ERROR(nationality);
27921 }
27922 }
27923 if (BV_ISSET(fields, 2)) {
27924 log_packet_detailed(" got field 'tile'");
27925#ifdef FREECIV_JSON_CONNECTION
27926 field_addr.name = "tile";
27927#endif /* FREECIV_JSON_CONNECTION */
27928 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
27929 RECEIVE_PACKET_FIELD_ERROR(tile);
27930 }
27931 }
27932 if (BV_ISSET(fields, 3)) {
27933 log_packet_detailed(" got field 'facing'");
27934#ifdef FREECIV_JSON_CONNECTION
27935 field_addr.name = "facing";
27936#endif /* FREECIV_JSON_CONNECTION */
27937 {
27938 int readin;
27939
27940 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
27941 RECEIVE_PACKET_FIELD_ERROR(facing);
27942 }
27943 real_packet->facing = readin;
27944 }
27945 }
27946 if (BV_ISSET(fields, 4)) {
27947 log_packet_detailed(" got field 'homecity'");
27948#ifdef FREECIV_JSON_CONNECTION
27949 field_addr.name = "homecity";
27950#endif /* FREECIV_JSON_CONNECTION */
27951 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
27952 RECEIVE_PACKET_FIELD_ERROR(homecity);
27953 }
27954 }
27955 if (BV_ISSET(fields, 5)) {
27956 log_packet_detailed(" got field 'upkeep'");
27957#ifdef FREECIV_JSON_CONNECTION
27958 field_addr.name = "upkeep";
27959#endif /* FREECIV_JSON_CONNECTION */
27960 {
27961 int i;
27962
27963#ifdef FREECIV_JSON_CONNECTION
27964 /* Enter array. */
27965 field_addr.sub_location = plocation_elem_new(0);
27966#endif /* FREECIV_JSON_CONNECTION */
27967
27968 for (i = 0; i < O_LAST; i++) {
27969#ifdef FREECIV_JSON_CONNECTION
27970 field_addr.sub_location->number = i;
27971#endif /* FREECIV_JSON_CONNECTION */
27972 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
27973 RECEIVE_PACKET_FIELD_ERROR(upkeep);
27974 }
27975 }
27976
27977#ifdef FREECIV_JSON_CONNECTION
27978 /* Exit array. */
27979 FC_FREE(field_addr.sub_location);
27980#endif /* FREECIV_JSON_CONNECTION */
27981 }
27982 }
27983 if (BV_ISSET(fields, 6)) {
27984 log_packet_detailed(" got field 'veteran'");
27985#ifdef FREECIV_JSON_CONNECTION
27986 field_addr.name = "veteran";
27987#endif /* FREECIV_JSON_CONNECTION */
27988 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
27989 RECEIVE_PACKET_FIELD_ERROR(veteran);
27990 }
27991 }
27992 if (BV_ISSET(fields, 7)) {
27993 log_packet_detailed(" got field 'ssa_controller'");
27994#ifdef FREECIV_JSON_CONNECTION
27995 field_addr.name = "ssa_controller";
27996#endif /* FREECIV_JSON_CONNECTION */
27997 {
27998 int readin;
27999
28000 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28001 RECEIVE_PACKET_FIELD_ERROR(ssa_controller);
28002 }
28003 real_packet->ssa_controller = readin;
28004 }
28005 }
28006 real_packet->paradropped = BV_ISSET(fields, 8);
28007 real_packet->occupied = BV_ISSET(fields, 9);
28008 real_packet->transported = BV_ISSET(fields, 10);
28009 real_packet->done_moving = BV_ISSET(fields, 11);
28010 real_packet->stay = BV_ISSET(fields, 12);
28011 if (BV_ISSET(fields, 13)) {
28012 log_packet_detailed(" got field 'birth_turn'");
28013#ifdef FREECIV_JSON_CONNECTION
28014 field_addr.name = "birth_turn";
28015#endif /* FREECIV_JSON_CONNECTION */
28016 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->birth_turn)) {
28017 RECEIVE_PACKET_FIELD_ERROR(birth_turn);
28018 }
28019 }
28020 if (BV_ISSET(fields, 14)) {
28021 log_packet_detailed(" got field 'current_form_turn'");
28022#ifdef FREECIV_JSON_CONNECTION
28023 field_addr.name = "current_form_turn";
28024#endif /* FREECIV_JSON_CONNECTION */
28025 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->current_form_turn)) {
28026 RECEIVE_PACKET_FIELD_ERROR(current_form_turn);
28027 }
28028 }
28029 if (BV_ISSET(fields, 15)) {
28030 log_packet_detailed(" got field 'type'");
28031#ifdef FREECIV_JSON_CONNECTION
28032 field_addr.name = "type";
28033#endif /* FREECIV_JSON_CONNECTION */
28034 {
28035 int readin;
28036
28037 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28038 RECEIVE_PACKET_FIELD_ERROR(type);
28039 }
28040 real_packet->type = readin;
28041 }
28042 }
28043 if (BV_ISSET(fields, 16)) {
28044 log_packet_detailed(" got field 'transported_by'");
28045#ifdef FREECIV_JSON_CONNECTION
28046 field_addr.name = "transported_by";
28047#endif /* FREECIV_JSON_CONNECTION */
28048 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
28049 RECEIVE_PACKET_FIELD_ERROR(transported_by);
28050 }
28051 }
28052 if (BV_ISSET(fields, 17)) {
28053 log_packet_detailed(" got field 'carrying'");
28054#ifdef FREECIV_JSON_CONNECTION
28055 field_addr.name = "carrying";
28056#endif /* FREECIV_JSON_CONNECTION */
28057 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->carrying)) {
28058 RECEIVE_PACKET_FIELD_ERROR(carrying);
28059 }
28060 }
28061 if (BV_ISSET(fields, 18)) {
28062 log_packet_detailed(" got field 'movesleft'");
28063#ifdef FREECIV_JSON_CONNECTION
28064 field_addr.name = "movesleft";
28065#endif /* FREECIV_JSON_CONNECTION */
28066 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->movesleft)) {
28067 RECEIVE_PACKET_FIELD_ERROR(movesleft);
28068 }
28069 }
28070 if (BV_ISSET(fields, 19)) {
28071 log_packet_detailed(" got field 'hp'");
28072#ifdef FREECIV_JSON_CONNECTION
28073 field_addr.name = "hp";
28074#endif /* FREECIV_JSON_CONNECTION */
28075 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
28076 RECEIVE_PACKET_FIELD_ERROR(hp);
28077 }
28078 }
28079 if (BV_ISSET(fields, 20)) {
28080 log_packet_detailed(" got field 'fuel'");
28081#ifdef FREECIV_JSON_CONNECTION
28082 field_addr.name = "fuel";
28083#endif /* FREECIV_JSON_CONNECTION */
28084 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
28085 RECEIVE_PACKET_FIELD_ERROR(fuel);
28086 }
28087 }
28088 if (BV_ISSET(fields, 21)) {
28089 log_packet_detailed(" got field 'activity_count'");
28090#ifdef FREECIV_JSON_CONNECTION
28091 field_addr.name = "activity_count";
28092#endif /* FREECIV_JSON_CONNECTION */
28093 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
28094 RECEIVE_PACKET_FIELD_ERROR(activity_count);
28095 }
28096 }
28097 if (BV_ISSET(fields, 22)) {
28098 log_packet_detailed(" got field 'changed_from_count'");
28099#ifdef FREECIV_JSON_CONNECTION
28100 field_addr.name = "changed_from_count";
28101#endif /* FREECIV_JSON_CONNECTION */
28102 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->changed_from_count)) {
28103 RECEIVE_PACKET_FIELD_ERROR(changed_from_count);
28104 }
28105 }
28106 if (BV_ISSET(fields, 23)) {
28107 log_packet_detailed(" got field 'goto_tile'");
28108#ifdef FREECIV_JSON_CONNECTION
28109 field_addr.name = "goto_tile";
28110#endif /* FREECIV_JSON_CONNECTION */
28111 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->goto_tile)) {
28112 RECEIVE_PACKET_FIELD_ERROR(goto_tile);
28113 }
28114 }
28115 if (BV_ISSET(fields, 24)) {
28116 log_packet_detailed(" got field 'activity'");
28117#ifdef FREECIV_JSON_CONNECTION
28118 field_addr.name = "activity";
28119#endif /* FREECIV_JSON_CONNECTION */
28120 {
28121 int readin;
28122
28123 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28124 RECEIVE_PACKET_FIELD_ERROR(activity);
28125 }
28126 real_packet->activity = readin;
28127 }
28128 }
28129 if (BV_ISSET(fields, 25)) {
28130 log_packet_detailed(" got field 'activity_tgt'");
28131#ifdef FREECIV_JSON_CONNECTION
28132 field_addr.name = "activity_tgt";
28133#endif /* FREECIV_JSON_CONNECTION */
28134 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
28135 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
28136 }
28137 }
28138 if (BV_ISSET(fields, 26)) {
28139 log_packet_detailed(" got field 'changed_from'");
28140#ifdef FREECIV_JSON_CONNECTION
28141 field_addr.name = "changed_from";
28142#endif /* FREECIV_JSON_CONNECTION */
28143 {
28144 int readin;
28145
28146 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28147 RECEIVE_PACKET_FIELD_ERROR(changed_from);
28148 }
28149 real_packet->changed_from = readin;
28150 }
28151 }
28152 if (BV_ISSET(fields, 27)) {
28153 log_packet_detailed(" got field 'changed_from_tgt'");
28154#ifdef FREECIV_JSON_CONNECTION
28155 field_addr.name = "changed_from_tgt";
28156#endif /* FREECIV_JSON_CONNECTION */
28157 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->changed_from_tgt)) {
28158 RECEIVE_PACKET_FIELD_ERROR(changed_from_tgt);
28159 }
28160 }
28161 if (BV_ISSET(fields, 28)) {
28162 log_packet_detailed(" got field 'battlegroup'");
28163#ifdef FREECIV_JSON_CONNECTION
28164 field_addr.name = "battlegroup";
28165#endif /* FREECIV_JSON_CONNECTION */
28166 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->battlegroup)) {
28167 RECEIVE_PACKET_FIELD_ERROR(battlegroup);
28168 }
28169 }
28170 real_packet->has_orders = BV_ISSET(fields, 29);
28171 if (BV_ISSET(fields, 30)) {
28172 log_packet_detailed(" got field 'orders_length'");
28173#ifdef FREECIV_JSON_CONNECTION
28174 field_addr.name = "orders_length";
28175#endif /* FREECIV_JSON_CONNECTION */
28176 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_length)) {
28177 RECEIVE_PACKET_FIELD_ERROR(orders_length);
28178 }
28179 }
28180 if (BV_ISSET(fields, 31)) {
28181 log_packet_detailed(" got field 'orders_index'");
28182#ifdef FREECIV_JSON_CONNECTION
28183 field_addr.name = "orders_index";
28184#endif /* FREECIV_JSON_CONNECTION */
28185 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->orders_index)) {
28186 RECEIVE_PACKET_FIELD_ERROR(orders_index);
28187 }
28188 }
28189 real_packet->orders_repeat = BV_ISSET(fields, 32);
28190 real_packet->orders_vigilant = BV_ISSET(fields, 33);
28191 if (BV_ISSET(fields, 34)) {
28192 log_packet_detailed(" got field 'orders'");
28193#ifdef FREECIV_JSON_CONNECTION
28194 field_addr.name = "orders";
28195#endif /* FREECIV_JSON_CONNECTION */
28196 {
28197 int i;
28198
28199#ifdef FREECIV_JSON_CONNECTION
28200 /* Enter array. */
28201 field_addr.sub_location = plocation_elem_new(0);
28202#endif /* FREECIV_JSON_CONNECTION */
28203
28204 if (real_packet->orders_length > MAX_LEN_ROUTE) {
28205 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
28206 }
28207 for (i = 0; i < real_packet->orders_length; i++) {
28208#ifdef FREECIV_JSON_CONNECTION
28209 field_addr.sub_location->number = i;
28210#endif /* FREECIV_JSON_CONNECTION */
28211 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
28212 RECEIVE_PACKET_FIELD_ERROR(orders);
28213 }
28214 }
28215
28216#ifdef FREECIV_JSON_CONNECTION
28217 /* Exit array. */
28218 FC_FREE(field_addr.sub_location);
28219#endif /* FREECIV_JSON_CONNECTION */
28220 }
28221 }
28222 if (BV_ISSET(fields, 35)) {
28223 log_packet_detailed(" got field 'action_decision_want'");
28224#ifdef FREECIV_JSON_CONNECTION
28225 field_addr.name = "action_decision_want";
28226#endif /* FREECIV_JSON_CONNECTION */
28227 {
28228 int readin;
28229
28230 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
28231 RECEIVE_PACKET_FIELD_ERROR(action_decision_want);
28232 }
28233 real_packet->action_decision_want = readin;
28234 }
28235 }
28236 if (BV_ISSET(fields, 36)) {
28237 log_packet_detailed(" got field 'action_decision_tile'");
28238#ifdef FREECIV_JSON_CONNECTION
28239 field_addr.name = "action_decision_tile";
28240#endif /* FREECIV_JSON_CONNECTION */
28241 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->action_decision_tile)) {
28242 RECEIVE_PACKET_FIELD_ERROR(action_decision_tile);
28243 }
28244 }
28245
28246 if (NULL == old) {
28247 old = fc_malloc(sizeof(*old));
28248 *old = *real_packet;
28249 genhash_insert(*hash, old, old);
28250 } else {
28251 *old = *real_packet;
28252 }
28253
28254 hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
28255 if (NULL != *hash) {
28256 genhash_remove(*hash, real_packet);
28257 }
28258
28259#endif /* FREECIV_DELTA_PROTOCOL */
28260 RECEIVE_PACKET_END(real_packet);
28261}
28262
28263 static int send_packet_unit_info_100(struct connection *pc, const struct packet_unit_info *packet)
28264{
28265 const struct packet_unit_info *real_packet = packet;
28266 int e;
28267#ifdef FREECIV_DELTA_PROTOCOL
28268 packet_unit_info_100_fields fields;
28269 struct packet_unit_info *old;
28270 bool differ;
28271 struct genhash **hash = pc->phs.sent + PACKET_UNIT_INFO;
28272 int different = 0;
28273#endif /* FREECIV_DELTA_PROTOCOL */
28274 SEND_PACKET_START(PACKET_UNIT_INFO);
28275#ifdef FREECIV_JSON_CONNECTION
28276 struct plocation field_addr;
28277 {
28278 struct plocation *field_addr_tmp = plocation_field_new(NULL);
28279 field_addr = *field_addr_tmp;
28280 FC_FREE(field_addr_tmp);
28281 }
28282#endif /* FREECIV_JSON_CONNECTION */
28283
28284 log_packet_detailed("packet_unit_info_100: sending info about (%d)",
28285 real_packet->id);
28286
28287#ifdef FREECIV_DELTA_PROTOCOL
28288 if (NULL == *hash) {
28289 *hash = genhash_new_full(hash_packet_unit_info_100, cmp_packet_unit_info_100,
28290 NULL, NULL, NULL, free);
28291 }
28292 BV_CLR_ALL(fields);
28293
28294 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
28295 old = fc_malloc(sizeof(*old));
28296 *old = *real_packet;
28297 genhash_insert(*hash, old, old);
28298 memset(old, 0, sizeof(*old));
28299 different = 1; /* Force to send. */
28300 }
28301 differ = (old->owner != real_packet->owner);
28302 if (differ) {
28303 different++;
28304 BV_SET(fields, 0);
28305 }
28306
28307 differ = (old->nationality != real_packet->nationality);
28308 if (differ) {
28309 different++;
28310 BV_SET(fields, 1);
28311 }
28312
28313 differ = (old->tile != real_packet->tile);
28314 if (differ) {
28315 different++;
28316 BV_SET(fields, 2);
28317 }
28318
28319 differ = (old->facing != real_packet->facing);
28320 if (differ) {
28321 different++;
28322 BV_SET(fields, 3);
28323 }
28324
28325 differ = (old->homecity != real_packet->homecity);
28326 if (differ) {
28327 different++;
28328 BV_SET(fields, 4);
28329 }
28330
28331 differ = FALSE;
28332 {
28333 int i;
28334
28335 for (i = 0; i < O_LAST; i++) {
28336 differ = (old->upkeep[i] != real_packet->upkeep[i]);
28337 if (differ) {
28338 break;
28339 }
28340 }
28341 }
28342 if (differ) {
28343 different++;
28344 BV_SET(fields, 5);
28345 }
28346
28347 differ = (old->veteran != real_packet->veteran);
28348 if (differ) {
28349 different++;
28350 BV_SET(fields, 6);
28351 }
28352
28353 differ = (old->ssa_controller != real_packet->ssa_controller);
28354 if (differ) {
28355 different++;
28356 BV_SET(fields, 7);
28357 }
28358
28359 differ = (old->paradropped != real_packet->paradropped);
28360 if (differ) {
28361 different++;
28362 }
28363 if (packet->paradropped) {
28364 BV_SET(fields, 8);
28365 }
28366
28367 differ = (old->occupied != real_packet->occupied);
28368 if (differ) {
28369 different++;
28370 }
28371 if (packet->occupied) {
28372 BV_SET(fields, 9);
28373 }
28374
28375 differ = (old->transported != real_packet->transported);
28376 if (differ) {
28377 different++;
28378 }
28379 if (packet->transported) {
28380 BV_SET(fields, 10);
28381 }
28382
28383 differ = (old->done_moving != real_packet->done_moving);
28384 if (differ) {
28385 different++;
28386 }
28387 if (packet->done_moving) {
28388 BV_SET(fields, 11);
28389 }
28390
28391 differ = (old->stay != real_packet->stay);
28392 if (differ) {
28393 different++;
28394 }
28395 if (packet->stay) {
28396 BV_SET(fields, 12);
28397 }
28398
28399 differ = (old->birth_turn != real_packet->birth_turn);
28400 if (differ) {
28401 different++;
28402 BV_SET(fields, 13);
28403 }
28404
28405 differ = (old->current_form_turn != real_packet->current_form_turn);
28406 if (differ) {
28407 different++;
28408 BV_SET(fields, 14);
28409 }
28410
28411 differ = (old->type != real_packet->type);
28412 if (differ) {
28413 different++;
28414 BV_SET(fields, 15);
28415 }
28416
28417 differ = (old->transported_by != real_packet->transported_by);
28418 if (differ) {
28419 different++;
28420 BV_SET(fields, 16);
28421 }
28422
28423 differ = (old->carrying != real_packet->carrying);
28424 if (differ) {
28425 different++;
28426 BV_SET(fields, 17);
28427 }
28428
28429 differ = (old->movesleft != real_packet->movesleft);
28430 if (differ) {
28431 different++;
28432 BV_SET(fields, 18);
28433 }
28434
28435 differ = (old->hp != real_packet->hp);
28436 if (differ) {
28437 different++;
28438 BV_SET(fields, 19);
28439 }
28440
28441 differ = (old->fuel != real_packet->fuel);
28442 if (differ) {
28443 different++;
28444 BV_SET(fields, 20);
28445 }
28446
28447 differ = (old->activity_count != real_packet->activity_count);
28448 if (differ) {
28449 different++;
28450 BV_SET(fields, 21);
28451 }
28452
28453 differ = (old->changed_from_count != real_packet->changed_from_count);
28454 if (differ) {
28455 different++;
28456 BV_SET(fields, 22);
28457 }
28458
28459 differ = (old->goto_tile != real_packet->goto_tile);
28460 if (differ) {
28461 different++;
28462 BV_SET(fields, 23);
28463 }
28464
28465 differ = (old->activity != real_packet->activity);
28466 if (differ) {
28467 different++;
28468 BV_SET(fields, 24);
28469 }
28470
28471 differ = (old->activity_tgt != real_packet->activity_tgt);
28472 if (differ) {
28473 different++;
28474 BV_SET(fields, 25);
28475 }
28476
28477 differ = (old->changed_from != real_packet->changed_from);
28478 if (differ) {
28479 different++;
28480 BV_SET(fields, 26);
28481 }
28482
28483 differ = (old->changed_from_tgt != real_packet->changed_from_tgt);
28484 if (differ) {
28485 different++;
28486 BV_SET(fields, 27);
28487 }
28488
28489 differ = (old->battlegroup != real_packet->battlegroup);
28490 if (differ) {
28491 different++;
28492 BV_SET(fields, 28);
28493 }
28494
28495 differ = (old->has_orders != real_packet->has_orders);
28496 if (differ) {
28497 different++;
28498 }
28499 if (packet->has_orders) {
28500 BV_SET(fields, 29);
28501 }
28502
28503 differ = (old->orders_length != real_packet->orders_length);
28504 if (differ) {
28505 different++;
28506 BV_SET(fields, 30);
28507 }
28508
28509 differ = (old->orders_index != real_packet->orders_index);
28510 if (differ) {
28511 different++;
28512 BV_SET(fields, 31);
28513 }
28514
28515 differ = (old->orders_repeat != real_packet->orders_repeat);
28516 if (differ) {
28517 different++;
28518 }
28519 if (packet->orders_repeat) {
28520 BV_SET(fields, 32);
28521 }
28522
28523 differ = (old->orders_vigilant != real_packet->orders_vigilant);
28524 if (differ) {
28525 different++;
28526 }
28527 if (packet->orders_vigilant) {
28528 BV_SET(fields, 33);
28529 }
28530
28531 differ = (old->orders_length != real_packet->orders_length);
28532 if (!differ) {
28533 int i;
28534
28535 for (i = 0; i < real_packet->orders_length; i++) {
28536 differ = !are_unit_orders_equal(&old->orders[i], &real_packet->orders[i]);
28537 if (differ) {
28538 break;
28539 }
28540 }
28541 }
28542 if (differ) {
28543 different++;
28544 BV_SET(fields, 34);
28545 }
28546
28547 differ = (old->action_decision_want != real_packet->action_decision_want);
28548 if (differ) {
28549 different++;
28550 BV_SET(fields, 35);
28551 }
28552
28553 differ = (old->action_decision_tile != real_packet->action_decision_tile);
28554 if (differ) {
28555 different++;
28556 BV_SET(fields, 36);
28557 }
28558
28559 if (different == 0) {
28560 log_packet_detailed(" no change -> discard");
28561 return 0;
28562 }
28563
28564#ifdef FREECIV_JSON_CONNECTION
28565 field_addr.name = "fields";
28566#endif /* FREECIV_JSON_CONNECTION */
28567 e = 0;
28568 e |= DIO_BV_PUT(&dout, &field_addr, fields);
28569 if (e) {
28570 log_packet_detailed("fields bitvector error detected");
28571 }
28572#ifdef FREECIV_JSON_CONNECTION
28573 field_addr.name = "id";
28574#endif /* FREECIV_JSON_CONNECTION */
28575 e = 0;
28576 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
28577 if (e) {
28578 log_packet_detailed("'id' field error detected");
28579 }
28580
28581 if (BV_ISSET(fields, 0)) {
28582 log_packet_detailed(" field 'owner' has changed");
28583#ifdef FREECIV_JSON_CONNECTION
28584 field_addr.name = "owner";
28585#endif /* FREECIV_JSON_CONNECTION */
28586 e = 0;
28587 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
28588 if (e) {
28589 log_packet_detailed("'owner' field error detected");
28590 }
28591 }
28592 if (BV_ISSET(fields, 1)) {
28593 log_packet_detailed(" field 'nationality' has changed");
28594#ifdef FREECIV_JSON_CONNECTION
28595 field_addr.name = "nationality";
28596#endif /* FREECIV_JSON_CONNECTION */
28597 e = 0;
28598 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nationality);
28599 if (e) {
28600 log_packet_detailed("'nationality' field error detected");
28601 }
28602 }
28603 if (BV_ISSET(fields, 2)) {
28604 log_packet_detailed(" field 'tile' has changed");
28605#ifdef FREECIV_JSON_CONNECTION
28606 field_addr.name = "tile";
28607#endif /* FREECIV_JSON_CONNECTION */
28608 e = 0;
28609 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
28610 if (e) {
28611 log_packet_detailed("'tile' field error detected");
28612 }
28613 }
28614 if (BV_ISSET(fields, 3)) {
28615 log_packet_detailed(" field 'facing' has changed");
28616#ifdef FREECIV_JSON_CONNECTION
28617 field_addr.name = "facing";
28618#endif /* FREECIV_JSON_CONNECTION */
28619 e = 0;
28620 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
28621 if (e) {
28622 log_packet_detailed("'facing' field error detected");
28623 }
28624 }
28625 if (BV_ISSET(fields, 4)) {
28626 log_packet_detailed(" field 'homecity' has changed");
28627#ifdef FREECIV_JSON_CONNECTION
28628 field_addr.name = "homecity";
28629#endif /* FREECIV_JSON_CONNECTION */
28630 e = 0;
28631 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
28632 if (e) {
28633 log_packet_detailed("'homecity' field error detected");
28634 }
28635 }
28636 if (BV_ISSET(fields, 5)) {
28637 log_packet_detailed(" field 'upkeep' has changed");
28638#ifdef FREECIV_JSON_CONNECTION
28639 field_addr.name = "upkeep";
28640#endif /* FREECIV_JSON_CONNECTION */
28641 e = 0;
28642 {
28643 int i;
28644
28645#ifdef FREECIV_JSON_CONNECTION
28646 /* Create the array. */
28647 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
28648
28649 /* Enter the array. */
28650 field_addr.sub_location = plocation_elem_new(0);
28651#endif /* FREECIV_JSON_CONNECTION */
28652
28653 for (i = 0; i < O_LAST; i++) {
28654#ifdef FREECIV_JSON_CONNECTION
28655 /* Next array element. */
28656 field_addr.sub_location->number = i;
28657#endif /* FREECIV_JSON_CONNECTION */
28658 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
28659 }
28660
28661#ifdef FREECIV_JSON_CONNECTION
28662 /* Exit array. */
28663 FC_FREE(field_addr.sub_location);
28664#endif /* FREECIV_JSON_CONNECTION */
28665 }
28666 if (e) {
28667 log_packet_detailed("'upkeep' field error detected");
28668 }
28669 }
28670 if (BV_ISSET(fields, 6)) {
28671 log_packet_detailed(" field 'veteran' has changed");
28672#ifdef FREECIV_JSON_CONNECTION
28673 field_addr.name = "veteran";
28674#endif /* FREECIV_JSON_CONNECTION */
28675 e = 0;
28676 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
28677 if (e) {
28678 log_packet_detailed("'veteran' field error detected");
28679 }
28680 }
28681 if (BV_ISSET(fields, 7)) {
28682 log_packet_detailed(" field 'ssa_controller' has changed");
28683#ifdef FREECIV_JSON_CONNECTION
28684 field_addr.name = "ssa_controller";
28685#endif /* FREECIV_JSON_CONNECTION */
28686 e = 0;
28687 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
28688 if (e) {
28689 log_packet_detailed("'ssa_controller' field error detected");
28690 }
28691 }
28692 /* field 8 is folded into the header */
28693 /* field 9 is folded into the header */
28694 /* field 10 is folded into the header */
28695 /* field 11 is folded into the header */
28696 /* field 12 is folded into the header */
28697 if (BV_ISSET(fields, 13)) {
28698 log_packet_detailed(" field 'birth_turn' has changed");
28699#ifdef FREECIV_JSON_CONNECTION
28700 field_addr.name = "birth_turn";
28701#endif /* FREECIV_JSON_CONNECTION */
28702 e = 0;
28703 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->birth_turn);
28704 if (e) {
28705 log_packet_detailed("'birth_turn' field error detected");
28706 }
28707 }
28708 if (BV_ISSET(fields, 14)) {
28709 log_packet_detailed(" field 'current_form_turn' has changed");
28710#ifdef FREECIV_JSON_CONNECTION
28711 field_addr.name = "current_form_turn";
28712#endif /* FREECIV_JSON_CONNECTION */
28713 e = 0;
28714 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->current_form_turn);
28715 if (e) {
28716 log_packet_detailed("'current_form_turn' field error detected");
28717 }
28718 }
28719 if (BV_ISSET(fields, 15)) {
28720 log_packet_detailed(" field 'type' has changed");
28721#ifdef FREECIV_JSON_CONNECTION
28722 field_addr.name = "type";
28723#endif /* FREECIV_JSON_CONNECTION */
28724 e = 0;
28725 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
28726 if (e) {
28727 log_packet_detailed("'type' field error detected");
28728 }
28729 }
28730 if (BV_ISSET(fields, 16)) {
28731 log_packet_detailed(" field 'transported_by' has changed");
28732#ifdef FREECIV_JSON_CONNECTION
28733 field_addr.name = "transported_by";
28734#endif /* FREECIV_JSON_CONNECTION */
28735 e = 0;
28736 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
28737 if (e) {
28738 log_packet_detailed("'transported_by' field error detected");
28739 }
28740 }
28741 if (BV_ISSET(fields, 17)) {
28742 log_packet_detailed(" field 'carrying' has changed");
28743#ifdef FREECIV_JSON_CONNECTION
28744 field_addr.name = "carrying";
28745#endif /* FREECIV_JSON_CONNECTION */
28746 e = 0;
28747 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
28748 if (e) {
28749 log_packet_detailed("'carrying' field error detected");
28750 }
28751 }
28752 if (BV_ISSET(fields, 18)) {
28753 log_packet_detailed(" field 'movesleft' has changed");
28754#ifdef FREECIV_JSON_CONNECTION
28755 field_addr.name = "movesleft";
28756#endif /* FREECIV_JSON_CONNECTION */
28757 e = 0;
28758 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
28759 if (e) {
28760 log_packet_detailed("'movesleft' field error detected");
28761 }
28762 }
28763 if (BV_ISSET(fields, 19)) {
28764 log_packet_detailed(" field 'hp' has changed");
28765#ifdef FREECIV_JSON_CONNECTION
28766 field_addr.name = "hp";
28767#endif /* FREECIV_JSON_CONNECTION */
28768 e = 0;
28769 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
28770 if (e) {
28771 log_packet_detailed("'hp' field error detected");
28772 }
28773 }
28774 if (BV_ISSET(fields, 20)) {
28775 log_packet_detailed(" field 'fuel' has changed");
28776#ifdef FREECIV_JSON_CONNECTION
28777 field_addr.name = "fuel";
28778#endif /* FREECIV_JSON_CONNECTION */
28779 e = 0;
28780 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
28781 if (e) {
28782 log_packet_detailed("'fuel' field error detected");
28783 }
28784 }
28785 if (BV_ISSET(fields, 21)) {
28786 log_packet_detailed(" field 'activity_count' has changed");
28787#ifdef FREECIV_JSON_CONNECTION
28788 field_addr.name = "activity_count";
28789#endif /* FREECIV_JSON_CONNECTION */
28790 e = 0;
28791 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
28792 if (e) {
28793 log_packet_detailed("'activity_count' field error detected");
28794 }
28795 }
28796 if (BV_ISSET(fields, 22)) {
28797 log_packet_detailed(" field 'changed_from_count' has changed");
28798#ifdef FREECIV_JSON_CONNECTION
28799 field_addr.name = "changed_from_count";
28800#endif /* FREECIV_JSON_CONNECTION */
28801 e = 0;
28802 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
28803 if (e) {
28804 log_packet_detailed("'changed_from_count' field error detected");
28805 }
28806 }
28807 if (BV_ISSET(fields, 23)) {
28808 log_packet_detailed(" field 'goto_tile' has changed");
28809#ifdef FREECIV_JSON_CONNECTION
28810 field_addr.name = "goto_tile";
28811#endif /* FREECIV_JSON_CONNECTION */
28812 e = 0;
28813 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
28814 if (e) {
28815 log_packet_detailed("'goto_tile' field error detected");
28816 }
28817 }
28818 if (BV_ISSET(fields, 24)) {
28819 log_packet_detailed(" field 'activity' has changed");
28820#ifdef FREECIV_JSON_CONNECTION
28821 field_addr.name = "activity";
28822#endif /* FREECIV_JSON_CONNECTION */
28823 e = 0;
28824 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
28825 if (e) {
28826 log_packet_detailed("'activity' field error detected");
28827 }
28828 }
28829 if (BV_ISSET(fields, 25)) {
28830 log_packet_detailed(" field 'activity_tgt' has changed");
28831#ifdef FREECIV_JSON_CONNECTION
28832 field_addr.name = "activity_tgt";
28833#endif /* FREECIV_JSON_CONNECTION */
28834 e = 0;
28835 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
28836 if (e) {
28837 log_packet_detailed("'activity_tgt' field error detected");
28838 }
28839 }
28840 if (BV_ISSET(fields, 26)) {
28841 log_packet_detailed(" field 'changed_from' has changed");
28842#ifdef FREECIV_JSON_CONNECTION
28843 field_addr.name = "changed_from";
28844#endif /* FREECIV_JSON_CONNECTION */
28845 e = 0;
28846 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
28847 if (e) {
28848 log_packet_detailed("'changed_from' field error detected");
28849 }
28850 }
28851 if (BV_ISSET(fields, 27)) {
28852 log_packet_detailed(" field 'changed_from_tgt' has changed");
28853#ifdef FREECIV_JSON_CONNECTION
28854 field_addr.name = "changed_from_tgt";
28855#endif /* FREECIV_JSON_CONNECTION */
28856 e = 0;
28857 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
28858 if (e) {
28859 log_packet_detailed("'changed_from_tgt' field error detected");
28860 }
28861 }
28862 if (BV_ISSET(fields, 28)) {
28863 log_packet_detailed(" field 'battlegroup' has changed");
28864#ifdef FREECIV_JSON_CONNECTION
28865 field_addr.name = "battlegroup";
28866#endif /* FREECIV_JSON_CONNECTION */
28867 e = 0;
28868 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
28869 if (e) {
28870 log_packet_detailed("'battlegroup' field error detected");
28871 }
28872 }
28873 /* field 29 is folded into the header */
28874 if (BV_ISSET(fields, 30)) {
28875 log_packet_detailed(" field 'orders_length' has changed");
28876#ifdef FREECIV_JSON_CONNECTION
28877 field_addr.name = "orders_length";
28878#endif /* FREECIV_JSON_CONNECTION */
28879 e = 0;
28880 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
28881 if (e) {
28882 log_packet_detailed("'orders_length' field error detected");
28883 }
28884 }
28885 if (BV_ISSET(fields, 31)) {
28886 log_packet_detailed(" field 'orders_index' has changed");
28887#ifdef FREECIV_JSON_CONNECTION
28888 field_addr.name = "orders_index";
28889#endif /* FREECIV_JSON_CONNECTION */
28890 e = 0;
28891 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
28892 if (e) {
28893 log_packet_detailed("'orders_index' field error detected");
28894 }
28895 }
28896 /* field 32 is folded into the header */
28897 /* field 33 is folded into the header */
28898 if (BV_ISSET(fields, 34)) {
28899 log_packet_detailed(" field 'orders' has changed");
28900#ifdef FREECIV_JSON_CONNECTION
28901 field_addr.name = "orders";
28902#endif /* FREECIV_JSON_CONNECTION */
28903 e = 0;
28904 {
28905 int i;
28906
28907#ifdef FREECIV_JSON_CONNECTION
28908 /* Create the array. */
28909 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
28910
28911 /* Enter the array. */
28912 field_addr.sub_location = plocation_elem_new(0);
28913#endif /* FREECIV_JSON_CONNECTION */
28914
28915 for (i = 0; i < real_packet->orders_length; i++) {
28916#ifdef FREECIV_JSON_CONNECTION
28917 /* Next array element. */
28918 field_addr.sub_location->number = i;
28919#endif /* FREECIV_JSON_CONNECTION */
28920 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
28921 }
28922
28923#ifdef FREECIV_JSON_CONNECTION
28924 /* Exit array. */
28925 FC_FREE(field_addr.sub_location);
28926#endif /* FREECIV_JSON_CONNECTION */
28927 }
28928 if (e) {
28929 log_packet_detailed("'orders' field error detected");
28930 }
28931 }
28932 if (BV_ISSET(fields, 35)) {
28933 log_packet_detailed(" field 'action_decision_want' has changed");
28934#ifdef FREECIV_JSON_CONNECTION
28935 field_addr.name = "action_decision_want";
28936#endif /* FREECIV_JSON_CONNECTION */
28937 e = 0;
28938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
28939 if (e) {
28940 log_packet_detailed("'action_decision_want' field error detected");
28941 }
28942 }
28943 if (BV_ISSET(fields, 36)) {
28944 log_packet_detailed(" field 'action_decision_tile' has changed");
28945#ifdef FREECIV_JSON_CONNECTION
28946 field_addr.name = "action_decision_tile";
28947#endif /* FREECIV_JSON_CONNECTION */
28948 e = 0;
28949 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
28950 if (e) {
28951 log_packet_detailed("'action_decision_tile' field error detected");
28952 }
28953 }
28954
28955 *old = *real_packet;
28956
28957 hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
28958 if (NULL != *hash) {
28959 genhash_remove(*hash, real_packet);
28960 }
28961#endif /* FREECIV_DELTA_PROTOCOL */
28962#ifndef FREECIV_DELTA_PROTOCOL
28963#ifdef FREECIV_JSON_CONNECTION
28964 field_addr.name = "id";
28965#endif /* FREECIV_JSON_CONNECTION */
28966 e = 0;
28967 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
28968 if (e) {
28969 log_packet_detailed("'id' field error detected");
28970 }
28971#ifdef FREECIV_JSON_CONNECTION
28972 field_addr.name = "owner";
28973#endif /* FREECIV_JSON_CONNECTION */
28974 e = 0;
28975 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
28976 if (e) {
28977 log_packet_detailed("'owner' field error detected");
28978 }
28979#ifdef FREECIV_JSON_CONNECTION
28980 field_addr.name = "nationality";
28981#endif /* FREECIV_JSON_CONNECTION */
28982 e = 0;
28983 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nationality);
28984 if (e) {
28985 log_packet_detailed("'nationality' field error detected");
28986 }
28987#ifdef FREECIV_JSON_CONNECTION
28988 field_addr.name = "tile";
28989#endif /* FREECIV_JSON_CONNECTION */
28990 e = 0;
28991 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
28992 if (e) {
28993 log_packet_detailed("'tile' field error detected");
28994 }
28995#ifdef FREECIV_JSON_CONNECTION
28996 field_addr.name = "facing";
28997#endif /* FREECIV_JSON_CONNECTION */
28998 e = 0;
28999 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
29000 if (e) {
29001 log_packet_detailed("'facing' field error detected");
29002 }
29003#ifdef FREECIV_JSON_CONNECTION
29004 field_addr.name = "homecity";
29005#endif /* FREECIV_JSON_CONNECTION */
29006 e = 0;
29007 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
29008 if (e) {
29009 log_packet_detailed("'homecity' field error detected");
29010 }
29011#ifdef FREECIV_JSON_CONNECTION
29012 field_addr.name = "upkeep";
29013#endif /* FREECIV_JSON_CONNECTION */
29014 e = 0;
29015 {
29016 int i;
29017
29018#ifdef FREECIV_JSON_CONNECTION
29019 /* Create the array. */
29020 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
29021
29022 /* Enter the array. */
29023 field_addr.sub_location = plocation_elem_new(0);
29024#endif /* FREECIV_JSON_CONNECTION */
29025
29026 for (i = 0; i < O_LAST; i++) {
29027#ifdef FREECIV_JSON_CONNECTION
29028 /* Next array element. */
29029 field_addr.sub_location->number = i;
29030#endif /* FREECIV_JSON_CONNECTION */
29031 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
29032 }
29033
29034#ifdef FREECIV_JSON_CONNECTION
29035 /* Exit array. */
29036 FC_FREE(field_addr.sub_location);
29037#endif /* FREECIV_JSON_CONNECTION */
29038 }
29039 if (e) {
29040 log_packet_detailed("'upkeep' field error detected");
29041 }
29042#ifdef FREECIV_JSON_CONNECTION
29043 field_addr.name = "veteran";
29044#endif /* FREECIV_JSON_CONNECTION */
29045 e = 0;
29046 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
29047 if (e) {
29048 log_packet_detailed("'veteran' field error detected");
29049 }
29050#ifdef FREECIV_JSON_CONNECTION
29051 field_addr.name = "ssa_controller";
29052#endif /* FREECIV_JSON_CONNECTION */
29053 e = 0;
29054 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ssa_controller);
29055 if (e) {
29056 log_packet_detailed("'ssa_controller' field error detected");
29057 }
29058#ifdef FREECIV_JSON_CONNECTION
29059 field_addr.name = "paradropped";
29060#endif /* FREECIV_JSON_CONNECTION */
29061 e = 0;
29062 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
29063 if (e) {
29064 log_packet_detailed("'paradropped' field error detected");
29065 }
29066#ifdef FREECIV_JSON_CONNECTION
29067 field_addr.name = "occupied";
29068#endif /* FREECIV_JSON_CONNECTION */
29069 e = 0;
29070 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
29071 if (e) {
29072 log_packet_detailed("'occupied' field error detected");
29073 }
29074#ifdef FREECIV_JSON_CONNECTION
29075 field_addr.name = "transported";
29076#endif /* FREECIV_JSON_CONNECTION */
29077 e = 0;
29078 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
29079 if (e) {
29080 log_packet_detailed("'transported' field error detected");
29081 }
29082#ifdef FREECIV_JSON_CONNECTION
29083 field_addr.name = "done_moving";
29084#endif /* FREECIV_JSON_CONNECTION */
29085 e = 0;
29086 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
29087 if (e) {
29088 log_packet_detailed("'done_moving' field error detected");
29089 }
29090#ifdef FREECIV_JSON_CONNECTION
29091 field_addr.name = "stay";
29092#endif /* FREECIV_JSON_CONNECTION */
29093 e = 0;
29094 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
29095 if (e) {
29096 log_packet_detailed("'stay' field error detected");
29097 }
29098#ifdef FREECIV_JSON_CONNECTION
29099 field_addr.name = "birth_turn";
29100#endif /* FREECIV_JSON_CONNECTION */
29101 e = 0;
29102 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->birth_turn);
29103 if (e) {
29104 log_packet_detailed("'birth_turn' field error detected");
29105 }
29106#ifdef FREECIV_JSON_CONNECTION
29107 field_addr.name = "current_form_turn";
29108#endif /* FREECIV_JSON_CONNECTION */
29109 e = 0;
29110 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->current_form_turn);
29111 if (e) {
29112 log_packet_detailed("'current_form_turn' field error detected");
29113 }
29114#ifdef FREECIV_JSON_CONNECTION
29115 field_addr.name = "type";
29116#endif /* FREECIV_JSON_CONNECTION */
29117 e = 0;
29118 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
29119 if (e) {
29120 log_packet_detailed("'type' field error detected");
29121 }
29122#ifdef FREECIV_JSON_CONNECTION
29123 field_addr.name = "transported_by";
29124#endif /* FREECIV_JSON_CONNECTION */
29125 e = 0;
29126 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
29127 if (e) {
29128 log_packet_detailed("'transported_by' field error detected");
29129 }
29130#ifdef FREECIV_JSON_CONNECTION
29131 field_addr.name = "carrying";
29132#endif /* FREECIV_JSON_CONNECTION */
29133 e = 0;
29134 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->carrying);
29135 if (e) {
29136 log_packet_detailed("'carrying' field error detected");
29137 }
29138#ifdef FREECIV_JSON_CONNECTION
29139 field_addr.name = "movesleft";
29140#endif /* FREECIV_JSON_CONNECTION */
29141 e = 0;
29142 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->movesleft);
29143 if (e) {
29144 log_packet_detailed("'movesleft' field error detected");
29145 }
29146#ifdef FREECIV_JSON_CONNECTION
29147 field_addr.name = "hp";
29148#endif /* FREECIV_JSON_CONNECTION */
29149 e = 0;
29150 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
29151 if (e) {
29152 log_packet_detailed("'hp' field error detected");
29153 }
29154#ifdef FREECIV_JSON_CONNECTION
29155 field_addr.name = "fuel";
29156#endif /* FREECIV_JSON_CONNECTION */
29157 e = 0;
29158 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
29159 if (e) {
29160 log_packet_detailed("'fuel' field error detected");
29161 }
29162#ifdef FREECIV_JSON_CONNECTION
29163 field_addr.name = "activity_count";
29164#endif /* FREECIV_JSON_CONNECTION */
29165 e = 0;
29166 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
29167 if (e) {
29168 log_packet_detailed("'activity_count' field error detected");
29169 }
29170#ifdef FREECIV_JSON_CONNECTION
29171 field_addr.name = "changed_from_count";
29172#endif /* FREECIV_JSON_CONNECTION */
29173 e = 0;
29174 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->changed_from_count);
29175 if (e) {
29176 log_packet_detailed("'changed_from_count' field error detected");
29177 }
29178#ifdef FREECIV_JSON_CONNECTION
29179 field_addr.name = "goto_tile";
29180#endif /* FREECIV_JSON_CONNECTION */
29181 e = 0;
29182 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->goto_tile);
29183 if (e) {
29184 log_packet_detailed("'goto_tile' field error detected");
29185 }
29186#ifdef FREECIV_JSON_CONNECTION
29187 field_addr.name = "activity";
29188#endif /* FREECIV_JSON_CONNECTION */
29189 e = 0;
29190 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
29191 if (e) {
29192 log_packet_detailed("'activity' field error detected");
29193 }
29194#ifdef FREECIV_JSON_CONNECTION
29195 field_addr.name = "activity_tgt";
29196#endif /* FREECIV_JSON_CONNECTION */
29197 e = 0;
29198 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
29199 if (e) {
29200 log_packet_detailed("'activity_tgt' field error detected");
29201 }
29202#ifdef FREECIV_JSON_CONNECTION
29203 field_addr.name = "changed_from";
29204#endif /* FREECIV_JSON_CONNECTION */
29205 e = 0;
29206 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->changed_from);
29207 if (e) {
29208 log_packet_detailed("'changed_from' field error detected");
29209 }
29210#ifdef FREECIV_JSON_CONNECTION
29211 field_addr.name = "changed_from_tgt";
29212#endif /* FREECIV_JSON_CONNECTION */
29213 e = 0;
29214 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->changed_from_tgt);
29215 if (e) {
29216 log_packet_detailed("'changed_from_tgt' field error detected");
29217 }
29218#ifdef FREECIV_JSON_CONNECTION
29219 field_addr.name = "battlegroup";
29220#endif /* FREECIV_JSON_CONNECTION */
29221 e = 0;
29222 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->battlegroup);
29223 if (e) {
29224 log_packet_detailed("'battlegroup' field error detected");
29225 }
29226#ifdef FREECIV_JSON_CONNECTION
29227 field_addr.name = "has_orders";
29228#endif /* FREECIV_JSON_CONNECTION */
29229 e = 0;
29230 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->has_orders);
29231 if (e) {
29232 log_packet_detailed("'has_orders' field error detected");
29233 }
29234#ifdef FREECIV_JSON_CONNECTION
29235 field_addr.name = "orders_length";
29236#endif /* FREECIV_JSON_CONNECTION */
29237 e = 0;
29238 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_length);
29239 if (e) {
29240 log_packet_detailed("'orders_length' field error detected");
29241 }
29242#ifdef FREECIV_JSON_CONNECTION
29243 field_addr.name = "orders_index";
29244#endif /* FREECIV_JSON_CONNECTION */
29245 e = 0;
29246 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->orders_index);
29247 if (e) {
29248 log_packet_detailed("'orders_index' field error detected");
29249 }
29250#ifdef FREECIV_JSON_CONNECTION
29251 field_addr.name = "orders_repeat";
29252#endif /* FREECIV_JSON_CONNECTION */
29253 e = 0;
29254 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_repeat);
29255 if (e) {
29256 log_packet_detailed("'orders_repeat' field error detected");
29257 }
29258#ifdef FREECIV_JSON_CONNECTION
29259 field_addr.name = "orders_vigilant";
29260#endif /* FREECIV_JSON_CONNECTION */
29261 e = 0;
29262 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->orders_vigilant);
29263 if (e) {
29264 log_packet_detailed("'orders_vigilant' field error detected");
29265 }
29266#ifdef FREECIV_JSON_CONNECTION
29267 field_addr.name = "orders";
29268#endif /* FREECIV_JSON_CONNECTION */
29269 e = 0;
29270 {
29271 int i;
29272
29273#ifdef FREECIV_JSON_CONNECTION
29274 /* Create the array. */
29275 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->orders_length);
29276
29277 /* Enter the array. */
29278 field_addr.sub_location = plocation_elem_new(0);
29279#endif /* FREECIV_JSON_CONNECTION */
29280
29281 for (i = 0; i < real_packet->orders_length; i++) {
29282#ifdef FREECIV_JSON_CONNECTION
29283 /* Next array element. */
29284 field_addr.sub_location->number = i;
29285#endif /* FREECIV_JSON_CONNECTION */
29286 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
29287 }
29288
29289#ifdef FREECIV_JSON_CONNECTION
29290 /* Exit array. */
29291 FC_FREE(field_addr.sub_location);
29292#endif /* FREECIV_JSON_CONNECTION */
29293 }
29294 if (e) {
29295 log_packet_detailed("'orders' field error detected");
29296 }
29297#ifdef FREECIV_JSON_CONNECTION
29298 field_addr.name = "action_decision_want";
29299#endif /* FREECIV_JSON_CONNECTION */
29300 e = 0;
29301 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_decision_want);
29302 if (e) {
29303 log_packet_detailed("'action_decision_want' field error detected");
29304 }
29305#ifdef FREECIV_JSON_CONNECTION
29306 field_addr.name = "action_decision_tile";
29307#endif /* FREECIV_JSON_CONNECTION */
29308 e = 0;
29309 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->action_decision_tile);
29310 if (e) {
29311 log_packet_detailed("'action_decision_tile' field error detected");
29312 }
29313
29314#endif
29315 SEND_PACKET_END(PACKET_UNIT_INFO);
29316}
29317
29318 int send_packet_unit_info(struct connection *pc, const struct packet_unit_info *packet)
29319{
29320 if (!pc->used) {
29321 log_error("WARNING: trying to send data to the closed connection %s",
29322 conn_description(pc));
29323 return -1;
29324 }
29325 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_INFO].packet != NULL, -1,
29326 "Handler for PACKET_UNIT_INFO not installed");
29327 return pc->phs.handlers->send[PACKET_UNIT_INFO].packet(pc, packet);
29328}
29329
29330 void lsend_packet_unit_info(struct conn_list *dest, const struct packet_unit_info *packet)
29331{
29332 conn_list_iterate(dest, pconn) {
29333 send_packet_unit_info(pconn, packet);
29334 } conn_list_iterate_end;
29335}
29336
29337#ifdef FREECIV_DELTA_PROTOCOL
29338static genhash_val_t hash_packet_unit_short_info_100(const void *vkey)
29339{
29340 const struct packet_unit_short_info *key = (const struct packet_unit_short_info *) vkey;
29341 genhash_val_t result = 0;
29342
29343 result += key->id;
29344
29345 result &= 0xFFFFFFFF;
29346 return result;
29347}
29348
29349static bool cmp_packet_unit_short_info_100(const void *vkey1, const void *vkey2)
29350{
29351 const struct packet_unit_short_info *old = (const struct packet_unit_short_info *) vkey1;
29352 const struct packet_unit_short_info *real_packet = (const struct packet_unit_short_info *) vkey2;
29353 bool differ;
29354
29355 differ = (old->id != real_packet->id);
29356
29357 return !differ;
29358}
29359 BV_DEFINE(packet_unit_short_info_100_fields, 13);
29360#endif /* FREECIV_DELTA_PROTOCOL */
29361
29362 static struct packet_unit_short_info *receive_packet_unit_short_info_100(struct connection *pc)
29363{
29364#ifdef FREECIV_DELTA_PROTOCOL
29365 packet_unit_short_info_100_fields fields;
29366 struct packet_unit_short_info *old;
29367 struct genhash **hash = pc->phs.received + PACKET_UNIT_SHORT_INFO;
29368#endif /* FREECIV_DELTA_PROTOCOL */
29369 RECEIVE_PACKET_START(packet_unit_short_info, real_packet);
29370#ifdef FREECIV_JSON_CONNECTION
29371 struct plocation field_addr;
29372 {
29373 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29374 field_addr = *field_addr_tmp;
29375 FC_FREE(field_addr_tmp);
29376 }
29377#endif /* FREECIV_JSON_CONNECTION */
29378
29379#ifdef FREECIV_DELTA_PROTOCOL
29380#ifdef FREECIV_JSON_CONNECTION
29381 field_addr.name = "fields";
29382#endif /* FREECIV_JSON_CONNECTION */
29383 DIO_BV_GET(&din, &field_addr, fields);
29384#ifdef FREECIV_JSON_CONNECTION
29385 field_addr.name = "id";
29386#endif /* FREECIV_JSON_CONNECTION */
29387 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
29388 RECEIVE_PACKET_FIELD_ERROR(id);
29389 }
29390
29391#else /* FREECIV_DELTA_PROTOCOL */
29392#ifdef FREECIV_JSON_CONNECTION
29393 field_addr.name = "id";
29394#endif /* FREECIV_JSON_CONNECTION */
29395 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
29396 RECEIVE_PACKET_FIELD_ERROR(id);
29397 }
29398#ifdef FREECIV_JSON_CONNECTION
29399 field_addr.name = "owner";
29400#endif /* FREECIV_JSON_CONNECTION */
29401 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
29402 RECEIVE_PACKET_FIELD_ERROR(owner);
29403 }
29404#ifdef FREECIV_JSON_CONNECTION
29405 field_addr.name = "tile";
29406#endif /* FREECIV_JSON_CONNECTION */
29407 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
29408 RECEIVE_PACKET_FIELD_ERROR(tile);
29409 }
29410#ifdef FREECIV_JSON_CONNECTION
29411 field_addr.name = "facing";
29412#endif /* FREECIV_JSON_CONNECTION */
29413 {
29414 int readin;
29415
29416 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
29417 RECEIVE_PACKET_FIELD_ERROR(facing);
29418 }
29419 real_packet->facing = readin;
29420 }
29421#ifdef FREECIV_JSON_CONNECTION
29422 field_addr.name = "type";
29423#endif /* FREECIV_JSON_CONNECTION */
29424 {
29425 int readin;
29426
29427 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
29428 RECEIVE_PACKET_FIELD_ERROR(type);
29429 }
29430 real_packet->type = readin;
29431 }
29432#ifdef FREECIV_JSON_CONNECTION
29433 field_addr.name = "veteran";
29434#endif /* FREECIV_JSON_CONNECTION */
29435 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
29436 RECEIVE_PACKET_FIELD_ERROR(veteran);
29437 }
29438#ifdef FREECIV_JSON_CONNECTION
29439 field_addr.name = "occupied";
29440#endif /* FREECIV_JSON_CONNECTION */
29441 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->occupied)) {
29442 RECEIVE_PACKET_FIELD_ERROR(occupied);
29443 }
29444#ifdef FREECIV_JSON_CONNECTION
29445 field_addr.name = "transported";
29446#endif /* FREECIV_JSON_CONNECTION */
29447 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->transported)) {
29448 RECEIVE_PACKET_FIELD_ERROR(transported);
29449 }
29450#ifdef FREECIV_JSON_CONNECTION
29451 field_addr.name = "hp";
29452#endif /* FREECIV_JSON_CONNECTION */
29453 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
29454 RECEIVE_PACKET_FIELD_ERROR(hp);
29455 }
29456#ifdef FREECIV_JSON_CONNECTION
29457 field_addr.name = "activity";
29458#endif /* FREECIV_JSON_CONNECTION */
29459 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
29460 RECEIVE_PACKET_FIELD_ERROR(activity);
29461 }
29462#ifdef FREECIV_JSON_CONNECTION
29463 field_addr.name = "activity_tgt";
29464#endif /* FREECIV_JSON_CONNECTION */
29465 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
29466 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
29467 }
29468#ifdef FREECIV_JSON_CONNECTION
29469 field_addr.name = "transported_by";
29470#endif /* FREECIV_JSON_CONNECTION */
29471 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
29472 RECEIVE_PACKET_FIELD_ERROR(transported_by);
29473 }
29474#ifdef FREECIV_JSON_CONNECTION
29475 field_addr.name = "packet_use";
29476#endif /* FREECIV_JSON_CONNECTION */
29477 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
29478 RECEIVE_PACKET_FIELD_ERROR(packet_use);
29479 }
29480#ifdef FREECIV_JSON_CONNECTION
29481 field_addr.name = "info_city_id";
29482#endif /* FREECIV_JSON_CONNECTION */
29483 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->info_city_id)) {
29484 RECEIVE_PACKET_FIELD_ERROR(info_city_id);
29485 }
29486#endif
29487 log_packet_detailed("packet_unit_short_info_100: got info about (%d)",
29488 real_packet->id);
29489
29490#ifdef FREECIV_DELTA_PROTOCOL
29491 if (NULL == *hash) {
29492 *hash = genhash_new_full(hash_packet_unit_short_info_100, cmp_packet_unit_short_info_100,
29493 NULL, NULL, NULL, free);
29494 }
29495
29496 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
29497 *real_packet = *old;
29498 } else {
29499 int id;
29500
29501 id = real_packet->id;
29502
29503 log_packet_detailed(" no old info");
29504 memset(real_packet, 0, sizeof(*real_packet));
29505
29506 real_packet->id = id;
29507 }
29508
29509 if (BV_ISSET(fields, 0)) {
29510 log_packet_detailed(" got field 'owner'");
29511#ifdef FREECIV_JSON_CONNECTION
29512 field_addr.name = "owner";
29513#endif /* FREECIV_JSON_CONNECTION */
29514 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
29515 RECEIVE_PACKET_FIELD_ERROR(owner);
29516 }
29517 }
29518 if (BV_ISSET(fields, 1)) {
29519 log_packet_detailed(" got field 'tile'");
29520#ifdef FREECIV_JSON_CONNECTION
29521 field_addr.name = "tile";
29522#endif /* FREECIV_JSON_CONNECTION */
29523 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
29524 RECEIVE_PACKET_FIELD_ERROR(tile);
29525 }
29526 }
29527 if (BV_ISSET(fields, 2)) {
29528 log_packet_detailed(" got field 'facing'");
29529#ifdef FREECIV_JSON_CONNECTION
29530 field_addr.name = "facing";
29531#endif /* FREECIV_JSON_CONNECTION */
29532 {
29533 int readin;
29534
29535 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
29536 RECEIVE_PACKET_FIELD_ERROR(facing);
29537 }
29538 real_packet->facing = readin;
29539 }
29540 }
29541 if (BV_ISSET(fields, 3)) {
29542 log_packet_detailed(" got field 'type'");
29543#ifdef FREECIV_JSON_CONNECTION
29544 field_addr.name = "type";
29545#endif /* FREECIV_JSON_CONNECTION */
29546 {
29547 int readin;
29548
29549 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
29550 RECEIVE_PACKET_FIELD_ERROR(type);
29551 }
29552 real_packet->type = readin;
29553 }
29554 }
29555 if (BV_ISSET(fields, 4)) {
29556 log_packet_detailed(" got field 'veteran'");
29557#ifdef FREECIV_JSON_CONNECTION
29558 field_addr.name = "veteran";
29559#endif /* FREECIV_JSON_CONNECTION */
29560 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
29561 RECEIVE_PACKET_FIELD_ERROR(veteran);
29562 }
29563 }
29564 real_packet->occupied = BV_ISSET(fields, 5);
29565 real_packet->transported = BV_ISSET(fields, 6);
29566 if (BV_ISSET(fields, 7)) {
29567 log_packet_detailed(" got field 'hp'");
29568#ifdef FREECIV_JSON_CONNECTION
29569 field_addr.name = "hp";
29570#endif /* FREECIV_JSON_CONNECTION */
29571 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
29572 RECEIVE_PACKET_FIELD_ERROR(hp);
29573 }
29574 }
29575 if (BV_ISSET(fields, 8)) {
29576 log_packet_detailed(" got field 'activity'");
29577#ifdef FREECIV_JSON_CONNECTION
29578 field_addr.name = "activity";
29579#endif /* FREECIV_JSON_CONNECTION */
29580 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->activity)) {
29581 RECEIVE_PACKET_FIELD_ERROR(activity);
29582 }
29583 }
29584 if (BV_ISSET(fields, 9)) {
29585 log_packet_detailed(" got field 'activity_tgt'");
29586#ifdef FREECIV_JSON_CONNECTION
29587 field_addr.name = "activity_tgt";
29588#endif /* FREECIV_JSON_CONNECTION */
29589 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->activity_tgt)) {
29590 RECEIVE_PACKET_FIELD_ERROR(activity_tgt);
29591 }
29592 }
29593 if (BV_ISSET(fields, 10)) {
29594 log_packet_detailed(" got field 'transported_by'");
29595#ifdef FREECIV_JSON_CONNECTION
29596 field_addr.name = "transported_by";
29597#endif /* FREECIV_JSON_CONNECTION */
29598 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
29599 RECEIVE_PACKET_FIELD_ERROR(transported_by);
29600 }
29601 }
29602 if (BV_ISSET(fields, 11)) {
29603 log_packet_detailed(" got field 'packet_use'");
29604#ifdef FREECIV_JSON_CONNECTION
29605 field_addr.name = "packet_use";
29606#endif /* FREECIV_JSON_CONNECTION */
29607 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->packet_use)) {
29608 RECEIVE_PACKET_FIELD_ERROR(packet_use);
29609 }
29610 }
29611 if (BV_ISSET(fields, 12)) {
29612 log_packet_detailed(" got field 'info_city_id'");
29613#ifdef FREECIV_JSON_CONNECTION
29614 field_addr.name = "info_city_id";
29615#endif /* FREECIV_JSON_CONNECTION */
29616 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->info_city_id)) {
29617 RECEIVE_PACKET_FIELD_ERROR(info_city_id);
29618 }
29619 }
29620
29621 if (NULL == old) {
29622 old = fc_malloc(sizeof(*old));
29623 *old = *real_packet;
29624 genhash_insert(*hash, old, old);
29625 } else {
29626 *old = *real_packet;
29627 }
29628
29629 hash = pc->phs.received + PACKET_UNIT_INFO;
29630 if (NULL != *hash) {
29631 genhash_remove(*hash, real_packet);
29632 }
29633
29634#endif /* FREECIV_DELTA_PROTOCOL */
29635 RECEIVE_PACKET_END(real_packet);
29636}
29637
29638 static int send_packet_unit_short_info_100(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
29639{
29640 const struct packet_unit_short_info *real_packet = packet;
29641 int e;
29642#ifdef FREECIV_DELTA_PROTOCOL
29643 packet_unit_short_info_100_fields fields;
29644 struct packet_unit_short_info *old;
29645 bool differ;
29646 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SHORT_INFO;
29647 int different = force_to_send;
29648#endif /* FREECIV_DELTA_PROTOCOL */
29649 SEND_PACKET_START(PACKET_UNIT_SHORT_INFO);
29650#ifdef FREECIV_JSON_CONNECTION
29651 struct plocation field_addr;
29652 {
29653 struct plocation *field_addr_tmp = plocation_field_new(NULL);
29654 field_addr = *field_addr_tmp;
29655 FC_FREE(field_addr_tmp);
29656 }
29657#endif /* FREECIV_JSON_CONNECTION */
29658
29659 log_packet_detailed("packet_unit_short_info_100: sending info about (%d)",
29660 real_packet->id);
29661
29662#ifdef FREECIV_DELTA_PROTOCOL
29663 if (NULL == *hash) {
29664 *hash = genhash_new_full(hash_packet_unit_short_info_100, cmp_packet_unit_short_info_100,
29665 NULL, NULL, NULL, free);
29666 }
29667 BV_CLR_ALL(fields);
29668
29669 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
29670 old = fc_malloc(sizeof(*old));
29671 *old = *real_packet;
29672 genhash_insert(*hash, old, old);
29673 memset(old, 0, sizeof(*old));
29674 different = 1; /* Force to send. */
29675 }
29676 differ = (old->owner != real_packet->owner);
29677 if (differ) {
29678 different++;
29679 BV_SET(fields, 0);
29680 }
29681
29682 differ = (old->tile != real_packet->tile);
29683 if (differ) {
29684 different++;
29685 BV_SET(fields, 1);
29686 }
29687
29688 differ = (old->facing != real_packet->facing);
29689 if (differ) {
29690 different++;
29691 BV_SET(fields, 2);
29692 }
29693
29694 differ = (old->type != real_packet->type);
29695 if (differ) {
29696 different++;
29697 BV_SET(fields, 3);
29698 }
29699
29700 differ = (old->veteran != real_packet->veteran);
29701 if (differ) {
29702 different++;
29703 BV_SET(fields, 4);
29704 }
29705
29706 differ = (old->occupied != real_packet->occupied);
29707 if (differ) {
29708 different++;
29709 }
29710 if (packet->occupied) {
29711 BV_SET(fields, 5);
29712 }
29713
29714 differ = (old->transported != real_packet->transported);
29715 if (differ) {
29716 different++;
29717 }
29718 if (packet->transported) {
29719 BV_SET(fields, 6);
29720 }
29721
29722 differ = (old->hp != real_packet->hp);
29723 if (differ) {
29724 different++;
29725 BV_SET(fields, 7);
29726 }
29727
29728 differ = (old->activity != real_packet->activity);
29729 if (differ) {
29730 different++;
29731 BV_SET(fields, 8);
29732 }
29733
29734 differ = (old->activity_tgt != real_packet->activity_tgt);
29735 if (differ) {
29736 different++;
29737 BV_SET(fields, 9);
29738 }
29739
29740 differ = (old->transported_by != real_packet->transported_by);
29741 if (differ) {
29742 different++;
29743 BV_SET(fields, 10);
29744 }
29745
29746 differ = (old->packet_use != real_packet->packet_use);
29747 if (differ) {
29748 different++;
29749 BV_SET(fields, 11);
29750 }
29751
29752 differ = (old->info_city_id != real_packet->info_city_id);
29753 if (differ) {
29754 different++;
29755 BV_SET(fields, 12);
29756 }
29757
29758 if (different == 0) {
29759 log_packet_detailed(" no change -> discard");
29760 return 0;
29761 }
29762
29763#ifdef FREECIV_JSON_CONNECTION
29764 field_addr.name = "fields";
29765#endif /* FREECIV_JSON_CONNECTION */
29766 e = 0;
29767 e |= DIO_BV_PUT(&dout, &field_addr, fields);
29768 if (e) {
29769 log_packet_detailed("fields bitvector error detected");
29770 }
29771#ifdef FREECIV_JSON_CONNECTION
29772 field_addr.name = "id";
29773#endif /* FREECIV_JSON_CONNECTION */
29774 e = 0;
29775 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
29776 if (e) {
29777 log_packet_detailed("'id' field error detected");
29778 }
29779
29780 if (BV_ISSET(fields, 0)) {
29781 log_packet_detailed(" field 'owner' has changed");
29782#ifdef FREECIV_JSON_CONNECTION
29783 field_addr.name = "owner";
29784#endif /* FREECIV_JSON_CONNECTION */
29785 e = 0;
29786 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
29787 if (e) {
29788 log_packet_detailed("'owner' field error detected");
29789 }
29790 }
29791 if (BV_ISSET(fields, 1)) {
29792 log_packet_detailed(" field 'tile' has changed");
29793#ifdef FREECIV_JSON_CONNECTION
29794 field_addr.name = "tile";
29795#endif /* FREECIV_JSON_CONNECTION */
29796 e = 0;
29797 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
29798 if (e) {
29799 log_packet_detailed("'tile' field error detected");
29800 }
29801 }
29802 if (BV_ISSET(fields, 2)) {
29803 log_packet_detailed(" field 'facing' has changed");
29804#ifdef FREECIV_JSON_CONNECTION
29805 field_addr.name = "facing";
29806#endif /* FREECIV_JSON_CONNECTION */
29807 e = 0;
29808 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
29809 if (e) {
29810 log_packet_detailed("'facing' field error detected");
29811 }
29812 }
29813 if (BV_ISSET(fields, 3)) {
29814 log_packet_detailed(" field 'type' has changed");
29815#ifdef FREECIV_JSON_CONNECTION
29816 field_addr.name = "type";
29817#endif /* FREECIV_JSON_CONNECTION */
29818 e = 0;
29819 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
29820 if (e) {
29821 log_packet_detailed("'type' field error detected");
29822 }
29823 }
29824 if (BV_ISSET(fields, 4)) {
29825 log_packet_detailed(" field 'veteran' has changed");
29826#ifdef FREECIV_JSON_CONNECTION
29827 field_addr.name = "veteran";
29828#endif /* FREECIV_JSON_CONNECTION */
29829 e = 0;
29830 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
29831 if (e) {
29832 log_packet_detailed("'veteran' field error detected");
29833 }
29834 }
29835 /* field 5 is folded into the header */
29836 /* field 6 is folded into the header */
29837 if (BV_ISSET(fields, 7)) {
29838 log_packet_detailed(" field 'hp' has changed");
29839#ifdef FREECIV_JSON_CONNECTION
29840 field_addr.name = "hp";
29841#endif /* FREECIV_JSON_CONNECTION */
29842 e = 0;
29843 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
29844 if (e) {
29845 log_packet_detailed("'hp' field error detected");
29846 }
29847 }
29848 if (BV_ISSET(fields, 8)) {
29849 log_packet_detailed(" field 'activity' has changed");
29850#ifdef FREECIV_JSON_CONNECTION
29851 field_addr.name = "activity";
29852#endif /* FREECIV_JSON_CONNECTION */
29853 e = 0;
29854 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
29855 if (e) {
29856 log_packet_detailed("'activity' field error detected");
29857 }
29858 }
29859 if (BV_ISSET(fields, 9)) {
29860 log_packet_detailed(" field 'activity_tgt' has changed");
29861#ifdef FREECIV_JSON_CONNECTION
29862 field_addr.name = "activity_tgt";
29863#endif /* FREECIV_JSON_CONNECTION */
29864 e = 0;
29865 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
29866 if (e) {
29867 log_packet_detailed("'activity_tgt' field error detected");
29868 }
29869 }
29870 if (BV_ISSET(fields, 10)) {
29871 log_packet_detailed(" field 'transported_by' has changed");
29872#ifdef FREECIV_JSON_CONNECTION
29873 field_addr.name = "transported_by";
29874#endif /* FREECIV_JSON_CONNECTION */
29875 e = 0;
29876 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
29877 if (e) {
29878 log_packet_detailed("'transported_by' field error detected");
29879 }
29880 }
29881 if (BV_ISSET(fields, 11)) {
29882 log_packet_detailed(" field 'packet_use' has changed");
29883#ifdef FREECIV_JSON_CONNECTION
29884 field_addr.name = "packet_use";
29885#endif /* FREECIV_JSON_CONNECTION */
29886 e = 0;
29887 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
29888 if (e) {
29889 log_packet_detailed("'packet_use' field error detected");
29890 }
29891 }
29892 if (BV_ISSET(fields, 12)) {
29893 log_packet_detailed(" field 'info_city_id' has changed");
29894#ifdef FREECIV_JSON_CONNECTION
29895 field_addr.name = "info_city_id";
29896#endif /* FREECIV_JSON_CONNECTION */
29897 e = 0;
29898 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->info_city_id);
29899 if (e) {
29900 log_packet_detailed("'info_city_id' field error detected");
29901 }
29902 }
29903
29904 *old = *real_packet;
29905
29906 hash = pc->phs.sent + PACKET_UNIT_INFO;
29907 if (NULL != *hash) {
29908 genhash_remove(*hash, real_packet);
29909 }
29910#endif /* FREECIV_DELTA_PROTOCOL */
29911#ifndef FREECIV_DELTA_PROTOCOL
29912#ifdef FREECIV_JSON_CONNECTION
29913 field_addr.name = "id";
29914#endif /* FREECIV_JSON_CONNECTION */
29915 e = 0;
29916 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
29917 if (e) {
29918 log_packet_detailed("'id' field error detected");
29919 }
29920#ifdef FREECIV_JSON_CONNECTION
29921 field_addr.name = "owner";
29922#endif /* FREECIV_JSON_CONNECTION */
29923 e = 0;
29924 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
29925 if (e) {
29926 log_packet_detailed("'owner' field error detected");
29927 }
29928#ifdef FREECIV_JSON_CONNECTION
29929 field_addr.name = "tile";
29930#endif /* FREECIV_JSON_CONNECTION */
29931 e = 0;
29932 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
29933 if (e) {
29934 log_packet_detailed("'tile' field error detected");
29935 }
29936#ifdef FREECIV_JSON_CONNECTION
29937 field_addr.name = "facing";
29938#endif /* FREECIV_JSON_CONNECTION */
29939 e = 0;
29940 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->facing);
29941 if (e) {
29942 log_packet_detailed("'facing' field error detected");
29943 }
29944#ifdef FREECIV_JSON_CONNECTION
29945 field_addr.name = "type";
29946#endif /* FREECIV_JSON_CONNECTION */
29947 e = 0;
29948 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
29949 if (e) {
29950 log_packet_detailed("'type' field error detected");
29951 }
29952#ifdef FREECIV_JSON_CONNECTION
29953 field_addr.name = "veteran";
29954#endif /* FREECIV_JSON_CONNECTION */
29955 e = 0;
29956 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
29957 if (e) {
29958 log_packet_detailed("'veteran' field error detected");
29959 }
29960#ifdef FREECIV_JSON_CONNECTION
29961 field_addr.name = "occupied";
29962#endif /* FREECIV_JSON_CONNECTION */
29963 e = 0;
29964 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->occupied);
29965 if (e) {
29966 log_packet_detailed("'occupied' field error detected");
29967 }
29968#ifdef FREECIV_JSON_CONNECTION
29969 field_addr.name = "transported";
29970#endif /* FREECIV_JSON_CONNECTION */
29971 e = 0;
29972 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->transported);
29973 if (e) {
29974 log_packet_detailed("'transported' field error detected");
29975 }
29976#ifdef FREECIV_JSON_CONNECTION
29977 field_addr.name = "hp";
29978#endif /* FREECIV_JSON_CONNECTION */
29979 e = 0;
29980 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
29981 if (e) {
29982 log_packet_detailed("'hp' field error detected");
29983 }
29984#ifdef FREECIV_JSON_CONNECTION
29985 field_addr.name = "activity";
29986#endif /* FREECIV_JSON_CONNECTION */
29987 e = 0;
29988 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
29989 if (e) {
29990 log_packet_detailed("'activity' field error detected");
29991 }
29992#ifdef FREECIV_JSON_CONNECTION
29993 field_addr.name = "activity_tgt";
29994#endif /* FREECIV_JSON_CONNECTION */
29995 e = 0;
29996 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_tgt);
29997 if (e) {
29998 log_packet_detailed("'activity_tgt' field error detected");
29999 }
30000#ifdef FREECIV_JSON_CONNECTION
30001 field_addr.name = "transported_by";
30002#endif /* FREECIV_JSON_CONNECTION */
30003 e = 0;
30004 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
30005 if (e) {
30006 log_packet_detailed("'transported_by' field error detected");
30007 }
30008#ifdef FREECIV_JSON_CONNECTION
30009 field_addr.name = "packet_use";
30010#endif /* FREECIV_JSON_CONNECTION */
30011 e = 0;
30012 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->packet_use);
30013 if (e) {
30014 log_packet_detailed("'packet_use' field error detected");
30015 }
30016#ifdef FREECIV_JSON_CONNECTION
30017 field_addr.name = "info_city_id";
30018#endif /* FREECIV_JSON_CONNECTION */
30019 e = 0;
30020 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->info_city_id);
30021 if (e) {
30022 log_packet_detailed("'info_city_id' field error detected");
30023 }
30024
30025#endif
30026 SEND_PACKET_END(PACKET_UNIT_SHORT_INFO);
30027}
30028
30029 int send_packet_unit_short_info(struct connection *pc, const struct packet_unit_short_info *packet, bool force_to_send)
30030{
30031 if (!pc->used) {
30032 log_error("WARNING: trying to send data to the closed connection %s",
30033 conn_description(pc));
30034 return -1;
30035 }
30036 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SHORT_INFO].force_to_send != NULL, -1,
30037 "Handler for PACKET_UNIT_SHORT_INFO not installed");
30038 return pc->phs.handlers->send[PACKET_UNIT_SHORT_INFO].force_to_send(pc, packet, force_to_send);
30039}
30040
30041 void lsend_packet_unit_short_info(struct conn_list *dest, const struct packet_unit_short_info *packet, bool force_to_send)
30042{
30043 conn_list_iterate(dest, pconn) {
30044 send_packet_unit_short_info(pconn, packet, force_to_send);
30045 } conn_list_iterate_end;
30046}
30047
30048#ifdef FREECIV_DELTA_PROTOCOL
30049#define hash_packet_unit_combat_info_100 hash_const
30050
30051#define cmp_packet_unit_combat_info_100 cmp_const
30052
30053 BV_DEFINE(packet_unit_combat_info_100_fields, 6);
30054#endif /* FREECIV_DELTA_PROTOCOL */
30055
30056 static struct packet_unit_combat_info *receive_packet_unit_combat_info_100(struct connection *pc)
30057{
30058#ifdef FREECIV_DELTA_PROTOCOL
30059 packet_unit_combat_info_100_fields fields;
30060 struct packet_unit_combat_info *old;
30061 struct genhash **hash = pc->phs.received + PACKET_UNIT_COMBAT_INFO;
30062#endif /* FREECIV_DELTA_PROTOCOL */
30063 RECEIVE_PACKET_START(packet_unit_combat_info, real_packet);
30064#ifdef FREECIV_JSON_CONNECTION
30065 struct plocation field_addr;
30066 {
30067 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30068 field_addr = *field_addr_tmp;
30069 FC_FREE(field_addr_tmp);
30070 }
30071#endif /* FREECIV_JSON_CONNECTION */
30072
30073#ifdef FREECIV_DELTA_PROTOCOL
30074#ifdef FREECIV_JSON_CONNECTION
30075 field_addr.name = "fields";
30076#endif /* FREECIV_JSON_CONNECTION */
30077 DIO_BV_GET(&din, &field_addr, fields);
30078
30079#else /* FREECIV_DELTA_PROTOCOL */
30080#ifdef FREECIV_JSON_CONNECTION
30081 field_addr.name = "attacker_unit_id";
30082#endif /* FREECIV_JSON_CONNECTION */
30083 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->attacker_unit_id)) {
30084 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id);
30085 }
30086#ifdef FREECIV_JSON_CONNECTION
30087 field_addr.name = "defender_unit_id";
30088#endif /* FREECIV_JSON_CONNECTION */
30089 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->defender_unit_id)) {
30090 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id);
30091 }
30092#ifdef FREECIV_JSON_CONNECTION
30093 field_addr.name = "attacker_hp";
30094#endif /* FREECIV_JSON_CONNECTION */
30095 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
30096 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
30097 }
30098#ifdef FREECIV_JSON_CONNECTION
30099 field_addr.name = "defender_hp";
30100#endif /* FREECIV_JSON_CONNECTION */
30101 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
30102 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
30103 }
30104#ifdef FREECIV_JSON_CONNECTION
30105 field_addr.name = "make_att_veteran";
30106#endif /* FREECIV_JSON_CONNECTION */
30107 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_att_veteran)) {
30108 RECEIVE_PACKET_FIELD_ERROR(make_att_veteran);
30109 }
30110#ifdef FREECIV_JSON_CONNECTION
30111 field_addr.name = "make_def_veteran";
30112#endif /* FREECIV_JSON_CONNECTION */
30113 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->make_def_veteran)) {
30114 RECEIVE_PACKET_FIELD_ERROR(make_def_veteran);
30115 }
30116#endif
30117 log_packet_detailed("packet_unit_combat_info_100: got info about ()");
30118
30119#ifdef FREECIV_DELTA_PROTOCOL
30120 if (NULL == *hash) {
30121 *hash = genhash_new_full(hash_packet_unit_combat_info_100, cmp_packet_unit_combat_info_100,
30122 NULL, NULL, NULL, free);
30123 }
30124
30125 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30126 *real_packet = *old;
30127 } else {
30128 log_packet_detailed(" no old info");
30129 memset(real_packet, 0, sizeof(*real_packet));
30130 }
30131
30132 if (BV_ISSET(fields, 0)) {
30133 log_packet_detailed(" got field 'attacker_unit_id'");
30134#ifdef FREECIV_JSON_CONNECTION
30135 field_addr.name = "attacker_unit_id";
30136#endif /* FREECIV_JSON_CONNECTION */
30137 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->attacker_unit_id)) {
30138 RECEIVE_PACKET_FIELD_ERROR(attacker_unit_id);
30139 }
30140 }
30141 if (BV_ISSET(fields, 1)) {
30142 log_packet_detailed(" got field 'defender_unit_id'");
30143#ifdef FREECIV_JSON_CONNECTION
30144 field_addr.name = "defender_unit_id";
30145#endif /* FREECIV_JSON_CONNECTION */
30146 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->defender_unit_id)) {
30147 RECEIVE_PACKET_FIELD_ERROR(defender_unit_id);
30148 }
30149 }
30150 if (BV_ISSET(fields, 2)) {
30151 log_packet_detailed(" got field 'attacker_hp'");
30152#ifdef FREECIV_JSON_CONNECTION
30153 field_addr.name = "attacker_hp";
30154#endif /* FREECIV_JSON_CONNECTION */
30155 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attacker_hp)) {
30156 RECEIVE_PACKET_FIELD_ERROR(attacker_hp);
30157 }
30158 }
30159 if (BV_ISSET(fields, 3)) {
30160 log_packet_detailed(" got field 'defender_hp'");
30161#ifdef FREECIV_JSON_CONNECTION
30162 field_addr.name = "defender_hp";
30163#endif /* FREECIV_JSON_CONNECTION */
30164 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defender_hp)) {
30165 RECEIVE_PACKET_FIELD_ERROR(defender_hp);
30166 }
30167 }
30168 real_packet->make_att_veteran = BV_ISSET(fields, 4);
30169 real_packet->make_def_veteran = BV_ISSET(fields, 5);
30170
30171 if (NULL == old) {
30172 old = fc_malloc(sizeof(*old));
30173 *old = *real_packet;
30174 genhash_insert(*hash, old, old);
30175 } else {
30176 *old = *real_packet;
30177 }
30178
30179#endif /* FREECIV_DELTA_PROTOCOL */
30180 RECEIVE_PACKET_END(real_packet);
30181}
30182
30183 static int send_packet_unit_combat_info_100(struct connection *pc, const struct packet_unit_combat_info *packet)
30184{
30185 const struct packet_unit_combat_info *real_packet = packet;
30186 int e;
30187#ifdef FREECIV_DELTA_PROTOCOL
30188 packet_unit_combat_info_100_fields fields;
30189 struct packet_unit_combat_info *old;
30190 bool differ;
30191 struct genhash **hash = pc->phs.sent + PACKET_UNIT_COMBAT_INFO;
30192#endif /* FREECIV_DELTA_PROTOCOL */
30193 SEND_PACKET_START(PACKET_UNIT_COMBAT_INFO);
30194#ifdef FREECIV_JSON_CONNECTION
30195 struct plocation field_addr;
30196 {
30197 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30198 field_addr = *field_addr_tmp;
30199 FC_FREE(field_addr_tmp);
30200 }
30201#endif /* FREECIV_JSON_CONNECTION */
30202
30203 log_packet_detailed("packet_unit_combat_info_100: sending info about ()");
30204
30205#ifdef FREECIV_DELTA_PROTOCOL
30206 if (NULL == *hash) {
30207 *hash = genhash_new_full(hash_packet_unit_combat_info_100, cmp_packet_unit_combat_info_100,
30208 NULL, NULL, NULL, free);
30209 }
30210 BV_CLR_ALL(fields);
30211
30212 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30213 old = fc_malloc(sizeof(*old));
30214 *old = *real_packet;
30215 genhash_insert(*hash, old, old);
30216 memset(old, 0, sizeof(*old));
30217 }
30218 differ = (old->attacker_unit_id != real_packet->attacker_unit_id);
30219 if (differ) {
30220 BV_SET(fields, 0);
30221 }
30222
30223 differ = (old->defender_unit_id != real_packet->defender_unit_id);
30224 if (differ) {
30225 BV_SET(fields, 1);
30226 }
30227
30228 differ = (old->attacker_hp != real_packet->attacker_hp);
30229 if (differ) {
30230 BV_SET(fields, 2);
30231 }
30232
30233 differ = (old->defender_hp != real_packet->defender_hp);
30234 if (differ) {
30235 BV_SET(fields, 3);
30236 }
30237
30238 if (packet->make_att_veteran) {
30239 BV_SET(fields, 4);
30240 }
30241
30242 if (packet->make_def_veteran) {
30243 BV_SET(fields, 5);
30244 }
30245
30246
30247#ifdef FREECIV_JSON_CONNECTION
30248 field_addr.name = "fields";
30249#endif /* FREECIV_JSON_CONNECTION */
30250 e = 0;
30251 e |= DIO_BV_PUT(&dout, &field_addr, fields);
30252 if (e) {
30253 log_packet_detailed("fields bitvector error detected");
30254 }
30255
30256 if (BV_ISSET(fields, 0)) {
30257 log_packet_detailed(" field 'attacker_unit_id' has changed");
30258#ifdef FREECIV_JSON_CONNECTION
30259 field_addr.name = "attacker_unit_id";
30260#endif /* FREECIV_JSON_CONNECTION */
30261 e = 0;
30262 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->attacker_unit_id);
30263 if (e) {
30264 log_packet_detailed("'attacker_unit_id' field error detected");
30265 }
30266 }
30267 if (BV_ISSET(fields, 1)) {
30268 log_packet_detailed(" field 'defender_unit_id' has changed");
30269#ifdef FREECIV_JSON_CONNECTION
30270 field_addr.name = "defender_unit_id";
30271#endif /* FREECIV_JSON_CONNECTION */
30272 e = 0;
30273 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->defender_unit_id);
30274 if (e) {
30275 log_packet_detailed("'defender_unit_id' field error detected");
30276 }
30277 }
30278 if (BV_ISSET(fields, 2)) {
30279 log_packet_detailed(" field 'attacker_hp' has changed");
30280#ifdef FREECIV_JSON_CONNECTION
30281 field_addr.name = "attacker_hp";
30282#endif /* FREECIV_JSON_CONNECTION */
30283 e = 0;
30284 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
30285 if (e) {
30286 log_packet_detailed("'attacker_hp' field error detected");
30287 }
30288 }
30289 if (BV_ISSET(fields, 3)) {
30290 log_packet_detailed(" field 'defender_hp' has changed");
30291#ifdef FREECIV_JSON_CONNECTION
30292 field_addr.name = "defender_hp";
30293#endif /* FREECIV_JSON_CONNECTION */
30294 e = 0;
30295 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
30296 if (e) {
30297 log_packet_detailed("'defender_hp' field error detected");
30298 }
30299 }
30300 /* field 4 is folded into the header */
30301 /* field 5 is folded into the header */
30302
30303 *old = *real_packet;
30304#endif /* FREECIV_DELTA_PROTOCOL */
30305#ifndef FREECIV_DELTA_PROTOCOL
30306#ifdef FREECIV_JSON_CONNECTION
30307 field_addr.name = "attacker_unit_id";
30308#endif /* FREECIV_JSON_CONNECTION */
30309 e = 0;
30310 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->attacker_unit_id);
30311 if (e) {
30312 log_packet_detailed("'attacker_unit_id' field error detected");
30313 }
30314#ifdef FREECIV_JSON_CONNECTION
30315 field_addr.name = "defender_unit_id";
30316#endif /* FREECIV_JSON_CONNECTION */
30317 e = 0;
30318 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->defender_unit_id);
30319 if (e) {
30320 log_packet_detailed("'defender_unit_id' field error detected");
30321 }
30322#ifdef FREECIV_JSON_CONNECTION
30323 field_addr.name = "attacker_hp";
30324#endif /* FREECIV_JSON_CONNECTION */
30325 e = 0;
30326 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attacker_hp);
30327 if (e) {
30328 log_packet_detailed("'attacker_hp' field error detected");
30329 }
30330#ifdef FREECIV_JSON_CONNECTION
30331 field_addr.name = "defender_hp";
30332#endif /* FREECIV_JSON_CONNECTION */
30333 e = 0;
30334 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defender_hp);
30335 if (e) {
30336 log_packet_detailed("'defender_hp' field error detected");
30337 }
30338#ifdef FREECIV_JSON_CONNECTION
30339 field_addr.name = "make_att_veteran";
30340#endif /* FREECIV_JSON_CONNECTION */
30341 e = 0;
30342 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->make_att_veteran);
30343 if (e) {
30344 log_packet_detailed("'make_att_veteran' field error detected");
30345 }
30346#ifdef FREECIV_JSON_CONNECTION
30347 field_addr.name = "make_def_veteran";
30348#endif /* FREECIV_JSON_CONNECTION */
30349 e = 0;
30350 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->make_def_veteran);
30351 if (e) {
30352 log_packet_detailed("'make_def_veteran' field error detected");
30353 }
30354
30355#endif
30356 SEND_PACKET_END(PACKET_UNIT_COMBAT_INFO);
30357}
30358
30359 int send_packet_unit_combat_info(struct connection *pc, const struct packet_unit_combat_info *packet)
30360{
30361 if (!pc->used) {
30362 log_error("WARNING: trying to send data to the closed connection %s",
30363 conn_description(pc));
30364 return -1;
30365 }
30366 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_COMBAT_INFO].packet != NULL, -1,
30367 "Handler for PACKET_UNIT_COMBAT_INFO not installed");
30368 return pc->phs.handlers->send[PACKET_UNIT_COMBAT_INFO].packet(pc, packet);
30369}
30370
30371 void lsend_packet_unit_combat_info(struct conn_list *dest, const struct packet_unit_combat_info *packet)
30372{
30373 conn_list_iterate(dest, pconn) {
30374 send_packet_unit_combat_info(pconn, packet);
30375 } conn_list_iterate_end;
30376}
30377
30378#ifdef FREECIV_DELTA_PROTOCOL
30379#define hash_packet_unit_sscs_set_100 hash_const
30380
30381#define cmp_packet_unit_sscs_set_100 cmp_const
30382
30383 BV_DEFINE(packet_unit_sscs_set_100_fields, 3);
30384#endif /* FREECIV_DELTA_PROTOCOL */
30385
30386 static struct packet_unit_sscs_set *receive_packet_unit_sscs_set_100(struct connection *pc)
30387{
30388#ifdef FREECIV_DELTA_PROTOCOL
30389 packet_unit_sscs_set_100_fields fields;
30390 struct packet_unit_sscs_set *old;
30391 struct genhash **hash = pc->phs.received + PACKET_UNIT_SSCS_SET;
30392#endif /* FREECIV_DELTA_PROTOCOL */
30393 RECEIVE_PACKET_START(packet_unit_sscs_set, real_packet);
30394#ifdef FREECIV_JSON_CONNECTION
30395 struct plocation field_addr;
30396 {
30397 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30398 field_addr = *field_addr_tmp;
30399 FC_FREE(field_addr_tmp);
30400 }
30401#endif /* FREECIV_JSON_CONNECTION */
30402
30403#ifdef FREECIV_DELTA_PROTOCOL
30404#ifdef FREECIV_JSON_CONNECTION
30405 field_addr.name = "fields";
30406#endif /* FREECIV_JSON_CONNECTION */
30407 DIO_BV_GET(&din, &field_addr, fields);
30408
30409#else /* FREECIV_DELTA_PROTOCOL */
30410#ifdef FREECIV_JSON_CONNECTION
30411 field_addr.name = "unit_id";
30412#endif /* FREECIV_JSON_CONNECTION */
30413 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
30414 RECEIVE_PACKET_FIELD_ERROR(unit_id);
30415 }
30416#ifdef FREECIV_JSON_CONNECTION
30417 field_addr.name = "type";
30418#endif /* FREECIV_JSON_CONNECTION */
30419 {
30420 int readin;
30421
30422 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
30423 RECEIVE_PACKET_FIELD_ERROR(type);
30424 }
30425 real_packet->type = readin;
30426 }
30427#ifdef FREECIV_JSON_CONNECTION
30428 field_addr.name = "value";
30429#endif /* FREECIV_JSON_CONNECTION */
30430 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
30431 RECEIVE_PACKET_FIELD_ERROR(value);
30432 }
30433#endif
30434 log_packet_detailed("packet_unit_sscs_set_100: got info about ()");
30435
30436#ifdef FREECIV_DELTA_PROTOCOL
30437 if (NULL == *hash) {
30438 *hash = genhash_new_full(hash_packet_unit_sscs_set_100, cmp_packet_unit_sscs_set_100,
30439 NULL, NULL, NULL, free);
30440 }
30441
30442 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30443 *real_packet = *old;
30444 } else {
30445 log_packet_detailed(" no old info");
30446 memset(real_packet, 0, sizeof(*real_packet));
30447 }
30448
30449 if (BV_ISSET(fields, 0)) {
30450 log_packet_detailed(" got field 'unit_id'");
30451#ifdef FREECIV_JSON_CONNECTION
30452 field_addr.name = "unit_id";
30453#endif /* FREECIV_JSON_CONNECTION */
30454 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
30455 RECEIVE_PACKET_FIELD_ERROR(unit_id);
30456 }
30457 }
30458 if (BV_ISSET(fields, 1)) {
30459 log_packet_detailed(" got field 'type'");
30460#ifdef FREECIV_JSON_CONNECTION
30461 field_addr.name = "type";
30462#endif /* FREECIV_JSON_CONNECTION */
30463 {
30464 int readin;
30465
30466 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
30467 RECEIVE_PACKET_FIELD_ERROR(type);
30468 }
30469 real_packet->type = readin;
30470 }
30471 }
30472 if (BV_ISSET(fields, 2)) {
30473 log_packet_detailed(" got field 'value'");
30474#ifdef FREECIV_JSON_CONNECTION
30475 field_addr.name = "value";
30476#endif /* FREECIV_JSON_CONNECTION */
30477 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->value)) {
30478 RECEIVE_PACKET_FIELD_ERROR(value);
30479 }
30480 }
30481
30482 if (NULL == old) {
30483 old = fc_malloc(sizeof(*old));
30484 *old = *real_packet;
30485 genhash_insert(*hash, old, old);
30486 } else {
30487 *old = *real_packet;
30488 }
30489
30490#endif /* FREECIV_DELTA_PROTOCOL */
30491 RECEIVE_PACKET_END(real_packet);
30492}
30493
30494 static int send_packet_unit_sscs_set_100(struct connection *pc, const struct packet_unit_sscs_set *packet)
30495{
30496 const struct packet_unit_sscs_set *real_packet = packet;
30497 int e;
30498#ifdef FREECIV_DELTA_PROTOCOL
30499 packet_unit_sscs_set_100_fields fields;
30500 struct packet_unit_sscs_set *old;
30501 bool differ;
30502 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SSCS_SET;
30503#endif /* FREECIV_DELTA_PROTOCOL */
30504 SEND_PACKET_START(PACKET_UNIT_SSCS_SET);
30505#ifdef FREECIV_JSON_CONNECTION
30506 struct plocation field_addr;
30507 {
30508 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30509 field_addr = *field_addr_tmp;
30510 FC_FREE(field_addr_tmp);
30511 }
30512#endif /* FREECIV_JSON_CONNECTION */
30513
30514 log_packet_detailed("packet_unit_sscs_set_100: sending info about ()");
30515
30516#ifdef FREECIV_DELTA_PROTOCOL
30517 if (NULL == *hash) {
30518 *hash = genhash_new_full(hash_packet_unit_sscs_set_100, cmp_packet_unit_sscs_set_100,
30519 NULL, NULL, NULL, free);
30520 }
30521 BV_CLR_ALL(fields);
30522
30523 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30524 old = fc_malloc(sizeof(*old));
30525 *old = *real_packet;
30526 genhash_insert(*hash, old, old);
30527 memset(old, 0, sizeof(*old));
30528 }
30529 differ = (old->unit_id != real_packet->unit_id);
30530 if (differ) {
30531 BV_SET(fields, 0);
30532 }
30533
30534 differ = (old->type != real_packet->type);
30535 if (differ) {
30536 BV_SET(fields, 1);
30537 }
30538
30539 differ = (old->value != real_packet->value);
30540 if (differ) {
30541 BV_SET(fields, 2);
30542 }
30543
30544
30545#ifdef FREECIV_JSON_CONNECTION
30546 field_addr.name = "fields";
30547#endif /* FREECIV_JSON_CONNECTION */
30548 e = 0;
30549 e |= DIO_BV_PUT(&dout, &field_addr, fields);
30550 if (e) {
30551 log_packet_detailed("fields bitvector error detected");
30552 }
30553
30554 if (BV_ISSET(fields, 0)) {
30555 log_packet_detailed(" field 'unit_id' has changed");
30556#ifdef FREECIV_JSON_CONNECTION
30557 field_addr.name = "unit_id";
30558#endif /* FREECIV_JSON_CONNECTION */
30559 e = 0;
30560 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
30561 if (e) {
30562 log_packet_detailed("'unit_id' field error detected");
30563 }
30564 }
30565 if (BV_ISSET(fields, 1)) {
30566 log_packet_detailed(" field 'type' has changed");
30567#ifdef FREECIV_JSON_CONNECTION
30568 field_addr.name = "type";
30569#endif /* FREECIV_JSON_CONNECTION */
30570 e = 0;
30571 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
30572 if (e) {
30573 log_packet_detailed("'type' field error detected");
30574 }
30575 }
30576 if (BV_ISSET(fields, 2)) {
30577 log_packet_detailed(" field 'value' has changed");
30578#ifdef FREECIV_JSON_CONNECTION
30579 field_addr.name = "value";
30580#endif /* FREECIV_JSON_CONNECTION */
30581 e = 0;
30582 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
30583 if (e) {
30584 log_packet_detailed("'value' field error detected");
30585 }
30586 }
30587
30588 *old = *real_packet;
30589#endif /* FREECIV_DELTA_PROTOCOL */
30590#ifndef FREECIV_DELTA_PROTOCOL
30591#ifdef FREECIV_JSON_CONNECTION
30592 field_addr.name = "unit_id";
30593#endif /* FREECIV_JSON_CONNECTION */
30594 e = 0;
30595 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
30596 if (e) {
30597 log_packet_detailed("'unit_id' field error detected");
30598 }
30599#ifdef FREECIV_JSON_CONNECTION
30600 field_addr.name = "type";
30601#endif /* FREECIV_JSON_CONNECTION */
30602 e = 0;
30603 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
30604 if (e) {
30605 log_packet_detailed("'type' field error detected");
30606 }
30607#ifdef FREECIV_JSON_CONNECTION
30608 field_addr.name = "value";
30609#endif /* FREECIV_JSON_CONNECTION */
30610 e = 0;
30611 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->value);
30612 if (e) {
30613 log_packet_detailed("'value' field error detected");
30614 }
30615
30616#endif
30617 SEND_PACKET_END(PACKET_UNIT_SSCS_SET);
30618}
30619
30620 int send_packet_unit_sscs_set(struct connection *pc, const struct packet_unit_sscs_set *packet)
30621{
30622 if (!pc->used) {
30623 log_error("WARNING: trying to send data to the closed connection %s",
30624 conn_description(pc));
30625 return -1;
30626 }
30627 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SSCS_SET].packet != NULL, -1,
30628 "Handler for PACKET_UNIT_SSCS_SET not installed");
30629 return pc->phs.handlers->send[PACKET_UNIT_SSCS_SET].packet(pc, packet);
30630}
30631
30632 int dsend_packet_unit_sscs_set(struct connection *pc, int unit_id, enum unit_ss_data_type type, int value)
30633{
30634 struct packet_unit_sscs_set packet, *real_packet = &packet;
30635
30636 real_packet->unit_id = unit_id;
30637 real_packet->type = type;
30638 real_packet->value = value;
30639
30640 return send_packet_unit_sscs_set(pc, real_packet);
30641}
30642
30643#ifdef FREECIV_DELTA_PROTOCOL
30644#define hash_packet_unit_orders_100 hash_const
30645
30646#define cmp_packet_unit_orders_100 cmp_const
30647
30648 BV_DEFINE(packet_unit_orders_100_fields, 7);
30649#endif /* FREECIV_DELTA_PROTOCOL */
30650
30651 static struct packet_unit_orders *receive_packet_unit_orders_100(struct connection *pc)
30652{
30653#ifdef FREECIV_DELTA_PROTOCOL
30654 packet_unit_orders_100_fields fields;
30655 struct packet_unit_orders *old;
30656 struct genhash **hash = pc->phs.received + PACKET_UNIT_ORDERS;
30657#endif /* FREECIV_DELTA_PROTOCOL */
30658 RECEIVE_PACKET_START(packet_unit_orders, real_packet);
30659#ifdef FREECIV_JSON_CONNECTION
30660 struct plocation field_addr;
30661 {
30662 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30663 field_addr = *field_addr_tmp;
30664 FC_FREE(field_addr_tmp);
30665 }
30666#endif /* FREECIV_JSON_CONNECTION */
30667
30668#ifdef FREECIV_DELTA_PROTOCOL
30669#ifdef FREECIV_JSON_CONNECTION
30670 field_addr.name = "fields";
30671#endif /* FREECIV_JSON_CONNECTION */
30672 DIO_BV_GET(&din, &field_addr, fields);
30673
30674#else /* FREECIV_DELTA_PROTOCOL */
30675#ifdef FREECIV_JSON_CONNECTION
30676 field_addr.name = "unit_id";
30677#endif /* FREECIV_JSON_CONNECTION */
30678 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
30679 RECEIVE_PACKET_FIELD_ERROR(unit_id);
30680 }
30681#ifdef FREECIV_JSON_CONNECTION
30682 field_addr.name = "src_tile";
30683#endif /* FREECIV_JSON_CONNECTION */
30684 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
30685 RECEIVE_PACKET_FIELD_ERROR(src_tile);
30686 }
30687#ifdef FREECIV_JSON_CONNECTION
30688 field_addr.name = "length";
30689#endif /* FREECIV_JSON_CONNECTION */
30690 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
30691 RECEIVE_PACKET_FIELD_ERROR(length);
30692 }
30693#ifdef FREECIV_JSON_CONNECTION
30694 field_addr.name = "repeat";
30695#endif /* FREECIV_JSON_CONNECTION */
30696 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->repeat)) {
30697 RECEIVE_PACKET_FIELD_ERROR(repeat);
30698 }
30699#ifdef FREECIV_JSON_CONNECTION
30700 field_addr.name = "vigilant";
30701#endif /* FREECIV_JSON_CONNECTION */
30702 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->vigilant)) {
30703 RECEIVE_PACKET_FIELD_ERROR(vigilant);
30704 }
30705#ifdef FREECIV_JSON_CONNECTION
30706 field_addr.name = "orders";
30707#endif /* FREECIV_JSON_CONNECTION */
30708 {
30709 int i;
30710
30711#ifdef FREECIV_JSON_CONNECTION
30712 /* Enter array. */
30713 field_addr.sub_location = plocation_elem_new(0);
30714#endif /* FREECIV_JSON_CONNECTION */
30715
30716 if (real_packet->length > MAX_LEN_ROUTE) {
30717 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
30718 }
30719 for (i = 0; i < real_packet->length; i++) {
30720#ifdef FREECIV_JSON_CONNECTION
30721 field_addr.sub_location->number = i;
30722#endif /* FREECIV_JSON_CONNECTION */
30723 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
30724 RECEIVE_PACKET_FIELD_ERROR(orders);
30725 }
30726 }
30727
30728#ifdef FREECIV_JSON_CONNECTION
30729 /* Exit array. */
30730 FC_FREE(field_addr.sub_location);
30731#endif /* FREECIV_JSON_CONNECTION */
30732 }
30733#ifdef FREECIV_JSON_CONNECTION
30734 field_addr.name = "dest_tile";
30735#endif /* FREECIV_JSON_CONNECTION */
30736 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
30737 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
30738 }
30739#endif
30740 log_packet_detailed("packet_unit_orders_100: got info about ()");
30741
30742#ifdef FREECIV_DELTA_PROTOCOL
30743 if (NULL == *hash) {
30744 *hash = genhash_new_full(hash_packet_unit_orders_100, cmp_packet_unit_orders_100,
30745 NULL, NULL, NULL, free);
30746 }
30747
30748 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
30749 *real_packet = *old;
30750 } else {
30751 log_packet_detailed(" no old info");
30752 memset(real_packet, 0, sizeof(*real_packet));
30753 }
30754
30755 if (BV_ISSET(fields, 0)) {
30756 log_packet_detailed(" got field 'unit_id'");
30757#ifdef FREECIV_JSON_CONNECTION
30758 field_addr.name = "unit_id";
30759#endif /* FREECIV_JSON_CONNECTION */
30760 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
30761 RECEIVE_PACKET_FIELD_ERROR(unit_id);
30762 }
30763 }
30764 if (BV_ISSET(fields, 1)) {
30765 log_packet_detailed(" got field 'src_tile'");
30766#ifdef FREECIV_JSON_CONNECTION
30767 field_addr.name = "src_tile";
30768#endif /* FREECIV_JSON_CONNECTION */
30769 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->src_tile)) {
30770 RECEIVE_PACKET_FIELD_ERROR(src_tile);
30771 }
30772 }
30773 if (BV_ISSET(fields, 2)) {
30774 log_packet_detailed(" got field 'length'");
30775#ifdef FREECIV_JSON_CONNECTION
30776 field_addr.name = "length";
30777#endif /* FREECIV_JSON_CONNECTION */
30778 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->length)) {
30779 RECEIVE_PACKET_FIELD_ERROR(length);
30780 }
30781 }
30782 real_packet->repeat = BV_ISSET(fields, 3);
30783 real_packet->vigilant = BV_ISSET(fields, 4);
30784 if (BV_ISSET(fields, 5)) {
30785 log_packet_detailed(" got field 'orders'");
30786#ifdef FREECIV_JSON_CONNECTION
30787 field_addr.name = "orders";
30788#endif /* FREECIV_JSON_CONNECTION */
30789 {
30790 int i;
30791
30792#ifdef FREECIV_JSON_CONNECTION
30793 /* Enter array. */
30794 field_addr.sub_location = plocation_elem_new(0);
30795#endif /* FREECIV_JSON_CONNECTION */
30796
30797 if (real_packet->length > MAX_LEN_ROUTE) {
30798 RECEIVE_PACKET_FIELD_ERROR(orders, ": truncation array");
30799 }
30800 for (i = 0; i < real_packet->length; i++) {
30801#ifdef FREECIV_JSON_CONNECTION
30802 field_addr.sub_location->number = i;
30803#endif /* FREECIV_JSON_CONNECTION */
30804 if (!DIO_GET(unit_order, &din, &field_addr, &real_packet->orders[i])) {
30805 RECEIVE_PACKET_FIELD_ERROR(orders);
30806 }
30807 }
30808
30809#ifdef FREECIV_JSON_CONNECTION
30810 /* Exit array. */
30811 FC_FREE(field_addr.sub_location);
30812#endif /* FREECIV_JSON_CONNECTION */
30813 }
30814 }
30815 if (BV_ISSET(fields, 6)) {
30816 log_packet_detailed(" got field 'dest_tile'");
30817#ifdef FREECIV_JSON_CONNECTION
30818 field_addr.name = "dest_tile";
30819#endif /* FREECIV_JSON_CONNECTION */
30820 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->dest_tile)) {
30821 RECEIVE_PACKET_FIELD_ERROR(dest_tile);
30822 }
30823 }
30824
30825 if (NULL == old) {
30826 old = fc_malloc(sizeof(*old));
30827 *old = *real_packet;
30828 genhash_insert(*hash, old, old);
30829 } else {
30830 *old = *real_packet;
30831 }
30832
30833#endif /* FREECIV_DELTA_PROTOCOL */
30834 RECEIVE_PACKET_END(real_packet);
30835}
30836
30837 static int send_packet_unit_orders_100(struct connection *pc, const struct packet_unit_orders *packet)
30838{
30839 const struct packet_unit_orders *real_packet = packet;
30840 int e;
30841#ifdef FREECIV_DELTA_PROTOCOL
30842 packet_unit_orders_100_fields fields;
30843 struct packet_unit_orders *old;
30844 bool differ;
30845 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ORDERS;
30846#endif /* FREECIV_DELTA_PROTOCOL */
30847 SEND_PACKET_START(PACKET_UNIT_ORDERS);
30848#ifdef FREECIV_JSON_CONNECTION
30849 struct plocation field_addr;
30850 {
30851 struct plocation *field_addr_tmp = plocation_field_new(NULL);
30852 field_addr = *field_addr_tmp;
30853 FC_FREE(field_addr_tmp);
30854 }
30855#endif /* FREECIV_JSON_CONNECTION */
30856
30857 log_packet_detailed("packet_unit_orders_100: sending info about ()");
30858
30859#ifdef FREECIV_DELTA_PROTOCOL
30860 if (NULL == *hash) {
30861 *hash = genhash_new_full(hash_packet_unit_orders_100, cmp_packet_unit_orders_100,
30862 NULL, NULL, NULL, free);
30863 }
30864 BV_CLR_ALL(fields);
30865
30866 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
30867 old = fc_malloc(sizeof(*old));
30868 *old = *real_packet;
30869 genhash_insert(*hash, old, old);
30870 memset(old, 0, sizeof(*old));
30871 }
30872 differ = (old->unit_id != real_packet->unit_id);
30873 if (differ) {
30874 BV_SET(fields, 0);
30875 }
30876
30877 differ = (old->src_tile != real_packet->src_tile);
30878 if (differ) {
30879 BV_SET(fields, 1);
30880 }
30881
30882 differ = (old->length != real_packet->length);
30883 if (differ) {
30884 BV_SET(fields, 2);
30885 }
30886
30887 if (packet->repeat) {
30888 BV_SET(fields, 3);
30889 }
30890
30891 if (packet->vigilant) {
30892 BV_SET(fields, 4);
30893 }
30894
30895 differ = (old->length != real_packet->length);
30896 if (!differ) {
30897 int i;
30898
30899 for (i = 0; i < real_packet->length; i++) {
30900 differ = !are_unit_orders_equal(&old->orders[i], &real_packet->orders[i]);
30901 if (differ) {
30902 break;
30903 }
30904 }
30905 }
30906 if (differ) {
30907 BV_SET(fields, 5);
30908 }
30909
30910 differ = (old->dest_tile != real_packet->dest_tile);
30911 if (differ) {
30912 BV_SET(fields, 6);
30913 }
30914
30915
30916#ifdef FREECIV_JSON_CONNECTION
30917 field_addr.name = "fields";
30918#endif /* FREECIV_JSON_CONNECTION */
30919 e = 0;
30920 e |= DIO_BV_PUT(&dout, &field_addr, fields);
30921 if (e) {
30922 log_packet_detailed("fields bitvector error detected");
30923 }
30924
30925 if (BV_ISSET(fields, 0)) {
30926 log_packet_detailed(" field 'unit_id' has changed");
30927#ifdef FREECIV_JSON_CONNECTION
30928 field_addr.name = "unit_id";
30929#endif /* FREECIV_JSON_CONNECTION */
30930 e = 0;
30931 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
30932 if (e) {
30933 log_packet_detailed("'unit_id' field error detected");
30934 }
30935 }
30936 if (BV_ISSET(fields, 1)) {
30937 log_packet_detailed(" field 'src_tile' has changed");
30938#ifdef FREECIV_JSON_CONNECTION
30939 field_addr.name = "src_tile";
30940#endif /* FREECIV_JSON_CONNECTION */
30941 e = 0;
30942 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
30943 if (e) {
30944 log_packet_detailed("'src_tile' field error detected");
30945 }
30946 }
30947 if (BV_ISSET(fields, 2)) {
30948 log_packet_detailed(" field 'length' has changed");
30949#ifdef FREECIV_JSON_CONNECTION
30950 field_addr.name = "length";
30951#endif /* FREECIV_JSON_CONNECTION */
30952 e = 0;
30953 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
30954 if (e) {
30955 log_packet_detailed("'length' field error detected");
30956 }
30957 }
30958 /* field 3 is folded into the header */
30959 /* field 4 is folded into the header */
30960 if (BV_ISSET(fields, 5)) {
30961 log_packet_detailed(" field 'orders' has changed");
30962#ifdef FREECIV_JSON_CONNECTION
30963 field_addr.name = "orders";
30964#endif /* FREECIV_JSON_CONNECTION */
30965 e = 0;
30966 {
30967 int i;
30968
30969#ifdef FREECIV_JSON_CONNECTION
30970 /* Create the array. */
30971 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
30972
30973 /* Enter the array. */
30974 field_addr.sub_location = plocation_elem_new(0);
30975#endif /* FREECIV_JSON_CONNECTION */
30976
30977 for (i = 0; i < real_packet->length; i++) {
30978#ifdef FREECIV_JSON_CONNECTION
30979 /* Next array element. */
30980 field_addr.sub_location->number = i;
30981#endif /* FREECIV_JSON_CONNECTION */
30982 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
30983 }
30984
30985#ifdef FREECIV_JSON_CONNECTION
30986 /* Exit array. */
30987 FC_FREE(field_addr.sub_location);
30988#endif /* FREECIV_JSON_CONNECTION */
30989 }
30990 if (e) {
30991 log_packet_detailed("'orders' field error detected");
30992 }
30993 }
30994 if (BV_ISSET(fields, 6)) {
30995 log_packet_detailed(" field 'dest_tile' has changed");
30996#ifdef FREECIV_JSON_CONNECTION
30997 field_addr.name = "dest_tile";
30998#endif /* FREECIV_JSON_CONNECTION */
30999 e = 0;
31000 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
31001 if (e) {
31002 log_packet_detailed("'dest_tile' field error detected");
31003 }
31004 }
31005
31006 *old = *real_packet;
31007#endif /* FREECIV_DELTA_PROTOCOL */
31008#ifndef FREECIV_DELTA_PROTOCOL
31009#ifdef FREECIV_JSON_CONNECTION
31010 field_addr.name = "unit_id";
31011#endif /* FREECIV_JSON_CONNECTION */
31012 e = 0;
31013 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
31014 if (e) {
31015 log_packet_detailed("'unit_id' field error detected");
31016 }
31017#ifdef FREECIV_JSON_CONNECTION
31018 field_addr.name = "src_tile";
31019#endif /* FREECIV_JSON_CONNECTION */
31020 e = 0;
31021 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->src_tile);
31022 if (e) {
31023 log_packet_detailed("'src_tile' field error detected");
31024 }
31025#ifdef FREECIV_JSON_CONNECTION
31026 field_addr.name = "length";
31027#endif /* FREECIV_JSON_CONNECTION */
31028 e = 0;
31029 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->length);
31030 if (e) {
31031 log_packet_detailed("'length' field error detected");
31032 }
31033#ifdef FREECIV_JSON_CONNECTION
31034 field_addr.name = "repeat";
31035#endif /* FREECIV_JSON_CONNECTION */
31036 e = 0;
31037 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->repeat);
31038 if (e) {
31039 log_packet_detailed("'repeat' field error detected");
31040 }
31041#ifdef FREECIV_JSON_CONNECTION
31042 field_addr.name = "vigilant";
31043#endif /* FREECIV_JSON_CONNECTION */
31044 e = 0;
31045 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->vigilant);
31046 if (e) {
31047 log_packet_detailed("'vigilant' field error detected");
31048 }
31049#ifdef FREECIV_JSON_CONNECTION
31050 field_addr.name = "orders";
31051#endif /* FREECIV_JSON_CONNECTION */
31052 e = 0;
31053 {
31054 int i;
31055
31056#ifdef FREECIV_JSON_CONNECTION
31057 /* Create the array. */
31058 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->length);
31059
31060 /* Enter the array. */
31061 field_addr.sub_location = plocation_elem_new(0);
31062#endif /* FREECIV_JSON_CONNECTION */
31063
31064 for (i = 0; i < real_packet->length; i++) {
31065#ifdef FREECIV_JSON_CONNECTION
31066 /* Next array element. */
31067 field_addr.sub_location->number = i;
31068#endif /* FREECIV_JSON_CONNECTION */
31069 e |= DIO_PUT(unit_order, &dout, &field_addr, &real_packet->orders[i]);
31070 }
31071
31072#ifdef FREECIV_JSON_CONNECTION
31073 /* Exit array. */
31074 FC_FREE(field_addr.sub_location);
31075#endif /* FREECIV_JSON_CONNECTION */
31076 }
31077 if (e) {
31078 log_packet_detailed("'orders' field error detected");
31079 }
31080#ifdef FREECIV_JSON_CONNECTION
31081 field_addr.name = "dest_tile";
31082#endif /* FREECIV_JSON_CONNECTION */
31083 e = 0;
31084 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->dest_tile);
31085 if (e) {
31086 log_packet_detailed("'dest_tile' field error detected");
31087 }
31088
31089#endif
31090 SEND_PACKET_END(PACKET_UNIT_ORDERS);
31091}
31092
31093 int send_packet_unit_orders(struct connection *pc, const struct packet_unit_orders *packet)
31094{
31095 if (!pc->used) {
31096 log_error("WARNING: trying to send data to the closed connection %s",
31097 conn_description(pc));
31098 return -1;
31099 }
31100 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ORDERS].packet != NULL, -1,
31101 "Handler for PACKET_UNIT_ORDERS not installed");
31102 return pc->phs.handlers->send[PACKET_UNIT_ORDERS].packet(pc, packet);
31103}
31104
31105#ifdef FREECIV_DELTA_PROTOCOL
31106#define hash_packet_unit_server_side_agent_set_100 hash_const
31107
31108#define cmp_packet_unit_server_side_agent_set_100 cmp_const
31109
31110 BV_DEFINE(packet_unit_server_side_agent_set_100_fields, 2);
31111#endif /* FREECIV_DELTA_PROTOCOL */
31112
31113 static struct packet_unit_server_side_agent_set *receive_packet_unit_server_side_agent_set_100(struct connection *pc)
31114{
31115#ifdef FREECIV_DELTA_PROTOCOL
31116 packet_unit_server_side_agent_set_100_fields fields;
31117 struct packet_unit_server_side_agent_set *old;
31118 struct genhash **hash = pc->phs.received + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
31119#endif /* FREECIV_DELTA_PROTOCOL */
31120 RECEIVE_PACKET_START(packet_unit_server_side_agent_set, real_packet);
31121#ifdef FREECIV_JSON_CONNECTION
31122 struct plocation field_addr;
31123 {
31124 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31125 field_addr = *field_addr_tmp;
31126 FC_FREE(field_addr_tmp);
31127 }
31128#endif /* FREECIV_JSON_CONNECTION */
31129
31130#ifdef FREECIV_DELTA_PROTOCOL
31131#ifdef FREECIV_JSON_CONNECTION
31132 field_addr.name = "fields";
31133#endif /* FREECIV_JSON_CONNECTION */
31134 DIO_BV_GET(&din, &field_addr, fields);
31135
31136#else /* FREECIV_DELTA_PROTOCOL */
31137#ifdef FREECIV_JSON_CONNECTION
31138 field_addr.name = "unit_id";
31139#endif /* FREECIV_JSON_CONNECTION */
31140 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
31141 RECEIVE_PACKET_FIELD_ERROR(unit_id);
31142 }
31143#ifdef FREECIV_JSON_CONNECTION
31144 field_addr.name = "agent";
31145#endif /* FREECIV_JSON_CONNECTION */
31146 {
31147 int readin;
31148
31149 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31150 RECEIVE_PACKET_FIELD_ERROR(agent);
31151 }
31152 real_packet->agent = readin;
31153 }
31154#endif
31155 log_packet_detailed("packet_unit_server_side_agent_set_100: got info about ()");
31156
31157#ifdef FREECIV_DELTA_PROTOCOL
31158 if (NULL == *hash) {
31159 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_100, cmp_packet_unit_server_side_agent_set_100,
31160 NULL, NULL, NULL, free);
31161 }
31162
31163 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31164 *real_packet = *old;
31165 } else {
31166 log_packet_detailed(" no old info");
31167 memset(real_packet, 0, sizeof(*real_packet));
31168 }
31169
31170 if (BV_ISSET(fields, 0)) {
31171 log_packet_detailed(" got field 'unit_id'");
31172#ifdef FREECIV_JSON_CONNECTION
31173 field_addr.name = "unit_id";
31174#endif /* FREECIV_JSON_CONNECTION */
31175 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
31176 RECEIVE_PACKET_FIELD_ERROR(unit_id);
31177 }
31178 }
31179 if (BV_ISSET(fields, 1)) {
31180 log_packet_detailed(" got field 'agent'");
31181#ifdef FREECIV_JSON_CONNECTION
31182 field_addr.name = "agent";
31183#endif /* FREECIV_JSON_CONNECTION */
31184 {
31185 int readin;
31186
31187 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31188 RECEIVE_PACKET_FIELD_ERROR(agent);
31189 }
31190 real_packet->agent = readin;
31191 }
31192 }
31193
31194 if (NULL == old) {
31195 old = fc_malloc(sizeof(*old));
31196 *old = *real_packet;
31197 genhash_insert(*hash, old, old);
31198 } else {
31199 *old = *real_packet;
31200 }
31201
31202#endif /* FREECIV_DELTA_PROTOCOL */
31203 RECEIVE_PACKET_END(real_packet);
31204}
31205
31206 static int send_packet_unit_server_side_agent_set_100(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
31207{
31208 const struct packet_unit_server_side_agent_set *real_packet = packet;
31209 int e;
31210#ifdef FREECIV_DELTA_PROTOCOL
31211 packet_unit_server_side_agent_set_100_fields fields;
31212 struct packet_unit_server_side_agent_set *old;
31213 bool differ;
31214 struct genhash **hash = pc->phs.sent + PACKET_UNIT_SERVER_SIDE_AGENT_SET;
31215#endif /* FREECIV_DELTA_PROTOCOL */
31216 SEND_PACKET_START(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
31217#ifdef FREECIV_JSON_CONNECTION
31218 struct plocation field_addr;
31219 {
31220 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31221 field_addr = *field_addr_tmp;
31222 FC_FREE(field_addr_tmp);
31223 }
31224#endif /* FREECIV_JSON_CONNECTION */
31225
31226 log_packet_detailed("packet_unit_server_side_agent_set_100: sending info about ()");
31227
31228#ifdef FREECIV_DELTA_PROTOCOL
31229 if (NULL == *hash) {
31230 *hash = genhash_new_full(hash_packet_unit_server_side_agent_set_100, cmp_packet_unit_server_side_agent_set_100,
31231 NULL, NULL, NULL, free);
31232 }
31233 BV_CLR_ALL(fields);
31234
31235 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31236 old = fc_malloc(sizeof(*old));
31237 *old = *real_packet;
31238 genhash_insert(*hash, old, old);
31239 memset(old, 0, sizeof(*old));
31240 }
31241 differ = (old->unit_id != real_packet->unit_id);
31242 if (differ) {
31243 BV_SET(fields, 0);
31244 }
31245
31246 differ = (old->agent != real_packet->agent);
31247 if (differ) {
31248 BV_SET(fields, 1);
31249 }
31250
31251
31252#ifdef FREECIV_JSON_CONNECTION
31253 field_addr.name = "fields";
31254#endif /* FREECIV_JSON_CONNECTION */
31255 e = 0;
31256 e |= DIO_BV_PUT(&dout, &field_addr, fields);
31257 if (e) {
31258 log_packet_detailed("fields bitvector error detected");
31259 }
31260
31261 if (BV_ISSET(fields, 0)) {
31262 log_packet_detailed(" field 'unit_id' has changed");
31263#ifdef FREECIV_JSON_CONNECTION
31264 field_addr.name = "unit_id";
31265#endif /* FREECIV_JSON_CONNECTION */
31266 e = 0;
31267 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
31268 if (e) {
31269 log_packet_detailed("'unit_id' field error detected");
31270 }
31271 }
31272 if (BV_ISSET(fields, 1)) {
31273 log_packet_detailed(" field 'agent' has changed");
31274#ifdef FREECIV_JSON_CONNECTION
31275 field_addr.name = "agent";
31276#endif /* FREECIV_JSON_CONNECTION */
31277 e = 0;
31278 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
31279 if (e) {
31280 log_packet_detailed("'agent' field error detected");
31281 }
31282 }
31283
31284 *old = *real_packet;
31285#endif /* FREECIV_DELTA_PROTOCOL */
31286#ifndef FREECIV_DELTA_PROTOCOL
31287#ifdef FREECIV_JSON_CONNECTION
31288 field_addr.name = "unit_id";
31289#endif /* FREECIV_JSON_CONNECTION */
31290 e = 0;
31291 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
31292 if (e) {
31293 log_packet_detailed("'unit_id' field error detected");
31294 }
31295#ifdef FREECIV_JSON_CONNECTION
31296 field_addr.name = "agent";
31297#endif /* FREECIV_JSON_CONNECTION */
31298 e = 0;
31299 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->agent);
31300 if (e) {
31301 log_packet_detailed("'agent' field error detected");
31302 }
31303
31304#endif
31305 SEND_PACKET_END(PACKET_UNIT_SERVER_SIDE_AGENT_SET);
31306}
31307
31308 int send_packet_unit_server_side_agent_set(struct connection *pc, const struct packet_unit_server_side_agent_set *packet)
31309{
31310 if (!pc->used) {
31311 log_error("WARNING: trying to send data to the closed connection %s",
31312 conn_description(pc));
31313 return -1;
31314 }
31315 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet != NULL, -1,
31316 "Handler for PACKET_UNIT_SERVER_SIDE_AGENT_SET not installed");
31317 return pc->phs.handlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet(pc, packet);
31318}
31319
31320 int dsend_packet_unit_server_side_agent_set(struct connection *pc, int unit_id, enum server_side_agent agent)
31321{
31322 struct packet_unit_server_side_agent_set packet, *real_packet = &packet;
31323
31324 real_packet->unit_id = unit_id;
31325 real_packet->agent = agent;
31326
31327 return send_packet_unit_server_side_agent_set(pc, real_packet);
31328}
31329
31330#ifdef FREECIV_DELTA_PROTOCOL
31331#define hash_packet_unit_action_query_100 hash_const
31332
31333#define cmp_packet_unit_action_query_100 cmp_const
31334
31335 BV_DEFINE(packet_unit_action_query_100_fields, 4);
31336#endif /* FREECIV_DELTA_PROTOCOL */
31337
31338 static struct packet_unit_action_query *receive_packet_unit_action_query_100(struct connection *pc)
31339{
31340#ifdef FREECIV_DELTA_PROTOCOL
31341 packet_unit_action_query_100_fields fields;
31342 struct packet_unit_action_query *old;
31343 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_QUERY;
31344#endif /* FREECIV_DELTA_PROTOCOL */
31345 RECEIVE_PACKET_START(packet_unit_action_query, real_packet);
31346#ifdef FREECIV_JSON_CONNECTION
31347 struct plocation field_addr;
31348 {
31349 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31350 field_addr = *field_addr_tmp;
31351 FC_FREE(field_addr_tmp);
31352 }
31353#endif /* FREECIV_JSON_CONNECTION */
31354
31355#ifdef FREECIV_DELTA_PROTOCOL
31356#ifdef FREECIV_JSON_CONNECTION
31357 field_addr.name = "fields";
31358#endif /* FREECIV_JSON_CONNECTION */
31359 DIO_BV_GET(&din, &field_addr, fields);
31360
31361#else /* FREECIV_DELTA_PROTOCOL */
31362#ifdef FREECIV_JSON_CONNECTION
31363 field_addr.name = "actor_id";
31364#endif /* FREECIV_JSON_CONNECTION */
31365 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
31366 RECEIVE_PACKET_FIELD_ERROR(actor_id);
31367 }
31368#ifdef FREECIV_JSON_CONNECTION
31369 field_addr.name = "target_id";
31370#endif /* FREECIV_JSON_CONNECTION */
31371 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
31372 RECEIVE_PACKET_FIELD_ERROR(target_id);
31373 }
31374#ifdef FREECIV_JSON_CONNECTION
31375 field_addr.name = "action_type";
31376#endif /* FREECIV_JSON_CONNECTION */
31377 {
31378 int readin;
31379
31380 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31381 RECEIVE_PACKET_FIELD_ERROR(action_type);
31382 }
31383 real_packet->action_type = readin;
31384 }
31385#ifdef FREECIV_JSON_CONNECTION
31386 field_addr.name = "request_kind";
31387#endif /* FREECIV_JSON_CONNECTION */
31388 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
31389 RECEIVE_PACKET_FIELD_ERROR(request_kind);
31390 }
31391#endif
31392 log_packet_detailed("packet_unit_action_query_100: got info about ()");
31393
31394#ifdef FREECIV_DELTA_PROTOCOL
31395 if (NULL == *hash) {
31396 *hash = genhash_new_full(hash_packet_unit_action_query_100, cmp_packet_unit_action_query_100,
31397 NULL, NULL, NULL, free);
31398 }
31399
31400 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31401 *real_packet = *old;
31402 } else {
31403 log_packet_detailed(" no old info");
31404 memset(real_packet, 0, sizeof(*real_packet));
31405 }
31406
31407 if (BV_ISSET(fields, 0)) {
31408 log_packet_detailed(" got field 'actor_id'");
31409#ifdef FREECIV_JSON_CONNECTION
31410 field_addr.name = "actor_id";
31411#endif /* FREECIV_JSON_CONNECTION */
31412 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
31413 RECEIVE_PACKET_FIELD_ERROR(actor_id);
31414 }
31415 }
31416 if (BV_ISSET(fields, 1)) {
31417 log_packet_detailed(" got field 'target_id'");
31418#ifdef FREECIV_JSON_CONNECTION
31419 field_addr.name = "target_id";
31420#endif /* FREECIV_JSON_CONNECTION */
31421 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
31422 RECEIVE_PACKET_FIELD_ERROR(target_id);
31423 }
31424 }
31425 if (BV_ISSET(fields, 2)) {
31426 log_packet_detailed(" got field 'action_type'");
31427#ifdef FREECIV_JSON_CONNECTION
31428 field_addr.name = "action_type";
31429#endif /* FREECIV_JSON_CONNECTION */
31430 {
31431 int readin;
31432
31433 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31434 RECEIVE_PACKET_FIELD_ERROR(action_type);
31435 }
31436 real_packet->action_type = readin;
31437 }
31438 }
31439 if (BV_ISSET(fields, 3)) {
31440 log_packet_detailed(" got field 'request_kind'");
31441#ifdef FREECIV_JSON_CONNECTION
31442 field_addr.name = "request_kind";
31443#endif /* FREECIV_JSON_CONNECTION */
31444 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
31445 RECEIVE_PACKET_FIELD_ERROR(request_kind);
31446 }
31447 }
31448
31449 if (NULL == old) {
31450 old = fc_malloc(sizeof(*old));
31451 *old = *real_packet;
31452 genhash_insert(*hash, old, old);
31453 } else {
31454 *old = *real_packet;
31455 }
31456
31457#endif /* FREECIV_DELTA_PROTOCOL */
31458 RECEIVE_PACKET_END(real_packet);
31459}
31460
31461 static int send_packet_unit_action_query_100(struct connection *pc, const struct packet_unit_action_query *packet)
31462{
31463 const struct packet_unit_action_query *real_packet = packet;
31464 int e;
31465#ifdef FREECIV_DELTA_PROTOCOL
31466 packet_unit_action_query_100_fields fields;
31467 struct packet_unit_action_query *old;
31468 bool differ;
31469 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_QUERY;
31470#endif /* FREECIV_DELTA_PROTOCOL */
31471 SEND_PACKET_START(PACKET_UNIT_ACTION_QUERY);
31472#ifdef FREECIV_JSON_CONNECTION
31473 struct plocation field_addr;
31474 {
31475 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31476 field_addr = *field_addr_tmp;
31477 FC_FREE(field_addr_tmp);
31478 }
31479#endif /* FREECIV_JSON_CONNECTION */
31480
31481 log_packet_detailed("packet_unit_action_query_100: sending info about ()");
31482
31483#ifdef FREECIV_DELTA_PROTOCOL
31484 if (NULL == *hash) {
31485 *hash = genhash_new_full(hash_packet_unit_action_query_100, cmp_packet_unit_action_query_100,
31486 NULL, NULL, NULL, free);
31487 }
31488 BV_CLR_ALL(fields);
31489
31490 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31491 old = fc_malloc(sizeof(*old));
31492 *old = *real_packet;
31493 genhash_insert(*hash, old, old);
31494 memset(old, 0, sizeof(*old));
31495 }
31496 differ = (old->actor_id != real_packet->actor_id);
31497 if (differ) {
31498 BV_SET(fields, 0);
31499 }
31500
31501 differ = (old->target_id != real_packet->target_id);
31502 if (differ) {
31503 BV_SET(fields, 1);
31504 }
31505
31506 differ = (old->action_type != real_packet->action_type);
31507 if (differ) {
31508 BV_SET(fields, 2);
31509 }
31510
31511 differ = (old->request_kind != real_packet->request_kind);
31512 if (differ) {
31513 BV_SET(fields, 3);
31514 }
31515
31516
31517#ifdef FREECIV_JSON_CONNECTION
31518 field_addr.name = "fields";
31519#endif /* FREECIV_JSON_CONNECTION */
31520 e = 0;
31521 e |= DIO_BV_PUT(&dout, &field_addr, fields);
31522 if (e) {
31523 log_packet_detailed("fields bitvector error detected");
31524 }
31525
31526 if (BV_ISSET(fields, 0)) {
31527 log_packet_detailed(" field 'actor_id' has changed");
31528#ifdef FREECIV_JSON_CONNECTION
31529 field_addr.name = "actor_id";
31530#endif /* FREECIV_JSON_CONNECTION */
31531 e = 0;
31532 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
31533 if (e) {
31534 log_packet_detailed("'actor_id' field error detected");
31535 }
31536 }
31537 if (BV_ISSET(fields, 1)) {
31538 log_packet_detailed(" field 'target_id' has changed");
31539#ifdef FREECIV_JSON_CONNECTION
31540 field_addr.name = "target_id";
31541#endif /* FREECIV_JSON_CONNECTION */
31542 e = 0;
31543 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
31544 if (e) {
31545 log_packet_detailed("'target_id' field error detected");
31546 }
31547 }
31548 if (BV_ISSET(fields, 2)) {
31549 log_packet_detailed(" field 'action_type' has changed");
31550#ifdef FREECIV_JSON_CONNECTION
31551 field_addr.name = "action_type";
31552#endif /* FREECIV_JSON_CONNECTION */
31553 e = 0;
31554 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
31555 if (e) {
31556 log_packet_detailed("'action_type' field error detected");
31557 }
31558 }
31559 if (BV_ISSET(fields, 3)) {
31560 log_packet_detailed(" field 'request_kind' has changed");
31561#ifdef FREECIV_JSON_CONNECTION
31562 field_addr.name = "request_kind";
31563#endif /* FREECIV_JSON_CONNECTION */
31564 e = 0;
31565 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
31566 if (e) {
31567 log_packet_detailed("'request_kind' field error detected");
31568 }
31569 }
31570
31571 *old = *real_packet;
31572#endif /* FREECIV_DELTA_PROTOCOL */
31573#ifndef FREECIV_DELTA_PROTOCOL
31574#ifdef FREECIV_JSON_CONNECTION
31575 field_addr.name = "actor_id";
31576#endif /* FREECIV_JSON_CONNECTION */
31577 e = 0;
31578 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
31579 if (e) {
31580 log_packet_detailed("'actor_id' field error detected");
31581 }
31582#ifdef FREECIV_JSON_CONNECTION
31583 field_addr.name = "target_id";
31584#endif /* FREECIV_JSON_CONNECTION */
31585 e = 0;
31586 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
31587 if (e) {
31588 log_packet_detailed("'target_id' field error detected");
31589 }
31590#ifdef FREECIV_JSON_CONNECTION
31591 field_addr.name = "action_type";
31592#endif /* FREECIV_JSON_CONNECTION */
31593 e = 0;
31594 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
31595 if (e) {
31596 log_packet_detailed("'action_type' field error detected");
31597 }
31598#ifdef FREECIV_JSON_CONNECTION
31599 field_addr.name = "request_kind";
31600#endif /* FREECIV_JSON_CONNECTION */
31601 e = 0;
31602 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
31603 if (e) {
31604 log_packet_detailed("'request_kind' field error detected");
31605 }
31606
31607#endif
31608 SEND_PACKET_END(PACKET_UNIT_ACTION_QUERY);
31609}
31610
31611 int send_packet_unit_action_query(struct connection *pc, const struct packet_unit_action_query *packet)
31612{
31613 if (!pc->used) {
31614 log_error("WARNING: trying to send data to the closed connection %s",
31615 conn_description(pc));
31616 return -1;
31617 }
31618 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTION_QUERY].packet != NULL, -1,
31619 "Handler for PACKET_UNIT_ACTION_QUERY not installed");
31620 return pc->phs.handlers->send[PACKET_UNIT_ACTION_QUERY].packet(pc, packet);
31621}
31622
31623 int dsend_packet_unit_action_query(struct connection *pc, int actor_id, int target_id, action_id action_type, int request_kind)
31624{
31625 struct packet_unit_action_query packet, *real_packet = &packet;
31626
31627 real_packet->actor_id = actor_id;
31628 real_packet->target_id = target_id;
31629 real_packet->action_type = action_type;
31630 real_packet->request_kind = request_kind;
31631
31632 return send_packet_unit_action_query(pc, real_packet);
31633}
31634
31635#ifdef FREECIV_DELTA_PROTOCOL
31636#define hash_packet_unit_type_upgrade_100 hash_const
31637
31638#define cmp_packet_unit_type_upgrade_100 cmp_const
31639
31640 BV_DEFINE(packet_unit_type_upgrade_100_fields, 1);
31641#endif /* FREECIV_DELTA_PROTOCOL */
31642
31643 static struct packet_unit_type_upgrade *receive_packet_unit_type_upgrade_100(struct connection *pc)
31644{
31645#ifdef FREECIV_DELTA_PROTOCOL
31646 packet_unit_type_upgrade_100_fields fields;
31647 struct packet_unit_type_upgrade *old;
31648 struct genhash **hash = pc->phs.received + PACKET_UNIT_TYPE_UPGRADE;
31649#endif /* FREECIV_DELTA_PROTOCOL */
31650 RECEIVE_PACKET_START(packet_unit_type_upgrade, real_packet);
31651#ifdef FREECIV_JSON_CONNECTION
31652 struct plocation field_addr;
31653 {
31654 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31655 field_addr = *field_addr_tmp;
31656 FC_FREE(field_addr_tmp);
31657 }
31658#endif /* FREECIV_JSON_CONNECTION */
31659
31660#ifdef FREECIV_DELTA_PROTOCOL
31661#ifdef FREECIV_JSON_CONNECTION
31662 field_addr.name = "fields";
31663#endif /* FREECIV_JSON_CONNECTION */
31664 DIO_BV_GET(&din, &field_addr, fields);
31665
31666#else /* FREECIV_DELTA_PROTOCOL */
31667#ifdef FREECIV_JSON_CONNECTION
31668 field_addr.name = "type";
31669#endif /* FREECIV_JSON_CONNECTION */
31670 {
31671 int readin;
31672
31673 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31674 RECEIVE_PACKET_FIELD_ERROR(type);
31675 }
31676 real_packet->type = readin;
31677 }
31678#endif
31679 log_packet_detailed("packet_unit_type_upgrade_100: got info about ()");
31680
31681#ifdef FREECIV_DELTA_PROTOCOL
31682 if (NULL == *hash) {
31683 *hash = genhash_new_full(hash_packet_unit_type_upgrade_100, cmp_packet_unit_type_upgrade_100,
31684 NULL, NULL, NULL, free);
31685 }
31686
31687 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31688 *real_packet = *old;
31689 } else {
31690 log_packet_detailed(" no old info");
31691 memset(real_packet, 0, sizeof(*real_packet));
31692 }
31693
31694 if (BV_ISSET(fields, 0)) {
31695 log_packet_detailed(" got field 'type'");
31696#ifdef FREECIV_JSON_CONNECTION
31697 field_addr.name = "type";
31698#endif /* FREECIV_JSON_CONNECTION */
31699 {
31700 int readin;
31701
31702 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31703 RECEIVE_PACKET_FIELD_ERROR(type);
31704 }
31705 real_packet->type = readin;
31706 }
31707 }
31708
31709 if (NULL == old) {
31710 old = fc_malloc(sizeof(*old));
31711 *old = *real_packet;
31712 genhash_insert(*hash, old, old);
31713 } else {
31714 *old = *real_packet;
31715 }
31716
31717#endif /* FREECIV_DELTA_PROTOCOL */
31718 RECEIVE_PACKET_END(real_packet);
31719}
31720
31721 static int send_packet_unit_type_upgrade_100(struct connection *pc, const struct packet_unit_type_upgrade *packet)
31722{
31723 const struct packet_unit_type_upgrade *real_packet = packet;
31724 int e;
31725#ifdef FREECIV_DELTA_PROTOCOL
31726 packet_unit_type_upgrade_100_fields fields;
31727 struct packet_unit_type_upgrade *old;
31728 bool differ;
31729 struct genhash **hash = pc->phs.sent + PACKET_UNIT_TYPE_UPGRADE;
31730#endif /* FREECIV_DELTA_PROTOCOL */
31731 SEND_PACKET_START(PACKET_UNIT_TYPE_UPGRADE);
31732#ifdef FREECIV_JSON_CONNECTION
31733 struct plocation field_addr;
31734 {
31735 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31736 field_addr = *field_addr_tmp;
31737 FC_FREE(field_addr_tmp);
31738 }
31739#endif /* FREECIV_JSON_CONNECTION */
31740
31741 log_packet_detailed("packet_unit_type_upgrade_100: sending info about ()");
31742
31743#ifdef FREECIV_DELTA_PROTOCOL
31744 if (NULL == *hash) {
31745 *hash = genhash_new_full(hash_packet_unit_type_upgrade_100, cmp_packet_unit_type_upgrade_100,
31746 NULL, NULL, NULL, free);
31747 }
31748 BV_CLR_ALL(fields);
31749
31750 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31751 old = fc_malloc(sizeof(*old));
31752 *old = *real_packet;
31753 genhash_insert(*hash, old, old);
31754 memset(old, 0, sizeof(*old));
31755 }
31756 differ = (old->type != real_packet->type);
31757 if (differ) {
31758 BV_SET(fields, 0);
31759 }
31760
31761
31762#ifdef FREECIV_JSON_CONNECTION
31763 field_addr.name = "fields";
31764#endif /* FREECIV_JSON_CONNECTION */
31765 e = 0;
31766 e |= DIO_BV_PUT(&dout, &field_addr, fields);
31767 if (e) {
31768 log_packet_detailed("fields bitvector error detected");
31769 }
31770
31771 if (BV_ISSET(fields, 0)) {
31772 log_packet_detailed(" field 'type' has changed");
31773#ifdef FREECIV_JSON_CONNECTION
31774 field_addr.name = "type";
31775#endif /* FREECIV_JSON_CONNECTION */
31776 e = 0;
31777 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
31778 if (e) {
31779 log_packet_detailed("'type' field error detected");
31780 }
31781 }
31782
31783 *old = *real_packet;
31784#endif /* FREECIV_DELTA_PROTOCOL */
31785#ifndef FREECIV_DELTA_PROTOCOL
31786#ifdef FREECIV_JSON_CONNECTION
31787 field_addr.name = "type";
31788#endif /* FREECIV_JSON_CONNECTION */
31789 e = 0;
31790 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
31791 if (e) {
31792 log_packet_detailed("'type' field error detected");
31793 }
31794
31795#endif
31796 SEND_PACKET_END(PACKET_UNIT_TYPE_UPGRADE);
31797}
31798
31799 int send_packet_unit_type_upgrade(struct connection *pc, const struct packet_unit_type_upgrade *packet)
31800{
31801 if (!pc->used) {
31802 log_error("WARNING: trying to send data to the closed connection %s",
31803 conn_description(pc));
31804 return -1;
31805 }
31806 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_TYPE_UPGRADE].packet != NULL, -1,
31807 "Handler for PACKET_UNIT_TYPE_UPGRADE not installed");
31808 return pc->phs.handlers->send[PACKET_UNIT_TYPE_UPGRADE].packet(pc, packet);
31809}
31810
31811 int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
31812{
31813 struct packet_unit_type_upgrade packet, *real_packet = &packet;
31814
31815 real_packet->type = type;
31816
31817 return send_packet_unit_type_upgrade(pc, real_packet);
31818}
31819
31820#ifdef FREECIV_DELTA_PROTOCOL
31821#define hash_packet_unit_do_action_100 hash_const
31822
31823#define cmp_packet_unit_do_action_100 cmp_const
31824
31825 BV_DEFINE(packet_unit_do_action_100_fields, 5);
31826#endif /* FREECIV_DELTA_PROTOCOL */
31827
31828 static struct packet_unit_do_action *receive_packet_unit_do_action_100(struct connection *pc)
31829{
31830#ifdef FREECIV_DELTA_PROTOCOL
31831 packet_unit_do_action_100_fields fields;
31832 struct packet_unit_do_action *old;
31833 struct genhash **hash = pc->phs.received + PACKET_UNIT_DO_ACTION;
31834#endif /* FREECIV_DELTA_PROTOCOL */
31835 RECEIVE_PACKET_START(packet_unit_do_action, real_packet);
31836#ifdef FREECIV_JSON_CONNECTION
31837 struct plocation field_addr;
31838 {
31839 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31840 field_addr = *field_addr_tmp;
31841 FC_FREE(field_addr_tmp);
31842 }
31843#endif /* FREECIV_JSON_CONNECTION */
31844
31845#ifdef FREECIV_DELTA_PROTOCOL
31846#ifdef FREECIV_JSON_CONNECTION
31847 field_addr.name = "fields";
31848#endif /* FREECIV_JSON_CONNECTION */
31849 DIO_BV_GET(&din, &field_addr, fields);
31850
31851#else /* FREECIV_DELTA_PROTOCOL */
31852#ifdef FREECIV_JSON_CONNECTION
31853 field_addr.name = "actor_id";
31854#endif /* FREECIV_JSON_CONNECTION */
31855 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
31856 RECEIVE_PACKET_FIELD_ERROR(actor_id);
31857 }
31858#ifdef FREECIV_JSON_CONNECTION
31859 field_addr.name = "target_id";
31860#endif /* FREECIV_JSON_CONNECTION */
31861 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
31862 RECEIVE_PACKET_FIELD_ERROR(target_id);
31863 }
31864#ifdef FREECIV_JSON_CONNECTION
31865 field_addr.name = "sub_tgt_id";
31866#endif /* FREECIV_JSON_CONNECTION */
31867 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
31868 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
31869 }
31870#ifdef FREECIV_JSON_CONNECTION
31871 field_addr.name = "name";
31872#endif /* FREECIV_JSON_CONNECTION */
31873 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
31874 RECEIVE_PACKET_FIELD_ERROR(name);
31875 }
31876#ifdef FREECIV_JSON_CONNECTION
31877 field_addr.name = "action_type";
31878#endif /* FREECIV_JSON_CONNECTION */
31879 {
31880 int readin;
31881
31882 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31883 RECEIVE_PACKET_FIELD_ERROR(action_type);
31884 }
31885 real_packet->action_type = readin;
31886 }
31887#endif
31888 log_packet_detailed("packet_unit_do_action_100: got info about ()");
31889
31890#ifdef FREECIV_DELTA_PROTOCOL
31891 if (NULL == *hash) {
31892 *hash = genhash_new_full(hash_packet_unit_do_action_100, cmp_packet_unit_do_action_100,
31893 NULL, NULL, NULL, free);
31894 }
31895
31896 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
31897 *real_packet = *old;
31898 } else {
31899 log_packet_detailed(" no old info");
31900 memset(real_packet, 0, sizeof(*real_packet));
31901 }
31902
31903 if (BV_ISSET(fields, 0)) {
31904 log_packet_detailed(" got field 'actor_id'");
31905#ifdef FREECIV_JSON_CONNECTION
31906 field_addr.name = "actor_id";
31907#endif /* FREECIV_JSON_CONNECTION */
31908 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
31909 RECEIVE_PACKET_FIELD_ERROR(actor_id);
31910 }
31911 }
31912 if (BV_ISSET(fields, 1)) {
31913 log_packet_detailed(" got field 'target_id'");
31914#ifdef FREECIV_JSON_CONNECTION
31915 field_addr.name = "target_id";
31916#endif /* FREECIV_JSON_CONNECTION */
31917 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
31918 RECEIVE_PACKET_FIELD_ERROR(target_id);
31919 }
31920 }
31921 if (BV_ISSET(fields, 2)) {
31922 log_packet_detailed(" got field 'sub_tgt_id'");
31923#ifdef FREECIV_JSON_CONNECTION
31924 field_addr.name = "sub_tgt_id";
31925#endif /* FREECIV_JSON_CONNECTION */
31926 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->sub_tgt_id)) {
31927 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_id);
31928 }
31929 }
31930 if (BV_ISSET(fields, 3)) {
31931 log_packet_detailed(" got field 'name'");
31932#ifdef FREECIV_JSON_CONNECTION
31933 field_addr.name = "name";
31934#endif /* FREECIV_JSON_CONNECTION */
31935 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
31936 RECEIVE_PACKET_FIELD_ERROR(name);
31937 }
31938 }
31939 if (BV_ISSET(fields, 4)) {
31940 log_packet_detailed(" got field 'action_type'");
31941#ifdef FREECIV_JSON_CONNECTION
31942 field_addr.name = "action_type";
31943#endif /* FREECIV_JSON_CONNECTION */
31944 {
31945 int readin;
31946
31947 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
31948 RECEIVE_PACKET_FIELD_ERROR(action_type);
31949 }
31950 real_packet->action_type = readin;
31951 }
31952 }
31953
31954 if (NULL == old) {
31955 old = fc_malloc(sizeof(*old));
31956 *old = *real_packet;
31957 genhash_insert(*hash, old, old);
31958 } else {
31959 *old = *real_packet;
31960 }
31961
31962#endif /* FREECIV_DELTA_PROTOCOL */
31963 RECEIVE_PACKET_END(real_packet);
31964}
31965
31966 static int send_packet_unit_do_action_100(struct connection *pc, const struct packet_unit_do_action *packet)
31967{
31968 const struct packet_unit_do_action *real_packet = packet;
31969 int e;
31970#ifdef FREECIV_DELTA_PROTOCOL
31971 packet_unit_do_action_100_fields fields;
31972 struct packet_unit_do_action *old;
31973 bool differ;
31974 struct genhash **hash = pc->phs.sent + PACKET_UNIT_DO_ACTION;
31975#endif /* FREECIV_DELTA_PROTOCOL */
31976 SEND_PACKET_START(PACKET_UNIT_DO_ACTION);
31977#ifdef FREECIV_JSON_CONNECTION
31978 struct plocation field_addr;
31979 {
31980 struct plocation *field_addr_tmp = plocation_field_new(NULL);
31981 field_addr = *field_addr_tmp;
31982 FC_FREE(field_addr_tmp);
31983 }
31984#endif /* FREECIV_JSON_CONNECTION */
31985
31986 log_packet_detailed("packet_unit_do_action_100: sending info about ()");
31987
31988#ifdef FREECIV_DELTA_PROTOCOL
31989 if (NULL == *hash) {
31990 *hash = genhash_new_full(hash_packet_unit_do_action_100, cmp_packet_unit_do_action_100,
31991 NULL, NULL, NULL, free);
31992 }
31993 BV_CLR_ALL(fields);
31994
31995 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
31996 old = fc_malloc(sizeof(*old));
31997 *old = *real_packet;
31998 genhash_insert(*hash, old, old);
31999 memset(old, 0, sizeof(*old));
32000 }
32001 differ = (old->actor_id != real_packet->actor_id);
32002 if (differ) {
32003 BV_SET(fields, 0);
32004 }
32005
32006 differ = (old->target_id != real_packet->target_id);
32007 if (differ) {
32008 BV_SET(fields, 1);
32009 }
32010
32011 differ = (old->sub_tgt_id != real_packet->sub_tgt_id);
32012 if (differ) {
32013 BV_SET(fields, 2);
32014 }
32015
32016 differ = (strcmp(old->name, real_packet->name) != 0);
32017 if (differ) {
32018 BV_SET(fields, 3);
32019 }
32020
32021 differ = (old->action_type != real_packet->action_type);
32022 if (differ) {
32023 BV_SET(fields, 4);
32024 }
32025
32026
32027#ifdef FREECIV_JSON_CONNECTION
32028 field_addr.name = "fields";
32029#endif /* FREECIV_JSON_CONNECTION */
32030 e = 0;
32031 e |= DIO_BV_PUT(&dout, &field_addr, fields);
32032 if (e) {
32033 log_packet_detailed("fields bitvector error detected");
32034 }
32035
32036 if (BV_ISSET(fields, 0)) {
32037 log_packet_detailed(" field 'actor_id' has changed");
32038#ifdef FREECIV_JSON_CONNECTION
32039 field_addr.name = "actor_id";
32040#endif /* FREECIV_JSON_CONNECTION */
32041 e = 0;
32042 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32043 if (e) {
32044 log_packet_detailed("'actor_id' field error detected");
32045 }
32046 }
32047 if (BV_ISSET(fields, 1)) {
32048 log_packet_detailed(" field 'target_id' has changed");
32049#ifdef FREECIV_JSON_CONNECTION
32050 field_addr.name = "target_id";
32051#endif /* FREECIV_JSON_CONNECTION */
32052 e = 0;
32053 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32054 if (e) {
32055 log_packet_detailed("'target_id' field error detected");
32056 }
32057 }
32058 if (BV_ISSET(fields, 2)) {
32059 log_packet_detailed(" field 'sub_tgt_id' has changed");
32060#ifdef FREECIV_JSON_CONNECTION
32061 field_addr.name = "sub_tgt_id";
32062#endif /* FREECIV_JSON_CONNECTION */
32063 e = 0;
32064 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
32065 if (e) {
32066 log_packet_detailed("'sub_tgt_id' field error detected");
32067 }
32068 }
32069 if (BV_ISSET(fields, 3)) {
32070 log_packet_detailed(" field 'name' has changed");
32071#ifdef FREECIV_JSON_CONNECTION
32072 field_addr.name = "name";
32073#endif /* FREECIV_JSON_CONNECTION */
32074 e = 0;
32075 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
32076 if (e) {
32077 log_packet_detailed("'name' field error detected");
32078 }
32079 }
32080 if (BV_ISSET(fields, 4)) {
32081 log_packet_detailed(" field 'action_type' has changed");
32082#ifdef FREECIV_JSON_CONNECTION
32083 field_addr.name = "action_type";
32084#endif /* FREECIV_JSON_CONNECTION */
32085 e = 0;
32086 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32087 if (e) {
32088 log_packet_detailed("'action_type' field error detected");
32089 }
32090 }
32091
32092 *old = *real_packet;
32093#endif /* FREECIV_DELTA_PROTOCOL */
32094#ifndef FREECIV_DELTA_PROTOCOL
32095#ifdef FREECIV_JSON_CONNECTION
32096 field_addr.name = "actor_id";
32097#endif /* FREECIV_JSON_CONNECTION */
32098 e = 0;
32099 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32100 if (e) {
32101 log_packet_detailed("'actor_id' field error detected");
32102 }
32103#ifdef FREECIV_JSON_CONNECTION
32104 field_addr.name = "target_id";
32105#endif /* FREECIV_JSON_CONNECTION */
32106 e = 0;
32107 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32108 if (e) {
32109 log_packet_detailed("'target_id' field error detected");
32110 }
32111#ifdef FREECIV_JSON_CONNECTION
32112 field_addr.name = "sub_tgt_id";
32113#endif /* FREECIV_JSON_CONNECTION */
32114 e = 0;
32115 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->sub_tgt_id);
32116 if (e) {
32117 log_packet_detailed("'sub_tgt_id' field error detected");
32118 }
32119#ifdef FREECIV_JSON_CONNECTION
32120 field_addr.name = "name";
32121#endif /* FREECIV_JSON_CONNECTION */
32122 e = 0;
32123 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
32124 if (e) {
32125 log_packet_detailed("'name' field error detected");
32126 }
32127#ifdef FREECIV_JSON_CONNECTION
32128 field_addr.name = "action_type";
32129#endif /* FREECIV_JSON_CONNECTION */
32130 e = 0;
32131 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32132 if (e) {
32133 log_packet_detailed("'action_type' field error detected");
32134 }
32135
32136#endif
32137 SEND_PACKET_END(PACKET_UNIT_DO_ACTION);
32138}
32139
32140 int send_packet_unit_do_action(struct connection *pc, const struct packet_unit_do_action *packet)
32141{
32142 if (!pc->used) {
32143 log_error("WARNING: trying to send data to the closed connection %s",
32144 conn_description(pc));
32145 return -1;
32146 }
32147 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_DO_ACTION].packet != NULL, -1,
32148 "Handler for PACKET_UNIT_DO_ACTION not installed");
32149 return pc->phs.handlers->send[PACKET_UNIT_DO_ACTION].packet(pc, packet);
32150}
32151
32152 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)
32153{
32154 struct packet_unit_do_action packet, *real_packet = &packet;
32155
32156 real_packet->actor_id = actor_id;
32157 real_packet->target_id = target_id;
32158 real_packet->sub_tgt_id = sub_tgt_id;
32159 sz_strlcpy(real_packet->name, name);
32160 real_packet->action_type = action_type;
32161
32162 return send_packet_unit_do_action(pc, real_packet);
32163}
32164
32165#ifdef FREECIV_DELTA_PROTOCOL
32166#define hash_packet_unit_action_answer_100 hash_const
32167
32168#define cmp_packet_unit_action_answer_100 cmp_const
32169
32170 BV_DEFINE(packet_unit_action_answer_100_fields, 5);
32171#endif /* FREECIV_DELTA_PROTOCOL */
32172
32173 static struct packet_unit_action_answer *receive_packet_unit_action_answer_100(struct connection *pc)
32174{
32175#ifdef FREECIV_DELTA_PROTOCOL
32176 packet_unit_action_answer_100_fields fields;
32177 struct packet_unit_action_answer *old;
32178 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTION_ANSWER;
32179#endif /* FREECIV_DELTA_PROTOCOL */
32180 RECEIVE_PACKET_START(packet_unit_action_answer, real_packet);
32181#ifdef FREECIV_JSON_CONNECTION
32182 struct plocation field_addr;
32183 {
32184 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32185 field_addr = *field_addr_tmp;
32186 FC_FREE(field_addr_tmp);
32187 }
32188#endif /* FREECIV_JSON_CONNECTION */
32189
32190#ifdef FREECIV_DELTA_PROTOCOL
32191#ifdef FREECIV_JSON_CONNECTION
32192 field_addr.name = "fields";
32193#endif /* FREECIV_JSON_CONNECTION */
32194 DIO_BV_GET(&din, &field_addr, fields);
32195
32196#else /* FREECIV_DELTA_PROTOCOL */
32197#ifdef FREECIV_JSON_CONNECTION
32198 field_addr.name = "actor_id";
32199#endif /* FREECIV_JSON_CONNECTION */
32200 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
32201 RECEIVE_PACKET_FIELD_ERROR(actor_id);
32202 }
32203#ifdef FREECIV_JSON_CONNECTION
32204 field_addr.name = "target_id";
32205#endif /* FREECIV_JSON_CONNECTION */
32206 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
32207 RECEIVE_PACKET_FIELD_ERROR(target_id);
32208 }
32209#ifdef FREECIV_JSON_CONNECTION
32210 field_addr.name = "cost";
32211#endif /* FREECIV_JSON_CONNECTION */
32212 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
32213 RECEIVE_PACKET_FIELD_ERROR(cost);
32214 }
32215#ifdef FREECIV_JSON_CONNECTION
32216 field_addr.name = "action_type";
32217#endif /* FREECIV_JSON_CONNECTION */
32218 {
32219 int readin;
32220
32221 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32222 RECEIVE_PACKET_FIELD_ERROR(action_type);
32223 }
32224 real_packet->action_type = readin;
32225 }
32226#ifdef FREECIV_JSON_CONNECTION
32227 field_addr.name = "request_kind";
32228#endif /* FREECIV_JSON_CONNECTION */
32229 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
32230 RECEIVE_PACKET_FIELD_ERROR(request_kind);
32231 }
32232#endif
32233 log_packet_detailed("packet_unit_action_answer_100: got info about ()");
32234
32235#ifdef FREECIV_DELTA_PROTOCOL
32236 if (NULL == *hash) {
32237 *hash = genhash_new_full(hash_packet_unit_action_answer_100, cmp_packet_unit_action_answer_100,
32238 NULL, NULL, NULL, free);
32239 }
32240
32241 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32242 *real_packet = *old;
32243 } else {
32244 log_packet_detailed(" no old info");
32245 memset(real_packet, 0, sizeof(*real_packet));
32246 }
32247
32248 if (BV_ISSET(fields, 0)) {
32249 log_packet_detailed(" got field 'actor_id'");
32250#ifdef FREECIV_JSON_CONNECTION
32251 field_addr.name = "actor_id";
32252#endif /* FREECIV_JSON_CONNECTION */
32253 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_id)) {
32254 RECEIVE_PACKET_FIELD_ERROR(actor_id);
32255 }
32256 }
32257 if (BV_ISSET(fields, 1)) {
32258 log_packet_detailed(" got field 'target_id'");
32259#ifdef FREECIV_JSON_CONNECTION
32260 field_addr.name = "target_id";
32261#endif /* FREECIV_JSON_CONNECTION */
32262 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_id)) {
32263 RECEIVE_PACKET_FIELD_ERROR(target_id);
32264 }
32265 }
32266 if (BV_ISSET(fields, 2)) {
32267 log_packet_detailed(" got field 'cost'");
32268#ifdef FREECIV_JSON_CONNECTION
32269 field_addr.name = "cost";
32270#endif /* FREECIV_JSON_CONNECTION */
32271 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->cost)) {
32272 RECEIVE_PACKET_FIELD_ERROR(cost);
32273 }
32274 }
32275 if (BV_ISSET(fields, 3)) {
32276 log_packet_detailed(" got field 'action_type'");
32277#ifdef FREECIV_JSON_CONNECTION
32278 field_addr.name = "action_type";
32279#endif /* FREECIV_JSON_CONNECTION */
32280 {
32281 int readin;
32282
32283 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
32284 RECEIVE_PACKET_FIELD_ERROR(action_type);
32285 }
32286 real_packet->action_type = readin;
32287 }
32288 }
32289 if (BV_ISSET(fields, 4)) {
32290 log_packet_detailed(" got field 'request_kind'");
32291#ifdef FREECIV_JSON_CONNECTION
32292 field_addr.name = "request_kind";
32293#endif /* FREECIV_JSON_CONNECTION */
32294 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
32295 RECEIVE_PACKET_FIELD_ERROR(request_kind);
32296 }
32297 }
32298
32299 if (NULL == old) {
32300 old = fc_malloc(sizeof(*old));
32301 *old = *real_packet;
32302 genhash_insert(*hash, old, old);
32303 } else {
32304 *old = *real_packet;
32305 }
32306
32307#endif /* FREECIV_DELTA_PROTOCOL */
32308 RECEIVE_PACKET_END(real_packet);
32309}
32310
32311 static int send_packet_unit_action_answer_100(struct connection *pc, const struct packet_unit_action_answer *packet)
32312{
32313 const struct packet_unit_action_answer *real_packet = packet;
32314 int e;
32315#ifdef FREECIV_DELTA_PROTOCOL
32316 packet_unit_action_answer_100_fields fields;
32317 struct packet_unit_action_answer *old;
32318 bool differ;
32319 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTION_ANSWER;
32320#endif /* FREECIV_DELTA_PROTOCOL */
32321 SEND_PACKET_START(PACKET_UNIT_ACTION_ANSWER);
32322#ifdef FREECIV_JSON_CONNECTION
32323 struct plocation field_addr;
32324 {
32325 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32326 field_addr = *field_addr_tmp;
32327 FC_FREE(field_addr_tmp);
32328 }
32329#endif /* FREECIV_JSON_CONNECTION */
32330
32331 log_packet_detailed("packet_unit_action_answer_100: sending info about ()");
32332
32333#ifdef FREECIV_DELTA_PROTOCOL
32334 if (NULL == *hash) {
32335 *hash = genhash_new_full(hash_packet_unit_action_answer_100, cmp_packet_unit_action_answer_100,
32336 NULL, NULL, NULL, free);
32337 }
32338 BV_CLR_ALL(fields);
32339
32340 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32341 old = fc_malloc(sizeof(*old));
32342 *old = *real_packet;
32343 genhash_insert(*hash, old, old);
32344 memset(old, 0, sizeof(*old));
32345 }
32346 differ = (old->actor_id != real_packet->actor_id);
32347 if (differ) {
32348 BV_SET(fields, 0);
32349 }
32350
32351 differ = (old->target_id != real_packet->target_id);
32352 if (differ) {
32353 BV_SET(fields, 1);
32354 }
32355
32356 differ = (old->cost != real_packet->cost);
32357 if (differ) {
32358 BV_SET(fields, 2);
32359 }
32360
32361 differ = (old->action_type != real_packet->action_type);
32362 if (differ) {
32363 BV_SET(fields, 3);
32364 }
32365
32366 differ = (old->request_kind != real_packet->request_kind);
32367 if (differ) {
32368 BV_SET(fields, 4);
32369 }
32370
32371
32372#ifdef FREECIV_JSON_CONNECTION
32373 field_addr.name = "fields";
32374#endif /* FREECIV_JSON_CONNECTION */
32375 e = 0;
32376 e |= DIO_BV_PUT(&dout, &field_addr, fields);
32377 if (e) {
32378 log_packet_detailed("fields bitvector error detected");
32379 }
32380
32381 if (BV_ISSET(fields, 0)) {
32382 log_packet_detailed(" field 'actor_id' has changed");
32383#ifdef FREECIV_JSON_CONNECTION
32384 field_addr.name = "actor_id";
32385#endif /* FREECIV_JSON_CONNECTION */
32386 e = 0;
32387 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32388 if (e) {
32389 log_packet_detailed("'actor_id' field error detected");
32390 }
32391 }
32392 if (BV_ISSET(fields, 1)) {
32393 log_packet_detailed(" field 'target_id' has changed");
32394#ifdef FREECIV_JSON_CONNECTION
32395 field_addr.name = "target_id";
32396#endif /* FREECIV_JSON_CONNECTION */
32397 e = 0;
32398 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32399 if (e) {
32400 log_packet_detailed("'target_id' field error detected");
32401 }
32402 }
32403 if (BV_ISSET(fields, 2)) {
32404 log_packet_detailed(" field 'cost' has changed");
32405#ifdef FREECIV_JSON_CONNECTION
32406 field_addr.name = "cost";
32407#endif /* FREECIV_JSON_CONNECTION */
32408 e = 0;
32409 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
32410 if (e) {
32411 log_packet_detailed("'cost' field error detected");
32412 }
32413 }
32414 if (BV_ISSET(fields, 3)) {
32415 log_packet_detailed(" field 'action_type' has changed");
32416#ifdef FREECIV_JSON_CONNECTION
32417 field_addr.name = "action_type";
32418#endif /* FREECIV_JSON_CONNECTION */
32419 e = 0;
32420 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32421 if (e) {
32422 log_packet_detailed("'action_type' field error detected");
32423 }
32424 }
32425 if (BV_ISSET(fields, 4)) {
32426 log_packet_detailed(" field 'request_kind' has changed");
32427#ifdef FREECIV_JSON_CONNECTION
32428 field_addr.name = "request_kind";
32429#endif /* FREECIV_JSON_CONNECTION */
32430 e = 0;
32431 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
32432 if (e) {
32433 log_packet_detailed("'request_kind' field error detected");
32434 }
32435 }
32436
32437 *old = *real_packet;
32438#endif /* FREECIV_DELTA_PROTOCOL */
32439#ifndef FREECIV_DELTA_PROTOCOL
32440#ifdef FREECIV_JSON_CONNECTION
32441 field_addr.name = "actor_id";
32442#endif /* FREECIV_JSON_CONNECTION */
32443 e = 0;
32444 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_id);
32445 if (e) {
32446 log_packet_detailed("'actor_id' field error detected");
32447 }
32448#ifdef FREECIV_JSON_CONNECTION
32449 field_addr.name = "target_id";
32450#endif /* FREECIV_JSON_CONNECTION */
32451 e = 0;
32452 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_id);
32453 if (e) {
32454 log_packet_detailed("'target_id' field error detected");
32455 }
32456#ifdef FREECIV_JSON_CONNECTION
32457 field_addr.name = "cost";
32458#endif /* FREECIV_JSON_CONNECTION */
32459 e = 0;
32460 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->cost);
32461 if (e) {
32462 log_packet_detailed("'cost' field error detected");
32463 }
32464#ifdef FREECIV_JSON_CONNECTION
32465 field_addr.name = "action_type";
32466#endif /* FREECIV_JSON_CONNECTION */
32467 e = 0;
32468 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->action_type);
32469 if (e) {
32470 log_packet_detailed("'action_type' field error detected");
32471 }
32472#ifdef FREECIV_JSON_CONNECTION
32473 field_addr.name = "request_kind";
32474#endif /* FREECIV_JSON_CONNECTION */
32475 e = 0;
32476 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
32477 if (e) {
32478 log_packet_detailed("'request_kind' field error detected");
32479 }
32480
32481#endif
32482 SEND_PACKET_END(PACKET_UNIT_ACTION_ANSWER);
32483}
32484
32485 int send_packet_unit_action_answer(struct connection *pc, const struct packet_unit_action_answer *packet)
32486{
32487 if (!pc->used) {
32488 log_error("WARNING: trying to send data to the closed connection %s",
32489 conn_description(pc));
32490 return -1;
32491 }
32492 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTION_ANSWER].packet != NULL, -1,
32493 "Handler for PACKET_UNIT_ACTION_ANSWER not installed");
32494 return pc->phs.handlers->send[PACKET_UNIT_ACTION_ANSWER].packet(pc, packet);
32495}
32496
32497 int dsend_packet_unit_action_answer(struct connection *pc, int actor_id, int target_id, int cost, action_id action_type, int request_kind)
32498{
32499 struct packet_unit_action_answer packet, *real_packet = &packet;
32500
32501 real_packet->actor_id = actor_id;
32502 real_packet->target_id = target_id;
32503 real_packet->cost = cost;
32504 real_packet->action_type = action_type;
32505 real_packet->request_kind = request_kind;
32506
32507 return send_packet_unit_action_answer(pc, real_packet);
32508}
32509
32510#ifdef FREECIV_DELTA_PROTOCOL
32511#define hash_packet_unit_get_actions_100 hash_const
32512
32513#define cmp_packet_unit_get_actions_100 cmp_const
32514
32515 BV_DEFINE(packet_unit_get_actions_100_fields, 5);
32516#endif /* FREECIV_DELTA_PROTOCOL */
32517
32518 static struct packet_unit_get_actions *receive_packet_unit_get_actions_100(struct connection *pc)
32519{
32520#ifdef FREECIV_DELTA_PROTOCOL
32521 packet_unit_get_actions_100_fields fields;
32522 struct packet_unit_get_actions *old;
32523 struct genhash **hash = pc->phs.received + PACKET_UNIT_GET_ACTIONS;
32524#endif /* FREECIV_DELTA_PROTOCOL */
32525 RECEIVE_PACKET_START(packet_unit_get_actions, real_packet);
32526#ifdef FREECIV_JSON_CONNECTION
32527 struct plocation field_addr;
32528 {
32529 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32530 field_addr = *field_addr_tmp;
32531 FC_FREE(field_addr_tmp);
32532 }
32533#endif /* FREECIV_JSON_CONNECTION */
32534
32535#ifdef FREECIV_DELTA_PROTOCOL
32536#ifdef FREECIV_JSON_CONNECTION
32537 field_addr.name = "fields";
32538#endif /* FREECIV_JSON_CONNECTION */
32539 DIO_BV_GET(&din, &field_addr, fields);
32540
32541#else /* FREECIV_DELTA_PROTOCOL */
32542#ifdef FREECIV_JSON_CONNECTION
32543 field_addr.name = "actor_unit_id";
32544#endif /* FREECIV_JSON_CONNECTION */
32545 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
32546 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
32547 }
32548#ifdef FREECIV_JSON_CONNECTION
32549 field_addr.name = "target_unit_id";
32550#endif /* FREECIV_JSON_CONNECTION */
32551 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
32552 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
32553 }
32554#ifdef FREECIV_JSON_CONNECTION
32555 field_addr.name = "target_tile_id";
32556#endif /* FREECIV_JSON_CONNECTION */
32557 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
32558 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
32559 }
32560#ifdef FREECIV_JSON_CONNECTION
32561 field_addr.name = "target_extra_id";
32562#endif /* FREECIV_JSON_CONNECTION */
32563 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
32564 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
32565 }
32566#ifdef FREECIV_JSON_CONNECTION
32567 field_addr.name = "request_kind";
32568#endif /* FREECIV_JSON_CONNECTION */
32569 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
32570 RECEIVE_PACKET_FIELD_ERROR(request_kind);
32571 }
32572#endif
32573 log_packet_detailed("packet_unit_get_actions_100: got info about ()");
32574
32575#ifdef FREECIV_DELTA_PROTOCOL
32576 if (NULL == *hash) {
32577 *hash = genhash_new_full(hash_packet_unit_get_actions_100, cmp_packet_unit_get_actions_100,
32578 NULL, NULL, NULL, free);
32579 }
32580
32581 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32582 *real_packet = *old;
32583 } else {
32584 log_packet_detailed(" no old info");
32585 memset(real_packet, 0, sizeof(*real_packet));
32586 }
32587
32588 if (BV_ISSET(fields, 0)) {
32589 log_packet_detailed(" got field 'actor_unit_id'");
32590#ifdef FREECIV_JSON_CONNECTION
32591 field_addr.name = "actor_unit_id";
32592#endif /* FREECIV_JSON_CONNECTION */
32593 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
32594 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
32595 }
32596 }
32597 if (BV_ISSET(fields, 1)) {
32598 log_packet_detailed(" got field 'target_unit_id'");
32599#ifdef FREECIV_JSON_CONNECTION
32600 field_addr.name = "target_unit_id";
32601#endif /* FREECIV_JSON_CONNECTION */
32602 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
32603 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
32604 }
32605 }
32606 if (BV_ISSET(fields, 2)) {
32607 log_packet_detailed(" got field 'target_tile_id'");
32608#ifdef FREECIV_JSON_CONNECTION
32609 field_addr.name = "target_tile_id";
32610#endif /* FREECIV_JSON_CONNECTION */
32611 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
32612 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
32613 }
32614 }
32615 if (BV_ISSET(fields, 3)) {
32616 log_packet_detailed(" got field 'target_extra_id'");
32617#ifdef FREECIV_JSON_CONNECTION
32618 field_addr.name = "target_extra_id";
32619#endif /* FREECIV_JSON_CONNECTION */
32620 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
32621 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
32622 }
32623 }
32624 if (BV_ISSET(fields, 4)) {
32625 log_packet_detailed(" got field 'request_kind'");
32626#ifdef FREECIV_JSON_CONNECTION
32627 field_addr.name = "request_kind";
32628#endif /* FREECIV_JSON_CONNECTION */
32629 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
32630 RECEIVE_PACKET_FIELD_ERROR(request_kind);
32631 }
32632 }
32633
32634 if (NULL == old) {
32635 old = fc_malloc(sizeof(*old));
32636 *old = *real_packet;
32637 genhash_insert(*hash, old, old);
32638 } else {
32639 *old = *real_packet;
32640 }
32641
32642#endif /* FREECIV_DELTA_PROTOCOL */
32643 RECEIVE_PACKET_END(real_packet);
32644}
32645
32646 static int send_packet_unit_get_actions_100(struct connection *pc, const struct packet_unit_get_actions *packet)
32647{
32648 const struct packet_unit_get_actions *real_packet = packet;
32649 int e;
32650#ifdef FREECIV_DELTA_PROTOCOL
32651 packet_unit_get_actions_100_fields fields;
32652 struct packet_unit_get_actions *old;
32653 bool differ;
32654 struct genhash **hash = pc->phs.sent + PACKET_UNIT_GET_ACTIONS;
32655#endif /* FREECIV_DELTA_PROTOCOL */
32656 SEND_PACKET_START(PACKET_UNIT_GET_ACTIONS);
32657#ifdef FREECIV_JSON_CONNECTION
32658 struct plocation field_addr;
32659 {
32660 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32661 field_addr = *field_addr_tmp;
32662 FC_FREE(field_addr_tmp);
32663 }
32664#endif /* FREECIV_JSON_CONNECTION */
32665
32666 log_packet_detailed("packet_unit_get_actions_100: sending info about ()");
32667
32668#ifdef FREECIV_DELTA_PROTOCOL
32669 if (NULL == *hash) {
32670 *hash = genhash_new_full(hash_packet_unit_get_actions_100, cmp_packet_unit_get_actions_100,
32671 NULL, NULL, NULL, free);
32672 }
32673 BV_CLR_ALL(fields);
32674
32675 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
32676 old = fc_malloc(sizeof(*old));
32677 *old = *real_packet;
32678 genhash_insert(*hash, old, old);
32679 memset(old, 0, sizeof(*old));
32680 }
32681 differ = (old->actor_unit_id != real_packet->actor_unit_id);
32682 if (differ) {
32683 BV_SET(fields, 0);
32684 }
32685
32686 differ = (old->target_unit_id != real_packet->target_unit_id);
32687 if (differ) {
32688 BV_SET(fields, 1);
32689 }
32690
32691 differ = (old->target_tile_id != real_packet->target_tile_id);
32692 if (differ) {
32693 BV_SET(fields, 2);
32694 }
32695
32696 differ = (old->target_extra_id != real_packet->target_extra_id);
32697 if (differ) {
32698 BV_SET(fields, 3);
32699 }
32700
32701 differ = (old->request_kind != real_packet->request_kind);
32702 if (differ) {
32703 BV_SET(fields, 4);
32704 }
32705
32706
32707#ifdef FREECIV_JSON_CONNECTION
32708 field_addr.name = "fields";
32709#endif /* FREECIV_JSON_CONNECTION */
32710 e = 0;
32711 e |= DIO_BV_PUT(&dout, &field_addr, fields);
32712 if (e) {
32713 log_packet_detailed("fields bitvector error detected");
32714 }
32715
32716 if (BV_ISSET(fields, 0)) {
32717 log_packet_detailed(" field 'actor_unit_id' has changed");
32718#ifdef FREECIV_JSON_CONNECTION
32719 field_addr.name = "actor_unit_id";
32720#endif /* FREECIV_JSON_CONNECTION */
32721 e = 0;
32722 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
32723 if (e) {
32724 log_packet_detailed("'actor_unit_id' field error detected");
32725 }
32726 }
32727 if (BV_ISSET(fields, 1)) {
32728 log_packet_detailed(" field 'target_unit_id' has changed");
32729#ifdef FREECIV_JSON_CONNECTION
32730 field_addr.name = "target_unit_id";
32731#endif /* FREECIV_JSON_CONNECTION */
32732 e = 0;
32733 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
32734 if (e) {
32735 log_packet_detailed("'target_unit_id' field error detected");
32736 }
32737 }
32738 if (BV_ISSET(fields, 2)) {
32739 log_packet_detailed(" field 'target_tile_id' has changed");
32740#ifdef FREECIV_JSON_CONNECTION
32741 field_addr.name = "target_tile_id";
32742#endif /* FREECIV_JSON_CONNECTION */
32743 e = 0;
32744 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
32745 if (e) {
32746 log_packet_detailed("'target_tile_id' field error detected");
32747 }
32748 }
32749 if (BV_ISSET(fields, 3)) {
32750 log_packet_detailed(" field 'target_extra_id' has changed");
32751#ifdef FREECIV_JSON_CONNECTION
32752 field_addr.name = "target_extra_id";
32753#endif /* FREECIV_JSON_CONNECTION */
32754 e = 0;
32755 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
32756 if (e) {
32757 log_packet_detailed("'target_extra_id' field error detected");
32758 }
32759 }
32760 if (BV_ISSET(fields, 4)) {
32761 log_packet_detailed(" field 'request_kind' has changed");
32762#ifdef FREECIV_JSON_CONNECTION
32763 field_addr.name = "request_kind";
32764#endif /* FREECIV_JSON_CONNECTION */
32765 e = 0;
32766 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
32767 if (e) {
32768 log_packet_detailed("'request_kind' field error detected");
32769 }
32770 }
32771
32772 *old = *real_packet;
32773#endif /* FREECIV_DELTA_PROTOCOL */
32774#ifndef FREECIV_DELTA_PROTOCOL
32775#ifdef FREECIV_JSON_CONNECTION
32776 field_addr.name = "actor_unit_id";
32777#endif /* FREECIV_JSON_CONNECTION */
32778 e = 0;
32779 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
32780 if (e) {
32781 log_packet_detailed("'actor_unit_id' field error detected");
32782 }
32783#ifdef FREECIV_JSON_CONNECTION
32784 field_addr.name = "target_unit_id";
32785#endif /* FREECIV_JSON_CONNECTION */
32786 e = 0;
32787 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
32788 if (e) {
32789 log_packet_detailed("'target_unit_id' field error detected");
32790 }
32791#ifdef FREECIV_JSON_CONNECTION
32792 field_addr.name = "target_tile_id";
32793#endif /* FREECIV_JSON_CONNECTION */
32794 e = 0;
32795 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
32796 if (e) {
32797 log_packet_detailed("'target_tile_id' field error detected");
32798 }
32799#ifdef FREECIV_JSON_CONNECTION
32800 field_addr.name = "target_extra_id";
32801#endif /* FREECIV_JSON_CONNECTION */
32802 e = 0;
32803 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
32804 if (e) {
32805 log_packet_detailed("'target_extra_id' field error detected");
32806 }
32807#ifdef FREECIV_JSON_CONNECTION
32808 field_addr.name = "request_kind";
32809#endif /* FREECIV_JSON_CONNECTION */
32810 e = 0;
32811 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
32812 if (e) {
32813 log_packet_detailed("'request_kind' field error detected");
32814 }
32815
32816#endif
32817 SEND_PACKET_END(PACKET_UNIT_GET_ACTIONS);
32818}
32819
32820 int send_packet_unit_get_actions(struct connection *pc, const struct packet_unit_get_actions *packet)
32821{
32822 if (!pc->used) {
32823 log_error("WARNING: trying to send data to the closed connection %s",
32824 conn_description(pc));
32825 return -1;
32826 }
32827 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_GET_ACTIONS].packet != NULL, -1,
32828 "Handler for PACKET_UNIT_GET_ACTIONS not installed");
32829 return pc->phs.handlers->send[PACKET_UNIT_GET_ACTIONS].packet(pc, packet);
32830}
32831
32832 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)
32833{
32834 struct packet_unit_get_actions packet, *real_packet = &packet;
32835
32836 real_packet->actor_unit_id = actor_unit_id;
32837 real_packet->target_unit_id = target_unit_id;
32838 real_packet->target_tile_id = target_tile_id;
32839 real_packet->target_extra_id = target_extra_id;
32840 real_packet->request_kind = request_kind;
32841
32842 return send_packet_unit_get_actions(pc, real_packet);
32843}
32844
32845#ifdef FREECIV_DELTA_PROTOCOL
32846#define hash_packet_unit_actions_100 hash_const
32847
32848#define cmp_packet_unit_actions_100 cmp_const
32849
32850 BV_DEFINE(packet_unit_actions_100_fields, 7);
32851#endif /* FREECIV_DELTA_PROTOCOL */
32852
32853 static struct packet_unit_actions *receive_packet_unit_actions_100(struct connection *pc)
32854{
32855#ifdef FREECIV_DELTA_PROTOCOL
32856 packet_unit_actions_100_fields fields;
32857 struct packet_unit_actions *old;
32858 struct genhash **hash = pc->phs.received + PACKET_UNIT_ACTIONS;
32859#endif /* FREECIV_DELTA_PROTOCOL */
32860 RECEIVE_PACKET_START(packet_unit_actions, real_packet);
32861#ifdef FREECIV_JSON_CONNECTION
32862 struct plocation field_addr;
32863 {
32864 struct plocation *field_addr_tmp = plocation_field_new(NULL);
32865 field_addr = *field_addr_tmp;
32866 FC_FREE(field_addr_tmp);
32867 }
32868#endif /* FREECIV_JSON_CONNECTION */
32869
32870#ifdef FREECIV_DELTA_PROTOCOL
32871#ifdef FREECIV_JSON_CONNECTION
32872 field_addr.name = "fields";
32873#endif /* FREECIV_JSON_CONNECTION */
32874 DIO_BV_GET(&din, &field_addr, fields);
32875
32876#else /* FREECIV_DELTA_PROTOCOL */
32877#ifdef FREECIV_JSON_CONNECTION
32878 field_addr.name = "actor_unit_id";
32879#endif /* FREECIV_JSON_CONNECTION */
32880 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
32881 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
32882 }
32883#ifdef FREECIV_JSON_CONNECTION
32884 field_addr.name = "target_unit_id";
32885#endif /* FREECIV_JSON_CONNECTION */
32886 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
32887 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
32888 }
32889#ifdef FREECIV_JSON_CONNECTION
32890 field_addr.name = "target_city_id";
32891#endif /* FREECIV_JSON_CONNECTION */
32892 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_city_id)) {
32893 RECEIVE_PACKET_FIELD_ERROR(target_city_id);
32894 }
32895#ifdef FREECIV_JSON_CONNECTION
32896 field_addr.name = "target_tile_id";
32897#endif /* FREECIV_JSON_CONNECTION */
32898 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
32899 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
32900 }
32901#ifdef FREECIV_JSON_CONNECTION
32902 field_addr.name = "target_extra_id";
32903#endif /* FREECIV_JSON_CONNECTION */
32904 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
32905 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
32906 }
32907#ifdef FREECIV_JSON_CONNECTION
32908 field_addr.name = "request_kind";
32909#endif /* FREECIV_JSON_CONNECTION */
32910 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
32911 RECEIVE_PACKET_FIELD_ERROR(request_kind);
32912 }
32913#ifdef FREECIV_JSON_CONNECTION
32914 field_addr.name = "action_probabilities";
32915#endif /* FREECIV_JSON_CONNECTION */
32916 {
32917 int i;
32918
32919#ifdef FREECIV_JSON_CONNECTION
32920 /* Enter array. */
32921 field_addr.sub_location = plocation_elem_new(0);
32922#endif /* FREECIV_JSON_CONNECTION */
32923
32924 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
32925#ifdef FREECIV_JSON_CONNECTION
32926 field_addr.sub_location->number = i;
32927#endif /* FREECIV_JSON_CONNECTION */
32928 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
32929 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
32930 }
32931 }
32932
32933#ifdef FREECIV_JSON_CONNECTION
32934 /* Exit array. */
32935 FC_FREE(field_addr.sub_location);
32936#endif /* FREECIV_JSON_CONNECTION */
32937 }
32938#endif
32939 log_packet_detailed("packet_unit_actions_100: got info about ()");
32940
32941#ifdef FREECIV_DELTA_PROTOCOL
32942 if (NULL == *hash) {
32943 *hash = genhash_new_full(hash_packet_unit_actions_100, cmp_packet_unit_actions_100,
32944 NULL, NULL, NULL, free);
32945 }
32946
32947 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
32948 *real_packet = *old;
32949 } else {
32950 log_packet_detailed(" no old info");
32951 memset(real_packet, 0, sizeof(*real_packet));
32952 }
32953
32954 if (BV_ISSET(fields, 0)) {
32955 log_packet_detailed(" got field 'actor_unit_id'");
32956#ifdef FREECIV_JSON_CONNECTION
32957 field_addr.name = "actor_unit_id";
32958#endif /* FREECIV_JSON_CONNECTION */
32959 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->actor_unit_id)) {
32960 RECEIVE_PACKET_FIELD_ERROR(actor_unit_id);
32961 }
32962 }
32963 if (BV_ISSET(fields, 1)) {
32964 log_packet_detailed(" got field 'target_unit_id'");
32965#ifdef FREECIV_JSON_CONNECTION
32966 field_addr.name = "target_unit_id";
32967#endif /* FREECIV_JSON_CONNECTION */
32968 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_unit_id)) {
32969 RECEIVE_PACKET_FIELD_ERROR(target_unit_id);
32970 }
32971 }
32972 if (BV_ISSET(fields, 2)) {
32973 log_packet_detailed(" got field 'target_city_id'");
32974#ifdef FREECIV_JSON_CONNECTION
32975 field_addr.name = "target_city_id";
32976#endif /* FREECIV_JSON_CONNECTION */
32977 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->target_city_id)) {
32978 RECEIVE_PACKET_FIELD_ERROR(target_city_id);
32979 }
32980 }
32981 if (BV_ISSET(fields, 3)) {
32982 log_packet_detailed(" got field 'target_tile_id'");
32983#ifdef FREECIV_JSON_CONNECTION
32984 field_addr.name = "target_tile_id";
32985#endif /* FREECIV_JSON_CONNECTION */
32986 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->target_tile_id)) {
32987 RECEIVE_PACKET_FIELD_ERROR(target_tile_id);
32988 }
32989 }
32990 if (BV_ISSET(fields, 4)) {
32991 log_packet_detailed(" got field 'target_extra_id'");
32992#ifdef FREECIV_JSON_CONNECTION
32993 field_addr.name = "target_extra_id";
32994#endif /* FREECIV_JSON_CONNECTION */
32995 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target_extra_id)) {
32996 RECEIVE_PACKET_FIELD_ERROR(target_extra_id);
32997 }
32998 }
32999 if (BV_ISSET(fields, 5)) {
33000 log_packet_detailed(" got field 'request_kind'");
33001#ifdef FREECIV_JSON_CONNECTION
33002 field_addr.name = "request_kind";
33003#endif /* FREECIV_JSON_CONNECTION */
33004 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->request_kind)) {
33005 RECEIVE_PACKET_FIELD_ERROR(request_kind);
33006 }
33007 }
33008 if (BV_ISSET(fields, 6)) {
33009 log_packet_detailed(" got field 'action_probabilities'");
33010#ifdef FREECIV_JSON_CONNECTION
33011 field_addr.name = "action_probabilities";
33012#endif /* FREECIV_JSON_CONNECTION */
33013 {
33014 int i;
33015
33016#ifdef FREECIV_JSON_CONNECTION
33017 /* Enter array. */
33018 field_addr.sub_location = plocation_elem_new(0);
33019#endif /* FREECIV_JSON_CONNECTION */
33020
33021 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
33022#ifdef FREECIV_JSON_CONNECTION
33023 field_addr.sub_location->number = i;
33024#endif /* FREECIV_JSON_CONNECTION */
33025 if (!DIO_GET(action_probability, &din, &field_addr, &real_packet->action_probabilities[i])) {
33026 RECEIVE_PACKET_FIELD_ERROR(action_probabilities);
33027 }
33028 }
33029
33030#ifdef FREECIV_JSON_CONNECTION
33031 /* Exit array. */
33032 FC_FREE(field_addr.sub_location);
33033#endif /* FREECIV_JSON_CONNECTION */
33034 }
33035 }
33036
33037 if (NULL == old) {
33038 old = fc_malloc(sizeof(*old));
33039 *old = *real_packet;
33040 genhash_insert(*hash, old, old);
33041 } else {
33042 *old = *real_packet;
33043 }
33044
33045#endif /* FREECIV_DELTA_PROTOCOL */
33046 RECEIVE_PACKET_END(real_packet);
33047}
33048
33049 static int send_packet_unit_actions_100(struct connection *pc, const struct packet_unit_actions *packet)
33050{
33051 const struct packet_unit_actions *real_packet = packet;
33052 int e;
33053#ifdef FREECIV_DELTA_PROTOCOL
33054 packet_unit_actions_100_fields fields;
33055 struct packet_unit_actions *old;
33056 bool differ;
33057 struct genhash **hash = pc->phs.sent + PACKET_UNIT_ACTIONS;
33058#endif /* FREECIV_DELTA_PROTOCOL */
33059 SEND_PACKET_START(PACKET_UNIT_ACTIONS);
33060#ifdef FREECIV_JSON_CONNECTION
33061 struct plocation field_addr;
33062 {
33063 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33064 field_addr = *field_addr_tmp;
33065 FC_FREE(field_addr_tmp);
33066 }
33067#endif /* FREECIV_JSON_CONNECTION */
33068
33069 log_packet_detailed("packet_unit_actions_100: sending info about ()");
33070
33071#ifdef FREECIV_DELTA_PROTOCOL
33072 if (NULL == *hash) {
33073 *hash = genhash_new_full(hash_packet_unit_actions_100, cmp_packet_unit_actions_100,
33074 NULL, NULL, NULL, free);
33075 }
33076 BV_CLR_ALL(fields);
33077
33078 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33079 old = fc_malloc(sizeof(*old));
33080 *old = *real_packet;
33081 genhash_insert(*hash, old, old);
33082 memset(old, 0, sizeof(*old));
33083 }
33084 differ = (old->actor_unit_id != real_packet->actor_unit_id);
33085 if (differ) {
33086 BV_SET(fields, 0);
33087 }
33088
33089 differ = (old->target_unit_id != real_packet->target_unit_id);
33090 if (differ) {
33091 BV_SET(fields, 1);
33092 }
33093
33094 differ = (old->target_city_id != real_packet->target_city_id);
33095 if (differ) {
33096 BV_SET(fields, 2);
33097 }
33098
33099 differ = (old->target_tile_id != real_packet->target_tile_id);
33100 if (differ) {
33101 BV_SET(fields, 3);
33102 }
33103
33104 differ = (old->target_extra_id != real_packet->target_extra_id);
33105 if (differ) {
33106 BV_SET(fields, 4);
33107 }
33108
33109 differ = (old->request_kind != real_packet->request_kind);
33110 if (differ) {
33111 BV_SET(fields, 5);
33112 }
33113
33114 differ = FALSE;
33115 {
33116 int i;
33117
33118 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
33119 differ = !are_action_probabilitys_equal(&old->action_probabilities[i], &real_packet->action_probabilities[i]);
33120 if (differ) {
33121 break;
33122 }
33123 }
33124 }
33125 if (differ) {
33126 BV_SET(fields, 6);
33127 }
33128
33129
33130#ifdef FREECIV_JSON_CONNECTION
33131 field_addr.name = "fields";
33132#endif /* FREECIV_JSON_CONNECTION */
33133 e = 0;
33134 e |= DIO_BV_PUT(&dout, &field_addr, fields);
33135 if (e) {
33136 log_packet_detailed("fields bitvector error detected");
33137 }
33138
33139 if (BV_ISSET(fields, 0)) {
33140 log_packet_detailed(" field 'actor_unit_id' has changed");
33141#ifdef FREECIV_JSON_CONNECTION
33142 field_addr.name = "actor_unit_id";
33143#endif /* FREECIV_JSON_CONNECTION */
33144 e = 0;
33145 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
33146 if (e) {
33147 log_packet_detailed("'actor_unit_id' field error detected");
33148 }
33149 }
33150 if (BV_ISSET(fields, 1)) {
33151 log_packet_detailed(" field 'target_unit_id' has changed");
33152#ifdef FREECIV_JSON_CONNECTION
33153 field_addr.name = "target_unit_id";
33154#endif /* FREECIV_JSON_CONNECTION */
33155 e = 0;
33156 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
33157 if (e) {
33158 log_packet_detailed("'target_unit_id' field error detected");
33159 }
33160 }
33161 if (BV_ISSET(fields, 2)) {
33162 log_packet_detailed(" field 'target_city_id' has changed");
33163#ifdef FREECIV_JSON_CONNECTION
33164 field_addr.name = "target_city_id";
33165#endif /* FREECIV_JSON_CONNECTION */
33166 e = 0;
33167 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_city_id);
33168 if (e) {
33169 log_packet_detailed("'target_city_id' field error detected");
33170 }
33171 }
33172 if (BV_ISSET(fields, 3)) {
33173 log_packet_detailed(" field 'target_tile_id' has changed");
33174#ifdef FREECIV_JSON_CONNECTION
33175 field_addr.name = "target_tile_id";
33176#endif /* FREECIV_JSON_CONNECTION */
33177 e = 0;
33178 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
33179 if (e) {
33180 log_packet_detailed("'target_tile_id' field error detected");
33181 }
33182 }
33183 if (BV_ISSET(fields, 4)) {
33184 log_packet_detailed(" field 'target_extra_id' has changed");
33185#ifdef FREECIV_JSON_CONNECTION
33186 field_addr.name = "target_extra_id";
33187#endif /* FREECIV_JSON_CONNECTION */
33188 e = 0;
33189 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
33190 if (e) {
33191 log_packet_detailed("'target_extra_id' field error detected");
33192 }
33193 }
33194 if (BV_ISSET(fields, 5)) {
33195 log_packet_detailed(" field 'request_kind' has changed");
33196#ifdef FREECIV_JSON_CONNECTION
33197 field_addr.name = "request_kind";
33198#endif /* FREECIV_JSON_CONNECTION */
33199 e = 0;
33200 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
33201 if (e) {
33202 log_packet_detailed("'request_kind' field error detected");
33203 }
33204 }
33205 if (BV_ISSET(fields, 6)) {
33206 log_packet_detailed(" field 'action_probabilities' has changed");
33207#ifdef FREECIV_JSON_CONNECTION
33208 field_addr.name = "action_probabilities";
33209#endif /* FREECIV_JSON_CONNECTION */
33210 e = 0;
33211 {
33212 int i;
33213
33214#ifdef FREECIV_JSON_CONNECTION
33215 /* Create the array. */
33216 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
33217
33218 /* Enter the array. */
33219 field_addr.sub_location = plocation_elem_new(0);
33220#endif /* FREECIV_JSON_CONNECTION */
33221
33222 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
33223#ifdef FREECIV_JSON_CONNECTION
33224 /* Next array element. */
33225 field_addr.sub_location->number = i;
33226#endif /* FREECIV_JSON_CONNECTION */
33227 e |= DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
33228 }
33229
33230#ifdef FREECIV_JSON_CONNECTION
33231 /* Exit array. */
33232 FC_FREE(field_addr.sub_location);
33233#endif /* FREECIV_JSON_CONNECTION */
33234 }
33235 if (e) {
33236 log_packet_detailed("'action_probabilities' field error detected");
33237 }
33238 }
33239
33240 *old = *real_packet;
33241#endif /* FREECIV_DELTA_PROTOCOL */
33242#ifndef FREECIV_DELTA_PROTOCOL
33243#ifdef FREECIV_JSON_CONNECTION
33244 field_addr.name = "actor_unit_id";
33245#endif /* FREECIV_JSON_CONNECTION */
33246 e = 0;
33247 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->actor_unit_id);
33248 if (e) {
33249 log_packet_detailed("'actor_unit_id' field error detected");
33250 }
33251#ifdef FREECIV_JSON_CONNECTION
33252 field_addr.name = "target_unit_id";
33253#endif /* FREECIV_JSON_CONNECTION */
33254 e = 0;
33255 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_unit_id);
33256 if (e) {
33257 log_packet_detailed("'target_unit_id' field error detected");
33258 }
33259#ifdef FREECIV_JSON_CONNECTION
33260 field_addr.name = "target_city_id";
33261#endif /* FREECIV_JSON_CONNECTION */
33262 e = 0;
33263 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->target_city_id);
33264 if (e) {
33265 log_packet_detailed("'target_city_id' field error detected");
33266 }
33267#ifdef FREECIV_JSON_CONNECTION
33268 field_addr.name = "target_tile_id";
33269#endif /* FREECIV_JSON_CONNECTION */
33270 e = 0;
33271 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->target_tile_id);
33272 if (e) {
33273 log_packet_detailed("'target_tile_id' field error detected");
33274 }
33275#ifdef FREECIV_JSON_CONNECTION
33276 field_addr.name = "target_extra_id";
33277#endif /* FREECIV_JSON_CONNECTION */
33278 e = 0;
33279 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_extra_id);
33280 if (e) {
33281 log_packet_detailed("'target_extra_id' field error detected");
33282 }
33283#ifdef FREECIV_JSON_CONNECTION
33284 field_addr.name = "request_kind";
33285#endif /* FREECIV_JSON_CONNECTION */
33286 e = 0;
33287 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->request_kind);
33288 if (e) {
33289 log_packet_detailed("'request_kind' field error detected");
33290 }
33291#ifdef FREECIV_JSON_CONNECTION
33292 field_addr.name = "action_probabilities";
33293#endif /* FREECIV_JSON_CONNECTION */
33294 e = 0;
33295 {
33296 int i;
33297
33298#ifdef FREECIV_JSON_CONNECTION
33299 /* Create the array. */
33300 e |= DIO_PUT(farray, &dout, &field_addr, MAX_NUM_ACTIONS);
33301
33302 /* Enter the array. */
33303 field_addr.sub_location = plocation_elem_new(0);
33304#endif /* FREECIV_JSON_CONNECTION */
33305
33306 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
33307#ifdef FREECIV_JSON_CONNECTION
33308 /* Next array element. */
33309 field_addr.sub_location->number = i;
33310#endif /* FREECIV_JSON_CONNECTION */
33311 e |= DIO_PUT(action_probability, &dout, &field_addr, &real_packet->action_probabilities[i]);
33312 }
33313
33314#ifdef FREECIV_JSON_CONNECTION
33315 /* Exit array. */
33316 FC_FREE(field_addr.sub_location);
33317#endif /* FREECIV_JSON_CONNECTION */
33318 }
33319 if (e) {
33320 log_packet_detailed("'action_probabilities' field error detected");
33321 }
33322
33323#endif
33324 SEND_PACKET_END(PACKET_UNIT_ACTIONS);
33325}
33326
33327 int send_packet_unit_actions(struct connection *pc, const struct packet_unit_actions *packet)
33328{
33329 if (!pc->used) {
33330 log_error("WARNING: trying to send data to the closed connection %s",
33331 conn_description(pc));
33332 return -1;
33333 }
33334 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_ACTIONS].packet != NULL, -1,
33335 "Handler for PACKET_UNIT_ACTIONS not installed");
33336 return pc->phs.handlers->send[PACKET_UNIT_ACTIONS].packet(pc, packet);
33337}
33338
33339 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)
33340{
33341 struct packet_unit_actions packet, *real_packet = &packet;
33342
33343 real_packet->actor_unit_id = actor_unit_id;
33344 real_packet->target_unit_id = target_unit_id;
33345 real_packet->target_city_id = target_city_id;
33346 real_packet->target_tile_id = target_tile_id;
33347 real_packet->target_extra_id = target_extra_id;
33348 real_packet->request_kind = request_kind;
33349 {
33350 int i;
33351
33352 for (i = 0; i < MAX_NUM_ACTIONS; i++) {
33353 real_packet->action_probabilities[i] = action_probabilities[i];
33354 }
33355 }
33356
33357 return send_packet_unit_actions(pc, real_packet);
33358}
33359
33360#ifdef FREECIV_DELTA_PROTOCOL
33361#define hash_packet_unit_change_activity_100 hash_const
33362
33363#define cmp_packet_unit_change_activity_100 cmp_const
33364
33365 BV_DEFINE(packet_unit_change_activity_100_fields, 3);
33366#endif /* FREECIV_DELTA_PROTOCOL */
33367
33368 static struct packet_unit_change_activity *receive_packet_unit_change_activity_100(struct connection *pc)
33369{
33370#ifdef FREECIV_DELTA_PROTOCOL
33371 packet_unit_change_activity_100_fields fields;
33372 struct packet_unit_change_activity *old;
33373 struct genhash **hash = pc->phs.received + PACKET_UNIT_CHANGE_ACTIVITY;
33374#endif /* FREECIV_DELTA_PROTOCOL */
33375 RECEIVE_PACKET_START(packet_unit_change_activity, real_packet);
33376#ifdef FREECIV_JSON_CONNECTION
33377 struct plocation field_addr;
33378 {
33379 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33380 field_addr = *field_addr_tmp;
33381 FC_FREE(field_addr_tmp);
33382 }
33383#endif /* FREECIV_JSON_CONNECTION */
33384
33385#ifdef FREECIV_DELTA_PROTOCOL
33386#ifdef FREECIV_JSON_CONNECTION
33387 field_addr.name = "fields";
33388#endif /* FREECIV_JSON_CONNECTION */
33389 DIO_BV_GET(&din, &field_addr, fields);
33390
33391#else /* FREECIV_DELTA_PROTOCOL */
33392#ifdef FREECIV_JSON_CONNECTION
33393 field_addr.name = "unit_id";
33394#endif /* FREECIV_JSON_CONNECTION */
33395 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
33396 RECEIVE_PACKET_FIELD_ERROR(unit_id);
33397 }
33398#ifdef FREECIV_JSON_CONNECTION
33399 field_addr.name = "activity";
33400#endif /* FREECIV_JSON_CONNECTION */
33401 {
33402 int readin;
33403
33404 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33405 RECEIVE_PACKET_FIELD_ERROR(activity);
33406 }
33407 real_packet->activity = readin;
33408 }
33409#ifdef FREECIV_JSON_CONNECTION
33410 field_addr.name = "target";
33411#endif /* FREECIV_JSON_CONNECTION */
33412 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
33413 RECEIVE_PACKET_FIELD_ERROR(target);
33414 }
33415#endif
33416 log_packet_detailed("packet_unit_change_activity_100: got info about ()");
33417
33418#ifdef FREECIV_DELTA_PROTOCOL
33419 if (NULL == *hash) {
33420 *hash = genhash_new_full(hash_packet_unit_change_activity_100, cmp_packet_unit_change_activity_100,
33421 NULL, NULL, NULL, free);
33422 }
33423
33424 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
33425 *real_packet = *old;
33426 } else {
33427 log_packet_detailed(" no old info");
33428 memset(real_packet, 0, sizeof(*real_packet));
33429 }
33430
33431 if (BV_ISSET(fields, 0)) {
33432 log_packet_detailed(" got field 'unit_id'");
33433#ifdef FREECIV_JSON_CONNECTION
33434 field_addr.name = "unit_id";
33435#endif /* FREECIV_JSON_CONNECTION */
33436 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->unit_id)) {
33437 RECEIVE_PACKET_FIELD_ERROR(unit_id);
33438 }
33439 }
33440 if (BV_ISSET(fields, 1)) {
33441 log_packet_detailed(" got field 'activity'");
33442#ifdef FREECIV_JSON_CONNECTION
33443 field_addr.name = "activity";
33444#endif /* FREECIV_JSON_CONNECTION */
33445 {
33446 int readin;
33447
33448 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
33449 RECEIVE_PACKET_FIELD_ERROR(activity);
33450 }
33451 real_packet->activity = readin;
33452 }
33453 }
33454 if (BV_ISSET(fields, 2)) {
33455 log_packet_detailed(" got field 'target'");
33456#ifdef FREECIV_JSON_CONNECTION
33457 field_addr.name = "target";
33458#endif /* FREECIV_JSON_CONNECTION */
33459 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->target)) {
33460 RECEIVE_PACKET_FIELD_ERROR(target);
33461 }
33462 }
33463
33464 if (NULL == old) {
33465 old = fc_malloc(sizeof(*old));
33466 *old = *real_packet;
33467 genhash_insert(*hash, old, old);
33468 } else {
33469 *old = *real_packet;
33470 }
33471
33472#endif /* FREECIV_DELTA_PROTOCOL */
33473 RECEIVE_PACKET_END(real_packet);
33474}
33475
33476 static int send_packet_unit_change_activity_100(struct connection *pc, const struct packet_unit_change_activity *packet)
33477{
33478 const struct packet_unit_change_activity *real_packet = packet;
33479 int e;
33480#ifdef FREECIV_DELTA_PROTOCOL
33481 packet_unit_change_activity_100_fields fields;
33482 struct packet_unit_change_activity *old;
33483 bool differ;
33484 struct genhash **hash = pc->phs.sent + PACKET_UNIT_CHANGE_ACTIVITY;
33485#endif /* FREECIV_DELTA_PROTOCOL */
33486 SEND_PACKET_START(PACKET_UNIT_CHANGE_ACTIVITY);
33487#ifdef FREECIV_JSON_CONNECTION
33488 struct plocation field_addr;
33489 {
33490 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33491 field_addr = *field_addr_tmp;
33492 FC_FREE(field_addr_tmp);
33493 }
33494#endif /* FREECIV_JSON_CONNECTION */
33495
33496 log_packet_detailed("packet_unit_change_activity_100: sending info about ()");
33497
33498#ifdef FREECIV_DELTA_PROTOCOL
33499 if (NULL == *hash) {
33500 *hash = genhash_new_full(hash_packet_unit_change_activity_100, cmp_packet_unit_change_activity_100,
33501 NULL, NULL, NULL, free);
33502 }
33503 BV_CLR_ALL(fields);
33504
33505 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33506 old = fc_malloc(sizeof(*old));
33507 *old = *real_packet;
33508 genhash_insert(*hash, old, old);
33509 memset(old, 0, sizeof(*old));
33510 }
33511 differ = (old->unit_id != real_packet->unit_id);
33512 if (differ) {
33513 BV_SET(fields, 0);
33514 }
33515
33516 differ = (old->activity != real_packet->activity);
33517 if (differ) {
33518 BV_SET(fields, 1);
33519 }
33520
33521 differ = (old->target != real_packet->target);
33522 if (differ) {
33523 BV_SET(fields, 2);
33524 }
33525
33526
33527#ifdef FREECIV_JSON_CONNECTION
33528 field_addr.name = "fields";
33529#endif /* FREECIV_JSON_CONNECTION */
33530 e = 0;
33531 e |= DIO_BV_PUT(&dout, &field_addr, fields);
33532 if (e) {
33533 log_packet_detailed("fields bitvector error detected");
33534 }
33535
33536 if (BV_ISSET(fields, 0)) {
33537 log_packet_detailed(" field 'unit_id' has changed");
33538#ifdef FREECIV_JSON_CONNECTION
33539 field_addr.name = "unit_id";
33540#endif /* FREECIV_JSON_CONNECTION */
33541 e = 0;
33542 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
33543 if (e) {
33544 log_packet_detailed("'unit_id' field error detected");
33545 }
33546 }
33547 if (BV_ISSET(fields, 1)) {
33548 log_packet_detailed(" field 'activity' has changed");
33549#ifdef FREECIV_JSON_CONNECTION
33550 field_addr.name = "activity";
33551#endif /* FREECIV_JSON_CONNECTION */
33552 e = 0;
33553 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
33554 if (e) {
33555 log_packet_detailed("'activity' field error detected");
33556 }
33557 }
33558 if (BV_ISSET(fields, 2)) {
33559 log_packet_detailed(" field 'target' has changed");
33560#ifdef FREECIV_JSON_CONNECTION
33561 field_addr.name = "target";
33562#endif /* FREECIV_JSON_CONNECTION */
33563 e = 0;
33564 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
33565 if (e) {
33566 log_packet_detailed("'target' field error detected");
33567 }
33568 }
33569
33570 *old = *real_packet;
33571#endif /* FREECIV_DELTA_PROTOCOL */
33572#ifndef FREECIV_DELTA_PROTOCOL
33573#ifdef FREECIV_JSON_CONNECTION
33574 field_addr.name = "unit_id";
33575#endif /* FREECIV_JSON_CONNECTION */
33576 e = 0;
33577 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->unit_id);
33578 if (e) {
33579 log_packet_detailed("'unit_id' field error detected");
33580 }
33581#ifdef FREECIV_JSON_CONNECTION
33582 field_addr.name = "activity";
33583#endif /* FREECIV_JSON_CONNECTION */
33584 e = 0;
33585 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
33586 if (e) {
33587 log_packet_detailed("'activity' field error detected");
33588 }
33589#ifdef FREECIV_JSON_CONNECTION
33590 field_addr.name = "target";
33591#endif /* FREECIV_JSON_CONNECTION */
33592 e = 0;
33593 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target);
33594 if (e) {
33595 log_packet_detailed("'target' field error detected");
33596 }
33597
33598#endif
33599 SEND_PACKET_END(PACKET_UNIT_CHANGE_ACTIVITY);
33600}
33601
33602 int send_packet_unit_change_activity(struct connection *pc, const struct packet_unit_change_activity *packet)
33603{
33604 if (!pc->used) {
33605 log_error("WARNING: trying to send data to the closed connection %s",
33606 conn_description(pc));
33607 return -1;
33608 }
33609 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet != NULL, -1,
33610 "Handler for PACKET_UNIT_CHANGE_ACTIVITY not installed");
33611 return pc->phs.handlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet(pc, packet);
33612}
33613
33614 int dsend_packet_unit_change_activity(struct connection *pc, int unit_id, enum unit_activity activity, int target)
33615{
33616 struct packet_unit_change_activity packet, *real_packet = &packet;
33617
33618 real_packet->unit_id = unit_id;
33619 real_packet->activity = activity;
33620 real_packet->target = target;
33621
33622 return send_packet_unit_change_activity(pc, real_packet);
33623}
33624
33625#ifdef FREECIV_DELTA_PROTOCOL
33626#define hash_packet_diplomacy_init_meeting_req_100 hash_const
33627
33628#define cmp_packet_diplomacy_init_meeting_req_100 cmp_const
33629
33630 BV_DEFINE(packet_diplomacy_init_meeting_req_100_fields, 1);
33631#endif /* FREECIV_DELTA_PROTOCOL */
33632
33633 static struct packet_diplomacy_init_meeting_req *receive_packet_diplomacy_init_meeting_req_100(struct connection *pc)
33634{
33635#ifdef FREECIV_DELTA_PROTOCOL
33636 packet_diplomacy_init_meeting_req_100_fields fields;
33637 struct packet_diplomacy_init_meeting_req *old;
33638 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_INIT_MEETING_REQ;
33639#endif /* FREECIV_DELTA_PROTOCOL */
33640 RECEIVE_PACKET_START(packet_diplomacy_init_meeting_req, real_packet);
33641#ifdef FREECIV_JSON_CONNECTION
33642 struct plocation field_addr;
33643 {
33644 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33645 field_addr = *field_addr_tmp;
33646 FC_FREE(field_addr_tmp);
33647 }
33648#endif /* FREECIV_JSON_CONNECTION */
33649
33650#ifdef FREECIV_DELTA_PROTOCOL
33651#ifdef FREECIV_JSON_CONNECTION
33652 field_addr.name = "fields";
33653#endif /* FREECIV_JSON_CONNECTION */
33654 DIO_BV_GET(&din, &field_addr, fields);
33655
33656#else /* FREECIV_DELTA_PROTOCOL */
33657#ifdef FREECIV_JSON_CONNECTION
33658 field_addr.name = "counterpart";
33659#endif /* FREECIV_JSON_CONNECTION */
33660 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
33661 RECEIVE_PACKET_FIELD_ERROR(counterpart);
33662 }
33663#endif
33664 log_packet_detailed("packet_diplomacy_init_meeting_req_100: got info about ()");
33665
33666#ifdef FREECIV_DELTA_PROTOCOL
33667 if (NULL == *hash) {
33668 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_req_100, cmp_packet_diplomacy_init_meeting_req_100,
33669 NULL, NULL, NULL, free);
33670 }
33671
33672 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
33673 *real_packet = *old;
33674 } else {
33675 log_packet_detailed(" no old info");
33676 memset(real_packet, 0, sizeof(*real_packet));
33677 }
33678
33679 if (BV_ISSET(fields, 0)) {
33680 log_packet_detailed(" got field 'counterpart'");
33681#ifdef FREECIV_JSON_CONNECTION
33682 field_addr.name = "counterpart";
33683#endif /* FREECIV_JSON_CONNECTION */
33684 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
33685 RECEIVE_PACKET_FIELD_ERROR(counterpart);
33686 }
33687 }
33688
33689 if (NULL == old) {
33690 old = fc_malloc(sizeof(*old));
33691 *old = *real_packet;
33692 genhash_insert(*hash, old, old);
33693 } else {
33694 *old = *real_packet;
33695 }
33696
33697#endif /* FREECIV_DELTA_PROTOCOL */
33698 RECEIVE_PACKET_END(real_packet);
33699}
33700
33701 static int send_packet_diplomacy_init_meeting_req_100(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
33702{
33703 const struct packet_diplomacy_init_meeting_req *real_packet = packet;
33704 int e;
33705#ifdef FREECIV_DELTA_PROTOCOL
33706 packet_diplomacy_init_meeting_req_100_fields fields;
33707 struct packet_diplomacy_init_meeting_req *old;
33708 bool differ;
33709 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_INIT_MEETING_REQ;
33710#endif /* FREECIV_DELTA_PROTOCOL */
33711 SEND_PACKET_START(PACKET_DIPLOMACY_INIT_MEETING_REQ);
33712#ifdef FREECIV_JSON_CONNECTION
33713 struct plocation field_addr;
33714 {
33715 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33716 field_addr = *field_addr_tmp;
33717 FC_FREE(field_addr_tmp);
33718 }
33719#endif /* FREECIV_JSON_CONNECTION */
33720
33721 log_packet_detailed("packet_diplomacy_init_meeting_req_100: sending info about ()");
33722
33723#ifdef FREECIV_DELTA_PROTOCOL
33724 if (NULL == *hash) {
33725 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_req_100, cmp_packet_diplomacy_init_meeting_req_100,
33726 NULL, NULL, NULL, free);
33727 }
33728 BV_CLR_ALL(fields);
33729
33730 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33731 old = fc_malloc(sizeof(*old));
33732 *old = *real_packet;
33733 genhash_insert(*hash, old, old);
33734 memset(old, 0, sizeof(*old));
33735 }
33736 differ = (old->counterpart != real_packet->counterpart);
33737 if (differ) {
33738 BV_SET(fields, 0);
33739 }
33740
33741
33742#ifdef FREECIV_JSON_CONNECTION
33743 field_addr.name = "fields";
33744#endif /* FREECIV_JSON_CONNECTION */
33745 e = 0;
33746 e |= DIO_BV_PUT(&dout, &field_addr, fields);
33747 if (e) {
33748 log_packet_detailed("fields bitvector error detected");
33749 }
33750
33751 if (BV_ISSET(fields, 0)) {
33752 log_packet_detailed(" field 'counterpart' has changed");
33753#ifdef FREECIV_JSON_CONNECTION
33754 field_addr.name = "counterpart";
33755#endif /* FREECIV_JSON_CONNECTION */
33756 e = 0;
33757 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
33758 if (e) {
33759 log_packet_detailed("'counterpart' field error detected");
33760 }
33761 }
33762
33763 *old = *real_packet;
33764#endif /* FREECIV_DELTA_PROTOCOL */
33765#ifndef FREECIV_DELTA_PROTOCOL
33766#ifdef FREECIV_JSON_CONNECTION
33767 field_addr.name = "counterpart";
33768#endif /* FREECIV_JSON_CONNECTION */
33769 e = 0;
33770 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
33771 if (e) {
33772 log_packet_detailed("'counterpart' field error detected");
33773 }
33774
33775#endif
33776 SEND_PACKET_END(PACKET_DIPLOMACY_INIT_MEETING_REQ);
33777}
33778
33779 int send_packet_diplomacy_init_meeting_req(struct connection *pc, const struct packet_diplomacy_init_meeting_req *packet)
33780{
33781 if (!pc->used) {
33782 log_error("WARNING: trying to send data to the closed connection %s",
33783 conn_description(pc));
33784 return -1;
33785 }
33786 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet != NULL, -1,
33787 "Handler for PACKET_DIPLOMACY_INIT_MEETING_REQ not installed");
33788 return pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet(pc, packet);
33789}
33790
33791 int dsend_packet_diplomacy_init_meeting_req(struct connection *pc, int counterpart)
33792{
33793 struct packet_diplomacy_init_meeting_req packet, *real_packet = &packet;
33794
33795 real_packet->counterpart = counterpart;
33796
33797 return send_packet_diplomacy_init_meeting_req(pc, real_packet);
33798}
33799
33800#ifdef FREECIV_DELTA_PROTOCOL
33801#define hash_packet_diplomacy_init_meeting_100 hash_const
33802
33803#define cmp_packet_diplomacy_init_meeting_100 cmp_const
33804
33805 BV_DEFINE(packet_diplomacy_init_meeting_100_fields, 2);
33806#endif /* FREECIV_DELTA_PROTOCOL */
33807
33808 static struct packet_diplomacy_init_meeting *receive_packet_diplomacy_init_meeting_100(struct connection *pc)
33809{
33810#ifdef FREECIV_DELTA_PROTOCOL
33811 packet_diplomacy_init_meeting_100_fields fields;
33812 struct packet_diplomacy_init_meeting *old;
33813 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_INIT_MEETING;
33814#endif /* FREECIV_DELTA_PROTOCOL */
33815 RECEIVE_PACKET_START(packet_diplomacy_init_meeting, real_packet);
33816#ifdef FREECIV_JSON_CONNECTION
33817 struct plocation field_addr;
33818 {
33819 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33820 field_addr = *field_addr_tmp;
33821 FC_FREE(field_addr_tmp);
33822 }
33823#endif /* FREECIV_JSON_CONNECTION */
33824
33825#ifdef FREECIV_DELTA_PROTOCOL
33826#ifdef FREECIV_JSON_CONNECTION
33827 field_addr.name = "fields";
33828#endif /* FREECIV_JSON_CONNECTION */
33829 DIO_BV_GET(&din, &field_addr, fields);
33830
33831#else /* FREECIV_DELTA_PROTOCOL */
33832#ifdef FREECIV_JSON_CONNECTION
33833 field_addr.name = "counterpart";
33834#endif /* FREECIV_JSON_CONNECTION */
33835 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
33836 RECEIVE_PACKET_FIELD_ERROR(counterpart);
33837 }
33838#ifdef FREECIV_JSON_CONNECTION
33839 field_addr.name = "initiated_from";
33840#endif /* FREECIV_JSON_CONNECTION */
33841 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
33842 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
33843 }
33844#endif
33845 log_packet_detailed("packet_diplomacy_init_meeting_100: got info about ()");
33846
33847#ifdef FREECIV_DELTA_PROTOCOL
33848 if (NULL == *hash) {
33849 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_100, cmp_packet_diplomacy_init_meeting_100,
33850 NULL, NULL, NULL, free);
33851 }
33852
33853 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
33854 *real_packet = *old;
33855 } else {
33856 log_packet_detailed(" no old info");
33857 memset(real_packet, 0, sizeof(*real_packet));
33858 }
33859
33860 if (BV_ISSET(fields, 0)) {
33861 log_packet_detailed(" got field 'counterpart'");
33862#ifdef FREECIV_JSON_CONNECTION
33863 field_addr.name = "counterpart";
33864#endif /* FREECIV_JSON_CONNECTION */
33865 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
33866 RECEIVE_PACKET_FIELD_ERROR(counterpart);
33867 }
33868 }
33869 if (BV_ISSET(fields, 1)) {
33870 log_packet_detailed(" got field 'initiated_from'");
33871#ifdef FREECIV_JSON_CONNECTION
33872 field_addr.name = "initiated_from";
33873#endif /* FREECIV_JSON_CONNECTION */
33874 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
33875 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
33876 }
33877 }
33878
33879 if (NULL == old) {
33880 old = fc_malloc(sizeof(*old));
33881 *old = *real_packet;
33882 genhash_insert(*hash, old, old);
33883 } else {
33884 *old = *real_packet;
33885 }
33886
33887#endif /* FREECIV_DELTA_PROTOCOL */
33888 RECEIVE_PACKET_END(real_packet);
33889}
33890
33891 static int send_packet_diplomacy_init_meeting_100(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
33892{
33893 const struct packet_diplomacy_init_meeting *real_packet = packet;
33894 int e;
33895#ifdef FREECIV_DELTA_PROTOCOL
33896 packet_diplomacy_init_meeting_100_fields fields;
33897 struct packet_diplomacy_init_meeting *old;
33898 bool differ;
33899 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_INIT_MEETING;
33900#endif /* FREECIV_DELTA_PROTOCOL */
33901 SEND_PACKET_START(PACKET_DIPLOMACY_INIT_MEETING);
33902#ifdef FREECIV_JSON_CONNECTION
33903 struct plocation field_addr;
33904 {
33905 struct plocation *field_addr_tmp = plocation_field_new(NULL);
33906 field_addr = *field_addr_tmp;
33907 FC_FREE(field_addr_tmp);
33908 }
33909#endif /* FREECIV_JSON_CONNECTION */
33910
33911 log_packet_detailed("packet_diplomacy_init_meeting_100: sending info about ()");
33912
33913#ifdef FREECIV_DELTA_PROTOCOL
33914 if (NULL == *hash) {
33915 *hash = genhash_new_full(hash_packet_diplomacy_init_meeting_100, cmp_packet_diplomacy_init_meeting_100,
33916 NULL, NULL, NULL, free);
33917 }
33918 BV_CLR_ALL(fields);
33919
33920 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
33921 old = fc_malloc(sizeof(*old));
33922 *old = *real_packet;
33923 genhash_insert(*hash, old, old);
33924 memset(old, 0, sizeof(*old));
33925 }
33926 differ = (old->counterpart != real_packet->counterpart);
33927 if (differ) {
33928 BV_SET(fields, 0);
33929 }
33930
33931 differ = (old->initiated_from != real_packet->initiated_from);
33932 if (differ) {
33933 BV_SET(fields, 1);
33934 }
33935
33936
33937#ifdef FREECIV_JSON_CONNECTION
33938 field_addr.name = "fields";
33939#endif /* FREECIV_JSON_CONNECTION */
33940 e = 0;
33941 e |= DIO_BV_PUT(&dout, &field_addr, fields);
33942 if (e) {
33943 log_packet_detailed("fields bitvector error detected");
33944 }
33945
33946 if (BV_ISSET(fields, 0)) {
33947 log_packet_detailed(" field 'counterpart' has changed");
33948#ifdef FREECIV_JSON_CONNECTION
33949 field_addr.name = "counterpart";
33950#endif /* FREECIV_JSON_CONNECTION */
33951 e = 0;
33952 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
33953 if (e) {
33954 log_packet_detailed("'counterpart' field error detected");
33955 }
33956 }
33957 if (BV_ISSET(fields, 1)) {
33958 log_packet_detailed(" field 'initiated_from' has changed");
33959#ifdef FREECIV_JSON_CONNECTION
33960 field_addr.name = "initiated_from";
33961#endif /* FREECIV_JSON_CONNECTION */
33962 e = 0;
33963 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
33964 if (e) {
33965 log_packet_detailed("'initiated_from' field error detected");
33966 }
33967 }
33968
33969 *old = *real_packet;
33970#endif /* FREECIV_DELTA_PROTOCOL */
33971#ifndef FREECIV_DELTA_PROTOCOL
33972#ifdef FREECIV_JSON_CONNECTION
33973 field_addr.name = "counterpart";
33974#endif /* FREECIV_JSON_CONNECTION */
33975 e = 0;
33976 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
33977 if (e) {
33978 log_packet_detailed("'counterpart' field error detected");
33979 }
33980#ifdef FREECIV_JSON_CONNECTION
33981 field_addr.name = "initiated_from";
33982#endif /* FREECIV_JSON_CONNECTION */
33983 e = 0;
33984 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
33985 if (e) {
33986 log_packet_detailed("'initiated_from' field error detected");
33987 }
33988
33989#endif
33990 SEND_PACKET_END(PACKET_DIPLOMACY_INIT_MEETING);
33991}
33992
33993 int send_packet_diplomacy_init_meeting(struct connection *pc, const struct packet_diplomacy_init_meeting *packet)
33994{
33995 if (!pc->used) {
33996 log_error("WARNING: trying to send data to the closed connection %s",
33997 conn_description(pc));
33998 return -1;
33999 }
34000 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet != NULL, -1,
34001 "Handler for PACKET_DIPLOMACY_INIT_MEETING not installed");
34002 return pc->phs.handlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet(pc, packet);
34003}
34004
34005 void lsend_packet_diplomacy_init_meeting(struct conn_list *dest, const struct packet_diplomacy_init_meeting *packet)
34006{
34007 conn_list_iterate(dest, pconn) {
34008 send_packet_diplomacy_init_meeting(pconn, packet);
34009 } conn_list_iterate_end;
34010}
34011
34012 int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
34013{
34014 struct packet_diplomacy_init_meeting packet, *real_packet = &packet;
34015
34016 real_packet->counterpart = counterpart;
34017 real_packet->initiated_from = initiated_from;
34018
34019 return send_packet_diplomacy_init_meeting(pc, real_packet);
34020}
34021
34022 void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
34023{
34024 struct packet_diplomacy_init_meeting packet, *real_packet = &packet;
34025
34026 real_packet->counterpart = counterpart;
34027 real_packet->initiated_from = initiated_from;
34028
34029 lsend_packet_diplomacy_init_meeting(dest, real_packet);
34030}
34031
34032#ifdef FREECIV_DELTA_PROTOCOL
34033#define hash_packet_diplomacy_cancel_meeting_req_100 hash_const
34034
34035#define cmp_packet_diplomacy_cancel_meeting_req_100 cmp_const
34036
34037 BV_DEFINE(packet_diplomacy_cancel_meeting_req_100_fields, 1);
34038#endif /* FREECIV_DELTA_PROTOCOL */
34039
34040 static struct packet_diplomacy_cancel_meeting_req *receive_packet_diplomacy_cancel_meeting_req_100(struct connection *pc)
34041{
34042#ifdef FREECIV_DELTA_PROTOCOL
34043 packet_diplomacy_cancel_meeting_req_100_fields fields;
34044 struct packet_diplomacy_cancel_meeting_req *old;
34045 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_MEETING_REQ;
34046#endif /* FREECIV_DELTA_PROTOCOL */
34047 RECEIVE_PACKET_START(packet_diplomacy_cancel_meeting_req, real_packet);
34048#ifdef FREECIV_JSON_CONNECTION
34049 struct plocation field_addr;
34050 {
34051 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34052 field_addr = *field_addr_tmp;
34053 FC_FREE(field_addr_tmp);
34054 }
34055#endif /* FREECIV_JSON_CONNECTION */
34056
34057#ifdef FREECIV_DELTA_PROTOCOL
34058#ifdef FREECIV_JSON_CONNECTION
34059 field_addr.name = "fields";
34060#endif /* FREECIV_JSON_CONNECTION */
34061 DIO_BV_GET(&din, &field_addr, fields);
34062
34063#else /* FREECIV_DELTA_PROTOCOL */
34064#ifdef FREECIV_JSON_CONNECTION
34065 field_addr.name = "counterpart";
34066#endif /* FREECIV_JSON_CONNECTION */
34067 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34068 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34069 }
34070#endif
34071 log_packet_detailed("packet_diplomacy_cancel_meeting_req_100: got info about ()");
34072
34073#ifdef FREECIV_DELTA_PROTOCOL
34074 if (NULL == *hash) {
34075 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_req_100, cmp_packet_diplomacy_cancel_meeting_req_100,
34076 NULL, NULL, NULL, free);
34077 }
34078
34079 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
34080 *real_packet = *old;
34081 } else {
34082 log_packet_detailed(" no old info");
34083 memset(real_packet, 0, sizeof(*real_packet));
34084 }
34085
34086 if (BV_ISSET(fields, 0)) {
34087 log_packet_detailed(" got field 'counterpart'");
34088#ifdef FREECIV_JSON_CONNECTION
34089 field_addr.name = "counterpart";
34090#endif /* FREECIV_JSON_CONNECTION */
34091 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34092 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34093 }
34094 }
34095
34096 if (NULL == old) {
34097 old = fc_malloc(sizeof(*old));
34098 *old = *real_packet;
34099 genhash_insert(*hash, old, old);
34100 } else {
34101 *old = *real_packet;
34102 }
34103
34104#endif /* FREECIV_DELTA_PROTOCOL */
34105 RECEIVE_PACKET_END(real_packet);
34106}
34107
34108 static int send_packet_diplomacy_cancel_meeting_req_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
34109{
34110 const struct packet_diplomacy_cancel_meeting_req *real_packet = packet;
34111 int e;
34112#ifdef FREECIV_DELTA_PROTOCOL
34113 packet_diplomacy_cancel_meeting_req_100_fields fields;
34114 struct packet_diplomacy_cancel_meeting_req *old;
34115 bool differ;
34116 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_MEETING_REQ;
34117#endif /* FREECIV_DELTA_PROTOCOL */
34118 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_MEETING_REQ);
34119#ifdef FREECIV_JSON_CONNECTION
34120 struct plocation field_addr;
34121 {
34122 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34123 field_addr = *field_addr_tmp;
34124 FC_FREE(field_addr_tmp);
34125 }
34126#endif /* FREECIV_JSON_CONNECTION */
34127
34128 log_packet_detailed("packet_diplomacy_cancel_meeting_req_100: sending info about ()");
34129
34130#ifdef FREECIV_DELTA_PROTOCOL
34131 if (NULL == *hash) {
34132 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_req_100, cmp_packet_diplomacy_cancel_meeting_req_100,
34133 NULL, NULL, NULL, free);
34134 }
34135 BV_CLR_ALL(fields);
34136
34137 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
34138 old = fc_malloc(sizeof(*old));
34139 *old = *real_packet;
34140 genhash_insert(*hash, old, old);
34141 memset(old, 0, sizeof(*old));
34142 }
34143 differ = (old->counterpart != real_packet->counterpart);
34144 if (differ) {
34145 BV_SET(fields, 0);
34146 }
34147
34148
34149#ifdef FREECIV_JSON_CONNECTION
34150 field_addr.name = "fields";
34151#endif /* FREECIV_JSON_CONNECTION */
34152 e = 0;
34153 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34154 if (e) {
34155 log_packet_detailed("fields bitvector error detected");
34156 }
34157
34158 if (BV_ISSET(fields, 0)) {
34159 log_packet_detailed(" field 'counterpart' has changed");
34160#ifdef FREECIV_JSON_CONNECTION
34161 field_addr.name = "counterpart";
34162#endif /* FREECIV_JSON_CONNECTION */
34163 e = 0;
34164 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34165 if (e) {
34166 log_packet_detailed("'counterpart' field error detected");
34167 }
34168 }
34169
34170 *old = *real_packet;
34171#endif /* FREECIV_DELTA_PROTOCOL */
34172#ifndef FREECIV_DELTA_PROTOCOL
34173#ifdef FREECIV_JSON_CONNECTION
34174 field_addr.name = "counterpart";
34175#endif /* FREECIV_JSON_CONNECTION */
34176 e = 0;
34177 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34178 if (e) {
34179 log_packet_detailed("'counterpart' field error detected");
34180 }
34181
34182#endif
34183 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_MEETING_REQ);
34184}
34185
34186 int send_packet_diplomacy_cancel_meeting_req(struct connection *pc, const struct packet_diplomacy_cancel_meeting_req *packet)
34187{
34188 if (!pc->used) {
34189 log_error("WARNING: trying to send data to the closed connection %s",
34190 conn_description(pc));
34191 return -1;
34192 }
34193 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet != NULL, -1,
34194 "Handler for PACKET_DIPLOMACY_CANCEL_MEETING_REQ not installed");
34195 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet(pc, packet);
34196}
34197
34198 int dsend_packet_diplomacy_cancel_meeting_req(struct connection *pc, int counterpart)
34199{
34200 struct packet_diplomacy_cancel_meeting_req packet, *real_packet = &packet;
34201
34202 real_packet->counterpart = counterpart;
34203
34204 return send_packet_diplomacy_cancel_meeting_req(pc, real_packet);
34205}
34206
34207#ifdef FREECIV_DELTA_PROTOCOL
34208#define hash_packet_diplomacy_cancel_meeting_100 hash_const
34209
34210#define cmp_packet_diplomacy_cancel_meeting_100 cmp_const
34211
34212 BV_DEFINE(packet_diplomacy_cancel_meeting_100_fields, 2);
34213#endif /* FREECIV_DELTA_PROTOCOL */
34214
34215 static struct packet_diplomacy_cancel_meeting *receive_packet_diplomacy_cancel_meeting_100(struct connection *pc)
34216{
34217#ifdef FREECIV_DELTA_PROTOCOL
34218 packet_diplomacy_cancel_meeting_100_fields fields;
34219 struct packet_diplomacy_cancel_meeting *old;
34220 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_MEETING;
34221#endif /* FREECIV_DELTA_PROTOCOL */
34222 RECEIVE_PACKET_START(packet_diplomacy_cancel_meeting, real_packet);
34223#ifdef FREECIV_JSON_CONNECTION
34224 struct plocation field_addr;
34225 {
34226 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34227 field_addr = *field_addr_tmp;
34228 FC_FREE(field_addr_tmp);
34229 }
34230#endif /* FREECIV_JSON_CONNECTION */
34231
34232#ifdef FREECIV_DELTA_PROTOCOL
34233#ifdef FREECIV_JSON_CONNECTION
34234 field_addr.name = "fields";
34235#endif /* FREECIV_JSON_CONNECTION */
34236 DIO_BV_GET(&din, &field_addr, fields);
34237
34238#else /* FREECIV_DELTA_PROTOCOL */
34239#ifdef FREECIV_JSON_CONNECTION
34240 field_addr.name = "counterpart";
34241#endif /* FREECIV_JSON_CONNECTION */
34242 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34243 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34244 }
34245#ifdef FREECIV_JSON_CONNECTION
34246 field_addr.name = "initiated_from";
34247#endif /* FREECIV_JSON_CONNECTION */
34248 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
34249 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
34250 }
34251#endif
34252 log_packet_detailed("packet_diplomacy_cancel_meeting_100: got info about ()");
34253
34254#ifdef FREECIV_DELTA_PROTOCOL
34255 if (NULL == *hash) {
34256 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_100, cmp_packet_diplomacy_cancel_meeting_100,
34257 NULL, NULL, NULL, free);
34258 }
34259
34260 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
34261 *real_packet = *old;
34262 } else {
34263 log_packet_detailed(" no old info");
34264 memset(real_packet, 0, sizeof(*real_packet));
34265 }
34266
34267 if (BV_ISSET(fields, 0)) {
34268 log_packet_detailed(" got field 'counterpart'");
34269#ifdef FREECIV_JSON_CONNECTION
34270 field_addr.name = "counterpart";
34271#endif /* FREECIV_JSON_CONNECTION */
34272 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34273 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34274 }
34275 }
34276 if (BV_ISSET(fields, 1)) {
34277 log_packet_detailed(" got field 'initiated_from'");
34278#ifdef FREECIV_JSON_CONNECTION
34279 field_addr.name = "initiated_from";
34280#endif /* FREECIV_JSON_CONNECTION */
34281 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->initiated_from)) {
34282 RECEIVE_PACKET_FIELD_ERROR(initiated_from);
34283 }
34284 }
34285
34286 if (NULL == old) {
34287 old = fc_malloc(sizeof(*old));
34288 *old = *real_packet;
34289 genhash_insert(*hash, old, old);
34290 } else {
34291 *old = *real_packet;
34292 }
34293
34294#endif /* FREECIV_DELTA_PROTOCOL */
34295 RECEIVE_PACKET_END(real_packet);
34296}
34297
34298 static int send_packet_diplomacy_cancel_meeting_100(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
34299{
34300 const struct packet_diplomacy_cancel_meeting *real_packet = packet;
34301 int e;
34302#ifdef FREECIV_DELTA_PROTOCOL
34303 packet_diplomacy_cancel_meeting_100_fields fields;
34304 struct packet_diplomacy_cancel_meeting *old;
34305 bool differ;
34306 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_MEETING;
34307#endif /* FREECIV_DELTA_PROTOCOL */
34308 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_MEETING);
34309#ifdef FREECIV_JSON_CONNECTION
34310 struct plocation field_addr;
34311 {
34312 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34313 field_addr = *field_addr_tmp;
34314 FC_FREE(field_addr_tmp);
34315 }
34316#endif /* FREECIV_JSON_CONNECTION */
34317
34318 log_packet_detailed("packet_diplomacy_cancel_meeting_100: sending info about ()");
34319
34320#ifdef FREECIV_DELTA_PROTOCOL
34321 if (NULL == *hash) {
34322 *hash = genhash_new_full(hash_packet_diplomacy_cancel_meeting_100, cmp_packet_diplomacy_cancel_meeting_100,
34323 NULL, NULL, NULL, free);
34324 }
34325 BV_CLR_ALL(fields);
34326
34327 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
34328 old = fc_malloc(sizeof(*old));
34329 *old = *real_packet;
34330 genhash_insert(*hash, old, old);
34331 memset(old, 0, sizeof(*old));
34332 }
34333 differ = (old->counterpart != real_packet->counterpart);
34334 if (differ) {
34335 BV_SET(fields, 0);
34336 }
34337
34338 differ = (old->initiated_from != real_packet->initiated_from);
34339 if (differ) {
34340 BV_SET(fields, 1);
34341 }
34342
34343
34344#ifdef FREECIV_JSON_CONNECTION
34345 field_addr.name = "fields";
34346#endif /* FREECIV_JSON_CONNECTION */
34347 e = 0;
34348 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34349 if (e) {
34350 log_packet_detailed("fields bitvector error detected");
34351 }
34352
34353 if (BV_ISSET(fields, 0)) {
34354 log_packet_detailed(" field 'counterpart' has changed");
34355#ifdef FREECIV_JSON_CONNECTION
34356 field_addr.name = "counterpart";
34357#endif /* FREECIV_JSON_CONNECTION */
34358 e = 0;
34359 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34360 if (e) {
34361 log_packet_detailed("'counterpart' field error detected");
34362 }
34363 }
34364 if (BV_ISSET(fields, 1)) {
34365 log_packet_detailed(" field 'initiated_from' has changed");
34366#ifdef FREECIV_JSON_CONNECTION
34367 field_addr.name = "initiated_from";
34368#endif /* FREECIV_JSON_CONNECTION */
34369 e = 0;
34370 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
34371 if (e) {
34372 log_packet_detailed("'initiated_from' field error detected");
34373 }
34374 }
34375
34376 *old = *real_packet;
34377#endif /* FREECIV_DELTA_PROTOCOL */
34378#ifndef FREECIV_DELTA_PROTOCOL
34379#ifdef FREECIV_JSON_CONNECTION
34380 field_addr.name = "counterpart";
34381#endif /* FREECIV_JSON_CONNECTION */
34382 e = 0;
34383 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34384 if (e) {
34385 log_packet_detailed("'counterpart' field error detected");
34386 }
34387#ifdef FREECIV_JSON_CONNECTION
34388 field_addr.name = "initiated_from";
34389#endif /* FREECIV_JSON_CONNECTION */
34390 e = 0;
34391 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->initiated_from);
34392 if (e) {
34393 log_packet_detailed("'initiated_from' field error detected");
34394 }
34395
34396#endif
34397 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_MEETING);
34398}
34399
34400 int send_packet_diplomacy_cancel_meeting(struct connection *pc, const struct packet_diplomacy_cancel_meeting *packet)
34401{
34402 if (!pc->used) {
34403 log_error("WARNING: trying to send data to the closed connection %s",
34404 conn_description(pc));
34405 return -1;
34406 }
34407 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet != NULL, -1,
34408 "Handler for PACKET_DIPLOMACY_CANCEL_MEETING not installed");
34409 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet(pc, packet);
34410}
34411
34412 void lsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, const struct packet_diplomacy_cancel_meeting *packet)
34413{
34414 conn_list_iterate(dest, pconn) {
34415 send_packet_diplomacy_cancel_meeting(pconn, packet);
34416 } conn_list_iterate_end;
34417}
34418
34419 int dsend_packet_diplomacy_cancel_meeting(struct connection *pc, int counterpart, int initiated_from)
34420{
34421 struct packet_diplomacy_cancel_meeting packet, *real_packet = &packet;
34422
34423 real_packet->counterpart = counterpart;
34424 real_packet->initiated_from = initiated_from;
34425
34426 return send_packet_diplomacy_cancel_meeting(pc, real_packet);
34427}
34428
34429 void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
34430{
34431 struct packet_diplomacy_cancel_meeting packet, *real_packet = &packet;
34432
34433 real_packet->counterpart = counterpart;
34434 real_packet->initiated_from = initiated_from;
34435
34436 lsend_packet_diplomacy_cancel_meeting(dest, real_packet);
34437}
34438
34439#ifdef FREECIV_DELTA_PROTOCOL
34440#define hash_packet_diplomacy_create_clause_req_100 hash_const
34441
34442#define cmp_packet_diplomacy_create_clause_req_100 cmp_const
34443
34444 BV_DEFINE(packet_diplomacy_create_clause_req_100_fields, 4);
34445#endif /* FREECIV_DELTA_PROTOCOL */
34446
34447 static struct packet_diplomacy_create_clause_req *receive_packet_diplomacy_create_clause_req_100(struct connection *pc)
34448{
34449#ifdef FREECIV_DELTA_PROTOCOL
34450 packet_diplomacy_create_clause_req_100_fields fields;
34451 struct packet_diplomacy_create_clause_req *old;
34452 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CREATE_CLAUSE_REQ;
34453#endif /* FREECIV_DELTA_PROTOCOL */
34454 RECEIVE_PACKET_START(packet_diplomacy_create_clause_req, real_packet);
34455#ifdef FREECIV_JSON_CONNECTION
34456 struct plocation field_addr;
34457 {
34458 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34459 field_addr = *field_addr_tmp;
34460 FC_FREE(field_addr_tmp);
34461 }
34462#endif /* FREECIV_JSON_CONNECTION */
34463
34464#ifdef FREECIV_DELTA_PROTOCOL
34465#ifdef FREECIV_JSON_CONNECTION
34466 field_addr.name = "fields";
34467#endif /* FREECIV_JSON_CONNECTION */
34468 DIO_BV_GET(&din, &field_addr, fields);
34469
34470#else /* FREECIV_DELTA_PROTOCOL */
34471#ifdef FREECIV_JSON_CONNECTION
34472 field_addr.name = "counterpart";
34473#endif /* FREECIV_JSON_CONNECTION */
34474 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34475 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34476 }
34477#ifdef FREECIV_JSON_CONNECTION
34478 field_addr.name = "giver";
34479#endif /* FREECIV_JSON_CONNECTION */
34480 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
34481 RECEIVE_PACKET_FIELD_ERROR(giver);
34482 }
34483#ifdef FREECIV_JSON_CONNECTION
34484 field_addr.name = "type";
34485#endif /* FREECIV_JSON_CONNECTION */
34486 {
34487 int readin;
34488
34489 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
34490 RECEIVE_PACKET_FIELD_ERROR(type);
34491 }
34492 real_packet->type = readin;
34493 }
34494#ifdef FREECIV_JSON_CONNECTION
34495 field_addr.name = "value";
34496#endif /* FREECIV_JSON_CONNECTION */
34497 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
34498 RECEIVE_PACKET_FIELD_ERROR(value);
34499 }
34500#endif
34501 log_packet_detailed("packet_diplomacy_create_clause_req_100: got info about ()");
34502
34503#ifdef FREECIV_DELTA_PROTOCOL
34504 if (NULL == *hash) {
34505 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_req_100, cmp_packet_diplomacy_create_clause_req_100,
34506 NULL, NULL, NULL, free);
34507 }
34508
34509 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
34510 *real_packet = *old;
34511 } else {
34512 log_packet_detailed(" no old info");
34513 memset(real_packet, 0, sizeof(*real_packet));
34514 }
34515
34516 if (BV_ISSET(fields, 0)) {
34517 log_packet_detailed(" got field 'counterpart'");
34518#ifdef FREECIV_JSON_CONNECTION
34519 field_addr.name = "counterpart";
34520#endif /* FREECIV_JSON_CONNECTION */
34521 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34522 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34523 }
34524 }
34525 if (BV_ISSET(fields, 1)) {
34526 log_packet_detailed(" got field 'giver'");
34527#ifdef FREECIV_JSON_CONNECTION
34528 field_addr.name = "giver";
34529#endif /* FREECIV_JSON_CONNECTION */
34530 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
34531 RECEIVE_PACKET_FIELD_ERROR(giver);
34532 }
34533 }
34534 if (BV_ISSET(fields, 2)) {
34535 log_packet_detailed(" got field 'type'");
34536#ifdef FREECIV_JSON_CONNECTION
34537 field_addr.name = "type";
34538#endif /* FREECIV_JSON_CONNECTION */
34539 {
34540 int readin;
34541
34542 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
34543 RECEIVE_PACKET_FIELD_ERROR(type);
34544 }
34545 real_packet->type = readin;
34546 }
34547 }
34548 if (BV_ISSET(fields, 3)) {
34549 log_packet_detailed(" got field 'value'");
34550#ifdef FREECIV_JSON_CONNECTION
34551 field_addr.name = "value";
34552#endif /* FREECIV_JSON_CONNECTION */
34553 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
34554 RECEIVE_PACKET_FIELD_ERROR(value);
34555 }
34556 }
34557
34558 if (NULL == old) {
34559 old = fc_malloc(sizeof(*old));
34560 *old = *real_packet;
34561 genhash_insert(*hash, old, old);
34562 } else {
34563 *old = *real_packet;
34564 }
34565
34566#endif /* FREECIV_DELTA_PROTOCOL */
34567 RECEIVE_PACKET_END(real_packet);
34568}
34569
34570 static int send_packet_diplomacy_create_clause_req_100(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
34571{
34572 const struct packet_diplomacy_create_clause_req *real_packet = packet;
34573 int e;
34574#ifdef FREECIV_DELTA_PROTOCOL
34575 packet_diplomacy_create_clause_req_100_fields fields;
34576 struct packet_diplomacy_create_clause_req *old;
34577 bool differ;
34578 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CREATE_CLAUSE_REQ;
34579#endif /* FREECIV_DELTA_PROTOCOL */
34580 SEND_PACKET_START(PACKET_DIPLOMACY_CREATE_CLAUSE_REQ);
34581#ifdef FREECIV_JSON_CONNECTION
34582 struct plocation field_addr;
34583 {
34584 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34585 field_addr = *field_addr_tmp;
34586 FC_FREE(field_addr_tmp);
34587 }
34588#endif /* FREECIV_JSON_CONNECTION */
34589
34590 log_packet_detailed("packet_diplomacy_create_clause_req_100: sending info about ()");
34591
34592#ifdef FREECIV_DELTA_PROTOCOL
34593 if (NULL == *hash) {
34594 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_req_100, cmp_packet_diplomacy_create_clause_req_100,
34595 NULL, NULL, NULL, free);
34596 }
34597 BV_CLR_ALL(fields);
34598
34599 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
34600 old = fc_malloc(sizeof(*old));
34601 *old = *real_packet;
34602 genhash_insert(*hash, old, old);
34603 memset(old, 0, sizeof(*old));
34604 }
34605 differ = (old->counterpart != real_packet->counterpart);
34606 if (differ) {
34607 BV_SET(fields, 0);
34608 }
34609
34610 differ = (old->giver != real_packet->giver);
34611 if (differ) {
34612 BV_SET(fields, 1);
34613 }
34614
34615 differ = (old->type != real_packet->type);
34616 if (differ) {
34617 BV_SET(fields, 2);
34618 }
34619
34620 differ = (old->value != real_packet->value);
34621 if (differ) {
34622 BV_SET(fields, 3);
34623 }
34624
34625
34626#ifdef FREECIV_JSON_CONNECTION
34627 field_addr.name = "fields";
34628#endif /* FREECIV_JSON_CONNECTION */
34629 e = 0;
34630 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34631 if (e) {
34632 log_packet_detailed("fields bitvector error detected");
34633 }
34634
34635 if (BV_ISSET(fields, 0)) {
34636 log_packet_detailed(" field 'counterpart' has changed");
34637#ifdef FREECIV_JSON_CONNECTION
34638 field_addr.name = "counterpart";
34639#endif /* FREECIV_JSON_CONNECTION */
34640 e = 0;
34641 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34642 if (e) {
34643 log_packet_detailed("'counterpart' field error detected");
34644 }
34645 }
34646 if (BV_ISSET(fields, 1)) {
34647 log_packet_detailed(" field 'giver' has changed");
34648#ifdef FREECIV_JSON_CONNECTION
34649 field_addr.name = "giver";
34650#endif /* FREECIV_JSON_CONNECTION */
34651 e = 0;
34652 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
34653 if (e) {
34654 log_packet_detailed("'giver' field error detected");
34655 }
34656 }
34657 if (BV_ISSET(fields, 2)) {
34658 log_packet_detailed(" field 'type' has changed");
34659#ifdef FREECIV_JSON_CONNECTION
34660 field_addr.name = "type";
34661#endif /* FREECIV_JSON_CONNECTION */
34662 e = 0;
34663 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
34664 if (e) {
34665 log_packet_detailed("'type' field error detected");
34666 }
34667 }
34668 if (BV_ISSET(fields, 3)) {
34669 log_packet_detailed(" field 'value' has changed");
34670#ifdef FREECIV_JSON_CONNECTION
34671 field_addr.name = "value";
34672#endif /* FREECIV_JSON_CONNECTION */
34673 e = 0;
34674 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
34675 if (e) {
34676 log_packet_detailed("'value' field error detected");
34677 }
34678 }
34679
34680 *old = *real_packet;
34681#endif /* FREECIV_DELTA_PROTOCOL */
34682#ifndef FREECIV_DELTA_PROTOCOL
34683#ifdef FREECIV_JSON_CONNECTION
34684 field_addr.name = "counterpart";
34685#endif /* FREECIV_JSON_CONNECTION */
34686 e = 0;
34687 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34688 if (e) {
34689 log_packet_detailed("'counterpart' field error detected");
34690 }
34691#ifdef FREECIV_JSON_CONNECTION
34692 field_addr.name = "giver";
34693#endif /* FREECIV_JSON_CONNECTION */
34694 e = 0;
34695 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
34696 if (e) {
34697 log_packet_detailed("'giver' field error detected");
34698 }
34699#ifdef FREECIV_JSON_CONNECTION
34700 field_addr.name = "type";
34701#endif /* FREECIV_JSON_CONNECTION */
34702 e = 0;
34703 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
34704 if (e) {
34705 log_packet_detailed("'type' field error detected");
34706 }
34707#ifdef FREECIV_JSON_CONNECTION
34708 field_addr.name = "value";
34709#endif /* FREECIV_JSON_CONNECTION */
34710 e = 0;
34711 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
34712 if (e) {
34713 log_packet_detailed("'value' field error detected");
34714 }
34715
34716#endif
34717 SEND_PACKET_END(PACKET_DIPLOMACY_CREATE_CLAUSE_REQ);
34718}
34719
34720 int send_packet_diplomacy_create_clause_req(struct connection *pc, const struct packet_diplomacy_create_clause_req *packet)
34721{
34722 if (!pc->used) {
34723 log_error("WARNING: trying to send data to the closed connection %s",
34724 conn_description(pc));
34725 return -1;
34726 }
34727 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet != NULL, -1,
34728 "Handler for PACKET_DIPLOMACY_CREATE_CLAUSE_REQ not installed");
34729 return pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet(pc, packet);
34730}
34731
34732 int dsend_packet_diplomacy_create_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
34733{
34734 struct packet_diplomacy_create_clause_req packet, *real_packet = &packet;
34735
34736 real_packet->counterpart = counterpart;
34737 real_packet->giver = giver;
34738 real_packet->type = type;
34739 real_packet->value = value;
34740
34741 return send_packet_diplomacy_create_clause_req(pc, real_packet);
34742}
34743
34744#ifdef FREECIV_DELTA_PROTOCOL
34745#define hash_packet_diplomacy_create_clause_100 hash_const
34746
34747#define cmp_packet_diplomacy_create_clause_100 cmp_const
34748
34749 BV_DEFINE(packet_diplomacy_create_clause_100_fields, 4);
34750#endif /* FREECIV_DELTA_PROTOCOL */
34751
34752 static struct packet_diplomacy_create_clause *receive_packet_diplomacy_create_clause_100(struct connection *pc)
34753{
34754#ifdef FREECIV_DELTA_PROTOCOL
34755 packet_diplomacy_create_clause_100_fields fields;
34756 struct packet_diplomacy_create_clause *old;
34757 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CREATE_CLAUSE;
34758#endif /* FREECIV_DELTA_PROTOCOL */
34759 RECEIVE_PACKET_START(packet_diplomacy_create_clause, real_packet);
34760#ifdef FREECIV_JSON_CONNECTION
34761 struct plocation field_addr;
34762 {
34763 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34764 field_addr = *field_addr_tmp;
34765 FC_FREE(field_addr_tmp);
34766 }
34767#endif /* FREECIV_JSON_CONNECTION */
34768
34769#ifdef FREECIV_DELTA_PROTOCOL
34770#ifdef FREECIV_JSON_CONNECTION
34771 field_addr.name = "fields";
34772#endif /* FREECIV_JSON_CONNECTION */
34773 DIO_BV_GET(&din, &field_addr, fields);
34774
34775#else /* FREECIV_DELTA_PROTOCOL */
34776#ifdef FREECIV_JSON_CONNECTION
34777 field_addr.name = "counterpart";
34778#endif /* FREECIV_JSON_CONNECTION */
34779 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34780 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34781 }
34782#ifdef FREECIV_JSON_CONNECTION
34783 field_addr.name = "giver";
34784#endif /* FREECIV_JSON_CONNECTION */
34785 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
34786 RECEIVE_PACKET_FIELD_ERROR(giver);
34787 }
34788#ifdef FREECIV_JSON_CONNECTION
34789 field_addr.name = "type";
34790#endif /* FREECIV_JSON_CONNECTION */
34791 {
34792 int readin;
34793
34794 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
34795 RECEIVE_PACKET_FIELD_ERROR(type);
34796 }
34797 real_packet->type = readin;
34798 }
34799#ifdef FREECIV_JSON_CONNECTION
34800 field_addr.name = "value";
34801#endif /* FREECIV_JSON_CONNECTION */
34802 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
34803 RECEIVE_PACKET_FIELD_ERROR(value);
34804 }
34805#endif
34806 log_packet_detailed("packet_diplomacy_create_clause_100: got info about ()");
34807
34808#ifdef FREECIV_DELTA_PROTOCOL
34809 if (NULL == *hash) {
34810 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_100, cmp_packet_diplomacy_create_clause_100,
34811 NULL, NULL, NULL, free);
34812 }
34813
34814 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
34815 *real_packet = *old;
34816 } else {
34817 log_packet_detailed(" no old info");
34818 memset(real_packet, 0, sizeof(*real_packet));
34819 }
34820
34821 if (BV_ISSET(fields, 0)) {
34822 log_packet_detailed(" got field 'counterpart'");
34823#ifdef FREECIV_JSON_CONNECTION
34824 field_addr.name = "counterpart";
34825#endif /* FREECIV_JSON_CONNECTION */
34826 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
34827 RECEIVE_PACKET_FIELD_ERROR(counterpart);
34828 }
34829 }
34830 if (BV_ISSET(fields, 1)) {
34831 log_packet_detailed(" got field 'giver'");
34832#ifdef FREECIV_JSON_CONNECTION
34833 field_addr.name = "giver";
34834#endif /* FREECIV_JSON_CONNECTION */
34835 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
34836 RECEIVE_PACKET_FIELD_ERROR(giver);
34837 }
34838 }
34839 if (BV_ISSET(fields, 2)) {
34840 log_packet_detailed(" got field 'type'");
34841#ifdef FREECIV_JSON_CONNECTION
34842 field_addr.name = "type";
34843#endif /* FREECIV_JSON_CONNECTION */
34844 {
34845 int readin;
34846
34847 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
34848 RECEIVE_PACKET_FIELD_ERROR(type);
34849 }
34850 real_packet->type = readin;
34851 }
34852 }
34853 if (BV_ISSET(fields, 3)) {
34854 log_packet_detailed(" got field 'value'");
34855#ifdef FREECIV_JSON_CONNECTION
34856 field_addr.name = "value";
34857#endif /* FREECIV_JSON_CONNECTION */
34858 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
34859 RECEIVE_PACKET_FIELD_ERROR(value);
34860 }
34861 }
34862
34863 if (NULL == old) {
34864 old = fc_malloc(sizeof(*old));
34865 *old = *real_packet;
34866 genhash_insert(*hash, old, old);
34867 } else {
34868 *old = *real_packet;
34869 }
34870
34871#endif /* FREECIV_DELTA_PROTOCOL */
34872 RECEIVE_PACKET_END(real_packet);
34873}
34874
34875 static int send_packet_diplomacy_create_clause_100(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
34876{
34877 const struct packet_diplomacy_create_clause *real_packet = packet;
34878 int e;
34879#ifdef FREECIV_DELTA_PROTOCOL
34880 packet_diplomacy_create_clause_100_fields fields;
34881 struct packet_diplomacy_create_clause *old;
34882 bool differ;
34883 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CREATE_CLAUSE;
34884#endif /* FREECIV_DELTA_PROTOCOL */
34885 SEND_PACKET_START(PACKET_DIPLOMACY_CREATE_CLAUSE);
34886#ifdef FREECIV_JSON_CONNECTION
34887 struct plocation field_addr;
34888 {
34889 struct plocation *field_addr_tmp = plocation_field_new(NULL);
34890 field_addr = *field_addr_tmp;
34891 FC_FREE(field_addr_tmp);
34892 }
34893#endif /* FREECIV_JSON_CONNECTION */
34894
34895 log_packet_detailed("packet_diplomacy_create_clause_100: sending info about ()");
34896
34897#ifdef FREECIV_DELTA_PROTOCOL
34898 if (NULL == *hash) {
34899 *hash = genhash_new_full(hash_packet_diplomacy_create_clause_100, cmp_packet_diplomacy_create_clause_100,
34900 NULL, NULL, NULL, free);
34901 }
34902 BV_CLR_ALL(fields);
34903
34904 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
34905 old = fc_malloc(sizeof(*old));
34906 *old = *real_packet;
34907 genhash_insert(*hash, old, old);
34908 memset(old, 0, sizeof(*old));
34909 }
34910 differ = (old->counterpart != real_packet->counterpart);
34911 if (differ) {
34912 BV_SET(fields, 0);
34913 }
34914
34915 differ = (old->giver != real_packet->giver);
34916 if (differ) {
34917 BV_SET(fields, 1);
34918 }
34919
34920 differ = (old->type != real_packet->type);
34921 if (differ) {
34922 BV_SET(fields, 2);
34923 }
34924
34925 differ = (old->value != real_packet->value);
34926 if (differ) {
34927 BV_SET(fields, 3);
34928 }
34929
34930
34931#ifdef FREECIV_JSON_CONNECTION
34932 field_addr.name = "fields";
34933#endif /* FREECIV_JSON_CONNECTION */
34934 e = 0;
34935 e |= DIO_BV_PUT(&dout, &field_addr, fields);
34936 if (e) {
34937 log_packet_detailed("fields bitvector error detected");
34938 }
34939
34940 if (BV_ISSET(fields, 0)) {
34941 log_packet_detailed(" field 'counterpart' has changed");
34942#ifdef FREECIV_JSON_CONNECTION
34943 field_addr.name = "counterpart";
34944#endif /* FREECIV_JSON_CONNECTION */
34945 e = 0;
34946 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34947 if (e) {
34948 log_packet_detailed("'counterpart' field error detected");
34949 }
34950 }
34951 if (BV_ISSET(fields, 1)) {
34952 log_packet_detailed(" field 'giver' has changed");
34953#ifdef FREECIV_JSON_CONNECTION
34954 field_addr.name = "giver";
34955#endif /* FREECIV_JSON_CONNECTION */
34956 e = 0;
34957 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
34958 if (e) {
34959 log_packet_detailed("'giver' field error detected");
34960 }
34961 }
34962 if (BV_ISSET(fields, 2)) {
34963 log_packet_detailed(" field 'type' has changed");
34964#ifdef FREECIV_JSON_CONNECTION
34965 field_addr.name = "type";
34966#endif /* FREECIV_JSON_CONNECTION */
34967 e = 0;
34968 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
34969 if (e) {
34970 log_packet_detailed("'type' field error detected");
34971 }
34972 }
34973 if (BV_ISSET(fields, 3)) {
34974 log_packet_detailed(" field 'value' has changed");
34975#ifdef FREECIV_JSON_CONNECTION
34976 field_addr.name = "value";
34977#endif /* FREECIV_JSON_CONNECTION */
34978 e = 0;
34979 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
34980 if (e) {
34981 log_packet_detailed("'value' field error detected");
34982 }
34983 }
34984
34985 *old = *real_packet;
34986#endif /* FREECIV_DELTA_PROTOCOL */
34987#ifndef FREECIV_DELTA_PROTOCOL
34988#ifdef FREECIV_JSON_CONNECTION
34989 field_addr.name = "counterpart";
34990#endif /* FREECIV_JSON_CONNECTION */
34991 e = 0;
34992 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
34993 if (e) {
34994 log_packet_detailed("'counterpart' field error detected");
34995 }
34996#ifdef FREECIV_JSON_CONNECTION
34997 field_addr.name = "giver";
34998#endif /* FREECIV_JSON_CONNECTION */
34999 e = 0;
35000 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
35001 if (e) {
35002 log_packet_detailed("'giver' field error detected");
35003 }
35004#ifdef FREECIV_JSON_CONNECTION
35005 field_addr.name = "type";
35006#endif /* FREECIV_JSON_CONNECTION */
35007 e = 0;
35008 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35009 if (e) {
35010 log_packet_detailed("'type' field error detected");
35011 }
35012#ifdef FREECIV_JSON_CONNECTION
35013 field_addr.name = "value";
35014#endif /* FREECIV_JSON_CONNECTION */
35015 e = 0;
35016 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35017 if (e) {
35018 log_packet_detailed("'value' field error detected");
35019 }
35020
35021#endif
35022 SEND_PACKET_END(PACKET_DIPLOMACY_CREATE_CLAUSE);
35023}
35024
35025 int send_packet_diplomacy_create_clause(struct connection *pc, const struct packet_diplomacy_create_clause *packet)
35026{
35027 if (!pc->used) {
35028 log_error("WARNING: trying to send data to the closed connection %s",
35029 conn_description(pc));
35030 return -1;
35031 }
35032 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet != NULL, -1,
35033 "Handler for PACKET_DIPLOMACY_CREATE_CLAUSE not installed");
35034 return pc->phs.handlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet(pc, packet);
35035}
35036
35037 void lsend_packet_diplomacy_create_clause(struct conn_list *dest, const struct packet_diplomacy_create_clause *packet)
35038{
35039 conn_list_iterate(dest, pconn) {
35040 send_packet_diplomacy_create_clause(pconn, packet);
35041 } conn_list_iterate_end;
35042}
35043
35044 int dsend_packet_diplomacy_create_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
35045{
35046 struct packet_diplomacy_create_clause packet, *real_packet = &packet;
35047
35048 real_packet->counterpart = counterpart;
35049 real_packet->giver = giver;
35050 real_packet->type = type;
35051 real_packet->value = value;
35052
35053 return send_packet_diplomacy_create_clause(pc, real_packet);
35054}
35055
35056 void dlsend_packet_diplomacy_create_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
35057{
35058 struct packet_diplomacy_create_clause packet, *real_packet = &packet;
35059
35060 real_packet->counterpart = counterpart;
35061 real_packet->giver = giver;
35062 real_packet->type = type;
35063 real_packet->value = value;
35064
35065 lsend_packet_diplomacy_create_clause(dest, real_packet);
35066}
35067
35068#ifdef FREECIV_DELTA_PROTOCOL
35069#define hash_packet_diplomacy_remove_clause_req_100 hash_const
35070
35071#define cmp_packet_diplomacy_remove_clause_req_100 cmp_const
35072
35073 BV_DEFINE(packet_diplomacy_remove_clause_req_100_fields, 4);
35074#endif /* FREECIV_DELTA_PROTOCOL */
35075
35076 static struct packet_diplomacy_remove_clause_req *receive_packet_diplomacy_remove_clause_req_100(struct connection *pc)
35077{
35078#ifdef FREECIV_DELTA_PROTOCOL
35079 packet_diplomacy_remove_clause_req_100_fields fields;
35080 struct packet_diplomacy_remove_clause_req *old;
35081 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ;
35082#endif /* FREECIV_DELTA_PROTOCOL */
35083 RECEIVE_PACKET_START(packet_diplomacy_remove_clause_req, real_packet);
35084#ifdef FREECIV_JSON_CONNECTION
35085 struct plocation field_addr;
35086 {
35087 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35088 field_addr = *field_addr_tmp;
35089 FC_FREE(field_addr_tmp);
35090 }
35091#endif /* FREECIV_JSON_CONNECTION */
35092
35093#ifdef FREECIV_DELTA_PROTOCOL
35094#ifdef FREECIV_JSON_CONNECTION
35095 field_addr.name = "fields";
35096#endif /* FREECIV_JSON_CONNECTION */
35097 DIO_BV_GET(&din, &field_addr, fields);
35098
35099#else /* FREECIV_DELTA_PROTOCOL */
35100#ifdef FREECIV_JSON_CONNECTION
35101 field_addr.name = "counterpart";
35102#endif /* FREECIV_JSON_CONNECTION */
35103 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35104 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35105 }
35106#ifdef FREECIV_JSON_CONNECTION
35107 field_addr.name = "giver";
35108#endif /* FREECIV_JSON_CONNECTION */
35109 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
35110 RECEIVE_PACKET_FIELD_ERROR(giver);
35111 }
35112#ifdef FREECIV_JSON_CONNECTION
35113 field_addr.name = "type";
35114#endif /* FREECIV_JSON_CONNECTION */
35115 {
35116 int readin;
35117
35118 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35119 RECEIVE_PACKET_FIELD_ERROR(type);
35120 }
35121 real_packet->type = readin;
35122 }
35123#ifdef FREECIV_JSON_CONNECTION
35124 field_addr.name = "value";
35125#endif /* FREECIV_JSON_CONNECTION */
35126 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35127 RECEIVE_PACKET_FIELD_ERROR(value);
35128 }
35129#endif
35130 log_packet_detailed("packet_diplomacy_remove_clause_req_100: got info about ()");
35131
35132#ifdef FREECIV_DELTA_PROTOCOL
35133 if (NULL == *hash) {
35134 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_req_100, cmp_packet_diplomacy_remove_clause_req_100,
35135 NULL, NULL, NULL, free);
35136 }
35137
35138 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35139 *real_packet = *old;
35140 } else {
35141 log_packet_detailed(" no old info");
35142 memset(real_packet, 0, sizeof(*real_packet));
35143 }
35144
35145 if (BV_ISSET(fields, 0)) {
35146 log_packet_detailed(" got field 'counterpart'");
35147#ifdef FREECIV_JSON_CONNECTION
35148 field_addr.name = "counterpart";
35149#endif /* FREECIV_JSON_CONNECTION */
35150 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35151 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35152 }
35153 }
35154 if (BV_ISSET(fields, 1)) {
35155 log_packet_detailed(" got field 'giver'");
35156#ifdef FREECIV_JSON_CONNECTION
35157 field_addr.name = "giver";
35158#endif /* FREECIV_JSON_CONNECTION */
35159 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
35160 RECEIVE_PACKET_FIELD_ERROR(giver);
35161 }
35162 }
35163 if (BV_ISSET(fields, 2)) {
35164 log_packet_detailed(" got field 'type'");
35165#ifdef FREECIV_JSON_CONNECTION
35166 field_addr.name = "type";
35167#endif /* FREECIV_JSON_CONNECTION */
35168 {
35169 int readin;
35170
35171 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35172 RECEIVE_PACKET_FIELD_ERROR(type);
35173 }
35174 real_packet->type = readin;
35175 }
35176 }
35177 if (BV_ISSET(fields, 3)) {
35178 log_packet_detailed(" got field 'value'");
35179#ifdef FREECIV_JSON_CONNECTION
35180 field_addr.name = "value";
35181#endif /* FREECIV_JSON_CONNECTION */
35182 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35183 RECEIVE_PACKET_FIELD_ERROR(value);
35184 }
35185 }
35186
35187 if (NULL == old) {
35188 old = fc_malloc(sizeof(*old));
35189 *old = *real_packet;
35190 genhash_insert(*hash, old, old);
35191 } else {
35192 *old = *real_packet;
35193 }
35194
35195#endif /* FREECIV_DELTA_PROTOCOL */
35196 RECEIVE_PACKET_END(real_packet);
35197}
35198
35199 static int send_packet_diplomacy_remove_clause_req_100(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
35200{
35201 const struct packet_diplomacy_remove_clause_req *real_packet = packet;
35202 int e;
35203#ifdef FREECIV_DELTA_PROTOCOL
35204 packet_diplomacy_remove_clause_req_100_fields fields;
35205 struct packet_diplomacy_remove_clause_req *old;
35206 bool differ;
35207 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ;
35208#endif /* FREECIV_DELTA_PROTOCOL */
35209 SEND_PACKET_START(PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ);
35210#ifdef FREECIV_JSON_CONNECTION
35211 struct plocation field_addr;
35212 {
35213 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35214 field_addr = *field_addr_tmp;
35215 FC_FREE(field_addr_tmp);
35216 }
35217#endif /* FREECIV_JSON_CONNECTION */
35218
35219 log_packet_detailed("packet_diplomacy_remove_clause_req_100: sending info about ()");
35220
35221#ifdef FREECIV_DELTA_PROTOCOL
35222 if (NULL == *hash) {
35223 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_req_100, cmp_packet_diplomacy_remove_clause_req_100,
35224 NULL, NULL, NULL, free);
35225 }
35226 BV_CLR_ALL(fields);
35227
35228 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35229 old = fc_malloc(sizeof(*old));
35230 *old = *real_packet;
35231 genhash_insert(*hash, old, old);
35232 memset(old, 0, sizeof(*old));
35233 }
35234 differ = (old->counterpart != real_packet->counterpart);
35235 if (differ) {
35236 BV_SET(fields, 0);
35237 }
35238
35239 differ = (old->giver != real_packet->giver);
35240 if (differ) {
35241 BV_SET(fields, 1);
35242 }
35243
35244 differ = (old->type != real_packet->type);
35245 if (differ) {
35246 BV_SET(fields, 2);
35247 }
35248
35249 differ = (old->value != real_packet->value);
35250 if (differ) {
35251 BV_SET(fields, 3);
35252 }
35253
35254
35255#ifdef FREECIV_JSON_CONNECTION
35256 field_addr.name = "fields";
35257#endif /* FREECIV_JSON_CONNECTION */
35258 e = 0;
35259 e |= DIO_BV_PUT(&dout, &field_addr, fields);
35260 if (e) {
35261 log_packet_detailed("fields bitvector error detected");
35262 }
35263
35264 if (BV_ISSET(fields, 0)) {
35265 log_packet_detailed(" field 'counterpart' has changed");
35266#ifdef FREECIV_JSON_CONNECTION
35267 field_addr.name = "counterpart";
35268#endif /* FREECIV_JSON_CONNECTION */
35269 e = 0;
35270 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
35271 if (e) {
35272 log_packet_detailed("'counterpart' field error detected");
35273 }
35274 }
35275 if (BV_ISSET(fields, 1)) {
35276 log_packet_detailed(" field 'giver' has changed");
35277#ifdef FREECIV_JSON_CONNECTION
35278 field_addr.name = "giver";
35279#endif /* FREECIV_JSON_CONNECTION */
35280 e = 0;
35281 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
35282 if (e) {
35283 log_packet_detailed("'giver' field error detected");
35284 }
35285 }
35286 if (BV_ISSET(fields, 2)) {
35287 log_packet_detailed(" field 'type' has changed");
35288#ifdef FREECIV_JSON_CONNECTION
35289 field_addr.name = "type";
35290#endif /* FREECIV_JSON_CONNECTION */
35291 e = 0;
35292 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35293 if (e) {
35294 log_packet_detailed("'type' field error detected");
35295 }
35296 }
35297 if (BV_ISSET(fields, 3)) {
35298 log_packet_detailed(" field 'value' has changed");
35299#ifdef FREECIV_JSON_CONNECTION
35300 field_addr.name = "value";
35301#endif /* FREECIV_JSON_CONNECTION */
35302 e = 0;
35303 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35304 if (e) {
35305 log_packet_detailed("'value' field error detected");
35306 }
35307 }
35308
35309 *old = *real_packet;
35310#endif /* FREECIV_DELTA_PROTOCOL */
35311#ifndef FREECIV_DELTA_PROTOCOL
35312#ifdef FREECIV_JSON_CONNECTION
35313 field_addr.name = "counterpart";
35314#endif /* FREECIV_JSON_CONNECTION */
35315 e = 0;
35316 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
35317 if (e) {
35318 log_packet_detailed("'counterpart' field error detected");
35319 }
35320#ifdef FREECIV_JSON_CONNECTION
35321 field_addr.name = "giver";
35322#endif /* FREECIV_JSON_CONNECTION */
35323 e = 0;
35324 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
35325 if (e) {
35326 log_packet_detailed("'giver' field error detected");
35327 }
35328#ifdef FREECIV_JSON_CONNECTION
35329 field_addr.name = "type";
35330#endif /* FREECIV_JSON_CONNECTION */
35331 e = 0;
35332 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35333 if (e) {
35334 log_packet_detailed("'type' field error detected");
35335 }
35336#ifdef FREECIV_JSON_CONNECTION
35337 field_addr.name = "value";
35338#endif /* FREECIV_JSON_CONNECTION */
35339 e = 0;
35340 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35341 if (e) {
35342 log_packet_detailed("'value' field error detected");
35343 }
35344
35345#endif
35346 SEND_PACKET_END(PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ);
35347}
35348
35349 int send_packet_diplomacy_remove_clause_req(struct connection *pc, const struct packet_diplomacy_remove_clause_req *packet)
35350{
35351 if (!pc->used) {
35352 log_error("WARNING: trying to send data to the closed connection %s",
35353 conn_description(pc));
35354 return -1;
35355 }
35356 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet != NULL, -1,
35357 "Handler for PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ not installed");
35358 return pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet(pc, packet);
35359}
35360
35361 int dsend_packet_diplomacy_remove_clause_req(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
35362{
35363 struct packet_diplomacy_remove_clause_req packet, *real_packet = &packet;
35364
35365 real_packet->counterpart = counterpart;
35366 real_packet->giver = giver;
35367 real_packet->type = type;
35368 real_packet->value = value;
35369
35370 return send_packet_diplomacy_remove_clause_req(pc, real_packet);
35371}
35372
35373#ifdef FREECIV_DELTA_PROTOCOL
35374#define hash_packet_diplomacy_remove_clause_100 hash_const
35375
35376#define cmp_packet_diplomacy_remove_clause_100 cmp_const
35377
35378 BV_DEFINE(packet_diplomacy_remove_clause_100_fields, 4);
35379#endif /* FREECIV_DELTA_PROTOCOL */
35380
35381 static struct packet_diplomacy_remove_clause *receive_packet_diplomacy_remove_clause_100(struct connection *pc)
35382{
35383#ifdef FREECIV_DELTA_PROTOCOL
35384 packet_diplomacy_remove_clause_100_fields fields;
35385 struct packet_diplomacy_remove_clause *old;
35386 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_REMOVE_CLAUSE;
35387#endif /* FREECIV_DELTA_PROTOCOL */
35388 RECEIVE_PACKET_START(packet_diplomacy_remove_clause, real_packet);
35389#ifdef FREECIV_JSON_CONNECTION
35390 struct plocation field_addr;
35391 {
35392 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35393 field_addr = *field_addr_tmp;
35394 FC_FREE(field_addr_tmp);
35395 }
35396#endif /* FREECIV_JSON_CONNECTION */
35397
35398#ifdef FREECIV_DELTA_PROTOCOL
35399#ifdef FREECIV_JSON_CONNECTION
35400 field_addr.name = "fields";
35401#endif /* FREECIV_JSON_CONNECTION */
35402 DIO_BV_GET(&din, &field_addr, fields);
35403
35404#else /* FREECIV_DELTA_PROTOCOL */
35405#ifdef FREECIV_JSON_CONNECTION
35406 field_addr.name = "counterpart";
35407#endif /* FREECIV_JSON_CONNECTION */
35408 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35409 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35410 }
35411#ifdef FREECIV_JSON_CONNECTION
35412 field_addr.name = "giver";
35413#endif /* FREECIV_JSON_CONNECTION */
35414 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
35415 RECEIVE_PACKET_FIELD_ERROR(giver);
35416 }
35417#ifdef FREECIV_JSON_CONNECTION
35418 field_addr.name = "type";
35419#endif /* FREECIV_JSON_CONNECTION */
35420 {
35421 int readin;
35422
35423 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35424 RECEIVE_PACKET_FIELD_ERROR(type);
35425 }
35426 real_packet->type = readin;
35427 }
35428#ifdef FREECIV_JSON_CONNECTION
35429 field_addr.name = "value";
35430#endif /* FREECIV_JSON_CONNECTION */
35431 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35432 RECEIVE_PACKET_FIELD_ERROR(value);
35433 }
35434#endif
35435 log_packet_detailed("packet_diplomacy_remove_clause_100: got info about ()");
35436
35437#ifdef FREECIV_DELTA_PROTOCOL
35438 if (NULL == *hash) {
35439 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_100, cmp_packet_diplomacy_remove_clause_100,
35440 NULL, NULL, NULL, free);
35441 }
35442
35443 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35444 *real_packet = *old;
35445 } else {
35446 log_packet_detailed(" no old info");
35447 memset(real_packet, 0, sizeof(*real_packet));
35448 }
35449
35450 if (BV_ISSET(fields, 0)) {
35451 log_packet_detailed(" got field 'counterpart'");
35452#ifdef FREECIV_JSON_CONNECTION
35453 field_addr.name = "counterpart";
35454#endif /* FREECIV_JSON_CONNECTION */
35455 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35456 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35457 }
35458 }
35459 if (BV_ISSET(fields, 1)) {
35460 log_packet_detailed(" got field 'giver'");
35461#ifdef FREECIV_JSON_CONNECTION
35462 field_addr.name = "giver";
35463#endif /* FREECIV_JSON_CONNECTION */
35464 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->giver)) {
35465 RECEIVE_PACKET_FIELD_ERROR(giver);
35466 }
35467 }
35468 if (BV_ISSET(fields, 2)) {
35469 log_packet_detailed(" got field 'type'");
35470#ifdef FREECIV_JSON_CONNECTION
35471 field_addr.name = "type";
35472#endif /* FREECIV_JSON_CONNECTION */
35473 {
35474 int readin;
35475
35476 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
35477 RECEIVE_PACKET_FIELD_ERROR(type);
35478 }
35479 real_packet->type = readin;
35480 }
35481 }
35482 if (BV_ISSET(fields, 3)) {
35483 log_packet_detailed(" got field 'value'");
35484#ifdef FREECIV_JSON_CONNECTION
35485 field_addr.name = "value";
35486#endif /* FREECIV_JSON_CONNECTION */
35487 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->value)) {
35488 RECEIVE_PACKET_FIELD_ERROR(value);
35489 }
35490 }
35491
35492 if (NULL == old) {
35493 old = fc_malloc(sizeof(*old));
35494 *old = *real_packet;
35495 genhash_insert(*hash, old, old);
35496 } else {
35497 *old = *real_packet;
35498 }
35499
35500#endif /* FREECIV_DELTA_PROTOCOL */
35501 RECEIVE_PACKET_END(real_packet);
35502}
35503
35504 static int send_packet_diplomacy_remove_clause_100(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
35505{
35506 const struct packet_diplomacy_remove_clause *real_packet = packet;
35507 int e;
35508#ifdef FREECIV_DELTA_PROTOCOL
35509 packet_diplomacy_remove_clause_100_fields fields;
35510 struct packet_diplomacy_remove_clause *old;
35511 bool differ;
35512 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_REMOVE_CLAUSE;
35513#endif /* FREECIV_DELTA_PROTOCOL */
35514 SEND_PACKET_START(PACKET_DIPLOMACY_REMOVE_CLAUSE);
35515#ifdef FREECIV_JSON_CONNECTION
35516 struct plocation field_addr;
35517 {
35518 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35519 field_addr = *field_addr_tmp;
35520 FC_FREE(field_addr_tmp);
35521 }
35522#endif /* FREECIV_JSON_CONNECTION */
35523
35524 log_packet_detailed("packet_diplomacy_remove_clause_100: sending info about ()");
35525
35526#ifdef FREECIV_DELTA_PROTOCOL
35527 if (NULL == *hash) {
35528 *hash = genhash_new_full(hash_packet_diplomacy_remove_clause_100, cmp_packet_diplomacy_remove_clause_100,
35529 NULL, NULL, NULL, free);
35530 }
35531 BV_CLR_ALL(fields);
35532
35533 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35534 old = fc_malloc(sizeof(*old));
35535 *old = *real_packet;
35536 genhash_insert(*hash, old, old);
35537 memset(old, 0, sizeof(*old));
35538 }
35539 differ = (old->counterpart != real_packet->counterpart);
35540 if (differ) {
35541 BV_SET(fields, 0);
35542 }
35543
35544 differ = (old->giver != real_packet->giver);
35545 if (differ) {
35546 BV_SET(fields, 1);
35547 }
35548
35549 differ = (old->type != real_packet->type);
35550 if (differ) {
35551 BV_SET(fields, 2);
35552 }
35553
35554 differ = (old->value != real_packet->value);
35555 if (differ) {
35556 BV_SET(fields, 3);
35557 }
35558
35559
35560#ifdef FREECIV_JSON_CONNECTION
35561 field_addr.name = "fields";
35562#endif /* FREECIV_JSON_CONNECTION */
35563 e = 0;
35564 e |= DIO_BV_PUT(&dout, &field_addr, fields);
35565 if (e) {
35566 log_packet_detailed("fields bitvector error detected");
35567 }
35568
35569 if (BV_ISSET(fields, 0)) {
35570 log_packet_detailed(" field 'counterpart' has changed");
35571#ifdef FREECIV_JSON_CONNECTION
35572 field_addr.name = "counterpart";
35573#endif /* FREECIV_JSON_CONNECTION */
35574 e = 0;
35575 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
35576 if (e) {
35577 log_packet_detailed("'counterpart' field error detected");
35578 }
35579 }
35580 if (BV_ISSET(fields, 1)) {
35581 log_packet_detailed(" field 'giver' has changed");
35582#ifdef FREECIV_JSON_CONNECTION
35583 field_addr.name = "giver";
35584#endif /* FREECIV_JSON_CONNECTION */
35585 e = 0;
35586 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
35587 if (e) {
35588 log_packet_detailed("'giver' field error detected");
35589 }
35590 }
35591 if (BV_ISSET(fields, 2)) {
35592 log_packet_detailed(" field 'type' has changed");
35593#ifdef FREECIV_JSON_CONNECTION
35594 field_addr.name = "type";
35595#endif /* FREECIV_JSON_CONNECTION */
35596 e = 0;
35597 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35598 if (e) {
35599 log_packet_detailed("'type' field error detected");
35600 }
35601 }
35602 if (BV_ISSET(fields, 3)) {
35603 log_packet_detailed(" field 'value' has changed");
35604#ifdef FREECIV_JSON_CONNECTION
35605 field_addr.name = "value";
35606#endif /* FREECIV_JSON_CONNECTION */
35607 e = 0;
35608 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35609 if (e) {
35610 log_packet_detailed("'value' field error detected");
35611 }
35612 }
35613
35614 *old = *real_packet;
35615#endif /* FREECIV_DELTA_PROTOCOL */
35616#ifndef FREECIV_DELTA_PROTOCOL
35617#ifdef FREECIV_JSON_CONNECTION
35618 field_addr.name = "counterpart";
35619#endif /* FREECIV_JSON_CONNECTION */
35620 e = 0;
35621 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
35622 if (e) {
35623 log_packet_detailed("'counterpart' field error detected");
35624 }
35625#ifdef FREECIV_JSON_CONNECTION
35626 field_addr.name = "giver";
35627#endif /* FREECIV_JSON_CONNECTION */
35628 e = 0;
35629 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->giver);
35630 if (e) {
35631 log_packet_detailed("'giver' field error detected");
35632 }
35633#ifdef FREECIV_JSON_CONNECTION
35634 field_addr.name = "type";
35635#endif /* FREECIV_JSON_CONNECTION */
35636 e = 0;
35637 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
35638 if (e) {
35639 log_packet_detailed("'type' field error detected");
35640 }
35641#ifdef FREECIV_JSON_CONNECTION
35642 field_addr.name = "value";
35643#endif /* FREECIV_JSON_CONNECTION */
35644 e = 0;
35645 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->value);
35646 if (e) {
35647 log_packet_detailed("'value' field error detected");
35648 }
35649
35650#endif
35651 SEND_PACKET_END(PACKET_DIPLOMACY_REMOVE_CLAUSE);
35652}
35653
35654 int send_packet_diplomacy_remove_clause(struct connection *pc, const struct packet_diplomacy_remove_clause *packet)
35655{
35656 if (!pc->used) {
35657 log_error("WARNING: trying to send data to the closed connection %s",
35658 conn_description(pc));
35659 return -1;
35660 }
35661 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet != NULL, -1,
35662 "Handler for PACKET_DIPLOMACY_REMOVE_CLAUSE not installed");
35663 return pc->phs.handlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet(pc, packet);
35664}
35665
35666 void lsend_packet_diplomacy_remove_clause(struct conn_list *dest, const struct packet_diplomacy_remove_clause *packet)
35667{
35668 conn_list_iterate(dest, pconn) {
35669 send_packet_diplomacy_remove_clause(pconn, packet);
35670 } conn_list_iterate_end;
35671}
35672
35673 int dsend_packet_diplomacy_remove_clause(struct connection *pc, int counterpart, int giver, enum clause_type type, int value)
35674{
35675 struct packet_diplomacy_remove_clause packet, *real_packet = &packet;
35676
35677 real_packet->counterpart = counterpart;
35678 real_packet->giver = giver;
35679 real_packet->type = type;
35680 real_packet->value = value;
35681
35682 return send_packet_diplomacy_remove_clause(pc, real_packet);
35683}
35684
35685 void dlsend_packet_diplomacy_remove_clause(struct conn_list *dest, int counterpart, int giver, enum clause_type type, int value)
35686{
35687 struct packet_diplomacy_remove_clause packet, *real_packet = &packet;
35688
35689 real_packet->counterpart = counterpart;
35690 real_packet->giver = giver;
35691 real_packet->type = type;
35692 real_packet->value = value;
35693
35694 lsend_packet_diplomacy_remove_clause(dest, real_packet);
35695}
35696
35697#ifdef FREECIV_DELTA_PROTOCOL
35698#define hash_packet_diplomacy_accept_treaty_req_100 hash_const
35699
35700#define cmp_packet_diplomacy_accept_treaty_req_100 cmp_const
35701
35702 BV_DEFINE(packet_diplomacy_accept_treaty_req_100_fields, 1);
35703#endif /* FREECIV_DELTA_PROTOCOL */
35704
35705 static struct packet_diplomacy_accept_treaty_req *receive_packet_diplomacy_accept_treaty_req_100(struct connection *pc)
35706{
35707#ifdef FREECIV_DELTA_PROTOCOL
35708 packet_diplomacy_accept_treaty_req_100_fields fields;
35709 struct packet_diplomacy_accept_treaty_req *old;
35710 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_ACCEPT_TREATY_REQ;
35711#endif /* FREECIV_DELTA_PROTOCOL */
35712 RECEIVE_PACKET_START(packet_diplomacy_accept_treaty_req, real_packet);
35713#ifdef FREECIV_JSON_CONNECTION
35714 struct plocation field_addr;
35715 {
35716 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35717 field_addr = *field_addr_tmp;
35718 FC_FREE(field_addr_tmp);
35719 }
35720#endif /* FREECIV_JSON_CONNECTION */
35721
35722#ifdef FREECIV_DELTA_PROTOCOL
35723#ifdef FREECIV_JSON_CONNECTION
35724 field_addr.name = "fields";
35725#endif /* FREECIV_JSON_CONNECTION */
35726 DIO_BV_GET(&din, &field_addr, fields);
35727
35728#else /* FREECIV_DELTA_PROTOCOL */
35729#ifdef FREECIV_JSON_CONNECTION
35730 field_addr.name = "counterpart";
35731#endif /* FREECIV_JSON_CONNECTION */
35732 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35733 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35734 }
35735#endif
35736 log_packet_detailed("packet_diplomacy_accept_treaty_req_100: got info about ()");
35737
35738#ifdef FREECIV_DELTA_PROTOCOL
35739 if (NULL == *hash) {
35740 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_req_100, cmp_packet_diplomacy_accept_treaty_req_100,
35741 NULL, NULL, NULL, free);
35742 }
35743
35744 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35745 *real_packet = *old;
35746 } else {
35747 log_packet_detailed(" no old info");
35748 memset(real_packet, 0, sizeof(*real_packet));
35749 }
35750
35751 if (BV_ISSET(fields, 0)) {
35752 log_packet_detailed(" got field 'counterpart'");
35753#ifdef FREECIV_JSON_CONNECTION
35754 field_addr.name = "counterpart";
35755#endif /* FREECIV_JSON_CONNECTION */
35756 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35757 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35758 }
35759 }
35760
35761 if (NULL == old) {
35762 old = fc_malloc(sizeof(*old));
35763 *old = *real_packet;
35764 genhash_insert(*hash, old, old);
35765 } else {
35766 *old = *real_packet;
35767 }
35768
35769#endif /* FREECIV_DELTA_PROTOCOL */
35770 RECEIVE_PACKET_END(real_packet);
35771}
35772
35773 static int send_packet_diplomacy_accept_treaty_req_100(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
35774{
35775 const struct packet_diplomacy_accept_treaty_req *real_packet = packet;
35776 int e;
35777#ifdef FREECIV_DELTA_PROTOCOL
35778 packet_diplomacy_accept_treaty_req_100_fields fields;
35779 struct packet_diplomacy_accept_treaty_req *old;
35780 bool differ;
35781 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_ACCEPT_TREATY_REQ;
35782#endif /* FREECIV_DELTA_PROTOCOL */
35783 SEND_PACKET_START(PACKET_DIPLOMACY_ACCEPT_TREATY_REQ);
35784#ifdef FREECIV_JSON_CONNECTION
35785 struct plocation field_addr;
35786 {
35787 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35788 field_addr = *field_addr_tmp;
35789 FC_FREE(field_addr_tmp);
35790 }
35791#endif /* FREECIV_JSON_CONNECTION */
35792
35793 log_packet_detailed("packet_diplomacy_accept_treaty_req_100: sending info about ()");
35794
35795#ifdef FREECIV_DELTA_PROTOCOL
35796 if (NULL == *hash) {
35797 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_req_100, cmp_packet_diplomacy_accept_treaty_req_100,
35798 NULL, NULL, NULL, free);
35799 }
35800 BV_CLR_ALL(fields);
35801
35802 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35803 old = fc_malloc(sizeof(*old));
35804 *old = *real_packet;
35805 genhash_insert(*hash, old, old);
35806 memset(old, 0, sizeof(*old));
35807 }
35808 differ = (old->counterpart != real_packet->counterpart);
35809 if (differ) {
35810 BV_SET(fields, 0);
35811 }
35812
35813
35814#ifdef FREECIV_JSON_CONNECTION
35815 field_addr.name = "fields";
35816#endif /* FREECIV_JSON_CONNECTION */
35817 e = 0;
35818 e |= DIO_BV_PUT(&dout, &field_addr, fields);
35819 if (e) {
35820 log_packet_detailed("fields bitvector error detected");
35821 }
35822
35823 if (BV_ISSET(fields, 0)) {
35824 log_packet_detailed(" field 'counterpart' has changed");
35825#ifdef FREECIV_JSON_CONNECTION
35826 field_addr.name = "counterpart";
35827#endif /* FREECIV_JSON_CONNECTION */
35828 e = 0;
35829 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
35830 if (e) {
35831 log_packet_detailed("'counterpart' field error detected");
35832 }
35833 }
35834
35835 *old = *real_packet;
35836#endif /* FREECIV_DELTA_PROTOCOL */
35837#ifndef FREECIV_DELTA_PROTOCOL
35838#ifdef FREECIV_JSON_CONNECTION
35839 field_addr.name = "counterpart";
35840#endif /* FREECIV_JSON_CONNECTION */
35841 e = 0;
35842 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
35843 if (e) {
35844 log_packet_detailed("'counterpart' field error detected");
35845 }
35846
35847#endif
35848 SEND_PACKET_END(PACKET_DIPLOMACY_ACCEPT_TREATY_REQ);
35849}
35850
35851 int send_packet_diplomacy_accept_treaty_req(struct connection *pc, const struct packet_diplomacy_accept_treaty_req *packet)
35852{
35853 if (!pc->used) {
35854 log_error("WARNING: trying to send data to the closed connection %s",
35855 conn_description(pc));
35856 return -1;
35857 }
35858 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet != NULL, -1,
35859 "Handler for PACKET_DIPLOMACY_ACCEPT_TREATY_REQ not installed");
35860 return pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet(pc, packet);
35861}
35862
35863 int dsend_packet_diplomacy_accept_treaty_req(struct connection *pc, int counterpart)
35864{
35865 struct packet_diplomacy_accept_treaty_req packet, *real_packet = &packet;
35866
35867 real_packet->counterpart = counterpart;
35868
35869 return send_packet_diplomacy_accept_treaty_req(pc, real_packet);
35870}
35871
35872#ifdef FREECIV_DELTA_PROTOCOL
35873#define hash_packet_diplomacy_accept_treaty_100 hash_const
35874
35875#define cmp_packet_diplomacy_accept_treaty_100 cmp_const
35876
35877 BV_DEFINE(packet_diplomacy_accept_treaty_100_fields, 3);
35878#endif /* FREECIV_DELTA_PROTOCOL */
35879
35880 static struct packet_diplomacy_accept_treaty *receive_packet_diplomacy_accept_treaty_100(struct connection *pc)
35881{
35882#ifdef FREECIV_DELTA_PROTOCOL
35883 packet_diplomacy_accept_treaty_100_fields fields;
35884 struct packet_diplomacy_accept_treaty *old;
35885 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_ACCEPT_TREATY;
35886#endif /* FREECIV_DELTA_PROTOCOL */
35887 RECEIVE_PACKET_START(packet_diplomacy_accept_treaty, real_packet);
35888#ifdef FREECIV_JSON_CONNECTION
35889 struct plocation field_addr;
35890 {
35891 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35892 field_addr = *field_addr_tmp;
35893 FC_FREE(field_addr_tmp);
35894 }
35895#endif /* FREECIV_JSON_CONNECTION */
35896
35897#ifdef FREECIV_DELTA_PROTOCOL
35898#ifdef FREECIV_JSON_CONNECTION
35899 field_addr.name = "fields";
35900#endif /* FREECIV_JSON_CONNECTION */
35901 DIO_BV_GET(&din, &field_addr, fields);
35902
35903#else /* FREECIV_DELTA_PROTOCOL */
35904#ifdef FREECIV_JSON_CONNECTION
35905 field_addr.name = "counterpart";
35906#endif /* FREECIV_JSON_CONNECTION */
35907 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35908 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35909 }
35910#ifdef FREECIV_JSON_CONNECTION
35911 field_addr.name = "I_accepted";
35912#endif /* FREECIV_JSON_CONNECTION */
35913 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->I_accepted)) {
35914 RECEIVE_PACKET_FIELD_ERROR(I_accepted);
35915 }
35916#ifdef FREECIV_JSON_CONNECTION
35917 field_addr.name = "other_accepted";
35918#endif /* FREECIV_JSON_CONNECTION */
35919 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->other_accepted)) {
35920 RECEIVE_PACKET_FIELD_ERROR(other_accepted);
35921 }
35922#endif
35923 log_packet_detailed("packet_diplomacy_accept_treaty_100: got info about ()");
35924
35925#ifdef FREECIV_DELTA_PROTOCOL
35926 if (NULL == *hash) {
35927 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_100, cmp_packet_diplomacy_accept_treaty_100,
35928 NULL, NULL, NULL, free);
35929 }
35930
35931 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
35932 *real_packet = *old;
35933 } else {
35934 log_packet_detailed(" no old info");
35935 memset(real_packet, 0, sizeof(*real_packet));
35936 }
35937
35938 if (BV_ISSET(fields, 0)) {
35939 log_packet_detailed(" got field 'counterpart'");
35940#ifdef FREECIV_JSON_CONNECTION
35941 field_addr.name = "counterpart";
35942#endif /* FREECIV_JSON_CONNECTION */
35943 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->counterpart)) {
35944 RECEIVE_PACKET_FIELD_ERROR(counterpart);
35945 }
35946 }
35947 real_packet->I_accepted = BV_ISSET(fields, 1);
35948 real_packet->other_accepted = BV_ISSET(fields, 2);
35949
35950 if (NULL == old) {
35951 old = fc_malloc(sizeof(*old));
35952 *old = *real_packet;
35953 genhash_insert(*hash, old, old);
35954 } else {
35955 *old = *real_packet;
35956 }
35957
35958#endif /* FREECIV_DELTA_PROTOCOL */
35959 RECEIVE_PACKET_END(real_packet);
35960}
35961
35962 static int send_packet_diplomacy_accept_treaty_100(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
35963{
35964 const struct packet_diplomacy_accept_treaty *real_packet = packet;
35965 int e;
35966#ifdef FREECIV_DELTA_PROTOCOL
35967 packet_diplomacy_accept_treaty_100_fields fields;
35968 struct packet_diplomacy_accept_treaty *old;
35969 bool differ;
35970 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_ACCEPT_TREATY;
35971#endif /* FREECIV_DELTA_PROTOCOL */
35972 SEND_PACKET_START(PACKET_DIPLOMACY_ACCEPT_TREATY);
35973#ifdef FREECIV_JSON_CONNECTION
35974 struct plocation field_addr;
35975 {
35976 struct plocation *field_addr_tmp = plocation_field_new(NULL);
35977 field_addr = *field_addr_tmp;
35978 FC_FREE(field_addr_tmp);
35979 }
35980#endif /* FREECIV_JSON_CONNECTION */
35981
35982 log_packet_detailed("packet_diplomacy_accept_treaty_100: sending info about ()");
35983
35984#ifdef FREECIV_DELTA_PROTOCOL
35985 if (NULL == *hash) {
35986 *hash = genhash_new_full(hash_packet_diplomacy_accept_treaty_100, cmp_packet_diplomacy_accept_treaty_100,
35987 NULL, NULL, NULL, free);
35988 }
35989 BV_CLR_ALL(fields);
35990
35991 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
35992 old = fc_malloc(sizeof(*old));
35993 *old = *real_packet;
35994 genhash_insert(*hash, old, old);
35995 memset(old, 0, sizeof(*old));
35996 }
35997 differ = (old->counterpart != real_packet->counterpart);
35998 if (differ) {
35999 BV_SET(fields, 0);
36000 }
36001
36002 if (packet->I_accepted) {
36003 BV_SET(fields, 1);
36004 }
36005
36006 if (packet->other_accepted) {
36007 BV_SET(fields, 2);
36008 }
36009
36010
36011#ifdef FREECIV_JSON_CONNECTION
36012 field_addr.name = "fields";
36013#endif /* FREECIV_JSON_CONNECTION */
36014 e = 0;
36015 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36016 if (e) {
36017 log_packet_detailed("fields bitvector error detected");
36018 }
36019
36020 if (BV_ISSET(fields, 0)) {
36021 log_packet_detailed(" field 'counterpart' has changed");
36022#ifdef FREECIV_JSON_CONNECTION
36023 field_addr.name = "counterpart";
36024#endif /* FREECIV_JSON_CONNECTION */
36025 e = 0;
36026 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
36027 if (e) {
36028 log_packet_detailed("'counterpart' field error detected");
36029 }
36030 }
36031 /* field 1 is folded into the header */
36032 /* field 2 is folded into the header */
36033
36034 *old = *real_packet;
36035#endif /* FREECIV_DELTA_PROTOCOL */
36036#ifndef FREECIV_DELTA_PROTOCOL
36037#ifdef FREECIV_JSON_CONNECTION
36038 field_addr.name = "counterpart";
36039#endif /* FREECIV_JSON_CONNECTION */
36040 e = 0;
36041 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->counterpart);
36042 if (e) {
36043 log_packet_detailed("'counterpart' field error detected");
36044 }
36045#ifdef FREECIV_JSON_CONNECTION
36046 field_addr.name = "I_accepted";
36047#endif /* FREECIV_JSON_CONNECTION */
36048 e = 0;
36049 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->I_accepted);
36050 if (e) {
36051 log_packet_detailed("'I_accepted' field error detected");
36052 }
36053#ifdef FREECIV_JSON_CONNECTION
36054 field_addr.name = "other_accepted";
36055#endif /* FREECIV_JSON_CONNECTION */
36056 e = 0;
36057 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->other_accepted);
36058 if (e) {
36059 log_packet_detailed("'other_accepted' field error detected");
36060 }
36061
36062#endif
36063 SEND_PACKET_END(PACKET_DIPLOMACY_ACCEPT_TREATY);
36064}
36065
36066 int send_packet_diplomacy_accept_treaty(struct connection *pc, const struct packet_diplomacy_accept_treaty *packet)
36067{
36068 if (!pc->used) {
36069 log_error("WARNING: trying to send data to the closed connection %s",
36070 conn_description(pc));
36071 return -1;
36072 }
36073 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet != NULL, -1,
36074 "Handler for PACKET_DIPLOMACY_ACCEPT_TREATY not installed");
36075 return pc->phs.handlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet(pc, packet);
36076}
36077
36078 void lsend_packet_diplomacy_accept_treaty(struct conn_list *dest, const struct packet_diplomacy_accept_treaty *packet)
36079{
36080 conn_list_iterate(dest, pconn) {
36081 send_packet_diplomacy_accept_treaty(pconn, packet);
36082 } conn_list_iterate_end;
36083}
36084
36085 int dsend_packet_diplomacy_accept_treaty(struct connection *pc, int counterpart, bool I_accepted, bool other_accepted)
36086{
36087 struct packet_diplomacy_accept_treaty packet, *real_packet = &packet;
36088
36089 real_packet->counterpart = counterpart;
36090 real_packet->I_accepted = I_accepted;
36091 real_packet->other_accepted = other_accepted;
36092
36093 return send_packet_diplomacy_accept_treaty(pc, real_packet);
36094}
36095
36096 void dlsend_packet_diplomacy_accept_treaty(struct conn_list *dest, int counterpart, bool I_accepted, bool other_accepted)
36097{
36098 struct packet_diplomacy_accept_treaty packet, *real_packet = &packet;
36099
36100 real_packet->counterpart = counterpart;
36101 real_packet->I_accepted = I_accepted;
36102 real_packet->other_accepted = other_accepted;
36103
36104 lsend_packet_diplomacy_accept_treaty(dest, real_packet);
36105}
36106
36107#ifdef FREECIV_DELTA_PROTOCOL
36108#define hash_packet_diplomacy_cancel_pact_100 hash_const
36109
36110#define cmp_packet_diplomacy_cancel_pact_100 cmp_const
36111
36112 BV_DEFINE(packet_diplomacy_cancel_pact_100_fields, 2);
36113#endif /* FREECIV_DELTA_PROTOCOL */
36114
36115 static struct packet_diplomacy_cancel_pact *receive_packet_diplomacy_cancel_pact_100(struct connection *pc)
36116{
36117#ifdef FREECIV_DELTA_PROTOCOL
36118 packet_diplomacy_cancel_pact_100_fields fields;
36119 struct packet_diplomacy_cancel_pact *old;
36120 struct genhash **hash = pc->phs.received + PACKET_DIPLOMACY_CANCEL_PACT;
36121#endif /* FREECIV_DELTA_PROTOCOL */
36122 RECEIVE_PACKET_START(packet_diplomacy_cancel_pact, real_packet);
36123#ifdef FREECIV_JSON_CONNECTION
36124 struct plocation field_addr;
36125 {
36126 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36127 field_addr = *field_addr_tmp;
36128 FC_FREE(field_addr_tmp);
36129 }
36130#endif /* FREECIV_JSON_CONNECTION */
36131
36132#ifdef FREECIV_DELTA_PROTOCOL
36133#ifdef FREECIV_JSON_CONNECTION
36134 field_addr.name = "fields";
36135#endif /* FREECIV_JSON_CONNECTION */
36136 DIO_BV_GET(&din, &field_addr, fields);
36137
36138#else /* FREECIV_DELTA_PROTOCOL */
36139#ifdef FREECIV_JSON_CONNECTION
36140 field_addr.name = "other_player_id";
36141#endif /* FREECIV_JSON_CONNECTION */
36142 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->other_player_id)) {
36143 RECEIVE_PACKET_FIELD_ERROR(other_player_id);
36144 }
36145#ifdef FREECIV_JSON_CONNECTION
36146 field_addr.name = "clause";
36147#endif /* FREECIV_JSON_CONNECTION */
36148 {
36149 int readin;
36150
36151 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36152 RECEIVE_PACKET_FIELD_ERROR(clause);
36153 }
36154 real_packet->clause = readin;
36155 }
36156#endif
36157 log_packet_detailed("packet_diplomacy_cancel_pact_100: got info about ()");
36158
36159#ifdef FREECIV_DELTA_PROTOCOL
36160 if (NULL == *hash) {
36161 *hash = genhash_new_full(hash_packet_diplomacy_cancel_pact_100, cmp_packet_diplomacy_cancel_pact_100,
36162 NULL, NULL, NULL, free);
36163 }
36164
36165 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36166 *real_packet = *old;
36167 } else {
36168 log_packet_detailed(" no old info");
36169 memset(real_packet, 0, sizeof(*real_packet));
36170 }
36171
36172 if (BV_ISSET(fields, 0)) {
36173 log_packet_detailed(" got field 'other_player_id'");
36174#ifdef FREECIV_JSON_CONNECTION
36175 field_addr.name = "other_player_id";
36176#endif /* FREECIV_JSON_CONNECTION */
36177 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->other_player_id)) {
36178 RECEIVE_PACKET_FIELD_ERROR(other_player_id);
36179 }
36180 }
36181 if (BV_ISSET(fields, 1)) {
36182 log_packet_detailed(" got field 'clause'");
36183#ifdef FREECIV_JSON_CONNECTION
36184 field_addr.name = "clause";
36185#endif /* FREECIV_JSON_CONNECTION */
36186 {
36187 int readin;
36188
36189 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36190 RECEIVE_PACKET_FIELD_ERROR(clause);
36191 }
36192 real_packet->clause = readin;
36193 }
36194 }
36195
36196 if (NULL == old) {
36197 old = fc_malloc(sizeof(*old));
36198 *old = *real_packet;
36199 genhash_insert(*hash, old, old);
36200 } else {
36201 *old = *real_packet;
36202 }
36203
36204#endif /* FREECIV_DELTA_PROTOCOL */
36205 RECEIVE_PACKET_END(real_packet);
36206}
36207
36208 static int send_packet_diplomacy_cancel_pact_100(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
36209{
36210 const struct packet_diplomacy_cancel_pact *real_packet = packet;
36211 int e;
36212#ifdef FREECIV_DELTA_PROTOCOL
36213 packet_diplomacy_cancel_pact_100_fields fields;
36214 struct packet_diplomacy_cancel_pact *old;
36215 bool differ;
36216 struct genhash **hash = pc->phs.sent + PACKET_DIPLOMACY_CANCEL_PACT;
36217#endif /* FREECIV_DELTA_PROTOCOL */
36218 SEND_PACKET_START(PACKET_DIPLOMACY_CANCEL_PACT);
36219#ifdef FREECIV_JSON_CONNECTION
36220 struct plocation field_addr;
36221 {
36222 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36223 field_addr = *field_addr_tmp;
36224 FC_FREE(field_addr_tmp);
36225 }
36226#endif /* FREECIV_JSON_CONNECTION */
36227
36228 log_packet_detailed("packet_diplomacy_cancel_pact_100: sending info about ()");
36229
36230#ifdef FREECIV_DELTA_PROTOCOL
36231 if (NULL == *hash) {
36232 *hash = genhash_new_full(hash_packet_diplomacy_cancel_pact_100, cmp_packet_diplomacy_cancel_pact_100,
36233 NULL, NULL, NULL, free);
36234 }
36235 BV_CLR_ALL(fields);
36236
36237 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36238 old = fc_malloc(sizeof(*old));
36239 *old = *real_packet;
36240 genhash_insert(*hash, old, old);
36241 memset(old, 0, sizeof(*old));
36242 }
36243 differ = (old->other_player_id != real_packet->other_player_id);
36244 if (differ) {
36245 BV_SET(fields, 0);
36246 }
36247
36248 differ = (old->clause != real_packet->clause);
36249 if (differ) {
36250 BV_SET(fields, 1);
36251 }
36252
36253
36254#ifdef FREECIV_JSON_CONNECTION
36255 field_addr.name = "fields";
36256#endif /* FREECIV_JSON_CONNECTION */
36257 e = 0;
36258 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36259 if (e) {
36260 log_packet_detailed("fields bitvector error detected");
36261 }
36262
36263 if (BV_ISSET(fields, 0)) {
36264 log_packet_detailed(" field 'other_player_id' has changed");
36265#ifdef FREECIV_JSON_CONNECTION
36266 field_addr.name = "other_player_id";
36267#endif /* FREECIV_JSON_CONNECTION */
36268 e = 0;
36269 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->other_player_id);
36270 if (e) {
36271 log_packet_detailed("'other_player_id' field error detected");
36272 }
36273 }
36274 if (BV_ISSET(fields, 1)) {
36275 log_packet_detailed(" field 'clause' has changed");
36276#ifdef FREECIV_JSON_CONNECTION
36277 field_addr.name = "clause";
36278#endif /* FREECIV_JSON_CONNECTION */
36279 e = 0;
36280 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->clause);
36281 if (e) {
36282 log_packet_detailed("'clause' field error detected");
36283 }
36284 }
36285
36286 *old = *real_packet;
36287#endif /* FREECIV_DELTA_PROTOCOL */
36288#ifndef FREECIV_DELTA_PROTOCOL
36289#ifdef FREECIV_JSON_CONNECTION
36290 field_addr.name = "other_player_id";
36291#endif /* FREECIV_JSON_CONNECTION */
36292 e = 0;
36293 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->other_player_id);
36294 if (e) {
36295 log_packet_detailed("'other_player_id' field error detected");
36296 }
36297#ifdef FREECIV_JSON_CONNECTION
36298 field_addr.name = "clause";
36299#endif /* FREECIV_JSON_CONNECTION */
36300 e = 0;
36301 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->clause);
36302 if (e) {
36303 log_packet_detailed("'clause' field error detected");
36304 }
36305
36306#endif
36307 SEND_PACKET_END(PACKET_DIPLOMACY_CANCEL_PACT);
36308}
36309
36310 int send_packet_diplomacy_cancel_pact(struct connection *pc, const struct packet_diplomacy_cancel_pact *packet)
36311{
36312 if (!pc->used) {
36313 log_error("WARNING: trying to send data to the closed connection %s",
36314 conn_description(pc));
36315 return -1;
36316 }
36317 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet != NULL, -1,
36318 "Handler for PACKET_DIPLOMACY_CANCEL_PACT not installed");
36319 return pc->phs.handlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet(pc, packet);
36320}
36321
36322 int dsend_packet_diplomacy_cancel_pact(struct connection *pc, int other_player_id, enum clause_type clause)
36323{
36324 struct packet_diplomacy_cancel_pact packet, *real_packet = &packet;
36325
36326 real_packet->other_player_id = other_player_id;
36327 real_packet->clause = clause;
36328
36329 return send_packet_diplomacy_cancel_pact(pc, real_packet);
36330}
36331
36332#ifdef FREECIV_DELTA_PROTOCOL
36333#define hash_packet_page_msg_100 hash_const
36334
36335#define cmp_packet_page_msg_100 cmp_const
36336
36337 BV_DEFINE(packet_page_msg_100_fields, 5);
36338#endif /* FREECIV_DELTA_PROTOCOL */
36339
36340 static struct packet_page_msg *receive_packet_page_msg_100(struct connection *pc)
36341{
36342#ifdef FREECIV_DELTA_PROTOCOL
36343 packet_page_msg_100_fields fields;
36344 struct packet_page_msg *old;
36345 struct genhash **hash = pc->phs.received + PACKET_PAGE_MSG;
36346#endif /* FREECIV_DELTA_PROTOCOL */
36347 RECEIVE_PACKET_START(packet_page_msg, real_packet);
36348#ifdef FREECIV_JSON_CONNECTION
36349 struct plocation field_addr;
36350 {
36351 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36352 field_addr = *field_addr_tmp;
36353 FC_FREE(field_addr_tmp);
36354 }
36355#endif /* FREECIV_JSON_CONNECTION */
36356
36357#ifdef FREECIV_DELTA_PROTOCOL
36358#ifdef FREECIV_JSON_CONNECTION
36359 field_addr.name = "fields";
36360#endif /* FREECIV_JSON_CONNECTION */
36361 DIO_BV_GET(&din, &field_addr, fields);
36362
36363#else /* FREECIV_DELTA_PROTOCOL */
36364#ifdef FREECIV_JSON_CONNECTION
36365 field_addr.name = "caption";
36366#endif /* FREECIV_JSON_CONNECTION */
36367 if (!DIO_GET(string, &din, &field_addr, real_packet->caption, sizeof(real_packet->caption))) {
36368 RECEIVE_PACKET_FIELD_ERROR(caption);
36369 }
36370#ifdef FREECIV_JSON_CONNECTION
36371 field_addr.name = "headline";
36372#endif /* FREECIV_JSON_CONNECTION */
36373 if (!DIO_GET(string, &din, &field_addr, real_packet->headline, sizeof(real_packet->headline))) {
36374 RECEIVE_PACKET_FIELD_ERROR(headline);
36375 }
36376#ifdef FREECIV_JSON_CONNECTION
36377 field_addr.name = "event";
36378#endif /* FREECIV_JSON_CONNECTION */
36379 {
36380 int readin;
36381
36382 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
36383 RECEIVE_PACKET_FIELD_ERROR(event);
36384 }
36385 real_packet->event = readin;
36386 }
36387#ifdef FREECIV_JSON_CONNECTION
36388 field_addr.name = "len";
36389#endif /* FREECIV_JSON_CONNECTION */
36390 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->len)) {
36391 RECEIVE_PACKET_FIELD_ERROR(len);
36392 }
36393#ifdef FREECIV_JSON_CONNECTION
36394 field_addr.name = "parts";
36395#endif /* FREECIV_JSON_CONNECTION */
36396 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->parts)) {
36397 RECEIVE_PACKET_FIELD_ERROR(parts);
36398 }
36399#endif
36400 log_packet_detailed("packet_page_msg_100: got info about ()");
36401
36402#ifdef FREECIV_DELTA_PROTOCOL
36403 if (NULL == *hash) {
36404 *hash = genhash_new_full(hash_packet_page_msg_100, cmp_packet_page_msg_100,
36405 NULL, NULL, NULL, free);
36406 }
36407
36408 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36409 *real_packet = *old;
36410 } else {
36411 log_packet_detailed(" no old info");
36412 memset(real_packet, 0, sizeof(*real_packet));
36413 }
36414
36415 if (BV_ISSET(fields, 0)) {
36416 log_packet_detailed(" got field 'caption'");
36417#ifdef FREECIV_JSON_CONNECTION
36418 field_addr.name = "caption";
36419#endif /* FREECIV_JSON_CONNECTION */
36420 if (!DIO_GET(string, &din, &field_addr, real_packet->caption, sizeof(real_packet->caption))) {
36421 RECEIVE_PACKET_FIELD_ERROR(caption);
36422 }
36423 }
36424 if (BV_ISSET(fields, 1)) {
36425 log_packet_detailed(" got field 'headline'");
36426#ifdef FREECIV_JSON_CONNECTION
36427 field_addr.name = "headline";
36428#endif /* FREECIV_JSON_CONNECTION */
36429 if (!DIO_GET(string, &din, &field_addr, real_packet->headline, sizeof(real_packet->headline))) {
36430 RECEIVE_PACKET_FIELD_ERROR(headline);
36431 }
36432 }
36433 if (BV_ISSET(fields, 2)) {
36434 log_packet_detailed(" got field 'event'");
36435#ifdef FREECIV_JSON_CONNECTION
36436 field_addr.name = "event";
36437#endif /* FREECIV_JSON_CONNECTION */
36438 {
36439 int readin;
36440
36441 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
36442 RECEIVE_PACKET_FIELD_ERROR(event);
36443 }
36444 real_packet->event = readin;
36445 }
36446 }
36447 if (BV_ISSET(fields, 3)) {
36448 log_packet_detailed(" got field 'len'");
36449#ifdef FREECIV_JSON_CONNECTION
36450 field_addr.name = "len";
36451#endif /* FREECIV_JSON_CONNECTION */
36452 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->len)) {
36453 RECEIVE_PACKET_FIELD_ERROR(len);
36454 }
36455 }
36456 if (BV_ISSET(fields, 4)) {
36457 log_packet_detailed(" got field 'parts'");
36458#ifdef FREECIV_JSON_CONNECTION
36459 field_addr.name = "parts";
36460#endif /* FREECIV_JSON_CONNECTION */
36461 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->parts)) {
36462 RECEIVE_PACKET_FIELD_ERROR(parts);
36463 }
36464 }
36465
36466 if (NULL == old) {
36467 old = fc_malloc(sizeof(*old));
36468 *old = *real_packet;
36469 genhash_insert(*hash, old, old);
36470 } else {
36471 *old = *real_packet;
36472 }
36473
36474#endif /* FREECIV_DELTA_PROTOCOL */
36475 RECEIVE_PACKET_END(real_packet);
36476}
36477
36478 static int send_packet_page_msg_100(struct connection *pc, const struct packet_page_msg *packet)
36479{
36480 const struct packet_page_msg *real_packet = packet;
36481 int e;
36482#ifdef FREECIV_DELTA_PROTOCOL
36483 packet_page_msg_100_fields fields;
36484 struct packet_page_msg *old;
36485 bool differ;
36486 struct genhash **hash = pc->phs.sent + PACKET_PAGE_MSG;
36487#endif /* FREECIV_DELTA_PROTOCOL */
36488 SEND_PACKET_START(PACKET_PAGE_MSG);
36489#ifdef FREECIV_JSON_CONNECTION
36490 struct plocation field_addr;
36491 {
36492 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36493 field_addr = *field_addr_tmp;
36494 FC_FREE(field_addr_tmp);
36495 }
36496#endif /* FREECIV_JSON_CONNECTION */
36497
36498 log_packet_detailed("packet_page_msg_100: sending info about ()");
36499
36500#ifdef FREECIV_DELTA_PROTOCOL
36501 if (NULL == *hash) {
36502 *hash = genhash_new_full(hash_packet_page_msg_100, cmp_packet_page_msg_100,
36503 NULL, NULL, NULL, free);
36504 }
36505 BV_CLR_ALL(fields);
36506
36507 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36508 old = fc_malloc(sizeof(*old));
36509 *old = *real_packet;
36510 genhash_insert(*hash, old, old);
36511 memset(old, 0, sizeof(*old));
36512 }
36513 differ = (strcmp(old->caption, real_packet->caption) != 0);
36514 if (differ) {
36515 BV_SET(fields, 0);
36516 }
36517
36518 differ = (strcmp(old->headline, real_packet->headline) != 0);
36519 if (differ) {
36520 BV_SET(fields, 1);
36521 }
36522
36523 differ = (old->event != real_packet->event);
36524 if (differ) {
36525 BV_SET(fields, 2);
36526 }
36527
36528 differ = (old->len != real_packet->len);
36529 if (differ) {
36530 BV_SET(fields, 3);
36531 }
36532
36533 differ = (old->parts != real_packet->parts);
36534 if (differ) {
36535 BV_SET(fields, 4);
36536 }
36537
36538
36539#ifdef FREECIV_JSON_CONNECTION
36540 field_addr.name = "fields";
36541#endif /* FREECIV_JSON_CONNECTION */
36542 e = 0;
36543 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36544 if (e) {
36545 log_packet_detailed("fields bitvector error detected");
36546 }
36547
36548 if (BV_ISSET(fields, 0)) {
36549 log_packet_detailed(" field 'caption' has changed");
36550#ifdef FREECIV_JSON_CONNECTION
36551 field_addr.name = "caption";
36552#endif /* FREECIV_JSON_CONNECTION */
36553 e = 0;
36554 e |= DIO_PUT(string, &dout, &field_addr, real_packet->caption);
36555 if (e) {
36556 log_packet_detailed("'caption' field error detected");
36557 }
36558 }
36559 if (BV_ISSET(fields, 1)) {
36560 log_packet_detailed(" field 'headline' has changed");
36561#ifdef FREECIV_JSON_CONNECTION
36562 field_addr.name = "headline";
36563#endif /* FREECIV_JSON_CONNECTION */
36564 e = 0;
36565 e |= DIO_PUT(string, &dout, &field_addr, real_packet->headline);
36566 if (e) {
36567 log_packet_detailed("'headline' field error detected");
36568 }
36569 }
36570 if (BV_ISSET(fields, 2)) {
36571 log_packet_detailed(" field 'event' has changed");
36572#ifdef FREECIV_JSON_CONNECTION
36573 field_addr.name = "event";
36574#endif /* FREECIV_JSON_CONNECTION */
36575 e = 0;
36576 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
36577 if (e) {
36578 log_packet_detailed("'event' field error detected");
36579 }
36580 }
36581 if (BV_ISSET(fields, 3)) {
36582 log_packet_detailed(" field 'len' has changed");
36583#ifdef FREECIV_JSON_CONNECTION
36584 field_addr.name = "len";
36585#endif /* FREECIV_JSON_CONNECTION */
36586 e = 0;
36587 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->len);
36588 if (e) {
36589 log_packet_detailed("'len' field error detected");
36590 }
36591 }
36592 if (BV_ISSET(fields, 4)) {
36593 log_packet_detailed(" field 'parts' has changed");
36594#ifdef FREECIV_JSON_CONNECTION
36595 field_addr.name = "parts";
36596#endif /* FREECIV_JSON_CONNECTION */
36597 e = 0;
36598 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->parts);
36599 if (e) {
36600 log_packet_detailed("'parts' field error detected");
36601 }
36602 }
36603
36604 *old = *real_packet;
36605#endif /* FREECIV_DELTA_PROTOCOL */
36606#ifndef FREECIV_DELTA_PROTOCOL
36607#ifdef FREECIV_JSON_CONNECTION
36608 field_addr.name = "caption";
36609#endif /* FREECIV_JSON_CONNECTION */
36610 e = 0;
36611 e |= DIO_PUT(string, &dout, &field_addr, real_packet->caption);
36612 if (e) {
36613 log_packet_detailed("'caption' field error detected");
36614 }
36615#ifdef FREECIV_JSON_CONNECTION
36616 field_addr.name = "headline";
36617#endif /* FREECIV_JSON_CONNECTION */
36618 e = 0;
36619 e |= DIO_PUT(string, &dout, &field_addr, real_packet->headline);
36620 if (e) {
36621 log_packet_detailed("'headline' field error detected");
36622 }
36623#ifdef FREECIV_JSON_CONNECTION
36624 field_addr.name = "event";
36625#endif /* FREECIV_JSON_CONNECTION */
36626 e = 0;
36627 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->event);
36628 if (e) {
36629 log_packet_detailed("'event' field error detected");
36630 }
36631#ifdef FREECIV_JSON_CONNECTION
36632 field_addr.name = "len";
36633#endif /* FREECIV_JSON_CONNECTION */
36634 e = 0;
36635 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->len);
36636 if (e) {
36637 log_packet_detailed("'len' field error detected");
36638 }
36639#ifdef FREECIV_JSON_CONNECTION
36640 field_addr.name = "parts";
36641#endif /* FREECIV_JSON_CONNECTION */
36642 e = 0;
36643 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->parts);
36644 if (e) {
36645 log_packet_detailed("'parts' field error detected");
36646 }
36647
36648#endif
36649 SEND_PACKET_END(PACKET_PAGE_MSG);
36650}
36651
36652 int send_packet_page_msg(struct connection *pc, const struct packet_page_msg *packet)
36653{
36654 if (!pc->used) {
36655 log_error("WARNING: trying to send data to the closed connection %s",
36656 conn_description(pc));
36657 return -1;
36658 }
36659 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PAGE_MSG].packet != NULL, -1,
36660 "Handler for PACKET_PAGE_MSG not installed");
36661 return pc->phs.handlers->send[PACKET_PAGE_MSG].packet(pc, packet);
36662}
36663
36664 void lsend_packet_page_msg(struct conn_list *dest, const struct packet_page_msg *packet)
36665{
36666 conn_list_iterate(dest, pconn) {
36667 send_packet_page_msg(pconn, packet);
36668 } conn_list_iterate_end;
36669}
36670
36671#ifdef FREECIV_DELTA_PROTOCOL
36672#define hash_packet_page_msg_part_100 hash_const
36673
36674#define cmp_packet_page_msg_part_100 cmp_const
36675
36676 BV_DEFINE(packet_page_msg_part_100_fields, 1);
36677#endif /* FREECIV_DELTA_PROTOCOL */
36678
36679 static struct packet_page_msg_part *receive_packet_page_msg_part_100(struct connection *pc)
36680{
36681#ifdef FREECIV_DELTA_PROTOCOL
36682 packet_page_msg_part_100_fields fields;
36683 struct packet_page_msg_part *old;
36684 struct genhash **hash = pc->phs.received + PACKET_PAGE_MSG_PART;
36685#endif /* FREECIV_DELTA_PROTOCOL */
36686 RECEIVE_PACKET_START(packet_page_msg_part, real_packet);
36687#ifdef FREECIV_JSON_CONNECTION
36688 struct plocation field_addr;
36689 {
36690 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36691 field_addr = *field_addr_tmp;
36692 FC_FREE(field_addr_tmp);
36693 }
36694#endif /* FREECIV_JSON_CONNECTION */
36695
36696#ifdef FREECIV_DELTA_PROTOCOL
36697#ifdef FREECIV_JSON_CONNECTION
36698 field_addr.name = "fields";
36699#endif /* FREECIV_JSON_CONNECTION */
36700 DIO_BV_GET(&din, &field_addr, fields);
36701
36702#else /* FREECIV_DELTA_PROTOCOL */
36703#ifdef FREECIV_JSON_CONNECTION
36704 field_addr.name = "lines";
36705#endif /* FREECIV_JSON_CONNECTION */
36706 if (!DIO_GET(string, &din, &field_addr, real_packet->lines, sizeof(real_packet->lines))) {
36707 RECEIVE_PACKET_FIELD_ERROR(lines);
36708 }
36709#endif
36710 log_packet_detailed("packet_page_msg_part_100: got info about ()");
36711
36712#ifdef FREECIV_DELTA_PROTOCOL
36713 if (NULL == *hash) {
36714 *hash = genhash_new_full(hash_packet_page_msg_part_100, cmp_packet_page_msg_part_100,
36715 NULL, NULL, NULL, free);
36716 }
36717
36718 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36719 *real_packet = *old;
36720 } else {
36721 log_packet_detailed(" no old info");
36722 memset(real_packet, 0, sizeof(*real_packet));
36723 }
36724
36725 if (BV_ISSET(fields, 0)) {
36726 log_packet_detailed(" got field 'lines'");
36727#ifdef FREECIV_JSON_CONNECTION
36728 field_addr.name = "lines";
36729#endif /* FREECIV_JSON_CONNECTION */
36730 if (!DIO_GET(string, &din, &field_addr, real_packet->lines, sizeof(real_packet->lines))) {
36731 RECEIVE_PACKET_FIELD_ERROR(lines);
36732 }
36733 }
36734
36735 if (NULL == old) {
36736 old = fc_malloc(sizeof(*old));
36737 *old = *real_packet;
36738 genhash_insert(*hash, old, old);
36739 } else {
36740 *old = *real_packet;
36741 }
36742
36743#endif /* FREECIV_DELTA_PROTOCOL */
36744 RECEIVE_PACKET_END(real_packet);
36745}
36746
36747 static int send_packet_page_msg_part_100(struct connection *pc, const struct packet_page_msg_part *packet)
36748{
36749 const struct packet_page_msg_part *real_packet = packet;
36750 int e;
36751#ifdef FREECIV_DELTA_PROTOCOL
36752 packet_page_msg_part_100_fields fields;
36753 struct packet_page_msg_part *old;
36754 bool differ;
36755 struct genhash **hash = pc->phs.sent + PACKET_PAGE_MSG_PART;
36756#endif /* FREECIV_DELTA_PROTOCOL */
36757 SEND_PACKET_START(PACKET_PAGE_MSG_PART);
36758#ifdef FREECIV_JSON_CONNECTION
36759 struct plocation field_addr;
36760 {
36761 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36762 field_addr = *field_addr_tmp;
36763 FC_FREE(field_addr_tmp);
36764 }
36765#endif /* FREECIV_JSON_CONNECTION */
36766
36767 log_packet_detailed("packet_page_msg_part_100: sending info about ()");
36768
36769#ifdef FREECIV_DELTA_PROTOCOL
36770 if (NULL == *hash) {
36771 *hash = genhash_new_full(hash_packet_page_msg_part_100, cmp_packet_page_msg_part_100,
36772 NULL, NULL, NULL, free);
36773 }
36774 BV_CLR_ALL(fields);
36775
36776 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36777 old = fc_malloc(sizeof(*old));
36778 *old = *real_packet;
36779 genhash_insert(*hash, old, old);
36780 memset(old, 0, sizeof(*old));
36781 }
36782 differ = (strcmp(old->lines, real_packet->lines) != 0);
36783 if (differ) {
36784 BV_SET(fields, 0);
36785 }
36786
36787
36788#ifdef FREECIV_JSON_CONNECTION
36789 field_addr.name = "fields";
36790#endif /* FREECIV_JSON_CONNECTION */
36791 e = 0;
36792 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36793 if (e) {
36794 log_packet_detailed("fields bitvector error detected");
36795 }
36796
36797 if (BV_ISSET(fields, 0)) {
36798 log_packet_detailed(" field 'lines' has changed");
36799#ifdef FREECIV_JSON_CONNECTION
36800 field_addr.name = "lines";
36801#endif /* FREECIV_JSON_CONNECTION */
36802 e = 0;
36803 e |= DIO_PUT(string, &dout, &field_addr, real_packet->lines);
36804 if (e) {
36805 log_packet_detailed("'lines' field error detected");
36806 }
36807 }
36808
36809 *old = *real_packet;
36810#endif /* FREECIV_DELTA_PROTOCOL */
36811#ifndef FREECIV_DELTA_PROTOCOL
36812#ifdef FREECIV_JSON_CONNECTION
36813 field_addr.name = "lines";
36814#endif /* FREECIV_JSON_CONNECTION */
36815 e = 0;
36816 e |= DIO_PUT(string, &dout, &field_addr, real_packet->lines);
36817 if (e) {
36818 log_packet_detailed("'lines' field error detected");
36819 }
36820
36821#endif
36822 SEND_PACKET_END(PACKET_PAGE_MSG_PART);
36823}
36824
36825 int send_packet_page_msg_part(struct connection *pc, const struct packet_page_msg_part *packet)
36826{
36827 if (!pc->used) {
36828 log_error("WARNING: trying to send data to the closed connection %s",
36829 conn_description(pc));
36830 return -1;
36831 }
36832 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PAGE_MSG_PART].packet != NULL, -1,
36833 "Handler for PACKET_PAGE_MSG_PART not installed");
36834 return pc->phs.handlers->send[PACKET_PAGE_MSG_PART].packet(pc, packet);
36835}
36836
36837 void lsend_packet_page_msg_part(struct conn_list *dest, const struct packet_page_msg_part *packet)
36838{
36839 conn_list_iterate(dest, pconn) {
36840 send_packet_page_msg_part(pconn, packet);
36841 } conn_list_iterate_end;
36842}
36843
36844#ifdef FREECIV_DELTA_PROTOCOL
36845#define hash_packet_report_req_100 hash_const
36846
36847#define cmp_packet_report_req_100 cmp_const
36848
36849 BV_DEFINE(packet_report_req_100_fields, 1);
36850#endif /* FREECIV_DELTA_PROTOCOL */
36851
36852 static struct packet_report_req *receive_packet_report_req_100(struct connection *pc)
36853{
36854#ifdef FREECIV_DELTA_PROTOCOL
36855 packet_report_req_100_fields fields;
36856 struct packet_report_req *old;
36857 struct genhash **hash = pc->phs.received + PACKET_REPORT_REQ;
36858#endif /* FREECIV_DELTA_PROTOCOL */
36859 RECEIVE_PACKET_START(packet_report_req, real_packet);
36860#ifdef FREECIV_JSON_CONNECTION
36861 struct plocation field_addr;
36862 {
36863 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36864 field_addr = *field_addr_tmp;
36865 FC_FREE(field_addr_tmp);
36866 }
36867#endif /* FREECIV_JSON_CONNECTION */
36868
36869#ifdef FREECIV_DELTA_PROTOCOL
36870#ifdef FREECIV_JSON_CONNECTION
36871 field_addr.name = "fields";
36872#endif /* FREECIV_JSON_CONNECTION */
36873 DIO_BV_GET(&din, &field_addr, fields);
36874
36875#else /* FREECIV_DELTA_PROTOCOL */
36876#ifdef FREECIV_JSON_CONNECTION
36877 field_addr.name = "type";
36878#endif /* FREECIV_JSON_CONNECTION */
36879 {
36880 int readin;
36881
36882 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36883 RECEIVE_PACKET_FIELD_ERROR(type);
36884 }
36885 real_packet->type = readin;
36886 }
36887#endif
36888 log_packet_detailed("packet_report_req_100: got info about ()");
36889
36890#ifdef FREECIV_DELTA_PROTOCOL
36891 if (NULL == *hash) {
36892 *hash = genhash_new_full(hash_packet_report_req_100, cmp_packet_report_req_100,
36893 NULL, NULL, NULL, free);
36894 }
36895
36896 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
36897 *real_packet = *old;
36898 } else {
36899 log_packet_detailed(" no old info");
36900 memset(real_packet, 0, sizeof(*real_packet));
36901 }
36902
36903 if (BV_ISSET(fields, 0)) {
36904 log_packet_detailed(" got field 'type'");
36905#ifdef FREECIV_JSON_CONNECTION
36906 field_addr.name = "type";
36907#endif /* FREECIV_JSON_CONNECTION */
36908 {
36909 int readin;
36910
36911 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
36912 RECEIVE_PACKET_FIELD_ERROR(type);
36913 }
36914 real_packet->type = readin;
36915 }
36916 }
36917
36918 if (NULL == old) {
36919 old = fc_malloc(sizeof(*old));
36920 *old = *real_packet;
36921 genhash_insert(*hash, old, old);
36922 } else {
36923 *old = *real_packet;
36924 }
36925
36926#endif /* FREECIV_DELTA_PROTOCOL */
36927 RECEIVE_PACKET_END(real_packet);
36928}
36929
36930 static int send_packet_report_req_100(struct connection *pc, const struct packet_report_req *packet)
36931{
36932 const struct packet_report_req *real_packet = packet;
36933 int e;
36934#ifdef FREECIV_DELTA_PROTOCOL
36935 packet_report_req_100_fields fields;
36936 struct packet_report_req *old;
36937 bool differ;
36938 struct genhash **hash = pc->phs.sent + PACKET_REPORT_REQ;
36939#endif /* FREECIV_DELTA_PROTOCOL */
36940 SEND_PACKET_START(PACKET_REPORT_REQ);
36941#ifdef FREECIV_JSON_CONNECTION
36942 struct plocation field_addr;
36943 {
36944 struct plocation *field_addr_tmp = plocation_field_new(NULL);
36945 field_addr = *field_addr_tmp;
36946 FC_FREE(field_addr_tmp);
36947 }
36948#endif /* FREECIV_JSON_CONNECTION */
36949
36950 log_packet_detailed("packet_report_req_100: sending info about ()");
36951
36952#ifdef FREECIV_DELTA_PROTOCOL
36953 if (NULL == *hash) {
36954 *hash = genhash_new_full(hash_packet_report_req_100, cmp_packet_report_req_100,
36955 NULL, NULL, NULL, free);
36956 }
36957 BV_CLR_ALL(fields);
36958
36959 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
36960 old = fc_malloc(sizeof(*old));
36961 *old = *real_packet;
36962 genhash_insert(*hash, old, old);
36963 memset(old, 0, sizeof(*old));
36964 }
36965 differ = (old->type != real_packet->type);
36966 if (differ) {
36967 BV_SET(fields, 0);
36968 }
36969
36970
36971#ifdef FREECIV_JSON_CONNECTION
36972 field_addr.name = "fields";
36973#endif /* FREECIV_JSON_CONNECTION */
36974 e = 0;
36975 e |= DIO_BV_PUT(&dout, &field_addr, fields);
36976 if (e) {
36977 log_packet_detailed("fields bitvector error detected");
36978 }
36979
36980 if (BV_ISSET(fields, 0)) {
36981 log_packet_detailed(" field 'type' has changed");
36982#ifdef FREECIV_JSON_CONNECTION
36983 field_addr.name = "type";
36984#endif /* FREECIV_JSON_CONNECTION */
36985 e = 0;
36986 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
36987 if (e) {
36988 log_packet_detailed("'type' field error detected");
36989 }
36990 }
36991
36992 *old = *real_packet;
36993#endif /* FREECIV_DELTA_PROTOCOL */
36994#ifndef FREECIV_DELTA_PROTOCOL
36995#ifdef FREECIV_JSON_CONNECTION
36996 field_addr.name = "type";
36997#endif /* FREECIV_JSON_CONNECTION */
36998 e = 0;
36999 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
37000 if (e) {
37001 log_packet_detailed("'type' field error detected");
37002 }
37003
37004#endif
37005 SEND_PACKET_END(PACKET_REPORT_REQ);
37006}
37007
37008 int send_packet_report_req(struct connection *pc, const struct packet_report_req *packet)
37009{
37010 if (!pc->used) {
37011 log_error("WARNING: trying to send data to the closed connection %s",
37012 conn_description(pc));
37013 return -1;
37014 }
37015 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_REPORT_REQ].packet != NULL, -1,
37016 "Handler for PACKET_REPORT_REQ not installed");
37017 return pc->phs.handlers->send[PACKET_REPORT_REQ].packet(pc, packet);
37018}
37019
37020 int dsend_packet_report_req(struct connection *pc, enum report_type type)
37021{
37022 struct packet_report_req packet, *real_packet = &packet;
37023
37024 real_packet->type = type;
37025
37026 return send_packet_report_req(pc, real_packet);
37027}
37028
37029#ifdef FREECIV_DELTA_PROTOCOL
37030static genhash_val_t hash_packet_conn_info_100(const void *vkey)
37031{
37032 const struct packet_conn_info *key = (const struct packet_conn_info *) vkey;
37033 genhash_val_t result = 0;
37034
37035 result += key->id;
37036
37037 result &= 0xFFFFFFFF;
37038 return result;
37039}
37040
37041static bool cmp_packet_conn_info_100(const void *vkey1, const void *vkey2)
37042{
37043 const struct packet_conn_info *old = (const struct packet_conn_info *) vkey1;
37044 const struct packet_conn_info *real_packet = (const struct packet_conn_info *) vkey2;
37045 bool differ;
37046
37047 differ = (old->id != real_packet->id);
37048
37049 return !differ;
37050}
37051 BV_DEFINE(packet_conn_info_100_fields, 8);
37052#endif /* FREECIV_DELTA_PROTOCOL */
37053
37054 static struct packet_conn_info *receive_packet_conn_info_100(struct connection *pc)
37055{
37056#ifdef FREECIV_DELTA_PROTOCOL
37057 packet_conn_info_100_fields fields;
37058 struct packet_conn_info *old;
37059 struct genhash **hash = pc->phs.received + PACKET_CONN_INFO;
37060#endif /* FREECIV_DELTA_PROTOCOL */
37061 RECEIVE_PACKET_START(packet_conn_info, real_packet);
37062#ifdef FREECIV_JSON_CONNECTION
37063 struct plocation field_addr;
37064 {
37065 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37066 field_addr = *field_addr_tmp;
37067 FC_FREE(field_addr_tmp);
37068 }
37069#endif /* FREECIV_JSON_CONNECTION */
37070
37071#ifdef FREECIV_DELTA_PROTOCOL
37072#ifdef FREECIV_JSON_CONNECTION
37073 field_addr.name = "fields";
37074#endif /* FREECIV_JSON_CONNECTION */
37075 DIO_BV_GET(&din, &field_addr, fields);
37076#ifdef FREECIV_JSON_CONNECTION
37077 field_addr.name = "id";
37078#endif /* FREECIV_JSON_CONNECTION */
37079 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
37080 RECEIVE_PACKET_FIELD_ERROR(id);
37081 }
37082
37083#else /* FREECIV_DELTA_PROTOCOL */
37084#ifdef FREECIV_JSON_CONNECTION
37085 field_addr.name = "id";
37086#endif /* FREECIV_JSON_CONNECTION */
37087 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->id)) {
37088 RECEIVE_PACKET_FIELD_ERROR(id);
37089 }
37090#ifdef FREECIV_JSON_CONNECTION
37091 field_addr.name = "used";
37092#endif /* FREECIV_JSON_CONNECTION */
37093 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->used)) {
37094 RECEIVE_PACKET_FIELD_ERROR(used);
37095 }
37096#ifdef FREECIV_JSON_CONNECTION
37097 field_addr.name = "established";
37098#endif /* FREECIV_JSON_CONNECTION */
37099 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->established)) {
37100 RECEIVE_PACKET_FIELD_ERROR(established);
37101 }
37102#ifdef FREECIV_JSON_CONNECTION
37103 field_addr.name = "observer";
37104#endif /* FREECIV_JSON_CONNECTION */
37105 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->observer)) {
37106 RECEIVE_PACKET_FIELD_ERROR(observer);
37107 }
37108#ifdef FREECIV_JSON_CONNECTION
37109 field_addr.name = "player_num";
37110#endif /* FREECIV_JSON_CONNECTION */
37111 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
37112 RECEIVE_PACKET_FIELD_ERROR(player_num);
37113 }
37114#ifdef FREECIV_JSON_CONNECTION
37115 field_addr.name = "access_level";
37116#endif /* FREECIV_JSON_CONNECTION */
37117 {
37118 int readin;
37119
37120 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
37121 RECEIVE_PACKET_FIELD_ERROR(access_level);
37122 }
37123 real_packet->access_level = readin;
37124 }
37125#ifdef FREECIV_JSON_CONNECTION
37126 field_addr.name = "username";
37127#endif /* FREECIV_JSON_CONNECTION */
37128 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
37129 RECEIVE_PACKET_FIELD_ERROR(username);
37130 }
37131#ifdef FREECIV_JSON_CONNECTION
37132 field_addr.name = "addr";
37133#endif /* FREECIV_JSON_CONNECTION */
37134 if (!DIO_GET(string, &din, &field_addr, real_packet->addr, sizeof(real_packet->addr))) {
37135 RECEIVE_PACKET_FIELD_ERROR(addr);
37136 }
37137#ifdef FREECIV_JSON_CONNECTION
37138 field_addr.name = "capability";
37139#endif /* FREECIV_JSON_CONNECTION */
37140 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
37141 RECEIVE_PACKET_FIELD_ERROR(capability);
37142 }
37143#endif
37144 log_packet_detailed("packet_conn_info_100: got info about (%d)",
37145 real_packet->id);
37146
37147#ifdef FREECIV_DELTA_PROTOCOL
37148 if (NULL == *hash) {
37149 *hash = genhash_new_full(hash_packet_conn_info_100, cmp_packet_conn_info_100,
37150 NULL, NULL, NULL, free);
37151 }
37152
37153 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37154 *real_packet = *old;
37155 } else {
37156 int id;
37157
37158 id = real_packet->id;
37159
37160 log_packet_detailed(" no old info");
37161 memset(real_packet, 0, sizeof(*real_packet));
37162
37163 real_packet->id = id;
37164 }
37165
37166 real_packet->used = BV_ISSET(fields, 0);
37167 real_packet->established = BV_ISSET(fields, 1);
37168 real_packet->observer = BV_ISSET(fields, 2);
37169 if (BV_ISSET(fields, 3)) {
37170 log_packet_detailed(" got field 'player_num'");
37171#ifdef FREECIV_JSON_CONNECTION
37172 field_addr.name = "player_num";
37173#endif /* FREECIV_JSON_CONNECTION */
37174 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
37175 RECEIVE_PACKET_FIELD_ERROR(player_num);
37176 }
37177 }
37178 if (BV_ISSET(fields, 4)) {
37179 log_packet_detailed(" got field 'access_level'");
37180#ifdef FREECIV_JSON_CONNECTION
37181 field_addr.name = "access_level";
37182#endif /* FREECIV_JSON_CONNECTION */
37183 {
37184 int readin;
37185
37186 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
37187 RECEIVE_PACKET_FIELD_ERROR(access_level);
37188 }
37189 real_packet->access_level = readin;
37190 }
37191 }
37192 if (BV_ISSET(fields, 5)) {
37193 log_packet_detailed(" got field 'username'");
37194#ifdef FREECIV_JSON_CONNECTION
37195 field_addr.name = "username";
37196#endif /* FREECIV_JSON_CONNECTION */
37197 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
37198 RECEIVE_PACKET_FIELD_ERROR(username);
37199 }
37200 }
37201 if (BV_ISSET(fields, 6)) {
37202 log_packet_detailed(" got field 'addr'");
37203#ifdef FREECIV_JSON_CONNECTION
37204 field_addr.name = "addr";
37205#endif /* FREECIV_JSON_CONNECTION */
37206 if (!DIO_GET(string, &din, &field_addr, real_packet->addr, sizeof(real_packet->addr))) {
37207 RECEIVE_PACKET_FIELD_ERROR(addr);
37208 }
37209 }
37210 if (BV_ISSET(fields, 7)) {
37211 log_packet_detailed(" got field 'capability'");
37212#ifdef FREECIV_JSON_CONNECTION
37213 field_addr.name = "capability";
37214#endif /* FREECIV_JSON_CONNECTION */
37215 if (!DIO_GET(string, &din, &field_addr, real_packet->capability, sizeof(real_packet->capability))) {
37216 RECEIVE_PACKET_FIELD_ERROR(capability);
37217 }
37218 }
37219
37220 if (NULL == old) {
37221 old = fc_malloc(sizeof(*old));
37222 *old = *real_packet;
37223 genhash_insert(*hash, old, old);
37224 } else {
37225 *old = *real_packet;
37226 }
37227
37228#endif /* FREECIV_DELTA_PROTOCOL */
37229 RECEIVE_PACKET_END(real_packet);
37230}
37231
37232 static int send_packet_conn_info_100(struct connection *pc, const struct packet_conn_info *packet)
37233{
37234 const struct packet_conn_info *real_packet = packet;
37235 int e;
37236#ifdef FREECIV_DELTA_PROTOCOL
37237 packet_conn_info_100_fields fields;
37238 struct packet_conn_info *old;
37239 bool differ;
37240 struct genhash **hash = pc->phs.sent + PACKET_CONN_INFO;
37241 int different = 0;
37242#endif /* FREECIV_DELTA_PROTOCOL */
37243 SEND_PACKET_START(PACKET_CONN_INFO);
37244#ifdef FREECIV_JSON_CONNECTION
37245 struct plocation field_addr;
37246 {
37247 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37248 field_addr = *field_addr_tmp;
37249 FC_FREE(field_addr_tmp);
37250 }
37251#endif /* FREECIV_JSON_CONNECTION */
37252
37253 log_packet_detailed("packet_conn_info_100: sending info about (%d)",
37254 real_packet->id);
37255
37256#ifdef FREECIV_DELTA_PROTOCOL
37257 if (NULL == *hash) {
37258 *hash = genhash_new_full(hash_packet_conn_info_100, cmp_packet_conn_info_100,
37259 NULL, NULL, NULL, free);
37260 }
37261 BV_CLR_ALL(fields);
37262
37263 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37264 old = fc_malloc(sizeof(*old));
37265 *old = *real_packet;
37266 genhash_insert(*hash, old, old);
37267 memset(old, 0, sizeof(*old));
37268 different = 1; /* Force to send. */
37269 }
37270 differ = (old->used != real_packet->used);
37271 if (differ) {
37272 different++;
37273 }
37274 if (packet->used) {
37275 BV_SET(fields, 0);
37276 }
37277
37278 differ = (old->established != real_packet->established);
37279 if (differ) {
37280 different++;
37281 }
37282 if (packet->established) {
37283 BV_SET(fields, 1);
37284 }
37285
37286 differ = (old->observer != real_packet->observer);
37287 if (differ) {
37288 different++;
37289 }
37290 if (packet->observer) {
37291 BV_SET(fields, 2);
37292 }
37293
37294 differ = (old->player_num != real_packet->player_num);
37295 if (differ) {
37296 different++;
37297 BV_SET(fields, 3);
37298 }
37299
37300 differ = (old->access_level != real_packet->access_level);
37301 if (differ) {
37302 different++;
37303 BV_SET(fields, 4);
37304 }
37305
37306 differ = (strcmp(old->username, real_packet->username) != 0);
37307 if (differ) {
37308 different++;
37309 BV_SET(fields, 5);
37310 }
37311
37312 differ = (strcmp(old->addr, real_packet->addr) != 0);
37313 if (differ) {
37314 different++;
37315 BV_SET(fields, 6);
37316 }
37317
37318 differ = (strcmp(old->capability, real_packet->capability) != 0);
37319 if (differ) {
37320 different++;
37321 BV_SET(fields, 7);
37322 }
37323
37324 if (different == 0) {
37325 log_packet_detailed(" no change -> discard");
37326 return 0;
37327 }
37328
37329#ifdef FREECIV_JSON_CONNECTION
37330 field_addr.name = "fields";
37331#endif /* FREECIV_JSON_CONNECTION */
37332 e = 0;
37333 e |= DIO_BV_PUT(&dout, &field_addr, fields);
37334 if (e) {
37335 log_packet_detailed("fields bitvector error detected");
37336 }
37337#ifdef FREECIV_JSON_CONNECTION
37338 field_addr.name = "id";
37339#endif /* FREECIV_JSON_CONNECTION */
37340 e = 0;
37341 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
37342 if (e) {
37343 log_packet_detailed("'id' field error detected");
37344 }
37345
37346 /* field 0 is folded into the header */
37347 /* field 1 is folded into the header */
37348 /* field 2 is folded into the header */
37349 if (BV_ISSET(fields, 3)) {
37350 log_packet_detailed(" field 'player_num' has changed");
37351#ifdef FREECIV_JSON_CONNECTION
37352 field_addr.name = "player_num";
37353#endif /* FREECIV_JSON_CONNECTION */
37354 e = 0;
37355 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
37356 if (e) {
37357 log_packet_detailed("'player_num' field error detected");
37358 }
37359 }
37360 if (BV_ISSET(fields, 4)) {
37361 log_packet_detailed(" field 'access_level' has changed");
37362#ifdef FREECIV_JSON_CONNECTION
37363 field_addr.name = "access_level";
37364#endif /* FREECIV_JSON_CONNECTION */
37365 e = 0;
37366 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->access_level);
37367 if (e) {
37368 log_packet_detailed("'access_level' field error detected");
37369 }
37370 }
37371 if (BV_ISSET(fields, 5)) {
37372 log_packet_detailed(" field 'username' has changed");
37373#ifdef FREECIV_JSON_CONNECTION
37374 field_addr.name = "username";
37375#endif /* FREECIV_JSON_CONNECTION */
37376 e = 0;
37377 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
37378 if (e) {
37379 log_packet_detailed("'username' field error detected");
37380 }
37381 }
37382 if (BV_ISSET(fields, 6)) {
37383 log_packet_detailed(" field 'addr' has changed");
37384#ifdef FREECIV_JSON_CONNECTION
37385 field_addr.name = "addr";
37386#endif /* FREECIV_JSON_CONNECTION */
37387 e = 0;
37388 e |= DIO_PUT(string, &dout, &field_addr, real_packet->addr);
37389 if (e) {
37390 log_packet_detailed("'addr' field error detected");
37391 }
37392 }
37393 if (BV_ISSET(fields, 7)) {
37394 log_packet_detailed(" field 'capability' has changed");
37395#ifdef FREECIV_JSON_CONNECTION
37396 field_addr.name = "capability";
37397#endif /* FREECIV_JSON_CONNECTION */
37398 e = 0;
37399 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
37400 if (e) {
37401 log_packet_detailed("'capability' field error detected");
37402 }
37403 }
37404
37405 *old = *real_packet;
37406#endif /* FREECIV_DELTA_PROTOCOL */
37407#ifndef FREECIV_DELTA_PROTOCOL
37408#ifdef FREECIV_JSON_CONNECTION
37409 field_addr.name = "id";
37410#endif /* FREECIV_JSON_CONNECTION */
37411 e = 0;
37412 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
37413 if (e) {
37414 log_packet_detailed("'id' field error detected");
37415 }
37416#ifdef FREECIV_JSON_CONNECTION
37417 field_addr.name = "used";
37418#endif /* FREECIV_JSON_CONNECTION */
37419 e = 0;
37420 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->used);
37421 if (e) {
37422 log_packet_detailed("'used' field error detected");
37423 }
37424#ifdef FREECIV_JSON_CONNECTION
37425 field_addr.name = "established";
37426#endif /* FREECIV_JSON_CONNECTION */
37427 e = 0;
37428 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->established);
37429 if (e) {
37430 log_packet_detailed("'established' field error detected");
37431 }
37432#ifdef FREECIV_JSON_CONNECTION
37433 field_addr.name = "observer";
37434#endif /* FREECIV_JSON_CONNECTION */
37435 e = 0;
37436 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->observer);
37437 if (e) {
37438 log_packet_detailed("'observer' field error detected");
37439 }
37440#ifdef FREECIV_JSON_CONNECTION
37441 field_addr.name = "player_num";
37442#endif /* FREECIV_JSON_CONNECTION */
37443 e = 0;
37444 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
37445 if (e) {
37446 log_packet_detailed("'player_num' field error detected");
37447 }
37448#ifdef FREECIV_JSON_CONNECTION
37449 field_addr.name = "access_level";
37450#endif /* FREECIV_JSON_CONNECTION */
37451 e = 0;
37452 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->access_level);
37453 if (e) {
37454 log_packet_detailed("'access_level' field error detected");
37455 }
37456#ifdef FREECIV_JSON_CONNECTION
37457 field_addr.name = "username";
37458#endif /* FREECIV_JSON_CONNECTION */
37459 e = 0;
37460 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
37461 if (e) {
37462 log_packet_detailed("'username' field error detected");
37463 }
37464#ifdef FREECIV_JSON_CONNECTION
37465 field_addr.name = "addr";
37466#endif /* FREECIV_JSON_CONNECTION */
37467 e = 0;
37468 e |= DIO_PUT(string, &dout, &field_addr, real_packet->addr);
37469 if (e) {
37470 log_packet_detailed("'addr' field error detected");
37471 }
37472#ifdef FREECIV_JSON_CONNECTION
37473 field_addr.name = "capability";
37474#endif /* FREECIV_JSON_CONNECTION */
37475 e = 0;
37476 e |= DIO_PUT(string, &dout, &field_addr, real_packet->capability);
37477 if (e) {
37478 log_packet_detailed("'capability' field error detected");
37479 }
37480
37481#endif
37482 SEND_PACKET_END(PACKET_CONN_INFO);
37483}
37484
37485 int send_packet_conn_info(struct connection *pc, const struct packet_conn_info *packet)
37486{
37487 if (!pc->used) {
37488 log_error("WARNING: trying to send data to the closed connection %s",
37489 conn_description(pc));
37490 return -1;
37491 }
37492 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_INFO].packet != NULL, -1,
37493 "Handler for PACKET_CONN_INFO not installed");
37494 return pc->phs.handlers->send[PACKET_CONN_INFO].packet(pc, packet);
37495}
37496
37497 void lsend_packet_conn_info(struct conn_list *dest, const struct packet_conn_info *packet)
37498{
37499 conn_list_iterate(dest, pconn) {
37500 send_packet_conn_info(pconn, packet);
37501 } conn_list_iterate_end;
37502}
37503
37504#ifdef FREECIV_DELTA_PROTOCOL
37505#define hash_packet_conn_ping_info_100 hash_const
37506
37507#define cmp_packet_conn_ping_info_100 cmp_const
37508
37509 BV_DEFINE(packet_conn_ping_info_100_fields, 3);
37510#endif /* FREECIV_DELTA_PROTOCOL */
37511
37512 static struct packet_conn_ping_info *receive_packet_conn_ping_info_100(struct connection *pc)
37513{
37514#ifdef FREECIV_DELTA_PROTOCOL
37515 packet_conn_ping_info_100_fields fields;
37516 struct packet_conn_ping_info *old;
37517 struct genhash **hash = pc->phs.received + PACKET_CONN_PING_INFO;
37518#endif /* FREECIV_DELTA_PROTOCOL */
37519 RECEIVE_PACKET_START(packet_conn_ping_info, real_packet);
37520#ifdef FREECIV_JSON_CONNECTION
37521 struct plocation field_addr;
37522 {
37523 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37524 field_addr = *field_addr_tmp;
37525 FC_FREE(field_addr_tmp);
37526 }
37527#endif /* FREECIV_JSON_CONNECTION */
37528
37529#ifdef FREECIV_DELTA_PROTOCOL
37530#ifdef FREECIV_JSON_CONNECTION
37531 field_addr.name = "fields";
37532#endif /* FREECIV_JSON_CONNECTION */
37533 DIO_BV_GET(&din, &field_addr, fields);
37534
37535#else /* FREECIV_DELTA_PROTOCOL */
37536#ifdef FREECIV_JSON_CONNECTION
37537 field_addr.name = "connections";
37538#endif /* FREECIV_JSON_CONNECTION */
37539 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->connections)) {
37540 RECEIVE_PACKET_FIELD_ERROR(connections);
37541 }
37542#ifdef FREECIV_JSON_CONNECTION
37543 field_addr.name = "conn_id";
37544#endif /* FREECIV_JSON_CONNECTION */
37545 {
37546 int i;
37547
37548#ifdef FREECIV_JSON_CONNECTION
37549 /* Enter array. */
37550 field_addr.sub_location = plocation_elem_new(0);
37551#endif /* FREECIV_JSON_CONNECTION */
37552
37553 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
37554 RECEIVE_PACKET_FIELD_ERROR(conn_id, ": truncation array");
37555 }
37556 for (i = 0; i < real_packet->connections; i++) {
37557#ifdef FREECIV_JSON_CONNECTION
37558 field_addr.sub_location->number = i;
37559#endif /* FREECIV_JSON_CONNECTION */
37560 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id[i])) {
37561 RECEIVE_PACKET_FIELD_ERROR(conn_id);
37562 }
37563 }
37564
37565#ifdef FREECIV_JSON_CONNECTION
37566 /* Exit array. */
37567 FC_FREE(field_addr.sub_location);
37568#endif /* FREECIV_JSON_CONNECTION */
37569 }
37570#ifdef FREECIV_JSON_CONNECTION
37571 field_addr.name = "ping_time";
37572#endif /* FREECIV_JSON_CONNECTION */
37573 {
37574 int i;
37575
37576#ifdef FREECIV_JSON_CONNECTION
37577 /* Enter array. */
37578 field_addr.sub_location = plocation_elem_new(0);
37579#endif /* FREECIV_JSON_CONNECTION */
37580
37581 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
37582 RECEIVE_PACKET_FIELD_ERROR(ping_time, ": truncation array");
37583 }
37584 for (i = 0; i < real_packet->connections; i++) {
37585#ifdef FREECIV_JSON_CONNECTION
37586 field_addr.sub_location->number = i;
37587#endif /* FREECIV_JSON_CONNECTION */
37588 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->ping_time[i], 100000)) {
37589 RECEIVE_PACKET_FIELD_ERROR(ping_time);
37590 }
37591 }
37592
37593#ifdef FREECIV_JSON_CONNECTION
37594 /* Exit array. */
37595 FC_FREE(field_addr.sub_location);
37596#endif /* FREECIV_JSON_CONNECTION */
37597 }
37598#endif
37599 log_packet_detailed("packet_conn_ping_info_100: got info about ()");
37600
37601#ifdef FREECIV_DELTA_PROTOCOL
37602 if (NULL == *hash) {
37603 *hash = genhash_new_full(hash_packet_conn_ping_info_100, cmp_packet_conn_ping_info_100,
37604 NULL, NULL, NULL, free);
37605 }
37606
37607 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
37608 *real_packet = *old;
37609 } else {
37610 log_packet_detailed(" no old info");
37611 memset(real_packet, 0, sizeof(*real_packet));
37612 }
37613
37614 if (BV_ISSET(fields, 0)) {
37615 log_packet_detailed(" got field 'connections'");
37616#ifdef FREECIV_JSON_CONNECTION
37617 field_addr.name = "connections";
37618#endif /* FREECIV_JSON_CONNECTION */
37619 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->connections)) {
37620 RECEIVE_PACKET_FIELD_ERROR(connections);
37621 }
37622 }
37623 if (BV_ISSET(fields, 1)) {
37624 log_packet_detailed(" got field 'conn_id'");
37625#ifdef FREECIV_JSON_CONNECTION
37626 field_addr.name = "conn_id";
37627#endif /* FREECIV_JSON_CONNECTION */
37628 {
37629 int i;
37630
37631#ifdef FREECIV_JSON_CONNECTION
37632 /* Enter array. */
37633 field_addr.sub_location = plocation_elem_new(0);
37634#endif /* FREECIV_JSON_CONNECTION */
37635
37636 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
37637 RECEIVE_PACKET_FIELD_ERROR(conn_id, ": truncation array");
37638 }
37639 for (i = 0; i < real_packet->connections; i++) {
37640#ifdef FREECIV_JSON_CONNECTION
37641 field_addr.sub_location->number = i;
37642#endif /* FREECIV_JSON_CONNECTION */
37643 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->conn_id[i])) {
37644 RECEIVE_PACKET_FIELD_ERROR(conn_id);
37645 }
37646 }
37647
37648#ifdef FREECIV_JSON_CONNECTION
37649 /* Exit array. */
37650 FC_FREE(field_addr.sub_location);
37651#endif /* FREECIV_JSON_CONNECTION */
37652 }
37653 }
37654 if (BV_ISSET(fields, 2)) {
37655 log_packet_detailed(" got field 'ping_time'");
37656#ifdef FREECIV_JSON_CONNECTION
37657 field_addr.name = "ping_time";
37658#endif /* FREECIV_JSON_CONNECTION */
37659 {
37660 int i;
37661
37662#ifdef FREECIV_JSON_CONNECTION
37663 /* Enter array. */
37664 field_addr.sub_location = plocation_elem_new(0);
37665#endif /* FREECIV_JSON_CONNECTION */
37666
37667 if (real_packet->connections > MAX_NUM_CONNECTIONS) {
37668 RECEIVE_PACKET_FIELD_ERROR(ping_time, ": truncation array");
37669 }
37670 for (i = 0; i < real_packet->connections; i++) {
37671#ifdef FREECIV_JSON_CONNECTION
37672 field_addr.sub_location->number = i;
37673#endif /* FREECIV_JSON_CONNECTION */
37674 if (!DIO_GET(sfloat, &din, &field_addr, &real_packet->ping_time[i], 100000)) {
37675 RECEIVE_PACKET_FIELD_ERROR(ping_time);
37676 }
37677 }
37678
37679#ifdef FREECIV_JSON_CONNECTION
37680 /* Exit array. */
37681 FC_FREE(field_addr.sub_location);
37682#endif /* FREECIV_JSON_CONNECTION */
37683 }
37684 }
37685
37686 if (NULL == old) {
37687 old = fc_malloc(sizeof(*old));
37688 *old = *real_packet;
37689 genhash_insert(*hash, old, old);
37690 } else {
37691 *old = *real_packet;
37692 }
37693
37694#endif /* FREECIV_DELTA_PROTOCOL */
37695 RECEIVE_PACKET_END(real_packet);
37696}
37697
37698 static int send_packet_conn_ping_info_100(struct connection *pc, const struct packet_conn_ping_info *packet)
37699{
37700 const struct packet_conn_ping_info *real_packet = packet;
37701 int e;
37702#ifdef FREECIV_DELTA_PROTOCOL
37703 packet_conn_ping_info_100_fields fields;
37704 struct packet_conn_ping_info *old;
37705 bool differ;
37706 struct genhash **hash = pc->phs.sent + PACKET_CONN_PING_INFO;
37707#endif /* FREECIV_DELTA_PROTOCOL */
37708 SEND_PACKET_START(PACKET_CONN_PING_INFO);
37709#ifdef FREECIV_JSON_CONNECTION
37710 struct plocation field_addr;
37711 {
37712 struct plocation *field_addr_tmp = plocation_field_new(NULL);
37713 field_addr = *field_addr_tmp;
37714 FC_FREE(field_addr_tmp);
37715 }
37716#endif /* FREECIV_JSON_CONNECTION */
37717
37718 log_packet_detailed("packet_conn_ping_info_100: sending info about ()");
37719
37720#ifdef FREECIV_DELTA_PROTOCOL
37721 if (NULL == *hash) {
37722 *hash = genhash_new_full(hash_packet_conn_ping_info_100, cmp_packet_conn_ping_info_100,
37723 NULL, NULL, NULL, free);
37724 }
37725 BV_CLR_ALL(fields);
37726
37727 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
37728 old = fc_malloc(sizeof(*old));
37729 *old = *real_packet;
37730 genhash_insert(*hash, old, old);
37731 memset(old, 0, sizeof(*old));
37732 }
37733 differ = (old->connections != real_packet->connections);
37734 if (differ) {
37735 BV_SET(fields, 0);
37736 }
37737
37738 differ = (old->connections != real_packet->connections);
37739 if (!differ) {
37740 int i;
37741
37742 for (i = 0; i < real_packet->connections; i++) {
37743 differ = (old->conn_id[i] != real_packet->conn_id[i]);
37744 if (differ) {
37745 break;
37746 }
37747 }
37748 }
37749 if (differ) {
37750 BV_SET(fields, 1);
37751 }
37752
37753 differ = (old->connections != real_packet->connections);
37754 if (!differ) {
37755 int i;
37756
37757 for (i = 0; i < real_packet->connections; i++) {
37758 differ = (old->ping_time[i] != real_packet->ping_time[i]);
37759 if (differ) {
37760 break;
37761 }
37762 }
37763 }
37764 if (differ) {
37765 BV_SET(fields, 2);
37766 }
37767
37768
37769#ifdef FREECIV_JSON_CONNECTION
37770 field_addr.name = "fields";
37771#endif /* FREECIV_JSON_CONNECTION */
37772 e = 0;
37773 e |= DIO_BV_PUT(&dout, &field_addr, fields);
37774 if (e) {
37775 log_packet_detailed("fields bitvector error detected");
37776 }
37777
37778 if (BV_ISSET(fields, 0)) {
37779 log_packet_detailed(" field 'connections' has changed");
37780#ifdef FREECIV_JSON_CONNECTION
37781 field_addr.name = "connections";
37782#endif /* FREECIV_JSON_CONNECTION */
37783 e = 0;
37784 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->connections);
37785 if (e) {
37786 log_packet_detailed("'connections' field error detected");
37787 }
37788 }
37789 if (BV_ISSET(fields, 1)) {
37790 log_packet_detailed(" field 'conn_id' has changed");
37791#ifdef FREECIV_JSON_CONNECTION
37792 field_addr.name = "conn_id";
37793#endif /* FREECIV_JSON_CONNECTION */
37794 e = 0;
37795 {
37796 int i;
37797
37798#ifdef FREECIV_JSON_CONNECTION
37799 /* Create the array. */
37800 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
37801
37802 /* Enter the array. */
37803 field_addr.sub_location = plocation_elem_new(0);
37804#endif /* FREECIV_JSON_CONNECTION */
37805
37806 for (i = 0; i < real_packet->connections; i++) {
37807#ifdef FREECIV_JSON_CONNECTION
37808 /* Next array element. */
37809 field_addr.sub_location->number = i;
37810#endif /* FREECIV_JSON_CONNECTION */
37811 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id[i]);
37812 }
37813
37814#ifdef FREECIV_JSON_CONNECTION
37815 /* Exit array. */
37816 FC_FREE(field_addr.sub_location);
37817#endif /* FREECIV_JSON_CONNECTION */
37818 }
37819 if (e) {
37820 log_packet_detailed("'conn_id' field error detected");
37821 }
37822 }
37823 if (BV_ISSET(fields, 2)) {
37824 log_packet_detailed(" field 'ping_time' has changed");
37825#ifdef FREECIV_JSON_CONNECTION
37826 field_addr.name = "ping_time";
37827#endif /* FREECIV_JSON_CONNECTION */
37828 e = 0;
37829 {
37830 int i;
37831
37832#ifdef FREECIV_JSON_CONNECTION
37833 /* Create the array. */
37834 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
37835
37836 /* Enter the array. */
37837 field_addr.sub_location = plocation_elem_new(0);
37838#endif /* FREECIV_JSON_CONNECTION */
37839
37840 for (i = 0; i < real_packet->connections; i++) {
37841#ifdef FREECIV_JSON_CONNECTION
37842 /* Next array element. */
37843 field_addr.sub_location->number = i;
37844#endif /* FREECIV_JSON_CONNECTION */
37845 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->ping_time[i], 100000);
37846 }
37847
37848#ifdef FREECIV_JSON_CONNECTION
37849 /* Exit array. */
37850 FC_FREE(field_addr.sub_location);
37851#endif /* FREECIV_JSON_CONNECTION */
37852 }
37853 if (e) {
37854 log_packet_detailed("'ping_time' field error detected");
37855 }
37856 }
37857
37858 *old = *real_packet;
37859#endif /* FREECIV_DELTA_PROTOCOL */
37860#ifndef FREECIV_DELTA_PROTOCOL
37861#ifdef FREECIV_JSON_CONNECTION
37862 field_addr.name = "connections";
37863#endif /* FREECIV_JSON_CONNECTION */
37864 e = 0;
37865 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->connections);
37866 if (e) {
37867 log_packet_detailed("'connections' field error detected");
37868 }
37869#ifdef FREECIV_JSON_CONNECTION
37870 field_addr.name = "conn_id";
37871#endif /* FREECIV_JSON_CONNECTION */
37872 e = 0;
37873 {
37874 int i;
37875
37876#ifdef FREECIV_JSON_CONNECTION
37877 /* Create the array. */
37878 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
37879
37880 /* Enter the array. */
37881 field_addr.sub_location = plocation_elem_new(0);
37882#endif /* FREECIV_JSON_CONNECTION */
37883
37884 for (i = 0; i < real_packet->connections; i++) {
37885#ifdef FREECIV_JSON_CONNECTION
37886 /* Next array element. */
37887 field_addr.sub_location->number = i;
37888#endif /* FREECIV_JSON_CONNECTION */
37889 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->conn_id[i]);
37890 }
37891
37892#ifdef FREECIV_JSON_CONNECTION
37893 /* Exit array. */
37894 FC_FREE(field_addr.sub_location);
37895#endif /* FREECIV_JSON_CONNECTION */
37896 }
37897 if (e) {
37898 log_packet_detailed("'conn_id' field error detected");
37899 }
37900#ifdef FREECIV_JSON_CONNECTION
37901 field_addr.name = "ping_time";
37902#endif /* FREECIV_JSON_CONNECTION */
37903 e = 0;
37904 {
37905 int i;
37906
37907#ifdef FREECIV_JSON_CONNECTION
37908 /* Create the array. */
37909 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->connections);
37910
37911 /* Enter the array. */
37912 field_addr.sub_location = plocation_elem_new(0);
37913#endif /* FREECIV_JSON_CONNECTION */
37914
37915 for (i = 0; i < real_packet->connections; i++) {
37916#ifdef FREECIV_JSON_CONNECTION
37917 /* Next array element. */
37918 field_addr.sub_location->number = i;
37919#endif /* FREECIV_JSON_CONNECTION */
37920 e |= DIO_PUT(sfloat, &dout, &field_addr, real_packet->ping_time[i], 100000);
37921 }
37922
37923#ifdef FREECIV_JSON_CONNECTION
37924 /* Exit array. */
37925 FC_FREE(field_addr.sub_location);
37926#endif /* FREECIV_JSON_CONNECTION */
37927 }
37928 if (e) {
37929 log_packet_detailed("'ping_time' field error detected");
37930 }
37931
37932#endif
37933 SEND_PACKET_END(PACKET_CONN_PING_INFO);
37934}
37935
37936 int send_packet_conn_ping_info(struct connection *pc, const struct packet_conn_ping_info *packet)
37937{
37938 if (!pc->used) {
37939 log_error("WARNING: trying to send data to the closed connection %s",
37940 conn_description(pc));
37941 return -1;
37942 }
37943 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PING_INFO].packet != NULL, -1,
37944 "Handler for PACKET_CONN_PING_INFO not installed");
37945 return pc->phs.handlers->send[PACKET_CONN_PING_INFO].packet(pc, packet);
37946}
37947
37948 void lsend_packet_conn_ping_info(struct conn_list *dest, const struct packet_conn_ping_info *packet)
37949{
37950 conn_list_iterate(dest, pconn) {
37951 send_packet_conn_ping_info(pconn, packet);
37952 } conn_list_iterate_end;
37953}
37954
37955 static struct packet_conn_ping *receive_packet_conn_ping_100(struct connection *pc)
37956{
37957 RECEIVE_PACKET_START(packet_conn_ping, real_packet);
37958#if 1 /* To match endif */
37959 real_packet->__dummy = 0xff;
37960#endif
37961 log_packet_detailed("packet_conn_ping_100: got info about ()");
37962 RECEIVE_PACKET_END(real_packet);
37963}
37964
37965 static int send_packet_conn_ping_100(struct connection *pc)
37966{
37967 SEND_PACKET_START(PACKET_CONN_PING);
37968
37969 log_packet_detailed("packet_conn_ping_100: sending info about ()");
37970 SEND_PACKET_END(PACKET_CONN_PING);
37971}
37972
37973 int send_packet_conn_ping(struct connection *pc)
37974{
37975 if (!pc->used) {
37976 log_error("WARNING: trying to send data to the closed connection %s",
37977 conn_description(pc));
37978 return -1;
37979 }
37980 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PING].no_packet != NULL, -1,
37981 "Handler for PACKET_CONN_PING not installed");
37982 return pc->phs.handlers->send[PACKET_CONN_PING].no_packet(pc);
37983}
37984
37985 static struct packet_conn_pong *receive_packet_conn_pong_100(struct connection *pc)
37986{
37987 RECEIVE_PACKET_START(packet_conn_pong, real_packet);
37988#if 1 /* To match endif */
37989 real_packet->__dummy = 0xff;
37990#endif
37991 log_packet_detailed("packet_conn_pong_100: got info about ()");
37992 RECEIVE_PACKET_END(real_packet);
37993}
37994
37995 static int send_packet_conn_pong_100(struct connection *pc)
37996{
37997 SEND_PACKET_START(PACKET_CONN_PONG);
37998
37999 log_packet_detailed("packet_conn_pong_100: sending info about ()");
38000 SEND_PACKET_END(PACKET_CONN_PONG);
38001}
38002
38003 int send_packet_conn_pong(struct connection *pc)
38004{
38005 if (!pc->used) {
38006 log_error("WARNING: trying to send data to the closed connection %s",
38007 conn_description(pc));
38008 return -1;
38009 }
38010 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CONN_PONG].no_packet != NULL, -1,
38011 "Handler for PACKET_CONN_PONG not installed");
38012 return pc->phs.handlers->send[PACKET_CONN_PONG].no_packet(pc);
38013}
38014
38015 static struct packet_client_heartbeat *receive_packet_client_heartbeat_100(struct connection *pc)
38016{
38017 RECEIVE_PACKET_START(packet_client_heartbeat, real_packet);
38018#if 1 /* To match endif */
38019 real_packet->__dummy = 0xff;
38020#endif
38021 log_packet_detailed("packet_client_heartbeat_100: got info about ()");
38022 RECEIVE_PACKET_END(real_packet);
38023}
38024
38025 static int send_packet_client_heartbeat_100(struct connection *pc)
38026{
38027 SEND_PACKET_START(PACKET_CLIENT_HEARTBEAT);
38028
38029 log_packet_detailed("packet_client_heartbeat_100: sending info about ()");
38030 SEND_PACKET_END(PACKET_CLIENT_HEARTBEAT);
38031}
38032
38033 int send_packet_client_heartbeat(struct connection *pc)
38034{
38035 if (!pc->used) {
38036 log_error("WARNING: trying to send data to the closed connection %s",
38037 conn_description(pc));
38038 return -1;
38039 }
38040 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CLIENT_HEARTBEAT].no_packet != NULL, -1,
38041 "Handler for PACKET_CLIENT_HEARTBEAT not installed");
38042 return pc->phs.handlers->send[PACKET_CLIENT_HEARTBEAT].no_packet(pc);
38043}
38044
38045#ifdef FREECIV_DELTA_PROTOCOL
38046#define hash_packet_client_info_100 hash_const
38047
38048#define cmp_packet_client_info_100 cmp_const
38049
38050 BV_DEFINE(packet_client_info_100_fields, 3);
38051#endif /* FREECIV_DELTA_PROTOCOL */
38052
38053 static struct packet_client_info *receive_packet_client_info_100(struct connection *pc)
38054{
38055#ifdef FREECIV_DELTA_PROTOCOL
38056 packet_client_info_100_fields fields;
38057 struct packet_client_info *old;
38058 struct genhash **hash = pc->phs.received + PACKET_CLIENT_INFO;
38059#endif /* FREECIV_DELTA_PROTOCOL */
38060 RECEIVE_PACKET_START(packet_client_info, real_packet);
38061#ifdef FREECIV_JSON_CONNECTION
38062 struct plocation field_addr;
38063 {
38064 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38065 field_addr = *field_addr_tmp;
38066 FC_FREE(field_addr_tmp);
38067 }
38068#endif /* FREECIV_JSON_CONNECTION */
38069
38070#ifdef FREECIV_DELTA_PROTOCOL
38071#ifdef FREECIV_JSON_CONNECTION
38072 field_addr.name = "fields";
38073#endif /* FREECIV_JSON_CONNECTION */
38074 DIO_BV_GET(&din, &field_addr, fields);
38075
38076#else /* FREECIV_DELTA_PROTOCOL */
38077#ifdef FREECIV_JSON_CONNECTION
38078 field_addr.name = "gui";
38079#endif /* FREECIV_JSON_CONNECTION */
38080 {
38081 int readin;
38082
38083 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38084 RECEIVE_PACKET_FIELD_ERROR(gui);
38085 }
38086 real_packet->gui = readin;
38087 }
38088#ifdef FREECIV_JSON_CONNECTION
38089 field_addr.name = "emerg_version";
38090#endif /* FREECIV_JSON_CONNECTION */
38091 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
38092 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
38093 }
38094#ifdef FREECIV_JSON_CONNECTION
38095 field_addr.name = "distribution";
38096#endif /* FREECIV_JSON_CONNECTION */
38097 if (!DIO_GET(string, &din, &field_addr, real_packet->distribution, sizeof(real_packet->distribution))) {
38098 RECEIVE_PACKET_FIELD_ERROR(distribution);
38099 }
38100#endif
38101 log_packet_detailed("packet_client_info_100: got info about ()");
38102
38103#ifdef FREECIV_DELTA_PROTOCOL
38104 if (NULL == *hash) {
38105 *hash = genhash_new_full(hash_packet_client_info_100, cmp_packet_client_info_100,
38106 NULL, NULL, NULL, free);
38107 }
38108
38109 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
38110 *real_packet = *old;
38111 } else {
38112 log_packet_detailed(" no old info");
38113 memset(real_packet, 0, sizeof(*real_packet));
38114 }
38115
38116 if (BV_ISSET(fields, 0)) {
38117 log_packet_detailed(" got field 'gui'");
38118#ifdef FREECIV_JSON_CONNECTION
38119 field_addr.name = "gui";
38120#endif /* FREECIV_JSON_CONNECTION */
38121 {
38122 int readin;
38123
38124 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38125 RECEIVE_PACKET_FIELD_ERROR(gui);
38126 }
38127 real_packet->gui = readin;
38128 }
38129 }
38130 if (BV_ISSET(fields, 1)) {
38131 log_packet_detailed(" got field 'emerg_version'");
38132#ifdef FREECIV_JSON_CONNECTION
38133 field_addr.name = "emerg_version";
38134#endif /* FREECIV_JSON_CONNECTION */
38135 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->emerg_version)) {
38136 RECEIVE_PACKET_FIELD_ERROR(emerg_version);
38137 }
38138 }
38139 if (BV_ISSET(fields, 2)) {
38140 log_packet_detailed(" got field 'distribution'");
38141#ifdef FREECIV_JSON_CONNECTION
38142 field_addr.name = "distribution";
38143#endif /* FREECIV_JSON_CONNECTION */
38144 if (!DIO_GET(string, &din, &field_addr, real_packet->distribution, sizeof(real_packet->distribution))) {
38145 RECEIVE_PACKET_FIELD_ERROR(distribution);
38146 }
38147 }
38148
38149 if (NULL == old) {
38150 old = fc_malloc(sizeof(*old));
38151 *old = *real_packet;
38152 genhash_insert(*hash, old, old);
38153 } else {
38154 *old = *real_packet;
38155 }
38156
38157#endif /* FREECIV_DELTA_PROTOCOL */
38158 RECEIVE_PACKET_END(real_packet);
38159}
38160
38161 static int send_packet_client_info_100(struct connection *pc, const struct packet_client_info *packet)
38162{
38163 const struct packet_client_info *real_packet = packet;
38164 int e;
38165#ifdef FREECIV_DELTA_PROTOCOL
38166 packet_client_info_100_fields fields;
38167 struct packet_client_info *old;
38168 bool differ;
38169 struct genhash **hash = pc->phs.sent + PACKET_CLIENT_INFO;
38170#endif /* FREECIV_DELTA_PROTOCOL */
38171 SEND_PACKET_START(PACKET_CLIENT_INFO);
38172#ifdef FREECIV_JSON_CONNECTION
38173 struct plocation field_addr;
38174 {
38175 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38176 field_addr = *field_addr_tmp;
38177 FC_FREE(field_addr_tmp);
38178 }
38179#endif /* FREECIV_JSON_CONNECTION */
38180
38181 log_packet_detailed("packet_client_info_100: sending info about ()");
38182
38183#ifdef FREECIV_DELTA_PROTOCOL
38184 if (NULL == *hash) {
38185 *hash = genhash_new_full(hash_packet_client_info_100, cmp_packet_client_info_100,
38186 NULL, NULL, NULL, free);
38187 }
38188 BV_CLR_ALL(fields);
38189
38190 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
38191 old = fc_malloc(sizeof(*old));
38192 *old = *real_packet;
38193 genhash_insert(*hash, old, old);
38194 memset(old, 0, sizeof(*old));
38195 }
38196 differ = (old->gui != real_packet->gui);
38197 if (differ) {
38198 BV_SET(fields, 0);
38199 }
38200
38201 differ = (old->emerg_version != real_packet->emerg_version);
38202 if (differ) {
38203 BV_SET(fields, 1);
38204 }
38205
38206 differ = (strcmp(old->distribution, real_packet->distribution) != 0);
38207 if (differ) {
38208 BV_SET(fields, 2);
38209 }
38210
38211
38212#ifdef FREECIV_JSON_CONNECTION
38213 field_addr.name = "fields";
38214#endif /* FREECIV_JSON_CONNECTION */
38215 e = 0;
38216 e |= DIO_BV_PUT(&dout, &field_addr, fields);
38217 if (e) {
38218 log_packet_detailed("fields bitvector error detected");
38219 }
38220
38221 if (BV_ISSET(fields, 0)) {
38222 log_packet_detailed(" field 'gui' has changed");
38223#ifdef FREECIV_JSON_CONNECTION
38224 field_addr.name = "gui";
38225#endif /* FREECIV_JSON_CONNECTION */
38226 e = 0;
38227 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui);
38228 if (e) {
38229 log_packet_detailed("'gui' field error detected");
38230 }
38231 }
38232 if (BV_ISSET(fields, 1)) {
38233 log_packet_detailed(" field 'emerg_version' has changed");
38234#ifdef FREECIV_JSON_CONNECTION
38235 field_addr.name = "emerg_version";
38236#endif /* FREECIV_JSON_CONNECTION */
38237 e = 0;
38238 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
38239 if (e) {
38240 log_packet_detailed("'emerg_version' field error detected");
38241 }
38242 }
38243 if (BV_ISSET(fields, 2)) {
38244 log_packet_detailed(" field 'distribution' has changed");
38245#ifdef FREECIV_JSON_CONNECTION
38246 field_addr.name = "distribution";
38247#endif /* FREECIV_JSON_CONNECTION */
38248 e = 0;
38249 e |= DIO_PUT(string, &dout, &field_addr, real_packet->distribution);
38250 if (e) {
38251 log_packet_detailed("'distribution' field error detected");
38252 }
38253 }
38254
38255 *old = *real_packet;
38256#endif /* FREECIV_DELTA_PROTOCOL */
38257#ifndef FREECIV_DELTA_PROTOCOL
38258#ifdef FREECIV_JSON_CONNECTION
38259 field_addr.name = "gui";
38260#endif /* FREECIV_JSON_CONNECTION */
38261 e = 0;
38262 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui);
38263 if (e) {
38264 log_packet_detailed("'gui' field error detected");
38265 }
38266#ifdef FREECIV_JSON_CONNECTION
38267 field_addr.name = "emerg_version";
38268#endif /* FREECIV_JSON_CONNECTION */
38269 e = 0;
38270 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->emerg_version);
38271 if (e) {
38272 log_packet_detailed("'emerg_version' field error detected");
38273 }
38274#ifdef FREECIV_JSON_CONNECTION
38275 field_addr.name = "distribution";
38276#endif /* FREECIV_JSON_CONNECTION */
38277 e = 0;
38278 e |= DIO_PUT(string, &dout, &field_addr, real_packet->distribution);
38279 if (e) {
38280 log_packet_detailed("'distribution' field error detected");
38281 }
38282
38283#endif
38284 SEND_PACKET_END(PACKET_CLIENT_INFO);
38285}
38286
38287 int send_packet_client_info(struct connection *pc, const struct packet_client_info *packet)
38288{
38289 if (!pc->used) {
38290 log_error("WARNING: trying to send data to the closed connection %s",
38291 conn_description(pc));
38292 return -1;
38293 }
38294 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_CLIENT_INFO].packet != NULL, -1,
38295 "Handler for PACKET_CLIENT_INFO not installed");
38296 return pc->phs.handlers->send[PACKET_CLIENT_INFO].packet(pc, packet);
38297}
38298
38299 static struct packet_end_phase *receive_packet_end_phase_100(struct connection *pc)
38300{
38301 RECEIVE_PACKET_START(packet_end_phase, real_packet);
38302#if 1 /* To match endif */
38303 real_packet->__dummy = 0xff;
38304#endif
38305 log_packet_detailed("packet_end_phase_100: got info about ()");
38306 RECEIVE_PACKET_END(real_packet);
38307}
38308
38309 static int send_packet_end_phase_100(struct connection *pc)
38310{
38311 SEND_PACKET_START(PACKET_END_PHASE);
38312
38313 log_packet_detailed("packet_end_phase_100: sending info about ()");
38314 SEND_PACKET_END(PACKET_END_PHASE);
38315}
38316
38317 int send_packet_end_phase(struct connection *pc)
38318{
38319 if (!pc->used) {
38320 log_error("WARNING: trying to send data to the closed connection %s",
38321 conn_description(pc));
38322 return -1;
38323 }
38324 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_END_PHASE].no_packet != NULL, -1,
38325 "Handler for PACKET_END_PHASE not installed");
38326 return pc->phs.handlers->send[PACKET_END_PHASE].no_packet(pc);
38327}
38328
38329 void lsend_packet_end_phase(struct conn_list *dest)
38330{
38331 conn_list_iterate(dest, pconn) {
38332 send_packet_end_phase(pconn);
38333 } conn_list_iterate_end;
38334}
38335
38336#ifdef FREECIV_DELTA_PROTOCOL
38337#define hash_packet_start_phase_100 hash_const
38338
38339#define cmp_packet_start_phase_100 cmp_const
38340
38341 BV_DEFINE(packet_start_phase_100_fields, 1);
38342#endif /* FREECIV_DELTA_PROTOCOL */
38343
38344 static struct packet_start_phase *receive_packet_start_phase_100(struct connection *pc)
38345{
38346#ifdef FREECIV_DELTA_PROTOCOL
38347 packet_start_phase_100_fields fields;
38348 struct packet_start_phase *old;
38349 struct genhash **hash = pc->phs.received + PACKET_START_PHASE;
38350#endif /* FREECIV_DELTA_PROTOCOL */
38351 RECEIVE_PACKET_START(packet_start_phase, real_packet);
38352#ifdef FREECIV_JSON_CONNECTION
38353 struct plocation field_addr;
38354 {
38355 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38356 field_addr = *field_addr_tmp;
38357 FC_FREE(field_addr_tmp);
38358 }
38359#endif /* FREECIV_JSON_CONNECTION */
38360
38361#ifdef FREECIV_DELTA_PROTOCOL
38362#ifdef FREECIV_JSON_CONNECTION
38363 field_addr.name = "fields";
38364#endif /* FREECIV_JSON_CONNECTION */
38365 DIO_BV_GET(&din, &field_addr, fields);
38366
38367#else /* FREECIV_DELTA_PROTOCOL */
38368#ifdef FREECIV_JSON_CONNECTION
38369 field_addr.name = "phase";
38370#endif /* FREECIV_JSON_CONNECTION */
38371 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
38372 RECEIVE_PACKET_FIELD_ERROR(phase);
38373 }
38374#endif
38375 log_packet_detailed("packet_start_phase_100: got info about ()");
38376
38377#ifdef FREECIV_DELTA_PROTOCOL
38378 if (NULL == *hash) {
38379 *hash = genhash_new_full(hash_packet_start_phase_100, cmp_packet_start_phase_100,
38380 NULL, NULL, NULL, free);
38381 }
38382
38383 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
38384 *real_packet = *old;
38385 } else {
38386 log_packet_detailed(" no old info");
38387 memset(real_packet, 0, sizeof(*real_packet));
38388 }
38389
38390 if (BV_ISSET(fields, 0)) {
38391 log_packet_detailed(" got field 'phase'");
38392#ifdef FREECIV_JSON_CONNECTION
38393 field_addr.name = "phase";
38394#endif /* FREECIV_JSON_CONNECTION */
38395 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->phase)) {
38396 RECEIVE_PACKET_FIELD_ERROR(phase);
38397 }
38398 }
38399
38400 if (NULL == old) {
38401 old = fc_malloc(sizeof(*old));
38402 *old = *real_packet;
38403 genhash_insert(*hash, old, old);
38404 } else {
38405 *old = *real_packet;
38406 }
38407
38408#endif /* FREECIV_DELTA_PROTOCOL */
38409 RECEIVE_PACKET_END(real_packet);
38410}
38411
38412 static int send_packet_start_phase_100(struct connection *pc, const struct packet_start_phase *packet)
38413{
38414 const struct packet_start_phase *real_packet = packet;
38415 int e;
38416#ifdef FREECIV_DELTA_PROTOCOL
38417 packet_start_phase_100_fields fields;
38418 struct packet_start_phase *old;
38419 bool differ;
38420 struct genhash **hash = pc->phs.sent + PACKET_START_PHASE;
38421#endif /* FREECIV_DELTA_PROTOCOL */
38422 SEND_PACKET_START(PACKET_START_PHASE);
38423#ifdef FREECIV_JSON_CONNECTION
38424 struct plocation field_addr;
38425 {
38426 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38427 field_addr = *field_addr_tmp;
38428 FC_FREE(field_addr_tmp);
38429 }
38430#endif /* FREECIV_JSON_CONNECTION */
38431
38432 log_packet_detailed("packet_start_phase_100: sending info about ()");
38433
38434#ifdef FREECIV_DELTA_PROTOCOL
38435 if (NULL == *hash) {
38436 *hash = genhash_new_full(hash_packet_start_phase_100, cmp_packet_start_phase_100,
38437 NULL, NULL, NULL, free);
38438 }
38439 BV_CLR_ALL(fields);
38440
38441 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
38442 old = fc_malloc(sizeof(*old));
38443 *old = *real_packet;
38444 genhash_insert(*hash, old, old);
38445 memset(old, 0, sizeof(*old));
38446 }
38447 differ = (old->phase != real_packet->phase);
38448 if (differ) {
38449 BV_SET(fields, 0);
38450 }
38451
38452
38453#ifdef FREECIV_JSON_CONNECTION
38454 field_addr.name = "fields";
38455#endif /* FREECIV_JSON_CONNECTION */
38456 e = 0;
38457 e |= DIO_BV_PUT(&dout, &field_addr, fields);
38458 if (e) {
38459 log_packet_detailed("fields bitvector error detected");
38460 }
38461
38462 if (BV_ISSET(fields, 0)) {
38463 log_packet_detailed(" field 'phase' has changed");
38464#ifdef FREECIV_JSON_CONNECTION
38465 field_addr.name = "phase";
38466#endif /* FREECIV_JSON_CONNECTION */
38467 e = 0;
38468 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
38469 if (e) {
38470 log_packet_detailed("'phase' field error detected");
38471 }
38472 }
38473
38474 *old = *real_packet;
38475#endif /* FREECIV_DELTA_PROTOCOL */
38476#ifndef FREECIV_DELTA_PROTOCOL
38477#ifdef FREECIV_JSON_CONNECTION
38478 field_addr.name = "phase";
38479#endif /* FREECIV_JSON_CONNECTION */
38480 e = 0;
38481 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->phase);
38482 if (e) {
38483 log_packet_detailed("'phase' field error detected");
38484 }
38485
38486#endif
38487 SEND_PACKET_END(PACKET_START_PHASE);
38488}
38489
38490 int send_packet_start_phase(struct connection *pc, const struct packet_start_phase *packet)
38491{
38492 if (!pc->used) {
38493 log_error("WARNING: trying to send data to the closed connection %s",
38494 conn_description(pc));
38495 return -1;
38496 }
38497 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_START_PHASE].packet != NULL, -1,
38498 "Handler for PACKET_START_PHASE not installed");
38499 return pc->phs.handlers->send[PACKET_START_PHASE].packet(pc, packet);
38500}
38501
38502 void lsend_packet_start_phase(struct conn_list *dest, const struct packet_start_phase *packet)
38503{
38504 conn_list_iterate(dest, pconn) {
38505 send_packet_start_phase(pconn, packet);
38506 } conn_list_iterate_end;
38507}
38508
38509 int dsend_packet_start_phase(struct connection *pc, int phase)
38510{
38511 struct packet_start_phase packet, *real_packet = &packet;
38512
38513 real_packet->phase = phase;
38514
38515 return send_packet_start_phase(pc, real_packet);
38516}
38517
38518 void dlsend_packet_start_phase(struct conn_list *dest, int phase)
38519{
38520 struct packet_start_phase packet, *real_packet = &packet;
38521
38522 real_packet->phase = phase;
38523
38524 lsend_packet_start_phase(dest, real_packet);
38525}
38526
38527#ifdef FREECIV_DELTA_PROTOCOL
38528#define hash_packet_new_year_100 hash_const
38529
38530#define cmp_packet_new_year_100 cmp_const
38531
38532 BV_DEFINE(packet_new_year_100_fields, 3);
38533#endif /* FREECIV_DELTA_PROTOCOL */
38534
38535 static struct packet_new_year *receive_packet_new_year_100(struct connection *pc)
38536{
38537#ifdef FREECIV_DELTA_PROTOCOL
38538 packet_new_year_100_fields fields;
38539 struct packet_new_year *old;
38540 struct genhash **hash = pc->phs.received + PACKET_NEW_YEAR;
38541#endif /* FREECIV_DELTA_PROTOCOL */
38542 RECEIVE_PACKET_START(packet_new_year, real_packet);
38543#ifdef FREECIV_JSON_CONNECTION
38544 struct plocation field_addr;
38545 {
38546 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38547 field_addr = *field_addr_tmp;
38548 FC_FREE(field_addr_tmp);
38549 }
38550#endif /* FREECIV_JSON_CONNECTION */
38551
38552#ifdef FREECIV_DELTA_PROTOCOL
38553#ifdef FREECIV_JSON_CONNECTION
38554 field_addr.name = "fields";
38555#endif /* FREECIV_JSON_CONNECTION */
38556 DIO_BV_GET(&din, &field_addr, fields);
38557
38558#else /* FREECIV_DELTA_PROTOCOL */
38559#ifdef FREECIV_JSON_CONNECTION
38560 field_addr.name = "year";
38561#endif /* FREECIV_JSON_CONNECTION */
38562 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
38563 RECEIVE_PACKET_FIELD_ERROR(year);
38564 }
38565#ifdef FREECIV_JSON_CONNECTION
38566 field_addr.name = "fragments";
38567#endif /* FREECIV_JSON_CONNECTION */
38568 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragments)) {
38569 RECEIVE_PACKET_FIELD_ERROR(fragments);
38570 }
38571#ifdef FREECIV_JSON_CONNECTION
38572 field_addr.name = "turn";
38573#endif /* FREECIV_JSON_CONNECTION */
38574 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
38575 RECEIVE_PACKET_FIELD_ERROR(turn);
38576 }
38577#endif
38578 log_packet_detailed("packet_new_year_100: got info about ()");
38579
38580#ifdef FREECIV_DELTA_PROTOCOL
38581 if (NULL == *hash) {
38582 *hash = genhash_new_full(hash_packet_new_year_100, cmp_packet_new_year_100,
38583 NULL, NULL, NULL, free);
38584 }
38585
38586 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
38587 *real_packet = *old;
38588 } else {
38589 log_packet_detailed(" no old info");
38590 memset(real_packet, 0, sizeof(*real_packet));
38591 }
38592
38593 if (BV_ISSET(fields, 0)) {
38594 log_packet_detailed(" got field 'year'");
38595#ifdef FREECIV_JSON_CONNECTION
38596 field_addr.name = "year";
38597#endif /* FREECIV_JSON_CONNECTION */
38598 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->year)) {
38599 RECEIVE_PACKET_FIELD_ERROR(year);
38600 }
38601 }
38602 if (BV_ISSET(fields, 1)) {
38603 log_packet_detailed(" got field 'fragments'");
38604#ifdef FREECIV_JSON_CONNECTION
38605 field_addr.name = "fragments";
38606#endif /* FREECIV_JSON_CONNECTION */
38607 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->fragments)) {
38608 RECEIVE_PACKET_FIELD_ERROR(fragments);
38609 }
38610 }
38611 if (BV_ISSET(fields, 2)) {
38612 log_packet_detailed(" got field 'turn'");
38613#ifdef FREECIV_JSON_CONNECTION
38614 field_addr.name = "turn";
38615#endif /* FREECIV_JSON_CONNECTION */
38616 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn)) {
38617 RECEIVE_PACKET_FIELD_ERROR(turn);
38618 }
38619 }
38620
38621 if (NULL == old) {
38622 old = fc_malloc(sizeof(*old));
38623 *old = *real_packet;
38624 genhash_insert(*hash, old, old);
38625 } else {
38626 *old = *real_packet;
38627 }
38628
38629#endif /* FREECIV_DELTA_PROTOCOL */
38630 RECEIVE_PACKET_END(real_packet);
38631}
38632
38633 static int send_packet_new_year_100(struct connection *pc, const struct packet_new_year *packet)
38634{
38635 const struct packet_new_year *real_packet = packet;
38636 int e;
38637#ifdef FREECIV_DELTA_PROTOCOL
38638 packet_new_year_100_fields fields;
38639 struct packet_new_year *old;
38640 bool differ;
38641 struct genhash **hash = pc->phs.sent + PACKET_NEW_YEAR;
38642#endif /* FREECIV_DELTA_PROTOCOL */
38643 SEND_PACKET_START(PACKET_NEW_YEAR);
38644#ifdef FREECIV_JSON_CONNECTION
38645 struct plocation field_addr;
38646 {
38647 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38648 field_addr = *field_addr_tmp;
38649 FC_FREE(field_addr_tmp);
38650 }
38651#endif /* FREECIV_JSON_CONNECTION */
38652
38653 log_packet_detailed("packet_new_year_100: sending info about ()");
38654
38655#ifdef FREECIV_DELTA_PROTOCOL
38656 if (NULL == *hash) {
38657 *hash = genhash_new_full(hash_packet_new_year_100, cmp_packet_new_year_100,
38658 NULL, NULL, NULL, free);
38659 }
38660 BV_CLR_ALL(fields);
38661
38662 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
38663 old = fc_malloc(sizeof(*old));
38664 *old = *real_packet;
38665 genhash_insert(*hash, old, old);
38666 memset(old, 0, sizeof(*old));
38667 }
38668 differ = (old->year != real_packet->year);
38669 if (differ) {
38670 BV_SET(fields, 0);
38671 }
38672
38673 differ = (old->fragments != real_packet->fragments);
38674 if (differ) {
38675 BV_SET(fields, 1);
38676 }
38677
38678 differ = (old->turn != real_packet->turn);
38679 if (differ) {
38680 BV_SET(fields, 2);
38681 }
38682
38683
38684#ifdef FREECIV_JSON_CONNECTION
38685 field_addr.name = "fields";
38686#endif /* FREECIV_JSON_CONNECTION */
38687 e = 0;
38688 e |= DIO_BV_PUT(&dout, &field_addr, fields);
38689 if (e) {
38690 log_packet_detailed("fields bitvector error detected");
38691 }
38692
38693 if (BV_ISSET(fields, 0)) {
38694 log_packet_detailed(" field 'year' has changed");
38695#ifdef FREECIV_JSON_CONNECTION
38696 field_addr.name = "year";
38697#endif /* FREECIV_JSON_CONNECTION */
38698 e = 0;
38699 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
38700 if (e) {
38701 log_packet_detailed("'year' field error detected");
38702 }
38703 }
38704 if (BV_ISSET(fields, 1)) {
38705 log_packet_detailed(" field 'fragments' has changed");
38706#ifdef FREECIV_JSON_CONNECTION
38707 field_addr.name = "fragments";
38708#endif /* FREECIV_JSON_CONNECTION */
38709 e = 0;
38710 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragments);
38711 if (e) {
38712 log_packet_detailed("'fragments' field error detected");
38713 }
38714 }
38715 if (BV_ISSET(fields, 2)) {
38716 log_packet_detailed(" field 'turn' has changed");
38717#ifdef FREECIV_JSON_CONNECTION
38718 field_addr.name = "turn";
38719#endif /* FREECIV_JSON_CONNECTION */
38720 e = 0;
38721 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
38722 if (e) {
38723 log_packet_detailed("'turn' field error detected");
38724 }
38725 }
38726
38727 *old = *real_packet;
38728#endif /* FREECIV_DELTA_PROTOCOL */
38729#ifndef FREECIV_DELTA_PROTOCOL
38730#ifdef FREECIV_JSON_CONNECTION
38731 field_addr.name = "year";
38732#endif /* FREECIV_JSON_CONNECTION */
38733 e = 0;
38734 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->year);
38735 if (e) {
38736 log_packet_detailed("'year' field error detected");
38737 }
38738#ifdef FREECIV_JSON_CONNECTION
38739 field_addr.name = "fragments";
38740#endif /* FREECIV_JSON_CONNECTION */
38741 e = 0;
38742 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->fragments);
38743 if (e) {
38744 log_packet_detailed("'fragments' field error detected");
38745 }
38746#ifdef FREECIV_JSON_CONNECTION
38747 field_addr.name = "turn";
38748#endif /* FREECIV_JSON_CONNECTION */
38749 e = 0;
38750 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn);
38751 if (e) {
38752 log_packet_detailed("'turn' field error detected");
38753 }
38754
38755#endif
38756 SEND_PACKET_END(PACKET_NEW_YEAR);
38757}
38758
38759 int send_packet_new_year(struct connection *pc, const struct packet_new_year *packet)
38760{
38761 if (!pc->used) {
38762 log_error("WARNING: trying to send data to the closed connection %s",
38763 conn_description(pc));
38764 return -1;
38765 }
38766 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NEW_YEAR].packet != NULL, -1,
38767 "Handler for PACKET_NEW_YEAR not installed");
38768 return pc->phs.handlers->send[PACKET_NEW_YEAR].packet(pc, packet);
38769}
38770
38771 void lsend_packet_new_year(struct conn_list *dest, const struct packet_new_year *packet)
38772{
38773 conn_list_iterate(dest, pconn) {
38774 send_packet_new_year(pconn, packet);
38775 } conn_list_iterate_end;
38776}
38777
38778 static struct packet_begin_turn *receive_packet_begin_turn_100(struct connection *pc)
38779{
38780 RECEIVE_PACKET_START(packet_begin_turn, real_packet);
38781#if 1 /* To match endif */
38782 real_packet->__dummy = 0xff;
38783#endif
38784 log_packet_detailed("packet_begin_turn_100: got info about ()");
38785 RECEIVE_PACKET_END(real_packet);
38786}
38787
38788 static int send_packet_begin_turn_100(struct connection *pc)
38789{
38790 SEND_PACKET_START(PACKET_BEGIN_TURN);
38791
38792 log_packet_detailed("packet_begin_turn_100: sending info about ()");
38793 SEND_PACKET_END(PACKET_BEGIN_TURN);
38794}
38795
38796 int send_packet_begin_turn(struct connection *pc)
38797{
38798 if (!pc->used) {
38799 log_error("WARNING: trying to send data to the closed connection %s",
38800 conn_description(pc));
38801 return -1;
38802 }
38803 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_BEGIN_TURN].no_packet != NULL, -1,
38804 "Handler for PACKET_BEGIN_TURN not installed");
38805 return pc->phs.handlers->send[PACKET_BEGIN_TURN].no_packet(pc);
38806}
38807
38808 void lsend_packet_begin_turn(struct conn_list *dest)
38809{
38810 conn_list_iterate(dest, pconn) {
38811 send_packet_begin_turn(pconn);
38812 } conn_list_iterate_end;
38813}
38814
38815 static struct packet_end_turn *receive_packet_end_turn_100(struct connection *pc)
38816{
38817 RECEIVE_PACKET_START(packet_end_turn, real_packet);
38818#if 1 /* To match endif */
38819 real_packet->__dummy = 0xff;
38820#endif
38821 log_packet_detailed("packet_end_turn_100: got info about ()");
38822 RECEIVE_PACKET_END(real_packet);
38823}
38824
38825 static int send_packet_end_turn_100(struct connection *pc)
38826{
38827 SEND_PACKET_START(PACKET_END_TURN);
38828
38829 log_packet_detailed("packet_end_turn_100: sending info about ()");
38830 SEND_PACKET_END(PACKET_END_TURN);
38831}
38832
38833 int send_packet_end_turn(struct connection *pc)
38834{
38835 if (!pc->used) {
38836 log_error("WARNING: trying to send data to the closed connection %s",
38837 conn_description(pc));
38838 return -1;
38839 }
38840 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_END_TURN].no_packet != NULL, -1,
38841 "Handler for PACKET_END_TURN not installed");
38842 return pc->phs.handlers->send[PACKET_END_TURN].no_packet(pc);
38843}
38844
38845 void lsend_packet_end_turn(struct conn_list *dest)
38846{
38847 conn_list_iterate(dest, pconn) {
38848 send_packet_end_turn(pconn);
38849 } conn_list_iterate_end;
38850}
38851
38852 static struct packet_freeze_client *receive_packet_freeze_client_100(struct connection *pc)
38853{
38854 RECEIVE_PACKET_START(packet_freeze_client, real_packet);
38855#if 1 /* To match endif */
38856 real_packet->__dummy = 0xff;
38857#endif
38858 log_packet_detailed("packet_freeze_client_100: got info about ()");
38859 RECEIVE_PACKET_END(real_packet);
38860}
38861
38862 static int send_packet_freeze_client_100(struct connection *pc)
38863{
38864 SEND_PACKET_START(PACKET_FREEZE_CLIENT);
38865
38866 log_packet_detailed("packet_freeze_client_100: sending info about ()");
38867 SEND_PACKET_END(PACKET_FREEZE_CLIENT);
38868}
38869
38870 int send_packet_freeze_client(struct connection *pc)
38871{
38872 if (!pc->used) {
38873 log_error("WARNING: trying to send data to the closed connection %s",
38874 conn_description(pc));
38875 return -1;
38876 }
38877 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_FREEZE_CLIENT].no_packet != NULL, -1,
38878 "Handler for PACKET_FREEZE_CLIENT not installed");
38879 return pc->phs.handlers->send[PACKET_FREEZE_CLIENT].no_packet(pc);
38880}
38881
38882 void lsend_packet_freeze_client(struct conn_list *dest)
38883{
38884 conn_list_iterate(dest, pconn) {
38885 send_packet_freeze_client(pconn);
38886 } conn_list_iterate_end;
38887}
38888
38889 static struct packet_thaw_client *receive_packet_thaw_client_100(struct connection *pc)
38890{
38891 RECEIVE_PACKET_START(packet_thaw_client, real_packet);
38892#if 1 /* To match endif */
38893 real_packet->__dummy = 0xff;
38894#endif
38895 log_packet_detailed("packet_thaw_client_100: got info about ()");
38896 RECEIVE_PACKET_END(real_packet);
38897}
38898
38899 static int send_packet_thaw_client_100(struct connection *pc)
38900{
38901 SEND_PACKET_START(PACKET_THAW_CLIENT);
38902
38903 log_packet_detailed("packet_thaw_client_100: sending info about ()");
38904 SEND_PACKET_END(PACKET_THAW_CLIENT);
38905}
38906
38907 int send_packet_thaw_client(struct connection *pc)
38908{
38909 if (!pc->used) {
38910 log_error("WARNING: trying to send data to the closed connection %s",
38911 conn_description(pc));
38912 return -1;
38913 }
38914 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_THAW_CLIENT].no_packet != NULL, -1,
38915 "Handler for PACKET_THAW_CLIENT not installed");
38916 return pc->phs.handlers->send[PACKET_THAW_CLIENT].no_packet(pc);
38917}
38918
38919 void lsend_packet_thaw_client(struct conn_list *dest)
38920{
38921 conn_list_iterate(dest, pconn) {
38922 send_packet_thaw_client(pconn);
38923 } conn_list_iterate_end;
38924}
38925
38926 static struct packet_spaceship_launch *receive_packet_spaceship_launch_100(struct connection *pc)
38927{
38928 RECEIVE_PACKET_START(packet_spaceship_launch, real_packet);
38929#if 1 /* To match endif */
38930 real_packet->__dummy = 0xff;
38931#endif
38932 log_packet_detailed("packet_spaceship_launch_100: got info about ()");
38933 RECEIVE_PACKET_END(real_packet);
38934}
38935
38936 static int send_packet_spaceship_launch_100(struct connection *pc)
38937{
38938 SEND_PACKET_START(PACKET_SPACESHIP_LAUNCH);
38939
38940 log_packet_detailed("packet_spaceship_launch_100: sending info about ()");
38941 SEND_PACKET_END(PACKET_SPACESHIP_LAUNCH);
38942}
38943
38944 int send_packet_spaceship_launch(struct connection *pc)
38945{
38946 if (!pc->used) {
38947 log_error("WARNING: trying to send data to the closed connection %s",
38948 conn_description(pc));
38949 return -1;
38950 }
38951 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_LAUNCH].no_packet != NULL, -1,
38952 "Handler for PACKET_SPACESHIP_LAUNCH not installed");
38953 return pc->phs.handlers->send[PACKET_SPACESHIP_LAUNCH].no_packet(pc);
38954}
38955
38956#ifdef FREECIV_DELTA_PROTOCOL
38957#define hash_packet_spaceship_place_100 hash_const
38958
38959#define cmp_packet_spaceship_place_100 cmp_const
38960
38961 BV_DEFINE(packet_spaceship_place_100_fields, 2);
38962#endif /* FREECIV_DELTA_PROTOCOL */
38963
38964 static struct packet_spaceship_place *receive_packet_spaceship_place_100(struct connection *pc)
38965{
38966#ifdef FREECIV_DELTA_PROTOCOL
38967 packet_spaceship_place_100_fields fields;
38968 struct packet_spaceship_place *old;
38969 struct genhash **hash = pc->phs.received + PACKET_SPACESHIP_PLACE;
38970#endif /* FREECIV_DELTA_PROTOCOL */
38971 RECEIVE_PACKET_START(packet_spaceship_place, real_packet);
38972#ifdef FREECIV_JSON_CONNECTION
38973 struct plocation field_addr;
38974 {
38975 struct plocation *field_addr_tmp = plocation_field_new(NULL);
38976 field_addr = *field_addr_tmp;
38977 FC_FREE(field_addr_tmp);
38978 }
38979#endif /* FREECIV_JSON_CONNECTION */
38980
38981#ifdef FREECIV_DELTA_PROTOCOL
38982#ifdef FREECIV_JSON_CONNECTION
38983 field_addr.name = "fields";
38984#endif /* FREECIV_JSON_CONNECTION */
38985 DIO_BV_GET(&din, &field_addr, fields);
38986
38987#else /* FREECIV_DELTA_PROTOCOL */
38988#ifdef FREECIV_JSON_CONNECTION
38989 field_addr.name = "type";
38990#endif /* FREECIV_JSON_CONNECTION */
38991 {
38992 int readin;
38993
38994 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
38995 RECEIVE_PACKET_FIELD_ERROR(type);
38996 }
38997 real_packet->type = readin;
38998 }
38999#ifdef FREECIV_JSON_CONNECTION
39000 field_addr.name = "num";
39001#endif /* FREECIV_JSON_CONNECTION */
39002 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num)) {
39003 RECEIVE_PACKET_FIELD_ERROR(num);
39004 }
39005#endif
39006 log_packet_detailed("packet_spaceship_place_100: got info about ()");
39007
39008#ifdef FREECIV_DELTA_PROTOCOL
39009 if (NULL == *hash) {
39010 *hash = genhash_new_full(hash_packet_spaceship_place_100, cmp_packet_spaceship_place_100,
39011 NULL, NULL, NULL, free);
39012 }
39013
39014 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
39015 *real_packet = *old;
39016 } else {
39017 log_packet_detailed(" no old info");
39018 memset(real_packet, 0, sizeof(*real_packet));
39019 }
39020
39021 if (BV_ISSET(fields, 0)) {
39022 log_packet_detailed(" got field 'type'");
39023#ifdef FREECIV_JSON_CONNECTION
39024 field_addr.name = "type";
39025#endif /* FREECIV_JSON_CONNECTION */
39026 {
39027 int readin;
39028
39029 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
39030 RECEIVE_PACKET_FIELD_ERROR(type);
39031 }
39032 real_packet->type = readin;
39033 }
39034 }
39035 if (BV_ISSET(fields, 1)) {
39036 log_packet_detailed(" got field 'num'");
39037#ifdef FREECIV_JSON_CONNECTION
39038 field_addr.name = "num";
39039#endif /* FREECIV_JSON_CONNECTION */
39040 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num)) {
39041 RECEIVE_PACKET_FIELD_ERROR(num);
39042 }
39043 }
39044
39045 if (NULL == old) {
39046 old = fc_malloc(sizeof(*old));
39047 *old = *real_packet;
39048 genhash_insert(*hash, old, old);
39049 } else {
39050 *old = *real_packet;
39051 }
39052
39053#endif /* FREECIV_DELTA_PROTOCOL */
39054 RECEIVE_PACKET_END(real_packet);
39055}
39056
39057 static int send_packet_spaceship_place_100(struct connection *pc, const struct packet_spaceship_place *packet)
39058{
39059 const struct packet_spaceship_place *real_packet = packet;
39060 int e;
39061#ifdef FREECIV_DELTA_PROTOCOL
39062 packet_spaceship_place_100_fields fields;
39063 struct packet_spaceship_place *old;
39064 bool differ;
39065 struct genhash **hash = pc->phs.sent + PACKET_SPACESHIP_PLACE;
39066#endif /* FREECIV_DELTA_PROTOCOL */
39067 SEND_PACKET_START(PACKET_SPACESHIP_PLACE);
39068#ifdef FREECIV_JSON_CONNECTION
39069 struct plocation field_addr;
39070 {
39071 struct plocation *field_addr_tmp = plocation_field_new(NULL);
39072 field_addr = *field_addr_tmp;
39073 FC_FREE(field_addr_tmp);
39074 }
39075#endif /* FREECIV_JSON_CONNECTION */
39076
39077 log_packet_detailed("packet_spaceship_place_100: sending info about ()");
39078
39079#ifdef FREECIV_DELTA_PROTOCOL
39080 if (NULL == *hash) {
39081 *hash = genhash_new_full(hash_packet_spaceship_place_100, cmp_packet_spaceship_place_100,
39082 NULL, NULL, NULL, free);
39083 }
39084 BV_CLR_ALL(fields);
39085
39086 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
39087 old = fc_malloc(sizeof(*old));
39088 *old = *real_packet;
39089 genhash_insert(*hash, old, old);
39090 memset(old, 0, sizeof(*old));
39091 }
39092 differ = (old->type != real_packet->type);
39093 if (differ) {
39094 BV_SET(fields, 0);
39095 }
39096
39097 differ = (old->num != real_packet->num);
39098 if (differ) {
39099 BV_SET(fields, 1);
39100 }
39101
39102
39103#ifdef FREECIV_JSON_CONNECTION
39104 field_addr.name = "fields";
39105#endif /* FREECIV_JSON_CONNECTION */
39106 e = 0;
39107 e |= DIO_BV_PUT(&dout, &field_addr, fields);
39108 if (e) {
39109 log_packet_detailed("fields bitvector error detected");
39110 }
39111
39112 if (BV_ISSET(fields, 0)) {
39113 log_packet_detailed(" field 'type' has changed");
39114#ifdef FREECIV_JSON_CONNECTION
39115 field_addr.name = "type";
39116#endif /* FREECIV_JSON_CONNECTION */
39117 e = 0;
39118 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
39119 if (e) {
39120 log_packet_detailed("'type' field error detected");
39121 }
39122 }
39123 if (BV_ISSET(fields, 1)) {
39124 log_packet_detailed(" field 'num' has changed");
39125#ifdef FREECIV_JSON_CONNECTION
39126 field_addr.name = "num";
39127#endif /* FREECIV_JSON_CONNECTION */
39128 e = 0;
39129 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num);
39130 if (e) {
39131 log_packet_detailed("'num' field error detected");
39132 }
39133 }
39134
39135 *old = *real_packet;
39136#endif /* FREECIV_DELTA_PROTOCOL */
39137#ifndef FREECIV_DELTA_PROTOCOL
39138#ifdef FREECIV_JSON_CONNECTION
39139 field_addr.name = "type";
39140#endif /* FREECIV_JSON_CONNECTION */
39141 e = 0;
39142 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
39143 if (e) {
39144 log_packet_detailed("'type' field error detected");
39145 }
39146#ifdef FREECIV_JSON_CONNECTION
39147 field_addr.name = "num";
39148#endif /* FREECIV_JSON_CONNECTION */
39149 e = 0;
39150 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num);
39151 if (e) {
39152 log_packet_detailed("'num' field error detected");
39153 }
39154
39155#endif
39156 SEND_PACKET_END(PACKET_SPACESHIP_PLACE);
39157}
39158
39159 int send_packet_spaceship_place(struct connection *pc, const struct packet_spaceship_place *packet)
39160{
39161 if (!pc->used) {
39162 log_error("WARNING: trying to send data to the closed connection %s",
39163 conn_description(pc));
39164 return -1;
39165 }
39166 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_PLACE].packet != NULL, -1,
39167 "Handler for PACKET_SPACESHIP_PLACE not installed");
39168 return pc->phs.handlers->send[PACKET_SPACESHIP_PLACE].packet(pc, packet);
39169}
39170
39171 int dsend_packet_spaceship_place(struct connection *pc, enum spaceship_place_type type, int num)
39172{
39173 struct packet_spaceship_place packet, *real_packet = &packet;
39174
39175 real_packet->type = type;
39176 real_packet->num = num;
39177
39178 return send_packet_spaceship_place(pc, real_packet);
39179}
39180
39181#ifdef FREECIV_DELTA_PROTOCOL
39182static genhash_val_t hash_packet_spaceship_info_100(const void *vkey)
39183{
39184 const struct packet_spaceship_info *key = (const struct packet_spaceship_info *) vkey;
39185 genhash_val_t result = 0;
39186
39187 result += key->player_num;
39188
39189 result &= 0xFFFFFFFF;
39190 return result;
39191}
39192
39193static bool cmp_packet_spaceship_info_100(const void *vkey1, const void *vkey2)
39194{
39195 const struct packet_spaceship_info *old = (const struct packet_spaceship_info *) vkey1;
39196 const struct packet_spaceship_info *real_packet = (const struct packet_spaceship_info *) vkey2;
39197 bool differ;
39198
39199 differ = (old->player_num != real_packet->player_num);
39200
39201 return !differ;
39202}
39203 BV_DEFINE(packet_spaceship_info_100_fields, 17);
39204#endif /* FREECIV_DELTA_PROTOCOL */
39205
39206 static struct packet_spaceship_info *receive_packet_spaceship_info_100(struct connection *pc)
39207{
39208#ifdef FREECIV_DELTA_PROTOCOL
39209 packet_spaceship_info_100_fields fields;
39210 struct packet_spaceship_info *old;
39211 struct genhash **hash = pc->phs.received + PACKET_SPACESHIP_INFO;
39212#endif /* FREECIV_DELTA_PROTOCOL */
39213 RECEIVE_PACKET_START(packet_spaceship_info, real_packet);
39214#ifdef FREECIV_JSON_CONNECTION
39215 struct plocation field_addr;
39216 {
39217 struct plocation *field_addr_tmp = plocation_field_new(NULL);
39218 field_addr = *field_addr_tmp;
39219 FC_FREE(field_addr_tmp);
39220 }
39221#endif /* FREECIV_JSON_CONNECTION */
39222
39223#ifdef FREECIV_DELTA_PROTOCOL
39224#ifdef FREECIV_JSON_CONNECTION
39225 field_addr.name = "fields";
39226#endif /* FREECIV_JSON_CONNECTION */
39227 DIO_BV_GET(&din, &field_addr, fields);
39228#ifdef FREECIV_JSON_CONNECTION
39229 field_addr.name = "player_num";
39230#endif /* FREECIV_JSON_CONNECTION */
39231 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
39232 RECEIVE_PACKET_FIELD_ERROR(player_num);
39233 }
39234
39235#else /* FREECIV_DELTA_PROTOCOL */
39236#ifdef FREECIV_JSON_CONNECTION
39237 field_addr.name = "player_num";
39238#endif /* FREECIV_JSON_CONNECTION */
39239 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player_num)) {
39240 RECEIVE_PACKET_FIELD_ERROR(player_num);
39241 }
39242#ifdef FREECIV_JSON_CONNECTION
39243 field_addr.name = "sship_state";
39244#endif /* FREECIV_JSON_CONNECTION */
39245 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sship_state)) {
39246 RECEIVE_PACKET_FIELD_ERROR(sship_state);
39247 }
39248#ifdef FREECIV_JSON_CONNECTION
39249 field_addr.name = "structurals";
39250#endif /* FREECIV_JSON_CONNECTION */
39251 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->structurals)) {
39252 RECEIVE_PACKET_FIELD_ERROR(structurals);
39253 }
39254#ifdef FREECIV_JSON_CONNECTION
39255 field_addr.name = "components";
39256#endif /* FREECIV_JSON_CONNECTION */
39257 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->components)) {
39258 RECEIVE_PACKET_FIELD_ERROR(components);
39259 }
39260#ifdef FREECIV_JSON_CONNECTION
39261 field_addr.name = "modules";
39262#endif /* FREECIV_JSON_CONNECTION */
39263 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->modules)) {
39264 RECEIVE_PACKET_FIELD_ERROR(modules);
39265 }
39266#ifdef FREECIV_JSON_CONNECTION
39267 field_addr.name = "fuel";
39268#endif /* FREECIV_JSON_CONNECTION */
39269 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
39270 RECEIVE_PACKET_FIELD_ERROR(fuel);
39271 }
39272#ifdef FREECIV_JSON_CONNECTION
39273 field_addr.name = "propulsion";
39274#endif /* FREECIV_JSON_CONNECTION */
39275 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->propulsion)) {
39276 RECEIVE_PACKET_FIELD_ERROR(propulsion);
39277 }
39278#ifdef FREECIV_JSON_CONNECTION
39279 field_addr.name = "habitation";
39280#endif /* FREECIV_JSON_CONNECTION */
39281 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->habitation)) {
39282 RECEIVE_PACKET_FIELD_ERROR(habitation);
39283 }
39284#ifdef FREECIV_JSON_CONNECTION
39285 field_addr.name = "life_support";
39286#endif /* FREECIV_JSON_CONNECTION */
39287 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->life_support)) {
39288 RECEIVE_PACKET_FIELD_ERROR(life_support);
39289 }
39290#ifdef FREECIV_JSON_CONNECTION
39291 field_addr.name = "solar_panels";
39292#endif /* FREECIV_JSON_CONNECTION */
39293 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->solar_panels)) {
39294 RECEIVE_PACKET_FIELD_ERROR(solar_panels);
39295 }
39296#ifdef FREECIV_JSON_CONNECTION
39297 field_addr.name = "launch_year";
39298#endif /* FREECIV_JSON_CONNECTION */
39299 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->launch_year)) {
39300 RECEIVE_PACKET_FIELD_ERROR(launch_year);
39301 }
39302#ifdef FREECIV_JSON_CONNECTION
39303 field_addr.name = "population";
39304#endif /* FREECIV_JSON_CONNECTION */
39305 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->population)) {
39306 RECEIVE_PACKET_FIELD_ERROR(population);
39307 }
39308#ifdef FREECIV_JSON_CONNECTION
39309 field_addr.name = "mass";
39310#endif /* FREECIV_JSON_CONNECTION */
39311 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->mass)) {
39312 RECEIVE_PACKET_FIELD_ERROR(mass);
39313 }
39314#ifdef FREECIV_JSON_CONNECTION
39315 field_addr.name = "structure";
39316#endif /* FREECIV_JSON_CONNECTION */
39317 if (!DIO_BV_GET(&din, &field_addr, real_packet->structure)) {
39318 RECEIVE_PACKET_FIELD_ERROR(structure);
39319 }
39320#ifdef FREECIV_JSON_CONNECTION
39321 field_addr.name = "support_rate";
39322#endif /* FREECIV_JSON_CONNECTION */
39323 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->support_rate, 10000)) {
39324 RECEIVE_PACKET_FIELD_ERROR(support_rate);
39325 }
39326#ifdef FREECIV_JSON_CONNECTION
39327 field_addr.name = "energy_rate";
39328#endif /* FREECIV_JSON_CONNECTION */
39329 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->energy_rate, 10000)) {
39330 RECEIVE_PACKET_FIELD_ERROR(energy_rate);
39331 }
39332#ifdef FREECIV_JSON_CONNECTION
39333 field_addr.name = "success_rate";
39334#endif /* FREECIV_JSON_CONNECTION */
39335 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->success_rate, 10000)) {
39336 RECEIVE_PACKET_FIELD_ERROR(success_rate);
39337 }
39338#ifdef FREECIV_JSON_CONNECTION
39339 field_addr.name = "travel_time";
39340#endif /* FREECIV_JSON_CONNECTION */
39341 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->travel_time, 10000)) {
39342 RECEIVE_PACKET_FIELD_ERROR(travel_time);
39343 }
39344#endif
39345 log_packet_detailed("packet_spaceship_info_100: got info about (%d)",
39346 real_packet->player_num);
39347
39348#ifdef FREECIV_DELTA_PROTOCOL
39349 if (NULL == *hash) {
39350 *hash = genhash_new_full(hash_packet_spaceship_info_100, cmp_packet_spaceship_info_100,
39351 NULL, NULL, NULL, free);
39352 }
39353
39354 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
39355 *real_packet = *old;
39356 } else {
39357 int player_num;
39358
39359 player_num = real_packet->player_num;
39360
39361 log_packet_detailed(" no old info");
39362 memset(real_packet, 0, sizeof(*real_packet));
39363
39364 real_packet->player_num = player_num;
39365 }
39366
39367 if (BV_ISSET(fields, 0)) {
39368 log_packet_detailed(" got field 'sship_state'");
39369#ifdef FREECIV_JSON_CONNECTION
39370 field_addr.name = "sship_state";
39371#endif /* FREECIV_JSON_CONNECTION */
39372 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sship_state)) {
39373 RECEIVE_PACKET_FIELD_ERROR(sship_state);
39374 }
39375 }
39376 if (BV_ISSET(fields, 1)) {
39377 log_packet_detailed(" got field 'structurals'");
39378#ifdef FREECIV_JSON_CONNECTION
39379 field_addr.name = "structurals";
39380#endif /* FREECIV_JSON_CONNECTION */
39381 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->structurals)) {
39382 RECEIVE_PACKET_FIELD_ERROR(structurals);
39383 }
39384 }
39385 if (BV_ISSET(fields, 2)) {
39386 log_packet_detailed(" got field 'components'");
39387#ifdef FREECIV_JSON_CONNECTION
39388 field_addr.name = "components";
39389#endif /* FREECIV_JSON_CONNECTION */
39390 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->components)) {
39391 RECEIVE_PACKET_FIELD_ERROR(components);
39392 }
39393 }
39394 if (BV_ISSET(fields, 3)) {
39395 log_packet_detailed(" got field 'modules'");
39396#ifdef FREECIV_JSON_CONNECTION
39397 field_addr.name = "modules";
39398#endif /* FREECIV_JSON_CONNECTION */
39399 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->modules)) {
39400 RECEIVE_PACKET_FIELD_ERROR(modules);
39401 }
39402 }
39403 if (BV_ISSET(fields, 4)) {
39404 log_packet_detailed(" got field 'fuel'");
39405#ifdef FREECIV_JSON_CONNECTION
39406 field_addr.name = "fuel";
39407#endif /* FREECIV_JSON_CONNECTION */
39408 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
39409 RECEIVE_PACKET_FIELD_ERROR(fuel);
39410 }
39411 }
39412 if (BV_ISSET(fields, 5)) {
39413 log_packet_detailed(" got field 'propulsion'");
39414#ifdef FREECIV_JSON_CONNECTION
39415 field_addr.name = "propulsion";
39416#endif /* FREECIV_JSON_CONNECTION */
39417 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->propulsion)) {
39418 RECEIVE_PACKET_FIELD_ERROR(propulsion);
39419 }
39420 }
39421 if (BV_ISSET(fields, 6)) {
39422 log_packet_detailed(" got field 'habitation'");
39423#ifdef FREECIV_JSON_CONNECTION
39424 field_addr.name = "habitation";
39425#endif /* FREECIV_JSON_CONNECTION */
39426 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->habitation)) {
39427 RECEIVE_PACKET_FIELD_ERROR(habitation);
39428 }
39429 }
39430 if (BV_ISSET(fields, 7)) {
39431 log_packet_detailed(" got field 'life_support'");
39432#ifdef FREECIV_JSON_CONNECTION
39433 field_addr.name = "life_support";
39434#endif /* FREECIV_JSON_CONNECTION */
39435 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->life_support)) {
39436 RECEIVE_PACKET_FIELD_ERROR(life_support);
39437 }
39438 }
39439 if (BV_ISSET(fields, 8)) {
39440 log_packet_detailed(" got field 'solar_panels'");
39441#ifdef FREECIV_JSON_CONNECTION
39442 field_addr.name = "solar_panels";
39443#endif /* FREECIV_JSON_CONNECTION */
39444 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->solar_panels)) {
39445 RECEIVE_PACKET_FIELD_ERROR(solar_panels);
39446 }
39447 }
39448 if (BV_ISSET(fields, 9)) {
39449 log_packet_detailed(" got field 'launch_year'");
39450#ifdef FREECIV_JSON_CONNECTION
39451 field_addr.name = "launch_year";
39452#endif /* FREECIV_JSON_CONNECTION */
39453 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->launch_year)) {
39454 RECEIVE_PACKET_FIELD_ERROR(launch_year);
39455 }
39456 }
39457 if (BV_ISSET(fields, 10)) {
39458 log_packet_detailed(" got field 'population'");
39459#ifdef FREECIV_JSON_CONNECTION
39460 field_addr.name = "population";
39461#endif /* FREECIV_JSON_CONNECTION */
39462 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->population)) {
39463 RECEIVE_PACKET_FIELD_ERROR(population);
39464 }
39465 }
39466 if (BV_ISSET(fields, 11)) {
39467 log_packet_detailed(" got field 'mass'");
39468#ifdef FREECIV_JSON_CONNECTION
39469 field_addr.name = "mass";
39470#endif /* FREECIV_JSON_CONNECTION */
39471 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->mass)) {
39472 RECEIVE_PACKET_FIELD_ERROR(mass);
39473 }
39474 }
39475 if (BV_ISSET(fields, 12)) {
39476 log_packet_detailed(" got field 'structure'");
39477#ifdef FREECIV_JSON_CONNECTION
39478 field_addr.name = "structure";
39479#endif /* FREECIV_JSON_CONNECTION */
39480 if (!DIO_BV_GET(&din, &field_addr, real_packet->structure)) {
39481 RECEIVE_PACKET_FIELD_ERROR(structure);
39482 }
39483 }
39484 if (BV_ISSET(fields, 13)) {
39485 log_packet_detailed(" got field 'support_rate'");
39486#ifdef FREECIV_JSON_CONNECTION
39487 field_addr.name = "support_rate";
39488#endif /* FREECIV_JSON_CONNECTION */
39489 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->support_rate, 10000)) {
39490 RECEIVE_PACKET_FIELD_ERROR(support_rate);
39491 }
39492 }
39493 if (BV_ISSET(fields, 14)) {
39494 log_packet_detailed(" got field 'energy_rate'");
39495#ifdef FREECIV_JSON_CONNECTION
39496 field_addr.name = "energy_rate";
39497#endif /* FREECIV_JSON_CONNECTION */
39498 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->energy_rate, 10000)) {
39499 RECEIVE_PACKET_FIELD_ERROR(energy_rate);
39500 }
39501 }
39502 if (BV_ISSET(fields, 15)) {
39503 log_packet_detailed(" got field 'success_rate'");
39504#ifdef FREECIV_JSON_CONNECTION
39505 field_addr.name = "success_rate";
39506#endif /* FREECIV_JSON_CONNECTION */
39507 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->success_rate, 10000)) {
39508 RECEIVE_PACKET_FIELD_ERROR(success_rate);
39509 }
39510 }
39511 if (BV_ISSET(fields, 16)) {
39512 log_packet_detailed(" got field 'travel_time'");
39513#ifdef FREECIV_JSON_CONNECTION
39514 field_addr.name = "travel_time";
39515#endif /* FREECIV_JSON_CONNECTION */
39516 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->travel_time, 10000)) {
39517 RECEIVE_PACKET_FIELD_ERROR(travel_time);
39518 }
39519 }
39520
39521 if (NULL == old) {
39522 old = fc_malloc(sizeof(*old));
39523 *old = *real_packet;
39524 genhash_insert(*hash, old, old);
39525 } else {
39526 *old = *real_packet;
39527 }
39528
39529#endif /* FREECIV_DELTA_PROTOCOL */
39530 RECEIVE_PACKET_END(real_packet);
39531}
39532
39533 static int send_packet_spaceship_info_100(struct connection *pc, const struct packet_spaceship_info *packet)
39534{
39535 const struct packet_spaceship_info *real_packet = packet;
39536 int e;
39537#ifdef FREECIV_DELTA_PROTOCOL
39538 packet_spaceship_info_100_fields fields;
39539 struct packet_spaceship_info *old;
39540 bool differ;
39541 struct genhash **hash = pc->phs.sent + PACKET_SPACESHIP_INFO;
39542 int different = 0;
39543#endif /* FREECIV_DELTA_PROTOCOL */
39544 SEND_PACKET_START(PACKET_SPACESHIP_INFO);
39545#ifdef FREECIV_JSON_CONNECTION
39546 struct plocation field_addr;
39547 {
39548 struct plocation *field_addr_tmp = plocation_field_new(NULL);
39549 field_addr = *field_addr_tmp;
39550 FC_FREE(field_addr_tmp);
39551 }
39552#endif /* FREECIV_JSON_CONNECTION */
39553
39554 log_packet_detailed("packet_spaceship_info_100: sending info about (%d)",
39555 real_packet->player_num);
39556
39557#ifdef FREECIV_DELTA_PROTOCOL
39558 if (NULL == *hash) {
39559 *hash = genhash_new_full(hash_packet_spaceship_info_100, cmp_packet_spaceship_info_100,
39560 NULL, NULL, NULL, free);
39561 }
39562 BV_CLR_ALL(fields);
39563
39564 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
39565 old = fc_malloc(sizeof(*old));
39566 *old = *real_packet;
39567 genhash_insert(*hash, old, old);
39568 memset(old, 0, sizeof(*old));
39569 different = 1; /* Force to send. */
39570 }
39571 differ = (old->sship_state != real_packet->sship_state);
39572 if (differ) {
39573 different++;
39574 BV_SET(fields, 0);
39575 }
39576
39577 differ = (old->structurals != real_packet->structurals);
39578 if (differ) {
39579 different++;
39580 BV_SET(fields, 1);
39581 }
39582
39583 differ = (old->components != real_packet->components);
39584 if (differ) {
39585 different++;
39586 BV_SET(fields, 2);
39587 }
39588
39589 differ = (old->modules != real_packet->modules);
39590 if (differ) {
39591 different++;
39592 BV_SET(fields, 3);
39593 }
39594
39595 differ = (old->fuel != real_packet->fuel);
39596 if (differ) {
39597 different++;
39598 BV_SET(fields, 4);
39599 }
39600
39601 differ = (old->propulsion != real_packet->propulsion);
39602 if (differ) {
39603 different++;
39604 BV_SET(fields, 5);
39605 }
39606
39607 differ = (old->habitation != real_packet->habitation);
39608 if (differ) {
39609 different++;
39610 BV_SET(fields, 6);
39611 }
39612
39613 differ = (old->life_support != real_packet->life_support);
39614 if (differ) {
39615 different++;
39616 BV_SET(fields, 7);
39617 }
39618
39619 differ = (old->solar_panels != real_packet->solar_panels);
39620 if (differ) {
39621 different++;
39622 BV_SET(fields, 8);
39623 }
39624
39625 differ = (old->launch_year != real_packet->launch_year);
39626 if (differ) {
39627 different++;
39628 BV_SET(fields, 9);
39629 }
39630
39631 differ = (old->population != real_packet->population);
39632 if (differ) {
39633 different++;
39634 BV_SET(fields, 10);
39635 }
39636
39637 differ = (old->mass != real_packet->mass);
39638 if (differ) {
39639 different++;
39640 BV_SET(fields, 11);
39641 }
39642
39643 differ = !BV_ARE_EQUAL(old->structure, real_packet->structure);
39644 if (differ) {
39645 different++;
39646 BV_SET(fields, 12);
39647 }
39648
39649 differ = (old->support_rate != real_packet->support_rate);
39650 if (differ) {
39651 different++;
39652 BV_SET(fields, 13);
39653 }
39654
39655 differ = (old->energy_rate != real_packet->energy_rate);
39656 if (differ) {
39657 different++;
39658 BV_SET(fields, 14);
39659 }
39660
39661 differ = (old->success_rate != real_packet->success_rate);
39662 if (differ) {
39663 different++;
39664 BV_SET(fields, 15);
39665 }
39666
39667 differ = (old->travel_time != real_packet->travel_time);
39668 if (differ) {
39669 different++;
39670 BV_SET(fields, 16);
39671 }
39672
39673 if (different == 0) {
39674 log_packet_detailed(" no change -> discard");
39675 return 0;
39676 }
39677
39678#ifdef FREECIV_JSON_CONNECTION
39679 field_addr.name = "fields";
39680#endif /* FREECIV_JSON_CONNECTION */
39681 e = 0;
39682 e |= DIO_BV_PUT(&dout, &field_addr, fields);
39683 if (e) {
39684 log_packet_detailed("fields bitvector error detected");
39685 }
39686#ifdef FREECIV_JSON_CONNECTION
39687 field_addr.name = "player_num";
39688#endif /* FREECIV_JSON_CONNECTION */
39689 e = 0;
39690 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
39691 if (e) {
39692 log_packet_detailed("'player_num' field error detected");
39693 }
39694
39695 if (BV_ISSET(fields, 0)) {
39696 log_packet_detailed(" field 'sship_state' has changed");
39697#ifdef FREECIV_JSON_CONNECTION
39698 field_addr.name = "sship_state";
39699#endif /* FREECIV_JSON_CONNECTION */
39700 e = 0;
39701 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sship_state);
39702 if (e) {
39703 log_packet_detailed("'sship_state' field error detected");
39704 }
39705 }
39706 if (BV_ISSET(fields, 1)) {
39707 log_packet_detailed(" field 'structurals' has changed");
39708#ifdef FREECIV_JSON_CONNECTION
39709 field_addr.name = "structurals";
39710#endif /* FREECIV_JSON_CONNECTION */
39711 e = 0;
39712 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->structurals);
39713 if (e) {
39714 log_packet_detailed("'structurals' field error detected");
39715 }
39716 }
39717 if (BV_ISSET(fields, 2)) {
39718 log_packet_detailed(" field 'components' has changed");
39719#ifdef FREECIV_JSON_CONNECTION
39720 field_addr.name = "components";
39721#endif /* FREECIV_JSON_CONNECTION */
39722 e = 0;
39723 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->components);
39724 if (e) {
39725 log_packet_detailed("'components' field error detected");
39726 }
39727 }
39728 if (BV_ISSET(fields, 3)) {
39729 log_packet_detailed(" field 'modules' has changed");
39730#ifdef FREECIV_JSON_CONNECTION
39731 field_addr.name = "modules";
39732#endif /* FREECIV_JSON_CONNECTION */
39733 e = 0;
39734 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->modules);
39735 if (e) {
39736 log_packet_detailed("'modules' field error detected");
39737 }
39738 }
39739 if (BV_ISSET(fields, 4)) {
39740 log_packet_detailed(" field 'fuel' has changed");
39741#ifdef FREECIV_JSON_CONNECTION
39742 field_addr.name = "fuel";
39743#endif /* FREECIV_JSON_CONNECTION */
39744 e = 0;
39745 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
39746 if (e) {
39747 log_packet_detailed("'fuel' field error detected");
39748 }
39749 }
39750 if (BV_ISSET(fields, 5)) {
39751 log_packet_detailed(" field 'propulsion' has changed");
39752#ifdef FREECIV_JSON_CONNECTION
39753 field_addr.name = "propulsion";
39754#endif /* FREECIV_JSON_CONNECTION */
39755 e = 0;
39756 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->propulsion);
39757 if (e) {
39758 log_packet_detailed("'propulsion' field error detected");
39759 }
39760 }
39761 if (BV_ISSET(fields, 6)) {
39762 log_packet_detailed(" field 'habitation' has changed");
39763#ifdef FREECIV_JSON_CONNECTION
39764 field_addr.name = "habitation";
39765#endif /* FREECIV_JSON_CONNECTION */
39766 e = 0;
39767 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->habitation);
39768 if (e) {
39769 log_packet_detailed("'habitation' field error detected");
39770 }
39771 }
39772 if (BV_ISSET(fields, 7)) {
39773 log_packet_detailed(" field 'life_support' has changed");
39774#ifdef FREECIV_JSON_CONNECTION
39775 field_addr.name = "life_support";
39776#endif /* FREECIV_JSON_CONNECTION */
39777 e = 0;
39778 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->life_support);
39779 if (e) {
39780 log_packet_detailed("'life_support' field error detected");
39781 }
39782 }
39783 if (BV_ISSET(fields, 8)) {
39784 log_packet_detailed(" field 'solar_panels' has changed");
39785#ifdef FREECIV_JSON_CONNECTION
39786 field_addr.name = "solar_panels";
39787#endif /* FREECIV_JSON_CONNECTION */
39788 e = 0;
39789 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->solar_panels);
39790 if (e) {
39791 log_packet_detailed("'solar_panels' field error detected");
39792 }
39793 }
39794 if (BV_ISSET(fields, 9)) {
39795 log_packet_detailed(" field 'launch_year' has changed");
39796#ifdef FREECIV_JSON_CONNECTION
39797 field_addr.name = "launch_year";
39798#endif /* FREECIV_JSON_CONNECTION */
39799 e = 0;
39800 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->launch_year);
39801 if (e) {
39802 log_packet_detailed("'launch_year' field error detected");
39803 }
39804 }
39805 if (BV_ISSET(fields, 10)) {
39806 log_packet_detailed(" field 'population' has changed");
39807#ifdef FREECIV_JSON_CONNECTION
39808 field_addr.name = "population";
39809#endif /* FREECIV_JSON_CONNECTION */
39810 e = 0;
39811 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->population);
39812 if (e) {
39813 log_packet_detailed("'population' field error detected");
39814 }
39815 }
39816 if (BV_ISSET(fields, 11)) {
39817 log_packet_detailed(" field 'mass' has changed");
39818#ifdef FREECIV_JSON_CONNECTION
39819 field_addr.name = "mass";
39820#endif /* FREECIV_JSON_CONNECTION */
39821 e = 0;
39822 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->mass);
39823 if (e) {
39824 log_packet_detailed("'mass' field error detected");
39825 }
39826 }
39827 if (BV_ISSET(fields, 12)) {
39828 log_packet_detailed(" field 'structure' has changed");
39829#ifdef FREECIV_JSON_CONNECTION
39830 field_addr.name = "structure";
39831#endif /* FREECIV_JSON_CONNECTION */
39832 e = 0;
39833 e |= DIO_BV_PUT(&dout, &field_addr, packet->structure);
39834 if (e) {
39835 log_packet_detailed("'structure' field error detected");
39836 }
39837 }
39838 if (BV_ISSET(fields, 13)) {
39839 log_packet_detailed(" field 'support_rate' has changed");
39840#ifdef FREECIV_JSON_CONNECTION
39841 field_addr.name = "support_rate";
39842#endif /* FREECIV_JSON_CONNECTION */
39843 e = 0;
39844 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->support_rate, 10000);
39845 if (e) {
39846 log_packet_detailed("'support_rate' field error detected");
39847 }
39848 }
39849 if (BV_ISSET(fields, 14)) {
39850 log_packet_detailed(" field 'energy_rate' has changed");
39851#ifdef FREECIV_JSON_CONNECTION
39852 field_addr.name = "energy_rate";
39853#endif /* FREECIV_JSON_CONNECTION */
39854 e = 0;
39855 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->energy_rate, 10000);
39856 if (e) {
39857 log_packet_detailed("'energy_rate' field error detected");
39858 }
39859 }
39860 if (BV_ISSET(fields, 15)) {
39861 log_packet_detailed(" field 'success_rate' has changed");
39862#ifdef FREECIV_JSON_CONNECTION
39863 field_addr.name = "success_rate";
39864#endif /* FREECIV_JSON_CONNECTION */
39865 e = 0;
39866 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->success_rate, 10000);
39867 if (e) {
39868 log_packet_detailed("'success_rate' field error detected");
39869 }
39870 }
39871 if (BV_ISSET(fields, 16)) {
39872 log_packet_detailed(" field 'travel_time' has changed");
39873#ifdef FREECIV_JSON_CONNECTION
39874 field_addr.name = "travel_time";
39875#endif /* FREECIV_JSON_CONNECTION */
39876 e = 0;
39877 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->travel_time, 10000);
39878 if (e) {
39879 log_packet_detailed("'travel_time' field error detected");
39880 }
39881 }
39882
39883 *old = *real_packet;
39884#endif /* FREECIV_DELTA_PROTOCOL */
39885#ifndef FREECIV_DELTA_PROTOCOL
39886#ifdef FREECIV_JSON_CONNECTION
39887 field_addr.name = "player_num";
39888#endif /* FREECIV_JSON_CONNECTION */
39889 e = 0;
39890 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player_num);
39891 if (e) {
39892 log_packet_detailed("'player_num' field error detected");
39893 }
39894#ifdef FREECIV_JSON_CONNECTION
39895 field_addr.name = "sship_state";
39896#endif /* FREECIV_JSON_CONNECTION */
39897 e = 0;
39898 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sship_state);
39899 if (e) {
39900 log_packet_detailed("'sship_state' field error detected");
39901 }
39902#ifdef FREECIV_JSON_CONNECTION
39903 field_addr.name = "structurals";
39904#endif /* FREECIV_JSON_CONNECTION */
39905 e = 0;
39906 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->structurals);
39907 if (e) {
39908 log_packet_detailed("'structurals' field error detected");
39909 }
39910#ifdef FREECIV_JSON_CONNECTION
39911 field_addr.name = "components";
39912#endif /* FREECIV_JSON_CONNECTION */
39913 e = 0;
39914 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->components);
39915 if (e) {
39916 log_packet_detailed("'components' field error detected");
39917 }
39918#ifdef FREECIV_JSON_CONNECTION
39919 field_addr.name = "modules";
39920#endif /* FREECIV_JSON_CONNECTION */
39921 e = 0;
39922 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->modules);
39923 if (e) {
39924 log_packet_detailed("'modules' field error detected");
39925 }
39926#ifdef FREECIV_JSON_CONNECTION
39927 field_addr.name = "fuel";
39928#endif /* FREECIV_JSON_CONNECTION */
39929 e = 0;
39930 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
39931 if (e) {
39932 log_packet_detailed("'fuel' field error detected");
39933 }
39934#ifdef FREECIV_JSON_CONNECTION
39935 field_addr.name = "propulsion";
39936#endif /* FREECIV_JSON_CONNECTION */
39937 e = 0;
39938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->propulsion);
39939 if (e) {
39940 log_packet_detailed("'propulsion' field error detected");
39941 }
39942#ifdef FREECIV_JSON_CONNECTION
39943 field_addr.name = "habitation";
39944#endif /* FREECIV_JSON_CONNECTION */
39945 e = 0;
39946 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->habitation);
39947 if (e) {
39948 log_packet_detailed("'habitation' field error detected");
39949 }
39950#ifdef FREECIV_JSON_CONNECTION
39951 field_addr.name = "life_support";
39952#endif /* FREECIV_JSON_CONNECTION */
39953 e = 0;
39954 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->life_support);
39955 if (e) {
39956 log_packet_detailed("'life_support' field error detected");
39957 }
39958#ifdef FREECIV_JSON_CONNECTION
39959 field_addr.name = "solar_panels";
39960#endif /* FREECIV_JSON_CONNECTION */
39961 e = 0;
39962 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->solar_panels);
39963 if (e) {
39964 log_packet_detailed("'solar_panels' field error detected");
39965 }
39966#ifdef FREECIV_JSON_CONNECTION
39967 field_addr.name = "launch_year";
39968#endif /* FREECIV_JSON_CONNECTION */
39969 e = 0;
39970 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->launch_year);
39971 if (e) {
39972 log_packet_detailed("'launch_year' field error detected");
39973 }
39974#ifdef FREECIV_JSON_CONNECTION
39975 field_addr.name = "population";
39976#endif /* FREECIV_JSON_CONNECTION */
39977 e = 0;
39978 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->population);
39979 if (e) {
39980 log_packet_detailed("'population' field error detected");
39981 }
39982#ifdef FREECIV_JSON_CONNECTION
39983 field_addr.name = "mass";
39984#endif /* FREECIV_JSON_CONNECTION */
39985 e = 0;
39986 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->mass);
39987 if (e) {
39988 log_packet_detailed("'mass' field error detected");
39989 }
39990#ifdef FREECIV_JSON_CONNECTION
39991 field_addr.name = "structure";
39992#endif /* FREECIV_JSON_CONNECTION */
39993 e = 0;
39994 e |= DIO_BV_PUT(&dout, &field_addr, packet->structure);
39995 if (e) {
39996 log_packet_detailed("'structure' field error detected");
39997 }
39998#ifdef FREECIV_JSON_CONNECTION
39999 field_addr.name = "support_rate";
40000#endif /* FREECIV_JSON_CONNECTION */
40001 e = 0;
40002 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->support_rate, 10000);
40003 if (e) {
40004 log_packet_detailed("'support_rate' field error detected");
40005 }
40006#ifdef FREECIV_JSON_CONNECTION
40007 field_addr.name = "energy_rate";
40008#endif /* FREECIV_JSON_CONNECTION */
40009 e = 0;
40010 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->energy_rate, 10000);
40011 if (e) {
40012 log_packet_detailed("'energy_rate' field error detected");
40013 }
40014#ifdef FREECIV_JSON_CONNECTION
40015 field_addr.name = "success_rate";
40016#endif /* FREECIV_JSON_CONNECTION */
40017 e = 0;
40018 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->success_rate, 10000);
40019 if (e) {
40020 log_packet_detailed("'success_rate' field error detected");
40021 }
40022#ifdef FREECIV_JSON_CONNECTION
40023 field_addr.name = "travel_time";
40024#endif /* FREECIV_JSON_CONNECTION */
40025 e = 0;
40026 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->travel_time, 10000);
40027 if (e) {
40028 log_packet_detailed("'travel_time' field error detected");
40029 }
40030
40031#endif
40032 SEND_PACKET_END(PACKET_SPACESHIP_INFO);
40033}
40034
40035 int send_packet_spaceship_info(struct connection *pc, const struct packet_spaceship_info *packet)
40036{
40037 if (!pc->used) {
40038 log_error("WARNING: trying to send data to the closed connection %s",
40039 conn_description(pc));
40040 return -1;
40041 }
40042 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SPACESHIP_INFO].packet != NULL, -1,
40043 "Handler for PACKET_SPACESHIP_INFO not installed");
40044 return pc->phs.handlers->send[PACKET_SPACESHIP_INFO].packet(pc, packet);
40045}
40046
40047 void lsend_packet_spaceship_info(struct conn_list *dest, const struct packet_spaceship_info *packet)
40048{
40049 conn_list_iterate(dest, pconn) {
40050 send_packet_spaceship_info(pconn, packet);
40051 } conn_list_iterate_end;
40052}
40053
40054#ifdef FREECIV_DELTA_PROTOCOL
40055#define hash_packet_ruleset_unit_100 hash_const
40056
40057#define cmp_packet_ruleset_unit_100 cmp_const
40058
40059 BV_DEFINE(packet_ruleset_unit_100_fields, 48);
40060#endif /* FREECIV_DELTA_PROTOCOL */
40061
40062 static struct packet_ruleset_unit *receive_packet_ruleset_unit_100(struct connection *pc)
40063{
40064#ifdef FREECIV_DELTA_PROTOCOL
40065 packet_ruleset_unit_100_fields fields;
40066 struct packet_ruleset_unit *old;
40067 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT;
40068#endif /* FREECIV_DELTA_PROTOCOL */
40069 RECEIVE_PACKET_START(packet_ruleset_unit, real_packet);
40070#ifdef FREECIV_JSON_CONNECTION
40071 struct plocation field_addr;
40072 {
40073 struct plocation *field_addr_tmp = plocation_field_new(NULL);
40074 field_addr = *field_addr_tmp;
40075 FC_FREE(field_addr_tmp);
40076 }
40077#endif /* FREECIV_JSON_CONNECTION */
40078
40079#ifdef FREECIV_DELTA_PROTOCOL
40080#ifdef FREECIV_JSON_CONNECTION
40081 field_addr.name = "fields";
40082#endif /* FREECIV_JSON_CONNECTION */
40083 DIO_BV_GET(&din, &field_addr, fields);
40084
40085#else /* FREECIV_DELTA_PROTOCOL */
40086#ifdef FREECIV_JSON_CONNECTION
40087 field_addr.name = "id";
40088#endif /* FREECIV_JSON_CONNECTION */
40089 {
40090 int readin;
40091
40092 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40093 RECEIVE_PACKET_FIELD_ERROR(id);
40094 }
40095 real_packet->id = readin;
40096 }
40097#ifdef FREECIV_JSON_CONNECTION
40098 field_addr.name = "name";
40099#endif /* FREECIV_JSON_CONNECTION */
40100 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
40101 RECEIVE_PACKET_FIELD_ERROR(name);
40102 }
40103#ifdef FREECIV_JSON_CONNECTION
40104 field_addr.name = "rule_name";
40105#endif /* FREECIV_JSON_CONNECTION */
40106 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
40107 RECEIVE_PACKET_FIELD_ERROR(rule_name);
40108 }
40109#ifdef FREECIV_JSON_CONNECTION
40110 field_addr.name = "graphic_str";
40111#endif /* FREECIV_JSON_CONNECTION */
40112 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
40113 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
40114 }
40115#ifdef FREECIV_JSON_CONNECTION
40116 field_addr.name = "graphic_alt";
40117#endif /* FREECIV_JSON_CONNECTION */
40118 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
40119 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
40120 }
40121#ifdef FREECIV_JSON_CONNECTION
40122 field_addr.name = "graphic_alt2";
40123#endif /* FREECIV_JSON_CONNECTION */
40124 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
40125 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
40126 }
40127#ifdef FREECIV_JSON_CONNECTION
40128 field_addr.name = "sound_move";
40129#endif /* FREECIV_JSON_CONNECTION */
40130 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move, sizeof(real_packet->sound_move))) {
40131 RECEIVE_PACKET_FIELD_ERROR(sound_move);
40132 }
40133#ifdef FREECIV_JSON_CONNECTION
40134 field_addr.name = "sound_move_alt";
40135#endif /* FREECIV_JSON_CONNECTION */
40136 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move_alt, sizeof(real_packet->sound_move_alt))) {
40137 RECEIVE_PACKET_FIELD_ERROR(sound_move_alt);
40138 }
40139#ifdef FREECIV_JSON_CONNECTION
40140 field_addr.name = "sound_fight";
40141#endif /* FREECIV_JSON_CONNECTION */
40142 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight, sizeof(real_packet->sound_fight))) {
40143 RECEIVE_PACKET_FIELD_ERROR(sound_fight);
40144 }
40145#ifdef FREECIV_JSON_CONNECTION
40146 field_addr.name = "sound_fight_alt";
40147#endif /* FREECIV_JSON_CONNECTION */
40148 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight_alt, sizeof(real_packet->sound_fight_alt))) {
40149 RECEIVE_PACKET_FIELD_ERROR(sound_fight_alt);
40150 }
40151#ifdef FREECIV_JSON_CONNECTION
40152 field_addr.name = "unit_class_id";
40153#endif /* FREECIV_JSON_CONNECTION */
40154 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->unit_class_id)) {
40155 RECEIVE_PACKET_FIELD_ERROR(unit_class_id);
40156 }
40157#ifdef FREECIV_JSON_CONNECTION
40158 field_addr.name = "build_cost";
40159#endif /* FREECIV_JSON_CONNECTION */
40160 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
40161 RECEIVE_PACKET_FIELD_ERROR(build_cost);
40162 }
40163#ifdef FREECIV_JSON_CONNECTION
40164 field_addr.name = "pop_cost";
40165#endif /* FREECIV_JSON_CONNECTION */
40166 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_cost)) {
40167 RECEIVE_PACKET_FIELD_ERROR(pop_cost);
40168 }
40169#ifdef FREECIV_JSON_CONNECTION
40170 field_addr.name = "attack_strength";
40171#endif /* FREECIV_JSON_CONNECTION */
40172 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attack_strength)) {
40173 RECEIVE_PACKET_FIELD_ERROR(attack_strength);
40174 }
40175#ifdef FREECIV_JSON_CONNECTION
40176 field_addr.name = "defense_strength";
40177#endif /* FREECIV_JSON_CONNECTION */
40178 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_strength)) {
40179 RECEIVE_PACKET_FIELD_ERROR(defense_strength);
40180 }
40181#ifdef FREECIV_JSON_CONNECTION
40182 field_addr.name = "move_rate";
40183#endif /* FREECIV_JSON_CONNECTION */
40184 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_rate)) {
40185 RECEIVE_PACKET_FIELD_ERROR(move_rate);
40186 }
40187#ifdef FREECIV_JSON_CONNECTION
40188 field_addr.name = "build_reqs_count";
40189#endif /* FREECIV_JSON_CONNECTION */
40190 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_reqs_count)) {
40191 RECEIVE_PACKET_FIELD_ERROR(build_reqs_count);
40192 }
40193#ifdef FREECIV_JSON_CONNECTION
40194 field_addr.name = "build_reqs";
40195#endif /* FREECIV_JSON_CONNECTION */
40196 {
40197 int i;
40198
40199#ifdef FREECIV_JSON_CONNECTION
40200 /* Enter array. */
40201 field_addr.sub_location = plocation_elem_new(0);
40202#endif /* FREECIV_JSON_CONNECTION */
40203
40204 if (real_packet->build_reqs_count > MAX_NUM_REQS) {
40205 RECEIVE_PACKET_FIELD_ERROR(build_reqs, ": truncation array");
40206 }
40207 for (i = 0; i < real_packet->build_reqs_count; i++) {
40208#ifdef FREECIV_JSON_CONNECTION
40209 field_addr.sub_location->number = i;
40210#endif /* FREECIV_JSON_CONNECTION */
40211 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->build_reqs[i])) {
40212 RECEIVE_PACKET_FIELD_ERROR(build_reqs);
40213 }
40214 }
40215
40216#ifdef FREECIV_JSON_CONNECTION
40217 /* Exit array. */
40218 FC_FREE(field_addr.sub_location);
40219#endif /* FREECIV_JSON_CONNECTION */
40220 }
40221#ifdef FREECIV_JSON_CONNECTION
40222 field_addr.name = "vision_radius_sq";
40223#endif /* FREECIV_JSON_CONNECTION */
40224 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->vision_radius_sq)) {
40225 RECEIVE_PACKET_FIELD_ERROR(vision_radius_sq);
40226 }
40227#ifdef FREECIV_JSON_CONNECTION
40228 field_addr.name = "transport_capacity";
40229#endif /* FREECIV_JSON_CONNECTION */
40230 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transport_capacity)) {
40231 RECEIVE_PACKET_FIELD_ERROR(transport_capacity);
40232 }
40233#ifdef FREECIV_JSON_CONNECTION
40234 field_addr.name = "hp";
40235#endif /* FREECIV_JSON_CONNECTION */
40236 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
40237 RECEIVE_PACKET_FIELD_ERROR(hp);
40238 }
40239#ifdef FREECIV_JSON_CONNECTION
40240 field_addr.name = "firepower";
40241#endif /* FREECIV_JSON_CONNECTION */
40242 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->firepower)) {
40243 RECEIVE_PACKET_FIELD_ERROR(firepower);
40244 }
40245#ifdef FREECIV_JSON_CONNECTION
40246 field_addr.name = "obsoleted_by";
40247#endif /* FREECIV_JSON_CONNECTION */
40248 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obsoleted_by)) {
40249 RECEIVE_PACKET_FIELD_ERROR(obsoleted_by);
40250 }
40251#ifdef FREECIV_JSON_CONNECTION
40252 field_addr.name = "converted_to";
40253#endif /* FREECIV_JSON_CONNECTION */
40254 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->converted_to)) {
40255 RECEIVE_PACKET_FIELD_ERROR(converted_to);
40256 }
40257#ifdef FREECIV_JSON_CONNECTION
40258 field_addr.name = "convert_time";
40259#endif /* FREECIV_JSON_CONNECTION */
40260 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->convert_time)) {
40261 RECEIVE_PACKET_FIELD_ERROR(convert_time);
40262 }
40263#ifdef FREECIV_JSON_CONNECTION
40264 field_addr.name = "fuel";
40265#endif /* FREECIV_JSON_CONNECTION */
40266 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
40267 RECEIVE_PACKET_FIELD_ERROR(fuel);
40268 }
40269#ifdef FREECIV_JSON_CONNECTION
40270 field_addr.name = "happy_cost";
40271#endif /* FREECIV_JSON_CONNECTION */
40272 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->happy_cost)) {
40273 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
40274 }
40275#ifdef FREECIV_JSON_CONNECTION
40276 field_addr.name = "upkeep";
40277#endif /* FREECIV_JSON_CONNECTION */
40278 {
40279 int i;
40280
40281#ifdef FREECIV_JSON_CONNECTION
40282 /* Enter array. */
40283 field_addr.sub_location = plocation_elem_new(0);
40284#endif /* FREECIV_JSON_CONNECTION */
40285
40286 for (i = 0; i < O_LAST; i++) {
40287#ifdef FREECIV_JSON_CONNECTION
40288 field_addr.sub_location->number = i;
40289#endif /* FREECIV_JSON_CONNECTION */
40290 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
40291 RECEIVE_PACKET_FIELD_ERROR(upkeep);
40292 }
40293 }
40294
40295#ifdef FREECIV_JSON_CONNECTION
40296 /* Exit array. */
40297 FC_FREE(field_addr.sub_location);
40298#endif /* FREECIV_JSON_CONNECTION */
40299 }
40300#ifdef FREECIV_JSON_CONNECTION
40301 field_addr.name = "paratroopers_range";
40302#endif /* FREECIV_JSON_CONNECTION */
40303 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->paratroopers_range)) {
40304 RECEIVE_PACKET_FIELD_ERROR(paratroopers_range);
40305 }
40306#ifdef FREECIV_JSON_CONNECTION
40307 field_addr.name = "veteran_levels";
40308#endif /* FREECIV_JSON_CONNECTION */
40309 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
40310 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
40311 }
40312#ifdef FREECIV_JSON_CONNECTION
40313 field_addr.name = "veteran_name";
40314#endif /* FREECIV_JSON_CONNECTION */
40315 {
40316 int i;
40317
40318#ifdef FREECIV_JSON_CONNECTION
40319 /* Enter array. */
40320 field_addr.sub_location = plocation_elem_new(0);
40321#endif /* FREECIV_JSON_CONNECTION */
40322
40323 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40324 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
40325 }
40326 for (i = 0; i < real_packet->veteran_levels; i++) {
40327#ifdef FREECIV_JSON_CONNECTION
40328 field_addr.sub_location->number = i;
40329#endif /* FREECIV_JSON_CONNECTION */
40330 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
40331 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
40332 }
40333 }
40334
40335#ifdef FREECIV_JSON_CONNECTION
40336 /* Exit array. */
40337 FC_FREE(field_addr.sub_location);
40338#endif /* FREECIV_JSON_CONNECTION */
40339 }
40340#ifdef FREECIV_JSON_CONNECTION
40341 field_addr.name = "power_fact";
40342#endif /* FREECIV_JSON_CONNECTION */
40343 {
40344 int i;
40345
40346#ifdef FREECIV_JSON_CONNECTION
40347 /* Enter array. */
40348 field_addr.sub_location = plocation_elem_new(0);
40349#endif /* FREECIV_JSON_CONNECTION */
40350
40351 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40352 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
40353 }
40354 for (i = 0; i < real_packet->veteran_levels; i++) {
40355#ifdef FREECIV_JSON_CONNECTION
40356 field_addr.sub_location->number = i;
40357#endif /* FREECIV_JSON_CONNECTION */
40358 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
40359 RECEIVE_PACKET_FIELD_ERROR(power_fact);
40360 }
40361 }
40362
40363#ifdef FREECIV_JSON_CONNECTION
40364 /* Exit array. */
40365 FC_FREE(field_addr.sub_location);
40366#endif /* FREECIV_JSON_CONNECTION */
40367 }
40368#ifdef FREECIV_JSON_CONNECTION
40369 field_addr.name = "move_bonus";
40370#endif /* FREECIV_JSON_CONNECTION */
40371 {
40372 int i;
40373
40374#ifdef FREECIV_JSON_CONNECTION
40375 /* Enter array. */
40376 field_addr.sub_location = plocation_elem_new(0);
40377#endif /* FREECIV_JSON_CONNECTION */
40378
40379 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40380 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
40381 }
40382 for (i = 0; i < real_packet->veteran_levels; i++) {
40383#ifdef FREECIV_JSON_CONNECTION
40384 field_addr.sub_location->number = i;
40385#endif /* FREECIV_JSON_CONNECTION */
40386 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
40387 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
40388 }
40389 }
40390
40391#ifdef FREECIV_JSON_CONNECTION
40392 /* Exit array. */
40393 FC_FREE(field_addr.sub_location);
40394#endif /* FREECIV_JSON_CONNECTION */
40395 }
40396#ifdef FREECIV_JSON_CONNECTION
40397 field_addr.name = "base_raise_chance";
40398#endif /* FREECIV_JSON_CONNECTION */
40399 {
40400 int i;
40401
40402#ifdef FREECIV_JSON_CONNECTION
40403 /* Enter array. */
40404 field_addr.sub_location = plocation_elem_new(0);
40405#endif /* FREECIV_JSON_CONNECTION */
40406
40407 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40408 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
40409 }
40410 for (i = 0; i < real_packet->veteran_levels; i++) {
40411#ifdef FREECIV_JSON_CONNECTION
40412 field_addr.sub_location->number = i;
40413#endif /* FREECIV_JSON_CONNECTION */
40414 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
40415 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
40416 }
40417 }
40418
40419#ifdef FREECIV_JSON_CONNECTION
40420 /* Exit array. */
40421 FC_FREE(field_addr.sub_location);
40422#endif /* FREECIV_JSON_CONNECTION */
40423 }
40424#ifdef FREECIV_JSON_CONNECTION
40425 field_addr.name = "work_raise_chance";
40426#endif /* FREECIV_JSON_CONNECTION */
40427 {
40428 int i;
40429
40430#ifdef FREECIV_JSON_CONNECTION
40431 /* Enter array. */
40432 field_addr.sub_location = plocation_elem_new(0);
40433#endif /* FREECIV_JSON_CONNECTION */
40434
40435 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40436 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
40437 }
40438 for (i = 0; i < real_packet->veteran_levels; i++) {
40439#ifdef FREECIV_JSON_CONNECTION
40440 field_addr.sub_location->number = i;
40441#endif /* FREECIV_JSON_CONNECTION */
40442 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
40443 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
40444 }
40445 }
40446
40447#ifdef FREECIV_JSON_CONNECTION
40448 /* Exit array. */
40449 FC_FREE(field_addr.sub_location);
40450#endif /* FREECIV_JSON_CONNECTION */
40451 }
40452#ifdef FREECIV_JSON_CONNECTION
40453 field_addr.name = "bombard_rate";
40454#endif /* FREECIV_JSON_CONNECTION */
40455 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bombard_rate)) {
40456 RECEIVE_PACKET_FIELD_ERROR(bombard_rate);
40457 }
40458#ifdef FREECIV_JSON_CONNECTION
40459 field_addr.name = "city_size";
40460#endif /* FREECIV_JSON_CONNECTION */
40461 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_size)) {
40462 RECEIVE_PACKET_FIELD_ERROR(city_size);
40463 }
40464#ifdef FREECIV_JSON_CONNECTION
40465 field_addr.name = "city_slots";
40466#endif /* FREECIV_JSON_CONNECTION */
40467 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_slots)) {
40468 RECEIVE_PACKET_FIELD_ERROR(city_slots);
40469 }
40470#ifdef FREECIV_JSON_CONNECTION
40471 field_addr.name = "tp_defense";
40472#endif /* FREECIV_JSON_CONNECTION */
40473 {
40474 int readin;
40475
40476 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40477 RECEIVE_PACKET_FIELD_ERROR(tp_defense);
40478 }
40479 real_packet->tp_defense = readin;
40480 }
40481#ifdef FREECIV_JSON_CONNECTION
40482 field_addr.name = "cargo";
40483#endif /* FREECIV_JSON_CONNECTION */
40484 if (!DIO_BV_GET(&din, &field_addr, real_packet->cargo)) {
40485 RECEIVE_PACKET_FIELD_ERROR(cargo);
40486 }
40487#ifdef FREECIV_JSON_CONNECTION
40488 field_addr.name = "targets";
40489#endif /* FREECIV_JSON_CONNECTION */
40490 if (!DIO_BV_GET(&din, &field_addr, real_packet->targets)) {
40491 RECEIVE_PACKET_FIELD_ERROR(targets);
40492 }
40493#ifdef FREECIV_JSON_CONNECTION
40494 field_addr.name = "embarks";
40495#endif /* FREECIV_JSON_CONNECTION */
40496 if (!DIO_BV_GET(&din, &field_addr, real_packet->embarks)) {
40497 RECEIVE_PACKET_FIELD_ERROR(embarks);
40498 }
40499#ifdef FREECIV_JSON_CONNECTION
40500 field_addr.name = "disembarks";
40501#endif /* FREECIV_JSON_CONNECTION */
40502 if (!DIO_BV_GET(&din, &field_addr, real_packet->disembarks)) {
40503 RECEIVE_PACKET_FIELD_ERROR(disembarks);
40504 }
40505#ifdef FREECIV_JSON_CONNECTION
40506 field_addr.name = "vlayer";
40507#endif /* FREECIV_JSON_CONNECTION */
40508 {
40509 int readin;
40510
40511 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40512 RECEIVE_PACKET_FIELD_ERROR(vlayer);
40513 }
40514 real_packet->vlayer = readin;
40515 }
40516#ifdef FREECIV_JSON_CONNECTION
40517 field_addr.name = "helptext";
40518#endif /* FREECIV_JSON_CONNECTION */
40519 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
40520 RECEIVE_PACKET_FIELD_ERROR(helptext);
40521 }
40522#ifdef FREECIV_JSON_CONNECTION
40523 field_addr.name = "flags";
40524#endif /* FREECIV_JSON_CONNECTION */
40525 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
40526 RECEIVE_PACKET_FIELD_ERROR(flags);
40527 }
40528#ifdef FREECIV_JSON_CONNECTION
40529 field_addr.name = "roles";
40530#endif /* FREECIV_JSON_CONNECTION */
40531 if (!DIO_BV_GET(&din, &field_addr, real_packet->roles)) {
40532 RECEIVE_PACKET_FIELD_ERROR(roles);
40533 }
40534#ifdef FREECIV_JSON_CONNECTION
40535 field_addr.name = "worker";
40536#endif /* FREECIV_JSON_CONNECTION */
40537 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->worker)) {
40538 RECEIVE_PACKET_FIELD_ERROR(worker);
40539 }
40540#endif
40541 log_packet_detailed("packet_ruleset_unit_100: got info about ()");
40542
40543#ifdef FREECIV_DELTA_PROTOCOL
40544 if (NULL == *hash) {
40545 *hash = genhash_new_full(hash_packet_ruleset_unit_100, cmp_packet_ruleset_unit_100,
40546 NULL, NULL, NULL, free);
40547 }
40548
40549 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
40550 *real_packet = *old;
40551 } else {
40552 log_packet_detailed(" no old info");
40553 memset(real_packet, 0, sizeof(*real_packet));
40554 }
40555
40556 if (BV_ISSET(fields, 0)) {
40557 log_packet_detailed(" got field 'id'");
40558#ifdef FREECIV_JSON_CONNECTION
40559 field_addr.name = "id";
40560#endif /* FREECIV_JSON_CONNECTION */
40561 {
40562 int readin;
40563
40564 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
40565 RECEIVE_PACKET_FIELD_ERROR(id);
40566 }
40567 real_packet->id = readin;
40568 }
40569 }
40570 if (BV_ISSET(fields, 1)) {
40571 log_packet_detailed(" got field 'name'");
40572#ifdef FREECIV_JSON_CONNECTION
40573 field_addr.name = "name";
40574#endif /* FREECIV_JSON_CONNECTION */
40575 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
40576 RECEIVE_PACKET_FIELD_ERROR(name);
40577 }
40578 }
40579 if (BV_ISSET(fields, 2)) {
40580 log_packet_detailed(" got field 'rule_name'");
40581#ifdef FREECIV_JSON_CONNECTION
40582 field_addr.name = "rule_name";
40583#endif /* FREECIV_JSON_CONNECTION */
40584 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
40585 RECEIVE_PACKET_FIELD_ERROR(rule_name);
40586 }
40587 }
40588 if (BV_ISSET(fields, 3)) {
40589 log_packet_detailed(" got field 'graphic_str'");
40590#ifdef FREECIV_JSON_CONNECTION
40591 field_addr.name = "graphic_str";
40592#endif /* FREECIV_JSON_CONNECTION */
40593 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
40594 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
40595 }
40596 }
40597 if (BV_ISSET(fields, 4)) {
40598 log_packet_detailed(" got field 'graphic_alt'");
40599#ifdef FREECIV_JSON_CONNECTION
40600 field_addr.name = "graphic_alt";
40601#endif /* FREECIV_JSON_CONNECTION */
40602 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
40603 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
40604 }
40605 }
40606 if (BV_ISSET(fields, 5)) {
40607 log_packet_detailed(" got field 'graphic_alt2'");
40608#ifdef FREECIV_JSON_CONNECTION
40609 field_addr.name = "graphic_alt2";
40610#endif /* FREECIV_JSON_CONNECTION */
40611 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
40612 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
40613 }
40614 }
40615 if (BV_ISSET(fields, 6)) {
40616 log_packet_detailed(" got field 'sound_move'");
40617#ifdef FREECIV_JSON_CONNECTION
40618 field_addr.name = "sound_move";
40619#endif /* FREECIV_JSON_CONNECTION */
40620 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move, sizeof(real_packet->sound_move))) {
40621 RECEIVE_PACKET_FIELD_ERROR(sound_move);
40622 }
40623 }
40624 if (BV_ISSET(fields, 7)) {
40625 log_packet_detailed(" got field 'sound_move_alt'");
40626#ifdef FREECIV_JSON_CONNECTION
40627 field_addr.name = "sound_move_alt";
40628#endif /* FREECIV_JSON_CONNECTION */
40629 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_move_alt, sizeof(real_packet->sound_move_alt))) {
40630 RECEIVE_PACKET_FIELD_ERROR(sound_move_alt);
40631 }
40632 }
40633 if (BV_ISSET(fields, 8)) {
40634 log_packet_detailed(" got field 'sound_fight'");
40635#ifdef FREECIV_JSON_CONNECTION
40636 field_addr.name = "sound_fight";
40637#endif /* FREECIV_JSON_CONNECTION */
40638 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight, sizeof(real_packet->sound_fight))) {
40639 RECEIVE_PACKET_FIELD_ERROR(sound_fight);
40640 }
40641 }
40642 if (BV_ISSET(fields, 9)) {
40643 log_packet_detailed(" got field 'sound_fight_alt'");
40644#ifdef FREECIV_JSON_CONNECTION
40645 field_addr.name = "sound_fight_alt";
40646#endif /* FREECIV_JSON_CONNECTION */
40647 if (!DIO_GET(string, &din, &field_addr, real_packet->sound_fight_alt, sizeof(real_packet->sound_fight_alt))) {
40648 RECEIVE_PACKET_FIELD_ERROR(sound_fight_alt);
40649 }
40650 }
40651 if (BV_ISSET(fields, 10)) {
40652 log_packet_detailed(" got field 'unit_class_id'");
40653#ifdef FREECIV_JSON_CONNECTION
40654 field_addr.name = "unit_class_id";
40655#endif /* FREECIV_JSON_CONNECTION */
40656 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->unit_class_id)) {
40657 RECEIVE_PACKET_FIELD_ERROR(unit_class_id);
40658 }
40659 }
40660 if (BV_ISSET(fields, 11)) {
40661 log_packet_detailed(" got field 'build_cost'");
40662#ifdef FREECIV_JSON_CONNECTION
40663 field_addr.name = "build_cost";
40664#endif /* FREECIV_JSON_CONNECTION */
40665 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
40666 RECEIVE_PACKET_FIELD_ERROR(build_cost);
40667 }
40668 }
40669 if (BV_ISSET(fields, 12)) {
40670 log_packet_detailed(" got field 'pop_cost'");
40671#ifdef FREECIV_JSON_CONNECTION
40672 field_addr.name = "pop_cost";
40673#endif /* FREECIV_JSON_CONNECTION */
40674 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pop_cost)) {
40675 RECEIVE_PACKET_FIELD_ERROR(pop_cost);
40676 }
40677 }
40678 if (BV_ISSET(fields, 13)) {
40679 log_packet_detailed(" got field 'attack_strength'");
40680#ifdef FREECIV_JSON_CONNECTION
40681 field_addr.name = "attack_strength";
40682#endif /* FREECIV_JSON_CONNECTION */
40683 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->attack_strength)) {
40684 RECEIVE_PACKET_FIELD_ERROR(attack_strength);
40685 }
40686 }
40687 if (BV_ISSET(fields, 14)) {
40688 log_packet_detailed(" got field 'defense_strength'");
40689#ifdef FREECIV_JSON_CONNECTION
40690 field_addr.name = "defense_strength";
40691#endif /* FREECIV_JSON_CONNECTION */
40692 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_strength)) {
40693 RECEIVE_PACKET_FIELD_ERROR(defense_strength);
40694 }
40695 }
40696 if (BV_ISSET(fields, 15)) {
40697 log_packet_detailed(" got field 'move_rate'");
40698#ifdef FREECIV_JSON_CONNECTION
40699 field_addr.name = "move_rate";
40700#endif /* FREECIV_JSON_CONNECTION */
40701 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_rate)) {
40702 RECEIVE_PACKET_FIELD_ERROR(move_rate);
40703 }
40704 }
40705 if (BV_ISSET(fields, 16)) {
40706 log_packet_detailed(" got field 'build_reqs_count'");
40707#ifdef FREECIV_JSON_CONNECTION
40708 field_addr.name = "build_reqs_count";
40709#endif /* FREECIV_JSON_CONNECTION */
40710 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_reqs_count)) {
40711 RECEIVE_PACKET_FIELD_ERROR(build_reqs_count);
40712 }
40713 }
40714 if (BV_ISSET(fields, 17)) {
40715 log_packet_detailed(" got field 'build_reqs'");
40716#ifdef FREECIV_JSON_CONNECTION
40717 field_addr.name = "build_reqs";
40718#endif /* FREECIV_JSON_CONNECTION */
40719 {
40720 int i;
40721
40722#ifdef FREECIV_JSON_CONNECTION
40723 /* Enter array. */
40724 field_addr.sub_location = plocation_elem_new(0);
40725#endif /* FREECIV_JSON_CONNECTION */
40726
40727 if (real_packet->build_reqs_count > MAX_NUM_REQS) {
40728 RECEIVE_PACKET_FIELD_ERROR(build_reqs, ": truncation array");
40729 }
40730 for (i = 0; i < real_packet->build_reqs_count; i++) {
40731#ifdef FREECIV_JSON_CONNECTION
40732 field_addr.sub_location->number = i;
40733#endif /* FREECIV_JSON_CONNECTION */
40734 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->build_reqs[i])) {
40735 RECEIVE_PACKET_FIELD_ERROR(build_reqs);
40736 }
40737 }
40738
40739#ifdef FREECIV_JSON_CONNECTION
40740 /* Exit array. */
40741 FC_FREE(field_addr.sub_location);
40742#endif /* FREECIV_JSON_CONNECTION */
40743 }
40744 }
40745 if (BV_ISSET(fields, 18)) {
40746 log_packet_detailed(" got field 'vision_radius_sq'");
40747#ifdef FREECIV_JSON_CONNECTION
40748 field_addr.name = "vision_radius_sq";
40749#endif /* FREECIV_JSON_CONNECTION */
40750 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->vision_radius_sq)) {
40751 RECEIVE_PACKET_FIELD_ERROR(vision_radius_sq);
40752 }
40753 }
40754 if (BV_ISSET(fields, 19)) {
40755 log_packet_detailed(" got field 'transport_capacity'");
40756#ifdef FREECIV_JSON_CONNECTION
40757 field_addr.name = "transport_capacity";
40758#endif /* FREECIV_JSON_CONNECTION */
40759 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transport_capacity)) {
40760 RECEIVE_PACKET_FIELD_ERROR(transport_capacity);
40761 }
40762 }
40763 if (BV_ISSET(fields, 20)) {
40764 log_packet_detailed(" got field 'hp'");
40765#ifdef FREECIV_JSON_CONNECTION
40766 field_addr.name = "hp";
40767#endif /* FREECIV_JSON_CONNECTION */
40768 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
40769 RECEIVE_PACKET_FIELD_ERROR(hp);
40770 }
40771 }
40772 if (BV_ISSET(fields, 21)) {
40773 log_packet_detailed(" got field 'firepower'");
40774#ifdef FREECIV_JSON_CONNECTION
40775 field_addr.name = "firepower";
40776#endif /* FREECIV_JSON_CONNECTION */
40777 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->firepower)) {
40778 RECEIVE_PACKET_FIELD_ERROR(firepower);
40779 }
40780 }
40781 if (BV_ISSET(fields, 22)) {
40782 log_packet_detailed(" got field 'obsoleted_by'");
40783#ifdef FREECIV_JSON_CONNECTION
40784 field_addr.name = "obsoleted_by";
40785#endif /* FREECIV_JSON_CONNECTION */
40786 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obsoleted_by)) {
40787 RECEIVE_PACKET_FIELD_ERROR(obsoleted_by);
40788 }
40789 }
40790 if (BV_ISSET(fields, 23)) {
40791 log_packet_detailed(" got field 'converted_to'");
40792#ifdef FREECIV_JSON_CONNECTION
40793 field_addr.name = "converted_to";
40794#endif /* FREECIV_JSON_CONNECTION */
40795 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->converted_to)) {
40796 RECEIVE_PACKET_FIELD_ERROR(converted_to);
40797 }
40798 }
40799 if (BV_ISSET(fields, 24)) {
40800 log_packet_detailed(" got field 'convert_time'");
40801#ifdef FREECIV_JSON_CONNECTION
40802 field_addr.name = "convert_time";
40803#endif /* FREECIV_JSON_CONNECTION */
40804 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->convert_time)) {
40805 RECEIVE_PACKET_FIELD_ERROR(convert_time);
40806 }
40807 }
40808 if (BV_ISSET(fields, 25)) {
40809 log_packet_detailed(" got field 'fuel'");
40810#ifdef FREECIV_JSON_CONNECTION
40811 field_addr.name = "fuel";
40812#endif /* FREECIV_JSON_CONNECTION */
40813 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
40814 RECEIVE_PACKET_FIELD_ERROR(fuel);
40815 }
40816 }
40817 if (BV_ISSET(fields, 26)) {
40818 log_packet_detailed(" got field 'happy_cost'");
40819#ifdef FREECIV_JSON_CONNECTION
40820 field_addr.name = "happy_cost";
40821#endif /* FREECIV_JSON_CONNECTION */
40822 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->happy_cost)) {
40823 RECEIVE_PACKET_FIELD_ERROR(happy_cost);
40824 }
40825 }
40826 if (BV_ISSET(fields, 27)) {
40827 log_packet_detailed(" got field 'upkeep'");
40828#ifdef FREECIV_JSON_CONNECTION
40829 field_addr.name = "upkeep";
40830#endif /* FREECIV_JSON_CONNECTION */
40831 {
40832 int i;
40833
40834#ifdef FREECIV_JSON_CONNECTION
40835 /* Enter array. */
40836 field_addr.sub_location = plocation_elem_new(0);
40837#endif /* FREECIV_JSON_CONNECTION */
40838
40839 for (i = 0; i < O_LAST; i++) {
40840#ifdef FREECIV_JSON_CONNECTION
40841 field_addr.sub_location->number = i;
40842#endif /* FREECIV_JSON_CONNECTION */
40843 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep[i])) {
40844 RECEIVE_PACKET_FIELD_ERROR(upkeep);
40845 }
40846 }
40847
40848#ifdef FREECIV_JSON_CONNECTION
40849 /* Exit array. */
40850 FC_FREE(field_addr.sub_location);
40851#endif /* FREECIV_JSON_CONNECTION */
40852 }
40853 }
40854 if (BV_ISSET(fields, 28)) {
40855 log_packet_detailed(" got field 'paratroopers_range'");
40856#ifdef FREECIV_JSON_CONNECTION
40857 field_addr.name = "paratroopers_range";
40858#endif /* FREECIV_JSON_CONNECTION */
40859 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->paratroopers_range)) {
40860 RECEIVE_PACKET_FIELD_ERROR(paratroopers_range);
40861 }
40862 }
40863 if (BV_ISSET(fields, 29)) {
40864 log_packet_detailed(" got field 'veteran_levels'");
40865#ifdef FREECIV_JSON_CONNECTION
40866 field_addr.name = "veteran_levels";
40867#endif /* FREECIV_JSON_CONNECTION */
40868 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
40869 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
40870 }
40871 }
40872 if (BV_ISSET(fields, 30)) {
40873 log_packet_detailed(" got field 'veteran_name'");
40874#ifdef FREECIV_JSON_CONNECTION
40875 field_addr.name = "veteran_name";
40876#endif /* FREECIV_JSON_CONNECTION */
40877 {
40878 int i;
40879
40880#ifdef FREECIV_JSON_CONNECTION
40881 /* Enter array. */
40882 field_addr.sub_location = plocation_elem_new(0);
40883#endif /* FREECIV_JSON_CONNECTION */
40884
40885 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40886 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
40887 }
40888 for (i = 0; i < real_packet->veteran_levels; i++) {
40889#ifdef FREECIV_JSON_CONNECTION
40890 field_addr.sub_location->number = i;
40891#endif /* FREECIV_JSON_CONNECTION */
40892 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
40893 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
40894 }
40895 }
40896
40897#ifdef FREECIV_JSON_CONNECTION
40898 /* Exit array. */
40899 FC_FREE(field_addr.sub_location);
40900#endif /* FREECIV_JSON_CONNECTION */
40901 }
40902 }
40903 if (BV_ISSET(fields, 31)) {
40904 log_packet_detailed(" got field 'power_fact'");
40905#ifdef FREECIV_JSON_CONNECTION
40906 field_addr.name = "power_fact";
40907#endif /* FREECIV_JSON_CONNECTION */
40908 {
40909 int i;
40910
40911#ifdef FREECIV_JSON_CONNECTION
40912 /* Enter array. */
40913 field_addr.sub_location = plocation_elem_new(0);
40914#endif /* FREECIV_JSON_CONNECTION */
40915
40916 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40917 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
40918 }
40919 for (i = 0; i < real_packet->veteran_levels; i++) {
40920#ifdef FREECIV_JSON_CONNECTION
40921 field_addr.sub_location->number = i;
40922#endif /* FREECIV_JSON_CONNECTION */
40923 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
40924 RECEIVE_PACKET_FIELD_ERROR(power_fact);
40925 }
40926 }
40927
40928#ifdef FREECIV_JSON_CONNECTION
40929 /* Exit array. */
40930 FC_FREE(field_addr.sub_location);
40931#endif /* FREECIV_JSON_CONNECTION */
40932 }
40933 }
40934 if (BV_ISSET(fields, 32)) {
40935 log_packet_detailed(" got field 'move_bonus'");
40936#ifdef FREECIV_JSON_CONNECTION
40937 field_addr.name = "move_bonus";
40938#endif /* FREECIV_JSON_CONNECTION */
40939 {
40940 int i;
40941
40942#ifdef FREECIV_JSON_CONNECTION
40943 /* Enter array. */
40944 field_addr.sub_location = plocation_elem_new(0);
40945#endif /* FREECIV_JSON_CONNECTION */
40946
40947 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40948 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
40949 }
40950 for (i = 0; i < real_packet->veteran_levels; i++) {
40951#ifdef FREECIV_JSON_CONNECTION
40952 field_addr.sub_location->number = i;
40953#endif /* FREECIV_JSON_CONNECTION */
40954 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
40955 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
40956 }
40957 }
40958
40959#ifdef FREECIV_JSON_CONNECTION
40960 /* Exit array. */
40961 FC_FREE(field_addr.sub_location);
40962#endif /* FREECIV_JSON_CONNECTION */
40963 }
40964 }
40965 if (BV_ISSET(fields, 33)) {
40966 log_packet_detailed(" got field 'base_raise_chance'");
40967#ifdef FREECIV_JSON_CONNECTION
40968 field_addr.name = "base_raise_chance";
40969#endif /* FREECIV_JSON_CONNECTION */
40970 {
40971 int i;
40972
40973#ifdef FREECIV_JSON_CONNECTION
40974 /* Enter array. */
40975 field_addr.sub_location = plocation_elem_new(0);
40976#endif /* FREECIV_JSON_CONNECTION */
40977
40978 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
40979 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
40980 }
40981 for (i = 0; i < real_packet->veteran_levels; i++) {
40982#ifdef FREECIV_JSON_CONNECTION
40983 field_addr.sub_location->number = i;
40984#endif /* FREECIV_JSON_CONNECTION */
40985 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
40986 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
40987 }
40988 }
40989
40990#ifdef FREECIV_JSON_CONNECTION
40991 /* Exit array. */
40992 FC_FREE(field_addr.sub_location);
40993#endif /* FREECIV_JSON_CONNECTION */
40994 }
40995 }
40996 if (BV_ISSET(fields, 34)) {
40997 log_packet_detailed(" got field 'work_raise_chance'");
40998#ifdef FREECIV_JSON_CONNECTION
40999 field_addr.name = "work_raise_chance";
41000#endif /* FREECIV_JSON_CONNECTION */
41001 {
41002 int i;
41003
41004#ifdef FREECIV_JSON_CONNECTION
41005 /* Enter array. */
41006 field_addr.sub_location = plocation_elem_new(0);
41007#endif /* FREECIV_JSON_CONNECTION */
41008
41009 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
41010 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
41011 }
41012 for (i = 0; i < real_packet->veteran_levels; i++) {
41013#ifdef FREECIV_JSON_CONNECTION
41014 field_addr.sub_location->number = i;
41015#endif /* FREECIV_JSON_CONNECTION */
41016 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
41017 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
41018 }
41019 }
41020
41021#ifdef FREECIV_JSON_CONNECTION
41022 /* Exit array. */
41023 FC_FREE(field_addr.sub_location);
41024#endif /* FREECIV_JSON_CONNECTION */
41025 }
41026 }
41027 if (BV_ISSET(fields, 35)) {
41028 log_packet_detailed(" got field 'bombard_rate'");
41029#ifdef FREECIV_JSON_CONNECTION
41030 field_addr.name = "bombard_rate";
41031#endif /* FREECIV_JSON_CONNECTION */
41032 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bombard_rate)) {
41033 RECEIVE_PACKET_FIELD_ERROR(bombard_rate);
41034 }
41035 }
41036 if (BV_ISSET(fields, 36)) {
41037 log_packet_detailed(" got field 'city_size'");
41038#ifdef FREECIV_JSON_CONNECTION
41039 field_addr.name = "city_size";
41040#endif /* FREECIV_JSON_CONNECTION */
41041 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_size)) {
41042 RECEIVE_PACKET_FIELD_ERROR(city_size);
41043 }
41044 }
41045 if (BV_ISSET(fields, 37)) {
41046 log_packet_detailed(" got field 'city_slots'");
41047#ifdef FREECIV_JSON_CONNECTION
41048 field_addr.name = "city_slots";
41049#endif /* FREECIV_JSON_CONNECTION */
41050 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->city_slots)) {
41051 RECEIVE_PACKET_FIELD_ERROR(city_slots);
41052 }
41053 }
41054 if (BV_ISSET(fields, 38)) {
41055 log_packet_detailed(" got field 'tp_defense'");
41056#ifdef FREECIV_JSON_CONNECTION
41057 field_addr.name = "tp_defense";
41058#endif /* FREECIV_JSON_CONNECTION */
41059 {
41060 int readin;
41061
41062 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41063 RECEIVE_PACKET_FIELD_ERROR(tp_defense);
41064 }
41065 real_packet->tp_defense = readin;
41066 }
41067 }
41068 if (BV_ISSET(fields, 39)) {
41069 log_packet_detailed(" got field 'cargo'");
41070#ifdef FREECIV_JSON_CONNECTION
41071 field_addr.name = "cargo";
41072#endif /* FREECIV_JSON_CONNECTION */
41073 if (!DIO_BV_GET(&din, &field_addr, real_packet->cargo)) {
41074 RECEIVE_PACKET_FIELD_ERROR(cargo);
41075 }
41076 }
41077 if (BV_ISSET(fields, 40)) {
41078 log_packet_detailed(" got field 'targets'");
41079#ifdef FREECIV_JSON_CONNECTION
41080 field_addr.name = "targets";
41081#endif /* FREECIV_JSON_CONNECTION */
41082 if (!DIO_BV_GET(&din, &field_addr, real_packet->targets)) {
41083 RECEIVE_PACKET_FIELD_ERROR(targets);
41084 }
41085 }
41086 if (BV_ISSET(fields, 41)) {
41087 log_packet_detailed(" got field 'embarks'");
41088#ifdef FREECIV_JSON_CONNECTION
41089 field_addr.name = "embarks";
41090#endif /* FREECIV_JSON_CONNECTION */
41091 if (!DIO_BV_GET(&din, &field_addr, real_packet->embarks)) {
41092 RECEIVE_PACKET_FIELD_ERROR(embarks);
41093 }
41094 }
41095 if (BV_ISSET(fields, 42)) {
41096 log_packet_detailed(" got field 'disembarks'");
41097#ifdef FREECIV_JSON_CONNECTION
41098 field_addr.name = "disembarks";
41099#endif /* FREECIV_JSON_CONNECTION */
41100 if (!DIO_BV_GET(&din, &field_addr, real_packet->disembarks)) {
41101 RECEIVE_PACKET_FIELD_ERROR(disembarks);
41102 }
41103 }
41104 if (BV_ISSET(fields, 43)) {
41105 log_packet_detailed(" got field 'vlayer'");
41106#ifdef FREECIV_JSON_CONNECTION
41107 field_addr.name = "vlayer";
41108#endif /* FREECIV_JSON_CONNECTION */
41109 {
41110 int readin;
41111
41112 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
41113 RECEIVE_PACKET_FIELD_ERROR(vlayer);
41114 }
41115 real_packet->vlayer = readin;
41116 }
41117 }
41118 if (BV_ISSET(fields, 44)) {
41119 log_packet_detailed(" got field 'helptext'");
41120#ifdef FREECIV_JSON_CONNECTION
41121 field_addr.name = "helptext";
41122#endif /* FREECIV_JSON_CONNECTION */
41123 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
41124 RECEIVE_PACKET_FIELD_ERROR(helptext);
41125 }
41126 }
41127 if (BV_ISSET(fields, 45)) {
41128 log_packet_detailed(" got field 'flags'");
41129#ifdef FREECIV_JSON_CONNECTION
41130 field_addr.name = "flags";
41131#endif /* FREECIV_JSON_CONNECTION */
41132 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
41133 RECEIVE_PACKET_FIELD_ERROR(flags);
41134 }
41135 }
41136 if (BV_ISSET(fields, 46)) {
41137 log_packet_detailed(" got field 'roles'");
41138#ifdef FREECIV_JSON_CONNECTION
41139 field_addr.name = "roles";
41140#endif /* FREECIV_JSON_CONNECTION */
41141 if (!DIO_BV_GET(&din, &field_addr, real_packet->roles)) {
41142 RECEIVE_PACKET_FIELD_ERROR(roles);
41143 }
41144 }
41145 real_packet->worker = BV_ISSET(fields, 47);
41146
41147 if (NULL == old) {
41148 old = fc_malloc(sizeof(*old));
41149 *old = *real_packet;
41150 genhash_insert(*hash, old, old);
41151 } else {
41152 *old = *real_packet;
41153 }
41154
41155#endif /* FREECIV_DELTA_PROTOCOL */
41156 RECEIVE_PACKET_END(real_packet);
41157}
41158
41159 static int send_packet_ruleset_unit_100(struct connection *pc, const struct packet_ruleset_unit *packet)
41160{
41161 const struct packet_ruleset_unit *real_packet = packet;
41162 int e;
41163#ifdef FREECIV_DELTA_PROTOCOL
41164 packet_ruleset_unit_100_fields fields;
41165 struct packet_ruleset_unit *old;
41166 bool differ;
41167 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT;
41168#endif /* FREECIV_DELTA_PROTOCOL */
41169 SEND_PACKET_START(PACKET_RULESET_UNIT);
41170#ifdef FREECIV_JSON_CONNECTION
41171 struct plocation field_addr;
41172 {
41173 struct plocation *field_addr_tmp = plocation_field_new(NULL);
41174 field_addr = *field_addr_tmp;
41175 FC_FREE(field_addr_tmp);
41176 }
41177#endif /* FREECIV_JSON_CONNECTION */
41178
41179 log_packet_detailed("packet_ruleset_unit_100: sending info about ()");
41180
41181#ifdef FREECIV_DELTA_PROTOCOL
41182 if (NULL == *hash) {
41183 *hash = genhash_new_full(hash_packet_ruleset_unit_100, cmp_packet_ruleset_unit_100,
41184 NULL, NULL, NULL, free);
41185 }
41186 BV_CLR_ALL(fields);
41187
41188 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
41189 old = fc_malloc(sizeof(*old));
41190 *old = *real_packet;
41191 genhash_insert(*hash, old, old);
41192 memset(old, 0, sizeof(*old));
41193 }
41194 differ = (old->id != real_packet->id);
41195 if (differ) {
41196 BV_SET(fields, 0);
41197 }
41198
41199 differ = (strcmp(old->name, real_packet->name) != 0);
41200 if (differ) {
41201 BV_SET(fields, 1);
41202 }
41203
41204 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
41205 if (differ) {
41206 BV_SET(fields, 2);
41207 }
41208
41209 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
41210 if (differ) {
41211 BV_SET(fields, 3);
41212 }
41213
41214 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
41215 if (differ) {
41216 BV_SET(fields, 4);
41217 }
41218
41219 differ = (strcmp(old->graphic_alt2, real_packet->graphic_alt2) != 0);
41220 if (differ) {
41221 BV_SET(fields, 5);
41222 }
41223
41224 differ = (strcmp(old->sound_move, real_packet->sound_move) != 0);
41225 if (differ) {
41226 BV_SET(fields, 6);
41227 }
41228
41229 differ = (strcmp(old->sound_move_alt, real_packet->sound_move_alt) != 0);
41230 if (differ) {
41231 BV_SET(fields, 7);
41232 }
41233
41234 differ = (strcmp(old->sound_fight, real_packet->sound_fight) != 0);
41235 if (differ) {
41236 BV_SET(fields, 8);
41237 }
41238
41239 differ = (strcmp(old->sound_fight_alt, real_packet->sound_fight_alt) != 0);
41240 if (differ) {
41241 BV_SET(fields, 9);
41242 }
41243
41244 differ = (old->unit_class_id != real_packet->unit_class_id);
41245 if (differ) {
41246 BV_SET(fields, 10);
41247 }
41248
41249 differ = (old->build_cost != real_packet->build_cost);
41250 if (differ) {
41251 BV_SET(fields, 11);
41252 }
41253
41254 differ = (old->pop_cost != real_packet->pop_cost);
41255 if (differ) {
41256 BV_SET(fields, 12);
41257 }
41258
41259 differ = (old->attack_strength != real_packet->attack_strength);
41260 if (differ) {
41261 BV_SET(fields, 13);
41262 }
41263
41264 differ = (old->defense_strength != real_packet->defense_strength);
41265 if (differ) {
41266 BV_SET(fields, 14);
41267 }
41268
41269 differ = (old->move_rate != real_packet->move_rate);
41270 if (differ) {
41271 BV_SET(fields, 15);
41272 }
41273
41274 differ = (old->build_reqs_count != real_packet->build_reqs_count);
41275 if (differ) {
41276 BV_SET(fields, 16);
41277 }
41278
41279 differ = (old->build_reqs_count != real_packet->build_reqs_count);
41280 if (!differ) {
41281 int i;
41282
41283 for (i = 0; i < real_packet->build_reqs_count; i++) {
41284 differ = !are_requirements_equal(&old->build_reqs[i], &real_packet->build_reqs[i]);
41285 if (differ) {
41286 break;
41287 }
41288 }
41289 }
41290 if (differ) {
41291 BV_SET(fields, 17);
41292 }
41293
41294 differ = (old->vision_radius_sq != real_packet->vision_radius_sq);
41295 if (differ) {
41296 BV_SET(fields, 18);
41297 }
41298
41299 differ = (old->transport_capacity != real_packet->transport_capacity);
41300 if (differ) {
41301 BV_SET(fields, 19);
41302 }
41303
41304 differ = (old->hp != real_packet->hp);
41305 if (differ) {
41306 BV_SET(fields, 20);
41307 }
41308
41309 differ = (old->firepower != real_packet->firepower);
41310 if (differ) {
41311 BV_SET(fields, 21);
41312 }
41313
41314 differ = (old->obsoleted_by != real_packet->obsoleted_by);
41315 if (differ) {
41316 BV_SET(fields, 22);
41317 }
41318
41319 differ = (old->converted_to != real_packet->converted_to);
41320 if (differ) {
41321 BV_SET(fields, 23);
41322 }
41323
41324 differ = (old->convert_time != real_packet->convert_time);
41325 if (differ) {
41326 BV_SET(fields, 24);
41327 }
41328
41329 differ = (old->fuel != real_packet->fuel);
41330 if (differ) {
41331 BV_SET(fields, 25);
41332 }
41333
41334 differ = (old->happy_cost != real_packet->happy_cost);
41335 if (differ) {
41336 BV_SET(fields, 26);
41337 }
41338
41339 differ = FALSE;
41340 {
41341 int i;
41342
41343 for (i = 0; i < O_LAST; i++) {
41344 differ = (old->upkeep[i] != real_packet->upkeep[i]);
41345 if (differ) {
41346 break;
41347 }
41348 }
41349 }
41350 if (differ) {
41351 BV_SET(fields, 27);
41352 }
41353
41354 differ = (old->paratroopers_range != real_packet->paratroopers_range);
41355 if (differ) {
41356 BV_SET(fields, 28);
41357 }
41358
41359 differ = (old->veteran_levels != real_packet->veteran_levels);
41360 if (differ) {
41361 BV_SET(fields, 29);
41362 }
41363
41364 differ = (old->veteran_levels != real_packet->veteran_levels);
41365 if (!differ) {
41366 int i;
41367
41368 for (i = 0; i < real_packet->veteran_levels; i++) {
41369 differ = (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0);
41370 if (differ) {
41371 break;
41372 }
41373 }
41374 }
41375 if (differ) {
41376 BV_SET(fields, 30);
41377 }
41378
41379 differ = (old->veteran_levels != real_packet->veteran_levels);
41380 if (!differ) {
41381 int i;
41382
41383 for (i = 0; i < real_packet->veteran_levels; i++) {
41384 differ = (old->power_fact[i] != real_packet->power_fact[i]);
41385 if (differ) {
41386 break;
41387 }
41388 }
41389 }
41390 if (differ) {
41391 BV_SET(fields, 31);
41392 }
41393
41394 differ = (old->veteran_levels != real_packet->veteran_levels);
41395 if (!differ) {
41396 int i;
41397
41398 for (i = 0; i < real_packet->veteran_levels; i++) {
41399 differ = (old->move_bonus[i] != real_packet->move_bonus[i]);
41400 if (differ) {
41401 break;
41402 }
41403 }
41404 }
41405 if (differ) {
41406 BV_SET(fields, 32);
41407 }
41408
41409 differ = (old->veteran_levels != real_packet->veteran_levels);
41410 if (!differ) {
41411 int i;
41412
41413 for (i = 0; i < real_packet->veteran_levels; i++) {
41414 differ = (old->base_raise_chance[i] != real_packet->base_raise_chance[i]);
41415 if (differ) {
41416 break;
41417 }
41418 }
41419 }
41420 if (differ) {
41421 BV_SET(fields, 33);
41422 }
41423
41424 differ = (old->veteran_levels != real_packet->veteran_levels);
41425 if (!differ) {
41426 int i;
41427
41428 for (i = 0; i < real_packet->veteran_levels; i++) {
41429 differ = (old->work_raise_chance[i] != real_packet->work_raise_chance[i]);
41430 if (differ) {
41431 break;
41432 }
41433 }
41434 }
41435 if (differ) {
41436 BV_SET(fields, 34);
41437 }
41438
41439 differ = (old->bombard_rate != real_packet->bombard_rate);
41440 if (differ) {
41441 BV_SET(fields, 35);
41442 }
41443
41444 differ = (old->city_size != real_packet->city_size);
41445 if (differ) {
41446 BV_SET(fields, 36);
41447 }
41448
41449 differ = (old->city_slots != real_packet->city_slots);
41450 if (differ) {
41451 BV_SET(fields, 37);
41452 }
41453
41454 differ = (old->tp_defense != real_packet->tp_defense);
41455 if (differ) {
41456 BV_SET(fields, 38);
41457 }
41458
41459 differ = !BV_ARE_EQUAL(old->cargo, real_packet->cargo);
41460 if (differ) {
41461 BV_SET(fields, 39);
41462 }
41463
41464 differ = !BV_ARE_EQUAL(old->targets, real_packet->targets);
41465 if (differ) {
41466 BV_SET(fields, 40);
41467 }
41468
41469 differ = !BV_ARE_EQUAL(old->embarks, real_packet->embarks);
41470 if (differ) {
41471 BV_SET(fields, 41);
41472 }
41473
41474 differ = !BV_ARE_EQUAL(old->disembarks, real_packet->disembarks);
41475 if (differ) {
41476 BV_SET(fields, 42);
41477 }
41478
41479 differ = (old->vlayer != real_packet->vlayer);
41480 if (differ) {
41481 BV_SET(fields, 43);
41482 }
41483
41484 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
41485 if (differ) {
41486 BV_SET(fields, 44);
41487 }
41488
41489 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
41490 if (differ) {
41491 BV_SET(fields, 45);
41492 }
41493
41494 differ = !BV_ARE_EQUAL(old->roles, real_packet->roles);
41495 if (differ) {
41496 BV_SET(fields, 46);
41497 }
41498
41499 if (packet->worker) {
41500 BV_SET(fields, 47);
41501 }
41502
41503
41504#ifdef FREECIV_JSON_CONNECTION
41505 field_addr.name = "fields";
41506#endif /* FREECIV_JSON_CONNECTION */
41507 e = 0;
41508 e |= DIO_BV_PUT(&dout, &field_addr, fields);
41509 if (e) {
41510 log_packet_detailed("fields bitvector error detected");
41511 }
41512
41513 if (BV_ISSET(fields, 0)) {
41514 log_packet_detailed(" field 'id' has changed");
41515#ifdef FREECIV_JSON_CONNECTION
41516 field_addr.name = "id";
41517#endif /* FREECIV_JSON_CONNECTION */
41518 e = 0;
41519 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
41520 if (e) {
41521 log_packet_detailed("'id' field error detected");
41522 }
41523 }
41524 if (BV_ISSET(fields, 1)) {
41525 log_packet_detailed(" field 'name' has changed");
41526#ifdef FREECIV_JSON_CONNECTION
41527 field_addr.name = "name";
41528#endif /* FREECIV_JSON_CONNECTION */
41529 e = 0;
41530 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
41531 if (e) {
41532 log_packet_detailed("'name' field error detected");
41533 }
41534 }
41535 if (BV_ISSET(fields, 2)) {
41536 log_packet_detailed(" field 'rule_name' has changed");
41537#ifdef FREECIV_JSON_CONNECTION
41538 field_addr.name = "rule_name";
41539#endif /* FREECIV_JSON_CONNECTION */
41540 e = 0;
41541 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
41542 if (e) {
41543 log_packet_detailed("'rule_name' field error detected");
41544 }
41545 }
41546 if (BV_ISSET(fields, 3)) {
41547 log_packet_detailed(" field 'graphic_str' has changed");
41548#ifdef FREECIV_JSON_CONNECTION
41549 field_addr.name = "graphic_str";
41550#endif /* FREECIV_JSON_CONNECTION */
41551 e = 0;
41552 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
41553 if (e) {
41554 log_packet_detailed("'graphic_str' field error detected");
41555 }
41556 }
41557 if (BV_ISSET(fields, 4)) {
41558 log_packet_detailed(" field 'graphic_alt' has changed");
41559#ifdef FREECIV_JSON_CONNECTION
41560 field_addr.name = "graphic_alt";
41561#endif /* FREECIV_JSON_CONNECTION */
41562 e = 0;
41563 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
41564 if (e) {
41565 log_packet_detailed("'graphic_alt' field error detected");
41566 }
41567 }
41568 if (BV_ISSET(fields, 5)) {
41569 log_packet_detailed(" field 'graphic_alt2' has changed");
41570#ifdef FREECIV_JSON_CONNECTION
41571 field_addr.name = "graphic_alt2";
41572#endif /* FREECIV_JSON_CONNECTION */
41573 e = 0;
41574 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
41575 if (e) {
41576 log_packet_detailed("'graphic_alt2' field error detected");
41577 }
41578 }
41579 if (BV_ISSET(fields, 6)) {
41580 log_packet_detailed(" field 'sound_move' has changed");
41581#ifdef FREECIV_JSON_CONNECTION
41582 field_addr.name = "sound_move";
41583#endif /* FREECIV_JSON_CONNECTION */
41584 e = 0;
41585 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move);
41586 if (e) {
41587 log_packet_detailed("'sound_move' field error detected");
41588 }
41589 }
41590 if (BV_ISSET(fields, 7)) {
41591 log_packet_detailed(" field 'sound_move_alt' has changed");
41592#ifdef FREECIV_JSON_CONNECTION
41593 field_addr.name = "sound_move_alt";
41594#endif /* FREECIV_JSON_CONNECTION */
41595 e = 0;
41596 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move_alt);
41597 if (e) {
41598 log_packet_detailed("'sound_move_alt' field error detected");
41599 }
41600 }
41601 if (BV_ISSET(fields, 8)) {
41602 log_packet_detailed(" field 'sound_fight' has changed");
41603#ifdef FREECIV_JSON_CONNECTION
41604 field_addr.name = "sound_fight";
41605#endif /* FREECIV_JSON_CONNECTION */
41606 e = 0;
41607 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight);
41608 if (e) {
41609 log_packet_detailed("'sound_fight' field error detected");
41610 }
41611 }
41612 if (BV_ISSET(fields, 9)) {
41613 log_packet_detailed(" field 'sound_fight_alt' has changed");
41614#ifdef FREECIV_JSON_CONNECTION
41615 field_addr.name = "sound_fight_alt";
41616#endif /* FREECIV_JSON_CONNECTION */
41617 e = 0;
41618 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight_alt);
41619 if (e) {
41620 log_packet_detailed("'sound_fight_alt' field error detected");
41621 }
41622 }
41623 if (BV_ISSET(fields, 10)) {
41624 log_packet_detailed(" field 'unit_class_id' has changed");
41625#ifdef FREECIV_JSON_CONNECTION
41626 field_addr.name = "unit_class_id";
41627#endif /* FREECIV_JSON_CONNECTION */
41628 e = 0;
41629 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->unit_class_id);
41630 if (e) {
41631 log_packet_detailed("'unit_class_id' field error detected");
41632 }
41633 }
41634 if (BV_ISSET(fields, 11)) {
41635 log_packet_detailed(" field 'build_cost' has changed");
41636#ifdef FREECIV_JSON_CONNECTION
41637 field_addr.name = "build_cost";
41638#endif /* FREECIV_JSON_CONNECTION */
41639 e = 0;
41640 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
41641 if (e) {
41642 log_packet_detailed("'build_cost' field error detected");
41643 }
41644 }
41645 if (BV_ISSET(fields, 12)) {
41646 log_packet_detailed(" field 'pop_cost' has changed");
41647#ifdef FREECIV_JSON_CONNECTION
41648 field_addr.name = "pop_cost";
41649#endif /* FREECIV_JSON_CONNECTION */
41650 e = 0;
41651 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_cost);
41652 if (e) {
41653 log_packet_detailed("'pop_cost' field error detected");
41654 }
41655 }
41656 if (BV_ISSET(fields, 13)) {
41657 log_packet_detailed(" field 'attack_strength' has changed");
41658#ifdef FREECIV_JSON_CONNECTION
41659 field_addr.name = "attack_strength";
41660#endif /* FREECIV_JSON_CONNECTION */
41661 e = 0;
41662 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attack_strength);
41663 if (e) {
41664 log_packet_detailed("'attack_strength' field error detected");
41665 }
41666 }
41667 if (BV_ISSET(fields, 14)) {
41668 log_packet_detailed(" field 'defense_strength' has changed");
41669#ifdef FREECIV_JSON_CONNECTION
41670 field_addr.name = "defense_strength";
41671#endif /* FREECIV_JSON_CONNECTION */
41672 e = 0;
41673 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_strength);
41674 if (e) {
41675 log_packet_detailed("'defense_strength' field error detected");
41676 }
41677 }
41678 if (BV_ISSET(fields, 15)) {
41679 log_packet_detailed(" field 'move_rate' has changed");
41680#ifdef FREECIV_JSON_CONNECTION
41681 field_addr.name = "move_rate";
41682#endif /* FREECIV_JSON_CONNECTION */
41683 e = 0;
41684 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_rate);
41685 if (e) {
41686 log_packet_detailed("'move_rate' field error detected");
41687 }
41688 }
41689 if (BV_ISSET(fields, 16)) {
41690 log_packet_detailed(" field 'build_reqs_count' has changed");
41691#ifdef FREECIV_JSON_CONNECTION
41692 field_addr.name = "build_reqs_count";
41693#endif /* FREECIV_JSON_CONNECTION */
41694 e = 0;
41695 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_reqs_count);
41696 if (e) {
41697 log_packet_detailed("'build_reqs_count' field error detected");
41698 }
41699 }
41700 if (BV_ISSET(fields, 17)) {
41701 log_packet_detailed(" field 'build_reqs' has changed");
41702#ifdef FREECIV_JSON_CONNECTION
41703 field_addr.name = "build_reqs";
41704#endif /* FREECIV_JSON_CONNECTION */
41705 e = 0;
41706 {
41707 int i;
41708
41709#ifdef FREECIV_JSON_CONNECTION
41710 /* Create the array. */
41711 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->build_reqs_count);
41712
41713 /* Enter the array. */
41714 field_addr.sub_location = plocation_elem_new(0);
41715#endif /* FREECIV_JSON_CONNECTION */
41716
41717 for (i = 0; i < real_packet->build_reqs_count; i++) {
41718#ifdef FREECIV_JSON_CONNECTION
41719 /* Next array element. */
41720 field_addr.sub_location->number = i;
41721#endif /* FREECIV_JSON_CONNECTION */
41722 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->build_reqs[i]);
41723 }
41724
41725#ifdef FREECIV_JSON_CONNECTION
41726 /* Exit array. */
41727 FC_FREE(field_addr.sub_location);
41728#endif /* FREECIV_JSON_CONNECTION */
41729 }
41730 if (e) {
41731 log_packet_detailed("'build_reqs' field error detected");
41732 }
41733 }
41734 if (BV_ISSET(fields, 18)) {
41735 log_packet_detailed(" field 'vision_radius_sq' has changed");
41736#ifdef FREECIV_JSON_CONNECTION
41737 field_addr.name = "vision_radius_sq";
41738#endif /* FREECIV_JSON_CONNECTION */
41739 e = 0;
41740 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->vision_radius_sq);
41741 if (e) {
41742 log_packet_detailed("'vision_radius_sq' field error detected");
41743 }
41744 }
41745 if (BV_ISSET(fields, 19)) {
41746 log_packet_detailed(" field 'transport_capacity' has changed");
41747#ifdef FREECIV_JSON_CONNECTION
41748 field_addr.name = "transport_capacity";
41749#endif /* FREECIV_JSON_CONNECTION */
41750 e = 0;
41751 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transport_capacity);
41752 if (e) {
41753 log_packet_detailed("'transport_capacity' field error detected");
41754 }
41755 }
41756 if (BV_ISSET(fields, 20)) {
41757 log_packet_detailed(" field 'hp' has changed");
41758#ifdef FREECIV_JSON_CONNECTION
41759 field_addr.name = "hp";
41760#endif /* FREECIV_JSON_CONNECTION */
41761 e = 0;
41762 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
41763 if (e) {
41764 log_packet_detailed("'hp' field error detected");
41765 }
41766 }
41767 if (BV_ISSET(fields, 21)) {
41768 log_packet_detailed(" field 'firepower' has changed");
41769#ifdef FREECIV_JSON_CONNECTION
41770 field_addr.name = "firepower";
41771#endif /* FREECIV_JSON_CONNECTION */
41772 e = 0;
41773 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->firepower);
41774 if (e) {
41775 log_packet_detailed("'firepower' field error detected");
41776 }
41777 }
41778 if (BV_ISSET(fields, 22)) {
41779 log_packet_detailed(" field 'obsoleted_by' has changed");
41780#ifdef FREECIV_JSON_CONNECTION
41781 field_addr.name = "obsoleted_by";
41782#endif /* FREECIV_JSON_CONNECTION */
41783 e = 0;
41784 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obsoleted_by);
41785 if (e) {
41786 log_packet_detailed("'obsoleted_by' field error detected");
41787 }
41788 }
41789 if (BV_ISSET(fields, 23)) {
41790 log_packet_detailed(" field 'converted_to' has changed");
41791#ifdef FREECIV_JSON_CONNECTION
41792 field_addr.name = "converted_to";
41793#endif /* FREECIV_JSON_CONNECTION */
41794 e = 0;
41795 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->converted_to);
41796 if (e) {
41797 log_packet_detailed("'converted_to' field error detected");
41798 }
41799 }
41800 if (BV_ISSET(fields, 24)) {
41801 log_packet_detailed(" field 'convert_time' has changed");
41802#ifdef FREECIV_JSON_CONNECTION
41803 field_addr.name = "convert_time";
41804#endif /* FREECIV_JSON_CONNECTION */
41805 e = 0;
41806 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->convert_time);
41807 if (e) {
41808 log_packet_detailed("'convert_time' field error detected");
41809 }
41810 }
41811 if (BV_ISSET(fields, 25)) {
41812 log_packet_detailed(" field 'fuel' has changed");
41813#ifdef FREECIV_JSON_CONNECTION
41814 field_addr.name = "fuel";
41815#endif /* FREECIV_JSON_CONNECTION */
41816 e = 0;
41817 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
41818 if (e) {
41819 log_packet_detailed("'fuel' field error detected");
41820 }
41821 }
41822 if (BV_ISSET(fields, 26)) {
41823 log_packet_detailed(" field 'happy_cost' has changed");
41824#ifdef FREECIV_JSON_CONNECTION
41825 field_addr.name = "happy_cost";
41826#endif /* FREECIV_JSON_CONNECTION */
41827 e = 0;
41828 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happy_cost);
41829 if (e) {
41830 log_packet_detailed("'happy_cost' field error detected");
41831 }
41832 }
41833 if (BV_ISSET(fields, 27)) {
41834 log_packet_detailed(" field 'upkeep' has changed");
41835#ifdef FREECIV_JSON_CONNECTION
41836 field_addr.name = "upkeep";
41837#endif /* FREECIV_JSON_CONNECTION */
41838 e = 0;
41839 {
41840 int i;
41841
41842#ifdef FREECIV_JSON_CONNECTION
41843 /* Create the array. */
41844 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
41845
41846 /* Enter the array. */
41847 field_addr.sub_location = plocation_elem_new(0);
41848#endif /* FREECIV_JSON_CONNECTION */
41849
41850 for (i = 0; i < O_LAST; i++) {
41851#ifdef FREECIV_JSON_CONNECTION
41852 /* Next array element. */
41853 field_addr.sub_location->number = i;
41854#endif /* FREECIV_JSON_CONNECTION */
41855 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
41856 }
41857
41858#ifdef FREECIV_JSON_CONNECTION
41859 /* Exit array. */
41860 FC_FREE(field_addr.sub_location);
41861#endif /* FREECIV_JSON_CONNECTION */
41862 }
41863 if (e) {
41864 log_packet_detailed("'upkeep' field error detected");
41865 }
41866 }
41867 if (BV_ISSET(fields, 28)) {
41868 log_packet_detailed(" field 'paratroopers_range' has changed");
41869#ifdef FREECIV_JSON_CONNECTION
41870 field_addr.name = "paratroopers_range";
41871#endif /* FREECIV_JSON_CONNECTION */
41872 e = 0;
41873 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->paratroopers_range);
41874 if (e) {
41875 log_packet_detailed("'paratroopers_range' field error detected");
41876 }
41877 }
41878 if (BV_ISSET(fields, 29)) {
41879 log_packet_detailed(" field 'veteran_levels' has changed");
41880#ifdef FREECIV_JSON_CONNECTION
41881 field_addr.name = "veteran_levels";
41882#endif /* FREECIV_JSON_CONNECTION */
41883 e = 0;
41884 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
41885 if (e) {
41886 log_packet_detailed("'veteran_levels' field error detected");
41887 }
41888 }
41889 if (BV_ISSET(fields, 30)) {
41890 log_packet_detailed(" field 'veteran_name' has changed");
41891#ifdef FREECIV_JSON_CONNECTION
41892 field_addr.name = "veteran_name";
41893#endif /* FREECIV_JSON_CONNECTION */
41894 e = 0;
41895 {
41896 int i;
41897
41898#ifdef FREECIV_JSON_CONNECTION
41899 /* Create the array. */
41900 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
41901
41902 /* Enter the array. */
41903 field_addr.sub_location = plocation_elem_new(0);
41904#endif /* FREECIV_JSON_CONNECTION */
41905
41906 for (i = 0; i < real_packet->veteran_levels; i++) {
41907#ifdef FREECIV_JSON_CONNECTION
41908 /* Next array element. */
41909 field_addr.sub_location->number = i;
41910#endif /* FREECIV_JSON_CONNECTION */
41911 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
41912 }
41913
41914#ifdef FREECIV_JSON_CONNECTION
41915 /* Exit array. */
41916 FC_FREE(field_addr.sub_location);
41917#endif /* FREECIV_JSON_CONNECTION */
41918 }
41919 if (e) {
41920 log_packet_detailed("'veteran_name' field error detected");
41921 }
41922 }
41923 if (BV_ISSET(fields, 31)) {
41924 log_packet_detailed(" field 'power_fact' has changed");
41925#ifdef FREECIV_JSON_CONNECTION
41926 field_addr.name = "power_fact";
41927#endif /* FREECIV_JSON_CONNECTION */
41928 e = 0;
41929 {
41930 int i;
41931
41932#ifdef FREECIV_JSON_CONNECTION
41933 /* Create the array. */
41934 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
41935
41936 /* Enter the array. */
41937 field_addr.sub_location = plocation_elem_new(0);
41938#endif /* FREECIV_JSON_CONNECTION */
41939
41940 for (i = 0; i < real_packet->veteran_levels; i++) {
41941#ifdef FREECIV_JSON_CONNECTION
41942 /* Next array element. */
41943 field_addr.sub_location->number = i;
41944#endif /* FREECIV_JSON_CONNECTION */
41945 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
41946 }
41947
41948#ifdef FREECIV_JSON_CONNECTION
41949 /* Exit array. */
41950 FC_FREE(field_addr.sub_location);
41951#endif /* FREECIV_JSON_CONNECTION */
41952 }
41953 if (e) {
41954 log_packet_detailed("'power_fact' field error detected");
41955 }
41956 }
41957 if (BV_ISSET(fields, 32)) {
41958 log_packet_detailed(" field 'move_bonus' has changed");
41959#ifdef FREECIV_JSON_CONNECTION
41960 field_addr.name = "move_bonus";
41961#endif /* FREECIV_JSON_CONNECTION */
41962 e = 0;
41963 {
41964 int i;
41965
41966#ifdef FREECIV_JSON_CONNECTION
41967 /* Create the array. */
41968 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
41969
41970 /* Enter the array. */
41971 field_addr.sub_location = plocation_elem_new(0);
41972#endif /* FREECIV_JSON_CONNECTION */
41973
41974 for (i = 0; i < real_packet->veteran_levels; i++) {
41975#ifdef FREECIV_JSON_CONNECTION
41976 /* Next array element. */
41977 field_addr.sub_location->number = i;
41978#endif /* FREECIV_JSON_CONNECTION */
41979 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
41980 }
41981
41982#ifdef FREECIV_JSON_CONNECTION
41983 /* Exit array. */
41984 FC_FREE(field_addr.sub_location);
41985#endif /* FREECIV_JSON_CONNECTION */
41986 }
41987 if (e) {
41988 log_packet_detailed("'move_bonus' field error detected");
41989 }
41990 }
41991 if (BV_ISSET(fields, 33)) {
41992 log_packet_detailed(" field 'base_raise_chance' has changed");
41993#ifdef FREECIV_JSON_CONNECTION
41994 field_addr.name = "base_raise_chance";
41995#endif /* FREECIV_JSON_CONNECTION */
41996 e = 0;
41997 {
41998 int i;
41999
42000#ifdef FREECIV_JSON_CONNECTION
42001 /* Create the array. */
42002 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
42003
42004 /* Enter the array. */
42005 field_addr.sub_location = plocation_elem_new(0);
42006#endif /* FREECIV_JSON_CONNECTION */
42007
42008 for (i = 0; i < real_packet->veteran_levels; i++) {
42009#ifdef FREECIV_JSON_CONNECTION
42010 /* Next array element. */
42011 field_addr.sub_location->number = i;
42012#endif /* FREECIV_JSON_CONNECTION */
42013 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
42014 }
42015
42016#ifdef FREECIV_JSON_CONNECTION
42017 /* Exit array. */
42018 FC_FREE(field_addr.sub_location);
42019#endif /* FREECIV_JSON_CONNECTION */
42020 }
42021 if (e) {
42022 log_packet_detailed("'base_raise_chance' field error detected");
42023 }
42024 }
42025 if (BV_ISSET(fields, 34)) {
42026 log_packet_detailed(" field 'work_raise_chance' has changed");
42027#ifdef FREECIV_JSON_CONNECTION
42028 field_addr.name = "work_raise_chance";
42029#endif /* FREECIV_JSON_CONNECTION */
42030 e = 0;
42031 {
42032 int i;
42033
42034#ifdef FREECIV_JSON_CONNECTION
42035 /* Create the array. */
42036 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
42037
42038 /* Enter the array. */
42039 field_addr.sub_location = plocation_elem_new(0);
42040#endif /* FREECIV_JSON_CONNECTION */
42041
42042 for (i = 0; i < real_packet->veteran_levels; i++) {
42043#ifdef FREECIV_JSON_CONNECTION
42044 /* Next array element. */
42045 field_addr.sub_location->number = i;
42046#endif /* FREECIV_JSON_CONNECTION */
42047 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
42048 }
42049
42050#ifdef FREECIV_JSON_CONNECTION
42051 /* Exit array. */
42052 FC_FREE(field_addr.sub_location);
42053#endif /* FREECIV_JSON_CONNECTION */
42054 }
42055 if (e) {
42056 log_packet_detailed("'work_raise_chance' field error detected");
42057 }
42058 }
42059 if (BV_ISSET(fields, 35)) {
42060 log_packet_detailed(" field 'bombard_rate' has changed");
42061#ifdef FREECIV_JSON_CONNECTION
42062 field_addr.name = "bombard_rate";
42063#endif /* FREECIV_JSON_CONNECTION */
42064 e = 0;
42065 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bombard_rate);
42066 if (e) {
42067 log_packet_detailed("'bombard_rate' field error detected");
42068 }
42069 }
42070 if (BV_ISSET(fields, 36)) {
42071 log_packet_detailed(" field 'city_size' has changed");
42072#ifdef FREECIV_JSON_CONNECTION
42073 field_addr.name = "city_size";
42074#endif /* FREECIV_JSON_CONNECTION */
42075 e = 0;
42076 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_size);
42077 if (e) {
42078 log_packet_detailed("'city_size' field error detected");
42079 }
42080 }
42081 if (BV_ISSET(fields, 37)) {
42082 log_packet_detailed(" field 'city_slots' has changed");
42083#ifdef FREECIV_JSON_CONNECTION
42084 field_addr.name = "city_slots";
42085#endif /* FREECIV_JSON_CONNECTION */
42086 e = 0;
42087 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_slots);
42088 if (e) {
42089 log_packet_detailed("'city_slots' field error detected");
42090 }
42091 }
42092 if (BV_ISSET(fields, 38)) {
42093 log_packet_detailed(" field 'tp_defense' has changed");
42094#ifdef FREECIV_JSON_CONNECTION
42095 field_addr.name = "tp_defense";
42096#endif /* FREECIV_JSON_CONNECTION */
42097 e = 0;
42098 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tp_defense);
42099 if (e) {
42100 log_packet_detailed("'tp_defense' field error detected");
42101 }
42102 }
42103 if (BV_ISSET(fields, 39)) {
42104 log_packet_detailed(" field 'cargo' has changed");
42105#ifdef FREECIV_JSON_CONNECTION
42106 field_addr.name = "cargo";
42107#endif /* FREECIV_JSON_CONNECTION */
42108 e = 0;
42109 e |= DIO_BV_PUT(&dout, &field_addr, packet->cargo);
42110 if (e) {
42111 log_packet_detailed("'cargo' field error detected");
42112 }
42113 }
42114 if (BV_ISSET(fields, 40)) {
42115 log_packet_detailed(" field 'targets' has changed");
42116#ifdef FREECIV_JSON_CONNECTION
42117 field_addr.name = "targets";
42118#endif /* FREECIV_JSON_CONNECTION */
42119 e = 0;
42120 e |= DIO_BV_PUT(&dout, &field_addr, packet->targets);
42121 if (e) {
42122 log_packet_detailed("'targets' field error detected");
42123 }
42124 }
42125 if (BV_ISSET(fields, 41)) {
42126 log_packet_detailed(" field 'embarks' has changed");
42127#ifdef FREECIV_JSON_CONNECTION
42128 field_addr.name = "embarks";
42129#endif /* FREECIV_JSON_CONNECTION */
42130 e = 0;
42131 e |= DIO_BV_PUT(&dout, &field_addr, packet->embarks);
42132 if (e) {
42133 log_packet_detailed("'embarks' field error detected");
42134 }
42135 }
42136 if (BV_ISSET(fields, 42)) {
42137 log_packet_detailed(" field 'disembarks' has changed");
42138#ifdef FREECIV_JSON_CONNECTION
42139 field_addr.name = "disembarks";
42140#endif /* FREECIV_JSON_CONNECTION */
42141 e = 0;
42142 e |= DIO_BV_PUT(&dout, &field_addr, packet->disembarks);
42143 if (e) {
42144 log_packet_detailed("'disembarks' field error detected");
42145 }
42146 }
42147 if (BV_ISSET(fields, 43)) {
42148 log_packet_detailed(" field 'vlayer' has changed");
42149#ifdef FREECIV_JSON_CONNECTION
42150 field_addr.name = "vlayer";
42151#endif /* FREECIV_JSON_CONNECTION */
42152 e = 0;
42153 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->vlayer);
42154 if (e) {
42155 log_packet_detailed("'vlayer' field error detected");
42156 }
42157 }
42158 if (BV_ISSET(fields, 44)) {
42159 log_packet_detailed(" field 'helptext' has changed");
42160#ifdef FREECIV_JSON_CONNECTION
42161 field_addr.name = "helptext";
42162#endif /* FREECIV_JSON_CONNECTION */
42163 e = 0;
42164 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
42165 if (e) {
42166 log_packet_detailed("'helptext' field error detected");
42167 }
42168 }
42169 if (BV_ISSET(fields, 45)) {
42170 log_packet_detailed(" field 'flags' has changed");
42171#ifdef FREECIV_JSON_CONNECTION
42172 field_addr.name = "flags";
42173#endif /* FREECIV_JSON_CONNECTION */
42174 e = 0;
42175 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
42176 if (e) {
42177 log_packet_detailed("'flags' field error detected");
42178 }
42179 }
42180 if (BV_ISSET(fields, 46)) {
42181 log_packet_detailed(" field 'roles' has changed");
42182#ifdef FREECIV_JSON_CONNECTION
42183 field_addr.name = "roles";
42184#endif /* FREECIV_JSON_CONNECTION */
42185 e = 0;
42186 e |= DIO_BV_PUT(&dout, &field_addr, packet->roles);
42187 if (e) {
42188 log_packet_detailed("'roles' field error detected");
42189 }
42190 }
42191 /* field 47 is folded into the header */
42192
42193 *old = *real_packet;
42194#endif /* FREECIV_DELTA_PROTOCOL */
42195#ifndef FREECIV_DELTA_PROTOCOL
42196#ifdef FREECIV_JSON_CONNECTION
42197 field_addr.name = "id";
42198#endif /* FREECIV_JSON_CONNECTION */
42199 e = 0;
42200 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
42201 if (e) {
42202 log_packet_detailed("'id' field error detected");
42203 }
42204#ifdef FREECIV_JSON_CONNECTION
42205 field_addr.name = "name";
42206#endif /* FREECIV_JSON_CONNECTION */
42207 e = 0;
42208 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
42209 if (e) {
42210 log_packet_detailed("'name' field error detected");
42211 }
42212#ifdef FREECIV_JSON_CONNECTION
42213 field_addr.name = "rule_name";
42214#endif /* FREECIV_JSON_CONNECTION */
42215 e = 0;
42216 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
42217 if (e) {
42218 log_packet_detailed("'rule_name' field error detected");
42219 }
42220#ifdef FREECIV_JSON_CONNECTION
42221 field_addr.name = "graphic_str";
42222#endif /* FREECIV_JSON_CONNECTION */
42223 e = 0;
42224 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
42225 if (e) {
42226 log_packet_detailed("'graphic_str' field error detected");
42227 }
42228#ifdef FREECIV_JSON_CONNECTION
42229 field_addr.name = "graphic_alt";
42230#endif /* FREECIV_JSON_CONNECTION */
42231 e = 0;
42232 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
42233 if (e) {
42234 log_packet_detailed("'graphic_alt' field error detected");
42235 }
42236#ifdef FREECIV_JSON_CONNECTION
42237 field_addr.name = "graphic_alt2";
42238#endif /* FREECIV_JSON_CONNECTION */
42239 e = 0;
42240 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
42241 if (e) {
42242 log_packet_detailed("'graphic_alt2' field error detected");
42243 }
42244#ifdef FREECIV_JSON_CONNECTION
42245 field_addr.name = "sound_move";
42246#endif /* FREECIV_JSON_CONNECTION */
42247 e = 0;
42248 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move);
42249 if (e) {
42250 log_packet_detailed("'sound_move' field error detected");
42251 }
42252#ifdef FREECIV_JSON_CONNECTION
42253 field_addr.name = "sound_move_alt";
42254#endif /* FREECIV_JSON_CONNECTION */
42255 e = 0;
42256 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_move_alt);
42257 if (e) {
42258 log_packet_detailed("'sound_move_alt' field error detected");
42259 }
42260#ifdef FREECIV_JSON_CONNECTION
42261 field_addr.name = "sound_fight";
42262#endif /* FREECIV_JSON_CONNECTION */
42263 e = 0;
42264 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight);
42265 if (e) {
42266 log_packet_detailed("'sound_fight' field error detected");
42267 }
42268#ifdef FREECIV_JSON_CONNECTION
42269 field_addr.name = "sound_fight_alt";
42270#endif /* FREECIV_JSON_CONNECTION */
42271 e = 0;
42272 e |= DIO_PUT(string, &dout, &field_addr, real_packet->sound_fight_alt);
42273 if (e) {
42274 log_packet_detailed("'sound_fight_alt' field error detected");
42275 }
42276#ifdef FREECIV_JSON_CONNECTION
42277 field_addr.name = "unit_class_id";
42278#endif /* FREECIV_JSON_CONNECTION */
42279 e = 0;
42280 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->unit_class_id);
42281 if (e) {
42282 log_packet_detailed("'unit_class_id' field error detected");
42283 }
42284#ifdef FREECIV_JSON_CONNECTION
42285 field_addr.name = "build_cost";
42286#endif /* FREECIV_JSON_CONNECTION */
42287 e = 0;
42288 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
42289 if (e) {
42290 log_packet_detailed("'build_cost' field error detected");
42291 }
42292#ifdef FREECIV_JSON_CONNECTION
42293 field_addr.name = "pop_cost";
42294#endif /* FREECIV_JSON_CONNECTION */
42295 e = 0;
42296 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pop_cost);
42297 if (e) {
42298 log_packet_detailed("'pop_cost' field error detected");
42299 }
42300#ifdef FREECIV_JSON_CONNECTION
42301 field_addr.name = "attack_strength";
42302#endif /* FREECIV_JSON_CONNECTION */
42303 e = 0;
42304 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->attack_strength);
42305 if (e) {
42306 log_packet_detailed("'attack_strength' field error detected");
42307 }
42308#ifdef FREECIV_JSON_CONNECTION
42309 field_addr.name = "defense_strength";
42310#endif /* FREECIV_JSON_CONNECTION */
42311 e = 0;
42312 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_strength);
42313 if (e) {
42314 log_packet_detailed("'defense_strength' field error detected");
42315 }
42316#ifdef FREECIV_JSON_CONNECTION
42317 field_addr.name = "move_rate";
42318#endif /* FREECIV_JSON_CONNECTION */
42319 e = 0;
42320 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_rate);
42321 if (e) {
42322 log_packet_detailed("'move_rate' field error detected");
42323 }
42324#ifdef FREECIV_JSON_CONNECTION
42325 field_addr.name = "build_reqs_count";
42326#endif /* FREECIV_JSON_CONNECTION */
42327 e = 0;
42328 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_reqs_count);
42329 if (e) {
42330 log_packet_detailed("'build_reqs_count' field error detected");
42331 }
42332#ifdef FREECIV_JSON_CONNECTION
42333 field_addr.name = "build_reqs";
42334#endif /* FREECIV_JSON_CONNECTION */
42335 e = 0;
42336 {
42337 int i;
42338
42339#ifdef FREECIV_JSON_CONNECTION
42340 /* Create the array. */
42341 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->build_reqs_count);
42342
42343 /* Enter the array. */
42344 field_addr.sub_location = plocation_elem_new(0);
42345#endif /* FREECIV_JSON_CONNECTION */
42346
42347 for (i = 0; i < real_packet->build_reqs_count; i++) {
42348#ifdef FREECIV_JSON_CONNECTION
42349 /* Next array element. */
42350 field_addr.sub_location->number = i;
42351#endif /* FREECIV_JSON_CONNECTION */
42352 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->build_reqs[i]);
42353 }
42354
42355#ifdef FREECIV_JSON_CONNECTION
42356 /* Exit array. */
42357 FC_FREE(field_addr.sub_location);
42358#endif /* FREECIV_JSON_CONNECTION */
42359 }
42360 if (e) {
42361 log_packet_detailed("'build_reqs' field error detected");
42362 }
42363#ifdef FREECIV_JSON_CONNECTION
42364 field_addr.name = "vision_radius_sq";
42365#endif /* FREECIV_JSON_CONNECTION */
42366 e = 0;
42367 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->vision_radius_sq);
42368 if (e) {
42369 log_packet_detailed("'vision_radius_sq' field error detected");
42370 }
42371#ifdef FREECIV_JSON_CONNECTION
42372 field_addr.name = "transport_capacity";
42373#endif /* FREECIV_JSON_CONNECTION */
42374 e = 0;
42375 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transport_capacity);
42376 if (e) {
42377 log_packet_detailed("'transport_capacity' field error detected");
42378 }
42379#ifdef FREECIV_JSON_CONNECTION
42380 field_addr.name = "hp";
42381#endif /* FREECIV_JSON_CONNECTION */
42382 e = 0;
42383 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
42384 if (e) {
42385 log_packet_detailed("'hp' field error detected");
42386 }
42387#ifdef FREECIV_JSON_CONNECTION
42388 field_addr.name = "firepower";
42389#endif /* FREECIV_JSON_CONNECTION */
42390 e = 0;
42391 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->firepower);
42392 if (e) {
42393 log_packet_detailed("'firepower' field error detected");
42394 }
42395#ifdef FREECIV_JSON_CONNECTION
42396 field_addr.name = "obsoleted_by";
42397#endif /* FREECIV_JSON_CONNECTION */
42398 e = 0;
42399 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obsoleted_by);
42400 if (e) {
42401 log_packet_detailed("'obsoleted_by' field error detected");
42402 }
42403#ifdef FREECIV_JSON_CONNECTION
42404 field_addr.name = "converted_to";
42405#endif /* FREECIV_JSON_CONNECTION */
42406 e = 0;
42407 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->converted_to);
42408 if (e) {
42409 log_packet_detailed("'converted_to' field error detected");
42410 }
42411#ifdef FREECIV_JSON_CONNECTION
42412 field_addr.name = "convert_time";
42413#endif /* FREECIV_JSON_CONNECTION */
42414 e = 0;
42415 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->convert_time);
42416 if (e) {
42417 log_packet_detailed("'convert_time' field error detected");
42418 }
42419#ifdef FREECIV_JSON_CONNECTION
42420 field_addr.name = "fuel";
42421#endif /* FREECIV_JSON_CONNECTION */
42422 e = 0;
42423 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
42424 if (e) {
42425 log_packet_detailed("'fuel' field error detected");
42426 }
42427#ifdef FREECIV_JSON_CONNECTION
42428 field_addr.name = "happy_cost";
42429#endif /* FREECIV_JSON_CONNECTION */
42430 e = 0;
42431 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->happy_cost);
42432 if (e) {
42433 log_packet_detailed("'happy_cost' field error detected");
42434 }
42435#ifdef FREECIV_JSON_CONNECTION
42436 field_addr.name = "upkeep";
42437#endif /* FREECIV_JSON_CONNECTION */
42438 e = 0;
42439 {
42440 int i;
42441
42442#ifdef FREECIV_JSON_CONNECTION
42443 /* Create the array. */
42444 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
42445
42446 /* Enter the array. */
42447 field_addr.sub_location = plocation_elem_new(0);
42448#endif /* FREECIV_JSON_CONNECTION */
42449
42450 for (i = 0; i < O_LAST; i++) {
42451#ifdef FREECIV_JSON_CONNECTION
42452 /* Next array element. */
42453 field_addr.sub_location->number = i;
42454#endif /* FREECIV_JSON_CONNECTION */
42455 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep[i]);
42456 }
42457
42458#ifdef FREECIV_JSON_CONNECTION
42459 /* Exit array. */
42460 FC_FREE(field_addr.sub_location);
42461#endif /* FREECIV_JSON_CONNECTION */
42462 }
42463 if (e) {
42464 log_packet_detailed("'upkeep' field error detected");
42465 }
42466#ifdef FREECIV_JSON_CONNECTION
42467 field_addr.name = "paratroopers_range";
42468#endif /* FREECIV_JSON_CONNECTION */
42469 e = 0;
42470 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->paratroopers_range);
42471 if (e) {
42472 log_packet_detailed("'paratroopers_range' field error detected");
42473 }
42474#ifdef FREECIV_JSON_CONNECTION
42475 field_addr.name = "veteran_levels";
42476#endif /* FREECIV_JSON_CONNECTION */
42477 e = 0;
42478 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
42479 if (e) {
42480 log_packet_detailed("'veteran_levels' field error detected");
42481 }
42482#ifdef FREECIV_JSON_CONNECTION
42483 field_addr.name = "veteran_name";
42484#endif /* FREECIV_JSON_CONNECTION */
42485 e = 0;
42486 {
42487 int i;
42488
42489#ifdef FREECIV_JSON_CONNECTION
42490 /* Create the array. */
42491 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
42492
42493 /* Enter the array. */
42494 field_addr.sub_location = plocation_elem_new(0);
42495#endif /* FREECIV_JSON_CONNECTION */
42496
42497 for (i = 0; i < real_packet->veteran_levels; i++) {
42498#ifdef FREECIV_JSON_CONNECTION
42499 /* Next array element. */
42500 field_addr.sub_location->number = i;
42501#endif /* FREECIV_JSON_CONNECTION */
42502 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
42503 }
42504
42505#ifdef FREECIV_JSON_CONNECTION
42506 /* Exit array. */
42507 FC_FREE(field_addr.sub_location);
42508#endif /* FREECIV_JSON_CONNECTION */
42509 }
42510 if (e) {
42511 log_packet_detailed("'veteran_name' field error detected");
42512 }
42513#ifdef FREECIV_JSON_CONNECTION
42514 field_addr.name = "power_fact";
42515#endif /* FREECIV_JSON_CONNECTION */
42516 e = 0;
42517 {
42518 int i;
42519
42520#ifdef FREECIV_JSON_CONNECTION
42521 /* Create the array. */
42522 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
42523
42524 /* Enter the array. */
42525 field_addr.sub_location = plocation_elem_new(0);
42526#endif /* FREECIV_JSON_CONNECTION */
42527
42528 for (i = 0; i < real_packet->veteran_levels; i++) {
42529#ifdef FREECIV_JSON_CONNECTION
42530 /* Next array element. */
42531 field_addr.sub_location->number = i;
42532#endif /* FREECIV_JSON_CONNECTION */
42533 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
42534 }
42535
42536#ifdef FREECIV_JSON_CONNECTION
42537 /* Exit array. */
42538 FC_FREE(field_addr.sub_location);
42539#endif /* FREECIV_JSON_CONNECTION */
42540 }
42541 if (e) {
42542 log_packet_detailed("'power_fact' field error detected");
42543 }
42544#ifdef FREECIV_JSON_CONNECTION
42545 field_addr.name = "move_bonus";
42546#endif /* FREECIV_JSON_CONNECTION */
42547 e = 0;
42548 {
42549 int i;
42550
42551#ifdef FREECIV_JSON_CONNECTION
42552 /* Create the array. */
42553 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
42554
42555 /* Enter the array. */
42556 field_addr.sub_location = plocation_elem_new(0);
42557#endif /* FREECIV_JSON_CONNECTION */
42558
42559 for (i = 0; i < real_packet->veteran_levels; i++) {
42560#ifdef FREECIV_JSON_CONNECTION
42561 /* Next array element. */
42562 field_addr.sub_location->number = i;
42563#endif /* FREECIV_JSON_CONNECTION */
42564 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
42565 }
42566
42567#ifdef FREECIV_JSON_CONNECTION
42568 /* Exit array. */
42569 FC_FREE(field_addr.sub_location);
42570#endif /* FREECIV_JSON_CONNECTION */
42571 }
42572 if (e) {
42573 log_packet_detailed("'move_bonus' field error detected");
42574 }
42575#ifdef FREECIV_JSON_CONNECTION
42576 field_addr.name = "base_raise_chance";
42577#endif /* FREECIV_JSON_CONNECTION */
42578 e = 0;
42579 {
42580 int i;
42581
42582#ifdef FREECIV_JSON_CONNECTION
42583 /* Create the array. */
42584 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
42585
42586 /* Enter the array. */
42587 field_addr.sub_location = plocation_elem_new(0);
42588#endif /* FREECIV_JSON_CONNECTION */
42589
42590 for (i = 0; i < real_packet->veteran_levels; i++) {
42591#ifdef FREECIV_JSON_CONNECTION
42592 /* Next array element. */
42593 field_addr.sub_location->number = i;
42594#endif /* FREECIV_JSON_CONNECTION */
42595 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
42596 }
42597
42598#ifdef FREECIV_JSON_CONNECTION
42599 /* Exit array. */
42600 FC_FREE(field_addr.sub_location);
42601#endif /* FREECIV_JSON_CONNECTION */
42602 }
42603 if (e) {
42604 log_packet_detailed("'base_raise_chance' field error detected");
42605 }
42606#ifdef FREECIV_JSON_CONNECTION
42607 field_addr.name = "work_raise_chance";
42608#endif /* FREECIV_JSON_CONNECTION */
42609 e = 0;
42610 {
42611 int i;
42612
42613#ifdef FREECIV_JSON_CONNECTION
42614 /* Create the array. */
42615 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
42616
42617 /* Enter the array. */
42618 field_addr.sub_location = plocation_elem_new(0);
42619#endif /* FREECIV_JSON_CONNECTION */
42620
42621 for (i = 0; i < real_packet->veteran_levels; i++) {
42622#ifdef FREECIV_JSON_CONNECTION
42623 /* Next array element. */
42624 field_addr.sub_location->number = i;
42625#endif /* FREECIV_JSON_CONNECTION */
42626 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
42627 }
42628
42629#ifdef FREECIV_JSON_CONNECTION
42630 /* Exit array. */
42631 FC_FREE(field_addr.sub_location);
42632#endif /* FREECIV_JSON_CONNECTION */
42633 }
42634 if (e) {
42635 log_packet_detailed("'work_raise_chance' field error detected");
42636 }
42637#ifdef FREECIV_JSON_CONNECTION
42638 field_addr.name = "bombard_rate";
42639#endif /* FREECIV_JSON_CONNECTION */
42640 e = 0;
42641 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bombard_rate);
42642 if (e) {
42643 log_packet_detailed("'bombard_rate' field error detected");
42644 }
42645#ifdef FREECIV_JSON_CONNECTION
42646 field_addr.name = "city_size";
42647#endif /* FREECIV_JSON_CONNECTION */
42648 e = 0;
42649 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_size);
42650 if (e) {
42651 log_packet_detailed("'city_size' field error detected");
42652 }
42653#ifdef FREECIV_JSON_CONNECTION
42654 field_addr.name = "city_slots";
42655#endif /* FREECIV_JSON_CONNECTION */
42656 e = 0;
42657 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->city_slots);
42658 if (e) {
42659 log_packet_detailed("'city_slots' field error detected");
42660 }
42661#ifdef FREECIV_JSON_CONNECTION
42662 field_addr.name = "tp_defense";
42663#endif /* FREECIV_JSON_CONNECTION */
42664 e = 0;
42665 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tp_defense);
42666 if (e) {
42667 log_packet_detailed("'tp_defense' field error detected");
42668 }
42669#ifdef FREECIV_JSON_CONNECTION
42670 field_addr.name = "cargo";
42671#endif /* FREECIV_JSON_CONNECTION */
42672 e = 0;
42673 e |= DIO_BV_PUT(&dout, &field_addr, packet->cargo);
42674 if (e) {
42675 log_packet_detailed("'cargo' field error detected");
42676 }
42677#ifdef FREECIV_JSON_CONNECTION
42678 field_addr.name = "targets";
42679#endif /* FREECIV_JSON_CONNECTION */
42680 e = 0;
42681 e |= DIO_BV_PUT(&dout, &field_addr, packet->targets);
42682 if (e) {
42683 log_packet_detailed("'targets' field error detected");
42684 }
42685#ifdef FREECIV_JSON_CONNECTION
42686 field_addr.name = "embarks";
42687#endif /* FREECIV_JSON_CONNECTION */
42688 e = 0;
42689 e |= DIO_BV_PUT(&dout, &field_addr, packet->embarks);
42690 if (e) {
42691 log_packet_detailed("'embarks' field error detected");
42692 }
42693#ifdef FREECIV_JSON_CONNECTION
42694 field_addr.name = "disembarks";
42695#endif /* FREECIV_JSON_CONNECTION */
42696 e = 0;
42697 e |= DIO_BV_PUT(&dout, &field_addr, packet->disembarks);
42698 if (e) {
42699 log_packet_detailed("'disembarks' field error detected");
42700 }
42701#ifdef FREECIV_JSON_CONNECTION
42702 field_addr.name = "vlayer";
42703#endif /* FREECIV_JSON_CONNECTION */
42704 e = 0;
42705 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->vlayer);
42706 if (e) {
42707 log_packet_detailed("'vlayer' field error detected");
42708 }
42709#ifdef FREECIV_JSON_CONNECTION
42710 field_addr.name = "helptext";
42711#endif /* FREECIV_JSON_CONNECTION */
42712 e = 0;
42713 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
42714 if (e) {
42715 log_packet_detailed("'helptext' field error detected");
42716 }
42717#ifdef FREECIV_JSON_CONNECTION
42718 field_addr.name = "flags";
42719#endif /* FREECIV_JSON_CONNECTION */
42720 e = 0;
42721 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
42722 if (e) {
42723 log_packet_detailed("'flags' field error detected");
42724 }
42725#ifdef FREECIV_JSON_CONNECTION
42726 field_addr.name = "roles";
42727#endif /* FREECIV_JSON_CONNECTION */
42728 e = 0;
42729 e |= DIO_BV_PUT(&dout, &field_addr, packet->roles);
42730 if (e) {
42731 log_packet_detailed("'roles' field error detected");
42732 }
42733#ifdef FREECIV_JSON_CONNECTION
42734 field_addr.name = "worker";
42735#endif /* FREECIV_JSON_CONNECTION */
42736 e = 0;
42737 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->worker);
42738 if (e) {
42739 log_packet_detailed("'worker' field error detected");
42740 }
42741
42742#endif
42743 SEND_PACKET_END(PACKET_RULESET_UNIT);
42744}
42745
42746 int send_packet_ruleset_unit(struct connection *pc, const struct packet_ruleset_unit *packet)
42747{
42748 if (!pc->used) {
42749 log_error("WARNING: trying to send data to the closed connection %s",
42750 conn_description(pc));
42751 return -1;
42752 }
42753 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT].packet != NULL, -1,
42754 "Handler for PACKET_RULESET_UNIT not installed");
42755 return pc->phs.handlers->send[PACKET_RULESET_UNIT].packet(pc, packet);
42756}
42757
42758 void lsend_packet_ruleset_unit(struct conn_list *dest, const struct packet_ruleset_unit *packet)
42759{
42760 conn_list_iterate(dest, pconn) {
42761 send_packet_ruleset_unit(pconn, packet);
42762 } conn_list_iterate_end;
42763}
42764
42765#ifdef FREECIV_DELTA_PROTOCOL
42766#define hash_packet_ruleset_unit_bonus_100 hash_const
42767
42768#define cmp_packet_ruleset_unit_bonus_100 cmp_const
42769
42770 BV_DEFINE(packet_ruleset_unit_bonus_100_fields, 5);
42771#endif /* FREECIV_DELTA_PROTOCOL */
42772
42773 static struct packet_ruleset_unit_bonus *receive_packet_ruleset_unit_bonus_100(struct connection *pc)
42774{
42775#ifdef FREECIV_DELTA_PROTOCOL
42776 packet_ruleset_unit_bonus_100_fields fields;
42777 struct packet_ruleset_unit_bonus *old;
42778 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_BONUS;
42779#endif /* FREECIV_DELTA_PROTOCOL */
42780 RECEIVE_PACKET_START(packet_ruleset_unit_bonus, real_packet);
42781#ifdef FREECIV_JSON_CONNECTION
42782 struct plocation field_addr;
42783 {
42784 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42785 field_addr = *field_addr_tmp;
42786 FC_FREE(field_addr_tmp);
42787 }
42788#endif /* FREECIV_JSON_CONNECTION */
42789
42790#ifdef FREECIV_DELTA_PROTOCOL
42791#ifdef FREECIV_JSON_CONNECTION
42792 field_addr.name = "fields";
42793#endif /* FREECIV_JSON_CONNECTION */
42794 DIO_BV_GET(&din, &field_addr, fields);
42795
42796#else /* FREECIV_DELTA_PROTOCOL */
42797#ifdef FREECIV_JSON_CONNECTION
42798 field_addr.name = "unit";
42799#endif /* FREECIV_JSON_CONNECTION */
42800 {
42801 int readin;
42802
42803 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42804 RECEIVE_PACKET_FIELD_ERROR(unit);
42805 }
42806 real_packet->unit = readin;
42807 }
42808#ifdef FREECIV_JSON_CONNECTION
42809 field_addr.name = "flag";
42810#endif /* FREECIV_JSON_CONNECTION */
42811 {
42812 int readin;
42813
42814 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42815 RECEIVE_PACKET_FIELD_ERROR(flag);
42816 }
42817 real_packet->flag = readin;
42818 }
42819#ifdef FREECIV_JSON_CONNECTION
42820 field_addr.name = "type";
42821#endif /* FREECIV_JSON_CONNECTION */
42822 {
42823 int readin;
42824
42825 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42826 RECEIVE_PACKET_FIELD_ERROR(type);
42827 }
42828 real_packet->type = readin;
42829 }
42830#ifdef FREECIV_JSON_CONNECTION
42831 field_addr.name = "value";
42832#endif /* FREECIV_JSON_CONNECTION */
42833 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->value)) {
42834 RECEIVE_PACKET_FIELD_ERROR(value);
42835 }
42836#ifdef FREECIV_JSON_CONNECTION
42837 field_addr.name = "quiet";
42838#endif /* FREECIV_JSON_CONNECTION */
42839 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->quiet)) {
42840 RECEIVE_PACKET_FIELD_ERROR(quiet);
42841 }
42842#endif
42843 log_packet_detailed("packet_ruleset_unit_bonus_100: got info about ()");
42844
42845#ifdef FREECIV_DELTA_PROTOCOL
42846 if (NULL == *hash) {
42847 *hash = genhash_new_full(hash_packet_ruleset_unit_bonus_100, cmp_packet_ruleset_unit_bonus_100,
42848 NULL, NULL, NULL, free);
42849 }
42850
42851 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
42852 *real_packet = *old;
42853 } else {
42854 log_packet_detailed(" no old info");
42855 memset(real_packet, 0, sizeof(*real_packet));
42856 }
42857
42858 if (BV_ISSET(fields, 0)) {
42859 log_packet_detailed(" got field 'unit'");
42860#ifdef FREECIV_JSON_CONNECTION
42861 field_addr.name = "unit";
42862#endif /* FREECIV_JSON_CONNECTION */
42863 {
42864 int readin;
42865
42866 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42867 RECEIVE_PACKET_FIELD_ERROR(unit);
42868 }
42869 real_packet->unit = readin;
42870 }
42871 }
42872 if (BV_ISSET(fields, 1)) {
42873 log_packet_detailed(" got field 'flag'");
42874#ifdef FREECIV_JSON_CONNECTION
42875 field_addr.name = "flag";
42876#endif /* FREECIV_JSON_CONNECTION */
42877 {
42878 int readin;
42879
42880 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42881 RECEIVE_PACKET_FIELD_ERROR(flag);
42882 }
42883 real_packet->flag = readin;
42884 }
42885 }
42886 if (BV_ISSET(fields, 2)) {
42887 log_packet_detailed(" got field 'type'");
42888#ifdef FREECIV_JSON_CONNECTION
42889 field_addr.name = "type";
42890#endif /* FREECIV_JSON_CONNECTION */
42891 {
42892 int readin;
42893
42894 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
42895 RECEIVE_PACKET_FIELD_ERROR(type);
42896 }
42897 real_packet->type = readin;
42898 }
42899 }
42900 if (BV_ISSET(fields, 3)) {
42901 log_packet_detailed(" got field 'value'");
42902#ifdef FREECIV_JSON_CONNECTION
42903 field_addr.name = "value";
42904#endif /* FREECIV_JSON_CONNECTION */
42905 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->value)) {
42906 RECEIVE_PACKET_FIELD_ERROR(value);
42907 }
42908 }
42909 real_packet->quiet = BV_ISSET(fields, 4);
42910
42911 if (NULL == old) {
42912 old = fc_malloc(sizeof(*old));
42913 *old = *real_packet;
42914 genhash_insert(*hash, old, old);
42915 } else {
42916 *old = *real_packet;
42917 }
42918
42919#endif /* FREECIV_DELTA_PROTOCOL */
42920 RECEIVE_PACKET_END(real_packet);
42921}
42922
42923 static int send_packet_ruleset_unit_bonus_100(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
42924{
42925 const struct packet_ruleset_unit_bonus *real_packet = packet;
42926 int e;
42927#ifdef FREECIV_DELTA_PROTOCOL
42928 packet_ruleset_unit_bonus_100_fields fields;
42929 struct packet_ruleset_unit_bonus *old;
42930 bool differ;
42931 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_BONUS;
42932#endif /* FREECIV_DELTA_PROTOCOL */
42933 SEND_PACKET_START(PACKET_RULESET_UNIT_BONUS);
42934#ifdef FREECIV_JSON_CONNECTION
42935 struct plocation field_addr;
42936 {
42937 struct plocation *field_addr_tmp = plocation_field_new(NULL);
42938 field_addr = *field_addr_tmp;
42939 FC_FREE(field_addr_tmp);
42940 }
42941#endif /* FREECIV_JSON_CONNECTION */
42942
42943 log_packet_detailed("packet_ruleset_unit_bonus_100: sending info about ()");
42944
42945#ifdef FREECIV_DELTA_PROTOCOL
42946 if (NULL == *hash) {
42947 *hash = genhash_new_full(hash_packet_ruleset_unit_bonus_100, cmp_packet_ruleset_unit_bonus_100,
42948 NULL, NULL, NULL, free);
42949 }
42950 BV_CLR_ALL(fields);
42951
42952 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
42953 old = fc_malloc(sizeof(*old));
42954 *old = *real_packet;
42955 genhash_insert(*hash, old, old);
42956 memset(old, 0, sizeof(*old));
42957 }
42958 differ = (old->unit != real_packet->unit);
42959 if (differ) {
42960 BV_SET(fields, 0);
42961 }
42962
42963 differ = (old->flag != real_packet->flag);
42964 if (differ) {
42965 BV_SET(fields, 1);
42966 }
42967
42968 differ = (old->type != real_packet->type);
42969 if (differ) {
42970 BV_SET(fields, 2);
42971 }
42972
42973 differ = (old->value != real_packet->value);
42974 if (differ) {
42975 BV_SET(fields, 3);
42976 }
42977
42978 if (packet->quiet) {
42979 BV_SET(fields, 4);
42980 }
42981
42982
42983#ifdef FREECIV_JSON_CONNECTION
42984 field_addr.name = "fields";
42985#endif /* FREECIV_JSON_CONNECTION */
42986 e = 0;
42987 e |= DIO_BV_PUT(&dout, &field_addr, fields);
42988 if (e) {
42989 log_packet_detailed("fields bitvector error detected");
42990 }
42991
42992 if (BV_ISSET(fields, 0)) {
42993 log_packet_detailed(" field 'unit' has changed");
42994#ifdef FREECIV_JSON_CONNECTION
42995 field_addr.name = "unit";
42996#endif /* FREECIV_JSON_CONNECTION */
42997 e = 0;
42998 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->unit);
42999 if (e) {
43000 log_packet_detailed("'unit' field error detected");
43001 }
43002 }
43003 if (BV_ISSET(fields, 1)) {
43004 log_packet_detailed(" field 'flag' has changed");
43005#ifdef FREECIV_JSON_CONNECTION
43006 field_addr.name = "flag";
43007#endif /* FREECIV_JSON_CONNECTION */
43008 e = 0;
43009 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->flag);
43010 if (e) {
43011 log_packet_detailed("'flag' field error detected");
43012 }
43013 }
43014 if (BV_ISSET(fields, 2)) {
43015 log_packet_detailed(" field 'type' has changed");
43016#ifdef FREECIV_JSON_CONNECTION
43017 field_addr.name = "type";
43018#endif /* FREECIV_JSON_CONNECTION */
43019 e = 0;
43020 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
43021 if (e) {
43022 log_packet_detailed("'type' field error detected");
43023 }
43024 }
43025 if (BV_ISSET(fields, 3)) {
43026 log_packet_detailed(" field 'value' has changed");
43027#ifdef FREECIV_JSON_CONNECTION
43028 field_addr.name = "value";
43029#endif /* FREECIV_JSON_CONNECTION */
43030 e = 0;
43031 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->value);
43032 if (e) {
43033 log_packet_detailed("'value' field error detected");
43034 }
43035 }
43036 /* field 4 is folded into the header */
43037
43038 *old = *real_packet;
43039#endif /* FREECIV_DELTA_PROTOCOL */
43040#ifndef FREECIV_DELTA_PROTOCOL
43041#ifdef FREECIV_JSON_CONNECTION
43042 field_addr.name = "unit";
43043#endif /* FREECIV_JSON_CONNECTION */
43044 e = 0;
43045 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->unit);
43046 if (e) {
43047 log_packet_detailed("'unit' field error detected");
43048 }
43049#ifdef FREECIV_JSON_CONNECTION
43050 field_addr.name = "flag";
43051#endif /* FREECIV_JSON_CONNECTION */
43052 e = 0;
43053 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->flag);
43054 if (e) {
43055 log_packet_detailed("'flag' field error detected");
43056 }
43057#ifdef FREECIV_JSON_CONNECTION
43058 field_addr.name = "type";
43059#endif /* FREECIV_JSON_CONNECTION */
43060 e = 0;
43061 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
43062 if (e) {
43063 log_packet_detailed("'type' field error detected");
43064 }
43065#ifdef FREECIV_JSON_CONNECTION
43066 field_addr.name = "value";
43067#endif /* FREECIV_JSON_CONNECTION */
43068 e = 0;
43069 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->value);
43070 if (e) {
43071 log_packet_detailed("'value' field error detected");
43072 }
43073#ifdef FREECIV_JSON_CONNECTION
43074 field_addr.name = "quiet";
43075#endif /* FREECIV_JSON_CONNECTION */
43076 e = 0;
43077 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->quiet);
43078 if (e) {
43079 log_packet_detailed("'quiet' field error detected");
43080 }
43081
43082#endif
43083 SEND_PACKET_END(PACKET_RULESET_UNIT_BONUS);
43084}
43085
43086 int send_packet_ruleset_unit_bonus(struct connection *pc, const struct packet_ruleset_unit_bonus *packet)
43087{
43088 if (!pc->used) {
43089 log_error("WARNING: trying to send data to the closed connection %s",
43090 conn_description(pc));
43091 return -1;
43092 }
43093 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_BONUS].packet != NULL, -1,
43094 "Handler for PACKET_RULESET_UNIT_BONUS not installed");
43095 return pc->phs.handlers->send[PACKET_RULESET_UNIT_BONUS].packet(pc, packet);
43096}
43097
43098 void lsend_packet_ruleset_unit_bonus(struct conn_list *dest, const struct packet_ruleset_unit_bonus *packet)
43099{
43100 conn_list_iterate(dest, pconn) {
43101 send_packet_ruleset_unit_bonus(pconn, packet);
43102 } conn_list_iterate_end;
43103}
43104
43105#ifdef FREECIV_DELTA_PROTOCOL
43106#define hash_packet_ruleset_unit_flag_100 hash_const
43107
43108#define cmp_packet_ruleset_unit_flag_100 cmp_const
43109
43110 BV_DEFINE(packet_ruleset_unit_flag_100_fields, 3);
43111#endif /* FREECIV_DELTA_PROTOCOL */
43112
43113 static struct packet_ruleset_unit_flag *receive_packet_ruleset_unit_flag_100(struct connection *pc)
43114{
43115#ifdef FREECIV_DELTA_PROTOCOL
43116 packet_ruleset_unit_flag_100_fields fields;
43117 struct packet_ruleset_unit_flag *old;
43118 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_FLAG;
43119#endif /* FREECIV_DELTA_PROTOCOL */
43120 RECEIVE_PACKET_START(packet_ruleset_unit_flag, real_packet);
43121#ifdef FREECIV_JSON_CONNECTION
43122 struct plocation field_addr;
43123 {
43124 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43125 field_addr = *field_addr_tmp;
43126 FC_FREE(field_addr_tmp);
43127 }
43128#endif /* FREECIV_JSON_CONNECTION */
43129
43130#ifdef FREECIV_DELTA_PROTOCOL
43131#ifdef FREECIV_JSON_CONNECTION
43132 field_addr.name = "fields";
43133#endif /* FREECIV_JSON_CONNECTION */
43134 DIO_BV_GET(&din, &field_addr, fields);
43135
43136#else /* FREECIV_DELTA_PROTOCOL */
43137#ifdef FREECIV_JSON_CONNECTION
43138 field_addr.name = "id";
43139#endif /* FREECIV_JSON_CONNECTION */
43140 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
43141 RECEIVE_PACKET_FIELD_ERROR(id);
43142 }
43143#ifdef FREECIV_JSON_CONNECTION
43144 field_addr.name = "name";
43145#endif /* FREECIV_JSON_CONNECTION */
43146 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
43147 RECEIVE_PACKET_FIELD_ERROR(name);
43148 }
43149#ifdef FREECIV_JSON_CONNECTION
43150 field_addr.name = "helptxt";
43151#endif /* FREECIV_JSON_CONNECTION */
43152 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
43153 RECEIVE_PACKET_FIELD_ERROR(helptxt);
43154 }
43155#endif
43156 log_packet_detailed("packet_ruleset_unit_flag_100: got info about ()");
43157
43158#ifdef FREECIV_DELTA_PROTOCOL
43159 if (NULL == *hash) {
43160 *hash = genhash_new_full(hash_packet_ruleset_unit_flag_100, cmp_packet_ruleset_unit_flag_100,
43161 NULL, NULL, NULL, free);
43162 }
43163
43164 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
43165 *real_packet = *old;
43166 } else {
43167 log_packet_detailed(" no old info");
43168 memset(real_packet, 0, sizeof(*real_packet));
43169 }
43170
43171 if (BV_ISSET(fields, 0)) {
43172 log_packet_detailed(" got field 'id'");
43173#ifdef FREECIV_JSON_CONNECTION
43174 field_addr.name = "id";
43175#endif /* FREECIV_JSON_CONNECTION */
43176 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
43177 RECEIVE_PACKET_FIELD_ERROR(id);
43178 }
43179 }
43180 if (BV_ISSET(fields, 1)) {
43181 log_packet_detailed(" got field 'name'");
43182#ifdef FREECIV_JSON_CONNECTION
43183 field_addr.name = "name";
43184#endif /* FREECIV_JSON_CONNECTION */
43185 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
43186 RECEIVE_PACKET_FIELD_ERROR(name);
43187 }
43188 }
43189 if (BV_ISSET(fields, 2)) {
43190 log_packet_detailed(" got field 'helptxt'");
43191#ifdef FREECIV_JSON_CONNECTION
43192 field_addr.name = "helptxt";
43193#endif /* FREECIV_JSON_CONNECTION */
43194 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
43195 RECEIVE_PACKET_FIELD_ERROR(helptxt);
43196 }
43197 }
43198
43199 if (NULL == old) {
43200 old = fc_malloc(sizeof(*old));
43201 *old = *real_packet;
43202 genhash_insert(*hash, old, old);
43203 } else {
43204 *old = *real_packet;
43205 }
43206
43207#endif /* FREECIV_DELTA_PROTOCOL */
43208 RECEIVE_PACKET_END(real_packet);
43209}
43210
43211 static int send_packet_ruleset_unit_flag_100(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
43212{
43213 const struct packet_ruleset_unit_flag *real_packet = packet;
43214 int e;
43215#ifdef FREECIV_DELTA_PROTOCOL
43216 packet_ruleset_unit_flag_100_fields fields;
43217 struct packet_ruleset_unit_flag *old;
43218 bool differ;
43219 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_FLAG;
43220#endif /* FREECIV_DELTA_PROTOCOL */
43221 SEND_PACKET_START(PACKET_RULESET_UNIT_FLAG);
43222#ifdef FREECIV_JSON_CONNECTION
43223 struct plocation field_addr;
43224 {
43225 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43226 field_addr = *field_addr_tmp;
43227 FC_FREE(field_addr_tmp);
43228 }
43229#endif /* FREECIV_JSON_CONNECTION */
43230
43231 log_packet_detailed("packet_ruleset_unit_flag_100: sending info about ()");
43232
43233#ifdef FREECIV_DELTA_PROTOCOL
43234 if (NULL == *hash) {
43235 *hash = genhash_new_full(hash_packet_ruleset_unit_flag_100, cmp_packet_ruleset_unit_flag_100,
43236 NULL, NULL, NULL, free);
43237 }
43238 BV_CLR_ALL(fields);
43239
43240 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
43241 old = fc_malloc(sizeof(*old));
43242 *old = *real_packet;
43243 genhash_insert(*hash, old, old);
43244 memset(old, 0, sizeof(*old));
43245 }
43246 differ = (old->id != real_packet->id);
43247 if (differ) {
43248 BV_SET(fields, 0);
43249 }
43250
43251 differ = (strcmp(old->name, real_packet->name) != 0);
43252 if (differ) {
43253 BV_SET(fields, 1);
43254 }
43255
43256 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
43257 if (differ) {
43258 BV_SET(fields, 2);
43259 }
43260
43261
43262#ifdef FREECIV_JSON_CONNECTION
43263 field_addr.name = "fields";
43264#endif /* FREECIV_JSON_CONNECTION */
43265 e = 0;
43266 e |= DIO_BV_PUT(&dout, &field_addr, fields);
43267 if (e) {
43268 log_packet_detailed("fields bitvector error detected");
43269 }
43270
43271 if (BV_ISSET(fields, 0)) {
43272 log_packet_detailed(" field 'id' has changed");
43273#ifdef FREECIV_JSON_CONNECTION
43274 field_addr.name = "id";
43275#endif /* FREECIV_JSON_CONNECTION */
43276 e = 0;
43277 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
43278 if (e) {
43279 log_packet_detailed("'id' field error detected");
43280 }
43281 }
43282 if (BV_ISSET(fields, 1)) {
43283 log_packet_detailed(" field 'name' has changed");
43284#ifdef FREECIV_JSON_CONNECTION
43285 field_addr.name = "name";
43286#endif /* FREECIV_JSON_CONNECTION */
43287 e = 0;
43288 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
43289 if (e) {
43290 log_packet_detailed("'name' field error detected");
43291 }
43292 }
43293 if (BV_ISSET(fields, 2)) {
43294 log_packet_detailed(" field 'helptxt' has changed");
43295#ifdef FREECIV_JSON_CONNECTION
43296 field_addr.name = "helptxt";
43297#endif /* FREECIV_JSON_CONNECTION */
43298 e = 0;
43299 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
43300 if (e) {
43301 log_packet_detailed("'helptxt' field error detected");
43302 }
43303 }
43304
43305 *old = *real_packet;
43306#endif /* FREECIV_DELTA_PROTOCOL */
43307#ifndef FREECIV_DELTA_PROTOCOL
43308#ifdef FREECIV_JSON_CONNECTION
43309 field_addr.name = "id";
43310#endif /* FREECIV_JSON_CONNECTION */
43311 e = 0;
43312 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
43313 if (e) {
43314 log_packet_detailed("'id' field error detected");
43315 }
43316#ifdef FREECIV_JSON_CONNECTION
43317 field_addr.name = "name";
43318#endif /* FREECIV_JSON_CONNECTION */
43319 e = 0;
43320 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
43321 if (e) {
43322 log_packet_detailed("'name' field error detected");
43323 }
43324#ifdef FREECIV_JSON_CONNECTION
43325 field_addr.name = "helptxt";
43326#endif /* FREECIV_JSON_CONNECTION */
43327 e = 0;
43328 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
43329 if (e) {
43330 log_packet_detailed("'helptxt' field error detected");
43331 }
43332
43333#endif
43334 SEND_PACKET_END(PACKET_RULESET_UNIT_FLAG);
43335}
43336
43337 int send_packet_ruleset_unit_flag(struct connection *pc, const struct packet_ruleset_unit_flag *packet)
43338{
43339 if (!pc->used) {
43340 log_error("WARNING: trying to send data to the closed connection %s",
43341 conn_description(pc));
43342 return -1;
43343 }
43344 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_FLAG].packet != NULL, -1,
43345 "Handler for PACKET_RULESET_UNIT_FLAG not installed");
43346 return pc->phs.handlers->send[PACKET_RULESET_UNIT_FLAG].packet(pc, packet);
43347}
43348
43349 void lsend_packet_ruleset_unit_flag(struct conn_list *dest, const struct packet_ruleset_unit_flag *packet)
43350{
43351 conn_list_iterate(dest, pconn) {
43352 send_packet_ruleset_unit_flag(pconn, packet);
43353 } conn_list_iterate_end;
43354}
43355
43356#ifdef FREECIV_DELTA_PROTOCOL
43357#define hash_packet_ruleset_unit_class_flag_100 hash_const
43358
43359#define cmp_packet_ruleset_unit_class_flag_100 cmp_const
43360
43361 BV_DEFINE(packet_ruleset_unit_class_flag_100_fields, 3);
43362#endif /* FREECIV_DELTA_PROTOCOL */
43363
43364 static struct packet_ruleset_unit_class_flag *receive_packet_ruleset_unit_class_flag_100(struct connection *pc)
43365{
43366#ifdef FREECIV_DELTA_PROTOCOL
43367 packet_ruleset_unit_class_flag_100_fields fields;
43368 struct packet_ruleset_unit_class_flag *old;
43369 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_CLASS_FLAG;
43370#endif /* FREECIV_DELTA_PROTOCOL */
43371 RECEIVE_PACKET_START(packet_ruleset_unit_class_flag, real_packet);
43372#ifdef FREECIV_JSON_CONNECTION
43373 struct plocation field_addr;
43374 {
43375 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43376 field_addr = *field_addr_tmp;
43377 FC_FREE(field_addr_tmp);
43378 }
43379#endif /* FREECIV_JSON_CONNECTION */
43380
43381#ifdef FREECIV_DELTA_PROTOCOL
43382#ifdef FREECIV_JSON_CONNECTION
43383 field_addr.name = "fields";
43384#endif /* FREECIV_JSON_CONNECTION */
43385 DIO_BV_GET(&din, &field_addr, fields);
43386
43387#else /* FREECIV_DELTA_PROTOCOL */
43388#ifdef FREECIV_JSON_CONNECTION
43389 field_addr.name = "id";
43390#endif /* FREECIV_JSON_CONNECTION */
43391 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
43392 RECEIVE_PACKET_FIELD_ERROR(id);
43393 }
43394#ifdef FREECIV_JSON_CONNECTION
43395 field_addr.name = "name";
43396#endif /* FREECIV_JSON_CONNECTION */
43397 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
43398 RECEIVE_PACKET_FIELD_ERROR(name);
43399 }
43400#ifdef FREECIV_JSON_CONNECTION
43401 field_addr.name = "helptxt";
43402#endif /* FREECIV_JSON_CONNECTION */
43403 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
43404 RECEIVE_PACKET_FIELD_ERROR(helptxt);
43405 }
43406#endif
43407 log_packet_detailed("packet_ruleset_unit_class_flag_100: got info about ()");
43408
43409#ifdef FREECIV_DELTA_PROTOCOL
43410 if (NULL == *hash) {
43411 *hash = genhash_new_full(hash_packet_ruleset_unit_class_flag_100, cmp_packet_ruleset_unit_class_flag_100,
43412 NULL, NULL, NULL, free);
43413 }
43414
43415 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
43416 *real_packet = *old;
43417 } else {
43418 log_packet_detailed(" no old info");
43419 memset(real_packet, 0, sizeof(*real_packet));
43420 }
43421
43422 if (BV_ISSET(fields, 0)) {
43423 log_packet_detailed(" got field 'id'");
43424#ifdef FREECIV_JSON_CONNECTION
43425 field_addr.name = "id";
43426#endif /* FREECIV_JSON_CONNECTION */
43427 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
43428 RECEIVE_PACKET_FIELD_ERROR(id);
43429 }
43430 }
43431 if (BV_ISSET(fields, 1)) {
43432 log_packet_detailed(" got field 'name'");
43433#ifdef FREECIV_JSON_CONNECTION
43434 field_addr.name = "name";
43435#endif /* FREECIV_JSON_CONNECTION */
43436 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
43437 RECEIVE_PACKET_FIELD_ERROR(name);
43438 }
43439 }
43440 if (BV_ISSET(fields, 2)) {
43441 log_packet_detailed(" got field 'helptxt'");
43442#ifdef FREECIV_JSON_CONNECTION
43443 field_addr.name = "helptxt";
43444#endif /* FREECIV_JSON_CONNECTION */
43445 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
43446 RECEIVE_PACKET_FIELD_ERROR(helptxt);
43447 }
43448 }
43449
43450 if (NULL == old) {
43451 old = fc_malloc(sizeof(*old));
43452 *old = *real_packet;
43453 genhash_insert(*hash, old, old);
43454 } else {
43455 *old = *real_packet;
43456 }
43457
43458#endif /* FREECIV_DELTA_PROTOCOL */
43459 RECEIVE_PACKET_END(real_packet);
43460}
43461
43462 static int send_packet_ruleset_unit_class_flag_100(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
43463{
43464 const struct packet_ruleset_unit_class_flag *real_packet = packet;
43465 int e;
43466#ifdef FREECIV_DELTA_PROTOCOL
43467 packet_ruleset_unit_class_flag_100_fields fields;
43468 struct packet_ruleset_unit_class_flag *old;
43469 bool differ;
43470 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_CLASS_FLAG;
43471#endif /* FREECIV_DELTA_PROTOCOL */
43472 SEND_PACKET_START(PACKET_RULESET_UNIT_CLASS_FLAG);
43473#ifdef FREECIV_JSON_CONNECTION
43474 struct plocation field_addr;
43475 {
43476 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43477 field_addr = *field_addr_tmp;
43478 FC_FREE(field_addr_tmp);
43479 }
43480#endif /* FREECIV_JSON_CONNECTION */
43481
43482 log_packet_detailed("packet_ruleset_unit_class_flag_100: sending info about ()");
43483
43484#ifdef FREECIV_DELTA_PROTOCOL
43485 if (NULL == *hash) {
43486 *hash = genhash_new_full(hash_packet_ruleset_unit_class_flag_100, cmp_packet_ruleset_unit_class_flag_100,
43487 NULL, NULL, NULL, free);
43488 }
43489 BV_CLR_ALL(fields);
43490
43491 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
43492 old = fc_malloc(sizeof(*old));
43493 *old = *real_packet;
43494 genhash_insert(*hash, old, old);
43495 memset(old, 0, sizeof(*old));
43496 }
43497 differ = (old->id != real_packet->id);
43498 if (differ) {
43499 BV_SET(fields, 0);
43500 }
43501
43502 differ = (strcmp(old->name, real_packet->name) != 0);
43503 if (differ) {
43504 BV_SET(fields, 1);
43505 }
43506
43507 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
43508 if (differ) {
43509 BV_SET(fields, 2);
43510 }
43511
43512
43513#ifdef FREECIV_JSON_CONNECTION
43514 field_addr.name = "fields";
43515#endif /* FREECIV_JSON_CONNECTION */
43516 e = 0;
43517 e |= DIO_BV_PUT(&dout, &field_addr, fields);
43518 if (e) {
43519 log_packet_detailed("fields bitvector error detected");
43520 }
43521
43522 if (BV_ISSET(fields, 0)) {
43523 log_packet_detailed(" field 'id' has changed");
43524#ifdef FREECIV_JSON_CONNECTION
43525 field_addr.name = "id";
43526#endif /* FREECIV_JSON_CONNECTION */
43527 e = 0;
43528 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
43529 if (e) {
43530 log_packet_detailed("'id' field error detected");
43531 }
43532 }
43533 if (BV_ISSET(fields, 1)) {
43534 log_packet_detailed(" field 'name' has changed");
43535#ifdef FREECIV_JSON_CONNECTION
43536 field_addr.name = "name";
43537#endif /* FREECIV_JSON_CONNECTION */
43538 e = 0;
43539 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
43540 if (e) {
43541 log_packet_detailed("'name' field error detected");
43542 }
43543 }
43544 if (BV_ISSET(fields, 2)) {
43545 log_packet_detailed(" field 'helptxt' has changed");
43546#ifdef FREECIV_JSON_CONNECTION
43547 field_addr.name = "helptxt";
43548#endif /* FREECIV_JSON_CONNECTION */
43549 e = 0;
43550 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
43551 if (e) {
43552 log_packet_detailed("'helptxt' field error detected");
43553 }
43554 }
43555
43556 *old = *real_packet;
43557#endif /* FREECIV_DELTA_PROTOCOL */
43558#ifndef FREECIV_DELTA_PROTOCOL
43559#ifdef FREECIV_JSON_CONNECTION
43560 field_addr.name = "id";
43561#endif /* FREECIV_JSON_CONNECTION */
43562 e = 0;
43563 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
43564 if (e) {
43565 log_packet_detailed("'id' field error detected");
43566 }
43567#ifdef FREECIV_JSON_CONNECTION
43568 field_addr.name = "name";
43569#endif /* FREECIV_JSON_CONNECTION */
43570 e = 0;
43571 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
43572 if (e) {
43573 log_packet_detailed("'name' field error detected");
43574 }
43575#ifdef FREECIV_JSON_CONNECTION
43576 field_addr.name = "helptxt";
43577#endif /* FREECIV_JSON_CONNECTION */
43578 e = 0;
43579 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
43580 if (e) {
43581 log_packet_detailed("'helptxt' field error detected");
43582 }
43583
43584#endif
43585 SEND_PACKET_END(PACKET_RULESET_UNIT_CLASS_FLAG);
43586}
43587
43588 int send_packet_ruleset_unit_class_flag(struct connection *pc, const struct packet_ruleset_unit_class_flag *packet)
43589{
43590 if (!pc->used) {
43591 log_error("WARNING: trying to send data to the closed connection %s",
43592 conn_description(pc));
43593 return -1;
43594 }
43595 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet != NULL, -1,
43596 "Handler for PACKET_RULESET_UNIT_CLASS_FLAG not installed");
43597 return pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet(pc, packet);
43598}
43599
43600 void lsend_packet_ruleset_unit_class_flag(struct conn_list *dest, const struct packet_ruleset_unit_class_flag *packet)
43601{
43602 conn_list_iterate(dest, pconn) {
43603 send_packet_ruleset_unit_class_flag(pconn, packet);
43604 } conn_list_iterate_end;
43605}
43606
43607#ifdef FREECIV_DELTA_PROTOCOL
43608#define hash_packet_ruleset_game_100 hash_const
43609
43610#define cmp_packet_ruleset_game_100 cmp_const
43611
43612 BV_DEFINE(packet_ruleset_game_100_fields, 14);
43613#endif /* FREECIV_DELTA_PROTOCOL */
43614
43615 static struct packet_ruleset_game *receive_packet_ruleset_game_100(struct connection *pc)
43616{
43617#ifdef FREECIV_DELTA_PROTOCOL
43618 packet_ruleset_game_100_fields fields;
43619 struct packet_ruleset_game *old;
43620 struct genhash **hash = pc->phs.received + PACKET_RULESET_GAME;
43621#endif /* FREECIV_DELTA_PROTOCOL */
43622 RECEIVE_PACKET_START(packet_ruleset_game, real_packet);
43623#ifdef FREECIV_JSON_CONNECTION
43624 struct plocation field_addr;
43625 {
43626 struct plocation *field_addr_tmp = plocation_field_new(NULL);
43627 field_addr = *field_addr_tmp;
43628 FC_FREE(field_addr_tmp);
43629 }
43630#endif /* FREECIV_JSON_CONNECTION */
43631
43632#ifdef FREECIV_DELTA_PROTOCOL
43633#ifdef FREECIV_JSON_CONNECTION
43634 field_addr.name = "fields";
43635#endif /* FREECIV_JSON_CONNECTION */
43636 DIO_BV_GET(&din, &field_addr, fields);
43637
43638#else /* FREECIV_DELTA_PROTOCOL */
43639#ifdef FREECIV_JSON_CONNECTION
43640 field_addr.name = "default_specialist";
43641#endif /* FREECIV_JSON_CONNECTION */
43642 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->default_specialist)) {
43643 RECEIVE_PACKET_FIELD_ERROR(default_specialist);
43644 }
43645#ifdef FREECIV_JSON_CONNECTION
43646 field_addr.name = "global_init_techs_count";
43647#endif /* FREECIV_JSON_CONNECTION */
43648 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs_count)) {
43649 RECEIVE_PACKET_FIELD_ERROR(global_init_techs_count);
43650 }
43651#ifdef FREECIV_JSON_CONNECTION
43652 field_addr.name = "global_init_techs";
43653#endif /* FREECIV_JSON_CONNECTION */
43654 {
43655 int i;
43656
43657#ifdef FREECIV_JSON_CONNECTION
43658 /* Enter array. */
43659 field_addr.sub_location = plocation_elem_new(0);
43660#endif /* FREECIV_JSON_CONNECTION */
43661
43662 if (real_packet->global_init_techs_count > MAX_NUM_TECH_LIST) {
43663 RECEIVE_PACKET_FIELD_ERROR(global_init_techs, ": truncation array");
43664 }
43665 for (i = 0; i < real_packet->global_init_techs_count; i++) {
43666#ifdef FREECIV_JSON_CONNECTION
43667 field_addr.sub_location->number = i;
43668#endif /* FREECIV_JSON_CONNECTION */
43669 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_init_techs[i])) {
43670 RECEIVE_PACKET_FIELD_ERROR(global_init_techs);
43671 }
43672 }
43673
43674#ifdef FREECIV_JSON_CONNECTION
43675 /* Exit array. */
43676 FC_FREE(field_addr.sub_location);
43677#endif /* FREECIV_JSON_CONNECTION */
43678 }
43679#ifdef FREECIV_JSON_CONNECTION
43680 field_addr.name = "global_init_buildings_count";
43681#endif /* FREECIV_JSON_CONNECTION */
43682 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_buildings_count)) {
43683 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings_count);
43684 }
43685#ifdef FREECIV_JSON_CONNECTION
43686 field_addr.name = "global_init_buildings";
43687#endif /* FREECIV_JSON_CONNECTION */
43688 {
43689 int i;
43690
43691#ifdef FREECIV_JSON_CONNECTION
43692 /* Enter array. */
43693 field_addr.sub_location = plocation_elem_new(0);
43694#endif /* FREECIV_JSON_CONNECTION */
43695
43696 if (real_packet->global_init_buildings_count > MAX_NUM_BUILDING_LIST) {
43697 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings, ": truncation array");
43698 }
43699 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
43700#ifdef FREECIV_JSON_CONNECTION
43701 field_addr.sub_location->number = i;
43702#endif /* FREECIV_JSON_CONNECTION */
43703 {
43704 int readin;
43705
43706 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
43707 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings);
43708 }
43709 real_packet->global_init_buildings[i] = readin;
43710 }
43711 }
43712
43713#ifdef FREECIV_JSON_CONNECTION
43714 /* Exit array. */
43715 FC_FREE(field_addr.sub_location);
43716#endif /* FREECIV_JSON_CONNECTION */
43717 }
43718#ifdef FREECIV_JSON_CONNECTION
43719 field_addr.name = "veteran_levels";
43720#endif /* FREECIV_JSON_CONNECTION */
43721 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
43722 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
43723 }
43724#ifdef FREECIV_JSON_CONNECTION
43725 field_addr.name = "veteran_name";
43726#endif /* FREECIV_JSON_CONNECTION */
43727 {
43728 int i;
43729
43730#ifdef FREECIV_JSON_CONNECTION
43731 /* Enter array. */
43732 field_addr.sub_location = plocation_elem_new(0);
43733#endif /* FREECIV_JSON_CONNECTION */
43734
43735 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
43736 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
43737 }
43738 for (i = 0; i < real_packet->veteran_levels; i++) {
43739#ifdef FREECIV_JSON_CONNECTION
43740 field_addr.sub_location->number = i;
43741#endif /* FREECIV_JSON_CONNECTION */
43742 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
43743 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
43744 }
43745 }
43746
43747#ifdef FREECIV_JSON_CONNECTION
43748 /* Exit array. */
43749 FC_FREE(field_addr.sub_location);
43750#endif /* FREECIV_JSON_CONNECTION */
43751 }
43752#ifdef FREECIV_JSON_CONNECTION
43753 field_addr.name = "power_fact";
43754#endif /* FREECIV_JSON_CONNECTION */
43755 {
43756 int i;
43757
43758#ifdef FREECIV_JSON_CONNECTION
43759 /* Enter array. */
43760 field_addr.sub_location = plocation_elem_new(0);
43761#endif /* FREECIV_JSON_CONNECTION */
43762
43763 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
43764 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
43765 }
43766 for (i = 0; i < real_packet->veteran_levels; i++) {
43767#ifdef FREECIV_JSON_CONNECTION
43768 field_addr.sub_location->number = i;
43769#endif /* FREECIV_JSON_CONNECTION */
43770 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
43771 RECEIVE_PACKET_FIELD_ERROR(power_fact);
43772 }
43773 }
43774
43775#ifdef FREECIV_JSON_CONNECTION
43776 /* Exit array. */
43777 FC_FREE(field_addr.sub_location);
43778#endif /* FREECIV_JSON_CONNECTION */
43779 }
43780#ifdef FREECIV_JSON_CONNECTION
43781 field_addr.name = "move_bonus";
43782#endif /* FREECIV_JSON_CONNECTION */
43783 {
43784 int i;
43785
43786#ifdef FREECIV_JSON_CONNECTION
43787 /* Enter array. */
43788 field_addr.sub_location = plocation_elem_new(0);
43789#endif /* FREECIV_JSON_CONNECTION */
43790
43791 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
43792 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
43793 }
43794 for (i = 0; i < real_packet->veteran_levels; i++) {
43795#ifdef FREECIV_JSON_CONNECTION
43796 field_addr.sub_location->number = i;
43797#endif /* FREECIV_JSON_CONNECTION */
43798 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
43799 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
43800 }
43801 }
43802
43803#ifdef FREECIV_JSON_CONNECTION
43804 /* Exit array. */
43805 FC_FREE(field_addr.sub_location);
43806#endif /* FREECIV_JSON_CONNECTION */
43807 }
43808#ifdef FREECIV_JSON_CONNECTION
43809 field_addr.name = "base_raise_chance";
43810#endif /* FREECIV_JSON_CONNECTION */
43811 {
43812 int i;
43813
43814#ifdef FREECIV_JSON_CONNECTION
43815 /* Enter array. */
43816 field_addr.sub_location = plocation_elem_new(0);
43817#endif /* FREECIV_JSON_CONNECTION */
43818
43819 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
43820 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
43821 }
43822 for (i = 0; i < real_packet->veteran_levels; i++) {
43823#ifdef FREECIV_JSON_CONNECTION
43824 field_addr.sub_location->number = i;
43825#endif /* FREECIV_JSON_CONNECTION */
43826 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
43827 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
43828 }
43829 }
43830
43831#ifdef FREECIV_JSON_CONNECTION
43832 /* Exit array. */
43833 FC_FREE(field_addr.sub_location);
43834#endif /* FREECIV_JSON_CONNECTION */
43835 }
43836#ifdef FREECIV_JSON_CONNECTION
43837 field_addr.name = "work_raise_chance";
43838#endif /* FREECIV_JSON_CONNECTION */
43839 {
43840 int i;
43841
43842#ifdef FREECIV_JSON_CONNECTION
43843 /* Enter array. */
43844 field_addr.sub_location = plocation_elem_new(0);
43845#endif /* FREECIV_JSON_CONNECTION */
43846
43847 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
43848 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
43849 }
43850 for (i = 0; i < real_packet->veteran_levels; i++) {
43851#ifdef FREECIV_JSON_CONNECTION
43852 field_addr.sub_location->number = i;
43853#endif /* FREECIV_JSON_CONNECTION */
43854 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
43855 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
43856 }
43857 }
43858
43859#ifdef FREECIV_JSON_CONNECTION
43860 /* Exit array. */
43861 FC_FREE(field_addr.sub_location);
43862#endif /* FREECIV_JSON_CONNECTION */
43863 }
43864#ifdef FREECIV_JSON_CONNECTION
43865 field_addr.name = "background_red";
43866#endif /* FREECIV_JSON_CONNECTION */
43867 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_red)) {
43868 RECEIVE_PACKET_FIELD_ERROR(background_red);
43869 }
43870#ifdef FREECIV_JSON_CONNECTION
43871 field_addr.name = "background_green";
43872#endif /* FREECIV_JSON_CONNECTION */
43873 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_green)) {
43874 RECEIVE_PACKET_FIELD_ERROR(background_green);
43875 }
43876#ifdef FREECIV_JSON_CONNECTION
43877 field_addr.name = "background_blue";
43878#endif /* FREECIV_JSON_CONNECTION */
43879 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_blue)) {
43880 RECEIVE_PACKET_FIELD_ERROR(background_blue);
43881 }
43882#endif
43883 log_packet_detailed("packet_ruleset_game_100: got info about ()");
43884
43885#ifdef FREECIV_DELTA_PROTOCOL
43886 if (NULL == *hash) {
43887 *hash = genhash_new_full(hash_packet_ruleset_game_100, cmp_packet_ruleset_game_100,
43888 NULL, NULL, NULL, free);
43889 }
43890
43891 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
43892 *real_packet = *old;
43893 } else {
43894 log_packet_detailed(" no old info");
43895 memset(real_packet, 0, sizeof(*real_packet));
43896 }
43897
43898 if (BV_ISSET(fields, 0)) {
43899 log_packet_detailed(" got field 'default_specialist'");
43900#ifdef FREECIV_JSON_CONNECTION
43901 field_addr.name = "default_specialist";
43902#endif /* FREECIV_JSON_CONNECTION */
43903 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->default_specialist)) {
43904 RECEIVE_PACKET_FIELD_ERROR(default_specialist);
43905 }
43906 }
43907 if (BV_ISSET(fields, 1)) {
43908 log_packet_detailed(" got field 'global_init_techs_count'");
43909#ifdef FREECIV_JSON_CONNECTION
43910 field_addr.name = "global_init_techs_count";
43911#endif /* FREECIV_JSON_CONNECTION */
43912 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_techs_count)) {
43913 RECEIVE_PACKET_FIELD_ERROR(global_init_techs_count);
43914 }
43915 }
43916 if (BV_ISSET(fields, 2)) {
43917 log_packet_detailed(" got field 'global_init_techs'");
43918#ifdef FREECIV_JSON_CONNECTION
43919 field_addr.name = "global_init_techs";
43920#endif /* FREECIV_JSON_CONNECTION */
43921 {
43922 int i;
43923
43924#ifdef FREECIV_JSON_CONNECTION
43925 /* Enter array. */
43926 field_addr.sub_location = plocation_elem_new(0);
43927#endif /* FREECIV_JSON_CONNECTION */
43928
43929 if (real_packet->global_init_techs_count > MAX_NUM_TECH_LIST) {
43930 RECEIVE_PACKET_FIELD_ERROR(global_init_techs, ": truncation array");
43931 }
43932 for (i = 0; i < real_packet->global_init_techs_count; i++) {
43933#ifdef FREECIV_JSON_CONNECTION
43934 field_addr.sub_location->number = i;
43935#endif /* FREECIV_JSON_CONNECTION */
43936 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->global_init_techs[i])) {
43937 RECEIVE_PACKET_FIELD_ERROR(global_init_techs);
43938 }
43939 }
43940
43941#ifdef FREECIV_JSON_CONNECTION
43942 /* Exit array. */
43943 FC_FREE(field_addr.sub_location);
43944#endif /* FREECIV_JSON_CONNECTION */
43945 }
43946 }
43947 if (BV_ISSET(fields, 3)) {
43948 log_packet_detailed(" got field 'global_init_buildings_count'");
43949#ifdef FREECIV_JSON_CONNECTION
43950 field_addr.name = "global_init_buildings_count";
43951#endif /* FREECIV_JSON_CONNECTION */
43952 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->global_init_buildings_count)) {
43953 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings_count);
43954 }
43955 }
43956 if (BV_ISSET(fields, 4)) {
43957 log_packet_detailed(" got field 'global_init_buildings'");
43958#ifdef FREECIV_JSON_CONNECTION
43959 field_addr.name = "global_init_buildings";
43960#endif /* FREECIV_JSON_CONNECTION */
43961 {
43962 int i;
43963
43964#ifdef FREECIV_JSON_CONNECTION
43965 /* Enter array. */
43966 field_addr.sub_location = plocation_elem_new(0);
43967#endif /* FREECIV_JSON_CONNECTION */
43968
43969 if (real_packet->global_init_buildings_count > MAX_NUM_BUILDING_LIST) {
43970 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings, ": truncation array");
43971 }
43972 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
43973#ifdef FREECIV_JSON_CONNECTION
43974 field_addr.sub_location->number = i;
43975#endif /* FREECIV_JSON_CONNECTION */
43976 {
43977 int readin;
43978
43979 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
43980 RECEIVE_PACKET_FIELD_ERROR(global_init_buildings);
43981 }
43982 real_packet->global_init_buildings[i] = readin;
43983 }
43984 }
43985
43986#ifdef FREECIV_JSON_CONNECTION
43987 /* Exit array. */
43988 FC_FREE(field_addr.sub_location);
43989#endif /* FREECIV_JSON_CONNECTION */
43990 }
43991 }
43992 if (BV_ISSET(fields, 5)) {
43993 log_packet_detailed(" got field 'veteran_levels'");
43994#ifdef FREECIV_JSON_CONNECTION
43995 field_addr.name = "veteran_levels";
43996#endif /* FREECIV_JSON_CONNECTION */
43997 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran_levels)) {
43998 RECEIVE_PACKET_FIELD_ERROR(veteran_levels);
43999 }
44000 }
44001 if (BV_ISSET(fields, 6)) {
44002 log_packet_detailed(" got field 'veteran_name'");
44003#ifdef FREECIV_JSON_CONNECTION
44004 field_addr.name = "veteran_name";
44005#endif /* FREECIV_JSON_CONNECTION */
44006 {
44007 int i;
44008
44009#ifdef FREECIV_JSON_CONNECTION
44010 /* Enter array. */
44011 field_addr.sub_location = plocation_elem_new(0);
44012#endif /* FREECIV_JSON_CONNECTION */
44013
44014 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
44015 RECEIVE_PACKET_FIELD_ERROR(veteran_name, ": truncation array");
44016 }
44017 for (i = 0; i < real_packet->veteran_levels; i++) {
44018#ifdef FREECIV_JSON_CONNECTION
44019 field_addr.sub_location->number = i;
44020#endif /* FREECIV_JSON_CONNECTION */
44021 if (!DIO_GET(string, &din, &field_addr, real_packet->veteran_name[i], sizeof(real_packet->veteran_name[i]))) {
44022 RECEIVE_PACKET_FIELD_ERROR(veteran_name);
44023 }
44024 }
44025
44026#ifdef FREECIV_JSON_CONNECTION
44027 /* Exit array. */
44028 FC_FREE(field_addr.sub_location);
44029#endif /* FREECIV_JSON_CONNECTION */
44030 }
44031 }
44032 if (BV_ISSET(fields, 7)) {
44033 log_packet_detailed(" got field 'power_fact'");
44034#ifdef FREECIV_JSON_CONNECTION
44035 field_addr.name = "power_fact";
44036#endif /* FREECIV_JSON_CONNECTION */
44037 {
44038 int i;
44039
44040#ifdef FREECIV_JSON_CONNECTION
44041 /* Enter array. */
44042 field_addr.sub_location = plocation_elem_new(0);
44043#endif /* FREECIV_JSON_CONNECTION */
44044
44045 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
44046 RECEIVE_PACKET_FIELD_ERROR(power_fact, ": truncation array");
44047 }
44048 for (i = 0; i < real_packet->veteran_levels; i++) {
44049#ifdef FREECIV_JSON_CONNECTION
44050 field_addr.sub_location->number = i;
44051#endif /* FREECIV_JSON_CONNECTION */
44052 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->power_fact[i])) {
44053 RECEIVE_PACKET_FIELD_ERROR(power_fact);
44054 }
44055 }
44056
44057#ifdef FREECIV_JSON_CONNECTION
44058 /* Exit array. */
44059 FC_FREE(field_addr.sub_location);
44060#endif /* FREECIV_JSON_CONNECTION */
44061 }
44062 }
44063 if (BV_ISSET(fields, 8)) {
44064 log_packet_detailed(" got field 'move_bonus'");
44065#ifdef FREECIV_JSON_CONNECTION
44066 field_addr.name = "move_bonus";
44067#endif /* FREECIV_JSON_CONNECTION */
44068 {
44069 int i;
44070
44071#ifdef FREECIV_JSON_CONNECTION
44072 /* Enter array. */
44073 field_addr.sub_location = plocation_elem_new(0);
44074#endif /* FREECIV_JSON_CONNECTION */
44075
44076 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
44077 RECEIVE_PACKET_FIELD_ERROR(move_bonus, ": truncation array");
44078 }
44079 for (i = 0; i < real_packet->veteran_levels; i++) {
44080#ifdef FREECIV_JSON_CONNECTION
44081 field_addr.sub_location->number = i;
44082#endif /* FREECIV_JSON_CONNECTION */
44083 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_bonus[i])) {
44084 RECEIVE_PACKET_FIELD_ERROR(move_bonus);
44085 }
44086 }
44087
44088#ifdef FREECIV_JSON_CONNECTION
44089 /* Exit array. */
44090 FC_FREE(field_addr.sub_location);
44091#endif /* FREECIV_JSON_CONNECTION */
44092 }
44093 }
44094 if (BV_ISSET(fields, 9)) {
44095 log_packet_detailed(" got field 'base_raise_chance'");
44096#ifdef FREECIV_JSON_CONNECTION
44097 field_addr.name = "base_raise_chance";
44098#endif /* FREECIV_JSON_CONNECTION */
44099 {
44100 int i;
44101
44102#ifdef FREECIV_JSON_CONNECTION
44103 /* Enter array. */
44104 field_addr.sub_location = plocation_elem_new(0);
44105#endif /* FREECIV_JSON_CONNECTION */
44106
44107 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
44108 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance, ": truncation array");
44109 }
44110 for (i = 0; i < real_packet->veteran_levels; i++) {
44111#ifdef FREECIV_JSON_CONNECTION
44112 field_addr.sub_location->number = i;
44113#endif /* FREECIV_JSON_CONNECTION */
44114 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_raise_chance[i])) {
44115 RECEIVE_PACKET_FIELD_ERROR(base_raise_chance);
44116 }
44117 }
44118
44119#ifdef FREECIV_JSON_CONNECTION
44120 /* Exit array. */
44121 FC_FREE(field_addr.sub_location);
44122#endif /* FREECIV_JSON_CONNECTION */
44123 }
44124 }
44125 if (BV_ISSET(fields, 10)) {
44126 log_packet_detailed(" got field 'work_raise_chance'");
44127#ifdef FREECIV_JSON_CONNECTION
44128 field_addr.name = "work_raise_chance";
44129#endif /* FREECIV_JSON_CONNECTION */
44130 {
44131 int i;
44132
44133#ifdef FREECIV_JSON_CONNECTION
44134 /* Enter array. */
44135 field_addr.sub_location = plocation_elem_new(0);
44136#endif /* FREECIV_JSON_CONNECTION */
44137
44138 if (real_packet->veteran_levels > MAX_VET_LEVELS) {
44139 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance, ": truncation array");
44140 }
44141 for (i = 0; i < real_packet->veteran_levels; i++) {
44142#ifdef FREECIV_JSON_CONNECTION
44143 field_addr.sub_location->number = i;
44144#endif /* FREECIV_JSON_CONNECTION */
44145 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->work_raise_chance[i])) {
44146 RECEIVE_PACKET_FIELD_ERROR(work_raise_chance);
44147 }
44148 }
44149
44150#ifdef FREECIV_JSON_CONNECTION
44151 /* Exit array. */
44152 FC_FREE(field_addr.sub_location);
44153#endif /* FREECIV_JSON_CONNECTION */
44154 }
44155 }
44156 if (BV_ISSET(fields, 11)) {
44157 log_packet_detailed(" got field 'background_red'");
44158#ifdef FREECIV_JSON_CONNECTION
44159 field_addr.name = "background_red";
44160#endif /* FREECIV_JSON_CONNECTION */
44161 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_red)) {
44162 RECEIVE_PACKET_FIELD_ERROR(background_red);
44163 }
44164 }
44165 if (BV_ISSET(fields, 12)) {
44166 log_packet_detailed(" got field 'background_green'");
44167#ifdef FREECIV_JSON_CONNECTION
44168 field_addr.name = "background_green";
44169#endif /* FREECIV_JSON_CONNECTION */
44170 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_green)) {
44171 RECEIVE_PACKET_FIELD_ERROR(background_green);
44172 }
44173 }
44174 if (BV_ISSET(fields, 13)) {
44175 log_packet_detailed(" got field 'background_blue'");
44176#ifdef FREECIV_JSON_CONNECTION
44177 field_addr.name = "background_blue";
44178#endif /* FREECIV_JSON_CONNECTION */
44179 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->background_blue)) {
44180 RECEIVE_PACKET_FIELD_ERROR(background_blue);
44181 }
44182 }
44183
44184 if (NULL == old) {
44185 old = fc_malloc(sizeof(*old));
44186 *old = *real_packet;
44187 genhash_insert(*hash, old, old);
44188 } else {
44189 *old = *real_packet;
44190 }
44191
44192#endif /* FREECIV_DELTA_PROTOCOL */
44193 RECEIVE_PACKET_END(real_packet);
44194}
44195
44196 static int send_packet_ruleset_game_100(struct connection *pc, const struct packet_ruleset_game *packet)
44197{
44198 const struct packet_ruleset_game *real_packet = packet;
44199 int e;
44200#ifdef FREECIV_DELTA_PROTOCOL
44201 packet_ruleset_game_100_fields fields;
44202 struct packet_ruleset_game *old;
44203 bool differ;
44204 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GAME;
44205#endif /* FREECIV_DELTA_PROTOCOL */
44206 SEND_PACKET_START(PACKET_RULESET_GAME);
44207#ifdef FREECIV_JSON_CONNECTION
44208 struct plocation field_addr;
44209 {
44210 struct plocation *field_addr_tmp = plocation_field_new(NULL);
44211 field_addr = *field_addr_tmp;
44212 FC_FREE(field_addr_tmp);
44213 }
44214#endif /* FREECIV_JSON_CONNECTION */
44215
44216 log_packet_detailed("packet_ruleset_game_100: sending info about ()");
44217
44218#ifdef FREECIV_DELTA_PROTOCOL
44219 if (NULL == *hash) {
44220 *hash = genhash_new_full(hash_packet_ruleset_game_100, cmp_packet_ruleset_game_100,
44221 NULL, NULL, NULL, free);
44222 }
44223 BV_CLR_ALL(fields);
44224
44225 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
44226 old = fc_malloc(sizeof(*old));
44227 *old = *real_packet;
44228 genhash_insert(*hash, old, old);
44229 memset(old, 0, sizeof(*old));
44230 }
44231 differ = (old->default_specialist != real_packet->default_specialist);
44232 if (differ) {
44233 BV_SET(fields, 0);
44234 }
44235
44236 differ = (old->global_init_techs_count != real_packet->global_init_techs_count);
44237 if (differ) {
44238 BV_SET(fields, 1);
44239 }
44240
44241 differ = (old->global_init_techs_count != real_packet->global_init_techs_count);
44242 if (!differ) {
44243 int i;
44244
44245 for (i = 0; i < real_packet->global_init_techs_count; i++) {
44246 differ = (old->global_init_techs[i] != real_packet->global_init_techs[i]);
44247 if (differ) {
44248 break;
44249 }
44250 }
44251 }
44252 if (differ) {
44253 BV_SET(fields, 2);
44254 }
44255
44256 differ = (old->global_init_buildings_count != real_packet->global_init_buildings_count);
44257 if (differ) {
44258 BV_SET(fields, 3);
44259 }
44260
44261 differ = (old->global_init_buildings_count != real_packet->global_init_buildings_count);
44262 if (!differ) {
44263 int i;
44264
44265 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
44266 differ = (old->global_init_buildings[i] != real_packet->global_init_buildings[i]);
44267 if (differ) {
44268 break;
44269 }
44270 }
44271 }
44272 if (differ) {
44273 BV_SET(fields, 4);
44274 }
44275
44276 differ = (old->veteran_levels != real_packet->veteran_levels);
44277 if (differ) {
44278 BV_SET(fields, 5);
44279 }
44280
44281 differ = (old->veteran_levels != real_packet->veteran_levels);
44282 if (!differ) {
44283 int i;
44284
44285 for (i = 0; i < real_packet->veteran_levels; i++) {
44286 differ = (strcmp(old->veteran_name[i], real_packet->veteran_name[i]) != 0);
44287 if (differ) {
44288 break;
44289 }
44290 }
44291 }
44292 if (differ) {
44293 BV_SET(fields, 6);
44294 }
44295
44296 differ = (old->veteran_levels != real_packet->veteran_levels);
44297 if (!differ) {
44298 int i;
44299
44300 for (i = 0; i < real_packet->veteran_levels; i++) {
44301 differ = (old->power_fact[i] != real_packet->power_fact[i]);
44302 if (differ) {
44303 break;
44304 }
44305 }
44306 }
44307 if (differ) {
44308 BV_SET(fields, 7);
44309 }
44310
44311 differ = (old->veteran_levels != real_packet->veteran_levels);
44312 if (!differ) {
44313 int i;
44314
44315 for (i = 0; i < real_packet->veteran_levels; i++) {
44316 differ = (old->move_bonus[i] != real_packet->move_bonus[i]);
44317 if (differ) {
44318 break;
44319 }
44320 }
44321 }
44322 if (differ) {
44323 BV_SET(fields, 8);
44324 }
44325
44326 differ = (old->veteran_levels != real_packet->veteran_levels);
44327 if (!differ) {
44328 int i;
44329
44330 for (i = 0; i < real_packet->veteran_levels; i++) {
44331 differ = (old->base_raise_chance[i] != real_packet->base_raise_chance[i]);
44332 if (differ) {
44333 break;
44334 }
44335 }
44336 }
44337 if (differ) {
44338 BV_SET(fields, 9);
44339 }
44340
44341 differ = (old->veteran_levels != real_packet->veteran_levels);
44342 if (!differ) {
44343 int i;
44344
44345 for (i = 0; i < real_packet->veteran_levels; i++) {
44346 differ = (old->work_raise_chance[i] != real_packet->work_raise_chance[i]);
44347 if (differ) {
44348 break;
44349 }
44350 }
44351 }
44352 if (differ) {
44353 BV_SET(fields, 10);
44354 }
44355
44356 differ = (old->background_red != real_packet->background_red);
44357 if (differ) {
44358 BV_SET(fields, 11);
44359 }
44360
44361 differ = (old->background_green != real_packet->background_green);
44362 if (differ) {
44363 BV_SET(fields, 12);
44364 }
44365
44366 differ = (old->background_blue != real_packet->background_blue);
44367 if (differ) {
44368 BV_SET(fields, 13);
44369 }
44370
44371
44372#ifdef FREECIV_JSON_CONNECTION
44373 field_addr.name = "fields";
44374#endif /* FREECIV_JSON_CONNECTION */
44375 e = 0;
44376 e |= DIO_BV_PUT(&dout, &field_addr, fields);
44377 if (e) {
44378 log_packet_detailed("fields bitvector error detected");
44379 }
44380
44381 if (BV_ISSET(fields, 0)) {
44382 log_packet_detailed(" field 'default_specialist' has changed");
44383#ifdef FREECIV_JSON_CONNECTION
44384 field_addr.name = "default_specialist";
44385#endif /* FREECIV_JSON_CONNECTION */
44386 e = 0;
44387 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->default_specialist);
44388 if (e) {
44389 log_packet_detailed("'default_specialist' field error detected");
44390 }
44391 }
44392 if (BV_ISSET(fields, 1)) {
44393 log_packet_detailed(" field 'global_init_techs_count' has changed");
44394#ifdef FREECIV_JSON_CONNECTION
44395 field_addr.name = "global_init_techs_count";
44396#endif /* FREECIV_JSON_CONNECTION */
44397 e = 0;
44398 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs_count);
44399 if (e) {
44400 log_packet_detailed("'global_init_techs_count' field error detected");
44401 }
44402 }
44403 if (BV_ISSET(fields, 2)) {
44404 log_packet_detailed(" field 'global_init_techs' has changed");
44405#ifdef FREECIV_JSON_CONNECTION
44406 field_addr.name = "global_init_techs";
44407#endif /* FREECIV_JSON_CONNECTION */
44408 e = 0;
44409 {
44410 int i;
44411
44412#ifdef FREECIV_JSON_CONNECTION
44413 /* Create the array. */
44414 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_techs_count);
44415
44416 /* Enter the array. */
44417 field_addr.sub_location = plocation_elem_new(0);
44418#endif /* FREECIV_JSON_CONNECTION */
44419
44420 for (i = 0; i < real_packet->global_init_techs_count; i++) {
44421#ifdef FREECIV_JSON_CONNECTION
44422 /* Next array element. */
44423 field_addr.sub_location->number = i;
44424#endif /* FREECIV_JSON_CONNECTION */
44425 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_init_techs[i]);
44426 }
44427
44428#ifdef FREECIV_JSON_CONNECTION
44429 /* Exit array. */
44430 FC_FREE(field_addr.sub_location);
44431#endif /* FREECIV_JSON_CONNECTION */
44432 }
44433 if (e) {
44434 log_packet_detailed("'global_init_techs' field error detected");
44435 }
44436 }
44437 if (BV_ISSET(fields, 3)) {
44438 log_packet_detailed(" field 'global_init_buildings_count' has changed");
44439#ifdef FREECIV_JSON_CONNECTION
44440 field_addr.name = "global_init_buildings_count";
44441#endif /* FREECIV_JSON_CONNECTION */
44442 e = 0;
44443 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings_count);
44444 if (e) {
44445 log_packet_detailed("'global_init_buildings_count' field error detected");
44446 }
44447 }
44448 if (BV_ISSET(fields, 4)) {
44449 log_packet_detailed(" field 'global_init_buildings' has changed");
44450#ifdef FREECIV_JSON_CONNECTION
44451 field_addr.name = "global_init_buildings";
44452#endif /* FREECIV_JSON_CONNECTION */
44453 e = 0;
44454 {
44455 int i;
44456
44457#ifdef FREECIV_JSON_CONNECTION
44458 /* Create the array. */
44459 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_buildings_count);
44460
44461 /* Enter the array. */
44462 field_addr.sub_location = plocation_elem_new(0);
44463#endif /* FREECIV_JSON_CONNECTION */
44464
44465 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
44466#ifdef FREECIV_JSON_CONNECTION
44467 /* Next array element. */
44468 field_addr.sub_location->number = i;
44469#endif /* FREECIV_JSON_CONNECTION */
44470 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings[i]);
44471 }
44472
44473#ifdef FREECIV_JSON_CONNECTION
44474 /* Exit array. */
44475 FC_FREE(field_addr.sub_location);
44476#endif /* FREECIV_JSON_CONNECTION */
44477 }
44478 if (e) {
44479 log_packet_detailed("'global_init_buildings' field error detected");
44480 }
44481 }
44482 if (BV_ISSET(fields, 5)) {
44483 log_packet_detailed(" field 'veteran_levels' has changed");
44484#ifdef FREECIV_JSON_CONNECTION
44485 field_addr.name = "veteran_levels";
44486#endif /* FREECIV_JSON_CONNECTION */
44487 e = 0;
44488 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
44489 if (e) {
44490 log_packet_detailed("'veteran_levels' field error detected");
44491 }
44492 }
44493 if (BV_ISSET(fields, 6)) {
44494 log_packet_detailed(" field 'veteran_name' has changed");
44495#ifdef FREECIV_JSON_CONNECTION
44496 field_addr.name = "veteran_name";
44497#endif /* FREECIV_JSON_CONNECTION */
44498 e = 0;
44499 {
44500 int i;
44501
44502#ifdef FREECIV_JSON_CONNECTION
44503 /* Create the array. */
44504 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44505
44506 /* Enter the array. */
44507 field_addr.sub_location = plocation_elem_new(0);
44508#endif /* FREECIV_JSON_CONNECTION */
44509
44510 for (i = 0; i < real_packet->veteran_levels; i++) {
44511#ifdef FREECIV_JSON_CONNECTION
44512 /* Next array element. */
44513 field_addr.sub_location->number = i;
44514#endif /* FREECIV_JSON_CONNECTION */
44515 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
44516 }
44517
44518#ifdef FREECIV_JSON_CONNECTION
44519 /* Exit array. */
44520 FC_FREE(field_addr.sub_location);
44521#endif /* FREECIV_JSON_CONNECTION */
44522 }
44523 if (e) {
44524 log_packet_detailed("'veteran_name' field error detected");
44525 }
44526 }
44527 if (BV_ISSET(fields, 7)) {
44528 log_packet_detailed(" field 'power_fact' has changed");
44529#ifdef FREECIV_JSON_CONNECTION
44530 field_addr.name = "power_fact";
44531#endif /* FREECIV_JSON_CONNECTION */
44532 e = 0;
44533 {
44534 int i;
44535
44536#ifdef FREECIV_JSON_CONNECTION
44537 /* Create the array. */
44538 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44539
44540 /* Enter the array. */
44541 field_addr.sub_location = plocation_elem_new(0);
44542#endif /* FREECIV_JSON_CONNECTION */
44543
44544 for (i = 0; i < real_packet->veteran_levels; i++) {
44545#ifdef FREECIV_JSON_CONNECTION
44546 /* Next array element. */
44547 field_addr.sub_location->number = i;
44548#endif /* FREECIV_JSON_CONNECTION */
44549 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
44550 }
44551
44552#ifdef FREECIV_JSON_CONNECTION
44553 /* Exit array. */
44554 FC_FREE(field_addr.sub_location);
44555#endif /* FREECIV_JSON_CONNECTION */
44556 }
44557 if (e) {
44558 log_packet_detailed("'power_fact' field error detected");
44559 }
44560 }
44561 if (BV_ISSET(fields, 8)) {
44562 log_packet_detailed(" field 'move_bonus' has changed");
44563#ifdef FREECIV_JSON_CONNECTION
44564 field_addr.name = "move_bonus";
44565#endif /* FREECIV_JSON_CONNECTION */
44566 e = 0;
44567 {
44568 int i;
44569
44570#ifdef FREECIV_JSON_CONNECTION
44571 /* Create the array. */
44572 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44573
44574 /* Enter the array. */
44575 field_addr.sub_location = plocation_elem_new(0);
44576#endif /* FREECIV_JSON_CONNECTION */
44577
44578 for (i = 0; i < real_packet->veteran_levels; i++) {
44579#ifdef FREECIV_JSON_CONNECTION
44580 /* Next array element. */
44581 field_addr.sub_location->number = i;
44582#endif /* FREECIV_JSON_CONNECTION */
44583 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
44584 }
44585
44586#ifdef FREECIV_JSON_CONNECTION
44587 /* Exit array. */
44588 FC_FREE(field_addr.sub_location);
44589#endif /* FREECIV_JSON_CONNECTION */
44590 }
44591 if (e) {
44592 log_packet_detailed("'move_bonus' field error detected");
44593 }
44594 }
44595 if (BV_ISSET(fields, 9)) {
44596 log_packet_detailed(" field 'base_raise_chance' has changed");
44597#ifdef FREECIV_JSON_CONNECTION
44598 field_addr.name = "base_raise_chance";
44599#endif /* FREECIV_JSON_CONNECTION */
44600 e = 0;
44601 {
44602 int i;
44603
44604#ifdef FREECIV_JSON_CONNECTION
44605 /* Create the array. */
44606 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44607
44608 /* Enter the array. */
44609 field_addr.sub_location = plocation_elem_new(0);
44610#endif /* FREECIV_JSON_CONNECTION */
44611
44612 for (i = 0; i < real_packet->veteran_levels; i++) {
44613#ifdef FREECIV_JSON_CONNECTION
44614 /* Next array element. */
44615 field_addr.sub_location->number = i;
44616#endif /* FREECIV_JSON_CONNECTION */
44617 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
44618 }
44619
44620#ifdef FREECIV_JSON_CONNECTION
44621 /* Exit array. */
44622 FC_FREE(field_addr.sub_location);
44623#endif /* FREECIV_JSON_CONNECTION */
44624 }
44625 if (e) {
44626 log_packet_detailed("'base_raise_chance' field error detected");
44627 }
44628 }
44629 if (BV_ISSET(fields, 10)) {
44630 log_packet_detailed(" field 'work_raise_chance' has changed");
44631#ifdef FREECIV_JSON_CONNECTION
44632 field_addr.name = "work_raise_chance";
44633#endif /* FREECIV_JSON_CONNECTION */
44634 e = 0;
44635 {
44636 int i;
44637
44638#ifdef FREECIV_JSON_CONNECTION
44639 /* Create the array. */
44640 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44641
44642 /* Enter the array. */
44643 field_addr.sub_location = plocation_elem_new(0);
44644#endif /* FREECIV_JSON_CONNECTION */
44645
44646 for (i = 0; i < real_packet->veteran_levels; i++) {
44647#ifdef FREECIV_JSON_CONNECTION
44648 /* Next array element. */
44649 field_addr.sub_location->number = i;
44650#endif /* FREECIV_JSON_CONNECTION */
44651 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
44652 }
44653
44654#ifdef FREECIV_JSON_CONNECTION
44655 /* Exit array. */
44656 FC_FREE(field_addr.sub_location);
44657#endif /* FREECIV_JSON_CONNECTION */
44658 }
44659 if (e) {
44660 log_packet_detailed("'work_raise_chance' field error detected");
44661 }
44662 }
44663 if (BV_ISSET(fields, 11)) {
44664 log_packet_detailed(" field 'background_red' has changed");
44665#ifdef FREECIV_JSON_CONNECTION
44666 field_addr.name = "background_red";
44667#endif /* FREECIV_JSON_CONNECTION */
44668 e = 0;
44669 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_red);
44670 if (e) {
44671 log_packet_detailed("'background_red' field error detected");
44672 }
44673 }
44674 if (BV_ISSET(fields, 12)) {
44675 log_packet_detailed(" field 'background_green' has changed");
44676#ifdef FREECIV_JSON_CONNECTION
44677 field_addr.name = "background_green";
44678#endif /* FREECIV_JSON_CONNECTION */
44679 e = 0;
44680 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_green);
44681 if (e) {
44682 log_packet_detailed("'background_green' field error detected");
44683 }
44684 }
44685 if (BV_ISSET(fields, 13)) {
44686 log_packet_detailed(" field 'background_blue' has changed");
44687#ifdef FREECIV_JSON_CONNECTION
44688 field_addr.name = "background_blue";
44689#endif /* FREECIV_JSON_CONNECTION */
44690 e = 0;
44691 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_blue);
44692 if (e) {
44693 log_packet_detailed("'background_blue' field error detected");
44694 }
44695 }
44696
44697 *old = *real_packet;
44698#endif /* FREECIV_DELTA_PROTOCOL */
44699#ifndef FREECIV_DELTA_PROTOCOL
44700#ifdef FREECIV_JSON_CONNECTION
44701 field_addr.name = "default_specialist";
44702#endif /* FREECIV_JSON_CONNECTION */
44703 e = 0;
44704 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->default_specialist);
44705 if (e) {
44706 log_packet_detailed("'default_specialist' field error detected");
44707 }
44708#ifdef FREECIV_JSON_CONNECTION
44709 field_addr.name = "global_init_techs_count";
44710#endif /* FREECIV_JSON_CONNECTION */
44711 e = 0;
44712 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_techs_count);
44713 if (e) {
44714 log_packet_detailed("'global_init_techs_count' field error detected");
44715 }
44716#ifdef FREECIV_JSON_CONNECTION
44717 field_addr.name = "global_init_techs";
44718#endif /* FREECIV_JSON_CONNECTION */
44719 e = 0;
44720 {
44721 int i;
44722
44723#ifdef FREECIV_JSON_CONNECTION
44724 /* Create the array. */
44725 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_techs_count);
44726
44727 /* Enter the array. */
44728 field_addr.sub_location = plocation_elem_new(0);
44729#endif /* FREECIV_JSON_CONNECTION */
44730
44731 for (i = 0; i < real_packet->global_init_techs_count; i++) {
44732#ifdef FREECIV_JSON_CONNECTION
44733 /* Next array element. */
44734 field_addr.sub_location->number = i;
44735#endif /* FREECIV_JSON_CONNECTION */
44736 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->global_init_techs[i]);
44737 }
44738
44739#ifdef FREECIV_JSON_CONNECTION
44740 /* Exit array. */
44741 FC_FREE(field_addr.sub_location);
44742#endif /* FREECIV_JSON_CONNECTION */
44743 }
44744 if (e) {
44745 log_packet_detailed("'global_init_techs' field error detected");
44746 }
44747#ifdef FREECIV_JSON_CONNECTION
44748 field_addr.name = "global_init_buildings_count";
44749#endif /* FREECIV_JSON_CONNECTION */
44750 e = 0;
44751 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings_count);
44752 if (e) {
44753 log_packet_detailed("'global_init_buildings_count' field error detected");
44754 }
44755#ifdef FREECIV_JSON_CONNECTION
44756 field_addr.name = "global_init_buildings";
44757#endif /* FREECIV_JSON_CONNECTION */
44758 e = 0;
44759 {
44760 int i;
44761
44762#ifdef FREECIV_JSON_CONNECTION
44763 /* Create the array. */
44764 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->global_init_buildings_count);
44765
44766 /* Enter the array. */
44767 field_addr.sub_location = plocation_elem_new(0);
44768#endif /* FREECIV_JSON_CONNECTION */
44769
44770 for (i = 0; i < real_packet->global_init_buildings_count; i++) {
44771#ifdef FREECIV_JSON_CONNECTION
44772 /* Next array element. */
44773 field_addr.sub_location->number = i;
44774#endif /* FREECIV_JSON_CONNECTION */
44775 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->global_init_buildings[i]);
44776 }
44777
44778#ifdef FREECIV_JSON_CONNECTION
44779 /* Exit array. */
44780 FC_FREE(field_addr.sub_location);
44781#endif /* FREECIV_JSON_CONNECTION */
44782 }
44783 if (e) {
44784 log_packet_detailed("'global_init_buildings' field error detected");
44785 }
44786#ifdef FREECIV_JSON_CONNECTION
44787 field_addr.name = "veteran_levels";
44788#endif /* FREECIV_JSON_CONNECTION */
44789 e = 0;
44790 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran_levels);
44791 if (e) {
44792 log_packet_detailed("'veteran_levels' field error detected");
44793 }
44794#ifdef FREECIV_JSON_CONNECTION
44795 field_addr.name = "veteran_name";
44796#endif /* FREECIV_JSON_CONNECTION */
44797 e = 0;
44798 {
44799 int i;
44800
44801#ifdef FREECIV_JSON_CONNECTION
44802 /* Create the array. */
44803 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44804
44805 /* Enter the array. */
44806 field_addr.sub_location = plocation_elem_new(0);
44807#endif /* FREECIV_JSON_CONNECTION */
44808
44809 for (i = 0; i < real_packet->veteran_levels; i++) {
44810#ifdef FREECIV_JSON_CONNECTION
44811 /* Next array element. */
44812 field_addr.sub_location->number = i;
44813#endif /* FREECIV_JSON_CONNECTION */
44814 e |= DIO_PUT(string, &dout, &field_addr, real_packet->veteran_name[i]);
44815 }
44816
44817#ifdef FREECIV_JSON_CONNECTION
44818 /* Exit array. */
44819 FC_FREE(field_addr.sub_location);
44820#endif /* FREECIV_JSON_CONNECTION */
44821 }
44822 if (e) {
44823 log_packet_detailed("'veteran_name' field error detected");
44824 }
44825#ifdef FREECIV_JSON_CONNECTION
44826 field_addr.name = "power_fact";
44827#endif /* FREECIV_JSON_CONNECTION */
44828 e = 0;
44829 {
44830 int i;
44831
44832#ifdef FREECIV_JSON_CONNECTION
44833 /* Create the array. */
44834 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44835
44836 /* Enter the array. */
44837 field_addr.sub_location = plocation_elem_new(0);
44838#endif /* FREECIV_JSON_CONNECTION */
44839
44840 for (i = 0; i < real_packet->veteran_levels; i++) {
44841#ifdef FREECIV_JSON_CONNECTION
44842 /* Next array element. */
44843 field_addr.sub_location->number = i;
44844#endif /* FREECIV_JSON_CONNECTION */
44845 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->power_fact[i]);
44846 }
44847
44848#ifdef FREECIV_JSON_CONNECTION
44849 /* Exit array. */
44850 FC_FREE(field_addr.sub_location);
44851#endif /* FREECIV_JSON_CONNECTION */
44852 }
44853 if (e) {
44854 log_packet_detailed("'power_fact' field error detected");
44855 }
44856#ifdef FREECIV_JSON_CONNECTION
44857 field_addr.name = "move_bonus";
44858#endif /* FREECIV_JSON_CONNECTION */
44859 e = 0;
44860 {
44861 int i;
44862
44863#ifdef FREECIV_JSON_CONNECTION
44864 /* Create the array. */
44865 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44866
44867 /* Enter the array. */
44868 field_addr.sub_location = plocation_elem_new(0);
44869#endif /* FREECIV_JSON_CONNECTION */
44870
44871 for (i = 0; i < real_packet->veteran_levels; i++) {
44872#ifdef FREECIV_JSON_CONNECTION
44873 /* Next array element. */
44874 field_addr.sub_location->number = i;
44875#endif /* FREECIV_JSON_CONNECTION */
44876 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_bonus[i]);
44877 }
44878
44879#ifdef FREECIV_JSON_CONNECTION
44880 /* Exit array. */
44881 FC_FREE(field_addr.sub_location);
44882#endif /* FREECIV_JSON_CONNECTION */
44883 }
44884 if (e) {
44885 log_packet_detailed("'move_bonus' field error detected");
44886 }
44887#ifdef FREECIV_JSON_CONNECTION
44888 field_addr.name = "base_raise_chance";
44889#endif /* FREECIV_JSON_CONNECTION */
44890 e = 0;
44891 {
44892 int i;
44893
44894#ifdef FREECIV_JSON_CONNECTION
44895 /* Create the array. */
44896 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44897
44898 /* Enter the array. */
44899 field_addr.sub_location = plocation_elem_new(0);
44900#endif /* FREECIV_JSON_CONNECTION */
44901
44902 for (i = 0; i < real_packet->veteran_levels; i++) {
44903#ifdef FREECIV_JSON_CONNECTION
44904 /* Next array element. */
44905 field_addr.sub_location->number = i;
44906#endif /* FREECIV_JSON_CONNECTION */
44907 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_raise_chance[i]);
44908 }
44909
44910#ifdef FREECIV_JSON_CONNECTION
44911 /* Exit array. */
44912 FC_FREE(field_addr.sub_location);
44913#endif /* FREECIV_JSON_CONNECTION */
44914 }
44915 if (e) {
44916 log_packet_detailed("'base_raise_chance' field error detected");
44917 }
44918#ifdef FREECIV_JSON_CONNECTION
44919 field_addr.name = "work_raise_chance";
44920#endif /* FREECIV_JSON_CONNECTION */
44921 e = 0;
44922 {
44923 int i;
44924
44925#ifdef FREECIV_JSON_CONNECTION
44926 /* Create the array. */
44927 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->veteran_levels);
44928
44929 /* Enter the array. */
44930 field_addr.sub_location = plocation_elem_new(0);
44931#endif /* FREECIV_JSON_CONNECTION */
44932
44933 for (i = 0; i < real_packet->veteran_levels; i++) {
44934#ifdef FREECIV_JSON_CONNECTION
44935 /* Next array element. */
44936 field_addr.sub_location->number = i;
44937#endif /* FREECIV_JSON_CONNECTION */
44938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->work_raise_chance[i]);
44939 }
44940
44941#ifdef FREECIV_JSON_CONNECTION
44942 /* Exit array. */
44943 FC_FREE(field_addr.sub_location);
44944#endif /* FREECIV_JSON_CONNECTION */
44945 }
44946 if (e) {
44947 log_packet_detailed("'work_raise_chance' field error detected");
44948 }
44949#ifdef FREECIV_JSON_CONNECTION
44950 field_addr.name = "background_red";
44951#endif /* FREECIV_JSON_CONNECTION */
44952 e = 0;
44953 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_red);
44954 if (e) {
44955 log_packet_detailed("'background_red' field error detected");
44956 }
44957#ifdef FREECIV_JSON_CONNECTION
44958 field_addr.name = "background_green";
44959#endif /* FREECIV_JSON_CONNECTION */
44960 e = 0;
44961 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_green);
44962 if (e) {
44963 log_packet_detailed("'background_green' field error detected");
44964 }
44965#ifdef FREECIV_JSON_CONNECTION
44966 field_addr.name = "background_blue";
44967#endif /* FREECIV_JSON_CONNECTION */
44968 e = 0;
44969 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->background_blue);
44970 if (e) {
44971 log_packet_detailed("'background_blue' field error detected");
44972 }
44973
44974#endif
44975 SEND_PACKET_END(PACKET_RULESET_GAME);
44976}
44977
44978 int send_packet_ruleset_game(struct connection *pc, const struct packet_ruleset_game *packet)
44979{
44980 if (!pc->used) {
44981 log_error("WARNING: trying to send data to the closed connection %s",
44982 conn_description(pc));
44983 return -1;
44984 }
44985 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GAME].packet != NULL, -1,
44986 "Handler for PACKET_RULESET_GAME not installed");
44987 return pc->phs.handlers->send[PACKET_RULESET_GAME].packet(pc, packet);
44988}
44989
44990 void lsend_packet_ruleset_game(struct conn_list *dest, const struct packet_ruleset_game *packet)
44991{
44992 conn_list_iterate(dest, pconn) {
44993 send_packet_ruleset_game(pconn, packet);
44994 } conn_list_iterate_end;
44995}
44996
44997#ifdef FREECIV_DELTA_PROTOCOL
44998#define hash_packet_ruleset_specialist_100 hash_const
44999
45000#define cmp_packet_ruleset_specialist_100 cmp_const
45001
45002 BV_DEFINE(packet_ruleset_specialist_100_fields, 9);
45003#endif /* FREECIV_DELTA_PROTOCOL */
45004
45005 static struct packet_ruleset_specialist *receive_packet_ruleset_specialist_100(struct connection *pc)
45006{
45007#ifdef FREECIV_DELTA_PROTOCOL
45008 packet_ruleset_specialist_100_fields fields;
45009 struct packet_ruleset_specialist *old;
45010 struct genhash **hash = pc->phs.received + PACKET_RULESET_SPECIALIST;
45011#endif /* FREECIV_DELTA_PROTOCOL */
45012 RECEIVE_PACKET_START(packet_ruleset_specialist, real_packet);
45013#ifdef FREECIV_JSON_CONNECTION
45014 struct plocation field_addr;
45015 {
45016 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45017 field_addr = *field_addr_tmp;
45018 FC_FREE(field_addr_tmp);
45019 }
45020#endif /* FREECIV_JSON_CONNECTION */
45021
45022#ifdef FREECIV_DELTA_PROTOCOL
45023#ifdef FREECIV_JSON_CONNECTION
45024 field_addr.name = "fields";
45025#endif /* FREECIV_JSON_CONNECTION */
45026 DIO_BV_GET(&din, &field_addr, fields);
45027
45028#else /* FREECIV_DELTA_PROTOCOL */
45029#ifdef FREECIV_JSON_CONNECTION
45030 field_addr.name = "id";
45031#endif /* FREECIV_JSON_CONNECTION */
45032 {
45033 int readin;
45034
45035 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45036 RECEIVE_PACKET_FIELD_ERROR(id);
45037 }
45038 real_packet->id = readin;
45039 }
45040#ifdef FREECIV_JSON_CONNECTION
45041 field_addr.name = "plural_name";
45042#endif /* FREECIV_JSON_CONNECTION */
45043 if (!DIO_GET(string, &din, &field_addr, real_packet->plural_name, sizeof(real_packet->plural_name))) {
45044 RECEIVE_PACKET_FIELD_ERROR(plural_name);
45045 }
45046#ifdef FREECIV_JSON_CONNECTION
45047 field_addr.name = "rule_name";
45048#endif /* FREECIV_JSON_CONNECTION */
45049 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
45050 RECEIVE_PACKET_FIELD_ERROR(rule_name);
45051 }
45052#ifdef FREECIV_JSON_CONNECTION
45053 field_addr.name = "short_name";
45054#endif /* FREECIV_JSON_CONNECTION */
45055 if (!DIO_GET(string, &din, &field_addr, real_packet->short_name, sizeof(real_packet->short_name))) {
45056 RECEIVE_PACKET_FIELD_ERROR(short_name);
45057 }
45058#ifdef FREECIV_JSON_CONNECTION
45059 field_addr.name = "graphic_str";
45060#endif /* FREECIV_JSON_CONNECTION */
45061 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
45062 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
45063 }
45064#ifdef FREECIV_JSON_CONNECTION
45065 field_addr.name = "graphic_alt";
45066#endif /* FREECIV_JSON_CONNECTION */
45067 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
45068 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
45069 }
45070#ifdef FREECIV_JSON_CONNECTION
45071 field_addr.name = "reqs_count";
45072#endif /* FREECIV_JSON_CONNECTION */
45073 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
45074 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
45075 }
45076#ifdef FREECIV_JSON_CONNECTION
45077 field_addr.name = "reqs";
45078#endif /* FREECIV_JSON_CONNECTION */
45079 {
45080 int i;
45081
45082#ifdef FREECIV_JSON_CONNECTION
45083 /* Enter array. */
45084 field_addr.sub_location = plocation_elem_new(0);
45085#endif /* FREECIV_JSON_CONNECTION */
45086
45087 if (real_packet->reqs_count > MAX_NUM_REQS) {
45088 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
45089 }
45090 for (i = 0; i < real_packet->reqs_count; i++) {
45091#ifdef FREECIV_JSON_CONNECTION
45092 field_addr.sub_location->number = i;
45093#endif /* FREECIV_JSON_CONNECTION */
45094 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
45095 RECEIVE_PACKET_FIELD_ERROR(reqs);
45096 }
45097 }
45098
45099#ifdef FREECIV_JSON_CONNECTION
45100 /* Exit array. */
45101 FC_FREE(field_addr.sub_location);
45102#endif /* FREECIV_JSON_CONNECTION */
45103 }
45104#ifdef FREECIV_JSON_CONNECTION
45105 field_addr.name = "helptext";
45106#endif /* FREECIV_JSON_CONNECTION */
45107 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
45108 RECEIVE_PACKET_FIELD_ERROR(helptext);
45109 }
45110#endif
45111 log_packet_detailed("packet_ruleset_specialist_100: got info about ()");
45112
45113#ifdef FREECIV_DELTA_PROTOCOL
45114 if (NULL == *hash) {
45115 *hash = genhash_new_full(hash_packet_ruleset_specialist_100, cmp_packet_ruleset_specialist_100,
45116 NULL, NULL, NULL, free);
45117 }
45118
45119 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45120 *real_packet = *old;
45121 } else {
45122 log_packet_detailed(" no old info");
45123 memset(real_packet, 0, sizeof(*real_packet));
45124 }
45125
45126 if (BV_ISSET(fields, 0)) {
45127 log_packet_detailed(" got field 'id'");
45128#ifdef FREECIV_JSON_CONNECTION
45129 field_addr.name = "id";
45130#endif /* FREECIV_JSON_CONNECTION */
45131 {
45132 int readin;
45133
45134 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
45135 RECEIVE_PACKET_FIELD_ERROR(id);
45136 }
45137 real_packet->id = readin;
45138 }
45139 }
45140 if (BV_ISSET(fields, 1)) {
45141 log_packet_detailed(" got field 'plural_name'");
45142#ifdef FREECIV_JSON_CONNECTION
45143 field_addr.name = "plural_name";
45144#endif /* FREECIV_JSON_CONNECTION */
45145 if (!DIO_GET(string, &din, &field_addr, real_packet->plural_name, sizeof(real_packet->plural_name))) {
45146 RECEIVE_PACKET_FIELD_ERROR(plural_name);
45147 }
45148 }
45149 if (BV_ISSET(fields, 2)) {
45150 log_packet_detailed(" got field 'rule_name'");
45151#ifdef FREECIV_JSON_CONNECTION
45152 field_addr.name = "rule_name";
45153#endif /* FREECIV_JSON_CONNECTION */
45154 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
45155 RECEIVE_PACKET_FIELD_ERROR(rule_name);
45156 }
45157 }
45158 if (BV_ISSET(fields, 3)) {
45159 log_packet_detailed(" got field 'short_name'");
45160#ifdef FREECIV_JSON_CONNECTION
45161 field_addr.name = "short_name";
45162#endif /* FREECIV_JSON_CONNECTION */
45163 if (!DIO_GET(string, &din, &field_addr, real_packet->short_name, sizeof(real_packet->short_name))) {
45164 RECEIVE_PACKET_FIELD_ERROR(short_name);
45165 }
45166 }
45167 if (BV_ISSET(fields, 4)) {
45168 log_packet_detailed(" got field 'graphic_str'");
45169#ifdef FREECIV_JSON_CONNECTION
45170 field_addr.name = "graphic_str";
45171#endif /* FREECIV_JSON_CONNECTION */
45172 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
45173 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
45174 }
45175 }
45176 if (BV_ISSET(fields, 5)) {
45177 log_packet_detailed(" got field 'graphic_alt'");
45178#ifdef FREECIV_JSON_CONNECTION
45179 field_addr.name = "graphic_alt";
45180#endif /* FREECIV_JSON_CONNECTION */
45181 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
45182 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
45183 }
45184 }
45185 if (BV_ISSET(fields, 6)) {
45186 log_packet_detailed(" got field 'reqs_count'");
45187#ifdef FREECIV_JSON_CONNECTION
45188 field_addr.name = "reqs_count";
45189#endif /* FREECIV_JSON_CONNECTION */
45190 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
45191 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
45192 }
45193 }
45194 if (BV_ISSET(fields, 7)) {
45195 log_packet_detailed(" got field 'reqs'");
45196#ifdef FREECIV_JSON_CONNECTION
45197 field_addr.name = "reqs";
45198#endif /* FREECIV_JSON_CONNECTION */
45199 {
45200 int i;
45201
45202#ifdef FREECIV_JSON_CONNECTION
45203 /* Enter array. */
45204 field_addr.sub_location = plocation_elem_new(0);
45205#endif /* FREECIV_JSON_CONNECTION */
45206
45207 if (real_packet->reqs_count > MAX_NUM_REQS) {
45208 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
45209 }
45210 for (i = 0; i < real_packet->reqs_count; i++) {
45211#ifdef FREECIV_JSON_CONNECTION
45212 field_addr.sub_location->number = i;
45213#endif /* FREECIV_JSON_CONNECTION */
45214 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
45215 RECEIVE_PACKET_FIELD_ERROR(reqs);
45216 }
45217 }
45218
45219#ifdef FREECIV_JSON_CONNECTION
45220 /* Exit array. */
45221 FC_FREE(field_addr.sub_location);
45222#endif /* FREECIV_JSON_CONNECTION */
45223 }
45224 }
45225 if (BV_ISSET(fields, 8)) {
45226 log_packet_detailed(" got field 'helptext'");
45227#ifdef FREECIV_JSON_CONNECTION
45228 field_addr.name = "helptext";
45229#endif /* FREECIV_JSON_CONNECTION */
45230 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
45231 RECEIVE_PACKET_FIELD_ERROR(helptext);
45232 }
45233 }
45234
45235 if (NULL == old) {
45236 old = fc_malloc(sizeof(*old));
45237 *old = *real_packet;
45238 genhash_insert(*hash, old, old);
45239 } else {
45240 *old = *real_packet;
45241 }
45242
45243#endif /* FREECIV_DELTA_PROTOCOL */
45244 RECEIVE_PACKET_END(real_packet);
45245}
45246
45247 static int send_packet_ruleset_specialist_100(struct connection *pc, const struct packet_ruleset_specialist *packet)
45248{
45249 const struct packet_ruleset_specialist *real_packet = packet;
45250 int e;
45251#ifdef FREECIV_DELTA_PROTOCOL
45252 packet_ruleset_specialist_100_fields fields;
45253 struct packet_ruleset_specialist *old;
45254 bool differ;
45255 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SPECIALIST;
45256#endif /* FREECIV_DELTA_PROTOCOL */
45257 SEND_PACKET_START(PACKET_RULESET_SPECIALIST);
45258#ifdef FREECIV_JSON_CONNECTION
45259 struct plocation field_addr;
45260 {
45261 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45262 field_addr = *field_addr_tmp;
45263 FC_FREE(field_addr_tmp);
45264 }
45265#endif /* FREECIV_JSON_CONNECTION */
45266
45267 log_packet_detailed("packet_ruleset_specialist_100: sending info about ()");
45268
45269#ifdef FREECIV_DELTA_PROTOCOL
45270 if (NULL == *hash) {
45271 *hash = genhash_new_full(hash_packet_ruleset_specialist_100, cmp_packet_ruleset_specialist_100,
45272 NULL, NULL, NULL, free);
45273 }
45274 BV_CLR_ALL(fields);
45275
45276 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
45277 old = fc_malloc(sizeof(*old));
45278 *old = *real_packet;
45279 genhash_insert(*hash, old, old);
45280 memset(old, 0, sizeof(*old));
45281 }
45282 differ = (old->id != real_packet->id);
45283 if (differ) {
45284 BV_SET(fields, 0);
45285 }
45286
45287 differ = (strcmp(old->plural_name, real_packet->plural_name) != 0);
45288 if (differ) {
45289 BV_SET(fields, 1);
45290 }
45291
45292 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
45293 if (differ) {
45294 BV_SET(fields, 2);
45295 }
45296
45297 differ = (strcmp(old->short_name, real_packet->short_name) != 0);
45298 if (differ) {
45299 BV_SET(fields, 3);
45300 }
45301
45302 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
45303 if (differ) {
45304 BV_SET(fields, 4);
45305 }
45306
45307 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
45308 if (differ) {
45309 BV_SET(fields, 5);
45310 }
45311
45312 differ = (old->reqs_count != real_packet->reqs_count);
45313 if (differ) {
45314 BV_SET(fields, 6);
45315 }
45316
45317 differ = (old->reqs_count != real_packet->reqs_count);
45318 if (!differ) {
45319 int i;
45320
45321 for (i = 0; i < real_packet->reqs_count; i++) {
45322 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
45323 if (differ) {
45324 break;
45325 }
45326 }
45327 }
45328 if (differ) {
45329 BV_SET(fields, 7);
45330 }
45331
45332 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
45333 if (differ) {
45334 BV_SET(fields, 8);
45335 }
45336
45337
45338#ifdef FREECIV_JSON_CONNECTION
45339 field_addr.name = "fields";
45340#endif /* FREECIV_JSON_CONNECTION */
45341 e = 0;
45342 e |= DIO_BV_PUT(&dout, &field_addr, fields);
45343 if (e) {
45344 log_packet_detailed("fields bitvector error detected");
45345 }
45346
45347 if (BV_ISSET(fields, 0)) {
45348 log_packet_detailed(" field 'id' has changed");
45349#ifdef FREECIV_JSON_CONNECTION
45350 field_addr.name = "id";
45351#endif /* FREECIV_JSON_CONNECTION */
45352 e = 0;
45353 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
45354 if (e) {
45355 log_packet_detailed("'id' field error detected");
45356 }
45357 }
45358 if (BV_ISSET(fields, 1)) {
45359 log_packet_detailed(" field 'plural_name' has changed");
45360#ifdef FREECIV_JSON_CONNECTION
45361 field_addr.name = "plural_name";
45362#endif /* FREECIV_JSON_CONNECTION */
45363 e = 0;
45364 e |= DIO_PUT(string, &dout, &field_addr, real_packet->plural_name);
45365 if (e) {
45366 log_packet_detailed("'plural_name' field error detected");
45367 }
45368 }
45369 if (BV_ISSET(fields, 2)) {
45370 log_packet_detailed(" field 'rule_name' has changed");
45371#ifdef FREECIV_JSON_CONNECTION
45372 field_addr.name = "rule_name";
45373#endif /* FREECIV_JSON_CONNECTION */
45374 e = 0;
45375 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
45376 if (e) {
45377 log_packet_detailed("'rule_name' field error detected");
45378 }
45379 }
45380 if (BV_ISSET(fields, 3)) {
45381 log_packet_detailed(" field 'short_name' has changed");
45382#ifdef FREECIV_JSON_CONNECTION
45383 field_addr.name = "short_name";
45384#endif /* FREECIV_JSON_CONNECTION */
45385 e = 0;
45386 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_name);
45387 if (e) {
45388 log_packet_detailed("'short_name' field error detected");
45389 }
45390 }
45391 if (BV_ISSET(fields, 4)) {
45392 log_packet_detailed(" field 'graphic_str' has changed");
45393#ifdef FREECIV_JSON_CONNECTION
45394 field_addr.name = "graphic_str";
45395#endif /* FREECIV_JSON_CONNECTION */
45396 e = 0;
45397 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
45398 if (e) {
45399 log_packet_detailed("'graphic_str' field error detected");
45400 }
45401 }
45402 if (BV_ISSET(fields, 5)) {
45403 log_packet_detailed(" field 'graphic_alt' has changed");
45404#ifdef FREECIV_JSON_CONNECTION
45405 field_addr.name = "graphic_alt";
45406#endif /* FREECIV_JSON_CONNECTION */
45407 e = 0;
45408 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
45409 if (e) {
45410 log_packet_detailed("'graphic_alt' field error detected");
45411 }
45412 }
45413 if (BV_ISSET(fields, 6)) {
45414 log_packet_detailed(" field 'reqs_count' has changed");
45415#ifdef FREECIV_JSON_CONNECTION
45416 field_addr.name = "reqs_count";
45417#endif /* FREECIV_JSON_CONNECTION */
45418 e = 0;
45419 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
45420 if (e) {
45421 log_packet_detailed("'reqs_count' field error detected");
45422 }
45423 }
45424 if (BV_ISSET(fields, 7)) {
45425 log_packet_detailed(" field 'reqs' has changed");
45426#ifdef FREECIV_JSON_CONNECTION
45427 field_addr.name = "reqs";
45428#endif /* FREECIV_JSON_CONNECTION */
45429 e = 0;
45430 {
45431 int i;
45432
45433#ifdef FREECIV_JSON_CONNECTION
45434 /* Create the array. */
45435 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
45436
45437 /* Enter the array. */
45438 field_addr.sub_location = plocation_elem_new(0);
45439#endif /* FREECIV_JSON_CONNECTION */
45440
45441 for (i = 0; i < real_packet->reqs_count; i++) {
45442#ifdef FREECIV_JSON_CONNECTION
45443 /* Next array element. */
45444 field_addr.sub_location->number = i;
45445#endif /* FREECIV_JSON_CONNECTION */
45446 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
45447 }
45448
45449#ifdef FREECIV_JSON_CONNECTION
45450 /* Exit array. */
45451 FC_FREE(field_addr.sub_location);
45452#endif /* FREECIV_JSON_CONNECTION */
45453 }
45454 if (e) {
45455 log_packet_detailed("'reqs' field error detected");
45456 }
45457 }
45458 if (BV_ISSET(fields, 8)) {
45459 log_packet_detailed(" field 'helptext' has changed");
45460#ifdef FREECIV_JSON_CONNECTION
45461 field_addr.name = "helptext";
45462#endif /* FREECIV_JSON_CONNECTION */
45463 e = 0;
45464 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
45465 if (e) {
45466 log_packet_detailed("'helptext' field error detected");
45467 }
45468 }
45469
45470 *old = *real_packet;
45471#endif /* FREECIV_DELTA_PROTOCOL */
45472#ifndef FREECIV_DELTA_PROTOCOL
45473#ifdef FREECIV_JSON_CONNECTION
45474 field_addr.name = "id";
45475#endif /* FREECIV_JSON_CONNECTION */
45476 e = 0;
45477 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
45478 if (e) {
45479 log_packet_detailed("'id' field error detected");
45480 }
45481#ifdef FREECIV_JSON_CONNECTION
45482 field_addr.name = "plural_name";
45483#endif /* FREECIV_JSON_CONNECTION */
45484 e = 0;
45485 e |= DIO_PUT(string, &dout, &field_addr, real_packet->plural_name);
45486 if (e) {
45487 log_packet_detailed("'plural_name' field error detected");
45488 }
45489#ifdef FREECIV_JSON_CONNECTION
45490 field_addr.name = "rule_name";
45491#endif /* FREECIV_JSON_CONNECTION */
45492 e = 0;
45493 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
45494 if (e) {
45495 log_packet_detailed("'rule_name' field error detected");
45496 }
45497#ifdef FREECIV_JSON_CONNECTION
45498 field_addr.name = "short_name";
45499#endif /* FREECIV_JSON_CONNECTION */
45500 e = 0;
45501 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_name);
45502 if (e) {
45503 log_packet_detailed("'short_name' field error detected");
45504 }
45505#ifdef FREECIV_JSON_CONNECTION
45506 field_addr.name = "graphic_str";
45507#endif /* FREECIV_JSON_CONNECTION */
45508 e = 0;
45509 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
45510 if (e) {
45511 log_packet_detailed("'graphic_str' field error detected");
45512 }
45513#ifdef FREECIV_JSON_CONNECTION
45514 field_addr.name = "graphic_alt";
45515#endif /* FREECIV_JSON_CONNECTION */
45516 e = 0;
45517 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
45518 if (e) {
45519 log_packet_detailed("'graphic_alt' field error detected");
45520 }
45521#ifdef FREECIV_JSON_CONNECTION
45522 field_addr.name = "reqs_count";
45523#endif /* FREECIV_JSON_CONNECTION */
45524 e = 0;
45525 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
45526 if (e) {
45527 log_packet_detailed("'reqs_count' field error detected");
45528 }
45529#ifdef FREECIV_JSON_CONNECTION
45530 field_addr.name = "reqs";
45531#endif /* FREECIV_JSON_CONNECTION */
45532 e = 0;
45533 {
45534 int i;
45535
45536#ifdef FREECIV_JSON_CONNECTION
45537 /* Create the array. */
45538 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
45539
45540 /* Enter the array. */
45541 field_addr.sub_location = plocation_elem_new(0);
45542#endif /* FREECIV_JSON_CONNECTION */
45543
45544 for (i = 0; i < real_packet->reqs_count; i++) {
45545#ifdef FREECIV_JSON_CONNECTION
45546 /* Next array element. */
45547 field_addr.sub_location->number = i;
45548#endif /* FREECIV_JSON_CONNECTION */
45549 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
45550 }
45551
45552#ifdef FREECIV_JSON_CONNECTION
45553 /* Exit array. */
45554 FC_FREE(field_addr.sub_location);
45555#endif /* FREECIV_JSON_CONNECTION */
45556 }
45557 if (e) {
45558 log_packet_detailed("'reqs' field error detected");
45559 }
45560#ifdef FREECIV_JSON_CONNECTION
45561 field_addr.name = "helptext";
45562#endif /* FREECIV_JSON_CONNECTION */
45563 e = 0;
45564 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
45565 if (e) {
45566 log_packet_detailed("'helptext' field error detected");
45567 }
45568
45569#endif
45570 SEND_PACKET_END(PACKET_RULESET_SPECIALIST);
45571}
45572
45573 int send_packet_ruleset_specialist(struct connection *pc, const struct packet_ruleset_specialist *packet)
45574{
45575 if (!pc->used) {
45576 log_error("WARNING: trying to send data to the closed connection %s",
45577 conn_description(pc));
45578 return -1;
45579 }
45580 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SPECIALIST].packet != NULL, -1,
45581 "Handler for PACKET_RULESET_SPECIALIST not installed");
45582 return pc->phs.handlers->send[PACKET_RULESET_SPECIALIST].packet(pc, packet);
45583}
45584
45585 void lsend_packet_ruleset_specialist(struct conn_list *dest, const struct packet_ruleset_specialist *packet)
45586{
45587 conn_list_iterate(dest, pconn) {
45588 send_packet_ruleset_specialist(pconn, packet);
45589 } conn_list_iterate_end;
45590}
45591
45592#ifdef FREECIV_DELTA_PROTOCOL
45593#define hash_packet_ruleset_government_ruler_title_100 hash_const
45594
45595#define cmp_packet_ruleset_government_ruler_title_100 cmp_const
45596
45597 BV_DEFINE(packet_ruleset_government_ruler_title_100_fields, 4);
45598#endif /* FREECIV_DELTA_PROTOCOL */
45599
45600 static struct packet_ruleset_government_ruler_title *receive_packet_ruleset_government_ruler_title_100(struct connection *pc)
45601{
45602#ifdef FREECIV_DELTA_PROTOCOL
45603 packet_ruleset_government_ruler_title_100_fields fields;
45604 struct packet_ruleset_government_ruler_title *old;
45605 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOVERNMENT_RULER_TITLE;
45606#endif /* FREECIV_DELTA_PROTOCOL */
45607 RECEIVE_PACKET_START(packet_ruleset_government_ruler_title, real_packet);
45608#ifdef FREECIV_JSON_CONNECTION
45609 struct plocation field_addr;
45610 {
45611 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45612 field_addr = *field_addr_tmp;
45613 FC_FREE(field_addr_tmp);
45614 }
45615#endif /* FREECIV_JSON_CONNECTION */
45616
45617#ifdef FREECIV_DELTA_PROTOCOL
45618#ifdef FREECIV_JSON_CONNECTION
45619 field_addr.name = "fields";
45620#endif /* FREECIV_JSON_CONNECTION */
45621 DIO_BV_GET(&din, &field_addr, fields);
45622
45623#else /* FREECIV_DELTA_PROTOCOL */
45624#ifdef FREECIV_JSON_CONNECTION
45625 field_addr.name = "gov";
45626#endif /* FREECIV_JSON_CONNECTION */
45627 {
45628 int readin;
45629
45630 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
45631 RECEIVE_PACKET_FIELD_ERROR(gov);
45632 }
45633 real_packet->gov = readin;
45634 }
45635#ifdef FREECIV_JSON_CONNECTION
45636 field_addr.name = "nation";
45637#endif /* FREECIV_JSON_CONNECTION */
45638 {
45639 int readin;
45640
45641 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
45642 RECEIVE_PACKET_FIELD_ERROR(nation);
45643 }
45644 real_packet->nation = readin;
45645 }
45646#ifdef FREECIV_JSON_CONNECTION
45647 field_addr.name = "male_title";
45648#endif /* FREECIV_JSON_CONNECTION */
45649 if (!DIO_GET(string, &din, &field_addr, real_packet->male_title, sizeof(real_packet->male_title))) {
45650 RECEIVE_PACKET_FIELD_ERROR(male_title);
45651 }
45652#ifdef FREECIV_JSON_CONNECTION
45653 field_addr.name = "female_title";
45654#endif /* FREECIV_JSON_CONNECTION */
45655 if (!DIO_GET(string, &din, &field_addr, real_packet->female_title, sizeof(real_packet->female_title))) {
45656 RECEIVE_PACKET_FIELD_ERROR(female_title);
45657 }
45658#endif
45659 log_packet_detailed("packet_ruleset_government_ruler_title_100: got info about ()");
45660
45661#ifdef FREECIV_DELTA_PROTOCOL
45662 if (NULL == *hash) {
45663 *hash = genhash_new_full(hash_packet_ruleset_government_ruler_title_100, cmp_packet_ruleset_government_ruler_title_100,
45664 NULL, NULL, NULL, free);
45665 }
45666
45667 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
45668 *real_packet = *old;
45669 } else {
45670 log_packet_detailed(" no old info");
45671 memset(real_packet, 0, sizeof(*real_packet));
45672 }
45673
45674 if (BV_ISSET(fields, 0)) {
45675 log_packet_detailed(" got field 'gov'");
45676#ifdef FREECIV_JSON_CONNECTION
45677 field_addr.name = "gov";
45678#endif /* FREECIV_JSON_CONNECTION */
45679 {
45680 int readin;
45681
45682 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
45683 RECEIVE_PACKET_FIELD_ERROR(gov);
45684 }
45685 real_packet->gov = readin;
45686 }
45687 }
45688 if (BV_ISSET(fields, 1)) {
45689 log_packet_detailed(" got field 'nation'");
45690#ifdef FREECIV_JSON_CONNECTION
45691 field_addr.name = "nation";
45692#endif /* FREECIV_JSON_CONNECTION */
45693 {
45694 int readin;
45695
45696 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
45697 RECEIVE_PACKET_FIELD_ERROR(nation);
45698 }
45699 real_packet->nation = readin;
45700 }
45701 }
45702 if (BV_ISSET(fields, 2)) {
45703 log_packet_detailed(" got field 'male_title'");
45704#ifdef FREECIV_JSON_CONNECTION
45705 field_addr.name = "male_title";
45706#endif /* FREECIV_JSON_CONNECTION */
45707 if (!DIO_GET(string, &din, &field_addr, real_packet->male_title, sizeof(real_packet->male_title))) {
45708 RECEIVE_PACKET_FIELD_ERROR(male_title);
45709 }
45710 }
45711 if (BV_ISSET(fields, 3)) {
45712 log_packet_detailed(" got field 'female_title'");
45713#ifdef FREECIV_JSON_CONNECTION
45714 field_addr.name = "female_title";
45715#endif /* FREECIV_JSON_CONNECTION */
45716 if (!DIO_GET(string, &din, &field_addr, real_packet->female_title, sizeof(real_packet->female_title))) {
45717 RECEIVE_PACKET_FIELD_ERROR(female_title);
45718 }
45719 }
45720
45721 if (NULL == old) {
45722 old = fc_malloc(sizeof(*old));
45723 *old = *real_packet;
45724 genhash_insert(*hash, old, old);
45725 } else {
45726 *old = *real_packet;
45727 }
45728
45729#endif /* FREECIV_DELTA_PROTOCOL */
45730 RECEIVE_PACKET_END(real_packet);
45731}
45732
45733 static int send_packet_ruleset_government_ruler_title_100(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
45734{
45735 const struct packet_ruleset_government_ruler_title *real_packet = packet;
45736 int e;
45737#ifdef FREECIV_DELTA_PROTOCOL
45738 packet_ruleset_government_ruler_title_100_fields fields;
45739 struct packet_ruleset_government_ruler_title *old;
45740 bool differ;
45741 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOVERNMENT_RULER_TITLE;
45742#endif /* FREECIV_DELTA_PROTOCOL */
45743 SEND_PACKET_START(PACKET_RULESET_GOVERNMENT_RULER_TITLE);
45744#ifdef FREECIV_JSON_CONNECTION
45745 struct plocation field_addr;
45746 {
45747 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45748 field_addr = *field_addr_tmp;
45749 FC_FREE(field_addr_tmp);
45750 }
45751#endif /* FREECIV_JSON_CONNECTION */
45752
45753 log_packet_detailed("packet_ruleset_government_ruler_title_100: sending info about ()");
45754
45755#ifdef FREECIV_DELTA_PROTOCOL
45756 if (NULL == *hash) {
45757 *hash = genhash_new_full(hash_packet_ruleset_government_ruler_title_100, cmp_packet_ruleset_government_ruler_title_100,
45758 NULL, NULL, NULL, free);
45759 }
45760 BV_CLR_ALL(fields);
45761
45762 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
45763 old = fc_malloc(sizeof(*old));
45764 *old = *real_packet;
45765 genhash_insert(*hash, old, old);
45766 memset(old, 0, sizeof(*old));
45767 }
45768 differ = (old->gov != real_packet->gov);
45769 if (differ) {
45770 BV_SET(fields, 0);
45771 }
45772
45773 differ = (old->nation != real_packet->nation);
45774 if (differ) {
45775 BV_SET(fields, 1);
45776 }
45777
45778 differ = (strcmp(old->male_title, real_packet->male_title) != 0);
45779 if (differ) {
45780 BV_SET(fields, 2);
45781 }
45782
45783 differ = (strcmp(old->female_title, real_packet->female_title) != 0);
45784 if (differ) {
45785 BV_SET(fields, 3);
45786 }
45787
45788
45789#ifdef FREECIV_JSON_CONNECTION
45790 field_addr.name = "fields";
45791#endif /* FREECIV_JSON_CONNECTION */
45792 e = 0;
45793 e |= DIO_BV_PUT(&dout, &field_addr, fields);
45794 if (e) {
45795 log_packet_detailed("fields bitvector error detected");
45796 }
45797
45798 if (BV_ISSET(fields, 0)) {
45799 log_packet_detailed(" field 'gov' has changed");
45800#ifdef FREECIV_JSON_CONNECTION
45801 field_addr.name = "gov";
45802#endif /* FREECIV_JSON_CONNECTION */
45803 e = 0;
45804 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->gov);
45805 if (e) {
45806 log_packet_detailed("'gov' field error detected");
45807 }
45808 }
45809 if (BV_ISSET(fields, 1)) {
45810 log_packet_detailed(" field 'nation' has changed");
45811#ifdef FREECIV_JSON_CONNECTION
45812 field_addr.name = "nation";
45813#endif /* FREECIV_JSON_CONNECTION */
45814 e = 0;
45815 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
45816 if (e) {
45817 log_packet_detailed("'nation' field error detected");
45818 }
45819 }
45820 if (BV_ISSET(fields, 2)) {
45821 log_packet_detailed(" field 'male_title' has changed");
45822#ifdef FREECIV_JSON_CONNECTION
45823 field_addr.name = "male_title";
45824#endif /* FREECIV_JSON_CONNECTION */
45825 e = 0;
45826 e |= DIO_PUT(string, &dout, &field_addr, real_packet->male_title);
45827 if (e) {
45828 log_packet_detailed("'male_title' field error detected");
45829 }
45830 }
45831 if (BV_ISSET(fields, 3)) {
45832 log_packet_detailed(" field 'female_title' has changed");
45833#ifdef FREECIV_JSON_CONNECTION
45834 field_addr.name = "female_title";
45835#endif /* FREECIV_JSON_CONNECTION */
45836 e = 0;
45837 e |= DIO_PUT(string, &dout, &field_addr, real_packet->female_title);
45838 if (e) {
45839 log_packet_detailed("'female_title' field error detected");
45840 }
45841 }
45842
45843 *old = *real_packet;
45844#endif /* FREECIV_DELTA_PROTOCOL */
45845#ifndef FREECIV_DELTA_PROTOCOL
45846#ifdef FREECIV_JSON_CONNECTION
45847 field_addr.name = "gov";
45848#endif /* FREECIV_JSON_CONNECTION */
45849 e = 0;
45850 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->gov);
45851 if (e) {
45852 log_packet_detailed("'gov' field error detected");
45853 }
45854#ifdef FREECIV_JSON_CONNECTION
45855 field_addr.name = "nation";
45856#endif /* FREECIV_JSON_CONNECTION */
45857 e = 0;
45858 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
45859 if (e) {
45860 log_packet_detailed("'nation' field error detected");
45861 }
45862#ifdef FREECIV_JSON_CONNECTION
45863 field_addr.name = "male_title";
45864#endif /* FREECIV_JSON_CONNECTION */
45865 e = 0;
45866 e |= DIO_PUT(string, &dout, &field_addr, real_packet->male_title);
45867 if (e) {
45868 log_packet_detailed("'male_title' field error detected");
45869 }
45870#ifdef FREECIV_JSON_CONNECTION
45871 field_addr.name = "female_title";
45872#endif /* FREECIV_JSON_CONNECTION */
45873 e = 0;
45874 e |= DIO_PUT(string, &dout, &field_addr, real_packet->female_title);
45875 if (e) {
45876 log_packet_detailed("'female_title' field error detected");
45877 }
45878
45879#endif
45880 SEND_PACKET_END(PACKET_RULESET_GOVERNMENT_RULER_TITLE);
45881}
45882
45883 int send_packet_ruleset_government_ruler_title(struct connection *pc, const struct packet_ruleset_government_ruler_title *packet)
45884{
45885 if (!pc->used) {
45886 log_error("WARNING: trying to send data to the closed connection %s",
45887 conn_description(pc));
45888 return -1;
45889 }
45890 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet != NULL, -1,
45891 "Handler for PACKET_RULESET_GOVERNMENT_RULER_TITLE not installed");
45892 return pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet(pc, packet);
45893}
45894
45895 void lsend_packet_ruleset_government_ruler_title(struct conn_list *dest, const struct packet_ruleset_government_ruler_title *packet)
45896{
45897 conn_list_iterate(dest, pconn) {
45898 send_packet_ruleset_government_ruler_title(pconn, packet);
45899 } conn_list_iterate_end;
45900}
45901
45902#ifdef FREECIV_DELTA_PROTOCOL
45903#define hash_packet_ruleset_tech_100 hash_const
45904
45905#define cmp_packet_ruleset_tech_100 cmp_const
45906
45907 BV_DEFINE(packet_ruleset_tech_100_fields, 14);
45908#endif /* FREECIV_DELTA_PROTOCOL */
45909
45910 static struct packet_ruleset_tech *receive_packet_ruleset_tech_100(struct connection *pc)
45911{
45912#ifdef FREECIV_DELTA_PROTOCOL
45913 packet_ruleset_tech_100_fields fields;
45914 struct packet_ruleset_tech *old;
45915 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH;
45916#endif /* FREECIV_DELTA_PROTOCOL */
45917 RECEIVE_PACKET_START(packet_ruleset_tech, real_packet);
45918#ifdef FREECIV_JSON_CONNECTION
45919 struct plocation field_addr;
45920 {
45921 struct plocation *field_addr_tmp = plocation_field_new(NULL);
45922 field_addr = *field_addr_tmp;
45923 FC_FREE(field_addr_tmp);
45924 }
45925#endif /* FREECIV_JSON_CONNECTION */
45926
45927#ifdef FREECIV_DELTA_PROTOCOL
45928#ifdef FREECIV_JSON_CONNECTION
45929 field_addr.name = "fields";
45930#endif /* FREECIV_JSON_CONNECTION */
45931 DIO_BV_GET(&din, &field_addr, fields);
45932
45933#else /* FREECIV_DELTA_PROTOCOL */
45934#ifdef FREECIV_JSON_CONNECTION
45935 field_addr.name = "id";
45936#endif /* FREECIV_JSON_CONNECTION */
45937 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
45938 RECEIVE_PACKET_FIELD_ERROR(id);
45939 }
45940#ifdef FREECIV_JSON_CONNECTION
45941 field_addr.name = "root_req";
45942#endif /* FREECIV_JSON_CONNECTION */
45943 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->root_req)) {
45944 RECEIVE_PACKET_FIELD_ERROR(root_req);
45945 }
45946#ifdef FREECIV_JSON_CONNECTION
45947 field_addr.name = "research_reqs_count";
45948#endif /* FREECIV_JSON_CONNECTION */
45949 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->research_reqs_count)) {
45950 RECEIVE_PACKET_FIELD_ERROR(research_reqs_count);
45951 }
45952#ifdef FREECIV_JSON_CONNECTION
45953 field_addr.name = "research_reqs";
45954#endif /* FREECIV_JSON_CONNECTION */
45955 {
45956 int i;
45957
45958#ifdef FREECIV_JSON_CONNECTION
45959 /* Enter array. */
45960 field_addr.sub_location = plocation_elem_new(0);
45961#endif /* FREECIV_JSON_CONNECTION */
45962
45963 if (real_packet->research_reqs_count > MAX_NUM_REQS) {
45964 RECEIVE_PACKET_FIELD_ERROR(research_reqs, ": truncation array");
45965 }
45966 for (i = 0; i < real_packet->research_reqs_count; i++) {
45967#ifdef FREECIV_JSON_CONNECTION
45968 field_addr.sub_location->number = i;
45969#endif /* FREECIV_JSON_CONNECTION */
45970 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->research_reqs[i])) {
45971 RECEIVE_PACKET_FIELD_ERROR(research_reqs);
45972 }
45973 }
45974
45975#ifdef FREECIV_JSON_CONNECTION
45976 /* Exit array. */
45977 FC_FREE(field_addr.sub_location);
45978#endif /* FREECIV_JSON_CONNECTION */
45979 }
45980#ifdef FREECIV_JSON_CONNECTION
45981 field_addr.name = "tclass";
45982#endif /* FREECIV_JSON_CONNECTION */
45983 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
45984 RECEIVE_PACKET_FIELD_ERROR(tclass);
45985 }
45986#ifdef FREECIV_JSON_CONNECTION
45987 field_addr.name = "removed";
45988#endif /* FREECIV_JSON_CONNECTION */
45989 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removed)) {
45990 RECEIVE_PACKET_FIELD_ERROR(removed);
45991 }
45992#ifdef FREECIV_JSON_CONNECTION
45993 field_addr.name = "flags";
45994#endif /* FREECIV_JSON_CONNECTION */
45995 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
45996 RECEIVE_PACKET_FIELD_ERROR(flags);
45997 }
45998#ifdef FREECIV_JSON_CONNECTION
45999 field_addr.name = "cost";
46000#endif /* FREECIV_JSON_CONNECTION */
46001 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->cost, 100)) {
46002 RECEIVE_PACKET_FIELD_ERROR(cost);
46003 }
46004#ifdef FREECIV_JSON_CONNECTION
46005 field_addr.name = "num_reqs";
46006#endif /* FREECIV_JSON_CONNECTION */
46007 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->num_reqs)) {
46008 RECEIVE_PACKET_FIELD_ERROR(num_reqs);
46009 }
46010#ifdef FREECIV_JSON_CONNECTION
46011 field_addr.name = "name";
46012#endif /* FREECIV_JSON_CONNECTION */
46013 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
46014 RECEIVE_PACKET_FIELD_ERROR(name);
46015 }
46016#ifdef FREECIV_JSON_CONNECTION
46017 field_addr.name = "rule_name";
46018#endif /* FREECIV_JSON_CONNECTION */
46019 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
46020 RECEIVE_PACKET_FIELD_ERROR(rule_name);
46021 }
46022#ifdef FREECIV_JSON_CONNECTION
46023 field_addr.name = "helptext";
46024#endif /* FREECIV_JSON_CONNECTION */
46025 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
46026 RECEIVE_PACKET_FIELD_ERROR(helptext);
46027 }
46028#ifdef FREECIV_JSON_CONNECTION
46029 field_addr.name = "graphic_str";
46030#endif /* FREECIV_JSON_CONNECTION */
46031 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
46032 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
46033 }
46034#ifdef FREECIV_JSON_CONNECTION
46035 field_addr.name = "graphic_alt";
46036#endif /* FREECIV_JSON_CONNECTION */
46037 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
46038 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
46039 }
46040#endif
46041 log_packet_detailed("packet_ruleset_tech_100: got info about ()");
46042
46043#ifdef FREECIV_DELTA_PROTOCOL
46044 if (NULL == *hash) {
46045 *hash = genhash_new_full(hash_packet_ruleset_tech_100, cmp_packet_ruleset_tech_100,
46046 NULL, NULL, NULL, free);
46047 }
46048
46049 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
46050 *real_packet = *old;
46051 } else {
46052 log_packet_detailed(" no old info");
46053 memset(real_packet, 0, sizeof(*real_packet));
46054 }
46055
46056 if (BV_ISSET(fields, 0)) {
46057 log_packet_detailed(" got field 'id'");
46058#ifdef FREECIV_JSON_CONNECTION
46059 field_addr.name = "id";
46060#endif /* FREECIV_JSON_CONNECTION */
46061 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
46062 RECEIVE_PACKET_FIELD_ERROR(id);
46063 }
46064 }
46065 if (BV_ISSET(fields, 1)) {
46066 log_packet_detailed(" got field 'root_req'");
46067#ifdef FREECIV_JSON_CONNECTION
46068 field_addr.name = "root_req";
46069#endif /* FREECIV_JSON_CONNECTION */
46070 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->root_req)) {
46071 RECEIVE_PACKET_FIELD_ERROR(root_req);
46072 }
46073 }
46074 if (BV_ISSET(fields, 2)) {
46075 log_packet_detailed(" got field 'research_reqs_count'");
46076#ifdef FREECIV_JSON_CONNECTION
46077 field_addr.name = "research_reqs_count";
46078#endif /* FREECIV_JSON_CONNECTION */
46079 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->research_reqs_count)) {
46080 RECEIVE_PACKET_FIELD_ERROR(research_reqs_count);
46081 }
46082 }
46083 if (BV_ISSET(fields, 3)) {
46084 log_packet_detailed(" got field 'research_reqs'");
46085#ifdef FREECIV_JSON_CONNECTION
46086 field_addr.name = "research_reqs";
46087#endif /* FREECIV_JSON_CONNECTION */
46088 {
46089 int i;
46090
46091#ifdef FREECIV_JSON_CONNECTION
46092 /* Enter array. */
46093 field_addr.sub_location = plocation_elem_new(0);
46094#endif /* FREECIV_JSON_CONNECTION */
46095
46096 if (real_packet->research_reqs_count > MAX_NUM_REQS) {
46097 RECEIVE_PACKET_FIELD_ERROR(research_reqs, ": truncation array");
46098 }
46099 for (i = 0; i < real_packet->research_reqs_count; i++) {
46100#ifdef FREECIV_JSON_CONNECTION
46101 field_addr.sub_location->number = i;
46102#endif /* FREECIV_JSON_CONNECTION */
46103 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->research_reqs[i])) {
46104 RECEIVE_PACKET_FIELD_ERROR(research_reqs);
46105 }
46106 }
46107
46108#ifdef FREECIV_JSON_CONNECTION
46109 /* Exit array. */
46110 FC_FREE(field_addr.sub_location);
46111#endif /* FREECIV_JSON_CONNECTION */
46112 }
46113 }
46114 if (BV_ISSET(fields, 4)) {
46115 log_packet_detailed(" got field 'tclass'");
46116#ifdef FREECIV_JSON_CONNECTION
46117 field_addr.name = "tclass";
46118#endif /* FREECIV_JSON_CONNECTION */
46119 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
46120 RECEIVE_PACKET_FIELD_ERROR(tclass);
46121 }
46122 }
46123 real_packet->removed = BV_ISSET(fields, 5);
46124 if (BV_ISSET(fields, 6)) {
46125 log_packet_detailed(" got field 'flags'");
46126#ifdef FREECIV_JSON_CONNECTION
46127 field_addr.name = "flags";
46128#endif /* FREECIV_JSON_CONNECTION */
46129 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
46130 RECEIVE_PACKET_FIELD_ERROR(flags);
46131 }
46132 }
46133 if (BV_ISSET(fields, 7)) {
46134 log_packet_detailed(" got field 'cost'");
46135#ifdef FREECIV_JSON_CONNECTION
46136 field_addr.name = "cost";
46137#endif /* FREECIV_JSON_CONNECTION */
46138 if (!DIO_GET(ufloat, &din, &field_addr, &real_packet->cost, 100)) {
46139 RECEIVE_PACKET_FIELD_ERROR(cost);
46140 }
46141 }
46142 if (BV_ISSET(fields, 8)) {
46143 log_packet_detailed(" got field 'num_reqs'");
46144#ifdef FREECIV_JSON_CONNECTION
46145 field_addr.name = "num_reqs";
46146#endif /* FREECIV_JSON_CONNECTION */
46147 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->num_reqs)) {
46148 RECEIVE_PACKET_FIELD_ERROR(num_reqs);
46149 }
46150 }
46151 if (BV_ISSET(fields, 9)) {
46152 log_packet_detailed(" got field 'name'");
46153#ifdef FREECIV_JSON_CONNECTION
46154 field_addr.name = "name";
46155#endif /* FREECIV_JSON_CONNECTION */
46156 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
46157 RECEIVE_PACKET_FIELD_ERROR(name);
46158 }
46159 }
46160 if (BV_ISSET(fields, 10)) {
46161 log_packet_detailed(" got field 'rule_name'");
46162#ifdef FREECIV_JSON_CONNECTION
46163 field_addr.name = "rule_name";
46164#endif /* FREECIV_JSON_CONNECTION */
46165 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
46166 RECEIVE_PACKET_FIELD_ERROR(rule_name);
46167 }
46168 }
46169 if (BV_ISSET(fields, 11)) {
46170 log_packet_detailed(" got field 'helptext'");
46171#ifdef FREECIV_JSON_CONNECTION
46172 field_addr.name = "helptext";
46173#endif /* FREECIV_JSON_CONNECTION */
46174 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
46175 RECEIVE_PACKET_FIELD_ERROR(helptext);
46176 }
46177 }
46178 if (BV_ISSET(fields, 12)) {
46179 log_packet_detailed(" got field 'graphic_str'");
46180#ifdef FREECIV_JSON_CONNECTION
46181 field_addr.name = "graphic_str";
46182#endif /* FREECIV_JSON_CONNECTION */
46183 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
46184 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
46185 }
46186 }
46187 if (BV_ISSET(fields, 13)) {
46188 log_packet_detailed(" got field 'graphic_alt'");
46189#ifdef FREECIV_JSON_CONNECTION
46190 field_addr.name = "graphic_alt";
46191#endif /* FREECIV_JSON_CONNECTION */
46192 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
46193 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
46194 }
46195 }
46196
46197 if (NULL == old) {
46198 old = fc_malloc(sizeof(*old));
46199 *old = *real_packet;
46200 genhash_insert(*hash, old, old);
46201 } else {
46202 *old = *real_packet;
46203 }
46204
46205#endif /* FREECIV_DELTA_PROTOCOL */
46206 RECEIVE_PACKET_END(real_packet);
46207}
46208
46209 static int send_packet_ruleset_tech_100(struct connection *pc, const struct packet_ruleset_tech *packet)
46210{
46211 const struct packet_ruleset_tech *real_packet = packet;
46212 int e;
46213#ifdef FREECIV_DELTA_PROTOCOL
46214 packet_ruleset_tech_100_fields fields;
46215 struct packet_ruleset_tech *old;
46216 bool differ;
46217 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH;
46218#endif /* FREECIV_DELTA_PROTOCOL */
46219 SEND_PACKET_START(PACKET_RULESET_TECH);
46220#ifdef FREECIV_JSON_CONNECTION
46221 struct plocation field_addr;
46222 {
46223 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46224 field_addr = *field_addr_tmp;
46225 FC_FREE(field_addr_tmp);
46226 }
46227#endif /* FREECIV_JSON_CONNECTION */
46228
46229 log_packet_detailed("packet_ruleset_tech_100: sending info about ()");
46230
46231#ifdef FREECIV_DELTA_PROTOCOL
46232 if (NULL == *hash) {
46233 *hash = genhash_new_full(hash_packet_ruleset_tech_100, cmp_packet_ruleset_tech_100,
46234 NULL, NULL, NULL, free);
46235 }
46236 BV_CLR_ALL(fields);
46237
46238 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
46239 old = fc_malloc(sizeof(*old));
46240 *old = *real_packet;
46241 genhash_insert(*hash, old, old);
46242 memset(old, 0, sizeof(*old));
46243 }
46244 differ = (old->id != real_packet->id);
46245 if (differ) {
46246 BV_SET(fields, 0);
46247 }
46248
46249 differ = (old->root_req != real_packet->root_req);
46250 if (differ) {
46251 BV_SET(fields, 1);
46252 }
46253
46254 differ = (old->research_reqs_count != real_packet->research_reqs_count);
46255 if (differ) {
46256 BV_SET(fields, 2);
46257 }
46258
46259 differ = (old->research_reqs_count != real_packet->research_reqs_count);
46260 if (!differ) {
46261 int i;
46262
46263 for (i = 0; i < real_packet->research_reqs_count; i++) {
46264 differ = !are_requirements_equal(&old->research_reqs[i], &real_packet->research_reqs[i]);
46265 if (differ) {
46266 break;
46267 }
46268 }
46269 }
46270 if (differ) {
46271 BV_SET(fields, 3);
46272 }
46273
46274 differ = (old->tclass != real_packet->tclass);
46275 if (differ) {
46276 BV_SET(fields, 4);
46277 }
46278
46279 if (packet->removed) {
46280 BV_SET(fields, 5);
46281 }
46282
46283 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
46284 if (differ) {
46285 BV_SET(fields, 6);
46286 }
46287
46288 differ = (old->cost != real_packet->cost);
46289 if (differ) {
46290 BV_SET(fields, 7);
46291 }
46292
46293 differ = (old->num_reqs != real_packet->num_reqs);
46294 if (differ) {
46295 BV_SET(fields, 8);
46296 }
46297
46298 differ = (strcmp(old->name, real_packet->name) != 0);
46299 if (differ) {
46300 BV_SET(fields, 9);
46301 }
46302
46303 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
46304 if (differ) {
46305 BV_SET(fields, 10);
46306 }
46307
46308 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
46309 if (differ) {
46310 BV_SET(fields, 11);
46311 }
46312
46313 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
46314 if (differ) {
46315 BV_SET(fields, 12);
46316 }
46317
46318 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
46319 if (differ) {
46320 BV_SET(fields, 13);
46321 }
46322
46323
46324#ifdef FREECIV_JSON_CONNECTION
46325 field_addr.name = "fields";
46326#endif /* FREECIV_JSON_CONNECTION */
46327 e = 0;
46328 e |= DIO_BV_PUT(&dout, &field_addr, fields);
46329 if (e) {
46330 log_packet_detailed("fields bitvector error detected");
46331 }
46332
46333 if (BV_ISSET(fields, 0)) {
46334 log_packet_detailed(" field 'id' has changed");
46335#ifdef FREECIV_JSON_CONNECTION
46336 field_addr.name = "id";
46337#endif /* FREECIV_JSON_CONNECTION */
46338 e = 0;
46339 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
46340 if (e) {
46341 log_packet_detailed("'id' field error detected");
46342 }
46343 }
46344 if (BV_ISSET(fields, 1)) {
46345 log_packet_detailed(" field 'root_req' has changed");
46346#ifdef FREECIV_JSON_CONNECTION
46347 field_addr.name = "root_req";
46348#endif /* FREECIV_JSON_CONNECTION */
46349 e = 0;
46350 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->root_req);
46351 if (e) {
46352 log_packet_detailed("'root_req' field error detected");
46353 }
46354 }
46355 if (BV_ISSET(fields, 2)) {
46356 log_packet_detailed(" field 'research_reqs_count' has changed");
46357#ifdef FREECIV_JSON_CONNECTION
46358 field_addr.name = "research_reqs_count";
46359#endif /* FREECIV_JSON_CONNECTION */
46360 e = 0;
46361 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->research_reqs_count);
46362 if (e) {
46363 log_packet_detailed("'research_reqs_count' field error detected");
46364 }
46365 }
46366 if (BV_ISSET(fields, 3)) {
46367 log_packet_detailed(" field 'research_reqs' has changed");
46368#ifdef FREECIV_JSON_CONNECTION
46369 field_addr.name = "research_reqs";
46370#endif /* FREECIV_JSON_CONNECTION */
46371 e = 0;
46372 {
46373 int i;
46374
46375#ifdef FREECIV_JSON_CONNECTION
46376 /* Create the array. */
46377 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->research_reqs_count);
46378
46379 /* Enter the array. */
46380 field_addr.sub_location = plocation_elem_new(0);
46381#endif /* FREECIV_JSON_CONNECTION */
46382
46383 for (i = 0; i < real_packet->research_reqs_count; i++) {
46384#ifdef FREECIV_JSON_CONNECTION
46385 /* Next array element. */
46386 field_addr.sub_location->number = i;
46387#endif /* FREECIV_JSON_CONNECTION */
46388 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->research_reqs[i]);
46389 }
46390
46391#ifdef FREECIV_JSON_CONNECTION
46392 /* Exit array. */
46393 FC_FREE(field_addr.sub_location);
46394#endif /* FREECIV_JSON_CONNECTION */
46395 }
46396 if (e) {
46397 log_packet_detailed("'research_reqs' field error detected");
46398 }
46399 }
46400 if (BV_ISSET(fields, 4)) {
46401 log_packet_detailed(" field 'tclass' has changed");
46402#ifdef FREECIV_JSON_CONNECTION
46403 field_addr.name = "tclass";
46404#endif /* FREECIV_JSON_CONNECTION */
46405 e = 0;
46406 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
46407 if (e) {
46408 log_packet_detailed("'tclass' field error detected");
46409 }
46410 }
46411 /* field 5 is folded into the header */
46412 if (BV_ISSET(fields, 6)) {
46413 log_packet_detailed(" field 'flags' has changed");
46414#ifdef FREECIV_JSON_CONNECTION
46415 field_addr.name = "flags";
46416#endif /* FREECIV_JSON_CONNECTION */
46417 e = 0;
46418 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
46419 if (e) {
46420 log_packet_detailed("'flags' field error detected");
46421 }
46422 }
46423 if (BV_ISSET(fields, 7)) {
46424 log_packet_detailed(" field 'cost' has changed");
46425#ifdef FREECIV_JSON_CONNECTION
46426 field_addr.name = "cost";
46427#endif /* FREECIV_JSON_CONNECTION */
46428 e = 0;
46429 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->cost, 100);
46430 if (e) {
46431 log_packet_detailed("'cost' field error detected");
46432 }
46433 }
46434 if (BV_ISSET(fields, 8)) {
46435 log_packet_detailed(" field 'num_reqs' has changed");
46436#ifdef FREECIV_JSON_CONNECTION
46437 field_addr.name = "num_reqs";
46438#endif /* FREECIV_JSON_CONNECTION */
46439 e = 0;
46440 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->num_reqs);
46441 if (e) {
46442 log_packet_detailed("'num_reqs' field error detected");
46443 }
46444 }
46445 if (BV_ISSET(fields, 9)) {
46446 log_packet_detailed(" field 'name' has changed");
46447#ifdef FREECIV_JSON_CONNECTION
46448 field_addr.name = "name";
46449#endif /* FREECIV_JSON_CONNECTION */
46450 e = 0;
46451 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
46452 if (e) {
46453 log_packet_detailed("'name' field error detected");
46454 }
46455 }
46456 if (BV_ISSET(fields, 10)) {
46457 log_packet_detailed(" field 'rule_name' has changed");
46458#ifdef FREECIV_JSON_CONNECTION
46459 field_addr.name = "rule_name";
46460#endif /* FREECIV_JSON_CONNECTION */
46461 e = 0;
46462 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
46463 if (e) {
46464 log_packet_detailed("'rule_name' field error detected");
46465 }
46466 }
46467 if (BV_ISSET(fields, 11)) {
46468 log_packet_detailed(" field 'helptext' has changed");
46469#ifdef FREECIV_JSON_CONNECTION
46470 field_addr.name = "helptext";
46471#endif /* FREECIV_JSON_CONNECTION */
46472 e = 0;
46473 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
46474 if (e) {
46475 log_packet_detailed("'helptext' field error detected");
46476 }
46477 }
46478 if (BV_ISSET(fields, 12)) {
46479 log_packet_detailed(" field 'graphic_str' has changed");
46480#ifdef FREECIV_JSON_CONNECTION
46481 field_addr.name = "graphic_str";
46482#endif /* FREECIV_JSON_CONNECTION */
46483 e = 0;
46484 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
46485 if (e) {
46486 log_packet_detailed("'graphic_str' field error detected");
46487 }
46488 }
46489 if (BV_ISSET(fields, 13)) {
46490 log_packet_detailed(" field 'graphic_alt' has changed");
46491#ifdef FREECIV_JSON_CONNECTION
46492 field_addr.name = "graphic_alt";
46493#endif /* FREECIV_JSON_CONNECTION */
46494 e = 0;
46495 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
46496 if (e) {
46497 log_packet_detailed("'graphic_alt' field error detected");
46498 }
46499 }
46500
46501 *old = *real_packet;
46502#endif /* FREECIV_DELTA_PROTOCOL */
46503#ifndef FREECIV_DELTA_PROTOCOL
46504#ifdef FREECIV_JSON_CONNECTION
46505 field_addr.name = "id";
46506#endif /* FREECIV_JSON_CONNECTION */
46507 e = 0;
46508 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
46509 if (e) {
46510 log_packet_detailed("'id' field error detected");
46511 }
46512#ifdef FREECIV_JSON_CONNECTION
46513 field_addr.name = "root_req";
46514#endif /* FREECIV_JSON_CONNECTION */
46515 e = 0;
46516 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->root_req);
46517 if (e) {
46518 log_packet_detailed("'root_req' field error detected");
46519 }
46520#ifdef FREECIV_JSON_CONNECTION
46521 field_addr.name = "research_reqs_count";
46522#endif /* FREECIV_JSON_CONNECTION */
46523 e = 0;
46524 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->research_reqs_count);
46525 if (e) {
46526 log_packet_detailed("'research_reqs_count' field error detected");
46527 }
46528#ifdef FREECIV_JSON_CONNECTION
46529 field_addr.name = "research_reqs";
46530#endif /* FREECIV_JSON_CONNECTION */
46531 e = 0;
46532 {
46533 int i;
46534
46535#ifdef FREECIV_JSON_CONNECTION
46536 /* Create the array. */
46537 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->research_reqs_count);
46538
46539 /* Enter the array. */
46540 field_addr.sub_location = plocation_elem_new(0);
46541#endif /* FREECIV_JSON_CONNECTION */
46542
46543 for (i = 0; i < real_packet->research_reqs_count; i++) {
46544#ifdef FREECIV_JSON_CONNECTION
46545 /* Next array element. */
46546 field_addr.sub_location->number = i;
46547#endif /* FREECIV_JSON_CONNECTION */
46548 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->research_reqs[i]);
46549 }
46550
46551#ifdef FREECIV_JSON_CONNECTION
46552 /* Exit array. */
46553 FC_FREE(field_addr.sub_location);
46554#endif /* FREECIV_JSON_CONNECTION */
46555 }
46556 if (e) {
46557 log_packet_detailed("'research_reqs' field error detected");
46558 }
46559#ifdef FREECIV_JSON_CONNECTION
46560 field_addr.name = "tclass";
46561#endif /* FREECIV_JSON_CONNECTION */
46562 e = 0;
46563 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
46564 if (e) {
46565 log_packet_detailed("'tclass' field error detected");
46566 }
46567#ifdef FREECIV_JSON_CONNECTION
46568 field_addr.name = "removed";
46569#endif /* FREECIV_JSON_CONNECTION */
46570 e = 0;
46571 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->removed);
46572 if (e) {
46573 log_packet_detailed("'removed' field error detected");
46574 }
46575#ifdef FREECIV_JSON_CONNECTION
46576 field_addr.name = "flags";
46577#endif /* FREECIV_JSON_CONNECTION */
46578 e = 0;
46579 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
46580 if (e) {
46581 log_packet_detailed("'flags' field error detected");
46582 }
46583#ifdef FREECIV_JSON_CONNECTION
46584 field_addr.name = "cost";
46585#endif /* FREECIV_JSON_CONNECTION */
46586 e = 0;
46587 e |= DIO_PUT(ufloat, &dout, &field_addr, real_packet->cost, 100);
46588 if (e) {
46589 log_packet_detailed("'cost' field error detected");
46590 }
46591#ifdef FREECIV_JSON_CONNECTION
46592 field_addr.name = "num_reqs";
46593#endif /* FREECIV_JSON_CONNECTION */
46594 e = 0;
46595 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->num_reqs);
46596 if (e) {
46597 log_packet_detailed("'num_reqs' field error detected");
46598 }
46599#ifdef FREECIV_JSON_CONNECTION
46600 field_addr.name = "name";
46601#endif /* FREECIV_JSON_CONNECTION */
46602 e = 0;
46603 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
46604 if (e) {
46605 log_packet_detailed("'name' field error detected");
46606 }
46607#ifdef FREECIV_JSON_CONNECTION
46608 field_addr.name = "rule_name";
46609#endif /* FREECIV_JSON_CONNECTION */
46610 e = 0;
46611 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
46612 if (e) {
46613 log_packet_detailed("'rule_name' field error detected");
46614 }
46615#ifdef FREECIV_JSON_CONNECTION
46616 field_addr.name = "helptext";
46617#endif /* FREECIV_JSON_CONNECTION */
46618 e = 0;
46619 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
46620 if (e) {
46621 log_packet_detailed("'helptext' field error detected");
46622 }
46623#ifdef FREECIV_JSON_CONNECTION
46624 field_addr.name = "graphic_str";
46625#endif /* FREECIV_JSON_CONNECTION */
46626 e = 0;
46627 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
46628 if (e) {
46629 log_packet_detailed("'graphic_str' field error detected");
46630 }
46631#ifdef FREECIV_JSON_CONNECTION
46632 field_addr.name = "graphic_alt";
46633#endif /* FREECIV_JSON_CONNECTION */
46634 e = 0;
46635 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
46636 if (e) {
46637 log_packet_detailed("'graphic_alt' field error detected");
46638 }
46639
46640#endif
46641 SEND_PACKET_END(PACKET_RULESET_TECH);
46642}
46643
46644 int send_packet_ruleset_tech(struct connection *pc, const struct packet_ruleset_tech *packet)
46645{
46646 if (!pc->used) {
46647 log_error("WARNING: trying to send data to the closed connection %s",
46648 conn_description(pc));
46649 return -1;
46650 }
46651 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH].packet != NULL, -1,
46652 "Handler for PACKET_RULESET_TECH not installed");
46653 return pc->phs.handlers->send[PACKET_RULESET_TECH].packet(pc, packet);
46654}
46655
46656 void lsend_packet_ruleset_tech(struct conn_list *dest, const struct packet_ruleset_tech *packet)
46657{
46658 conn_list_iterate(dest, pconn) {
46659 send_packet_ruleset_tech(pconn, packet);
46660 } conn_list_iterate_end;
46661}
46662
46663#ifdef FREECIV_DELTA_PROTOCOL
46664#define hash_packet_ruleset_tech_class_100 hash_const
46665
46666#define cmp_packet_ruleset_tech_class_100 cmp_const
46667
46668 BV_DEFINE(packet_ruleset_tech_class_100_fields, 4);
46669#endif /* FREECIV_DELTA_PROTOCOL */
46670
46671 static struct packet_ruleset_tech_class *receive_packet_ruleset_tech_class_100(struct connection *pc)
46672{
46673#ifdef FREECIV_DELTA_PROTOCOL
46674 packet_ruleset_tech_class_100_fields fields;
46675 struct packet_ruleset_tech_class *old;
46676 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH_CLASS;
46677#endif /* FREECIV_DELTA_PROTOCOL */
46678 RECEIVE_PACKET_START(packet_ruleset_tech_class, real_packet);
46679#ifdef FREECIV_JSON_CONNECTION
46680 struct plocation field_addr;
46681 {
46682 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46683 field_addr = *field_addr_tmp;
46684 FC_FREE(field_addr_tmp);
46685 }
46686#endif /* FREECIV_JSON_CONNECTION */
46687
46688#ifdef FREECIV_DELTA_PROTOCOL
46689#ifdef FREECIV_JSON_CONNECTION
46690 field_addr.name = "fields";
46691#endif /* FREECIV_JSON_CONNECTION */
46692 DIO_BV_GET(&din, &field_addr, fields);
46693
46694#else /* FREECIV_DELTA_PROTOCOL */
46695#ifdef FREECIV_JSON_CONNECTION
46696 field_addr.name = "id";
46697#endif /* FREECIV_JSON_CONNECTION */
46698 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
46699 RECEIVE_PACKET_FIELD_ERROR(id);
46700 }
46701#ifdef FREECIV_JSON_CONNECTION
46702 field_addr.name = "name";
46703#endif /* FREECIV_JSON_CONNECTION */
46704 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
46705 RECEIVE_PACKET_FIELD_ERROR(name);
46706 }
46707#ifdef FREECIV_JSON_CONNECTION
46708 field_addr.name = "rule_name";
46709#endif /* FREECIV_JSON_CONNECTION */
46710 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
46711 RECEIVE_PACKET_FIELD_ERROR(rule_name);
46712 }
46713#ifdef FREECIV_JSON_CONNECTION
46714 field_addr.name = "cost_pct";
46715#endif /* FREECIV_JSON_CONNECTION */
46716 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->cost_pct)) {
46717 RECEIVE_PACKET_FIELD_ERROR(cost_pct);
46718 }
46719#endif
46720 log_packet_detailed("packet_ruleset_tech_class_100: got info about ()");
46721
46722#ifdef FREECIV_DELTA_PROTOCOL
46723 if (NULL == *hash) {
46724 *hash = genhash_new_full(hash_packet_ruleset_tech_class_100, cmp_packet_ruleset_tech_class_100,
46725 NULL, NULL, NULL, free);
46726 }
46727
46728 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
46729 *real_packet = *old;
46730 } else {
46731 log_packet_detailed(" no old info");
46732 memset(real_packet, 0, sizeof(*real_packet));
46733 }
46734
46735 if (BV_ISSET(fields, 0)) {
46736 log_packet_detailed(" got field 'id'");
46737#ifdef FREECIV_JSON_CONNECTION
46738 field_addr.name = "id";
46739#endif /* FREECIV_JSON_CONNECTION */
46740 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
46741 RECEIVE_PACKET_FIELD_ERROR(id);
46742 }
46743 }
46744 if (BV_ISSET(fields, 1)) {
46745 log_packet_detailed(" got field 'name'");
46746#ifdef FREECIV_JSON_CONNECTION
46747 field_addr.name = "name";
46748#endif /* FREECIV_JSON_CONNECTION */
46749 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
46750 RECEIVE_PACKET_FIELD_ERROR(name);
46751 }
46752 }
46753 if (BV_ISSET(fields, 2)) {
46754 log_packet_detailed(" got field 'rule_name'");
46755#ifdef FREECIV_JSON_CONNECTION
46756 field_addr.name = "rule_name";
46757#endif /* FREECIV_JSON_CONNECTION */
46758 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
46759 RECEIVE_PACKET_FIELD_ERROR(rule_name);
46760 }
46761 }
46762 if (BV_ISSET(fields, 3)) {
46763 log_packet_detailed(" got field 'cost_pct'");
46764#ifdef FREECIV_JSON_CONNECTION
46765 field_addr.name = "cost_pct";
46766#endif /* FREECIV_JSON_CONNECTION */
46767 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->cost_pct)) {
46768 RECEIVE_PACKET_FIELD_ERROR(cost_pct);
46769 }
46770 }
46771
46772 if (NULL == old) {
46773 old = fc_malloc(sizeof(*old));
46774 *old = *real_packet;
46775 genhash_insert(*hash, old, old);
46776 } else {
46777 *old = *real_packet;
46778 }
46779
46780#endif /* FREECIV_DELTA_PROTOCOL */
46781 RECEIVE_PACKET_END(real_packet);
46782}
46783
46784 static int send_packet_ruleset_tech_class_100(struct connection *pc, const struct packet_ruleset_tech_class *packet)
46785{
46786 const struct packet_ruleset_tech_class *real_packet = packet;
46787 int e;
46788#ifdef FREECIV_DELTA_PROTOCOL
46789 packet_ruleset_tech_class_100_fields fields;
46790 struct packet_ruleset_tech_class *old;
46791 bool differ;
46792 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH_CLASS;
46793#endif /* FREECIV_DELTA_PROTOCOL */
46794 SEND_PACKET_START(PACKET_RULESET_TECH_CLASS);
46795#ifdef FREECIV_JSON_CONNECTION
46796 struct plocation field_addr;
46797 {
46798 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46799 field_addr = *field_addr_tmp;
46800 FC_FREE(field_addr_tmp);
46801 }
46802#endif /* FREECIV_JSON_CONNECTION */
46803
46804 log_packet_detailed("packet_ruleset_tech_class_100: sending info about ()");
46805
46806#ifdef FREECIV_DELTA_PROTOCOL
46807 if (NULL == *hash) {
46808 *hash = genhash_new_full(hash_packet_ruleset_tech_class_100, cmp_packet_ruleset_tech_class_100,
46809 NULL, NULL, NULL, free);
46810 }
46811 BV_CLR_ALL(fields);
46812
46813 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
46814 old = fc_malloc(sizeof(*old));
46815 *old = *real_packet;
46816 genhash_insert(*hash, old, old);
46817 memset(old, 0, sizeof(*old));
46818 }
46819 differ = (old->id != real_packet->id);
46820 if (differ) {
46821 BV_SET(fields, 0);
46822 }
46823
46824 differ = (strcmp(old->name, real_packet->name) != 0);
46825 if (differ) {
46826 BV_SET(fields, 1);
46827 }
46828
46829 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
46830 if (differ) {
46831 BV_SET(fields, 2);
46832 }
46833
46834 differ = (old->cost_pct != real_packet->cost_pct);
46835 if (differ) {
46836 BV_SET(fields, 3);
46837 }
46838
46839
46840#ifdef FREECIV_JSON_CONNECTION
46841 field_addr.name = "fields";
46842#endif /* FREECIV_JSON_CONNECTION */
46843 e = 0;
46844 e |= DIO_BV_PUT(&dout, &field_addr, fields);
46845 if (e) {
46846 log_packet_detailed("fields bitvector error detected");
46847 }
46848
46849 if (BV_ISSET(fields, 0)) {
46850 log_packet_detailed(" field 'id' has changed");
46851#ifdef FREECIV_JSON_CONNECTION
46852 field_addr.name = "id";
46853#endif /* FREECIV_JSON_CONNECTION */
46854 e = 0;
46855 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
46856 if (e) {
46857 log_packet_detailed("'id' field error detected");
46858 }
46859 }
46860 if (BV_ISSET(fields, 1)) {
46861 log_packet_detailed(" field 'name' has changed");
46862#ifdef FREECIV_JSON_CONNECTION
46863 field_addr.name = "name";
46864#endif /* FREECIV_JSON_CONNECTION */
46865 e = 0;
46866 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
46867 if (e) {
46868 log_packet_detailed("'name' field error detected");
46869 }
46870 }
46871 if (BV_ISSET(fields, 2)) {
46872 log_packet_detailed(" field 'rule_name' has changed");
46873#ifdef FREECIV_JSON_CONNECTION
46874 field_addr.name = "rule_name";
46875#endif /* FREECIV_JSON_CONNECTION */
46876 e = 0;
46877 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
46878 if (e) {
46879 log_packet_detailed("'rule_name' field error detected");
46880 }
46881 }
46882 if (BV_ISSET(fields, 3)) {
46883 log_packet_detailed(" field 'cost_pct' has changed");
46884#ifdef FREECIV_JSON_CONNECTION
46885 field_addr.name = "cost_pct";
46886#endif /* FREECIV_JSON_CONNECTION */
46887 e = 0;
46888 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->cost_pct);
46889 if (e) {
46890 log_packet_detailed("'cost_pct' field error detected");
46891 }
46892 }
46893
46894 *old = *real_packet;
46895#endif /* FREECIV_DELTA_PROTOCOL */
46896#ifndef FREECIV_DELTA_PROTOCOL
46897#ifdef FREECIV_JSON_CONNECTION
46898 field_addr.name = "id";
46899#endif /* FREECIV_JSON_CONNECTION */
46900 e = 0;
46901 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
46902 if (e) {
46903 log_packet_detailed("'id' field error detected");
46904 }
46905#ifdef FREECIV_JSON_CONNECTION
46906 field_addr.name = "name";
46907#endif /* FREECIV_JSON_CONNECTION */
46908 e = 0;
46909 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
46910 if (e) {
46911 log_packet_detailed("'name' field error detected");
46912 }
46913#ifdef FREECIV_JSON_CONNECTION
46914 field_addr.name = "rule_name";
46915#endif /* FREECIV_JSON_CONNECTION */
46916 e = 0;
46917 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
46918 if (e) {
46919 log_packet_detailed("'rule_name' field error detected");
46920 }
46921#ifdef FREECIV_JSON_CONNECTION
46922 field_addr.name = "cost_pct";
46923#endif /* FREECIV_JSON_CONNECTION */
46924 e = 0;
46925 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->cost_pct);
46926 if (e) {
46927 log_packet_detailed("'cost_pct' field error detected");
46928 }
46929
46930#endif
46931 SEND_PACKET_END(PACKET_RULESET_TECH_CLASS);
46932}
46933
46934 int send_packet_ruleset_tech_class(struct connection *pc, const struct packet_ruleset_tech_class *packet)
46935{
46936 if (!pc->used) {
46937 log_error("WARNING: trying to send data to the closed connection %s",
46938 conn_description(pc));
46939 return -1;
46940 }
46941 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH_CLASS].packet != NULL, -1,
46942 "Handler for PACKET_RULESET_TECH_CLASS not installed");
46943 return pc->phs.handlers->send[PACKET_RULESET_TECH_CLASS].packet(pc, packet);
46944}
46945
46946 void lsend_packet_ruleset_tech_class(struct conn_list *dest, const struct packet_ruleset_tech_class *packet)
46947{
46948 conn_list_iterate(dest, pconn) {
46949 send_packet_ruleset_tech_class(pconn, packet);
46950 } conn_list_iterate_end;
46951}
46952
46953#ifdef FREECIV_DELTA_PROTOCOL
46954#define hash_packet_ruleset_tech_flag_100 hash_const
46955
46956#define cmp_packet_ruleset_tech_flag_100 cmp_const
46957
46958 BV_DEFINE(packet_ruleset_tech_flag_100_fields, 3);
46959#endif /* FREECIV_DELTA_PROTOCOL */
46960
46961 static struct packet_ruleset_tech_flag *receive_packet_ruleset_tech_flag_100(struct connection *pc)
46962{
46963#ifdef FREECIV_DELTA_PROTOCOL
46964 packet_ruleset_tech_flag_100_fields fields;
46965 struct packet_ruleset_tech_flag *old;
46966 struct genhash **hash = pc->phs.received + PACKET_RULESET_TECH_FLAG;
46967#endif /* FREECIV_DELTA_PROTOCOL */
46968 RECEIVE_PACKET_START(packet_ruleset_tech_flag, real_packet);
46969#ifdef FREECIV_JSON_CONNECTION
46970 struct plocation field_addr;
46971 {
46972 struct plocation *field_addr_tmp = plocation_field_new(NULL);
46973 field_addr = *field_addr_tmp;
46974 FC_FREE(field_addr_tmp);
46975 }
46976#endif /* FREECIV_JSON_CONNECTION */
46977
46978#ifdef FREECIV_DELTA_PROTOCOL
46979#ifdef FREECIV_JSON_CONNECTION
46980 field_addr.name = "fields";
46981#endif /* FREECIV_JSON_CONNECTION */
46982 DIO_BV_GET(&din, &field_addr, fields);
46983
46984#else /* FREECIV_DELTA_PROTOCOL */
46985#ifdef FREECIV_JSON_CONNECTION
46986 field_addr.name = "id";
46987#endif /* FREECIV_JSON_CONNECTION */
46988 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
46989 RECEIVE_PACKET_FIELD_ERROR(id);
46990 }
46991#ifdef FREECIV_JSON_CONNECTION
46992 field_addr.name = "name";
46993#endif /* FREECIV_JSON_CONNECTION */
46994 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
46995 RECEIVE_PACKET_FIELD_ERROR(name);
46996 }
46997#ifdef FREECIV_JSON_CONNECTION
46998 field_addr.name = "helptxt";
46999#endif /* FREECIV_JSON_CONNECTION */
47000 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
47001 RECEIVE_PACKET_FIELD_ERROR(helptxt);
47002 }
47003#endif
47004 log_packet_detailed("packet_ruleset_tech_flag_100: got info about ()");
47005
47006#ifdef FREECIV_DELTA_PROTOCOL
47007 if (NULL == *hash) {
47008 *hash = genhash_new_full(hash_packet_ruleset_tech_flag_100, cmp_packet_ruleset_tech_flag_100,
47009 NULL, NULL, NULL, free);
47010 }
47011
47012 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47013 *real_packet = *old;
47014 } else {
47015 log_packet_detailed(" no old info");
47016 memset(real_packet, 0, sizeof(*real_packet));
47017 }
47018
47019 if (BV_ISSET(fields, 0)) {
47020 log_packet_detailed(" got field 'id'");
47021#ifdef FREECIV_JSON_CONNECTION
47022 field_addr.name = "id";
47023#endif /* FREECIV_JSON_CONNECTION */
47024 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
47025 RECEIVE_PACKET_FIELD_ERROR(id);
47026 }
47027 }
47028 if (BV_ISSET(fields, 1)) {
47029 log_packet_detailed(" got field 'name'");
47030#ifdef FREECIV_JSON_CONNECTION
47031 field_addr.name = "name";
47032#endif /* FREECIV_JSON_CONNECTION */
47033 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
47034 RECEIVE_PACKET_FIELD_ERROR(name);
47035 }
47036 }
47037 if (BV_ISSET(fields, 2)) {
47038 log_packet_detailed(" got field 'helptxt'");
47039#ifdef FREECIV_JSON_CONNECTION
47040 field_addr.name = "helptxt";
47041#endif /* FREECIV_JSON_CONNECTION */
47042 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
47043 RECEIVE_PACKET_FIELD_ERROR(helptxt);
47044 }
47045 }
47046
47047 if (NULL == old) {
47048 old = fc_malloc(sizeof(*old));
47049 *old = *real_packet;
47050 genhash_insert(*hash, old, old);
47051 } else {
47052 *old = *real_packet;
47053 }
47054
47055#endif /* FREECIV_DELTA_PROTOCOL */
47056 RECEIVE_PACKET_END(real_packet);
47057}
47058
47059 static int send_packet_ruleset_tech_flag_100(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
47060{
47061 const struct packet_ruleset_tech_flag *real_packet = packet;
47062 int e;
47063#ifdef FREECIV_DELTA_PROTOCOL
47064 packet_ruleset_tech_flag_100_fields fields;
47065 struct packet_ruleset_tech_flag *old;
47066 bool differ;
47067 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TECH_FLAG;
47068#endif /* FREECIV_DELTA_PROTOCOL */
47069 SEND_PACKET_START(PACKET_RULESET_TECH_FLAG);
47070#ifdef FREECIV_JSON_CONNECTION
47071 struct plocation field_addr;
47072 {
47073 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47074 field_addr = *field_addr_tmp;
47075 FC_FREE(field_addr_tmp);
47076 }
47077#endif /* FREECIV_JSON_CONNECTION */
47078
47079 log_packet_detailed("packet_ruleset_tech_flag_100: sending info about ()");
47080
47081#ifdef FREECIV_DELTA_PROTOCOL
47082 if (NULL == *hash) {
47083 *hash = genhash_new_full(hash_packet_ruleset_tech_flag_100, cmp_packet_ruleset_tech_flag_100,
47084 NULL, NULL, NULL, free);
47085 }
47086 BV_CLR_ALL(fields);
47087
47088 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
47089 old = fc_malloc(sizeof(*old));
47090 *old = *real_packet;
47091 genhash_insert(*hash, old, old);
47092 memset(old, 0, sizeof(*old));
47093 }
47094 differ = (old->id != real_packet->id);
47095 if (differ) {
47096 BV_SET(fields, 0);
47097 }
47098
47099 differ = (strcmp(old->name, real_packet->name) != 0);
47100 if (differ) {
47101 BV_SET(fields, 1);
47102 }
47103
47104 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
47105 if (differ) {
47106 BV_SET(fields, 2);
47107 }
47108
47109
47110#ifdef FREECIV_JSON_CONNECTION
47111 field_addr.name = "fields";
47112#endif /* FREECIV_JSON_CONNECTION */
47113 e = 0;
47114 e |= DIO_BV_PUT(&dout, &field_addr, fields);
47115 if (e) {
47116 log_packet_detailed("fields bitvector error detected");
47117 }
47118
47119 if (BV_ISSET(fields, 0)) {
47120 log_packet_detailed(" field 'id' has changed");
47121#ifdef FREECIV_JSON_CONNECTION
47122 field_addr.name = "id";
47123#endif /* FREECIV_JSON_CONNECTION */
47124 e = 0;
47125 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
47126 if (e) {
47127 log_packet_detailed("'id' field error detected");
47128 }
47129 }
47130 if (BV_ISSET(fields, 1)) {
47131 log_packet_detailed(" field 'name' has changed");
47132#ifdef FREECIV_JSON_CONNECTION
47133 field_addr.name = "name";
47134#endif /* FREECIV_JSON_CONNECTION */
47135 e = 0;
47136 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
47137 if (e) {
47138 log_packet_detailed("'name' field error detected");
47139 }
47140 }
47141 if (BV_ISSET(fields, 2)) {
47142 log_packet_detailed(" field 'helptxt' has changed");
47143#ifdef FREECIV_JSON_CONNECTION
47144 field_addr.name = "helptxt";
47145#endif /* FREECIV_JSON_CONNECTION */
47146 e = 0;
47147 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
47148 if (e) {
47149 log_packet_detailed("'helptxt' field error detected");
47150 }
47151 }
47152
47153 *old = *real_packet;
47154#endif /* FREECIV_DELTA_PROTOCOL */
47155#ifndef FREECIV_DELTA_PROTOCOL
47156#ifdef FREECIV_JSON_CONNECTION
47157 field_addr.name = "id";
47158#endif /* FREECIV_JSON_CONNECTION */
47159 e = 0;
47160 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
47161 if (e) {
47162 log_packet_detailed("'id' field error detected");
47163 }
47164#ifdef FREECIV_JSON_CONNECTION
47165 field_addr.name = "name";
47166#endif /* FREECIV_JSON_CONNECTION */
47167 e = 0;
47168 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
47169 if (e) {
47170 log_packet_detailed("'name' field error detected");
47171 }
47172#ifdef FREECIV_JSON_CONNECTION
47173 field_addr.name = "helptxt";
47174#endif /* FREECIV_JSON_CONNECTION */
47175 e = 0;
47176 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
47177 if (e) {
47178 log_packet_detailed("'helptxt' field error detected");
47179 }
47180
47181#endif
47182 SEND_PACKET_END(PACKET_RULESET_TECH_FLAG);
47183}
47184
47185 int send_packet_ruleset_tech_flag(struct connection *pc, const struct packet_ruleset_tech_flag *packet)
47186{
47187 if (!pc->used) {
47188 log_error("WARNING: trying to send data to the closed connection %s",
47189 conn_description(pc));
47190 return -1;
47191 }
47192 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TECH_FLAG].packet != NULL, -1,
47193 "Handler for PACKET_RULESET_TECH_FLAG not installed");
47194 return pc->phs.handlers->send[PACKET_RULESET_TECH_FLAG].packet(pc, packet);
47195}
47196
47197 void lsend_packet_ruleset_tech_flag(struct conn_list *dest, const struct packet_ruleset_tech_flag *packet)
47198{
47199 conn_list_iterate(dest, pconn) {
47200 send_packet_ruleset_tech_flag(pconn, packet);
47201 } conn_list_iterate_end;
47202}
47203
47204#ifdef FREECIV_DELTA_PROTOCOL
47205#define hash_packet_ruleset_government_100 hash_const
47206
47207#define cmp_packet_ruleset_government_100 cmp_const
47208
47209 BV_DEFINE(packet_ruleset_government_100_fields, 8);
47210#endif /* FREECIV_DELTA_PROTOCOL */
47211
47212 static struct packet_ruleset_government *receive_packet_ruleset_government_100(struct connection *pc)
47213{
47214#ifdef FREECIV_DELTA_PROTOCOL
47215 packet_ruleset_government_100_fields fields;
47216 struct packet_ruleset_government *old;
47217 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOVERNMENT;
47218#endif /* FREECIV_DELTA_PROTOCOL */
47219 RECEIVE_PACKET_START(packet_ruleset_government, real_packet);
47220#ifdef FREECIV_JSON_CONNECTION
47221 struct plocation field_addr;
47222 {
47223 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47224 field_addr = *field_addr_tmp;
47225 FC_FREE(field_addr_tmp);
47226 }
47227#endif /* FREECIV_JSON_CONNECTION */
47228
47229#ifdef FREECIV_DELTA_PROTOCOL
47230#ifdef FREECIV_JSON_CONNECTION
47231 field_addr.name = "fields";
47232#endif /* FREECIV_JSON_CONNECTION */
47233 DIO_BV_GET(&din, &field_addr, fields);
47234
47235#else /* FREECIV_DELTA_PROTOCOL */
47236#ifdef FREECIV_JSON_CONNECTION
47237 field_addr.name = "id";
47238#endif /* FREECIV_JSON_CONNECTION */
47239 {
47240 int readin;
47241
47242 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
47243 RECEIVE_PACKET_FIELD_ERROR(id);
47244 }
47245 real_packet->id = readin;
47246 }
47247#ifdef FREECIV_JSON_CONNECTION
47248 field_addr.name = "reqs_count";
47249#endif /* FREECIV_JSON_CONNECTION */
47250 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
47251 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
47252 }
47253#ifdef FREECIV_JSON_CONNECTION
47254 field_addr.name = "reqs";
47255#endif /* FREECIV_JSON_CONNECTION */
47256 {
47257 int i;
47258
47259#ifdef FREECIV_JSON_CONNECTION
47260 /* Enter array. */
47261 field_addr.sub_location = plocation_elem_new(0);
47262#endif /* FREECIV_JSON_CONNECTION */
47263
47264 if (real_packet->reqs_count > MAX_NUM_REQS) {
47265 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
47266 }
47267 for (i = 0; i < real_packet->reqs_count; i++) {
47268#ifdef FREECIV_JSON_CONNECTION
47269 field_addr.sub_location->number = i;
47270#endif /* FREECIV_JSON_CONNECTION */
47271 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
47272 RECEIVE_PACKET_FIELD_ERROR(reqs);
47273 }
47274 }
47275
47276#ifdef FREECIV_JSON_CONNECTION
47277 /* Exit array. */
47278 FC_FREE(field_addr.sub_location);
47279#endif /* FREECIV_JSON_CONNECTION */
47280 }
47281#ifdef FREECIV_JSON_CONNECTION
47282 field_addr.name = "name";
47283#endif /* FREECIV_JSON_CONNECTION */
47284 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
47285 RECEIVE_PACKET_FIELD_ERROR(name);
47286 }
47287#ifdef FREECIV_JSON_CONNECTION
47288 field_addr.name = "rule_name";
47289#endif /* FREECIV_JSON_CONNECTION */
47290 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
47291 RECEIVE_PACKET_FIELD_ERROR(rule_name);
47292 }
47293#ifdef FREECIV_JSON_CONNECTION
47294 field_addr.name = "graphic_str";
47295#endif /* FREECIV_JSON_CONNECTION */
47296 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
47297 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
47298 }
47299#ifdef FREECIV_JSON_CONNECTION
47300 field_addr.name = "graphic_alt";
47301#endif /* FREECIV_JSON_CONNECTION */
47302 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
47303 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
47304 }
47305#ifdef FREECIV_JSON_CONNECTION
47306 field_addr.name = "helptext";
47307#endif /* FREECIV_JSON_CONNECTION */
47308 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
47309 RECEIVE_PACKET_FIELD_ERROR(helptext);
47310 }
47311#endif
47312 log_packet_detailed("packet_ruleset_government_100: got info about ()");
47313
47314#ifdef FREECIV_DELTA_PROTOCOL
47315 if (NULL == *hash) {
47316 *hash = genhash_new_full(hash_packet_ruleset_government_100, cmp_packet_ruleset_government_100,
47317 NULL, NULL, NULL, free);
47318 }
47319
47320 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47321 *real_packet = *old;
47322 } else {
47323 log_packet_detailed(" no old info");
47324 memset(real_packet, 0, sizeof(*real_packet));
47325 }
47326
47327 if (BV_ISSET(fields, 0)) {
47328 log_packet_detailed(" got field 'id'");
47329#ifdef FREECIV_JSON_CONNECTION
47330 field_addr.name = "id";
47331#endif /* FREECIV_JSON_CONNECTION */
47332 {
47333 int readin;
47334
47335 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
47336 RECEIVE_PACKET_FIELD_ERROR(id);
47337 }
47338 real_packet->id = readin;
47339 }
47340 }
47341 if (BV_ISSET(fields, 1)) {
47342 log_packet_detailed(" got field 'reqs_count'");
47343#ifdef FREECIV_JSON_CONNECTION
47344 field_addr.name = "reqs_count";
47345#endif /* FREECIV_JSON_CONNECTION */
47346 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
47347 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
47348 }
47349 }
47350 if (BV_ISSET(fields, 2)) {
47351 log_packet_detailed(" got field 'reqs'");
47352#ifdef FREECIV_JSON_CONNECTION
47353 field_addr.name = "reqs";
47354#endif /* FREECIV_JSON_CONNECTION */
47355 {
47356 int i;
47357
47358#ifdef FREECIV_JSON_CONNECTION
47359 /* Enter array. */
47360 field_addr.sub_location = plocation_elem_new(0);
47361#endif /* FREECIV_JSON_CONNECTION */
47362
47363 if (real_packet->reqs_count > MAX_NUM_REQS) {
47364 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
47365 }
47366 for (i = 0; i < real_packet->reqs_count; i++) {
47367#ifdef FREECIV_JSON_CONNECTION
47368 field_addr.sub_location->number = i;
47369#endif /* FREECIV_JSON_CONNECTION */
47370 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
47371 RECEIVE_PACKET_FIELD_ERROR(reqs);
47372 }
47373 }
47374
47375#ifdef FREECIV_JSON_CONNECTION
47376 /* Exit array. */
47377 FC_FREE(field_addr.sub_location);
47378#endif /* FREECIV_JSON_CONNECTION */
47379 }
47380 }
47381 if (BV_ISSET(fields, 3)) {
47382 log_packet_detailed(" got field 'name'");
47383#ifdef FREECIV_JSON_CONNECTION
47384 field_addr.name = "name";
47385#endif /* FREECIV_JSON_CONNECTION */
47386 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
47387 RECEIVE_PACKET_FIELD_ERROR(name);
47388 }
47389 }
47390 if (BV_ISSET(fields, 4)) {
47391 log_packet_detailed(" got field 'rule_name'");
47392#ifdef FREECIV_JSON_CONNECTION
47393 field_addr.name = "rule_name";
47394#endif /* FREECIV_JSON_CONNECTION */
47395 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
47396 RECEIVE_PACKET_FIELD_ERROR(rule_name);
47397 }
47398 }
47399 if (BV_ISSET(fields, 5)) {
47400 log_packet_detailed(" got field 'graphic_str'");
47401#ifdef FREECIV_JSON_CONNECTION
47402 field_addr.name = "graphic_str";
47403#endif /* FREECIV_JSON_CONNECTION */
47404 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
47405 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
47406 }
47407 }
47408 if (BV_ISSET(fields, 6)) {
47409 log_packet_detailed(" got field 'graphic_alt'");
47410#ifdef FREECIV_JSON_CONNECTION
47411 field_addr.name = "graphic_alt";
47412#endif /* FREECIV_JSON_CONNECTION */
47413 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
47414 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
47415 }
47416 }
47417 if (BV_ISSET(fields, 7)) {
47418 log_packet_detailed(" got field 'helptext'");
47419#ifdef FREECIV_JSON_CONNECTION
47420 field_addr.name = "helptext";
47421#endif /* FREECIV_JSON_CONNECTION */
47422 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
47423 RECEIVE_PACKET_FIELD_ERROR(helptext);
47424 }
47425 }
47426
47427 if (NULL == old) {
47428 old = fc_malloc(sizeof(*old));
47429 *old = *real_packet;
47430 genhash_insert(*hash, old, old);
47431 } else {
47432 *old = *real_packet;
47433 }
47434
47435#endif /* FREECIV_DELTA_PROTOCOL */
47436 RECEIVE_PACKET_END(real_packet);
47437}
47438
47439 static int send_packet_ruleset_government_100(struct connection *pc, const struct packet_ruleset_government *packet)
47440{
47441 const struct packet_ruleset_government *real_packet = packet;
47442 int e;
47443#ifdef FREECIV_DELTA_PROTOCOL
47444 packet_ruleset_government_100_fields fields;
47445 struct packet_ruleset_government *old;
47446 bool differ;
47447 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOVERNMENT;
47448#endif /* FREECIV_DELTA_PROTOCOL */
47449 SEND_PACKET_START(PACKET_RULESET_GOVERNMENT);
47450#ifdef FREECIV_JSON_CONNECTION
47451 struct plocation field_addr;
47452 {
47453 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47454 field_addr = *field_addr_tmp;
47455 FC_FREE(field_addr_tmp);
47456 }
47457#endif /* FREECIV_JSON_CONNECTION */
47458
47459 log_packet_detailed("packet_ruleset_government_100: sending info about ()");
47460
47461#ifdef FREECIV_DELTA_PROTOCOL
47462 if (NULL == *hash) {
47463 *hash = genhash_new_full(hash_packet_ruleset_government_100, cmp_packet_ruleset_government_100,
47464 NULL, NULL, NULL, free);
47465 }
47466 BV_CLR_ALL(fields);
47467
47468 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
47469 old = fc_malloc(sizeof(*old));
47470 *old = *real_packet;
47471 genhash_insert(*hash, old, old);
47472 memset(old, 0, sizeof(*old));
47473 }
47474 differ = (old->id != real_packet->id);
47475 if (differ) {
47476 BV_SET(fields, 0);
47477 }
47478
47479 differ = (old->reqs_count != real_packet->reqs_count);
47480 if (differ) {
47481 BV_SET(fields, 1);
47482 }
47483
47484 differ = (old->reqs_count != real_packet->reqs_count);
47485 if (!differ) {
47486 int i;
47487
47488 for (i = 0; i < real_packet->reqs_count; i++) {
47489 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
47490 if (differ) {
47491 break;
47492 }
47493 }
47494 }
47495 if (differ) {
47496 BV_SET(fields, 2);
47497 }
47498
47499 differ = (strcmp(old->name, real_packet->name) != 0);
47500 if (differ) {
47501 BV_SET(fields, 3);
47502 }
47503
47504 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
47505 if (differ) {
47506 BV_SET(fields, 4);
47507 }
47508
47509 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
47510 if (differ) {
47511 BV_SET(fields, 5);
47512 }
47513
47514 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
47515 if (differ) {
47516 BV_SET(fields, 6);
47517 }
47518
47519 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
47520 if (differ) {
47521 BV_SET(fields, 7);
47522 }
47523
47524
47525#ifdef FREECIV_JSON_CONNECTION
47526 field_addr.name = "fields";
47527#endif /* FREECIV_JSON_CONNECTION */
47528 e = 0;
47529 e |= DIO_BV_PUT(&dout, &field_addr, fields);
47530 if (e) {
47531 log_packet_detailed("fields bitvector error detected");
47532 }
47533
47534 if (BV_ISSET(fields, 0)) {
47535 log_packet_detailed(" field 'id' has changed");
47536#ifdef FREECIV_JSON_CONNECTION
47537 field_addr.name = "id";
47538#endif /* FREECIV_JSON_CONNECTION */
47539 e = 0;
47540 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->id);
47541 if (e) {
47542 log_packet_detailed("'id' field error detected");
47543 }
47544 }
47545 if (BV_ISSET(fields, 1)) {
47546 log_packet_detailed(" field 'reqs_count' has changed");
47547#ifdef FREECIV_JSON_CONNECTION
47548 field_addr.name = "reqs_count";
47549#endif /* FREECIV_JSON_CONNECTION */
47550 e = 0;
47551 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
47552 if (e) {
47553 log_packet_detailed("'reqs_count' field error detected");
47554 }
47555 }
47556 if (BV_ISSET(fields, 2)) {
47557 log_packet_detailed(" field 'reqs' has changed");
47558#ifdef FREECIV_JSON_CONNECTION
47559 field_addr.name = "reqs";
47560#endif /* FREECIV_JSON_CONNECTION */
47561 e = 0;
47562 {
47563 int i;
47564
47565#ifdef FREECIV_JSON_CONNECTION
47566 /* Create the array. */
47567 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
47568
47569 /* Enter the array. */
47570 field_addr.sub_location = plocation_elem_new(0);
47571#endif /* FREECIV_JSON_CONNECTION */
47572
47573 for (i = 0; i < real_packet->reqs_count; i++) {
47574#ifdef FREECIV_JSON_CONNECTION
47575 /* Next array element. */
47576 field_addr.sub_location->number = i;
47577#endif /* FREECIV_JSON_CONNECTION */
47578 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
47579 }
47580
47581#ifdef FREECIV_JSON_CONNECTION
47582 /* Exit array. */
47583 FC_FREE(field_addr.sub_location);
47584#endif /* FREECIV_JSON_CONNECTION */
47585 }
47586 if (e) {
47587 log_packet_detailed("'reqs' field error detected");
47588 }
47589 }
47590 if (BV_ISSET(fields, 3)) {
47591 log_packet_detailed(" field 'name' has changed");
47592#ifdef FREECIV_JSON_CONNECTION
47593 field_addr.name = "name";
47594#endif /* FREECIV_JSON_CONNECTION */
47595 e = 0;
47596 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
47597 if (e) {
47598 log_packet_detailed("'name' field error detected");
47599 }
47600 }
47601 if (BV_ISSET(fields, 4)) {
47602 log_packet_detailed(" field 'rule_name' has changed");
47603#ifdef FREECIV_JSON_CONNECTION
47604 field_addr.name = "rule_name";
47605#endif /* FREECIV_JSON_CONNECTION */
47606 e = 0;
47607 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
47608 if (e) {
47609 log_packet_detailed("'rule_name' field error detected");
47610 }
47611 }
47612 if (BV_ISSET(fields, 5)) {
47613 log_packet_detailed(" field 'graphic_str' has changed");
47614#ifdef FREECIV_JSON_CONNECTION
47615 field_addr.name = "graphic_str";
47616#endif /* FREECIV_JSON_CONNECTION */
47617 e = 0;
47618 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
47619 if (e) {
47620 log_packet_detailed("'graphic_str' field error detected");
47621 }
47622 }
47623 if (BV_ISSET(fields, 6)) {
47624 log_packet_detailed(" field 'graphic_alt' has changed");
47625#ifdef FREECIV_JSON_CONNECTION
47626 field_addr.name = "graphic_alt";
47627#endif /* FREECIV_JSON_CONNECTION */
47628 e = 0;
47629 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
47630 if (e) {
47631 log_packet_detailed("'graphic_alt' field error detected");
47632 }
47633 }
47634 if (BV_ISSET(fields, 7)) {
47635 log_packet_detailed(" field 'helptext' has changed");
47636#ifdef FREECIV_JSON_CONNECTION
47637 field_addr.name = "helptext";
47638#endif /* FREECIV_JSON_CONNECTION */
47639 e = 0;
47640 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
47641 if (e) {
47642 log_packet_detailed("'helptext' field error detected");
47643 }
47644 }
47645
47646 *old = *real_packet;
47647#endif /* FREECIV_DELTA_PROTOCOL */
47648#ifndef FREECIV_DELTA_PROTOCOL
47649#ifdef FREECIV_JSON_CONNECTION
47650 field_addr.name = "id";
47651#endif /* FREECIV_JSON_CONNECTION */
47652 e = 0;
47653 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->id);
47654 if (e) {
47655 log_packet_detailed("'id' field error detected");
47656 }
47657#ifdef FREECIV_JSON_CONNECTION
47658 field_addr.name = "reqs_count";
47659#endif /* FREECIV_JSON_CONNECTION */
47660 e = 0;
47661 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
47662 if (e) {
47663 log_packet_detailed("'reqs_count' field error detected");
47664 }
47665#ifdef FREECIV_JSON_CONNECTION
47666 field_addr.name = "reqs";
47667#endif /* FREECIV_JSON_CONNECTION */
47668 e = 0;
47669 {
47670 int i;
47671
47672#ifdef FREECIV_JSON_CONNECTION
47673 /* Create the array. */
47674 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
47675
47676 /* Enter the array. */
47677 field_addr.sub_location = plocation_elem_new(0);
47678#endif /* FREECIV_JSON_CONNECTION */
47679
47680 for (i = 0; i < real_packet->reqs_count; i++) {
47681#ifdef FREECIV_JSON_CONNECTION
47682 /* Next array element. */
47683 field_addr.sub_location->number = i;
47684#endif /* FREECIV_JSON_CONNECTION */
47685 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
47686 }
47687
47688#ifdef FREECIV_JSON_CONNECTION
47689 /* Exit array. */
47690 FC_FREE(field_addr.sub_location);
47691#endif /* FREECIV_JSON_CONNECTION */
47692 }
47693 if (e) {
47694 log_packet_detailed("'reqs' field error detected");
47695 }
47696#ifdef FREECIV_JSON_CONNECTION
47697 field_addr.name = "name";
47698#endif /* FREECIV_JSON_CONNECTION */
47699 e = 0;
47700 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
47701 if (e) {
47702 log_packet_detailed("'name' field error detected");
47703 }
47704#ifdef FREECIV_JSON_CONNECTION
47705 field_addr.name = "rule_name";
47706#endif /* FREECIV_JSON_CONNECTION */
47707 e = 0;
47708 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
47709 if (e) {
47710 log_packet_detailed("'rule_name' field error detected");
47711 }
47712#ifdef FREECIV_JSON_CONNECTION
47713 field_addr.name = "graphic_str";
47714#endif /* FREECIV_JSON_CONNECTION */
47715 e = 0;
47716 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
47717 if (e) {
47718 log_packet_detailed("'graphic_str' field error detected");
47719 }
47720#ifdef FREECIV_JSON_CONNECTION
47721 field_addr.name = "graphic_alt";
47722#endif /* FREECIV_JSON_CONNECTION */
47723 e = 0;
47724 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
47725 if (e) {
47726 log_packet_detailed("'graphic_alt' field error detected");
47727 }
47728#ifdef FREECIV_JSON_CONNECTION
47729 field_addr.name = "helptext";
47730#endif /* FREECIV_JSON_CONNECTION */
47731 e = 0;
47732 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
47733 if (e) {
47734 log_packet_detailed("'helptext' field error detected");
47735 }
47736
47737#endif
47738 SEND_PACKET_END(PACKET_RULESET_GOVERNMENT);
47739}
47740
47741 int send_packet_ruleset_government(struct connection *pc, const struct packet_ruleset_government *packet)
47742{
47743 if (!pc->used) {
47744 log_error("WARNING: trying to send data to the closed connection %s",
47745 conn_description(pc));
47746 return -1;
47747 }
47748 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT].packet != NULL, -1,
47749 "Handler for PACKET_RULESET_GOVERNMENT not installed");
47750 return pc->phs.handlers->send[PACKET_RULESET_GOVERNMENT].packet(pc, packet);
47751}
47752
47753 void lsend_packet_ruleset_government(struct conn_list *dest, const struct packet_ruleset_government *packet)
47754{
47755 conn_list_iterate(dest, pconn) {
47756 send_packet_ruleset_government(pconn, packet);
47757 } conn_list_iterate_end;
47758}
47759
47760#ifdef FREECIV_DELTA_PROTOCOL
47761#define hash_packet_ruleset_terrain_control_100 hash_const
47762
47763#define cmp_packet_ruleset_terrain_control_100 cmp_const
47764
47765 BV_DEFINE(packet_ruleset_terrain_control_100_fields, 12);
47766#endif /* FREECIV_DELTA_PROTOCOL */
47767
47768 static struct packet_ruleset_terrain_control *receive_packet_ruleset_terrain_control_100(struct connection *pc)
47769{
47770#ifdef FREECIV_DELTA_PROTOCOL
47771 packet_ruleset_terrain_control_100_fields fields;
47772 struct packet_ruleset_terrain_control *old;
47773 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN_CONTROL;
47774#endif /* FREECIV_DELTA_PROTOCOL */
47775 RECEIVE_PACKET_START(packet_ruleset_terrain_control, real_packet);
47776#ifdef FREECIV_JSON_CONNECTION
47777 struct plocation field_addr;
47778 {
47779 struct plocation *field_addr_tmp = plocation_field_new(NULL);
47780 field_addr = *field_addr_tmp;
47781 FC_FREE(field_addr_tmp);
47782 }
47783#endif /* FREECIV_JSON_CONNECTION */
47784
47785#ifdef FREECIV_DELTA_PROTOCOL
47786#ifdef FREECIV_JSON_CONNECTION
47787 field_addr.name = "fields";
47788#endif /* FREECIV_JSON_CONNECTION */
47789 DIO_BV_GET(&din, &field_addr, fields);
47790
47791#else /* FREECIV_DELTA_PROTOCOL */
47792#ifdef FREECIV_JSON_CONNECTION
47793 field_addr.name = "ocean_reclaim_requirement_pct";
47794#endif /* FREECIV_JSON_CONNECTION */
47795 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ocean_reclaim_requirement_pct)) {
47796 RECEIVE_PACKET_FIELD_ERROR(ocean_reclaim_requirement_pct);
47797 }
47798#ifdef FREECIV_JSON_CONNECTION
47799 field_addr.name = "land_channel_requirement_pct";
47800#endif /* FREECIV_JSON_CONNECTION */
47801 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->land_channel_requirement_pct)) {
47802 RECEIVE_PACKET_FIELD_ERROR(land_channel_requirement_pct);
47803 }
47804#ifdef FREECIV_JSON_CONNECTION
47805 field_addr.name = "terrain_thaw_requirement_pct";
47806#endif /* FREECIV_JSON_CONNECTION */
47807 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_thaw_requirement_pct)) {
47808 RECEIVE_PACKET_FIELD_ERROR(terrain_thaw_requirement_pct);
47809 }
47810#ifdef FREECIV_JSON_CONNECTION
47811 field_addr.name = "terrain_freeze_requirement_pct";
47812#endif /* FREECIV_JSON_CONNECTION */
47813 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_freeze_requirement_pct)) {
47814 RECEIVE_PACKET_FIELD_ERROR(terrain_freeze_requirement_pct);
47815 }
47816#ifdef FREECIV_JSON_CONNECTION
47817 field_addr.name = "lake_max_size";
47818#endif /* FREECIV_JSON_CONNECTION */
47819 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->lake_max_size)) {
47820 RECEIVE_PACKET_FIELD_ERROR(lake_max_size);
47821 }
47822#ifdef FREECIV_JSON_CONNECTION
47823 field_addr.name = "min_start_native_area";
47824#endif /* FREECIV_JSON_CONNECTION */
47825 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_start_native_area)) {
47826 RECEIVE_PACKET_FIELD_ERROR(min_start_native_area);
47827 }
47828#ifdef FREECIV_JSON_CONNECTION
47829 field_addr.name = "move_fragments";
47830#endif /* FREECIV_JSON_CONNECTION */
47831 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_fragments)) {
47832 RECEIVE_PACKET_FIELD_ERROR(move_fragments);
47833 }
47834#ifdef FREECIV_JSON_CONNECTION
47835 field_addr.name = "igter_cost";
47836#endif /* FREECIV_JSON_CONNECTION */
47837 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->igter_cost)) {
47838 RECEIVE_PACKET_FIELD_ERROR(igter_cost);
47839 }
47840#ifdef FREECIV_JSON_CONNECTION
47841 field_addr.name = "pythagorean_diagonal";
47842#endif /* FREECIV_JSON_CONNECTION */
47843 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->pythagorean_diagonal)) {
47844 RECEIVE_PACKET_FIELD_ERROR(pythagorean_diagonal);
47845 }
47846#ifdef FREECIV_JSON_CONNECTION
47847 field_addr.name = "infrapoints";
47848#endif /* FREECIV_JSON_CONNECTION */
47849 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->infrapoints)) {
47850 RECEIVE_PACKET_FIELD_ERROR(infrapoints);
47851 }
47852#ifdef FREECIV_JSON_CONNECTION
47853 field_addr.name = "gui_type_base0";
47854#endif /* FREECIV_JSON_CONNECTION */
47855 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base0, sizeof(real_packet->gui_type_base0))) {
47856 RECEIVE_PACKET_FIELD_ERROR(gui_type_base0);
47857 }
47858#ifdef FREECIV_JSON_CONNECTION
47859 field_addr.name = "gui_type_base1";
47860#endif /* FREECIV_JSON_CONNECTION */
47861 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base1, sizeof(real_packet->gui_type_base1))) {
47862 RECEIVE_PACKET_FIELD_ERROR(gui_type_base1);
47863 }
47864#endif
47865 log_packet_detailed("packet_ruleset_terrain_control_100: got info about ()");
47866
47867#ifdef FREECIV_DELTA_PROTOCOL
47868 if (NULL == *hash) {
47869 *hash = genhash_new_full(hash_packet_ruleset_terrain_control_100, cmp_packet_ruleset_terrain_control_100,
47870 NULL, NULL, NULL, free);
47871 }
47872
47873 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
47874 *real_packet = *old;
47875 } else {
47876 log_packet_detailed(" no old info");
47877 memset(real_packet, 0, sizeof(*real_packet));
47878 }
47879
47880 if (BV_ISSET(fields, 0)) {
47881 log_packet_detailed(" got field 'ocean_reclaim_requirement_pct'");
47882#ifdef FREECIV_JSON_CONNECTION
47883 field_addr.name = "ocean_reclaim_requirement_pct";
47884#endif /* FREECIV_JSON_CONNECTION */
47885 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ocean_reclaim_requirement_pct)) {
47886 RECEIVE_PACKET_FIELD_ERROR(ocean_reclaim_requirement_pct);
47887 }
47888 }
47889 if (BV_ISSET(fields, 1)) {
47890 log_packet_detailed(" got field 'land_channel_requirement_pct'");
47891#ifdef FREECIV_JSON_CONNECTION
47892 field_addr.name = "land_channel_requirement_pct";
47893#endif /* FREECIV_JSON_CONNECTION */
47894 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->land_channel_requirement_pct)) {
47895 RECEIVE_PACKET_FIELD_ERROR(land_channel_requirement_pct);
47896 }
47897 }
47898 if (BV_ISSET(fields, 2)) {
47899 log_packet_detailed(" got field 'terrain_thaw_requirement_pct'");
47900#ifdef FREECIV_JSON_CONNECTION
47901 field_addr.name = "terrain_thaw_requirement_pct";
47902#endif /* FREECIV_JSON_CONNECTION */
47903 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_thaw_requirement_pct)) {
47904 RECEIVE_PACKET_FIELD_ERROR(terrain_thaw_requirement_pct);
47905 }
47906 }
47907 if (BV_ISSET(fields, 3)) {
47908 log_packet_detailed(" got field 'terrain_freeze_requirement_pct'");
47909#ifdef FREECIV_JSON_CONNECTION
47910 field_addr.name = "terrain_freeze_requirement_pct";
47911#endif /* FREECIV_JSON_CONNECTION */
47912 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->terrain_freeze_requirement_pct)) {
47913 RECEIVE_PACKET_FIELD_ERROR(terrain_freeze_requirement_pct);
47914 }
47915 }
47916 if (BV_ISSET(fields, 4)) {
47917 log_packet_detailed(" got field 'lake_max_size'");
47918#ifdef FREECIV_JSON_CONNECTION
47919 field_addr.name = "lake_max_size";
47920#endif /* FREECIV_JSON_CONNECTION */
47921 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->lake_max_size)) {
47922 RECEIVE_PACKET_FIELD_ERROR(lake_max_size);
47923 }
47924 }
47925 if (BV_ISSET(fields, 5)) {
47926 log_packet_detailed(" got field 'min_start_native_area'");
47927#ifdef FREECIV_JSON_CONNECTION
47928 field_addr.name = "min_start_native_area";
47929#endif /* FREECIV_JSON_CONNECTION */
47930 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->min_start_native_area)) {
47931 RECEIVE_PACKET_FIELD_ERROR(min_start_native_area);
47932 }
47933 }
47934 if (BV_ISSET(fields, 6)) {
47935 log_packet_detailed(" got field 'move_fragments'");
47936#ifdef FREECIV_JSON_CONNECTION
47937 field_addr.name = "move_fragments";
47938#endif /* FREECIV_JSON_CONNECTION */
47939 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->move_fragments)) {
47940 RECEIVE_PACKET_FIELD_ERROR(move_fragments);
47941 }
47942 }
47943 if (BV_ISSET(fields, 7)) {
47944 log_packet_detailed(" got field 'igter_cost'");
47945#ifdef FREECIV_JSON_CONNECTION
47946 field_addr.name = "igter_cost";
47947#endif /* FREECIV_JSON_CONNECTION */
47948 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->igter_cost)) {
47949 RECEIVE_PACKET_FIELD_ERROR(igter_cost);
47950 }
47951 }
47952 real_packet->pythagorean_diagonal = BV_ISSET(fields, 8);
47953 real_packet->infrapoints = BV_ISSET(fields, 9);
47954 if (BV_ISSET(fields, 10)) {
47955 log_packet_detailed(" got field 'gui_type_base0'");
47956#ifdef FREECIV_JSON_CONNECTION
47957 field_addr.name = "gui_type_base0";
47958#endif /* FREECIV_JSON_CONNECTION */
47959 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base0, sizeof(real_packet->gui_type_base0))) {
47960 RECEIVE_PACKET_FIELD_ERROR(gui_type_base0);
47961 }
47962 }
47963 if (BV_ISSET(fields, 11)) {
47964 log_packet_detailed(" got field 'gui_type_base1'");
47965#ifdef FREECIV_JSON_CONNECTION
47966 field_addr.name = "gui_type_base1";
47967#endif /* FREECIV_JSON_CONNECTION */
47968 if (!DIO_GET(string, &din, &field_addr, real_packet->gui_type_base1, sizeof(real_packet->gui_type_base1))) {
47969 RECEIVE_PACKET_FIELD_ERROR(gui_type_base1);
47970 }
47971 }
47972
47973 if (NULL == old) {
47974 old = fc_malloc(sizeof(*old));
47975 *old = *real_packet;
47976 genhash_insert(*hash, old, old);
47977 } else {
47978 *old = *real_packet;
47979 }
47980
47981#endif /* FREECIV_DELTA_PROTOCOL */
47982 RECEIVE_PACKET_END(real_packet);
47983}
47984
47985 static int send_packet_ruleset_terrain_control_100(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
47986{
47987 const struct packet_ruleset_terrain_control *real_packet = packet;
47988 int e;
47989#ifdef FREECIV_DELTA_PROTOCOL
47990 packet_ruleset_terrain_control_100_fields fields;
47991 struct packet_ruleset_terrain_control *old;
47992 bool differ;
47993 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN_CONTROL;
47994#endif /* FREECIV_DELTA_PROTOCOL */
47995 SEND_PACKET_START(PACKET_RULESET_TERRAIN_CONTROL);
47996#ifdef FREECIV_JSON_CONNECTION
47997 struct plocation field_addr;
47998 {
47999 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48000 field_addr = *field_addr_tmp;
48001 FC_FREE(field_addr_tmp);
48002 }
48003#endif /* FREECIV_JSON_CONNECTION */
48004
48005 log_packet_detailed("packet_ruleset_terrain_control_100: sending info about ()");
48006
48007#ifdef FREECIV_DELTA_PROTOCOL
48008 if (NULL == *hash) {
48009 *hash = genhash_new_full(hash_packet_ruleset_terrain_control_100, cmp_packet_ruleset_terrain_control_100,
48010 NULL, NULL, NULL, free);
48011 }
48012 BV_CLR_ALL(fields);
48013
48014 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48015 old = fc_malloc(sizeof(*old));
48016 *old = *real_packet;
48017 genhash_insert(*hash, old, old);
48018 memset(old, 0, sizeof(*old));
48019 }
48020 differ = (old->ocean_reclaim_requirement_pct != real_packet->ocean_reclaim_requirement_pct);
48021 if (differ) {
48022 BV_SET(fields, 0);
48023 }
48024
48025 differ = (old->land_channel_requirement_pct != real_packet->land_channel_requirement_pct);
48026 if (differ) {
48027 BV_SET(fields, 1);
48028 }
48029
48030 differ = (old->terrain_thaw_requirement_pct != real_packet->terrain_thaw_requirement_pct);
48031 if (differ) {
48032 BV_SET(fields, 2);
48033 }
48034
48035 differ = (old->terrain_freeze_requirement_pct != real_packet->terrain_freeze_requirement_pct);
48036 if (differ) {
48037 BV_SET(fields, 3);
48038 }
48039
48040 differ = (old->lake_max_size != real_packet->lake_max_size);
48041 if (differ) {
48042 BV_SET(fields, 4);
48043 }
48044
48045 differ = (old->min_start_native_area != real_packet->min_start_native_area);
48046 if (differ) {
48047 BV_SET(fields, 5);
48048 }
48049
48050 differ = (old->move_fragments != real_packet->move_fragments);
48051 if (differ) {
48052 BV_SET(fields, 6);
48053 }
48054
48055 differ = (old->igter_cost != real_packet->igter_cost);
48056 if (differ) {
48057 BV_SET(fields, 7);
48058 }
48059
48060 if (packet->pythagorean_diagonal) {
48061 BV_SET(fields, 8);
48062 }
48063
48064 if (packet->infrapoints) {
48065 BV_SET(fields, 9);
48066 }
48067
48068 differ = (strcmp(old->gui_type_base0, real_packet->gui_type_base0) != 0);
48069 if (differ) {
48070 BV_SET(fields, 10);
48071 }
48072
48073 differ = (strcmp(old->gui_type_base1, real_packet->gui_type_base1) != 0);
48074 if (differ) {
48075 BV_SET(fields, 11);
48076 }
48077
48078
48079#ifdef FREECIV_JSON_CONNECTION
48080 field_addr.name = "fields";
48081#endif /* FREECIV_JSON_CONNECTION */
48082 e = 0;
48083 e |= DIO_BV_PUT(&dout, &field_addr, fields);
48084 if (e) {
48085 log_packet_detailed("fields bitvector error detected");
48086 }
48087
48088 if (BV_ISSET(fields, 0)) {
48089 log_packet_detailed(" field 'ocean_reclaim_requirement_pct' has changed");
48090#ifdef FREECIV_JSON_CONNECTION
48091 field_addr.name = "ocean_reclaim_requirement_pct";
48092#endif /* FREECIV_JSON_CONNECTION */
48093 e = 0;
48094 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ocean_reclaim_requirement_pct);
48095 if (e) {
48096 log_packet_detailed("'ocean_reclaim_requirement_pct' field error detected");
48097 }
48098 }
48099 if (BV_ISSET(fields, 1)) {
48100 log_packet_detailed(" field 'land_channel_requirement_pct' has changed");
48101#ifdef FREECIV_JSON_CONNECTION
48102 field_addr.name = "land_channel_requirement_pct";
48103#endif /* FREECIV_JSON_CONNECTION */
48104 e = 0;
48105 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->land_channel_requirement_pct);
48106 if (e) {
48107 log_packet_detailed("'land_channel_requirement_pct' field error detected");
48108 }
48109 }
48110 if (BV_ISSET(fields, 2)) {
48111 log_packet_detailed(" field 'terrain_thaw_requirement_pct' has changed");
48112#ifdef FREECIV_JSON_CONNECTION
48113 field_addr.name = "terrain_thaw_requirement_pct";
48114#endif /* FREECIV_JSON_CONNECTION */
48115 e = 0;
48116 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_thaw_requirement_pct);
48117 if (e) {
48118 log_packet_detailed("'terrain_thaw_requirement_pct' field error detected");
48119 }
48120 }
48121 if (BV_ISSET(fields, 3)) {
48122 log_packet_detailed(" field 'terrain_freeze_requirement_pct' has changed");
48123#ifdef FREECIV_JSON_CONNECTION
48124 field_addr.name = "terrain_freeze_requirement_pct";
48125#endif /* FREECIV_JSON_CONNECTION */
48126 e = 0;
48127 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_freeze_requirement_pct);
48128 if (e) {
48129 log_packet_detailed("'terrain_freeze_requirement_pct' field error detected");
48130 }
48131 }
48132 if (BV_ISSET(fields, 4)) {
48133 log_packet_detailed(" field 'lake_max_size' has changed");
48134#ifdef FREECIV_JSON_CONNECTION
48135 field_addr.name = "lake_max_size";
48136#endif /* FREECIV_JSON_CONNECTION */
48137 e = 0;
48138 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->lake_max_size);
48139 if (e) {
48140 log_packet_detailed("'lake_max_size' field error detected");
48141 }
48142 }
48143 if (BV_ISSET(fields, 5)) {
48144 log_packet_detailed(" field 'min_start_native_area' has changed");
48145#ifdef FREECIV_JSON_CONNECTION
48146 field_addr.name = "min_start_native_area";
48147#endif /* FREECIV_JSON_CONNECTION */
48148 e = 0;
48149 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_start_native_area);
48150 if (e) {
48151 log_packet_detailed("'min_start_native_area' field error detected");
48152 }
48153 }
48154 if (BV_ISSET(fields, 6)) {
48155 log_packet_detailed(" field 'move_fragments' has changed");
48156#ifdef FREECIV_JSON_CONNECTION
48157 field_addr.name = "move_fragments";
48158#endif /* FREECIV_JSON_CONNECTION */
48159 e = 0;
48160 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_fragments);
48161 if (e) {
48162 log_packet_detailed("'move_fragments' field error detected");
48163 }
48164 }
48165 if (BV_ISSET(fields, 7)) {
48166 log_packet_detailed(" field 'igter_cost' has changed");
48167#ifdef FREECIV_JSON_CONNECTION
48168 field_addr.name = "igter_cost";
48169#endif /* FREECIV_JSON_CONNECTION */
48170 e = 0;
48171 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->igter_cost);
48172 if (e) {
48173 log_packet_detailed("'igter_cost' field error detected");
48174 }
48175 }
48176 /* field 8 is folded into the header */
48177 /* field 9 is folded into the header */
48178 if (BV_ISSET(fields, 10)) {
48179 log_packet_detailed(" field 'gui_type_base0' has changed");
48180#ifdef FREECIV_JSON_CONNECTION
48181 field_addr.name = "gui_type_base0";
48182#endif /* FREECIV_JSON_CONNECTION */
48183 e = 0;
48184 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base0);
48185 if (e) {
48186 log_packet_detailed("'gui_type_base0' field error detected");
48187 }
48188 }
48189 if (BV_ISSET(fields, 11)) {
48190 log_packet_detailed(" field 'gui_type_base1' has changed");
48191#ifdef FREECIV_JSON_CONNECTION
48192 field_addr.name = "gui_type_base1";
48193#endif /* FREECIV_JSON_CONNECTION */
48194 e = 0;
48195 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base1);
48196 if (e) {
48197 log_packet_detailed("'gui_type_base1' field error detected");
48198 }
48199 }
48200
48201 *old = *real_packet;
48202#endif /* FREECIV_DELTA_PROTOCOL */
48203#ifndef FREECIV_DELTA_PROTOCOL
48204#ifdef FREECIV_JSON_CONNECTION
48205 field_addr.name = "ocean_reclaim_requirement_pct";
48206#endif /* FREECIV_JSON_CONNECTION */
48207 e = 0;
48208 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ocean_reclaim_requirement_pct);
48209 if (e) {
48210 log_packet_detailed("'ocean_reclaim_requirement_pct' field error detected");
48211 }
48212#ifdef FREECIV_JSON_CONNECTION
48213 field_addr.name = "land_channel_requirement_pct";
48214#endif /* FREECIV_JSON_CONNECTION */
48215 e = 0;
48216 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->land_channel_requirement_pct);
48217 if (e) {
48218 log_packet_detailed("'land_channel_requirement_pct' field error detected");
48219 }
48220#ifdef FREECIV_JSON_CONNECTION
48221 field_addr.name = "terrain_thaw_requirement_pct";
48222#endif /* FREECIV_JSON_CONNECTION */
48223 e = 0;
48224 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_thaw_requirement_pct);
48225 if (e) {
48226 log_packet_detailed("'terrain_thaw_requirement_pct' field error detected");
48227 }
48228#ifdef FREECIV_JSON_CONNECTION
48229 field_addr.name = "terrain_freeze_requirement_pct";
48230#endif /* FREECIV_JSON_CONNECTION */
48231 e = 0;
48232 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain_freeze_requirement_pct);
48233 if (e) {
48234 log_packet_detailed("'terrain_freeze_requirement_pct' field error detected");
48235 }
48236#ifdef FREECIV_JSON_CONNECTION
48237 field_addr.name = "lake_max_size";
48238#endif /* FREECIV_JSON_CONNECTION */
48239 e = 0;
48240 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->lake_max_size);
48241 if (e) {
48242 log_packet_detailed("'lake_max_size' field error detected");
48243 }
48244#ifdef FREECIV_JSON_CONNECTION
48245 field_addr.name = "min_start_native_area";
48246#endif /* FREECIV_JSON_CONNECTION */
48247 e = 0;
48248 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->min_start_native_area);
48249 if (e) {
48250 log_packet_detailed("'min_start_native_area' field error detected");
48251 }
48252#ifdef FREECIV_JSON_CONNECTION
48253 field_addr.name = "move_fragments";
48254#endif /* FREECIV_JSON_CONNECTION */
48255 e = 0;
48256 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->move_fragments);
48257 if (e) {
48258 log_packet_detailed("'move_fragments' field error detected");
48259 }
48260#ifdef FREECIV_JSON_CONNECTION
48261 field_addr.name = "igter_cost";
48262#endif /* FREECIV_JSON_CONNECTION */
48263 e = 0;
48264 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->igter_cost);
48265 if (e) {
48266 log_packet_detailed("'igter_cost' field error detected");
48267 }
48268#ifdef FREECIV_JSON_CONNECTION
48269 field_addr.name = "pythagorean_diagonal";
48270#endif /* FREECIV_JSON_CONNECTION */
48271 e = 0;
48272 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->pythagorean_diagonal);
48273 if (e) {
48274 log_packet_detailed("'pythagorean_diagonal' field error detected");
48275 }
48276#ifdef FREECIV_JSON_CONNECTION
48277 field_addr.name = "infrapoints";
48278#endif /* FREECIV_JSON_CONNECTION */
48279 e = 0;
48280 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->infrapoints);
48281 if (e) {
48282 log_packet_detailed("'infrapoints' field error detected");
48283 }
48284#ifdef FREECIV_JSON_CONNECTION
48285 field_addr.name = "gui_type_base0";
48286#endif /* FREECIV_JSON_CONNECTION */
48287 e = 0;
48288 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base0);
48289 if (e) {
48290 log_packet_detailed("'gui_type_base0' field error detected");
48291 }
48292#ifdef FREECIV_JSON_CONNECTION
48293 field_addr.name = "gui_type_base1";
48294#endif /* FREECIV_JSON_CONNECTION */
48295 e = 0;
48296 e |= DIO_PUT(string, &dout, &field_addr, real_packet->gui_type_base1);
48297 if (e) {
48298 log_packet_detailed("'gui_type_base1' field error detected");
48299 }
48300
48301#endif
48302 SEND_PACKET_END(PACKET_RULESET_TERRAIN_CONTROL);
48303}
48304
48305 int send_packet_ruleset_terrain_control(struct connection *pc, const struct packet_ruleset_terrain_control *packet)
48306{
48307 if (!pc->used) {
48308 log_error("WARNING: trying to send data to the closed connection %s",
48309 conn_description(pc));
48310 return -1;
48311 }
48312 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet != NULL, -1,
48313 "Handler for PACKET_RULESET_TERRAIN_CONTROL not installed");
48314 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet(pc, packet);
48315}
48316
48317 void lsend_packet_ruleset_terrain_control(struct conn_list *dest, const struct packet_ruleset_terrain_control *packet)
48318{
48319 conn_list_iterate(dest, pconn) {
48320 send_packet_ruleset_terrain_control(pconn, packet);
48321 } conn_list_iterate_end;
48322}
48323
48324 static struct packet_rulesets_ready *receive_packet_rulesets_ready_100(struct connection *pc)
48325{
48326 RECEIVE_PACKET_START(packet_rulesets_ready, real_packet);
48327#if 1 /* To match endif */
48328 real_packet->__dummy = 0xff;
48329#endif
48330 log_packet_detailed("packet_rulesets_ready_100: got info about ()");
48331 RECEIVE_PACKET_END(real_packet);
48332}
48333
48334 static int send_packet_rulesets_ready_100(struct connection *pc)
48335{
48336 SEND_PACKET_START(PACKET_RULESETS_READY);
48337
48338 log_packet_detailed("packet_rulesets_ready_100: sending info about ()");
48339 SEND_PACKET_END(PACKET_RULESETS_READY);
48340}
48341
48342 int send_packet_rulesets_ready(struct connection *pc)
48343{
48344 if (!pc->used) {
48345 log_error("WARNING: trying to send data to the closed connection %s",
48346 conn_description(pc));
48347 return -1;
48348 }
48349 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESETS_READY].no_packet != NULL, -1,
48350 "Handler for PACKET_RULESETS_READY not installed");
48351 return pc->phs.handlers->send[PACKET_RULESETS_READY].no_packet(pc);
48352}
48353
48354 void lsend_packet_rulesets_ready(struct conn_list *dest)
48355{
48356 conn_list_iterate(dest, pconn) {
48357 send_packet_rulesets_ready(pconn);
48358 } conn_list_iterate_end;
48359}
48360
48361#ifdef FREECIV_DELTA_PROTOCOL
48362#define hash_packet_ruleset_nation_sets_100 hash_const
48363
48364#define cmp_packet_ruleset_nation_sets_100 cmp_const
48365
48366 BV_DEFINE(packet_ruleset_nation_sets_100_fields, 4);
48367#endif /* FREECIV_DELTA_PROTOCOL */
48368
48369 static struct packet_ruleset_nation_sets *receive_packet_ruleset_nation_sets_100(struct connection *pc)
48370{
48371#ifdef FREECIV_DELTA_PROTOCOL
48372 packet_ruleset_nation_sets_100_fields fields;
48373 struct packet_ruleset_nation_sets *old;
48374 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION_SETS;
48375#endif /* FREECIV_DELTA_PROTOCOL */
48376 RECEIVE_PACKET_START(packet_ruleset_nation_sets, real_packet);
48377#ifdef FREECIV_JSON_CONNECTION
48378 struct plocation field_addr;
48379 {
48380 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48381 field_addr = *field_addr_tmp;
48382 FC_FREE(field_addr_tmp);
48383 }
48384#endif /* FREECIV_JSON_CONNECTION */
48385
48386#ifdef FREECIV_DELTA_PROTOCOL
48387#ifdef FREECIV_JSON_CONNECTION
48388 field_addr.name = "fields";
48389#endif /* FREECIV_JSON_CONNECTION */
48390 DIO_BV_GET(&din, &field_addr, fields);
48391
48392#else /* FREECIV_DELTA_PROTOCOL */
48393#ifdef FREECIV_JSON_CONNECTION
48394 field_addr.name = "nsets";
48395#endif /* FREECIV_JSON_CONNECTION */
48396 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
48397 RECEIVE_PACKET_FIELD_ERROR(nsets);
48398 }
48399#ifdef FREECIV_JSON_CONNECTION
48400 field_addr.name = "names";
48401#endif /* FREECIV_JSON_CONNECTION */
48402 {
48403 int i;
48404
48405#ifdef FREECIV_JSON_CONNECTION
48406 /* Enter array. */
48407 field_addr.sub_location = plocation_elem_new(0);
48408#endif /* FREECIV_JSON_CONNECTION */
48409
48410 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
48411 RECEIVE_PACKET_FIELD_ERROR(names, ": truncation array");
48412 }
48413 for (i = 0; i < real_packet->nsets; i++) {
48414#ifdef FREECIV_JSON_CONNECTION
48415 field_addr.sub_location->number = i;
48416#endif /* FREECIV_JSON_CONNECTION */
48417 if (!DIO_GET(string, &din, &field_addr, real_packet->names[i], sizeof(real_packet->names[i]))) {
48418 RECEIVE_PACKET_FIELD_ERROR(names);
48419 }
48420 }
48421
48422#ifdef FREECIV_JSON_CONNECTION
48423 /* Exit array. */
48424 FC_FREE(field_addr.sub_location);
48425#endif /* FREECIV_JSON_CONNECTION */
48426 }
48427#ifdef FREECIV_JSON_CONNECTION
48428 field_addr.name = "rule_names";
48429#endif /* FREECIV_JSON_CONNECTION */
48430 {
48431 int i;
48432
48433#ifdef FREECIV_JSON_CONNECTION
48434 /* Enter array. */
48435 field_addr.sub_location = plocation_elem_new(0);
48436#endif /* FREECIV_JSON_CONNECTION */
48437
48438 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
48439 RECEIVE_PACKET_FIELD_ERROR(rule_names, ": truncation array");
48440 }
48441 for (i = 0; i < real_packet->nsets; i++) {
48442#ifdef FREECIV_JSON_CONNECTION
48443 field_addr.sub_location->number = i;
48444#endif /* FREECIV_JSON_CONNECTION */
48445 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_names[i], sizeof(real_packet->rule_names[i]))) {
48446 RECEIVE_PACKET_FIELD_ERROR(rule_names);
48447 }
48448 }
48449
48450#ifdef FREECIV_JSON_CONNECTION
48451 /* Exit array. */
48452 FC_FREE(field_addr.sub_location);
48453#endif /* FREECIV_JSON_CONNECTION */
48454 }
48455#ifdef FREECIV_JSON_CONNECTION
48456 field_addr.name = "descriptions";
48457#endif /* FREECIV_JSON_CONNECTION */
48458 {
48459 int i;
48460
48461#ifdef FREECIV_JSON_CONNECTION
48462 /* Enter array. */
48463 field_addr.sub_location = plocation_elem_new(0);
48464#endif /* FREECIV_JSON_CONNECTION */
48465
48466 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
48467 RECEIVE_PACKET_FIELD_ERROR(descriptions, ": truncation array");
48468 }
48469 for (i = 0; i < real_packet->nsets; i++) {
48470#ifdef FREECIV_JSON_CONNECTION
48471 field_addr.sub_location->number = i;
48472#endif /* FREECIV_JSON_CONNECTION */
48473 if (!DIO_GET(string, &din, &field_addr, real_packet->descriptions[i], sizeof(real_packet->descriptions[i]))) {
48474 RECEIVE_PACKET_FIELD_ERROR(descriptions);
48475 }
48476 }
48477
48478#ifdef FREECIV_JSON_CONNECTION
48479 /* Exit array. */
48480 FC_FREE(field_addr.sub_location);
48481#endif /* FREECIV_JSON_CONNECTION */
48482 }
48483#endif
48484 log_packet_detailed("packet_ruleset_nation_sets_100: got info about ()");
48485
48486#ifdef FREECIV_DELTA_PROTOCOL
48487 if (NULL == *hash) {
48488 *hash = genhash_new_full(hash_packet_ruleset_nation_sets_100, cmp_packet_ruleset_nation_sets_100,
48489 NULL, NULL, NULL, free);
48490 }
48491
48492 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
48493 *real_packet = *old;
48494 } else {
48495 log_packet_detailed(" no old info");
48496 memset(real_packet, 0, sizeof(*real_packet));
48497 }
48498
48499 if (BV_ISSET(fields, 0)) {
48500 log_packet_detailed(" got field 'nsets'");
48501#ifdef FREECIV_JSON_CONNECTION
48502 field_addr.name = "nsets";
48503#endif /* FREECIV_JSON_CONNECTION */
48504 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
48505 RECEIVE_PACKET_FIELD_ERROR(nsets);
48506 }
48507 }
48508 if (BV_ISSET(fields, 1)) {
48509 log_packet_detailed(" got field 'names'");
48510#ifdef FREECIV_JSON_CONNECTION
48511 field_addr.name = "names";
48512#endif /* FREECIV_JSON_CONNECTION */
48513 {
48514 int i;
48515
48516#ifdef FREECIV_JSON_CONNECTION
48517 /* Enter array. */
48518 field_addr.sub_location = plocation_elem_new(0);
48519#endif /* FREECIV_JSON_CONNECTION */
48520
48521 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
48522 RECEIVE_PACKET_FIELD_ERROR(names, ": truncation array");
48523 }
48524 for (i = 0; i < real_packet->nsets; i++) {
48525#ifdef FREECIV_JSON_CONNECTION
48526 field_addr.sub_location->number = i;
48527#endif /* FREECIV_JSON_CONNECTION */
48528 if (!DIO_GET(string, &din, &field_addr, real_packet->names[i], sizeof(real_packet->names[i]))) {
48529 RECEIVE_PACKET_FIELD_ERROR(names);
48530 }
48531 }
48532
48533#ifdef FREECIV_JSON_CONNECTION
48534 /* Exit array. */
48535 FC_FREE(field_addr.sub_location);
48536#endif /* FREECIV_JSON_CONNECTION */
48537 }
48538 }
48539 if (BV_ISSET(fields, 2)) {
48540 log_packet_detailed(" got field 'rule_names'");
48541#ifdef FREECIV_JSON_CONNECTION
48542 field_addr.name = "rule_names";
48543#endif /* FREECIV_JSON_CONNECTION */
48544 {
48545 int i;
48546
48547#ifdef FREECIV_JSON_CONNECTION
48548 /* Enter array. */
48549 field_addr.sub_location = plocation_elem_new(0);
48550#endif /* FREECIV_JSON_CONNECTION */
48551
48552 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
48553 RECEIVE_PACKET_FIELD_ERROR(rule_names, ": truncation array");
48554 }
48555 for (i = 0; i < real_packet->nsets; i++) {
48556#ifdef FREECIV_JSON_CONNECTION
48557 field_addr.sub_location->number = i;
48558#endif /* FREECIV_JSON_CONNECTION */
48559 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_names[i], sizeof(real_packet->rule_names[i]))) {
48560 RECEIVE_PACKET_FIELD_ERROR(rule_names);
48561 }
48562 }
48563
48564#ifdef FREECIV_JSON_CONNECTION
48565 /* Exit array. */
48566 FC_FREE(field_addr.sub_location);
48567#endif /* FREECIV_JSON_CONNECTION */
48568 }
48569 }
48570 if (BV_ISSET(fields, 3)) {
48571 log_packet_detailed(" got field 'descriptions'");
48572#ifdef FREECIV_JSON_CONNECTION
48573 field_addr.name = "descriptions";
48574#endif /* FREECIV_JSON_CONNECTION */
48575 {
48576 int i;
48577
48578#ifdef FREECIV_JSON_CONNECTION
48579 /* Enter array. */
48580 field_addr.sub_location = plocation_elem_new(0);
48581#endif /* FREECIV_JSON_CONNECTION */
48582
48583 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
48584 RECEIVE_PACKET_FIELD_ERROR(descriptions, ": truncation array");
48585 }
48586 for (i = 0; i < real_packet->nsets; i++) {
48587#ifdef FREECIV_JSON_CONNECTION
48588 field_addr.sub_location->number = i;
48589#endif /* FREECIV_JSON_CONNECTION */
48590 if (!DIO_GET(string, &din, &field_addr, real_packet->descriptions[i], sizeof(real_packet->descriptions[i]))) {
48591 RECEIVE_PACKET_FIELD_ERROR(descriptions);
48592 }
48593 }
48594
48595#ifdef FREECIV_JSON_CONNECTION
48596 /* Exit array. */
48597 FC_FREE(field_addr.sub_location);
48598#endif /* FREECIV_JSON_CONNECTION */
48599 }
48600 }
48601
48602 if (NULL == old) {
48603 old = fc_malloc(sizeof(*old));
48604 *old = *real_packet;
48605 genhash_insert(*hash, old, old);
48606 } else {
48607 *old = *real_packet;
48608 }
48609
48610#endif /* FREECIV_DELTA_PROTOCOL */
48611 RECEIVE_PACKET_END(real_packet);
48612}
48613
48614 static int send_packet_ruleset_nation_sets_100(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
48615{
48616 const struct packet_ruleset_nation_sets *real_packet = packet;
48617 int e;
48618#ifdef FREECIV_DELTA_PROTOCOL
48619 packet_ruleset_nation_sets_100_fields fields;
48620 struct packet_ruleset_nation_sets *old;
48621 bool differ;
48622 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION_SETS;
48623#endif /* FREECIV_DELTA_PROTOCOL */
48624 SEND_PACKET_START(PACKET_RULESET_NATION_SETS);
48625#ifdef FREECIV_JSON_CONNECTION
48626 struct plocation field_addr;
48627 {
48628 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48629 field_addr = *field_addr_tmp;
48630 FC_FREE(field_addr_tmp);
48631 }
48632#endif /* FREECIV_JSON_CONNECTION */
48633
48634 log_packet_detailed("packet_ruleset_nation_sets_100: sending info about ()");
48635
48636#ifdef FREECIV_DELTA_PROTOCOL
48637 if (NULL == *hash) {
48638 *hash = genhash_new_full(hash_packet_ruleset_nation_sets_100, cmp_packet_ruleset_nation_sets_100,
48639 NULL, NULL, NULL, free);
48640 }
48641 BV_CLR_ALL(fields);
48642
48643 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
48644 old = fc_malloc(sizeof(*old));
48645 *old = *real_packet;
48646 genhash_insert(*hash, old, old);
48647 memset(old, 0, sizeof(*old));
48648 }
48649 differ = (old->nsets != real_packet->nsets);
48650 if (differ) {
48651 BV_SET(fields, 0);
48652 }
48653
48654 differ = (old->nsets != real_packet->nsets);
48655 if (!differ) {
48656 int i;
48657
48658 for (i = 0; i < real_packet->nsets; i++) {
48659 differ = (strcmp(old->names[i], real_packet->names[i]) != 0);
48660 if (differ) {
48661 break;
48662 }
48663 }
48664 }
48665 if (differ) {
48666 BV_SET(fields, 1);
48667 }
48668
48669 differ = (old->nsets != real_packet->nsets);
48670 if (!differ) {
48671 int i;
48672
48673 for (i = 0; i < real_packet->nsets; i++) {
48674 differ = (strcmp(old->rule_names[i], real_packet->rule_names[i]) != 0);
48675 if (differ) {
48676 break;
48677 }
48678 }
48679 }
48680 if (differ) {
48681 BV_SET(fields, 2);
48682 }
48683
48684 differ = (old->nsets != real_packet->nsets);
48685 if (!differ) {
48686 int i;
48687
48688 for (i = 0; i < real_packet->nsets; i++) {
48689 differ = (strcmp(old->descriptions[i], real_packet->descriptions[i]) != 0);
48690 if (differ) {
48691 break;
48692 }
48693 }
48694 }
48695 if (differ) {
48696 BV_SET(fields, 3);
48697 }
48698
48699
48700#ifdef FREECIV_JSON_CONNECTION
48701 field_addr.name = "fields";
48702#endif /* FREECIV_JSON_CONNECTION */
48703 e = 0;
48704 e |= DIO_BV_PUT(&dout, &field_addr, fields);
48705 if (e) {
48706 log_packet_detailed("fields bitvector error detected");
48707 }
48708
48709 if (BV_ISSET(fields, 0)) {
48710 log_packet_detailed(" field 'nsets' has changed");
48711#ifdef FREECIV_JSON_CONNECTION
48712 field_addr.name = "nsets";
48713#endif /* FREECIV_JSON_CONNECTION */
48714 e = 0;
48715 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
48716 if (e) {
48717 log_packet_detailed("'nsets' field error detected");
48718 }
48719 }
48720 if (BV_ISSET(fields, 1)) {
48721 log_packet_detailed(" field 'names' has changed");
48722#ifdef FREECIV_JSON_CONNECTION
48723 field_addr.name = "names";
48724#endif /* FREECIV_JSON_CONNECTION */
48725 e = 0;
48726 {
48727 int i;
48728
48729#ifdef FREECIV_JSON_CONNECTION
48730 /* Create the array. */
48731 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
48732
48733 /* Enter the array. */
48734 field_addr.sub_location = plocation_elem_new(0);
48735#endif /* FREECIV_JSON_CONNECTION */
48736
48737 for (i = 0; i < real_packet->nsets; i++) {
48738#ifdef FREECIV_JSON_CONNECTION
48739 /* Next array element. */
48740 field_addr.sub_location->number = i;
48741#endif /* FREECIV_JSON_CONNECTION */
48742 e |= DIO_PUT(string, &dout, &field_addr, real_packet->names[i]);
48743 }
48744
48745#ifdef FREECIV_JSON_CONNECTION
48746 /* Exit array. */
48747 FC_FREE(field_addr.sub_location);
48748#endif /* FREECIV_JSON_CONNECTION */
48749 }
48750 if (e) {
48751 log_packet_detailed("'names' field error detected");
48752 }
48753 }
48754 if (BV_ISSET(fields, 2)) {
48755 log_packet_detailed(" field 'rule_names' has changed");
48756#ifdef FREECIV_JSON_CONNECTION
48757 field_addr.name = "rule_names";
48758#endif /* FREECIV_JSON_CONNECTION */
48759 e = 0;
48760 {
48761 int i;
48762
48763#ifdef FREECIV_JSON_CONNECTION
48764 /* Create the array. */
48765 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
48766
48767 /* Enter the array. */
48768 field_addr.sub_location = plocation_elem_new(0);
48769#endif /* FREECIV_JSON_CONNECTION */
48770
48771 for (i = 0; i < real_packet->nsets; i++) {
48772#ifdef FREECIV_JSON_CONNECTION
48773 /* Next array element. */
48774 field_addr.sub_location->number = i;
48775#endif /* FREECIV_JSON_CONNECTION */
48776 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_names[i]);
48777 }
48778
48779#ifdef FREECIV_JSON_CONNECTION
48780 /* Exit array. */
48781 FC_FREE(field_addr.sub_location);
48782#endif /* FREECIV_JSON_CONNECTION */
48783 }
48784 if (e) {
48785 log_packet_detailed("'rule_names' field error detected");
48786 }
48787 }
48788 if (BV_ISSET(fields, 3)) {
48789 log_packet_detailed(" field 'descriptions' has changed");
48790#ifdef FREECIV_JSON_CONNECTION
48791 field_addr.name = "descriptions";
48792#endif /* FREECIV_JSON_CONNECTION */
48793 e = 0;
48794 {
48795 int i;
48796
48797#ifdef FREECIV_JSON_CONNECTION
48798 /* Create the array. */
48799 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
48800
48801 /* Enter the array. */
48802 field_addr.sub_location = plocation_elem_new(0);
48803#endif /* FREECIV_JSON_CONNECTION */
48804
48805 for (i = 0; i < real_packet->nsets; i++) {
48806#ifdef FREECIV_JSON_CONNECTION
48807 /* Next array element. */
48808 field_addr.sub_location->number = i;
48809#endif /* FREECIV_JSON_CONNECTION */
48810 e |= DIO_PUT(string, &dout, &field_addr, real_packet->descriptions[i]);
48811 }
48812
48813#ifdef FREECIV_JSON_CONNECTION
48814 /* Exit array. */
48815 FC_FREE(field_addr.sub_location);
48816#endif /* FREECIV_JSON_CONNECTION */
48817 }
48818 if (e) {
48819 log_packet_detailed("'descriptions' field error detected");
48820 }
48821 }
48822
48823 *old = *real_packet;
48824#endif /* FREECIV_DELTA_PROTOCOL */
48825#ifndef FREECIV_DELTA_PROTOCOL
48826#ifdef FREECIV_JSON_CONNECTION
48827 field_addr.name = "nsets";
48828#endif /* FREECIV_JSON_CONNECTION */
48829 e = 0;
48830 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
48831 if (e) {
48832 log_packet_detailed("'nsets' field error detected");
48833 }
48834#ifdef FREECIV_JSON_CONNECTION
48835 field_addr.name = "names";
48836#endif /* FREECIV_JSON_CONNECTION */
48837 e = 0;
48838 {
48839 int i;
48840
48841#ifdef FREECIV_JSON_CONNECTION
48842 /* Create the array. */
48843 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
48844
48845 /* Enter the array. */
48846 field_addr.sub_location = plocation_elem_new(0);
48847#endif /* FREECIV_JSON_CONNECTION */
48848
48849 for (i = 0; i < real_packet->nsets; i++) {
48850#ifdef FREECIV_JSON_CONNECTION
48851 /* Next array element. */
48852 field_addr.sub_location->number = i;
48853#endif /* FREECIV_JSON_CONNECTION */
48854 e |= DIO_PUT(string, &dout, &field_addr, real_packet->names[i]);
48855 }
48856
48857#ifdef FREECIV_JSON_CONNECTION
48858 /* Exit array. */
48859 FC_FREE(field_addr.sub_location);
48860#endif /* FREECIV_JSON_CONNECTION */
48861 }
48862 if (e) {
48863 log_packet_detailed("'names' field error detected");
48864 }
48865#ifdef FREECIV_JSON_CONNECTION
48866 field_addr.name = "rule_names";
48867#endif /* FREECIV_JSON_CONNECTION */
48868 e = 0;
48869 {
48870 int i;
48871
48872#ifdef FREECIV_JSON_CONNECTION
48873 /* Create the array. */
48874 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
48875
48876 /* Enter the array. */
48877 field_addr.sub_location = plocation_elem_new(0);
48878#endif /* FREECIV_JSON_CONNECTION */
48879
48880 for (i = 0; i < real_packet->nsets; i++) {
48881#ifdef FREECIV_JSON_CONNECTION
48882 /* Next array element. */
48883 field_addr.sub_location->number = i;
48884#endif /* FREECIV_JSON_CONNECTION */
48885 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_names[i]);
48886 }
48887
48888#ifdef FREECIV_JSON_CONNECTION
48889 /* Exit array. */
48890 FC_FREE(field_addr.sub_location);
48891#endif /* FREECIV_JSON_CONNECTION */
48892 }
48893 if (e) {
48894 log_packet_detailed("'rule_names' field error detected");
48895 }
48896#ifdef FREECIV_JSON_CONNECTION
48897 field_addr.name = "descriptions";
48898#endif /* FREECIV_JSON_CONNECTION */
48899 e = 0;
48900 {
48901 int i;
48902
48903#ifdef FREECIV_JSON_CONNECTION
48904 /* Create the array. */
48905 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
48906
48907 /* Enter the array. */
48908 field_addr.sub_location = plocation_elem_new(0);
48909#endif /* FREECIV_JSON_CONNECTION */
48910
48911 for (i = 0; i < real_packet->nsets; i++) {
48912#ifdef FREECIV_JSON_CONNECTION
48913 /* Next array element. */
48914 field_addr.sub_location->number = i;
48915#endif /* FREECIV_JSON_CONNECTION */
48916 e |= DIO_PUT(string, &dout, &field_addr, real_packet->descriptions[i]);
48917 }
48918
48919#ifdef FREECIV_JSON_CONNECTION
48920 /* Exit array. */
48921 FC_FREE(field_addr.sub_location);
48922#endif /* FREECIV_JSON_CONNECTION */
48923 }
48924 if (e) {
48925 log_packet_detailed("'descriptions' field error detected");
48926 }
48927
48928#endif
48929 SEND_PACKET_END(PACKET_RULESET_NATION_SETS);
48930}
48931
48932 int send_packet_ruleset_nation_sets(struct connection *pc, const struct packet_ruleset_nation_sets *packet)
48933{
48934 if (!pc->used) {
48935 log_error("WARNING: trying to send data to the closed connection %s",
48936 conn_description(pc));
48937 return -1;
48938 }
48939 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION_SETS].packet != NULL, -1,
48940 "Handler for PACKET_RULESET_NATION_SETS not installed");
48941 return pc->phs.handlers->send[PACKET_RULESET_NATION_SETS].packet(pc, packet);
48942}
48943
48944 void lsend_packet_ruleset_nation_sets(struct conn_list *dest, const struct packet_ruleset_nation_sets *packet)
48945{
48946 conn_list_iterate(dest, pconn) {
48947 send_packet_ruleset_nation_sets(pconn, packet);
48948 } conn_list_iterate_end;
48949}
48950
48951#ifdef FREECIV_DELTA_PROTOCOL
48952#define hash_packet_ruleset_nation_groups_100 hash_const
48953
48954#define cmp_packet_ruleset_nation_groups_100 cmp_const
48955
48956 BV_DEFINE(packet_ruleset_nation_groups_100_fields, 3);
48957#endif /* FREECIV_DELTA_PROTOCOL */
48958
48959 static struct packet_ruleset_nation_groups *receive_packet_ruleset_nation_groups_100(struct connection *pc)
48960{
48961#ifdef FREECIV_DELTA_PROTOCOL
48962 packet_ruleset_nation_groups_100_fields fields;
48963 struct packet_ruleset_nation_groups *old;
48964 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION_GROUPS;
48965#endif /* FREECIV_DELTA_PROTOCOL */
48966 RECEIVE_PACKET_START(packet_ruleset_nation_groups, real_packet);
48967#ifdef FREECIV_JSON_CONNECTION
48968 struct plocation field_addr;
48969 {
48970 struct plocation *field_addr_tmp = plocation_field_new(NULL);
48971 field_addr = *field_addr_tmp;
48972 FC_FREE(field_addr_tmp);
48973 }
48974#endif /* FREECIV_JSON_CONNECTION */
48975
48976#ifdef FREECIV_DELTA_PROTOCOL
48977#ifdef FREECIV_JSON_CONNECTION
48978 field_addr.name = "fields";
48979#endif /* FREECIV_JSON_CONNECTION */
48980 DIO_BV_GET(&din, &field_addr, fields);
48981
48982#else /* FREECIV_DELTA_PROTOCOL */
48983#ifdef FREECIV_JSON_CONNECTION
48984 field_addr.name = "ngroups";
48985#endif /* FREECIV_JSON_CONNECTION */
48986 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
48987 RECEIVE_PACKET_FIELD_ERROR(ngroups);
48988 }
48989#ifdef FREECIV_JSON_CONNECTION
48990 field_addr.name = "groups";
48991#endif /* FREECIV_JSON_CONNECTION */
48992 {
48993 int i;
48994
48995#ifdef FREECIV_JSON_CONNECTION
48996 /* Enter array. */
48997 field_addr.sub_location = plocation_elem_new(0);
48998#endif /* FREECIV_JSON_CONNECTION */
48999
49000 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
49001 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
49002 }
49003 for (i = 0; i < real_packet->ngroups; i++) {
49004#ifdef FREECIV_JSON_CONNECTION
49005 field_addr.sub_location->number = i;
49006#endif /* FREECIV_JSON_CONNECTION */
49007 if (!DIO_GET(string, &din, &field_addr, real_packet->groups[i], sizeof(real_packet->groups[i]))) {
49008 RECEIVE_PACKET_FIELD_ERROR(groups);
49009 }
49010 }
49011
49012#ifdef FREECIV_JSON_CONNECTION
49013 /* Exit array. */
49014 FC_FREE(field_addr.sub_location);
49015#endif /* FREECIV_JSON_CONNECTION */
49016 }
49017#ifdef FREECIV_JSON_CONNECTION
49018 field_addr.name = "hidden";
49019#endif /* FREECIV_JSON_CONNECTION */
49020 {
49021 int i;
49022
49023#ifdef FREECIV_JSON_CONNECTION
49024 /* Enter array. */
49025 field_addr.sub_location = plocation_elem_new(0);
49026#endif /* FREECIV_JSON_CONNECTION */
49027
49028 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
49029 RECEIVE_PACKET_FIELD_ERROR(hidden, ": truncation array");
49030 }
49031 for (i = 0; i < real_packet->ngroups; i++) {
49032#ifdef FREECIV_JSON_CONNECTION
49033 field_addr.sub_location->number = i;
49034#endif /* FREECIV_JSON_CONNECTION */
49035 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->hidden[i])) {
49036 RECEIVE_PACKET_FIELD_ERROR(hidden);
49037 }
49038 }
49039
49040#ifdef FREECIV_JSON_CONNECTION
49041 /* Exit array. */
49042 FC_FREE(field_addr.sub_location);
49043#endif /* FREECIV_JSON_CONNECTION */
49044 }
49045#endif
49046 log_packet_detailed("packet_ruleset_nation_groups_100: got info about ()");
49047
49048#ifdef FREECIV_DELTA_PROTOCOL
49049 if (NULL == *hash) {
49050 *hash = genhash_new_full(hash_packet_ruleset_nation_groups_100, cmp_packet_ruleset_nation_groups_100,
49051 NULL, NULL, NULL, free);
49052 }
49053
49054 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49055 *real_packet = *old;
49056 } else {
49057 log_packet_detailed(" no old info");
49058 memset(real_packet, 0, sizeof(*real_packet));
49059 }
49060
49061 if (BV_ISSET(fields, 0)) {
49062 log_packet_detailed(" got field 'ngroups'");
49063#ifdef FREECIV_JSON_CONNECTION
49064 field_addr.name = "ngroups";
49065#endif /* FREECIV_JSON_CONNECTION */
49066 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
49067 RECEIVE_PACKET_FIELD_ERROR(ngroups);
49068 }
49069 }
49070 if (BV_ISSET(fields, 1)) {
49071 log_packet_detailed(" got field 'groups'");
49072#ifdef FREECIV_JSON_CONNECTION
49073 field_addr.name = "groups";
49074#endif /* FREECIV_JSON_CONNECTION */
49075 {
49076 int i;
49077
49078#ifdef FREECIV_JSON_CONNECTION
49079 /* Enter array. */
49080 field_addr.sub_location = plocation_elem_new(0);
49081#endif /* FREECIV_JSON_CONNECTION */
49082
49083 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
49084 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
49085 }
49086 for (i = 0; i < real_packet->ngroups; i++) {
49087#ifdef FREECIV_JSON_CONNECTION
49088 field_addr.sub_location->number = i;
49089#endif /* FREECIV_JSON_CONNECTION */
49090 if (!DIO_GET(string, &din, &field_addr, real_packet->groups[i], sizeof(real_packet->groups[i]))) {
49091 RECEIVE_PACKET_FIELD_ERROR(groups);
49092 }
49093 }
49094
49095#ifdef FREECIV_JSON_CONNECTION
49096 /* Exit array. */
49097 FC_FREE(field_addr.sub_location);
49098#endif /* FREECIV_JSON_CONNECTION */
49099 }
49100 }
49101 if (BV_ISSET(fields, 2)) {
49102 log_packet_detailed(" got field 'hidden'");
49103#ifdef FREECIV_JSON_CONNECTION
49104 field_addr.name = "hidden";
49105#endif /* FREECIV_JSON_CONNECTION */
49106 {
49107 int i;
49108
49109#ifdef FREECIV_JSON_CONNECTION
49110 /* Enter array. */
49111 field_addr.sub_location = plocation_elem_new(0);
49112#endif /* FREECIV_JSON_CONNECTION */
49113
49114 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
49115 RECEIVE_PACKET_FIELD_ERROR(hidden, ": truncation array");
49116 }
49117 for (i = 0; i < real_packet->ngroups; i++) {
49118#ifdef FREECIV_JSON_CONNECTION
49119 field_addr.sub_location->number = i;
49120#endif /* FREECIV_JSON_CONNECTION */
49121 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->hidden[i])) {
49122 RECEIVE_PACKET_FIELD_ERROR(hidden);
49123 }
49124 }
49125
49126#ifdef FREECIV_JSON_CONNECTION
49127 /* Exit array. */
49128 FC_FREE(field_addr.sub_location);
49129#endif /* FREECIV_JSON_CONNECTION */
49130 }
49131 }
49132
49133 if (NULL == old) {
49134 old = fc_malloc(sizeof(*old));
49135 *old = *real_packet;
49136 genhash_insert(*hash, old, old);
49137 } else {
49138 *old = *real_packet;
49139 }
49140
49141#endif /* FREECIV_DELTA_PROTOCOL */
49142 RECEIVE_PACKET_END(real_packet);
49143}
49144
49145 static int send_packet_ruleset_nation_groups_100(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
49146{
49147 const struct packet_ruleset_nation_groups *real_packet = packet;
49148 int e;
49149#ifdef FREECIV_DELTA_PROTOCOL
49150 packet_ruleset_nation_groups_100_fields fields;
49151 struct packet_ruleset_nation_groups *old;
49152 bool differ;
49153 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION_GROUPS;
49154#endif /* FREECIV_DELTA_PROTOCOL */
49155 SEND_PACKET_START(PACKET_RULESET_NATION_GROUPS);
49156#ifdef FREECIV_JSON_CONNECTION
49157 struct plocation field_addr;
49158 {
49159 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49160 field_addr = *field_addr_tmp;
49161 FC_FREE(field_addr_tmp);
49162 }
49163#endif /* FREECIV_JSON_CONNECTION */
49164
49165 log_packet_detailed("packet_ruleset_nation_groups_100: sending info about ()");
49166
49167#ifdef FREECIV_DELTA_PROTOCOL
49168 if (NULL == *hash) {
49169 *hash = genhash_new_full(hash_packet_ruleset_nation_groups_100, cmp_packet_ruleset_nation_groups_100,
49170 NULL, NULL, NULL, free);
49171 }
49172 BV_CLR_ALL(fields);
49173
49174 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
49175 old = fc_malloc(sizeof(*old));
49176 *old = *real_packet;
49177 genhash_insert(*hash, old, old);
49178 memset(old, 0, sizeof(*old));
49179 }
49180 differ = (old->ngroups != real_packet->ngroups);
49181 if (differ) {
49182 BV_SET(fields, 0);
49183 }
49184
49185 differ = (old->ngroups != real_packet->ngroups);
49186 if (!differ) {
49187 int i;
49188
49189 for (i = 0; i < real_packet->ngroups; i++) {
49190 differ = (strcmp(old->groups[i], real_packet->groups[i]) != 0);
49191 if (differ) {
49192 break;
49193 }
49194 }
49195 }
49196 if (differ) {
49197 BV_SET(fields, 1);
49198 }
49199
49200 differ = (old->ngroups != real_packet->ngroups);
49201 if (!differ) {
49202 int i;
49203
49204 for (i = 0; i < real_packet->ngroups; i++) {
49205 differ = (old->hidden[i] != real_packet->hidden[i]);
49206 if (differ) {
49207 break;
49208 }
49209 }
49210 }
49211 if (differ) {
49212 BV_SET(fields, 2);
49213 }
49214
49215
49216#ifdef FREECIV_JSON_CONNECTION
49217 field_addr.name = "fields";
49218#endif /* FREECIV_JSON_CONNECTION */
49219 e = 0;
49220 e |= DIO_BV_PUT(&dout, &field_addr, fields);
49221 if (e) {
49222 log_packet_detailed("fields bitvector error detected");
49223 }
49224
49225 if (BV_ISSET(fields, 0)) {
49226 log_packet_detailed(" field 'ngroups' has changed");
49227#ifdef FREECIV_JSON_CONNECTION
49228 field_addr.name = "ngroups";
49229#endif /* FREECIV_JSON_CONNECTION */
49230 e = 0;
49231 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
49232 if (e) {
49233 log_packet_detailed("'ngroups' field error detected");
49234 }
49235 }
49236 if (BV_ISSET(fields, 1)) {
49237 log_packet_detailed(" field 'groups' has changed");
49238#ifdef FREECIV_JSON_CONNECTION
49239 field_addr.name = "groups";
49240#endif /* FREECIV_JSON_CONNECTION */
49241 e = 0;
49242 {
49243 int i;
49244
49245#ifdef FREECIV_JSON_CONNECTION
49246 /* Create the array. */
49247 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
49248
49249 /* Enter the array. */
49250 field_addr.sub_location = plocation_elem_new(0);
49251#endif /* FREECIV_JSON_CONNECTION */
49252
49253 for (i = 0; i < real_packet->ngroups; i++) {
49254#ifdef FREECIV_JSON_CONNECTION
49255 /* Next array element. */
49256 field_addr.sub_location->number = i;
49257#endif /* FREECIV_JSON_CONNECTION */
49258 e |= DIO_PUT(string, &dout, &field_addr, real_packet->groups[i]);
49259 }
49260
49261#ifdef FREECIV_JSON_CONNECTION
49262 /* Exit array. */
49263 FC_FREE(field_addr.sub_location);
49264#endif /* FREECIV_JSON_CONNECTION */
49265 }
49266 if (e) {
49267 log_packet_detailed("'groups' field error detected");
49268 }
49269 }
49270 if (BV_ISSET(fields, 2)) {
49271 log_packet_detailed(" field 'hidden' has changed");
49272#ifdef FREECIV_JSON_CONNECTION
49273 field_addr.name = "hidden";
49274#endif /* FREECIV_JSON_CONNECTION */
49275 e = 0;
49276 {
49277 int i;
49278
49279#ifdef FREECIV_JSON_CONNECTION
49280 /* Create the array. */
49281 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
49282
49283 /* Enter the array. */
49284 field_addr.sub_location = plocation_elem_new(0);
49285#endif /* FREECIV_JSON_CONNECTION */
49286
49287 for (i = 0; i < real_packet->ngroups; i++) {
49288#ifdef FREECIV_JSON_CONNECTION
49289 /* Next array element. */
49290 field_addr.sub_location->number = i;
49291#endif /* FREECIV_JSON_CONNECTION */
49292 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->hidden[i]);
49293 }
49294
49295#ifdef FREECIV_JSON_CONNECTION
49296 /* Exit array. */
49297 FC_FREE(field_addr.sub_location);
49298#endif /* FREECIV_JSON_CONNECTION */
49299 }
49300 if (e) {
49301 log_packet_detailed("'hidden' field error detected");
49302 }
49303 }
49304
49305 *old = *real_packet;
49306#endif /* FREECIV_DELTA_PROTOCOL */
49307#ifndef FREECIV_DELTA_PROTOCOL
49308#ifdef FREECIV_JSON_CONNECTION
49309 field_addr.name = "ngroups";
49310#endif /* FREECIV_JSON_CONNECTION */
49311 e = 0;
49312 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
49313 if (e) {
49314 log_packet_detailed("'ngroups' field error detected");
49315 }
49316#ifdef FREECIV_JSON_CONNECTION
49317 field_addr.name = "groups";
49318#endif /* FREECIV_JSON_CONNECTION */
49319 e = 0;
49320 {
49321 int i;
49322
49323#ifdef FREECIV_JSON_CONNECTION
49324 /* Create the array. */
49325 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
49326
49327 /* Enter the array. */
49328 field_addr.sub_location = plocation_elem_new(0);
49329#endif /* FREECIV_JSON_CONNECTION */
49330
49331 for (i = 0; i < real_packet->ngroups; i++) {
49332#ifdef FREECIV_JSON_CONNECTION
49333 /* Next array element. */
49334 field_addr.sub_location->number = i;
49335#endif /* FREECIV_JSON_CONNECTION */
49336 e |= DIO_PUT(string, &dout, &field_addr, real_packet->groups[i]);
49337 }
49338
49339#ifdef FREECIV_JSON_CONNECTION
49340 /* Exit array. */
49341 FC_FREE(field_addr.sub_location);
49342#endif /* FREECIV_JSON_CONNECTION */
49343 }
49344 if (e) {
49345 log_packet_detailed("'groups' field error detected");
49346 }
49347#ifdef FREECIV_JSON_CONNECTION
49348 field_addr.name = "hidden";
49349#endif /* FREECIV_JSON_CONNECTION */
49350 e = 0;
49351 {
49352 int i;
49353
49354#ifdef FREECIV_JSON_CONNECTION
49355 /* Create the array. */
49356 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
49357
49358 /* Enter the array. */
49359 field_addr.sub_location = plocation_elem_new(0);
49360#endif /* FREECIV_JSON_CONNECTION */
49361
49362 for (i = 0; i < real_packet->ngroups; i++) {
49363#ifdef FREECIV_JSON_CONNECTION
49364 /* Next array element. */
49365 field_addr.sub_location->number = i;
49366#endif /* FREECIV_JSON_CONNECTION */
49367 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->hidden[i]);
49368 }
49369
49370#ifdef FREECIV_JSON_CONNECTION
49371 /* Exit array. */
49372 FC_FREE(field_addr.sub_location);
49373#endif /* FREECIV_JSON_CONNECTION */
49374 }
49375 if (e) {
49376 log_packet_detailed("'hidden' field error detected");
49377 }
49378
49379#endif
49380 SEND_PACKET_END(PACKET_RULESET_NATION_GROUPS);
49381}
49382
49383 int send_packet_ruleset_nation_groups(struct connection *pc, const struct packet_ruleset_nation_groups *packet)
49384{
49385 if (!pc->used) {
49386 log_error("WARNING: trying to send data to the closed connection %s",
49387 conn_description(pc));
49388 return -1;
49389 }
49390 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION_GROUPS].packet != NULL, -1,
49391 "Handler for PACKET_RULESET_NATION_GROUPS not installed");
49392 return pc->phs.handlers->send[PACKET_RULESET_NATION_GROUPS].packet(pc, packet);
49393}
49394
49395 void lsend_packet_ruleset_nation_groups(struct conn_list *dest, const struct packet_ruleset_nation_groups *packet)
49396{
49397 conn_list_iterate(dest, pconn) {
49398 send_packet_ruleset_nation_groups(pconn, packet);
49399 } conn_list_iterate_end;
49400}
49401
49402#ifdef FREECIV_DELTA_PROTOCOL
49403static genhash_val_t hash_packet_ruleset_nation_100(const void *vkey)
49404{
49405 const struct packet_ruleset_nation *key = (const struct packet_ruleset_nation *) vkey;
49406 genhash_val_t result = 0;
49407
49408 result += key->id;
49409
49410 result &= 0xFFFFFFFF;
49411 return result;
49412}
49413
49414static bool cmp_packet_ruleset_nation_100(const void *vkey1, const void *vkey2)
49415{
49416 const struct packet_ruleset_nation *old = (const struct packet_ruleset_nation *) vkey1;
49417 const struct packet_ruleset_nation *real_packet = (const struct packet_ruleset_nation *) vkey2;
49418 bool differ;
49419
49420 differ = (old->id != real_packet->id);
49421
49422 return !differ;
49423}
49424 BV_DEFINE(packet_ruleset_nation_100_fields, 24);
49425#endif /* FREECIV_DELTA_PROTOCOL */
49426
49427 static struct packet_ruleset_nation *receive_packet_ruleset_nation_100(struct connection *pc)
49428{
49429#ifdef FREECIV_DELTA_PROTOCOL
49430 packet_ruleset_nation_100_fields fields;
49431 struct packet_ruleset_nation *old;
49432 struct genhash **hash = pc->phs.received + PACKET_RULESET_NATION;
49433#endif /* FREECIV_DELTA_PROTOCOL */
49434 RECEIVE_PACKET_START(packet_ruleset_nation, real_packet);
49435#ifdef FREECIV_JSON_CONNECTION
49436 struct plocation field_addr;
49437 {
49438 struct plocation *field_addr_tmp = plocation_field_new(NULL);
49439 field_addr = *field_addr_tmp;
49440 FC_FREE(field_addr_tmp);
49441 }
49442#endif /* FREECIV_JSON_CONNECTION */
49443
49444#ifdef FREECIV_DELTA_PROTOCOL
49445#ifdef FREECIV_JSON_CONNECTION
49446 field_addr.name = "fields";
49447#endif /* FREECIV_JSON_CONNECTION */
49448 DIO_BV_GET(&din, &field_addr, fields);
49449#ifdef FREECIV_JSON_CONNECTION
49450 field_addr.name = "id";
49451#endif /* FREECIV_JSON_CONNECTION */
49452 {
49453 int readin;
49454
49455 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
49456 RECEIVE_PACKET_FIELD_ERROR(id);
49457 }
49458 real_packet->id = readin;
49459 }
49460
49461#else /* FREECIV_DELTA_PROTOCOL */
49462#ifdef FREECIV_JSON_CONNECTION
49463 field_addr.name = "id";
49464#endif /* FREECIV_JSON_CONNECTION */
49465 {
49466 int readin;
49467
49468 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
49469 RECEIVE_PACKET_FIELD_ERROR(id);
49470 }
49471 real_packet->id = readin;
49472 }
49473#ifdef FREECIV_JSON_CONNECTION
49474 field_addr.name = "translation_domain";
49475#endif /* FREECIV_JSON_CONNECTION */
49476 if (!DIO_GET(string, &din, &field_addr, real_packet->translation_domain, sizeof(real_packet->translation_domain))) {
49477 RECEIVE_PACKET_FIELD_ERROR(translation_domain);
49478 }
49479#ifdef FREECIV_JSON_CONNECTION
49480 field_addr.name = "adjective";
49481#endif /* FREECIV_JSON_CONNECTION */
49482 if (!DIO_GET(string, &din, &field_addr, real_packet->adjective, sizeof(real_packet->adjective))) {
49483 RECEIVE_PACKET_FIELD_ERROR(adjective);
49484 }
49485#ifdef FREECIV_JSON_CONNECTION
49486 field_addr.name = "rule_name";
49487#endif /* FREECIV_JSON_CONNECTION */
49488 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
49489 RECEIVE_PACKET_FIELD_ERROR(rule_name);
49490 }
49491#ifdef FREECIV_JSON_CONNECTION
49492 field_addr.name = "noun_plural";
49493#endif /* FREECIV_JSON_CONNECTION */
49494 if (!DIO_GET(string, &din, &field_addr, real_packet->noun_plural, sizeof(real_packet->noun_plural))) {
49495 RECEIVE_PACKET_FIELD_ERROR(noun_plural);
49496 }
49497#ifdef FREECIV_JSON_CONNECTION
49498 field_addr.name = "graphic_str";
49499#endif /* FREECIV_JSON_CONNECTION */
49500 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
49501 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
49502 }
49503#ifdef FREECIV_JSON_CONNECTION
49504 field_addr.name = "graphic_alt";
49505#endif /* FREECIV_JSON_CONNECTION */
49506 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
49507 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
49508 }
49509#ifdef FREECIV_JSON_CONNECTION
49510 field_addr.name = "legend";
49511#endif /* FREECIV_JSON_CONNECTION */
49512 if (!DIO_GET(string, &din, &field_addr, real_packet->legend, sizeof(real_packet->legend))) {
49513 RECEIVE_PACKET_FIELD_ERROR(legend);
49514 }
49515#ifdef FREECIV_JSON_CONNECTION
49516 field_addr.name = "style";
49517#endif /* FREECIV_JSON_CONNECTION */
49518 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
49519 RECEIVE_PACKET_FIELD_ERROR(style);
49520 }
49521#ifdef FREECIV_JSON_CONNECTION
49522 field_addr.name = "leader_count";
49523#endif /* FREECIV_JSON_CONNECTION */
49524 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->leader_count)) {
49525 RECEIVE_PACKET_FIELD_ERROR(leader_count);
49526 }
49527#ifdef FREECIV_JSON_CONNECTION
49528 field_addr.name = "leader_name";
49529#endif /* FREECIV_JSON_CONNECTION */
49530 {
49531 int i;
49532
49533#ifdef FREECIV_JSON_CONNECTION
49534 /* Enter array. */
49535 field_addr.sub_location = plocation_elem_new(0);
49536#endif /* FREECIV_JSON_CONNECTION */
49537
49538 if (real_packet->leader_count > MAX_NUM_LEADERS) {
49539 RECEIVE_PACKET_FIELD_ERROR(leader_name, ": truncation array");
49540 }
49541 for (i = 0; i < real_packet->leader_count; i++) {
49542#ifdef FREECIV_JSON_CONNECTION
49543 field_addr.sub_location->number = i;
49544#endif /* FREECIV_JSON_CONNECTION */
49545 if (!DIO_GET(string, &din, &field_addr, real_packet->leader_name[i], sizeof(real_packet->leader_name[i]))) {
49546 RECEIVE_PACKET_FIELD_ERROR(leader_name);
49547 }
49548 }
49549
49550#ifdef FREECIV_JSON_CONNECTION
49551 /* Exit array. */
49552 FC_FREE(field_addr.sub_location);
49553#endif /* FREECIV_JSON_CONNECTION */
49554 }
49555#ifdef FREECIV_JSON_CONNECTION
49556 field_addr.name = "leader_is_male";
49557#endif /* FREECIV_JSON_CONNECTION */
49558 {
49559 int i;
49560
49561#ifdef FREECIV_JSON_CONNECTION
49562 /* Enter array. */
49563 field_addr.sub_location = plocation_elem_new(0);
49564#endif /* FREECIV_JSON_CONNECTION */
49565
49566 if (real_packet->leader_count > MAX_NUM_LEADERS) {
49567 RECEIVE_PACKET_FIELD_ERROR(leader_is_male, ": truncation array");
49568 }
49569 for (i = 0; i < real_packet->leader_count; i++) {
49570#ifdef FREECIV_JSON_CONNECTION
49571 field_addr.sub_location->number = i;
49572#endif /* FREECIV_JSON_CONNECTION */
49573 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->leader_is_male[i])) {
49574 RECEIVE_PACKET_FIELD_ERROR(leader_is_male);
49575 }
49576 }
49577
49578#ifdef FREECIV_JSON_CONNECTION
49579 /* Exit array. */
49580 FC_FREE(field_addr.sub_location);
49581#endif /* FREECIV_JSON_CONNECTION */
49582 }
49583#ifdef FREECIV_JSON_CONNECTION
49584 field_addr.name = "is_playable";
49585#endif /* FREECIV_JSON_CONNECTION */
49586 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_playable)) {
49587 RECEIVE_PACKET_FIELD_ERROR(is_playable);
49588 }
49589#ifdef FREECIV_JSON_CONNECTION
49590 field_addr.name = "barbarian_type";
49591#endif /* FREECIV_JSON_CONNECTION */
49592 {
49593 int readin;
49594
49595 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49596 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
49597 }
49598 real_packet->barbarian_type = readin;
49599 }
49600#ifdef FREECIV_JSON_CONNECTION
49601 field_addr.name = "nsets";
49602#endif /* FREECIV_JSON_CONNECTION */
49603 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
49604 RECEIVE_PACKET_FIELD_ERROR(nsets);
49605 }
49606#ifdef FREECIV_JSON_CONNECTION
49607 field_addr.name = "sets";
49608#endif /* FREECIV_JSON_CONNECTION */
49609 {
49610 int i;
49611
49612#ifdef FREECIV_JSON_CONNECTION
49613 /* Enter array. */
49614 field_addr.sub_location = plocation_elem_new(0);
49615#endif /* FREECIV_JSON_CONNECTION */
49616
49617 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
49618 RECEIVE_PACKET_FIELD_ERROR(sets, ": truncation array");
49619 }
49620 for (i = 0; i < real_packet->nsets; i++) {
49621#ifdef FREECIV_JSON_CONNECTION
49622 field_addr.sub_location->number = i;
49623#endif /* FREECIV_JSON_CONNECTION */
49624 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sets[i])) {
49625 RECEIVE_PACKET_FIELD_ERROR(sets);
49626 }
49627 }
49628
49629#ifdef FREECIV_JSON_CONNECTION
49630 /* Exit array. */
49631 FC_FREE(field_addr.sub_location);
49632#endif /* FREECIV_JSON_CONNECTION */
49633 }
49634#ifdef FREECIV_JSON_CONNECTION
49635 field_addr.name = "ngroups";
49636#endif /* FREECIV_JSON_CONNECTION */
49637 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
49638 RECEIVE_PACKET_FIELD_ERROR(ngroups);
49639 }
49640#ifdef FREECIV_JSON_CONNECTION
49641 field_addr.name = "groups";
49642#endif /* FREECIV_JSON_CONNECTION */
49643 {
49644 int i;
49645
49646#ifdef FREECIV_JSON_CONNECTION
49647 /* Enter array. */
49648 field_addr.sub_location = plocation_elem_new(0);
49649#endif /* FREECIV_JSON_CONNECTION */
49650
49651 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
49652 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
49653 }
49654 for (i = 0; i < real_packet->ngroups; i++) {
49655#ifdef FREECIV_JSON_CONNECTION
49656 field_addr.sub_location->number = i;
49657#endif /* FREECIV_JSON_CONNECTION */
49658 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->groups[i])) {
49659 RECEIVE_PACKET_FIELD_ERROR(groups);
49660 }
49661 }
49662
49663#ifdef FREECIV_JSON_CONNECTION
49664 /* Exit array. */
49665 FC_FREE(field_addr.sub_location);
49666#endif /* FREECIV_JSON_CONNECTION */
49667 }
49668#ifdef FREECIV_JSON_CONNECTION
49669 field_addr.name = "init_government_id";
49670#endif /* FREECIV_JSON_CONNECTION */
49671 {
49672 int readin;
49673
49674 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
49675 RECEIVE_PACKET_FIELD_ERROR(init_government_id);
49676 }
49677 real_packet->init_government_id = readin;
49678 }
49679#ifdef FREECIV_JSON_CONNECTION
49680 field_addr.name = "init_techs_count";
49681#endif /* FREECIV_JSON_CONNECTION */
49682 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs_count)) {
49683 RECEIVE_PACKET_FIELD_ERROR(init_techs_count);
49684 }
49685#ifdef FREECIV_JSON_CONNECTION
49686 field_addr.name = "init_techs";
49687#endif /* FREECIV_JSON_CONNECTION */
49688 {
49689 int i;
49690
49691#ifdef FREECIV_JSON_CONNECTION
49692 /* Enter array. */
49693 field_addr.sub_location = plocation_elem_new(0);
49694#endif /* FREECIV_JSON_CONNECTION */
49695
49696 if (real_packet->init_techs_count > MAX_NUM_TECH_LIST) {
49697 RECEIVE_PACKET_FIELD_ERROR(init_techs, ": truncation array");
49698 }
49699 for (i = 0; i < real_packet->init_techs_count; i++) {
49700#ifdef FREECIV_JSON_CONNECTION
49701 field_addr.sub_location->number = i;
49702#endif /* FREECIV_JSON_CONNECTION */
49703 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->init_techs[i])) {
49704 RECEIVE_PACKET_FIELD_ERROR(init_techs);
49705 }
49706 }
49707
49708#ifdef FREECIV_JSON_CONNECTION
49709 /* Exit array. */
49710 FC_FREE(field_addr.sub_location);
49711#endif /* FREECIV_JSON_CONNECTION */
49712 }
49713#ifdef FREECIV_JSON_CONNECTION
49714 field_addr.name = "init_units_count";
49715#endif /* FREECIV_JSON_CONNECTION */
49716 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_units_count)) {
49717 RECEIVE_PACKET_FIELD_ERROR(init_units_count);
49718 }
49719#ifdef FREECIV_JSON_CONNECTION
49720 field_addr.name = "init_units";
49721#endif /* FREECIV_JSON_CONNECTION */
49722 {
49723 int i;
49724
49725#ifdef FREECIV_JSON_CONNECTION
49726 /* Enter array. */
49727 field_addr.sub_location = plocation_elem_new(0);
49728#endif /* FREECIV_JSON_CONNECTION */
49729
49730 if (real_packet->init_units_count > MAX_NUM_UNIT_LIST) {
49731 RECEIVE_PACKET_FIELD_ERROR(init_units, ": truncation array");
49732 }
49733 for (i = 0; i < real_packet->init_units_count; i++) {
49734#ifdef FREECIV_JSON_CONNECTION
49735 field_addr.sub_location->number = i;
49736#endif /* FREECIV_JSON_CONNECTION */
49737 {
49738 int readin;
49739
49740 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49741 RECEIVE_PACKET_FIELD_ERROR(init_units);
49742 }
49743 real_packet->init_units[i] = readin;
49744 }
49745 }
49746
49747#ifdef FREECIV_JSON_CONNECTION
49748 /* Exit array. */
49749 FC_FREE(field_addr.sub_location);
49750#endif /* FREECIV_JSON_CONNECTION */
49751 }
49752#ifdef FREECIV_JSON_CONNECTION
49753 field_addr.name = "init_buildings_count";
49754#endif /* FREECIV_JSON_CONNECTION */
49755 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_buildings_count)) {
49756 RECEIVE_PACKET_FIELD_ERROR(init_buildings_count);
49757 }
49758#ifdef FREECIV_JSON_CONNECTION
49759 field_addr.name = "init_buildings";
49760#endif /* FREECIV_JSON_CONNECTION */
49761 {
49762 int i;
49763
49764#ifdef FREECIV_JSON_CONNECTION
49765 /* Enter array. */
49766 field_addr.sub_location = plocation_elem_new(0);
49767#endif /* FREECIV_JSON_CONNECTION */
49768
49769 if (real_packet->init_buildings_count > MAX_NUM_BUILDING_LIST) {
49770 RECEIVE_PACKET_FIELD_ERROR(init_buildings, ": truncation array");
49771 }
49772 for (i = 0; i < real_packet->init_buildings_count; i++) {
49773#ifdef FREECIV_JSON_CONNECTION
49774 field_addr.sub_location->number = i;
49775#endif /* FREECIV_JSON_CONNECTION */
49776 {
49777 int readin;
49778
49779 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49780 RECEIVE_PACKET_FIELD_ERROR(init_buildings);
49781 }
49782 real_packet->init_buildings[i] = readin;
49783 }
49784 }
49785
49786#ifdef FREECIV_JSON_CONNECTION
49787 /* Exit array. */
49788 FC_FREE(field_addr.sub_location);
49789#endif /* FREECIV_JSON_CONNECTION */
49790 }
49791#endif
49792 log_packet_detailed("packet_ruleset_nation_100: got info about (%d)",
49793 real_packet->id);
49794
49795#ifdef FREECIV_DELTA_PROTOCOL
49796 if (NULL == *hash) {
49797 *hash = genhash_new_full(hash_packet_ruleset_nation_100, cmp_packet_ruleset_nation_100,
49798 NULL, NULL, NULL, free);
49799 }
49800
49801 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
49802 *real_packet = *old;
49803 } else {
49804 Nation_type_id id;
49805
49806 id = real_packet->id;
49807
49808 log_packet_detailed(" no old info");
49809 memset(real_packet, 0, sizeof(*real_packet));
49810
49811 real_packet->id = id;
49812 }
49813
49814 if (BV_ISSET(fields, 0)) {
49815 log_packet_detailed(" got field 'translation_domain'");
49816#ifdef FREECIV_JSON_CONNECTION
49817 field_addr.name = "translation_domain";
49818#endif /* FREECIV_JSON_CONNECTION */
49819 if (!DIO_GET(string, &din, &field_addr, real_packet->translation_domain, sizeof(real_packet->translation_domain))) {
49820 RECEIVE_PACKET_FIELD_ERROR(translation_domain);
49821 }
49822 }
49823 if (BV_ISSET(fields, 1)) {
49824 log_packet_detailed(" got field 'adjective'");
49825#ifdef FREECIV_JSON_CONNECTION
49826 field_addr.name = "adjective";
49827#endif /* FREECIV_JSON_CONNECTION */
49828 if (!DIO_GET(string, &din, &field_addr, real_packet->adjective, sizeof(real_packet->adjective))) {
49829 RECEIVE_PACKET_FIELD_ERROR(adjective);
49830 }
49831 }
49832 if (BV_ISSET(fields, 2)) {
49833 log_packet_detailed(" got field 'rule_name'");
49834#ifdef FREECIV_JSON_CONNECTION
49835 field_addr.name = "rule_name";
49836#endif /* FREECIV_JSON_CONNECTION */
49837 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
49838 RECEIVE_PACKET_FIELD_ERROR(rule_name);
49839 }
49840 }
49841 if (BV_ISSET(fields, 3)) {
49842 log_packet_detailed(" got field 'noun_plural'");
49843#ifdef FREECIV_JSON_CONNECTION
49844 field_addr.name = "noun_plural";
49845#endif /* FREECIV_JSON_CONNECTION */
49846 if (!DIO_GET(string, &din, &field_addr, real_packet->noun_plural, sizeof(real_packet->noun_plural))) {
49847 RECEIVE_PACKET_FIELD_ERROR(noun_plural);
49848 }
49849 }
49850 if (BV_ISSET(fields, 4)) {
49851 log_packet_detailed(" got field 'graphic_str'");
49852#ifdef FREECIV_JSON_CONNECTION
49853 field_addr.name = "graphic_str";
49854#endif /* FREECIV_JSON_CONNECTION */
49855 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
49856 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
49857 }
49858 }
49859 if (BV_ISSET(fields, 5)) {
49860 log_packet_detailed(" got field 'graphic_alt'");
49861#ifdef FREECIV_JSON_CONNECTION
49862 field_addr.name = "graphic_alt";
49863#endif /* FREECIV_JSON_CONNECTION */
49864 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
49865 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
49866 }
49867 }
49868 if (BV_ISSET(fields, 6)) {
49869 log_packet_detailed(" got field 'legend'");
49870#ifdef FREECIV_JSON_CONNECTION
49871 field_addr.name = "legend";
49872#endif /* FREECIV_JSON_CONNECTION */
49873 if (!DIO_GET(string, &din, &field_addr, real_packet->legend, sizeof(real_packet->legend))) {
49874 RECEIVE_PACKET_FIELD_ERROR(legend);
49875 }
49876 }
49877 if (BV_ISSET(fields, 7)) {
49878 log_packet_detailed(" got field 'style'");
49879#ifdef FREECIV_JSON_CONNECTION
49880 field_addr.name = "style";
49881#endif /* FREECIV_JSON_CONNECTION */
49882 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style)) {
49883 RECEIVE_PACKET_FIELD_ERROR(style);
49884 }
49885 }
49886 if (BV_ISSET(fields, 8)) {
49887 log_packet_detailed(" got field 'leader_count'");
49888#ifdef FREECIV_JSON_CONNECTION
49889 field_addr.name = "leader_count";
49890#endif /* FREECIV_JSON_CONNECTION */
49891 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->leader_count)) {
49892 RECEIVE_PACKET_FIELD_ERROR(leader_count);
49893 }
49894 }
49895 if (BV_ISSET(fields, 9)) {
49896 log_packet_detailed(" got field 'leader_name'");
49897#ifdef FREECIV_JSON_CONNECTION
49898 field_addr.name = "leader_name";
49899#endif /* FREECIV_JSON_CONNECTION */
49900 {
49901 int i;
49902
49903#ifdef FREECIV_JSON_CONNECTION
49904 /* Enter array. */
49905 field_addr.sub_location = plocation_elem_new(0);
49906#endif /* FREECIV_JSON_CONNECTION */
49907
49908 if (real_packet->leader_count > MAX_NUM_LEADERS) {
49909 RECEIVE_PACKET_FIELD_ERROR(leader_name, ": truncation array");
49910 }
49911 for (i = 0; i < real_packet->leader_count; i++) {
49912#ifdef FREECIV_JSON_CONNECTION
49913 field_addr.sub_location->number = i;
49914#endif /* FREECIV_JSON_CONNECTION */
49915 if (!DIO_GET(string, &din, &field_addr, real_packet->leader_name[i], sizeof(real_packet->leader_name[i]))) {
49916 RECEIVE_PACKET_FIELD_ERROR(leader_name);
49917 }
49918 }
49919
49920#ifdef FREECIV_JSON_CONNECTION
49921 /* Exit array. */
49922 FC_FREE(field_addr.sub_location);
49923#endif /* FREECIV_JSON_CONNECTION */
49924 }
49925 }
49926 if (BV_ISSET(fields, 10)) {
49927 log_packet_detailed(" got field 'leader_is_male'");
49928#ifdef FREECIV_JSON_CONNECTION
49929 field_addr.name = "leader_is_male";
49930#endif /* FREECIV_JSON_CONNECTION */
49931 {
49932 int i;
49933
49934#ifdef FREECIV_JSON_CONNECTION
49935 /* Enter array. */
49936 field_addr.sub_location = plocation_elem_new(0);
49937#endif /* FREECIV_JSON_CONNECTION */
49938
49939 if (real_packet->leader_count > MAX_NUM_LEADERS) {
49940 RECEIVE_PACKET_FIELD_ERROR(leader_is_male, ": truncation array");
49941 }
49942 for (i = 0; i < real_packet->leader_count; i++) {
49943#ifdef FREECIV_JSON_CONNECTION
49944 field_addr.sub_location->number = i;
49945#endif /* FREECIV_JSON_CONNECTION */
49946 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->leader_is_male[i])) {
49947 RECEIVE_PACKET_FIELD_ERROR(leader_is_male);
49948 }
49949 }
49950
49951#ifdef FREECIV_JSON_CONNECTION
49952 /* Exit array. */
49953 FC_FREE(field_addr.sub_location);
49954#endif /* FREECIV_JSON_CONNECTION */
49955 }
49956 }
49957 real_packet->is_playable = BV_ISSET(fields, 11);
49958 if (BV_ISSET(fields, 12)) {
49959 log_packet_detailed(" got field 'barbarian_type'");
49960#ifdef FREECIV_JSON_CONNECTION
49961 field_addr.name = "barbarian_type";
49962#endif /* FREECIV_JSON_CONNECTION */
49963 {
49964 int readin;
49965
49966 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
49967 RECEIVE_PACKET_FIELD_ERROR(barbarian_type);
49968 }
49969 real_packet->barbarian_type = readin;
49970 }
49971 }
49972 if (BV_ISSET(fields, 13)) {
49973 log_packet_detailed(" got field 'nsets'");
49974#ifdef FREECIV_JSON_CONNECTION
49975 field_addr.name = "nsets";
49976#endif /* FREECIV_JSON_CONNECTION */
49977 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->nsets)) {
49978 RECEIVE_PACKET_FIELD_ERROR(nsets);
49979 }
49980 }
49981 if (BV_ISSET(fields, 14)) {
49982 log_packet_detailed(" got field 'sets'");
49983#ifdef FREECIV_JSON_CONNECTION
49984 field_addr.name = "sets";
49985#endif /* FREECIV_JSON_CONNECTION */
49986 {
49987 int i;
49988
49989#ifdef FREECIV_JSON_CONNECTION
49990 /* Enter array. */
49991 field_addr.sub_location = plocation_elem_new(0);
49992#endif /* FREECIV_JSON_CONNECTION */
49993
49994 if (real_packet->nsets > MAX_NUM_NATION_SETS) {
49995 RECEIVE_PACKET_FIELD_ERROR(sets, ": truncation array");
49996 }
49997 for (i = 0; i < real_packet->nsets; i++) {
49998#ifdef FREECIV_JSON_CONNECTION
49999 field_addr.sub_location->number = i;
50000#endif /* FREECIV_JSON_CONNECTION */
50001 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sets[i])) {
50002 RECEIVE_PACKET_FIELD_ERROR(sets);
50003 }
50004 }
50005
50006#ifdef FREECIV_JSON_CONNECTION
50007 /* Exit array. */
50008 FC_FREE(field_addr.sub_location);
50009#endif /* FREECIV_JSON_CONNECTION */
50010 }
50011 }
50012 if (BV_ISSET(fields, 15)) {
50013 log_packet_detailed(" got field 'ngroups'");
50014#ifdef FREECIV_JSON_CONNECTION
50015 field_addr.name = "ngroups";
50016#endif /* FREECIV_JSON_CONNECTION */
50017 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ngroups)) {
50018 RECEIVE_PACKET_FIELD_ERROR(ngroups);
50019 }
50020 }
50021 if (BV_ISSET(fields, 16)) {
50022 log_packet_detailed(" got field 'groups'");
50023#ifdef FREECIV_JSON_CONNECTION
50024 field_addr.name = "groups";
50025#endif /* FREECIV_JSON_CONNECTION */
50026 {
50027 int i;
50028
50029#ifdef FREECIV_JSON_CONNECTION
50030 /* Enter array. */
50031 field_addr.sub_location = plocation_elem_new(0);
50032#endif /* FREECIV_JSON_CONNECTION */
50033
50034 if (real_packet->ngroups > MAX_NUM_NATION_GROUPS) {
50035 RECEIVE_PACKET_FIELD_ERROR(groups, ": truncation array");
50036 }
50037 for (i = 0; i < real_packet->ngroups; i++) {
50038#ifdef FREECIV_JSON_CONNECTION
50039 field_addr.sub_location->number = i;
50040#endif /* FREECIV_JSON_CONNECTION */
50041 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->groups[i])) {
50042 RECEIVE_PACKET_FIELD_ERROR(groups);
50043 }
50044 }
50045
50046#ifdef FREECIV_JSON_CONNECTION
50047 /* Exit array. */
50048 FC_FREE(field_addr.sub_location);
50049#endif /* FREECIV_JSON_CONNECTION */
50050 }
50051 }
50052 if (BV_ISSET(fields, 17)) {
50053 log_packet_detailed(" got field 'init_government_id'");
50054#ifdef FREECIV_JSON_CONNECTION
50055 field_addr.name = "init_government_id";
50056#endif /* FREECIV_JSON_CONNECTION */
50057 {
50058 int readin;
50059
50060 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
50061 RECEIVE_PACKET_FIELD_ERROR(init_government_id);
50062 }
50063 real_packet->init_government_id = readin;
50064 }
50065 }
50066 if (BV_ISSET(fields, 18)) {
50067 log_packet_detailed(" got field 'init_techs_count'");
50068#ifdef FREECIV_JSON_CONNECTION
50069 field_addr.name = "init_techs_count";
50070#endif /* FREECIV_JSON_CONNECTION */
50071 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_techs_count)) {
50072 RECEIVE_PACKET_FIELD_ERROR(init_techs_count);
50073 }
50074 }
50075 if (BV_ISSET(fields, 19)) {
50076 log_packet_detailed(" got field 'init_techs'");
50077#ifdef FREECIV_JSON_CONNECTION
50078 field_addr.name = "init_techs";
50079#endif /* FREECIV_JSON_CONNECTION */
50080 {
50081 int i;
50082
50083#ifdef FREECIV_JSON_CONNECTION
50084 /* Enter array. */
50085 field_addr.sub_location = plocation_elem_new(0);
50086#endif /* FREECIV_JSON_CONNECTION */
50087
50088 if (real_packet->init_techs_count > MAX_NUM_TECH_LIST) {
50089 RECEIVE_PACKET_FIELD_ERROR(init_techs, ": truncation array");
50090 }
50091 for (i = 0; i < real_packet->init_techs_count; i++) {
50092#ifdef FREECIV_JSON_CONNECTION
50093 field_addr.sub_location->number = i;
50094#endif /* FREECIV_JSON_CONNECTION */
50095 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->init_techs[i])) {
50096 RECEIVE_PACKET_FIELD_ERROR(init_techs);
50097 }
50098 }
50099
50100#ifdef FREECIV_JSON_CONNECTION
50101 /* Exit array. */
50102 FC_FREE(field_addr.sub_location);
50103#endif /* FREECIV_JSON_CONNECTION */
50104 }
50105 }
50106 if (BV_ISSET(fields, 20)) {
50107 log_packet_detailed(" got field 'init_units_count'");
50108#ifdef FREECIV_JSON_CONNECTION
50109 field_addr.name = "init_units_count";
50110#endif /* FREECIV_JSON_CONNECTION */
50111 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_units_count)) {
50112 RECEIVE_PACKET_FIELD_ERROR(init_units_count);
50113 }
50114 }
50115 if (BV_ISSET(fields, 21)) {
50116 log_packet_detailed(" got field 'init_units'");
50117#ifdef FREECIV_JSON_CONNECTION
50118 field_addr.name = "init_units";
50119#endif /* FREECIV_JSON_CONNECTION */
50120 {
50121 int i;
50122
50123#ifdef FREECIV_JSON_CONNECTION
50124 /* Enter array. */
50125 field_addr.sub_location = plocation_elem_new(0);
50126#endif /* FREECIV_JSON_CONNECTION */
50127
50128 if (real_packet->init_units_count > MAX_NUM_UNIT_LIST) {
50129 RECEIVE_PACKET_FIELD_ERROR(init_units, ": truncation array");
50130 }
50131 for (i = 0; i < real_packet->init_units_count; i++) {
50132#ifdef FREECIV_JSON_CONNECTION
50133 field_addr.sub_location->number = i;
50134#endif /* FREECIV_JSON_CONNECTION */
50135 {
50136 int readin;
50137
50138 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
50139 RECEIVE_PACKET_FIELD_ERROR(init_units);
50140 }
50141 real_packet->init_units[i] = readin;
50142 }
50143 }
50144
50145#ifdef FREECIV_JSON_CONNECTION
50146 /* Exit array. */
50147 FC_FREE(field_addr.sub_location);
50148#endif /* FREECIV_JSON_CONNECTION */
50149 }
50150 }
50151 if (BV_ISSET(fields, 22)) {
50152 log_packet_detailed(" got field 'init_buildings_count'");
50153#ifdef FREECIV_JSON_CONNECTION
50154 field_addr.name = "init_buildings_count";
50155#endif /* FREECIV_JSON_CONNECTION */
50156 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->init_buildings_count)) {
50157 RECEIVE_PACKET_FIELD_ERROR(init_buildings_count);
50158 }
50159 }
50160 if (BV_ISSET(fields, 23)) {
50161 log_packet_detailed(" got field 'init_buildings'");
50162#ifdef FREECIV_JSON_CONNECTION
50163 field_addr.name = "init_buildings";
50164#endif /* FREECIV_JSON_CONNECTION */
50165 {
50166 int i;
50167
50168#ifdef FREECIV_JSON_CONNECTION
50169 /* Enter array. */
50170 field_addr.sub_location = plocation_elem_new(0);
50171#endif /* FREECIV_JSON_CONNECTION */
50172
50173 if (real_packet->init_buildings_count > MAX_NUM_BUILDING_LIST) {
50174 RECEIVE_PACKET_FIELD_ERROR(init_buildings, ": truncation array");
50175 }
50176 for (i = 0; i < real_packet->init_buildings_count; i++) {
50177#ifdef FREECIV_JSON_CONNECTION
50178 field_addr.sub_location->number = i;
50179#endif /* FREECIV_JSON_CONNECTION */
50180 {
50181 int readin;
50182
50183 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
50184 RECEIVE_PACKET_FIELD_ERROR(init_buildings);
50185 }
50186 real_packet->init_buildings[i] = readin;
50187 }
50188 }
50189
50190#ifdef FREECIV_JSON_CONNECTION
50191 /* Exit array. */
50192 FC_FREE(field_addr.sub_location);
50193#endif /* FREECIV_JSON_CONNECTION */
50194 }
50195 }
50196
50197 if (NULL == old) {
50198 old = fc_malloc(sizeof(*old));
50199 *old = *real_packet;
50200 genhash_insert(*hash, old, old);
50201 } else {
50202 *old = *real_packet;
50203 }
50204
50205#endif /* FREECIV_DELTA_PROTOCOL */
50206 RECEIVE_PACKET_END(real_packet);
50207}
50208
50209 static int send_packet_ruleset_nation_100(struct connection *pc, const struct packet_ruleset_nation *packet)
50210{
50211 const struct packet_ruleset_nation *real_packet = packet;
50212 int e;
50213#ifdef FREECIV_DELTA_PROTOCOL
50214 packet_ruleset_nation_100_fields fields;
50215 struct packet_ruleset_nation *old;
50216 bool differ;
50217 struct genhash **hash = pc->phs.sent + PACKET_RULESET_NATION;
50218#endif /* FREECIV_DELTA_PROTOCOL */
50219 SEND_PACKET_START(PACKET_RULESET_NATION);
50220#ifdef FREECIV_JSON_CONNECTION
50221 struct plocation field_addr;
50222 {
50223 struct plocation *field_addr_tmp = plocation_field_new(NULL);
50224 field_addr = *field_addr_tmp;
50225 FC_FREE(field_addr_tmp);
50226 }
50227#endif /* FREECIV_JSON_CONNECTION */
50228
50229 log_packet_detailed("packet_ruleset_nation_100: sending info about (%d)",
50230 real_packet->id);
50231
50232#ifdef FREECIV_DELTA_PROTOCOL
50233 if (NULL == *hash) {
50234 *hash = genhash_new_full(hash_packet_ruleset_nation_100, cmp_packet_ruleset_nation_100,
50235 NULL, NULL, NULL, free);
50236 }
50237 BV_CLR_ALL(fields);
50238
50239 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
50240 old = fc_malloc(sizeof(*old));
50241 *old = *real_packet;
50242 genhash_insert(*hash, old, old);
50243 memset(old, 0, sizeof(*old));
50244 }
50245 differ = (strcmp(old->translation_domain, real_packet->translation_domain) != 0);
50246 if (differ) {
50247 BV_SET(fields, 0);
50248 }
50249
50250 differ = (strcmp(old->adjective, real_packet->adjective) != 0);
50251 if (differ) {
50252 BV_SET(fields, 1);
50253 }
50254
50255 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
50256 if (differ) {
50257 BV_SET(fields, 2);
50258 }
50259
50260 differ = (strcmp(old->noun_plural, real_packet->noun_plural) != 0);
50261 if (differ) {
50262 BV_SET(fields, 3);
50263 }
50264
50265 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
50266 if (differ) {
50267 BV_SET(fields, 4);
50268 }
50269
50270 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
50271 if (differ) {
50272 BV_SET(fields, 5);
50273 }
50274
50275 differ = (strcmp(old->legend, real_packet->legend) != 0);
50276 if (differ) {
50277 BV_SET(fields, 6);
50278 }
50279
50280 differ = (old->style != real_packet->style);
50281 if (differ) {
50282 BV_SET(fields, 7);
50283 }
50284
50285 differ = (old->leader_count != real_packet->leader_count);
50286 if (differ) {
50287 BV_SET(fields, 8);
50288 }
50289
50290 differ = (old->leader_count != real_packet->leader_count);
50291 if (!differ) {
50292 int i;
50293
50294 for (i = 0; i < real_packet->leader_count; i++) {
50295 differ = (strcmp(old->leader_name[i], real_packet->leader_name[i]) != 0);
50296 if (differ) {
50297 break;
50298 }
50299 }
50300 }
50301 if (differ) {
50302 BV_SET(fields, 9);
50303 }
50304
50305 differ = (old->leader_count != real_packet->leader_count);
50306 if (!differ) {
50307 int i;
50308
50309 for (i = 0; i < real_packet->leader_count; i++) {
50310 differ = (old->leader_is_male[i] != real_packet->leader_is_male[i]);
50311 if (differ) {
50312 break;
50313 }
50314 }
50315 }
50316 if (differ) {
50317 BV_SET(fields, 10);
50318 }
50319
50320 if (packet->is_playable) {
50321 BV_SET(fields, 11);
50322 }
50323
50324 differ = (old->barbarian_type != real_packet->barbarian_type);
50325 if (differ) {
50326 BV_SET(fields, 12);
50327 }
50328
50329 differ = (old->nsets != real_packet->nsets);
50330 if (differ) {
50331 BV_SET(fields, 13);
50332 }
50333
50334 differ = (old->nsets != real_packet->nsets);
50335 if (!differ) {
50336 int i;
50337
50338 for (i = 0; i < real_packet->nsets; i++) {
50339 differ = (old->sets[i] != real_packet->sets[i]);
50340 if (differ) {
50341 break;
50342 }
50343 }
50344 }
50345 if (differ) {
50346 BV_SET(fields, 14);
50347 }
50348
50349 differ = (old->ngroups != real_packet->ngroups);
50350 if (differ) {
50351 BV_SET(fields, 15);
50352 }
50353
50354 differ = (old->ngroups != real_packet->ngroups);
50355 if (!differ) {
50356 int i;
50357
50358 for (i = 0; i < real_packet->ngroups; i++) {
50359 differ = (old->groups[i] != real_packet->groups[i]);
50360 if (differ) {
50361 break;
50362 }
50363 }
50364 }
50365 if (differ) {
50366 BV_SET(fields, 16);
50367 }
50368
50369 differ = (old->init_government_id != real_packet->init_government_id);
50370 if (differ) {
50371 BV_SET(fields, 17);
50372 }
50373
50374 differ = (old->init_techs_count != real_packet->init_techs_count);
50375 if (differ) {
50376 BV_SET(fields, 18);
50377 }
50378
50379 differ = (old->init_techs_count != real_packet->init_techs_count);
50380 if (!differ) {
50381 int i;
50382
50383 for (i = 0; i < real_packet->init_techs_count; i++) {
50384 differ = (old->init_techs[i] != real_packet->init_techs[i]);
50385 if (differ) {
50386 break;
50387 }
50388 }
50389 }
50390 if (differ) {
50391 BV_SET(fields, 19);
50392 }
50393
50394 differ = (old->init_units_count != real_packet->init_units_count);
50395 if (differ) {
50396 BV_SET(fields, 20);
50397 }
50398
50399 differ = (old->init_units_count != real_packet->init_units_count);
50400 if (!differ) {
50401 int i;
50402
50403 for (i = 0; i < real_packet->init_units_count; i++) {
50404 differ = (old->init_units[i] != real_packet->init_units[i]);
50405 if (differ) {
50406 break;
50407 }
50408 }
50409 }
50410 if (differ) {
50411 BV_SET(fields, 21);
50412 }
50413
50414 differ = (old->init_buildings_count != real_packet->init_buildings_count);
50415 if (differ) {
50416 BV_SET(fields, 22);
50417 }
50418
50419 differ = (old->init_buildings_count != real_packet->init_buildings_count);
50420 if (!differ) {
50421 int i;
50422
50423 for (i = 0; i < real_packet->init_buildings_count; i++) {
50424 differ = (old->init_buildings[i] != real_packet->init_buildings[i]);
50425 if (differ) {
50426 break;
50427 }
50428 }
50429 }
50430 if (differ) {
50431 BV_SET(fields, 23);
50432 }
50433
50434
50435#ifdef FREECIV_JSON_CONNECTION
50436 field_addr.name = "fields";
50437#endif /* FREECIV_JSON_CONNECTION */
50438 e = 0;
50439 e |= DIO_BV_PUT(&dout, &field_addr, fields);
50440 if (e) {
50441 log_packet_detailed("fields bitvector error detected");
50442 }
50443#ifdef FREECIV_JSON_CONNECTION
50444 field_addr.name = "id";
50445#endif /* FREECIV_JSON_CONNECTION */
50446 e = 0;
50447 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
50448 if (e) {
50449 log_packet_detailed("'id' field error detected");
50450 }
50451
50452 if (BV_ISSET(fields, 0)) {
50453 log_packet_detailed(" field 'translation_domain' has changed");
50454#ifdef FREECIV_JSON_CONNECTION
50455 field_addr.name = "translation_domain";
50456#endif /* FREECIV_JSON_CONNECTION */
50457 e = 0;
50458 e |= DIO_PUT(string, &dout, &field_addr, real_packet->translation_domain);
50459 if (e) {
50460 log_packet_detailed("'translation_domain' field error detected");
50461 }
50462 }
50463 if (BV_ISSET(fields, 1)) {
50464 log_packet_detailed(" field 'adjective' has changed");
50465#ifdef FREECIV_JSON_CONNECTION
50466 field_addr.name = "adjective";
50467#endif /* FREECIV_JSON_CONNECTION */
50468 e = 0;
50469 e |= DIO_PUT(string, &dout, &field_addr, real_packet->adjective);
50470 if (e) {
50471 log_packet_detailed("'adjective' field error detected");
50472 }
50473 }
50474 if (BV_ISSET(fields, 2)) {
50475 log_packet_detailed(" field 'rule_name' has changed");
50476#ifdef FREECIV_JSON_CONNECTION
50477 field_addr.name = "rule_name";
50478#endif /* FREECIV_JSON_CONNECTION */
50479 e = 0;
50480 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
50481 if (e) {
50482 log_packet_detailed("'rule_name' field error detected");
50483 }
50484 }
50485 if (BV_ISSET(fields, 3)) {
50486 log_packet_detailed(" field 'noun_plural' has changed");
50487#ifdef FREECIV_JSON_CONNECTION
50488 field_addr.name = "noun_plural";
50489#endif /* FREECIV_JSON_CONNECTION */
50490 e = 0;
50491 e |= DIO_PUT(string, &dout, &field_addr, real_packet->noun_plural);
50492 if (e) {
50493 log_packet_detailed("'noun_plural' field error detected");
50494 }
50495 }
50496 if (BV_ISSET(fields, 4)) {
50497 log_packet_detailed(" field 'graphic_str' has changed");
50498#ifdef FREECIV_JSON_CONNECTION
50499 field_addr.name = "graphic_str";
50500#endif /* FREECIV_JSON_CONNECTION */
50501 e = 0;
50502 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
50503 if (e) {
50504 log_packet_detailed("'graphic_str' field error detected");
50505 }
50506 }
50507 if (BV_ISSET(fields, 5)) {
50508 log_packet_detailed(" field 'graphic_alt' has changed");
50509#ifdef FREECIV_JSON_CONNECTION
50510 field_addr.name = "graphic_alt";
50511#endif /* FREECIV_JSON_CONNECTION */
50512 e = 0;
50513 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
50514 if (e) {
50515 log_packet_detailed("'graphic_alt' field error detected");
50516 }
50517 }
50518 if (BV_ISSET(fields, 6)) {
50519 log_packet_detailed(" field 'legend' has changed");
50520#ifdef FREECIV_JSON_CONNECTION
50521 field_addr.name = "legend";
50522#endif /* FREECIV_JSON_CONNECTION */
50523 e = 0;
50524 e |= DIO_PUT(string, &dout, &field_addr, real_packet->legend);
50525 if (e) {
50526 log_packet_detailed("'legend' field error detected");
50527 }
50528 }
50529 if (BV_ISSET(fields, 7)) {
50530 log_packet_detailed(" field 'style' has changed");
50531#ifdef FREECIV_JSON_CONNECTION
50532 field_addr.name = "style";
50533#endif /* FREECIV_JSON_CONNECTION */
50534 e = 0;
50535 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
50536 if (e) {
50537 log_packet_detailed("'style' field error detected");
50538 }
50539 }
50540 if (BV_ISSET(fields, 8)) {
50541 log_packet_detailed(" field 'leader_count' has changed");
50542#ifdef FREECIV_JSON_CONNECTION
50543 field_addr.name = "leader_count";
50544#endif /* FREECIV_JSON_CONNECTION */
50545 e = 0;
50546 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->leader_count);
50547 if (e) {
50548 log_packet_detailed("'leader_count' field error detected");
50549 }
50550 }
50551 if (BV_ISSET(fields, 9)) {
50552 log_packet_detailed(" field 'leader_name' has changed");
50553#ifdef FREECIV_JSON_CONNECTION
50554 field_addr.name = "leader_name";
50555#endif /* FREECIV_JSON_CONNECTION */
50556 e = 0;
50557 {
50558 int i;
50559
50560#ifdef FREECIV_JSON_CONNECTION
50561 /* Create the array. */
50562 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
50563
50564 /* Enter the array. */
50565 field_addr.sub_location = plocation_elem_new(0);
50566#endif /* FREECIV_JSON_CONNECTION */
50567
50568 for (i = 0; i < real_packet->leader_count; i++) {
50569#ifdef FREECIV_JSON_CONNECTION
50570 /* Next array element. */
50571 field_addr.sub_location->number = i;
50572#endif /* FREECIV_JSON_CONNECTION */
50573 e |= DIO_PUT(string, &dout, &field_addr, real_packet->leader_name[i]);
50574 }
50575
50576#ifdef FREECIV_JSON_CONNECTION
50577 /* Exit array. */
50578 FC_FREE(field_addr.sub_location);
50579#endif /* FREECIV_JSON_CONNECTION */
50580 }
50581 if (e) {
50582 log_packet_detailed("'leader_name' field error detected");
50583 }
50584 }
50585 if (BV_ISSET(fields, 10)) {
50586 log_packet_detailed(" field 'leader_is_male' has changed");
50587#ifdef FREECIV_JSON_CONNECTION
50588 field_addr.name = "leader_is_male";
50589#endif /* FREECIV_JSON_CONNECTION */
50590 e = 0;
50591 {
50592 int i;
50593
50594#ifdef FREECIV_JSON_CONNECTION
50595 /* Create the array. */
50596 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
50597
50598 /* Enter the array. */
50599 field_addr.sub_location = plocation_elem_new(0);
50600#endif /* FREECIV_JSON_CONNECTION */
50601
50602 for (i = 0; i < real_packet->leader_count; i++) {
50603#ifdef FREECIV_JSON_CONNECTION
50604 /* Next array element. */
50605 field_addr.sub_location->number = i;
50606#endif /* FREECIV_JSON_CONNECTION */
50607 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->leader_is_male[i]);
50608 }
50609
50610#ifdef FREECIV_JSON_CONNECTION
50611 /* Exit array. */
50612 FC_FREE(field_addr.sub_location);
50613#endif /* FREECIV_JSON_CONNECTION */
50614 }
50615 if (e) {
50616 log_packet_detailed("'leader_is_male' field error detected");
50617 }
50618 }
50619 /* field 11 is folded into the header */
50620 if (BV_ISSET(fields, 12)) {
50621 log_packet_detailed(" field 'barbarian_type' has changed");
50622#ifdef FREECIV_JSON_CONNECTION
50623 field_addr.name = "barbarian_type";
50624#endif /* FREECIV_JSON_CONNECTION */
50625 e = 0;
50626 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
50627 if (e) {
50628 log_packet_detailed("'barbarian_type' field error detected");
50629 }
50630 }
50631 if (BV_ISSET(fields, 13)) {
50632 log_packet_detailed(" field 'nsets' has changed");
50633#ifdef FREECIV_JSON_CONNECTION
50634 field_addr.name = "nsets";
50635#endif /* FREECIV_JSON_CONNECTION */
50636 e = 0;
50637 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
50638 if (e) {
50639 log_packet_detailed("'nsets' field error detected");
50640 }
50641 }
50642 if (BV_ISSET(fields, 14)) {
50643 log_packet_detailed(" field 'sets' has changed");
50644#ifdef FREECIV_JSON_CONNECTION
50645 field_addr.name = "sets";
50646#endif /* FREECIV_JSON_CONNECTION */
50647 e = 0;
50648 {
50649 int i;
50650
50651#ifdef FREECIV_JSON_CONNECTION
50652 /* Create the array. */
50653 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
50654
50655 /* Enter the array. */
50656 field_addr.sub_location = plocation_elem_new(0);
50657#endif /* FREECIV_JSON_CONNECTION */
50658
50659 for (i = 0; i < real_packet->nsets; i++) {
50660#ifdef FREECIV_JSON_CONNECTION
50661 /* Next array element. */
50662 field_addr.sub_location->number = i;
50663#endif /* FREECIV_JSON_CONNECTION */
50664 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sets[i]);
50665 }
50666
50667#ifdef FREECIV_JSON_CONNECTION
50668 /* Exit array. */
50669 FC_FREE(field_addr.sub_location);
50670#endif /* FREECIV_JSON_CONNECTION */
50671 }
50672 if (e) {
50673 log_packet_detailed("'sets' field error detected");
50674 }
50675 }
50676 if (BV_ISSET(fields, 15)) {
50677 log_packet_detailed(" field 'ngroups' has changed");
50678#ifdef FREECIV_JSON_CONNECTION
50679 field_addr.name = "ngroups";
50680#endif /* FREECIV_JSON_CONNECTION */
50681 e = 0;
50682 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
50683 if (e) {
50684 log_packet_detailed("'ngroups' field error detected");
50685 }
50686 }
50687 if (BV_ISSET(fields, 16)) {
50688 log_packet_detailed(" field 'groups' has changed");
50689#ifdef FREECIV_JSON_CONNECTION
50690 field_addr.name = "groups";
50691#endif /* FREECIV_JSON_CONNECTION */
50692 e = 0;
50693 {
50694 int i;
50695
50696#ifdef FREECIV_JSON_CONNECTION
50697 /* Create the array. */
50698 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
50699
50700 /* Enter the array. */
50701 field_addr.sub_location = plocation_elem_new(0);
50702#endif /* FREECIV_JSON_CONNECTION */
50703
50704 for (i = 0; i < real_packet->ngroups; i++) {
50705#ifdef FREECIV_JSON_CONNECTION
50706 /* Next array element. */
50707 field_addr.sub_location->number = i;
50708#endif /* FREECIV_JSON_CONNECTION */
50709 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->groups[i]);
50710 }
50711
50712#ifdef FREECIV_JSON_CONNECTION
50713 /* Exit array. */
50714 FC_FREE(field_addr.sub_location);
50715#endif /* FREECIV_JSON_CONNECTION */
50716 }
50717 if (e) {
50718 log_packet_detailed("'groups' field error detected");
50719 }
50720 }
50721 if (BV_ISSET(fields, 17)) {
50722 log_packet_detailed(" field 'init_government_id' has changed");
50723#ifdef FREECIV_JSON_CONNECTION
50724 field_addr.name = "init_government_id";
50725#endif /* FREECIV_JSON_CONNECTION */
50726 e = 0;
50727 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->init_government_id);
50728 if (e) {
50729 log_packet_detailed("'init_government_id' field error detected");
50730 }
50731 }
50732 if (BV_ISSET(fields, 18)) {
50733 log_packet_detailed(" field 'init_techs_count' has changed");
50734#ifdef FREECIV_JSON_CONNECTION
50735 field_addr.name = "init_techs_count";
50736#endif /* FREECIV_JSON_CONNECTION */
50737 e = 0;
50738 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs_count);
50739 if (e) {
50740 log_packet_detailed("'init_techs_count' field error detected");
50741 }
50742 }
50743 if (BV_ISSET(fields, 19)) {
50744 log_packet_detailed(" field 'init_techs' has changed");
50745#ifdef FREECIV_JSON_CONNECTION
50746 field_addr.name = "init_techs";
50747#endif /* FREECIV_JSON_CONNECTION */
50748 e = 0;
50749 {
50750 int i;
50751
50752#ifdef FREECIV_JSON_CONNECTION
50753 /* Create the array. */
50754 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_techs_count);
50755
50756 /* Enter the array. */
50757 field_addr.sub_location = plocation_elem_new(0);
50758#endif /* FREECIV_JSON_CONNECTION */
50759
50760 for (i = 0; i < real_packet->init_techs_count; i++) {
50761#ifdef FREECIV_JSON_CONNECTION
50762 /* Next array element. */
50763 field_addr.sub_location->number = i;
50764#endif /* FREECIV_JSON_CONNECTION */
50765 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->init_techs[i]);
50766 }
50767
50768#ifdef FREECIV_JSON_CONNECTION
50769 /* Exit array. */
50770 FC_FREE(field_addr.sub_location);
50771#endif /* FREECIV_JSON_CONNECTION */
50772 }
50773 if (e) {
50774 log_packet_detailed("'init_techs' field error detected");
50775 }
50776 }
50777 if (BV_ISSET(fields, 20)) {
50778 log_packet_detailed(" field 'init_units_count' has changed");
50779#ifdef FREECIV_JSON_CONNECTION
50780 field_addr.name = "init_units_count";
50781#endif /* FREECIV_JSON_CONNECTION */
50782 e = 0;
50783 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units_count);
50784 if (e) {
50785 log_packet_detailed("'init_units_count' field error detected");
50786 }
50787 }
50788 if (BV_ISSET(fields, 21)) {
50789 log_packet_detailed(" field 'init_units' has changed");
50790#ifdef FREECIV_JSON_CONNECTION
50791 field_addr.name = "init_units";
50792#endif /* FREECIV_JSON_CONNECTION */
50793 e = 0;
50794 {
50795 int i;
50796
50797#ifdef FREECIV_JSON_CONNECTION
50798 /* Create the array. */
50799 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_units_count);
50800
50801 /* Enter the array. */
50802 field_addr.sub_location = plocation_elem_new(0);
50803#endif /* FREECIV_JSON_CONNECTION */
50804
50805 for (i = 0; i < real_packet->init_units_count; i++) {
50806#ifdef FREECIV_JSON_CONNECTION
50807 /* Next array element. */
50808 field_addr.sub_location->number = i;
50809#endif /* FREECIV_JSON_CONNECTION */
50810 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units[i]);
50811 }
50812
50813#ifdef FREECIV_JSON_CONNECTION
50814 /* Exit array. */
50815 FC_FREE(field_addr.sub_location);
50816#endif /* FREECIV_JSON_CONNECTION */
50817 }
50818 if (e) {
50819 log_packet_detailed("'init_units' field error detected");
50820 }
50821 }
50822 if (BV_ISSET(fields, 22)) {
50823 log_packet_detailed(" field 'init_buildings_count' has changed");
50824#ifdef FREECIV_JSON_CONNECTION
50825 field_addr.name = "init_buildings_count";
50826#endif /* FREECIV_JSON_CONNECTION */
50827 e = 0;
50828 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings_count);
50829 if (e) {
50830 log_packet_detailed("'init_buildings_count' field error detected");
50831 }
50832 }
50833 if (BV_ISSET(fields, 23)) {
50834 log_packet_detailed(" field 'init_buildings' has changed");
50835#ifdef FREECIV_JSON_CONNECTION
50836 field_addr.name = "init_buildings";
50837#endif /* FREECIV_JSON_CONNECTION */
50838 e = 0;
50839 {
50840 int i;
50841
50842#ifdef FREECIV_JSON_CONNECTION
50843 /* Create the array. */
50844 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_buildings_count);
50845
50846 /* Enter the array. */
50847 field_addr.sub_location = plocation_elem_new(0);
50848#endif /* FREECIV_JSON_CONNECTION */
50849
50850 for (i = 0; i < real_packet->init_buildings_count; i++) {
50851#ifdef FREECIV_JSON_CONNECTION
50852 /* Next array element. */
50853 field_addr.sub_location->number = i;
50854#endif /* FREECIV_JSON_CONNECTION */
50855 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings[i]);
50856 }
50857
50858#ifdef FREECIV_JSON_CONNECTION
50859 /* Exit array. */
50860 FC_FREE(field_addr.sub_location);
50861#endif /* FREECIV_JSON_CONNECTION */
50862 }
50863 if (e) {
50864 log_packet_detailed("'init_buildings' field error detected");
50865 }
50866 }
50867
50868 *old = *real_packet;
50869#endif /* FREECIV_DELTA_PROTOCOL */
50870#ifndef FREECIV_DELTA_PROTOCOL
50871#ifdef FREECIV_JSON_CONNECTION
50872 field_addr.name = "id";
50873#endif /* FREECIV_JSON_CONNECTION */
50874 e = 0;
50875 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->id);
50876 if (e) {
50877 log_packet_detailed("'id' field error detected");
50878 }
50879#ifdef FREECIV_JSON_CONNECTION
50880 field_addr.name = "translation_domain";
50881#endif /* FREECIV_JSON_CONNECTION */
50882 e = 0;
50883 e |= DIO_PUT(string, &dout, &field_addr, real_packet->translation_domain);
50884 if (e) {
50885 log_packet_detailed("'translation_domain' field error detected");
50886 }
50887#ifdef FREECIV_JSON_CONNECTION
50888 field_addr.name = "adjective";
50889#endif /* FREECIV_JSON_CONNECTION */
50890 e = 0;
50891 e |= DIO_PUT(string, &dout, &field_addr, real_packet->adjective);
50892 if (e) {
50893 log_packet_detailed("'adjective' field error detected");
50894 }
50895#ifdef FREECIV_JSON_CONNECTION
50896 field_addr.name = "rule_name";
50897#endif /* FREECIV_JSON_CONNECTION */
50898 e = 0;
50899 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
50900 if (e) {
50901 log_packet_detailed("'rule_name' field error detected");
50902 }
50903#ifdef FREECIV_JSON_CONNECTION
50904 field_addr.name = "noun_plural";
50905#endif /* FREECIV_JSON_CONNECTION */
50906 e = 0;
50907 e |= DIO_PUT(string, &dout, &field_addr, real_packet->noun_plural);
50908 if (e) {
50909 log_packet_detailed("'noun_plural' field error detected");
50910 }
50911#ifdef FREECIV_JSON_CONNECTION
50912 field_addr.name = "graphic_str";
50913#endif /* FREECIV_JSON_CONNECTION */
50914 e = 0;
50915 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
50916 if (e) {
50917 log_packet_detailed("'graphic_str' field error detected");
50918 }
50919#ifdef FREECIV_JSON_CONNECTION
50920 field_addr.name = "graphic_alt";
50921#endif /* FREECIV_JSON_CONNECTION */
50922 e = 0;
50923 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
50924 if (e) {
50925 log_packet_detailed("'graphic_alt' field error detected");
50926 }
50927#ifdef FREECIV_JSON_CONNECTION
50928 field_addr.name = "legend";
50929#endif /* FREECIV_JSON_CONNECTION */
50930 e = 0;
50931 e |= DIO_PUT(string, &dout, &field_addr, real_packet->legend);
50932 if (e) {
50933 log_packet_detailed("'legend' field error detected");
50934 }
50935#ifdef FREECIV_JSON_CONNECTION
50936 field_addr.name = "style";
50937#endif /* FREECIV_JSON_CONNECTION */
50938 e = 0;
50939 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style);
50940 if (e) {
50941 log_packet_detailed("'style' field error detected");
50942 }
50943#ifdef FREECIV_JSON_CONNECTION
50944 field_addr.name = "leader_count";
50945#endif /* FREECIV_JSON_CONNECTION */
50946 e = 0;
50947 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->leader_count);
50948 if (e) {
50949 log_packet_detailed("'leader_count' field error detected");
50950 }
50951#ifdef FREECIV_JSON_CONNECTION
50952 field_addr.name = "leader_name";
50953#endif /* FREECIV_JSON_CONNECTION */
50954 e = 0;
50955 {
50956 int i;
50957
50958#ifdef FREECIV_JSON_CONNECTION
50959 /* Create the array. */
50960 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
50961
50962 /* Enter the array. */
50963 field_addr.sub_location = plocation_elem_new(0);
50964#endif /* FREECIV_JSON_CONNECTION */
50965
50966 for (i = 0; i < real_packet->leader_count; i++) {
50967#ifdef FREECIV_JSON_CONNECTION
50968 /* Next array element. */
50969 field_addr.sub_location->number = i;
50970#endif /* FREECIV_JSON_CONNECTION */
50971 e |= DIO_PUT(string, &dout, &field_addr, real_packet->leader_name[i]);
50972 }
50973
50974#ifdef FREECIV_JSON_CONNECTION
50975 /* Exit array. */
50976 FC_FREE(field_addr.sub_location);
50977#endif /* FREECIV_JSON_CONNECTION */
50978 }
50979 if (e) {
50980 log_packet_detailed("'leader_name' field error detected");
50981 }
50982#ifdef FREECIV_JSON_CONNECTION
50983 field_addr.name = "leader_is_male";
50984#endif /* FREECIV_JSON_CONNECTION */
50985 e = 0;
50986 {
50987 int i;
50988
50989#ifdef FREECIV_JSON_CONNECTION
50990 /* Create the array. */
50991 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->leader_count);
50992
50993 /* Enter the array. */
50994 field_addr.sub_location = plocation_elem_new(0);
50995#endif /* FREECIV_JSON_CONNECTION */
50996
50997 for (i = 0; i < real_packet->leader_count; i++) {
50998#ifdef FREECIV_JSON_CONNECTION
50999 /* Next array element. */
51000 field_addr.sub_location->number = i;
51001#endif /* FREECIV_JSON_CONNECTION */
51002 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->leader_is_male[i]);
51003 }
51004
51005#ifdef FREECIV_JSON_CONNECTION
51006 /* Exit array. */
51007 FC_FREE(field_addr.sub_location);
51008#endif /* FREECIV_JSON_CONNECTION */
51009 }
51010 if (e) {
51011 log_packet_detailed("'leader_is_male' field error detected");
51012 }
51013#ifdef FREECIV_JSON_CONNECTION
51014 field_addr.name = "is_playable";
51015#endif /* FREECIV_JSON_CONNECTION */
51016 e = 0;
51017 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_playable);
51018 if (e) {
51019 log_packet_detailed("'is_playable' field error detected");
51020 }
51021#ifdef FREECIV_JSON_CONNECTION
51022 field_addr.name = "barbarian_type";
51023#endif /* FREECIV_JSON_CONNECTION */
51024 e = 0;
51025 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->barbarian_type);
51026 if (e) {
51027 log_packet_detailed("'barbarian_type' field error detected");
51028 }
51029#ifdef FREECIV_JSON_CONNECTION
51030 field_addr.name = "nsets";
51031#endif /* FREECIV_JSON_CONNECTION */
51032 e = 0;
51033 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->nsets);
51034 if (e) {
51035 log_packet_detailed("'nsets' field error detected");
51036 }
51037#ifdef FREECIV_JSON_CONNECTION
51038 field_addr.name = "sets";
51039#endif /* FREECIV_JSON_CONNECTION */
51040 e = 0;
51041 {
51042 int i;
51043
51044#ifdef FREECIV_JSON_CONNECTION
51045 /* Create the array. */
51046 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->nsets);
51047
51048 /* Enter the array. */
51049 field_addr.sub_location = plocation_elem_new(0);
51050#endif /* FREECIV_JSON_CONNECTION */
51051
51052 for (i = 0; i < real_packet->nsets; i++) {
51053#ifdef FREECIV_JSON_CONNECTION
51054 /* Next array element. */
51055 field_addr.sub_location->number = i;
51056#endif /* FREECIV_JSON_CONNECTION */
51057 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sets[i]);
51058 }
51059
51060#ifdef FREECIV_JSON_CONNECTION
51061 /* Exit array. */
51062 FC_FREE(field_addr.sub_location);
51063#endif /* FREECIV_JSON_CONNECTION */
51064 }
51065 if (e) {
51066 log_packet_detailed("'sets' field error detected");
51067 }
51068#ifdef FREECIV_JSON_CONNECTION
51069 field_addr.name = "ngroups";
51070#endif /* FREECIV_JSON_CONNECTION */
51071 e = 0;
51072 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ngroups);
51073 if (e) {
51074 log_packet_detailed("'ngroups' field error detected");
51075 }
51076#ifdef FREECIV_JSON_CONNECTION
51077 field_addr.name = "groups";
51078#endif /* FREECIV_JSON_CONNECTION */
51079 e = 0;
51080 {
51081 int i;
51082
51083#ifdef FREECIV_JSON_CONNECTION
51084 /* Create the array. */
51085 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ngroups);
51086
51087 /* Enter the array. */
51088 field_addr.sub_location = plocation_elem_new(0);
51089#endif /* FREECIV_JSON_CONNECTION */
51090
51091 for (i = 0; i < real_packet->ngroups; i++) {
51092#ifdef FREECIV_JSON_CONNECTION
51093 /* Next array element. */
51094 field_addr.sub_location->number = i;
51095#endif /* FREECIV_JSON_CONNECTION */
51096 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->groups[i]);
51097 }
51098
51099#ifdef FREECIV_JSON_CONNECTION
51100 /* Exit array. */
51101 FC_FREE(field_addr.sub_location);
51102#endif /* FREECIV_JSON_CONNECTION */
51103 }
51104 if (e) {
51105 log_packet_detailed("'groups' field error detected");
51106 }
51107#ifdef FREECIV_JSON_CONNECTION
51108 field_addr.name = "init_government_id";
51109#endif /* FREECIV_JSON_CONNECTION */
51110 e = 0;
51111 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->init_government_id);
51112 if (e) {
51113 log_packet_detailed("'init_government_id' field error detected");
51114 }
51115#ifdef FREECIV_JSON_CONNECTION
51116 field_addr.name = "init_techs_count";
51117#endif /* FREECIV_JSON_CONNECTION */
51118 e = 0;
51119 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_techs_count);
51120 if (e) {
51121 log_packet_detailed("'init_techs_count' field error detected");
51122 }
51123#ifdef FREECIV_JSON_CONNECTION
51124 field_addr.name = "init_techs";
51125#endif /* FREECIV_JSON_CONNECTION */
51126 e = 0;
51127 {
51128 int i;
51129
51130#ifdef FREECIV_JSON_CONNECTION
51131 /* Create the array. */
51132 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_techs_count);
51133
51134 /* Enter the array. */
51135 field_addr.sub_location = plocation_elem_new(0);
51136#endif /* FREECIV_JSON_CONNECTION */
51137
51138 for (i = 0; i < real_packet->init_techs_count; i++) {
51139#ifdef FREECIV_JSON_CONNECTION
51140 /* Next array element. */
51141 field_addr.sub_location->number = i;
51142#endif /* FREECIV_JSON_CONNECTION */
51143 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->init_techs[i]);
51144 }
51145
51146#ifdef FREECIV_JSON_CONNECTION
51147 /* Exit array. */
51148 FC_FREE(field_addr.sub_location);
51149#endif /* FREECIV_JSON_CONNECTION */
51150 }
51151 if (e) {
51152 log_packet_detailed("'init_techs' field error detected");
51153 }
51154#ifdef FREECIV_JSON_CONNECTION
51155 field_addr.name = "init_units_count";
51156#endif /* FREECIV_JSON_CONNECTION */
51157 e = 0;
51158 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units_count);
51159 if (e) {
51160 log_packet_detailed("'init_units_count' field error detected");
51161 }
51162#ifdef FREECIV_JSON_CONNECTION
51163 field_addr.name = "init_units";
51164#endif /* FREECIV_JSON_CONNECTION */
51165 e = 0;
51166 {
51167 int i;
51168
51169#ifdef FREECIV_JSON_CONNECTION
51170 /* Create the array. */
51171 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_units_count);
51172
51173 /* Enter the array. */
51174 field_addr.sub_location = plocation_elem_new(0);
51175#endif /* FREECIV_JSON_CONNECTION */
51176
51177 for (i = 0; i < real_packet->init_units_count; i++) {
51178#ifdef FREECIV_JSON_CONNECTION
51179 /* Next array element. */
51180 field_addr.sub_location->number = i;
51181#endif /* FREECIV_JSON_CONNECTION */
51182 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_units[i]);
51183 }
51184
51185#ifdef FREECIV_JSON_CONNECTION
51186 /* Exit array. */
51187 FC_FREE(field_addr.sub_location);
51188#endif /* FREECIV_JSON_CONNECTION */
51189 }
51190 if (e) {
51191 log_packet_detailed("'init_units' field error detected");
51192 }
51193#ifdef FREECIV_JSON_CONNECTION
51194 field_addr.name = "init_buildings_count";
51195#endif /* FREECIV_JSON_CONNECTION */
51196 e = 0;
51197 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings_count);
51198 if (e) {
51199 log_packet_detailed("'init_buildings_count' field error detected");
51200 }
51201#ifdef FREECIV_JSON_CONNECTION
51202 field_addr.name = "init_buildings";
51203#endif /* FREECIV_JSON_CONNECTION */
51204 e = 0;
51205 {
51206 int i;
51207
51208#ifdef FREECIV_JSON_CONNECTION
51209 /* Create the array. */
51210 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->init_buildings_count);
51211
51212 /* Enter the array. */
51213 field_addr.sub_location = plocation_elem_new(0);
51214#endif /* FREECIV_JSON_CONNECTION */
51215
51216 for (i = 0; i < real_packet->init_buildings_count; i++) {
51217#ifdef FREECIV_JSON_CONNECTION
51218 /* Next array element. */
51219 field_addr.sub_location->number = i;
51220#endif /* FREECIV_JSON_CONNECTION */
51221 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->init_buildings[i]);
51222 }
51223
51224#ifdef FREECIV_JSON_CONNECTION
51225 /* Exit array. */
51226 FC_FREE(field_addr.sub_location);
51227#endif /* FREECIV_JSON_CONNECTION */
51228 }
51229 if (e) {
51230 log_packet_detailed("'init_buildings' field error detected");
51231 }
51232
51233#endif
51234 SEND_PACKET_END(PACKET_RULESET_NATION);
51235}
51236
51237 int send_packet_ruleset_nation(struct connection *pc, const struct packet_ruleset_nation *packet)
51238{
51239 if (!pc->used) {
51240 log_error("WARNING: trying to send data to the closed connection %s",
51241 conn_description(pc));
51242 return -1;
51243 }
51244 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_NATION].packet != NULL, -1,
51245 "Handler for PACKET_RULESET_NATION not installed");
51246 return pc->phs.handlers->send[PACKET_RULESET_NATION].packet(pc, packet);
51247}
51248
51249 void lsend_packet_ruleset_nation(struct conn_list *dest, const struct packet_ruleset_nation *packet)
51250{
51251 conn_list_iterate(dest, pconn) {
51252 send_packet_ruleset_nation(pconn, packet);
51253 } conn_list_iterate_end;
51254}
51255
51256#ifdef FREECIV_DELTA_PROTOCOL
51257#define hash_packet_nation_availability_100 hash_const
51258
51259#define cmp_packet_nation_availability_100 cmp_const
51260
51261 BV_DEFINE(packet_nation_availability_100_fields, 3);
51262#endif /* FREECIV_DELTA_PROTOCOL */
51263
51264 static struct packet_nation_availability *receive_packet_nation_availability_100(struct connection *pc)
51265{
51266#ifdef FREECIV_DELTA_PROTOCOL
51267 packet_nation_availability_100_fields fields;
51268 struct packet_nation_availability *old;
51269 struct genhash **hash = pc->phs.received + PACKET_NATION_AVAILABILITY;
51270#endif /* FREECIV_DELTA_PROTOCOL */
51271 RECEIVE_PACKET_START(packet_nation_availability, real_packet);
51272#ifdef FREECIV_JSON_CONNECTION
51273 struct plocation field_addr;
51274 {
51275 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51276 field_addr = *field_addr_tmp;
51277 FC_FREE(field_addr_tmp);
51278 }
51279#endif /* FREECIV_JSON_CONNECTION */
51280
51281#ifdef FREECIV_DELTA_PROTOCOL
51282#ifdef FREECIV_JSON_CONNECTION
51283 field_addr.name = "fields";
51284#endif /* FREECIV_JSON_CONNECTION */
51285 DIO_BV_GET(&din, &field_addr, fields);
51286
51287#else /* FREECIV_DELTA_PROTOCOL */
51288#ifdef FREECIV_JSON_CONNECTION
51289 field_addr.name = "ncount";
51290#endif /* FREECIV_JSON_CONNECTION */
51291 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ncount)) {
51292 RECEIVE_PACKET_FIELD_ERROR(ncount);
51293 }
51294#ifdef FREECIV_JSON_CONNECTION
51295 field_addr.name = "is_pickable";
51296#endif /* FREECIV_JSON_CONNECTION */
51297 {
51298 int i;
51299
51300#ifdef FREECIV_JSON_CONNECTION
51301 /* Enter array. */
51302 field_addr.sub_location = plocation_elem_new(0);
51303#endif /* FREECIV_JSON_CONNECTION */
51304
51305 if (real_packet->ncount > MAX_NUM_NATIONS) {
51306 RECEIVE_PACKET_FIELD_ERROR(is_pickable, ": truncation array");
51307 }
51308 for (i = 0; i < real_packet->ncount; i++) {
51309#ifdef FREECIV_JSON_CONNECTION
51310 field_addr.sub_location->number = i;
51311#endif /* FREECIV_JSON_CONNECTION */
51312 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_pickable[i])) {
51313 RECEIVE_PACKET_FIELD_ERROR(is_pickable);
51314 }
51315 }
51316
51317#ifdef FREECIV_JSON_CONNECTION
51318 /* Exit array. */
51319 FC_FREE(field_addr.sub_location);
51320#endif /* FREECIV_JSON_CONNECTION */
51321 }
51322#ifdef FREECIV_JSON_CONNECTION
51323 field_addr.name = "nationset_change";
51324#endif /* FREECIV_JSON_CONNECTION */
51325 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->nationset_change)) {
51326 RECEIVE_PACKET_FIELD_ERROR(nationset_change);
51327 }
51328#endif
51329 log_packet_detailed("packet_nation_availability_100: got info about ()");
51330
51331#ifdef FREECIV_DELTA_PROTOCOL
51332 if (NULL == *hash) {
51333 *hash = genhash_new_full(hash_packet_nation_availability_100, cmp_packet_nation_availability_100,
51334 NULL, NULL, NULL, free);
51335 }
51336
51337 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51338 *real_packet = *old;
51339 } else {
51340 log_packet_detailed(" no old info");
51341 memset(real_packet, 0, sizeof(*real_packet));
51342 }
51343
51344 if (BV_ISSET(fields, 0)) {
51345 log_packet_detailed(" got field 'ncount'");
51346#ifdef FREECIV_JSON_CONNECTION
51347 field_addr.name = "ncount";
51348#endif /* FREECIV_JSON_CONNECTION */
51349 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->ncount)) {
51350 RECEIVE_PACKET_FIELD_ERROR(ncount);
51351 }
51352 }
51353 if (BV_ISSET(fields, 1)) {
51354 log_packet_detailed(" got field 'is_pickable'");
51355#ifdef FREECIV_JSON_CONNECTION
51356 field_addr.name = "is_pickable";
51357#endif /* FREECIV_JSON_CONNECTION */
51358 {
51359 int i;
51360
51361#ifdef FREECIV_JSON_CONNECTION
51362 /* Enter array. */
51363 field_addr.sub_location = plocation_elem_new(0);
51364#endif /* FREECIV_JSON_CONNECTION */
51365
51366 if (real_packet->ncount > MAX_NUM_NATIONS) {
51367 RECEIVE_PACKET_FIELD_ERROR(is_pickable, ": truncation array");
51368 }
51369 for (i = 0; i < real_packet->ncount; i++) {
51370#ifdef FREECIV_JSON_CONNECTION
51371 field_addr.sub_location->number = i;
51372#endif /* FREECIV_JSON_CONNECTION */
51373 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_pickable[i])) {
51374 RECEIVE_PACKET_FIELD_ERROR(is_pickable);
51375 }
51376 }
51377
51378#ifdef FREECIV_JSON_CONNECTION
51379 /* Exit array. */
51380 FC_FREE(field_addr.sub_location);
51381#endif /* FREECIV_JSON_CONNECTION */
51382 }
51383 }
51384 real_packet->nationset_change = BV_ISSET(fields, 2);
51385
51386 if (NULL == old) {
51387 old = fc_malloc(sizeof(*old));
51388 *old = *real_packet;
51389 genhash_insert(*hash, old, old);
51390 } else {
51391 *old = *real_packet;
51392 }
51393
51394#endif /* FREECIV_DELTA_PROTOCOL */
51395 RECEIVE_PACKET_END(real_packet);
51396}
51397
51398 static int send_packet_nation_availability_100(struct connection *pc, const struct packet_nation_availability *packet)
51399{
51400 const struct packet_nation_availability *real_packet = packet;
51401 int e;
51402#ifdef FREECIV_DELTA_PROTOCOL
51403 packet_nation_availability_100_fields fields;
51404 struct packet_nation_availability *old;
51405 bool differ;
51406 struct genhash **hash = pc->phs.sent + PACKET_NATION_AVAILABILITY;
51407#endif /* FREECIV_DELTA_PROTOCOL */
51408 SEND_PACKET_START(PACKET_NATION_AVAILABILITY);
51409#ifdef FREECIV_JSON_CONNECTION
51410 struct plocation field_addr;
51411 {
51412 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51413 field_addr = *field_addr_tmp;
51414 FC_FREE(field_addr_tmp);
51415 }
51416#endif /* FREECIV_JSON_CONNECTION */
51417
51418 log_packet_detailed("packet_nation_availability_100: sending info about ()");
51419
51420#ifdef FREECIV_DELTA_PROTOCOL
51421 if (NULL == *hash) {
51422 *hash = genhash_new_full(hash_packet_nation_availability_100, cmp_packet_nation_availability_100,
51423 NULL, NULL, NULL, free);
51424 }
51425 BV_CLR_ALL(fields);
51426
51427 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
51428 old = fc_malloc(sizeof(*old));
51429 *old = *real_packet;
51430 genhash_insert(*hash, old, old);
51431 memset(old, 0, sizeof(*old));
51432 }
51433 differ = (old->ncount != real_packet->ncount);
51434 if (differ) {
51435 BV_SET(fields, 0);
51436 }
51437
51438 differ = (old->ncount != real_packet->ncount);
51439 if (!differ) {
51440 int i;
51441
51442 for (i = 0; i < real_packet->ncount; i++) {
51443 differ = (old->is_pickable[i] != real_packet->is_pickable[i]);
51444 if (differ) {
51445 break;
51446 }
51447 }
51448 }
51449 if (differ) {
51450 BV_SET(fields, 1);
51451 }
51452
51453 if (packet->nationset_change) {
51454 BV_SET(fields, 2);
51455 }
51456
51457
51458#ifdef FREECIV_JSON_CONNECTION
51459 field_addr.name = "fields";
51460#endif /* FREECIV_JSON_CONNECTION */
51461 e = 0;
51462 e |= DIO_BV_PUT(&dout, &field_addr, fields);
51463 if (e) {
51464 log_packet_detailed("fields bitvector error detected");
51465 }
51466
51467 if (BV_ISSET(fields, 0)) {
51468 log_packet_detailed(" field 'ncount' has changed");
51469#ifdef FREECIV_JSON_CONNECTION
51470 field_addr.name = "ncount";
51471#endif /* FREECIV_JSON_CONNECTION */
51472 e = 0;
51473 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ncount);
51474 if (e) {
51475 log_packet_detailed("'ncount' field error detected");
51476 }
51477 }
51478 if (BV_ISSET(fields, 1)) {
51479 log_packet_detailed(" field 'is_pickable' has changed");
51480#ifdef FREECIV_JSON_CONNECTION
51481 field_addr.name = "is_pickable";
51482#endif /* FREECIV_JSON_CONNECTION */
51483 e = 0;
51484 {
51485 int i;
51486
51487#ifdef FREECIV_JSON_CONNECTION
51488 /* Create the array. */
51489 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ncount);
51490
51491 /* Enter the array. */
51492 field_addr.sub_location = plocation_elem_new(0);
51493#endif /* FREECIV_JSON_CONNECTION */
51494
51495 for (i = 0; i < real_packet->ncount; i++) {
51496#ifdef FREECIV_JSON_CONNECTION
51497 /* Next array element. */
51498 field_addr.sub_location->number = i;
51499#endif /* FREECIV_JSON_CONNECTION */
51500 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_pickable[i]);
51501 }
51502
51503#ifdef FREECIV_JSON_CONNECTION
51504 /* Exit array. */
51505 FC_FREE(field_addr.sub_location);
51506#endif /* FREECIV_JSON_CONNECTION */
51507 }
51508 if (e) {
51509 log_packet_detailed("'is_pickable' field error detected");
51510 }
51511 }
51512 /* field 2 is folded into the header */
51513
51514 *old = *real_packet;
51515#endif /* FREECIV_DELTA_PROTOCOL */
51516#ifndef FREECIV_DELTA_PROTOCOL
51517#ifdef FREECIV_JSON_CONNECTION
51518 field_addr.name = "ncount";
51519#endif /* FREECIV_JSON_CONNECTION */
51520 e = 0;
51521 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->ncount);
51522 if (e) {
51523 log_packet_detailed("'ncount' field error detected");
51524 }
51525#ifdef FREECIV_JSON_CONNECTION
51526 field_addr.name = "is_pickable";
51527#endif /* FREECIV_JSON_CONNECTION */
51528 e = 0;
51529 {
51530 int i;
51531
51532#ifdef FREECIV_JSON_CONNECTION
51533 /* Create the array. */
51534 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ncount);
51535
51536 /* Enter the array. */
51537 field_addr.sub_location = plocation_elem_new(0);
51538#endif /* FREECIV_JSON_CONNECTION */
51539
51540 for (i = 0; i < real_packet->ncount; i++) {
51541#ifdef FREECIV_JSON_CONNECTION
51542 /* Next array element. */
51543 field_addr.sub_location->number = i;
51544#endif /* FREECIV_JSON_CONNECTION */
51545 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_pickable[i]);
51546 }
51547
51548#ifdef FREECIV_JSON_CONNECTION
51549 /* Exit array. */
51550 FC_FREE(field_addr.sub_location);
51551#endif /* FREECIV_JSON_CONNECTION */
51552 }
51553 if (e) {
51554 log_packet_detailed("'is_pickable' field error detected");
51555 }
51556#ifdef FREECIV_JSON_CONNECTION
51557 field_addr.name = "nationset_change";
51558#endif /* FREECIV_JSON_CONNECTION */
51559 e = 0;
51560 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->nationset_change);
51561 if (e) {
51562 log_packet_detailed("'nationset_change' field error detected");
51563 }
51564
51565#endif
51566 SEND_PACKET_END(PACKET_NATION_AVAILABILITY);
51567}
51568
51569 int send_packet_nation_availability(struct connection *pc, const struct packet_nation_availability *packet)
51570{
51571 if (!pc->used) {
51572 log_error("WARNING: trying to send data to the closed connection %s",
51573 conn_description(pc));
51574 return -1;
51575 }
51576 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_NATION_AVAILABILITY].packet != NULL, -1,
51577 "Handler for PACKET_NATION_AVAILABILITY not installed");
51578 return pc->phs.handlers->send[PACKET_NATION_AVAILABILITY].packet(pc, packet);
51579}
51580
51581 void lsend_packet_nation_availability(struct conn_list *dest, const struct packet_nation_availability *packet)
51582{
51583 conn_list_iterate(dest, pconn) {
51584 send_packet_nation_availability(pconn, packet);
51585 } conn_list_iterate_end;
51586}
51587
51588#ifdef FREECIV_DELTA_PROTOCOL
51589#define hash_packet_ruleset_style_100 hash_const
51590
51591#define cmp_packet_ruleset_style_100 cmp_const
51592
51593 BV_DEFINE(packet_ruleset_style_100_fields, 3);
51594#endif /* FREECIV_DELTA_PROTOCOL */
51595
51596 static struct packet_ruleset_style *receive_packet_ruleset_style_100(struct connection *pc)
51597{
51598#ifdef FREECIV_DELTA_PROTOCOL
51599 packet_ruleset_style_100_fields fields;
51600 struct packet_ruleset_style *old;
51601 struct genhash **hash = pc->phs.received + PACKET_RULESET_STYLE;
51602#endif /* FREECIV_DELTA_PROTOCOL */
51603 RECEIVE_PACKET_START(packet_ruleset_style, real_packet);
51604#ifdef FREECIV_JSON_CONNECTION
51605 struct plocation field_addr;
51606 {
51607 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51608 field_addr = *field_addr_tmp;
51609 FC_FREE(field_addr_tmp);
51610 }
51611#endif /* FREECIV_JSON_CONNECTION */
51612
51613#ifdef FREECIV_DELTA_PROTOCOL
51614#ifdef FREECIV_JSON_CONNECTION
51615 field_addr.name = "fields";
51616#endif /* FREECIV_JSON_CONNECTION */
51617 DIO_BV_GET(&din, &field_addr, fields);
51618
51619#else /* FREECIV_DELTA_PROTOCOL */
51620#ifdef FREECIV_JSON_CONNECTION
51621 field_addr.name = "id";
51622#endif /* FREECIV_JSON_CONNECTION */
51623 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
51624 RECEIVE_PACKET_FIELD_ERROR(id);
51625 }
51626#ifdef FREECIV_JSON_CONNECTION
51627 field_addr.name = "name";
51628#endif /* FREECIV_JSON_CONNECTION */
51629 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
51630 RECEIVE_PACKET_FIELD_ERROR(name);
51631 }
51632#ifdef FREECIV_JSON_CONNECTION
51633 field_addr.name = "rule_name";
51634#endif /* FREECIV_JSON_CONNECTION */
51635 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
51636 RECEIVE_PACKET_FIELD_ERROR(rule_name);
51637 }
51638#endif
51639 log_packet_detailed("packet_ruleset_style_100: got info about ()");
51640
51641#ifdef FREECIV_DELTA_PROTOCOL
51642 if (NULL == *hash) {
51643 *hash = genhash_new_full(hash_packet_ruleset_style_100, cmp_packet_ruleset_style_100,
51644 NULL, NULL, NULL, free);
51645 }
51646
51647 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51648 *real_packet = *old;
51649 } else {
51650 log_packet_detailed(" no old info");
51651 memset(real_packet, 0, sizeof(*real_packet));
51652 }
51653
51654 if (BV_ISSET(fields, 0)) {
51655 log_packet_detailed(" got field 'id'");
51656#ifdef FREECIV_JSON_CONNECTION
51657 field_addr.name = "id";
51658#endif /* FREECIV_JSON_CONNECTION */
51659 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
51660 RECEIVE_PACKET_FIELD_ERROR(id);
51661 }
51662 }
51663 if (BV_ISSET(fields, 1)) {
51664 log_packet_detailed(" got field 'name'");
51665#ifdef FREECIV_JSON_CONNECTION
51666 field_addr.name = "name";
51667#endif /* FREECIV_JSON_CONNECTION */
51668 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
51669 RECEIVE_PACKET_FIELD_ERROR(name);
51670 }
51671 }
51672 if (BV_ISSET(fields, 2)) {
51673 log_packet_detailed(" got field 'rule_name'");
51674#ifdef FREECIV_JSON_CONNECTION
51675 field_addr.name = "rule_name";
51676#endif /* FREECIV_JSON_CONNECTION */
51677 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
51678 RECEIVE_PACKET_FIELD_ERROR(rule_name);
51679 }
51680 }
51681
51682 if (NULL == old) {
51683 old = fc_malloc(sizeof(*old));
51684 *old = *real_packet;
51685 genhash_insert(*hash, old, old);
51686 } else {
51687 *old = *real_packet;
51688 }
51689
51690#endif /* FREECIV_DELTA_PROTOCOL */
51691 RECEIVE_PACKET_END(real_packet);
51692}
51693
51694 static int send_packet_ruleset_style_100(struct connection *pc, const struct packet_ruleset_style *packet)
51695{
51696 const struct packet_ruleset_style *real_packet = packet;
51697 int e;
51698#ifdef FREECIV_DELTA_PROTOCOL
51699 packet_ruleset_style_100_fields fields;
51700 struct packet_ruleset_style *old;
51701 bool differ;
51702 struct genhash **hash = pc->phs.sent + PACKET_RULESET_STYLE;
51703#endif /* FREECIV_DELTA_PROTOCOL */
51704 SEND_PACKET_START(PACKET_RULESET_STYLE);
51705#ifdef FREECIV_JSON_CONNECTION
51706 struct plocation field_addr;
51707 {
51708 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51709 field_addr = *field_addr_tmp;
51710 FC_FREE(field_addr_tmp);
51711 }
51712#endif /* FREECIV_JSON_CONNECTION */
51713
51714 log_packet_detailed("packet_ruleset_style_100: sending info about ()");
51715
51716#ifdef FREECIV_DELTA_PROTOCOL
51717 if (NULL == *hash) {
51718 *hash = genhash_new_full(hash_packet_ruleset_style_100, cmp_packet_ruleset_style_100,
51719 NULL, NULL, NULL, free);
51720 }
51721 BV_CLR_ALL(fields);
51722
51723 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
51724 old = fc_malloc(sizeof(*old));
51725 *old = *real_packet;
51726 genhash_insert(*hash, old, old);
51727 memset(old, 0, sizeof(*old));
51728 }
51729 differ = (old->id != real_packet->id);
51730 if (differ) {
51731 BV_SET(fields, 0);
51732 }
51733
51734 differ = (strcmp(old->name, real_packet->name) != 0);
51735 if (differ) {
51736 BV_SET(fields, 1);
51737 }
51738
51739 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
51740 if (differ) {
51741 BV_SET(fields, 2);
51742 }
51743
51744
51745#ifdef FREECIV_JSON_CONNECTION
51746 field_addr.name = "fields";
51747#endif /* FREECIV_JSON_CONNECTION */
51748 e = 0;
51749 e |= DIO_BV_PUT(&dout, &field_addr, fields);
51750 if (e) {
51751 log_packet_detailed("fields bitvector error detected");
51752 }
51753
51754 if (BV_ISSET(fields, 0)) {
51755 log_packet_detailed(" field 'id' has changed");
51756#ifdef FREECIV_JSON_CONNECTION
51757 field_addr.name = "id";
51758#endif /* FREECIV_JSON_CONNECTION */
51759 e = 0;
51760 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
51761 if (e) {
51762 log_packet_detailed("'id' field error detected");
51763 }
51764 }
51765 if (BV_ISSET(fields, 1)) {
51766 log_packet_detailed(" field 'name' has changed");
51767#ifdef FREECIV_JSON_CONNECTION
51768 field_addr.name = "name";
51769#endif /* FREECIV_JSON_CONNECTION */
51770 e = 0;
51771 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
51772 if (e) {
51773 log_packet_detailed("'name' field error detected");
51774 }
51775 }
51776 if (BV_ISSET(fields, 2)) {
51777 log_packet_detailed(" field 'rule_name' has changed");
51778#ifdef FREECIV_JSON_CONNECTION
51779 field_addr.name = "rule_name";
51780#endif /* FREECIV_JSON_CONNECTION */
51781 e = 0;
51782 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
51783 if (e) {
51784 log_packet_detailed("'rule_name' field error detected");
51785 }
51786 }
51787
51788 *old = *real_packet;
51789#endif /* FREECIV_DELTA_PROTOCOL */
51790#ifndef FREECIV_DELTA_PROTOCOL
51791#ifdef FREECIV_JSON_CONNECTION
51792 field_addr.name = "id";
51793#endif /* FREECIV_JSON_CONNECTION */
51794 e = 0;
51795 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
51796 if (e) {
51797 log_packet_detailed("'id' field error detected");
51798 }
51799#ifdef FREECIV_JSON_CONNECTION
51800 field_addr.name = "name";
51801#endif /* FREECIV_JSON_CONNECTION */
51802 e = 0;
51803 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
51804 if (e) {
51805 log_packet_detailed("'name' field error detected");
51806 }
51807#ifdef FREECIV_JSON_CONNECTION
51808 field_addr.name = "rule_name";
51809#endif /* FREECIV_JSON_CONNECTION */
51810 e = 0;
51811 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
51812 if (e) {
51813 log_packet_detailed("'rule_name' field error detected");
51814 }
51815
51816#endif
51817 SEND_PACKET_END(PACKET_RULESET_STYLE);
51818}
51819
51820 int send_packet_ruleset_style(struct connection *pc, const struct packet_ruleset_style *packet)
51821{
51822 if (!pc->used) {
51823 log_error("WARNING: trying to send data to the closed connection %s",
51824 conn_description(pc));
51825 return -1;
51826 }
51827 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_STYLE].packet != NULL, -1,
51828 "Handler for PACKET_RULESET_STYLE not installed");
51829 return pc->phs.handlers->send[PACKET_RULESET_STYLE].packet(pc, packet);
51830}
51831
51832 void lsend_packet_ruleset_style(struct conn_list *dest, const struct packet_ruleset_style *packet)
51833{
51834 conn_list_iterate(dest, pconn) {
51835 send_packet_ruleset_style(pconn, packet);
51836 } conn_list_iterate_end;
51837}
51838
51839#ifdef FREECIV_DELTA_PROTOCOL
51840#define hash_packet_ruleset_city_100 hash_const
51841
51842#define cmp_packet_ruleset_city_100 cmp_const
51843
51844 BV_DEFINE(packet_ruleset_city_100_fields, 8);
51845#endif /* FREECIV_DELTA_PROTOCOL */
51846
51847 static struct packet_ruleset_city *receive_packet_ruleset_city_100(struct connection *pc)
51848{
51849#ifdef FREECIV_DELTA_PROTOCOL
51850 packet_ruleset_city_100_fields fields;
51851 struct packet_ruleset_city *old;
51852 struct genhash **hash = pc->phs.received + PACKET_RULESET_CITY;
51853#endif /* FREECIV_DELTA_PROTOCOL */
51854 RECEIVE_PACKET_START(packet_ruleset_city, real_packet);
51855#ifdef FREECIV_JSON_CONNECTION
51856 struct plocation field_addr;
51857 {
51858 struct plocation *field_addr_tmp = plocation_field_new(NULL);
51859 field_addr = *field_addr_tmp;
51860 FC_FREE(field_addr_tmp);
51861 }
51862#endif /* FREECIV_JSON_CONNECTION */
51863
51864#ifdef FREECIV_DELTA_PROTOCOL
51865#ifdef FREECIV_JSON_CONNECTION
51866 field_addr.name = "fields";
51867#endif /* FREECIV_JSON_CONNECTION */
51868 DIO_BV_GET(&din, &field_addr, fields);
51869
51870#else /* FREECIV_DELTA_PROTOCOL */
51871#ifdef FREECIV_JSON_CONNECTION
51872 field_addr.name = "style_id";
51873#endif /* FREECIV_JSON_CONNECTION */
51874 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style_id)) {
51875 RECEIVE_PACKET_FIELD_ERROR(style_id);
51876 }
51877#ifdef FREECIV_JSON_CONNECTION
51878 field_addr.name = "name";
51879#endif /* FREECIV_JSON_CONNECTION */
51880 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
51881 RECEIVE_PACKET_FIELD_ERROR(name);
51882 }
51883#ifdef FREECIV_JSON_CONNECTION
51884 field_addr.name = "rule_name";
51885#endif /* FREECIV_JSON_CONNECTION */
51886 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
51887 RECEIVE_PACKET_FIELD_ERROR(rule_name);
51888 }
51889#ifdef FREECIV_JSON_CONNECTION
51890 field_addr.name = "citizens_graphic";
51891#endif /* FREECIV_JSON_CONNECTION */
51892 if (!DIO_GET(string, &din, &field_addr, real_packet->citizens_graphic, sizeof(real_packet->citizens_graphic))) {
51893 RECEIVE_PACKET_FIELD_ERROR(citizens_graphic);
51894 }
51895#ifdef FREECIV_JSON_CONNECTION
51896 field_addr.name = "reqs_count";
51897#endif /* FREECIV_JSON_CONNECTION */
51898 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
51899 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
51900 }
51901#ifdef FREECIV_JSON_CONNECTION
51902 field_addr.name = "reqs";
51903#endif /* FREECIV_JSON_CONNECTION */
51904 {
51905 int i;
51906
51907#ifdef FREECIV_JSON_CONNECTION
51908 /* Enter array. */
51909 field_addr.sub_location = plocation_elem_new(0);
51910#endif /* FREECIV_JSON_CONNECTION */
51911
51912 if (real_packet->reqs_count > MAX_NUM_REQS) {
51913 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
51914 }
51915 for (i = 0; i < real_packet->reqs_count; i++) {
51916#ifdef FREECIV_JSON_CONNECTION
51917 field_addr.sub_location->number = i;
51918#endif /* FREECIV_JSON_CONNECTION */
51919 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
51920 RECEIVE_PACKET_FIELD_ERROR(reqs);
51921 }
51922 }
51923
51924#ifdef FREECIV_JSON_CONNECTION
51925 /* Exit array. */
51926 FC_FREE(field_addr.sub_location);
51927#endif /* FREECIV_JSON_CONNECTION */
51928 }
51929#ifdef FREECIV_JSON_CONNECTION
51930 field_addr.name = "graphic";
51931#endif /* FREECIV_JSON_CONNECTION */
51932 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic, sizeof(real_packet->graphic))) {
51933 RECEIVE_PACKET_FIELD_ERROR(graphic);
51934 }
51935#ifdef FREECIV_JSON_CONNECTION
51936 field_addr.name = "graphic_alt";
51937#endif /* FREECIV_JSON_CONNECTION */
51938 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
51939 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
51940 }
51941#endif
51942 log_packet_detailed("packet_ruleset_city_100: got info about ()");
51943
51944#ifdef FREECIV_DELTA_PROTOCOL
51945 if (NULL == *hash) {
51946 *hash = genhash_new_full(hash_packet_ruleset_city_100, cmp_packet_ruleset_city_100,
51947 NULL, NULL, NULL, free);
51948 }
51949
51950 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
51951 *real_packet = *old;
51952 } else {
51953 log_packet_detailed(" no old info");
51954 memset(real_packet, 0, sizeof(*real_packet));
51955 }
51956
51957 if (BV_ISSET(fields, 0)) {
51958 log_packet_detailed(" got field 'style_id'");
51959#ifdef FREECIV_JSON_CONNECTION
51960 field_addr.name = "style_id";
51961#endif /* FREECIV_JSON_CONNECTION */
51962 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->style_id)) {
51963 RECEIVE_PACKET_FIELD_ERROR(style_id);
51964 }
51965 }
51966 if (BV_ISSET(fields, 1)) {
51967 log_packet_detailed(" got field 'name'");
51968#ifdef FREECIV_JSON_CONNECTION
51969 field_addr.name = "name";
51970#endif /* FREECIV_JSON_CONNECTION */
51971 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
51972 RECEIVE_PACKET_FIELD_ERROR(name);
51973 }
51974 }
51975 if (BV_ISSET(fields, 2)) {
51976 log_packet_detailed(" got field 'rule_name'");
51977#ifdef FREECIV_JSON_CONNECTION
51978 field_addr.name = "rule_name";
51979#endif /* FREECIV_JSON_CONNECTION */
51980 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
51981 RECEIVE_PACKET_FIELD_ERROR(rule_name);
51982 }
51983 }
51984 if (BV_ISSET(fields, 3)) {
51985 log_packet_detailed(" got field 'citizens_graphic'");
51986#ifdef FREECIV_JSON_CONNECTION
51987 field_addr.name = "citizens_graphic";
51988#endif /* FREECIV_JSON_CONNECTION */
51989 if (!DIO_GET(string, &din, &field_addr, real_packet->citizens_graphic, sizeof(real_packet->citizens_graphic))) {
51990 RECEIVE_PACKET_FIELD_ERROR(citizens_graphic);
51991 }
51992 }
51993 if (BV_ISSET(fields, 4)) {
51994 log_packet_detailed(" got field 'reqs_count'");
51995#ifdef FREECIV_JSON_CONNECTION
51996 field_addr.name = "reqs_count";
51997#endif /* FREECIV_JSON_CONNECTION */
51998 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
51999 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
52000 }
52001 }
52002 if (BV_ISSET(fields, 5)) {
52003 log_packet_detailed(" got field 'reqs'");
52004#ifdef FREECIV_JSON_CONNECTION
52005 field_addr.name = "reqs";
52006#endif /* FREECIV_JSON_CONNECTION */
52007 {
52008 int i;
52009
52010#ifdef FREECIV_JSON_CONNECTION
52011 /* Enter array. */
52012 field_addr.sub_location = plocation_elem_new(0);
52013#endif /* FREECIV_JSON_CONNECTION */
52014
52015 if (real_packet->reqs_count > MAX_NUM_REQS) {
52016 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
52017 }
52018 for (i = 0; i < real_packet->reqs_count; i++) {
52019#ifdef FREECIV_JSON_CONNECTION
52020 field_addr.sub_location->number = i;
52021#endif /* FREECIV_JSON_CONNECTION */
52022 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
52023 RECEIVE_PACKET_FIELD_ERROR(reqs);
52024 }
52025 }
52026
52027#ifdef FREECIV_JSON_CONNECTION
52028 /* Exit array. */
52029 FC_FREE(field_addr.sub_location);
52030#endif /* FREECIV_JSON_CONNECTION */
52031 }
52032 }
52033 if (BV_ISSET(fields, 6)) {
52034 log_packet_detailed(" got field 'graphic'");
52035#ifdef FREECIV_JSON_CONNECTION
52036 field_addr.name = "graphic";
52037#endif /* FREECIV_JSON_CONNECTION */
52038 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic, sizeof(real_packet->graphic))) {
52039 RECEIVE_PACKET_FIELD_ERROR(graphic);
52040 }
52041 }
52042 if (BV_ISSET(fields, 7)) {
52043 log_packet_detailed(" got field 'graphic_alt'");
52044#ifdef FREECIV_JSON_CONNECTION
52045 field_addr.name = "graphic_alt";
52046#endif /* FREECIV_JSON_CONNECTION */
52047 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
52048 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
52049 }
52050 }
52051
52052 if (NULL == old) {
52053 old = fc_malloc(sizeof(*old));
52054 *old = *real_packet;
52055 genhash_insert(*hash, old, old);
52056 } else {
52057 *old = *real_packet;
52058 }
52059
52060#endif /* FREECIV_DELTA_PROTOCOL */
52061 RECEIVE_PACKET_END(real_packet);
52062}
52063
52064 static int send_packet_ruleset_city_100(struct connection *pc, const struct packet_ruleset_city *packet)
52065{
52066 const struct packet_ruleset_city *real_packet = packet;
52067 int e;
52068#ifdef FREECIV_DELTA_PROTOCOL
52069 packet_ruleset_city_100_fields fields;
52070 struct packet_ruleset_city *old;
52071 bool differ;
52072 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CITY;
52073#endif /* FREECIV_DELTA_PROTOCOL */
52074 SEND_PACKET_START(PACKET_RULESET_CITY);
52075#ifdef FREECIV_JSON_CONNECTION
52076 struct plocation field_addr;
52077 {
52078 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52079 field_addr = *field_addr_tmp;
52080 FC_FREE(field_addr_tmp);
52081 }
52082#endif /* FREECIV_JSON_CONNECTION */
52083
52084 log_packet_detailed("packet_ruleset_city_100: sending info about ()");
52085
52086#ifdef FREECIV_DELTA_PROTOCOL
52087 if (NULL == *hash) {
52088 *hash = genhash_new_full(hash_packet_ruleset_city_100, cmp_packet_ruleset_city_100,
52089 NULL, NULL, NULL, free);
52090 }
52091 BV_CLR_ALL(fields);
52092
52093 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
52094 old = fc_malloc(sizeof(*old));
52095 *old = *real_packet;
52096 genhash_insert(*hash, old, old);
52097 memset(old, 0, sizeof(*old));
52098 }
52099 differ = (old->style_id != real_packet->style_id);
52100 if (differ) {
52101 BV_SET(fields, 0);
52102 }
52103
52104 differ = (strcmp(old->name, real_packet->name) != 0);
52105 if (differ) {
52106 BV_SET(fields, 1);
52107 }
52108
52109 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
52110 if (differ) {
52111 BV_SET(fields, 2);
52112 }
52113
52114 differ = (strcmp(old->citizens_graphic, real_packet->citizens_graphic) != 0);
52115 if (differ) {
52116 BV_SET(fields, 3);
52117 }
52118
52119 differ = (old->reqs_count != real_packet->reqs_count);
52120 if (differ) {
52121 BV_SET(fields, 4);
52122 }
52123
52124 differ = (old->reqs_count != real_packet->reqs_count);
52125 if (!differ) {
52126 int i;
52127
52128 for (i = 0; i < real_packet->reqs_count; i++) {
52129 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
52130 if (differ) {
52131 break;
52132 }
52133 }
52134 }
52135 if (differ) {
52136 BV_SET(fields, 5);
52137 }
52138
52139 differ = (strcmp(old->graphic, real_packet->graphic) != 0);
52140 if (differ) {
52141 BV_SET(fields, 6);
52142 }
52143
52144 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
52145 if (differ) {
52146 BV_SET(fields, 7);
52147 }
52148
52149
52150#ifdef FREECIV_JSON_CONNECTION
52151 field_addr.name = "fields";
52152#endif /* FREECIV_JSON_CONNECTION */
52153 e = 0;
52154 e |= DIO_BV_PUT(&dout, &field_addr, fields);
52155 if (e) {
52156 log_packet_detailed("fields bitvector error detected");
52157 }
52158
52159 if (BV_ISSET(fields, 0)) {
52160 log_packet_detailed(" field 'style_id' has changed");
52161#ifdef FREECIV_JSON_CONNECTION
52162 field_addr.name = "style_id";
52163#endif /* FREECIV_JSON_CONNECTION */
52164 e = 0;
52165 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style_id);
52166 if (e) {
52167 log_packet_detailed("'style_id' field error detected");
52168 }
52169 }
52170 if (BV_ISSET(fields, 1)) {
52171 log_packet_detailed(" field 'name' has changed");
52172#ifdef FREECIV_JSON_CONNECTION
52173 field_addr.name = "name";
52174#endif /* FREECIV_JSON_CONNECTION */
52175 e = 0;
52176 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
52177 if (e) {
52178 log_packet_detailed("'name' field error detected");
52179 }
52180 }
52181 if (BV_ISSET(fields, 2)) {
52182 log_packet_detailed(" field 'rule_name' has changed");
52183#ifdef FREECIV_JSON_CONNECTION
52184 field_addr.name = "rule_name";
52185#endif /* FREECIV_JSON_CONNECTION */
52186 e = 0;
52187 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
52188 if (e) {
52189 log_packet_detailed("'rule_name' field error detected");
52190 }
52191 }
52192 if (BV_ISSET(fields, 3)) {
52193 log_packet_detailed(" field 'citizens_graphic' has changed");
52194#ifdef FREECIV_JSON_CONNECTION
52195 field_addr.name = "citizens_graphic";
52196#endif /* FREECIV_JSON_CONNECTION */
52197 e = 0;
52198 e |= DIO_PUT(string, &dout, &field_addr, real_packet->citizens_graphic);
52199 if (e) {
52200 log_packet_detailed("'citizens_graphic' field error detected");
52201 }
52202 }
52203 if (BV_ISSET(fields, 4)) {
52204 log_packet_detailed(" field 'reqs_count' has changed");
52205#ifdef FREECIV_JSON_CONNECTION
52206 field_addr.name = "reqs_count";
52207#endif /* FREECIV_JSON_CONNECTION */
52208 e = 0;
52209 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
52210 if (e) {
52211 log_packet_detailed("'reqs_count' field error detected");
52212 }
52213 }
52214 if (BV_ISSET(fields, 5)) {
52215 log_packet_detailed(" field 'reqs' has changed");
52216#ifdef FREECIV_JSON_CONNECTION
52217 field_addr.name = "reqs";
52218#endif /* FREECIV_JSON_CONNECTION */
52219 e = 0;
52220 {
52221 int i;
52222
52223#ifdef FREECIV_JSON_CONNECTION
52224 /* Create the array. */
52225 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
52226
52227 /* Enter the array. */
52228 field_addr.sub_location = plocation_elem_new(0);
52229#endif /* FREECIV_JSON_CONNECTION */
52230
52231 for (i = 0; i < real_packet->reqs_count; i++) {
52232#ifdef FREECIV_JSON_CONNECTION
52233 /* Next array element. */
52234 field_addr.sub_location->number = i;
52235#endif /* FREECIV_JSON_CONNECTION */
52236 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
52237 }
52238
52239#ifdef FREECIV_JSON_CONNECTION
52240 /* Exit array. */
52241 FC_FREE(field_addr.sub_location);
52242#endif /* FREECIV_JSON_CONNECTION */
52243 }
52244 if (e) {
52245 log_packet_detailed("'reqs' field error detected");
52246 }
52247 }
52248 if (BV_ISSET(fields, 6)) {
52249 log_packet_detailed(" field 'graphic' has changed");
52250#ifdef FREECIV_JSON_CONNECTION
52251 field_addr.name = "graphic";
52252#endif /* FREECIV_JSON_CONNECTION */
52253 e = 0;
52254 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic);
52255 if (e) {
52256 log_packet_detailed("'graphic' field error detected");
52257 }
52258 }
52259 if (BV_ISSET(fields, 7)) {
52260 log_packet_detailed(" field 'graphic_alt' has changed");
52261#ifdef FREECIV_JSON_CONNECTION
52262 field_addr.name = "graphic_alt";
52263#endif /* FREECIV_JSON_CONNECTION */
52264 e = 0;
52265 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
52266 if (e) {
52267 log_packet_detailed("'graphic_alt' field error detected");
52268 }
52269 }
52270
52271 *old = *real_packet;
52272#endif /* FREECIV_DELTA_PROTOCOL */
52273#ifndef FREECIV_DELTA_PROTOCOL
52274#ifdef FREECIV_JSON_CONNECTION
52275 field_addr.name = "style_id";
52276#endif /* FREECIV_JSON_CONNECTION */
52277 e = 0;
52278 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->style_id);
52279 if (e) {
52280 log_packet_detailed("'style_id' field error detected");
52281 }
52282#ifdef FREECIV_JSON_CONNECTION
52283 field_addr.name = "name";
52284#endif /* FREECIV_JSON_CONNECTION */
52285 e = 0;
52286 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
52287 if (e) {
52288 log_packet_detailed("'name' field error detected");
52289 }
52290#ifdef FREECIV_JSON_CONNECTION
52291 field_addr.name = "rule_name";
52292#endif /* FREECIV_JSON_CONNECTION */
52293 e = 0;
52294 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
52295 if (e) {
52296 log_packet_detailed("'rule_name' field error detected");
52297 }
52298#ifdef FREECIV_JSON_CONNECTION
52299 field_addr.name = "citizens_graphic";
52300#endif /* FREECIV_JSON_CONNECTION */
52301 e = 0;
52302 e |= DIO_PUT(string, &dout, &field_addr, real_packet->citizens_graphic);
52303 if (e) {
52304 log_packet_detailed("'citizens_graphic' field error detected");
52305 }
52306#ifdef FREECIV_JSON_CONNECTION
52307 field_addr.name = "reqs_count";
52308#endif /* FREECIV_JSON_CONNECTION */
52309 e = 0;
52310 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
52311 if (e) {
52312 log_packet_detailed("'reqs_count' field error detected");
52313 }
52314#ifdef FREECIV_JSON_CONNECTION
52315 field_addr.name = "reqs";
52316#endif /* FREECIV_JSON_CONNECTION */
52317 e = 0;
52318 {
52319 int i;
52320
52321#ifdef FREECIV_JSON_CONNECTION
52322 /* Create the array. */
52323 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
52324
52325 /* Enter the array. */
52326 field_addr.sub_location = plocation_elem_new(0);
52327#endif /* FREECIV_JSON_CONNECTION */
52328
52329 for (i = 0; i < real_packet->reqs_count; i++) {
52330#ifdef FREECIV_JSON_CONNECTION
52331 /* Next array element. */
52332 field_addr.sub_location->number = i;
52333#endif /* FREECIV_JSON_CONNECTION */
52334 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
52335 }
52336
52337#ifdef FREECIV_JSON_CONNECTION
52338 /* Exit array. */
52339 FC_FREE(field_addr.sub_location);
52340#endif /* FREECIV_JSON_CONNECTION */
52341 }
52342 if (e) {
52343 log_packet_detailed("'reqs' field error detected");
52344 }
52345#ifdef FREECIV_JSON_CONNECTION
52346 field_addr.name = "graphic";
52347#endif /* FREECIV_JSON_CONNECTION */
52348 e = 0;
52349 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic);
52350 if (e) {
52351 log_packet_detailed("'graphic' field error detected");
52352 }
52353#ifdef FREECIV_JSON_CONNECTION
52354 field_addr.name = "graphic_alt";
52355#endif /* FREECIV_JSON_CONNECTION */
52356 e = 0;
52357 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
52358 if (e) {
52359 log_packet_detailed("'graphic_alt' field error detected");
52360 }
52361
52362#endif
52363 SEND_PACKET_END(PACKET_RULESET_CITY);
52364}
52365
52366 int send_packet_ruleset_city(struct connection *pc, const struct packet_ruleset_city *packet)
52367{
52368 if (!pc->used) {
52369 log_error("WARNING: trying to send data to the closed connection %s",
52370 conn_description(pc));
52371 return -1;
52372 }
52373 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CITY].packet != NULL, -1,
52374 "Handler for PACKET_RULESET_CITY not installed");
52375 return pc->phs.handlers->send[PACKET_RULESET_CITY].packet(pc, packet);
52376}
52377
52378 void lsend_packet_ruleset_city(struct conn_list *dest, const struct packet_ruleset_city *packet)
52379{
52380 conn_list_iterate(dest, pconn) {
52381 send_packet_ruleset_city(pconn, packet);
52382 } conn_list_iterate_end;
52383}
52384
52385#ifdef FREECIV_DELTA_PROTOCOL
52386#define hash_packet_ruleset_building_100 hash_const
52387
52388#define cmp_packet_ruleset_building_100 cmp_const
52389
52390 BV_DEFINE(packet_ruleset_building_100_fields, 19);
52391#endif /* FREECIV_DELTA_PROTOCOL */
52392
52393 static struct packet_ruleset_building *receive_packet_ruleset_building_100(struct connection *pc)
52394{
52395#ifdef FREECIV_DELTA_PROTOCOL
52396 packet_ruleset_building_100_fields fields;
52397 struct packet_ruleset_building *old;
52398 struct genhash **hash = pc->phs.received + PACKET_RULESET_BUILDING;
52399#endif /* FREECIV_DELTA_PROTOCOL */
52400 RECEIVE_PACKET_START(packet_ruleset_building, real_packet);
52401#ifdef FREECIV_JSON_CONNECTION
52402 struct plocation field_addr;
52403 {
52404 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52405 field_addr = *field_addr_tmp;
52406 FC_FREE(field_addr_tmp);
52407 }
52408#endif /* FREECIV_JSON_CONNECTION */
52409
52410#ifdef FREECIV_DELTA_PROTOCOL
52411#ifdef FREECIV_JSON_CONNECTION
52412 field_addr.name = "fields";
52413#endif /* FREECIV_JSON_CONNECTION */
52414 DIO_BV_GET(&din, &field_addr, fields);
52415
52416#else /* FREECIV_DELTA_PROTOCOL */
52417#ifdef FREECIV_JSON_CONNECTION
52418 field_addr.name = "id";
52419#endif /* FREECIV_JSON_CONNECTION */
52420 {
52421 int readin;
52422
52423 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52424 RECEIVE_PACKET_FIELD_ERROR(id);
52425 }
52426 real_packet->id = readin;
52427 }
52428#ifdef FREECIV_JSON_CONNECTION
52429 field_addr.name = "genus";
52430#endif /* FREECIV_JSON_CONNECTION */
52431 {
52432 int readin;
52433
52434 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52435 RECEIVE_PACKET_FIELD_ERROR(genus);
52436 }
52437 real_packet->genus = readin;
52438 }
52439#ifdef FREECIV_JSON_CONNECTION
52440 field_addr.name = "name";
52441#endif /* FREECIV_JSON_CONNECTION */
52442 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
52443 RECEIVE_PACKET_FIELD_ERROR(name);
52444 }
52445#ifdef FREECIV_JSON_CONNECTION
52446 field_addr.name = "rule_name";
52447#endif /* FREECIV_JSON_CONNECTION */
52448 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
52449 RECEIVE_PACKET_FIELD_ERROR(rule_name);
52450 }
52451#ifdef FREECIV_JSON_CONNECTION
52452 field_addr.name = "graphic_str";
52453#endif /* FREECIV_JSON_CONNECTION */
52454 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
52455 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
52456 }
52457#ifdef FREECIV_JSON_CONNECTION
52458 field_addr.name = "graphic_alt";
52459#endif /* FREECIV_JSON_CONNECTION */
52460 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
52461 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
52462 }
52463#ifdef FREECIV_JSON_CONNECTION
52464 field_addr.name = "graphic_alt2";
52465#endif /* FREECIV_JSON_CONNECTION */
52466 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
52467 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
52468 }
52469#ifdef FREECIV_JSON_CONNECTION
52470 field_addr.name = "reqs_count";
52471#endif /* FREECIV_JSON_CONNECTION */
52472 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
52473 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
52474 }
52475#ifdef FREECIV_JSON_CONNECTION
52476 field_addr.name = "reqs";
52477#endif /* FREECIV_JSON_CONNECTION */
52478 {
52479 int i;
52480
52481#ifdef FREECIV_JSON_CONNECTION
52482 /* Enter array. */
52483 field_addr.sub_location = plocation_elem_new(0);
52484#endif /* FREECIV_JSON_CONNECTION */
52485
52486 if (real_packet->reqs_count > MAX_NUM_REQS) {
52487 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
52488 }
52489 for (i = 0; i < real_packet->reqs_count; i++) {
52490#ifdef FREECIV_JSON_CONNECTION
52491 field_addr.sub_location->number = i;
52492#endif /* FREECIV_JSON_CONNECTION */
52493 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
52494 RECEIVE_PACKET_FIELD_ERROR(reqs);
52495 }
52496 }
52497
52498#ifdef FREECIV_JSON_CONNECTION
52499 /* Exit array. */
52500 FC_FREE(field_addr.sub_location);
52501#endif /* FREECIV_JSON_CONNECTION */
52502 }
52503#ifdef FREECIV_JSON_CONNECTION
52504 field_addr.name = "obs_count";
52505#endif /* FREECIV_JSON_CONNECTION */
52506 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obs_count)) {
52507 RECEIVE_PACKET_FIELD_ERROR(obs_count);
52508 }
52509#ifdef FREECIV_JSON_CONNECTION
52510 field_addr.name = "obs_reqs";
52511#endif /* FREECIV_JSON_CONNECTION */
52512 {
52513 int i;
52514
52515#ifdef FREECIV_JSON_CONNECTION
52516 /* Enter array. */
52517 field_addr.sub_location = plocation_elem_new(0);
52518#endif /* FREECIV_JSON_CONNECTION */
52519
52520 if (real_packet->obs_count > MAX_NUM_REQS) {
52521 RECEIVE_PACKET_FIELD_ERROR(obs_reqs, ": truncation array");
52522 }
52523 for (i = 0; i < real_packet->obs_count; i++) {
52524#ifdef FREECIV_JSON_CONNECTION
52525 field_addr.sub_location->number = i;
52526#endif /* FREECIV_JSON_CONNECTION */
52527 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->obs_reqs[i])) {
52528 RECEIVE_PACKET_FIELD_ERROR(obs_reqs);
52529 }
52530 }
52531
52532#ifdef FREECIV_JSON_CONNECTION
52533 /* Exit array. */
52534 FC_FREE(field_addr.sub_location);
52535#endif /* FREECIV_JSON_CONNECTION */
52536 }
52537#ifdef FREECIV_JSON_CONNECTION
52538 field_addr.name = "build_cost";
52539#endif /* FREECIV_JSON_CONNECTION */
52540 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
52541 RECEIVE_PACKET_FIELD_ERROR(build_cost);
52542 }
52543#ifdef FREECIV_JSON_CONNECTION
52544 field_addr.name = "upkeep";
52545#endif /* FREECIV_JSON_CONNECTION */
52546 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep)) {
52547 RECEIVE_PACKET_FIELD_ERROR(upkeep);
52548 }
52549#ifdef FREECIV_JSON_CONNECTION
52550 field_addr.name = "sabotage";
52551#endif /* FREECIV_JSON_CONNECTION */
52552 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sabotage)) {
52553 RECEIVE_PACKET_FIELD_ERROR(sabotage);
52554 }
52555#ifdef FREECIV_JSON_CONNECTION
52556 field_addr.name = "flags";
52557#endif /* FREECIV_JSON_CONNECTION */
52558 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
52559 RECEIVE_PACKET_FIELD_ERROR(flags);
52560 }
52561#ifdef FREECIV_JSON_CONNECTION
52562 field_addr.name = "soundtag";
52563#endif /* FREECIV_JSON_CONNECTION */
52564 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag, sizeof(real_packet->soundtag))) {
52565 RECEIVE_PACKET_FIELD_ERROR(soundtag);
52566 }
52567#ifdef FREECIV_JSON_CONNECTION
52568 field_addr.name = "soundtag_alt";
52569#endif /* FREECIV_JSON_CONNECTION */
52570 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt, sizeof(real_packet->soundtag_alt))) {
52571 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt);
52572 }
52573#ifdef FREECIV_JSON_CONNECTION
52574 field_addr.name = "soundtag_alt2";
52575#endif /* FREECIV_JSON_CONNECTION */
52576 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt2, sizeof(real_packet->soundtag_alt2))) {
52577 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt2);
52578 }
52579#ifdef FREECIV_JSON_CONNECTION
52580 field_addr.name = "helptext";
52581#endif /* FREECIV_JSON_CONNECTION */
52582 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
52583 RECEIVE_PACKET_FIELD_ERROR(helptext);
52584 }
52585#endif
52586 log_packet_detailed("packet_ruleset_building_100: got info about ()");
52587
52588#ifdef FREECIV_DELTA_PROTOCOL
52589 if (NULL == *hash) {
52590 *hash = genhash_new_full(hash_packet_ruleset_building_100, cmp_packet_ruleset_building_100,
52591 NULL, NULL, NULL, free);
52592 }
52593
52594 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
52595 *real_packet = *old;
52596 } else {
52597 log_packet_detailed(" no old info");
52598 memset(real_packet, 0, sizeof(*real_packet));
52599 }
52600
52601 if (BV_ISSET(fields, 0)) {
52602 log_packet_detailed(" got field 'id'");
52603#ifdef FREECIV_JSON_CONNECTION
52604 field_addr.name = "id";
52605#endif /* FREECIV_JSON_CONNECTION */
52606 {
52607 int readin;
52608
52609 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52610 RECEIVE_PACKET_FIELD_ERROR(id);
52611 }
52612 real_packet->id = readin;
52613 }
52614 }
52615 if (BV_ISSET(fields, 1)) {
52616 log_packet_detailed(" got field 'genus'");
52617#ifdef FREECIV_JSON_CONNECTION
52618 field_addr.name = "genus";
52619#endif /* FREECIV_JSON_CONNECTION */
52620 {
52621 int readin;
52622
52623 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
52624 RECEIVE_PACKET_FIELD_ERROR(genus);
52625 }
52626 real_packet->genus = readin;
52627 }
52628 }
52629 if (BV_ISSET(fields, 2)) {
52630 log_packet_detailed(" got field 'name'");
52631#ifdef FREECIV_JSON_CONNECTION
52632 field_addr.name = "name";
52633#endif /* FREECIV_JSON_CONNECTION */
52634 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
52635 RECEIVE_PACKET_FIELD_ERROR(name);
52636 }
52637 }
52638 if (BV_ISSET(fields, 3)) {
52639 log_packet_detailed(" got field 'rule_name'");
52640#ifdef FREECIV_JSON_CONNECTION
52641 field_addr.name = "rule_name";
52642#endif /* FREECIV_JSON_CONNECTION */
52643 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
52644 RECEIVE_PACKET_FIELD_ERROR(rule_name);
52645 }
52646 }
52647 if (BV_ISSET(fields, 4)) {
52648 log_packet_detailed(" got field 'graphic_str'");
52649#ifdef FREECIV_JSON_CONNECTION
52650 field_addr.name = "graphic_str";
52651#endif /* FREECIV_JSON_CONNECTION */
52652 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
52653 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
52654 }
52655 }
52656 if (BV_ISSET(fields, 5)) {
52657 log_packet_detailed(" got field 'graphic_alt'");
52658#ifdef FREECIV_JSON_CONNECTION
52659 field_addr.name = "graphic_alt";
52660#endif /* FREECIV_JSON_CONNECTION */
52661 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
52662 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
52663 }
52664 }
52665 if (BV_ISSET(fields, 6)) {
52666 log_packet_detailed(" got field 'graphic_alt2'");
52667#ifdef FREECIV_JSON_CONNECTION
52668 field_addr.name = "graphic_alt2";
52669#endif /* FREECIV_JSON_CONNECTION */
52670 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
52671 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
52672 }
52673 }
52674 if (BV_ISSET(fields, 7)) {
52675 log_packet_detailed(" got field 'reqs_count'");
52676#ifdef FREECIV_JSON_CONNECTION
52677 field_addr.name = "reqs_count";
52678#endif /* FREECIV_JSON_CONNECTION */
52679 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
52680 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
52681 }
52682 }
52683 if (BV_ISSET(fields, 8)) {
52684 log_packet_detailed(" got field 'reqs'");
52685#ifdef FREECIV_JSON_CONNECTION
52686 field_addr.name = "reqs";
52687#endif /* FREECIV_JSON_CONNECTION */
52688 {
52689 int i;
52690
52691#ifdef FREECIV_JSON_CONNECTION
52692 /* Enter array. */
52693 field_addr.sub_location = plocation_elem_new(0);
52694#endif /* FREECIV_JSON_CONNECTION */
52695
52696 if (real_packet->reqs_count > MAX_NUM_REQS) {
52697 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
52698 }
52699 for (i = 0; i < real_packet->reqs_count; i++) {
52700#ifdef FREECIV_JSON_CONNECTION
52701 field_addr.sub_location->number = i;
52702#endif /* FREECIV_JSON_CONNECTION */
52703 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
52704 RECEIVE_PACKET_FIELD_ERROR(reqs);
52705 }
52706 }
52707
52708#ifdef FREECIV_JSON_CONNECTION
52709 /* Exit array. */
52710 FC_FREE(field_addr.sub_location);
52711#endif /* FREECIV_JSON_CONNECTION */
52712 }
52713 }
52714 if (BV_ISSET(fields, 9)) {
52715 log_packet_detailed(" got field 'obs_count'");
52716#ifdef FREECIV_JSON_CONNECTION
52717 field_addr.name = "obs_count";
52718#endif /* FREECIV_JSON_CONNECTION */
52719 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->obs_count)) {
52720 RECEIVE_PACKET_FIELD_ERROR(obs_count);
52721 }
52722 }
52723 if (BV_ISSET(fields, 10)) {
52724 log_packet_detailed(" got field 'obs_reqs'");
52725#ifdef FREECIV_JSON_CONNECTION
52726 field_addr.name = "obs_reqs";
52727#endif /* FREECIV_JSON_CONNECTION */
52728 {
52729 int i;
52730
52731#ifdef FREECIV_JSON_CONNECTION
52732 /* Enter array. */
52733 field_addr.sub_location = plocation_elem_new(0);
52734#endif /* FREECIV_JSON_CONNECTION */
52735
52736 if (real_packet->obs_count > MAX_NUM_REQS) {
52737 RECEIVE_PACKET_FIELD_ERROR(obs_reqs, ": truncation array");
52738 }
52739 for (i = 0; i < real_packet->obs_count; i++) {
52740#ifdef FREECIV_JSON_CONNECTION
52741 field_addr.sub_location->number = i;
52742#endif /* FREECIV_JSON_CONNECTION */
52743 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->obs_reqs[i])) {
52744 RECEIVE_PACKET_FIELD_ERROR(obs_reqs);
52745 }
52746 }
52747
52748#ifdef FREECIV_JSON_CONNECTION
52749 /* Exit array. */
52750 FC_FREE(field_addr.sub_location);
52751#endif /* FREECIV_JSON_CONNECTION */
52752 }
52753 }
52754 if (BV_ISSET(fields, 11)) {
52755 log_packet_detailed(" got field 'build_cost'");
52756#ifdef FREECIV_JSON_CONNECTION
52757 field_addr.name = "build_cost";
52758#endif /* FREECIV_JSON_CONNECTION */
52759 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->build_cost)) {
52760 RECEIVE_PACKET_FIELD_ERROR(build_cost);
52761 }
52762 }
52763 if (BV_ISSET(fields, 12)) {
52764 log_packet_detailed(" got field 'upkeep'");
52765#ifdef FREECIV_JSON_CONNECTION
52766 field_addr.name = "upkeep";
52767#endif /* FREECIV_JSON_CONNECTION */
52768 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->upkeep)) {
52769 RECEIVE_PACKET_FIELD_ERROR(upkeep);
52770 }
52771 }
52772 if (BV_ISSET(fields, 13)) {
52773 log_packet_detailed(" got field 'sabotage'");
52774#ifdef FREECIV_JSON_CONNECTION
52775 field_addr.name = "sabotage";
52776#endif /* FREECIV_JSON_CONNECTION */
52777 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->sabotage)) {
52778 RECEIVE_PACKET_FIELD_ERROR(sabotage);
52779 }
52780 }
52781 if (BV_ISSET(fields, 14)) {
52782 log_packet_detailed(" got field 'flags'");
52783#ifdef FREECIV_JSON_CONNECTION
52784 field_addr.name = "flags";
52785#endif /* FREECIV_JSON_CONNECTION */
52786 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
52787 RECEIVE_PACKET_FIELD_ERROR(flags);
52788 }
52789 }
52790 if (BV_ISSET(fields, 15)) {
52791 log_packet_detailed(" got field 'soundtag'");
52792#ifdef FREECIV_JSON_CONNECTION
52793 field_addr.name = "soundtag";
52794#endif /* FREECIV_JSON_CONNECTION */
52795 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag, sizeof(real_packet->soundtag))) {
52796 RECEIVE_PACKET_FIELD_ERROR(soundtag);
52797 }
52798 }
52799 if (BV_ISSET(fields, 16)) {
52800 log_packet_detailed(" got field 'soundtag_alt'");
52801#ifdef FREECIV_JSON_CONNECTION
52802 field_addr.name = "soundtag_alt";
52803#endif /* FREECIV_JSON_CONNECTION */
52804 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt, sizeof(real_packet->soundtag_alt))) {
52805 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt);
52806 }
52807 }
52808 if (BV_ISSET(fields, 17)) {
52809 log_packet_detailed(" got field 'soundtag_alt2'");
52810#ifdef FREECIV_JSON_CONNECTION
52811 field_addr.name = "soundtag_alt2";
52812#endif /* FREECIV_JSON_CONNECTION */
52813 if (!DIO_GET(string, &din, &field_addr, real_packet->soundtag_alt2, sizeof(real_packet->soundtag_alt2))) {
52814 RECEIVE_PACKET_FIELD_ERROR(soundtag_alt2);
52815 }
52816 }
52817 if (BV_ISSET(fields, 18)) {
52818 log_packet_detailed(" got field 'helptext'");
52819#ifdef FREECIV_JSON_CONNECTION
52820 field_addr.name = "helptext";
52821#endif /* FREECIV_JSON_CONNECTION */
52822 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
52823 RECEIVE_PACKET_FIELD_ERROR(helptext);
52824 }
52825 }
52826
52827 if (NULL == old) {
52828 old = fc_malloc(sizeof(*old));
52829 *old = *real_packet;
52830 genhash_insert(*hash, old, old);
52831 } else {
52832 *old = *real_packet;
52833 }
52834
52835#endif /* FREECIV_DELTA_PROTOCOL */
52836 RECEIVE_PACKET_END(real_packet);
52837}
52838
52839 static int send_packet_ruleset_building_100(struct connection *pc, const struct packet_ruleset_building *packet)
52840{
52841 const struct packet_ruleset_building *real_packet = packet;
52842 int e;
52843#ifdef FREECIV_DELTA_PROTOCOL
52844 packet_ruleset_building_100_fields fields;
52845 struct packet_ruleset_building *old;
52846 bool differ;
52847 struct genhash **hash = pc->phs.sent + PACKET_RULESET_BUILDING;
52848#endif /* FREECIV_DELTA_PROTOCOL */
52849 SEND_PACKET_START(PACKET_RULESET_BUILDING);
52850#ifdef FREECIV_JSON_CONNECTION
52851 struct plocation field_addr;
52852 {
52853 struct plocation *field_addr_tmp = plocation_field_new(NULL);
52854 field_addr = *field_addr_tmp;
52855 FC_FREE(field_addr_tmp);
52856 }
52857#endif /* FREECIV_JSON_CONNECTION */
52858
52859 log_packet_detailed("packet_ruleset_building_100: sending info about ()");
52860
52861#ifdef FREECIV_DELTA_PROTOCOL
52862 if (NULL == *hash) {
52863 *hash = genhash_new_full(hash_packet_ruleset_building_100, cmp_packet_ruleset_building_100,
52864 NULL, NULL, NULL, free);
52865 }
52866 BV_CLR_ALL(fields);
52867
52868 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
52869 old = fc_malloc(sizeof(*old));
52870 *old = *real_packet;
52871 genhash_insert(*hash, old, old);
52872 memset(old, 0, sizeof(*old));
52873 }
52874 differ = (old->id != real_packet->id);
52875 if (differ) {
52876 BV_SET(fields, 0);
52877 }
52878
52879 differ = (old->genus != real_packet->genus);
52880 if (differ) {
52881 BV_SET(fields, 1);
52882 }
52883
52884 differ = (strcmp(old->name, real_packet->name) != 0);
52885 if (differ) {
52886 BV_SET(fields, 2);
52887 }
52888
52889 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
52890 if (differ) {
52891 BV_SET(fields, 3);
52892 }
52893
52894 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
52895 if (differ) {
52896 BV_SET(fields, 4);
52897 }
52898
52899 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
52900 if (differ) {
52901 BV_SET(fields, 5);
52902 }
52903
52904 differ = (strcmp(old->graphic_alt2, real_packet->graphic_alt2) != 0);
52905 if (differ) {
52906 BV_SET(fields, 6);
52907 }
52908
52909 differ = (old->reqs_count != real_packet->reqs_count);
52910 if (differ) {
52911 BV_SET(fields, 7);
52912 }
52913
52914 differ = (old->reqs_count != real_packet->reqs_count);
52915 if (!differ) {
52916 int i;
52917
52918 for (i = 0; i < real_packet->reqs_count; i++) {
52919 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
52920 if (differ) {
52921 break;
52922 }
52923 }
52924 }
52925 if (differ) {
52926 BV_SET(fields, 8);
52927 }
52928
52929 differ = (old->obs_count != real_packet->obs_count);
52930 if (differ) {
52931 BV_SET(fields, 9);
52932 }
52933
52934 differ = (old->obs_count != real_packet->obs_count);
52935 if (!differ) {
52936 int i;
52937
52938 for (i = 0; i < real_packet->obs_count; i++) {
52939 differ = !are_requirements_equal(&old->obs_reqs[i], &real_packet->obs_reqs[i]);
52940 if (differ) {
52941 break;
52942 }
52943 }
52944 }
52945 if (differ) {
52946 BV_SET(fields, 10);
52947 }
52948
52949 differ = (old->build_cost != real_packet->build_cost);
52950 if (differ) {
52951 BV_SET(fields, 11);
52952 }
52953
52954 differ = (old->upkeep != real_packet->upkeep);
52955 if (differ) {
52956 BV_SET(fields, 12);
52957 }
52958
52959 differ = (old->sabotage != real_packet->sabotage);
52960 if (differ) {
52961 BV_SET(fields, 13);
52962 }
52963
52964 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
52965 if (differ) {
52966 BV_SET(fields, 14);
52967 }
52968
52969 differ = (strcmp(old->soundtag, real_packet->soundtag) != 0);
52970 if (differ) {
52971 BV_SET(fields, 15);
52972 }
52973
52974 differ = (strcmp(old->soundtag_alt, real_packet->soundtag_alt) != 0);
52975 if (differ) {
52976 BV_SET(fields, 16);
52977 }
52978
52979 differ = (strcmp(old->soundtag_alt2, real_packet->soundtag_alt2) != 0);
52980 if (differ) {
52981 BV_SET(fields, 17);
52982 }
52983
52984 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
52985 if (differ) {
52986 BV_SET(fields, 18);
52987 }
52988
52989
52990#ifdef FREECIV_JSON_CONNECTION
52991 field_addr.name = "fields";
52992#endif /* FREECIV_JSON_CONNECTION */
52993 e = 0;
52994 e |= DIO_BV_PUT(&dout, &field_addr, fields);
52995 if (e) {
52996 log_packet_detailed("fields bitvector error detected");
52997 }
52998
52999 if (BV_ISSET(fields, 0)) {
53000 log_packet_detailed(" field 'id' has changed");
53001#ifdef FREECIV_JSON_CONNECTION
53002 field_addr.name = "id";
53003#endif /* FREECIV_JSON_CONNECTION */
53004 e = 0;
53005 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
53006 if (e) {
53007 log_packet_detailed("'id' field error detected");
53008 }
53009 }
53010 if (BV_ISSET(fields, 1)) {
53011 log_packet_detailed(" field 'genus' has changed");
53012#ifdef FREECIV_JSON_CONNECTION
53013 field_addr.name = "genus";
53014#endif /* FREECIV_JSON_CONNECTION */
53015 e = 0;
53016 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->genus);
53017 if (e) {
53018 log_packet_detailed("'genus' field error detected");
53019 }
53020 }
53021 if (BV_ISSET(fields, 2)) {
53022 log_packet_detailed(" field 'name' has changed");
53023#ifdef FREECIV_JSON_CONNECTION
53024 field_addr.name = "name";
53025#endif /* FREECIV_JSON_CONNECTION */
53026 e = 0;
53027 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
53028 if (e) {
53029 log_packet_detailed("'name' field error detected");
53030 }
53031 }
53032 if (BV_ISSET(fields, 3)) {
53033 log_packet_detailed(" field 'rule_name' has changed");
53034#ifdef FREECIV_JSON_CONNECTION
53035 field_addr.name = "rule_name";
53036#endif /* FREECIV_JSON_CONNECTION */
53037 e = 0;
53038 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
53039 if (e) {
53040 log_packet_detailed("'rule_name' field error detected");
53041 }
53042 }
53043 if (BV_ISSET(fields, 4)) {
53044 log_packet_detailed(" field 'graphic_str' has changed");
53045#ifdef FREECIV_JSON_CONNECTION
53046 field_addr.name = "graphic_str";
53047#endif /* FREECIV_JSON_CONNECTION */
53048 e = 0;
53049 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
53050 if (e) {
53051 log_packet_detailed("'graphic_str' field error detected");
53052 }
53053 }
53054 if (BV_ISSET(fields, 5)) {
53055 log_packet_detailed(" field 'graphic_alt' has changed");
53056#ifdef FREECIV_JSON_CONNECTION
53057 field_addr.name = "graphic_alt";
53058#endif /* FREECIV_JSON_CONNECTION */
53059 e = 0;
53060 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
53061 if (e) {
53062 log_packet_detailed("'graphic_alt' field error detected");
53063 }
53064 }
53065 if (BV_ISSET(fields, 6)) {
53066 log_packet_detailed(" field 'graphic_alt2' has changed");
53067#ifdef FREECIV_JSON_CONNECTION
53068 field_addr.name = "graphic_alt2";
53069#endif /* FREECIV_JSON_CONNECTION */
53070 e = 0;
53071 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
53072 if (e) {
53073 log_packet_detailed("'graphic_alt2' field error detected");
53074 }
53075 }
53076 if (BV_ISSET(fields, 7)) {
53077 log_packet_detailed(" field 'reqs_count' has changed");
53078#ifdef FREECIV_JSON_CONNECTION
53079 field_addr.name = "reqs_count";
53080#endif /* FREECIV_JSON_CONNECTION */
53081 e = 0;
53082 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
53083 if (e) {
53084 log_packet_detailed("'reqs_count' field error detected");
53085 }
53086 }
53087 if (BV_ISSET(fields, 8)) {
53088 log_packet_detailed(" field 'reqs' has changed");
53089#ifdef FREECIV_JSON_CONNECTION
53090 field_addr.name = "reqs";
53091#endif /* FREECIV_JSON_CONNECTION */
53092 e = 0;
53093 {
53094 int i;
53095
53096#ifdef FREECIV_JSON_CONNECTION
53097 /* Create the array. */
53098 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
53099
53100 /* Enter the array. */
53101 field_addr.sub_location = plocation_elem_new(0);
53102#endif /* FREECIV_JSON_CONNECTION */
53103
53104 for (i = 0; i < real_packet->reqs_count; i++) {
53105#ifdef FREECIV_JSON_CONNECTION
53106 /* Next array element. */
53107 field_addr.sub_location->number = i;
53108#endif /* FREECIV_JSON_CONNECTION */
53109 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
53110 }
53111
53112#ifdef FREECIV_JSON_CONNECTION
53113 /* Exit array. */
53114 FC_FREE(field_addr.sub_location);
53115#endif /* FREECIV_JSON_CONNECTION */
53116 }
53117 if (e) {
53118 log_packet_detailed("'reqs' field error detected");
53119 }
53120 }
53121 if (BV_ISSET(fields, 9)) {
53122 log_packet_detailed(" field 'obs_count' has changed");
53123#ifdef FREECIV_JSON_CONNECTION
53124 field_addr.name = "obs_count";
53125#endif /* FREECIV_JSON_CONNECTION */
53126 e = 0;
53127 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obs_count);
53128 if (e) {
53129 log_packet_detailed("'obs_count' field error detected");
53130 }
53131 }
53132 if (BV_ISSET(fields, 10)) {
53133 log_packet_detailed(" field 'obs_reqs' has changed");
53134#ifdef FREECIV_JSON_CONNECTION
53135 field_addr.name = "obs_reqs";
53136#endif /* FREECIV_JSON_CONNECTION */
53137 e = 0;
53138 {
53139 int i;
53140
53141#ifdef FREECIV_JSON_CONNECTION
53142 /* Create the array. */
53143 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->obs_count);
53144
53145 /* Enter the array. */
53146 field_addr.sub_location = plocation_elem_new(0);
53147#endif /* FREECIV_JSON_CONNECTION */
53148
53149 for (i = 0; i < real_packet->obs_count; i++) {
53150#ifdef FREECIV_JSON_CONNECTION
53151 /* Next array element. */
53152 field_addr.sub_location->number = i;
53153#endif /* FREECIV_JSON_CONNECTION */
53154 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->obs_reqs[i]);
53155 }
53156
53157#ifdef FREECIV_JSON_CONNECTION
53158 /* Exit array. */
53159 FC_FREE(field_addr.sub_location);
53160#endif /* FREECIV_JSON_CONNECTION */
53161 }
53162 if (e) {
53163 log_packet_detailed("'obs_reqs' field error detected");
53164 }
53165 }
53166 if (BV_ISSET(fields, 11)) {
53167 log_packet_detailed(" field 'build_cost' has changed");
53168#ifdef FREECIV_JSON_CONNECTION
53169 field_addr.name = "build_cost";
53170#endif /* FREECIV_JSON_CONNECTION */
53171 e = 0;
53172 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
53173 if (e) {
53174 log_packet_detailed("'build_cost' field error detected");
53175 }
53176 }
53177 if (BV_ISSET(fields, 12)) {
53178 log_packet_detailed(" field 'upkeep' has changed");
53179#ifdef FREECIV_JSON_CONNECTION
53180 field_addr.name = "upkeep";
53181#endif /* FREECIV_JSON_CONNECTION */
53182 e = 0;
53183 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep);
53184 if (e) {
53185 log_packet_detailed("'upkeep' field error detected");
53186 }
53187 }
53188 if (BV_ISSET(fields, 13)) {
53189 log_packet_detailed(" field 'sabotage' has changed");
53190#ifdef FREECIV_JSON_CONNECTION
53191 field_addr.name = "sabotage";
53192#endif /* FREECIV_JSON_CONNECTION */
53193 e = 0;
53194 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sabotage);
53195 if (e) {
53196 log_packet_detailed("'sabotage' field error detected");
53197 }
53198 }
53199 if (BV_ISSET(fields, 14)) {
53200 log_packet_detailed(" field 'flags' has changed");
53201#ifdef FREECIV_JSON_CONNECTION
53202 field_addr.name = "flags";
53203#endif /* FREECIV_JSON_CONNECTION */
53204 e = 0;
53205 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
53206 if (e) {
53207 log_packet_detailed("'flags' field error detected");
53208 }
53209 }
53210 if (BV_ISSET(fields, 15)) {
53211 log_packet_detailed(" field 'soundtag' has changed");
53212#ifdef FREECIV_JSON_CONNECTION
53213 field_addr.name = "soundtag";
53214#endif /* FREECIV_JSON_CONNECTION */
53215 e = 0;
53216 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag);
53217 if (e) {
53218 log_packet_detailed("'soundtag' field error detected");
53219 }
53220 }
53221 if (BV_ISSET(fields, 16)) {
53222 log_packet_detailed(" field 'soundtag_alt' has changed");
53223#ifdef FREECIV_JSON_CONNECTION
53224 field_addr.name = "soundtag_alt";
53225#endif /* FREECIV_JSON_CONNECTION */
53226 e = 0;
53227 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt);
53228 if (e) {
53229 log_packet_detailed("'soundtag_alt' field error detected");
53230 }
53231 }
53232 if (BV_ISSET(fields, 17)) {
53233 log_packet_detailed(" field 'soundtag_alt2' has changed");
53234#ifdef FREECIV_JSON_CONNECTION
53235 field_addr.name = "soundtag_alt2";
53236#endif /* FREECIV_JSON_CONNECTION */
53237 e = 0;
53238 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt2);
53239 if (e) {
53240 log_packet_detailed("'soundtag_alt2' field error detected");
53241 }
53242 }
53243 if (BV_ISSET(fields, 18)) {
53244 log_packet_detailed(" field 'helptext' has changed");
53245#ifdef FREECIV_JSON_CONNECTION
53246 field_addr.name = "helptext";
53247#endif /* FREECIV_JSON_CONNECTION */
53248 e = 0;
53249 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
53250 if (e) {
53251 log_packet_detailed("'helptext' field error detected");
53252 }
53253 }
53254
53255 *old = *real_packet;
53256#endif /* FREECIV_DELTA_PROTOCOL */
53257#ifndef FREECIV_DELTA_PROTOCOL
53258#ifdef FREECIV_JSON_CONNECTION
53259 field_addr.name = "id";
53260#endif /* FREECIV_JSON_CONNECTION */
53261 e = 0;
53262 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
53263 if (e) {
53264 log_packet_detailed("'id' field error detected");
53265 }
53266#ifdef FREECIV_JSON_CONNECTION
53267 field_addr.name = "genus";
53268#endif /* FREECIV_JSON_CONNECTION */
53269 e = 0;
53270 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->genus);
53271 if (e) {
53272 log_packet_detailed("'genus' field error detected");
53273 }
53274#ifdef FREECIV_JSON_CONNECTION
53275 field_addr.name = "name";
53276#endif /* FREECIV_JSON_CONNECTION */
53277 e = 0;
53278 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
53279 if (e) {
53280 log_packet_detailed("'name' field error detected");
53281 }
53282#ifdef FREECIV_JSON_CONNECTION
53283 field_addr.name = "rule_name";
53284#endif /* FREECIV_JSON_CONNECTION */
53285 e = 0;
53286 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
53287 if (e) {
53288 log_packet_detailed("'rule_name' field error detected");
53289 }
53290#ifdef FREECIV_JSON_CONNECTION
53291 field_addr.name = "graphic_str";
53292#endif /* FREECIV_JSON_CONNECTION */
53293 e = 0;
53294 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
53295 if (e) {
53296 log_packet_detailed("'graphic_str' field error detected");
53297 }
53298#ifdef FREECIV_JSON_CONNECTION
53299 field_addr.name = "graphic_alt";
53300#endif /* FREECIV_JSON_CONNECTION */
53301 e = 0;
53302 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
53303 if (e) {
53304 log_packet_detailed("'graphic_alt' field error detected");
53305 }
53306#ifdef FREECIV_JSON_CONNECTION
53307 field_addr.name = "graphic_alt2";
53308#endif /* FREECIV_JSON_CONNECTION */
53309 e = 0;
53310 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
53311 if (e) {
53312 log_packet_detailed("'graphic_alt2' field error detected");
53313 }
53314#ifdef FREECIV_JSON_CONNECTION
53315 field_addr.name = "reqs_count";
53316#endif /* FREECIV_JSON_CONNECTION */
53317 e = 0;
53318 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
53319 if (e) {
53320 log_packet_detailed("'reqs_count' field error detected");
53321 }
53322#ifdef FREECIV_JSON_CONNECTION
53323 field_addr.name = "reqs";
53324#endif /* FREECIV_JSON_CONNECTION */
53325 e = 0;
53326 {
53327 int i;
53328
53329#ifdef FREECIV_JSON_CONNECTION
53330 /* Create the array. */
53331 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
53332
53333 /* Enter the array. */
53334 field_addr.sub_location = plocation_elem_new(0);
53335#endif /* FREECIV_JSON_CONNECTION */
53336
53337 for (i = 0; i < real_packet->reqs_count; i++) {
53338#ifdef FREECIV_JSON_CONNECTION
53339 /* Next array element. */
53340 field_addr.sub_location->number = i;
53341#endif /* FREECIV_JSON_CONNECTION */
53342 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
53343 }
53344
53345#ifdef FREECIV_JSON_CONNECTION
53346 /* Exit array. */
53347 FC_FREE(field_addr.sub_location);
53348#endif /* FREECIV_JSON_CONNECTION */
53349 }
53350 if (e) {
53351 log_packet_detailed("'reqs' field error detected");
53352 }
53353#ifdef FREECIV_JSON_CONNECTION
53354 field_addr.name = "obs_count";
53355#endif /* FREECIV_JSON_CONNECTION */
53356 e = 0;
53357 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->obs_count);
53358 if (e) {
53359 log_packet_detailed("'obs_count' field error detected");
53360 }
53361#ifdef FREECIV_JSON_CONNECTION
53362 field_addr.name = "obs_reqs";
53363#endif /* FREECIV_JSON_CONNECTION */
53364 e = 0;
53365 {
53366 int i;
53367
53368#ifdef FREECIV_JSON_CONNECTION
53369 /* Create the array. */
53370 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->obs_count);
53371
53372 /* Enter the array. */
53373 field_addr.sub_location = plocation_elem_new(0);
53374#endif /* FREECIV_JSON_CONNECTION */
53375
53376 for (i = 0; i < real_packet->obs_count; i++) {
53377#ifdef FREECIV_JSON_CONNECTION
53378 /* Next array element. */
53379 field_addr.sub_location->number = i;
53380#endif /* FREECIV_JSON_CONNECTION */
53381 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->obs_reqs[i]);
53382 }
53383
53384#ifdef FREECIV_JSON_CONNECTION
53385 /* Exit array. */
53386 FC_FREE(field_addr.sub_location);
53387#endif /* FREECIV_JSON_CONNECTION */
53388 }
53389 if (e) {
53390 log_packet_detailed("'obs_reqs' field error detected");
53391 }
53392#ifdef FREECIV_JSON_CONNECTION
53393 field_addr.name = "build_cost";
53394#endif /* FREECIV_JSON_CONNECTION */
53395 e = 0;
53396 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->build_cost);
53397 if (e) {
53398 log_packet_detailed("'build_cost' field error detected");
53399 }
53400#ifdef FREECIV_JSON_CONNECTION
53401 field_addr.name = "upkeep";
53402#endif /* FREECIV_JSON_CONNECTION */
53403 e = 0;
53404 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->upkeep);
53405 if (e) {
53406 log_packet_detailed("'upkeep' field error detected");
53407 }
53408#ifdef FREECIV_JSON_CONNECTION
53409 field_addr.name = "sabotage";
53410#endif /* FREECIV_JSON_CONNECTION */
53411 e = 0;
53412 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sabotage);
53413 if (e) {
53414 log_packet_detailed("'sabotage' field error detected");
53415 }
53416#ifdef FREECIV_JSON_CONNECTION
53417 field_addr.name = "flags";
53418#endif /* FREECIV_JSON_CONNECTION */
53419 e = 0;
53420 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
53421 if (e) {
53422 log_packet_detailed("'flags' field error detected");
53423 }
53424#ifdef FREECIV_JSON_CONNECTION
53425 field_addr.name = "soundtag";
53426#endif /* FREECIV_JSON_CONNECTION */
53427 e = 0;
53428 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag);
53429 if (e) {
53430 log_packet_detailed("'soundtag' field error detected");
53431 }
53432#ifdef FREECIV_JSON_CONNECTION
53433 field_addr.name = "soundtag_alt";
53434#endif /* FREECIV_JSON_CONNECTION */
53435 e = 0;
53436 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt);
53437 if (e) {
53438 log_packet_detailed("'soundtag_alt' field error detected");
53439 }
53440#ifdef FREECIV_JSON_CONNECTION
53441 field_addr.name = "soundtag_alt2";
53442#endif /* FREECIV_JSON_CONNECTION */
53443 e = 0;
53444 e |= DIO_PUT(string, &dout, &field_addr, real_packet->soundtag_alt2);
53445 if (e) {
53446 log_packet_detailed("'soundtag_alt2' field error detected");
53447 }
53448#ifdef FREECIV_JSON_CONNECTION
53449 field_addr.name = "helptext";
53450#endif /* FREECIV_JSON_CONNECTION */
53451 e = 0;
53452 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
53453 if (e) {
53454 log_packet_detailed("'helptext' field error detected");
53455 }
53456
53457#endif
53458 SEND_PACKET_END(PACKET_RULESET_BUILDING);
53459}
53460
53461 int send_packet_ruleset_building(struct connection *pc, const struct packet_ruleset_building *packet)
53462{
53463 if (!pc->used) {
53464 log_error("WARNING: trying to send data to the closed connection %s",
53465 conn_description(pc));
53466 return -1;
53467 }
53468 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_BUILDING].packet != NULL, -1,
53469 "Handler for PACKET_RULESET_BUILDING not installed");
53470 return pc->phs.handlers->send[PACKET_RULESET_BUILDING].packet(pc, packet);
53471}
53472
53473 void lsend_packet_ruleset_building(struct conn_list *dest, const struct packet_ruleset_building *packet)
53474{
53475 conn_list_iterate(dest, pconn) {
53476 send_packet_ruleset_building(pconn, packet);
53477 } conn_list_iterate_end;
53478}
53479
53480#ifdef FREECIV_DELTA_PROTOCOL
53481#define hash_packet_ruleset_impr_flag_100 hash_const
53482
53483#define cmp_packet_ruleset_impr_flag_100 cmp_const
53484
53485 BV_DEFINE(packet_ruleset_impr_flag_100_fields, 3);
53486#endif /* FREECIV_DELTA_PROTOCOL */
53487
53488 static struct packet_ruleset_impr_flag *receive_packet_ruleset_impr_flag_100(struct connection *pc)
53489{
53490#ifdef FREECIV_DELTA_PROTOCOL
53491 packet_ruleset_impr_flag_100_fields fields;
53492 struct packet_ruleset_impr_flag *old;
53493 struct genhash **hash = pc->phs.received + PACKET_RULESET_IMPR_FLAG;
53494#endif /* FREECIV_DELTA_PROTOCOL */
53495 RECEIVE_PACKET_START(packet_ruleset_impr_flag, real_packet);
53496#ifdef FREECIV_JSON_CONNECTION
53497 struct plocation field_addr;
53498 {
53499 struct plocation *field_addr_tmp = plocation_field_new(NULL);
53500 field_addr = *field_addr_tmp;
53501 FC_FREE(field_addr_tmp);
53502 }
53503#endif /* FREECIV_JSON_CONNECTION */
53504
53505#ifdef FREECIV_DELTA_PROTOCOL
53506#ifdef FREECIV_JSON_CONNECTION
53507 field_addr.name = "fields";
53508#endif /* FREECIV_JSON_CONNECTION */
53509 DIO_BV_GET(&din, &field_addr, fields);
53510
53511#else /* FREECIV_DELTA_PROTOCOL */
53512#ifdef FREECIV_JSON_CONNECTION
53513 field_addr.name = "id";
53514#endif /* FREECIV_JSON_CONNECTION */
53515 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
53516 RECEIVE_PACKET_FIELD_ERROR(id);
53517 }
53518#ifdef FREECIV_JSON_CONNECTION
53519 field_addr.name = "name";
53520#endif /* FREECIV_JSON_CONNECTION */
53521 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
53522 RECEIVE_PACKET_FIELD_ERROR(name);
53523 }
53524#ifdef FREECIV_JSON_CONNECTION
53525 field_addr.name = "helptxt";
53526#endif /* FREECIV_JSON_CONNECTION */
53527 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
53528 RECEIVE_PACKET_FIELD_ERROR(helptxt);
53529 }
53530#endif
53531 log_packet_detailed("packet_ruleset_impr_flag_100: got info about ()");
53532
53533#ifdef FREECIV_DELTA_PROTOCOL
53534 if (NULL == *hash) {
53535 *hash = genhash_new_full(hash_packet_ruleset_impr_flag_100, cmp_packet_ruleset_impr_flag_100,
53536 NULL, NULL, NULL, free);
53537 }
53538
53539 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
53540 *real_packet = *old;
53541 } else {
53542 log_packet_detailed(" no old info");
53543 memset(real_packet, 0, sizeof(*real_packet));
53544 }
53545
53546 if (BV_ISSET(fields, 0)) {
53547 log_packet_detailed(" got field 'id'");
53548#ifdef FREECIV_JSON_CONNECTION
53549 field_addr.name = "id";
53550#endif /* FREECIV_JSON_CONNECTION */
53551 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
53552 RECEIVE_PACKET_FIELD_ERROR(id);
53553 }
53554 }
53555 if (BV_ISSET(fields, 1)) {
53556 log_packet_detailed(" got field 'name'");
53557#ifdef FREECIV_JSON_CONNECTION
53558 field_addr.name = "name";
53559#endif /* FREECIV_JSON_CONNECTION */
53560 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
53561 RECEIVE_PACKET_FIELD_ERROR(name);
53562 }
53563 }
53564 if (BV_ISSET(fields, 2)) {
53565 log_packet_detailed(" got field 'helptxt'");
53566#ifdef FREECIV_JSON_CONNECTION
53567 field_addr.name = "helptxt";
53568#endif /* FREECIV_JSON_CONNECTION */
53569 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
53570 RECEIVE_PACKET_FIELD_ERROR(helptxt);
53571 }
53572 }
53573
53574 if (NULL == old) {
53575 old = fc_malloc(sizeof(*old));
53576 *old = *real_packet;
53577 genhash_insert(*hash, old, old);
53578 } else {
53579 *old = *real_packet;
53580 }
53581
53582#endif /* FREECIV_DELTA_PROTOCOL */
53583 RECEIVE_PACKET_END(real_packet);
53584}
53585
53586 static int send_packet_ruleset_impr_flag_100(struct connection *pc, const struct packet_ruleset_impr_flag *packet)
53587{
53588 const struct packet_ruleset_impr_flag *real_packet = packet;
53589 int e;
53590#ifdef FREECIV_DELTA_PROTOCOL
53591 packet_ruleset_impr_flag_100_fields fields;
53592 struct packet_ruleset_impr_flag *old;
53593 bool differ;
53594 struct genhash **hash = pc->phs.sent + PACKET_RULESET_IMPR_FLAG;
53595#endif /* FREECIV_DELTA_PROTOCOL */
53596 SEND_PACKET_START(PACKET_RULESET_IMPR_FLAG);
53597#ifdef FREECIV_JSON_CONNECTION
53598 struct plocation field_addr;
53599 {
53600 struct plocation *field_addr_tmp = plocation_field_new(NULL);
53601 field_addr = *field_addr_tmp;
53602 FC_FREE(field_addr_tmp);
53603 }
53604#endif /* FREECIV_JSON_CONNECTION */
53605
53606 log_packet_detailed("packet_ruleset_impr_flag_100: sending info about ()");
53607
53608#ifdef FREECIV_DELTA_PROTOCOL
53609 if (NULL == *hash) {
53610 *hash = genhash_new_full(hash_packet_ruleset_impr_flag_100, cmp_packet_ruleset_impr_flag_100,
53611 NULL, NULL, NULL, free);
53612 }
53613 BV_CLR_ALL(fields);
53614
53615 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
53616 old = fc_malloc(sizeof(*old));
53617 *old = *real_packet;
53618 genhash_insert(*hash, old, old);
53619 memset(old, 0, sizeof(*old));
53620 }
53621 differ = (old->id != real_packet->id);
53622 if (differ) {
53623 BV_SET(fields, 0);
53624 }
53625
53626 differ = (strcmp(old->name, real_packet->name) != 0);
53627 if (differ) {
53628 BV_SET(fields, 1);
53629 }
53630
53631 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
53632 if (differ) {
53633 BV_SET(fields, 2);
53634 }
53635
53636
53637#ifdef FREECIV_JSON_CONNECTION
53638 field_addr.name = "fields";
53639#endif /* FREECIV_JSON_CONNECTION */
53640 e = 0;
53641 e |= DIO_BV_PUT(&dout, &field_addr, fields);
53642 if (e) {
53643 log_packet_detailed("fields bitvector error detected");
53644 }
53645
53646 if (BV_ISSET(fields, 0)) {
53647 log_packet_detailed(" field 'id' has changed");
53648#ifdef FREECIV_JSON_CONNECTION
53649 field_addr.name = "id";
53650#endif /* FREECIV_JSON_CONNECTION */
53651 e = 0;
53652 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
53653 if (e) {
53654 log_packet_detailed("'id' field error detected");
53655 }
53656 }
53657 if (BV_ISSET(fields, 1)) {
53658 log_packet_detailed(" field 'name' has changed");
53659#ifdef FREECIV_JSON_CONNECTION
53660 field_addr.name = "name";
53661#endif /* FREECIV_JSON_CONNECTION */
53662 e = 0;
53663 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
53664 if (e) {
53665 log_packet_detailed("'name' field error detected");
53666 }
53667 }
53668 if (BV_ISSET(fields, 2)) {
53669 log_packet_detailed(" field 'helptxt' has changed");
53670#ifdef FREECIV_JSON_CONNECTION
53671 field_addr.name = "helptxt";
53672#endif /* FREECIV_JSON_CONNECTION */
53673 e = 0;
53674 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
53675 if (e) {
53676 log_packet_detailed("'helptxt' field error detected");
53677 }
53678 }
53679
53680 *old = *real_packet;
53681#endif /* FREECIV_DELTA_PROTOCOL */
53682#ifndef FREECIV_DELTA_PROTOCOL
53683#ifdef FREECIV_JSON_CONNECTION
53684 field_addr.name = "id";
53685#endif /* FREECIV_JSON_CONNECTION */
53686 e = 0;
53687 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
53688 if (e) {
53689 log_packet_detailed("'id' field error detected");
53690 }
53691#ifdef FREECIV_JSON_CONNECTION
53692 field_addr.name = "name";
53693#endif /* FREECIV_JSON_CONNECTION */
53694 e = 0;
53695 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
53696 if (e) {
53697 log_packet_detailed("'name' field error detected");
53698 }
53699#ifdef FREECIV_JSON_CONNECTION
53700 field_addr.name = "helptxt";
53701#endif /* FREECIV_JSON_CONNECTION */
53702 e = 0;
53703 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
53704 if (e) {
53705 log_packet_detailed("'helptxt' field error detected");
53706 }
53707
53708#endif
53709 SEND_PACKET_END(PACKET_RULESET_IMPR_FLAG);
53710}
53711
53712 int send_packet_ruleset_impr_flag(struct connection *pc, const struct packet_ruleset_impr_flag *packet)
53713{
53714 if (!pc->used) {
53715 log_error("WARNING: trying to send data to the closed connection %s",
53716 conn_description(pc));
53717 return -1;
53718 }
53719 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_IMPR_FLAG].packet != NULL, -1,
53720 "Handler for PACKET_RULESET_IMPR_FLAG not installed");
53721 return pc->phs.handlers->send[PACKET_RULESET_IMPR_FLAG].packet(pc, packet);
53722}
53723
53724 void lsend_packet_ruleset_impr_flag(struct conn_list *dest, const struct packet_ruleset_impr_flag *packet)
53725{
53726 conn_list_iterate(dest, pconn) {
53727 send_packet_ruleset_impr_flag(pconn, packet);
53728 } conn_list_iterate_end;
53729}
53730
53731#ifdef FREECIV_DELTA_PROTOCOL
53732#define hash_packet_ruleset_terrain_100 hash_const
53733
53734#define cmp_packet_ruleset_terrain_100 cmp_const
53735
53736 BV_DEFINE(packet_ruleset_terrain_100_fields, 37);
53737#endif /* FREECIV_DELTA_PROTOCOL */
53738
53739 static struct packet_ruleset_terrain *receive_packet_ruleset_terrain_100(struct connection *pc)
53740{
53741#ifdef FREECIV_DELTA_PROTOCOL
53742 packet_ruleset_terrain_100_fields fields;
53743 struct packet_ruleset_terrain *old;
53744 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN;
53745#endif /* FREECIV_DELTA_PROTOCOL */
53746 RECEIVE_PACKET_START(packet_ruleset_terrain, real_packet);
53747#ifdef FREECIV_JSON_CONNECTION
53748 struct plocation field_addr;
53749 {
53750 struct plocation *field_addr_tmp = plocation_field_new(NULL);
53751 field_addr = *field_addr_tmp;
53752 FC_FREE(field_addr_tmp);
53753 }
53754#endif /* FREECIV_JSON_CONNECTION */
53755
53756#ifdef FREECIV_DELTA_PROTOCOL
53757#ifdef FREECIV_JSON_CONNECTION
53758 field_addr.name = "fields";
53759#endif /* FREECIV_JSON_CONNECTION */
53760 DIO_BV_GET(&din, &field_addr, fields);
53761
53762#else /* FREECIV_DELTA_PROTOCOL */
53763#ifdef FREECIV_JSON_CONNECTION
53764 field_addr.name = "id";
53765#endif /* FREECIV_JSON_CONNECTION */
53766 {
53767 int readin;
53768
53769 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
53770 RECEIVE_PACKET_FIELD_ERROR(id);
53771 }
53772 real_packet->id = readin;
53773 }
53774#ifdef FREECIV_JSON_CONNECTION
53775 field_addr.name = "tclass";
53776#endif /* FREECIV_JSON_CONNECTION */
53777 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
53778 RECEIVE_PACKET_FIELD_ERROR(tclass);
53779 }
53780#ifdef FREECIV_JSON_CONNECTION
53781 field_addr.name = "flags";
53782#endif /* FREECIV_JSON_CONNECTION */
53783 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
53784 RECEIVE_PACKET_FIELD_ERROR(flags);
53785 }
53786#ifdef FREECIV_JSON_CONNECTION
53787 field_addr.name = "native_to";
53788#endif /* FREECIV_JSON_CONNECTION */
53789 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
53790 RECEIVE_PACKET_FIELD_ERROR(native_to);
53791 }
53792#ifdef FREECIV_JSON_CONNECTION
53793 field_addr.name = "name";
53794#endif /* FREECIV_JSON_CONNECTION */
53795 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
53796 RECEIVE_PACKET_FIELD_ERROR(name);
53797 }
53798#ifdef FREECIV_JSON_CONNECTION
53799 field_addr.name = "rule_name";
53800#endif /* FREECIV_JSON_CONNECTION */
53801 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
53802 RECEIVE_PACKET_FIELD_ERROR(rule_name);
53803 }
53804#ifdef FREECIV_JSON_CONNECTION
53805 field_addr.name = "graphic_str";
53806#endif /* FREECIV_JSON_CONNECTION */
53807 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
53808 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
53809 }
53810#ifdef FREECIV_JSON_CONNECTION
53811 field_addr.name = "graphic_alt";
53812#endif /* FREECIV_JSON_CONNECTION */
53813 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
53814 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
53815 }
53816#ifdef FREECIV_JSON_CONNECTION
53817 field_addr.name = "graphic_alt2";
53818#endif /* FREECIV_JSON_CONNECTION */
53819 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
53820 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
53821 }
53822#ifdef FREECIV_JSON_CONNECTION
53823 field_addr.name = "movement_cost";
53824#endif /* FREECIV_JSON_CONNECTION */
53825 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->movement_cost)) {
53826 RECEIVE_PACKET_FIELD_ERROR(movement_cost);
53827 }
53828#ifdef FREECIV_JSON_CONNECTION
53829 field_addr.name = "defense_bonus";
53830#endif /* FREECIV_JSON_CONNECTION */
53831 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->defense_bonus)) {
53832 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
53833 }
53834#ifdef FREECIV_JSON_CONNECTION
53835 field_addr.name = "output";
53836#endif /* FREECIV_JSON_CONNECTION */
53837 {
53838 int i;
53839
53840#ifdef FREECIV_JSON_CONNECTION
53841 /* Enter array. */
53842 field_addr.sub_location = plocation_elem_new(0);
53843#endif /* FREECIV_JSON_CONNECTION */
53844
53845 for (i = 0; i < O_LAST; i++) {
53846#ifdef FREECIV_JSON_CONNECTION
53847 field_addr.sub_location->number = i;
53848#endif /* FREECIV_JSON_CONNECTION */
53849 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
53850 RECEIVE_PACKET_FIELD_ERROR(output);
53851 }
53852 }
53853
53854#ifdef FREECIV_JSON_CONNECTION
53855 /* Exit array. */
53856 FC_FREE(field_addr.sub_location);
53857#endif /* FREECIV_JSON_CONNECTION */
53858 }
53859#ifdef FREECIV_JSON_CONNECTION
53860 field_addr.name = "num_resources";
53861#endif /* FREECIV_JSON_CONNECTION */
53862 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_resources)) {
53863 RECEIVE_PACKET_FIELD_ERROR(num_resources);
53864 }
53865#ifdef FREECIV_JSON_CONNECTION
53866 field_addr.name = "resources";
53867#endif /* FREECIV_JSON_CONNECTION */
53868 {
53869 int i;
53870
53871#ifdef FREECIV_JSON_CONNECTION
53872 /* Enter array. */
53873 field_addr.sub_location = plocation_elem_new(0);
53874#endif /* FREECIV_JSON_CONNECTION */
53875
53876 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
53877 RECEIVE_PACKET_FIELD_ERROR(resources, ": truncation array");
53878 }
53879 for (i = 0; i < real_packet->num_resources; i++) {
53880#ifdef FREECIV_JSON_CONNECTION
53881 field_addr.sub_location->number = i;
53882#endif /* FREECIV_JSON_CONNECTION */
53883 {
53884 int readin;
53885
53886 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
53887 RECEIVE_PACKET_FIELD_ERROR(resources);
53888 }
53889 real_packet->resources[i] = readin;
53890 }
53891 }
53892
53893#ifdef FREECIV_JSON_CONNECTION
53894 /* Exit array. */
53895 FC_FREE(field_addr.sub_location);
53896#endif /* FREECIV_JSON_CONNECTION */
53897 }
53898#ifdef FREECIV_JSON_CONNECTION
53899 field_addr.name = "resource_freq";
53900#endif /* FREECIV_JSON_CONNECTION */
53901 {
53902 int i;
53903
53904#ifdef FREECIV_JSON_CONNECTION
53905 /* Enter array. */
53906 field_addr.sub_location = plocation_elem_new(0);
53907#endif /* FREECIV_JSON_CONNECTION */
53908
53909 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
53910 RECEIVE_PACKET_FIELD_ERROR(resource_freq, ": truncation array");
53911 }
53912 for (i = 0; i < real_packet->num_resources; i++) {
53913#ifdef FREECIV_JSON_CONNECTION
53914 field_addr.sub_location->number = i;
53915#endif /* FREECIV_JSON_CONNECTION */
53916 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->resource_freq[i])) {
53917 RECEIVE_PACKET_FIELD_ERROR(resource_freq);
53918 }
53919 }
53920
53921#ifdef FREECIV_JSON_CONNECTION
53922 /* Exit array. */
53923 FC_FREE(field_addr.sub_location);
53924#endif /* FREECIV_JSON_CONNECTION */
53925 }
53926#ifdef FREECIV_JSON_CONNECTION
53927 field_addr.name = "road_output_incr_pct";
53928#endif /* FREECIV_JSON_CONNECTION */
53929 {
53930 int i;
53931
53932#ifdef FREECIV_JSON_CONNECTION
53933 /* Enter array. */
53934 field_addr.sub_location = plocation_elem_new(0);
53935#endif /* FREECIV_JSON_CONNECTION */
53936
53937 for (i = 0; i < O_LAST; i++) {
53938#ifdef FREECIV_JSON_CONNECTION
53939 field_addr.sub_location->number = i;
53940#endif /* FREECIV_JSON_CONNECTION */
53941 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->road_output_incr_pct[i])) {
53942 RECEIVE_PACKET_FIELD_ERROR(road_output_incr_pct);
53943 }
53944 }
53945
53946#ifdef FREECIV_JSON_CONNECTION
53947 /* Exit array. */
53948 FC_FREE(field_addr.sub_location);
53949#endif /* FREECIV_JSON_CONNECTION */
53950 }
53951#ifdef FREECIV_JSON_CONNECTION
53952 field_addr.name = "base_time";
53953#endif /* FREECIV_JSON_CONNECTION */
53954 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_time)) {
53955 RECEIVE_PACKET_FIELD_ERROR(base_time);
53956 }
53957#ifdef FREECIV_JSON_CONNECTION
53958 field_addr.name = "road_time";
53959#endif /* FREECIV_JSON_CONNECTION */
53960 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->road_time)) {
53961 RECEIVE_PACKET_FIELD_ERROR(road_time);
53962 }
53963#ifdef FREECIV_JSON_CONNECTION
53964 field_addr.name = "cultivate_result";
53965#endif /* FREECIV_JSON_CONNECTION */
53966 {
53967 int readin;
53968
53969 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
53970 RECEIVE_PACKET_FIELD_ERROR(cultivate_result);
53971 }
53972 real_packet->cultivate_result = readin;
53973 }
53974#ifdef FREECIV_JSON_CONNECTION
53975 field_addr.name = "cultivate_time";
53976#endif /* FREECIV_JSON_CONNECTION */
53977 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->cultivate_time)) {
53978 RECEIVE_PACKET_FIELD_ERROR(cultivate_time);
53979 }
53980#ifdef FREECIV_JSON_CONNECTION
53981 field_addr.name = "plant_result";
53982#endif /* FREECIV_JSON_CONNECTION */
53983 {
53984 int readin;
53985
53986 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
53987 RECEIVE_PACKET_FIELD_ERROR(plant_result);
53988 }
53989 real_packet->plant_result = readin;
53990 }
53991#ifdef FREECIV_JSON_CONNECTION
53992 field_addr.name = "plant_time";
53993#endif /* FREECIV_JSON_CONNECTION */
53994 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->plant_time)) {
53995 RECEIVE_PACKET_FIELD_ERROR(plant_time);
53996 }
53997#ifdef FREECIV_JSON_CONNECTION
53998 field_addr.name = "irrigation_food_incr";
53999#endif /* FREECIV_JSON_CONNECTION */
54000 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_food_incr)) {
54001 RECEIVE_PACKET_FIELD_ERROR(irrigation_food_incr);
54002 }
54003#ifdef FREECIV_JSON_CONNECTION
54004 field_addr.name = "irrigation_time";
54005#endif /* FREECIV_JSON_CONNECTION */
54006 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_time)) {
54007 RECEIVE_PACKET_FIELD_ERROR(irrigation_time);
54008 }
54009#ifdef FREECIV_JSON_CONNECTION
54010 field_addr.name = "mining_shield_incr";
54011#endif /* FREECIV_JSON_CONNECTION */
54012 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_shield_incr)) {
54013 RECEIVE_PACKET_FIELD_ERROR(mining_shield_incr);
54014 }
54015#ifdef FREECIV_JSON_CONNECTION
54016 field_addr.name = "mining_time";
54017#endif /* FREECIV_JSON_CONNECTION */
54018 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_time)) {
54019 RECEIVE_PACKET_FIELD_ERROR(mining_time);
54020 }
54021#ifdef FREECIV_JSON_CONNECTION
54022 field_addr.name = "animal";
54023#endif /* FREECIV_JSON_CONNECTION */
54024 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->animal)) {
54025 RECEIVE_PACKET_FIELD_ERROR(animal);
54026 }
54027#ifdef FREECIV_JSON_CONNECTION
54028 field_addr.name = "transform_result";
54029#endif /* FREECIV_JSON_CONNECTION */
54030 {
54031 int readin;
54032
54033 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54034 RECEIVE_PACKET_FIELD_ERROR(transform_result);
54035 }
54036 real_packet->transform_result = readin;
54037 }
54038#ifdef FREECIV_JSON_CONNECTION
54039 field_addr.name = "transform_time";
54040#endif /* FREECIV_JSON_CONNECTION */
54041 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transform_time)) {
54042 RECEIVE_PACKET_FIELD_ERROR(transform_time);
54043 }
54044#ifdef FREECIV_JSON_CONNECTION
54045 field_addr.name = "placing_time";
54046#endif /* FREECIV_JSON_CONNECTION */
54047 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->placing_time)) {
54048 RECEIVE_PACKET_FIELD_ERROR(placing_time);
54049 }
54050#ifdef FREECIV_JSON_CONNECTION
54051 field_addr.name = "pillage_time";
54052#endif /* FREECIV_JSON_CONNECTION */
54053 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pillage_time)) {
54054 RECEIVE_PACKET_FIELD_ERROR(pillage_time);
54055 }
54056#ifdef FREECIV_JSON_CONNECTION
54057 field_addr.name = "extra_count";
54058#endif /* FREECIV_JSON_CONNECTION */
54059 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_count)) {
54060 RECEIVE_PACKET_FIELD_ERROR(extra_count);
54061 }
54062#ifdef FREECIV_JSON_CONNECTION
54063 field_addr.name = "extra_removal_times";
54064#endif /* FREECIV_JSON_CONNECTION */
54065 {
54066 int i;
54067
54068#ifdef FREECIV_JSON_CONNECTION
54069 /* Enter array. */
54070 field_addr.sub_location = plocation_elem_new(0);
54071#endif /* FREECIV_JSON_CONNECTION */
54072
54073 if (real_packet->extra_count > MAX_EXTRA_TYPES) {
54074 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times, ": truncation array");
54075 }
54076 for (i = 0; i < real_packet->extra_count; i++) {
54077#ifdef FREECIV_JSON_CONNECTION
54078 field_addr.sub_location->number = i;
54079#endif /* FREECIV_JSON_CONNECTION */
54080 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_removal_times[i])) {
54081 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times);
54082 }
54083 }
54084
54085#ifdef FREECIV_JSON_CONNECTION
54086 /* Exit array. */
54087 FC_FREE(field_addr.sub_location);
54088#endif /* FREECIV_JSON_CONNECTION */
54089 }
54090#ifdef FREECIV_JSON_CONNECTION
54091 field_addr.name = "color_red";
54092#endif /* FREECIV_JSON_CONNECTION */
54093 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
54094 RECEIVE_PACKET_FIELD_ERROR(color_red);
54095 }
54096#ifdef FREECIV_JSON_CONNECTION
54097 field_addr.name = "color_green";
54098#endif /* FREECIV_JSON_CONNECTION */
54099 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
54100 RECEIVE_PACKET_FIELD_ERROR(color_green);
54101 }
54102#ifdef FREECIV_JSON_CONNECTION
54103 field_addr.name = "color_blue";
54104#endif /* FREECIV_JSON_CONNECTION */
54105 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
54106 RECEIVE_PACKET_FIELD_ERROR(color_blue);
54107 }
54108#ifdef FREECIV_JSON_CONNECTION
54109 field_addr.name = "helptext";
54110#endif /* FREECIV_JSON_CONNECTION */
54111 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
54112 RECEIVE_PACKET_FIELD_ERROR(helptext);
54113 }
54114#endif
54115 log_packet_detailed("packet_ruleset_terrain_100: got info about ()");
54116
54117#ifdef FREECIV_DELTA_PROTOCOL
54118 if (NULL == *hash) {
54119 *hash = genhash_new_full(hash_packet_ruleset_terrain_100, cmp_packet_ruleset_terrain_100,
54120 NULL, NULL, NULL, free);
54121 }
54122
54123 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
54124 *real_packet = *old;
54125 } else {
54126 log_packet_detailed(" no old info");
54127 memset(real_packet, 0, sizeof(*real_packet));
54128 }
54129
54130 if (BV_ISSET(fields, 0)) {
54131 log_packet_detailed(" got field 'id'");
54132#ifdef FREECIV_JSON_CONNECTION
54133 field_addr.name = "id";
54134#endif /* FREECIV_JSON_CONNECTION */
54135 {
54136 int readin;
54137
54138 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54139 RECEIVE_PACKET_FIELD_ERROR(id);
54140 }
54141 real_packet->id = readin;
54142 }
54143 }
54144 if (BV_ISSET(fields, 1)) {
54145 log_packet_detailed(" got field 'tclass'");
54146#ifdef FREECIV_JSON_CONNECTION
54147 field_addr.name = "tclass";
54148#endif /* FREECIV_JSON_CONNECTION */
54149 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tclass)) {
54150 RECEIVE_PACKET_FIELD_ERROR(tclass);
54151 }
54152 }
54153 if (BV_ISSET(fields, 2)) {
54154 log_packet_detailed(" got field 'flags'");
54155#ifdef FREECIV_JSON_CONNECTION
54156 field_addr.name = "flags";
54157#endif /* FREECIV_JSON_CONNECTION */
54158 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
54159 RECEIVE_PACKET_FIELD_ERROR(flags);
54160 }
54161 }
54162 if (BV_ISSET(fields, 3)) {
54163 log_packet_detailed(" got field 'native_to'");
54164#ifdef FREECIV_JSON_CONNECTION
54165 field_addr.name = "native_to";
54166#endif /* FREECIV_JSON_CONNECTION */
54167 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
54168 RECEIVE_PACKET_FIELD_ERROR(native_to);
54169 }
54170 }
54171 if (BV_ISSET(fields, 4)) {
54172 log_packet_detailed(" got field 'name'");
54173#ifdef FREECIV_JSON_CONNECTION
54174 field_addr.name = "name";
54175#endif /* FREECIV_JSON_CONNECTION */
54176 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
54177 RECEIVE_PACKET_FIELD_ERROR(name);
54178 }
54179 }
54180 if (BV_ISSET(fields, 5)) {
54181 log_packet_detailed(" got field 'rule_name'");
54182#ifdef FREECIV_JSON_CONNECTION
54183 field_addr.name = "rule_name";
54184#endif /* FREECIV_JSON_CONNECTION */
54185 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
54186 RECEIVE_PACKET_FIELD_ERROR(rule_name);
54187 }
54188 }
54189 if (BV_ISSET(fields, 6)) {
54190 log_packet_detailed(" got field 'graphic_str'");
54191#ifdef FREECIV_JSON_CONNECTION
54192 field_addr.name = "graphic_str";
54193#endif /* FREECIV_JSON_CONNECTION */
54194 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
54195 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
54196 }
54197 }
54198 if (BV_ISSET(fields, 7)) {
54199 log_packet_detailed(" got field 'graphic_alt'");
54200#ifdef FREECIV_JSON_CONNECTION
54201 field_addr.name = "graphic_alt";
54202#endif /* FREECIV_JSON_CONNECTION */
54203 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
54204 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
54205 }
54206 }
54207 if (BV_ISSET(fields, 8)) {
54208 log_packet_detailed(" got field 'graphic_alt2'");
54209#ifdef FREECIV_JSON_CONNECTION
54210 field_addr.name = "graphic_alt2";
54211#endif /* FREECIV_JSON_CONNECTION */
54212 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt2, sizeof(real_packet->graphic_alt2))) {
54213 RECEIVE_PACKET_FIELD_ERROR(graphic_alt2);
54214 }
54215 }
54216 if (BV_ISSET(fields, 9)) {
54217 log_packet_detailed(" got field 'movement_cost'");
54218#ifdef FREECIV_JSON_CONNECTION
54219 field_addr.name = "movement_cost";
54220#endif /* FREECIV_JSON_CONNECTION */
54221 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->movement_cost)) {
54222 RECEIVE_PACKET_FIELD_ERROR(movement_cost);
54223 }
54224 }
54225 if (BV_ISSET(fields, 10)) {
54226 log_packet_detailed(" got field 'defense_bonus'");
54227#ifdef FREECIV_JSON_CONNECTION
54228 field_addr.name = "defense_bonus";
54229#endif /* FREECIV_JSON_CONNECTION */
54230 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->defense_bonus)) {
54231 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
54232 }
54233 }
54234 if (BV_ISSET(fields, 11)) {
54235 log_packet_detailed(" got field 'output'");
54236#ifdef FREECIV_JSON_CONNECTION
54237 field_addr.name = "output";
54238#endif /* FREECIV_JSON_CONNECTION */
54239 {
54240 int i;
54241
54242#ifdef FREECIV_JSON_CONNECTION
54243 /* Enter array. */
54244 field_addr.sub_location = plocation_elem_new(0);
54245#endif /* FREECIV_JSON_CONNECTION */
54246
54247 for (i = 0; i < O_LAST; i++) {
54248#ifdef FREECIV_JSON_CONNECTION
54249 field_addr.sub_location->number = i;
54250#endif /* FREECIV_JSON_CONNECTION */
54251 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
54252 RECEIVE_PACKET_FIELD_ERROR(output);
54253 }
54254 }
54255
54256#ifdef FREECIV_JSON_CONNECTION
54257 /* Exit array. */
54258 FC_FREE(field_addr.sub_location);
54259#endif /* FREECIV_JSON_CONNECTION */
54260 }
54261 }
54262 if (BV_ISSET(fields, 12)) {
54263 log_packet_detailed(" got field 'num_resources'");
54264#ifdef FREECIV_JSON_CONNECTION
54265 field_addr.name = "num_resources";
54266#endif /* FREECIV_JSON_CONNECTION */
54267 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_resources)) {
54268 RECEIVE_PACKET_FIELD_ERROR(num_resources);
54269 }
54270 }
54271 if (BV_ISSET(fields, 13)) {
54272 log_packet_detailed(" got field 'resources'");
54273#ifdef FREECIV_JSON_CONNECTION
54274 field_addr.name = "resources";
54275#endif /* FREECIV_JSON_CONNECTION */
54276 {
54277 int i;
54278
54279#ifdef FREECIV_JSON_CONNECTION
54280 /* Enter array. */
54281 field_addr.sub_location = plocation_elem_new(0);
54282#endif /* FREECIV_JSON_CONNECTION */
54283
54284 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
54285 RECEIVE_PACKET_FIELD_ERROR(resources, ": truncation array");
54286 }
54287 for (i = 0; i < real_packet->num_resources; i++) {
54288#ifdef FREECIV_JSON_CONNECTION
54289 field_addr.sub_location->number = i;
54290#endif /* FREECIV_JSON_CONNECTION */
54291 {
54292 int readin;
54293
54294 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54295 RECEIVE_PACKET_FIELD_ERROR(resources);
54296 }
54297 real_packet->resources[i] = readin;
54298 }
54299 }
54300
54301#ifdef FREECIV_JSON_CONNECTION
54302 /* Exit array. */
54303 FC_FREE(field_addr.sub_location);
54304#endif /* FREECIV_JSON_CONNECTION */
54305 }
54306 }
54307 if (BV_ISSET(fields, 14)) {
54308 log_packet_detailed(" got field 'resource_freq'");
54309#ifdef FREECIV_JSON_CONNECTION
54310 field_addr.name = "resource_freq";
54311#endif /* FREECIV_JSON_CONNECTION */
54312 {
54313 int i;
54314
54315#ifdef FREECIV_JSON_CONNECTION
54316 /* Enter array. */
54317 field_addr.sub_location = plocation_elem_new(0);
54318#endif /* FREECIV_JSON_CONNECTION */
54319
54320 if (real_packet->num_resources > MAX_EXTRA_TYPES) {
54321 RECEIVE_PACKET_FIELD_ERROR(resource_freq, ": truncation array");
54322 }
54323 for (i = 0; i < real_packet->num_resources; i++) {
54324#ifdef FREECIV_JSON_CONNECTION
54325 field_addr.sub_location->number = i;
54326#endif /* FREECIV_JSON_CONNECTION */
54327 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->resource_freq[i])) {
54328 RECEIVE_PACKET_FIELD_ERROR(resource_freq);
54329 }
54330 }
54331
54332#ifdef FREECIV_JSON_CONNECTION
54333 /* Exit array. */
54334 FC_FREE(field_addr.sub_location);
54335#endif /* FREECIV_JSON_CONNECTION */
54336 }
54337 }
54338 if (BV_ISSET(fields, 15)) {
54339 log_packet_detailed(" got field 'road_output_incr_pct'");
54340#ifdef FREECIV_JSON_CONNECTION
54341 field_addr.name = "road_output_incr_pct";
54342#endif /* FREECIV_JSON_CONNECTION */
54343 {
54344 int i;
54345
54346#ifdef FREECIV_JSON_CONNECTION
54347 /* Enter array. */
54348 field_addr.sub_location = plocation_elem_new(0);
54349#endif /* FREECIV_JSON_CONNECTION */
54350
54351 for (i = 0; i < O_LAST; i++) {
54352#ifdef FREECIV_JSON_CONNECTION
54353 field_addr.sub_location->number = i;
54354#endif /* FREECIV_JSON_CONNECTION */
54355 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->road_output_incr_pct[i])) {
54356 RECEIVE_PACKET_FIELD_ERROR(road_output_incr_pct);
54357 }
54358 }
54359
54360#ifdef FREECIV_JSON_CONNECTION
54361 /* Exit array. */
54362 FC_FREE(field_addr.sub_location);
54363#endif /* FREECIV_JSON_CONNECTION */
54364 }
54365 }
54366 if (BV_ISSET(fields, 16)) {
54367 log_packet_detailed(" got field 'base_time'");
54368#ifdef FREECIV_JSON_CONNECTION
54369 field_addr.name = "base_time";
54370#endif /* FREECIV_JSON_CONNECTION */
54371 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->base_time)) {
54372 RECEIVE_PACKET_FIELD_ERROR(base_time);
54373 }
54374 }
54375 if (BV_ISSET(fields, 17)) {
54376 log_packet_detailed(" got field 'road_time'");
54377#ifdef FREECIV_JSON_CONNECTION
54378 field_addr.name = "road_time";
54379#endif /* FREECIV_JSON_CONNECTION */
54380 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->road_time)) {
54381 RECEIVE_PACKET_FIELD_ERROR(road_time);
54382 }
54383 }
54384 if (BV_ISSET(fields, 18)) {
54385 log_packet_detailed(" got field 'cultivate_result'");
54386#ifdef FREECIV_JSON_CONNECTION
54387 field_addr.name = "cultivate_result";
54388#endif /* FREECIV_JSON_CONNECTION */
54389 {
54390 int readin;
54391
54392 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54393 RECEIVE_PACKET_FIELD_ERROR(cultivate_result);
54394 }
54395 real_packet->cultivate_result = readin;
54396 }
54397 }
54398 if (BV_ISSET(fields, 19)) {
54399 log_packet_detailed(" got field 'cultivate_time'");
54400#ifdef FREECIV_JSON_CONNECTION
54401 field_addr.name = "cultivate_time";
54402#endif /* FREECIV_JSON_CONNECTION */
54403 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->cultivate_time)) {
54404 RECEIVE_PACKET_FIELD_ERROR(cultivate_time);
54405 }
54406 }
54407 if (BV_ISSET(fields, 20)) {
54408 log_packet_detailed(" got field 'plant_result'");
54409#ifdef FREECIV_JSON_CONNECTION
54410 field_addr.name = "plant_result";
54411#endif /* FREECIV_JSON_CONNECTION */
54412 {
54413 int readin;
54414
54415 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54416 RECEIVE_PACKET_FIELD_ERROR(plant_result);
54417 }
54418 real_packet->plant_result = readin;
54419 }
54420 }
54421 if (BV_ISSET(fields, 21)) {
54422 log_packet_detailed(" got field 'plant_time'");
54423#ifdef FREECIV_JSON_CONNECTION
54424 field_addr.name = "plant_time";
54425#endif /* FREECIV_JSON_CONNECTION */
54426 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->plant_time)) {
54427 RECEIVE_PACKET_FIELD_ERROR(plant_time);
54428 }
54429 }
54430 if (BV_ISSET(fields, 22)) {
54431 log_packet_detailed(" got field 'irrigation_food_incr'");
54432#ifdef FREECIV_JSON_CONNECTION
54433 field_addr.name = "irrigation_food_incr";
54434#endif /* FREECIV_JSON_CONNECTION */
54435 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_food_incr)) {
54436 RECEIVE_PACKET_FIELD_ERROR(irrigation_food_incr);
54437 }
54438 }
54439 if (BV_ISSET(fields, 23)) {
54440 log_packet_detailed(" got field 'irrigation_time'");
54441#ifdef FREECIV_JSON_CONNECTION
54442 field_addr.name = "irrigation_time";
54443#endif /* FREECIV_JSON_CONNECTION */
54444 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->irrigation_time)) {
54445 RECEIVE_PACKET_FIELD_ERROR(irrigation_time);
54446 }
54447 }
54448 if (BV_ISSET(fields, 24)) {
54449 log_packet_detailed(" got field 'mining_shield_incr'");
54450#ifdef FREECIV_JSON_CONNECTION
54451 field_addr.name = "mining_shield_incr";
54452#endif /* FREECIV_JSON_CONNECTION */
54453 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_shield_incr)) {
54454 RECEIVE_PACKET_FIELD_ERROR(mining_shield_incr);
54455 }
54456 }
54457 if (BV_ISSET(fields, 25)) {
54458 log_packet_detailed(" got field 'mining_time'");
54459#ifdef FREECIV_JSON_CONNECTION
54460 field_addr.name = "mining_time";
54461#endif /* FREECIV_JSON_CONNECTION */
54462 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->mining_time)) {
54463 RECEIVE_PACKET_FIELD_ERROR(mining_time);
54464 }
54465 }
54466 if (BV_ISSET(fields, 26)) {
54467 log_packet_detailed(" got field 'animal'");
54468#ifdef FREECIV_JSON_CONNECTION
54469 field_addr.name = "animal";
54470#endif /* FREECIV_JSON_CONNECTION */
54471 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->animal)) {
54472 RECEIVE_PACKET_FIELD_ERROR(animal);
54473 }
54474 }
54475 if (BV_ISSET(fields, 27)) {
54476 log_packet_detailed(" got field 'transform_result'");
54477#ifdef FREECIV_JSON_CONNECTION
54478 field_addr.name = "transform_result";
54479#endif /* FREECIV_JSON_CONNECTION */
54480 {
54481 int readin;
54482
54483 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
54484 RECEIVE_PACKET_FIELD_ERROR(transform_result);
54485 }
54486 real_packet->transform_result = readin;
54487 }
54488 }
54489 if (BV_ISSET(fields, 28)) {
54490 log_packet_detailed(" got field 'transform_time'");
54491#ifdef FREECIV_JSON_CONNECTION
54492 field_addr.name = "transform_time";
54493#endif /* FREECIV_JSON_CONNECTION */
54494 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->transform_time)) {
54495 RECEIVE_PACKET_FIELD_ERROR(transform_time);
54496 }
54497 }
54498 if (BV_ISSET(fields, 29)) {
54499 log_packet_detailed(" got field 'placing_time'");
54500#ifdef FREECIV_JSON_CONNECTION
54501 field_addr.name = "placing_time";
54502#endif /* FREECIV_JSON_CONNECTION */
54503 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->placing_time)) {
54504 RECEIVE_PACKET_FIELD_ERROR(placing_time);
54505 }
54506 }
54507 if (BV_ISSET(fields, 30)) {
54508 log_packet_detailed(" got field 'pillage_time'");
54509#ifdef FREECIV_JSON_CONNECTION
54510 field_addr.name = "pillage_time";
54511#endif /* FREECIV_JSON_CONNECTION */
54512 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->pillage_time)) {
54513 RECEIVE_PACKET_FIELD_ERROR(pillage_time);
54514 }
54515 }
54516 if (BV_ISSET(fields, 31)) {
54517 log_packet_detailed(" got field 'extra_count'");
54518#ifdef FREECIV_JSON_CONNECTION
54519 field_addr.name = "extra_count";
54520#endif /* FREECIV_JSON_CONNECTION */
54521 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_count)) {
54522 RECEIVE_PACKET_FIELD_ERROR(extra_count);
54523 }
54524 }
54525 if (BV_ISSET(fields, 32)) {
54526 log_packet_detailed(" got field 'extra_removal_times'");
54527#ifdef FREECIV_JSON_CONNECTION
54528 field_addr.name = "extra_removal_times";
54529#endif /* FREECIV_JSON_CONNECTION */
54530 {
54531 int i;
54532
54533#ifdef FREECIV_JSON_CONNECTION
54534 /* Enter array. */
54535 field_addr.sub_location = plocation_elem_new(0);
54536#endif /* FREECIV_JSON_CONNECTION */
54537
54538 if (real_packet->extra_count > MAX_EXTRA_TYPES) {
54539 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times, ": truncation array");
54540 }
54541 for (i = 0; i < real_packet->extra_count; i++) {
54542#ifdef FREECIV_JSON_CONNECTION
54543 field_addr.sub_location->number = i;
54544#endif /* FREECIV_JSON_CONNECTION */
54545 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->extra_removal_times[i])) {
54546 RECEIVE_PACKET_FIELD_ERROR(extra_removal_times);
54547 }
54548 }
54549
54550#ifdef FREECIV_JSON_CONNECTION
54551 /* Exit array. */
54552 FC_FREE(field_addr.sub_location);
54553#endif /* FREECIV_JSON_CONNECTION */
54554 }
54555 }
54556 if (BV_ISSET(fields, 33)) {
54557 log_packet_detailed(" got field 'color_red'");
54558#ifdef FREECIV_JSON_CONNECTION
54559 field_addr.name = "color_red";
54560#endif /* FREECIV_JSON_CONNECTION */
54561 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_red)) {
54562 RECEIVE_PACKET_FIELD_ERROR(color_red);
54563 }
54564 }
54565 if (BV_ISSET(fields, 34)) {
54566 log_packet_detailed(" got field 'color_green'");
54567#ifdef FREECIV_JSON_CONNECTION
54568 field_addr.name = "color_green";
54569#endif /* FREECIV_JSON_CONNECTION */
54570 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_green)) {
54571 RECEIVE_PACKET_FIELD_ERROR(color_green);
54572 }
54573 }
54574 if (BV_ISSET(fields, 35)) {
54575 log_packet_detailed(" got field 'color_blue'");
54576#ifdef FREECIV_JSON_CONNECTION
54577 field_addr.name = "color_blue";
54578#endif /* FREECIV_JSON_CONNECTION */
54579 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->color_blue)) {
54580 RECEIVE_PACKET_FIELD_ERROR(color_blue);
54581 }
54582 }
54583 if (BV_ISSET(fields, 36)) {
54584 log_packet_detailed(" got field 'helptext'");
54585#ifdef FREECIV_JSON_CONNECTION
54586 field_addr.name = "helptext";
54587#endif /* FREECIV_JSON_CONNECTION */
54588 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
54589 RECEIVE_PACKET_FIELD_ERROR(helptext);
54590 }
54591 }
54592
54593 if (NULL == old) {
54594 old = fc_malloc(sizeof(*old));
54595 *old = *real_packet;
54596 genhash_insert(*hash, old, old);
54597 } else {
54598 *old = *real_packet;
54599 }
54600
54601#endif /* FREECIV_DELTA_PROTOCOL */
54602 RECEIVE_PACKET_END(real_packet);
54603}
54604
54605 static int send_packet_ruleset_terrain_100(struct connection *pc, const struct packet_ruleset_terrain *packet)
54606{
54607 const struct packet_ruleset_terrain *real_packet = packet;
54608 int e;
54609#ifdef FREECIV_DELTA_PROTOCOL
54610 packet_ruleset_terrain_100_fields fields;
54611 struct packet_ruleset_terrain *old;
54612 bool differ;
54613 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN;
54614#endif /* FREECIV_DELTA_PROTOCOL */
54615 SEND_PACKET_START(PACKET_RULESET_TERRAIN);
54616#ifdef FREECIV_JSON_CONNECTION
54617 struct plocation field_addr;
54618 {
54619 struct plocation *field_addr_tmp = plocation_field_new(NULL);
54620 field_addr = *field_addr_tmp;
54621 FC_FREE(field_addr_tmp);
54622 }
54623#endif /* FREECIV_JSON_CONNECTION */
54624
54625 log_packet_detailed("packet_ruleset_terrain_100: sending info about ()");
54626
54627#ifdef FREECIV_DELTA_PROTOCOL
54628 if (NULL == *hash) {
54629 *hash = genhash_new_full(hash_packet_ruleset_terrain_100, cmp_packet_ruleset_terrain_100,
54630 NULL, NULL, NULL, free);
54631 }
54632 BV_CLR_ALL(fields);
54633
54634 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
54635 old = fc_malloc(sizeof(*old));
54636 *old = *real_packet;
54637 genhash_insert(*hash, old, old);
54638 memset(old, 0, sizeof(*old));
54639 }
54640 differ = (old->id != real_packet->id);
54641 if (differ) {
54642 BV_SET(fields, 0);
54643 }
54644
54645 differ = (old->tclass != real_packet->tclass);
54646 if (differ) {
54647 BV_SET(fields, 1);
54648 }
54649
54650 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
54651 if (differ) {
54652 BV_SET(fields, 2);
54653 }
54654
54655 differ = !BV_ARE_EQUAL(old->native_to, real_packet->native_to);
54656 if (differ) {
54657 BV_SET(fields, 3);
54658 }
54659
54660 differ = (strcmp(old->name, real_packet->name) != 0);
54661 if (differ) {
54662 BV_SET(fields, 4);
54663 }
54664
54665 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
54666 if (differ) {
54667 BV_SET(fields, 5);
54668 }
54669
54670 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
54671 if (differ) {
54672 BV_SET(fields, 6);
54673 }
54674
54675 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
54676 if (differ) {
54677 BV_SET(fields, 7);
54678 }
54679
54680 differ = (strcmp(old->graphic_alt2, real_packet->graphic_alt2) != 0);
54681 if (differ) {
54682 BV_SET(fields, 8);
54683 }
54684
54685 differ = (old->movement_cost != real_packet->movement_cost);
54686 if (differ) {
54687 BV_SET(fields, 9);
54688 }
54689
54690 differ = (old->defense_bonus != real_packet->defense_bonus);
54691 if (differ) {
54692 BV_SET(fields, 10);
54693 }
54694
54695 differ = FALSE;
54696 {
54697 int i;
54698
54699 for (i = 0; i < O_LAST; i++) {
54700 differ = (old->output[i] != real_packet->output[i]);
54701 if (differ) {
54702 break;
54703 }
54704 }
54705 }
54706 if (differ) {
54707 BV_SET(fields, 11);
54708 }
54709
54710 differ = (old->num_resources != real_packet->num_resources);
54711 if (differ) {
54712 BV_SET(fields, 12);
54713 }
54714
54715 differ = (old->num_resources != real_packet->num_resources);
54716 if (!differ) {
54717 int i;
54718
54719 for (i = 0; i < real_packet->num_resources; i++) {
54720 differ = (old->resources[i] != real_packet->resources[i]);
54721 if (differ) {
54722 break;
54723 }
54724 }
54725 }
54726 if (differ) {
54727 BV_SET(fields, 13);
54728 }
54729
54730 differ = (old->num_resources != real_packet->num_resources);
54731 if (!differ) {
54732 int i;
54733
54734 for (i = 0; i < real_packet->num_resources; i++) {
54735 differ = (old->resource_freq[i] != real_packet->resource_freq[i]);
54736 if (differ) {
54737 break;
54738 }
54739 }
54740 }
54741 if (differ) {
54742 BV_SET(fields, 14);
54743 }
54744
54745 differ = FALSE;
54746 {
54747 int i;
54748
54749 for (i = 0; i < O_LAST; i++) {
54750 differ = (old->road_output_incr_pct[i] != real_packet->road_output_incr_pct[i]);
54751 if (differ) {
54752 break;
54753 }
54754 }
54755 }
54756 if (differ) {
54757 BV_SET(fields, 15);
54758 }
54759
54760 differ = (old->base_time != real_packet->base_time);
54761 if (differ) {
54762 BV_SET(fields, 16);
54763 }
54764
54765 differ = (old->road_time != real_packet->road_time);
54766 if (differ) {
54767 BV_SET(fields, 17);
54768 }
54769
54770 differ = (old->cultivate_result != real_packet->cultivate_result);
54771 if (differ) {
54772 BV_SET(fields, 18);
54773 }
54774
54775 differ = (old->cultivate_time != real_packet->cultivate_time);
54776 if (differ) {
54777 BV_SET(fields, 19);
54778 }
54779
54780 differ = (old->plant_result != real_packet->plant_result);
54781 if (differ) {
54782 BV_SET(fields, 20);
54783 }
54784
54785 differ = (old->plant_time != real_packet->plant_time);
54786 if (differ) {
54787 BV_SET(fields, 21);
54788 }
54789
54790 differ = (old->irrigation_food_incr != real_packet->irrigation_food_incr);
54791 if (differ) {
54792 BV_SET(fields, 22);
54793 }
54794
54795 differ = (old->irrigation_time != real_packet->irrigation_time);
54796 if (differ) {
54797 BV_SET(fields, 23);
54798 }
54799
54800 differ = (old->mining_shield_incr != real_packet->mining_shield_incr);
54801 if (differ) {
54802 BV_SET(fields, 24);
54803 }
54804
54805 differ = (old->mining_time != real_packet->mining_time);
54806 if (differ) {
54807 BV_SET(fields, 25);
54808 }
54809
54810 differ = (old->animal != real_packet->animal);
54811 if (differ) {
54812 BV_SET(fields, 26);
54813 }
54814
54815 differ = (old->transform_result != real_packet->transform_result);
54816 if (differ) {
54817 BV_SET(fields, 27);
54818 }
54819
54820 differ = (old->transform_time != real_packet->transform_time);
54821 if (differ) {
54822 BV_SET(fields, 28);
54823 }
54824
54825 differ = (old->placing_time != real_packet->placing_time);
54826 if (differ) {
54827 BV_SET(fields, 29);
54828 }
54829
54830 differ = (old->pillage_time != real_packet->pillage_time);
54831 if (differ) {
54832 BV_SET(fields, 30);
54833 }
54834
54835 differ = (old->extra_count != real_packet->extra_count);
54836 if (differ) {
54837 BV_SET(fields, 31);
54838 }
54839
54840 differ = (old->extra_count != real_packet->extra_count);
54841 if (!differ) {
54842 int i;
54843
54844 for (i = 0; i < real_packet->extra_count; i++) {
54845 differ = (old->extra_removal_times[i] != real_packet->extra_removal_times[i]);
54846 if (differ) {
54847 break;
54848 }
54849 }
54850 }
54851 if (differ) {
54852 BV_SET(fields, 32);
54853 }
54854
54855 differ = (old->color_red != real_packet->color_red);
54856 if (differ) {
54857 BV_SET(fields, 33);
54858 }
54859
54860 differ = (old->color_green != real_packet->color_green);
54861 if (differ) {
54862 BV_SET(fields, 34);
54863 }
54864
54865 differ = (old->color_blue != real_packet->color_blue);
54866 if (differ) {
54867 BV_SET(fields, 35);
54868 }
54869
54870 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
54871 if (differ) {
54872 BV_SET(fields, 36);
54873 }
54874
54875
54876#ifdef FREECIV_JSON_CONNECTION
54877 field_addr.name = "fields";
54878#endif /* FREECIV_JSON_CONNECTION */
54879 e = 0;
54880 e |= DIO_BV_PUT(&dout, &field_addr, fields);
54881 if (e) {
54882 log_packet_detailed("fields bitvector error detected");
54883 }
54884
54885 if (BV_ISSET(fields, 0)) {
54886 log_packet_detailed(" field 'id' has changed");
54887#ifdef FREECIV_JSON_CONNECTION
54888 field_addr.name = "id";
54889#endif /* FREECIV_JSON_CONNECTION */
54890 e = 0;
54891 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
54892 if (e) {
54893 log_packet_detailed("'id' field error detected");
54894 }
54895 }
54896 if (BV_ISSET(fields, 1)) {
54897 log_packet_detailed(" field 'tclass' has changed");
54898#ifdef FREECIV_JSON_CONNECTION
54899 field_addr.name = "tclass";
54900#endif /* FREECIV_JSON_CONNECTION */
54901 e = 0;
54902 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
54903 if (e) {
54904 log_packet_detailed("'tclass' field error detected");
54905 }
54906 }
54907 if (BV_ISSET(fields, 2)) {
54908 log_packet_detailed(" field 'flags' has changed");
54909#ifdef FREECIV_JSON_CONNECTION
54910 field_addr.name = "flags";
54911#endif /* FREECIV_JSON_CONNECTION */
54912 e = 0;
54913 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
54914 if (e) {
54915 log_packet_detailed("'flags' field error detected");
54916 }
54917 }
54918 if (BV_ISSET(fields, 3)) {
54919 log_packet_detailed(" field 'native_to' has changed");
54920#ifdef FREECIV_JSON_CONNECTION
54921 field_addr.name = "native_to";
54922#endif /* FREECIV_JSON_CONNECTION */
54923 e = 0;
54924 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
54925 if (e) {
54926 log_packet_detailed("'native_to' field error detected");
54927 }
54928 }
54929 if (BV_ISSET(fields, 4)) {
54930 log_packet_detailed(" field 'name' has changed");
54931#ifdef FREECIV_JSON_CONNECTION
54932 field_addr.name = "name";
54933#endif /* FREECIV_JSON_CONNECTION */
54934 e = 0;
54935 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
54936 if (e) {
54937 log_packet_detailed("'name' field error detected");
54938 }
54939 }
54940 if (BV_ISSET(fields, 5)) {
54941 log_packet_detailed(" field 'rule_name' has changed");
54942#ifdef FREECIV_JSON_CONNECTION
54943 field_addr.name = "rule_name";
54944#endif /* FREECIV_JSON_CONNECTION */
54945 e = 0;
54946 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
54947 if (e) {
54948 log_packet_detailed("'rule_name' field error detected");
54949 }
54950 }
54951 if (BV_ISSET(fields, 6)) {
54952 log_packet_detailed(" field 'graphic_str' has changed");
54953#ifdef FREECIV_JSON_CONNECTION
54954 field_addr.name = "graphic_str";
54955#endif /* FREECIV_JSON_CONNECTION */
54956 e = 0;
54957 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
54958 if (e) {
54959 log_packet_detailed("'graphic_str' field error detected");
54960 }
54961 }
54962 if (BV_ISSET(fields, 7)) {
54963 log_packet_detailed(" field 'graphic_alt' has changed");
54964#ifdef FREECIV_JSON_CONNECTION
54965 field_addr.name = "graphic_alt";
54966#endif /* FREECIV_JSON_CONNECTION */
54967 e = 0;
54968 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
54969 if (e) {
54970 log_packet_detailed("'graphic_alt' field error detected");
54971 }
54972 }
54973 if (BV_ISSET(fields, 8)) {
54974 log_packet_detailed(" field 'graphic_alt2' has changed");
54975#ifdef FREECIV_JSON_CONNECTION
54976 field_addr.name = "graphic_alt2";
54977#endif /* FREECIV_JSON_CONNECTION */
54978 e = 0;
54979 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
54980 if (e) {
54981 log_packet_detailed("'graphic_alt2' field error detected");
54982 }
54983 }
54984 if (BV_ISSET(fields, 9)) {
54985 log_packet_detailed(" field 'movement_cost' has changed");
54986#ifdef FREECIV_JSON_CONNECTION
54987 field_addr.name = "movement_cost";
54988#endif /* FREECIV_JSON_CONNECTION */
54989 e = 0;
54990 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->movement_cost);
54991 if (e) {
54992 log_packet_detailed("'movement_cost' field error detected");
54993 }
54994 }
54995 if (BV_ISSET(fields, 10)) {
54996 log_packet_detailed(" field 'defense_bonus' has changed");
54997#ifdef FREECIV_JSON_CONNECTION
54998 field_addr.name = "defense_bonus";
54999#endif /* FREECIV_JSON_CONNECTION */
55000 e = 0;
55001 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->defense_bonus);
55002 if (e) {
55003 log_packet_detailed("'defense_bonus' field error detected");
55004 }
55005 }
55006 if (BV_ISSET(fields, 11)) {
55007 log_packet_detailed(" field 'output' has changed");
55008#ifdef FREECIV_JSON_CONNECTION
55009 field_addr.name = "output";
55010#endif /* FREECIV_JSON_CONNECTION */
55011 e = 0;
55012 {
55013 int i;
55014
55015#ifdef FREECIV_JSON_CONNECTION
55016 /* Create the array. */
55017 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
55018
55019 /* Enter the array. */
55020 field_addr.sub_location = plocation_elem_new(0);
55021#endif /* FREECIV_JSON_CONNECTION */
55022
55023 for (i = 0; i < O_LAST; i++) {
55024#ifdef FREECIV_JSON_CONNECTION
55025 /* Next array element. */
55026 field_addr.sub_location->number = i;
55027#endif /* FREECIV_JSON_CONNECTION */
55028 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
55029 }
55030
55031#ifdef FREECIV_JSON_CONNECTION
55032 /* Exit array. */
55033 FC_FREE(field_addr.sub_location);
55034#endif /* FREECIV_JSON_CONNECTION */
55035 }
55036 if (e) {
55037 log_packet_detailed("'output' field error detected");
55038 }
55039 }
55040 if (BV_ISSET(fields, 12)) {
55041 log_packet_detailed(" field 'num_resources' has changed");
55042#ifdef FREECIV_JSON_CONNECTION
55043 field_addr.name = "num_resources";
55044#endif /* FREECIV_JSON_CONNECTION */
55045 e = 0;
55046 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_resources);
55047 if (e) {
55048 log_packet_detailed("'num_resources' field error detected");
55049 }
55050 }
55051 if (BV_ISSET(fields, 13)) {
55052 log_packet_detailed(" field 'resources' has changed");
55053#ifdef FREECIV_JSON_CONNECTION
55054 field_addr.name = "resources";
55055#endif /* FREECIV_JSON_CONNECTION */
55056 e = 0;
55057 {
55058 int i;
55059
55060#ifdef FREECIV_JSON_CONNECTION
55061 /* Create the array. */
55062 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
55063
55064 /* Enter the array. */
55065 field_addr.sub_location = plocation_elem_new(0);
55066#endif /* FREECIV_JSON_CONNECTION */
55067
55068 for (i = 0; i < real_packet->num_resources; i++) {
55069#ifdef FREECIV_JSON_CONNECTION
55070 /* Next array element. */
55071 field_addr.sub_location->number = i;
55072#endif /* FREECIV_JSON_CONNECTION */
55073 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resources[i]);
55074 }
55075
55076#ifdef FREECIV_JSON_CONNECTION
55077 /* Exit array. */
55078 FC_FREE(field_addr.sub_location);
55079#endif /* FREECIV_JSON_CONNECTION */
55080 }
55081 if (e) {
55082 log_packet_detailed("'resources' field error detected");
55083 }
55084 }
55085 if (BV_ISSET(fields, 14)) {
55086 log_packet_detailed(" field 'resource_freq' has changed");
55087#ifdef FREECIV_JSON_CONNECTION
55088 field_addr.name = "resource_freq";
55089#endif /* FREECIV_JSON_CONNECTION */
55090 e = 0;
55091 {
55092 int i;
55093
55094#ifdef FREECIV_JSON_CONNECTION
55095 /* Create the array. */
55096 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
55097
55098 /* Enter the array. */
55099 field_addr.sub_location = plocation_elem_new(0);
55100#endif /* FREECIV_JSON_CONNECTION */
55101
55102 for (i = 0; i < real_packet->num_resources; i++) {
55103#ifdef FREECIV_JSON_CONNECTION
55104 /* Next array element. */
55105 field_addr.sub_location->number = i;
55106#endif /* FREECIV_JSON_CONNECTION */
55107 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource_freq[i]);
55108 }
55109
55110#ifdef FREECIV_JSON_CONNECTION
55111 /* Exit array. */
55112 FC_FREE(field_addr.sub_location);
55113#endif /* FREECIV_JSON_CONNECTION */
55114 }
55115 if (e) {
55116 log_packet_detailed("'resource_freq' field error detected");
55117 }
55118 }
55119 if (BV_ISSET(fields, 15)) {
55120 log_packet_detailed(" field 'road_output_incr_pct' has changed");
55121#ifdef FREECIV_JSON_CONNECTION
55122 field_addr.name = "road_output_incr_pct";
55123#endif /* FREECIV_JSON_CONNECTION */
55124 e = 0;
55125 {
55126 int i;
55127
55128#ifdef FREECIV_JSON_CONNECTION
55129 /* Create the array. */
55130 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
55131
55132 /* Enter the array. */
55133 field_addr.sub_location = plocation_elem_new(0);
55134#endif /* FREECIV_JSON_CONNECTION */
55135
55136 for (i = 0; i < O_LAST; i++) {
55137#ifdef FREECIV_JSON_CONNECTION
55138 /* Next array element. */
55139 field_addr.sub_location->number = i;
55140#endif /* FREECIV_JSON_CONNECTION */
55141 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->road_output_incr_pct[i]);
55142 }
55143
55144#ifdef FREECIV_JSON_CONNECTION
55145 /* Exit array. */
55146 FC_FREE(field_addr.sub_location);
55147#endif /* FREECIV_JSON_CONNECTION */
55148 }
55149 if (e) {
55150 log_packet_detailed("'road_output_incr_pct' field error detected");
55151 }
55152 }
55153 if (BV_ISSET(fields, 16)) {
55154 log_packet_detailed(" field 'base_time' has changed");
55155#ifdef FREECIV_JSON_CONNECTION
55156 field_addr.name = "base_time";
55157#endif /* FREECIV_JSON_CONNECTION */
55158 e = 0;
55159 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_time);
55160 if (e) {
55161 log_packet_detailed("'base_time' field error detected");
55162 }
55163 }
55164 if (BV_ISSET(fields, 17)) {
55165 log_packet_detailed(" field 'road_time' has changed");
55166#ifdef FREECIV_JSON_CONNECTION
55167 field_addr.name = "road_time";
55168#endif /* FREECIV_JSON_CONNECTION */
55169 e = 0;
55170 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->road_time);
55171 if (e) {
55172 log_packet_detailed("'road_time' field error detected");
55173 }
55174 }
55175 if (BV_ISSET(fields, 18)) {
55176 log_packet_detailed(" field 'cultivate_result' has changed");
55177#ifdef FREECIV_JSON_CONNECTION
55178 field_addr.name = "cultivate_result";
55179#endif /* FREECIV_JSON_CONNECTION */
55180 e = 0;
55181 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_result);
55182 if (e) {
55183 log_packet_detailed("'cultivate_result' field error detected");
55184 }
55185 }
55186 if (BV_ISSET(fields, 19)) {
55187 log_packet_detailed(" field 'cultivate_time' has changed");
55188#ifdef FREECIV_JSON_CONNECTION
55189 field_addr.name = "cultivate_time";
55190#endif /* FREECIV_JSON_CONNECTION */
55191 e = 0;
55192 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_time);
55193 if (e) {
55194 log_packet_detailed("'cultivate_time' field error detected");
55195 }
55196 }
55197 if (BV_ISSET(fields, 20)) {
55198 log_packet_detailed(" field 'plant_result' has changed");
55199#ifdef FREECIV_JSON_CONNECTION
55200 field_addr.name = "plant_result";
55201#endif /* FREECIV_JSON_CONNECTION */
55202 e = 0;
55203 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_result);
55204 if (e) {
55205 log_packet_detailed("'plant_result' field error detected");
55206 }
55207 }
55208 if (BV_ISSET(fields, 21)) {
55209 log_packet_detailed(" field 'plant_time' has changed");
55210#ifdef FREECIV_JSON_CONNECTION
55211 field_addr.name = "plant_time";
55212#endif /* FREECIV_JSON_CONNECTION */
55213 e = 0;
55214 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_time);
55215 if (e) {
55216 log_packet_detailed("'plant_time' field error detected");
55217 }
55218 }
55219 if (BV_ISSET(fields, 22)) {
55220 log_packet_detailed(" field 'irrigation_food_incr' has changed");
55221#ifdef FREECIV_JSON_CONNECTION
55222 field_addr.name = "irrigation_food_incr";
55223#endif /* FREECIV_JSON_CONNECTION */
55224 e = 0;
55225 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_food_incr);
55226 if (e) {
55227 log_packet_detailed("'irrigation_food_incr' field error detected");
55228 }
55229 }
55230 if (BV_ISSET(fields, 23)) {
55231 log_packet_detailed(" field 'irrigation_time' has changed");
55232#ifdef FREECIV_JSON_CONNECTION
55233 field_addr.name = "irrigation_time";
55234#endif /* FREECIV_JSON_CONNECTION */
55235 e = 0;
55236 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_time);
55237 if (e) {
55238 log_packet_detailed("'irrigation_time' field error detected");
55239 }
55240 }
55241 if (BV_ISSET(fields, 24)) {
55242 log_packet_detailed(" field 'mining_shield_incr' has changed");
55243#ifdef FREECIV_JSON_CONNECTION
55244 field_addr.name = "mining_shield_incr";
55245#endif /* FREECIV_JSON_CONNECTION */
55246 e = 0;
55247 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_shield_incr);
55248 if (e) {
55249 log_packet_detailed("'mining_shield_incr' field error detected");
55250 }
55251 }
55252 if (BV_ISSET(fields, 25)) {
55253 log_packet_detailed(" field 'mining_time' has changed");
55254#ifdef FREECIV_JSON_CONNECTION
55255 field_addr.name = "mining_time";
55256#endif /* FREECIV_JSON_CONNECTION */
55257 e = 0;
55258 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_time);
55259 if (e) {
55260 log_packet_detailed("'mining_time' field error detected");
55261 }
55262 }
55263 if (BV_ISSET(fields, 26)) {
55264 log_packet_detailed(" field 'animal' has changed");
55265#ifdef FREECIV_JSON_CONNECTION
55266 field_addr.name = "animal";
55267#endif /* FREECIV_JSON_CONNECTION */
55268 e = 0;
55269 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->animal);
55270 if (e) {
55271 log_packet_detailed("'animal' field error detected");
55272 }
55273 }
55274 if (BV_ISSET(fields, 27)) {
55275 log_packet_detailed(" field 'transform_result' has changed");
55276#ifdef FREECIV_JSON_CONNECTION
55277 field_addr.name = "transform_result";
55278#endif /* FREECIV_JSON_CONNECTION */
55279 e = 0;
55280 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_result);
55281 if (e) {
55282 log_packet_detailed("'transform_result' field error detected");
55283 }
55284 }
55285 if (BV_ISSET(fields, 28)) {
55286 log_packet_detailed(" field 'transform_time' has changed");
55287#ifdef FREECIV_JSON_CONNECTION
55288 field_addr.name = "transform_time";
55289#endif /* FREECIV_JSON_CONNECTION */
55290 e = 0;
55291 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_time);
55292 if (e) {
55293 log_packet_detailed("'transform_time' field error detected");
55294 }
55295 }
55296 if (BV_ISSET(fields, 29)) {
55297 log_packet_detailed(" field 'placing_time' has changed");
55298#ifdef FREECIV_JSON_CONNECTION
55299 field_addr.name = "placing_time";
55300#endif /* FREECIV_JSON_CONNECTION */
55301 e = 0;
55302 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->placing_time);
55303 if (e) {
55304 log_packet_detailed("'placing_time' field error detected");
55305 }
55306 }
55307 if (BV_ISSET(fields, 30)) {
55308 log_packet_detailed(" field 'pillage_time' has changed");
55309#ifdef FREECIV_JSON_CONNECTION
55310 field_addr.name = "pillage_time";
55311#endif /* FREECIV_JSON_CONNECTION */
55312 e = 0;
55313 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pillage_time);
55314 if (e) {
55315 log_packet_detailed("'pillage_time' field error detected");
55316 }
55317 }
55318 if (BV_ISSET(fields, 31)) {
55319 log_packet_detailed(" field 'extra_count' has changed");
55320#ifdef FREECIV_JSON_CONNECTION
55321 field_addr.name = "extra_count";
55322#endif /* FREECIV_JSON_CONNECTION */
55323 e = 0;
55324 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_count);
55325 if (e) {
55326 log_packet_detailed("'extra_count' field error detected");
55327 }
55328 }
55329 if (BV_ISSET(fields, 32)) {
55330 log_packet_detailed(" field 'extra_removal_times' has changed");
55331#ifdef FREECIV_JSON_CONNECTION
55332 field_addr.name = "extra_removal_times";
55333#endif /* FREECIV_JSON_CONNECTION */
55334 e = 0;
55335 {
55336 int i;
55337
55338#ifdef FREECIV_JSON_CONNECTION
55339 /* Create the array. */
55340 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->extra_count);
55341
55342 /* Enter the array. */
55343 field_addr.sub_location = plocation_elem_new(0);
55344#endif /* FREECIV_JSON_CONNECTION */
55345
55346 for (i = 0; i < real_packet->extra_count; i++) {
55347#ifdef FREECIV_JSON_CONNECTION
55348 /* Next array element. */
55349 field_addr.sub_location->number = i;
55350#endif /* FREECIV_JSON_CONNECTION */
55351 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_removal_times[i]);
55352 }
55353
55354#ifdef FREECIV_JSON_CONNECTION
55355 /* Exit array. */
55356 FC_FREE(field_addr.sub_location);
55357#endif /* FREECIV_JSON_CONNECTION */
55358 }
55359 if (e) {
55360 log_packet_detailed("'extra_removal_times' field error detected");
55361 }
55362 }
55363 if (BV_ISSET(fields, 33)) {
55364 log_packet_detailed(" field 'color_red' has changed");
55365#ifdef FREECIV_JSON_CONNECTION
55366 field_addr.name = "color_red";
55367#endif /* FREECIV_JSON_CONNECTION */
55368 e = 0;
55369 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
55370 if (e) {
55371 log_packet_detailed("'color_red' field error detected");
55372 }
55373 }
55374 if (BV_ISSET(fields, 34)) {
55375 log_packet_detailed(" field 'color_green' has changed");
55376#ifdef FREECIV_JSON_CONNECTION
55377 field_addr.name = "color_green";
55378#endif /* FREECIV_JSON_CONNECTION */
55379 e = 0;
55380 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
55381 if (e) {
55382 log_packet_detailed("'color_green' field error detected");
55383 }
55384 }
55385 if (BV_ISSET(fields, 35)) {
55386 log_packet_detailed(" field 'color_blue' has changed");
55387#ifdef FREECIV_JSON_CONNECTION
55388 field_addr.name = "color_blue";
55389#endif /* FREECIV_JSON_CONNECTION */
55390 e = 0;
55391 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
55392 if (e) {
55393 log_packet_detailed("'color_blue' field error detected");
55394 }
55395 }
55396 if (BV_ISSET(fields, 36)) {
55397 log_packet_detailed(" field 'helptext' has changed");
55398#ifdef FREECIV_JSON_CONNECTION
55399 field_addr.name = "helptext";
55400#endif /* FREECIV_JSON_CONNECTION */
55401 e = 0;
55402 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
55403 if (e) {
55404 log_packet_detailed("'helptext' field error detected");
55405 }
55406 }
55407
55408 *old = *real_packet;
55409#endif /* FREECIV_DELTA_PROTOCOL */
55410#ifndef FREECIV_DELTA_PROTOCOL
55411#ifdef FREECIV_JSON_CONNECTION
55412 field_addr.name = "id";
55413#endif /* FREECIV_JSON_CONNECTION */
55414 e = 0;
55415 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
55416 if (e) {
55417 log_packet_detailed("'id' field error detected");
55418 }
55419#ifdef FREECIV_JSON_CONNECTION
55420 field_addr.name = "tclass";
55421#endif /* FREECIV_JSON_CONNECTION */
55422 e = 0;
55423 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tclass);
55424 if (e) {
55425 log_packet_detailed("'tclass' field error detected");
55426 }
55427#ifdef FREECIV_JSON_CONNECTION
55428 field_addr.name = "flags";
55429#endif /* FREECIV_JSON_CONNECTION */
55430 e = 0;
55431 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
55432 if (e) {
55433 log_packet_detailed("'flags' field error detected");
55434 }
55435#ifdef FREECIV_JSON_CONNECTION
55436 field_addr.name = "native_to";
55437#endif /* FREECIV_JSON_CONNECTION */
55438 e = 0;
55439 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
55440 if (e) {
55441 log_packet_detailed("'native_to' field error detected");
55442 }
55443#ifdef FREECIV_JSON_CONNECTION
55444 field_addr.name = "name";
55445#endif /* FREECIV_JSON_CONNECTION */
55446 e = 0;
55447 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
55448 if (e) {
55449 log_packet_detailed("'name' field error detected");
55450 }
55451#ifdef FREECIV_JSON_CONNECTION
55452 field_addr.name = "rule_name";
55453#endif /* FREECIV_JSON_CONNECTION */
55454 e = 0;
55455 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
55456 if (e) {
55457 log_packet_detailed("'rule_name' field error detected");
55458 }
55459#ifdef FREECIV_JSON_CONNECTION
55460 field_addr.name = "graphic_str";
55461#endif /* FREECIV_JSON_CONNECTION */
55462 e = 0;
55463 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
55464 if (e) {
55465 log_packet_detailed("'graphic_str' field error detected");
55466 }
55467#ifdef FREECIV_JSON_CONNECTION
55468 field_addr.name = "graphic_alt";
55469#endif /* FREECIV_JSON_CONNECTION */
55470 e = 0;
55471 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
55472 if (e) {
55473 log_packet_detailed("'graphic_alt' field error detected");
55474 }
55475#ifdef FREECIV_JSON_CONNECTION
55476 field_addr.name = "graphic_alt2";
55477#endif /* FREECIV_JSON_CONNECTION */
55478 e = 0;
55479 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt2);
55480 if (e) {
55481 log_packet_detailed("'graphic_alt2' field error detected");
55482 }
55483#ifdef FREECIV_JSON_CONNECTION
55484 field_addr.name = "movement_cost";
55485#endif /* FREECIV_JSON_CONNECTION */
55486 e = 0;
55487 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->movement_cost);
55488 if (e) {
55489 log_packet_detailed("'movement_cost' field error detected");
55490 }
55491#ifdef FREECIV_JSON_CONNECTION
55492 field_addr.name = "defense_bonus";
55493#endif /* FREECIV_JSON_CONNECTION */
55494 e = 0;
55495 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->defense_bonus);
55496 if (e) {
55497 log_packet_detailed("'defense_bonus' field error detected");
55498 }
55499#ifdef FREECIV_JSON_CONNECTION
55500 field_addr.name = "output";
55501#endif /* FREECIV_JSON_CONNECTION */
55502 e = 0;
55503 {
55504 int i;
55505
55506#ifdef FREECIV_JSON_CONNECTION
55507 /* Create the array. */
55508 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
55509
55510 /* Enter the array. */
55511 field_addr.sub_location = plocation_elem_new(0);
55512#endif /* FREECIV_JSON_CONNECTION */
55513
55514 for (i = 0; i < O_LAST; i++) {
55515#ifdef FREECIV_JSON_CONNECTION
55516 /* Next array element. */
55517 field_addr.sub_location->number = i;
55518#endif /* FREECIV_JSON_CONNECTION */
55519 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
55520 }
55521
55522#ifdef FREECIV_JSON_CONNECTION
55523 /* Exit array. */
55524 FC_FREE(field_addr.sub_location);
55525#endif /* FREECIV_JSON_CONNECTION */
55526 }
55527 if (e) {
55528 log_packet_detailed("'output' field error detected");
55529 }
55530#ifdef FREECIV_JSON_CONNECTION
55531 field_addr.name = "num_resources";
55532#endif /* FREECIV_JSON_CONNECTION */
55533 e = 0;
55534 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_resources);
55535 if (e) {
55536 log_packet_detailed("'num_resources' field error detected");
55537 }
55538#ifdef FREECIV_JSON_CONNECTION
55539 field_addr.name = "resources";
55540#endif /* FREECIV_JSON_CONNECTION */
55541 e = 0;
55542 {
55543 int i;
55544
55545#ifdef FREECIV_JSON_CONNECTION
55546 /* Create the array. */
55547 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
55548
55549 /* Enter the array. */
55550 field_addr.sub_location = plocation_elem_new(0);
55551#endif /* FREECIV_JSON_CONNECTION */
55552
55553 for (i = 0; i < real_packet->num_resources; i++) {
55554#ifdef FREECIV_JSON_CONNECTION
55555 /* Next array element. */
55556 field_addr.sub_location->number = i;
55557#endif /* FREECIV_JSON_CONNECTION */
55558 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resources[i]);
55559 }
55560
55561#ifdef FREECIV_JSON_CONNECTION
55562 /* Exit array. */
55563 FC_FREE(field_addr.sub_location);
55564#endif /* FREECIV_JSON_CONNECTION */
55565 }
55566 if (e) {
55567 log_packet_detailed("'resources' field error detected");
55568 }
55569#ifdef FREECIV_JSON_CONNECTION
55570 field_addr.name = "resource_freq";
55571#endif /* FREECIV_JSON_CONNECTION */
55572 e = 0;
55573 {
55574 int i;
55575
55576#ifdef FREECIV_JSON_CONNECTION
55577 /* Create the array. */
55578 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->num_resources);
55579
55580 /* Enter the array. */
55581 field_addr.sub_location = plocation_elem_new(0);
55582#endif /* FREECIV_JSON_CONNECTION */
55583
55584 for (i = 0; i < real_packet->num_resources; i++) {
55585#ifdef FREECIV_JSON_CONNECTION
55586 /* Next array element. */
55587 field_addr.sub_location->number = i;
55588#endif /* FREECIV_JSON_CONNECTION */
55589 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource_freq[i]);
55590 }
55591
55592#ifdef FREECIV_JSON_CONNECTION
55593 /* Exit array. */
55594 FC_FREE(field_addr.sub_location);
55595#endif /* FREECIV_JSON_CONNECTION */
55596 }
55597 if (e) {
55598 log_packet_detailed("'resource_freq' field error detected");
55599 }
55600#ifdef FREECIV_JSON_CONNECTION
55601 field_addr.name = "road_output_incr_pct";
55602#endif /* FREECIV_JSON_CONNECTION */
55603 e = 0;
55604 {
55605 int i;
55606
55607#ifdef FREECIV_JSON_CONNECTION
55608 /* Create the array. */
55609 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
55610
55611 /* Enter the array. */
55612 field_addr.sub_location = plocation_elem_new(0);
55613#endif /* FREECIV_JSON_CONNECTION */
55614
55615 for (i = 0; i < O_LAST; i++) {
55616#ifdef FREECIV_JSON_CONNECTION
55617 /* Next array element. */
55618 field_addr.sub_location->number = i;
55619#endif /* FREECIV_JSON_CONNECTION */
55620 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->road_output_incr_pct[i]);
55621 }
55622
55623#ifdef FREECIV_JSON_CONNECTION
55624 /* Exit array. */
55625 FC_FREE(field_addr.sub_location);
55626#endif /* FREECIV_JSON_CONNECTION */
55627 }
55628 if (e) {
55629 log_packet_detailed("'road_output_incr_pct' field error detected");
55630 }
55631#ifdef FREECIV_JSON_CONNECTION
55632 field_addr.name = "base_time";
55633#endif /* FREECIV_JSON_CONNECTION */
55634 e = 0;
55635 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->base_time);
55636 if (e) {
55637 log_packet_detailed("'base_time' field error detected");
55638 }
55639#ifdef FREECIV_JSON_CONNECTION
55640 field_addr.name = "road_time";
55641#endif /* FREECIV_JSON_CONNECTION */
55642 e = 0;
55643 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->road_time);
55644 if (e) {
55645 log_packet_detailed("'road_time' field error detected");
55646 }
55647#ifdef FREECIV_JSON_CONNECTION
55648 field_addr.name = "cultivate_result";
55649#endif /* FREECIV_JSON_CONNECTION */
55650 e = 0;
55651 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_result);
55652 if (e) {
55653 log_packet_detailed("'cultivate_result' field error detected");
55654 }
55655#ifdef FREECIV_JSON_CONNECTION
55656 field_addr.name = "cultivate_time";
55657#endif /* FREECIV_JSON_CONNECTION */
55658 e = 0;
55659 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cultivate_time);
55660 if (e) {
55661 log_packet_detailed("'cultivate_time' field error detected");
55662 }
55663#ifdef FREECIV_JSON_CONNECTION
55664 field_addr.name = "plant_result";
55665#endif /* FREECIV_JSON_CONNECTION */
55666 e = 0;
55667 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_result);
55668 if (e) {
55669 log_packet_detailed("'plant_result' field error detected");
55670 }
55671#ifdef FREECIV_JSON_CONNECTION
55672 field_addr.name = "plant_time";
55673#endif /* FREECIV_JSON_CONNECTION */
55674 e = 0;
55675 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->plant_time);
55676 if (e) {
55677 log_packet_detailed("'plant_time' field error detected");
55678 }
55679#ifdef FREECIV_JSON_CONNECTION
55680 field_addr.name = "irrigation_food_incr";
55681#endif /* FREECIV_JSON_CONNECTION */
55682 e = 0;
55683 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_food_incr);
55684 if (e) {
55685 log_packet_detailed("'irrigation_food_incr' field error detected");
55686 }
55687#ifdef FREECIV_JSON_CONNECTION
55688 field_addr.name = "irrigation_time";
55689#endif /* FREECIV_JSON_CONNECTION */
55690 e = 0;
55691 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->irrigation_time);
55692 if (e) {
55693 log_packet_detailed("'irrigation_time' field error detected");
55694 }
55695#ifdef FREECIV_JSON_CONNECTION
55696 field_addr.name = "mining_shield_incr";
55697#endif /* FREECIV_JSON_CONNECTION */
55698 e = 0;
55699 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_shield_incr);
55700 if (e) {
55701 log_packet_detailed("'mining_shield_incr' field error detected");
55702 }
55703#ifdef FREECIV_JSON_CONNECTION
55704 field_addr.name = "mining_time";
55705#endif /* FREECIV_JSON_CONNECTION */
55706 e = 0;
55707 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->mining_time);
55708 if (e) {
55709 log_packet_detailed("'mining_time' field error detected");
55710 }
55711#ifdef FREECIV_JSON_CONNECTION
55712 field_addr.name = "animal";
55713#endif /* FREECIV_JSON_CONNECTION */
55714 e = 0;
55715 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->animal);
55716 if (e) {
55717 log_packet_detailed("'animal' field error detected");
55718 }
55719#ifdef FREECIV_JSON_CONNECTION
55720 field_addr.name = "transform_result";
55721#endif /* FREECIV_JSON_CONNECTION */
55722 e = 0;
55723 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_result);
55724 if (e) {
55725 log_packet_detailed("'transform_result' field error detected");
55726 }
55727#ifdef FREECIV_JSON_CONNECTION
55728 field_addr.name = "transform_time";
55729#endif /* FREECIV_JSON_CONNECTION */
55730 e = 0;
55731 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->transform_time);
55732 if (e) {
55733 log_packet_detailed("'transform_time' field error detected");
55734 }
55735#ifdef FREECIV_JSON_CONNECTION
55736 field_addr.name = "placing_time";
55737#endif /* FREECIV_JSON_CONNECTION */
55738 e = 0;
55739 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->placing_time);
55740 if (e) {
55741 log_packet_detailed("'placing_time' field error detected");
55742 }
55743#ifdef FREECIV_JSON_CONNECTION
55744 field_addr.name = "pillage_time";
55745#endif /* FREECIV_JSON_CONNECTION */
55746 e = 0;
55747 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->pillage_time);
55748 if (e) {
55749 log_packet_detailed("'pillage_time' field error detected");
55750 }
55751#ifdef FREECIV_JSON_CONNECTION
55752 field_addr.name = "extra_count";
55753#endif /* FREECIV_JSON_CONNECTION */
55754 e = 0;
55755 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_count);
55756 if (e) {
55757 log_packet_detailed("'extra_count' field error detected");
55758 }
55759#ifdef FREECIV_JSON_CONNECTION
55760 field_addr.name = "extra_removal_times";
55761#endif /* FREECIV_JSON_CONNECTION */
55762 e = 0;
55763 {
55764 int i;
55765
55766#ifdef FREECIV_JSON_CONNECTION
55767 /* Create the array. */
55768 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->extra_count);
55769
55770 /* Enter the array. */
55771 field_addr.sub_location = plocation_elem_new(0);
55772#endif /* FREECIV_JSON_CONNECTION */
55773
55774 for (i = 0; i < real_packet->extra_count; i++) {
55775#ifdef FREECIV_JSON_CONNECTION
55776 /* Next array element. */
55777 field_addr.sub_location->number = i;
55778#endif /* FREECIV_JSON_CONNECTION */
55779 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->extra_removal_times[i]);
55780 }
55781
55782#ifdef FREECIV_JSON_CONNECTION
55783 /* Exit array. */
55784 FC_FREE(field_addr.sub_location);
55785#endif /* FREECIV_JSON_CONNECTION */
55786 }
55787 if (e) {
55788 log_packet_detailed("'extra_removal_times' field error detected");
55789 }
55790#ifdef FREECIV_JSON_CONNECTION
55791 field_addr.name = "color_red";
55792#endif /* FREECIV_JSON_CONNECTION */
55793 e = 0;
55794 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_red);
55795 if (e) {
55796 log_packet_detailed("'color_red' field error detected");
55797 }
55798#ifdef FREECIV_JSON_CONNECTION
55799 field_addr.name = "color_green";
55800#endif /* FREECIV_JSON_CONNECTION */
55801 e = 0;
55802 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_green);
55803 if (e) {
55804 log_packet_detailed("'color_green' field error detected");
55805 }
55806#ifdef FREECIV_JSON_CONNECTION
55807 field_addr.name = "color_blue";
55808#endif /* FREECIV_JSON_CONNECTION */
55809 e = 0;
55810 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->color_blue);
55811 if (e) {
55812 log_packet_detailed("'color_blue' field error detected");
55813 }
55814#ifdef FREECIV_JSON_CONNECTION
55815 field_addr.name = "helptext";
55816#endif /* FREECIV_JSON_CONNECTION */
55817 e = 0;
55818 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
55819 if (e) {
55820 log_packet_detailed("'helptext' field error detected");
55821 }
55822
55823#endif
55824 SEND_PACKET_END(PACKET_RULESET_TERRAIN);
55825}
55826
55827 int send_packet_ruleset_terrain(struct connection *pc, const struct packet_ruleset_terrain *packet)
55828{
55829 if (!pc->used) {
55830 log_error("WARNING: trying to send data to the closed connection %s",
55831 conn_description(pc));
55832 return -1;
55833 }
55834 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN].packet != NULL, -1,
55835 "Handler for PACKET_RULESET_TERRAIN not installed");
55836 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN].packet(pc, packet);
55837}
55838
55839 void lsend_packet_ruleset_terrain(struct conn_list *dest, const struct packet_ruleset_terrain *packet)
55840{
55841 conn_list_iterate(dest, pconn) {
55842 send_packet_ruleset_terrain(pconn, packet);
55843 } conn_list_iterate_end;
55844}
55845
55846#ifdef FREECIV_DELTA_PROTOCOL
55847#define hash_packet_ruleset_terrain_flag_100 hash_const
55848
55849#define cmp_packet_ruleset_terrain_flag_100 cmp_const
55850
55851 BV_DEFINE(packet_ruleset_terrain_flag_100_fields, 3);
55852#endif /* FREECIV_DELTA_PROTOCOL */
55853
55854 static struct packet_ruleset_terrain_flag *receive_packet_ruleset_terrain_flag_100(struct connection *pc)
55855{
55856#ifdef FREECIV_DELTA_PROTOCOL
55857 packet_ruleset_terrain_flag_100_fields fields;
55858 struct packet_ruleset_terrain_flag *old;
55859 struct genhash **hash = pc->phs.received + PACKET_RULESET_TERRAIN_FLAG;
55860#endif /* FREECIV_DELTA_PROTOCOL */
55861 RECEIVE_PACKET_START(packet_ruleset_terrain_flag, real_packet);
55862#ifdef FREECIV_JSON_CONNECTION
55863 struct plocation field_addr;
55864 {
55865 struct plocation *field_addr_tmp = plocation_field_new(NULL);
55866 field_addr = *field_addr_tmp;
55867 FC_FREE(field_addr_tmp);
55868 }
55869#endif /* FREECIV_JSON_CONNECTION */
55870
55871#ifdef FREECIV_DELTA_PROTOCOL
55872#ifdef FREECIV_JSON_CONNECTION
55873 field_addr.name = "fields";
55874#endif /* FREECIV_JSON_CONNECTION */
55875 DIO_BV_GET(&din, &field_addr, fields);
55876
55877#else /* FREECIV_DELTA_PROTOCOL */
55878#ifdef FREECIV_JSON_CONNECTION
55879 field_addr.name = "id";
55880#endif /* FREECIV_JSON_CONNECTION */
55881 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
55882 RECEIVE_PACKET_FIELD_ERROR(id);
55883 }
55884#ifdef FREECIV_JSON_CONNECTION
55885 field_addr.name = "name";
55886#endif /* FREECIV_JSON_CONNECTION */
55887 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
55888 RECEIVE_PACKET_FIELD_ERROR(name);
55889 }
55890#ifdef FREECIV_JSON_CONNECTION
55891 field_addr.name = "helptxt";
55892#endif /* FREECIV_JSON_CONNECTION */
55893 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
55894 RECEIVE_PACKET_FIELD_ERROR(helptxt);
55895 }
55896#endif
55897 log_packet_detailed("packet_ruleset_terrain_flag_100: got info about ()");
55898
55899#ifdef FREECIV_DELTA_PROTOCOL
55900 if (NULL == *hash) {
55901 *hash = genhash_new_full(hash_packet_ruleset_terrain_flag_100, cmp_packet_ruleset_terrain_flag_100,
55902 NULL, NULL, NULL, free);
55903 }
55904
55905 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
55906 *real_packet = *old;
55907 } else {
55908 log_packet_detailed(" no old info");
55909 memset(real_packet, 0, sizeof(*real_packet));
55910 }
55911
55912 if (BV_ISSET(fields, 0)) {
55913 log_packet_detailed(" got field 'id'");
55914#ifdef FREECIV_JSON_CONNECTION
55915 field_addr.name = "id";
55916#endif /* FREECIV_JSON_CONNECTION */
55917 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
55918 RECEIVE_PACKET_FIELD_ERROR(id);
55919 }
55920 }
55921 if (BV_ISSET(fields, 1)) {
55922 log_packet_detailed(" got field 'name'");
55923#ifdef FREECIV_JSON_CONNECTION
55924 field_addr.name = "name";
55925#endif /* FREECIV_JSON_CONNECTION */
55926 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
55927 RECEIVE_PACKET_FIELD_ERROR(name);
55928 }
55929 }
55930 if (BV_ISSET(fields, 2)) {
55931 log_packet_detailed(" got field 'helptxt'");
55932#ifdef FREECIV_JSON_CONNECTION
55933 field_addr.name = "helptxt";
55934#endif /* FREECIV_JSON_CONNECTION */
55935 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
55936 RECEIVE_PACKET_FIELD_ERROR(helptxt);
55937 }
55938 }
55939
55940 if (NULL == old) {
55941 old = fc_malloc(sizeof(*old));
55942 *old = *real_packet;
55943 genhash_insert(*hash, old, old);
55944 } else {
55945 *old = *real_packet;
55946 }
55947
55948#endif /* FREECIV_DELTA_PROTOCOL */
55949 RECEIVE_PACKET_END(real_packet);
55950}
55951
55952 static int send_packet_ruleset_terrain_flag_100(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
55953{
55954 const struct packet_ruleset_terrain_flag *real_packet = packet;
55955 int e;
55956#ifdef FREECIV_DELTA_PROTOCOL
55957 packet_ruleset_terrain_flag_100_fields fields;
55958 struct packet_ruleset_terrain_flag *old;
55959 bool differ;
55960 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TERRAIN_FLAG;
55961#endif /* FREECIV_DELTA_PROTOCOL */
55962 SEND_PACKET_START(PACKET_RULESET_TERRAIN_FLAG);
55963#ifdef FREECIV_JSON_CONNECTION
55964 struct plocation field_addr;
55965 {
55966 struct plocation *field_addr_tmp = plocation_field_new(NULL);
55967 field_addr = *field_addr_tmp;
55968 FC_FREE(field_addr_tmp);
55969 }
55970#endif /* FREECIV_JSON_CONNECTION */
55971
55972 log_packet_detailed("packet_ruleset_terrain_flag_100: sending info about ()");
55973
55974#ifdef FREECIV_DELTA_PROTOCOL
55975 if (NULL == *hash) {
55976 *hash = genhash_new_full(hash_packet_ruleset_terrain_flag_100, cmp_packet_ruleset_terrain_flag_100,
55977 NULL, NULL, NULL, free);
55978 }
55979 BV_CLR_ALL(fields);
55980
55981 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
55982 old = fc_malloc(sizeof(*old));
55983 *old = *real_packet;
55984 genhash_insert(*hash, old, old);
55985 memset(old, 0, sizeof(*old));
55986 }
55987 differ = (old->id != real_packet->id);
55988 if (differ) {
55989 BV_SET(fields, 0);
55990 }
55991
55992 differ = (strcmp(old->name, real_packet->name) != 0);
55993 if (differ) {
55994 BV_SET(fields, 1);
55995 }
55996
55997 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
55998 if (differ) {
55999 BV_SET(fields, 2);
56000 }
56001
56002
56003#ifdef FREECIV_JSON_CONNECTION
56004 field_addr.name = "fields";
56005#endif /* FREECIV_JSON_CONNECTION */
56006 e = 0;
56007 e |= DIO_BV_PUT(&dout, &field_addr, fields);
56008 if (e) {
56009 log_packet_detailed("fields bitvector error detected");
56010 }
56011
56012 if (BV_ISSET(fields, 0)) {
56013 log_packet_detailed(" field 'id' has changed");
56014#ifdef FREECIV_JSON_CONNECTION
56015 field_addr.name = "id";
56016#endif /* FREECIV_JSON_CONNECTION */
56017 e = 0;
56018 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56019 if (e) {
56020 log_packet_detailed("'id' field error detected");
56021 }
56022 }
56023 if (BV_ISSET(fields, 1)) {
56024 log_packet_detailed(" field 'name' has changed");
56025#ifdef FREECIV_JSON_CONNECTION
56026 field_addr.name = "name";
56027#endif /* FREECIV_JSON_CONNECTION */
56028 e = 0;
56029 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56030 if (e) {
56031 log_packet_detailed("'name' field error detected");
56032 }
56033 }
56034 if (BV_ISSET(fields, 2)) {
56035 log_packet_detailed(" field 'helptxt' has changed");
56036#ifdef FREECIV_JSON_CONNECTION
56037 field_addr.name = "helptxt";
56038#endif /* FREECIV_JSON_CONNECTION */
56039 e = 0;
56040 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
56041 if (e) {
56042 log_packet_detailed("'helptxt' field error detected");
56043 }
56044 }
56045
56046 *old = *real_packet;
56047#endif /* FREECIV_DELTA_PROTOCOL */
56048#ifndef FREECIV_DELTA_PROTOCOL
56049#ifdef FREECIV_JSON_CONNECTION
56050 field_addr.name = "id";
56051#endif /* FREECIV_JSON_CONNECTION */
56052 e = 0;
56053 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56054 if (e) {
56055 log_packet_detailed("'id' field error detected");
56056 }
56057#ifdef FREECIV_JSON_CONNECTION
56058 field_addr.name = "name";
56059#endif /* FREECIV_JSON_CONNECTION */
56060 e = 0;
56061 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56062 if (e) {
56063 log_packet_detailed("'name' field error detected");
56064 }
56065#ifdef FREECIV_JSON_CONNECTION
56066 field_addr.name = "helptxt";
56067#endif /* FREECIV_JSON_CONNECTION */
56068 e = 0;
56069 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
56070 if (e) {
56071 log_packet_detailed("'helptxt' field error detected");
56072 }
56073
56074#endif
56075 SEND_PACKET_END(PACKET_RULESET_TERRAIN_FLAG);
56076}
56077
56078 int send_packet_ruleset_terrain_flag(struct connection *pc, const struct packet_ruleset_terrain_flag *packet)
56079{
56080 if (!pc->used) {
56081 log_error("WARNING: trying to send data to the closed connection %s",
56082 conn_description(pc));
56083 return -1;
56084 }
56085 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TERRAIN_FLAG].packet != NULL, -1,
56086 "Handler for PACKET_RULESET_TERRAIN_FLAG not installed");
56087 return pc->phs.handlers->send[PACKET_RULESET_TERRAIN_FLAG].packet(pc, packet);
56088}
56089
56090 void lsend_packet_ruleset_terrain_flag(struct conn_list *dest, const struct packet_ruleset_terrain_flag *packet)
56091{
56092 conn_list_iterate(dest, pconn) {
56093 send_packet_ruleset_terrain_flag(pconn, packet);
56094 } conn_list_iterate_end;
56095}
56096
56097#ifdef FREECIV_DELTA_PROTOCOL
56098#define hash_packet_ruleset_unit_class_100 hash_const
56099
56100#define cmp_packet_ruleset_unit_class_100 cmp_const
56101
56102 BV_DEFINE(packet_ruleset_unit_class_100_fields, 8);
56103#endif /* FREECIV_DELTA_PROTOCOL */
56104
56105 static struct packet_ruleset_unit_class *receive_packet_ruleset_unit_class_100(struct connection *pc)
56106{
56107#ifdef FREECIV_DELTA_PROTOCOL
56108 packet_ruleset_unit_class_100_fields fields;
56109 struct packet_ruleset_unit_class *old;
56110 struct genhash **hash = pc->phs.received + PACKET_RULESET_UNIT_CLASS;
56111#endif /* FREECIV_DELTA_PROTOCOL */
56112 RECEIVE_PACKET_START(packet_ruleset_unit_class, real_packet);
56113#ifdef FREECIV_JSON_CONNECTION
56114 struct plocation field_addr;
56115 {
56116 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56117 field_addr = *field_addr_tmp;
56118 FC_FREE(field_addr_tmp);
56119 }
56120#endif /* FREECIV_JSON_CONNECTION */
56121
56122#ifdef FREECIV_DELTA_PROTOCOL
56123#ifdef FREECIV_JSON_CONNECTION
56124 field_addr.name = "fields";
56125#endif /* FREECIV_JSON_CONNECTION */
56126 DIO_BV_GET(&din, &field_addr, fields);
56127
56128#else /* FREECIV_DELTA_PROTOCOL */
56129#ifdef FREECIV_JSON_CONNECTION
56130 field_addr.name = "id";
56131#endif /* FREECIV_JSON_CONNECTION */
56132 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56133 RECEIVE_PACKET_FIELD_ERROR(id);
56134 }
56135#ifdef FREECIV_JSON_CONNECTION
56136 field_addr.name = "name";
56137#endif /* FREECIV_JSON_CONNECTION */
56138 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56139 RECEIVE_PACKET_FIELD_ERROR(name);
56140 }
56141#ifdef FREECIV_JSON_CONNECTION
56142 field_addr.name = "rule_name";
56143#endif /* FREECIV_JSON_CONNECTION */
56144 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
56145 RECEIVE_PACKET_FIELD_ERROR(rule_name);
56146 }
56147#ifdef FREECIV_JSON_CONNECTION
56148 field_addr.name = "min_speed";
56149#endif /* FREECIV_JSON_CONNECTION */
56150 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->min_speed)) {
56151 RECEIVE_PACKET_FIELD_ERROR(min_speed);
56152 }
56153#ifdef FREECIV_JSON_CONNECTION
56154 field_addr.name = "hp_loss_pct";
56155#endif /* FREECIV_JSON_CONNECTION */
56156 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp_loss_pct)) {
56157 RECEIVE_PACKET_FIELD_ERROR(hp_loss_pct);
56158 }
56159#ifdef FREECIV_JSON_CONNECTION
56160 field_addr.name = "non_native_def_pct";
56161#endif /* FREECIV_JSON_CONNECTION */
56162 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->non_native_def_pct)) {
56163 RECEIVE_PACKET_FIELD_ERROR(non_native_def_pct);
56164 }
56165#ifdef FREECIV_JSON_CONNECTION
56166 field_addr.name = "flags";
56167#endif /* FREECIV_JSON_CONNECTION */
56168 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
56169 RECEIVE_PACKET_FIELD_ERROR(flags);
56170 }
56171#ifdef FREECIV_JSON_CONNECTION
56172 field_addr.name = "helptext";
56173#endif /* FREECIV_JSON_CONNECTION */
56174 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
56175 RECEIVE_PACKET_FIELD_ERROR(helptext);
56176 }
56177#endif
56178 log_packet_detailed("packet_ruleset_unit_class_100: got info about ()");
56179
56180#ifdef FREECIV_DELTA_PROTOCOL
56181 if (NULL == *hash) {
56182 *hash = genhash_new_full(hash_packet_ruleset_unit_class_100, cmp_packet_ruleset_unit_class_100,
56183 NULL, NULL, NULL, free);
56184 }
56185
56186 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
56187 *real_packet = *old;
56188 } else {
56189 log_packet_detailed(" no old info");
56190 memset(real_packet, 0, sizeof(*real_packet));
56191 }
56192
56193 if (BV_ISSET(fields, 0)) {
56194 log_packet_detailed(" got field 'id'");
56195#ifdef FREECIV_JSON_CONNECTION
56196 field_addr.name = "id";
56197#endif /* FREECIV_JSON_CONNECTION */
56198 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56199 RECEIVE_PACKET_FIELD_ERROR(id);
56200 }
56201 }
56202 if (BV_ISSET(fields, 1)) {
56203 log_packet_detailed(" got field 'name'");
56204#ifdef FREECIV_JSON_CONNECTION
56205 field_addr.name = "name";
56206#endif /* FREECIV_JSON_CONNECTION */
56207 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56208 RECEIVE_PACKET_FIELD_ERROR(name);
56209 }
56210 }
56211 if (BV_ISSET(fields, 2)) {
56212 log_packet_detailed(" got field 'rule_name'");
56213#ifdef FREECIV_JSON_CONNECTION
56214 field_addr.name = "rule_name";
56215#endif /* FREECIV_JSON_CONNECTION */
56216 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
56217 RECEIVE_PACKET_FIELD_ERROR(rule_name);
56218 }
56219 }
56220 if (BV_ISSET(fields, 3)) {
56221 log_packet_detailed(" got field 'min_speed'");
56222#ifdef FREECIV_JSON_CONNECTION
56223 field_addr.name = "min_speed";
56224#endif /* FREECIV_JSON_CONNECTION */
56225 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->min_speed)) {
56226 RECEIVE_PACKET_FIELD_ERROR(min_speed);
56227 }
56228 }
56229 if (BV_ISSET(fields, 4)) {
56230 log_packet_detailed(" got field 'hp_loss_pct'");
56231#ifdef FREECIV_JSON_CONNECTION
56232 field_addr.name = "hp_loss_pct";
56233#endif /* FREECIV_JSON_CONNECTION */
56234 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp_loss_pct)) {
56235 RECEIVE_PACKET_FIELD_ERROR(hp_loss_pct);
56236 }
56237 }
56238 if (BV_ISSET(fields, 5)) {
56239 log_packet_detailed(" got field 'non_native_def_pct'");
56240#ifdef FREECIV_JSON_CONNECTION
56241 field_addr.name = "non_native_def_pct";
56242#endif /* FREECIV_JSON_CONNECTION */
56243 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->non_native_def_pct)) {
56244 RECEIVE_PACKET_FIELD_ERROR(non_native_def_pct);
56245 }
56246 }
56247 if (BV_ISSET(fields, 6)) {
56248 log_packet_detailed(" got field 'flags'");
56249#ifdef FREECIV_JSON_CONNECTION
56250 field_addr.name = "flags";
56251#endif /* FREECIV_JSON_CONNECTION */
56252 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
56253 RECEIVE_PACKET_FIELD_ERROR(flags);
56254 }
56255 }
56256 if (BV_ISSET(fields, 7)) {
56257 log_packet_detailed(" got field 'helptext'");
56258#ifdef FREECIV_JSON_CONNECTION
56259 field_addr.name = "helptext";
56260#endif /* FREECIV_JSON_CONNECTION */
56261 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
56262 RECEIVE_PACKET_FIELD_ERROR(helptext);
56263 }
56264 }
56265
56266 if (NULL == old) {
56267 old = fc_malloc(sizeof(*old));
56268 *old = *real_packet;
56269 genhash_insert(*hash, old, old);
56270 } else {
56271 *old = *real_packet;
56272 }
56273
56274#endif /* FREECIV_DELTA_PROTOCOL */
56275 RECEIVE_PACKET_END(real_packet);
56276}
56277
56278 static int send_packet_ruleset_unit_class_100(struct connection *pc, const struct packet_ruleset_unit_class *packet)
56279{
56280 const struct packet_ruleset_unit_class *real_packet = packet;
56281 int e;
56282#ifdef FREECIV_DELTA_PROTOCOL
56283 packet_ruleset_unit_class_100_fields fields;
56284 struct packet_ruleset_unit_class *old;
56285 bool differ;
56286 struct genhash **hash = pc->phs.sent + PACKET_RULESET_UNIT_CLASS;
56287#endif /* FREECIV_DELTA_PROTOCOL */
56288 SEND_PACKET_START(PACKET_RULESET_UNIT_CLASS);
56289#ifdef FREECIV_JSON_CONNECTION
56290 struct plocation field_addr;
56291 {
56292 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56293 field_addr = *field_addr_tmp;
56294 FC_FREE(field_addr_tmp);
56295 }
56296#endif /* FREECIV_JSON_CONNECTION */
56297
56298 log_packet_detailed("packet_ruleset_unit_class_100: sending info about ()");
56299
56300#ifdef FREECIV_DELTA_PROTOCOL
56301 if (NULL == *hash) {
56302 *hash = genhash_new_full(hash_packet_ruleset_unit_class_100, cmp_packet_ruleset_unit_class_100,
56303 NULL, NULL, NULL, free);
56304 }
56305 BV_CLR_ALL(fields);
56306
56307 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
56308 old = fc_malloc(sizeof(*old));
56309 *old = *real_packet;
56310 genhash_insert(*hash, old, old);
56311 memset(old, 0, sizeof(*old));
56312 }
56313 differ = (old->id != real_packet->id);
56314 if (differ) {
56315 BV_SET(fields, 0);
56316 }
56317
56318 differ = (strcmp(old->name, real_packet->name) != 0);
56319 if (differ) {
56320 BV_SET(fields, 1);
56321 }
56322
56323 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
56324 if (differ) {
56325 BV_SET(fields, 2);
56326 }
56327
56328 differ = (old->min_speed != real_packet->min_speed);
56329 if (differ) {
56330 BV_SET(fields, 3);
56331 }
56332
56333 differ = (old->hp_loss_pct != real_packet->hp_loss_pct);
56334 if (differ) {
56335 BV_SET(fields, 4);
56336 }
56337
56338 differ = (old->non_native_def_pct != real_packet->non_native_def_pct);
56339 if (differ) {
56340 BV_SET(fields, 5);
56341 }
56342
56343 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
56344 if (differ) {
56345 BV_SET(fields, 6);
56346 }
56347
56348 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
56349 if (differ) {
56350 BV_SET(fields, 7);
56351 }
56352
56353
56354#ifdef FREECIV_JSON_CONNECTION
56355 field_addr.name = "fields";
56356#endif /* FREECIV_JSON_CONNECTION */
56357 e = 0;
56358 e |= DIO_BV_PUT(&dout, &field_addr, fields);
56359 if (e) {
56360 log_packet_detailed("fields bitvector error detected");
56361 }
56362
56363 if (BV_ISSET(fields, 0)) {
56364 log_packet_detailed(" field 'id' has changed");
56365#ifdef FREECIV_JSON_CONNECTION
56366 field_addr.name = "id";
56367#endif /* FREECIV_JSON_CONNECTION */
56368 e = 0;
56369 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56370 if (e) {
56371 log_packet_detailed("'id' field error detected");
56372 }
56373 }
56374 if (BV_ISSET(fields, 1)) {
56375 log_packet_detailed(" field 'name' has changed");
56376#ifdef FREECIV_JSON_CONNECTION
56377 field_addr.name = "name";
56378#endif /* FREECIV_JSON_CONNECTION */
56379 e = 0;
56380 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56381 if (e) {
56382 log_packet_detailed("'name' field error detected");
56383 }
56384 }
56385 if (BV_ISSET(fields, 2)) {
56386 log_packet_detailed(" field 'rule_name' has changed");
56387#ifdef FREECIV_JSON_CONNECTION
56388 field_addr.name = "rule_name";
56389#endif /* FREECIV_JSON_CONNECTION */
56390 e = 0;
56391 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
56392 if (e) {
56393 log_packet_detailed("'rule_name' field error detected");
56394 }
56395 }
56396 if (BV_ISSET(fields, 3)) {
56397 log_packet_detailed(" field 'min_speed' has changed");
56398#ifdef FREECIV_JSON_CONNECTION
56399 field_addr.name = "min_speed";
56400#endif /* FREECIV_JSON_CONNECTION */
56401 e = 0;
56402 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->min_speed);
56403 if (e) {
56404 log_packet_detailed("'min_speed' field error detected");
56405 }
56406 }
56407 if (BV_ISSET(fields, 4)) {
56408 log_packet_detailed(" field 'hp_loss_pct' has changed");
56409#ifdef FREECIV_JSON_CONNECTION
56410 field_addr.name = "hp_loss_pct";
56411#endif /* FREECIV_JSON_CONNECTION */
56412 e = 0;
56413 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp_loss_pct);
56414 if (e) {
56415 log_packet_detailed("'hp_loss_pct' field error detected");
56416 }
56417 }
56418 if (BV_ISSET(fields, 5)) {
56419 log_packet_detailed(" field 'non_native_def_pct' has changed");
56420#ifdef FREECIV_JSON_CONNECTION
56421 field_addr.name = "non_native_def_pct";
56422#endif /* FREECIV_JSON_CONNECTION */
56423 e = 0;
56424 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->non_native_def_pct);
56425 if (e) {
56426 log_packet_detailed("'non_native_def_pct' field error detected");
56427 }
56428 }
56429 if (BV_ISSET(fields, 6)) {
56430 log_packet_detailed(" field 'flags' has changed");
56431#ifdef FREECIV_JSON_CONNECTION
56432 field_addr.name = "flags";
56433#endif /* FREECIV_JSON_CONNECTION */
56434 e = 0;
56435 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
56436 if (e) {
56437 log_packet_detailed("'flags' field error detected");
56438 }
56439 }
56440 if (BV_ISSET(fields, 7)) {
56441 log_packet_detailed(" field 'helptext' has changed");
56442#ifdef FREECIV_JSON_CONNECTION
56443 field_addr.name = "helptext";
56444#endif /* FREECIV_JSON_CONNECTION */
56445 e = 0;
56446 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
56447 if (e) {
56448 log_packet_detailed("'helptext' field error detected");
56449 }
56450 }
56451
56452 *old = *real_packet;
56453#endif /* FREECIV_DELTA_PROTOCOL */
56454#ifndef FREECIV_DELTA_PROTOCOL
56455#ifdef FREECIV_JSON_CONNECTION
56456 field_addr.name = "id";
56457#endif /* FREECIV_JSON_CONNECTION */
56458 e = 0;
56459 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
56460 if (e) {
56461 log_packet_detailed("'id' field error detected");
56462 }
56463#ifdef FREECIV_JSON_CONNECTION
56464 field_addr.name = "name";
56465#endif /* FREECIV_JSON_CONNECTION */
56466 e = 0;
56467 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
56468 if (e) {
56469 log_packet_detailed("'name' field error detected");
56470 }
56471#ifdef FREECIV_JSON_CONNECTION
56472 field_addr.name = "rule_name";
56473#endif /* FREECIV_JSON_CONNECTION */
56474 e = 0;
56475 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
56476 if (e) {
56477 log_packet_detailed("'rule_name' field error detected");
56478 }
56479#ifdef FREECIV_JSON_CONNECTION
56480 field_addr.name = "min_speed";
56481#endif /* FREECIV_JSON_CONNECTION */
56482 e = 0;
56483 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->min_speed);
56484 if (e) {
56485 log_packet_detailed("'min_speed' field error detected");
56486 }
56487#ifdef FREECIV_JSON_CONNECTION
56488 field_addr.name = "hp_loss_pct";
56489#endif /* FREECIV_JSON_CONNECTION */
56490 e = 0;
56491 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp_loss_pct);
56492 if (e) {
56493 log_packet_detailed("'hp_loss_pct' field error detected");
56494 }
56495#ifdef FREECIV_JSON_CONNECTION
56496 field_addr.name = "non_native_def_pct";
56497#endif /* FREECIV_JSON_CONNECTION */
56498 e = 0;
56499 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->non_native_def_pct);
56500 if (e) {
56501 log_packet_detailed("'non_native_def_pct' field error detected");
56502 }
56503#ifdef FREECIV_JSON_CONNECTION
56504 field_addr.name = "flags";
56505#endif /* FREECIV_JSON_CONNECTION */
56506 e = 0;
56507 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
56508 if (e) {
56509 log_packet_detailed("'flags' field error detected");
56510 }
56511#ifdef FREECIV_JSON_CONNECTION
56512 field_addr.name = "helptext";
56513#endif /* FREECIV_JSON_CONNECTION */
56514 e = 0;
56515 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
56516 if (e) {
56517 log_packet_detailed("'helptext' field error detected");
56518 }
56519
56520#endif
56521 SEND_PACKET_END(PACKET_RULESET_UNIT_CLASS);
56522}
56523
56524 int send_packet_ruleset_unit_class(struct connection *pc, const struct packet_ruleset_unit_class *packet)
56525{
56526 if (!pc->used) {
56527 log_error("WARNING: trying to send data to the closed connection %s",
56528 conn_description(pc));
56529 return -1;
56530 }
56531 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS].packet != NULL, -1,
56532 "Handler for PACKET_RULESET_UNIT_CLASS not installed");
56533 return pc->phs.handlers->send[PACKET_RULESET_UNIT_CLASS].packet(pc, packet);
56534}
56535
56536 void lsend_packet_ruleset_unit_class(struct conn_list *dest, const struct packet_ruleset_unit_class *packet)
56537{
56538 conn_list_iterate(dest, pconn) {
56539 send_packet_ruleset_unit_class(pconn, packet);
56540 } conn_list_iterate_end;
56541}
56542
56543#ifdef FREECIV_DELTA_PROTOCOL
56544#define hash_packet_ruleset_extra_100 hash_const
56545
56546#define cmp_packet_ruleset_extra_100 cmp_const
56547
56548 BV_DEFINE(packet_ruleset_extra_100_fields, 41);
56549#endif /* FREECIV_DELTA_PROTOCOL */
56550
56551 static struct packet_ruleset_extra *receive_packet_ruleset_extra_100(struct connection *pc)
56552{
56553#ifdef FREECIV_DELTA_PROTOCOL
56554 packet_ruleset_extra_100_fields fields;
56555 struct packet_ruleset_extra *old;
56556 struct genhash **hash = pc->phs.received + PACKET_RULESET_EXTRA;
56557#endif /* FREECIV_DELTA_PROTOCOL */
56558 RECEIVE_PACKET_START(packet_ruleset_extra, real_packet);
56559#ifdef FREECIV_JSON_CONNECTION
56560 struct plocation field_addr;
56561 {
56562 struct plocation *field_addr_tmp = plocation_field_new(NULL);
56563 field_addr = *field_addr_tmp;
56564 FC_FREE(field_addr_tmp);
56565 }
56566#endif /* FREECIV_JSON_CONNECTION */
56567
56568#ifdef FREECIV_DELTA_PROTOCOL
56569#ifdef FREECIV_JSON_CONNECTION
56570 field_addr.name = "fields";
56571#endif /* FREECIV_JSON_CONNECTION */
56572 DIO_BV_GET(&din, &field_addr, fields);
56573
56574#else /* FREECIV_DELTA_PROTOCOL */
56575#ifdef FREECIV_JSON_CONNECTION
56576 field_addr.name = "id";
56577#endif /* FREECIV_JSON_CONNECTION */
56578 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56579 RECEIVE_PACKET_FIELD_ERROR(id);
56580 }
56581#ifdef FREECIV_JSON_CONNECTION
56582 field_addr.name = "name";
56583#endif /* FREECIV_JSON_CONNECTION */
56584 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56585 RECEIVE_PACKET_FIELD_ERROR(name);
56586 }
56587#ifdef FREECIV_JSON_CONNECTION
56588 field_addr.name = "rule_name";
56589#endif /* FREECIV_JSON_CONNECTION */
56590 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
56591 RECEIVE_PACKET_FIELD_ERROR(rule_name);
56592 }
56593#ifdef FREECIV_JSON_CONNECTION
56594 field_addr.name = "category";
56595#endif /* FREECIV_JSON_CONNECTION */
56596 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
56597 RECEIVE_PACKET_FIELD_ERROR(category);
56598 }
56599#ifdef FREECIV_JSON_CONNECTION
56600 field_addr.name = "causes";
56601#endif /* FREECIV_JSON_CONNECTION */
56602 if (!DIO_BV_GET(&din, &field_addr, real_packet->causes)) {
56603 RECEIVE_PACKET_FIELD_ERROR(causes);
56604 }
56605#ifdef FREECIV_JSON_CONNECTION
56606 field_addr.name = "rmcauses";
56607#endif /* FREECIV_JSON_CONNECTION */
56608 if (!DIO_BV_GET(&din, &field_addr, real_packet->rmcauses)) {
56609 RECEIVE_PACKET_FIELD_ERROR(rmcauses);
56610 }
56611#ifdef FREECIV_JSON_CONNECTION
56612 field_addr.name = "activity_gfx";
56613#endif /* FREECIV_JSON_CONNECTION */
56614 if (!DIO_GET(string, &din, &field_addr, real_packet->activity_gfx, sizeof(real_packet->activity_gfx))) {
56615 RECEIVE_PACKET_FIELD_ERROR(activity_gfx);
56616 }
56617#ifdef FREECIV_JSON_CONNECTION
56618 field_addr.name = "act_gfx_alt";
56619#endif /* FREECIV_JSON_CONNECTION */
56620 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt, sizeof(real_packet->act_gfx_alt))) {
56621 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt);
56622 }
56623#ifdef FREECIV_JSON_CONNECTION
56624 field_addr.name = "act_gfx_alt2";
56625#endif /* FREECIV_JSON_CONNECTION */
56626 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt2, sizeof(real_packet->act_gfx_alt2))) {
56627 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt2);
56628 }
56629#ifdef FREECIV_JSON_CONNECTION
56630 field_addr.name = "rmact_gfx";
56631#endif /* FREECIV_JSON_CONNECTION */
56632 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx, sizeof(real_packet->rmact_gfx))) {
56633 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx);
56634 }
56635#ifdef FREECIV_JSON_CONNECTION
56636 field_addr.name = "rmact_gfx_alt";
56637#endif /* FREECIV_JSON_CONNECTION */
56638 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt, sizeof(real_packet->rmact_gfx_alt))) {
56639 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt);
56640 }
56641#ifdef FREECIV_JSON_CONNECTION
56642 field_addr.name = "rmact_gfx_alt2";
56643#endif /* FREECIV_JSON_CONNECTION */
56644 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt2, sizeof(real_packet->rmact_gfx_alt2))) {
56645 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt2);
56646 }
56647#ifdef FREECIV_JSON_CONNECTION
56648 field_addr.name = "graphic_str";
56649#endif /* FREECIV_JSON_CONNECTION */
56650 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
56651 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
56652 }
56653#ifdef FREECIV_JSON_CONNECTION
56654 field_addr.name = "graphic_alt";
56655#endif /* FREECIV_JSON_CONNECTION */
56656 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
56657 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
56658 }
56659#ifdef FREECIV_JSON_CONNECTION
56660 field_addr.name = "reqs_count";
56661#endif /* FREECIV_JSON_CONNECTION */
56662 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
56663 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
56664 }
56665#ifdef FREECIV_JSON_CONNECTION
56666 field_addr.name = "reqs";
56667#endif /* FREECIV_JSON_CONNECTION */
56668 {
56669 int i;
56670
56671#ifdef FREECIV_JSON_CONNECTION
56672 /* Enter array. */
56673 field_addr.sub_location = plocation_elem_new(0);
56674#endif /* FREECIV_JSON_CONNECTION */
56675
56676 if (real_packet->reqs_count > MAX_NUM_REQS) {
56677 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
56678 }
56679 for (i = 0; i < real_packet->reqs_count; i++) {
56680#ifdef FREECIV_JSON_CONNECTION
56681 field_addr.sub_location->number = i;
56682#endif /* FREECIV_JSON_CONNECTION */
56683 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
56684 RECEIVE_PACKET_FIELD_ERROR(reqs);
56685 }
56686 }
56687
56688#ifdef FREECIV_JSON_CONNECTION
56689 /* Exit array. */
56690 FC_FREE(field_addr.sub_location);
56691#endif /* FREECIV_JSON_CONNECTION */
56692 }
56693#ifdef FREECIV_JSON_CONNECTION
56694 field_addr.name = "rmreqs_count";
56695#endif /* FREECIV_JSON_CONNECTION */
56696 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rmreqs_count)) {
56697 RECEIVE_PACKET_FIELD_ERROR(rmreqs_count);
56698 }
56699#ifdef FREECIV_JSON_CONNECTION
56700 field_addr.name = "rmreqs";
56701#endif /* FREECIV_JSON_CONNECTION */
56702 {
56703 int i;
56704
56705#ifdef FREECIV_JSON_CONNECTION
56706 /* Enter array. */
56707 field_addr.sub_location = plocation_elem_new(0);
56708#endif /* FREECIV_JSON_CONNECTION */
56709
56710 if (real_packet->rmreqs_count > MAX_NUM_REQS) {
56711 RECEIVE_PACKET_FIELD_ERROR(rmreqs, ": truncation array");
56712 }
56713 for (i = 0; i < real_packet->rmreqs_count; i++) {
56714#ifdef FREECIV_JSON_CONNECTION
56715 field_addr.sub_location->number = i;
56716#endif /* FREECIV_JSON_CONNECTION */
56717 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->rmreqs[i])) {
56718 RECEIVE_PACKET_FIELD_ERROR(rmreqs);
56719 }
56720 }
56721
56722#ifdef FREECIV_JSON_CONNECTION
56723 /* Exit array. */
56724 FC_FREE(field_addr.sub_location);
56725#endif /* FREECIV_JSON_CONNECTION */
56726 }
56727#ifdef FREECIV_JSON_CONNECTION
56728 field_addr.name = "appearance_chance";
56729#endif /* FREECIV_JSON_CONNECTION */
56730 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->appearance_chance)) {
56731 RECEIVE_PACKET_FIELD_ERROR(appearance_chance);
56732 }
56733#ifdef FREECIV_JSON_CONNECTION
56734 field_addr.name = "appearance_reqs_count";
56735#endif /* FREECIV_JSON_CONNECTION */
56736 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->appearance_reqs_count)) {
56737 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs_count);
56738 }
56739#ifdef FREECIV_JSON_CONNECTION
56740 field_addr.name = "appearance_reqs";
56741#endif /* FREECIV_JSON_CONNECTION */
56742 {
56743 int i;
56744
56745#ifdef FREECIV_JSON_CONNECTION
56746 /* Enter array. */
56747 field_addr.sub_location = plocation_elem_new(0);
56748#endif /* FREECIV_JSON_CONNECTION */
56749
56750 if (real_packet->appearance_reqs_count > MAX_NUM_REQS) {
56751 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs, ": truncation array");
56752 }
56753 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
56754#ifdef FREECIV_JSON_CONNECTION
56755 field_addr.sub_location->number = i;
56756#endif /* FREECIV_JSON_CONNECTION */
56757 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->appearance_reqs[i])) {
56758 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs);
56759 }
56760 }
56761
56762#ifdef FREECIV_JSON_CONNECTION
56763 /* Exit array. */
56764 FC_FREE(field_addr.sub_location);
56765#endif /* FREECIV_JSON_CONNECTION */
56766 }
56767#ifdef FREECIV_JSON_CONNECTION
56768 field_addr.name = "disappearance_chance";
56769#endif /* FREECIV_JSON_CONNECTION */
56770 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disappearance_chance)) {
56771 RECEIVE_PACKET_FIELD_ERROR(disappearance_chance);
56772 }
56773#ifdef FREECIV_JSON_CONNECTION
56774 field_addr.name = "disappearance_reqs_count";
56775#endif /* FREECIV_JSON_CONNECTION */
56776 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->disappearance_reqs_count)) {
56777 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs_count);
56778 }
56779#ifdef FREECIV_JSON_CONNECTION
56780 field_addr.name = "disappearance_reqs";
56781#endif /* FREECIV_JSON_CONNECTION */
56782 {
56783 int i;
56784
56785#ifdef FREECIV_JSON_CONNECTION
56786 /* Enter array. */
56787 field_addr.sub_location = plocation_elem_new(0);
56788#endif /* FREECIV_JSON_CONNECTION */
56789
56790 if (real_packet->disappearance_reqs_count > MAX_NUM_REQS) {
56791 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs, ": truncation array");
56792 }
56793 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
56794#ifdef FREECIV_JSON_CONNECTION
56795 field_addr.sub_location->number = i;
56796#endif /* FREECIV_JSON_CONNECTION */
56797 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->disappearance_reqs[i])) {
56798 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs);
56799 }
56800 }
56801
56802#ifdef FREECIV_JSON_CONNECTION
56803 /* Exit array. */
56804 FC_FREE(field_addr.sub_location);
56805#endif /* FREECIV_JSON_CONNECTION */
56806 }
56807#ifdef FREECIV_JSON_CONNECTION
56808 field_addr.name = "visibility_req";
56809#endif /* FREECIV_JSON_CONNECTION */
56810 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->visibility_req)) {
56811 RECEIVE_PACKET_FIELD_ERROR(visibility_req);
56812 }
56813#ifdef FREECIV_JSON_CONNECTION
56814 field_addr.name = "buildable";
56815#endif /* FREECIV_JSON_CONNECTION */
56816 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->buildable)) {
56817 RECEIVE_PACKET_FIELD_ERROR(buildable);
56818 }
56819#ifdef FREECIV_JSON_CONNECTION
56820 field_addr.name = "generated";
56821#endif /* FREECIV_JSON_CONNECTION */
56822 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->generated)) {
56823 RECEIVE_PACKET_FIELD_ERROR(generated);
56824 }
56825#ifdef FREECIV_JSON_CONNECTION
56826 field_addr.name = "build_time";
56827#endif /* FREECIV_JSON_CONNECTION */
56828 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time)) {
56829 RECEIVE_PACKET_FIELD_ERROR(build_time);
56830 }
56831#ifdef FREECIV_JSON_CONNECTION
56832 field_addr.name = "build_time_factor";
56833#endif /* FREECIV_JSON_CONNECTION */
56834 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time_factor)) {
56835 RECEIVE_PACKET_FIELD_ERROR(build_time_factor);
56836 }
56837#ifdef FREECIV_JSON_CONNECTION
56838 field_addr.name = "removal_time";
56839#endif /* FREECIV_JSON_CONNECTION */
56840 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time)) {
56841 RECEIVE_PACKET_FIELD_ERROR(removal_time);
56842 }
56843#ifdef FREECIV_JSON_CONNECTION
56844 field_addr.name = "removal_time_factor";
56845#endif /* FREECIV_JSON_CONNECTION */
56846 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time_factor)) {
56847 RECEIVE_PACKET_FIELD_ERROR(removal_time_factor);
56848 }
56849#ifdef FREECIV_JSON_CONNECTION
56850 field_addr.name = "infracost";
56851#endif /* FREECIV_JSON_CONNECTION */
56852 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->infracost)) {
56853 RECEIVE_PACKET_FIELD_ERROR(infracost);
56854 }
56855#ifdef FREECIV_JSON_CONNECTION
56856 field_addr.name = "defense_bonus";
56857#endif /* FREECIV_JSON_CONNECTION */
56858 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_bonus)) {
56859 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
56860 }
56861#ifdef FREECIV_JSON_CONNECTION
56862 field_addr.name = "eus";
56863#endif /* FREECIV_JSON_CONNECTION */
56864 {
56865 int readin;
56866
56867 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
56868 RECEIVE_PACKET_FIELD_ERROR(eus);
56869 }
56870 real_packet->eus = readin;
56871 }
56872#ifdef FREECIV_JSON_CONNECTION
56873 field_addr.name = "native_to";
56874#endif /* FREECIV_JSON_CONNECTION */
56875 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
56876 RECEIVE_PACKET_FIELD_ERROR(native_to);
56877 }
56878#ifdef FREECIV_JSON_CONNECTION
56879 field_addr.name = "flags";
56880#endif /* FREECIV_JSON_CONNECTION */
56881 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
56882 RECEIVE_PACKET_FIELD_ERROR(flags);
56883 }
56884#ifdef FREECIV_JSON_CONNECTION
56885 field_addr.name = "hidden_by";
56886#endif /* FREECIV_JSON_CONNECTION */
56887 if (!DIO_BV_GET(&din, &field_addr, real_packet->hidden_by)) {
56888 RECEIVE_PACKET_FIELD_ERROR(hidden_by);
56889 }
56890#ifdef FREECIV_JSON_CONNECTION
56891 field_addr.name = "bridged_over";
56892#endif /* FREECIV_JSON_CONNECTION */
56893 if (!DIO_BV_GET(&din, &field_addr, real_packet->bridged_over)) {
56894 RECEIVE_PACKET_FIELD_ERROR(bridged_over);
56895 }
56896#ifdef FREECIV_JSON_CONNECTION
56897 field_addr.name = "conflicts";
56898#endif /* FREECIV_JSON_CONNECTION */
56899 if (!DIO_BV_GET(&din, &field_addr, real_packet->conflicts)) {
56900 RECEIVE_PACKET_FIELD_ERROR(conflicts);
56901 }
56902#ifdef FREECIV_JSON_CONNECTION
56903 field_addr.name = "no_aggr_near_city";
56904#endif /* FREECIV_JSON_CONNECTION */
56905 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->no_aggr_near_city)) {
56906 RECEIVE_PACKET_FIELD_ERROR(no_aggr_near_city);
56907 }
56908#ifdef FREECIV_JSON_CONNECTION
56909 field_addr.name = "helptext";
56910#endif /* FREECIV_JSON_CONNECTION */
56911 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
56912 RECEIVE_PACKET_FIELD_ERROR(helptext);
56913 }
56914#endif
56915 log_packet_detailed("packet_ruleset_extra_100: got info about ()");
56916
56917#ifdef FREECIV_DELTA_PROTOCOL
56918 if (NULL == *hash) {
56919 *hash = genhash_new_full(hash_packet_ruleset_extra_100, cmp_packet_ruleset_extra_100,
56920 NULL, NULL, NULL, free);
56921 }
56922
56923 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
56924 *real_packet = *old;
56925 } else {
56926 log_packet_detailed(" no old info");
56927 memset(real_packet, 0, sizeof(*real_packet));
56928 }
56929
56930 if (BV_ISSET(fields, 0)) {
56931 log_packet_detailed(" got field 'id'");
56932#ifdef FREECIV_JSON_CONNECTION
56933 field_addr.name = "id";
56934#endif /* FREECIV_JSON_CONNECTION */
56935 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
56936 RECEIVE_PACKET_FIELD_ERROR(id);
56937 }
56938 }
56939 if (BV_ISSET(fields, 1)) {
56940 log_packet_detailed(" got field 'name'");
56941#ifdef FREECIV_JSON_CONNECTION
56942 field_addr.name = "name";
56943#endif /* FREECIV_JSON_CONNECTION */
56944 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
56945 RECEIVE_PACKET_FIELD_ERROR(name);
56946 }
56947 }
56948 if (BV_ISSET(fields, 2)) {
56949 log_packet_detailed(" got field 'rule_name'");
56950#ifdef FREECIV_JSON_CONNECTION
56951 field_addr.name = "rule_name";
56952#endif /* FREECIV_JSON_CONNECTION */
56953 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
56954 RECEIVE_PACKET_FIELD_ERROR(rule_name);
56955 }
56956 }
56957 if (BV_ISSET(fields, 3)) {
56958 log_packet_detailed(" got field 'category'");
56959#ifdef FREECIV_JSON_CONNECTION
56960 field_addr.name = "category";
56961#endif /* FREECIV_JSON_CONNECTION */
56962 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
56963 RECEIVE_PACKET_FIELD_ERROR(category);
56964 }
56965 }
56966 if (BV_ISSET(fields, 4)) {
56967 log_packet_detailed(" got field 'causes'");
56968#ifdef FREECIV_JSON_CONNECTION
56969 field_addr.name = "causes";
56970#endif /* FREECIV_JSON_CONNECTION */
56971 if (!DIO_BV_GET(&din, &field_addr, real_packet->causes)) {
56972 RECEIVE_PACKET_FIELD_ERROR(causes);
56973 }
56974 }
56975 if (BV_ISSET(fields, 5)) {
56976 log_packet_detailed(" got field 'rmcauses'");
56977#ifdef FREECIV_JSON_CONNECTION
56978 field_addr.name = "rmcauses";
56979#endif /* FREECIV_JSON_CONNECTION */
56980 if (!DIO_BV_GET(&din, &field_addr, real_packet->rmcauses)) {
56981 RECEIVE_PACKET_FIELD_ERROR(rmcauses);
56982 }
56983 }
56984 if (BV_ISSET(fields, 6)) {
56985 log_packet_detailed(" got field 'activity_gfx'");
56986#ifdef FREECIV_JSON_CONNECTION
56987 field_addr.name = "activity_gfx";
56988#endif /* FREECIV_JSON_CONNECTION */
56989 if (!DIO_GET(string, &din, &field_addr, real_packet->activity_gfx, sizeof(real_packet->activity_gfx))) {
56990 RECEIVE_PACKET_FIELD_ERROR(activity_gfx);
56991 }
56992 }
56993 if (BV_ISSET(fields, 7)) {
56994 log_packet_detailed(" got field 'act_gfx_alt'");
56995#ifdef FREECIV_JSON_CONNECTION
56996 field_addr.name = "act_gfx_alt";
56997#endif /* FREECIV_JSON_CONNECTION */
56998 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt, sizeof(real_packet->act_gfx_alt))) {
56999 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt);
57000 }
57001 }
57002 if (BV_ISSET(fields, 8)) {
57003 log_packet_detailed(" got field 'act_gfx_alt2'");
57004#ifdef FREECIV_JSON_CONNECTION
57005 field_addr.name = "act_gfx_alt2";
57006#endif /* FREECIV_JSON_CONNECTION */
57007 if (!DIO_GET(string, &din, &field_addr, real_packet->act_gfx_alt2, sizeof(real_packet->act_gfx_alt2))) {
57008 RECEIVE_PACKET_FIELD_ERROR(act_gfx_alt2);
57009 }
57010 }
57011 if (BV_ISSET(fields, 9)) {
57012 log_packet_detailed(" got field 'rmact_gfx'");
57013#ifdef FREECIV_JSON_CONNECTION
57014 field_addr.name = "rmact_gfx";
57015#endif /* FREECIV_JSON_CONNECTION */
57016 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx, sizeof(real_packet->rmact_gfx))) {
57017 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx);
57018 }
57019 }
57020 if (BV_ISSET(fields, 10)) {
57021 log_packet_detailed(" got field 'rmact_gfx_alt'");
57022#ifdef FREECIV_JSON_CONNECTION
57023 field_addr.name = "rmact_gfx_alt";
57024#endif /* FREECIV_JSON_CONNECTION */
57025 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt, sizeof(real_packet->rmact_gfx_alt))) {
57026 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt);
57027 }
57028 }
57029 if (BV_ISSET(fields, 11)) {
57030 log_packet_detailed(" got field 'rmact_gfx_alt2'");
57031#ifdef FREECIV_JSON_CONNECTION
57032 field_addr.name = "rmact_gfx_alt2";
57033#endif /* FREECIV_JSON_CONNECTION */
57034 if (!DIO_GET(string, &din, &field_addr, real_packet->rmact_gfx_alt2, sizeof(real_packet->rmact_gfx_alt2))) {
57035 RECEIVE_PACKET_FIELD_ERROR(rmact_gfx_alt2);
57036 }
57037 }
57038 if (BV_ISSET(fields, 12)) {
57039 log_packet_detailed(" got field 'graphic_str'");
57040#ifdef FREECIV_JSON_CONNECTION
57041 field_addr.name = "graphic_str";
57042#endif /* FREECIV_JSON_CONNECTION */
57043 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_str, sizeof(real_packet->graphic_str))) {
57044 RECEIVE_PACKET_FIELD_ERROR(graphic_str);
57045 }
57046 }
57047 if (BV_ISSET(fields, 13)) {
57048 log_packet_detailed(" got field 'graphic_alt'");
57049#ifdef FREECIV_JSON_CONNECTION
57050 field_addr.name = "graphic_alt";
57051#endif /* FREECIV_JSON_CONNECTION */
57052 if (!DIO_GET(string, &din, &field_addr, real_packet->graphic_alt, sizeof(real_packet->graphic_alt))) {
57053 RECEIVE_PACKET_FIELD_ERROR(graphic_alt);
57054 }
57055 }
57056 if (BV_ISSET(fields, 14)) {
57057 log_packet_detailed(" got field 'reqs_count'");
57058#ifdef FREECIV_JSON_CONNECTION
57059 field_addr.name = "reqs_count";
57060#endif /* FREECIV_JSON_CONNECTION */
57061 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
57062 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
57063 }
57064 }
57065 if (BV_ISSET(fields, 15)) {
57066 log_packet_detailed(" got field 'reqs'");
57067#ifdef FREECIV_JSON_CONNECTION
57068 field_addr.name = "reqs";
57069#endif /* FREECIV_JSON_CONNECTION */
57070 {
57071 int i;
57072
57073#ifdef FREECIV_JSON_CONNECTION
57074 /* Enter array. */
57075 field_addr.sub_location = plocation_elem_new(0);
57076#endif /* FREECIV_JSON_CONNECTION */
57077
57078 if (real_packet->reqs_count > MAX_NUM_REQS) {
57079 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
57080 }
57081 for (i = 0; i < real_packet->reqs_count; i++) {
57082#ifdef FREECIV_JSON_CONNECTION
57083 field_addr.sub_location->number = i;
57084#endif /* FREECIV_JSON_CONNECTION */
57085 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
57086 RECEIVE_PACKET_FIELD_ERROR(reqs);
57087 }
57088 }
57089
57090#ifdef FREECIV_JSON_CONNECTION
57091 /* Exit array. */
57092 FC_FREE(field_addr.sub_location);
57093#endif /* FREECIV_JSON_CONNECTION */
57094 }
57095 }
57096 if (BV_ISSET(fields, 16)) {
57097 log_packet_detailed(" got field 'rmreqs_count'");
57098#ifdef FREECIV_JSON_CONNECTION
57099 field_addr.name = "rmreqs_count";
57100#endif /* FREECIV_JSON_CONNECTION */
57101 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rmreqs_count)) {
57102 RECEIVE_PACKET_FIELD_ERROR(rmreqs_count);
57103 }
57104 }
57105 if (BV_ISSET(fields, 17)) {
57106 log_packet_detailed(" got field 'rmreqs'");
57107#ifdef FREECIV_JSON_CONNECTION
57108 field_addr.name = "rmreqs";
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 if (real_packet->rmreqs_count > MAX_NUM_REQS) {
57119 RECEIVE_PACKET_FIELD_ERROR(rmreqs, ": truncation array");
57120 }
57121 for (i = 0; i < real_packet->rmreqs_count; i++) {
57122#ifdef FREECIV_JSON_CONNECTION
57123 field_addr.sub_location->number = i;
57124#endif /* FREECIV_JSON_CONNECTION */
57125 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->rmreqs[i])) {
57126 RECEIVE_PACKET_FIELD_ERROR(rmreqs);
57127 }
57128 }
57129
57130#ifdef FREECIV_JSON_CONNECTION
57131 /* Exit array. */
57132 FC_FREE(field_addr.sub_location);
57133#endif /* FREECIV_JSON_CONNECTION */
57134 }
57135 }
57136 if (BV_ISSET(fields, 18)) {
57137 log_packet_detailed(" got field 'appearance_chance'");
57138#ifdef FREECIV_JSON_CONNECTION
57139 field_addr.name = "appearance_chance";
57140#endif /* FREECIV_JSON_CONNECTION */
57141 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->appearance_chance)) {
57142 RECEIVE_PACKET_FIELD_ERROR(appearance_chance);
57143 }
57144 }
57145 if (BV_ISSET(fields, 19)) {
57146 log_packet_detailed(" got field 'appearance_reqs_count'");
57147#ifdef FREECIV_JSON_CONNECTION
57148 field_addr.name = "appearance_reqs_count";
57149#endif /* FREECIV_JSON_CONNECTION */
57150 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->appearance_reqs_count)) {
57151 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs_count);
57152 }
57153 }
57154 if (BV_ISSET(fields, 20)) {
57155 log_packet_detailed(" got field 'appearance_reqs'");
57156#ifdef FREECIV_JSON_CONNECTION
57157 field_addr.name = "appearance_reqs";
57158#endif /* FREECIV_JSON_CONNECTION */
57159 {
57160 int i;
57161
57162#ifdef FREECIV_JSON_CONNECTION
57163 /* Enter array. */
57164 field_addr.sub_location = plocation_elem_new(0);
57165#endif /* FREECIV_JSON_CONNECTION */
57166
57167 if (real_packet->appearance_reqs_count > MAX_NUM_REQS) {
57168 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs, ": truncation array");
57169 }
57170 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
57171#ifdef FREECIV_JSON_CONNECTION
57172 field_addr.sub_location->number = i;
57173#endif /* FREECIV_JSON_CONNECTION */
57174 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->appearance_reqs[i])) {
57175 RECEIVE_PACKET_FIELD_ERROR(appearance_reqs);
57176 }
57177 }
57178
57179#ifdef FREECIV_JSON_CONNECTION
57180 /* Exit array. */
57181 FC_FREE(field_addr.sub_location);
57182#endif /* FREECIV_JSON_CONNECTION */
57183 }
57184 }
57185 if (BV_ISSET(fields, 21)) {
57186 log_packet_detailed(" got field 'disappearance_chance'");
57187#ifdef FREECIV_JSON_CONNECTION
57188 field_addr.name = "disappearance_chance";
57189#endif /* FREECIV_JSON_CONNECTION */
57190 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->disappearance_chance)) {
57191 RECEIVE_PACKET_FIELD_ERROR(disappearance_chance);
57192 }
57193 }
57194 if (BV_ISSET(fields, 22)) {
57195 log_packet_detailed(" got field 'disappearance_reqs_count'");
57196#ifdef FREECIV_JSON_CONNECTION
57197 field_addr.name = "disappearance_reqs_count";
57198#endif /* FREECIV_JSON_CONNECTION */
57199 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->disappearance_reqs_count)) {
57200 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs_count);
57201 }
57202 }
57203 if (BV_ISSET(fields, 23)) {
57204 log_packet_detailed(" got field 'disappearance_reqs'");
57205#ifdef FREECIV_JSON_CONNECTION
57206 field_addr.name = "disappearance_reqs";
57207#endif /* FREECIV_JSON_CONNECTION */
57208 {
57209 int i;
57210
57211#ifdef FREECIV_JSON_CONNECTION
57212 /* Enter array. */
57213 field_addr.sub_location = plocation_elem_new(0);
57214#endif /* FREECIV_JSON_CONNECTION */
57215
57216 if (real_packet->disappearance_reqs_count > MAX_NUM_REQS) {
57217 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs, ": truncation array");
57218 }
57219 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
57220#ifdef FREECIV_JSON_CONNECTION
57221 field_addr.sub_location->number = i;
57222#endif /* FREECIV_JSON_CONNECTION */
57223 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->disappearance_reqs[i])) {
57224 RECEIVE_PACKET_FIELD_ERROR(disappearance_reqs);
57225 }
57226 }
57227
57228#ifdef FREECIV_JSON_CONNECTION
57229 /* Exit array. */
57230 FC_FREE(field_addr.sub_location);
57231#endif /* FREECIV_JSON_CONNECTION */
57232 }
57233 }
57234 if (BV_ISSET(fields, 24)) {
57235 log_packet_detailed(" got field 'visibility_req'");
57236#ifdef FREECIV_JSON_CONNECTION
57237 field_addr.name = "visibility_req";
57238#endif /* FREECIV_JSON_CONNECTION */
57239 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->visibility_req)) {
57240 RECEIVE_PACKET_FIELD_ERROR(visibility_req);
57241 }
57242 }
57243 real_packet->buildable = BV_ISSET(fields, 25);
57244 real_packet->generated = BV_ISSET(fields, 26);
57245 if (BV_ISSET(fields, 27)) {
57246 log_packet_detailed(" got field 'build_time'");
57247#ifdef FREECIV_JSON_CONNECTION
57248 field_addr.name = "build_time";
57249#endif /* FREECIV_JSON_CONNECTION */
57250 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time)) {
57251 RECEIVE_PACKET_FIELD_ERROR(build_time);
57252 }
57253 }
57254 if (BV_ISSET(fields, 28)) {
57255 log_packet_detailed(" got field 'build_time_factor'");
57256#ifdef FREECIV_JSON_CONNECTION
57257 field_addr.name = "build_time_factor";
57258#endif /* FREECIV_JSON_CONNECTION */
57259 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->build_time_factor)) {
57260 RECEIVE_PACKET_FIELD_ERROR(build_time_factor);
57261 }
57262 }
57263 if (BV_ISSET(fields, 29)) {
57264 log_packet_detailed(" got field 'removal_time'");
57265#ifdef FREECIV_JSON_CONNECTION
57266 field_addr.name = "removal_time";
57267#endif /* FREECIV_JSON_CONNECTION */
57268 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time)) {
57269 RECEIVE_PACKET_FIELD_ERROR(removal_time);
57270 }
57271 }
57272 if (BV_ISSET(fields, 30)) {
57273 log_packet_detailed(" got field 'removal_time_factor'");
57274#ifdef FREECIV_JSON_CONNECTION
57275 field_addr.name = "removal_time_factor";
57276#endif /* FREECIV_JSON_CONNECTION */
57277 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->removal_time_factor)) {
57278 RECEIVE_PACKET_FIELD_ERROR(removal_time_factor);
57279 }
57280 }
57281 if (BV_ISSET(fields, 31)) {
57282 log_packet_detailed(" got field 'infracost'");
57283#ifdef FREECIV_JSON_CONNECTION
57284 field_addr.name = "infracost";
57285#endif /* FREECIV_JSON_CONNECTION */
57286 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->infracost)) {
57287 RECEIVE_PACKET_FIELD_ERROR(infracost);
57288 }
57289 }
57290 if (BV_ISSET(fields, 32)) {
57291 log_packet_detailed(" got field 'defense_bonus'");
57292#ifdef FREECIV_JSON_CONNECTION
57293 field_addr.name = "defense_bonus";
57294#endif /* FREECIV_JSON_CONNECTION */
57295 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->defense_bonus)) {
57296 RECEIVE_PACKET_FIELD_ERROR(defense_bonus);
57297 }
57298 }
57299 if (BV_ISSET(fields, 33)) {
57300 log_packet_detailed(" got field 'eus'");
57301#ifdef FREECIV_JSON_CONNECTION
57302 field_addr.name = "eus";
57303#endif /* FREECIV_JSON_CONNECTION */
57304 {
57305 int readin;
57306
57307 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
57308 RECEIVE_PACKET_FIELD_ERROR(eus);
57309 }
57310 real_packet->eus = readin;
57311 }
57312 }
57313 if (BV_ISSET(fields, 34)) {
57314 log_packet_detailed(" got field 'native_to'");
57315#ifdef FREECIV_JSON_CONNECTION
57316 field_addr.name = "native_to";
57317#endif /* FREECIV_JSON_CONNECTION */
57318 if (!DIO_BV_GET(&din, &field_addr, real_packet->native_to)) {
57319 RECEIVE_PACKET_FIELD_ERROR(native_to);
57320 }
57321 }
57322 if (BV_ISSET(fields, 35)) {
57323 log_packet_detailed(" got field 'flags'");
57324#ifdef FREECIV_JSON_CONNECTION
57325 field_addr.name = "flags";
57326#endif /* FREECIV_JSON_CONNECTION */
57327 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
57328 RECEIVE_PACKET_FIELD_ERROR(flags);
57329 }
57330 }
57331 if (BV_ISSET(fields, 36)) {
57332 log_packet_detailed(" got field 'hidden_by'");
57333#ifdef FREECIV_JSON_CONNECTION
57334 field_addr.name = "hidden_by";
57335#endif /* FREECIV_JSON_CONNECTION */
57336 if (!DIO_BV_GET(&din, &field_addr, real_packet->hidden_by)) {
57337 RECEIVE_PACKET_FIELD_ERROR(hidden_by);
57338 }
57339 }
57340 if (BV_ISSET(fields, 37)) {
57341 log_packet_detailed(" got field 'bridged_over'");
57342#ifdef FREECIV_JSON_CONNECTION
57343 field_addr.name = "bridged_over";
57344#endif /* FREECIV_JSON_CONNECTION */
57345 if (!DIO_BV_GET(&din, &field_addr, real_packet->bridged_over)) {
57346 RECEIVE_PACKET_FIELD_ERROR(bridged_over);
57347 }
57348 }
57349 if (BV_ISSET(fields, 38)) {
57350 log_packet_detailed(" got field 'conflicts'");
57351#ifdef FREECIV_JSON_CONNECTION
57352 field_addr.name = "conflicts";
57353#endif /* FREECIV_JSON_CONNECTION */
57354 if (!DIO_BV_GET(&din, &field_addr, real_packet->conflicts)) {
57355 RECEIVE_PACKET_FIELD_ERROR(conflicts);
57356 }
57357 }
57358 if (BV_ISSET(fields, 39)) {
57359 log_packet_detailed(" got field 'no_aggr_near_city'");
57360#ifdef FREECIV_JSON_CONNECTION
57361 field_addr.name = "no_aggr_near_city";
57362#endif /* FREECIV_JSON_CONNECTION */
57363 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->no_aggr_near_city)) {
57364 RECEIVE_PACKET_FIELD_ERROR(no_aggr_near_city);
57365 }
57366 }
57367 if (BV_ISSET(fields, 40)) {
57368 log_packet_detailed(" got field 'helptext'");
57369#ifdef FREECIV_JSON_CONNECTION
57370 field_addr.name = "helptext";
57371#endif /* FREECIV_JSON_CONNECTION */
57372 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
57373 RECEIVE_PACKET_FIELD_ERROR(helptext);
57374 }
57375 }
57376
57377 if (NULL == old) {
57378 old = fc_malloc(sizeof(*old));
57379 *old = *real_packet;
57380 genhash_insert(*hash, old, old);
57381 } else {
57382 *old = *real_packet;
57383 }
57384
57385#endif /* FREECIV_DELTA_PROTOCOL */
57386 RECEIVE_PACKET_END(real_packet);
57387}
57388
57389 static int send_packet_ruleset_extra_100(struct connection *pc, const struct packet_ruleset_extra *packet)
57390{
57391 const struct packet_ruleset_extra *real_packet = packet;
57392 int e;
57393#ifdef FREECIV_DELTA_PROTOCOL
57394 packet_ruleset_extra_100_fields fields;
57395 struct packet_ruleset_extra *old;
57396 bool differ;
57397 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EXTRA;
57398#endif /* FREECIV_DELTA_PROTOCOL */
57399 SEND_PACKET_START(PACKET_RULESET_EXTRA);
57400#ifdef FREECIV_JSON_CONNECTION
57401 struct plocation field_addr;
57402 {
57403 struct plocation *field_addr_tmp = plocation_field_new(NULL);
57404 field_addr = *field_addr_tmp;
57405 FC_FREE(field_addr_tmp);
57406 }
57407#endif /* FREECIV_JSON_CONNECTION */
57408
57409 log_packet_detailed("packet_ruleset_extra_100: sending info about ()");
57410
57411#ifdef FREECIV_DELTA_PROTOCOL
57412 if (NULL == *hash) {
57413 *hash = genhash_new_full(hash_packet_ruleset_extra_100, cmp_packet_ruleset_extra_100,
57414 NULL, NULL, NULL, free);
57415 }
57416 BV_CLR_ALL(fields);
57417
57418 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
57419 old = fc_malloc(sizeof(*old));
57420 *old = *real_packet;
57421 genhash_insert(*hash, old, old);
57422 memset(old, 0, sizeof(*old));
57423 }
57424 differ = (old->id != real_packet->id);
57425 if (differ) {
57426 BV_SET(fields, 0);
57427 }
57428
57429 differ = (strcmp(old->name, real_packet->name) != 0);
57430 if (differ) {
57431 BV_SET(fields, 1);
57432 }
57433
57434 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
57435 if (differ) {
57436 BV_SET(fields, 2);
57437 }
57438
57439 differ = (old->category != real_packet->category);
57440 if (differ) {
57441 BV_SET(fields, 3);
57442 }
57443
57444 differ = !BV_ARE_EQUAL(old->causes, real_packet->causes);
57445 if (differ) {
57446 BV_SET(fields, 4);
57447 }
57448
57449 differ = !BV_ARE_EQUAL(old->rmcauses, real_packet->rmcauses);
57450 if (differ) {
57451 BV_SET(fields, 5);
57452 }
57453
57454 differ = (strcmp(old->activity_gfx, real_packet->activity_gfx) != 0);
57455 if (differ) {
57456 BV_SET(fields, 6);
57457 }
57458
57459 differ = (strcmp(old->act_gfx_alt, real_packet->act_gfx_alt) != 0);
57460 if (differ) {
57461 BV_SET(fields, 7);
57462 }
57463
57464 differ = (strcmp(old->act_gfx_alt2, real_packet->act_gfx_alt2) != 0);
57465 if (differ) {
57466 BV_SET(fields, 8);
57467 }
57468
57469 differ = (strcmp(old->rmact_gfx, real_packet->rmact_gfx) != 0);
57470 if (differ) {
57471 BV_SET(fields, 9);
57472 }
57473
57474 differ = (strcmp(old->rmact_gfx_alt, real_packet->rmact_gfx_alt) != 0);
57475 if (differ) {
57476 BV_SET(fields, 10);
57477 }
57478
57479 differ = (strcmp(old->rmact_gfx_alt2, real_packet->rmact_gfx_alt2) != 0);
57480 if (differ) {
57481 BV_SET(fields, 11);
57482 }
57483
57484 differ = (strcmp(old->graphic_str, real_packet->graphic_str) != 0);
57485 if (differ) {
57486 BV_SET(fields, 12);
57487 }
57488
57489 differ = (strcmp(old->graphic_alt, real_packet->graphic_alt) != 0);
57490 if (differ) {
57491 BV_SET(fields, 13);
57492 }
57493
57494 differ = (old->reqs_count != real_packet->reqs_count);
57495 if (differ) {
57496 BV_SET(fields, 14);
57497 }
57498
57499 differ = (old->reqs_count != real_packet->reqs_count);
57500 if (!differ) {
57501 int i;
57502
57503 for (i = 0; i < real_packet->reqs_count; i++) {
57504 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
57505 if (differ) {
57506 break;
57507 }
57508 }
57509 }
57510 if (differ) {
57511 BV_SET(fields, 15);
57512 }
57513
57514 differ = (old->rmreqs_count != real_packet->rmreqs_count);
57515 if (differ) {
57516 BV_SET(fields, 16);
57517 }
57518
57519 differ = (old->rmreqs_count != real_packet->rmreqs_count);
57520 if (!differ) {
57521 int i;
57522
57523 for (i = 0; i < real_packet->rmreqs_count; i++) {
57524 differ = !are_requirements_equal(&old->rmreqs[i], &real_packet->rmreqs[i]);
57525 if (differ) {
57526 break;
57527 }
57528 }
57529 }
57530 if (differ) {
57531 BV_SET(fields, 17);
57532 }
57533
57534 differ = (old->appearance_chance != real_packet->appearance_chance);
57535 if (differ) {
57536 BV_SET(fields, 18);
57537 }
57538
57539 differ = (old->appearance_reqs_count != real_packet->appearance_reqs_count);
57540 if (differ) {
57541 BV_SET(fields, 19);
57542 }
57543
57544 differ = (old->appearance_reqs_count != real_packet->appearance_reqs_count);
57545 if (!differ) {
57546 int i;
57547
57548 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
57549 differ = !are_requirements_equal(&old->appearance_reqs[i], &real_packet->appearance_reqs[i]);
57550 if (differ) {
57551 break;
57552 }
57553 }
57554 }
57555 if (differ) {
57556 BV_SET(fields, 20);
57557 }
57558
57559 differ = (old->disappearance_chance != real_packet->disappearance_chance);
57560 if (differ) {
57561 BV_SET(fields, 21);
57562 }
57563
57564 differ = (old->disappearance_reqs_count != real_packet->disappearance_reqs_count);
57565 if (differ) {
57566 BV_SET(fields, 22);
57567 }
57568
57569 differ = (old->disappearance_reqs_count != real_packet->disappearance_reqs_count);
57570 if (!differ) {
57571 int i;
57572
57573 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
57574 differ = !are_requirements_equal(&old->disappearance_reqs[i], &real_packet->disappearance_reqs[i]);
57575 if (differ) {
57576 break;
57577 }
57578 }
57579 }
57580 if (differ) {
57581 BV_SET(fields, 23);
57582 }
57583
57584 differ = (old->visibility_req != real_packet->visibility_req);
57585 if (differ) {
57586 BV_SET(fields, 24);
57587 }
57588
57589 if (packet->buildable) {
57590 BV_SET(fields, 25);
57591 }
57592
57593 if (packet->generated) {
57594 BV_SET(fields, 26);
57595 }
57596
57597 differ = (old->build_time != real_packet->build_time);
57598 if (differ) {
57599 BV_SET(fields, 27);
57600 }
57601
57602 differ = (old->build_time_factor != real_packet->build_time_factor);
57603 if (differ) {
57604 BV_SET(fields, 28);
57605 }
57606
57607 differ = (old->removal_time != real_packet->removal_time);
57608 if (differ) {
57609 BV_SET(fields, 29);
57610 }
57611
57612 differ = (old->removal_time_factor != real_packet->removal_time_factor);
57613 if (differ) {
57614 BV_SET(fields, 30);
57615 }
57616
57617 differ = (old->infracost != real_packet->infracost);
57618 if (differ) {
57619 BV_SET(fields, 31);
57620 }
57621
57622 differ = (old->defense_bonus != real_packet->defense_bonus);
57623 if (differ) {
57624 BV_SET(fields, 32);
57625 }
57626
57627 differ = (old->eus != real_packet->eus);
57628 if (differ) {
57629 BV_SET(fields, 33);
57630 }
57631
57632 differ = !BV_ARE_EQUAL(old->native_to, real_packet->native_to);
57633 if (differ) {
57634 BV_SET(fields, 34);
57635 }
57636
57637 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
57638 if (differ) {
57639 BV_SET(fields, 35);
57640 }
57641
57642 differ = !BV_ARE_EQUAL(old->hidden_by, real_packet->hidden_by);
57643 if (differ) {
57644 BV_SET(fields, 36);
57645 }
57646
57647 differ = !BV_ARE_EQUAL(old->bridged_over, real_packet->bridged_over);
57648 if (differ) {
57649 BV_SET(fields, 37);
57650 }
57651
57652 differ = !BV_ARE_EQUAL(old->conflicts, real_packet->conflicts);
57653 if (differ) {
57654 BV_SET(fields, 38);
57655 }
57656
57657 differ = (old->no_aggr_near_city != real_packet->no_aggr_near_city);
57658 if (differ) {
57659 BV_SET(fields, 39);
57660 }
57661
57662 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
57663 if (differ) {
57664 BV_SET(fields, 40);
57665 }
57666
57667
57668#ifdef FREECIV_JSON_CONNECTION
57669 field_addr.name = "fields";
57670#endif /* FREECIV_JSON_CONNECTION */
57671 e = 0;
57672 e |= DIO_BV_PUT(&dout, &field_addr, fields);
57673 if (e) {
57674 log_packet_detailed("fields bitvector error detected");
57675 }
57676
57677 if (BV_ISSET(fields, 0)) {
57678 log_packet_detailed(" field 'id' has changed");
57679#ifdef FREECIV_JSON_CONNECTION
57680 field_addr.name = "id";
57681#endif /* FREECIV_JSON_CONNECTION */
57682 e = 0;
57683 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
57684 if (e) {
57685 log_packet_detailed("'id' field error detected");
57686 }
57687 }
57688 if (BV_ISSET(fields, 1)) {
57689 log_packet_detailed(" field 'name' has changed");
57690#ifdef FREECIV_JSON_CONNECTION
57691 field_addr.name = "name";
57692#endif /* FREECIV_JSON_CONNECTION */
57693 e = 0;
57694 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
57695 if (e) {
57696 log_packet_detailed("'name' field error detected");
57697 }
57698 }
57699 if (BV_ISSET(fields, 2)) {
57700 log_packet_detailed(" field 'rule_name' has changed");
57701#ifdef FREECIV_JSON_CONNECTION
57702 field_addr.name = "rule_name";
57703#endif /* FREECIV_JSON_CONNECTION */
57704 e = 0;
57705 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
57706 if (e) {
57707 log_packet_detailed("'rule_name' field error detected");
57708 }
57709 }
57710 if (BV_ISSET(fields, 3)) {
57711 log_packet_detailed(" field 'category' has changed");
57712#ifdef FREECIV_JSON_CONNECTION
57713 field_addr.name = "category";
57714#endif /* FREECIV_JSON_CONNECTION */
57715 e = 0;
57716 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
57717 if (e) {
57718 log_packet_detailed("'category' field error detected");
57719 }
57720 }
57721 if (BV_ISSET(fields, 4)) {
57722 log_packet_detailed(" field 'causes' has changed");
57723#ifdef FREECIV_JSON_CONNECTION
57724 field_addr.name = "causes";
57725#endif /* FREECIV_JSON_CONNECTION */
57726 e = 0;
57727 e |= DIO_BV_PUT(&dout, &field_addr, packet->causes);
57728 if (e) {
57729 log_packet_detailed("'causes' field error detected");
57730 }
57731 }
57732 if (BV_ISSET(fields, 5)) {
57733 log_packet_detailed(" field 'rmcauses' has changed");
57734#ifdef FREECIV_JSON_CONNECTION
57735 field_addr.name = "rmcauses";
57736#endif /* FREECIV_JSON_CONNECTION */
57737 e = 0;
57738 e |= DIO_BV_PUT(&dout, &field_addr, packet->rmcauses);
57739 if (e) {
57740 log_packet_detailed("'rmcauses' field error detected");
57741 }
57742 }
57743 if (BV_ISSET(fields, 6)) {
57744 log_packet_detailed(" field 'activity_gfx' has changed");
57745#ifdef FREECIV_JSON_CONNECTION
57746 field_addr.name = "activity_gfx";
57747#endif /* FREECIV_JSON_CONNECTION */
57748 e = 0;
57749 e |= DIO_PUT(string, &dout, &field_addr, real_packet->activity_gfx);
57750 if (e) {
57751 log_packet_detailed("'activity_gfx' field error detected");
57752 }
57753 }
57754 if (BV_ISSET(fields, 7)) {
57755 log_packet_detailed(" field 'act_gfx_alt' has changed");
57756#ifdef FREECIV_JSON_CONNECTION
57757 field_addr.name = "act_gfx_alt";
57758#endif /* FREECIV_JSON_CONNECTION */
57759 e = 0;
57760 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt);
57761 if (e) {
57762 log_packet_detailed("'act_gfx_alt' field error detected");
57763 }
57764 }
57765 if (BV_ISSET(fields, 8)) {
57766 log_packet_detailed(" field 'act_gfx_alt2' has changed");
57767#ifdef FREECIV_JSON_CONNECTION
57768 field_addr.name = "act_gfx_alt2";
57769#endif /* FREECIV_JSON_CONNECTION */
57770 e = 0;
57771 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt2);
57772 if (e) {
57773 log_packet_detailed("'act_gfx_alt2' field error detected");
57774 }
57775 }
57776 if (BV_ISSET(fields, 9)) {
57777 log_packet_detailed(" field 'rmact_gfx' has changed");
57778#ifdef FREECIV_JSON_CONNECTION
57779 field_addr.name = "rmact_gfx";
57780#endif /* FREECIV_JSON_CONNECTION */
57781 e = 0;
57782 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx);
57783 if (e) {
57784 log_packet_detailed("'rmact_gfx' field error detected");
57785 }
57786 }
57787 if (BV_ISSET(fields, 10)) {
57788 log_packet_detailed(" field 'rmact_gfx_alt' has changed");
57789#ifdef FREECIV_JSON_CONNECTION
57790 field_addr.name = "rmact_gfx_alt";
57791#endif /* FREECIV_JSON_CONNECTION */
57792 e = 0;
57793 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt);
57794 if (e) {
57795 log_packet_detailed("'rmact_gfx_alt' field error detected");
57796 }
57797 }
57798 if (BV_ISSET(fields, 11)) {
57799 log_packet_detailed(" field 'rmact_gfx_alt2' has changed");
57800#ifdef FREECIV_JSON_CONNECTION
57801 field_addr.name = "rmact_gfx_alt2";
57802#endif /* FREECIV_JSON_CONNECTION */
57803 e = 0;
57804 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt2);
57805 if (e) {
57806 log_packet_detailed("'rmact_gfx_alt2' field error detected");
57807 }
57808 }
57809 if (BV_ISSET(fields, 12)) {
57810 log_packet_detailed(" field 'graphic_str' has changed");
57811#ifdef FREECIV_JSON_CONNECTION
57812 field_addr.name = "graphic_str";
57813#endif /* FREECIV_JSON_CONNECTION */
57814 e = 0;
57815 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
57816 if (e) {
57817 log_packet_detailed("'graphic_str' field error detected");
57818 }
57819 }
57820 if (BV_ISSET(fields, 13)) {
57821 log_packet_detailed(" field 'graphic_alt' has changed");
57822#ifdef FREECIV_JSON_CONNECTION
57823 field_addr.name = "graphic_alt";
57824#endif /* FREECIV_JSON_CONNECTION */
57825 e = 0;
57826 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
57827 if (e) {
57828 log_packet_detailed("'graphic_alt' field error detected");
57829 }
57830 }
57831 if (BV_ISSET(fields, 14)) {
57832 log_packet_detailed(" field 'reqs_count' has changed");
57833#ifdef FREECIV_JSON_CONNECTION
57834 field_addr.name = "reqs_count";
57835#endif /* FREECIV_JSON_CONNECTION */
57836 e = 0;
57837 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
57838 if (e) {
57839 log_packet_detailed("'reqs_count' field error detected");
57840 }
57841 }
57842 if (BV_ISSET(fields, 15)) {
57843 log_packet_detailed(" field 'reqs' has changed");
57844#ifdef FREECIV_JSON_CONNECTION
57845 field_addr.name = "reqs";
57846#endif /* FREECIV_JSON_CONNECTION */
57847 e = 0;
57848 {
57849 int i;
57850
57851#ifdef FREECIV_JSON_CONNECTION
57852 /* Create the array. */
57853 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
57854
57855 /* Enter the array. */
57856 field_addr.sub_location = plocation_elem_new(0);
57857#endif /* FREECIV_JSON_CONNECTION */
57858
57859 for (i = 0; i < real_packet->reqs_count; i++) {
57860#ifdef FREECIV_JSON_CONNECTION
57861 /* Next array element. */
57862 field_addr.sub_location->number = i;
57863#endif /* FREECIV_JSON_CONNECTION */
57864 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
57865 }
57866
57867#ifdef FREECIV_JSON_CONNECTION
57868 /* Exit array. */
57869 FC_FREE(field_addr.sub_location);
57870#endif /* FREECIV_JSON_CONNECTION */
57871 }
57872 if (e) {
57873 log_packet_detailed("'reqs' field error detected");
57874 }
57875 }
57876 if (BV_ISSET(fields, 16)) {
57877 log_packet_detailed(" field 'rmreqs_count' has changed");
57878#ifdef FREECIV_JSON_CONNECTION
57879 field_addr.name = "rmreqs_count";
57880#endif /* FREECIV_JSON_CONNECTION */
57881 e = 0;
57882 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rmreqs_count);
57883 if (e) {
57884 log_packet_detailed("'rmreqs_count' field error detected");
57885 }
57886 }
57887 if (BV_ISSET(fields, 17)) {
57888 log_packet_detailed(" field 'rmreqs' has changed");
57889#ifdef FREECIV_JSON_CONNECTION
57890 field_addr.name = "rmreqs";
57891#endif /* FREECIV_JSON_CONNECTION */
57892 e = 0;
57893 {
57894 int i;
57895
57896#ifdef FREECIV_JSON_CONNECTION
57897 /* Create the array. */
57898 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->rmreqs_count);
57899
57900 /* Enter the array. */
57901 field_addr.sub_location = plocation_elem_new(0);
57902#endif /* FREECIV_JSON_CONNECTION */
57903
57904 for (i = 0; i < real_packet->rmreqs_count; i++) {
57905#ifdef FREECIV_JSON_CONNECTION
57906 /* Next array element. */
57907 field_addr.sub_location->number = i;
57908#endif /* FREECIV_JSON_CONNECTION */
57909 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->rmreqs[i]);
57910 }
57911
57912#ifdef FREECIV_JSON_CONNECTION
57913 /* Exit array. */
57914 FC_FREE(field_addr.sub_location);
57915#endif /* FREECIV_JSON_CONNECTION */
57916 }
57917 if (e) {
57918 log_packet_detailed("'rmreqs' field error detected");
57919 }
57920 }
57921 if (BV_ISSET(fields, 18)) {
57922 log_packet_detailed(" field 'appearance_chance' has changed");
57923#ifdef FREECIV_JSON_CONNECTION
57924 field_addr.name = "appearance_chance";
57925#endif /* FREECIV_JSON_CONNECTION */
57926 e = 0;
57927 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->appearance_chance);
57928 if (e) {
57929 log_packet_detailed("'appearance_chance' field error detected");
57930 }
57931 }
57932 if (BV_ISSET(fields, 19)) {
57933 log_packet_detailed(" field 'appearance_reqs_count' has changed");
57934#ifdef FREECIV_JSON_CONNECTION
57935 field_addr.name = "appearance_reqs_count";
57936#endif /* FREECIV_JSON_CONNECTION */
57937 e = 0;
57938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->appearance_reqs_count);
57939 if (e) {
57940 log_packet_detailed("'appearance_reqs_count' field error detected");
57941 }
57942 }
57943 if (BV_ISSET(fields, 20)) {
57944 log_packet_detailed(" field 'appearance_reqs' has changed");
57945#ifdef FREECIV_JSON_CONNECTION
57946 field_addr.name = "appearance_reqs";
57947#endif /* FREECIV_JSON_CONNECTION */
57948 e = 0;
57949 {
57950 int i;
57951
57952#ifdef FREECIV_JSON_CONNECTION
57953 /* Create the array. */
57954 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->appearance_reqs_count);
57955
57956 /* Enter the array. */
57957 field_addr.sub_location = plocation_elem_new(0);
57958#endif /* FREECIV_JSON_CONNECTION */
57959
57960 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
57961#ifdef FREECIV_JSON_CONNECTION
57962 /* Next array element. */
57963 field_addr.sub_location->number = i;
57964#endif /* FREECIV_JSON_CONNECTION */
57965 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->appearance_reqs[i]);
57966 }
57967
57968#ifdef FREECIV_JSON_CONNECTION
57969 /* Exit array. */
57970 FC_FREE(field_addr.sub_location);
57971#endif /* FREECIV_JSON_CONNECTION */
57972 }
57973 if (e) {
57974 log_packet_detailed("'appearance_reqs' field error detected");
57975 }
57976 }
57977 if (BV_ISSET(fields, 21)) {
57978 log_packet_detailed(" field 'disappearance_chance' has changed");
57979#ifdef FREECIV_JSON_CONNECTION
57980 field_addr.name = "disappearance_chance";
57981#endif /* FREECIV_JSON_CONNECTION */
57982 e = 0;
57983 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disappearance_chance);
57984 if (e) {
57985 log_packet_detailed("'disappearance_chance' field error detected");
57986 }
57987 }
57988 if (BV_ISSET(fields, 22)) {
57989 log_packet_detailed(" field 'disappearance_reqs_count' has changed");
57990#ifdef FREECIV_JSON_CONNECTION
57991 field_addr.name = "disappearance_reqs_count";
57992#endif /* FREECIV_JSON_CONNECTION */
57993 e = 0;
57994 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->disappearance_reqs_count);
57995 if (e) {
57996 log_packet_detailed("'disappearance_reqs_count' field error detected");
57997 }
57998 }
57999 if (BV_ISSET(fields, 23)) {
58000 log_packet_detailed(" field 'disappearance_reqs' has changed");
58001#ifdef FREECIV_JSON_CONNECTION
58002 field_addr.name = "disappearance_reqs";
58003#endif /* FREECIV_JSON_CONNECTION */
58004 e = 0;
58005 {
58006 int i;
58007
58008#ifdef FREECIV_JSON_CONNECTION
58009 /* Create the array. */
58010 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->disappearance_reqs_count);
58011
58012 /* Enter the array. */
58013 field_addr.sub_location = plocation_elem_new(0);
58014#endif /* FREECIV_JSON_CONNECTION */
58015
58016 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
58017#ifdef FREECIV_JSON_CONNECTION
58018 /* Next array element. */
58019 field_addr.sub_location->number = i;
58020#endif /* FREECIV_JSON_CONNECTION */
58021 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->disappearance_reqs[i]);
58022 }
58023
58024#ifdef FREECIV_JSON_CONNECTION
58025 /* Exit array. */
58026 FC_FREE(field_addr.sub_location);
58027#endif /* FREECIV_JSON_CONNECTION */
58028 }
58029 if (e) {
58030 log_packet_detailed("'disappearance_reqs' field error detected");
58031 }
58032 }
58033 if (BV_ISSET(fields, 24)) {
58034 log_packet_detailed(" field 'visibility_req' has changed");
58035#ifdef FREECIV_JSON_CONNECTION
58036 field_addr.name = "visibility_req";
58037#endif /* FREECIV_JSON_CONNECTION */
58038 e = 0;
58039 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->visibility_req);
58040 if (e) {
58041 log_packet_detailed("'visibility_req' field error detected");
58042 }
58043 }
58044 /* field 25 is folded into the header */
58045 /* field 26 is folded into the header */
58046 if (BV_ISSET(fields, 27)) {
58047 log_packet_detailed(" field 'build_time' has changed");
58048#ifdef FREECIV_JSON_CONNECTION
58049 field_addr.name = "build_time";
58050#endif /* FREECIV_JSON_CONNECTION */
58051 e = 0;
58052 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time);
58053 if (e) {
58054 log_packet_detailed("'build_time' field error detected");
58055 }
58056 }
58057 if (BV_ISSET(fields, 28)) {
58058 log_packet_detailed(" field 'build_time_factor' has changed");
58059#ifdef FREECIV_JSON_CONNECTION
58060 field_addr.name = "build_time_factor";
58061#endif /* FREECIV_JSON_CONNECTION */
58062 e = 0;
58063 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time_factor);
58064 if (e) {
58065 log_packet_detailed("'build_time_factor' field error detected");
58066 }
58067 }
58068 if (BV_ISSET(fields, 29)) {
58069 log_packet_detailed(" field 'removal_time' has changed");
58070#ifdef FREECIV_JSON_CONNECTION
58071 field_addr.name = "removal_time";
58072#endif /* FREECIV_JSON_CONNECTION */
58073 e = 0;
58074 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time);
58075 if (e) {
58076 log_packet_detailed("'removal_time' field error detected");
58077 }
58078 }
58079 if (BV_ISSET(fields, 30)) {
58080 log_packet_detailed(" field 'removal_time_factor' has changed");
58081#ifdef FREECIV_JSON_CONNECTION
58082 field_addr.name = "removal_time_factor";
58083#endif /* FREECIV_JSON_CONNECTION */
58084 e = 0;
58085 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time_factor);
58086 if (e) {
58087 log_packet_detailed("'removal_time_factor' field error detected");
58088 }
58089 }
58090 if (BV_ISSET(fields, 31)) {
58091 log_packet_detailed(" field 'infracost' has changed");
58092#ifdef FREECIV_JSON_CONNECTION
58093 field_addr.name = "infracost";
58094#endif /* FREECIV_JSON_CONNECTION */
58095 e = 0;
58096 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->infracost);
58097 if (e) {
58098 log_packet_detailed("'infracost' field error detected");
58099 }
58100 }
58101 if (BV_ISSET(fields, 32)) {
58102 log_packet_detailed(" field 'defense_bonus' has changed");
58103#ifdef FREECIV_JSON_CONNECTION
58104 field_addr.name = "defense_bonus";
58105#endif /* FREECIV_JSON_CONNECTION */
58106 e = 0;
58107 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_bonus);
58108 if (e) {
58109 log_packet_detailed("'defense_bonus' field error detected");
58110 }
58111 }
58112 if (BV_ISSET(fields, 33)) {
58113 log_packet_detailed(" field 'eus' has changed");
58114#ifdef FREECIV_JSON_CONNECTION
58115 field_addr.name = "eus";
58116#endif /* FREECIV_JSON_CONNECTION */
58117 e = 0;
58118 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->eus);
58119 if (e) {
58120 log_packet_detailed("'eus' field error detected");
58121 }
58122 }
58123 if (BV_ISSET(fields, 34)) {
58124 log_packet_detailed(" field 'native_to' has changed");
58125#ifdef FREECIV_JSON_CONNECTION
58126 field_addr.name = "native_to";
58127#endif /* FREECIV_JSON_CONNECTION */
58128 e = 0;
58129 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
58130 if (e) {
58131 log_packet_detailed("'native_to' field error detected");
58132 }
58133 }
58134 if (BV_ISSET(fields, 35)) {
58135 log_packet_detailed(" field 'flags' has changed");
58136#ifdef FREECIV_JSON_CONNECTION
58137 field_addr.name = "flags";
58138#endif /* FREECIV_JSON_CONNECTION */
58139 e = 0;
58140 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
58141 if (e) {
58142 log_packet_detailed("'flags' field error detected");
58143 }
58144 }
58145 if (BV_ISSET(fields, 36)) {
58146 log_packet_detailed(" field 'hidden_by' has changed");
58147#ifdef FREECIV_JSON_CONNECTION
58148 field_addr.name = "hidden_by";
58149#endif /* FREECIV_JSON_CONNECTION */
58150 e = 0;
58151 e |= DIO_BV_PUT(&dout, &field_addr, packet->hidden_by);
58152 if (e) {
58153 log_packet_detailed("'hidden_by' field error detected");
58154 }
58155 }
58156 if (BV_ISSET(fields, 37)) {
58157 log_packet_detailed(" field 'bridged_over' has changed");
58158#ifdef FREECIV_JSON_CONNECTION
58159 field_addr.name = "bridged_over";
58160#endif /* FREECIV_JSON_CONNECTION */
58161 e = 0;
58162 e |= DIO_BV_PUT(&dout, &field_addr, packet->bridged_over);
58163 if (e) {
58164 log_packet_detailed("'bridged_over' field error detected");
58165 }
58166 }
58167 if (BV_ISSET(fields, 38)) {
58168 log_packet_detailed(" field 'conflicts' has changed");
58169#ifdef FREECIV_JSON_CONNECTION
58170 field_addr.name = "conflicts";
58171#endif /* FREECIV_JSON_CONNECTION */
58172 e = 0;
58173 e |= DIO_BV_PUT(&dout, &field_addr, packet->conflicts);
58174 if (e) {
58175 log_packet_detailed("'conflicts' field error detected");
58176 }
58177 }
58178 if (BV_ISSET(fields, 39)) {
58179 log_packet_detailed(" field 'no_aggr_near_city' has changed");
58180#ifdef FREECIV_JSON_CONNECTION
58181 field_addr.name = "no_aggr_near_city";
58182#endif /* FREECIV_JSON_CONNECTION */
58183 e = 0;
58184 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->no_aggr_near_city);
58185 if (e) {
58186 log_packet_detailed("'no_aggr_near_city' field error detected");
58187 }
58188 }
58189 if (BV_ISSET(fields, 40)) {
58190 log_packet_detailed(" field 'helptext' has changed");
58191#ifdef FREECIV_JSON_CONNECTION
58192 field_addr.name = "helptext";
58193#endif /* FREECIV_JSON_CONNECTION */
58194 e = 0;
58195 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
58196 if (e) {
58197 log_packet_detailed("'helptext' field error detected");
58198 }
58199 }
58200
58201 *old = *real_packet;
58202#endif /* FREECIV_DELTA_PROTOCOL */
58203#ifndef FREECIV_DELTA_PROTOCOL
58204#ifdef FREECIV_JSON_CONNECTION
58205 field_addr.name = "id";
58206#endif /* FREECIV_JSON_CONNECTION */
58207 e = 0;
58208 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
58209 if (e) {
58210 log_packet_detailed("'id' field error detected");
58211 }
58212#ifdef FREECIV_JSON_CONNECTION
58213 field_addr.name = "name";
58214#endif /* FREECIV_JSON_CONNECTION */
58215 e = 0;
58216 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
58217 if (e) {
58218 log_packet_detailed("'name' field error detected");
58219 }
58220#ifdef FREECIV_JSON_CONNECTION
58221 field_addr.name = "rule_name";
58222#endif /* FREECIV_JSON_CONNECTION */
58223 e = 0;
58224 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
58225 if (e) {
58226 log_packet_detailed("'rule_name' field error detected");
58227 }
58228#ifdef FREECIV_JSON_CONNECTION
58229 field_addr.name = "category";
58230#endif /* FREECIV_JSON_CONNECTION */
58231 e = 0;
58232 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
58233 if (e) {
58234 log_packet_detailed("'category' field error detected");
58235 }
58236#ifdef FREECIV_JSON_CONNECTION
58237 field_addr.name = "causes";
58238#endif /* FREECIV_JSON_CONNECTION */
58239 e = 0;
58240 e |= DIO_BV_PUT(&dout, &field_addr, packet->causes);
58241 if (e) {
58242 log_packet_detailed("'causes' field error detected");
58243 }
58244#ifdef FREECIV_JSON_CONNECTION
58245 field_addr.name = "rmcauses";
58246#endif /* FREECIV_JSON_CONNECTION */
58247 e = 0;
58248 e |= DIO_BV_PUT(&dout, &field_addr, packet->rmcauses);
58249 if (e) {
58250 log_packet_detailed("'rmcauses' field error detected");
58251 }
58252#ifdef FREECIV_JSON_CONNECTION
58253 field_addr.name = "activity_gfx";
58254#endif /* FREECIV_JSON_CONNECTION */
58255 e = 0;
58256 e |= DIO_PUT(string, &dout, &field_addr, real_packet->activity_gfx);
58257 if (e) {
58258 log_packet_detailed("'activity_gfx' field error detected");
58259 }
58260#ifdef FREECIV_JSON_CONNECTION
58261 field_addr.name = "act_gfx_alt";
58262#endif /* FREECIV_JSON_CONNECTION */
58263 e = 0;
58264 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt);
58265 if (e) {
58266 log_packet_detailed("'act_gfx_alt' field error detected");
58267 }
58268#ifdef FREECIV_JSON_CONNECTION
58269 field_addr.name = "act_gfx_alt2";
58270#endif /* FREECIV_JSON_CONNECTION */
58271 e = 0;
58272 e |= DIO_PUT(string, &dout, &field_addr, real_packet->act_gfx_alt2);
58273 if (e) {
58274 log_packet_detailed("'act_gfx_alt2' field error detected");
58275 }
58276#ifdef FREECIV_JSON_CONNECTION
58277 field_addr.name = "rmact_gfx";
58278#endif /* FREECIV_JSON_CONNECTION */
58279 e = 0;
58280 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx);
58281 if (e) {
58282 log_packet_detailed("'rmact_gfx' field error detected");
58283 }
58284#ifdef FREECIV_JSON_CONNECTION
58285 field_addr.name = "rmact_gfx_alt";
58286#endif /* FREECIV_JSON_CONNECTION */
58287 e = 0;
58288 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt);
58289 if (e) {
58290 log_packet_detailed("'rmact_gfx_alt' field error detected");
58291 }
58292#ifdef FREECIV_JSON_CONNECTION
58293 field_addr.name = "rmact_gfx_alt2";
58294#endif /* FREECIV_JSON_CONNECTION */
58295 e = 0;
58296 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rmact_gfx_alt2);
58297 if (e) {
58298 log_packet_detailed("'rmact_gfx_alt2' field error detected");
58299 }
58300#ifdef FREECIV_JSON_CONNECTION
58301 field_addr.name = "graphic_str";
58302#endif /* FREECIV_JSON_CONNECTION */
58303 e = 0;
58304 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_str);
58305 if (e) {
58306 log_packet_detailed("'graphic_str' field error detected");
58307 }
58308#ifdef FREECIV_JSON_CONNECTION
58309 field_addr.name = "graphic_alt";
58310#endif /* FREECIV_JSON_CONNECTION */
58311 e = 0;
58312 e |= DIO_PUT(string, &dout, &field_addr, real_packet->graphic_alt);
58313 if (e) {
58314 log_packet_detailed("'graphic_alt' field error detected");
58315 }
58316#ifdef FREECIV_JSON_CONNECTION
58317 field_addr.name = "reqs_count";
58318#endif /* FREECIV_JSON_CONNECTION */
58319 e = 0;
58320 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
58321 if (e) {
58322 log_packet_detailed("'reqs_count' field error detected");
58323 }
58324#ifdef FREECIV_JSON_CONNECTION
58325 field_addr.name = "reqs";
58326#endif /* FREECIV_JSON_CONNECTION */
58327 e = 0;
58328 {
58329 int i;
58330
58331#ifdef FREECIV_JSON_CONNECTION
58332 /* Create the array. */
58333 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
58334
58335 /* Enter the array. */
58336 field_addr.sub_location = plocation_elem_new(0);
58337#endif /* FREECIV_JSON_CONNECTION */
58338
58339 for (i = 0; i < real_packet->reqs_count; i++) {
58340#ifdef FREECIV_JSON_CONNECTION
58341 /* Next array element. */
58342 field_addr.sub_location->number = i;
58343#endif /* FREECIV_JSON_CONNECTION */
58344 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
58345 }
58346
58347#ifdef FREECIV_JSON_CONNECTION
58348 /* Exit array. */
58349 FC_FREE(field_addr.sub_location);
58350#endif /* FREECIV_JSON_CONNECTION */
58351 }
58352 if (e) {
58353 log_packet_detailed("'reqs' field error detected");
58354 }
58355#ifdef FREECIV_JSON_CONNECTION
58356 field_addr.name = "rmreqs_count";
58357#endif /* FREECIV_JSON_CONNECTION */
58358 e = 0;
58359 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rmreqs_count);
58360 if (e) {
58361 log_packet_detailed("'rmreqs_count' field error detected");
58362 }
58363#ifdef FREECIV_JSON_CONNECTION
58364 field_addr.name = "rmreqs";
58365#endif /* FREECIV_JSON_CONNECTION */
58366 e = 0;
58367 {
58368 int i;
58369
58370#ifdef FREECIV_JSON_CONNECTION
58371 /* Create the array. */
58372 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->rmreqs_count);
58373
58374 /* Enter the array. */
58375 field_addr.sub_location = plocation_elem_new(0);
58376#endif /* FREECIV_JSON_CONNECTION */
58377
58378 for (i = 0; i < real_packet->rmreqs_count; i++) {
58379#ifdef FREECIV_JSON_CONNECTION
58380 /* Next array element. */
58381 field_addr.sub_location->number = i;
58382#endif /* FREECIV_JSON_CONNECTION */
58383 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->rmreqs[i]);
58384 }
58385
58386#ifdef FREECIV_JSON_CONNECTION
58387 /* Exit array. */
58388 FC_FREE(field_addr.sub_location);
58389#endif /* FREECIV_JSON_CONNECTION */
58390 }
58391 if (e) {
58392 log_packet_detailed("'rmreqs' field error detected");
58393 }
58394#ifdef FREECIV_JSON_CONNECTION
58395 field_addr.name = "appearance_chance";
58396#endif /* FREECIV_JSON_CONNECTION */
58397 e = 0;
58398 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->appearance_chance);
58399 if (e) {
58400 log_packet_detailed("'appearance_chance' field error detected");
58401 }
58402#ifdef FREECIV_JSON_CONNECTION
58403 field_addr.name = "appearance_reqs_count";
58404#endif /* FREECIV_JSON_CONNECTION */
58405 e = 0;
58406 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->appearance_reqs_count);
58407 if (e) {
58408 log_packet_detailed("'appearance_reqs_count' field error detected");
58409 }
58410#ifdef FREECIV_JSON_CONNECTION
58411 field_addr.name = "appearance_reqs";
58412#endif /* FREECIV_JSON_CONNECTION */
58413 e = 0;
58414 {
58415 int i;
58416
58417#ifdef FREECIV_JSON_CONNECTION
58418 /* Create the array. */
58419 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->appearance_reqs_count);
58420
58421 /* Enter the array. */
58422 field_addr.sub_location = plocation_elem_new(0);
58423#endif /* FREECIV_JSON_CONNECTION */
58424
58425 for (i = 0; i < real_packet->appearance_reqs_count; i++) {
58426#ifdef FREECIV_JSON_CONNECTION
58427 /* Next array element. */
58428 field_addr.sub_location->number = i;
58429#endif /* FREECIV_JSON_CONNECTION */
58430 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->appearance_reqs[i]);
58431 }
58432
58433#ifdef FREECIV_JSON_CONNECTION
58434 /* Exit array. */
58435 FC_FREE(field_addr.sub_location);
58436#endif /* FREECIV_JSON_CONNECTION */
58437 }
58438 if (e) {
58439 log_packet_detailed("'appearance_reqs' field error detected");
58440 }
58441#ifdef FREECIV_JSON_CONNECTION
58442 field_addr.name = "disappearance_chance";
58443#endif /* FREECIV_JSON_CONNECTION */
58444 e = 0;
58445 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->disappearance_chance);
58446 if (e) {
58447 log_packet_detailed("'disappearance_chance' field error detected");
58448 }
58449#ifdef FREECIV_JSON_CONNECTION
58450 field_addr.name = "disappearance_reqs_count";
58451#endif /* FREECIV_JSON_CONNECTION */
58452 e = 0;
58453 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->disappearance_reqs_count);
58454 if (e) {
58455 log_packet_detailed("'disappearance_reqs_count' field error detected");
58456 }
58457#ifdef FREECIV_JSON_CONNECTION
58458 field_addr.name = "disappearance_reqs";
58459#endif /* FREECIV_JSON_CONNECTION */
58460 e = 0;
58461 {
58462 int i;
58463
58464#ifdef FREECIV_JSON_CONNECTION
58465 /* Create the array. */
58466 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->disappearance_reqs_count);
58467
58468 /* Enter the array. */
58469 field_addr.sub_location = plocation_elem_new(0);
58470#endif /* FREECIV_JSON_CONNECTION */
58471
58472 for (i = 0; i < real_packet->disappearance_reqs_count; i++) {
58473#ifdef FREECIV_JSON_CONNECTION
58474 /* Next array element. */
58475 field_addr.sub_location->number = i;
58476#endif /* FREECIV_JSON_CONNECTION */
58477 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->disappearance_reqs[i]);
58478 }
58479
58480#ifdef FREECIV_JSON_CONNECTION
58481 /* Exit array. */
58482 FC_FREE(field_addr.sub_location);
58483#endif /* FREECIV_JSON_CONNECTION */
58484 }
58485 if (e) {
58486 log_packet_detailed("'disappearance_reqs' field error detected");
58487 }
58488#ifdef FREECIV_JSON_CONNECTION
58489 field_addr.name = "visibility_req";
58490#endif /* FREECIV_JSON_CONNECTION */
58491 e = 0;
58492 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->visibility_req);
58493 if (e) {
58494 log_packet_detailed("'visibility_req' field error detected");
58495 }
58496#ifdef FREECIV_JSON_CONNECTION
58497 field_addr.name = "buildable";
58498#endif /* FREECIV_JSON_CONNECTION */
58499 e = 0;
58500 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->buildable);
58501 if (e) {
58502 log_packet_detailed("'buildable' field error detected");
58503 }
58504#ifdef FREECIV_JSON_CONNECTION
58505 field_addr.name = "generated";
58506#endif /* FREECIV_JSON_CONNECTION */
58507 e = 0;
58508 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->generated);
58509 if (e) {
58510 log_packet_detailed("'generated' field error detected");
58511 }
58512#ifdef FREECIV_JSON_CONNECTION
58513 field_addr.name = "build_time";
58514#endif /* FREECIV_JSON_CONNECTION */
58515 e = 0;
58516 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time);
58517 if (e) {
58518 log_packet_detailed("'build_time' field error detected");
58519 }
58520#ifdef FREECIV_JSON_CONNECTION
58521 field_addr.name = "build_time_factor";
58522#endif /* FREECIV_JSON_CONNECTION */
58523 e = 0;
58524 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->build_time_factor);
58525 if (e) {
58526 log_packet_detailed("'build_time_factor' field error detected");
58527 }
58528#ifdef FREECIV_JSON_CONNECTION
58529 field_addr.name = "removal_time";
58530#endif /* FREECIV_JSON_CONNECTION */
58531 e = 0;
58532 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time);
58533 if (e) {
58534 log_packet_detailed("'removal_time' field error detected");
58535 }
58536#ifdef FREECIV_JSON_CONNECTION
58537 field_addr.name = "removal_time_factor";
58538#endif /* FREECIV_JSON_CONNECTION */
58539 e = 0;
58540 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->removal_time_factor);
58541 if (e) {
58542 log_packet_detailed("'removal_time_factor' field error detected");
58543 }
58544#ifdef FREECIV_JSON_CONNECTION
58545 field_addr.name = "infracost";
58546#endif /* FREECIV_JSON_CONNECTION */
58547 e = 0;
58548 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->infracost);
58549 if (e) {
58550 log_packet_detailed("'infracost' field error detected");
58551 }
58552#ifdef FREECIV_JSON_CONNECTION
58553 field_addr.name = "defense_bonus";
58554#endif /* FREECIV_JSON_CONNECTION */
58555 e = 0;
58556 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->defense_bonus);
58557 if (e) {
58558 log_packet_detailed("'defense_bonus' field error detected");
58559 }
58560#ifdef FREECIV_JSON_CONNECTION
58561 field_addr.name = "eus";
58562#endif /* FREECIV_JSON_CONNECTION */
58563 e = 0;
58564 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->eus);
58565 if (e) {
58566 log_packet_detailed("'eus' field error detected");
58567 }
58568#ifdef FREECIV_JSON_CONNECTION
58569 field_addr.name = "native_to";
58570#endif /* FREECIV_JSON_CONNECTION */
58571 e = 0;
58572 e |= DIO_BV_PUT(&dout, &field_addr, packet->native_to);
58573 if (e) {
58574 log_packet_detailed("'native_to' field error detected");
58575 }
58576#ifdef FREECIV_JSON_CONNECTION
58577 field_addr.name = "flags";
58578#endif /* FREECIV_JSON_CONNECTION */
58579 e = 0;
58580 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
58581 if (e) {
58582 log_packet_detailed("'flags' field error detected");
58583 }
58584#ifdef FREECIV_JSON_CONNECTION
58585 field_addr.name = "hidden_by";
58586#endif /* FREECIV_JSON_CONNECTION */
58587 e = 0;
58588 e |= DIO_BV_PUT(&dout, &field_addr, packet->hidden_by);
58589 if (e) {
58590 log_packet_detailed("'hidden_by' field error detected");
58591 }
58592#ifdef FREECIV_JSON_CONNECTION
58593 field_addr.name = "bridged_over";
58594#endif /* FREECIV_JSON_CONNECTION */
58595 e = 0;
58596 e |= DIO_BV_PUT(&dout, &field_addr, packet->bridged_over);
58597 if (e) {
58598 log_packet_detailed("'bridged_over' field error detected");
58599 }
58600#ifdef FREECIV_JSON_CONNECTION
58601 field_addr.name = "conflicts";
58602#endif /* FREECIV_JSON_CONNECTION */
58603 e = 0;
58604 e |= DIO_BV_PUT(&dout, &field_addr, packet->conflicts);
58605 if (e) {
58606 log_packet_detailed("'conflicts' field error detected");
58607 }
58608#ifdef FREECIV_JSON_CONNECTION
58609 field_addr.name = "no_aggr_near_city";
58610#endif /* FREECIV_JSON_CONNECTION */
58611 e = 0;
58612 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->no_aggr_near_city);
58613 if (e) {
58614 log_packet_detailed("'no_aggr_near_city' field error detected");
58615 }
58616#ifdef FREECIV_JSON_CONNECTION
58617 field_addr.name = "helptext";
58618#endif /* FREECIV_JSON_CONNECTION */
58619 e = 0;
58620 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
58621 if (e) {
58622 log_packet_detailed("'helptext' field error detected");
58623 }
58624
58625#endif
58626 SEND_PACKET_END(PACKET_RULESET_EXTRA);
58627}
58628
58629 int send_packet_ruleset_extra(struct connection *pc, const struct packet_ruleset_extra *packet)
58630{
58631 if (!pc->used) {
58632 log_error("WARNING: trying to send data to the closed connection %s",
58633 conn_description(pc));
58634 return -1;
58635 }
58636 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EXTRA].packet != NULL, -1,
58637 "Handler for PACKET_RULESET_EXTRA not installed");
58638 return pc->phs.handlers->send[PACKET_RULESET_EXTRA].packet(pc, packet);
58639}
58640
58641 void lsend_packet_ruleset_extra(struct conn_list *dest, const struct packet_ruleset_extra *packet)
58642{
58643 conn_list_iterate(dest, pconn) {
58644 send_packet_ruleset_extra(pconn, packet);
58645 } conn_list_iterate_end;
58646}
58647
58648#ifdef FREECIV_DELTA_PROTOCOL
58649#define hash_packet_ruleset_extra_flag_100 hash_const
58650
58651#define cmp_packet_ruleset_extra_flag_100 cmp_const
58652
58653 BV_DEFINE(packet_ruleset_extra_flag_100_fields, 3);
58654#endif /* FREECIV_DELTA_PROTOCOL */
58655
58656 static struct packet_ruleset_extra_flag *receive_packet_ruleset_extra_flag_100(struct connection *pc)
58657{
58658#ifdef FREECIV_DELTA_PROTOCOL
58659 packet_ruleset_extra_flag_100_fields fields;
58660 struct packet_ruleset_extra_flag *old;
58661 struct genhash **hash = pc->phs.received + PACKET_RULESET_EXTRA_FLAG;
58662#endif /* FREECIV_DELTA_PROTOCOL */
58663 RECEIVE_PACKET_START(packet_ruleset_extra_flag, real_packet);
58664#ifdef FREECIV_JSON_CONNECTION
58665 struct plocation field_addr;
58666 {
58667 struct plocation *field_addr_tmp = plocation_field_new(NULL);
58668 field_addr = *field_addr_tmp;
58669 FC_FREE(field_addr_tmp);
58670 }
58671#endif /* FREECIV_JSON_CONNECTION */
58672
58673#ifdef FREECIV_DELTA_PROTOCOL
58674#ifdef FREECIV_JSON_CONNECTION
58675 field_addr.name = "fields";
58676#endif /* FREECIV_JSON_CONNECTION */
58677 DIO_BV_GET(&din, &field_addr, fields);
58678
58679#else /* FREECIV_DELTA_PROTOCOL */
58680#ifdef FREECIV_JSON_CONNECTION
58681 field_addr.name = "id";
58682#endif /* FREECIV_JSON_CONNECTION */
58683 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
58684 RECEIVE_PACKET_FIELD_ERROR(id);
58685 }
58686#ifdef FREECIV_JSON_CONNECTION
58687 field_addr.name = "name";
58688#endif /* FREECIV_JSON_CONNECTION */
58689 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
58690 RECEIVE_PACKET_FIELD_ERROR(name);
58691 }
58692#ifdef FREECIV_JSON_CONNECTION
58693 field_addr.name = "helptxt";
58694#endif /* FREECIV_JSON_CONNECTION */
58695 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
58696 RECEIVE_PACKET_FIELD_ERROR(helptxt);
58697 }
58698#endif
58699 log_packet_detailed("packet_ruleset_extra_flag_100: got info about ()");
58700
58701#ifdef FREECIV_DELTA_PROTOCOL
58702 if (NULL == *hash) {
58703 *hash = genhash_new_full(hash_packet_ruleset_extra_flag_100, cmp_packet_ruleset_extra_flag_100,
58704 NULL, NULL, NULL, free);
58705 }
58706
58707 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
58708 *real_packet = *old;
58709 } else {
58710 log_packet_detailed(" no old info");
58711 memset(real_packet, 0, sizeof(*real_packet));
58712 }
58713
58714 if (BV_ISSET(fields, 0)) {
58715 log_packet_detailed(" got field 'id'");
58716#ifdef FREECIV_JSON_CONNECTION
58717 field_addr.name = "id";
58718#endif /* FREECIV_JSON_CONNECTION */
58719 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
58720 RECEIVE_PACKET_FIELD_ERROR(id);
58721 }
58722 }
58723 if (BV_ISSET(fields, 1)) {
58724 log_packet_detailed(" got field 'name'");
58725#ifdef FREECIV_JSON_CONNECTION
58726 field_addr.name = "name";
58727#endif /* FREECIV_JSON_CONNECTION */
58728 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
58729 RECEIVE_PACKET_FIELD_ERROR(name);
58730 }
58731 }
58732 if (BV_ISSET(fields, 2)) {
58733 log_packet_detailed(" got field 'helptxt'");
58734#ifdef FREECIV_JSON_CONNECTION
58735 field_addr.name = "helptxt";
58736#endif /* FREECIV_JSON_CONNECTION */
58737 if (!DIO_GET(string, &din, &field_addr, real_packet->helptxt, sizeof(real_packet->helptxt))) {
58738 RECEIVE_PACKET_FIELD_ERROR(helptxt);
58739 }
58740 }
58741
58742 if (NULL == old) {
58743 old = fc_malloc(sizeof(*old));
58744 *old = *real_packet;
58745 genhash_insert(*hash, old, old);
58746 } else {
58747 *old = *real_packet;
58748 }
58749
58750#endif /* FREECIV_DELTA_PROTOCOL */
58751 RECEIVE_PACKET_END(real_packet);
58752}
58753
58754 static int send_packet_ruleset_extra_flag_100(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
58755{
58756 const struct packet_ruleset_extra_flag *real_packet = packet;
58757 int e;
58758#ifdef FREECIV_DELTA_PROTOCOL
58759 packet_ruleset_extra_flag_100_fields fields;
58760 struct packet_ruleset_extra_flag *old;
58761 bool differ;
58762 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EXTRA_FLAG;
58763#endif /* FREECIV_DELTA_PROTOCOL */
58764 SEND_PACKET_START(PACKET_RULESET_EXTRA_FLAG);
58765#ifdef FREECIV_JSON_CONNECTION
58766 struct plocation field_addr;
58767 {
58768 struct plocation *field_addr_tmp = plocation_field_new(NULL);
58769 field_addr = *field_addr_tmp;
58770 FC_FREE(field_addr_tmp);
58771 }
58772#endif /* FREECIV_JSON_CONNECTION */
58773
58774 log_packet_detailed("packet_ruleset_extra_flag_100: sending info about ()");
58775
58776#ifdef FREECIV_DELTA_PROTOCOL
58777 if (NULL == *hash) {
58778 *hash = genhash_new_full(hash_packet_ruleset_extra_flag_100, cmp_packet_ruleset_extra_flag_100,
58779 NULL, NULL, NULL, free);
58780 }
58781 BV_CLR_ALL(fields);
58782
58783 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
58784 old = fc_malloc(sizeof(*old));
58785 *old = *real_packet;
58786 genhash_insert(*hash, old, old);
58787 memset(old, 0, sizeof(*old));
58788 }
58789 differ = (old->id != real_packet->id);
58790 if (differ) {
58791 BV_SET(fields, 0);
58792 }
58793
58794 differ = (strcmp(old->name, real_packet->name) != 0);
58795 if (differ) {
58796 BV_SET(fields, 1);
58797 }
58798
58799 differ = (strcmp(old->helptxt, real_packet->helptxt) != 0);
58800 if (differ) {
58801 BV_SET(fields, 2);
58802 }
58803
58804
58805#ifdef FREECIV_JSON_CONNECTION
58806 field_addr.name = "fields";
58807#endif /* FREECIV_JSON_CONNECTION */
58808 e = 0;
58809 e |= DIO_BV_PUT(&dout, &field_addr, fields);
58810 if (e) {
58811 log_packet_detailed("fields bitvector error detected");
58812 }
58813
58814 if (BV_ISSET(fields, 0)) {
58815 log_packet_detailed(" field 'id' has changed");
58816#ifdef FREECIV_JSON_CONNECTION
58817 field_addr.name = "id";
58818#endif /* FREECIV_JSON_CONNECTION */
58819 e = 0;
58820 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
58821 if (e) {
58822 log_packet_detailed("'id' field error detected");
58823 }
58824 }
58825 if (BV_ISSET(fields, 1)) {
58826 log_packet_detailed(" field 'name' has changed");
58827#ifdef FREECIV_JSON_CONNECTION
58828 field_addr.name = "name";
58829#endif /* FREECIV_JSON_CONNECTION */
58830 e = 0;
58831 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
58832 if (e) {
58833 log_packet_detailed("'name' field error detected");
58834 }
58835 }
58836 if (BV_ISSET(fields, 2)) {
58837 log_packet_detailed(" field 'helptxt' has changed");
58838#ifdef FREECIV_JSON_CONNECTION
58839 field_addr.name = "helptxt";
58840#endif /* FREECIV_JSON_CONNECTION */
58841 e = 0;
58842 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
58843 if (e) {
58844 log_packet_detailed("'helptxt' field error detected");
58845 }
58846 }
58847
58848 *old = *real_packet;
58849#endif /* FREECIV_DELTA_PROTOCOL */
58850#ifndef FREECIV_DELTA_PROTOCOL
58851#ifdef FREECIV_JSON_CONNECTION
58852 field_addr.name = "id";
58853#endif /* FREECIV_JSON_CONNECTION */
58854 e = 0;
58855 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
58856 if (e) {
58857 log_packet_detailed("'id' field error detected");
58858 }
58859#ifdef FREECIV_JSON_CONNECTION
58860 field_addr.name = "name";
58861#endif /* FREECIV_JSON_CONNECTION */
58862 e = 0;
58863 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
58864 if (e) {
58865 log_packet_detailed("'name' field error detected");
58866 }
58867#ifdef FREECIV_JSON_CONNECTION
58868 field_addr.name = "helptxt";
58869#endif /* FREECIV_JSON_CONNECTION */
58870 e = 0;
58871 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptxt);
58872 if (e) {
58873 log_packet_detailed("'helptxt' field error detected");
58874 }
58875
58876#endif
58877 SEND_PACKET_END(PACKET_RULESET_EXTRA_FLAG);
58878}
58879
58880 int send_packet_ruleset_extra_flag(struct connection *pc, const struct packet_ruleset_extra_flag *packet)
58881{
58882 if (!pc->used) {
58883 log_error("WARNING: trying to send data to the closed connection %s",
58884 conn_description(pc));
58885 return -1;
58886 }
58887 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EXTRA_FLAG].packet != NULL, -1,
58888 "Handler for PACKET_RULESET_EXTRA_FLAG not installed");
58889 return pc->phs.handlers->send[PACKET_RULESET_EXTRA_FLAG].packet(pc, packet);
58890}
58891
58892 void lsend_packet_ruleset_extra_flag(struct conn_list *dest, const struct packet_ruleset_extra_flag *packet)
58893{
58894 conn_list_iterate(dest, pconn) {
58895 send_packet_ruleset_extra_flag(pconn, packet);
58896 } conn_list_iterate_end;
58897}
58898
58899#ifdef FREECIV_DELTA_PROTOCOL
58900#define hash_packet_ruleset_base_100 hash_const
58901
58902#define cmp_packet_ruleset_base_100 cmp_const
58903
58904 BV_DEFINE(packet_ruleset_base_100_fields, 6);
58905#endif /* FREECIV_DELTA_PROTOCOL */
58906
58907 static struct packet_ruleset_base *receive_packet_ruleset_base_100(struct connection *pc)
58908{
58909#ifdef FREECIV_DELTA_PROTOCOL
58910 packet_ruleset_base_100_fields fields;
58911 struct packet_ruleset_base *old;
58912 struct genhash **hash = pc->phs.received + PACKET_RULESET_BASE;
58913#endif /* FREECIV_DELTA_PROTOCOL */
58914 RECEIVE_PACKET_START(packet_ruleset_base, real_packet);
58915#ifdef FREECIV_JSON_CONNECTION
58916 struct plocation field_addr;
58917 {
58918 struct plocation *field_addr_tmp = plocation_field_new(NULL);
58919 field_addr = *field_addr_tmp;
58920 FC_FREE(field_addr_tmp);
58921 }
58922#endif /* FREECIV_JSON_CONNECTION */
58923
58924#ifdef FREECIV_DELTA_PROTOCOL
58925#ifdef FREECIV_JSON_CONNECTION
58926 field_addr.name = "fields";
58927#endif /* FREECIV_JSON_CONNECTION */
58928 DIO_BV_GET(&din, &field_addr, fields);
58929
58930#else /* FREECIV_DELTA_PROTOCOL */
58931#ifdef FREECIV_JSON_CONNECTION
58932 field_addr.name = "id";
58933#endif /* FREECIV_JSON_CONNECTION */
58934 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
58935 RECEIVE_PACKET_FIELD_ERROR(id);
58936 }
58937#ifdef FREECIV_JSON_CONNECTION
58938 field_addr.name = "gui_type";
58939#endif /* FREECIV_JSON_CONNECTION */
58940 {
58941 int readin;
58942
58943 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
58944 RECEIVE_PACKET_FIELD_ERROR(gui_type);
58945 }
58946 real_packet->gui_type = readin;
58947 }
58948#ifdef FREECIV_JSON_CONNECTION
58949 field_addr.name = "border_sq";
58950#endif /* FREECIV_JSON_CONNECTION */
58951 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->border_sq)) {
58952 RECEIVE_PACKET_FIELD_ERROR(border_sq);
58953 }
58954#ifdef FREECIV_JSON_CONNECTION
58955 field_addr.name = "vision_main_sq";
58956#endif /* FREECIV_JSON_CONNECTION */
58957 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_main_sq)) {
58958 RECEIVE_PACKET_FIELD_ERROR(vision_main_sq);
58959 }
58960#ifdef FREECIV_JSON_CONNECTION
58961 field_addr.name = "vision_invis_sq";
58962#endif /* FREECIV_JSON_CONNECTION */
58963 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_invis_sq)) {
58964 RECEIVE_PACKET_FIELD_ERROR(vision_invis_sq);
58965 }
58966#ifdef FREECIV_JSON_CONNECTION
58967 field_addr.name = "vision_subs_sq";
58968#endif /* FREECIV_JSON_CONNECTION */
58969 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_subs_sq)) {
58970 RECEIVE_PACKET_FIELD_ERROR(vision_subs_sq);
58971 }
58972#endif
58973 log_packet_detailed("packet_ruleset_base_100: got info about ()");
58974
58975#ifdef FREECIV_DELTA_PROTOCOL
58976 if (NULL == *hash) {
58977 *hash = genhash_new_full(hash_packet_ruleset_base_100, cmp_packet_ruleset_base_100,
58978 NULL, NULL, NULL, free);
58979 }
58980
58981 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
58982 *real_packet = *old;
58983 } else {
58984 log_packet_detailed(" no old info");
58985 memset(real_packet, 0, sizeof(*real_packet));
58986 }
58987
58988 if (BV_ISSET(fields, 0)) {
58989 log_packet_detailed(" got field 'id'");
58990#ifdef FREECIV_JSON_CONNECTION
58991 field_addr.name = "id";
58992#endif /* FREECIV_JSON_CONNECTION */
58993 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
58994 RECEIVE_PACKET_FIELD_ERROR(id);
58995 }
58996 }
58997 if (BV_ISSET(fields, 1)) {
58998 log_packet_detailed(" got field 'gui_type'");
58999#ifdef FREECIV_JSON_CONNECTION
59000 field_addr.name = "gui_type";
59001#endif /* FREECIV_JSON_CONNECTION */
59002 {
59003 int readin;
59004
59005 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
59006 RECEIVE_PACKET_FIELD_ERROR(gui_type);
59007 }
59008 real_packet->gui_type = readin;
59009 }
59010 }
59011 if (BV_ISSET(fields, 2)) {
59012 log_packet_detailed(" got field 'border_sq'");
59013#ifdef FREECIV_JSON_CONNECTION
59014 field_addr.name = "border_sq";
59015#endif /* FREECIV_JSON_CONNECTION */
59016 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->border_sq)) {
59017 RECEIVE_PACKET_FIELD_ERROR(border_sq);
59018 }
59019 }
59020 if (BV_ISSET(fields, 3)) {
59021 log_packet_detailed(" got field 'vision_main_sq'");
59022#ifdef FREECIV_JSON_CONNECTION
59023 field_addr.name = "vision_main_sq";
59024#endif /* FREECIV_JSON_CONNECTION */
59025 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_main_sq)) {
59026 RECEIVE_PACKET_FIELD_ERROR(vision_main_sq);
59027 }
59028 }
59029 if (BV_ISSET(fields, 4)) {
59030 log_packet_detailed(" got field 'vision_invis_sq'");
59031#ifdef FREECIV_JSON_CONNECTION
59032 field_addr.name = "vision_invis_sq";
59033#endif /* FREECIV_JSON_CONNECTION */
59034 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_invis_sq)) {
59035 RECEIVE_PACKET_FIELD_ERROR(vision_invis_sq);
59036 }
59037 }
59038 if (BV_ISSET(fields, 5)) {
59039 log_packet_detailed(" got field 'vision_subs_sq'");
59040#ifdef FREECIV_JSON_CONNECTION
59041 field_addr.name = "vision_subs_sq";
59042#endif /* FREECIV_JSON_CONNECTION */
59043 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->vision_subs_sq)) {
59044 RECEIVE_PACKET_FIELD_ERROR(vision_subs_sq);
59045 }
59046 }
59047
59048 if (NULL == old) {
59049 old = fc_malloc(sizeof(*old));
59050 *old = *real_packet;
59051 genhash_insert(*hash, old, old);
59052 } else {
59053 *old = *real_packet;
59054 }
59055
59056#endif /* FREECIV_DELTA_PROTOCOL */
59057 RECEIVE_PACKET_END(real_packet);
59058}
59059
59060 static int send_packet_ruleset_base_100(struct connection *pc, const struct packet_ruleset_base *packet)
59061{
59062 const struct packet_ruleset_base *real_packet = packet;
59063 int e;
59064#ifdef FREECIV_DELTA_PROTOCOL
59065 packet_ruleset_base_100_fields fields;
59066 struct packet_ruleset_base *old;
59067 bool differ;
59068 struct genhash **hash = pc->phs.sent + PACKET_RULESET_BASE;
59069#endif /* FREECIV_DELTA_PROTOCOL */
59070 SEND_PACKET_START(PACKET_RULESET_BASE);
59071#ifdef FREECIV_JSON_CONNECTION
59072 struct plocation field_addr;
59073 {
59074 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59075 field_addr = *field_addr_tmp;
59076 FC_FREE(field_addr_tmp);
59077 }
59078#endif /* FREECIV_JSON_CONNECTION */
59079
59080 log_packet_detailed("packet_ruleset_base_100: sending info about ()");
59081
59082#ifdef FREECIV_DELTA_PROTOCOL
59083 if (NULL == *hash) {
59084 *hash = genhash_new_full(hash_packet_ruleset_base_100, cmp_packet_ruleset_base_100,
59085 NULL, NULL, NULL, free);
59086 }
59087 BV_CLR_ALL(fields);
59088
59089 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
59090 old = fc_malloc(sizeof(*old));
59091 *old = *real_packet;
59092 genhash_insert(*hash, old, old);
59093 memset(old, 0, sizeof(*old));
59094 }
59095 differ = (old->id != real_packet->id);
59096 if (differ) {
59097 BV_SET(fields, 0);
59098 }
59099
59100 differ = (old->gui_type != real_packet->gui_type);
59101 if (differ) {
59102 BV_SET(fields, 1);
59103 }
59104
59105 differ = (old->border_sq != real_packet->border_sq);
59106 if (differ) {
59107 BV_SET(fields, 2);
59108 }
59109
59110 differ = (old->vision_main_sq != real_packet->vision_main_sq);
59111 if (differ) {
59112 BV_SET(fields, 3);
59113 }
59114
59115 differ = (old->vision_invis_sq != real_packet->vision_invis_sq);
59116 if (differ) {
59117 BV_SET(fields, 4);
59118 }
59119
59120 differ = (old->vision_subs_sq != real_packet->vision_subs_sq);
59121 if (differ) {
59122 BV_SET(fields, 5);
59123 }
59124
59125
59126#ifdef FREECIV_JSON_CONNECTION
59127 field_addr.name = "fields";
59128#endif /* FREECIV_JSON_CONNECTION */
59129 e = 0;
59130 e |= DIO_BV_PUT(&dout, &field_addr, fields);
59131 if (e) {
59132 log_packet_detailed("fields bitvector error detected");
59133 }
59134
59135 if (BV_ISSET(fields, 0)) {
59136 log_packet_detailed(" field 'id' has changed");
59137#ifdef FREECIV_JSON_CONNECTION
59138 field_addr.name = "id";
59139#endif /* FREECIV_JSON_CONNECTION */
59140 e = 0;
59141 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
59142 if (e) {
59143 log_packet_detailed("'id' field error detected");
59144 }
59145 }
59146 if (BV_ISSET(fields, 1)) {
59147 log_packet_detailed(" field 'gui_type' has changed");
59148#ifdef FREECIV_JSON_CONNECTION
59149 field_addr.name = "gui_type";
59150#endif /* FREECIV_JSON_CONNECTION */
59151 e = 0;
59152 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
59153 if (e) {
59154 log_packet_detailed("'gui_type' field error detected");
59155 }
59156 }
59157 if (BV_ISSET(fields, 2)) {
59158 log_packet_detailed(" field 'border_sq' has changed");
59159#ifdef FREECIV_JSON_CONNECTION
59160 field_addr.name = "border_sq";
59161#endif /* FREECIV_JSON_CONNECTION */
59162 e = 0;
59163 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->border_sq);
59164 if (e) {
59165 log_packet_detailed("'border_sq' field error detected");
59166 }
59167 }
59168 if (BV_ISSET(fields, 3)) {
59169 log_packet_detailed(" field 'vision_main_sq' has changed");
59170#ifdef FREECIV_JSON_CONNECTION
59171 field_addr.name = "vision_main_sq";
59172#endif /* FREECIV_JSON_CONNECTION */
59173 e = 0;
59174 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_main_sq);
59175 if (e) {
59176 log_packet_detailed("'vision_main_sq' field error detected");
59177 }
59178 }
59179 if (BV_ISSET(fields, 4)) {
59180 log_packet_detailed(" field 'vision_invis_sq' has changed");
59181#ifdef FREECIV_JSON_CONNECTION
59182 field_addr.name = "vision_invis_sq";
59183#endif /* FREECIV_JSON_CONNECTION */
59184 e = 0;
59185 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_invis_sq);
59186 if (e) {
59187 log_packet_detailed("'vision_invis_sq' field error detected");
59188 }
59189 }
59190 if (BV_ISSET(fields, 5)) {
59191 log_packet_detailed(" field 'vision_subs_sq' has changed");
59192#ifdef FREECIV_JSON_CONNECTION
59193 field_addr.name = "vision_subs_sq";
59194#endif /* FREECIV_JSON_CONNECTION */
59195 e = 0;
59196 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_subs_sq);
59197 if (e) {
59198 log_packet_detailed("'vision_subs_sq' field error detected");
59199 }
59200 }
59201
59202 *old = *real_packet;
59203#endif /* FREECIV_DELTA_PROTOCOL */
59204#ifndef FREECIV_DELTA_PROTOCOL
59205#ifdef FREECIV_JSON_CONNECTION
59206 field_addr.name = "id";
59207#endif /* FREECIV_JSON_CONNECTION */
59208 e = 0;
59209 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
59210 if (e) {
59211 log_packet_detailed("'id' field error detected");
59212 }
59213#ifdef FREECIV_JSON_CONNECTION
59214 field_addr.name = "gui_type";
59215#endif /* FREECIV_JSON_CONNECTION */
59216 e = 0;
59217 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
59218 if (e) {
59219 log_packet_detailed("'gui_type' field error detected");
59220 }
59221#ifdef FREECIV_JSON_CONNECTION
59222 field_addr.name = "border_sq";
59223#endif /* FREECIV_JSON_CONNECTION */
59224 e = 0;
59225 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->border_sq);
59226 if (e) {
59227 log_packet_detailed("'border_sq' field error detected");
59228 }
59229#ifdef FREECIV_JSON_CONNECTION
59230 field_addr.name = "vision_main_sq";
59231#endif /* FREECIV_JSON_CONNECTION */
59232 e = 0;
59233 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_main_sq);
59234 if (e) {
59235 log_packet_detailed("'vision_main_sq' field error detected");
59236 }
59237#ifdef FREECIV_JSON_CONNECTION
59238 field_addr.name = "vision_invis_sq";
59239#endif /* FREECIV_JSON_CONNECTION */
59240 e = 0;
59241 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_invis_sq);
59242 if (e) {
59243 log_packet_detailed("'vision_invis_sq' field error detected");
59244 }
59245#ifdef FREECIV_JSON_CONNECTION
59246 field_addr.name = "vision_subs_sq";
59247#endif /* FREECIV_JSON_CONNECTION */
59248 e = 0;
59249 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->vision_subs_sq);
59250 if (e) {
59251 log_packet_detailed("'vision_subs_sq' field error detected");
59252 }
59253
59254#endif
59255 SEND_PACKET_END(PACKET_RULESET_BASE);
59256}
59257
59258 int send_packet_ruleset_base(struct connection *pc, const struct packet_ruleset_base *packet)
59259{
59260 if (!pc->used) {
59261 log_error("WARNING: trying to send data to the closed connection %s",
59262 conn_description(pc));
59263 return -1;
59264 }
59265 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_BASE].packet != NULL, -1,
59266 "Handler for PACKET_RULESET_BASE not installed");
59267 return pc->phs.handlers->send[PACKET_RULESET_BASE].packet(pc, packet);
59268}
59269
59270 void lsend_packet_ruleset_base(struct conn_list *dest, const struct packet_ruleset_base *packet)
59271{
59272 conn_list_iterate(dest, pconn) {
59273 send_packet_ruleset_base(pconn, packet);
59274 } conn_list_iterate_end;
59275}
59276
59277#ifdef FREECIV_DELTA_PROTOCOL
59278#define hash_packet_ruleset_road_100 hash_const
59279
59280#define cmp_packet_ruleset_road_100 cmp_const
59281
59282 BV_DEFINE(packet_ruleset_road_100_fields, 12);
59283#endif /* FREECIV_DELTA_PROTOCOL */
59284
59285 static struct packet_ruleset_road *receive_packet_ruleset_road_100(struct connection *pc)
59286{
59287#ifdef FREECIV_DELTA_PROTOCOL
59288 packet_ruleset_road_100_fields fields;
59289 struct packet_ruleset_road *old;
59290 struct genhash **hash = pc->phs.received + PACKET_RULESET_ROAD;
59291#endif /* FREECIV_DELTA_PROTOCOL */
59292 RECEIVE_PACKET_START(packet_ruleset_road, real_packet);
59293#ifdef FREECIV_JSON_CONNECTION
59294 struct plocation field_addr;
59295 {
59296 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59297 field_addr = *field_addr_tmp;
59298 FC_FREE(field_addr_tmp);
59299 }
59300#endif /* FREECIV_JSON_CONNECTION */
59301
59302#ifdef FREECIV_DELTA_PROTOCOL
59303#ifdef FREECIV_JSON_CONNECTION
59304 field_addr.name = "fields";
59305#endif /* FREECIV_JSON_CONNECTION */
59306 DIO_BV_GET(&din, &field_addr, fields);
59307
59308#else /* FREECIV_DELTA_PROTOCOL */
59309#ifdef FREECIV_JSON_CONNECTION
59310 field_addr.name = "id";
59311#endif /* FREECIV_JSON_CONNECTION */
59312 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59313 RECEIVE_PACKET_FIELD_ERROR(id);
59314 }
59315#ifdef FREECIV_JSON_CONNECTION
59316 field_addr.name = "gui_type";
59317#endif /* FREECIV_JSON_CONNECTION */
59318 {
59319 int readin;
59320
59321 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
59322 RECEIVE_PACKET_FIELD_ERROR(gui_type);
59323 }
59324 real_packet->gui_type = readin;
59325 }
59326#ifdef FREECIV_JSON_CONNECTION
59327 field_addr.name = "first_reqs_count";
59328#endif /* FREECIV_JSON_CONNECTION */
59329 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->first_reqs_count)) {
59330 RECEIVE_PACKET_FIELD_ERROR(first_reqs_count);
59331 }
59332#ifdef FREECIV_JSON_CONNECTION
59333 field_addr.name = "first_reqs";
59334#endif /* FREECIV_JSON_CONNECTION */
59335 {
59336 int i;
59337
59338#ifdef FREECIV_JSON_CONNECTION
59339 /* Enter array. */
59340 field_addr.sub_location = plocation_elem_new(0);
59341#endif /* FREECIV_JSON_CONNECTION */
59342
59343 if (real_packet->first_reqs_count > MAX_NUM_REQS) {
59344 RECEIVE_PACKET_FIELD_ERROR(first_reqs, ": truncation array");
59345 }
59346 for (i = 0; i < real_packet->first_reqs_count; i++) {
59347#ifdef FREECIV_JSON_CONNECTION
59348 field_addr.sub_location->number = i;
59349#endif /* FREECIV_JSON_CONNECTION */
59350 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->first_reqs[i])) {
59351 RECEIVE_PACKET_FIELD_ERROR(first_reqs);
59352 }
59353 }
59354
59355#ifdef FREECIV_JSON_CONNECTION
59356 /* Exit array. */
59357 FC_FREE(field_addr.sub_location);
59358#endif /* FREECIV_JSON_CONNECTION */
59359 }
59360#ifdef FREECIV_JSON_CONNECTION
59361 field_addr.name = "move_cost";
59362#endif /* FREECIV_JSON_CONNECTION */
59363 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->move_cost)) {
59364 RECEIVE_PACKET_FIELD_ERROR(move_cost);
59365 }
59366#ifdef FREECIV_JSON_CONNECTION
59367 field_addr.name = "move_mode";
59368#endif /* FREECIV_JSON_CONNECTION */
59369 {
59370 int readin;
59371
59372 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
59373 RECEIVE_PACKET_FIELD_ERROR(move_mode);
59374 }
59375 real_packet->move_mode = readin;
59376 }
59377#ifdef FREECIV_JSON_CONNECTION
59378 field_addr.name = "tile_incr_const";
59379#endif /* FREECIV_JSON_CONNECTION */
59380 {
59381 int i;
59382
59383#ifdef FREECIV_JSON_CONNECTION
59384 /* Enter array. */
59385 field_addr.sub_location = plocation_elem_new(0);
59386#endif /* FREECIV_JSON_CONNECTION */
59387
59388 for (i = 0; i < O_LAST; i++) {
59389#ifdef FREECIV_JSON_CONNECTION
59390 field_addr.sub_location->number = i;
59391#endif /* FREECIV_JSON_CONNECTION */
59392 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr_const[i])) {
59393 RECEIVE_PACKET_FIELD_ERROR(tile_incr_const);
59394 }
59395 }
59396
59397#ifdef FREECIV_JSON_CONNECTION
59398 /* Exit array. */
59399 FC_FREE(field_addr.sub_location);
59400#endif /* FREECIV_JSON_CONNECTION */
59401 }
59402#ifdef FREECIV_JSON_CONNECTION
59403 field_addr.name = "tile_incr";
59404#endif /* FREECIV_JSON_CONNECTION */
59405 {
59406 int i;
59407
59408#ifdef FREECIV_JSON_CONNECTION
59409 /* Enter array. */
59410 field_addr.sub_location = plocation_elem_new(0);
59411#endif /* FREECIV_JSON_CONNECTION */
59412
59413 for (i = 0; i < O_LAST; i++) {
59414#ifdef FREECIV_JSON_CONNECTION
59415 field_addr.sub_location->number = i;
59416#endif /* FREECIV_JSON_CONNECTION */
59417 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr[i])) {
59418 RECEIVE_PACKET_FIELD_ERROR(tile_incr);
59419 }
59420 }
59421
59422#ifdef FREECIV_JSON_CONNECTION
59423 /* Exit array. */
59424 FC_FREE(field_addr.sub_location);
59425#endif /* FREECIV_JSON_CONNECTION */
59426 }
59427#ifdef FREECIV_JSON_CONNECTION
59428 field_addr.name = "tile_bonus";
59429#endif /* FREECIV_JSON_CONNECTION */
59430 {
59431 int i;
59432
59433#ifdef FREECIV_JSON_CONNECTION
59434 /* Enter array. */
59435 field_addr.sub_location = plocation_elem_new(0);
59436#endif /* FREECIV_JSON_CONNECTION */
59437
59438 for (i = 0; i < O_LAST; i++) {
59439#ifdef FREECIV_JSON_CONNECTION
59440 field_addr.sub_location->number = i;
59441#endif /* FREECIV_JSON_CONNECTION */
59442 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_bonus[i])) {
59443 RECEIVE_PACKET_FIELD_ERROR(tile_bonus);
59444 }
59445 }
59446
59447#ifdef FREECIV_JSON_CONNECTION
59448 /* Exit array. */
59449 FC_FREE(field_addr.sub_location);
59450#endif /* FREECIV_JSON_CONNECTION */
59451 }
59452#ifdef FREECIV_JSON_CONNECTION
59453 field_addr.name = "compat";
59454#endif /* FREECIV_JSON_CONNECTION */
59455 {
59456 int readin;
59457
59458 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
59459 RECEIVE_PACKET_FIELD_ERROR(compat);
59460 }
59461 real_packet->compat = readin;
59462 }
59463#ifdef FREECIV_JSON_CONNECTION
59464 field_addr.name = "integrates";
59465#endif /* FREECIV_JSON_CONNECTION */
59466 if (!DIO_BV_GET(&din, &field_addr, real_packet->integrates)) {
59467 RECEIVE_PACKET_FIELD_ERROR(integrates);
59468 }
59469#ifdef FREECIV_JSON_CONNECTION
59470 field_addr.name = "flags";
59471#endif /* FREECIV_JSON_CONNECTION */
59472 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
59473 RECEIVE_PACKET_FIELD_ERROR(flags);
59474 }
59475#endif
59476 log_packet_detailed("packet_ruleset_road_100: got info about ()");
59477
59478#ifdef FREECIV_DELTA_PROTOCOL
59479 if (NULL == *hash) {
59480 *hash = genhash_new_full(hash_packet_ruleset_road_100, cmp_packet_ruleset_road_100,
59481 NULL, NULL, NULL, free);
59482 }
59483
59484 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
59485 *real_packet = *old;
59486 } else {
59487 log_packet_detailed(" no old info");
59488 memset(real_packet, 0, sizeof(*real_packet));
59489 }
59490
59491 if (BV_ISSET(fields, 0)) {
59492 log_packet_detailed(" got field 'id'");
59493#ifdef FREECIV_JSON_CONNECTION
59494 field_addr.name = "id";
59495#endif /* FREECIV_JSON_CONNECTION */
59496 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
59497 RECEIVE_PACKET_FIELD_ERROR(id);
59498 }
59499 }
59500 if (BV_ISSET(fields, 1)) {
59501 log_packet_detailed(" got field 'gui_type'");
59502#ifdef FREECIV_JSON_CONNECTION
59503 field_addr.name = "gui_type";
59504#endif /* FREECIV_JSON_CONNECTION */
59505 {
59506 int readin;
59507
59508 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
59509 RECEIVE_PACKET_FIELD_ERROR(gui_type);
59510 }
59511 real_packet->gui_type = readin;
59512 }
59513 }
59514 if (BV_ISSET(fields, 2)) {
59515 log_packet_detailed(" got field 'first_reqs_count'");
59516#ifdef FREECIV_JSON_CONNECTION
59517 field_addr.name = "first_reqs_count";
59518#endif /* FREECIV_JSON_CONNECTION */
59519 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->first_reqs_count)) {
59520 RECEIVE_PACKET_FIELD_ERROR(first_reqs_count);
59521 }
59522 }
59523 if (BV_ISSET(fields, 3)) {
59524 log_packet_detailed(" got field 'first_reqs'");
59525#ifdef FREECIV_JSON_CONNECTION
59526 field_addr.name = "first_reqs";
59527#endif /* FREECIV_JSON_CONNECTION */
59528 {
59529 int i;
59530
59531#ifdef FREECIV_JSON_CONNECTION
59532 /* Enter array. */
59533 field_addr.sub_location = plocation_elem_new(0);
59534#endif /* FREECIV_JSON_CONNECTION */
59535
59536 if (real_packet->first_reqs_count > MAX_NUM_REQS) {
59537 RECEIVE_PACKET_FIELD_ERROR(first_reqs, ": truncation array");
59538 }
59539 for (i = 0; i < real_packet->first_reqs_count; i++) {
59540#ifdef FREECIV_JSON_CONNECTION
59541 field_addr.sub_location->number = i;
59542#endif /* FREECIV_JSON_CONNECTION */
59543 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->first_reqs[i])) {
59544 RECEIVE_PACKET_FIELD_ERROR(first_reqs);
59545 }
59546 }
59547
59548#ifdef FREECIV_JSON_CONNECTION
59549 /* Exit array. */
59550 FC_FREE(field_addr.sub_location);
59551#endif /* FREECIV_JSON_CONNECTION */
59552 }
59553 }
59554 if (BV_ISSET(fields, 4)) {
59555 log_packet_detailed(" got field 'move_cost'");
59556#ifdef FREECIV_JSON_CONNECTION
59557 field_addr.name = "move_cost";
59558#endif /* FREECIV_JSON_CONNECTION */
59559 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->move_cost)) {
59560 RECEIVE_PACKET_FIELD_ERROR(move_cost);
59561 }
59562 }
59563 if (BV_ISSET(fields, 5)) {
59564 log_packet_detailed(" got field 'move_mode'");
59565#ifdef FREECIV_JSON_CONNECTION
59566 field_addr.name = "move_mode";
59567#endif /* FREECIV_JSON_CONNECTION */
59568 {
59569 int readin;
59570
59571 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
59572 RECEIVE_PACKET_FIELD_ERROR(move_mode);
59573 }
59574 real_packet->move_mode = readin;
59575 }
59576 }
59577 if (BV_ISSET(fields, 6)) {
59578 log_packet_detailed(" got field 'tile_incr_const'");
59579#ifdef FREECIV_JSON_CONNECTION
59580 field_addr.name = "tile_incr_const";
59581#endif /* FREECIV_JSON_CONNECTION */
59582 {
59583 int i;
59584
59585#ifdef FREECIV_JSON_CONNECTION
59586 /* Enter array. */
59587 field_addr.sub_location = plocation_elem_new(0);
59588#endif /* FREECIV_JSON_CONNECTION */
59589
59590 for (i = 0; i < O_LAST; i++) {
59591#ifdef FREECIV_JSON_CONNECTION
59592 field_addr.sub_location->number = i;
59593#endif /* FREECIV_JSON_CONNECTION */
59594 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr_const[i])) {
59595 RECEIVE_PACKET_FIELD_ERROR(tile_incr_const);
59596 }
59597 }
59598
59599#ifdef FREECIV_JSON_CONNECTION
59600 /* Exit array. */
59601 FC_FREE(field_addr.sub_location);
59602#endif /* FREECIV_JSON_CONNECTION */
59603 }
59604 }
59605 if (BV_ISSET(fields, 7)) {
59606 log_packet_detailed(" got field 'tile_incr'");
59607#ifdef FREECIV_JSON_CONNECTION
59608 field_addr.name = "tile_incr";
59609#endif /* FREECIV_JSON_CONNECTION */
59610 {
59611 int i;
59612
59613#ifdef FREECIV_JSON_CONNECTION
59614 /* Enter array. */
59615 field_addr.sub_location = plocation_elem_new(0);
59616#endif /* FREECIV_JSON_CONNECTION */
59617
59618 for (i = 0; i < O_LAST; i++) {
59619#ifdef FREECIV_JSON_CONNECTION
59620 field_addr.sub_location->number = i;
59621#endif /* FREECIV_JSON_CONNECTION */
59622 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_incr[i])) {
59623 RECEIVE_PACKET_FIELD_ERROR(tile_incr);
59624 }
59625 }
59626
59627#ifdef FREECIV_JSON_CONNECTION
59628 /* Exit array. */
59629 FC_FREE(field_addr.sub_location);
59630#endif /* FREECIV_JSON_CONNECTION */
59631 }
59632 }
59633 if (BV_ISSET(fields, 8)) {
59634 log_packet_detailed(" got field 'tile_bonus'");
59635#ifdef FREECIV_JSON_CONNECTION
59636 field_addr.name = "tile_bonus";
59637#endif /* FREECIV_JSON_CONNECTION */
59638 {
59639 int i;
59640
59641#ifdef FREECIV_JSON_CONNECTION
59642 /* Enter array. */
59643 field_addr.sub_location = plocation_elem_new(0);
59644#endif /* FREECIV_JSON_CONNECTION */
59645
59646 for (i = 0; i < O_LAST; i++) {
59647#ifdef FREECIV_JSON_CONNECTION
59648 field_addr.sub_location->number = i;
59649#endif /* FREECIV_JSON_CONNECTION */
59650 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->tile_bonus[i])) {
59651 RECEIVE_PACKET_FIELD_ERROR(tile_bonus);
59652 }
59653 }
59654
59655#ifdef FREECIV_JSON_CONNECTION
59656 /* Exit array. */
59657 FC_FREE(field_addr.sub_location);
59658#endif /* FREECIV_JSON_CONNECTION */
59659 }
59660 }
59661 if (BV_ISSET(fields, 9)) {
59662 log_packet_detailed(" got field 'compat'");
59663#ifdef FREECIV_JSON_CONNECTION
59664 field_addr.name = "compat";
59665#endif /* FREECIV_JSON_CONNECTION */
59666 {
59667 int readin;
59668
59669 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
59670 RECEIVE_PACKET_FIELD_ERROR(compat);
59671 }
59672 real_packet->compat = readin;
59673 }
59674 }
59675 if (BV_ISSET(fields, 10)) {
59676 log_packet_detailed(" got field 'integrates'");
59677#ifdef FREECIV_JSON_CONNECTION
59678 field_addr.name = "integrates";
59679#endif /* FREECIV_JSON_CONNECTION */
59680 if (!DIO_BV_GET(&din, &field_addr, real_packet->integrates)) {
59681 RECEIVE_PACKET_FIELD_ERROR(integrates);
59682 }
59683 }
59684 if (BV_ISSET(fields, 11)) {
59685 log_packet_detailed(" got field 'flags'");
59686#ifdef FREECIV_JSON_CONNECTION
59687 field_addr.name = "flags";
59688#endif /* FREECIV_JSON_CONNECTION */
59689 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
59690 RECEIVE_PACKET_FIELD_ERROR(flags);
59691 }
59692 }
59693
59694 if (NULL == old) {
59695 old = fc_malloc(sizeof(*old));
59696 *old = *real_packet;
59697 genhash_insert(*hash, old, old);
59698 } else {
59699 *old = *real_packet;
59700 }
59701
59702#endif /* FREECIV_DELTA_PROTOCOL */
59703 RECEIVE_PACKET_END(real_packet);
59704}
59705
59706 static int send_packet_ruleset_road_100(struct connection *pc, const struct packet_ruleset_road *packet)
59707{
59708 const struct packet_ruleset_road *real_packet = packet;
59709 int e;
59710#ifdef FREECIV_DELTA_PROTOCOL
59711 packet_ruleset_road_100_fields fields;
59712 struct packet_ruleset_road *old;
59713 bool differ;
59714 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ROAD;
59715#endif /* FREECIV_DELTA_PROTOCOL */
59716 SEND_PACKET_START(PACKET_RULESET_ROAD);
59717#ifdef FREECIV_JSON_CONNECTION
59718 struct plocation field_addr;
59719 {
59720 struct plocation *field_addr_tmp = plocation_field_new(NULL);
59721 field_addr = *field_addr_tmp;
59722 FC_FREE(field_addr_tmp);
59723 }
59724#endif /* FREECIV_JSON_CONNECTION */
59725
59726 log_packet_detailed("packet_ruleset_road_100: sending info about ()");
59727
59728#ifdef FREECIV_DELTA_PROTOCOL
59729 if (NULL == *hash) {
59730 *hash = genhash_new_full(hash_packet_ruleset_road_100, cmp_packet_ruleset_road_100,
59731 NULL, NULL, NULL, free);
59732 }
59733 BV_CLR_ALL(fields);
59734
59735 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
59736 old = fc_malloc(sizeof(*old));
59737 *old = *real_packet;
59738 genhash_insert(*hash, old, old);
59739 memset(old, 0, sizeof(*old));
59740 }
59741 differ = (old->id != real_packet->id);
59742 if (differ) {
59743 BV_SET(fields, 0);
59744 }
59745
59746 differ = (old->gui_type != real_packet->gui_type);
59747 if (differ) {
59748 BV_SET(fields, 1);
59749 }
59750
59751 differ = (old->first_reqs_count != real_packet->first_reqs_count);
59752 if (differ) {
59753 BV_SET(fields, 2);
59754 }
59755
59756 differ = (old->first_reqs_count != real_packet->first_reqs_count);
59757 if (!differ) {
59758 int i;
59759
59760 for (i = 0; i < real_packet->first_reqs_count; i++) {
59761 differ = !are_requirements_equal(&old->first_reqs[i], &real_packet->first_reqs[i]);
59762 if (differ) {
59763 break;
59764 }
59765 }
59766 }
59767 if (differ) {
59768 BV_SET(fields, 3);
59769 }
59770
59771 differ = (old->move_cost != real_packet->move_cost);
59772 if (differ) {
59773 BV_SET(fields, 4);
59774 }
59775
59776 differ = (old->move_mode != real_packet->move_mode);
59777 if (differ) {
59778 BV_SET(fields, 5);
59779 }
59780
59781 differ = FALSE;
59782 {
59783 int i;
59784
59785 for (i = 0; i < O_LAST; i++) {
59786 differ = (old->tile_incr_const[i] != real_packet->tile_incr_const[i]);
59787 if (differ) {
59788 break;
59789 }
59790 }
59791 }
59792 if (differ) {
59793 BV_SET(fields, 6);
59794 }
59795
59796 differ = FALSE;
59797 {
59798 int i;
59799
59800 for (i = 0; i < O_LAST; i++) {
59801 differ = (old->tile_incr[i] != real_packet->tile_incr[i]);
59802 if (differ) {
59803 break;
59804 }
59805 }
59806 }
59807 if (differ) {
59808 BV_SET(fields, 7);
59809 }
59810
59811 differ = FALSE;
59812 {
59813 int i;
59814
59815 for (i = 0; i < O_LAST; i++) {
59816 differ = (old->tile_bonus[i] != real_packet->tile_bonus[i]);
59817 if (differ) {
59818 break;
59819 }
59820 }
59821 }
59822 if (differ) {
59823 BV_SET(fields, 8);
59824 }
59825
59826 differ = (old->compat != real_packet->compat);
59827 if (differ) {
59828 BV_SET(fields, 9);
59829 }
59830
59831 differ = !BV_ARE_EQUAL(old->integrates, real_packet->integrates);
59832 if (differ) {
59833 BV_SET(fields, 10);
59834 }
59835
59836 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
59837 if (differ) {
59838 BV_SET(fields, 11);
59839 }
59840
59841
59842#ifdef FREECIV_JSON_CONNECTION
59843 field_addr.name = "fields";
59844#endif /* FREECIV_JSON_CONNECTION */
59845 e = 0;
59846 e |= DIO_BV_PUT(&dout, &field_addr, fields);
59847 if (e) {
59848 log_packet_detailed("fields bitvector error detected");
59849 }
59850
59851 if (BV_ISSET(fields, 0)) {
59852 log_packet_detailed(" field 'id' has changed");
59853#ifdef FREECIV_JSON_CONNECTION
59854 field_addr.name = "id";
59855#endif /* FREECIV_JSON_CONNECTION */
59856 e = 0;
59857 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
59858 if (e) {
59859 log_packet_detailed("'id' field error detected");
59860 }
59861 }
59862 if (BV_ISSET(fields, 1)) {
59863 log_packet_detailed(" field 'gui_type' has changed");
59864#ifdef FREECIV_JSON_CONNECTION
59865 field_addr.name = "gui_type";
59866#endif /* FREECIV_JSON_CONNECTION */
59867 e = 0;
59868 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
59869 if (e) {
59870 log_packet_detailed("'gui_type' field error detected");
59871 }
59872 }
59873 if (BV_ISSET(fields, 2)) {
59874 log_packet_detailed(" field 'first_reqs_count' has changed");
59875#ifdef FREECIV_JSON_CONNECTION
59876 field_addr.name = "first_reqs_count";
59877#endif /* FREECIV_JSON_CONNECTION */
59878 e = 0;
59879 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->first_reqs_count);
59880 if (e) {
59881 log_packet_detailed("'first_reqs_count' field error detected");
59882 }
59883 }
59884 if (BV_ISSET(fields, 3)) {
59885 log_packet_detailed(" field 'first_reqs' has changed");
59886#ifdef FREECIV_JSON_CONNECTION
59887 field_addr.name = "first_reqs";
59888#endif /* FREECIV_JSON_CONNECTION */
59889 e = 0;
59890 {
59891 int i;
59892
59893#ifdef FREECIV_JSON_CONNECTION
59894 /* Create the array. */
59895 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->first_reqs_count);
59896
59897 /* Enter the array. */
59898 field_addr.sub_location = plocation_elem_new(0);
59899#endif /* FREECIV_JSON_CONNECTION */
59900
59901 for (i = 0; i < real_packet->first_reqs_count; i++) {
59902#ifdef FREECIV_JSON_CONNECTION
59903 /* Next array element. */
59904 field_addr.sub_location->number = i;
59905#endif /* FREECIV_JSON_CONNECTION */
59906 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->first_reqs[i]);
59907 }
59908
59909#ifdef FREECIV_JSON_CONNECTION
59910 /* Exit array. */
59911 FC_FREE(field_addr.sub_location);
59912#endif /* FREECIV_JSON_CONNECTION */
59913 }
59914 if (e) {
59915 log_packet_detailed("'first_reqs' field error detected");
59916 }
59917 }
59918 if (BV_ISSET(fields, 4)) {
59919 log_packet_detailed(" field 'move_cost' has changed");
59920#ifdef FREECIV_JSON_CONNECTION
59921 field_addr.name = "move_cost";
59922#endif /* FREECIV_JSON_CONNECTION */
59923 e = 0;
59924 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->move_cost);
59925 if (e) {
59926 log_packet_detailed("'move_cost' field error detected");
59927 }
59928 }
59929 if (BV_ISSET(fields, 5)) {
59930 log_packet_detailed(" field 'move_mode' has changed");
59931#ifdef FREECIV_JSON_CONNECTION
59932 field_addr.name = "move_mode";
59933#endif /* FREECIV_JSON_CONNECTION */
59934 e = 0;
59935 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->move_mode);
59936 if (e) {
59937 log_packet_detailed("'move_mode' field error detected");
59938 }
59939 }
59940 if (BV_ISSET(fields, 6)) {
59941 log_packet_detailed(" field 'tile_incr_const' has changed");
59942#ifdef FREECIV_JSON_CONNECTION
59943 field_addr.name = "tile_incr_const";
59944#endif /* FREECIV_JSON_CONNECTION */
59945 e = 0;
59946 {
59947 int i;
59948
59949#ifdef FREECIV_JSON_CONNECTION
59950 /* Create the array. */
59951 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
59952
59953 /* Enter the array. */
59954 field_addr.sub_location = plocation_elem_new(0);
59955#endif /* FREECIV_JSON_CONNECTION */
59956
59957 for (i = 0; i < O_LAST; i++) {
59958#ifdef FREECIV_JSON_CONNECTION
59959 /* Next array element. */
59960 field_addr.sub_location->number = i;
59961#endif /* FREECIV_JSON_CONNECTION */
59962 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr_const[i]);
59963 }
59964
59965#ifdef FREECIV_JSON_CONNECTION
59966 /* Exit array. */
59967 FC_FREE(field_addr.sub_location);
59968#endif /* FREECIV_JSON_CONNECTION */
59969 }
59970 if (e) {
59971 log_packet_detailed("'tile_incr_const' field error detected");
59972 }
59973 }
59974 if (BV_ISSET(fields, 7)) {
59975 log_packet_detailed(" field 'tile_incr' has changed");
59976#ifdef FREECIV_JSON_CONNECTION
59977 field_addr.name = "tile_incr";
59978#endif /* FREECIV_JSON_CONNECTION */
59979 e = 0;
59980 {
59981 int i;
59982
59983#ifdef FREECIV_JSON_CONNECTION
59984 /* Create the array. */
59985 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
59986
59987 /* Enter the array. */
59988 field_addr.sub_location = plocation_elem_new(0);
59989#endif /* FREECIV_JSON_CONNECTION */
59990
59991 for (i = 0; i < O_LAST; i++) {
59992#ifdef FREECIV_JSON_CONNECTION
59993 /* Next array element. */
59994 field_addr.sub_location->number = i;
59995#endif /* FREECIV_JSON_CONNECTION */
59996 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr[i]);
59997 }
59998
59999#ifdef FREECIV_JSON_CONNECTION
60000 /* Exit array. */
60001 FC_FREE(field_addr.sub_location);
60002#endif /* FREECIV_JSON_CONNECTION */
60003 }
60004 if (e) {
60005 log_packet_detailed("'tile_incr' field error detected");
60006 }
60007 }
60008 if (BV_ISSET(fields, 8)) {
60009 log_packet_detailed(" field 'tile_bonus' has changed");
60010#ifdef FREECIV_JSON_CONNECTION
60011 field_addr.name = "tile_bonus";
60012#endif /* FREECIV_JSON_CONNECTION */
60013 e = 0;
60014 {
60015 int i;
60016
60017#ifdef FREECIV_JSON_CONNECTION
60018 /* Create the array. */
60019 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
60020
60021 /* Enter the array. */
60022 field_addr.sub_location = plocation_elem_new(0);
60023#endif /* FREECIV_JSON_CONNECTION */
60024
60025 for (i = 0; i < O_LAST; i++) {
60026#ifdef FREECIV_JSON_CONNECTION
60027 /* Next array element. */
60028 field_addr.sub_location->number = i;
60029#endif /* FREECIV_JSON_CONNECTION */
60030 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_bonus[i]);
60031 }
60032
60033#ifdef FREECIV_JSON_CONNECTION
60034 /* Exit array. */
60035 FC_FREE(field_addr.sub_location);
60036#endif /* FREECIV_JSON_CONNECTION */
60037 }
60038 if (e) {
60039 log_packet_detailed("'tile_bonus' field error detected");
60040 }
60041 }
60042 if (BV_ISSET(fields, 9)) {
60043 log_packet_detailed(" field 'compat' has changed");
60044#ifdef FREECIV_JSON_CONNECTION
60045 field_addr.name = "compat";
60046#endif /* FREECIV_JSON_CONNECTION */
60047 e = 0;
60048 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->compat);
60049 if (e) {
60050 log_packet_detailed("'compat' field error detected");
60051 }
60052 }
60053 if (BV_ISSET(fields, 10)) {
60054 log_packet_detailed(" field 'integrates' has changed");
60055#ifdef FREECIV_JSON_CONNECTION
60056 field_addr.name = "integrates";
60057#endif /* FREECIV_JSON_CONNECTION */
60058 e = 0;
60059 e |= DIO_BV_PUT(&dout, &field_addr, packet->integrates);
60060 if (e) {
60061 log_packet_detailed("'integrates' field error detected");
60062 }
60063 }
60064 if (BV_ISSET(fields, 11)) {
60065 log_packet_detailed(" field 'flags' has changed");
60066#ifdef FREECIV_JSON_CONNECTION
60067 field_addr.name = "flags";
60068#endif /* FREECIV_JSON_CONNECTION */
60069 e = 0;
60070 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
60071 if (e) {
60072 log_packet_detailed("'flags' field error detected");
60073 }
60074 }
60075
60076 *old = *real_packet;
60077#endif /* FREECIV_DELTA_PROTOCOL */
60078#ifndef FREECIV_DELTA_PROTOCOL
60079#ifdef FREECIV_JSON_CONNECTION
60080 field_addr.name = "id";
60081#endif /* FREECIV_JSON_CONNECTION */
60082 e = 0;
60083 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
60084 if (e) {
60085 log_packet_detailed("'id' field error detected");
60086 }
60087#ifdef FREECIV_JSON_CONNECTION
60088 field_addr.name = "gui_type";
60089#endif /* FREECIV_JSON_CONNECTION */
60090 e = 0;
60091 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->gui_type);
60092 if (e) {
60093 log_packet_detailed("'gui_type' field error detected");
60094 }
60095#ifdef FREECIV_JSON_CONNECTION
60096 field_addr.name = "first_reqs_count";
60097#endif /* FREECIV_JSON_CONNECTION */
60098 e = 0;
60099 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->first_reqs_count);
60100 if (e) {
60101 log_packet_detailed("'first_reqs_count' field error detected");
60102 }
60103#ifdef FREECIV_JSON_CONNECTION
60104 field_addr.name = "first_reqs";
60105#endif /* FREECIV_JSON_CONNECTION */
60106 e = 0;
60107 {
60108 int i;
60109
60110#ifdef FREECIV_JSON_CONNECTION
60111 /* Create the array. */
60112 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->first_reqs_count);
60113
60114 /* Enter the array. */
60115 field_addr.sub_location = plocation_elem_new(0);
60116#endif /* FREECIV_JSON_CONNECTION */
60117
60118 for (i = 0; i < real_packet->first_reqs_count; i++) {
60119#ifdef FREECIV_JSON_CONNECTION
60120 /* Next array element. */
60121 field_addr.sub_location->number = i;
60122#endif /* FREECIV_JSON_CONNECTION */
60123 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->first_reqs[i]);
60124 }
60125
60126#ifdef FREECIV_JSON_CONNECTION
60127 /* Exit array. */
60128 FC_FREE(field_addr.sub_location);
60129#endif /* FREECIV_JSON_CONNECTION */
60130 }
60131 if (e) {
60132 log_packet_detailed("'first_reqs' field error detected");
60133 }
60134#ifdef FREECIV_JSON_CONNECTION
60135 field_addr.name = "move_cost";
60136#endif /* FREECIV_JSON_CONNECTION */
60137 e = 0;
60138 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->move_cost);
60139 if (e) {
60140 log_packet_detailed("'move_cost' field error detected");
60141 }
60142#ifdef FREECIV_JSON_CONNECTION
60143 field_addr.name = "move_mode";
60144#endif /* FREECIV_JSON_CONNECTION */
60145 e = 0;
60146 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->move_mode);
60147 if (e) {
60148 log_packet_detailed("'move_mode' field error detected");
60149 }
60150#ifdef FREECIV_JSON_CONNECTION
60151 field_addr.name = "tile_incr_const";
60152#endif /* FREECIV_JSON_CONNECTION */
60153 e = 0;
60154 {
60155 int i;
60156
60157#ifdef FREECIV_JSON_CONNECTION
60158 /* Create the array. */
60159 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
60160
60161 /* Enter the array. */
60162 field_addr.sub_location = plocation_elem_new(0);
60163#endif /* FREECIV_JSON_CONNECTION */
60164
60165 for (i = 0; i < O_LAST; i++) {
60166#ifdef FREECIV_JSON_CONNECTION
60167 /* Next array element. */
60168 field_addr.sub_location->number = i;
60169#endif /* FREECIV_JSON_CONNECTION */
60170 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr_const[i]);
60171 }
60172
60173#ifdef FREECIV_JSON_CONNECTION
60174 /* Exit array. */
60175 FC_FREE(field_addr.sub_location);
60176#endif /* FREECIV_JSON_CONNECTION */
60177 }
60178 if (e) {
60179 log_packet_detailed("'tile_incr_const' field error detected");
60180 }
60181#ifdef FREECIV_JSON_CONNECTION
60182 field_addr.name = "tile_incr";
60183#endif /* FREECIV_JSON_CONNECTION */
60184 e = 0;
60185 {
60186 int i;
60187
60188#ifdef FREECIV_JSON_CONNECTION
60189 /* Create the array. */
60190 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
60191
60192 /* Enter the array. */
60193 field_addr.sub_location = plocation_elem_new(0);
60194#endif /* FREECIV_JSON_CONNECTION */
60195
60196 for (i = 0; i < O_LAST; i++) {
60197#ifdef FREECIV_JSON_CONNECTION
60198 /* Next array element. */
60199 field_addr.sub_location->number = i;
60200#endif /* FREECIV_JSON_CONNECTION */
60201 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_incr[i]);
60202 }
60203
60204#ifdef FREECIV_JSON_CONNECTION
60205 /* Exit array. */
60206 FC_FREE(field_addr.sub_location);
60207#endif /* FREECIV_JSON_CONNECTION */
60208 }
60209 if (e) {
60210 log_packet_detailed("'tile_incr' field error detected");
60211 }
60212#ifdef FREECIV_JSON_CONNECTION
60213 field_addr.name = "tile_bonus";
60214#endif /* FREECIV_JSON_CONNECTION */
60215 e = 0;
60216 {
60217 int i;
60218
60219#ifdef FREECIV_JSON_CONNECTION
60220 /* Create the array. */
60221 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
60222
60223 /* Enter the array. */
60224 field_addr.sub_location = plocation_elem_new(0);
60225#endif /* FREECIV_JSON_CONNECTION */
60226
60227 for (i = 0; i < O_LAST; i++) {
60228#ifdef FREECIV_JSON_CONNECTION
60229 /* Next array element. */
60230 field_addr.sub_location->number = i;
60231#endif /* FREECIV_JSON_CONNECTION */
60232 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->tile_bonus[i]);
60233 }
60234
60235#ifdef FREECIV_JSON_CONNECTION
60236 /* Exit array. */
60237 FC_FREE(field_addr.sub_location);
60238#endif /* FREECIV_JSON_CONNECTION */
60239 }
60240 if (e) {
60241 log_packet_detailed("'tile_bonus' field error detected");
60242 }
60243#ifdef FREECIV_JSON_CONNECTION
60244 field_addr.name = "compat";
60245#endif /* FREECIV_JSON_CONNECTION */
60246 e = 0;
60247 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->compat);
60248 if (e) {
60249 log_packet_detailed("'compat' field error detected");
60250 }
60251#ifdef FREECIV_JSON_CONNECTION
60252 field_addr.name = "integrates";
60253#endif /* FREECIV_JSON_CONNECTION */
60254 e = 0;
60255 e |= DIO_BV_PUT(&dout, &field_addr, packet->integrates);
60256 if (e) {
60257 log_packet_detailed("'integrates' field error detected");
60258 }
60259#ifdef FREECIV_JSON_CONNECTION
60260 field_addr.name = "flags";
60261#endif /* FREECIV_JSON_CONNECTION */
60262 e = 0;
60263 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
60264 if (e) {
60265 log_packet_detailed("'flags' field error detected");
60266 }
60267
60268#endif
60269 SEND_PACKET_END(PACKET_RULESET_ROAD);
60270}
60271
60272 int send_packet_ruleset_road(struct connection *pc, const struct packet_ruleset_road *packet)
60273{
60274 if (!pc->used) {
60275 log_error("WARNING: trying to send data to the closed connection %s",
60276 conn_description(pc));
60277 return -1;
60278 }
60279 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ROAD].packet != NULL, -1,
60280 "Handler for PACKET_RULESET_ROAD not installed");
60281 return pc->phs.handlers->send[PACKET_RULESET_ROAD].packet(pc, packet);
60282}
60283
60284 void lsend_packet_ruleset_road(struct conn_list *dest, const struct packet_ruleset_road *packet)
60285{
60286 conn_list_iterate(dest, pconn) {
60287 send_packet_ruleset_road(pconn, packet);
60288 } conn_list_iterate_end;
60289}
60290
60291#ifdef FREECIV_DELTA_PROTOCOL
60292#define hash_packet_ruleset_goods_100 hash_const
60293
60294#define cmp_packet_ruleset_goods_100 cmp_const
60295
60296 BV_DEFINE(packet_ruleset_goods_100_fields, 10);
60297#endif /* FREECIV_DELTA_PROTOCOL */
60298
60299 static struct packet_ruleset_goods *receive_packet_ruleset_goods_100(struct connection *pc)
60300{
60301#ifdef FREECIV_DELTA_PROTOCOL
60302 packet_ruleset_goods_100_fields fields;
60303 struct packet_ruleset_goods *old;
60304 struct genhash **hash = pc->phs.received + PACKET_RULESET_GOODS;
60305#endif /* FREECIV_DELTA_PROTOCOL */
60306 RECEIVE_PACKET_START(packet_ruleset_goods, real_packet);
60307#ifdef FREECIV_JSON_CONNECTION
60308 struct plocation field_addr;
60309 {
60310 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60311 field_addr = *field_addr_tmp;
60312 FC_FREE(field_addr_tmp);
60313 }
60314#endif /* FREECIV_JSON_CONNECTION */
60315
60316#ifdef FREECIV_DELTA_PROTOCOL
60317#ifdef FREECIV_JSON_CONNECTION
60318 field_addr.name = "fields";
60319#endif /* FREECIV_JSON_CONNECTION */
60320 DIO_BV_GET(&din, &field_addr, fields);
60321
60322#else /* FREECIV_DELTA_PROTOCOL */
60323#ifdef FREECIV_JSON_CONNECTION
60324 field_addr.name = "id";
60325#endif /* FREECIV_JSON_CONNECTION */
60326 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
60327 RECEIVE_PACKET_FIELD_ERROR(id);
60328 }
60329#ifdef FREECIV_JSON_CONNECTION
60330 field_addr.name = "name";
60331#endif /* FREECIV_JSON_CONNECTION */
60332 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60333 RECEIVE_PACKET_FIELD_ERROR(name);
60334 }
60335#ifdef FREECIV_JSON_CONNECTION
60336 field_addr.name = "rule_name";
60337#endif /* FREECIV_JSON_CONNECTION */
60338 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
60339 RECEIVE_PACKET_FIELD_ERROR(rule_name);
60340 }
60341#ifdef FREECIV_JSON_CONNECTION
60342 field_addr.name = "reqs_count";
60343#endif /* FREECIV_JSON_CONNECTION */
60344 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
60345 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
60346 }
60347#ifdef FREECIV_JSON_CONNECTION
60348 field_addr.name = "reqs";
60349#endif /* FREECIV_JSON_CONNECTION */
60350 {
60351 int i;
60352
60353#ifdef FREECIV_JSON_CONNECTION
60354 /* Enter array. */
60355 field_addr.sub_location = plocation_elem_new(0);
60356#endif /* FREECIV_JSON_CONNECTION */
60357
60358 if (real_packet->reqs_count > MAX_NUM_REQS) {
60359 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
60360 }
60361 for (i = 0; i < real_packet->reqs_count; i++) {
60362#ifdef FREECIV_JSON_CONNECTION
60363 field_addr.sub_location->number = i;
60364#endif /* FREECIV_JSON_CONNECTION */
60365 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
60366 RECEIVE_PACKET_FIELD_ERROR(reqs);
60367 }
60368 }
60369
60370#ifdef FREECIV_JSON_CONNECTION
60371 /* Exit array. */
60372 FC_FREE(field_addr.sub_location);
60373#endif /* FREECIV_JSON_CONNECTION */
60374 }
60375#ifdef FREECIV_JSON_CONNECTION
60376 field_addr.name = "from_pct";
60377#endif /* FREECIV_JSON_CONNECTION */
60378 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->from_pct)) {
60379 RECEIVE_PACKET_FIELD_ERROR(from_pct);
60380 }
60381#ifdef FREECIV_JSON_CONNECTION
60382 field_addr.name = "to_pct";
60383#endif /* FREECIV_JSON_CONNECTION */
60384 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->to_pct)) {
60385 RECEIVE_PACKET_FIELD_ERROR(to_pct);
60386 }
60387#ifdef FREECIV_JSON_CONNECTION
60388 field_addr.name = "onetime_pct";
60389#endif /* FREECIV_JSON_CONNECTION */
60390 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->onetime_pct)) {
60391 RECEIVE_PACKET_FIELD_ERROR(onetime_pct);
60392 }
60393#ifdef FREECIV_JSON_CONNECTION
60394 field_addr.name = "flags";
60395#endif /* FREECIV_JSON_CONNECTION */
60396 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
60397 RECEIVE_PACKET_FIELD_ERROR(flags);
60398 }
60399#ifdef FREECIV_JSON_CONNECTION
60400 field_addr.name = "helptext";
60401#endif /* FREECIV_JSON_CONNECTION */
60402 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
60403 RECEIVE_PACKET_FIELD_ERROR(helptext);
60404 }
60405#endif
60406 log_packet_detailed("packet_ruleset_goods_100: got info about ()");
60407
60408#ifdef FREECIV_DELTA_PROTOCOL
60409 if (NULL == *hash) {
60410 *hash = genhash_new_full(hash_packet_ruleset_goods_100, cmp_packet_ruleset_goods_100,
60411 NULL, NULL, NULL, free);
60412 }
60413
60414 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
60415 *real_packet = *old;
60416 } else {
60417 log_packet_detailed(" no old info");
60418 memset(real_packet, 0, sizeof(*real_packet));
60419 }
60420
60421 if (BV_ISSET(fields, 0)) {
60422 log_packet_detailed(" got field 'id'");
60423#ifdef FREECIV_JSON_CONNECTION
60424 field_addr.name = "id";
60425#endif /* FREECIV_JSON_CONNECTION */
60426 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
60427 RECEIVE_PACKET_FIELD_ERROR(id);
60428 }
60429 }
60430 if (BV_ISSET(fields, 1)) {
60431 log_packet_detailed(" got field 'name'");
60432#ifdef FREECIV_JSON_CONNECTION
60433 field_addr.name = "name";
60434#endif /* FREECIV_JSON_CONNECTION */
60435 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60436 RECEIVE_PACKET_FIELD_ERROR(name);
60437 }
60438 }
60439 if (BV_ISSET(fields, 2)) {
60440 log_packet_detailed(" got field 'rule_name'");
60441#ifdef FREECIV_JSON_CONNECTION
60442 field_addr.name = "rule_name";
60443#endif /* FREECIV_JSON_CONNECTION */
60444 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
60445 RECEIVE_PACKET_FIELD_ERROR(rule_name);
60446 }
60447 }
60448 if (BV_ISSET(fields, 3)) {
60449 log_packet_detailed(" got field 'reqs_count'");
60450#ifdef FREECIV_JSON_CONNECTION
60451 field_addr.name = "reqs_count";
60452#endif /* FREECIV_JSON_CONNECTION */
60453 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
60454 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
60455 }
60456 }
60457 if (BV_ISSET(fields, 4)) {
60458 log_packet_detailed(" got field 'reqs'");
60459#ifdef FREECIV_JSON_CONNECTION
60460 field_addr.name = "reqs";
60461#endif /* FREECIV_JSON_CONNECTION */
60462 {
60463 int i;
60464
60465#ifdef FREECIV_JSON_CONNECTION
60466 /* Enter array. */
60467 field_addr.sub_location = plocation_elem_new(0);
60468#endif /* FREECIV_JSON_CONNECTION */
60469
60470 if (real_packet->reqs_count > MAX_NUM_REQS) {
60471 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
60472 }
60473 for (i = 0; i < real_packet->reqs_count; i++) {
60474#ifdef FREECIV_JSON_CONNECTION
60475 field_addr.sub_location->number = i;
60476#endif /* FREECIV_JSON_CONNECTION */
60477 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
60478 RECEIVE_PACKET_FIELD_ERROR(reqs);
60479 }
60480 }
60481
60482#ifdef FREECIV_JSON_CONNECTION
60483 /* Exit array. */
60484 FC_FREE(field_addr.sub_location);
60485#endif /* FREECIV_JSON_CONNECTION */
60486 }
60487 }
60488 if (BV_ISSET(fields, 5)) {
60489 log_packet_detailed(" got field 'from_pct'");
60490#ifdef FREECIV_JSON_CONNECTION
60491 field_addr.name = "from_pct";
60492#endif /* FREECIV_JSON_CONNECTION */
60493 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->from_pct)) {
60494 RECEIVE_PACKET_FIELD_ERROR(from_pct);
60495 }
60496 }
60497 if (BV_ISSET(fields, 6)) {
60498 log_packet_detailed(" got field 'to_pct'");
60499#ifdef FREECIV_JSON_CONNECTION
60500 field_addr.name = "to_pct";
60501#endif /* FREECIV_JSON_CONNECTION */
60502 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->to_pct)) {
60503 RECEIVE_PACKET_FIELD_ERROR(to_pct);
60504 }
60505 }
60506 if (BV_ISSET(fields, 7)) {
60507 log_packet_detailed(" got field 'onetime_pct'");
60508#ifdef FREECIV_JSON_CONNECTION
60509 field_addr.name = "onetime_pct";
60510#endif /* FREECIV_JSON_CONNECTION */
60511 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->onetime_pct)) {
60512 RECEIVE_PACKET_FIELD_ERROR(onetime_pct);
60513 }
60514 }
60515 if (BV_ISSET(fields, 8)) {
60516 log_packet_detailed(" got field 'flags'");
60517#ifdef FREECIV_JSON_CONNECTION
60518 field_addr.name = "flags";
60519#endif /* FREECIV_JSON_CONNECTION */
60520 if (!DIO_BV_GET(&din, &field_addr, real_packet->flags)) {
60521 RECEIVE_PACKET_FIELD_ERROR(flags);
60522 }
60523 }
60524 if (BV_ISSET(fields, 9)) {
60525 log_packet_detailed(" got field 'helptext'");
60526#ifdef FREECIV_JSON_CONNECTION
60527 field_addr.name = "helptext";
60528#endif /* FREECIV_JSON_CONNECTION */
60529 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
60530 RECEIVE_PACKET_FIELD_ERROR(helptext);
60531 }
60532 }
60533
60534 if (NULL == old) {
60535 old = fc_malloc(sizeof(*old));
60536 *old = *real_packet;
60537 genhash_insert(*hash, old, old);
60538 } else {
60539 *old = *real_packet;
60540 }
60541
60542#endif /* FREECIV_DELTA_PROTOCOL */
60543 RECEIVE_PACKET_END(real_packet);
60544}
60545
60546 static int send_packet_ruleset_goods_100(struct connection *pc, const struct packet_ruleset_goods *packet)
60547{
60548 const struct packet_ruleset_goods *real_packet = packet;
60549 int e;
60550#ifdef FREECIV_DELTA_PROTOCOL
60551 packet_ruleset_goods_100_fields fields;
60552 struct packet_ruleset_goods *old;
60553 bool differ;
60554 struct genhash **hash = pc->phs.sent + PACKET_RULESET_GOODS;
60555#endif /* FREECIV_DELTA_PROTOCOL */
60556 SEND_PACKET_START(PACKET_RULESET_GOODS);
60557#ifdef FREECIV_JSON_CONNECTION
60558 struct plocation field_addr;
60559 {
60560 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60561 field_addr = *field_addr_tmp;
60562 FC_FREE(field_addr_tmp);
60563 }
60564#endif /* FREECIV_JSON_CONNECTION */
60565
60566 log_packet_detailed("packet_ruleset_goods_100: sending info about ()");
60567
60568#ifdef FREECIV_DELTA_PROTOCOL
60569 if (NULL == *hash) {
60570 *hash = genhash_new_full(hash_packet_ruleset_goods_100, cmp_packet_ruleset_goods_100,
60571 NULL, NULL, NULL, free);
60572 }
60573 BV_CLR_ALL(fields);
60574
60575 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
60576 old = fc_malloc(sizeof(*old));
60577 *old = *real_packet;
60578 genhash_insert(*hash, old, old);
60579 memset(old, 0, sizeof(*old));
60580 }
60581 differ = (old->id != real_packet->id);
60582 if (differ) {
60583 BV_SET(fields, 0);
60584 }
60585
60586 differ = (strcmp(old->name, real_packet->name) != 0);
60587 if (differ) {
60588 BV_SET(fields, 1);
60589 }
60590
60591 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
60592 if (differ) {
60593 BV_SET(fields, 2);
60594 }
60595
60596 differ = (old->reqs_count != real_packet->reqs_count);
60597 if (differ) {
60598 BV_SET(fields, 3);
60599 }
60600
60601 differ = (old->reqs_count != real_packet->reqs_count);
60602 if (!differ) {
60603 int i;
60604
60605 for (i = 0; i < real_packet->reqs_count; i++) {
60606 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
60607 if (differ) {
60608 break;
60609 }
60610 }
60611 }
60612 if (differ) {
60613 BV_SET(fields, 4);
60614 }
60615
60616 differ = (old->from_pct != real_packet->from_pct);
60617 if (differ) {
60618 BV_SET(fields, 5);
60619 }
60620
60621 differ = (old->to_pct != real_packet->to_pct);
60622 if (differ) {
60623 BV_SET(fields, 6);
60624 }
60625
60626 differ = (old->onetime_pct != real_packet->onetime_pct);
60627 if (differ) {
60628 BV_SET(fields, 7);
60629 }
60630
60631 differ = !BV_ARE_EQUAL(old->flags, real_packet->flags);
60632 if (differ) {
60633 BV_SET(fields, 8);
60634 }
60635
60636 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
60637 if (differ) {
60638 BV_SET(fields, 9);
60639 }
60640
60641
60642#ifdef FREECIV_JSON_CONNECTION
60643 field_addr.name = "fields";
60644#endif /* FREECIV_JSON_CONNECTION */
60645 e = 0;
60646 e |= DIO_BV_PUT(&dout, &field_addr, fields);
60647 if (e) {
60648 log_packet_detailed("fields bitvector error detected");
60649 }
60650
60651 if (BV_ISSET(fields, 0)) {
60652 log_packet_detailed(" field 'id' has changed");
60653#ifdef FREECIV_JSON_CONNECTION
60654 field_addr.name = "id";
60655#endif /* FREECIV_JSON_CONNECTION */
60656 e = 0;
60657 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
60658 if (e) {
60659 log_packet_detailed("'id' field error detected");
60660 }
60661 }
60662 if (BV_ISSET(fields, 1)) {
60663 log_packet_detailed(" field 'name' has changed");
60664#ifdef FREECIV_JSON_CONNECTION
60665 field_addr.name = "name";
60666#endif /* FREECIV_JSON_CONNECTION */
60667 e = 0;
60668 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
60669 if (e) {
60670 log_packet_detailed("'name' field error detected");
60671 }
60672 }
60673 if (BV_ISSET(fields, 2)) {
60674 log_packet_detailed(" field 'rule_name' has changed");
60675#ifdef FREECIV_JSON_CONNECTION
60676 field_addr.name = "rule_name";
60677#endif /* FREECIV_JSON_CONNECTION */
60678 e = 0;
60679 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60680 if (e) {
60681 log_packet_detailed("'rule_name' field error detected");
60682 }
60683 }
60684 if (BV_ISSET(fields, 3)) {
60685 log_packet_detailed(" field 'reqs_count' has changed");
60686#ifdef FREECIV_JSON_CONNECTION
60687 field_addr.name = "reqs_count";
60688#endif /* FREECIV_JSON_CONNECTION */
60689 e = 0;
60690 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
60691 if (e) {
60692 log_packet_detailed("'reqs_count' field error detected");
60693 }
60694 }
60695 if (BV_ISSET(fields, 4)) {
60696 log_packet_detailed(" field 'reqs' has changed");
60697#ifdef FREECIV_JSON_CONNECTION
60698 field_addr.name = "reqs";
60699#endif /* FREECIV_JSON_CONNECTION */
60700 e = 0;
60701 {
60702 int i;
60703
60704#ifdef FREECIV_JSON_CONNECTION
60705 /* Create the array. */
60706 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
60707
60708 /* Enter the array. */
60709 field_addr.sub_location = plocation_elem_new(0);
60710#endif /* FREECIV_JSON_CONNECTION */
60711
60712 for (i = 0; i < real_packet->reqs_count; i++) {
60713#ifdef FREECIV_JSON_CONNECTION
60714 /* Next array element. */
60715 field_addr.sub_location->number = i;
60716#endif /* FREECIV_JSON_CONNECTION */
60717 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
60718 }
60719
60720#ifdef FREECIV_JSON_CONNECTION
60721 /* Exit array. */
60722 FC_FREE(field_addr.sub_location);
60723#endif /* FREECIV_JSON_CONNECTION */
60724 }
60725 if (e) {
60726 log_packet_detailed("'reqs' field error detected");
60727 }
60728 }
60729 if (BV_ISSET(fields, 5)) {
60730 log_packet_detailed(" field 'from_pct' has changed");
60731#ifdef FREECIV_JSON_CONNECTION
60732 field_addr.name = "from_pct";
60733#endif /* FREECIV_JSON_CONNECTION */
60734 e = 0;
60735 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->from_pct);
60736 if (e) {
60737 log_packet_detailed("'from_pct' field error detected");
60738 }
60739 }
60740 if (BV_ISSET(fields, 6)) {
60741 log_packet_detailed(" field 'to_pct' has changed");
60742#ifdef FREECIV_JSON_CONNECTION
60743 field_addr.name = "to_pct";
60744#endif /* FREECIV_JSON_CONNECTION */
60745 e = 0;
60746 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->to_pct);
60747 if (e) {
60748 log_packet_detailed("'to_pct' field error detected");
60749 }
60750 }
60751 if (BV_ISSET(fields, 7)) {
60752 log_packet_detailed(" field 'onetime_pct' has changed");
60753#ifdef FREECIV_JSON_CONNECTION
60754 field_addr.name = "onetime_pct";
60755#endif /* FREECIV_JSON_CONNECTION */
60756 e = 0;
60757 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->onetime_pct);
60758 if (e) {
60759 log_packet_detailed("'onetime_pct' field error detected");
60760 }
60761 }
60762 if (BV_ISSET(fields, 8)) {
60763 log_packet_detailed(" field 'flags' has changed");
60764#ifdef FREECIV_JSON_CONNECTION
60765 field_addr.name = "flags";
60766#endif /* FREECIV_JSON_CONNECTION */
60767 e = 0;
60768 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
60769 if (e) {
60770 log_packet_detailed("'flags' field error detected");
60771 }
60772 }
60773 if (BV_ISSET(fields, 9)) {
60774 log_packet_detailed(" field 'helptext' has changed");
60775#ifdef FREECIV_JSON_CONNECTION
60776 field_addr.name = "helptext";
60777#endif /* FREECIV_JSON_CONNECTION */
60778 e = 0;
60779 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
60780 if (e) {
60781 log_packet_detailed("'helptext' field error detected");
60782 }
60783 }
60784
60785 *old = *real_packet;
60786#endif /* FREECIV_DELTA_PROTOCOL */
60787#ifndef FREECIV_DELTA_PROTOCOL
60788#ifdef FREECIV_JSON_CONNECTION
60789 field_addr.name = "id";
60790#endif /* FREECIV_JSON_CONNECTION */
60791 e = 0;
60792 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
60793 if (e) {
60794 log_packet_detailed("'id' field error detected");
60795 }
60796#ifdef FREECIV_JSON_CONNECTION
60797 field_addr.name = "name";
60798#endif /* FREECIV_JSON_CONNECTION */
60799 e = 0;
60800 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
60801 if (e) {
60802 log_packet_detailed("'name' field error detected");
60803 }
60804#ifdef FREECIV_JSON_CONNECTION
60805 field_addr.name = "rule_name";
60806#endif /* FREECIV_JSON_CONNECTION */
60807 e = 0;
60808 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
60809 if (e) {
60810 log_packet_detailed("'rule_name' field error detected");
60811 }
60812#ifdef FREECIV_JSON_CONNECTION
60813 field_addr.name = "reqs_count";
60814#endif /* FREECIV_JSON_CONNECTION */
60815 e = 0;
60816 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
60817 if (e) {
60818 log_packet_detailed("'reqs_count' field error detected");
60819 }
60820#ifdef FREECIV_JSON_CONNECTION
60821 field_addr.name = "reqs";
60822#endif /* FREECIV_JSON_CONNECTION */
60823 e = 0;
60824 {
60825 int i;
60826
60827#ifdef FREECIV_JSON_CONNECTION
60828 /* Create the array. */
60829 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
60830
60831 /* Enter the array. */
60832 field_addr.sub_location = plocation_elem_new(0);
60833#endif /* FREECIV_JSON_CONNECTION */
60834
60835 for (i = 0; i < real_packet->reqs_count; i++) {
60836#ifdef FREECIV_JSON_CONNECTION
60837 /* Next array element. */
60838 field_addr.sub_location->number = i;
60839#endif /* FREECIV_JSON_CONNECTION */
60840 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
60841 }
60842
60843#ifdef FREECIV_JSON_CONNECTION
60844 /* Exit array. */
60845 FC_FREE(field_addr.sub_location);
60846#endif /* FREECIV_JSON_CONNECTION */
60847 }
60848 if (e) {
60849 log_packet_detailed("'reqs' field error detected");
60850 }
60851#ifdef FREECIV_JSON_CONNECTION
60852 field_addr.name = "from_pct";
60853#endif /* FREECIV_JSON_CONNECTION */
60854 e = 0;
60855 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->from_pct);
60856 if (e) {
60857 log_packet_detailed("'from_pct' field error detected");
60858 }
60859#ifdef FREECIV_JSON_CONNECTION
60860 field_addr.name = "to_pct";
60861#endif /* FREECIV_JSON_CONNECTION */
60862 e = 0;
60863 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->to_pct);
60864 if (e) {
60865 log_packet_detailed("'to_pct' field error detected");
60866 }
60867#ifdef FREECIV_JSON_CONNECTION
60868 field_addr.name = "onetime_pct";
60869#endif /* FREECIV_JSON_CONNECTION */
60870 e = 0;
60871 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->onetime_pct);
60872 if (e) {
60873 log_packet_detailed("'onetime_pct' field error detected");
60874 }
60875#ifdef FREECIV_JSON_CONNECTION
60876 field_addr.name = "flags";
60877#endif /* FREECIV_JSON_CONNECTION */
60878 e = 0;
60879 e |= DIO_BV_PUT(&dout, &field_addr, packet->flags);
60880 if (e) {
60881 log_packet_detailed("'flags' field error detected");
60882 }
60883#ifdef FREECIV_JSON_CONNECTION
60884 field_addr.name = "helptext";
60885#endif /* FREECIV_JSON_CONNECTION */
60886 e = 0;
60887 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
60888 if (e) {
60889 log_packet_detailed("'helptext' field error detected");
60890 }
60891
60892#endif
60893 SEND_PACKET_END(PACKET_RULESET_GOODS);
60894}
60895
60896 int send_packet_ruleset_goods(struct connection *pc, const struct packet_ruleset_goods *packet)
60897{
60898 if (!pc->used) {
60899 log_error("WARNING: trying to send data to the closed connection %s",
60900 conn_description(pc));
60901 return -1;
60902 }
60903 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_GOODS].packet != NULL, -1,
60904 "Handler for PACKET_RULESET_GOODS not installed");
60905 return pc->phs.handlers->send[PACKET_RULESET_GOODS].packet(pc, packet);
60906}
60907
60908 void lsend_packet_ruleset_goods(struct conn_list *dest, const struct packet_ruleset_goods *packet)
60909{
60910 conn_list_iterate(dest, pconn) {
60911 send_packet_ruleset_goods(pconn, packet);
60912 } conn_list_iterate_end;
60913}
60914
60915#ifdef FREECIV_DELTA_PROTOCOL
60916#define hash_packet_ruleset_disaster_100 hash_const
60917
60918#define cmp_packet_ruleset_disaster_100 cmp_const
60919
60920 BV_DEFINE(packet_ruleset_disaster_100_fields, 7);
60921#endif /* FREECIV_DELTA_PROTOCOL */
60922
60923 static struct packet_ruleset_disaster *receive_packet_ruleset_disaster_100(struct connection *pc)
60924{
60925#ifdef FREECIV_DELTA_PROTOCOL
60926 packet_ruleset_disaster_100_fields fields;
60927 struct packet_ruleset_disaster *old;
60928 struct genhash **hash = pc->phs.received + PACKET_RULESET_DISASTER;
60929#endif /* FREECIV_DELTA_PROTOCOL */
60930 RECEIVE_PACKET_START(packet_ruleset_disaster, real_packet);
60931#ifdef FREECIV_JSON_CONNECTION
60932 struct plocation field_addr;
60933 {
60934 struct plocation *field_addr_tmp = plocation_field_new(NULL);
60935 field_addr = *field_addr_tmp;
60936 FC_FREE(field_addr_tmp);
60937 }
60938#endif /* FREECIV_JSON_CONNECTION */
60939
60940#ifdef FREECIV_DELTA_PROTOCOL
60941#ifdef FREECIV_JSON_CONNECTION
60942 field_addr.name = "fields";
60943#endif /* FREECIV_JSON_CONNECTION */
60944 DIO_BV_GET(&din, &field_addr, fields);
60945
60946#else /* FREECIV_DELTA_PROTOCOL */
60947#ifdef FREECIV_JSON_CONNECTION
60948 field_addr.name = "id";
60949#endif /* FREECIV_JSON_CONNECTION */
60950 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
60951 RECEIVE_PACKET_FIELD_ERROR(id);
60952 }
60953#ifdef FREECIV_JSON_CONNECTION
60954 field_addr.name = "name";
60955#endif /* FREECIV_JSON_CONNECTION */
60956 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
60957 RECEIVE_PACKET_FIELD_ERROR(name);
60958 }
60959#ifdef FREECIV_JSON_CONNECTION
60960 field_addr.name = "rule_name";
60961#endif /* FREECIV_JSON_CONNECTION */
60962 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
60963 RECEIVE_PACKET_FIELD_ERROR(rule_name);
60964 }
60965#ifdef FREECIV_JSON_CONNECTION
60966 field_addr.name = "reqs_count";
60967#endif /* FREECIV_JSON_CONNECTION */
60968 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
60969 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
60970 }
60971#ifdef FREECIV_JSON_CONNECTION
60972 field_addr.name = "reqs";
60973#endif /* FREECIV_JSON_CONNECTION */
60974 {
60975 int i;
60976
60977#ifdef FREECIV_JSON_CONNECTION
60978 /* Enter array. */
60979 field_addr.sub_location = plocation_elem_new(0);
60980#endif /* FREECIV_JSON_CONNECTION */
60981
60982 if (real_packet->reqs_count > MAX_NUM_REQS) {
60983 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
60984 }
60985 for (i = 0; i < real_packet->reqs_count; i++) {
60986#ifdef FREECIV_JSON_CONNECTION
60987 field_addr.sub_location->number = i;
60988#endif /* FREECIV_JSON_CONNECTION */
60989 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
60990 RECEIVE_PACKET_FIELD_ERROR(reqs);
60991 }
60992 }
60993
60994#ifdef FREECIV_JSON_CONNECTION
60995 /* Exit array. */
60996 FC_FREE(field_addr.sub_location);
60997#endif /* FREECIV_JSON_CONNECTION */
60998 }
60999#ifdef FREECIV_JSON_CONNECTION
61000 field_addr.name = "frequency";
61001#endif /* FREECIV_JSON_CONNECTION */
61002 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->frequency)) {
61003 RECEIVE_PACKET_FIELD_ERROR(frequency);
61004 }
61005#ifdef FREECIV_JSON_CONNECTION
61006 field_addr.name = "effects";
61007#endif /* FREECIV_JSON_CONNECTION */
61008 if (!DIO_BV_GET(&din, &field_addr, real_packet->effects)) {
61009 RECEIVE_PACKET_FIELD_ERROR(effects);
61010 }
61011#endif
61012 log_packet_detailed("packet_ruleset_disaster_100: got info about ()");
61013
61014#ifdef FREECIV_DELTA_PROTOCOL
61015 if (NULL == *hash) {
61016 *hash = genhash_new_full(hash_packet_ruleset_disaster_100, cmp_packet_ruleset_disaster_100,
61017 NULL, NULL, NULL, free);
61018 }
61019
61020 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
61021 *real_packet = *old;
61022 } else {
61023 log_packet_detailed(" no old info");
61024 memset(real_packet, 0, sizeof(*real_packet));
61025 }
61026
61027 if (BV_ISSET(fields, 0)) {
61028 log_packet_detailed(" got field 'id'");
61029#ifdef FREECIV_JSON_CONNECTION
61030 field_addr.name = "id";
61031#endif /* FREECIV_JSON_CONNECTION */
61032 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
61033 RECEIVE_PACKET_FIELD_ERROR(id);
61034 }
61035 }
61036 if (BV_ISSET(fields, 1)) {
61037 log_packet_detailed(" got field 'name'");
61038#ifdef FREECIV_JSON_CONNECTION
61039 field_addr.name = "name";
61040#endif /* FREECIV_JSON_CONNECTION */
61041 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
61042 RECEIVE_PACKET_FIELD_ERROR(name);
61043 }
61044 }
61045 if (BV_ISSET(fields, 2)) {
61046 log_packet_detailed(" got field 'rule_name'");
61047#ifdef FREECIV_JSON_CONNECTION
61048 field_addr.name = "rule_name";
61049#endif /* FREECIV_JSON_CONNECTION */
61050 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
61051 RECEIVE_PACKET_FIELD_ERROR(rule_name);
61052 }
61053 }
61054 if (BV_ISSET(fields, 3)) {
61055 log_packet_detailed(" got field 'reqs_count'");
61056#ifdef FREECIV_JSON_CONNECTION
61057 field_addr.name = "reqs_count";
61058#endif /* FREECIV_JSON_CONNECTION */
61059 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
61060 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
61061 }
61062 }
61063 if (BV_ISSET(fields, 4)) {
61064 log_packet_detailed(" got field 'reqs'");
61065#ifdef FREECIV_JSON_CONNECTION
61066 field_addr.name = "reqs";
61067#endif /* FREECIV_JSON_CONNECTION */
61068 {
61069 int i;
61070
61071#ifdef FREECIV_JSON_CONNECTION
61072 /* Enter array. */
61073 field_addr.sub_location = plocation_elem_new(0);
61074#endif /* FREECIV_JSON_CONNECTION */
61075
61076 if (real_packet->reqs_count > MAX_NUM_REQS) {
61077 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
61078 }
61079 for (i = 0; i < real_packet->reqs_count; i++) {
61080#ifdef FREECIV_JSON_CONNECTION
61081 field_addr.sub_location->number = i;
61082#endif /* FREECIV_JSON_CONNECTION */
61083 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
61084 RECEIVE_PACKET_FIELD_ERROR(reqs);
61085 }
61086 }
61087
61088#ifdef FREECIV_JSON_CONNECTION
61089 /* Exit array. */
61090 FC_FREE(field_addr.sub_location);
61091#endif /* FREECIV_JSON_CONNECTION */
61092 }
61093 }
61094 if (BV_ISSET(fields, 5)) {
61095 log_packet_detailed(" got field 'frequency'");
61096#ifdef FREECIV_JSON_CONNECTION
61097 field_addr.name = "frequency";
61098#endif /* FREECIV_JSON_CONNECTION */
61099 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->frequency)) {
61100 RECEIVE_PACKET_FIELD_ERROR(frequency);
61101 }
61102 }
61103 if (BV_ISSET(fields, 6)) {
61104 log_packet_detailed(" got field 'effects'");
61105#ifdef FREECIV_JSON_CONNECTION
61106 field_addr.name = "effects";
61107#endif /* FREECIV_JSON_CONNECTION */
61108 if (!DIO_BV_GET(&din, &field_addr, real_packet->effects)) {
61109 RECEIVE_PACKET_FIELD_ERROR(effects);
61110 }
61111 }
61112
61113 if (NULL == old) {
61114 old = fc_malloc(sizeof(*old));
61115 *old = *real_packet;
61116 genhash_insert(*hash, old, old);
61117 } else {
61118 *old = *real_packet;
61119 }
61120
61121#endif /* FREECIV_DELTA_PROTOCOL */
61122 RECEIVE_PACKET_END(real_packet);
61123}
61124
61125 static int send_packet_ruleset_disaster_100(struct connection *pc, const struct packet_ruleset_disaster *packet)
61126{
61127 const struct packet_ruleset_disaster *real_packet = packet;
61128 int e;
61129#ifdef FREECIV_DELTA_PROTOCOL
61130 packet_ruleset_disaster_100_fields fields;
61131 struct packet_ruleset_disaster *old;
61132 bool differ;
61133 struct genhash **hash = pc->phs.sent + PACKET_RULESET_DISASTER;
61134#endif /* FREECIV_DELTA_PROTOCOL */
61135 SEND_PACKET_START(PACKET_RULESET_DISASTER);
61136#ifdef FREECIV_JSON_CONNECTION
61137 struct plocation field_addr;
61138 {
61139 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61140 field_addr = *field_addr_tmp;
61141 FC_FREE(field_addr_tmp);
61142 }
61143#endif /* FREECIV_JSON_CONNECTION */
61144
61145 log_packet_detailed("packet_ruleset_disaster_100: sending info about ()");
61146
61147#ifdef FREECIV_DELTA_PROTOCOL
61148 if (NULL == *hash) {
61149 *hash = genhash_new_full(hash_packet_ruleset_disaster_100, cmp_packet_ruleset_disaster_100,
61150 NULL, NULL, NULL, free);
61151 }
61152 BV_CLR_ALL(fields);
61153
61154 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
61155 old = fc_malloc(sizeof(*old));
61156 *old = *real_packet;
61157 genhash_insert(*hash, old, old);
61158 memset(old, 0, sizeof(*old));
61159 }
61160 differ = (old->id != real_packet->id);
61161 if (differ) {
61162 BV_SET(fields, 0);
61163 }
61164
61165 differ = (strcmp(old->name, real_packet->name) != 0);
61166 if (differ) {
61167 BV_SET(fields, 1);
61168 }
61169
61170 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
61171 if (differ) {
61172 BV_SET(fields, 2);
61173 }
61174
61175 differ = (old->reqs_count != real_packet->reqs_count);
61176 if (differ) {
61177 BV_SET(fields, 3);
61178 }
61179
61180 differ = (old->reqs_count != real_packet->reqs_count);
61181 if (!differ) {
61182 int i;
61183
61184 for (i = 0; i < real_packet->reqs_count; i++) {
61185 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
61186 if (differ) {
61187 break;
61188 }
61189 }
61190 }
61191 if (differ) {
61192 BV_SET(fields, 4);
61193 }
61194
61195 differ = (old->frequency != real_packet->frequency);
61196 if (differ) {
61197 BV_SET(fields, 5);
61198 }
61199
61200 differ = !BV_ARE_EQUAL(old->effects, real_packet->effects);
61201 if (differ) {
61202 BV_SET(fields, 6);
61203 }
61204
61205
61206#ifdef FREECIV_JSON_CONNECTION
61207 field_addr.name = "fields";
61208#endif /* FREECIV_JSON_CONNECTION */
61209 e = 0;
61210 e |= DIO_BV_PUT(&dout, &field_addr, fields);
61211 if (e) {
61212 log_packet_detailed("fields bitvector error detected");
61213 }
61214
61215 if (BV_ISSET(fields, 0)) {
61216 log_packet_detailed(" field 'id' has changed");
61217#ifdef FREECIV_JSON_CONNECTION
61218 field_addr.name = "id";
61219#endif /* FREECIV_JSON_CONNECTION */
61220 e = 0;
61221 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
61222 if (e) {
61223 log_packet_detailed("'id' field error detected");
61224 }
61225 }
61226 if (BV_ISSET(fields, 1)) {
61227 log_packet_detailed(" field 'name' has changed");
61228#ifdef FREECIV_JSON_CONNECTION
61229 field_addr.name = "name";
61230#endif /* FREECIV_JSON_CONNECTION */
61231 e = 0;
61232 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
61233 if (e) {
61234 log_packet_detailed("'name' field error detected");
61235 }
61236 }
61237 if (BV_ISSET(fields, 2)) {
61238 log_packet_detailed(" field 'rule_name' has changed");
61239#ifdef FREECIV_JSON_CONNECTION
61240 field_addr.name = "rule_name";
61241#endif /* FREECIV_JSON_CONNECTION */
61242 e = 0;
61243 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
61244 if (e) {
61245 log_packet_detailed("'rule_name' field error detected");
61246 }
61247 }
61248 if (BV_ISSET(fields, 3)) {
61249 log_packet_detailed(" field 'reqs_count' has changed");
61250#ifdef FREECIV_JSON_CONNECTION
61251 field_addr.name = "reqs_count";
61252#endif /* FREECIV_JSON_CONNECTION */
61253 e = 0;
61254 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
61255 if (e) {
61256 log_packet_detailed("'reqs_count' field error detected");
61257 }
61258 }
61259 if (BV_ISSET(fields, 4)) {
61260 log_packet_detailed(" field 'reqs' has changed");
61261#ifdef FREECIV_JSON_CONNECTION
61262 field_addr.name = "reqs";
61263#endif /* FREECIV_JSON_CONNECTION */
61264 e = 0;
61265 {
61266 int i;
61267
61268#ifdef FREECIV_JSON_CONNECTION
61269 /* Create the array. */
61270 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
61271
61272 /* Enter the array. */
61273 field_addr.sub_location = plocation_elem_new(0);
61274#endif /* FREECIV_JSON_CONNECTION */
61275
61276 for (i = 0; i < real_packet->reqs_count; i++) {
61277#ifdef FREECIV_JSON_CONNECTION
61278 /* Next array element. */
61279 field_addr.sub_location->number = i;
61280#endif /* FREECIV_JSON_CONNECTION */
61281 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
61282 }
61283
61284#ifdef FREECIV_JSON_CONNECTION
61285 /* Exit array. */
61286 FC_FREE(field_addr.sub_location);
61287#endif /* FREECIV_JSON_CONNECTION */
61288 }
61289 if (e) {
61290 log_packet_detailed("'reqs' field error detected");
61291 }
61292 }
61293 if (BV_ISSET(fields, 5)) {
61294 log_packet_detailed(" field 'frequency' has changed");
61295#ifdef FREECIV_JSON_CONNECTION
61296 field_addr.name = "frequency";
61297#endif /* FREECIV_JSON_CONNECTION */
61298 e = 0;
61299 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->frequency);
61300 if (e) {
61301 log_packet_detailed("'frequency' field error detected");
61302 }
61303 }
61304 if (BV_ISSET(fields, 6)) {
61305 log_packet_detailed(" field 'effects' has changed");
61306#ifdef FREECIV_JSON_CONNECTION
61307 field_addr.name = "effects";
61308#endif /* FREECIV_JSON_CONNECTION */
61309 e = 0;
61310 e |= DIO_BV_PUT(&dout, &field_addr, packet->effects);
61311 if (e) {
61312 log_packet_detailed("'effects' field error detected");
61313 }
61314 }
61315
61316 *old = *real_packet;
61317#endif /* FREECIV_DELTA_PROTOCOL */
61318#ifndef FREECIV_DELTA_PROTOCOL
61319#ifdef FREECIV_JSON_CONNECTION
61320 field_addr.name = "id";
61321#endif /* FREECIV_JSON_CONNECTION */
61322 e = 0;
61323 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
61324 if (e) {
61325 log_packet_detailed("'id' field error detected");
61326 }
61327#ifdef FREECIV_JSON_CONNECTION
61328 field_addr.name = "name";
61329#endif /* FREECIV_JSON_CONNECTION */
61330 e = 0;
61331 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
61332 if (e) {
61333 log_packet_detailed("'name' field error detected");
61334 }
61335#ifdef FREECIV_JSON_CONNECTION
61336 field_addr.name = "rule_name";
61337#endif /* FREECIV_JSON_CONNECTION */
61338 e = 0;
61339 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
61340 if (e) {
61341 log_packet_detailed("'rule_name' field error detected");
61342 }
61343#ifdef FREECIV_JSON_CONNECTION
61344 field_addr.name = "reqs_count";
61345#endif /* FREECIV_JSON_CONNECTION */
61346 e = 0;
61347 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
61348 if (e) {
61349 log_packet_detailed("'reqs_count' field error detected");
61350 }
61351#ifdef FREECIV_JSON_CONNECTION
61352 field_addr.name = "reqs";
61353#endif /* FREECIV_JSON_CONNECTION */
61354 e = 0;
61355 {
61356 int i;
61357
61358#ifdef FREECIV_JSON_CONNECTION
61359 /* Create the array. */
61360 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
61361
61362 /* Enter the array. */
61363 field_addr.sub_location = plocation_elem_new(0);
61364#endif /* FREECIV_JSON_CONNECTION */
61365
61366 for (i = 0; i < real_packet->reqs_count; i++) {
61367#ifdef FREECIV_JSON_CONNECTION
61368 /* Next array element. */
61369 field_addr.sub_location->number = i;
61370#endif /* FREECIV_JSON_CONNECTION */
61371 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
61372 }
61373
61374#ifdef FREECIV_JSON_CONNECTION
61375 /* Exit array. */
61376 FC_FREE(field_addr.sub_location);
61377#endif /* FREECIV_JSON_CONNECTION */
61378 }
61379 if (e) {
61380 log_packet_detailed("'reqs' field error detected");
61381 }
61382#ifdef FREECIV_JSON_CONNECTION
61383 field_addr.name = "frequency";
61384#endif /* FREECIV_JSON_CONNECTION */
61385 e = 0;
61386 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->frequency);
61387 if (e) {
61388 log_packet_detailed("'frequency' field error detected");
61389 }
61390#ifdef FREECIV_JSON_CONNECTION
61391 field_addr.name = "effects";
61392#endif /* FREECIV_JSON_CONNECTION */
61393 e = 0;
61394 e |= DIO_BV_PUT(&dout, &field_addr, packet->effects);
61395 if (e) {
61396 log_packet_detailed("'effects' field error detected");
61397 }
61398
61399#endif
61400 SEND_PACKET_END(PACKET_RULESET_DISASTER);
61401}
61402
61403 int send_packet_ruleset_disaster(struct connection *pc, const struct packet_ruleset_disaster *packet)
61404{
61405 if (!pc->used) {
61406 log_error("WARNING: trying to send data to the closed connection %s",
61407 conn_description(pc));
61408 return -1;
61409 }
61410 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_DISASTER].packet != NULL, -1,
61411 "Handler for PACKET_RULESET_DISASTER not installed");
61412 return pc->phs.handlers->send[PACKET_RULESET_DISASTER].packet(pc, packet);
61413}
61414
61415 void lsend_packet_ruleset_disaster(struct conn_list *dest, const struct packet_ruleset_disaster *packet)
61416{
61417 conn_list_iterate(dest, pconn) {
61418 send_packet_ruleset_disaster(pconn, packet);
61419 } conn_list_iterate_end;
61420}
61421
61422#ifdef FREECIV_DELTA_PROTOCOL
61423#define hash_packet_ruleset_achievement_100 hash_const
61424
61425#define cmp_packet_ruleset_achievement_100 cmp_const
61426
61427 BV_DEFINE(packet_ruleset_achievement_100_fields, 6);
61428#endif /* FREECIV_DELTA_PROTOCOL */
61429
61430 static struct packet_ruleset_achievement *receive_packet_ruleset_achievement_100(struct connection *pc)
61431{
61432#ifdef FREECIV_DELTA_PROTOCOL
61433 packet_ruleset_achievement_100_fields fields;
61434 struct packet_ruleset_achievement *old;
61435 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACHIEVEMENT;
61436#endif /* FREECIV_DELTA_PROTOCOL */
61437 RECEIVE_PACKET_START(packet_ruleset_achievement, real_packet);
61438#ifdef FREECIV_JSON_CONNECTION
61439 struct plocation field_addr;
61440 {
61441 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61442 field_addr = *field_addr_tmp;
61443 FC_FREE(field_addr_tmp);
61444 }
61445#endif /* FREECIV_JSON_CONNECTION */
61446
61447#ifdef FREECIV_DELTA_PROTOCOL
61448#ifdef FREECIV_JSON_CONNECTION
61449 field_addr.name = "fields";
61450#endif /* FREECIV_JSON_CONNECTION */
61451 DIO_BV_GET(&din, &field_addr, fields);
61452
61453#else /* FREECIV_DELTA_PROTOCOL */
61454#ifdef FREECIV_JSON_CONNECTION
61455 field_addr.name = "id";
61456#endif /* FREECIV_JSON_CONNECTION */
61457 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
61458 RECEIVE_PACKET_FIELD_ERROR(id);
61459 }
61460#ifdef FREECIV_JSON_CONNECTION
61461 field_addr.name = "name";
61462#endif /* FREECIV_JSON_CONNECTION */
61463 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
61464 RECEIVE_PACKET_FIELD_ERROR(name);
61465 }
61466#ifdef FREECIV_JSON_CONNECTION
61467 field_addr.name = "rule_name";
61468#endif /* FREECIV_JSON_CONNECTION */
61469 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
61470 RECEIVE_PACKET_FIELD_ERROR(rule_name);
61471 }
61472#ifdef FREECIV_JSON_CONNECTION
61473 field_addr.name = "type";
61474#endif /* FREECIV_JSON_CONNECTION */
61475 {
61476 int readin;
61477
61478 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
61479 RECEIVE_PACKET_FIELD_ERROR(type);
61480 }
61481 real_packet->type = readin;
61482 }
61483#ifdef FREECIV_JSON_CONNECTION
61484 field_addr.name = "unique";
61485#endif /* FREECIV_JSON_CONNECTION */
61486 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->unique)) {
61487 RECEIVE_PACKET_FIELD_ERROR(unique);
61488 }
61489#ifdef FREECIV_JSON_CONNECTION
61490 field_addr.name = "value";
61491#endif /* FREECIV_JSON_CONNECTION */
61492 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
61493 RECEIVE_PACKET_FIELD_ERROR(value);
61494 }
61495#endif
61496 log_packet_detailed("packet_ruleset_achievement_100: got info about ()");
61497
61498#ifdef FREECIV_DELTA_PROTOCOL
61499 if (NULL == *hash) {
61500 *hash = genhash_new_full(hash_packet_ruleset_achievement_100, cmp_packet_ruleset_achievement_100,
61501 NULL, NULL, NULL, free);
61502 }
61503
61504 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
61505 *real_packet = *old;
61506 } else {
61507 log_packet_detailed(" no old info");
61508 memset(real_packet, 0, sizeof(*real_packet));
61509 }
61510
61511 if (BV_ISSET(fields, 0)) {
61512 log_packet_detailed(" got field 'id'");
61513#ifdef FREECIV_JSON_CONNECTION
61514 field_addr.name = "id";
61515#endif /* FREECIV_JSON_CONNECTION */
61516 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
61517 RECEIVE_PACKET_FIELD_ERROR(id);
61518 }
61519 }
61520 if (BV_ISSET(fields, 1)) {
61521 log_packet_detailed(" got field 'name'");
61522#ifdef FREECIV_JSON_CONNECTION
61523 field_addr.name = "name";
61524#endif /* FREECIV_JSON_CONNECTION */
61525 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
61526 RECEIVE_PACKET_FIELD_ERROR(name);
61527 }
61528 }
61529 if (BV_ISSET(fields, 2)) {
61530 log_packet_detailed(" got field 'rule_name'");
61531#ifdef FREECIV_JSON_CONNECTION
61532 field_addr.name = "rule_name";
61533#endif /* FREECIV_JSON_CONNECTION */
61534 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
61535 RECEIVE_PACKET_FIELD_ERROR(rule_name);
61536 }
61537 }
61538 if (BV_ISSET(fields, 3)) {
61539 log_packet_detailed(" got field 'type'");
61540#ifdef FREECIV_JSON_CONNECTION
61541 field_addr.name = "type";
61542#endif /* FREECIV_JSON_CONNECTION */
61543 {
61544 int readin;
61545
61546 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
61547 RECEIVE_PACKET_FIELD_ERROR(type);
61548 }
61549 real_packet->type = readin;
61550 }
61551 }
61552 real_packet->unique = BV_ISSET(fields, 4);
61553 if (BV_ISSET(fields, 5)) {
61554 log_packet_detailed(" got field 'value'");
61555#ifdef FREECIV_JSON_CONNECTION
61556 field_addr.name = "value";
61557#endif /* FREECIV_JSON_CONNECTION */
61558 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->value)) {
61559 RECEIVE_PACKET_FIELD_ERROR(value);
61560 }
61561 }
61562
61563 if (NULL == old) {
61564 old = fc_malloc(sizeof(*old));
61565 *old = *real_packet;
61566 genhash_insert(*hash, old, old);
61567 } else {
61568 *old = *real_packet;
61569 }
61570
61571#endif /* FREECIV_DELTA_PROTOCOL */
61572 RECEIVE_PACKET_END(real_packet);
61573}
61574
61575 static int send_packet_ruleset_achievement_100(struct connection *pc, const struct packet_ruleset_achievement *packet)
61576{
61577 const struct packet_ruleset_achievement *real_packet = packet;
61578 int e;
61579#ifdef FREECIV_DELTA_PROTOCOL
61580 packet_ruleset_achievement_100_fields fields;
61581 struct packet_ruleset_achievement *old;
61582 bool differ;
61583 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACHIEVEMENT;
61584#endif /* FREECIV_DELTA_PROTOCOL */
61585 SEND_PACKET_START(PACKET_RULESET_ACHIEVEMENT);
61586#ifdef FREECIV_JSON_CONNECTION
61587 struct plocation field_addr;
61588 {
61589 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61590 field_addr = *field_addr_tmp;
61591 FC_FREE(field_addr_tmp);
61592 }
61593#endif /* FREECIV_JSON_CONNECTION */
61594
61595 log_packet_detailed("packet_ruleset_achievement_100: sending info about ()");
61596
61597#ifdef FREECIV_DELTA_PROTOCOL
61598 if (NULL == *hash) {
61599 *hash = genhash_new_full(hash_packet_ruleset_achievement_100, cmp_packet_ruleset_achievement_100,
61600 NULL, NULL, NULL, free);
61601 }
61602 BV_CLR_ALL(fields);
61603
61604 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
61605 old = fc_malloc(sizeof(*old));
61606 *old = *real_packet;
61607 genhash_insert(*hash, old, old);
61608 memset(old, 0, sizeof(*old));
61609 }
61610 differ = (old->id != real_packet->id);
61611 if (differ) {
61612 BV_SET(fields, 0);
61613 }
61614
61615 differ = (strcmp(old->name, real_packet->name) != 0);
61616 if (differ) {
61617 BV_SET(fields, 1);
61618 }
61619
61620 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
61621 if (differ) {
61622 BV_SET(fields, 2);
61623 }
61624
61625 differ = (old->type != real_packet->type);
61626 if (differ) {
61627 BV_SET(fields, 3);
61628 }
61629
61630 if (packet->unique) {
61631 BV_SET(fields, 4);
61632 }
61633
61634 differ = (old->value != real_packet->value);
61635 if (differ) {
61636 BV_SET(fields, 5);
61637 }
61638
61639
61640#ifdef FREECIV_JSON_CONNECTION
61641 field_addr.name = "fields";
61642#endif /* FREECIV_JSON_CONNECTION */
61643 e = 0;
61644 e |= DIO_BV_PUT(&dout, &field_addr, fields);
61645 if (e) {
61646 log_packet_detailed("fields bitvector error detected");
61647 }
61648
61649 if (BV_ISSET(fields, 0)) {
61650 log_packet_detailed(" field 'id' has changed");
61651#ifdef FREECIV_JSON_CONNECTION
61652 field_addr.name = "id";
61653#endif /* FREECIV_JSON_CONNECTION */
61654 e = 0;
61655 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
61656 if (e) {
61657 log_packet_detailed("'id' field error detected");
61658 }
61659 }
61660 if (BV_ISSET(fields, 1)) {
61661 log_packet_detailed(" field 'name' has changed");
61662#ifdef FREECIV_JSON_CONNECTION
61663 field_addr.name = "name";
61664#endif /* FREECIV_JSON_CONNECTION */
61665 e = 0;
61666 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
61667 if (e) {
61668 log_packet_detailed("'name' field error detected");
61669 }
61670 }
61671 if (BV_ISSET(fields, 2)) {
61672 log_packet_detailed(" field 'rule_name' has changed");
61673#ifdef FREECIV_JSON_CONNECTION
61674 field_addr.name = "rule_name";
61675#endif /* FREECIV_JSON_CONNECTION */
61676 e = 0;
61677 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
61678 if (e) {
61679 log_packet_detailed("'rule_name' field error detected");
61680 }
61681 }
61682 if (BV_ISSET(fields, 3)) {
61683 log_packet_detailed(" field 'type' has changed");
61684#ifdef FREECIV_JSON_CONNECTION
61685 field_addr.name = "type";
61686#endif /* FREECIV_JSON_CONNECTION */
61687 e = 0;
61688 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
61689 if (e) {
61690 log_packet_detailed("'type' field error detected");
61691 }
61692 }
61693 /* field 4 is folded into the header */
61694 if (BV_ISSET(fields, 5)) {
61695 log_packet_detailed(" field 'value' has changed");
61696#ifdef FREECIV_JSON_CONNECTION
61697 field_addr.name = "value";
61698#endif /* FREECIV_JSON_CONNECTION */
61699 e = 0;
61700 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
61701 if (e) {
61702 log_packet_detailed("'value' field error detected");
61703 }
61704 }
61705
61706 *old = *real_packet;
61707#endif /* FREECIV_DELTA_PROTOCOL */
61708#ifndef FREECIV_DELTA_PROTOCOL
61709#ifdef FREECIV_JSON_CONNECTION
61710 field_addr.name = "id";
61711#endif /* FREECIV_JSON_CONNECTION */
61712 e = 0;
61713 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
61714 if (e) {
61715 log_packet_detailed("'id' field error detected");
61716 }
61717#ifdef FREECIV_JSON_CONNECTION
61718 field_addr.name = "name";
61719#endif /* FREECIV_JSON_CONNECTION */
61720 e = 0;
61721 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
61722 if (e) {
61723 log_packet_detailed("'name' field error detected");
61724 }
61725#ifdef FREECIV_JSON_CONNECTION
61726 field_addr.name = "rule_name";
61727#endif /* FREECIV_JSON_CONNECTION */
61728 e = 0;
61729 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
61730 if (e) {
61731 log_packet_detailed("'rule_name' field error detected");
61732 }
61733#ifdef FREECIV_JSON_CONNECTION
61734 field_addr.name = "type";
61735#endif /* FREECIV_JSON_CONNECTION */
61736 e = 0;
61737 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
61738 if (e) {
61739 log_packet_detailed("'type' field error detected");
61740 }
61741#ifdef FREECIV_JSON_CONNECTION
61742 field_addr.name = "unique";
61743#endif /* FREECIV_JSON_CONNECTION */
61744 e = 0;
61745 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->unique);
61746 if (e) {
61747 log_packet_detailed("'unique' field error detected");
61748 }
61749#ifdef FREECIV_JSON_CONNECTION
61750 field_addr.name = "value";
61751#endif /* FREECIV_JSON_CONNECTION */
61752 e = 0;
61753 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->value);
61754 if (e) {
61755 log_packet_detailed("'value' field error detected");
61756 }
61757
61758#endif
61759 SEND_PACKET_END(PACKET_RULESET_ACHIEVEMENT);
61760}
61761
61762 int send_packet_ruleset_achievement(struct connection *pc, const struct packet_ruleset_achievement *packet)
61763{
61764 if (!pc->used) {
61765 log_error("WARNING: trying to send data to the closed connection %s",
61766 conn_description(pc));
61767 return -1;
61768 }
61769 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACHIEVEMENT].packet != NULL, -1,
61770 "Handler for PACKET_RULESET_ACHIEVEMENT not installed");
61771 return pc->phs.handlers->send[PACKET_RULESET_ACHIEVEMENT].packet(pc, packet);
61772}
61773
61774 void lsend_packet_ruleset_achievement(struct conn_list *dest, const struct packet_ruleset_achievement *packet)
61775{
61776 conn_list_iterate(dest, pconn) {
61777 send_packet_ruleset_achievement(pconn, packet);
61778 } conn_list_iterate_end;
61779}
61780
61781#ifdef FREECIV_DELTA_PROTOCOL
61782#define hash_packet_ruleset_trade_100 hash_const
61783
61784#define cmp_packet_ruleset_trade_100 cmp_const
61785
61786 BV_DEFINE(packet_ruleset_trade_100_fields, 4);
61787#endif /* FREECIV_DELTA_PROTOCOL */
61788
61789 static struct packet_ruleset_trade *receive_packet_ruleset_trade_100(struct connection *pc)
61790{
61791#ifdef FREECIV_DELTA_PROTOCOL
61792 packet_ruleset_trade_100_fields fields;
61793 struct packet_ruleset_trade *old;
61794 struct genhash **hash = pc->phs.received + PACKET_RULESET_TRADE;
61795#endif /* FREECIV_DELTA_PROTOCOL */
61796 RECEIVE_PACKET_START(packet_ruleset_trade, real_packet);
61797#ifdef FREECIV_JSON_CONNECTION
61798 struct plocation field_addr;
61799 {
61800 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61801 field_addr = *field_addr_tmp;
61802 FC_FREE(field_addr_tmp);
61803 }
61804#endif /* FREECIV_JSON_CONNECTION */
61805
61806#ifdef FREECIV_DELTA_PROTOCOL
61807#ifdef FREECIV_JSON_CONNECTION
61808 field_addr.name = "fields";
61809#endif /* FREECIV_JSON_CONNECTION */
61810 DIO_BV_GET(&din, &field_addr, fields);
61811
61812#else /* FREECIV_DELTA_PROTOCOL */
61813#ifdef FREECIV_JSON_CONNECTION
61814 field_addr.name = "id";
61815#endif /* FREECIV_JSON_CONNECTION */
61816 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
61817 RECEIVE_PACKET_FIELD_ERROR(id);
61818 }
61819#ifdef FREECIV_JSON_CONNECTION
61820 field_addr.name = "trade_pct";
61821#endif /* FREECIV_JSON_CONNECTION */
61822 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trade_pct)) {
61823 RECEIVE_PACKET_FIELD_ERROR(trade_pct);
61824 }
61825#ifdef FREECIV_JSON_CONNECTION
61826 field_addr.name = "cancelling";
61827#endif /* FREECIV_JSON_CONNECTION */
61828 {
61829 int readin;
61830
61831 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
61832 RECEIVE_PACKET_FIELD_ERROR(cancelling);
61833 }
61834 real_packet->cancelling = readin;
61835 }
61836#ifdef FREECIV_JSON_CONNECTION
61837 field_addr.name = "bonus_type";
61838#endif /* FREECIV_JSON_CONNECTION */
61839 {
61840 int readin;
61841
61842 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
61843 RECEIVE_PACKET_FIELD_ERROR(bonus_type);
61844 }
61845 real_packet->bonus_type = readin;
61846 }
61847#endif
61848 log_packet_detailed("packet_ruleset_trade_100: got info about ()");
61849
61850#ifdef FREECIV_DELTA_PROTOCOL
61851 if (NULL == *hash) {
61852 *hash = genhash_new_full(hash_packet_ruleset_trade_100, cmp_packet_ruleset_trade_100,
61853 NULL, NULL, NULL, free);
61854 }
61855
61856 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
61857 *real_packet = *old;
61858 } else {
61859 log_packet_detailed(" no old info");
61860 memset(real_packet, 0, sizeof(*real_packet));
61861 }
61862
61863 if (BV_ISSET(fields, 0)) {
61864 log_packet_detailed(" got field 'id'");
61865#ifdef FREECIV_JSON_CONNECTION
61866 field_addr.name = "id";
61867#endif /* FREECIV_JSON_CONNECTION */
61868 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
61869 RECEIVE_PACKET_FIELD_ERROR(id);
61870 }
61871 }
61872 if (BV_ISSET(fields, 1)) {
61873 log_packet_detailed(" got field 'trade_pct'");
61874#ifdef FREECIV_JSON_CONNECTION
61875 field_addr.name = "trade_pct";
61876#endif /* FREECIV_JSON_CONNECTION */
61877 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->trade_pct)) {
61878 RECEIVE_PACKET_FIELD_ERROR(trade_pct);
61879 }
61880 }
61881 if (BV_ISSET(fields, 2)) {
61882 log_packet_detailed(" got field 'cancelling'");
61883#ifdef FREECIV_JSON_CONNECTION
61884 field_addr.name = "cancelling";
61885#endif /* FREECIV_JSON_CONNECTION */
61886 {
61887 int readin;
61888
61889 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
61890 RECEIVE_PACKET_FIELD_ERROR(cancelling);
61891 }
61892 real_packet->cancelling = readin;
61893 }
61894 }
61895 if (BV_ISSET(fields, 3)) {
61896 log_packet_detailed(" got field 'bonus_type'");
61897#ifdef FREECIV_JSON_CONNECTION
61898 field_addr.name = "bonus_type";
61899#endif /* FREECIV_JSON_CONNECTION */
61900 {
61901 int readin;
61902
61903 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
61904 RECEIVE_PACKET_FIELD_ERROR(bonus_type);
61905 }
61906 real_packet->bonus_type = readin;
61907 }
61908 }
61909
61910 if (NULL == old) {
61911 old = fc_malloc(sizeof(*old));
61912 *old = *real_packet;
61913 genhash_insert(*hash, old, old);
61914 } else {
61915 *old = *real_packet;
61916 }
61917
61918#endif /* FREECIV_DELTA_PROTOCOL */
61919 RECEIVE_PACKET_END(real_packet);
61920}
61921
61922 static int send_packet_ruleset_trade_100(struct connection *pc, const struct packet_ruleset_trade *packet)
61923{
61924 const struct packet_ruleset_trade *real_packet = packet;
61925 int e;
61926#ifdef FREECIV_DELTA_PROTOCOL
61927 packet_ruleset_trade_100_fields fields;
61928 struct packet_ruleset_trade *old;
61929 bool differ;
61930 struct genhash **hash = pc->phs.sent + PACKET_RULESET_TRADE;
61931#endif /* FREECIV_DELTA_PROTOCOL */
61932 SEND_PACKET_START(PACKET_RULESET_TRADE);
61933#ifdef FREECIV_JSON_CONNECTION
61934 struct plocation field_addr;
61935 {
61936 struct plocation *field_addr_tmp = plocation_field_new(NULL);
61937 field_addr = *field_addr_tmp;
61938 FC_FREE(field_addr_tmp);
61939 }
61940#endif /* FREECIV_JSON_CONNECTION */
61941
61942 log_packet_detailed("packet_ruleset_trade_100: sending info about ()");
61943
61944#ifdef FREECIV_DELTA_PROTOCOL
61945 if (NULL == *hash) {
61946 *hash = genhash_new_full(hash_packet_ruleset_trade_100, cmp_packet_ruleset_trade_100,
61947 NULL, NULL, NULL, free);
61948 }
61949 BV_CLR_ALL(fields);
61950
61951 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
61952 old = fc_malloc(sizeof(*old));
61953 *old = *real_packet;
61954 genhash_insert(*hash, old, old);
61955 memset(old, 0, sizeof(*old));
61956 }
61957 differ = (old->id != real_packet->id);
61958 if (differ) {
61959 BV_SET(fields, 0);
61960 }
61961
61962 differ = (old->trade_pct != real_packet->trade_pct);
61963 if (differ) {
61964 BV_SET(fields, 1);
61965 }
61966
61967 differ = (old->cancelling != real_packet->cancelling);
61968 if (differ) {
61969 BV_SET(fields, 2);
61970 }
61971
61972 differ = (old->bonus_type != real_packet->bonus_type);
61973 if (differ) {
61974 BV_SET(fields, 3);
61975 }
61976
61977
61978#ifdef FREECIV_JSON_CONNECTION
61979 field_addr.name = "fields";
61980#endif /* FREECIV_JSON_CONNECTION */
61981 e = 0;
61982 e |= DIO_BV_PUT(&dout, &field_addr, fields);
61983 if (e) {
61984 log_packet_detailed("fields bitvector error detected");
61985 }
61986
61987 if (BV_ISSET(fields, 0)) {
61988 log_packet_detailed(" field 'id' has changed");
61989#ifdef FREECIV_JSON_CONNECTION
61990 field_addr.name = "id";
61991#endif /* FREECIV_JSON_CONNECTION */
61992 e = 0;
61993 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
61994 if (e) {
61995 log_packet_detailed("'id' field error detected");
61996 }
61997 }
61998 if (BV_ISSET(fields, 1)) {
61999 log_packet_detailed(" field 'trade_pct' has changed");
62000#ifdef FREECIV_JSON_CONNECTION
62001 field_addr.name = "trade_pct";
62002#endif /* FREECIV_JSON_CONNECTION */
62003 e = 0;
62004 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trade_pct);
62005 if (e) {
62006 log_packet_detailed("'trade_pct' field error detected");
62007 }
62008 }
62009 if (BV_ISSET(fields, 2)) {
62010 log_packet_detailed(" field 'cancelling' has changed");
62011#ifdef FREECIV_JSON_CONNECTION
62012 field_addr.name = "cancelling";
62013#endif /* FREECIV_JSON_CONNECTION */
62014 e = 0;
62015 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cancelling);
62016 if (e) {
62017 log_packet_detailed("'cancelling' field error detected");
62018 }
62019 }
62020 if (BV_ISSET(fields, 3)) {
62021 log_packet_detailed(" field 'bonus_type' has changed");
62022#ifdef FREECIV_JSON_CONNECTION
62023 field_addr.name = "bonus_type";
62024#endif /* FREECIV_JSON_CONNECTION */
62025 e = 0;
62026 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bonus_type);
62027 if (e) {
62028 log_packet_detailed("'bonus_type' field error detected");
62029 }
62030 }
62031
62032 *old = *real_packet;
62033#endif /* FREECIV_DELTA_PROTOCOL */
62034#ifndef FREECIV_DELTA_PROTOCOL
62035#ifdef FREECIV_JSON_CONNECTION
62036 field_addr.name = "id";
62037#endif /* FREECIV_JSON_CONNECTION */
62038 e = 0;
62039 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
62040 if (e) {
62041 log_packet_detailed("'id' field error detected");
62042 }
62043#ifdef FREECIV_JSON_CONNECTION
62044 field_addr.name = "trade_pct";
62045#endif /* FREECIV_JSON_CONNECTION */
62046 e = 0;
62047 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->trade_pct);
62048 if (e) {
62049 log_packet_detailed("'trade_pct' field error detected");
62050 }
62051#ifdef FREECIV_JSON_CONNECTION
62052 field_addr.name = "cancelling";
62053#endif /* FREECIV_JSON_CONNECTION */
62054 e = 0;
62055 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cancelling);
62056 if (e) {
62057 log_packet_detailed("'cancelling' field error detected");
62058 }
62059#ifdef FREECIV_JSON_CONNECTION
62060 field_addr.name = "bonus_type";
62061#endif /* FREECIV_JSON_CONNECTION */
62062 e = 0;
62063 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bonus_type);
62064 if (e) {
62065 log_packet_detailed("'bonus_type' field error detected");
62066 }
62067
62068#endif
62069 SEND_PACKET_END(PACKET_RULESET_TRADE);
62070}
62071
62072 int send_packet_ruleset_trade(struct connection *pc, const struct packet_ruleset_trade *packet)
62073{
62074 if (!pc->used) {
62075 log_error("WARNING: trying to send data to the closed connection %s",
62076 conn_description(pc));
62077 return -1;
62078 }
62079 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_TRADE].packet != NULL, -1,
62080 "Handler for PACKET_RULESET_TRADE not installed");
62081 return pc->phs.handlers->send[PACKET_RULESET_TRADE].packet(pc, packet);
62082}
62083
62084 void lsend_packet_ruleset_trade(struct conn_list *dest, const struct packet_ruleset_trade *packet)
62085{
62086 conn_list_iterate(dest, pconn) {
62087 send_packet_ruleset_trade(pconn, packet);
62088 } conn_list_iterate_end;
62089}
62090
62091#ifdef FREECIV_DELTA_PROTOCOL
62092#define hash_packet_ruleset_action_100 hash_const
62093
62094#define cmp_packet_ruleset_action_100 cmp_const
62095
62096 BV_DEFINE(packet_ruleset_action_100_fields, 12);
62097#endif /* FREECIV_DELTA_PROTOCOL */
62098
62099 static struct packet_ruleset_action *receive_packet_ruleset_action_100(struct connection *pc)
62100{
62101#ifdef FREECIV_DELTA_PROTOCOL
62102 packet_ruleset_action_100_fields fields;
62103 struct packet_ruleset_action *old;
62104 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION;
62105#endif /* FREECIV_DELTA_PROTOCOL */
62106 RECEIVE_PACKET_START(packet_ruleset_action, real_packet);
62107#ifdef FREECIV_JSON_CONNECTION
62108 struct plocation field_addr;
62109 {
62110 struct plocation *field_addr_tmp = plocation_field_new(NULL);
62111 field_addr = *field_addr_tmp;
62112 FC_FREE(field_addr_tmp);
62113 }
62114#endif /* FREECIV_JSON_CONNECTION */
62115
62116#ifdef FREECIV_DELTA_PROTOCOL
62117#ifdef FREECIV_JSON_CONNECTION
62118 field_addr.name = "fields";
62119#endif /* FREECIV_JSON_CONNECTION */
62120 DIO_BV_GET(&din, &field_addr, fields);
62121
62122#else /* FREECIV_DELTA_PROTOCOL */
62123#ifdef FREECIV_JSON_CONNECTION
62124 field_addr.name = "id";
62125#endif /* FREECIV_JSON_CONNECTION */
62126 {
62127 int readin;
62128
62129 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62130 RECEIVE_PACKET_FIELD_ERROR(id);
62131 }
62132 real_packet->id = readin;
62133 }
62134#ifdef FREECIV_JSON_CONNECTION
62135 field_addr.name = "ui_name";
62136#endif /* FREECIV_JSON_CONNECTION */
62137 if (!DIO_GET(string, &din, &field_addr, real_packet->ui_name, sizeof(real_packet->ui_name))) {
62138 RECEIVE_PACKET_FIELD_ERROR(ui_name);
62139 }
62140#ifdef FREECIV_JSON_CONNECTION
62141 field_addr.name = "quiet";
62142#endif /* FREECIV_JSON_CONNECTION */
62143 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->quiet)) {
62144 RECEIVE_PACKET_FIELD_ERROR(quiet);
62145 }
62146#ifdef FREECIV_JSON_CONNECTION
62147 field_addr.name = "result";
62148#endif /* FREECIV_JSON_CONNECTION */
62149 {
62150 int readin;
62151
62152 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62153 RECEIVE_PACKET_FIELD_ERROR(result);
62154 }
62155 real_packet->result = readin;
62156 }
62157#ifdef FREECIV_JSON_CONNECTION
62158 field_addr.name = "sub_results";
62159#endif /* FREECIV_JSON_CONNECTION */
62160 if (!DIO_BV_GET(&din, &field_addr, real_packet->sub_results)) {
62161 RECEIVE_PACKET_FIELD_ERROR(sub_results);
62162 }
62163#ifdef FREECIV_JSON_CONNECTION
62164 field_addr.name = "actor_consuming_always";
62165#endif /* FREECIV_JSON_CONNECTION */
62166 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->actor_consuming_always)) {
62167 RECEIVE_PACKET_FIELD_ERROR(actor_consuming_always);
62168 }
62169#ifdef FREECIV_JSON_CONNECTION
62170 field_addr.name = "act_kind";
62171#endif /* FREECIV_JSON_CONNECTION */
62172 {
62173 int readin;
62174
62175 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62176 RECEIVE_PACKET_FIELD_ERROR(act_kind);
62177 }
62178 real_packet->act_kind = readin;
62179 }
62180#ifdef FREECIV_JSON_CONNECTION
62181 field_addr.name = "tgt_kind";
62182#endif /* FREECIV_JSON_CONNECTION */
62183 {
62184 int readin;
62185
62186 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62187 RECEIVE_PACKET_FIELD_ERROR(tgt_kind);
62188 }
62189 real_packet->tgt_kind = readin;
62190 }
62191#ifdef FREECIV_JSON_CONNECTION
62192 field_addr.name = "sub_tgt_kind";
62193#endif /* FREECIV_JSON_CONNECTION */
62194 {
62195 int readin;
62196
62197 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62198 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_kind);
62199 }
62200 real_packet->sub_tgt_kind = readin;
62201 }
62202#ifdef FREECIV_JSON_CONNECTION
62203 field_addr.name = "min_distance";
62204#endif /* FREECIV_JSON_CONNECTION */
62205 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_distance)) {
62206 RECEIVE_PACKET_FIELD_ERROR(min_distance);
62207 }
62208#ifdef FREECIV_JSON_CONNECTION
62209 field_addr.name = "max_distance";
62210#endif /* FREECIV_JSON_CONNECTION */
62211 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_distance)) {
62212 RECEIVE_PACKET_FIELD_ERROR(max_distance);
62213 }
62214#ifdef FREECIV_JSON_CONNECTION
62215 field_addr.name = "blocked_by";
62216#endif /* FREECIV_JSON_CONNECTION */
62217 if (!DIO_BV_GET(&din, &field_addr, real_packet->blocked_by)) {
62218 RECEIVE_PACKET_FIELD_ERROR(blocked_by);
62219 }
62220#endif
62221 log_packet_detailed("packet_ruleset_action_100: got info about ()");
62222
62223#ifdef FREECIV_DELTA_PROTOCOL
62224 if (NULL == *hash) {
62225 *hash = genhash_new_full(hash_packet_ruleset_action_100, cmp_packet_ruleset_action_100,
62226 NULL, NULL, NULL, free);
62227 }
62228
62229 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
62230 *real_packet = *old;
62231 } else {
62232 log_packet_detailed(" no old info");
62233 memset(real_packet, 0, sizeof(*real_packet));
62234 }
62235
62236 if (BV_ISSET(fields, 0)) {
62237 log_packet_detailed(" got field 'id'");
62238#ifdef FREECIV_JSON_CONNECTION
62239 field_addr.name = "id";
62240#endif /* FREECIV_JSON_CONNECTION */
62241 {
62242 int readin;
62243
62244 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62245 RECEIVE_PACKET_FIELD_ERROR(id);
62246 }
62247 real_packet->id = readin;
62248 }
62249 }
62250 if (BV_ISSET(fields, 1)) {
62251 log_packet_detailed(" got field 'ui_name'");
62252#ifdef FREECIV_JSON_CONNECTION
62253 field_addr.name = "ui_name";
62254#endif /* FREECIV_JSON_CONNECTION */
62255 if (!DIO_GET(string, &din, &field_addr, real_packet->ui_name, sizeof(real_packet->ui_name))) {
62256 RECEIVE_PACKET_FIELD_ERROR(ui_name);
62257 }
62258 }
62259 real_packet->quiet = BV_ISSET(fields, 2);
62260 if (BV_ISSET(fields, 3)) {
62261 log_packet_detailed(" got field 'result'");
62262#ifdef FREECIV_JSON_CONNECTION
62263 field_addr.name = "result";
62264#endif /* FREECIV_JSON_CONNECTION */
62265 {
62266 int readin;
62267
62268 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62269 RECEIVE_PACKET_FIELD_ERROR(result);
62270 }
62271 real_packet->result = readin;
62272 }
62273 }
62274 if (BV_ISSET(fields, 4)) {
62275 log_packet_detailed(" got field 'sub_results'");
62276#ifdef FREECIV_JSON_CONNECTION
62277 field_addr.name = "sub_results";
62278#endif /* FREECIV_JSON_CONNECTION */
62279 if (!DIO_BV_GET(&din, &field_addr, real_packet->sub_results)) {
62280 RECEIVE_PACKET_FIELD_ERROR(sub_results);
62281 }
62282 }
62283 real_packet->actor_consuming_always = BV_ISSET(fields, 5);
62284 if (BV_ISSET(fields, 6)) {
62285 log_packet_detailed(" got field 'act_kind'");
62286#ifdef FREECIV_JSON_CONNECTION
62287 field_addr.name = "act_kind";
62288#endif /* FREECIV_JSON_CONNECTION */
62289 {
62290 int readin;
62291
62292 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62293 RECEIVE_PACKET_FIELD_ERROR(act_kind);
62294 }
62295 real_packet->act_kind = readin;
62296 }
62297 }
62298 if (BV_ISSET(fields, 7)) {
62299 log_packet_detailed(" got field 'tgt_kind'");
62300#ifdef FREECIV_JSON_CONNECTION
62301 field_addr.name = "tgt_kind";
62302#endif /* FREECIV_JSON_CONNECTION */
62303 {
62304 int readin;
62305
62306 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62307 RECEIVE_PACKET_FIELD_ERROR(tgt_kind);
62308 }
62309 real_packet->tgt_kind = readin;
62310 }
62311 }
62312 if (BV_ISSET(fields, 8)) {
62313 log_packet_detailed(" got field 'sub_tgt_kind'");
62314#ifdef FREECIV_JSON_CONNECTION
62315 field_addr.name = "sub_tgt_kind";
62316#endif /* FREECIV_JSON_CONNECTION */
62317 {
62318 int readin;
62319
62320 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62321 RECEIVE_PACKET_FIELD_ERROR(sub_tgt_kind);
62322 }
62323 real_packet->sub_tgt_kind = readin;
62324 }
62325 }
62326 if (BV_ISSET(fields, 9)) {
62327 log_packet_detailed(" got field 'min_distance'");
62328#ifdef FREECIV_JSON_CONNECTION
62329 field_addr.name = "min_distance";
62330#endif /* FREECIV_JSON_CONNECTION */
62331 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_distance)) {
62332 RECEIVE_PACKET_FIELD_ERROR(min_distance);
62333 }
62334 }
62335 if (BV_ISSET(fields, 10)) {
62336 log_packet_detailed(" got field 'max_distance'");
62337#ifdef FREECIV_JSON_CONNECTION
62338 field_addr.name = "max_distance";
62339#endif /* FREECIV_JSON_CONNECTION */
62340 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_distance)) {
62341 RECEIVE_PACKET_FIELD_ERROR(max_distance);
62342 }
62343 }
62344 if (BV_ISSET(fields, 11)) {
62345 log_packet_detailed(" got field 'blocked_by'");
62346#ifdef FREECIV_JSON_CONNECTION
62347 field_addr.name = "blocked_by";
62348#endif /* FREECIV_JSON_CONNECTION */
62349 if (!DIO_BV_GET(&din, &field_addr, real_packet->blocked_by)) {
62350 RECEIVE_PACKET_FIELD_ERROR(blocked_by);
62351 }
62352 }
62353
62354 if (NULL == old) {
62355 old = fc_malloc(sizeof(*old));
62356 *old = *real_packet;
62357 genhash_insert(*hash, old, old);
62358 } else {
62359 *old = *real_packet;
62360 }
62361
62362#endif /* FREECIV_DELTA_PROTOCOL */
62363 RECEIVE_PACKET_END(real_packet);
62364}
62365
62366 static int send_packet_ruleset_action_100(struct connection *pc, const struct packet_ruleset_action *packet)
62367{
62368 const struct packet_ruleset_action *real_packet = packet;
62369 int e;
62370#ifdef FREECIV_DELTA_PROTOCOL
62371 packet_ruleset_action_100_fields fields;
62372 struct packet_ruleset_action *old;
62373 bool differ;
62374 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION;
62375#endif /* FREECIV_DELTA_PROTOCOL */
62376 SEND_PACKET_START(PACKET_RULESET_ACTION);
62377#ifdef FREECIV_JSON_CONNECTION
62378 struct plocation field_addr;
62379 {
62380 struct plocation *field_addr_tmp = plocation_field_new(NULL);
62381 field_addr = *field_addr_tmp;
62382 FC_FREE(field_addr_tmp);
62383 }
62384#endif /* FREECIV_JSON_CONNECTION */
62385
62386 log_packet_detailed("packet_ruleset_action_100: sending info about ()");
62387
62388#ifdef FREECIV_DELTA_PROTOCOL
62389 if (NULL == *hash) {
62390 *hash = genhash_new_full(hash_packet_ruleset_action_100, cmp_packet_ruleset_action_100,
62391 NULL, NULL, NULL, free);
62392 }
62393 BV_CLR_ALL(fields);
62394
62395 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
62396 old = fc_malloc(sizeof(*old));
62397 *old = *real_packet;
62398 genhash_insert(*hash, old, old);
62399 memset(old, 0, sizeof(*old));
62400 }
62401 differ = (old->id != real_packet->id);
62402 if (differ) {
62403 BV_SET(fields, 0);
62404 }
62405
62406 differ = (strcmp(old->ui_name, real_packet->ui_name) != 0);
62407 if (differ) {
62408 BV_SET(fields, 1);
62409 }
62410
62411 if (packet->quiet) {
62412 BV_SET(fields, 2);
62413 }
62414
62415 differ = (old->result != real_packet->result);
62416 if (differ) {
62417 BV_SET(fields, 3);
62418 }
62419
62420 differ = !BV_ARE_EQUAL(old->sub_results, real_packet->sub_results);
62421 if (differ) {
62422 BV_SET(fields, 4);
62423 }
62424
62425 if (packet->actor_consuming_always) {
62426 BV_SET(fields, 5);
62427 }
62428
62429 differ = (old->act_kind != real_packet->act_kind);
62430 if (differ) {
62431 BV_SET(fields, 6);
62432 }
62433
62434 differ = (old->tgt_kind != real_packet->tgt_kind);
62435 if (differ) {
62436 BV_SET(fields, 7);
62437 }
62438
62439 differ = (old->sub_tgt_kind != real_packet->sub_tgt_kind);
62440 if (differ) {
62441 BV_SET(fields, 8);
62442 }
62443
62444 differ = (old->min_distance != real_packet->min_distance);
62445 if (differ) {
62446 BV_SET(fields, 9);
62447 }
62448
62449 differ = (old->max_distance != real_packet->max_distance);
62450 if (differ) {
62451 BV_SET(fields, 10);
62452 }
62453
62454 differ = !BV_ARE_EQUAL(old->blocked_by, real_packet->blocked_by);
62455 if (differ) {
62456 BV_SET(fields, 11);
62457 }
62458
62459
62460#ifdef FREECIV_JSON_CONNECTION
62461 field_addr.name = "fields";
62462#endif /* FREECIV_JSON_CONNECTION */
62463 e = 0;
62464 e |= DIO_BV_PUT(&dout, &field_addr, fields);
62465 if (e) {
62466 log_packet_detailed("fields bitvector error detected");
62467 }
62468
62469 if (BV_ISSET(fields, 0)) {
62470 log_packet_detailed(" field 'id' has changed");
62471#ifdef FREECIV_JSON_CONNECTION
62472 field_addr.name = "id";
62473#endif /* FREECIV_JSON_CONNECTION */
62474 e = 0;
62475 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
62476 if (e) {
62477 log_packet_detailed("'id' field error detected");
62478 }
62479 }
62480 if (BV_ISSET(fields, 1)) {
62481 log_packet_detailed(" field 'ui_name' has changed");
62482#ifdef FREECIV_JSON_CONNECTION
62483 field_addr.name = "ui_name";
62484#endif /* FREECIV_JSON_CONNECTION */
62485 e = 0;
62486 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ui_name);
62487 if (e) {
62488 log_packet_detailed("'ui_name' field error detected");
62489 }
62490 }
62491 /* field 2 is folded into the header */
62492 if (BV_ISSET(fields, 3)) {
62493 log_packet_detailed(" field 'result' has changed");
62494#ifdef FREECIV_JSON_CONNECTION
62495 field_addr.name = "result";
62496#endif /* FREECIV_JSON_CONNECTION */
62497 e = 0;
62498 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->result);
62499 if (e) {
62500 log_packet_detailed("'result' field error detected");
62501 }
62502 }
62503 if (BV_ISSET(fields, 4)) {
62504 log_packet_detailed(" field 'sub_results' has changed");
62505#ifdef FREECIV_JSON_CONNECTION
62506 field_addr.name = "sub_results";
62507#endif /* FREECIV_JSON_CONNECTION */
62508 e = 0;
62509 e |= DIO_BV_PUT(&dout, &field_addr, packet->sub_results);
62510 if (e) {
62511 log_packet_detailed("'sub_results' field error detected");
62512 }
62513 }
62514 /* field 5 is folded into the header */
62515 if (BV_ISSET(fields, 6)) {
62516 log_packet_detailed(" field 'act_kind' has changed");
62517#ifdef FREECIV_JSON_CONNECTION
62518 field_addr.name = "act_kind";
62519#endif /* FREECIV_JSON_CONNECTION */
62520 e = 0;
62521 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_kind);
62522 if (e) {
62523 log_packet_detailed("'act_kind' field error detected");
62524 }
62525 }
62526 if (BV_ISSET(fields, 7)) {
62527 log_packet_detailed(" field 'tgt_kind' has changed");
62528#ifdef FREECIV_JSON_CONNECTION
62529 field_addr.name = "tgt_kind";
62530#endif /* FREECIV_JSON_CONNECTION */
62531 e = 0;
62532 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tgt_kind);
62533 if (e) {
62534 log_packet_detailed("'tgt_kind' field error detected");
62535 }
62536 }
62537 if (BV_ISSET(fields, 8)) {
62538 log_packet_detailed(" field 'sub_tgt_kind' has changed");
62539#ifdef FREECIV_JSON_CONNECTION
62540 field_addr.name = "sub_tgt_kind";
62541#endif /* FREECIV_JSON_CONNECTION */
62542 e = 0;
62543 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sub_tgt_kind);
62544 if (e) {
62545 log_packet_detailed("'sub_tgt_kind' field error detected");
62546 }
62547 }
62548 if (BV_ISSET(fields, 9)) {
62549 log_packet_detailed(" field 'min_distance' has changed");
62550#ifdef FREECIV_JSON_CONNECTION
62551 field_addr.name = "min_distance";
62552#endif /* FREECIV_JSON_CONNECTION */
62553 e = 0;
62554 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_distance);
62555 if (e) {
62556 log_packet_detailed("'min_distance' field error detected");
62557 }
62558 }
62559 if (BV_ISSET(fields, 10)) {
62560 log_packet_detailed(" field 'max_distance' has changed");
62561#ifdef FREECIV_JSON_CONNECTION
62562 field_addr.name = "max_distance";
62563#endif /* FREECIV_JSON_CONNECTION */
62564 e = 0;
62565 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_distance);
62566 if (e) {
62567 log_packet_detailed("'max_distance' field error detected");
62568 }
62569 }
62570 if (BV_ISSET(fields, 11)) {
62571 log_packet_detailed(" field 'blocked_by' has changed");
62572#ifdef FREECIV_JSON_CONNECTION
62573 field_addr.name = "blocked_by";
62574#endif /* FREECIV_JSON_CONNECTION */
62575 e = 0;
62576 e |= DIO_BV_PUT(&dout, &field_addr, packet->blocked_by);
62577 if (e) {
62578 log_packet_detailed("'blocked_by' field error detected");
62579 }
62580 }
62581
62582 *old = *real_packet;
62583#endif /* FREECIV_DELTA_PROTOCOL */
62584#ifndef FREECIV_DELTA_PROTOCOL
62585#ifdef FREECIV_JSON_CONNECTION
62586 field_addr.name = "id";
62587#endif /* FREECIV_JSON_CONNECTION */
62588 e = 0;
62589 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
62590 if (e) {
62591 log_packet_detailed("'id' field error detected");
62592 }
62593#ifdef FREECIV_JSON_CONNECTION
62594 field_addr.name = "ui_name";
62595#endif /* FREECIV_JSON_CONNECTION */
62596 e = 0;
62597 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ui_name);
62598 if (e) {
62599 log_packet_detailed("'ui_name' field error detected");
62600 }
62601#ifdef FREECIV_JSON_CONNECTION
62602 field_addr.name = "quiet";
62603#endif /* FREECIV_JSON_CONNECTION */
62604 e = 0;
62605 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->quiet);
62606 if (e) {
62607 log_packet_detailed("'quiet' field error detected");
62608 }
62609#ifdef FREECIV_JSON_CONNECTION
62610 field_addr.name = "result";
62611#endif /* FREECIV_JSON_CONNECTION */
62612 e = 0;
62613 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->result);
62614 if (e) {
62615 log_packet_detailed("'result' field error detected");
62616 }
62617#ifdef FREECIV_JSON_CONNECTION
62618 field_addr.name = "sub_results";
62619#endif /* FREECIV_JSON_CONNECTION */
62620 e = 0;
62621 e |= DIO_BV_PUT(&dout, &field_addr, packet->sub_results);
62622 if (e) {
62623 log_packet_detailed("'sub_results' field error detected");
62624 }
62625#ifdef FREECIV_JSON_CONNECTION
62626 field_addr.name = "actor_consuming_always";
62627#endif /* FREECIV_JSON_CONNECTION */
62628 e = 0;
62629 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->actor_consuming_always);
62630 if (e) {
62631 log_packet_detailed("'actor_consuming_always' field error detected");
62632 }
62633#ifdef FREECIV_JSON_CONNECTION
62634 field_addr.name = "act_kind";
62635#endif /* FREECIV_JSON_CONNECTION */
62636 e = 0;
62637 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->act_kind);
62638 if (e) {
62639 log_packet_detailed("'act_kind' field error detected");
62640 }
62641#ifdef FREECIV_JSON_CONNECTION
62642 field_addr.name = "tgt_kind";
62643#endif /* FREECIV_JSON_CONNECTION */
62644 e = 0;
62645 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tgt_kind);
62646 if (e) {
62647 log_packet_detailed("'tgt_kind' field error detected");
62648 }
62649#ifdef FREECIV_JSON_CONNECTION
62650 field_addr.name = "sub_tgt_kind";
62651#endif /* FREECIV_JSON_CONNECTION */
62652 e = 0;
62653 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->sub_tgt_kind);
62654 if (e) {
62655 log_packet_detailed("'sub_tgt_kind' field error detected");
62656 }
62657#ifdef FREECIV_JSON_CONNECTION
62658 field_addr.name = "min_distance";
62659#endif /* FREECIV_JSON_CONNECTION */
62660 e = 0;
62661 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_distance);
62662 if (e) {
62663 log_packet_detailed("'min_distance' field error detected");
62664 }
62665#ifdef FREECIV_JSON_CONNECTION
62666 field_addr.name = "max_distance";
62667#endif /* FREECIV_JSON_CONNECTION */
62668 e = 0;
62669 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_distance);
62670 if (e) {
62671 log_packet_detailed("'max_distance' field error detected");
62672 }
62673#ifdef FREECIV_JSON_CONNECTION
62674 field_addr.name = "blocked_by";
62675#endif /* FREECIV_JSON_CONNECTION */
62676 e = 0;
62677 e |= DIO_BV_PUT(&dout, &field_addr, packet->blocked_by);
62678 if (e) {
62679 log_packet_detailed("'blocked_by' field error detected");
62680 }
62681
62682#endif
62683 SEND_PACKET_END(PACKET_RULESET_ACTION);
62684}
62685
62686 int send_packet_ruleset_action(struct connection *pc, const struct packet_ruleset_action *packet)
62687{
62688 if (!pc->used) {
62689 log_error("WARNING: trying to send data to the closed connection %s",
62690 conn_description(pc));
62691 return -1;
62692 }
62693 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION].packet != NULL, -1,
62694 "Handler for PACKET_RULESET_ACTION not installed");
62695 return pc->phs.handlers->send[PACKET_RULESET_ACTION].packet(pc, packet);
62696}
62697
62698 void lsend_packet_ruleset_action(struct conn_list *dest, const struct packet_ruleset_action *packet)
62699{
62700 conn_list_iterate(dest, pconn) {
62701 send_packet_ruleset_action(pconn, packet);
62702 } conn_list_iterate_end;
62703}
62704
62705#ifdef FREECIV_DELTA_PROTOCOL
62706#define hash_packet_ruleset_action_enabler_100 hash_const
62707
62708#define cmp_packet_ruleset_action_enabler_100 cmp_const
62709
62710 BV_DEFINE(packet_ruleset_action_enabler_100_fields, 5);
62711#endif /* FREECIV_DELTA_PROTOCOL */
62712
62713 static struct packet_ruleset_action_enabler *receive_packet_ruleset_action_enabler_100(struct connection *pc)
62714{
62715#ifdef FREECIV_DELTA_PROTOCOL
62716 packet_ruleset_action_enabler_100_fields fields;
62717 struct packet_ruleset_action_enabler *old;
62718 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION_ENABLER;
62719#endif /* FREECIV_DELTA_PROTOCOL */
62720 RECEIVE_PACKET_START(packet_ruleset_action_enabler, real_packet);
62721#ifdef FREECIV_JSON_CONNECTION
62722 struct plocation field_addr;
62723 {
62724 struct plocation *field_addr_tmp = plocation_field_new(NULL);
62725 field_addr = *field_addr_tmp;
62726 FC_FREE(field_addr_tmp);
62727 }
62728#endif /* FREECIV_JSON_CONNECTION */
62729
62730#ifdef FREECIV_DELTA_PROTOCOL
62731#ifdef FREECIV_JSON_CONNECTION
62732 field_addr.name = "fields";
62733#endif /* FREECIV_JSON_CONNECTION */
62734 DIO_BV_GET(&din, &field_addr, fields);
62735
62736#else /* FREECIV_DELTA_PROTOCOL */
62737#ifdef FREECIV_JSON_CONNECTION
62738 field_addr.name = "enabled_action";
62739#endif /* FREECIV_JSON_CONNECTION */
62740 {
62741 int readin;
62742
62743 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62744 RECEIVE_PACKET_FIELD_ERROR(enabled_action);
62745 }
62746 real_packet->enabled_action = readin;
62747 }
62748#ifdef FREECIV_JSON_CONNECTION
62749 field_addr.name = "actor_reqs_count";
62750#endif /* FREECIV_JSON_CONNECTION */
62751 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->actor_reqs_count)) {
62752 RECEIVE_PACKET_FIELD_ERROR(actor_reqs_count);
62753 }
62754#ifdef FREECIV_JSON_CONNECTION
62755 field_addr.name = "actor_reqs";
62756#endif /* FREECIV_JSON_CONNECTION */
62757 {
62758 int i;
62759
62760#ifdef FREECIV_JSON_CONNECTION
62761 /* Enter array. */
62762 field_addr.sub_location = plocation_elem_new(0);
62763#endif /* FREECIV_JSON_CONNECTION */
62764
62765 if (real_packet->actor_reqs_count > MAX_NUM_REQS) {
62766 RECEIVE_PACKET_FIELD_ERROR(actor_reqs, ": truncation array");
62767 }
62768 for (i = 0; i < real_packet->actor_reqs_count; i++) {
62769#ifdef FREECIV_JSON_CONNECTION
62770 field_addr.sub_location->number = i;
62771#endif /* FREECIV_JSON_CONNECTION */
62772 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->actor_reqs[i])) {
62773 RECEIVE_PACKET_FIELD_ERROR(actor_reqs);
62774 }
62775 }
62776
62777#ifdef FREECIV_JSON_CONNECTION
62778 /* Exit array. */
62779 FC_FREE(field_addr.sub_location);
62780#endif /* FREECIV_JSON_CONNECTION */
62781 }
62782#ifdef FREECIV_JSON_CONNECTION
62783 field_addr.name = "target_reqs_count";
62784#endif /* FREECIV_JSON_CONNECTION */
62785 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->target_reqs_count)) {
62786 RECEIVE_PACKET_FIELD_ERROR(target_reqs_count);
62787 }
62788#ifdef FREECIV_JSON_CONNECTION
62789 field_addr.name = "target_reqs";
62790#endif /* FREECIV_JSON_CONNECTION */
62791 {
62792 int i;
62793
62794#ifdef FREECIV_JSON_CONNECTION
62795 /* Enter array. */
62796 field_addr.sub_location = plocation_elem_new(0);
62797#endif /* FREECIV_JSON_CONNECTION */
62798
62799 if (real_packet->target_reqs_count > MAX_NUM_REQS) {
62800 RECEIVE_PACKET_FIELD_ERROR(target_reqs, ": truncation array");
62801 }
62802 for (i = 0; i < real_packet->target_reqs_count; i++) {
62803#ifdef FREECIV_JSON_CONNECTION
62804 field_addr.sub_location->number = i;
62805#endif /* FREECIV_JSON_CONNECTION */
62806 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->target_reqs[i])) {
62807 RECEIVE_PACKET_FIELD_ERROR(target_reqs);
62808 }
62809 }
62810
62811#ifdef FREECIV_JSON_CONNECTION
62812 /* Exit array. */
62813 FC_FREE(field_addr.sub_location);
62814#endif /* FREECIV_JSON_CONNECTION */
62815 }
62816#endif
62817 log_packet_detailed("packet_ruleset_action_enabler_100: got info about ()");
62818
62819#ifdef FREECIV_DELTA_PROTOCOL
62820 if (NULL == *hash) {
62821 *hash = genhash_new_full(hash_packet_ruleset_action_enabler_100, cmp_packet_ruleset_action_enabler_100,
62822 NULL, NULL, NULL, free);
62823 }
62824
62825 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
62826 *real_packet = *old;
62827 } else {
62828 log_packet_detailed(" no old info");
62829 memset(real_packet, 0, sizeof(*real_packet));
62830 }
62831
62832 if (BV_ISSET(fields, 0)) {
62833 log_packet_detailed(" got field 'enabled_action'");
62834#ifdef FREECIV_JSON_CONNECTION
62835 field_addr.name = "enabled_action";
62836#endif /* FREECIV_JSON_CONNECTION */
62837 {
62838 int readin;
62839
62840 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
62841 RECEIVE_PACKET_FIELD_ERROR(enabled_action);
62842 }
62843 real_packet->enabled_action = readin;
62844 }
62845 }
62846 if (BV_ISSET(fields, 1)) {
62847 log_packet_detailed(" got field 'actor_reqs_count'");
62848#ifdef FREECIV_JSON_CONNECTION
62849 field_addr.name = "actor_reqs_count";
62850#endif /* FREECIV_JSON_CONNECTION */
62851 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->actor_reqs_count)) {
62852 RECEIVE_PACKET_FIELD_ERROR(actor_reqs_count);
62853 }
62854 }
62855 if (BV_ISSET(fields, 2)) {
62856 log_packet_detailed(" got field 'actor_reqs'");
62857#ifdef FREECIV_JSON_CONNECTION
62858 field_addr.name = "actor_reqs";
62859#endif /* FREECIV_JSON_CONNECTION */
62860 {
62861 int i;
62862
62863#ifdef FREECIV_JSON_CONNECTION
62864 /* Enter array. */
62865 field_addr.sub_location = plocation_elem_new(0);
62866#endif /* FREECIV_JSON_CONNECTION */
62867
62868 if (real_packet->actor_reqs_count > MAX_NUM_REQS) {
62869 RECEIVE_PACKET_FIELD_ERROR(actor_reqs, ": truncation array");
62870 }
62871 for (i = 0; i < real_packet->actor_reqs_count; i++) {
62872#ifdef FREECIV_JSON_CONNECTION
62873 field_addr.sub_location->number = i;
62874#endif /* FREECIV_JSON_CONNECTION */
62875 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->actor_reqs[i])) {
62876 RECEIVE_PACKET_FIELD_ERROR(actor_reqs);
62877 }
62878 }
62879
62880#ifdef FREECIV_JSON_CONNECTION
62881 /* Exit array. */
62882 FC_FREE(field_addr.sub_location);
62883#endif /* FREECIV_JSON_CONNECTION */
62884 }
62885 }
62886 if (BV_ISSET(fields, 3)) {
62887 log_packet_detailed(" got field 'target_reqs_count'");
62888#ifdef FREECIV_JSON_CONNECTION
62889 field_addr.name = "target_reqs_count";
62890#endif /* FREECIV_JSON_CONNECTION */
62891 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->target_reqs_count)) {
62892 RECEIVE_PACKET_FIELD_ERROR(target_reqs_count);
62893 }
62894 }
62895 if (BV_ISSET(fields, 4)) {
62896 log_packet_detailed(" got field 'target_reqs'");
62897#ifdef FREECIV_JSON_CONNECTION
62898 field_addr.name = "target_reqs";
62899#endif /* FREECIV_JSON_CONNECTION */
62900 {
62901 int i;
62902
62903#ifdef FREECIV_JSON_CONNECTION
62904 /* Enter array. */
62905 field_addr.sub_location = plocation_elem_new(0);
62906#endif /* FREECIV_JSON_CONNECTION */
62907
62908 if (real_packet->target_reqs_count > MAX_NUM_REQS) {
62909 RECEIVE_PACKET_FIELD_ERROR(target_reqs, ": truncation array");
62910 }
62911 for (i = 0; i < real_packet->target_reqs_count; i++) {
62912#ifdef FREECIV_JSON_CONNECTION
62913 field_addr.sub_location->number = i;
62914#endif /* FREECIV_JSON_CONNECTION */
62915 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->target_reqs[i])) {
62916 RECEIVE_PACKET_FIELD_ERROR(target_reqs);
62917 }
62918 }
62919
62920#ifdef FREECIV_JSON_CONNECTION
62921 /* Exit array. */
62922 FC_FREE(field_addr.sub_location);
62923#endif /* FREECIV_JSON_CONNECTION */
62924 }
62925 }
62926
62927 if (NULL == old) {
62928 old = fc_malloc(sizeof(*old));
62929 *old = *real_packet;
62930 genhash_insert(*hash, old, old);
62931 } else {
62932 *old = *real_packet;
62933 }
62934
62935#endif /* FREECIV_DELTA_PROTOCOL */
62936 RECEIVE_PACKET_END(real_packet);
62937}
62938
62939 static int send_packet_ruleset_action_enabler_100(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
62940{
62941 const struct packet_ruleset_action_enabler *real_packet = packet;
62942 int e;
62943#ifdef FREECIV_DELTA_PROTOCOL
62944 packet_ruleset_action_enabler_100_fields fields;
62945 struct packet_ruleset_action_enabler *old;
62946 bool differ;
62947 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION_ENABLER;
62948#endif /* FREECIV_DELTA_PROTOCOL */
62949 SEND_PACKET_START(PACKET_RULESET_ACTION_ENABLER);
62950#ifdef FREECIV_JSON_CONNECTION
62951 struct plocation field_addr;
62952 {
62953 struct plocation *field_addr_tmp = plocation_field_new(NULL);
62954 field_addr = *field_addr_tmp;
62955 FC_FREE(field_addr_tmp);
62956 }
62957#endif /* FREECIV_JSON_CONNECTION */
62958
62959 log_packet_detailed("packet_ruleset_action_enabler_100: sending info about ()");
62960
62961#ifdef FREECIV_DELTA_PROTOCOL
62962 if (NULL == *hash) {
62963 *hash = genhash_new_full(hash_packet_ruleset_action_enabler_100, cmp_packet_ruleset_action_enabler_100,
62964 NULL, NULL, NULL, free);
62965 }
62966 BV_CLR_ALL(fields);
62967
62968 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
62969 old = fc_malloc(sizeof(*old));
62970 *old = *real_packet;
62971 genhash_insert(*hash, old, old);
62972 memset(old, 0, sizeof(*old));
62973 }
62974 differ = (old->enabled_action != real_packet->enabled_action);
62975 if (differ) {
62976 BV_SET(fields, 0);
62977 }
62978
62979 differ = (old->actor_reqs_count != real_packet->actor_reqs_count);
62980 if (differ) {
62981 BV_SET(fields, 1);
62982 }
62983
62984 differ = (old->actor_reqs_count != real_packet->actor_reqs_count);
62985 if (!differ) {
62986 int i;
62987
62988 for (i = 0; i < real_packet->actor_reqs_count; i++) {
62989 differ = !are_requirements_equal(&old->actor_reqs[i], &real_packet->actor_reqs[i]);
62990 if (differ) {
62991 break;
62992 }
62993 }
62994 }
62995 if (differ) {
62996 BV_SET(fields, 2);
62997 }
62998
62999 differ = (old->target_reqs_count != real_packet->target_reqs_count);
63000 if (differ) {
63001 BV_SET(fields, 3);
63002 }
63003
63004 differ = (old->target_reqs_count != real_packet->target_reqs_count);
63005 if (!differ) {
63006 int i;
63007
63008 for (i = 0; i < real_packet->target_reqs_count; i++) {
63009 differ = !are_requirements_equal(&old->target_reqs[i], &real_packet->target_reqs[i]);
63010 if (differ) {
63011 break;
63012 }
63013 }
63014 }
63015 if (differ) {
63016 BV_SET(fields, 4);
63017 }
63018
63019
63020#ifdef FREECIV_JSON_CONNECTION
63021 field_addr.name = "fields";
63022#endif /* FREECIV_JSON_CONNECTION */
63023 e = 0;
63024 e |= DIO_BV_PUT(&dout, &field_addr, fields);
63025 if (e) {
63026 log_packet_detailed("fields bitvector error detected");
63027 }
63028
63029 if (BV_ISSET(fields, 0)) {
63030 log_packet_detailed(" field 'enabled_action' has changed");
63031#ifdef FREECIV_JSON_CONNECTION
63032 field_addr.name = "enabled_action";
63033#endif /* FREECIV_JSON_CONNECTION */
63034 e = 0;
63035 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->enabled_action);
63036 if (e) {
63037 log_packet_detailed("'enabled_action' field error detected");
63038 }
63039 }
63040 if (BV_ISSET(fields, 1)) {
63041 log_packet_detailed(" field 'actor_reqs_count' has changed");
63042#ifdef FREECIV_JSON_CONNECTION
63043 field_addr.name = "actor_reqs_count";
63044#endif /* FREECIV_JSON_CONNECTION */
63045 e = 0;
63046 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->actor_reqs_count);
63047 if (e) {
63048 log_packet_detailed("'actor_reqs_count' field error detected");
63049 }
63050 }
63051 if (BV_ISSET(fields, 2)) {
63052 log_packet_detailed(" field 'actor_reqs' has changed");
63053#ifdef FREECIV_JSON_CONNECTION
63054 field_addr.name = "actor_reqs";
63055#endif /* FREECIV_JSON_CONNECTION */
63056 e = 0;
63057 {
63058 int i;
63059
63060#ifdef FREECIV_JSON_CONNECTION
63061 /* Create the array. */
63062 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->actor_reqs_count);
63063
63064 /* Enter the array. */
63065 field_addr.sub_location = plocation_elem_new(0);
63066#endif /* FREECIV_JSON_CONNECTION */
63067
63068 for (i = 0; i < real_packet->actor_reqs_count; i++) {
63069#ifdef FREECIV_JSON_CONNECTION
63070 /* Next array element. */
63071 field_addr.sub_location->number = i;
63072#endif /* FREECIV_JSON_CONNECTION */
63073 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->actor_reqs[i]);
63074 }
63075
63076#ifdef FREECIV_JSON_CONNECTION
63077 /* Exit array. */
63078 FC_FREE(field_addr.sub_location);
63079#endif /* FREECIV_JSON_CONNECTION */
63080 }
63081 if (e) {
63082 log_packet_detailed("'actor_reqs' field error detected");
63083 }
63084 }
63085 if (BV_ISSET(fields, 3)) {
63086 log_packet_detailed(" field 'target_reqs_count' has changed");
63087#ifdef FREECIV_JSON_CONNECTION
63088 field_addr.name = "target_reqs_count";
63089#endif /* FREECIV_JSON_CONNECTION */
63090 e = 0;
63091 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->target_reqs_count);
63092 if (e) {
63093 log_packet_detailed("'target_reqs_count' field error detected");
63094 }
63095 }
63096 if (BV_ISSET(fields, 4)) {
63097 log_packet_detailed(" field 'target_reqs' has changed");
63098#ifdef FREECIV_JSON_CONNECTION
63099 field_addr.name = "target_reqs";
63100#endif /* FREECIV_JSON_CONNECTION */
63101 e = 0;
63102 {
63103 int i;
63104
63105#ifdef FREECIV_JSON_CONNECTION
63106 /* Create the array. */
63107 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->target_reqs_count);
63108
63109 /* Enter the array. */
63110 field_addr.sub_location = plocation_elem_new(0);
63111#endif /* FREECIV_JSON_CONNECTION */
63112
63113 for (i = 0; i < real_packet->target_reqs_count; i++) {
63114#ifdef FREECIV_JSON_CONNECTION
63115 /* Next array element. */
63116 field_addr.sub_location->number = i;
63117#endif /* FREECIV_JSON_CONNECTION */
63118 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->target_reqs[i]);
63119 }
63120
63121#ifdef FREECIV_JSON_CONNECTION
63122 /* Exit array. */
63123 FC_FREE(field_addr.sub_location);
63124#endif /* FREECIV_JSON_CONNECTION */
63125 }
63126 if (e) {
63127 log_packet_detailed("'target_reqs' field error detected");
63128 }
63129 }
63130
63131 *old = *real_packet;
63132#endif /* FREECIV_DELTA_PROTOCOL */
63133#ifndef FREECIV_DELTA_PROTOCOL
63134#ifdef FREECIV_JSON_CONNECTION
63135 field_addr.name = "enabled_action";
63136#endif /* FREECIV_JSON_CONNECTION */
63137 e = 0;
63138 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->enabled_action);
63139 if (e) {
63140 log_packet_detailed("'enabled_action' field error detected");
63141 }
63142#ifdef FREECIV_JSON_CONNECTION
63143 field_addr.name = "actor_reqs_count";
63144#endif /* FREECIV_JSON_CONNECTION */
63145 e = 0;
63146 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->actor_reqs_count);
63147 if (e) {
63148 log_packet_detailed("'actor_reqs_count' field error detected");
63149 }
63150#ifdef FREECIV_JSON_CONNECTION
63151 field_addr.name = "actor_reqs";
63152#endif /* FREECIV_JSON_CONNECTION */
63153 e = 0;
63154 {
63155 int i;
63156
63157#ifdef FREECIV_JSON_CONNECTION
63158 /* Create the array. */
63159 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->actor_reqs_count);
63160
63161 /* Enter the array. */
63162 field_addr.sub_location = plocation_elem_new(0);
63163#endif /* FREECIV_JSON_CONNECTION */
63164
63165 for (i = 0; i < real_packet->actor_reqs_count; i++) {
63166#ifdef FREECIV_JSON_CONNECTION
63167 /* Next array element. */
63168 field_addr.sub_location->number = i;
63169#endif /* FREECIV_JSON_CONNECTION */
63170 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->actor_reqs[i]);
63171 }
63172
63173#ifdef FREECIV_JSON_CONNECTION
63174 /* Exit array. */
63175 FC_FREE(field_addr.sub_location);
63176#endif /* FREECIV_JSON_CONNECTION */
63177 }
63178 if (e) {
63179 log_packet_detailed("'actor_reqs' field error detected");
63180 }
63181#ifdef FREECIV_JSON_CONNECTION
63182 field_addr.name = "target_reqs_count";
63183#endif /* FREECIV_JSON_CONNECTION */
63184 e = 0;
63185 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->target_reqs_count);
63186 if (e) {
63187 log_packet_detailed("'target_reqs_count' field error detected");
63188 }
63189#ifdef FREECIV_JSON_CONNECTION
63190 field_addr.name = "target_reqs";
63191#endif /* FREECIV_JSON_CONNECTION */
63192 e = 0;
63193 {
63194 int i;
63195
63196#ifdef FREECIV_JSON_CONNECTION
63197 /* Create the array. */
63198 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->target_reqs_count);
63199
63200 /* Enter the array. */
63201 field_addr.sub_location = plocation_elem_new(0);
63202#endif /* FREECIV_JSON_CONNECTION */
63203
63204 for (i = 0; i < real_packet->target_reqs_count; i++) {
63205#ifdef FREECIV_JSON_CONNECTION
63206 /* Next array element. */
63207 field_addr.sub_location->number = i;
63208#endif /* FREECIV_JSON_CONNECTION */
63209 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->target_reqs[i]);
63210 }
63211
63212#ifdef FREECIV_JSON_CONNECTION
63213 /* Exit array. */
63214 FC_FREE(field_addr.sub_location);
63215#endif /* FREECIV_JSON_CONNECTION */
63216 }
63217 if (e) {
63218 log_packet_detailed("'target_reqs' field error detected");
63219 }
63220
63221#endif
63222 SEND_PACKET_END(PACKET_RULESET_ACTION_ENABLER);
63223}
63224
63225 int send_packet_ruleset_action_enabler(struct connection *pc, const struct packet_ruleset_action_enabler *packet)
63226{
63227 if (!pc->used) {
63228 log_error("WARNING: trying to send data to the closed connection %s",
63229 conn_description(pc));
63230 return -1;
63231 }
63232 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION_ENABLER].packet != NULL, -1,
63233 "Handler for PACKET_RULESET_ACTION_ENABLER not installed");
63234 return pc->phs.handlers->send[PACKET_RULESET_ACTION_ENABLER].packet(pc, packet);
63235}
63236
63237 void lsend_packet_ruleset_action_enabler(struct conn_list *dest, const struct packet_ruleset_action_enabler *packet)
63238{
63239 conn_list_iterate(dest, pconn) {
63240 send_packet_ruleset_action_enabler(pconn, packet);
63241 } conn_list_iterate_end;
63242}
63243
63244#ifdef FREECIV_DELTA_PROTOCOL
63245#define hash_packet_ruleset_action_auto_100 hash_const
63246
63247#define cmp_packet_ruleset_action_auto_100 cmp_const
63248
63249 BV_DEFINE(packet_ruleset_action_auto_100_fields, 6);
63250#endif /* FREECIV_DELTA_PROTOCOL */
63251
63252 static struct packet_ruleset_action_auto *receive_packet_ruleset_action_auto_100(struct connection *pc)
63253{
63254#ifdef FREECIV_DELTA_PROTOCOL
63255 packet_ruleset_action_auto_100_fields fields;
63256 struct packet_ruleset_action_auto *old;
63257 struct genhash **hash = pc->phs.received + PACKET_RULESET_ACTION_AUTO;
63258#endif /* FREECIV_DELTA_PROTOCOL */
63259 RECEIVE_PACKET_START(packet_ruleset_action_auto, real_packet);
63260#ifdef FREECIV_JSON_CONNECTION
63261 struct plocation field_addr;
63262 {
63263 struct plocation *field_addr_tmp = plocation_field_new(NULL);
63264 field_addr = *field_addr_tmp;
63265 FC_FREE(field_addr_tmp);
63266 }
63267#endif /* FREECIV_JSON_CONNECTION */
63268
63269#ifdef FREECIV_DELTA_PROTOCOL
63270#ifdef FREECIV_JSON_CONNECTION
63271 field_addr.name = "fields";
63272#endif /* FREECIV_JSON_CONNECTION */
63273 DIO_BV_GET(&din, &field_addr, fields);
63274
63275#else /* FREECIV_DELTA_PROTOCOL */
63276#ifdef FREECIV_JSON_CONNECTION
63277 field_addr.name = "id";
63278#endif /* FREECIV_JSON_CONNECTION */
63279 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
63280 RECEIVE_PACKET_FIELD_ERROR(id);
63281 }
63282#ifdef FREECIV_JSON_CONNECTION
63283 field_addr.name = "cause";
63284#endif /* FREECIV_JSON_CONNECTION */
63285 {
63286 int readin;
63287
63288 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63289 RECEIVE_PACKET_FIELD_ERROR(cause);
63290 }
63291 real_packet->cause = readin;
63292 }
63293#ifdef FREECIV_JSON_CONNECTION
63294 field_addr.name = "reqs_count";
63295#endif /* FREECIV_JSON_CONNECTION */
63296 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
63297 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
63298 }
63299#ifdef FREECIV_JSON_CONNECTION
63300 field_addr.name = "reqs";
63301#endif /* FREECIV_JSON_CONNECTION */
63302 {
63303 int i;
63304
63305#ifdef FREECIV_JSON_CONNECTION
63306 /* Enter array. */
63307 field_addr.sub_location = plocation_elem_new(0);
63308#endif /* FREECIV_JSON_CONNECTION */
63309
63310 if (real_packet->reqs_count > MAX_NUM_REQS) {
63311 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
63312 }
63313 for (i = 0; i < real_packet->reqs_count; i++) {
63314#ifdef FREECIV_JSON_CONNECTION
63315 field_addr.sub_location->number = i;
63316#endif /* FREECIV_JSON_CONNECTION */
63317 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
63318 RECEIVE_PACKET_FIELD_ERROR(reqs);
63319 }
63320 }
63321
63322#ifdef FREECIV_JSON_CONNECTION
63323 /* Exit array. */
63324 FC_FREE(field_addr.sub_location);
63325#endif /* FREECIV_JSON_CONNECTION */
63326 }
63327#ifdef FREECIV_JSON_CONNECTION
63328 field_addr.name = "alternatives_count";
63329#endif /* FREECIV_JSON_CONNECTION */
63330 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->alternatives_count)) {
63331 RECEIVE_PACKET_FIELD_ERROR(alternatives_count);
63332 }
63333#ifdef FREECIV_JSON_CONNECTION
63334 field_addr.name = "alternatives";
63335#endif /* FREECIV_JSON_CONNECTION */
63336 {
63337 int i;
63338
63339#ifdef FREECIV_JSON_CONNECTION
63340 /* Enter array. */
63341 field_addr.sub_location = plocation_elem_new(0);
63342#endif /* FREECIV_JSON_CONNECTION */
63343
63344 if (real_packet->alternatives_count > MAX_NUM_ACTIONS) {
63345 RECEIVE_PACKET_FIELD_ERROR(alternatives, ": truncation array");
63346 }
63347 for (i = 0; i < real_packet->alternatives_count; i++) {
63348#ifdef FREECIV_JSON_CONNECTION
63349 field_addr.sub_location->number = i;
63350#endif /* FREECIV_JSON_CONNECTION */
63351 {
63352 int readin;
63353
63354 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63355 RECEIVE_PACKET_FIELD_ERROR(alternatives);
63356 }
63357 real_packet->alternatives[i] = readin;
63358 }
63359 }
63360
63361#ifdef FREECIV_JSON_CONNECTION
63362 /* Exit array. */
63363 FC_FREE(field_addr.sub_location);
63364#endif /* FREECIV_JSON_CONNECTION */
63365 }
63366#endif
63367 log_packet_detailed("packet_ruleset_action_auto_100: got info about ()");
63368
63369#ifdef FREECIV_DELTA_PROTOCOL
63370 if (NULL == *hash) {
63371 *hash = genhash_new_full(hash_packet_ruleset_action_auto_100, cmp_packet_ruleset_action_auto_100,
63372 NULL, NULL, NULL, free);
63373 }
63374
63375 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
63376 *real_packet = *old;
63377 } else {
63378 log_packet_detailed(" no old info");
63379 memset(real_packet, 0, sizeof(*real_packet));
63380 }
63381
63382 if (BV_ISSET(fields, 0)) {
63383 log_packet_detailed(" got field 'id'");
63384#ifdef FREECIV_JSON_CONNECTION
63385 field_addr.name = "id";
63386#endif /* FREECIV_JSON_CONNECTION */
63387 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
63388 RECEIVE_PACKET_FIELD_ERROR(id);
63389 }
63390 }
63391 if (BV_ISSET(fields, 1)) {
63392 log_packet_detailed(" got field 'cause'");
63393#ifdef FREECIV_JSON_CONNECTION
63394 field_addr.name = "cause";
63395#endif /* FREECIV_JSON_CONNECTION */
63396 {
63397 int readin;
63398
63399 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63400 RECEIVE_PACKET_FIELD_ERROR(cause);
63401 }
63402 real_packet->cause = readin;
63403 }
63404 }
63405 if (BV_ISSET(fields, 2)) {
63406 log_packet_detailed(" got field 'reqs_count'");
63407#ifdef FREECIV_JSON_CONNECTION
63408 field_addr.name = "reqs_count";
63409#endif /* FREECIV_JSON_CONNECTION */
63410 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
63411 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
63412 }
63413 }
63414 if (BV_ISSET(fields, 3)) {
63415 log_packet_detailed(" got field 'reqs'");
63416#ifdef FREECIV_JSON_CONNECTION
63417 field_addr.name = "reqs";
63418#endif /* FREECIV_JSON_CONNECTION */
63419 {
63420 int i;
63421
63422#ifdef FREECIV_JSON_CONNECTION
63423 /* Enter array. */
63424 field_addr.sub_location = plocation_elem_new(0);
63425#endif /* FREECIV_JSON_CONNECTION */
63426
63427 if (real_packet->reqs_count > MAX_NUM_REQS) {
63428 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
63429 }
63430 for (i = 0; i < real_packet->reqs_count; i++) {
63431#ifdef FREECIV_JSON_CONNECTION
63432 field_addr.sub_location->number = i;
63433#endif /* FREECIV_JSON_CONNECTION */
63434 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
63435 RECEIVE_PACKET_FIELD_ERROR(reqs);
63436 }
63437 }
63438
63439#ifdef FREECIV_JSON_CONNECTION
63440 /* Exit array. */
63441 FC_FREE(field_addr.sub_location);
63442#endif /* FREECIV_JSON_CONNECTION */
63443 }
63444 }
63445 if (BV_ISSET(fields, 4)) {
63446 log_packet_detailed(" got field 'alternatives_count'");
63447#ifdef FREECIV_JSON_CONNECTION
63448 field_addr.name = "alternatives_count";
63449#endif /* FREECIV_JSON_CONNECTION */
63450 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->alternatives_count)) {
63451 RECEIVE_PACKET_FIELD_ERROR(alternatives_count);
63452 }
63453 }
63454 if (BV_ISSET(fields, 5)) {
63455 log_packet_detailed(" got field 'alternatives'");
63456#ifdef FREECIV_JSON_CONNECTION
63457 field_addr.name = "alternatives";
63458#endif /* FREECIV_JSON_CONNECTION */
63459 {
63460 int i;
63461
63462#ifdef FREECIV_JSON_CONNECTION
63463 /* Enter array. */
63464 field_addr.sub_location = plocation_elem_new(0);
63465#endif /* FREECIV_JSON_CONNECTION */
63466
63467 if (real_packet->alternatives_count > MAX_NUM_ACTIONS) {
63468 RECEIVE_PACKET_FIELD_ERROR(alternatives, ": truncation array");
63469 }
63470 for (i = 0; i < real_packet->alternatives_count; i++) {
63471#ifdef FREECIV_JSON_CONNECTION
63472 field_addr.sub_location->number = i;
63473#endif /* FREECIV_JSON_CONNECTION */
63474 {
63475 int readin;
63476
63477 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63478 RECEIVE_PACKET_FIELD_ERROR(alternatives);
63479 }
63480 real_packet->alternatives[i] = readin;
63481 }
63482 }
63483
63484#ifdef FREECIV_JSON_CONNECTION
63485 /* Exit array. */
63486 FC_FREE(field_addr.sub_location);
63487#endif /* FREECIV_JSON_CONNECTION */
63488 }
63489 }
63490
63491 if (NULL == old) {
63492 old = fc_malloc(sizeof(*old));
63493 *old = *real_packet;
63494 genhash_insert(*hash, old, old);
63495 } else {
63496 *old = *real_packet;
63497 }
63498
63499#endif /* FREECIV_DELTA_PROTOCOL */
63500 RECEIVE_PACKET_END(real_packet);
63501}
63502
63503 static int send_packet_ruleset_action_auto_100(struct connection *pc, const struct packet_ruleset_action_auto *packet)
63504{
63505 const struct packet_ruleset_action_auto *real_packet = packet;
63506 int e;
63507#ifdef FREECIV_DELTA_PROTOCOL
63508 packet_ruleset_action_auto_100_fields fields;
63509 struct packet_ruleset_action_auto *old;
63510 bool differ;
63511 struct genhash **hash = pc->phs.sent + PACKET_RULESET_ACTION_AUTO;
63512#endif /* FREECIV_DELTA_PROTOCOL */
63513 SEND_PACKET_START(PACKET_RULESET_ACTION_AUTO);
63514#ifdef FREECIV_JSON_CONNECTION
63515 struct plocation field_addr;
63516 {
63517 struct plocation *field_addr_tmp = plocation_field_new(NULL);
63518 field_addr = *field_addr_tmp;
63519 FC_FREE(field_addr_tmp);
63520 }
63521#endif /* FREECIV_JSON_CONNECTION */
63522
63523 log_packet_detailed("packet_ruleset_action_auto_100: sending info about ()");
63524
63525#ifdef FREECIV_DELTA_PROTOCOL
63526 if (NULL == *hash) {
63527 *hash = genhash_new_full(hash_packet_ruleset_action_auto_100, cmp_packet_ruleset_action_auto_100,
63528 NULL, NULL, NULL, free);
63529 }
63530 BV_CLR_ALL(fields);
63531
63532 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
63533 old = fc_malloc(sizeof(*old));
63534 *old = *real_packet;
63535 genhash_insert(*hash, old, old);
63536 memset(old, 0, sizeof(*old));
63537 }
63538 differ = (old->id != real_packet->id);
63539 if (differ) {
63540 BV_SET(fields, 0);
63541 }
63542
63543 differ = (old->cause != real_packet->cause);
63544 if (differ) {
63545 BV_SET(fields, 1);
63546 }
63547
63548 differ = (old->reqs_count != real_packet->reqs_count);
63549 if (differ) {
63550 BV_SET(fields, 2);
63551 }
63552
63553 differ = (old->reqs_count != real_packet->reqs_count);
63554 if (!differ) {
63555 int i;
63556
63557 for (i = 0; i < real_packet->reqs_count; i++) {
63558 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
63559 if (differ) {
63560 break;
63561 }
63562 }
63563 }
63564 if (differ) {
63565 BV_SET(fields, 3);
63566 }
63567
63568 differ = (old->alternatives_count != real_packet->alternatives_count);
63569 if (differ) {
63570 BV_SET(fields, 4);
63571 }
63572
63573 differ = (old->alternatives_count != real_packet->alternatives_count);
63574 if (!differ) {
63575 int i;
63576
63577 for (i = 0; i < real_packet->alternatives_count; i++) {
63578 differ = (old->alternatives[i] != real_packet->alternatives[i]);
63579 if (differ) {
63580 break;
63581 }
63582 }
63583 }
63584 if (differ) {
63585 BV_SET(fields, 5);
63586 }
63587
63588
63589#ifdef FREECIV_JSON_CONNECTION
63590 field_addr.name = "fields";
63591#endif /* FREECIV_JSON_CONNECTION */
63592 e = 0;
63593 e |= DIO_BV_PUT(&dout, &field_addr, fields);
63594 if (e) {
63595 log_packet_detailed("fields bitvector error detected");
63596 }
63597
63598 if (BV_ISSET(fields, 0)) {
63599 log_packet_detailed(" field 'id' has changed");
63600#ifdef FREECIV_JSON_CONNECTION
63601 field_addr.name = "id";
63602#endif /* FREECIV_JSON_CONNECTION */
63603 e = 0;
63604 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
63605 if (e) {
63606 log_packet_detailed("'id' field error detected");
63607 }
63608 }
63609 if (BV_ISSET(fields, 1)) {
63610 log_packet_detailed(" field 'cause' has changed");
63611#ifdef FREECIV_JSON_CONNECTION
63612 field_addr.name = "cause";
63613#endif /* FREECIV_JSON_CONNECTION */
63614 e = 0;
63615 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cause);
63616 if (e) {
63617 log_packet_detailed("'cause' field error detected");
63618 }
63619 }
63620 if (BV_ISSET(fields, 2)) {
63621 log_packet_detailed(" field 'reqs_count' has changed");
63622#ifdef FREECIV_JSON_CONNECTION
63623 field_addr.name = "reqs_count";
63624#endif /* FREECIV_JSON_CONNECTION */
63625 e = 0;
63626 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
63627 if (e) {
63628 log_packet_detailed("'reqs_count' field error detected");
63629 }
63630 }
63631 if (BV_ISSET(fields, 3)) {
63632 log_packet_detailed(" field 'reqs' has changed");
63633#ifdef FREECIV_JSON_CONNECTION
63634 field_addr.name = "reqs";
63635#endif /* FREECIV_JSON_CONNECTION */
63636 e = 0;
63637 {
63638 int i;
63639
63640#ifdef FREECIV_JSON_CONNECTION
63641 /* Create the array. */
63642 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
63643
63644 /* Enter the array. */
63645 field_addr.sub_location = plocation_elem_new(0);
63646#endif /* FREECIV_JSON_CONNECTION */
63647
63648 for (i = 0; i < real_packet->reqs_count; i++) {
63649#ifdef FREECIV_JSON_CONNECTION
63650 /* Next array element. */
63651 field_addr.sub_location->number = i;
63652#endif /* FREECIV_JSON_CONNECTION */
63653 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
63654 }
63655
63656#ifdef FREECIV_JSON_CONNECTION
63657 /* Exit array. */
63658 FC_FREE(field_addr.sub_location);
63659#endif /* FREECIV_JSON_CONNECTION */
63660 }
63661 if (e) {
63662 log_packet_detailed("'reqs' field error detected");
63663 }
63664 }
63665 if (BV_ISSET(fields, 4)) {
63666 log_packet_detailed(" field 'alternatives_count' has changed");
63667#ifdef FREECIV_JSON_CONNECTION
63668 field_addr.name = "alternatives_count";
63669#endif /* FREECIV_JSON_CONNECTION */
63670 e = 0;
63671 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives_count);
63672 if (e) {
63673 log_packet_detailed("'alternatives_count' field error detected");
63674 }
63675 }
63676 if (BV_ISSET(fields, 5)) {
63677 log_packet_detailed(" field 'alternatives' has changed");
63678#ifdef FREECIV_JSON_CONNECTION
63679 field_addr.name = "alternatives";
63680#endif /* FREECIV_JSON_CONNECTION */
63681 e = 0;
63682 {
63683 int i;
63684
63685#ifdef FREECIV_JSON_CONNECTION
63686 /* Create the array. */
63687 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->alternatives_count);
63688
63689 /* Enter the array. */
63690 field_addr.sub_location = plocation_elem_new(0);
63691#endif /* FREECIV_JSON_CONNECTION */
63692
63693 for (i = 0; i < real_packet->alternatives_count; i++) {
63694#ifdef FREECIV_JSON_CONNECTION
63695 /* Next array element. */
63696 field_addr.sub_location->number = i;
63697#endif /* FREECIV_JSON_CONNECTION */
63698 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives[i]);
63699 }
63700
63701#ifdef FREECIV_JSON_CONNECTION
63702 /* Exit array. */
63703 FC_FREE(field_addr.sub_location);
63704#endif /* FREECIV_JSON_CONNECTION */
63705 }
63706 if (e) {
63707 log_packet_detailed("'alternatives' field error detected");
63708 }
63709 }
63710
63711 *old = *real_packet;
63712#endif /* FREECIV_DELTA_PROTOCOL */
63713#ifndef FREECIV_DELTA_PROTOCOL
63714#ifdef FREECIV_JSON_CONNECTION
63715 field_addr.name = "id";
63716#endif /* FREECIV_JSON_CONNECTION */
63717 e = 0;
63718 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
63719 if (e) {
63720 log_packet_detailed("'id' field error detected");
63721 }
63722#ifdef FREECIV_JSON_CONNECTION
63723 field_addr.name = "cause";
63724#endif /* FREECIV_JSON_CONNECTION */
63725 e = 0;
63726 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->cause);
63727 if (e) {
63728 log_packet_detailed("'cause' field error detected");
63729 }
63730#ifdef FREECIV_JSON_CONNECTION
63731 field_addr.name = "reqs_count";
63732#endif /* FREECIV_JSON_CONNECTION */
63733 e = 0;
63734 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
63735 if (e) {
63736 log_packet_detailed("'reqs_count' field error detected");
63737 }
63738#ifdef FREECIV_JSON_CONNECTION
63739 field_addr.name = "reqs";
63740#endif /* FREECIV_JSON_CONNECTION */
63741 e = 0;
63742 {
63743 int i;
63744
63745#ifdef FREECIV_JSON_CONNECTION
63746 /* Create the array. */
63747 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
63748
63749 /* Enter the array. */
63750 field_addr.sub_location = plocation_elem_new(0);
63751#endif /* FREECIV_JSON_CONNECTION */
63752
63753 for (i = 0; i < real_packet->reqs_count; i++) {
63754#ifdef FREECIV_JSON_CONNECTION
63755 /* Next array element. */
63756 field_addr.sub_location->number = i;
63757#endif /* FREECIV_JSON_CONNECTION */
63758 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
63759 }
63760
63761#ifdef FREECIV_JSON_CONNECTION
63762 /* Exit array. */
63763 FC_FREE(field_addr.sub_location);
63764#endif /* FREECIV_JSON_CONNECTION */
63765 }
63766 if (e) {
63767 log_packet_detailed("'reqs' field error detected");
63768 }
63769#ifdef FREECIV_JSON_CONNECTION
63770 field_addr.name = "alternatives_count";
63771#endif /* FREECIV_JSON_CONNECTION */
63772 e = 0;
63773 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives_count);
63774 if (e) {
63775 log_packet_detailed("'alternatives_count' field error detected");
63776 }
63777#ifdef FREECIV_JSON_CONNECTION
63778 field_addr.name = "alternatives";
63779#endif /* FREECIV_JSON_CONNECTION */
63780 e = 0;
63781 {
63782 int i;
63783
63784#ifdef FREECIV_JSON_CONNECTION
63785 /* Create the array. */
63786 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->alternatives_count);
63787
63788 /* Enter the array. */
63789 field_addr.sub_location = plocation_elem_new(0);
63790#endif /* FREECIV_JSON_CONNECTION */
63791
63792 for (i = 0; i < real_packet->alternatives_count; i++) {
63793#ifdef FREECIV_JSON_CONNECTION
63794 /* Next array element. */
63795 field_addr.sub_location->number = i;
63796#endif /* FREECIV_JSON_CONNECTION */
63797 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->alternatives[i]);
63798 }
63799
63800#ifdef FREECIV_JSON_CONNECTION
63801 /* Exit array. */
63802 FC_FREE(field_addr.sub_location);
63803#endif /* FREECIV_JSON_CONNECTION */
63804 }
63805 if (e) {
63806 log_packet_detailed("'alternatives' field error detected");
63807 }
63808
63809#endif
63810 SEND_PACKET_END(PACKET_RULESET_ACTION_AUTO);
63811}
63812
63813 int send_packet_ruleset_action_auto(struct connection *pc, const struct packet_ruleset_action_auto *packet)
63814{
63815 if (!pc->used) {
63816 log_error("WARNING: trying to send data to the closed connection %s",
63817 conn_description(pc));
63818 return -1;
63819 }
63820 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_ACTION_AUTO].packet != NULL, -1,
63821 "Handler for PACKET_RULESET_ACTION_AUTO not installed");
63822 return pc->phs.handlers->send[PACKET_RULESET_ACTION_AUTO].packet(pc, packet);
63823}
63824
63825 void lsend_packet_ruleset_action_auto(struct conn_list *dest, const struct packet_ruleset_action_auto *packet)
63826{
63827 conn_list_iterate(dest, pconn) {
63828 send_packet_ruleset_action_auto(pconn, packet);
63829 } conn_list_iterate_end;
63830}
63831
63832#ifdef FREECIV_DELTA_PROTOCOL
63833#define hash_packet_ruleset_counter_100 hash_const
63834
63835#define cmp_packet_ruleset_counter_100 cmp_const
63836
63837 BV_DEFINE(packet_ruleset_counter_100_fields, 7);
63838#endif /* FREECIV_DELTA_PROTOCOL */
63839
63840 static struct packet_ruleset_counter *receive_packet_ruleset_counter_100(struct connection *pc)
63841{
63842#ifdef FREECIV_DELTA_PROTOCOL
63843 packet_ruleset_counter_100_fields fields;
63844 struct packet_ruleset_counter *old;
63845 struct genhash **hash = pc->phs.received + PACKET_RULESET_COUNTER;
63846#endif /* FREECIV_DELTA_PROTOCOL */
63847 RECEIVE_PACKET_START(packet_ruleset_counter, real_packet);
63848#ifdef FREECIV_JSON_CONNECTION
63849 struct plocation field_addr;
63850 {
63851 struct plocation *field_addr_tmp = plocation_field_new(NULL);
63852 field_addr = *field_addr_tmp;
63853 FC_FREE(field_addr_tmp);
63854 }
63855#endif /* FREECIV_JSON_CONNECTION */
63856
63857#ifdef FREECIV_DELTA_PROTOCOL
63858#ifdef FREECIV_JSON_CONNECTION
63859 field_addr.name = "fields";
63860#endif /* FREECIV_JSON_CONNECTION */
63861 DIO_BV_GET(&din, &field_addr, fields);
63862
63863#else /* FREECIV_DELTA_PROTOCOL */
63864#ifdef FREECIV_JSON_CONNECTION
63865 field_addr.name = "name";
63866#endif /* FREECIV_JSON_CONNECTION */
63867 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
63868 RECEIVE_PACKET_FIELD_ERROR(name);
63869 }
63870#ifdef FREECIV_JSON_CONNECTION
63871 field_addr.name = "rule_name";
63872#endif /* FREECIV_JSON_CONNECTION */
63873 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
63874 RECEIVE_PACKET_FIELD_ERROR(rule_name);
63875 }
63876#ifdef FREECIV_JSON_CONNECTION
63877 field_addr.name = "helptext";
63878#endif /* FREECIV_JSON_CONNECTION */
63879 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
63880 RECEIVE_PACKET_FIELD_ERROR(helptext);
63881 }
63882#ifdef FREECIV_JSON_CONNECTION
63883 field_addr.name = "def";
63884#endif /* FREECIV_JSON_CONNECTION */
63885 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->def)) {
63886 RECEIVE_PACKET_FIELD_ERROR(def);
63887 }
63888#ifdef FREECIV_JSON_CONNECTION
63889 field_addr.name = "checkpoint";
63890#endif /* FREECIV_JSON_CONNECTION */
63891 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->checkpoint)) {
63892 RECEIVE_PACKET_FIELD_ERROR(checkpoint);
63893 }
63894#ifdef FREECIV_JSON_CONNECTION
63895 field_addr.name = "type";
63896#endif /* FREECIV_JSON_CONNECTION */
63897 {
63898 int readin;
63899
63900 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63901 RECEIVE_PACKET_FIELD_ERROR(type);
63902 }
63903 real_packet->type = readin;
63904 }
63905#ifdef FREECIV_JSON_CONNECTION
63906 field_addr.name = "behaviour";
63907#endif /* FREECIV_JSON_CONNECTION */
63908 {
63909 int readin;
63910
63911 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63912 RECEIVE_PACKET_FIELD_ERROR(behaviour);
63913 }
63914 real_packet->behaviour = readin;
63915 }
63916#endif
63917 log_packet_detailed("packet_ruleset_counter_100: got info about ()");
63918
63919#ifdef FREECIV_DELTA_PROTOCOL
63920 if (NULL == *hash) {
63921 *hash = genhash_new_full(hash_packet_ruleset_counter_100, cmp_packet_ruleset_counter_100,
63922 NULL, NULL, NULL, free);
63923 }
63924
63925 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
63926 *real_packet = *old;
63927 } else {
63928 log_packet_detailed(" no old info");
63929 memset(real_packet, 0, sizeof(*real_packet));
63930 }
63931
63932 if (BV_ISSET(fields, 0)) {
63933 log_packet_detailed(" got field 'name'");
63934#ifdef FREECIV_JSON_CONNECTION
63935 field_addr.name = "name";
63936#endif /* FREECIV_JSON_CONNECTION */
63937 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
63938 RECEIVE_PACKET_FIELD_ERROR(name);
63939 }
63940 }
63941 if (BV_ISSET(fields, 1)) {
63942 log_packet_detailed(" got field 'rule_name'");
63943#ifdef FREECIV_JSON_CONNECTION
63944 field_addr.name = "rule_name";
63945#endif /* FREECIV_JSON_CONNECTION */
63946 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
63947 RECEIVE_PACKET_FIELD_ERROR(rule_name);
63948 }
63949 }
63950 if (BV_ISSET(fields, 2)) {
63951 log_packet_detailed(" got field 'helptext'");
63952#ifdef FREECIV_JSON_CONNECTION
63953 field_addr.name = "helptext";
63954#endif /* FREECIV_JSON_CONNECTION */
63955 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
63956 RECEIVE_PACKET_FIELD_ERROR(helptext);
63957 }
63958 }
63959 if (BV_ISSET(fields, 3)) {
63960 log_packet_detailed(" got field 'def'");
63961#ifdef FREECIV_JSON_CONNECTION
63962 field_addr.name = "def";
63963#endif /* FREECIV_JSON_CONNECTION */
63964 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->def)) {
63965 RECEIVE_PACKET_FIELD_ERROR(def);
63966 }
63967 }
63968 if (BV_ISSET(fields, 4)) {
63969 log_packet_detailed(" got field 'checkpoint'");
63970#ifdef FREECIV_JSON_CONNECTION
63971 field_addr.name = "checkpoint";
63972#endif /* FREECIV_JSON_CONNECTION */
63973 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->checkpoint)) {
63974 RECEIVE_PACKET_FIELD_ERROR(checkpoint);
63975 }
63976 }
63977 if (BV_ISSET(fields, 5)) {
63978 log_packet_detailed(" got field 'type'");
63979#ifdef FREECIV_JSON_CONNECTION
63980 field_addr.name = "type";
63981#endif /* FREECIV_JSON_CONNECTION */
63982 {
63983 int readin;
63984
63985 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
63986 RECEIVE_PACKET_FIELD_ERROR(type);
63987 }
63988 real_packet->type = readin;
63989 }
63990 }
63991 if (BV_ISSET(fields, 6)) {
63992 log_packet_detailed(" got field 'behaviour'");
63993#ifdef FREECIV_JSON_CONNECTION
63994 field_addr.name = "behaviour";
63995#endif /* FREECIV_JSON_CONNECTION */
63996 {
63997 int readin;
63998
63999 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
64000 RECEIVE_PACKET_FIELD_ERROR(behaviour);
64001 }
64002 real_packet->behaviour = readin;
64003 }
64004 }
64005
64006 if (NULL == old) {
64007 old = fc_malloc(sizeof(*old));
64008 *old = *real_packet;
64009 genhash_insert(*hash, old, old);
64010 } else {
64011 *old = *real_packet;
64012 }
64013
64014#endif /* FREECIV_DELTA_PROTOCOL */
64015 RECEIVE_PACKET_END(real_packet);
64016}
64017
64018 static int send_packet_ruleset_counter_100(struct connection *pc, const struct packet_ruleset_counter *packet)
64019{
64020 const struct packet_ruleset_counter *real_packet = packet;
64021 int e;
64022#ifdef FREECIV_DELTA_PROTOCOL
64023 packet_ruleset_counter_100_fields fields;
64024 struct packet_ruleset_counter *old;
64025 bool differ;
64026 struct genhash **hash = pc->phs.sent + PACKET_RULESET_COUNTER;
64027#endif /* FREECIV_DELTA_PROTOCOL */
64028 SEND_PACKET_START(PACKET_RULESET_COUNTER);
64029#ifdef FREECIV_JSON_CONNECTION
64030 struct plocation field_addr;
64031 {
64032 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64033 field_addr = *field_addr_tmp;
64034 FC_FREE(field_addr_tmp);
64035 }
64036#endif /* FREECIV_JSON_CONNECTION */
64037
64038 log_packet_detailed("packet_ruleset_counter_100: sending info about ()");
64039
64040#ifdef FREECIV_DELTA_PROTOCOL
64041 if (NULL == *hash) {
64042 *hash = genhash_new_full(hash_packet_ruleset_counter_100, cmp_packet_ruleset_counter_100,
64043 NULL, NULL, NULL, free);
64044 }
64045 BV_CLR_ALL(fields);
64046
64047 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
64048 old = fc_malloc(sizeof(*old));
64049 *old = *real_packet;
64050 genhash_insert(*hash, old, old);
64051 memset(old, 0, sizeof(*old));
64052 }
64053 differ = (strcmp(old->name, real_packet->name) != 0);
64054 if (differ) {
64055 BV_SET(fields, 0);
64056 }
64057
64058 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
64059 if (differ) {
64060 BV_SET(fields, 1);
64061 }
64062
64063 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
64064 if (differ) {
64065 BV_SET(fields, 2);
64066 }
64067
64068 differ = (old->def != real_packet->def);
64069 if (differ) {
64070 BV_SET(fields, 3);
64071 }
64072
64073 differ = (old->checkpoint != real_packet->checkpoint);
64074 if (differ) {
64075 BV_SET(fields, 4);
64076 }
64077
64078 differ = (old->type != real_packet->type);
64079 if (differ) {
64080 BV_SET(fields, 5);
64081 }
64082
64083 differ = (old->behaviour != real_packet->behaviour);
64084 if (differ) {
64085 BV_SET(fields, 6);
64086 }
64087
64088
64089#ifdef FREECIV_JSON_CONNECTION
64090 field_addr.name = "fields";
64091#endif /* FREECIV_JSON_CONNECTION */
64092 e = 0;
64093 e |= DIO_BV_PUT(&dout, &field_addr, fields);
64094 if (e) {
64095 log_packet_detailed("fields bitvector error detected");
64096 }
64097
64098 if (BV_ISSET(fields, 0)) {
64099 log_packet_detailed(" field 'name' has changed");
64100#ifdef FREECIV_JSON_CONNECTION
64101 field_addr.name = "name";
64102#endif /* FREECIV_JSON_CONNECTION */
64103 e = 0;
64104 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
64105 if (e) {
64106 log_packet_detailed("'name' field error detected");
64107 }
64108 }
64109 if (BV_ISSET(fields, 1)) {
64110 log_packet_detailed(" field 'rule_name' has changed");
64111#ifdef FREECIV_JSON_CONNECTION
64112 field_addr.name = "rule_name";
64113#endif /* FREECIV_JSON_CONNECTION */
64114 e = 0;
64115 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
64116 if (e) {
64117 log_packet_detailed("'rule_name' field error detected");
64118 }
64119 }
64120 if (BV_ISSET(fields, 2)) {
64121 log_packet_detailed(" field 'helptext' has changed");
64122#ifdef FREECIV_JSON_CONNECTION
64123 field_addr.name = "helptext";
64124#endif /* FREECIV_JSON_CONNECTION */
64125 e = 0;
64126 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
64127 if (e) {
64128 log_packet_detailed("'helptext' field error detected");
64129 }
64130 }
64131 if (BV_ISSET(fields, 3)) {
64132 log_packet_detailed(" field 'def' has changed");
64133#ifdef FREECIV_JSON_CONNECTION
64134 field_addr.name = "def";
64135#endif /* FREECIV_JSON_CONNECTION */
64136 e = 0;
64137 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->def);
64138 if (e) {
64139 log_packet_detailed("'def' field error detected");
64140 }
64141 }
64142 if (BV_ISSET(fields, 4)) {
64143 log_packet_detailed(" field 'checkpoint' has changed");
64144#ifdef FREECIV_JSON_CONNECTION
64145 field_addr.name = "checkpoint";
64146#endif /* FREECIV_JSON_CONNECTION */
64147 e = 0;
64148 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->checkpoint);
64149 if (e) {
64150 log_packet_detailed("'checkpoint' field error detected");
64151 }
64152 }
64153 if (BV_ISSET(fields, 5)) {
64154 log_packet_detailed(" field 'type' has changed");
64155#ifdef FREECIV_JSON_CONNECTION
64156 field_addr.name = "type";
64157#endif /* FREECIV_JSON_CONNECTION */
64158 e = 0;
64159 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
64160 if (e) {
64161 log_packet_detailed("'type' field error detected");
64162 }
64163 }
64164 if (BV_ISSET(fields, 6)) {
64165 log_packet_detailed(" field 'behaviour' has changed");
64166#ifdef FREECIV_JSON_CONNECTION
64167 field_addr.name = "behaviour";
64168#endif /* FREECIV_JSON_CONNECTION */
64169 e = 0;
64170 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->behaviour);
64171 if (e) {
64172 log_packet_detailed("'behaviour' field error detected");
64173 }
64174 }
64175
64176 *old = *real_packet;
64177#endif /* FREECIV_DELTA_PROTOCOL */
64178#ifndef FREECIV_DELTA_PROTOCOL
64179#ifdef FREECIV_JSON_CONNECTION
64180 field_addr.name = "name";
64181#endif /* FREECIV_JSON_CONNECTION */
64182 e = 0;
64183 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
64184 if (e) {
64185 log_packet_detailed("'name' field error detected");
64186 }
64187#ifdef FREECIV_JSON_CONNECTION
64188 field_addr.name = "rule_name";
64189#endif /* FREECIV_JSON_CONNECTION */
64190 e = 0;
64191 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
64192 if (e) {
64193 log_packet_detailed("'rule_name' field error detected");
64194 }
64195#ifdef FREECIV_JSON_CONNECTION
64196 field_addr.name = "helptext";
64197#endif /* FREECIV_JSON_CONNECTION */
64198 e = 0;
64199 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
64200 if (e) {
64201 log_packet_detailed("'helptext' field error detected");
64202 }
64203#ifdef FREECIV_JSON_CONNECTION
64204 field_addr.name = "def";
64205#endif /* FREECIV_JSON_CONNECTION */
64206 e = 0;
64207 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->def);
64208 if (e) {
64209 log_packet_detailed("'def' field error detected");
64210 }
64211#ifdef FREECIV_JSON_CONNECTION
64212 field_addr.name = "checkpoint";
64213#endif /* FREECIV_JSON_CONNECTION */
64214 e = 0;
64215 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->checkpoint);
64216 if (e) {
64217 log_packet_detailed("'checkpoint' field error detected");
64218 }
64219#ifdef FREECIV_JSON_CONNECTION
64220 field_addr.name = "type";
64221#endif /* FREECIV_JSON_CONNECTION */
64222 e = 0;
64223 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
64224 if (e) {
64225 log_packet_detailed("'type' field error detected");
64226 }
64227#ifdef FREECIV_JSON_CONNECTION
64228 field_addr.name = "behaviour";
64229#endif /* FREECIV_JSON_CONNECTION */
64230 e = 0;
64231 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->behaviour);
64232 if (e) {
64233 log_packet_detailed("'behaviour' field error detected");
64234 }
64235
64236#endif
64237 SEND_PACKET_END(PACKET_RULESET_COUNTER);
64238}
64239
64240 int send_packet_ruleset_counter(struct connection *pc, const struct packet_ruleset_counter *packet)
64241{
64242 if (!pc->used) {
64243 log_error("WARNING: trying to send data to the closed connection %s",
64244 conn_description(pc));
64245 return -1;
64246 }
64247 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_COUNTER].packet != NULL, -1,
64248 "Handler for PACKET_RULESET_COUNTER not installed");
64249 return pc->phs.handlers->send[PACKET_RULESET_COUNTER].packet(pc, packet);
64250}
64251
64252 void lsend_packet_ruleset_counter(struct conn_list *dest, const struct packet_ruleset_counter *packet)
64253{
64254 conn_list_iterate(dest, pconn) {
64255 send_packet_ruleset_counter(pconn, packet);
64256 } conn_list_iterate_end;
64257}
64258
64259#ifdef FREECIV_DELTA_PROTOCOL
64260#define hash_packet_ruleset_music_100 hash_const
64261
64262#define cmp_packet_ruleset_music_100 cmp_const
64263
64264 BV_DEFINE(packet_ruleset_music_100_fields, 5);
64265#endif /* FREECIV_DELTA_PROTOCOL */
64266
64267 static struct packet_ruleset_music *receive_packet_ruleset_music_100(struct connection *pc)
64268{
64269#ifdef FREECIV_DELTA_PROTOCOL
64270 packet_ruleset_music_100_fields fields;
64271 struct packet_ruleset_music *old;
64272 struct genhash **hash = pc->phs.received + PACKET_RULESET_MUSIC;
64273#endif /* FREECIV_DELTA_PROTOCOL */
64274 RECEIVE_PACKET_START(packet_ruleset_music, real_packet);
64275#ifdef FREECIV_JSON_CONNECTION
64276 struct plocation field_addr;
64277 {
64278 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64279 field_addr = *field_addr_tmp;
64280 FC_FREE(field_addr_tmp);
64281 }
64282#endif /* FREECIV_JSON_CONNECTION */
64283
64284#ifdef FREECIV_DELTA_PROTOCOL
64285#ifdef FREECIV_JSON_CONNECTION
64286 field_addr.name = "fields";
64287#endif /* FREECIV_JSON_CONNECTION */
64288 DIO_BV_GET(&din, &field_addr, fields);
64289
64290#else /* FREECIV_DELTA_PROTOCOL */
64291#ifdef FREECIV_JSON_CONNECTION
64292 field_addr.name = "id";
64293#endif /* FREECIV_JSON_CONNECTION */
64294 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
64295 RECEIVE_PACKET_FIELD_ERROR(id);
64296 }
64297#ifdef FREECIV_JSON_CONNECTION
64298 field_addr.name = "music_peaceful";
64299#endif /* FREECIV_JSON_CONNECTION */
64300 if (!DIO_GET(string, &din, &field_addr, real_packet->music_peaceful, sizeof(real_packet->music_peaceful))) {
64301 RECEIVE_PACKET_FIELD_ERROR(music_peaceful);
64302 }
64303#ifdef FREECIV_JSON_CONNECTION
64304 field_addr.name = "music_combat";
64305#endif /* FREECIV_JSON_CONNECTION */
64306 if (!DIO_GET(string, &din, &field_addr, real_packet->music_combat, sizeof(real_packet->music_combat))) {
64307 RECEIVE_PACKET_FIELD_ERROR(music_combat);
64308 }
64309#ifdef FREECIV_JSON_CONNECTION
64310 field_addr.name = "reqs_count";
64311#endif /* FREECIV_JSON_CONNECTION */
64312 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64313 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64314 }
64315#ifdef FREECIV_JSON_CONNECTION
64316 field_addr.name = "reqs";
64317#endif /* FREECIV_JSON_CONNECTION */
64318 {
64319 int i;
64320
64321#ifdef FREECIV_JSON_CONNECTION
64322 /* Enter array. */
64323 field_addr.sub_location = plocation_elem_new(0);
64324#endif /* FREECIV_JSON_CONNECTION */
64325
64326 if (real_packet->reqs_count > MAX_NUM_REQS) {
64327 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64328 }
64329 for (i = 0; i < real_packet->reqs_count; i++) {
64330#ifdef FREECIV_JSON_CONNECTION
64331 field_addr.sub_location->number = i;
64332#endif /* FREECIV_JSON_CONNECTION */
64333 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64334 RECEIVE_PACKET_FIELD_ERROR(reqs);
64335 }
64336 }
64337
64338#ifdef FREECIV_JSON_CONNECTION
64339 /* Exit array. */
64340 FC_FREE(field_addr.sub_location);
64341#endif /* FREECIV_JSON_CONNECTION */
64342 }
64343#endif
64344 log_packet_detailed("packet_ruleset_music_100: got info about ()");
64345
64346#ifdef FREECIV_DELTA_PROTOCOL
64347 if (NULL == *hash) {
64348 *hash = genhash_new_full(hash_packet_ruleset_music_100, cmp_packet_ruleset_music_100,
64349 NULL, NULL, NULL, free);
64350 }
64351
64352 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
64353 *real_packet = *old;
64354 } else {
64355 log_packet_detailed(" no old info");
64356 memset(real_packet, 0, sizeof(*real_packet));
64357 }
64358
64359 if (BV_ISSET(fields, 0)) {
64360 log_packet_detailed(" got field 'id'");
64361#ifdef FREECIV_JSON_CONNECTION
64362 field_addr.name = "id";
64363#endif /* FREECIV_JSON_CONNECTION */
64364 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
64365 RECEIVE_PACKET_FIELD_ERROR(id);
64366 }
64367 }
64368 if (BV_ISSET(fields, 1)) {
64369 log_packet_detailed(" got field 'music_peaceful'");
64370#ifdef FREECIV_JSON_CONNECTION
64371 field_addr.name = "music_peaceful";
64372#endif /* FREECIV_JSON_CONNECTION */
64373 if (!DIO_GET(string, &din, &field_addr, real_packet->music_peaceful, sizeof(real_packet->music_peaceful))) {
64374 RECEIVE_PACKET_FIELD_ERROR(music_peaceful);
64375 }
64376 }
64377 if (BV_ISSET(fields, 2)) {
64378 log_packet_detailed(" got field 'music_combat'");
64379#ifdef FREECIV_JSON_CONNECTION
64380 field_addr.name = "music_combat";
64381#endif /* FREECIV_JSON_CONNECTION */
64382 if (!DIO_GET(string, &din, &field_addr, real_packet->music_combat, sizeof(real_packet->music_combat))) {
64383 RECEIVE_PACKET_FIELD_ERROR(music_combat);
64384 }
64385 }
64386 if (BV_ISSET(fields, 3)) {
64387 log_packet_detailed(" got field 'reqs_count'");
64388#ifdef FREECIV_JSON_CONNECTION
64389 field_addr.name = "reqs_count";
64390#endif /* FREECIV_JSON_CONNECTION */
64391 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64392 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64393 }
64394 }
64395 if (BV_ISSET(fields, 4)) {
64396 log_packet_detailed(" got field 'reqs'");
64397#ifdef FREECIV_JSON_CONNECTION
64398 field_addr.name = "reqs";
64399#endif /* FREECIV_JSON_CONNECTION */
64400 {
64401 int i;
64402
64403#ifdef FREECIV_JSON_CONNECTION
64404 /* Enter array. */
64405 field_addr.sub_location = plocation_elem_new(0);
64406#endif /* FREECIV_JSON_CONNECTION */
64407
64408 if (real_packet->reqs_count > MAX_NUM_REQS) {
64409 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64410 }
64411 for (i = 0; i < real_packet->reqs_count; i++) {
64412#ifdef FREECIV_JSON_CONNECTION
64413 field_addr.sub_location->number = i;
64414#endif /* FREECIV_JSON_CONNECTION */
64415 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64416 RECEIVE_PACKET_FIELD_ERROR(reqs);
64417 }
64418 }
64419
64420#ifdef FREECIV_JSON_CONNECTION
64421 /* Exit array. */
64422 FC_FREE(field_addr.sub_location);
64423#endif /* FREECIV_JSON_CONNECTION */
64424 }
64425 }
64426
64427 if (NULL == old) {
64428 old = fc_malloc(sizeof(*old));
64429 *old = *real_packet;
64430 genhash_insert(*hash, old, old);
64431 } else {
64432 *old = *real_packet;
64433 }
64434
64435#endif /* FREECIV_DELTA_PROTOCOL */
64436 RECEIVE_PACKET_END(real_packet);
64437}
64438
64439 static int send_packet_ruleset_music_100(struct connection *pc, const struct packet_ruleset_music *packet)
64440{
64441 const struct packet_ruleset_music *real_packet = packet;
64442 int e;
64443#ifdef FREECIV_DELTA_PROTOCOL
64444 packet_ruleset_music_100_fields fields;
64445 struct packet_ruleset_music *old;
64446 bool differ;
64447 struct genhash **hash = pc->phs.sent + PACKET_RULESET_MUSIC;
64448#endif /* FREECIV_DELTA_PROTOCOL */
64449 SEND_PACKET_START(PACKET_RULESET_MUSIC);
64450#ifdef FREECIV_JSON_CONNECTION
64451 struct plocation field_addr;
64452 {
64453 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64454 field_addr = *field_addr_tmp;
64455 FC_FREE(field_addr_tmp);
64456 }
64457#endif /* FREECIV_JSON_CONNECTION */
64458
64459 log_packet_detailed("packet_ruleset_music_100: sending info about ()");
64460
64461#ifdef FREECIV_DELTA_PROTOCOL
64462 if (NULL == *hash) {
64463 *hash = genhash_new_full(hash_packet_ruleset_music_100, cmp_packet_ruleset_music_100,
64464 NULL, NULL, NULL, free);
64465 }
64466 BV_CLR_ALL(fields);
64467
64468 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
64469 old = fc_malloc(sizeof(*old));
64470 *old = *real_packet;
64471 genhash_insert(*hash, old, old);
64472 memset(old, 0, sizeof(*old));
64473 }
64474 differ = (old->id != real_packet->id);
64475 if (differ) {
64476 BV_SET(fields, 0);
64477 }
64478
64479 differ = (strcmp(old->music_peaceful, real_packet->music_peaceful) != 0);
64480 if (differ) {
64481 BV_SET(fields, 1);
64482 }
64483
64484 differ = (strcmp(old->music_combat, real_packet->music_combat) != 0);
64485 if (differ) {
64486 BV_SET(fields, 2);
64487 }
64488
64489 differ = (old->reqs_count != real_packet->reqs_count);
64490 if (differ) {
64491 BV_SET(fields, 3);
64492 }
64493
64494 differ = (old->reqs_count != real_packet->reqs_count);
64495 if (!differ) {
64496 int i;
64497
64498 for (i = 0; i < real_packet->reqs_count; i++) {
64499 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
64500 if (differ) {
64501 break;
64502 }
64503 }
64504 }
64505 if (differ) {
64506 BV_SET(fields, 4);
64507 }
64508
64509
64510#ifdef FREECIV_JSON_CONNECTION
64511 field_addr.name = "fields";
64512#endif /* FREECIV_JSON_CONNECTION */
64513 e = 0;
64514 e |= DIO_BV_PUT(&dout, &field_addr, fields);
64515 if (e) {
64516 log_packet_detailed("fields bitvector error detected");
64517 }
64518
64519 if (BV_ISSET(fields, 0)) {
64520 log_packet_detailed(" field 'id' has changed");
64521#ifdef FREECIV_JSON_CONNECTION
64522 field_addr.name = "id";
64523#endif /* FREECIV_JSON_CONNECTION */
64524 e = 0;
64525 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
64526 if (e) {
64527 log_packet_detailed("'id' field error detected");
64528 }
64529 }
64530 if (BV_ISSET(fields, 1)) {
64531 log_packet_detailed(" field 'music_peaceful' has changed");
64532#ifdef FREECIV_JSON_CONNECTION
64533 field_addr.name = "music_peaceful";
64534#endif /* FREECIV_JSON_CONNECTION */
64535 e = 0;
64536 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_peaceful);
64537 if (e) {
64538 log_packet_detailed("'music_peaceful' field error detected");
64539 }
64540 }
64541 if (BV_ISSET(fields, 2)) {
64542 log_packet_detailed(" field 'music_combat' has changed");
64543#ifdef FREECIV_JSON_CONNECTION
64544 field_addr.name = "music_combat";
64545#endif /* FREECIV_JSON_CONNECTION */
64546 e = 0;
64547 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_combat);
64548 if (e) {
64549 log_packet_detailed("'music_combat' field error detected");
64550 }
64551 }
64552 if (BV_ISSET(fields, 3)) {
64553 log_packet_detailed(" field 'reqs_count' has changed");
64554#ifdef FREECIV_JSON_CONNECTION
64555 field_addr.name = "reqs_count";
64556#endif /* FREECIV_JSON_CONNECTION */
64557 e = 0;
64558 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
64559 if (e) {
64560 log_packet_detailed("'reqs_count' field error detected");
64561 }
64562 }
64563 if (BV_ISSET(fields, 4)) {
64564 log_packet_detailed(" field 'reqs' has changed");
64565#ifdef FREECIV_JSON_CONNECTION
64566 field_addr.name = "reqs";
64567#endif /* FREECIV_JSON_CONNECTION */
64568 e = 0;
64569 {
64570 int i;
64571
64572#ifdef FREECIV_JSON_CONNECTION
64573 /* Create the array. */
64574 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
64575
64576 /* Enter the array. */
64577 field_addr.sub_location = plocation_elem_new(0);
64578#endif /* FREECIV_JSON_CONNECTION */
64579
64580 for (i = 0; i < real_packet->reqs_count; i++) {
64581#ifdef FREECIV_JSON_CONNECTION
64582 /* Next array element. */
64583 field_addr.sub_location->number = i;
64584#endif /* FREECIV_JSON_CONNECTION */
64585 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
64586 }
64587
64588#ifdef FREECIV_JSON_CONNECTION
64589 /* Exit array. */
64590 FC_FREE(field_addr.sub_location);
64591#endif /* FREECIV_JSON_CONNECTION */
64592 }
64593 if (e) {
64594 log_packet_detailed("'reqs' field error detected");
64595 }
64596 }
64597
64598 *old = *real_packet;
64599#endif /* FREECIV_DELTA_PROTOCOL */
64600#ifndef FREECIV_DELTA_PROTOCOL
64601#ifdef FREECIV_JSON_CONNECTION
64602 field_addr.name = "id";
64603#endif /* FREECIV_JSON_CONNECTION */
64604 e = 0;
64605 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
64606 if (e) {
64607 log_packet_detailed("'id' field error detected");
64608 }
64609#ifdef FREECIV_JSON_CONNECTION
64610 field_addr.name = "music_peaceful";
64611#endif /* FREECIV_JSON_CONNECTION */
64612 e = 0;
64613 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_peaceful);
64614 if (e) {
64615 log_packet_detailed("'music_peaceful' field error detected");
64616 }
64617#ifdef FREECIV_JSON_CONNECTION
64618 field_addr.name = "music_combat";
64619#endif /* FREECIV_JSON_CONNECTION */
64620 e = 0;
64621 e |= DIO_PUT(string, &dout, &field_addr, real_packet->music_combat);
64622 if (e) {
64623 log_packet_detailed("'music_combat' field error detected");
64624 }
64625#ifdef FREECIV_JSON_CONNECTION
64626 field_addr.name = "reqs_count";
64627#endif /* FREECIV_JSON_CONNECTION */
64628 e = 0;
64629 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
64630 if (e) {
64631 log_packet_detailed("'reqs_count' field error detected");
64632 }
64633#ifdef FREECIV_JSON_CONNECTION
64634 field_addr.name = "reqs";
64635#endif /* FREECIV_JSON_CONNECTION */
64636 e = 0;
64637 {
64638 int i;
64639
64640#ifdef FREECIV_JSON_CONNECTION
64641 /* Create the array. */
64642 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
64643
64644 /* Enter the array. */
64645 field_addr.sub_location = plocation_elem_new(0);
64646#endif /* FREECIV_JSON_CONNECTION */
64647
64648 for (i = 0; i < real_packet->reqs_count; i++) {
64649#ifdef FREECIV_JSON_CONNECTION
64650 /* Next array element. */
64651 field_addr.sub_location->number = i;
64652#endif /* FREECIV_JSON_CONNECTION */
64653 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
64654 }
64655
64656#ifdef FREECIV_JSON_CONNECTION
64657 /* Exit array. */
64658 FC_FREE(field_addr.sub_location);
64659#endif /* FREECIV_JSON_CONNECTION */
64660 }
64661 if (e) {
64662 log_packet_detailed("'reqs' field error detected");
64663 }
64664
64665#endif
64666 SEND_PACKET_END(PACKET_RULESET_MUSIC);
64667}
64668
64669 int send_packet_ruleset_music(struct connection *pc, const struct packet_ruleset_music *packet)
64670{
64671 if (!pc->used) {
64672 log_error("WARNING: trying to send data to the closed connection %s",
64673 conn_description(pc));
64674 return -1;
64675 }
64676 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_MUSIC].packet != NULL, -1,
64677 "Handler for PACKET_RULESET_MUSIC not installed");
64678 return pc->phs.handlers->send[PACKET_RULESET_MUSIC].packet(pc, packet);
64679}
64680
64681 void lsend_packet_ruleset_music(struct conn_list *dest, const struct packet_ruleset_music *packet)
64682{
64683 conn_list_iterate(dest, pconn) {
64684 send_packet_ruleset_music(pconn, packet);
64685 } conn_list_iterate_end;
64686}
64687
64688#ifdef FREECIV_DELTA_PROTOCOL
64689#define hash_packet_ruleset_multiplier_100 hash_const
64690
64691#define cmp_packet_ruleset_multiplier_100 cmp_const
64692
64693 BV_DEFINE(packet_ruleset_multiplier_100_fields, 13);
64694#endif /* FREECIV_DELTA_PROTOCOL */
64695
64696 static struct packet_ruleset_multiplier *receive_packet_ruleset_multiplier_100(struct connection *pc)
64697{
64698#ifdef FREECIV_DELTA_PROTOCOL
64699 packet_ruleset_multiplier_100_fields fields;
64700 struct packet_ruleset_multiplier *old;
64701 struct genhash **hash = pc->phs.received + PACKET_RULESET_MULTIPLIER;
64702#endif /* FREECIV_DELTA_PROTOCOL */
64703 RECEIVE_PACKET_START(packet_ruleset_multiplier, real_packet);
64704#ifdef FREECIV_JSON_CONNECTION
64705 struct plocation field_addr;
64706 {
64707 struct plocation *field_addr_tmp = plocation_field_new(NULL);
64708 field_addr = *field_addr_tmp;
64709 FC_FREE(field_addr_tmp);
64710 }
64711#endif /* FREECIV_JSON_CONNECTION */
64712
64713#ifdef FREECIV_DELTA_PROTOCOL
64714#ifdef FREECIV_JSON_CONNECTION
64715 field_addr.name = "fields";
64716#endif /* FREECIV_JSON_CONNECTION */
64717 DIO_BV_GET(&din, &field_addr, fields);
64718
64719#else /* FREECIV_DELTA_PROTOCOL */
64720#ifdef FREECIV_JSON_CONNECTION
64721 field_addr.name = "id";
64722#endif /* FREECIV_JSON_CONNECTION */
64723 {
64724 int readin;
64725
64726 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
64727 RECEIVE_PACKET_FIELD_ERROR(id);
64728 }
64729 real_packet->id = readin;
64730 }
64731#ifdef FREECIV_JSON_CONNECTION
64732 field_addr.name = "start";
64733#endif /* FREECIV_JSON_CONNECTION */
64734 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->start)) {
64735 RECEIVE_PACKET_FIELD_ERROR(start);
64736 }
64737#ifdef FREECIV_JSON_CONNECTION
64738 field_addr.name = "stop";
64739#endif /* FREECIV_JSON_CONNECTION */
64740 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->stop)) {
64741 RECEIVE_PACKET_FIELD_ERROR(stop);
64742 }
64743#ifdef FREECIV_JSON_CONNECTION
64744 field_addr.name = "step";
64745#endif /* FREECIV_JSON_CONNECTION */
64746 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->step)) {
64747 RECEIVE_PACKET_FIELD_ERROR(step);
64748 }
64749#ifdef FREECIV_JSON_CONNECTION
64750 field_addr.name = "def";
64751#endif /* FREECIV_JSON_CONNECTION */
64752 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->def)) {
64753 RECEIVE_PACKET_FIELD_ERROR(def);
64754 }
64755#ifdef FREECIV_JSON_CONNECTION
64756 field_addr.name = "offset";
64757#endif /* FREECIV_JSON_CONNECTION */
64758 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->offset)) {
64759 RECEIVE_PACKET_FIELD_ERROR(offset);
64760 }
64761#ifdef FREECIV_JSON_CONNECTION
64762 field_addr.name = "factor";
64763#endif /* FREECIV_JSON_CONNECTION */
64764 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->factor)) {
64765 RECEIVE_PACKET_FIELD_ERROR(factor);
64766 }
64767#ifdef FREECIV_JSON_CONNECTION
64768 field_addr.name = "minimum_turns";
64769#endif /* FREECIV_JSON_CONNECTION */
64770 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->minimum_turns)) {
64771 RECEIVE_PACKET_FIELD_ERROR(minimum_turns);
64772 }
64773#ifdef FREECIV_JSON_CONNECTION
64774 field_addr.name = "name";
64775#endif /* FREECIV_JSON_CONNECTION */
64776 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64777 RECEIVE_PACKET_FIELD_ERROR(name);
64778 }
64779#ifdef FREECIV_JSON_CONNECTION
64780 field_addr.name = "rule_name";
64781#endif /* FREECIV_JSON_CONNECTION */
64782 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64783 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64784 }
64785#ifdef FREECIV_JSON_CONNECTION
64786 field_addr.name = "reqs_count";
64787#endif /* FREECIV_JSON_CONNECTION */
64788 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64789 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64790 }
64791#ifdef FREECIV_JSON_CONNECTION
64792 field_addr.name = "reqs";
64793#endif /* FREECIV_JSON_CONNECTION */
64794 {
64795 int i;
64796
64797#ifdef FREECIV_JSON_CONNECTION
64798 /* Enter array. */
64799 field_addr.sub_location = plocation_elem_new(0);
64800#endif /* FREECIV_JSON_CONNECTION */
64801
64802 if (real_packet->reqs_count > MAX_NUM_REQS) {
64803 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64804 }
64805 for (i = 0; i < real_packet->reqs_count; i++) {
64806#ifdef FREECIV_JSON_CONNECTION
64807 field_addr.sub_location->number = i;
64808#endif /* FREECIV_JSON_CONNECTION */
64809 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64810 RECEIVE_PACKET_FIELD_ERROR(reqs);
64811 }
64812 }
64813
64814#ifdef FREECIV_JSON_CONNECTION
64815 /* Exit array. */
64816 FC_FREE(field_addr.sub_location);
64817#endif /* FREECIV_JSON_CONNECTION */
64818 }
64819#ifdef FREECIV_JSON_CONNECTION
64820 field_addr.name = "helptext";
64821#endif /* FREECIV_JSON_CONNECTION */
64822 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
64823 RECEIVE_PACKET_FIELD_ERROR(helptext);
64824 }
64825#endif
64826 log_packet_detailed("packet_ruleset_multiplier_100: got info about ()");
64827
64828#ifdef FREECIV_DELTA_PROTOCOL
64829 if (NULL == *hash) {
64830 *hash = genhash_new_full(hash_packet_ruleset_multiplier_100, cmp_packet_ruleset_multiplier_100,
64831 NULL, NULL, NULL, free);
64832 }
64833
64834 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
64835 *real_packet = *old;
64836 } else {
64837 log_packet_detailed(" no old info");
64838 memset(real_packet, 0, sizeof(*real_packet));
64839 }
64840
64841 if (BV_ISSET(fields, 0)) {
64842 log_packet_detailed(" got field 'id'");
64843#ifdef FREECIV_JSON_CONNECTION
64844 field_addr.name = "id";
64845#endif /* FREECIV_JSON_CONNECTION */
64846 {
64847 int readin;
64848
64849 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
64850 RECEIVE_PACKET_FIELD_ERROR(id);
64851 }
64852 real_packet->id = readin;
64853 }
64854 }
64855 if (BV_ISSET(fields, 1)) {
64856 log_packet_detailed(" got field 'start'");
64857#ifdef FREECIV_JSON_CONNECTION
64858 field_addr.name = "start";
64859#endif /* FREECIV_JSON_CONNECTION */
64860 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->start)) {
64861 RECEIVE_PACKET_FIELD_ERROR(start);
64862 }
64863 }
64864 if (BV_ISSET(fields, 2)) {
64865 log_packet_detailed(" got field 'stop'");
64866#ifdef FREECIV_JSON_CONNECTION
64867 field_addr.name = "stop";
64868#endif /* FREECIV_JSON_CONNECTION */
64869 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->stop)) {
64870 RECEIVE_PACKET_FIELD_ERROR(stop);
64871 }
64872 }
64873 if (BV_ISSET(fields, 3)) {
64874 log_packet_detailed(" got field 'step'");
64875#ifdef FREECIV_JSON_CONNECTION
64876 field_addr.name = "step";
64877#endif /* FREECIV_JSON_CONNECTION */
64878 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->step)) {
64879 RECEIVE_PACKET_FIELD_ERROR(step);
64880 }
64881 }
64882 if (BV_ISSET(fields, 4)) {
64883 log_packet_detailed(" got field 'def'");
64884#ifdef FREECIV_JSON_CONNECTION
64885 field_addr.name = "def";
64886#endif /* FREECIV_JSON_CONNECTION */
64887 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->def)) {
64888 RECEIVE_PACKET_FIELD_ERROR(def);
64889 }
64890 }
64891 if (BV_ISSET(fields, 5)) {
64892 log_packet_detailed(" got field 'offset'");
64893#ifdef FREECIV_JSON_CONNECTION
64894 field_addr.name = "offset";
64895#endif /* FREECIV_JSON_CONNECTION */
64896 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->offset)) {
64897 RECEIVE_PACKET_FIELD_ERROR(offset);
64898 }
64899 }
64900 if (BV_ISSET(fields, 6)) {
64901 log_packet_detailed(" got field 'factor'");
64902#ifdef FREECIV_JSON_CONNECTION
64903 field_addr.name = "factor";
64904#endif /* FREECIV_JSON_CONNECTION */
64905 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->factor)) {
64906 RECEIVE_PACKET_FIELD_ERROR(factor);
64907 }
64908 }
64909 if (BV_ISSET(fields, 7)) {
64910 log_packet_detailed(" got field 'minimum_turns'");
64911#ifdef FREECIV_JSON_CONNECTION
64912 field_addr.name = "minimum_turns";
64913#endif /* FREECIV_JSON_CONNECTION */
64914 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->minimum_turns)) {
64915 RECEIVE_PACKET_FIELD_ERROR(minimum_turns);
64916 }
64917 }
64918 if (BV_ISSET(fields, 8)) {
64919 log_packet_detailed(" got field 'name'");
64920#ifdef FREECIV_JSON_CONNECTION
64921 field_addr.name = "name";
64922#endif /* FREECIV_JSON_CONNECTION */
64923 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
64924 RECEIVE_PACKET_FIELD_ERROR(name);
64925 }
64926 }
64927 if (BV_ISSET(fields, 9)) {
64928 log_packet_detailed(" got field 'rule_name'");
64929#ifdef FREECIV_JSON_CONNECTION
64930 field_addr.name = "rule_name";
64931#endif /* FREECIV_JSON_CONNECTION */
64932 if (!DIO_GET(string, &din, &field_addr, real_packet->rule_name, sizeof(real_packet->rule_name))) {
64933 RECEIVE_PACKET_FIELD_ERROR(rule_name);
64934 }
64935 }
64936 if (BV_ISSET(fields, 10)) {
64937 log_packet_detailed(" got field 'reqs_count'");
64938#ifdef FREECIV_JSON_CONNECTION
64939 field_addr.name = "reqs_count";
64940#endif /* FREECIV_JSON_CONNECTION */
64941 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
64942 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
64943 }
64944 }
64945 if (BV_ISSET(fields, 11)) {
64946 log_packet_detailed(" got field 'reqs'");
64947#ifdef FREECIV_JSON_CONNECTION
64948 field_addr.name = "reqs";
64949#endif /* FREECIV_JSON_CONNECTION */
64950 {
64951 int i;
64952
64953#ifdef FREECIV_JSON_CONNECTION
64954 /* Enter array. */
64955 field_addr.sub_location = plocation_elem_new(0);
64956#endif /* FREECIV_JSON_CONNECTION */
64957
64958 if (real_packet->reqs_count > MAX_NUM_REQS) {
64959 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
64960 }
64961 for (i = 0; i < real_packet->reqs_count; i++) {
64962#ifdef FREECIV_JSON_CONNECTION
64963 field_addr.sub_location->number = i;
64964#endif /* FREECIV_JSON_CONNECTION */
64965 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
64966 RECEIVE_PACKET_FIELD_ERROR(reqs);
64967 }
64968 }
64969
64970#ifdef FREECIV_JSON_CONNECTION
64971 /* Exit array. */
64972 FC_FREE(field_addr.sub_location);
64973#endif /* FREECIV_JSON_CONNECTION */
64974 }
64975 }
64976 if (BV_ISSET(fields, 12)) {
64977 log_packet_detailed(" got field 'helptext'");
64978#ifdef FREECIV_JSON_CONNECTION
64979 field_addr.name = "helptext";
64980#endif /* FREECIV_JSON_CONNECTION */
64981 if (!DIO_GET(string, &din, &field_addr, real_packet->helptext, sizeof(real_packet->helptext))) {
64982 RECEIVE_PACKET_FIELD_ERROR(helptext);
64983 }
64984 }
64985
64986 if (NULL == old) {
64987 old = fc_malloc(sizeof(*old));
64988 *old = *real_packet;
64989 genhash_insert(*hash, old, old);
64990 } else {
64991 *old = *real_packet;
64992 }
64993
64994#endif /* FREECIV_DELTA_PROTOCOL */
64995 RECEIVE_PACKET_END(real_packet);
64996}
64997
64998 static int send_packet_ruleset_multiplier_100(struct connection *pc, const struct packet_ruleset_multiplier *packet)
64999{
65000 const struct packet_ruleset_multiplier *real_packet = packet;
65001 int e;
65002#ifdef FREECIV_DELTA_PROTOCOL
65003 packet_ruleset_multiplier_100_fields fields;
65004 struct packet_ruleset_multiplier *old;
65005 bool differ;
65006 struct genhash **hash = pc->phs.sent + PACKET_RULESET_MULTIPLIER;
65007#endif /* FREECIV_DELTA_PROTOCOL */
65008 SEND_PACKET_START(PACKET_RULESET_MULTIPLIER);
65009#ifdef FREECIV_JSON_CONNECTION
65010 struct plocation field_addr;
65011 {
65012 struct plocation *field_addr_tmp = plocation_field_new(NULL);
65013 field_addr = *field_addr_tmp;
65014 FC_FREE(field_addr_tmp);
65015 }
65016#endif /* FREECIV_JSON_CONNECTION */
65017
65018 log_packet_detailed("packet_ruleset_multiplier_100: sending info about ()");
65019
65020#ifdef FREECIV_DELTA_PROTOCOL
65021 if (NULL == *hash) {
65022 *hash = genhash_new_full(hash_packet_ruleset_multiplier_100, cmp_packet_ruleset_multiplier_100,
65023 NULL, NULL, NULL, free);
65024 }
65025 BV_CLR_ALL(fields);
65026
65027 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
65028 old = fc_malloc(sizeof(*old));
65029 *old = *real_packet;
65030 genhash_insert(*hash, old, old);
65031 memset(old, 0, sizeof(*old));
65032 }
65033 differ = (old->id != real_packet->id);
65034 if (differ) {
65035 BV_SET(fields, 0);
65036 }
65037
65038 differ = (old->start != real_packet->start);
65039 if (differ) {
65040 BV_SET(fields, 1);
65041 }
65042
65043 differ = (old->stop != real_packet->stop);
65044 if (differ) {
65045 BV_SET(fields, 2);
65046 }
65047
65048 differ = (old->step != real_packet->step);
65049 if (differ) {
65050 BV_SET(fields, 3);
65051 }
65052
65053 differ = (old->def != real_packet->def);
65054 if (differ) {
65055 BV_SET(fields, 4);
65056 }
65057
65058 differ = (old->offset != real_packet->offset);
65059 if (differ) {
65060 BV_SET(fields, 5);
65061 }
65062
65063 differ = (old->factor != real_packet->factor);
65064 if (differ) {
65065 BV_SET(fields, 6);
65066 }
65067
65068 differ = (old->minimum_turns != real_packet->minimum_turns);
65069 if (differ) {
65070 BV_SET(fields, 7);
65071 }
65072
65073 differ = (strcmp(old->name, real_packet->name) != 0);
65074 if (differ) {
65075 BV_SET(fields, 8);
65076 }
65077
65078 differ = (strcmp(old->rule_name, real_packet->rule_name) != 0);
65079 if (differ) {
65080 BV_SET(fields, 9);
65081 }
65082
65083 differ = (old->reqs_count != real_packet->reqs_count);
65084 if (differ) {
65085 BV_SET(fields, 10);
65086 }
65087
65088 differ = (old->reqs_count != real_packet->reqs_count);
65089 if (!differ) {
65090 int i;
65091
65092 for (i = 0; i < real_packet->reqs_count; i++) {
65093 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
65094 if (differ) {
65095 break;
65096 }
65097 }
65098 }
65099 if (differ) {
65100 BV_SET(fields, 11);
65101 }
65102
65103 differ = (strcmp(old->helptext, real_packet->helptext) != 0);
65104 if (differ) {
65105 BV_SET(fields, 12);
65106 }
65107
65108
65109#ifdef FREECIV_JSON_CONNECTION
65110 field_addr.name = "fields";
65111#endif /* FREECIV_JSON_CONNECTION */
65112 e = 0;
65113 e |= DIO_BV_PUT(&dout, &field_addr, fields);
65114 if (e) {
65115 log_packet_detailed("fields bitvector error detected");
65116 }
65117
65118 if (BV_ISSET(fields, 0)) {
65119 log_packet_detailed(" field 'id' has changed");
65120#ifdef FREECIV_JSON_CONNECTION
65121 field_addr.name = "id";
65122#endif /* FREECIV_JSON_CONNECTION */
65123 e = 0;
65124 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65125 if (e) {
65126 log_packet_detailed("'id' field error detected");
65127 }
65128 }
65129 if (BV_ISSET(fields, 1)) {
65130 log_packet_detailed(" field 'start' has changed");
65131#ifdef FREECIV_JSON_CONNECTION
65132 field_addr.name = "start";
65133#endif /* FREECIV_JSON_CONNECTION */
65134 e = 0;
65135 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->start);
65136 if (e) {
65137 log_packet_detailed("'start' field error detected");
65138 }
65139 }
65140 if (BV_ISSET(fields, 2)) {
65141 log_packet_detailed(" field 'stop' has changed");
65142#ifdef FREECIV_JSON_CONNECTION
65143 field_addr.name = "stop";
65144#endif /* FREECIV_JSON_CONNECTION */
65145 e = 0;
65146 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->stop);
65147 if (e) {
65148 log_packet_detailed("'stop' field error detected");
65149 }
65150 }
65151 if (BV_ISSET(fields, 3)) {
65152 log_packet_detailed(" field 'step' has changed");
65153#ifdef FREECIV_JSON_CONNECTION
65154 field_addr.name = "step";
65155#endif /* FREECIV_JSON_CONNECTION */
65156 e = 0;
65157 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->step);
65158 if (e) {
65159 log_packet_detailed("'step' field error detected");
65160 }
65161 }
65162 if (BV_ISSET(fields, 4)) {
65163 log_packet_detailed(" field 'def' has changed");
65164#ifdef FREECIV_JSON_CONNECTION
65165 field_addr.name = "def";
65166#endif /* FREECIV_JSON_CONNECTION */
65167 e = 0;
65168 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->def);
65169 if (e) {
65170 log_packet_detailed("'def' field error detected");
65171 }
65172 }
65173 if (BV_ISSET(fields, 5)) {
65174 log_packet_detailed(" field 'offset' has changed");
65175#ifdef FREECIV_JSON_CONNECTION
65176 field_addr.name = "offset";
65177#endif /* FREECIV_JSON_CONNECTION */
65178 e = 0;
65179 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->offset);
65180 if (e) {
65181 log_packet_detailed("'offset' field error detected");
65182 }
65183 }
65184 if (BV_ISSET(fields, 6)) {
65185 log_packet_detailed(" field 'factor' has changed");
65186#ifdef FREECIV_JSON_CONNECTION
65187 field_addr.name = "factor";
65188#endif /* FREECIV_JSON_CONNECTION */
65189 e = 0;
65190 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->factor);
65191 if (e) {
65192 log_packet_detailed("'factor' field error detected");
65193 }
65194 }
65195 if (BV_ISSET(fields, 7)) {
65196 log_packet_detailed(" field 'minimum_turns' has changed");
65197#ifdef FREECIV_JSON_CONNECTION
65198 field_addr.name = "minimum_turns";
65199#endif /* FREECIV_JSON_CONNECTION */
65200 e = 0;
65201 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->minimum_turns);
65202 if (e) {
65203 log_packet_detailed("'minimum_turns' field error detected");
65204 }
65205 }
65206 if (BV_ISSET(fields, 8)) {
65207 log_packet_detailed(" field 'name' has changed");
65208#ifdef FREECIV_JSON_CONNECTION
65209 field_addr.name = "name";
65210#endif /* FREECIV_JSON_CONNECTION */
65211 e = 0;
65212 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
65213 if (e) {
65214 log_packet_detailed("'name' field error detected");
65215 }
65216 }
65217 if (BV_ISSET(fields, 9)) {
65218 log_packet_detailed(" field 'rule_name' has changed");
65219#ifdef FREECIV_JSON_CONNECTION
65220 field_addr.name = "rule_name";
65221#endif /* FREECIV_JSON_CONNECTION */
65222 e = 0;
65223 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65224 if (e) {
65225 log_packet_detailed("'rule_name' field error detected");
65226 }
65227 }
65228 if (BV_ISSET(fields, 10)) {
65229 log_packet_detailed(" field 'reqs_count' has changed");
65230#ifdef FREECIV_JSON_CONNECTION
65231 field_addr.name = "reqs_count";
65232#endif /* FREECIV_JSON_CONNECTION */
65233 e = 0;
65234 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65235 if (e) {
65236 log_packet_detailed("'reqs_count' field error detected");
65237 }
65238 }
65239 if (BV_ISSET(fields, 11)) {
65240 log_packet_detailed(" field 'reqs' has changed");
65241#ifdef FREECIV_JSON_CONNECTION
65242 field_addr.name = "reqs";
65243#endif /* FREECIV_JSON_CONNECTION */
65244 e = 0;
65245 {
65246 int i;
65247
65248#ifdef FREECIV_JSON_CONNECTION
65249 /* Create the array. */
65250 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65251
65252 /* Enter the array. */
65253 field_addr.sub_location = plocation_elem_new(0);
65254#endif /* FREECIV_JSON_CONNECTION */
65255
65256 for (i = 0; i < real_packet->reqs_count; i++) {
65257#ifdef FREECIV_JSON_CONNECTION
65258 /* Next array element. */
65259 field_addr.sub_location->number = i;
65260#endif /* FREECIV_JSON_CONNECTION */
65261 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65262 }
65263
65264#ifdef FREECIV_JSON_CONNECTION
65265 /* Exit array. */
65266 FC_FREE(field_addr.sub_location);
65267#endif /* FREECIV_JSON_CONNECTION */
65268 }
65269 if (e) {
65270 log_packet_detailed("'reqs' field error detected");
65271 }
65272 }
65273 if (BV_ISSET(fields, 12)) {
65274 log_packet_detailed(" field 'helptext' has changed");
65275#ifdef FREECIV_JSON_CONNECTION
65276 field_addr.name = "helptext";
65277#endif /* FREECIV_JSON_CONNECTION */
65278 e = 0;
65279 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
65280 if (e) {
65281 log_packet_detailed("'helptext' field error detected");
65282 }
65283 }
65284
65285 *old = *real_packet;
65286#endif /* FREECIV_DELTA_PROTOCOL */
65287#ifndef FREECIV_DELTA_PROTOCOL
65288#ifdef FREECIV_JSON_CONNECTION
65289 field_addr.name = "id";
65290#endif /* FREECIV_JSON_CONNECTION */
65291 e = 0;
65292 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
65293 if (e) {
65294 log_packet_detailed("'id' field error detected");
65295 }
65296#ifdef FREECIV_JSON_CONNECTION
65297 field_addr.name = "start";
65298#endif /* FREECIV_JSON_CONNECTION */
65299 e = 0;
65300 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->start);
65301 if (e) {
65302 log_packet_detailed("'start' field error detected");
65303 }
65304#ifdef FREECIV_JSON_CONNECTION
65305 field_addr.name = "stop";
65306#endif /* FREECIV_JSON_CONNECTION */
65307 e = 0;
65308 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->stop);
65309 if (e) {
65310 log_packet_detailed("'stop' field error detected");
65311 }
65312#ifdef FREECIV_JSON_CONNECTION
65313 field_addr.name = "step";
65314#endif /* FREECIV_JSON_CONNECTION */
65315 e = 0;
65316 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->step);
65317 if (e) {
65318 log_packet_detailed("'step' field error detected");
65319 }
65320#ifdef FREECIV_JSON_CONNECTION
65321 field_addr.name = "def";
65322#endif /* FREECIV_JSON_CONNECTION */
65323 e = 0;
65324 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->def);
65325 if (e) {
65326 log_packet_detailed("'def' field error detected");
65327 }
65328#ifdef FREECIV_JSON_CONNECTION
65329 field_addr.name = "offset";
65330#endif /* FREECIV_JSON_CONNECTION */
65331 e = 0;
65332 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->offset);
65333 if (e) {
65334 log_packet_detailed("'offset' field error detected");
65335 }
65336#ifdef FREECIV_JSON_CONNECTION
65337 field_addr.name = "factor";
65338#endif /* FREECIV_JSON_CONNECTION */
65339 e = 0;
65340 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->factor);
65341 if (e) {
65342 log_packet_detailed("'factor' field error detected");
65343 }
65344#ifdef FREECIV_JSON_CONNECTION
65345 field_addr.name = "minimum_turns";
65346#endif /* FREECIV_JSON_CONNECTION */
65347 e = 0;
65348 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->minimum_turns);
65349 if (e) {
65350 log_packet_detailed("'minimum_turns' field error detected");
65351 }
65352#ifdef FREECIV_JSON_CONNECTION
65353 field_addr.name = "name";
65354#endif /* FREECIV_JSON_CONNECTION */
65355 e = 0;
65356 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
65357 if (e) {
65358 log_packet_detailed("'name' field error detected");
65359 }
65360#ifdef FREECIV_JSON_CONNECTION
65361 field_addr.name = "rule_name";
65362#endif /* FREECIV_JSON_CONNECTION */
65363 e = 0;
65364 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rule_name);
65365 if (e) {
65366 log_packet_detailed("'rule_name' field error detected");
65367 }
65368#ifdef FREECIV_JSON_CONNECTION
65369 field_addr.name = "reqs_count";
65370#endif /* FREECIV_JSON_CONNECTION */
65371 e = 0;
65372 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
65373 if (e) {
65374 log_packet_detailed("'reqs_count' field error detected");
65375 }
65376#ifdef FREECIV_JSON_CONNECTION
65377 field_addr.name = "reqs";
65378#endif /* FREECIV_JSON_CONNECTION */
65379 e = 0;
65380 {
65381 int i;
65382
65383#ifdef FREECIV_JSON_CONNECTION
65384 /* Create the array. */
65385 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
65386
65387 /* Enter the array. */
65388 field_addr.sub_location = plocation_elem_new(0);
65389#endif /* FREECIV_JSON_CONNECTION */
65390
65391 for (i = 0; i < real_packet->reqs_count; i++) {
65392#ifdef FREECIV_JSON_CONNECTION
65393 /* Next array element. */
65394 field_addr.sub_location->number = i;
65395#endif /* FREECIV_JSON_CONNECTION */
65396 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
65397 }
65398
65399#ifdef FREECIV_JSON_CONNECTION
65400 /* Exit array. */
65401 FC_FREE(field_addr.sub_location);
65402#endif /* FREECIV_JSON_CONNECTION */
65403 }
65404 if (e) {
65405 log_packet_detailed("'reqs' field error detected");
65406 }
65407#ifdef FREECIV_JSON_CONNECTION
65408 field_addr.name = "helptext";
65409#endif /* FREECIV_JSON_CONNECTION */
65410 e = 0;
65411 e |= DIO_PUT(string, &dout, &field_addr, real_packet->helptext);
65412 if (e) {
65413 log_packet_detailed("'helptext' field error detected");
65414 }
65415
65416#endif
65417 SEND_PACKET_END(PACKET_RULESET_MULTIPLIER);
65418}
65419
65420 int send_packet_ruleset_multiplier(struct connection *pc, const struct packet_ruleset_multiplier *packet)
65421{
65422 if (!pc->used) {
65423 log_error("WARNING: trying to send data to the closed connection %s",
65424 conn_description(pc));
65425 return -1;
65426 }
65427 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_MULTIPLIER].packet != NULL, -1,
65428 "Handler for PACKET_RULESET_MULTIPLIER not installed");
65429 return pc->phs.handlers->send[PACKET_RULESET_MULTIPLIER].packet(pc, packet);
65430}
65431
65432 void lsend_packet_ruleset_multiplier(struct conn_list *dest, const struct packet_ruleset_multiplier *packet)
65433{
65434 conn_list_iterate(dest, pconn) {
65435 send_packet_ruleset_multiplier(pconn, packet);
65436 } conn_list_iterate_end;
65437}
65438
65439 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 char *helptext)
65440{
65441 struct packet_ruleset_multiplier packet, *real_packet = &packet;
65442
65443 real_packet->id = id;
65444 real_packet->start = start;
65445 real_packet->stop = stop;
65446 real_packet->step = step;
65447 real_packet->def = def;
65448 real_packet->offset = offset;
65449 real_packet->factor = factor;
65450 real_packet->minimum_turns = minimum_turns;
65451 sz_strlcpy(real_packet->name, name);
65452 sz_strlcpy(real_packet->rule_name, rule_name);
65453 real_packet->reqs_count = reqs_count;
65454 {
65455 int i;
65456
65457 for (i = 0; i < real_packet->reqs_count; i++) {
65458 real_packet->reqs[i] = reqs[i];
65459 }
65460 }
65461 sz_strlcpy(real_packet->helptext, helptext);
65462
65463 return send_packet_ruleset_multiplier(pc, real_packet);
65464}
65465
65466 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 char *helptext)
65467{
65468 struct packet_ruleset_multiplier packet, *real_packet = &packet;
65469
65470 real_packet->id = id;
65471 real_packet->start = start;
65472 real_packet->stop = stop;
65473 real_packet->step = step;
65474 real_packet->def = def;
65475 real_packet->offset = offset;
65476 real_packet->factor = factor;
65477 real_packet->minimum_turns = minimum_turns;
65478 sz_strlcpy(real_packet->name, name);
65479 sz_strlcpy(real_packet->rule_name, rule_name);
65480 real_packet->reqs_count = reqs_count;
65481 {
65482 int i;
65483
65484 for (i = 0; i < real_packet->reqs_count; i++) {
65485 real_packet->reqs[i] = reqs[i];
65486 }
65487 }
65488 sz_strlcpy(real_packet->helptext, helptext);
65489
65490 lsend_packet_ruleset_multiplier(dest, real_packet);
65491}
65492
65493#ifdef FREECIV_DELTA_PROTOCOL
65494#define hash_packet_ruleset_clause_100 hash_const
65495
65496#define cmp_packet_ruleset_clause_100 cmp_const
65497
65498 BV_DEFINE(packet_ruleset_clause_100_fields, 6);
65499#endif /* FREECIV_DELTA_PROTOCOL */
65500
65501 static struct packet_ruleset_clause *receive_packet_ruleset_clause_100(struct connection *pc)
65502{
65503#ifdef FREECIV_DELTA_PROTOCOL
65504 packet_ruleset_clause_100_fields fields;
65505 struct packet_ruleset_clause *old;
65506 struct genhash **hash = pc->phs.received + PACKET_RULESET_CLAUSE;
65507#endif /* FREECIV_DELTA_PROTOCOL */
65508 RECEIVE_PACKET_START(packet_ruleset_clause, real_packet);
65509#ifdef FREECIV_JSON_CONNECTION
65510 struct plocation field_addr;
65511 {
65512 struct plocation *field_addr_tmp = plocation_field_new(NULL);
65513 field_addr = *field_addr_tmp;
65514 FC_FREE(field_addr_tmp);
65515 }
65516#endif /* FREECIV_JSON_CONNECTION */
65517
65518#ifdef FREECIV_DELTA_PROTOCOL
65519#ifdef FREECIV_JSON_CONNECTION
65520 field_addr.name = "fields";
65521#endif /* FREECIV_JSON_CONNECTION */
65522 DIO_BV_GET(&din, &field_addr, fields);
65523
65524#else /* FREECIV_DELTA_PROTOCOL */
65525#ifdef FREECIV_JSON_CONNECTION
65526 field_addr.name = "type";
65527#endif /* FREECIV_JSON_CONNECTION */
65528 {
65529 int readin;
65530
65531 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
65532 RECEIVE_PACKET_FIELD_ERROR(type);
65533 }
65534 real_packet->type = readin;
65535 }
65536#ifdef FREECIV_JSON_CONNECTION
65537 field_addr.name = "enabled";
65538#endif /* FREECIV_JSON_CONNECTION */
65539 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->enabled)) {
65540 RECEIVE_PACKET_FIELD_ERROR(enabled);
65541 }
65542#ifdef FREECIV_JSON_CONNECTION
65543 field_addr.name = "giver_reqs_count";
65544#endif /* FREECIV_JSON_CONNECTION */
65545 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->giver_reqs_count)) {
65546 RECEIVE_PACKET_FIELD_ERROR(giver_reqs_count);
65547 }
65548#ifdef FREECIV_JSON_CONNECTION
65549 field_addr.name = "giver_reqs";
65550#endif /* FREECIV_JSON_CONNECTION */
65551 {
65552 int i;
65553
65554#ifdef FREECIV_JSON_CONNECTION
65555 /* Enter array. */
65556 field_addr.sub_location = plocation_elem_new(0);
65557#endif /* FREECIV_JSON_CONNECTION */
65558
65559 if (real_packet->giver_reqs_count > MAX_NUM_REQS) {
65560 RECEIVE_PACKET_FIELD_ERROR(giver_reqs, ": truncation array");
65561 }
65562 for (i = 0; i < real_packet->giver_reqs_count; i++) {
65563#ifdef FREECIV_JSON_CONNECTION
65564 field_addr.sub_location->number = i;
65565#endif /* FREECIV_JSON_CONNECTION */
65566 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->giver_reqs[i])) {
65567 RECEIVE_PACKET_FIELD_ERROR(giver_reqs);
65568 }
65569 }
65570
65571#ifdef FREECIV_JSON_CONNECTION
65572 /* Exit array. */
65573 FC_FREE(field_addr.sub_location);
65574#endif /* FREECIV_JSON_CONNECTION */
65575 }
65576#ifdef FREECIV_JSON_CONNECTION
65577 field_addr.name = "receiver_reqs_count";
65578#endif /* FREECIV_JSON_CONNECTION */
65579 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->receiver_reqs_count)) {
65580 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs_count);
65581 }
65582#ifdef FREECIV_JSON_CONNECTION
65583 field_addr.name = "receiver_reqs";
65584#endif /* FREECIV_JSON_CONNECTION */
65585 {
65586 int i;
65587
65588#ifdef FREECIV_JSON_CONNECTION
65589 /* Enter array. */
65590 field_addr.sub_location = plocation_elem_new(0);
65591#endif /* FREECIV_JSON_CONNECTION */
65592
65593 if (real_packet->receiver_reqs_count > MAX_NUM_REQS) {
65594 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs, ": truncation array");
65595 }
65596 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
65597#ifdef FREECIV_JSON_CONNECTION
65598 field_addr.sub_location->number = i;
65599#endif /* FREECIV_JSON_CONNECTION */
65600 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->receiver_reqs[i])) {
65601 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs);
65602 }
65603 }
65604
65605#ifdef FREECIV_JSON_CONNECTION
65606 /* Exit array. */
65607 FC_FREE(field_addr.sub_location);
65608#endif /* FREECIV_JSON_CONNECTION */
65609 }
65610#endif
65611 log_packet_detailed("packet_ruleset_clause_100: got info about ()");
65612
65613#ifdef FREECIV_DELTA_PROTOCOL
65614 if (NULL == *hash) {
65615 *hash = genhash_new_full(hash_packet_ruleset_clause_100, cmp_packet_ruleset_clause_100,
65616 NULL, NULL, NULL, free);
65617 }
65618
65619 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
65620 *real_packet = *old;
65621 } else {
65622 log_packet_detailed(" no old info");
65623 memset(real_packet, 0, sizeof(*real_packet));
65624 }
65625
65626 if (BV_ISSET(fields, 0)) {
65627 log_packet_detailed(" got field 'type'");
65628#ifdef FREECIV_JSON_CONNECTION
65629 field_addr.name = "type";
65630#endif /* FREECIV_JSON_CONNECTION */
65631 {
65632 int readin;
65633
65634 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
65635 RECEIVE_PACKET_FIELD_ERROR(type);
65636 }
65637 real_packet->type = readin;
65638 }
65639 }
65640 real_packet->enabled = BV_ISSET(fields, 1);
65641 if (BV_ISSET(fields, 2)) {
65642 log_packet_detailed(" got field 'giver_reqs_count'");
65643#ifdef FREECIV_JSON_CONNECTION
65644 field_addr.name = "giver_reqs_count";
65645#endif /* FREECIV_JSON_CONNECTION */
65646 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->giver_reqs_count)) {
65647 RECEIVE_PACKET_FIELD_ERROR(giver_reqs_count);
65648 }
65649 }
65650 if (BV_ISSET(fields, 3)) {
65651 log_packet_detailed(" got field 'giver_reqs'");
65652#ifdef FREECIV_JSON_CONNECTION
65653 field_addr.name = "giver_reqs";
65654#endif /* FREECIV_JSON_CONNECTION */
65655 {
65656 int i;
65657
65658#ifdef FREECIV_JSON_CONNECTION
65659 /* Enter array. */
65660 field_addr.sub_location = plocation_elem_new(0);
65661#endif /* FREECIV_JSON_CONNECTION */
65662
65663 if (real_packet->giver_reqs_count > MAX_NUM_REQS) {
65664 RECEIVE_PACKET_FIELD_ERROR(giver_reqs, ": truncation array");
65665 }
65666 for (i = 0; i < real_packet->giver_reqs_count; i++) {
65667#ifdef FREECIV_JSON_CONNECTION
65668 field_addr.sub_location->number = i;
65669#endif /* FREECIV_JSON_CONNECTION */
65670 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->giver_reqs[i])) {
65671 RECEIVE_PACKET_FIELD_ERROR(giver_reqs);
65672 }
65673 }
65674
65675#ifdef FREECIV_JSON_CONNECTION
65676 /* Exit array. */
65677 FC_FREE(field_addr.sub_location);
65678#endif /* FREECIV_JSON_CONNECTION */
65679 }
65680 }
65681 if (BV_ISSET(fields, 4)) {
65682 log_packet_detailed(" got field 'receiver_reqs_count'");
65683#ifdef FREECIV_JSON_CONNECTION
65684 field_addr.name = "receiver_reqs_count";
65685#endif /* FREECIV_JSON_CONNECTION */
65686 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->receiver_reqs_count)) {
65687 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs_count);
65688 }
65689 }
65690 if (BV_ISSET(fields, 5)) {
65691 log_packet_detailed(" got field 'receiver_reqs'");
65692#ifdef FREECIV_JSON_CONNECTION
65693 field_addr.name = "receiver_reqs";
65694#endif /* FREECIV_JSON_CONNECTION */
65695 {
65696 int i;
65697
65698#ifdef FREECIV_JSON_CONNECTION
65699 /* Enter array. */
65700 field_addr.sub_location = plocation_elem_new(0);
65701#endif /* FREECIV_JSON_CONNECTION */
65702
65703 if (real_packet->receiver_reqs_count > MAX_NUM_REQS) {
65704 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs, ": truncation array");
65705 }
65706 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
65707#ifdef FREECIV_JSON_CONNECTION
65708 field_addr.sub_location->number = i;
65709#endif /* FREECIV_JSON_CONNECTION */
65710 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->receiver_reqs[i])) {
65711 RECEIVE_PACKET_FIELD_ERROR(receiver_reqs);
65712 }
65713 }
65714
65715#ifdef FREECIV_JSON_CONNECTION
65716 /* Exit array. */
65717 FC_FREE(field_addr.sub_location);
65718#endif /* FREECIV_JSON_CONNECTION */
65719 }
65720 }
65721
65722 if (NULL == old) {
65723 old = fc_malloc(sizeof(*old));
65724 *old = *real_packet;
65725 genhash_insert(*hash, old, old);
65726 } else {
65727 *old = *real_packet;
65728 }
65729
65730#endif /* FREECIV_DELTA_PROTOCOL */
65731 RECEIVE_PACKET_END(real_packet);
65732}
65733
65734 static int send_packet_ruleset_clause_100(struct connection *pc, const struct packet_ruleset_clause *packet)
65735{
65736 const struct packet_ruleset_clause *real_packet = packet;
65737 int e;
65738#ifdef FREECIV_DELTA_PROTOCOL
65739 packet_ruleset_clause_100_fields fields;
65740 struct packet_ruleset_clause *old;
65741 bool differ;
65742 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CLAUSE;
65743#endif /* FREECIV_DELTA_PROTOCOL */
65744 SEND_PACKET_START(PACKET_RULESET_CLAUSE);
65745#ifdef FREECIV_JSON_CONNECTION
65746 struct plocation field_addr;
65747 {
65748 struct plocation *field_addr_tmp = plocation_field_new(NULL);
65749 field_addr = *field_addr_tmp;
65750 FC_FREE(field_addr_tmp);
65751 }
65752#endif /* FREECIV_JSON_CONNECTION */
65753
65754 log_packet_detailed("packet_ruleset_clause_100: sending info about ()");
65755
65756#ifdef FREECIV_DELTA_PROTOCOL
65757 if (NULL == *hash) {
65758 *hash = genhash_new_full(hash_packet_ruleset_clause_100, cmp_packet_ruleset_clause_100,
65759 NULL, NULL, NULL, free);
65760 }
65761 BV_CLR_ALL(fields);
65762
65763 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
65764 old = fc_malloc(sizeof(*old));
65765 *old = *real_packet;
65766 genhash_insert(*hash, old, old);
65767 memset(old, 0, sizeof(*old));
65768 }
65769 differ = (old->type != real_packet->type);
65770 if (differ) {
65771 BV_SET(fields, 0);
65772 }
65773
65774 if (packet->enabled) {
65775 BV_SET(fields, 1);
65776 }
65777
65778 differ = (old->giver_reqs_count != real_packet->giver_reqs_count);
65779 if (differ) {
65780 BV_SET(fields, 2);
65781 }
65782
65783 differ = (old->giver_reqs_count != real_packet->giver_reqs_count);
65784 if (!differ) {
65785 int i;
65786
65787 for (i = 0; i < real_packet->giver_reqs_count; i++) {
65788 differ = !are_requirements_equal(&old->giver_reqs[i], &real_packet->giver_reqs[i]);
65789 if (differ) {
65790 break;
65791 }
65792 }
65793 }
65794 if (differ) {
65795 BV_SET(fields, 3);
65796 }
65797
65798 differ = (old->receiver_reqs_count != real_packet->receiver_reqs_count);
65799 if (differ) {
65800 BV_SET(fields, 4);
65801 }
65802
65803 differ = (old->receiver_reqs_count != real_packet->receiver_reqs_count);
65804 if (!differ) {
65805 int i;
65806
65807 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
65808 differ = !are_requirements_equal(&old->receiver_reqs[i], &real_packet->receiver_reqs[i]);
65809 if (differ) {
65810 break;
65811 }
65812 }
65813 }
65814 if (differ) {
65815 BV_SET(fields, 5);
65816 }
65817
65818
65819#ifdef FREECIV_JSON_CONNECTION
65820 field_addr.name = "fields";
65821#endif /* FREECIV_JSON_CONNECTION */
65822 e = 0;
65823 e |= DIO_BV_PUT(&dout, &field_addr, fields);
65824 if (e) {
65825 log_packet_detailed("fields bitvector error detected");
65826 }
65827
65828 if (BV_ISSET(fields, 0)) {
65829 log_packet_detailed(" field 'type' has changed");
65830#ifdef FREECIV_JSON_CONNECTION
65831 field_addr.name = "type";
65832#endif /* FREECIV_JSON_CONNECTION */
65833 e = 0;
65834 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
65835 if (e) {
65836 log_packet_detailed("'type' field error detected");
65837 }
65838 }
65839 /* field 1 is folded into the header */
65840 if (BV_ISSET(fields, 2)) {
65841 log_packet_detailed(" field 'giver_reqs_count' has changed");
65842#ifdef FREECIV_JSON_CONNECTION
65843 field_addr.name = "giver_reqs_count";
65844#endif /* FREECIV_JSON_CONNECTION */
65845 e = 0;
65846 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->giver_reqs_count);
65847 if (e) {
65848 log_packet_detailed("'giver_reqs_count' field error detected");
65849 }
65850 }
65851 if (BV_ISSET(fields, 3)) {
65852 log_packet_detailed(" field 'giver_reqs' has changed");
65853#ifdef FREECIV_JSON_CONNECTION
65854 field_addr.name = "giver_reqs";
65855#endif /* FREECIV_JSON_CONNECTION */
65856 e = 0;
65857 {
65858 int i;
65859
65860#ifdef FREECIV_JSON_CONNECTION
65861 /* Create the array. */
65862 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->giver_reqs_count);
65863
65864 /* Enter the array. */
65865 field_addr.sub_location = plocation_elem_new(0);
65866#endif /* FREECIV_JSON_CONNECTION */
65867
65868 for (i = 0; i < real_packet->giver_reqs_count; i++) {
65869#ifdef FREECIV_JSON_CONNECTION
65870 /* Next array element. */
65871 field_addr.sub_location->number = i;
65872#endif /* FREECIV_JSON_CONNECTION */
65873 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->giver_reqs[i]);
65874 }
65875
65876#ifdef FREECIV_JSON_CONNECTION
65877 /* Exit array. */
65878 FC_FREE(field_addr.sub_location);
65879#endif /* FREECIV_JSON_CONNECTION */
65880 }
65881 if (e) {
65882 log_packet_detailed("'giver_reqs' field error detected");
65883 }
65884 }
65885 if (BV_ISSET(fields, 4)) {
65886 log_packet_detailed(" field 'receiver_reqs_count' has changed");
65887#ifdef FREECIV_JSON_CONNECTION
65888 field_addr.name = "receiver_reqs_count";
65889#endif /* FREECIV_JSON_CONNECTION */
65890 e = 0;
65891 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->receiver_reqs_count);
65892 if (e) {
65893 log_packet_detailed("'receiver_reqs_count' field error detected");
65894 }
65895 }
65896 if (BV_ISSET(fields, 5)) {
65897 log_packet_detailed(" field 'receiver_reqs' has changed");
65898#ifdef FREECIV_JSON_CONNECTION
65899 field_addr.name = "receiver_reqs";
65900#endif /* FREECIV_JSON_CONNECTION */
65901 e = 0;
65902 {
65903 int i;
65904
65905#ifdef FREECIV_JSON_CONNECTION
65906 /* Create the array. */
65907 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->receiver_reqs_count);
65908
65909 /* Enter the array. */
65910 field_addr.sub_location = plocation_elem_new(0);
65911#endif /* FREECIV_JSON_CONNECTION */
65912
65913 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
65914#ifdef FREECIV_JSON_CONNECTION
65915 /* Next array element. */
65916 field_addr.sub_location->number = i;
65917#endif /* FREECIV_JSON_CONNECTION */
65918 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->receiver_reqs[i]);
65919 }
65920
65921#ifdef FREECIV_JSON_CONNECTION
65922 /* Exit array. */
65923 FC_FREE(field_addr.sub_location);
65924#endif /* FREECIV_JSON_CONNECTION */
65925 }
65926 if (e) {
65927 log_packet_detailed("'receiver_reqs' field error detected");
65928 }
65929 }
65930
65931 *old = *real_packet;
65932#endif /* FREECIV_DELTA_PROTOCOL */
65933#ifndef FREECIV_DELTA_PROTOCOL
65934#ifdef FREECIV_JSON_CONNECTION
65935 field_addr.name = "type";
65936#endif /* FREECIV_JSON_CONNECTION */
65937 e = 0;
65938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
65939 if (e) {
65940 log_packet_detailed("'type' field error detected");
65941 }
65942#ifdef FREECIV_JSON_CONNECTION
65943 field_addr.name = "enabled";
65944#endif /* FREECIV_JSON_CONNECTION */
65945 e = 0;
65946 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->enabled);
65947 if (e) {
65948 log_packet_detailed("'enabled' field error detected");
65949 }
65950#ifdef FREECIV_JSON_CONNECTION
65951 field_addr.name = "giver_reqs_count";
65952#endif /* FREECIV_JSON_CONNECTION */
65953 e = 0;
65954 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->giver_reqs_count);
65955 if (e) {
65956 log_packet_detailed("'giver_reqs_count' field error detected");
65957 }
65958#ifdef FREECIV_JSON_CONNECTION
65959 field_addr.name = "giver_reqs";
65960#endif /* FREECIV_JSON_CONNECTION */
65961 e = 0;
65962 {
65963 int i;
65964
65965#ifdef FREECIV_JSON_CONNECTION
65966 /* Create the array. */
65967 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->giver_reqs_count);
65968
65969 /* Enter the array. */
65970 field_addr.sub_location = plocation_elem_new(0);
65971#endif /* FREECIV_JSON_CONNECTION */
65972
65973 for (i = 0; i < real_packet->giver_reqs_count; i++) {
65974#ifdef FREECIV_JSON_CONNECTION
65975 /* Next array element. */
65976 field_addr.sub_location->number = i;
65977#endif /* FREECIV_JSON_CONNECTION */
65978 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->giver_reqs[i]);
65979 }
65980
65981#ifdef FREECIV_JSON_CONNECTION
65982 /* Exit array. */
65983 FC_FREE(field_addr.sub_location);
65984#endif /* FREECIV_JSON_CONNECTION */
65985 }
65986 if (e) {
65987 log_packet_detailed("'giver_reqs' field error detected");
65988 }
65989#ifdef FREECIV_JSON_CONNECTION
65990 field_addr.name = "receiver_reqs_count";
65991#endif /* FREECIV_JSON_CONNECTION */
65992 e = 0;
65993 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->receiver_reqs_count);
65994 if (e) {
65995 log_packet_detailed("'receiver_reqs_count' field error detected");
65996 }
65997#ifdef FREECIV_JSON_CONNECTION
65998 field_addr.name = "receiver_reqs";
65999#endif /* FREECIV_JSON_CONNECTION */
66000 e = 0;
66001 {
66002 int i;
66003
66004#ifdef FREECIV_JSON_CONNECTION
66005 /* Create the array. */
66006 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->receiver_reqs_count);
66007
66008 /* Enter the array. */
66009 field_addr.sub_location = plocation_elem_new(0);
66010#endif /* FREECIV_JSON_CONNECTION */
66011
66012 for (i = 0; i < real_packet->receiver_reqs_count; i++) {
66013#ifdef FREECIV_JSON_CONNECTION
66014 /* Next array element. */
66015 field_addr.sub_location->number = i;
66016#endif /* FREECIV_JSON_CONNECTION */
66017 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->receiver_reqs[i]);
66018 }
66019
66020#ifdef FREECIV_JSON_CONNECTION
66021 /* Exit array. */
66022 FC_FREE(field_addr.sub_location);
66023#endif /* FREECIV_JSON_CONNECTION */
66024 }
66025 if (e) {
66026 log_packet_detailed("'receiver_reqs' field error detected");
66027 }
66028
66029#endif
66030 SEND_PACKET_END(PACKET_RULESET_CLAUSE);
66031}
66032
66033 int send_packet_ruleset_clause(struct connection *pc, const struct packet_ruleset_clause *packet)
66034{
66035 if (!pc->used) {
66036 log_error("WARNING: trying to send data to the closed connection %s",
66037 conn_description(pc));
66038 return -1;
66039 }
66040 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CLAUSE].packet != NULL, -1,
66041 "Handler for PACKET_RULESET_CLAUSE not installed");
66042 return pc->phs.handlers->send[PACKET_RULESET_CLAUSE].packet(pc, packet);
66043}
66044
66045 void lsend_packet_ruleset_clause(struct conn_list *dest, const struct packet_ruleset_clause *packet)
66046{
66047 conn_list_iterate(dest, pconn) {
66048 send_packet_ruleset_clause(pconn, packet);
66049 } conn_list_iterate_end;
66050}
66051
66052#ifdef FREECIV_DELTA_PROTOCOL
66053#define hash_packet_ruleset_control_100 hash_const
66054
66055#define cmp_packet_ruleset_control_100 cmp_const
66056
66057 BV_DEFINE(packet_ruleset_control_100_fields, 31);
66058#endif /* FREECIV_DELTA_PROTOCOL */
66059
66060 static struct packet_ruleset_control *receive_packet_ruleset_control_100(struct connection *pc)
66061{
66062#ifdef FREECIV_DELTA_PROTOCOL
66063 packet_ruleset_control_100_fields fields;
66064 struct packet_ruleset_control *old;
66065 struct genhash **hash = pc->phs.received + PACKET_RULESET_CONTROL;
66066#endif /* FREECIV_DELTA_PROTOCOL */
66067 RECEIVE_PACKET_START(packet_ruleset_control, real_packet);
66068#ifdef FREECIV_JSON_CONNECTION
66069 struct plocation field_addr;
66070 {
66071 struct plocation *field_addr_tmp = plocation_field_new(NULL);
66072 field_addr = *field_addr_tmp;
66073 FC_FREE(field_addr_tmp);
66074 }
66075#endif /* FREECIV_JSON_CONNECTION */
66076
66077#ifdef FREECIV_DELTA_PROTOCOL
66078#ifdef FREECIV_JSON_CONNECTION
66079 field_addr.name = "fields";
66080#endif /* FREECIV_JSON_CONNECTION */
66081 DIO_BV_GET(&din, &field_addr, fields);
66082
66083#else /* FREECIV_DELTA_PROTOCOL */
66084#ifdef FREECIV_JSON_CONNECTION
66085 field_addr.name = "num_unit_classes";
66086#endif /* FREECIV_JSON_CONNECTION */
66087 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
66088 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
66089 }
66090#ifdef FREECIV_JSON_CONNECTION
66091 field_addr.name = "num_unit_types";
66092#endif /* FREECIV_JSON_CONNECTION */
66093 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
66094 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
66095 }
66096#ifdef FREECIV_JSON_CONNECTION
66097 field_addr.name = "num_impr_types";
66098#endif /* FREECIV_JSON_CONNECTION */
66099 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
66100 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
66101 }
66102#ifdef FREECIV_JSON_CONNECTION
66103 field_addr.name = "num_tech_classes";
66104#endif /* FREECIV_JSON_CONNECTION */
66105 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
66106 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
66107 }
66108#ifdef FREECIV_JSON_CONNECTION
66109 field_addr.name = "num_tech_types";
66110#endif /* FREECIV_JSON_CONNECTION */
66111 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
66112 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
66113 }
66114#ifdef FREECIV_JSON_CONNECTION
66115 field_addr.name = "num_extra_types";
66116#endif /* FREECIV_JSON_CONNECTION */
66117 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
66118 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
66119 }
66120#ifdef FREECIV_JSON_CONNECTION
66121 field_addr.name = "num_base_types";
66122#endif /* FREECIV_JSON_CONNECTION */
66123 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
66124 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
66125 }
66126#ifdef FREECIV_JSON_CONNECTION
66127 field_addr.name = "num_road_types";
66128#endif /* FREECIV_JSON_CONNECTION */
66129 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
66130 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
66131 }
66132#ifdef FREECIV_JSON_CONNECTION
66133 field_addr.name = "num_resource_types";
66134#endif /* FREECIV_JSON_CONNECTION */
66135 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
66136 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
66137 }
66138#ifdef FREECIV_JSON_CONNECTION
66139 field_addr.name = "num_goods_types";
66140#endif /* FREECIV_JSON_CONNECTION */
66141 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
66142 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
66143 }
66144#ifdef FREECIV_JSON_CONNECTION
66145 field_addr.name = "num_disaster_types";
66146#endif /* FREECIV_JSON_CONNECTION */
66147 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
66148 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
66149 }
66150#ifdef FREECIV_JSON_CONNECTION
66151 field_addr.name = "num_achievement_types";
66152#endif /* FREECIV_JSON_CONNECTION */
66153 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
66154 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
66155 }
66156#ifdef FREECIV_JSON_CONNECTION
66157 field_addr.name = "num_multipliers";
66158#endif /* FREECIV_JSON_CONNECTION */
66159 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
66160 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
66161 }
66162#ifdef FREECIV_JSON_CONNECTION
66163 field_addr.name = "num_styles";
66164#endif /* FREECIV_JSON_CONNECTION */
66165 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
66166 RECEIVE_PACKET_FIELD_ERROR(num_styles);
66167 }
66168#ifdef FREECIV_JSON_CONNECTION
66169 field_addr.name = "num_music_styles";
66170#endif /* FREECIV_JSON_CONNECTION */
66171 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
66172 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
66173 }
66174#ifdef FREECIV_JSON_CONNECTION
66175 field_addr.name = "government_count";
66176#endif /* FREECIV_JSON_CONNECTION */
66177 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
66178 RECEIVE_PACKET_FIELD_ERROR(government_count);
66179 }
66180#ifdef FREECIV_JSON_CONNECTION
66181 field_addr.name = "nation_count";
66182#endif /* FREECIV_JSON_CONNECTION */
66183 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
66184 RECEIVE_PACKET_FIELD_ERROR(nation_count);
66185 }
66186#ifdef FREECIV_JSON_CONNECTION
66187 field_addr.name = "num_city_styles";
66188#endif /* FREECIV_JSON_CONNECTION */
66189 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_city_styles)) {
66190 RECEIVE_PACKET_FIELD_ERROR(num_city_styles);
66191 }
66192#ifdef FREECIV_JSON_CONNECTION
66193 field_addr.name = "terrain_count";
66194#endif /* FREECIV_JSON_CONNECTION */
66195 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
66196 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
66197 }
66198#ifdef FREECIV_JSON_CONNECTION
66199 field_addr.name = "num_specialist_types";
66200#endif /* FREECIV_JSON_CONNECTION */
66201 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
66202 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
66203 }
66204#ifdef FREECIV_JSON_CONNECTION
66205 field_addr.name = "num_nation_groups";
66206#endif /* FREECIV_JSON_CONNECTION */
66207 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
66208 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
66209 }
66210#ifdef FREECIV_JSON_CONNECTION
66211 field_addr.name = "num_nation_sets";
66212#endif /* FREECIV_JSON_CONNECTION */
66213 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
66214 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
66215 }
66216#ifdef FREECIV_JSON_CONNECTION
66217 field_addr.name = "preferred_tileset";
66218#endif /* FREECIV_JSON_CONNECTION */
66219 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
66220 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
66221 }
66222#ifdef FREECIV_JSON_CONNECTION
66223 field_addr.name = "preferred_soundset";
66224#endif /* FREECIV_JSON_CONNECTION */
66225 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
66226 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
66227 }
66228#ifdef FREECIV_JSON_CONNECTION
66229 field_addr.name = "preferred_musicset";
66230#endif /* FREECIV_JSON_CONNECTION */
66231 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
66232 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
66233 }
66234#ifdef FREECIV_JSON_CONNECTION
66235 field_addr.name = "popup_tech_help";
66236#endif /* FREECIV_JSON_CONNECTION */
66237 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->popup_tech_help)) {
66238 RECEIVE_PACKET_FIELD_ERROR(popup_tech_help);
66239 }
66240#ifdef FREECIV_JSON_CONNECTION
66241 field_addr.name = "name";
66242#endif /* FREECIV_JSON_CONNECTION */
66243 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
66244 RECEIVE_PACKET_FIELD_ERROR(name);
66245 }
66246#ifdef FREECIV_JSON_CONNECTION
66247 field_addr.name = "version";
66248#endif /* FREECIV_JSON_CONNECTION */
66249 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
66250 RECEIVE_PACKET_FIELD_ERROR(version);
66251 }
66252#ifdef FREECIV_JSON_CONNECTION
66253 field_addr.name = "alt_dir";
66254#endif /* FREECIV_JSON_CONNECTION */
66255 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
66256 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
66257 }
66258#ifdef FREECIV_JSON_CONNECTION
66259 field_addr.name = "desc_length";
66260#endif /* FREECIV_JSON_CONNECTION */
66261 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->desc_length)) {
66262 RECEIVE_PACKET_FIELD_ERROR(desc_length);
66263 }
66264#ifdef FREECIV_JSON_CONNECTION
66265 field_addr.name = "num_counters";
66266#endif /* FREECIV_JSON_CONNECTION */
66267 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_counters)) {
66268 RECEIVE_PACKET_FIELD_ERROR(num_counters);
66269 }
66270#endif
66271 log_packet_detailed("packet_ruleset_control_100: got info about ()");
66272
66273#ifdef FREECIV_DELTA_PROTOCOL
66274 if (NULL == *hash) {
66275 *hash = genhash_new_full(hash_packet_ruleset_control_100, cmp_packet_ruleset_control_100,
66276 NULL, NULL, NULL, free);
66277 }
66278
66279 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
66280 *real_packet = *old;
66281 } else {
66282 log_packet_detailed(" no old info");
66283 memset(real_packet, 0, sizeof(*real_packet));
66284 }
66285
66286 if (BV_ISSET(fields, 0)) {
66287 log_packet_detailed(" got field 'num_unit_classes'");
66288#ifdef FREECIV_JSON_CONNECTION
66289 field_addr.name = "num_unit_classes";
66290#endif /* FREECIV_JSON_CONNECTION */
66291 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_classes)) {
66292 RECEIVE_PACKET_FIELD_ERROR(num_unit_classes);
66293 }
66294 }
66295 if (BV_ISSET(fields, 1)) {
66296 log_packet_detailed(" got field 'num_unit_types'");
66297#ifdef FREECIV_JSON_CONNECTION
66298 field_addr.name = "num_unit_types";
66299#endif /* FREECIV_JSON_CONNECTION */
66300 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_unit_types)) {
66301 RECEIVE_PACKET_FIELD_ERROR(num_unit_types);
66302 }
66303 }
66304 if (BV_ISSET(fields, 2)) {
66305 log_packet_detailed(" got field 'num_impr_types'");
66306#ifdef FREECIV_JSON_CONNECTION
66307 field_addr.name = "num_impr_types";
66308#endif /* FREECIV_JSON_CONNECTION */
66309 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_impr_types)) {
66310 RECEIVE_PACKET_FIELD_ERROR(num_impr_types);
66311 }
66312 }
66313 if (BV_ISSET(fields, 3)) {
66314 log_packet_detailed(" got field 'num_tech_classes'");
66315#ifdef FREECIV_JSON_CONNECTION
66316 field_addr.name = "num_tech_classes";
66317#endif /* FREECIV_JSON_CONNECTION */
66318 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_classes)) {
66319 RECEIVE_PACKET_FIELD_ERROR(num_tech_classes);
66320 }
66321 }
66322 if (BV_ISSET(fields, 4)) {
66323 log_packet_detailed(" got field 'num_tech_types'");
66324#ifdef FREECIV_JSON_CONNECTION
66325 field_addr.name = "num_tech_types";
66326#endif /* FREECIV_JSON_CONNECTION */
66327 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_tech_types)) {
66328 RECEIVE_PACKET_FIELD_ERROR(num_tech_types);
66329 }
66330 }
66331 if (BV_ISSET(fields, 5)) {
66332 log_packet_detailed(" got field 'num_extra_types'");
66333#ifdef FREECIV_JSON_CONNECTION
66334 field_addr.name = "num_extra_types";
66335#endif /* FREECIV_JSON_CONNECTION */
66336 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_extra_types)) {
66337 RECEIVE_PACKET_FIELD_ERROR(num_extra_types);
66338 }
66339 }
66340 if (BV_ISSET(fields, 6)) {
66341 log_packet_detailed(" got field 'num_base_types'");
66342#ifdef FREECIV_JSON_CONNECTION
66343 field_addr.name = "num_base_types";
66344#endif /* FREECIV_JSON_CONNECTION */
66345 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_base_types)) {
66346 RECEIVE_PACKET_FIELD_ERROR(num_base_types);
66347 }
66348 }
66349 if (BV_ISSET(fields, 7)) {
66350 log_packet_detailed(" got field 'num_road_types'");
66351#ifdef FREECIV_JSON_CONNECTION
66352 field_addr.name = "num_road_types";
66353#endif /* FREECIV_JSON_CONNECTION */
66354 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_road_types)) {
66355 RECEIVE_PACKET_FIELD_ERROR(num_road_types);
66356 }
66357 }
66358 if (BV_ISSET(fields, 8)) {
66359 log_packet_detailed(" got field 'num_resource_types'");
66360#ifdef FREECIV_JSON_CONNECTION
66361 field_addr.name = "num_resource_types";
66362#endif /* FREECIV_JSON_CONNECTION */
66363 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_resource_types)) {
66364 RECEIVE_PACKET_FIELD_ERROR(num_resource_types);
66365 }
66366 }
66367 if (BV_ISSET(fields, 9)) {
66368 log_packet_detailed(" got field 'num_goods_types'");
66369#ifdef FREECIV_JSON_CONNECTION
66370 field_addr.name = "num_goods_types";
66371#endif /* FREECIV_JSON_CONNECTION */
66372 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_goods_types)) {
66373 RECEIVE_PACKET_FIELD_ERROR(num_goods_types);
66374 }
66375 }
66376 if (BV_ISSET(fields, 10)) {
66377 log_packet_detailed(" got field 'num_disaster_types'");
66378#ifdef FREECIV_JSON_CONNECTION
66379 field_addr.name = "num_disaster_types";
66380#endif /* FREECIV_JSON_CONNECTION */
66381 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_disaster_types)) {
66382 RECEIVE_PACKET_FIELD_ERROR(num_disaster_types);
66383 }
66384 }
66385 if (BV_ISSET(fields, 11)) {
66386 log_packet_detailed(" got field 'num_achievement_types'");
66387#ifdef FREECIV_JSON_CONNECTION
66388 field_addr.name = "num_achievement_types";
66389#endif /* FREECIV_JSON_CONNECTION */
66390 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_achievement_types)) {
66391 RECEIVE_PACKET_FIELD_ERROR(num_achievement_types);
66392 }
66393 }
66394 if (BV_ISSET(fields, 12)) {
66395 log_packet_detailed(" got field 'num_multipliers'");
66396#ifdef FREECIV_JSON_CONNECTION
66397 field_addr.name = "num_multipliers";
66398#endif /* FREECIV_JSON_CONNECTION */
66399 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_multipliers)) {
66400 RECEIVE_PACKET_FIELD_ERROR(num_multipliers);
66401 }
66402 }
66403 if (BV_ISSET(fields, 13)) {
66404 log_packet_detailed(" got field 'num_styles'");
66405#ifdef FREECIV_JSON_CONNECTION
66406 field_addr.name = "num_styles";
66407#endif /* FREECIV_JSON_CONNECTION */
66408 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_styles)) {
66409 RECEIVE_PACKET_FIELD_ERROR(num_styles);
66410 }
66411 }
66412 if (BV_ISSET(fields, 14)) {
66413 log_packet_detailed(" got field 'num_music_styles'");
66414#ifdef FREECIV_JSON_CONNECTION
66415 field_addr.name = "num_music_styles";
66416#endif /* FREECIV_JSON_CONNECTION */
66417 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_music_styles)) {
66418 RECEIVE_PACKET_FIELD_ERROR(num_music_styles);
66419 }
66420 }
66421 if (BV_ISSET(fields, 15)) {
66422 log_packet_detailed(" got field 'government_count'");
66423#ifdef FREECIV_JSON_CONNECTION
66424 field_addr.name = "government_count";
66425#endif /* FREECIV_JSON_CONNECTION */
66426 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->government_count)) {
66427 RECEIVE_PACKET_FIELD_ERROR(government_count);
66428 }
66429 }
66430 if (BV_ISSET(fields, 16)) {
66431 log_packet_detailed(" got field 'nation_count'");
66432#ifdef FREECIV_JSON_CONNECTION
66433 field_addr.name = "nation_count";
66434#endif /* FREECIV_JSON_CONNECTION */
66435 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->nation_count)) {
66436 RECEIVE_PACKET_FIELD_ERROR(nation_count);
66437 }
66438 }
66439 if (BV_ISSET(fields, 17)) {
66440 log_packet_detailed(" got field 'num_city_styles'");
66441#ifdef FREECIV_JSON_CONNECTION
66442 field_addr.name = "num_city_styles";
66443#endif /* FREECIV_JSON_CONNECTION */
66444 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_city_styles)) {
66445 RECEIVE_PACKET_FIELD_ERROR(num_city_styles);
66446 }
66447 }
66448 if (BV_ISSET(fields, 18)) {
66449 log_packet_detailed(" got field 'terrain_count'");
66450#ifdef FREECIV_JSON_CONNECTION
66451 field_addr.name = "terrain_count";
66452#endif /* FREECIV_JSON_CONNECTION */
66453 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->terrain_count)) {
66454 RECEIVE_PACKET_FIELD_ERROR(terrain_count);
66455 }
66456 }
66457 if (BV_ISSET(fields, 19)) {
66458 log_packet_detailed(" got field 'num_specialist_types'");
66459#ifdef FREECIV_JSON_CONNECTION
66460 field_addr.name = "num_specialist_types";
66461#endif /* FREECIV_JSON_CONNECTION */
66462 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_specialist_types)) {
66463 RECEIVE_PACKET_FIELD_ERROR(num_specialist_types);
66464 }
66465 }
66466 if (BV_ISSET(fields, 20)) {
66467 log_packet_detailed(" got field 'num_nation_groups'");
66468#ifdef FREECIV_JSON_CONNECTION
66469 field_addr.name = "num_nation_groups";
66470#endif /* FREECIV_JSON_CONNECTION */
66471 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_groups)) {
66472 RECEIVE_PACKET_FIELD_ERROR(num_nation_groups);
66473 }
66474 }
66475 if (BV_ISSET(fields, 21)) {
66476 log_packet_detailed(" got field 'num_nation_sets'");
66477#ifdef FREECIV_JSON_CONNECTION
66478 field_addr.name = "num_nation_sets";
66479#endif /* FREECIV_JSON_CONNECTION */
66480 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_nation_sets)) {
66481 RECEIVE_PACKET_FIELD_ERROR(num_nation_sets);
66482 }
66483 }
66484 if (BV_ISSET(fields, 22)) {
66485 log_packet_detailed(" got field 'preferred_tileset'");
66486#ifdef FREECIV_JSON_CONNECTION
66487 field_addr.name = "preferred_tileset";
66488#endif /* FREECIV_JSON_CONNECTION */
66489 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_tileset, sizeof(real_packet->preferred_tileset))) {
66490 RECEIVE_PACKET_FIELD_ERROR(preferred_tileset);
66491 }
66492 }
66493 if (BV_ISSET(fields, 23)) {
66494 log_packet_detailed(" got field 'preferred_soundset'");
66495#ifdef FREECIV_JSON_CONNECTION
66496 field_addr.name = "preferred_soundset";
66497#endif /* FREECIV_JSON_CONNECTION */
66498 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_soundset, sizeof(real_packet->preferred_soundset))) {
66499 RECEIVE_PACKET_FIELD_ERROR(preferred_soundset);
66500 }
66501 }
66502 if (BV_ISSET(fields, 24)) {
66503 log_packet_detailed(" got field 'preferred_musicset'");
66504#ifdef FREECIV_JSON_CONNECTION
66505 field_addr.name = "preferred_musicset";
66506#endif /* FREECIV_JSON_CONNECTION */
66507 if (!DIO_GET(string, &din, &field_addr, real_packet->preferred_musicset, sizeof(real_packet->preferred_musicset))) {
66508 RECEIVE_PACKET_FIELD_ERROR(preferred_musicset);
66509 }
66510 }
66511 real_packet->popup_tech_help = BV_ISSET(fields, 25);
66512 if (BV_ISSET(fields, 26)) {
66513 log_packet_detailed(" got field 'name'");
66514#ifdef FREECIV_JSON_CONNECTION
66515 field_addr.name = "name";
66516#endif /* FREECIV_JSON_CONNECTION */
66517 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
66518 RECEIVE_PACKET_FIELD_ERROR(name);
66519 }
66520 }
66521 if (BV_ISSET(fields, 27)) {
66522 log_packet_detailed(" got field 'version'");
66523#ifdef FREECIV_JSON_CONNECTION
66524 field_addr.name = "version";
66525#endif /* FREECIV_JSON_CONNECTION */
66526 if (!DIO_GET(string, &din, &field_addr, real_packet->version, sizeof(real_packet->version))) {
66527 RECEIVE_PACKET_FIELD_ERROR(version);
66528 }
66529 }
66530 if (BV_ISSET(fields, 28)) {
66531 log_packet_detailed(" got field 'alt_dir'");
66532#ifdef FREECIV_JSON_CONNECTION
66533 field_addr.name = "alt_dir";
66534#endif /* FREECIV_JSON_CONNECTION */
66535 if (!DIO_GET(string, &din, &field_addr, real_packet->alt_dir, sizeof(real_packet->alt_dir))) {
66536 RECEIVE_PACKET_FIELD_ERROR(alt_dir);
66537 }
66538 }
66539 if (BV_ISSET(fields, 29)) {
66540 log_packet_detailed(" got field 'desc_length'");
66541#ifdef FREECIV_JSON_CONNECTION
66542 field_addr.name = "desc_length";
66543#endif /* FREECIV_JSON_CONNECTION */
66544 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->desc_length)) {
66545 RECEIVE_PACKET_FIELD_ERROR(desc_length);
66546 }
66547 }
66548 if (BV_ISSET(fields, 30)) {
66549 log_packet_detailed(" got field 'num_counters'");
66550#ifdef FREECIV_JSON_CONNECTION
66551 field_addr.name = "num_counters";
66552#endif /* FREECIV_JSON_CONNECTION */
66553 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->num_counters)) {
66554 RECEIVE_PACKET_FIELD_ERROR(num_counters);
66555 }
66556 }
66557
66558 if (NULL == old) {
66559 old = fc_malloc(sizeof(*old));
66560 *old = *real_packet;
66561 genhash_insert(*hash, old, old);
66562 } else {
66563 *old = *real_packet;
66564 }
66565
66566#endif /* FREECIV_DELTA_PROTOCOL */
66567 RECEIVE_PACKET_END(real_packet);
66568}
66569
66570 static int send_packet_ruleset_control_100(struct connection *pc, const struct packet_ruleset_control *packet)
66571{
66572 const struct packet_ruleset_control *real_packet = packet;
66573 int e;
66574#ifdef FREECIV_DELTA_PROTOCOL
66575 packet_ruleset_control_100_fields fields;
66576 struct packet_ruleset_control *old;
66577 bool differ;
66578 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CONTROL;
66579#endif /* FREECIV_DELTA_PROTOCOL */
66580 SEND_PACKET_START(PACKET_RULESET_CONTROL);
66581#ifdef FREECIV_JSON_CONNECTION
66582 struct plocation field_addr;
66583 {
66584 struct plocation *field_addr_tmp = plocation_field_new(NULL);
66585 field_addr = *field_addr_tmp;
66586 FC_FREE(field_addr_tmp);
66587 }
66588#endif /* FREECIV_JSON_CONNECTION */
66589
66590 log_packet_detailed("packet_ruleset_control_100: sending info about ()");
66591
66592#ifdef FREECIV_DELTA_PROTOCOL
66593 if (NULL == *hash) {
66594 *hash = genhash_new_full(hash_packet_ruleset_control_100, cmp_packet_ruleset_control_100,
66595 NULL, NULL, NULL, free);
66596 }
66597 BV_CLR_ALL(fields);
66598
66599 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
66600 old = fc_malloc(sizeof(*old));
66601 *old = *real_packet;
66602 genhash_insert(*hash, old, old);
66603 memset(old, 0, sizeof(*old));
66604 }
66605 differ = (old->num_unit_classes != real_packet->num_unit_classes);
66606 if (differ) {
66607 BV_SET(fields, 0);
66608 }
66609
66610 differ = (old->num_unit_types != real_packet->num_unit_types);
66611 if (differ) {
66612 BV_SET(fields, 1);
66613 }
66614
66615 differ = (old->num_impr_types != real_packet->num_impr_types);
66616 if (differ) {
66617 BV_SET(fields, 2);
66618 }
66619
66620 differ = (old->num_tech_classes != real_packet->num_tech_classes);
66621 if (differ) {
66622 BV_SET(fields, 3);
66623 }
66624
66625 differ = (old->num_tech_types != real_packet->num_tech_types);
66626 if (differ) {
66627 BV_SET(fields, 4);
66628 }
66629
66630 differ = (old->num_extra_types != real_packet->num_extra_types);
66631 if (differ) {
66632 BV_SET(fields, 5);
66633 }
66634
66635 differ = (old->num_base_types != real_packet->num_base_types);
66636 if (differ) {
66637 BV_SET(fields, 6);
66638 }
66639
66640 differ = (old->num_road_types != real_packet->num_road_types);
66641 if (differ) {
66642 BV_SET(fields, 7);
66643 }
66644
66645 differ = (old->num_resource_types != real_packet->num_resource_types);
66646 if (differ) {
66647 BV_SET(fields, 8);
66648 }
66649
66650 differ = (old->num_goods_types != real_packet->num_goods_types);
66651 if (differ) {
66652 BV_SET(fields, 9);
66653 }
66654
66655 differ = (old->num_disaster_types != real_packet->num_disaster_types);
66656 if (differ) {
66657 BV_SET(fields, 10);
66658 }
66659
66660 differ = (old->num_achievement_types != real_packet->num_achievement_types);
66661 if (differ) {
66662 BV_SET(fields, 11);
66663 }
66664
66665 differ = (old->num_multipliers != real_packet->num_multipliers);
66666 if (differ) {
66667 BV_SET(fields, 12);
66668 }
66669
66670 differ = (old->num_styles != real_packet->num_styles);
66671 if (differ) {
66672 BV_SET(fields, 13);
66673 }
66674
66675 differ = (old->num_music_styles != real_packet->num_music_styles);
66676 if (differ) {
66677 BV_SET(fields, 14);
66678 }
66679
66680 differ = (old->government_count != real_packet->government_count);
66681 if (differ) {
66682 BV_SET(fields, 15);
66683 }
66684
66685 differ = (old->nation_count != real_packet->nation_count);
66686 if (differ) {
66687 BV_SET(fields, 16);
66688 }
66689
66690 differ = (old->num_city_styles != real_packet->num_city_styles);
66691 if (differ) {
66692 BV_SET(fields, 17);
66693 }
66694
66695 differ = (old->terrain_count != real_packet->terrain_count);
66696 if (differ) {
66697 BV_SET(fields, 18);
66698 }
66699
66700 differ = (old->num_specialist_types != real_packet->num_specialist_types);
66701 if (differ) {
66702 BV_SET(fields, 19);
66703 }
66704
66705 differ = (old->num_nation_groups != real_packet->num_nation_groups);
66706 if (differ) {
66707 BV_SET(fields, 20);
66708 }
66709
66710 differ = (old->num_nation_sets != real_packet->num_nation_sets);
66711 if (differ) {
66712 BV_SET(fields, 21);
66713 }
66714
66715 differ = (strcmp(old->preferred_tileset, real_packet->preferred_tileset) != 0);
66716 if (differ) {
66717 BV_SET(fields, 22);
66718 }
66719
66720 differ = (strcmp(old->preferred_soundset, real_packet->preferred_soundset) != 0);
66721 if (differ) {
66722 BV_SET(fields, 23);
66723 }
66724
66725 differ = (strcmp(old->preferred_musicset, real_packet->preferred_musicset) != 0);
66726 if (differ) {
66727 BV_SET(fields, 24);
66728 }
66729
66730 if (packet->popup_tech_help) {
66731 BV_SET(fields, 25);
66732 }
66733
66734 differ = (strcmp(old->name, real_packet->name) != 0);
66735 if (differ) {
66736 BV_SET(fields, 26);
66737 }
66738
66739 differ = (strcmp(old->version, real_packet->version) != 0);
66740 if (differ) {
66741 BV_SET(fields, 27);
66742 }
66743
66744 differ = (strcmp(old->alt_dir, real_packet->alt_dir) != 0);
66745 if (differ) {
66746 BV_SET(fields, 28);
66747 }
66748
66749 differ = (old->desc_length != real_packet->desc_length);
66750 if (differ) {
66751 BV_SET(fields, 29);
66752 }
66753
66754 differ = (old->num_counters != real_packet->num_counters);
66755 if (differ) {
66756 BV_SET(fields, 30);
66757 }
66758
66759
66760#ifdef FREECIV_JSON_CONNECTION
66761 field_addr.name = "fields";
66762#endif /* FREECIV_JSON_CONNECTION */
66763 e = 0;
66764 e |= DIO_BV_PUT(&dout, &field_addr, fields);
66765 if (e) {
66766 log_packet_detailed("fields bitvector error detected");
66767 }
66768
66769 if (BV_ISSET(fields, 0)) {
66770 log_packet_detailed(" field 'num_unit_classes' has changed");
66771#ifdef FREECIV_JSON_CONNECTION
66772 field_addr.name = "num_unit_classes";
66773#endif /* FREECIV_JSON_CONNECTION */
66774 e = 0;
66775 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
66776 if (e) {
66777 log_packet_detailed("'num_unit_classes' field error detected");
66778 }
66779 }
66780 if (BV_ISSET(fields, 1)) {
66781 log_packet_detailed(" field 'num_unit_types' has changed");
66782#ifdef FREECIV_JSON_CONNECTION
66783 field_addr.name = "num_unit_types";
66784#endif /* FREECIV_JSON_CONNECTION */
66785 e = 0;
66786 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
66787 if (e) {
66788 log_packet_detailed("'num_unit_types' field error detected");
66789 }
66790 }
66791 if (BV_ISSET(fields, 2)) {
66792 log_packet_detailed(" field 'num_impr_types' has changed");
66793#ifdef FREECIV_JSON_CONNECTION
66794 field_addr.name = "num_impr_types";
66795#endif /* FREECIV_JSON_CONNECTION */
66796 e = 0;
66797 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
66798 if (e) {
66799 log_packet_detailed("'num_impr_types' field error detected");
66800 }
66801 }
66802 if (BV_ISSET(fields, 3)) {
66803 log_packet_detailed(" field 'num_tech_classes' has changed");
66804#ifdef FREECIV_JSON_CONNECTION
66805 field_addr.name = "num_tech_classes";
66806#endif /* FREECIV_JSON_CONNECTION */
66807 e = 0;
66808 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
66809 if (e) {
66810 log_packet_detailed("'num_tech_classes' field error detected");
66811 }
66812 }
66813 if (BV_ISSET(fields, 4)) {
66814 log_packet_detailed(" field 'num_tech_types' has changed");
66815#ifdef FREECIV_JSON_CONNECTION
66816 field_addr.name = "num_tech_types";
66817#endif /* FREECIV_JSON_CONNECTION */
66818 e = 0;
66819 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
66820 if (e) {
66821 log_packet_detailed("'num_tech_types' field error detected");
66822 }
66823 }
66824 if (BV_ISSET(fields, 5)) {
66825 log_packet_detailed(" field 'num_extra_types' has changed");
66826#ifdef FREECIV_JSON_CONNECTION
66827 field_addr.name = "num_extra_types";
66828#endif /* FREECIV_JSON_CONNECTION */
66829 e = 0;
66830 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
66831 if (e) {
66832 log_packet_detailed("'num_extra_types' field error detected");
66833 }
66834 }
66835 if (BV_ISSET(fields, 6)) {
66836 log_packet_detailed(" field 'num_base_types' has changed");
66837#ifdef FREECIV_JSON_CONNECTION
66838 field_addr.name = "num_base_types";
66839#endif /* FREECIV_JSON_CONNECTION */
66840 e = 0;
66841 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
66842 if (e) {
66843 log_packet_detailed("'num_base_types' field error detected");
66844 }
66845 }
66846 if (BV_ISSET(fields, 7)) {
66847 log_packet_detailed(" field 'num_road_types' has changed");
66848#ifdef FREECIV_JSON_CONNECTION
66849 field_addr.name = "num_road_types";
66850#endif /* FREECIV_JSON_CONNECTION */
66851 e = 0;
66852 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
66853 if (e) {
66854 log_packet_detailed("'num_road_types' field error detected");
66855 }
66856 }
66857 if (BV_ISSET(fields, 8)) {
66858 log_packet_detailed(" field 'num_resource_types' has changed");
66859#ifdef FREECIV_JSON_CONNECTION
66860 field_addr.name = "num_resource_types";
66861#endif /* FREECIV_JSON_CONNECTION */
66862 e = 0;
66863 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
66864 if (e) {
66865 log_packet_detailed("'num_resource_types' field error detected");
66866 }
66867 }
66868 if (BV_ISSET(fields, 9)) {
66869 log_packet_detailed(" field 'num_goods_types' has changed");
66870#ifdef FREECIV_JSON_CONNECTION
66871 field_addr.name = "num_goods_types";
66872#endif /* FREECIV_JSON_CONNECTION */
66873 e = 0;
66874 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
66875 if (e) {
66876 log_packet_detailed("'num_goods_types' field error detected");
66877 }
66878 }
66879 if (BV_ISSET(fields, 10)) {
66880 log_packet_detailed(" field 'num_disaster_types' has changed");
66881#ifdef FREECIV_JSON_CONNECTION
66882 field_addr.name = "num_disaster_types";
66883#endif /* FREECIV_JSON_CONNECTION */
66884 e = 0;
66885 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
66886 if (e) {
66887 log_packet_detailed("'num_disaster_types' field error detected");
66888 }
66889 }
66890 if (BV_ISSET(fields, 11)) {
66891 log_packet_detailed(" field 'num_achievement_types' has changed");
66892#ifdef FREECIV_JSON_CONNECTION
66893 field_addr.name = "num_achievement_types";
66894#endif /* FREECIV_JSON_CONNECTION */
66895 e = 0;
66896 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
66897 if (e) {
66898 log_packet_detailed("'num_achievement_types' field error detected");
66899 }
66900 }
66901 if (BV_ISSET(fields, 12)) {
66902 log_packet_detailed(" field 'num_multipliers' has changed");
66903#ifdef FREECIV_JSON_CONNECTION
66904 field_addr.name = "num_multipliers";
66905#endif /* FREECIV_JSON_CONNECTION */
66906 e = 0;
66907 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
66908 if (e) {
66909 log_packet_detailed("'num_multipliers' field error detected");
66910 }
66911 }
66912 if (BV_ISSET(fields, 13)) {
66913 log_packet_detailed(" field 'num_styles' has changed");
66914#ifdef FREECIV_JSON_CONNECTION
66915 field_addr.name = "num_styles";
66916#endif /* FREECIV_JSON_CONNECTION */
66917 e = 0;
66918 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
66919 if (e) {
66920 log_packet_detailed("'num_styles' field error detected");
66921 }
66922 }
66923 if (BV_ISSET(fields, 14)) {
66924 log_packet_detailed(" field 'num_music_styles' has changed");
66925#ifdef FREECIV_JSON_CONNECTION
66926 field_addr.name = "num_music_styles";
66927#endif /* FREECIV_JSON_CONNECTION */
66928 e = 0;
66929 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
66930 if (e) {
66931 log_packet_detailed("'num_music_styles' field error detected");
66932 }
66933 }
66934 if (BV_ISSET(fields, 15)) {
66935 log_packet_detailed(" field 'government_count' has changed");
66936#ifdef FREECIV_JSON_CONNECTION
66937 field_addr.name = "government_count";
66938#endif /* FREECIV_JSON_CONNECTION */
66939 e = 0;
66940 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
66941 if (e) {
66942 log_packet_detailed("'government_count' field error detected");
66943 }
66944 }
66945 if (BV_ISSET(fields, 16)) {
66946 log_packet_detailed(" field 'nation_count' has changed");
66947#ifdef FREECIV_JSON_CONNECTION
66948 field_addr.name = "nation_count";
66949#endif /* FREECIV_JSON_CONNECTION */
66950 e = 0;
66951 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
66952 if (e) {
66953 log_packet_detailed("'nation_count' field error detected");
66954 }
66955 }
66956 if (BV_ISSET(fields, 17)) {
66957 log_packet_detailed(" field 'num_city_styles' has changed");
66958#ifdef FREECIV_JSON_CONNECTION
66959 field_addr.name = "num_city_styles";
66960#endif /* FREECIV_JSON_CONNECTION */
66961 e = 0;
66962 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_city_styles);
66963 if (e) {
66964 log_packet_detailed("'num_city_styles' field error detected");
66965 }
66966 }
66967 if (BV_ISSET(fields, 18)) {
66968 log_packet_detailed(" field 'terrain_count' has changed");
66969#ifdef FREECIV_JSON_CONNECTION
66970 field_addr.name = "terrain_count";
66971#endif /* FREECIV_JSON_CONNECTION */
66972 e = 0;
66973 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
66974 if (e) {
66975 log_packet_detailed("'terrain_count' field error detected");
66976 }
66977 }
66978 if (BV_ISSET(fields, 19)) {
66979 log_packet_detailed(" field 'num_specialist_types' has changed");
66980#ifdef FREECIV_JSON_CONNECTION
66981 field_addr.name = "num_specialist_types";
66982#endif /* FREECIV_JSON_CONNECTION */
66983 e = 0;
66984 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
66985 if (e) {
66986 log_packet_detailed("'num_specialist_types' field error detected");
66987 }
66988 }
66989 if (BV_ISSET(fields, 20)) {
66990 log_packet_detailed(" field 'num_nation_groups' has changed");
66991#ifdef FREECIV_JSON_CONNECTION
66992 field_addr.name = "num_nation_groups";
66993#endif /* FREECIV_JSON_CONNECTION */
66994 e = 0;
66995 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
66996 if (e) {
66997 log_packet_detailed("'num_nation_groups' field error detected");
66998 }
66999 }
67000 if (BV_ISSET(fields, 21)) {
67001 log_packet_detailed(" field 'num_nation_sets' has changed");
67002#ifdef FREECIV_JSON_CONNECTION
67003 field_addr.name = "num_nation_sets";
67004#endif /* FREECIV_JSON_CONNECTION */
67005 e = 0;
67006 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
67007 if (e) {
67008 log_packet_detailed("'num_nation_sets' field error detected");
67009 }
67010 }
67011 if (BV_ISSET(fields, 22)) {
67012 log_packet_detailed(" field 'preferred_tileset' has changed");
67013#ifdef FREECIV_JSON_CONNECTION
67014 field_addr.name = "preferred_tileset";
67015#endif /* FREECIV_JSON_CONNECTION */
67016 e = 0;
67017 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
67018 if (e) {
67019 log_packet_detailed("'preferred_tileset' field error detected");
67020 }
67021 }
67022 if (BV_ISSET(fields, 23)) {
67023 log_packet_detailed(" field 'preferred_soundset' has changed");
67024#ifdef FREECIV_JSON_CONNECTION
67025 field_addr.name = "preferred_soundset";
67026#endif /* FREECIV_JSON_CONNECTION */
67027 e = 0;
67028 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
67029 if (e) {
67030 log_packet_detailed("'preferred_soundset' field error detected");
67031 }
67032 }
67033 if (BV_ISSET(fields, 24)) {
67034 log_packet_detailed(" field 'preferred_musicset' has changed");
67035#ifdef FREECIV_JSON_CONNECTION
67036 field_addr.name = "preferred_musicset";
67037#endif /* FREECIV_JSON_CONNECTION */
67038 e = 0;
67039 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
67040 if (e) {
67041 log_packet_detailed("'preferred_musicset' field error detected");
67042 }
67043 }
67044 /* field 25 is folded into the header */
67045 if (BV_ISSET(fields, 26)) {
67046 log_packet_detailed(" field 'name' has changed");
67047#ifdef FREECIV_JSON_CONNECTION
67048 field_addr.name = "name";
67049#endif /* FREECIV_JSON_CONNECTION */
67050 e = 0;
67051 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
67052 if (e) {
67053 log_packet_detailed("'name' field error detected");
67054 }
67055 }
67056 if (BV_ISSET(fields, 27)) {
67057 log_packet_detailed(" field 'version' has changed");
67058#ifdef FREECIV_JSON_CONNECTION
67059 field_addr.name = "version";
67060#endif /* FREECIV_JSON_CONNECTION */
67061 e = 0;
67062 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version);
67063 if (e) {
67064 log_packet_detailed("'version' field error detected");
67065 }
67066 }
67067 if (BV_ISSET(fields, 28)) {
67068 log_packet_detailed(" field 'alt_dir' has changed");
67069#ifdef FREECIV_JSON_CONNECTION
67070 field_addr.name = "alt_dir";
67071#endif /* FREECIV_JSON_CONNECTION */
67072 e = 0;
67073 e |= DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
67074 if (e) {
67075 log_packet_detailed("'alt_dir' field error detected");
67076 }
67077 }
67078 if (BV_ISSET(fields, 29)) {
67079 log_packet_detailed(" field 'desc_length' has changed");
67080#ifdef FREECIV_JSON_CONNECTION
67081 field_addr.name = "desc_length";
67082#endif /* FREECIV_JSON_CONNECTION */
67083 e = 0;
67084 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->desc_length);
67085 if (e) {
67086 log_packet_detailed("'desc_length' field error detected");
67087 }
67088 }
67089 if (BV_ISSET(fields, 30)) {
67090 log_packet_detailed(" field 'num_counters' has changed");
67091#ifdef FREECIV_JSON_CONNECTION
67092 field_addr.name = "num_counters";
67093#endif /* FREECIV_JSON_CONNECTION */
67094 e = 0;
67095 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_counters);
67096 if (e) {
67097 log_packet_detailed("'num_counters' field error detected");
67098 }
67099 }
67100
67101 *old = *real_packet;
67102#endif /* FREECIV_DELTA_PROTOCOL */
67103#ifndef FREECIV_DELTA_PROTOCOL
67104#ifdef FREECIV_JSON_CONNECTION
67105 field_addr.name = "num_unit_classes";
67106#endif /* FREECIV_JSON_CONNECTION */
67107 e = 0;
67108 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_classes);
67109 if (e) {
67110 log_packet_detailed("'num_unit_classes' field error detected");
67111 }
67112#ifdef FREECIV_JSON_CONNECTION
67113 field_addr.name = "num_unit_types";
67114#endif /* FREECIV_JSON_CONNECTION */
67115 e = 0;
67116 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_unit_types);
67117 if (e) {
67118 log_packet_detailed("'num_unit_types' field error detected");
67119 }
67120#ifdef FREECIV_JSON_CONNECTION
67121 field_addr.name = "num_impr_types";
67122#endif /* FREECIV_JSON_CONNECTION */
67123 e = 0;
67124 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_impr_types);
67125 if (e) {
67126 log_packet_detailed("'num_impr_types' field error detected");
67127 }
67128#ifdef FREECIV_JSON_CONNECTION
67129 field_addr.name = "num_tech_classes";
67130#endif /* FREECIV_JSON_CONNECTION */
67131 e = 0;
67132 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_classes);
67133 if (e) {
67134 log_packet_detailed("'num_tech_classes' field error detected");
67135 }
67136#ifdef FREECIV_JSON_CONNECTION
67137 field_addr.name = "num_tech_types";
67138#endif /* FREECIV_JSON_CONNECTION */
67139 e = 0;
67140 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_tech_types);
67141 if (e) {
67142 log_packet_detailed("'num_tech_types' field error detected");
67143 }
67144#ifdef FREECIV_JSON_CONNECTION
67145 field_addr.name = "num_extra_types";
67146#endif /* FREECIV_JSON_CONNECTION */
67147 e = 0;
67148 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_extra_types);
67149 if (e) {
67150 log_packet_detailed("'num_extra_types' field error detected");
67151 }
67152#ifdef FREECIV_JSON_CONNECTION
67153 field_addr.name = "num_base_types";
67154#endif /* FREECIV_JSON_CONNECTION */
67155 e = 0;
67156 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_base_types);
67157 if (e) {
67158 log_packet_detailed("'num_base_types' field error detected");
67159 }
67160#ifdef FREECIV_JSON_CONNECTION
67161 field_addr.name = "num_road_types";
67162#endif /* FREECIV_JSON_CONNECTION */
67163 e = 0;
67164 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_road_types);
67165 if (e) {
67166 log_packet_detailed("'num_road_types' field error detected");
67167 }
67168#ifdef FREECIV_JSON_CONNECTION
67169 field_addr.name = "num_resource_types";
67170#endif /* FREECIV_JSON_CONNECTION */
67171 e = 0;
67172 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_resource_types);
67173 if (e) {
67174 log_packet_detailed("'num_resource_types' field error detected");
67175 }
67176#ifdef FREECIV_JSON_CONNECTION
67177 field_addr.name = "num_goods_types";
67178#endif /* FREECIV_JSON_CONNECTION */
67179 e = 0;
67180 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_goods_types);
67181 if (e) {
67182 log_packet_detailed("'num_goods_types' field error detected");
67183 }
67184#ifdef FREECIV_JSON_CONNECTION
67185 field_addr.name = "num_disaster_types";
67186#endif /* FREECIV_JSON_CONNECTION */
67187 e = 0;
67188 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_disaster_types);
67189 if (e) {
67190 log_packet_detailed("'num_disaster_types' field error detected");
67191 }
67192#ifdef FREECIV_JSON_CONNECTION
67193 field_addr.name = "num_achievement_types";
67194#endif /* FREECIV_JSON_CONNECTION */
67195 e = 0;
67196 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_achievement_types);
67197 if (e) {
67198 log_packet_detailed("'num_achievement_types' field error detected");
67199 }
67200#ifdef FREECIV_JSON_CONNECTION
67201 field_addr.name = "num_multipliers";
67202#endif /* FREECIV_JSON_CONNECTION */
67203 e = 0;
67204 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_multipliers);
67205 if (e) {
67206 log_packet_detailed("'num_multipliers' field error detected");
67207 }
67208#ifdef FREECIV_JSON_CONNECTION
67209 field_addr.name = "num_styles";
67210#endif /* FREECIV_JSON_CONNECTION */
67211 e = 0;
67212 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_styles);
67213 if (e) {
67214 log_packet_detailed("'num_styles' field error detected");
67215 }
67216#ifdef FREECIV_JSON_CONNECTION
67217 field_addr.name = "num_music_styles";
67218#endif /* FREECIV_JSON_CONNECTION */
67219 e = 0;
67220 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_music_styles);
67221 if (e) {
67222 log_packet_detailed("'num_music_styles' field error detected");
67223 }
67224#ifdef FREECIV_JSON_CONNECTION
67225 field_addr.name = "government_count";
67226#endif /* FREECIV_JSON_CONNECTION */
67227 e = 0;
67228 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->government_count);
67229 if (e) {
67230 log_packet_detailed("'government_count' field error detected");
67231 }
67232#ifdef FREECIV_JSON_CONNECTION
67233 field_addr.name = "nation_count";
67234#endif /* FREECIV_JSON_CONNECTION */
67235 e = 0;
67236 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->nation_count);
67237 if (e) {
67238 log_packet_detailed("'nation_count' field error detected");
67239 }
67240#ifdef FREECIV_JSON_CONNECTION
67241 field_addr.name = "num_city_styles";
67242#endif /* FREECIV_JSON_CONNECTION */
67243 e = 0;
67244 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_city_styles);
67245 if (e) {
67246 log_packet_detailed("'num_city_styles' field error detected");
67247 }
67248#ifdef FREECIV_JSON_CONNECTION
67249 field_addr.name = "terrain_count";
67250#endif /* FREECIV_JSON_CONNECTION */
67251 e = 0;
67252 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->terrain_count);
67253 if (e) {
67254 log_packet_detailed("'terrain_count' field error detected");
67255 }
67256#ifdef FREECIV_JSON_CONNECTION
67257 field_addr.name = "num_specialist_types";
67258#endif /* FREECIV_JSON_CONNECTION */
67259 e = 0;
67260 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_specialist_types);
67261 if (e) {
67262 log_packet_detailed("'num_specialist_types' field error detected");
67263 }
67264#ifdef FREECIV_JSON_CONNECTION
67265 field_addr.name = "num_nation_groups";
67266#endif /* FREECIV_JSON_CONNECTION */
67267 e = 0;
67268 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_groups);
67269 if (e) {
67270 log_packet_detailed("'num_nation_groups' field error detected");
67271 }
67272#ifdef FREECIV_JSON_CONNECTION
67273 field_addr.name = "num_nation_sets";
67274#endif /* FREECIV_JSON_CONNECTION */
67275 e = 0;
67276 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_nation_sets);
67277 if (e) {
67278 log_packet_detailed("'num_nation_sets' field error detected");
67279 }
67280#ifdef FREECIV_JSON_CONNECTION
67281 field_addr.name = "preferred_tileset";
67282#endif /* FREECIV_JSON_CONNECTION */
67283 e = 0;
67284 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_tileset);
67285 if (e) {
67286 log_packet_detailed("'preferred_tileset' field error detected");
67287 }
67288#ifdef FREECIV_JSON_CONNECTION
67289 field_addr.name = "preferred_soundset";
67290#endif /* FREECIV_JSON_CONNECTION */
67291 e = 0;
67292 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_soundset);
67293 if (e) {
67294 log_packet_detailed("'preferred_soundset' field error detected");
67295 }
67296#ifdef FREECIV_JSON_CONNECTION
67297 field_addr.name = "preferred_musicset";
67298#endif /* FREECIV_JSON_CONNECTION */
67299 e = 0;
67300 e |= DIO_PUT(string, &dout, &field_addr, real_packet->preferred_musicset);
67301 if (e) {
67302 log_packet_detailed("'preferred_musicset' field error detected");
67303 }
67304#ifdef FREECIV_JSON_CONNECTION
67305 field_addr.name = "popup_tech_help";
67306#endif /* FREECIV_JSON_CONNECTION */
67307 e = 0;
67308 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->popup_tech_help);
67309 if (e) {
67310 log_packet_detailed("'popup_tech_help' field error detected");
67311 }
67312#ifdef FREECIV_JSON_CONNECTION
67313 field_addr.name = "name";
67314#endif /* FREECIV_JSON_CONNECTION */
67315 e = 0;
67316 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
67317 if (e) {
67318 log_packet_detailed("'name' field error detected");
67319 }
67320#ifdef FREECIV_JSON_CONNECTION
67321 field_addr.name = "version";
67322#endif /* FREECIV_JSON_CONNECTION */
67323 e = 0;
67324 e |= DIO_PUT(string, &dout, &field_addr, real_packet->version);
67325 if (e) {
67326 log_packet_detailed("'version' field error detected");
67327 }
67328#ifdef FREECIV_JSON_CONNECTION
67329 field_addr.name = "alt_dir";
67330#endif /* FREECIV_JSON_CONNECTION */
67331 e = 0;
67332 e |= DIO_PUT(string, &dout, &field_addr, real_packet->alt_dir);
67333 if (e) {
67334 log_packet_detailed("'alt_dir' field error detected");
67335 }
67336#ifdef FREECIV_JSON_CONNECTION
67337 field_addr.name = "desc_length";
67338#endif /* FREECIV_JSON_CONNECTION */
67339 e = 0;
67340 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->desc_length);
67341 if (e) {
67342 log_packet_detailed("'desc_length' field error detected");
67343 }
67344#ifdef FREECIV_JSON_CONNECTION
67345 field_addr.name = "num_counters";
67346#endif /* FREECIV_JSON_CONNECTION */
67347 e = 0;
67348 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->num_counters);
67349 if (e) {
67350 log_packet_detailed("'num_counters' field error detected");
67351 }
67352
67353#endif
67354 SEND_PACKET_END(PACKET_RULESET_CONTROL);
67355}
67356
67357 int send_packet_ruleset_control(struct connection *pc, const struct packet_ruleset_control *packet)
67358{
67359 if (!pc->used) {
67360 log_error("WARNING: trying to send data to the closed connection %s",
67361 conn_description(pc));
67362 return -1;
67363 }
67364 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CONTROL].packet != NULL, -1,
67365 "Handler for PACKET_RULESET_CONTROL not installed");
67366 return pc->phs.handlers->send[PACKET_RULESET_CONTROL].packet(pc, packet);
67367}
67368
67369 void lsend_packet_ruleset_control(struct conn_list *dest, const struct packet_ruleset_control *packet)
67370{
67371 conn_list_iterate(dest, pconn) {
67372 send_packet_ruleset_control(pconn, packet);
67373 } conn_list_iterate_end;
67374}
67375
67376#ifdef FREECIV_DELTA_PROTOCOL
67377#define hash_packet_ruleset_summary_100 hash_const
67378
67379#define cmp_packet_ruleset_summary_100 cmp_const
67380
67381 BV_DEFINE(packet_ruleset_summary_100_fields, 1);
67382#endif /* FREECIV_DELTA_PROTOCOL */
67383
67384 static struct packet_ruleset_summary *receive_packet_ruleset_summary_100(struct connection *pc)
67385{
67386#ifdef FREECIV_DELTA_PROTOCOL
67387 packet_ruleset_summary_100_fields fields;
67388 struct packet_ruleset_summary *old;
67389 struct genhash **hash = pc->phs.received + PACKET_RULESET_SUMMARY;
67390#endif /* FREECIV_DELTA_PROTOCOL */
67391 RECEIVE_PACKET_START(packet_ruleset_summary, real_packet);
67392#ifdef FREECIV_JSON_CONNECTION
67393 struct plocation field_addr;
67394 {
67395 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67396 field_addr = *field_addr_tmp;
67397 FC_FREE(field_addr_tmp);
67398 }
67399#endif /* FREECIV_JSON_CONNECTION */
67400
67401#ifdef FREECIV_DELTA_PROTOCOL
67402#ifdef FREECIV_JSON_CONNECTION
67403 field_addr.name = "fields";
67404#endif /* FREECIV_JSON_CONNECTION */
67405 DIO_BV_GET(&din, &field_addr, fields);
67406
67407#else /* FREECIV_DELTA_PROTOCOL */
67408#ifdef FREECIV_JSON_CONNECTION
67409 field_addr.name = "text";
67410#endif /* FREECIV_JSON_CONNECTION */
67411 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
67412 RECEIVE_PACKET_FIELD_ERROR(text);
67413 }
67414#endif
67415 log_packet_detailed("packet_ruleset_summary_100: got info about ()");
67416
67417#ifdef FREECIV_DELTA_PROTOCOL
67418 if (NULL == *hash) {
67419 *hash = genhash_new_full(hash_packet_ruleset_summary_100, cmp_packet_ruleset_summary_100,
67420 NULL, NULL, NULL, free);
67421 }
67422
67423 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
67424 *real_packet = *old;
67425 } else {
67426 log_packet_detailed(" no old info");
67427 memset(real_packet, 0, sizeof(*real_packet));
67428 }
67429
67430 if (BV_ISSET(fields, 0)) {
67431 log_packet_detailed(" got field 'text'");
67432#ifdef FREECIV_JSON_CONNECTION
67433 field_addr.name = "text";
67434#endif /* FREECIV_JSON_CONNECTION */
67435 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
67436 RECEIVE_PACKET_FIELD_ERROR(text);
67437 }
67438 }
67439
67440 if (NULL == old) {
67441 old = fc_malloc(sizeof(*old));
67442 *old = *real_packet;
67443 genhash_insert(*hash, old, old);
67444 } else {
67445 *old = *real_packet;
67446 }
67447
67448#endif /* FREECIV_DELTA_PROTOCOL */
67449 RECEIVE_PACKET_END(real_packet);
67450}
67451
67452 static int send_packet_ruleset_summary_100(struct connection *pc, const struct packet_ruleset_summary *packet)
67453{
67454 const struct packet_ruleset_summary *real_packet = packet;
67455 int e;
67456#ifdef FREECIV_DELTA_PROTOCOL
67457 packet_ruleset_summary_100_fields fields;
67458 struct packet_ruleset_summary *old;
67459 bool differ;
67460 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SUMMARY;
67461#endif /* FREECIV_DELTA_PROTOCOL */
67462 SEND_PACKET_START(PACKET_RULESET_SUMMARY);
67463#ifdef FREECIV_JSON_CONNECTION
67464 struct plocation field_addr;
67465 {
67466 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67467 field_addr = *field_addr_tmp;
67468 FC_FREE(field_addr_tmp);
67469 }
67470#endif /* FREECIV_JSON_CONNECTION */
67471
67472 log_packet_detailed("packet_ruleset_summary_100: sending info about ()");
67473
67474#ifdef FREECIV_DELTA_PROTOCOL
67475 if (NULL == *hash) {
67476 *hash = genhash_new_full(hash_packet_ruleset_summary_100, cmp_packet_ruleset_summary_100,
67477 NULL, NULL, NULL, free);
67478 }
67479 BV_CLR_ALL(fields);
67480
67481 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
67482 old = fc_malloc(sizeof(*old));
67483 *old = *real_packet;
67484 genhash_insert(*hash, old, old);
67485 memset(old, 0, sizeof(*old));
67486 }
67487 differ = (strcmp(old->text, real_packet->text) != 0);
67488 if (differ) {
67489 BV_SET(fields, 0);
67490 }
67491
67492
67493#ifdef FREECIV_JSON_CONNECTION
67494 field_addr.name = "fields";
67495#endif /* FREECIV_JSON_CONNECTION */
67496 e = 0;
67497 e |= DIO_BV_PUT(&dout, &field_addr, fields);
67498 if (e) {
67499 log_packet_detailed("fields bitvector error detected");
67500 }
67501
67502 if (BV_ISSET(fields, 0)) {
67503 log_packet_detailed(" field 'text' has changed");
67504#ifdef FREECIV_JSON_CONNECTION
67505 field_addr.name = "text";
67506#endif /* FREECIV_JSON_CONNECTION */
67507 e = 0;
67508 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
67509 if (e) {
67510 log_packet_detailed("'text' field error detected");
67511 }
67512 }
67513
67514 *old = *real_packet;
67515#endif /* FREECIV_DELTA_PROTOCOL */
67516#ifndef FREECIV_DELTA_PROTOCOL
67517#ifdef FREECIV_JSON_CONNECTION
67518 field_addr.name = "text";
67519#endif /* FREECIV_JSON_CONNECTION */
67520 e = 0;
67521 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
67522 if (e) {
67523 log_packet_detailed("'text' field error detected");
67524 }
67525
67526#endif
67527 SEND_PACKET_END(PACKET_RULESET_SUMMARY);
67528}
67529
67530 int send_packet_ruleset_summary(struct connection *pc, const struct packet_ruleset_summary *packet)
67531{
67532 if (!pc->used) {
67533 log_error("WARNING: trying to send data to the closed connection %s",
67534 conn_description(pc));
67535 return -1;
67536 }
67537 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SUMMARY].packet != NULL, -1,
67538 "Handler for PACKET_RULESET_SUMMARY not installed");
67539 return pc->phs.handlers->send[PACKET_RULESET_SUMMARY].packet(pc, packet);
67540}
67541
67542 void lsend_packet_ruleset_summary(struct conn_list *dest, const struct packet_ruleset_summary *packet)
67543{
67544 conn_list_iterate(dest, pconn) {
67545 send_packet_ruleset_summary(pconn, packet);
67546 } conn_list_iterate_end;
67547}
67548
67549#ifdef FREECIV_DELTA_PROTOCOL
67550#define hash_packet_ruleset_description_part_100 hash_const
67551
67552#define cmp_packet_ruleset_description_part_100 cmp_const
67553
67554 BV_DEFINE(packet_ruleset_description_part_100_fields, 1);
67555#endif /* FREECIV_DELTA_PROTOCOL */
67556
67557 static struct packet_ruleset_description_part *receive_packet_ruleset_description_part_100(struct connection *pc)
67558{
67559#ifdef FREECIV_DELTA_PROTOCOL
67560 packet_ruleset_description_part_100_fields fields;
67561 struct packet_ruleset_description_part *old;
67562 struct genhash **hash = pc->phs.received + PACKET_RULESET_DESCRIPTION_PART;
67563#endif /* FREECIV_DELTA_PROTOCOL */
67564 RECEIVE_PACKET_START(packet_ruleset_description_part, real_packet);
67565#ifdef FREECIV_JSON_CONNECTION
67566 struct plocation field_addr;
67567 {
67568 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67569 field_addr = *field_addr_tmp;
67570 FC_FREE(field_addr_tmp);
67571 }
67572#endif /* FREECIV_JSON_CONNECTION */
67573
67574#ifdef FREECIV_DELTA_PROTOCOL
67575#ifdef FREECIV_JSON_CONNECTION
67576 field_addr.name = "fields";
67577#endif /* FREECIV_JSON_CONNECTION */
67578 DIO_BV_GET(&din, &field_addr, fields);
67579
67580#else /* FREECIV_DELTA_PROTOCOL */
67581#ifdef FREECIV_JSON_CONNECTION
67582 field_addr.name = "text";
67583#endif /* FREECIV_JSON_CONNECTION */
67584 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
67585 RECEIVE_PACKET_FIELD_ERROR(text);
67586 }
67587#endif
67588 log_packet_detailed("packet_ruleset_description_part_100: got info about ()");
67589
67590#ifdef FREECIV_DELTA_PROTOCOL
67591 if (NULL == *hash) {
67592 *hash = genhash_new_full(hash_packet_ruleset_description_part_100, cmp_packet_ruleset_description_part_100,
67593 NULL, NULL, NULL, free);
67594 }
67595
67596 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
67597 *real_packet = *old;
67598 } else {
67599 log_packet_detailed(" no old info");
67600 memset(real_packet, 0, sizeof(*real_packet));
67601 }
67602
67603 if (BV_ISSET(fields, 0)) {
67604 log_packet_detailed(" got field 'text'");
67605#ifdef FREECIV_JSON_CONNECTION
67606 field_addr.name = "text";
67607#endif /* FREECIV_JSON_CONNECTION */
67608 if (!DIO_GET(string, &din, &field_addr, real_packet->text, sizeof(real_packet->text))) {
67609 RECEIVE_PACKET_FIELD_ERROR(text);
67610 }
67611 }
67612
67613 if (NULL == old) {
67614 old = fc_malloc(sizeof(*old));
67615 *old = *real_packet;
67616 genhash_insert(*hash, old, old);
67617 } else {
67618 *old = *real_packet;
67619 }
67620
67621#endif /* FREECIV_DELTA_PROTOCOL */
67622 RECEIVE_PACKET_END(real_packet);
67623}
67624
67625 static int send_packet_ruleset_description_part_100(struct connection *pc, const struct packet_ruleset_description_part *packet)
67626{
67627 const struct packet_ruleset_description_part *real_packet = packet;
67628 int e;
67629#ifdef FREECIV_DELTA_PROTOCOL
67630 packet_ruleset_description_part_100_fields fields;
67631 struct packet_ruleset_description_part *old;
67632 bool differ;
67633 struct genhash **hash = pc->phs.sent + PACKET_RULESET_DESCRIPTION_PART;
67634#endif /* FREECIV_DELTA_PROTOCOL */
67635 SEND_PACKET_START(PACKET_RULESET_DESCRIPTION_PART);
67636#ifdef FREECIV_JSON_CONNECTION
67637 struct plocation field_addr;
67638 {
67639 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67640 field_addr = *field_addr_tmp;
67641 FC_FREE(field_addr_tmp);
67642 }
67643#endif /* FREECIV_JSON_CONNECTION */
67644
67645 log_packet_detailed("packet_ruleset_description_part_100: sending info about ()");
67646
67647#ifdef FREECIV_DELTA_PROTOCOL
67648 if (NULL == *hash) {
67649 *hash = genhash_new_full(hash_packet_ruleset_description_part_100, cmp_packet_ruleset_description_part_100,
67650 NULL, NULL, NULL, free);
67651 }
67652 BV_CLR_ALL(fields);
67653
67654 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
67655 old = fc_malloc(sizeof(*old));
67656 *old = *real_packet;
67657 genhash_insert(*hash, old, old);
67658 memset(old, 0, sizeof(*old));
67659 }
67660 differ = (strcmp(old->text, real_packet->text) != 0);
67661 if (differ) {
67662 BV_SET(fields, 0);
67663 }
67664
67665
67666#ifdef FREECIV_JSON_CONNECTION
67667 field_addr.name = "fields";
67668#endif /* FREECIV_JSON_CONNECTION */
67669 e = 0;
67670 e |= DIO_BV_PUT(&dout, &field_addr, fields);
67671 if (e) {
67672 log_packet_detailed("fields bitvector error detected");
67673 }
67674
67675 if (BV_ISSET(fields, 0)) {
67676 log_packet_detailed(" field 'text' has changed");
67677#ifdef FREECIV_JSON_CONNECTION
67678 field_addr.name = "text";
67679#endif /* FREECIV_JSON_CONNECTION */
67680 e = 0;
67681 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
67682 if (e) {
67683 log_packet_detailed("'text' field error detected");
67684 }
67685 }
67686
67687 *old = *real_packet;
67688#endif /* FREECIV_DELTA_PROTOCOL */
67689#ifndef FREECIV_DELTA_PROTOCOL
67690#ifdef FREECIV_JSON_CONNECTION
67691 field_addr.name = "text";
67692#endif /* FREECIV_JSON_CONNECTION */
67693 e = 0;
67694 e |= DIO_PUT(string, &dout, &field_addr, real_packet->text);
67695 if (e) {
67696 log_packet_detailed("'text' field error detected");
67697 }
67698
67699#endif
67700 SEND_PACKET_END(PACKET_RULESET_DESCRIPTION_PART);
67701}
67702
67703 int send_packet_ruleset_description_part(struct connection *pc, const struct packet_ruleset_description_part *packet)
67704{
67705 if (!pc->used) {
67706 log_error("WARNING: trying to send data to the closed connection %s",
67707 conn_description(pc));
67708 return -1;
67709 }
67710 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_DESCRIPTION_PART].packet != NULL, -1,
67711 "Handler for PACKET_RULESET_DESCRIPTION_PART not installed");
67712 return pc->phs.handlers->send[PACKET_RULESET_DESCRIPTION_PART].packet(pc, packet);
67713}
67714
67715 void lsend_packet_ruleset_description_part(struct conn_list *dest, const struct packet_ruleset_description_part *packet)
67716{
67717 conn_list_iterate(dest, pconn) {
67718 send_packet_ruleset_description_part(pconn, packet);
67719 } conn_list_iterate_end;
67720}
67721
67722#ifdef FREECIV_DELTA_PROTOCOL
67723#define hash_packet_single_want_hack_req_100 hash_const
67724
67725#define cmp_packet_single_want_hack_req_100 cmp_const
67726
67727 BV_DEFINE(packet_single_want_hack_req_100_fields, 1);
67728#endif /* FREECIV_DELTA_PROTOCOL */
67729
67730 static struct packet_single_want_hack_req *receive_packet_single_want_hack_req_100(struct connection *pc)
67731{
67732#ifdef FREECIV_DELTA_PROTOCOL
67733 packet_single_want_hack_req_100_fields fields;
67734 struct packet_single_want_hack_req *old;
67735 struct genhash **hash = pc->phs.received + PACKET_SINGLE_WANT_HACK_REQ;
67736#endif /* FREECIV_DELTA_PROTOCOL */
67737 RECEIVE_PACKET_START(packet_single_want_hack_req, real_packet);
67738#ifdef FREECIV_JSON_CONNECTION
67739 struct plocation field_addr;
67740 {
67741 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67742 field_addr = *field_addr_tmp;
67743 FC_FREE(field_addr_tmp);
67744 }
67745#endif /* FREECIV_JSON_CONNECTION */
67746
67747#ifdef FREECIV_DELTA_PROTOCOL
67748#ifdef FREECIV_JSON_CONNECTION
67749 field_addr.name = "fields";
67750#endif /* FREECIV_JSON_CONNECTION */
67751 DIO_BV_GET(&din, &field_addr, fields);
67752
67753#else /* FREECIV_DELTA_PROTOCOL */
67754#ifdef FREECIV_JSON_CONNECTION
67755 field_addr.name = "token";
67756#endif /* FREECIV_JSON_CONNECTION */
67757 if (!DIO_GET(string, &din, &field_addr, real_packet->token, sizeof(real_packet->token))) {
67758 RECEIVE_PACKET_FIELD_ERROR(token);
67759 }
67760#endif
67761 log_packet_detailed("packet_single_want_hack_req_100: got info about ()");
67762
67763#ifdef FREECIV_DELTA_PROTOCOL
67764 if (NULL == *hash) {
67765 *hash = genhash_new_full(hash_packet_single_want_hack_req_100, cmp_packet_single_want_hack_req_100,
67766 NULL, NULL, NULL, free);
67767 }
67768
67769 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
67770 *real_packet = *old;
67771 } else {
67772 log_packet_detailed(" no old info");
67773 memset(real_packet, 0, sizeof(*real_packet));
67774 }
67775
67776 if (BV_ISSET(fields, 0)) {
67777 log_packet_detailed(" got field 'token'");
67778#ifdef FREECIV_JSON_CONNECTION
67779 field_addr.name = "token";
67780#endif /* FREECIV_JSON_CONNECTION */
67781 if (!DIO_GET(string, &din, &field_addr, real_packet->token, sizeof(real_packet->token))) {
67782 RECEIVE_PACKET_FIELD_ERROR(token);
67783 }
67784 }
67785
67786 if (NULL == old) {
67787 old = fc_malloc(sizeof(*old));
67788 *old = *real_packet;
67789 genhash_insert(*hash, old, old);
67790 } else {
67791 *old = *real_packet;
67792 }
67793
67794#endif /* FREECIV_DELTA_PROTOCOL */
67795 RECEIVE_PACKET_END(real_packet);
67796}
67797
67798 static int send_packet_single_want_hack_req_100(struct connection *pc, const struct packet_single_want_hack_req *packet)
67799{
67800 const struct packet_single_want_hack_req *real_packet = packet;
67801 int e;
67802#ifdef FREECIV_DELTA_PROTOCOL
67803 packet_single_want_hack_req_100_fields fields;
67804 struct packet_single_want_hack_req *old;
67805 bool differ;
67806 struct genhash **hash = pc->phs.sent + PACKET_SINGLE_WANT_HACK_REQ;
67807#endif /* FREECIV_DELTA_PROTOCOL */
67808 SEND_PACKET_START(PACKET_SINGLE_WANT_HACK_REQ);
67809#ifdef FREECIV_JSON_CONNECTION
67810 struct plocation field_addr;
67811 {
67812 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67813 field_addr = *field_addr_tmp;
67814 FC_FREE(field_addr_tmp);
67815 }
67816#endif /* FREECIV_JSON_CONNECTION */
67817
67818 log_packet_detailed("packet_single_want_hack_req_100: sending info about ()");
67819
67820#ifdef FREECIV_DELTA_PROTOCOL
67821 if (NULL == *hash) {
67822 *hash = genhash_new_full(hash_packet_single_want_hack_req_100, cmp_packet_single_want_hack_req_100,
67823 NULL, NULL, NULL, free);
67824 }
67825 BV_CLR_ALL(fields);
67826
67827 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
67828 old = fc_malloc(sizeof(*old));
67829 *old = *real_packet;
67830 genhash_insert(*hash, old, old);
67831 memset(old, 0, sizeof(*old));
67832 }
67833 differ = (strcmp(old->token, real_packet->token) != 0);
67834 if (differ) {
67835 BV_SET(fields, 0);
67836 }
67837
67838
67839#ifdef FREECIV_JSON_CONNECTION
67840 field_addr.name = "fields";
67841#endif /* FREECIV_JSON_CONNECTION */
67842 e = 0;
67843 e |= DIO_BV_PUT(&dout, &field_addr, fields);
67844 if (e) {
67845 log_packet_detailed("fields bitvector error detected");
67846 }
67847
67848 if (BV_ISSET(fields, 0)) {
67849 log_packet_detailed(" field 'token' has changed");
67850#ifdef FREECIV_JSON_CONNECTION
67851 field_addr.name = "token";
67852#endif /* FREECIV_JSON_CONNECTION */
67853 e = 0;
67854 e |= DIO_PUT(string, &dout, &field_addr, real_packet->token);
67855 if (e) {
67856 log_packet_detailed("'token' field error detected");
67857 }
67858 }
67859
67860 *old = *real_packet;
67861#endif /* FREECIV_DELTA_PROTOCOL */
67862#ifndef FREECIV_DELTA_PROTOCOL
67863#ifdef FREECIV_JSON_CONNECTION
67864 field_addr.name = "token";
67865#endif /* FREECIV_JSON_CONNECTION */
67866 e = 0;
67867 e |= DIO_PUT(string, &dout, &field_addr, real_packet->token);
67868 if (e) {
67869 log_packet_detailed("'token' field error detected");
67870 }
67871
67872#endif
67873 SEND_PACKET_END(PACKET_SINGLE_WANT_HACK_REQ);
67874}
67875
67876 int send_packet_single_want_hack_req(struct connection *pc, const struct packet_single_want_hack_req *packet)
67877{
67878 if (!pc->used) {
67879 log_error("WARNING: trying to send data to the closed connection %s",
67880 conn_description(pc));
67881 return -1;
67882 }
67883 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet != NULL, -1,
67884 "Handler for PACKET_SINGLE_WANT_HACK_REQ not installed");
67885 return pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet(pc, packet);
67886}
67887
67888#ifdef FREECIV_DELTA_PROTOCOL
67889#define hash_packet_single_want_hack_reply_100 hash_const
67890
67891#define cmp_packet_single_want_hack_reply_100 cmp_const
67892
67893 BV_DEFINE(packet_single_want_hack_reply_100_fields, 1);
67894#endif /* FREECIV_DELTA_PROTOCOL */
67895
67896 static struct packet_single_want_hack_reply *receive_packet_single_want_hack_reply_100(struct connection *pc)
67897{
67898#ifdef FREECIV_DELTA_PROTOCOL
67899 packet_single_want_hack_reply_100_fields fields;
67900 struct packet_single_want_hack_reply *old;
67901 struct genhash **hash = pc->phs.received + PACKET_SINGLE_WANT_HACK_REPLY;
67902#endif /* FREECIV_DELTA_PROTOCOL */
67903 RECEIVE_PACKET_START(packet_single_want_hack_reply, real_packet);
67904#ifdef FREECIV_JSON_CONNECTION
67905 struct plocation field_addr;
67906 {
67907 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67908 field_addr = *field_addr_tmp;
67909 FC_FREE(field_addr_tmp);
67910 }
67911#endif /* FREECIV_JSON_CONNECTION */
67912
67913#ifdef FREECIV_DELTA_PROTOCOL
67914#ifdef FREECIV_JSON_CONNECTION
67915 field_addr.name = "fields";
67916#endif /* FREECIV_JSON_CONNECTION */
67917 DIO_BV_GET(&din, &field_addr, fields);
67918
67919#else /* FREECIV_DELTA_PROTOCOL */
67920#ifdef FREECIV_JSON_CONNECTION
67921 field_addr.name = "you_have_hack";
67922#endif /* FREECIV_JSON_CONNECTION */
67923 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->you_have_hack)) {
67924 RECEIVE_PACKET_FIELD_ERROR(you_have_hack);
67925 }
67926#endif
67927 log_packet_detailed("packet_single_want_hack_reply_100: got info about ()");
67928
67929#ifdef FREECIV_DELTA_PROTOCOL
67930 if (NULL == *hash) {
67931 *hash = genhash_new_full(hash_packet_single_want_hack_reply_100, cmp_packet_single_want_hack_reply_100,
67932 NULL, NULL, NULL, free);
67933 }
67934
67935 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
67936 *real_packet = *old;
67937 } else {
67938 log_packet_detailed(" no old info");
67939 memset(real_packet, 0, sizeof(*real_packet));
67940 }
67941
67942 real_packet->you_have_hack = BV_ISSET(fields, 0);
67943
67944 if (NULL == old) {
67945 old = fc_malloc(sizeof(*old));
67946 *old = *real_packet;
67947 genhash_insert(*hash, old, old);
67948 } else {
67949 *old = *real_packet;
67950 }
67951
67952#endif /* FREECIV_DELTA_PROTOCOL */
67953 RECEIVE_PACKET_END(real_packet);
67954}
67955
67956 static int send_packet_single_want_hack_reply_100(struct connection *pc, const struct packet_single_want_hack_reply *packet)
67957{
67958 const struct packet_single_want_hack_reply *real_packet = packet;
67959 int e;
67960#ifdef FREECIV_DELTA_PROTOCOL
67961 packet_single_want_hack_reply_100_fields fields;
67962 struct packet_single_want_hack_reply *old;
67963 struct genhash **hash = pc->phs.sent + PACKET_SINGLE_WANT_HACK_REPLY;
67964#endif /* FREECIV_DELTA_PROTOCOL */
67965 SEND_PACKET_START(PACKET_SINGLE_WANT_HACK_REPLY);
67966#ifdef FREECIV_JSON_CONNECTION
67967 struct plocation field_addr;
67968 {
67969 struct plocation *field_addr_tmp = plocation_field_new(NULL);
67970 field_addr = *field_addr_tmp;
67971 FC_FREE(field_addr_tmp);
67972 }
67973#endif /* FREECIV_JSON_CONNECTION */
67974
67975 log_packet_detailed("packet_single_want_hack_reply_100: sending info about ()");
67976
67977#ifdef FREECIV_DELTA_PROTOCOL
67978 if (NULL == *hash) {
67979 *hash = genhash_new_full(hash_packet_single_want_hack_reply_100, cmp_packet_single_want_hack_reply_100,
67980 NULL, NULL, NULL, free);
67981 }
67982 BV_CLR_ALL(fields);
67983
67984 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
67985 old = fc_malloc(sizeof(*old));
67986 *old = *real_packet;
67987 genhash_insert(*hash, old, old);
67988 memset(old, 0, sizeof(*old));
67989 }
67990 if (packet->you_have_hack) {
67991 BV_SET(fields, 0);
67992 }
67993
67994
67995#ifdef FREECIV_JSON_CONNECTION
67996 field_addr.name = "fields";
67997#endif /* FREECIV_JSON_CONNECTION */
67998 e = 0;
67999 e |= DIO_BV_PUT(&dout, &field_addr, fields);
68000 if (e) {
68001 log_packet_detailed("fields bitvector error detected");
68002 }
68003
68004 /* field 0 is folded into the header */
68005
68006 *old = *real_packet;
68007#endif /* FREECIV_DELTA_PROTOCOL */
68008#ifndef FREECIV_DELTA_PROTOCOL
68009#ifdef FREECIV_JSON_CONNECTION
68010 field_addr.name = "you_have_hack";
68011#endif /* FREECIV_JSON_CONNECTION */
68012 e = 0;
68013 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->you_have_hack);
68014 if (e) {
68015 log_packet_detailed("'you_have_hack' field error detected");
68016 }
68017
68018#endif
68019 SEND_PACKET_END(PACKET_SINGLE_WANT_HACK_REPLY);
68020}
68021
68022 int send_packet_single_want_hack_reply(struct connection *pc, const struct packet_single_want_hack_reply *packet)
68023{
68024 if (!pc->used) {
68025 log_error("WARNING: trying to send data to the closed connection %s",
68026 conn_description(pc));
68027 return -1;
68028 }
68029 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet != NULL, -1,
68030 "Handler for PACKET_SINGLE_WANT_HACK_REPLY not installed");
68031 return pc->phs.handlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet(pc, packet);
68032}
68033
68034 int dsend_packet_single_want_hack_reply(struct connection *pc, bool you_have_hack)
68035{
68036 struct packet_single_want_hack_reply packet, *real_packet = &packet;
68037
68038 real_packet->you_have_hack = you_have_hack;
68039
68040 return send_packet_single_want_hack_reply(pc, real_packet);
68041}
68042
68043#ifdef FREECIV_DELTA_PROTOCOL
68044#define hash_packet_ruleset_choices_100 hash_const
68045
68046#define cmp_packet_ruleset_choices_100 cmp_const
68047
68048 BV_DEFINE(packet_ruleset_choices_100_fields, 2);
68049#endif /* FREECIV_DELTA_PROTOCOL */
68050
68051 static struct packet_ruleset_choices *receive_packet_ruleset_choices_100(struct connection *pc)
68052{
68053#ifdef FREECIV_DELTA_PROTOCOL
68054 packet_ruleset_choices_100_fields fields;
68055 struct packet_ruleset_choices *old;
68056 struct genhash **hash = pc->phs.received + PACKET_RULESET_CHOICES;
68057#endif /* FREECIV_DELTA_PROTOCOL */
68058 RECEIVE_PACKET_START(packet_ruleset_choices, real_packet);
68059#ifdef FREECIV_JSON_CONNECTION
68060 struct plocation field_addr;
68061 {
68062 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68063 field_addr = *field_addr_tmp;
68064 FC_FREE(field_addr_tmp);
68065 }
68066#endif /* FREECIV_JSON_CONNECTION */
68067
68068#ifdef FREECIV_DELTA_PROTOCOL
68069#ifdef FREECIV_JSON_CONNECTION
68070 field_addr.name = "fields";
68071#endif /* FREECIV_JSON_CONNECTION */
68072 DIO_BV_GET(&din, &field_addr, fields);
68073
68074#else /* FREECIV_DELTA_PROTOCOL */
68075#ifdef FREECIV_JSON_CONNECTION
68076 field_addr.name = "ruleset_count";
68077#endif /* FREECIV_JSON_CONNECTION */
68078 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ruleset_count)) {
68079 RECEIVE_PACKET_FIELD_ERROR(ruleset_count);
68080 }
68081#ifdef FREECIV_JSON_CONNECTION
68082 field_addr.name = "rulesets";
68083#endif /* FREECIV_JSON_CONNECTION */
68084 {
68085 int i;
68086
68087#ifdef FREECIV_JSON_CONNECTION
68088 /* Enter array. */
68089 field_addr.sub_location = plocation_elem_new(0);
68090#endif /* FREECIV_JSON_CONNECTION */
68091
68092 if (real_packet->ruleset_count > MAX_NUM_RULESETS) {
68093 RECEIVE_PACKET_FIELD_ERROR(rulesets, ": truncation array");
68094 }
68095 for (i = 0; i < real_packet->ruleset_count; i++) {
68096#ifdef FREECIV_JSON_CONNECTION
68097 field_addr.sub_location->number = i;
68098#endif /* FREECIV_JSON_CONNECTION */
68099 if (!DIO_GET(string, &din, &field_addr, real_packet->rulesets[i], sizeof(real_packet->rulesets[i]))) {
68100 RECEIVE_PACKET_FIELD_ERROR(rulesets);
68101 }
68102 }
68103
68104#ifdef FREECIV_JSON_CONNECTION
68105 /* Exit array. */
68106 FC_FREE(field_addr.sub_location);
68107#endif /* FREECIV_JSON_CONNECTION */
68108 }
68109#endif
68110 log_packet_detailed("packet_ruleset_choices_100: got info about ()");
68111
68112#ifdef FREECIV_DELTA_PROTOCOL
68113 if (NULL == *hash) {
68114 *hash = genhash_new_full(hash_packet_ruleset_choices_100, cmp_packet_ruleset_choices_100,
68115 NULL, NULL, NULL, free);
68116 }
68117
68118 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
68119 *real_packet = *old;
68120 } else {
68121 log_packet_detailed(" no old info");
68122 memset(real_packet, 0, sizeof(*real_packet));
68123 }
68124
68125 if (BV_ISSET(fields, 0)) {
68126 log_packet_detailed(" got field 'ruleset_count'");
68127#ifdef FREECIV_JSON_CONNECTION
68128 field_addr.name = "ruleset_count";
68129#endif /* FREECIV_JSON_CONNECTION */
68130 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ruleset_count)) {
68131 RECEIVE_PACKET_FIELD_ERROR(ruleset_count);
68132 }
68133 }
68134 if (BV_ISSET(fields, 1)) {
68135 log_packet_detailed(" got field 'rulesets'");
68136#ifdef FREECIV_JSON_CONNECTION
68137 field_addr.name = "rulesets";
68138#endif /* FREECIV_JSON_CONNECTION */
68139 {
68140 int i;
68141
68142#ifdef FREECIV_JSON_CONNECTION
68143 /* Enter array. */
68144 field_addr.sub_location = plocation_elem_new(0);
68145#endif /* FREECIV_JSON_CONNECTION */
68146
68147 if (real_packet->ruleset_count > MAX_NUM_RULESETS) {
68148 RECEIVE_PACKET_FIELD_ERROR(rulesets, ": truncation array");
68149 }
68150 for (i = 0; i < real_packet->ruleset_count; i++) {
68151#ifdef FREECIV_JSON_CONNECTION
68152 field_addr.sub_location->number = i;
68153#endif /* FREECIV_JSON_CONNECTION */
68154 if (!DIO_GET(string, &din, &field_addr, real_packet->rulesets[i], sizeof(real_packet->rulesets[i]))) {
68155 RECEIVE_PACKET_FIELD_ERROR(rulesets);
68156 }
68157 }
68158
68159#ifdef FREECIV_JSON_CONNECTION
68160 /* Exit array. */
68161 FC_FREE(field_addr.sub_location);
68162#endif /* FREECIV_JSON_CONNECTION */
68163 }
68164 }
68165
68166 if (NULL == old) {
68167 old = fc_malloc(sizeof(*old));
68168 *old = *real_packet;
68169 genhash_insert(*hash, old, old);
68170 } else {
68171 *old = *real_packet;
68172 }
68173
68174#endif /* FREECIV_DELTA_PROTOCOL */
68175 RECEIVE_PACKET_END(real_packet);
68176}
68177
68178 static int send_packet_ruleset_choices_100(struct connection *pc, const struct packet_ruleset_choices *packet)
68179{
68180 const struct packet_ruleset_choices *real_packet = packet;
68181 int e;
68182#ifdef FREECIV_DELTA_PROTOCOL
68183 packet_ruleset_choices_100_fields fields;
68184 struct packet_ruleset_choices *old;
68185 bool differ;
68186 struct genhash **hash = pc->phs.sent + PACKET_RULESET_CHOICES;
68187#endif /* FREECIV_DELTA_PROTOCOL */
68188 SEND_PACKET_START(PACKET_RULESET_CHOICES);
68189#ifdef FREECIV_JSON_CONNECTION
68190 struct plocation field_addr;
68191 {
68192 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68193 field_addr = *field_addr_tmp;
68194 FC_FREE(field_addr_tmp);
68195 }
68196#endif /* FREECIV_JSON_CONNECTION */
68197
68198 log_packet_detailed("packet_ruleset_choices_100: sending info about ()");
68199
68200#ifdef FREECIV_DELTA_PROTOCOL
68201 if (NULL == *hash) {
68202 *hash = genhash_new_full(hash_packet_ruleset_choices_100, cmp_packet_ruleset_choices_100,
68203 NULL, NULL, NULL, free);
68204 }
68205 BV_CLR_ALL(fields);
68206
68207 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
68208 old = fc_malloc(sizeof(*old));
68209 *old = *real_packet;
68210 genhash_insert(*hash, old, old);
68211 memset(old, 0, sizeof(*old));
68212 }
68213 differ = (old->ruleset_count != real_packet->ruleset_count);
68214 if (differ) {
68215 BV_SET(fields, 0);
68216 }
68217
68218 differ = (old->ruleset_count != real_packet->ruleset_count);
68219 if (!differ) {
68220 int i;
68221
68222 for (i = 0; i < real_packet->ruleset_count; i++) {
68223 differ = (strcmp(old->rulesets[i], real_packet->rulesets[i]) != 0);
68224 if (differ) {
68225 break;
68226 }
68227 }
68228 }
68229 if (differ) {
68230 BV_SET(fields, 1);
68231 }
68232
68233
68234#ifdef FREECIV_JSON_CONNECTION
68235 field_addr.name = "fields";
68236#endif /* FREECIV_JSON_CONNECTION */
68237 e = 0;
68238 e |= DIO_BV_PUT(&dout, &field_addr, fields);
68239 if (e) {
68240 log_packet_detailed("fields bitvector error detected");
68241 }
68242
68243 if (BV_ISSET(fields, 0)) {
68244 log_packet_detailed(" field 'ruleset_count' has changed");
68245#ifdef FREECIV_JSON_CONNECTION
68246 field_addr.name = "ruleset_count";
68247#endif /* FREECIV_JSON_CONNECTION */
68248 e = 0;
68249 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ruleset_count);
68250 if (e) {
68251 log_packet_detailed("'ruleset_count' field error detected");
68252 }
68253 }
68254 if (BV_ISSET(fields, 1)) {
68255 log_packet_detailed(" field 'rulesets' has changed");
68256#ifdef FREECIV_JSON_CONNECTION
68257 field_addr.name = "rulesets";
68258#endif /* FREECIV_JSON_CONNECTION */
68259 e = 0;
68260 {
68261 int i;
68262
68263#ifdef FREECIV_JSON_CONNECTION
68264 /* Create the array. */
68265 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ruleset_count);
68266
68267 /* Enter the array. */
68268 field_addr.sub_location = plocation_elem_new(0);
68269#endif /* FREECIV_JSON_CONNECTION */
68270
68271 for (i = 0; i < real_packet->ruleset_count; i++) {
68272#ifdef FREECIV_JSON_CONNECTION
68273 /* Next array element. */
68274 field_addr.sub_location->number = i;
68275#endif /* FREECIV_JSON_CONNECTION */
68276 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rulesets[i]);
68277 }
68278
68279#ifdef FREECIV_JSON_CONNECTION
68280 /* Exit array. */
68281 FC_FREE(field_addr.sub_location);
68282#endif /* FREECIV_JSON_CONNECTION */
68283 }
68284 if (e) {
68285 log_packet_detailed("'rulesets' field error detected");
68286 }
68287 }
68288
68289 *old = *real_packet;
68290#endif /* FREECIV_DELTA_PROTOCOL */
68291#ifndef FREECIV_DELTA_PROTOCOL
68292#ifdef FREECIV_JSON_CONNECTION
68293 field_addr.name = "ruleset_count";
68294#endif /* FREECIV_JSON_CONNECTION */
68295 e = 0;
68296 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ruleset_count);
68297 if (e) {
68298 log_packet_detailed("'ruleset_count' field error detected");
68299 }
68300#ifdef FREECIV_JSON_CONNECTION
68301 field_addr.name = "rulesets";
68302#endif /* FREECIV_JSON_CONNECTION */
68303 e = 0;
68304 {
68305 int i;
68306
68307#ifdef FREECIV_JSON_CONNECTION
68308 /* Create the array. */
68309 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->ruleset_count);
68310
68311 /* Enter the array. */
68312 field_addr.sub_location = plocation_elem_new(0);
68313#endif /* FREECIV_JSON_CONNECTION */
68314
68315 for (i = 0; i < real_packet->ruleset_count; i++) {
68316#ifdef FREECIV_JSON_CONNECTION
68317 /* Next array element. */
68318 field_addr.sub_location->number = i;
68319#endif /* FREECIV_JSON_CONNECTION */
68320 e |= DIO_PUT(string, &dout, &field_addr, real_packet->rulesets[i]);
68321 }
68322
68323#ifdef FREECIV_JSON_CONNECTION
68324 /* Exit array. */
68325 FC_FREE(field_addr.sub_location);
68326#endif /* FREECIV_JSON_CONNECTION */
68327 }
68328 if (e) {
68329 log_packet_detailed("'rulesets' field error detected");
68330 }
68331
68332#endif
68333 SEND_PACKET_END(PACKET_RULESET_CHOICES);
68334}
68335
68336 int send_packet_ruleset_choices(struct connection *pc, const struct packet_ruleset_choices *packet)
68337{
68338 if (!pc->used) {
68339 log_error("WARNING: trying to send data to the closed connection %s",
68340 conn_description(pc));
68341 return -1;
68342 }
68343 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_CHOICES].packet != NULL, -1,
68344 "Handler for PACKET_RULESET_CHOICES not installed");
68345 return pc->phs.handlers->send[PACKET_RULESET_CHOICES].packet(pc, packet);
68346}
68347
68348#ifdef FREECIV_DELTA_PROTOCOL
68349#define hash_packet_ruleset_select_100 hash_const
68350
68351#define cmp_packet_ruleset_select_100 cmp_const
68352
68353 BV_DEFINE(packet_ruleset_select_100_fields, 1);
68354#endif /* FREECIV_DELTA_PROTOCOL */
68355
68356 static struct packet_ruleset_select *receive_packet_ruleset_select_100(struct connection *pc)
68357{
68358#ifdef FREECIV_DELTA_PROTOCOL
68359 packet_ruleset_select_100_fields fields;
68360 struct packet_ruleset_select *old;
68361 struct genhash **hash = pc->phs.received + PACKET_RULESET_SELECT;
68362#endif /* FREECIV_DELTA_PROTOCOL */
68363 RECEIVE_PACKET_START(packet_ruleset_select, real_packet);
68364#ifdef FREECIV_JSON_CONNECTION
68365 struct plocation field_addr;
68366 {
68367 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68368 field_addr = *field_addr_tmp;
68369 FC_FREE(field_addr_tmp);
68370 }
68371#endif /* FREECIV_JSON_CONNECTION */
68372
68373#ifdef FREECIV_DELTA_PROTOCOL
68374#ifdef FREECIV_JSON_CONNECTION
68375 field_addr.name = "fields";
68376#endif /* FREECIV_JSON_CONNECTION */
68377 DIO_BV_GET(&din, &field_addr, fields);
68378
68379#else /* FREECIV_DELTA_PROTOCOL */
68380#ifdef FREECIV_JSON_CONNECTION
68381 field_addr.name = "modpack";
68382#endif /* FREECIV_JSON_CONNECTION */
68383 if (!DIO_GET(string, &din, &field_addr, real_packet->modpack, sizeof(real_packet->modpack))) {
68384 RECEIVE_PACKET_FIELD_ERROR(modpack);
68385 }
68386#endif
68387 log_packet_detailed("packet_ruleset_select_100: got info about ()");
68388
68389#ifdef FREECIV_DELTA_PROTOCOL
68390 if (NULL == *hash) {
68391 *hash = genhash_new_full(hash_packet_ruleset_select_100, cmp_packet_ruleset_select_100,
68392 NULL, NULL, NULL, free);
68393 }
68394
68395 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
68396 *real_packet = *old;
68397 } else {
68398 log_packet_detailed(" no old info");
68399 memset(real_packet, 0, sizeof(*real_packet));
68400 }
68401
68402 if (BV_ISSET(fields, 0)) {
68403 log_packet_detailed(" got field 'modpack'");
68404#ifdef FREECIV_JSON_CONNECTION
68405 field_addr.name = "modpack";
68406#endif /* FREECIV_JSON_CONNECTION */
68407 if (!DIO_GET(string, &din, &field_addr, real_packet->modpack, sizeof(real_packet->modpack))) {
68408 RECEIVE_PACKET_FIELD_ERROR(modpack);
68409 }
68410 }
68411
68412 if (NULL == old) {
68413 old = fc_malloc(sizeof(*old));
68414 *old = *real_packet;
68415 genhash_insert(*hash, old, old);
68416 } else {
68417 *old = *real_packet;
68418 }
68419
68420#endif /* FREECIV_DELTA_PROTOCOL */
68421 RECEIVE_PACKET_END(real_packet);
68422}
68423
68424 static int send_packet_ruleset_select_100(struct connection *pc, const struct packet_ruleset_select *packet)
68425{
68426 const struct packet_ruleset_select *real_packet = packet;
68427 int e;
68428#ifdef FREECIV_DELTA_PROTOCOL
68429 packet_ruleset_select_100_fields fields;
68430 struct packet_ruleset_select *old;
68431 bool differ;
68432 struct genhash **hash = pc->phs.sent + PACKET_RULESET_SELECT;
68433#endif /* FREECIV_DELTA_PROTOCOL */
68434 SEND_PACKET_START(PACKET_RULESET_SELECT);
68435#ifdef FREECIV_JSON_CONNECTION
68436 struct plocation field_addr;
68437 {
68438 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68439 field_addr = *field_addr_tmp;
68440 FC_FREE(field_addr_tmp);
68441 }
68442#endif /* FREECIV_JSON_CONNECTION */
68443
68444 log_packet_detailed("packet_ruleset_select_100: sending info about ()");
68445
68446#ifdef FREECIV_DELTA_PROTOCOL
68447 if (NULL == *hash) {
68448 *hash = genhash_new_full(hash_packet_ruleset_select_100, cmp_packet_ruleset_select_100,
68449 NULL, NULL, NULL, free);
68450 }
68451 BV_CLR_ALL(fields);
68452
68453 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
68454 old = fc_malloc(sizeof(*old));
68455 *old = *real_packet;
68456 genhash_insert(*hash, old, old);
68457 memset(old, 0, sizeof(*old));
68458 }
68459 differ = (strcmp(old->modpack, real_packet->modpack) != 0);
68460 if (differ) {
68461 BV_SET(fields, 0);
68462 }
68463
68464
68465#ifdef FREECIV_JSON_CONNECTION
68466 field_addr.name = "fields";
68467#endif /* FREECIV_JSON_CONNECTION */
68468 e = 0;
68469 e |= DIO_BV_PUT(&dout, &field_addr, fields);
68470 if (e) {
68471 log_packet_detailed("fields bitvector error detected");
68472 }
68473
68474 if (BV_ISSET(fields, 0)) {
68475 log_packet_detailed(" field 'modpack' has changed");
68476#ifdef FREECIV_JSON_CONNECTION
68477 field_addr.name = "modpack";
68478#endif /* FREECIV_JSON_CONNECTION */
68479 e = 0;
68480 e |= DIO_PUT(string, &dout, &field_addr, real_packet->modpack);
68481 if (e) {
68482 log_packet_detailed("'modpack' field error detected");
68483 }
68484 }
68485
68486 *old = *real_packet;
68487#endif /* FREECIV_DELTA_PROTOCOL */
68488#ifndef FREECIV_DELTA_PROTOCOL
68489#ifdef FREECIV_JSON_CONNECTION
68490 field_addr.name = "modpack";
68491#endif /* FREECIV_JSON_CONNECTION */
68492 e = 0;
68493 e |= DIO_PUT(string, &dout, &field_addr, real_packet->modpack);
68494 if (e) {
68495 log_packet_detailed("'modpack' field error detected");
68496 }
68497
68498#endif
68499 SEND_PACKET_END(PACKET_RULESET_SELECT);
68500}
68501
68502 int send_packet_ruleset_select(struct connection *pc, const struct packet_ruleset_select *packet)
68503{
68504 if (!pc->used) {
68505 log_error("WARNING: trying to send data to the closed connection %s",
68506 conn_description(pc));
68507 return -1;
68508 }
68509 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_SELECT].packet != NULL, -1,
68510 "Handler for PACKET_RULESET_SELECT not installed");
68511 return pc->phs.handlers->send[PACKET_RULESET_SELECT].packet(pc, packet);
68512}
68513
68514#ifdef FREECIV_DELTA_PROTOCOL
68515#define hash_packet_game_load_100 hash_const
68516
68517#define cmp_packet_game_load_100 cmp_const
68518
68519 BV_DEFINE(packet_game_load_100_fields, 2);
68520#endif /* FREECIV_DELTA_PROTOCOL */
68521
68522 static struct packet_game_load *receive_packet_game_load_100(struct connection *pc)
68523{
68524#ifdef FREECIV_DELTA_PROTOCOL
68525 packet_game_load_100_fields fields;
68526 struct packet_game_load *old;
68527 struct genhash **hash = pc->phs.received + PACKET_GAME_LOAD;
68528#endif /* FREECIV_DELTA_PROTOCOL */
68529 RECEIVE_PACKET_START(packet_game_load, real_packet);
68530#ifdef FREECIV_JSON_CONNECTION
68531 struct plocation field_addr;
68532 {
68533 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68534 field_addr = *field_addr_tmp;
68535 FC_FREE(field_addr_tmp);
68536 }
68537#endif /* FREECIV_JSON_CONNECTION */
68538
68539#ifdef FREECIV_DELTA_PROTOCOL
68540#ifdef FREECIV_JSON_CONNECTION
68541 field_addr.name = "fields";
68542#endif /* FREECIV_JSON_CONNECTION */
68543 DIO_BV_GET(&din, &field_addr, fields);
68544
68545#else /* FREECIV_DELTA_PROTOCOL */
68546#ifdef FREECIV_JSON_CONNECTION
68547 field_addr.name = "load_successful";
68548#endif /* FREECIV_JSON_CONNECTION */
68549 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->load_successful)) {
68550 RECEIVE_PACKET_FIELD_ERROR(load_successful);
68551 }
68552#ifdef FREECIV_JSON_CONNECTION
68553 field_addr.name = "load_filename";
68554#endif /* FREECIV_JSON_CONNECTION */
68555 if (!DIO_GET(string, &din, &field_addr, real_packet->load_filename, sizeof(real_packet->load_filename))) {
68556 RECEIVE_PACKET_FIELD_ERROR(load_filename);
68557 }
68558#endif
68559 log_packet_detailed("packet_game_load_100: got info about ()");
68560
68561#ifdef FREECIV_DELTA_PROTOCOL
68562 if (NULL == *hash) {
68563 *hash = genhash_new_full(hash_packet_game_load_100, cmp_packet_game_load_100,
68564 NULL, NULL, NULL, free);
68565 }
68566
68567 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
68568 *real_packet = *old;
68569 } else {
68570 log_packet_detailed(" no old info");
68571 memset(real_packet, 0, sizeof(*real_packet));
68572 }
68573
68574 real_packet->load_successful = BV_ISSET(fields, 0);
68575 if (BV_ISSET(fields, 1)) {
68576 log_packet_detailed(" got field 'load_filename'");
68577#ifdef FREECIV_JSON_CONNECTION
68578 field_addr.name = "load_filename";
68579#endif /* FREECIV_JSON_CONNECTION */
68580 if (!DIO_GET(string, &din, &field_addr, real_packet->load_filename, sizeof(real_packet->load_filename))) {
68581 RECEIVE_PACKET_FIELD_ERROR(load_filename);
68582 }
68583 }
68584
68585 if (NULL == old) {
68586 old = fc_malloc(sizeof(*old));
68587 *old = *real_packet;
68588 genhash_insert(*hash, old, old);
68589 } else {
68590 *old = *real_packet;
68591 }
68592
68593#endif /* FREECIV_DELTA_PROTOCOL */
68594 RECEIVE_PACKET_END(real_packet);
68595}
68596
68597 static int send_packet_game_load_100(struct connection *pc, const struct packet_game_load *packet)
68598{
68599 const struct packet_game_load *real_packet = packet;
68600 int e;
68601#ifdef FREECIV_DELTA_PROTOCOL
68602 packet_game_load_100_fields fields;
68603 struct packet_game_load *old;
68604 bool differ;
68605 struct genhash **hash = pc->phs.sent + PACKET_GAME_LOAD;
68606#endif /* FREECIV_DELTA_PROTOCOL */
68607 SEND_PACKET_START(PACKET_GAME_LOAD);
68608#ifdef FREECIV_JSON_CONNECTION
68609 struct plocation field_addr;
68610 {
68611 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68612 field_addr = *field_addr_tmp;
68613 FC_FREE(field_addr_tmp);
68614 }
68615#endif /* FREECIV_JSON_CONNECTION */
68616
68617 log_packet_detailed("packet_game_load_100: sending info about ()");
68618
68619#ifdef FREECIV_DELTA_PROTOCOL
68620 if (NULL == *hash) {
68621 *hash = genhash_new_full(hash_packet_game_load_100, cmp_packet_game_load_100,
68622 NULL, NULL, NULL, free);
68623 }
68624 BV_CLR_ALL(fields);
68625
68626 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
68627 old = fc_malloc(sizeof(*old));
68628 *old = *real_packet;
68629 genhash_insert(*hash, old, old);
68630 memset(old, 0, sizeof(*old));
68631 }
68632 if (packet->load_successful) {
68633 BV_SET(fields, 0);
68634 }
68635
68636 differ = (strcmp(old->load_filename, real_packet->load_filename) != 0);
68637 if (differ) {
68638 BV_SET(fields, 1);
68639 }
68640
68641
68642#ifdef FREECIV_JSON_CONNECTION
68643 field_addr.name = "fields";
68644#endif /* FREECIV_JSON_CONNECTION */
68645 e = 0;
68646 e |= DIO_BV_PUT(&dout, &field_addr, fields);
68647 if (e) {
68648 log_packet_detailed("fields bitvector error detected");
68649 }
68650
68651 /* field 0 is folded into the header */
68652 if (BV_ISSET(fields, 1)) {
68653 log_packet_detailed(" field 'load_filename' has changed");
68654#ifdef FREECIV_JSON_CONNECTION
68655 field_addr.name = "load_filename";
68656#endif /* FREECIV_JSON_CONNECTION */
68657 e = 0;
68658 e |= DIO_PUT(string, &dout, &field_addr, real_packet->load_filename);
68659 if (e) {
68660 log_packet_detailed("'load_filename' field error detected");
68661 }
68662 }
68663
68664 *old = *real_packet;
68665#endif /* FREECIV_DELTA_PROTOCOL */
68666#ifndef FREECIV_DELTA_PROTOCOL
68667#ifdef FREECIV_JSON_CONNECTION
68668 field_addr.name = "load_successful";
68669#endif /* FREECIV_JSON_CONNECTION */
68670 e = 0;
68671 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->load_successful);
68672 if (e) {
68673 log_packet_detailed("'load_successful' field error detected");
68674 }
68675#ifdef FREECIV_JSON_CONNECTION
68676 field_addr.name = "load_filename";
68677#endif /* FREECIV_JSON_CONNECTION */
68678 e = 0;
68679 e |= DIO_PUT(string, &dout, &field_addr, real_packet->load_filename);
68680 if (e) {
68681 log_packet_detailed("'load_filename' field error detected");
68682 }
68683
68684#endif
68685 SEND_PACKET_END(PACKET_GAME_LOAD);
68686}
68687
68688 int send_packet_game_load(struct connection *pc, const struct packet_game_load *packet)
68689{
68690 if (!pc->used) {
68691 log_error("WARNING: trying to send data to the closed connection %s",
68692 conn_description(pc));
68693 return -1;
68694 }
68695 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_GAME_LOAD].packet != NULL, -1,
68696 "Handler for PACKET_GAME_LOAD not installed");
68697 return pc->phs.handlers->send[PACKET_GAME_LOAD].packet(pc, packet);
68698}
68699
68700 void lsend_packet_game_load(struct conn_list *dest, const struct packet_game_load *packet)
68701{
68702 conn_list_iterate(dest, pconn) {
68703 send_packet_game_load(pconn, packet);
68704 } conn_list_iterate_end;
68705}
68706
68707 int dsend_packet_game_load(struct connection *pc, bool load_successful, const char *load_filename)
68708{
68709 struct packet_game_load packet, *real_packet = &packet;
68710
68711 real_packet->load_successful = load_successful;
68712 sz_strlcpy(real_packet->load_filename, load_filename);
68713
68714 return send_packet_game_load(pc, real_packet);
68715}
68716
68717 void dlsend_packet_game_load(struct conn_list *dest, bool load_successful, const char *load_filename)
68718{
68719 struct packet_game_load packet, *real_packet = &packet;
68720
68721 real_packet->load_successful = load_successful;
68722 sz_strlcpy(real_packet->load_filename, load_filename);
68723
68724 lsend_packet_game_load(dest, real_packet);
68725}
68726
68727#ifdef FREECIV_DELTA_PROTOCOL
68728#define hash_packet_server_setting_control_100 hash_const
68729
68730#define cmp_packet_server_setting_control_100 cmp_const
68731
68732 BV_DEFINE(packet_server_setting_control_100_fields, 3);
68733#endif /* FREECIV_DELTA_PROTOCOL */
68734
68735 static struct packet_server_setting_control *receive_packet_server_setting_control_100(struct connection *pc)
68736{
68737#ifdef FREECIV_DELTA_PROTOCOL
68738 packet_server_setting_control_100_fields fields;
68739 struct packet_server_setting_control *old;
68740 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_CONTROL;
68741#endif /* FREECIV_DELTA_PROTOCOL */
68742 RECEIVE_PACKET_START(packet_server_setting_control, real_packet);
68743#ifdef FREECIV_JSON_CONNECTION
68744 struct plocation field_addr;
68745 {
68746 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68747 field_addr = *field_addr_tmp;
68748 FC_FREE(field_addr_tmp);
68749 }
68750#endif /* FREECIV_JSON_CONNECTION */
68751
68752#ifdef FREECIV_DELTA_PROTOCOL
68753#ifdef FREECIV_JSON_CONNECTION
68754 field_addr.name = "fields";
68755#endif /* FREECIV_JSON_CONNECTION */
68756 DIO_BV_GET(&din, &field_addr, fields);
68757
68758#else /* FREECIV_DELTA_PROTOCOL */
68759#ifdef FREECIV_JSON_CONNECTION
68760 field_addr.name = "settings_num";
68761#endif /* FREECIV_JSON_CONNECTION */
68762 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->settings_num)) {
68763 RECEIVE_PACKET_FIELD_ERROR(settings_num);
68764 }
68765#ifdef FREECIV_JSON_CONNECTION
68766 field_addr.name = "categories_num";
68767#endif /* FREECIV_JSON_CONNECTION */
68768 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->categories_num)) {
68769 RECEIVE_PACKET_FIELD_ERROR(categories_num);
68770 }
68771#ifdef FREECIV_JSON_CONNECTION
68772 field_addr.name = "category_names";
68773#endif /* FREECIV_JSON_CONNECTION */
68774 {
68775 int i;
68776
68777#ifdef FREECIV_JSON_CONNECTION
68778 /* Enter array. */
68779 field_addr.sub_location = plocation_elem_new(0);
68780#endif /* FREECIV_JSON_CONNECTION */
68781
68782 if (real_packet->categories_num > 256) {
68783 RECEIVE_PACKET_FIELD_ERROR(category_names, ": truncation array");
68784 }
68785 for (i = 0; i < real_packet->categories_num; i++) {
68786#ifdef FREECIV_JSON_CONNECTION
68787 field_addr.sub_location->number = i;
68788#endif /* FREECIV_JSON_CONNECTION */
68789 if (!DIO_GET(string, &din, &field_addr, real_packet->category_names[i], sizeof(real_packet->category_names[i]))) {
68790 RECEIVE_PACKET_FIELD_ERROR(category_names);
68791 }
68792 }
68793
68794#ifdef FREECIV_JSON_CONNECTION
68795 /* Exit array. */
68796 FC_FREE(field_addr.sub_location);
68797#endif /* FREECIV_JSON_CONNECTION */
68798 }
68799#endif
68800 log_packet_detailed("packet_server_setting_control_100: got info about ()");
68801
68802#ifdef FREECIV_DELTA_PROTOCOL
68803 if (NULL == *hash) {
68804 *hash = genhash_new_full(hash_packet_server_setting_control_100, cmp_packet_server_setting_control_100,
68805 NULL, NULL, NULL, free);
68806 }
68807
68808 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
68809 *real_packet = *old;
68810 } else {
68811 log_packet_detailed(" no old info");
68812 memset(real_packet, 0, sizeof(*real_packet));
68813 }
68814
68815 if (BV_ISSET(fields, 0)) {
68816 log_packet_detailed(" got field 'settings_num'");
68817#ifdef FREECIV_JSON_CONNECTION
68818 field_addr.name = "settings_num";
68819#endif /* FREECIV_JSON_CONNECTION */
68820 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->settings_num)) {
68821 RECEIVE_PACKET_FIELD_ERROR(settings_num);
68822 }
68823 }
68824 if (BV_ISSET(fields, 1)) {
68825 log_packet_detailed(" got field 'categories_num'");
68826#ifdef FREECIV_JSON_CONNECTION
68827 field_addr.name = "categories_num";
68828#endif /* FREECIV_JSON_CONNECTION */
68829 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->categories_num)) {
68830 RECEIVE_PACKET_FIELD_ERROR(categories_num);
68831 }
68832 }
68833 if (BV_ISSET(fields, 2)) {
68834 log_packet_detailed(" got field 'category_names'");
68835#ifdef FREECIV_JSON_CONNECTION
68836 field_addr.name = "category_names";
68837#endif /* FREECIV_JSON_CONNECTION */
68838 {
68839 int i;
68840
68841#ifdef FREECIV_JSON_CONNECTION
68842 /* Enter array. */
68843 field_addr.sub_location = plocation_elem_new(0);
68844#endif /* FREECIV_JSON_CONNECTION */
68845
68846 if (real_packet->categories_num > 256) {
68847 RECEIVE_PACKET_FIELD_ERROR(category_names, ": truncation array");
68848 }
68849 for (i = 0; i < real_packet->categories_num; i++) {
68850#ifdef FREECIV_JSON_CONNECTION
68851 field_addr.sub_location->number = i;
68852#endif /* FREECIV_JSON_CONNECTION */
68853 if (!DIO_GET(string, &din, &field_addr, real_packet->category_names[i], sizeof(real_packet->category_names[i]))) {
68854 RECEIVE_PACKET_FIELD_ERROR(category_names);
68855 }
68856 }
68857
68858#ifdef FREECIV_JSON_CONNECTION
68859 /* Exit array. */
68860 FC_FREE(field_addr.sub_location);
68861#endif /* FREECIV_JSON_CONNECTION */
68862 }
68863 }
68864
68865 if (NULL == old) {
68866 old = fc_malloc(sizeof(*old));
68867 *old = *real_packet;
68868 genhash_insert(*hash, old, old);
68869 } else {
68870 *old = *real_packet;
68871 }
68872
68873#endif /* FREECIV_DELTA_PROTOCOL */
68874 RECEIVE_PACKET_END(real_packet);
68875}
68876
68877 static int send_packet_server_setting_control_100(struct connection *pc, const struct packet_server_setting_control *packet)
68878{
68879 const struct packet_server_setting_control *real_packet = packet;
68880 int e;
68881#ifdef FREECIV_DELTA_PROTOCOL
68882 packet_server_setting_control_100_fields fields;
68883 struct packet_server_setting_control *old;
68884 bool differ;
68885 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_CONTROL;
68886 int different = 0;
68887#endif /* FREECIV_DELTA_PROTOCOL */
68888 SEND_PACKET_START(PACKET_SERVER_SETTING_CONTROL);
68889#ifdef FREECIV_JSON_CONNECTION
68890 struct plocation field_addr;
68891 {
68892 struct plocation *field_addr_tmp = plocation_field_new(NULL);
68893 field_addr = *field_addr_tmp;
68894 FC_FREE(field_addr_tmp);
68895 }
68896#endif /* FREECIV_JSON_CONNECTION */
68897
68898 log_packet_detailed("packet_server_setting_control_100: sending info about ()");
68899
68900#ifdef FREECIV_DELTA_PROTOCOL
68901 if (NULL == *hash) {
68902 *hash = genhash_new_full(hash_packet_server_setting_control_100, cmp_packet_server_setting_control_100,
68903 NULL, NULL, NULL, free);
68904 }
68905 BV_CLR_ALL(fields);
68906
68907 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
68908 old = fc_malloc(sizeof(*old));
68909 *old = *real_packet;
68910 genhash_insert(*hash, old, old);
68911 memset(old, 0, sizeof(*old));
68912 different = 1; /* Force to send. */
68913 }
68914 differ = (old->settings_num != real_packet->settings_num);
68915 if (differ) {
68916 different++;
68917 BV_SET(fields, 0);
68918 }
68919
68920 differ = (old->categories_num != real_packet->categories_num);
68921 if (differ) {
68922 different++;
68923 BV_SET(fields, 1);
68924 }
68925
68926 differ = (old->categories_num != real_packet->categories_num);
68927 if (!differ) {
68928 int i;
68929
68930 for (i = 0; i < real_packet->categories_num; i++) {
68931 differ = (strcmp(old->category_names[i], real_packet->category_names[i]) != 0);
68932 if (differ) {
68933 break;
68934 }
68935 }
68936 }
68937 if (differ) {
68938 different++;
68939 BV_SET(fields, 2);
68940 }
68941
68942 if (different == 0) {
68943 log_packet_detailed(" no change -> discard");
68944 return 0;
68945 }
68946
68947#ifdef FREECIV_JSON_CONNECTION
68948 field_addr.name = "fields";
68949#endif /* FREECIV_JSON_CONNECTION */
68950 e = 0;
68951 e |= DIO_BV_PUT(&dout, &field_addr, fields);
68952 if (e) {
68953 log_packet_detailed("fields bitvector error detected");
68954 }
68955
68956 if (BV_ISSET(fields, 0)) {
68957 log_packet_detailed(" field 'settings_num' has changed");
68958#ifdef FREECIV_JSON_CONNECTION
68959 field_addr.name = "settings_num";
68960#endif /* FREECIV_JSON_CONNECTION */
68961 e = 0;
68962 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->settings_num);
68963 if (e) {
68964 log_packet_detailed("'settings_num' field error detected");
68965 }
68966 }
68967 if (BV_ISSET(fields, 1)) {
68968 log_packet_detailed(" field 'categories_num' has changed");
68969#ifdef FREECIV_JSON_CONNECTION
68970 field_addr.name = "categories_num";
68971#endif /* FREECIV_JSON_CONNECTION */
68972 e = 0;
68973 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->categories_num);
68974 if (e) {
68975 log_packet_detailed("'categories_num' field error detected");
68976 }
68977 }
68978 if (BV_ISSET(fields, 2)) {
68979 log_packet_detailed(" field 'category_names' has changed");
68980#ifdef FREECIV_JSON_CONNECTION
68981 field_addr.name = "category_names";
68982#endif /* FREECIV_JSON_CONNECTION */
68983 e = 0;
68984 {
68985 int i;
68986
68987#ifdef FREECIV_JSON_CONNECTION
68988 /* Create the array. */
68989 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->categories_num);
68990
68991 /* Enter the array. */
68992 field_addr.sub_location = plocation_elem_new(0);
68993#endif /* FREECIV_JSON_CONNECTION */
68994
68995 for (i = 0; i < real_packet->categories_num; i++) {
68996#ifdef FREECIV_JSON_CONNECTION
68997 /* Next array element. */
68998 field_addr.sub_location->number = i;
68999#endif /* FREECIV_JSON_CONNECTION */
69000 e |= DIO_PUT(string, &dout, &field_addr, real_packet->category_names[i]);
69001 }
69002
69003#ifdef FREECIV_JSON_CONNECTION
69004 /* Exit array. */
69005 FC_FREE(field_addr.sub_location);
69006#endif /* FREECIV_JSON_CONNECTION */
69007 }
69008 if (e) {
69009 log_packet_detailed("'category_names' field error detected");
69010 }
69011 }
69012
69013 *old = *real_packet;
69014#endif /* FREECIV_DELTA_PROTOCOL */
69015#ifndef FREECIV_DELTA_PROTOCOL
69016#ifdef FREECIV_JSON_CONNECTION
69017 field_addr.name = "settings_num";
69018#endif /* FREECIV_JSON_CONNECTION */
69019 e = 0;
69020 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->settings_num);
69021 if (e) {
69022 log_packet_detailed("'settings_num' field error detected");
69023 }
69024#ifdef FREECIV_JSON_CONNECTION
69025 field_addr.name = "categories_num";
69026#endif /* FREECIV_JSON_CONNECTION */
69027 e = 0;
69028 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->categories_num);
69029 if (e) {
69030 log_packet_detailed("'categories_num' field error detected");
69031 }
69032#ifdef FREECIV_JSON_CONNECTION
69033 field_addr.name = "category_names";
69034#endif /* FREECIV_JSON_CONNECTION */
69035 e = 0;
69036 {
69037 int i;
69038
69039#ifdef FREECIV_JSON_CONNECTION
69040 /* Create the array. */
69041 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->categories_num);
69042
69043 /* Enter the array. */
69044 field_addr.sub_location = plocation_elem_new(0);
69045#endif /* FREECIV_JSON_CONNECTION */
69046
69047 for (i = 0; i < real_packet->categories_num; i++) {
69048#ifdef FREECIV_JSON_CONNECTION
69049 /* Next array element. */
69050 field_addr.sub_location->number = i;
69051#endif /* FREECIV_JSON_CONNECTION */
69052 e |= DIO_PUT(string, &dout, &field_addr, real_packet->category_names[i]);
69053 }
69054
69055#ifdef FREECIV_JSON_CONNECTION
69056 /* Exit array. */
69057 FC_FREE(field_addr.sub_location);
69058#endif /* FREECIV_JSON_CONNECTION */
69059 }
69060 if (e) {
69061 log_packet_detailed("'category_names' field error detected");
69062 }
69063
69064#endif
69065 SEND_PACKET_END(PACKET_SERVER_SETTING_CONTROL);
69066}
69067
69068 int send_packet_server_setting_control(struct connection *pc, const struct packet_server_setting_control *packet)
69069{
69070 if (!pc->used) {
69071 log_error("WARNING: trying to send data to the closed connection %s",
69072 conn_description(pc));
69073 return -1;
69074 }
69075 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_CONTROL].packet != NULL, -1,
69076 "Handler for PACKET_SERVER_SETTING_CONTROL not installed");
69077 return pc->phs.handlers->send[PACKET_SERVER_SETTING_CONTROL].packet(pc, packet);
69078}
69079
69080#ifdef FREECIV_DELTA_PROTOCOL
69081static genhash_val_t hash_packet_server_setting_const_100(const void *vkey)
69082{
69083 const struct packet_server_setting_const *key = (const struct packet_server_setting_const *) vkey;
69084 genhash_val_t result = 0;
69085
69086 result += key->id;
69087
69088 result &= 0xFFFFFFFF;
69089 return result;
69090}
69091
69092static bool cmp_packet_server_setting_const_100(const void *vkey1, const void *vkey2)
69093{
69094 const struct packet_server_setting_const *old = (const struct packet_server_setting_const *) vkey1;
69095 const struct packet_server_setting_const *real_packet = (const struct packet_server_setting_const *) vkey2;
69096 bool differ;
69097
69098 differ = (old->id != real_packet->id);
69099
69100 return !differ;
69101}
69102 BV_DEFINE(packet_server_setting_const_100_fields, 4);
69103#endif /* FREECIV_DELTA_PROTOCOL */
69104
69105 static struct packet_server_setting_const *receive_packet_server_setting_const_100(struct connection *pc)
69106{
69107#ifdef FREECIV_DELTA_PROTOCOL
69108 packet_server_setting_const_100_fields fields;
69109 struct packet_server_setting_const *old;
69110 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_CONST;
69111#endif /* FREECIV_DELTA_PROTOCOL */
69112 RECEIVE_PACKET_START(packet_server_setting_const, real_packet);
69113#ifdef FREECIV_JSON_CONNECTION
69114 struct plocation field_addr;
69115 {
69116 struct plocation *field_addr_tmp = plocation_field_new(NULL);
69117 field_addr = *field_addr_tmp;
69118 FC_FREE(field_addr_tmp);
69119 }
69120#endif /* FREECIV_JSON_CONNECTION */
69121
69122#ifdef FREECIV_DELTA_PROTOCOL
69123#ifdef FREECIV_JSON_CONNECTION
69124 field_addr.name = "fields";
69125#endif /* FREECIV_JSON_CONNECTION */
69126 DIO_BV_GET(&din, &field_addr, fields);
69127#ifdef FREECIV_JSON_CONNECTION
69128 field_addr.name = "id";
69129#endif /* FREECIV_JSON_CONNECTION */
69130 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
69131 RECEIVE_PACKET_FIELD_ERROR(id);
69132 }
69133
69134#else /* FREECIV_DELTA_PROTOCOL */
69135#ifdef FREECIV_JSON_CONNECTION
69136 field_addr.name = "id";
69137#endif /* FREECIV_JSON_CONNECTION */
69138 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
69139 RECEIVE_PACKET_FIELD_ERROR(id);
69140 }
69141#ifdef FREECIV_JSON_CONNECTION
69142 field_addr.name = "name";
69143#endif /* FREECIV_JSON_CONNECTION */
69144 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
69145 RECEIVE_PACKET_FIELD_ERROR(name);
69146 }
69147#ifdef FREECIV_JSON_CONNECTION
69148 field_addr.name = "short_help";
69149#endif /* FREECIV_JSON_CONNECTION */
69150 if (!DIO_GET(string, &din, &field_addr, real_packet->short_help, sizeof(real_packet->short_help))) {
69151 RECEIVE_PACKET_FIELD_ERROR(short_help);
69152 }
69153#ifdef FREECIV_JSON_CONNECTION
69154 field_addr.name = "extra_help";
69155#endif /* FREECIV_JSON_CONNECTION */
69156 if (!DIO_GET(string, &din, &field_addr, real_packet->extra_help, sizeof(real_packet->extra_help))) {
69157 RECEIVE_PACKET_FIELD_ERROR(extra_help);
69158 }
69159#ifdef FREECIV_JSON_CONNECTION
69160 field_addr.name = "category";
69161#endif /* FREECIV_JSON_CONNECTION */
69162 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
69163 RECEIVE_PACKET_FIELD_ERROR(category);
69164 }
69165#endif
69166 log_packet_detailed("packet_server_setting_const_100: got info about (%d)",
69167 real_packet->id);
69168
69169#ifdef FREECIV_DELTA_PROTOCOL
69170 if (NULL == *hash) {
69171 *hash = genhash_new_full(hash_packet_server_setting_const_100, cmp_packet_server_setting_const_100,
69172 NULL, NULL, NULL, free);
69173 }
69174
69175 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
69176 *real_packet = *old;
69177 } else {
69178 int id;
69179
69180 id = real_packet->id;
69181
69182 log_packet_detailed(" no old info");
69183 memset(real_packet, 0, sizeof(*real_packet));
69184
69185 real_packet->id = id;
69186 }
69187
69188 if (BV_ISSET(fields, 0)) {
69189 log_packet_detailed(" got field 'name'");
69190#ifdef FREECIV_JSON_CONNECTION
69191 field_addr.name = "name";
69192#endif /* FREECIV_JSON_CONNECTION */
69193 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
69194 RECEIVE_PACKET_FIELD_ERROR(name);
69195 }
69196 }
69197 if (BV_ISSET(fields, 1)) {
69198 log_packet_detailed(" got field 'short_help'");
69199#ifdef FREECIV_JSON_CONNECTION
69200 field_addr.name = "short_help";
69201#endif /* FREECIV_JSON_CONNECTION */
69202 if (!DIO_GET(string, &din, &field_addr, real_packet->short_help, sizeof(real_packet->short_help))) {
69203 RECEIVE_PACKET_FIELD_ERROR(short_help);
69204 }
69205 }
69206 if (BV_ISSET(fields, 2)) {
69207 log_packet_detailed(" got field 'extra_help'");
69208#ifdef FREECIV_JSON_CONNECTION
69209 field_addr.name = "extra_help";
69210#endif /* FREECIV_JSON_CONNECTION */
69211 if (!DIO_GET(string, &din, &field_addr, real_packet->extra_help, sizeof(real_packet->extra_help))) {
69212 RECEIVE_PACKET_FIELD_ERROR(extra_help);
69213 }
69214 }
69215 if (BV_ISSET(fields, 3)) {
69216 log_packet_detailed(" got field 'category'");
69217#ifdef FREECIV_JSON_CONNECTION
69218 field_addr.name = "category";
69219#endif /* FREECIV_JSON_CONNECTION */
69220 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->category)) {
69221 RECEIVE_PACKET_FIELD_ERROR(category);
69222 }
69223 }
69224
69225 if (NULL == old) {
69226 old = fc_malloc(sizeof(*old));
69227 *old = *real_packet;
69228 genhash_insert(*hash, old, old);
69229 } else {
69230 *old = *real_packet;
69231 }
69232
69233#endif /* FREECIV_DELTA_PROTOCOL */
69234 RECEIVE_PACKET_END(real_packet);
69235}
69236
69237 static int send_packet_server_setting_const_100(struct connection *pc, const struct packet_server_setting_const *packet)
69238{
69239 const struct packet_server_setting_const *real_packet = packet;
69240 int e;
69241#ifdef FREECIV_DELTA_PROTOCOL
69242 packet_server_setting_const_100_fields fields;
69243 struct packet_server_setting_const *old;
69244 bool differ;
69245 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_CONST;
69246 int different = 0;
69247#endif /* FREECIV_DELTA_PROTOCOL */
69248 SEND_PACKET_START(PACKET_SERVER_SETTING_CONST);
69249#ifdef FREECIV_JSON_CONNECTION
69250 struct plocation field_addr;
69251 {
69252 struct plocation *field_addr_tmp = plocation_field_new(NULL);
69253 field_addr = *field_addr_tmp;
69254 FC_FREE(field_addr_tmp);
69255 }
69256#endif /* FREECIV_JSON_CONNECTION */
69257
69258 log_packet_detailed("packet_server_setting_const_100: sending info about (%d)",
69259 real_packet->id);
69260
69261#ifdef FREECIV_DELTA_PROTOCOL
69262 if (NULL == *hash) {
69263 *hash = genhash_new_full(hash_packet_server_setting_const_100, cmp_packet_server_setting_const_100,
69264 NULL, NULL, NULL, free);
69265 }
69266 BV_CLR_ALL(fields);
69267
69268 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
69269 old = fc_malloc(sizeof(*old));
69270 *old = *real_packet;
69271 genhash_insert(*hash, old, old);
69272 memset(old, 0, sizeof(*old));
69273 different = 1; /* Force to send. */
69274 }
69275 differ = (strcmp(old->name, real_packet->name) != 0);
69276 if (differ) {
69277 different++;
69278 BV_SET(fields, 0);
69279 }
69280
69281 differ = (strcmp(old->short_help, real_packet->short_help) != 0);
69282 if (differ) {
69283 different++;
69284 BV_SET(fields, 1);
69285 }
69286
69287 differ = (strcmp(old->extra_help, real_packet->extra_help) != 0);
69288 if (differ) {
69289 different++;
69290 BV_SET(fields, 2);
69291 }
69292
69293 differ = (old->category != real_packet->category);
69294 if (differ) {
69295 different++;
69296 BV_SET(fields, 3);
69297 }
69298
69299 if (different == 0) {
69300 log_packet_detailed(" no change -> discard");
69301 return 0;
69302 }
69303
69304#ifdef FREECIV_JSON_CONNECTION
69305 field_addr.name = "fields";
69306#endif /* FREECIV_JSON_CONNECTION */
69307 e = 0;
69308 e |= DIO_BV_PUT(&dout, &field_addr, fields);
69309 if (e) {
69310 log_packet_detailed("fields bitvector error detected");
69311 }
69312#ifdef FREECIV_JSON_CONNECTION
69313 field_addr.name = "id";
69314#endif /* FREECIV_JSON_CONNECTION */
69315 e = 0;
69316 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
69317 if (e) {
69318 log_packet_detailed("'id' field error detected");
69319 }
69320
69321 if (BV_ISSET(fields, 0)) {
69322 log_packet_detailed(" field 'name' has changed");
69323#ifdef FREECIV_JSON_CONNECTION
69324 field_addr.name = "name";
69325#endif /* FREECIV_JSON_CONNECTION */
69326 e = 0;
69327 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
69328 if (e) {
69329 log_packet_detailed("'name' field error detected");
69330 }
69331 }
69332 if (BV_ISSET(fields, 1)) {
69333 log_packet_detailed(" field 'short_help' has changed");
69334#ifdef FREECIV_JSON_CONNECTION
69335 field_addr.name = "short_help";
69336#endif /* FREECIV_JSON_CONNECTION */
69337 e = 0;
69338 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_help);
69339 if (e) {
69340 log_packet_detailed("'short_help' field error detected");
69341 }
69342 }
69343 if (BV_ISSET(fields, 2)) {
69344 log_packet_detailed(" field 'extra_help' has changed");
69345#ifdef FREECIV_JSON_CONNECTION
69346 field_addr.name = "extra_help";
69347#endif /* FREECIV_JSON_CONNECTION */
69348 e = 0;
69349 e |= DIO_PUT(string, &dout, &field_addr, real_packet->extra_help);
69350 if (e) {
69351 log_packet_detailed("'extra_help' field error detected");
69352 }
69353 }
69354 if (BV_ISSET(fields, 3)) {
69355 log_packet_detailed(" field 'category' has changed");
69356#ifdef FREECIV_JSON_CONNECTION
69357 field_addr.name = "category";
69358#endif /* FREECIV_JSON_CONNECTION */
69359 e = 0;
69360 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
69361 if (e) {
69362 log_packet_detailed("'category' field error detected");
69363 }
69364 }
69365
69366 *old = *real_packet;
69367#endif /* FREECIV_DELTA_PROTOCOL */
69368#ifndef FREECIV_DELTA_PROTOCOL
69369#ifdef FREECIV_JSON_CONNECTION
69370 field_addr.name = "id";
69371#endif /* FREECIV_JSON_CONNECTION */
69372 e = 0;
69373 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
69374 if (e) {
69375 log_packet_detailed("'id' field error detected");
69376 }
69377#ifdef FREECIV_JSON_CONNECTION
69378 field_addr.name = "name";
69379#endif /* FREECIV_JSON_CONNECTION */
69380 e = 0;
69381 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
69382 if (e) {
69383 log_packet_detailed("'name' field error detected");
69384 }
69385#ifdef FREECIV_JSON_CONNECTION
69386 field_addr.name = "short_help";
69387#endif /* FREECIV_JSON_CONNECTION */
69388 e = 0;
69389 e |= DIO_PUT(string, &dout, &field_addr, real_packet->short_help);
69390 if (e) {
69391 log_packet_detailed("'short_help' field error detected");
69392 }
69393#ifdef FREECIV_JSON_CONNECTION
69394 field_addr.name = "extra_help";
69395#endif /* FREECIV_JSON_CONNECTION */
69396 e = 0;
69397 e |= DIO_PUT(string, &dout, &field_addr, real_packet->extra_help);
69398 if (e) {
69399 log_packet_detailed("'extra_help' field error detected");
69400 }
69401#ifdef FREECIV_JSON_CONNECTION
69402 field_addr.name = "category";
69403#endif /* FREECIV_JSON_CONNECTION */
69404 e = 0;
69405 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->category);
69406 if (e) {
69407 log_packet_detailed("'category' field error detected");
69408 }
69409
69410#endif
69411 SEND_PACKET_END(PACKET_SERVER_SETTING_CONST);
69412}
69413
69414 int send_packet_server_setting_const(struct connection *pc, const struct packet_server_setting_const *packet)
69415{
69416 if (!pc->used) {
69417 log_error("WARNING: trying to send data to the closed connection %s",
69418 conn_description(pc));
69419 return -1;
69420 }
69421 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_CONST].packet != NULL, -1,
69422 "Handler for PACKET_SERVER_SETTING_CONST not installed");
69423 return pc->phs.handlers->send[PACKET_SERVER_SETTING_CONST].packet(pc, packet);
69424}
69425
69426#ifdef FREECIV_DELTA_PROTOCOL
69427static genhash_val_t hash_packet_server_setting_bool_100(const void *vkey)
69428{
69429 const struct packet_server_setting_bool *key = (const struct packet_server_setting_bool *) vkey;
69430 genhash_val_t result = 0;
69431
69432 result += key->id;
69433
69434 result &= 0xFFFFFFFF;
69435 return result;
69436}
69437
69438static bool cmp_packet_server_setting_bool_100(const void *vkey1, const void *vkey2)
69439{
69440 const struct packet_server_setting_bool *old = (const struct packet_server_setting_bool *) vkey1;
69441 const struct packet_server_setting_bool *real_packet = (const struct packet_server_setting_bool *) vkey2;
69442 bool differ;
69443
69444 differ = (old->id != real_packet->id);
69445
69446 return !differ;
69447}
69448 BV_DEFINE(packet_server_setting_bool_100_fields, 6);
69449#endif /* FREECIV_DELTA_PROTOCOL */
69450
69451 static struct packet_server_setting_bool *receive_packet_server_setting_bool_100(struct connection *pc)
69452{
69453#ifdef FREECIV_DELTA_PROTOCOL
69454 packet_server_setting_bool_100_fields fields;
69455 struct packet_server_setting_bool *old;
69456 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_BOOL;
69457#endif /* FREECIV_DELTA_PROTOCOL */
69458 RECEIVE_PACKET_START(packet_server_setting_bool, real_packet);
69459#ifdef FREECIV_JSON_CONNECTION
69460 struct plocation field_addr;
69461 {
69462 struct plocation *field_addr_tmp = plocation_field_new(NULL);
69463 field_addr = *field_addr_tmp;
69464 FC_FREE(field_addr_tmp);
69465 }
69466#endif /* FREECIV_JSON_CONNECTION */
69467
69468#ifdef FREECIV_DELTA_PROTOCOL
69469#ifdef FREECIV_JSON_CONNECTION
69470 field_addr.name = "fields";
69471#endif /* FREECIV_JSON_CONNECTION */
69472 DIO_BV_GET(&din, &field_addr, fields);
69473#ifdef FREECIV_JSON_CONNECTION
69474 field_addr.name = "id";
69475#endif /* FREECIV_JSON_CONNECTION */
69476 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
69477 RECEIVE_PACKET_FIELD_ERROR(id);
69478 }
69479
69480#else /* FREECIV_DELTA_PROTOCOL */
69481#ifdef FREECIV_JSON_CONNECTION
69482 field_addr.name = "id";
69483#endif /* FREECIV_JSON_CONNECTION */
69484 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
69485 RECEIVE_PACKET_FIELD_ERROR(id);
69486 }
69487#ifdef FREECIV_JSON_CONNECTION
69488 field_addr.name = "is_visible";
69489#endif /* FREECIV_JSON_CONNECTION */
69490 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
69491 RECEIVE_PACKET_FIELD_ERROR(is_visible);
69492 }
69493#ifdef FREECIV_JSON_CONNECTION
69494 field_addr.name = "is_changeable";
69495#endif /* FREECIV_JSON_CONNECTION */
69496 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
69497 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
69498 }
69499#ifdef FREECIV_JSON_CONNECTION
69500 field_addr.name = "initial_setting";
69501#endif /* FREECIV_JSON_CONNECTION */
69502 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
69503 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
69504 }
69505#ifdef FREECIV_JSON_CONNECTION
69506 field_addr.name = "setdef";
69507#endif /* FREECIV_JSON_CONNECTION */
69508 {
69509 int readin;
69510
69511 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
69512 RECEIVE_PACKET_FIELD_ERROR(setdef);
69513 }
69514 real_packet->setdef = readin;
69515 }
69516#ifdef FREECIV_JSON_CONNECTION
69517 field_addr.name = "val";
69518#endif /* FREECIV_JSON_CONNECTION */
69519 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->val)) {
69520 RECEIVE_PACKET_FIELD_ERROR(val);
69521 }
69522#ifdef FREECIV_JSON_CONNECTION
69523 field_addr.name = "default_val";
69524#endif /* FREECIV_JSON_CONNECTION */
69525 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->default_val)) {
69526 RECEIVE_PACKET_FIELD_ERROR(default_val);
69527 }
69528#endif
69529 log_packet_detailed("packet_server_setting_bool_100: got info about (%d)",
69530 real_packet->id);
69531
69532#ifdef FREECIV_DELTA_PROTOCOL
69533 if (NULL == *hash) {
69534 *hash = genhash_new_full(hash_packet_server_setting_bool_100, cmp_packet_server_setting_bool_100,
69535 NULL, NULL, NULL, free);
69536 }
69537
69538 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
69539 *real_packet = *old;
69540 } else {
69541 int id;
69542
69543 id = real_packet->id;
69544
69545 log_packet_detailed(" no old info");
69546 memset(real_packet, 0, sizeof(*real_packet));
69547
69548 real_packet->id = id;
69549 }
69550
69551 real_packet->is_visible = BV_ISSET(fields, 0);
69552 real_packet->is_changeable = BV_ISSET(fields, 1);
69553 real_packet->initial_setting = BV_ISSET(fields, 2);
69554 if (BV_ISSET(fields, 3)) {
69555 log_packet_detailed(" got field 'setdef'");
69556#ifdef FREECIV_JSON_CONNECTION
69557 field_addr.name = "setdef";
69558#endif /* FREECIV_JSON_CONNECTION */
69559 {
69560 int readin;
69561
69562 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
69563 RECEIVE_PACKET_FIELD_ERROR(setdef);
69564 }
69565 real_packet->setdef = readin;
69566 }
69567 }
69568 real_packet->val = BV_ISSET(fields, 4);
69569 real_packet->default_val = BV_ISSET(fields, 5);
69570
69571 if (NULL == old) {
69572 old = fc_malloc(sizeof(*old));
69573 *old = *real_packet;
69574 genhash_insert(*hash, old, old);
69575 } else {
69576 *old = *real_packet;
69577 }
69578
69579#endif /* FREECIV_DELTA_PROTOCOL */
69580 RECEIVE_PACKET_END(real_packet);
69581}
69582
69583 static int send_packet_server_setting_bool_100(struct connection *pc, const struct packet_server_setting_bool *packet)
69584{
69585 const struct packet_server_setting_bool *real_packet = packet;
69586 int e;
69587#ifdef FREECIV_DELTA_PROTOCOL
69588 packet_server_setting_bool_100_fields fields;
69589 struct packet_server_setting_bool *old;
69590 bool differ;
69591 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_BOOL;
69592 int different = 0;
69593#endif /* FREECIV_DELTA_PROTOCOL */
69594 SEND_PACKET_START(PACKET_SERVER_SETTING_BOOL);
69595#ifdef FREECIV_JSON_CONNECTION
69596 struct plocation field_addr;
69597 {
69598 struct plocation *field_addr_tmp = plocation_field_new(NULL);
69599 field_addr = *field_addr_tmp;
69600 FC_FREE(field_addr_tmp);
69601 }
69602#endif /* FREECIV_JSON_CONNECTION */
69603
69604 log_packet_detailed("packet_server_setting_bool_100: sending info about (%d)",
69605 real_packet->id);
69606
69607#ifdef FREECIV_DELTA_PROTOCOL
69608 if (NULL == *hash) {
69609 *hash = genhash_new_full(hash_packet_server_setting_bool_100, cmp_packet_server_setting_bool_100,
69610 NULL, NULL, NULL, free);
69611 }
69612 BV_CLR_ALL(fields);
69613
69614 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
69615 old = fc_malloc(sizeof(*old));
69616 *old = *real_packet;
69617 genhash_insert(*hash, old, old);
69618 memset(old, 0, sizeof(*old));
69619 different = 1; /* Force to send. */
69620 }
69621 differ = (old->is_visible != real_packet->is_visible);
69622 if (differ) {
69623 different++;
69624 }
69625 if (packet->is_visible) {
69626 BV_SET(fields, 0);
69627 }
69628
69629 differ = (old->is_changeable != real_packet->is_changeable);
69630 if (differ) {
69631 different++;
69632 }
69633 if (packet->is_changeable) {
69634 BV_SET(fields, 1);
69635 }
69636
69637 differ = (old->initial_setting != real_packet->initial_setting);
69638 if (differ) {
69639 different++;
69640 }
69641 if (packet->initial_setting) {
69642 BV_SET(fields, 2);
69643 }
69644
69645 differ = (old->setdef != real_packet->setdef);
69646 if (differ) {
69647 different++;
69648 BV_SET(fields, 3);
69649 }
69650
69651 differ = (old->val != real_packet->val);
69652 if (differ) {
69653 different++;
69654 }
69655 if (packet->val) {
69656 BV_SET(fields, 4);
69657 }
69658
69659 differ = (old->default_val != real_packet->default_val);
69660 if (differ) {
69661 different++;
69662 }
69663 if (packet->default_val) {
69664 BV_SET(fields, 5);
69665 }
69666
69667 if (different == 0) {
69668 log_packet_detailed(" no change -> discard");
69669 return 0;
69670 }
69671
69672#ifdef FREECIV_JSON_CONNECTION
69673 field_addr.name = "fields";
69674#endif /* FREECIV_JSON_CONNECTION */
69675 e = 0;
69676 e |= DIO_BV_PUT(&dout, &field_addr, fields);
69677 if (e) {
69678 log_packet_detailed("fields bitvector error detected");
69679 }
69680#ifdef FREECIV_JSON_CONNECTION
69681 field_addr.name = "id";
69682#endif /* FREECIV_JSON_CONNECTION */
69683 e = 0;
69684 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
69685 if (e) {
69686 log_packet_detailed("'id' field error detected");
69687 }
69688
69689 /* field 0 is folded into the header */
69690 /* field 1 is folded into the header */
69691 /* field 2 is folded into the header */
69692 if (BV_ISSET(fields, 3)) {
69693 log_packet_detailed(" field 'setdef' has changed");
69694#ifdef FREECIV_JSON_CONNECTION
69695 field_addr.name = "setdef";
69696#endif /* FREECIV_JSON_CONNECTION */
69697 e = 0;
69698 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
69699 if (e) {
69700 log_packet_detailed("'setdef' field error detected");
69701 }
69702 }
69703 /* field 4 is folded into the header */
69704 /* field 5 is folded into the header */
69705
69706 *old = *real_packet;
69707#endif /* FREECIV_DELTA_PROTOCOL */
69708#ifndef FREECIV_DELTA_PROTOCOL
69709#ifdef FREECIV_JSON_CONNECTION
69710 field_addr.name = "id";
69711#endif /* FREECIV_JSON_CONNECTION */
69712 e = 0;
69713 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
69714 if (e) {
69715 log_packet_detailed("'id' field error detected");
69716 }
69717#ifdef FREECIV_JSON_CONNECTION
69718 field_addr.name = "is_visible";
69719#endif /* FREECIV_JSON_CONNECTION */
69720 e = 0;
69721 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
69722 if (e) {
69723 log_packet_detailed("'is_visible' field error detected");
69724 }
69725#ifdef FREECIV_JSON_CONNECTION
69726 field_addr.name = "is_changeable";
69727#endif /* FREECIV_JSON_CONNECTION */
69728 e = 0;
69729 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
69730 if (e) {
69731 log_packet_detailed("'is_changeable' field error detected");
69732 }
69733#ifdef FREECIV_JSON_CONNECTION
69734 field_addr.name = "initial_setting";
69735#endif /* FREECIV_JSON_CONNECTION */
69736 e = 0;
69737 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
69738 if (e) {
69739 log_packet_detailed("'initial_setting' field error detected");
69740 }
69741#ifdef FREECIV_JSON_CONNECTION
69742 field_addr.name = "setdef";
69743#endif /* FREECIV_JSON_CONNECTION */
69744 e = 0;
69745 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
69746 if (e) {
69747 log_packet_detailed("'setdef' field error detected");
69748 }
69749#ifdef FREECIV_JSON_CONNECTION
69750 field_addr.name = "val";
69751#endif /* FREECIV_JSON_CONNECTION */
69752 e = 0;
69753 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->val);
69754 if (e) {
69755 log_packet_detailed("'val' field error detected");
69756 }
69757#ifdef FREECIV_JSON_CONNECTION
69758 field_addr.name = "default_val";
69759#endif /* FREECIV_JSON_CONNECTION */
69760 e = 0;
69761 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->default_val);
69762 if (e) {
69763 log_packet_detailed("'default_val' field error detected");
69764 }
69765
69766#endif
69767 SEND_PACKET_END(PACKET_SERVER_SETTING_BOOL);
69768}
69769
69770 int send_packet_server_setting_bool(struct connection *pc, const struct packet_server_setting_bool *packet)
69771{
69772 if (!pc->used) {
69773 log_error("WARNING: trying to send data to the closed connection %s",
69774 conn_description(pc));
69775 return -1;
69776 }
69777 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_BOOL].packet != NULL, -1,
69778 "Handler for PACKET_SERVER_SETTING_BOOL not installed");
69779 return pc->phs.handlers->send[PACKET_SERVER_SETTING_BOOL].packet(pc, packet);
69780}
69781
69782#ifdef FREECIV_DELTA_PROTOCOL
69783static genhash_val_t hash_packet_server_setting_int_100(const void *vkey)
69784{
69785 const struct packet_server_setting_int *key = (const struct packet_server_setting_int *) vkey;
69786 genhash_val_t result = 0;
69787
69788 result += key->id;
69789
69790 result &= 0xFFFFFFFF;
69791 return result;
69792}
69793
69794static bool cmp_packet_server_setting_int_100(const void *vkey1, const void *vkey2)
69795{
69796 const struct packet_server_setting_int *old = (const struct packet_server_setting_int *) vkey1;
69797 const struct packet_server_setting_int *real_packet = (const struct packet_server_setting_int *) vkey2;
69798 bool differ;
69799
69800 differ = (old->id != real_packet->id);
69801
69802 return !differ;
69803}
69804 BV_DEFINE(packet_server_setting_int_100_fields, 8);
69805#endif /* FREECIV_DELTA_PROTOCOL */
69806
69807 static struct packet_server_setting_int *receive_packet_server_setting_int_100(struct connection *pc)
69808{
69809#ifdef FREECIV_DELTA_PROTOCOL
69810 packet_server_setting_int_100_fields fields;
69811 struct packet_server_setting_int *old;
69812 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_INT;
69813#endif /* FREECIV_DELTA_PROTOCOL */
69814 RECEIVE_PACKET_START(packet_server_setting_int, real_packet);
69815#ifdef FREECIV_JSON_CONNECTION
69816 struct plocation field_addr;
69817 {
69818 struct plocation *field_addr_tmp = plocation_field_new(NULL);
69819 field_addr = *field_addr_tmp;
69820 FC_FREE(field_addr_tmp);
69821 }
69822#endif /* FREECIV_JSON_CONNECTION */
69823
69824#ifdef FREECIV_DELTA_PROTOCOL
69825#ifdef FREECIV_JSON_CONNECTION
69826 field_addr.name = "fields";
69827#endif /* FREECIV_JSON_CONNECTION */
69828 DIO_BV_GET(&din, &field_addr, fields);
69829#ifdef FREECIV_JSON_CONNECTION
69830 field_addr.name = "id";
69831#endif /* FREECIV_JSON_CONNECTION */
69832 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
69833 RECEIVE_PACKET_FIELD_ERROR(id);
69834 }
69835
69836#else /* FREECIV_DELTA_PROTOCOL */
69837#ifdef FREECIV_JSON_CONNECTION
69838 field_addr.name = "id";
69839#endif /* FREECIV_JSON_CONNECTION */
69840 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
69841 RECEIVE_PACKET_FIELD_ERROR(id);
69842 }
69843#ifdef FREECIV_JSON_CONNECTION
69844 field_addr.name = "is_visible";
69845#endif /* FREECIV_JSON_CONNECTION */
69846 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
69847 RECEIVE_PACKET_FIELD_ERROR(is_visible);
69848 }
69849#ifdef FREECIV_JSON_CONNECTION
69850 field_addr.name = "is_changeable";
69851#endif /* FREECIV_JSON_CONNECTION */
69852 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
69853 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
69854 }
69855#ifdef FREECIV_JSON_CONNECTION
69856 field_addr.name = "initial_setting";
69857#endif /* FREECIV_JSON_CONNECTION */
69858 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
69859 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
69860 }
69861#ifdef FREECIV_JSON_CONNECTION
69862 field_addr.name = "setdef";
69863#endif /* FREECIV_JSON_CONNECTION */
69864 {
69865 int readin;
69866
69867 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
69868 RECEIVE_PACKET_FIELD_ERROR(setdef);
69869 }
69870 real_packet->setdef = readin;
69871 }
69872#ifdef FREECIV_JSON_CONNECTION
69873 field_addr.name = "val";
69874#endif /* FREECIV_JSON_CONNECTION */
69875 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->val)) {
69876 RECEIVE_PACKET_FIELD_ERROR(val);
69877 }
69878#ifdef FREECIV_JSON_CONNECTION
69879 field_addr.name = "default_val";
69880#endif /* FREECIV_JSON_CONNECTION */
69881 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->default_val)) {
69882 RECEIVE_PACKET_FIELD_ERROR(default_val);
69883 }
69884#ifdef FREECIV_JSON_CONNECTION
69885 field_addr.name = "min_val";
69886#endif /* FREECIV_JSON_CONNECTION */
69887 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_val)) {
69888 RECEIVE_PACKET_FIELD_ERROR(min_val);
69889 }
69890#ifdef FREECIV_JSON_CONNECTION
69891 field_addr.name = "max_val";
69892#endif /* FREECIV_JSON_CONNECTION */
69893 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_val)) {
69894 RECEIVE_PACKET_FIELD_ERROR(max_val);
69895 }
69896#endif
69897 log_packet_detailed("packet_server_setting_int_100: got info about (%d)",
69898 real_packet->id);
69899
69900#ifdef FREECIV_DELTA_PROTOCOL
69901 if (NULL == *hash) {
69902 *hash = genhash_new_full(hash_packet_server_setting_int_100, cmp_packet_server_setting_int_100,
69903 NULL, NULL, NULL, free);
69904 }
69905
69906 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
69907 *real_packet = *old;
69908 } else {
69909 int id;
69910
69911 id = real_packet->id;
69912
69913 log_packet_detailed(" no old info");
69914 memset(real_packet, 0, sizeof(*real_packet));
69915
69916 real_packet->id = id;
69917 }
69918
69919 real_packet->is_visible = BV_ISSET(fields, 0);
69920 real_packet->is_changeable = BV_ISSET(fields, 1);
69921 real_packet->initial_setting = BV_ISSET(fields, 2);
69922 if (BV_ISSET(fields, 3)) {
69923 log_packet_detailed(" got field 'setdef'");
69924#ifdef FREECIV_JSON_CONNECTION
69925 field_addr.name = "setdef";
69926#endif /* FREECIV_JSON_CONNECTION */
69927 {
69928 int readin;
69929
69930 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
69931 RECEIVE_PACKET_FIELD_ERROR(setdef);
69932 }
69933 real_packet->setdef = readin;
69934 }
69935 }
69936 if (BV_ISSET(fields, 4)) {
69937 log_packet_detailed(" got field 'val'");
69938#ifdef FREECIV_JSON_CONNECTION
69939 field_addr.name = "val";
69940#endif /* FREECIV_JSON_CONNECTION */
69941 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->val)) {
69942 RECEIVE_PACKET_FIELD_ERROR(val);
69943 }
69944 }
69945 if (BV_ISSET(fields, 5)) {
69946 log_packet_detailed(" got field 'default_val'");
69947#ifdef FREECIV_JSON_CONNECTION
69948 field_addr.name = "default_val";
69949#endif /* FREECIV_JSON_CONNECTION */
69950 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->default_val)) {
69951 RECEIVE_PACKET_FIELD_ERROR(default_val);
69952 }
69953 }
69954 if (BV_ISSET(fields, 6)) {
69955 log_packet_detailed(" got field 'min_val'");
69956#ifdef FREECIV_JSON_CONNECTION
69957 field_addr.name = "min_val";
69958#endif /* FREECIV_JSON_CONNECTION */
69959 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->min_val)) {
69960 RECEIVE_PACKET_FIELD_ERROR(min_val);
69961 }
69962 }
69963 if (BV_ISSET(fields, 7)) {
69964 log_packet_detailed(" got field 'max_val'");
69965#ifdef FREECIV_JSON_CONNECTION
69966 field_addr.name = "max_val";
69967#endif /* FREECIV_JSON_CONNECTION */
69968 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->max_val)) {
69969 RECEIVE_PACKET_FIELD_ERROR(max_val);
69970 }
69971 }
69972
69973 if (NULL == old) {
69974 old = fc_malloc(sizeof(*old));
69975 *old = *real_packet;
69976 genhash_insert(*hash, old, old);
69977 } else {
69978 *old = *real_packet;
69979 }
69980
69981#endif /* FREECIV_DELTA_PROTOCOL */
69982 RECEIVE_PACKET_END(real_packet);
69983}
69984
69985 static int send_packet_server_setting_int_100(struct connection *pc, const struct packet_server_setting_int *packet)
69986{
69987 const struct packet_server_setting_int *real_packet = packet;
69988 int e;
69989#ifdef FREECIV_DELTA_PROTOCOL
69990 packet_server_setting_int_100_fields fields;
69991 struct packet_server_setting_int *old;
69992 bool differ;
69993 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_INT;
69994 int different = 0;
69995#endif /* FREECIV_DELTA_PROTOCOL */
69996 SEND_PACKET_START(PACKET_SERVER_SETTING_INT);
69997#ifdef FREECIV_JSON_CONNECTION
69998 struct plocation field_addr;
69999 {
70000 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70001 field_addr = *field_addr_tmp;
70002 FC_FREE(field_addr_tmp);
70003 }
70004#endif /* FREECIV_JSON_CONNECTION */
70005
70006 log_packet_detailed("packet_server_setting_int_100: sending info about (%d)",
70007 real_packet->id);
70008
70009#ifdef FREECIV_DELTA_PROTOCOL
70010 if (NULL == *hash) {
70011 *hash = genhash_new_full(hash_packet_server_setting_int_100, cmp_packet_server_setting_int_100,
70012 NULL, NULL, NULL, free);
70013 }
70014 BV_CLR_ALL(fields);
70015
70016 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
70017 old = fc_malloc(sizeof(*old));
70018 *old = *real_packet;
70019 genhash_insert(*hash, old, old);
70020 memset(old, 0, sizeof(*old));
70021 different = 1; /* Force to send. */
70022 }
70023 differ = (old->is_visible != real_packet->is_visible);
70024 if (differ) {
70025 different++;
70026 }
70027 if (packet->is_visible) {
70028 BV_SET(fields, 0);
70029 }
70030
70031 differ = (old->is_changeable != real_packet->is_changeable);
70032 if (differ) {
70033 different++;
70034 }
70035 if (packet->is_changeable) {
70036 BV_SET(fields, 1);
70037 }
70038
70039 differ = (old->initial_setting != real_packet->initial_setting);
70040 if (differ) {
70041 different++;
70042 }
70043 if (packet->initial_setting) {
70044 BV_SET(fields, 2);
70045 }
70046
70047 differ = (old->setdef != real_packet->setdef);
70048 if (differ) {
70049 different++;
70050 BV_SET(fields, 3);
70051 }
70052
70053 differ = (old->val != real_packet->val);
70054 if (differ) {
70055 different++;
70056 BV_SET(fields, 4);
70057 }
70058
70059 differ = (old->default_val != real_packet->default_val);
70060 if (differ) {
70061 different++;
70062 BV_SET(fields, 5);
70063 }
70064
70065 differ = (old->min_val != real_packet->min_val);
70066 if (differ) {
70067 different++;
70068 BV_SET(fields, 6);
70069 }
70070
70071 differ = (old->max_val != real_packet->max_val);
70072 if (differ) {
70073 different++;
70074 BV_SET(fields, 7);
70075 }
70076
70077 if (different == 0) {
70078 log_packet_detailed(" no change -> discard");
70079 return 0;
70080 }
70081
70082#ifdef FREECIV_JSON_CONNECTION
70083 field_addr.name = "fields";
70084#endif /* FREECIV_JSON_CONNECTION */
70085 e = 0;
70086 e |= DIO_BV_PUT(&dout, &field_addr, fields);
70087 if (e) {
70088 log_packet_detailed("fields bitvector error detected");
70089 }
70090#ifdef FREECIV_JSON_CONNECTION
70091 field_addr.name = "id";
70092#endif /* FREECIV_JSON_CONNECTION */
70093 e = 0;
70094 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
70095 if (e) {
70096 log_packet_detailed("'id' field error detected");
70097 }
70098
70099 /* field 0 is folded into the header */
70100 /* field 1 is folded into the header */
70101 /* field 2 is folded into the header */
70102 if (BV_ISSET(fields, 3)) {
70103 log_packet_detailed(" field 'setdef' has changed");
70104#ifdef FREECIV_JSON_CONNECTION
70105 field_addr.name = "setdef";
70106#endif /* FREECIV_JSON_CONNECTION */
70107 e = 0;
70108 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
70109 if (e) {
70110 log_packet_detailed("'setdef' field error detected");
70111 }
70112 }
70113 if (BV_ISSET(fields, 4)) {
70114 log_packet_detailed(" field 'val' has changed");
70115#ifdef FREECIV_JSON_CONNECTION
70116 field_addr.name = "val";
70117#endif /* FREECIV_JSON_CONNECTION */
70118 e = 0;
70119 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->val);
70120 if (e) {
70121 log_packet_detailed("'val' field error detected");
70122 }
70123 }
70124 if (BV_ISSET(fields, 5)) {
70125 log_packet_detailed(" field 'default_val' has changed");
70126#ifdef FREECIV_JSON_CONNECTION
70127 field_addr.name = "default_val";
70128#endif /* FREECIV_JSON_CONNECTION */
70129 e = 0;
70130 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->default_val);
70131 if (e) {
70132 log_packet_detailed("'default_val' field error detected");
70133 }
70134 }
70135 if (BV_ISSET(fields, 6)) {
70136 log_packet_detailed(" field 'min_val' has changed");
70137#ifdef FREECIV_JSON_CONNECTION
70138 field_addr.name = "min_val";
70139#endif /* FREECIV_JSON_CONNECTION */
70140 e = 0;
70141 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_val);
70142 if (e) {
70143 log_packet_detailed("'min_val' field error detected");
70144 }
70145 }
70146 if (BV_ISSET(fields, 7)) {
70147 log_packet_detailed(" field 'max_val' has changed");
70148#ifdef FREECIV_JSON_CONNECTION
70149 field_addr.name = "max_val";
70150#endif /* FREECIV_JSON_CONNECTION */
70151 e = 0;
70152 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_val);
70153 if (e) {
70154 log_packet_detailed("'max_val' field error detected");
70155 }
70156 }
70157
70158 *old = *real_packet;
70159#endif /* FREECIV_DELTA_PROTOCOL */
70160#ifndef FREECIV_DELTA_PROTOCOL
70161#ifdef FREECIV_JSON_CONNECTION
70162 field_addr.name = "id";
70163#endif /* FREECIV_JSON_CONNECTION */
70164 e = 0;
70165 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
70166 if (e) {
70167 log_packet_detailed("'id' field error detected");
70168 }
70169#ifdef FREECIV_JSON_CONNECTION
70170 field_addr.name = "is_visible";
70171#endif /* FREECIV_JSON_CONNECTION */
70172 e = 0;
70173 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
70174 if (e) {
70175 log_packet_detailed("'is_visible' field error detected");
70176 }
70177#ifdef FREECIV_JSON_CONNECTION
70178 field_addr.name = "is_changeable";
70179#endif /* FREECIV_JSON_CONNECTION */
70180 e = 0;
70181 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
70182 if (e) {
70183 log_packet_detailed("'is_changeable' field error detected");
70184 }
70185#ifdef FREECIV_JSON_CONNECTION
70186 field_addr.name = "initial_setting";
70187#endif /* FREECIV_JSON_CONNECTION */
70188 e = 0;
70189 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
70190 if (e) {
70191 log_packet_detailed("'initial_setting' field error detected");
70192 }
70193#ifdef FREECIV_JSON_CONNECTION
70194 field_addr.name = "setdef";
70195#endif /* FREECIV_JSON_CONNECTION */
70196 e = 0;
70197 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
70198 if (e) {
70199 log_packet_detailed("'setdef' field error detected");
70200 }
70201#ifdef FREECIV_JSON_CONNECTION
70202 field_addr.name = "val";
70203#endif /* FREECIV_JSON_CONNECTION */
70204 e = 0;
70205 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->val);
70206 if (e) {
70207 log_packet_detailed("'val' field error detected");
70208 }
70209#ifdef FREECIV_JSON_CONNECTION
70210 field_addr.name = "default_val";
70211#endif /* FREECIV_JSON_CONNECTION */
70212 e = 0;
70213 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->default_val);
70214 if (e) {
70215 log_packet_detailed("'default_val' field error detected");
70216 }
70217#ifdef FREECIV_JSON_CONNECTION
70218 field_addr.name = "min_val";
70219#endif /* FREECIV_JSON_CONNECTION */
70220 e = 0;
70221 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->min_val);
70222 if (e) {
70223 log_packet_detailed("'min_val' field error detected");
70224 }
70225#ifdef FREECIV_JSON_CONNECTION
70226 field_addr.name = "max_val";
70227#endif /* FREECIV_JSON_CONNECTION */
70228 e = 0;
70229 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->max_val);
70230 if (e) {
70231 log_packet_detailed("'max_val' field error detected");
70232 }
70233
70234#endif
70235 SEND_PACKET_END(PACKET_SERVER_SETTING_INT);
70236}
70237
70238 int send_packet_server_setting_int(struct connection *pc, const struct packet_server_setting_int *packet)
70239{
70240 if (!pc->used) {
70241 log_error("WARNING: trying to send data to the closed connection %s",
70242 conn_description(pc));
70243 return -1;
70244 }
70245 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_INT].packet != NULL, -1,
70246 "Handler for PACKET_SERVER_SETTING_INT not installed");
70247 return pc->phs.handlers->send[PACKET_SERVER_SETTING_INT].packet(pc, packet);
70248}
70249
70250#ifdef FREECIV_DELTA_PROTOCOL
70251static genhash_val_t hash_packet_server_setting_str_100(const void *vkey)
70252{
70253 const struct packet_server_setting_str *key = (const struct packet_server_setting_str *) vkey;
70254 genhash_val_t result = 0;
70255
70256 result += key->id;
70257
70258 result &= 0xFFFFFFFF;
70259 return result;
70260}
70261
70262static bool cmp_packet_server_setting_str_100(const void *vkey1, const void *vkey2)
70263{
70264 const struct packet_server_setting_str *old = (const struct packet_server_setting_str *) vkey1;
70265 const struct packet_server_setting_str *real_packet = (const struct packet_server_setting_str *) vkey2;
70266 bool differ;
70267
70268 differ = (old->id != real_packet->id);
70269
70270 return !differ;
70271}
70272 BV_DEFINE(packet_server_setting_str_100_fields, 6);
70273#endif /* FREECIV_DELTA_PROTOCOL */
70274
70275 static struct packet_server_setting_str *receive_packet_server_setting_str_100(struct connection *pc)
70276{
70277#ifdef FREECIV_DELTA_PROTOCOL
70278 packet_server_setting_str_100_fields fields;
70279 struct packet_server_setting_str *old;
70280 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_STR;
70281#endif /* FREECIV_DELTA_PROTOCOL */
70282 RECEIVE_PACKET_START(packet_server_setting_str, real_packet);
70283#ifdef FREECIV_JSON_CONNECTION
70284 struct plocation field_addr;
70285 {
70286 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70287 field_addr = *field_addr_tmp;
70288 FC_FREE(field_addr_tmp);
70289 }
70290#endif /* FREECIV_JSON_CONNECTION */
70291
70292#ifdef FREECIV_DELTA_PROTOCOL
70293#ifdef FREECIV_JSON_CONNECTION
70294 field_addr.name = "fields";
70295#endif /* FREECIV_JSON_CONNECTION */
70296 DIO_BV_GET(&din, &field_addr, fields);
70297#ifdef FREECIV_JSON_CONNECTION
70298 field_addr.name = "id";
70299#endif /* FREECIV_JSON_CONNECTION */
70300 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
70301 RECEIVE_PACKET_FIELD_ERROR(id);
70302 }
70303
70304#else /* FREECIV_DELTA_PROTOCOL */
70305#ifdef FREECIV_JSON_CONNECTION
70306 field_addr.name = "id";
70307#endif /* FREECIV_JSON_CONNECTION */
70308 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
70309 RECEIVE_PACKET_FIELD_ERROR(id);
70310 }
70311#ifdef FREECIV_JSON_CONNECTION
70312 field_addr.name = "is_visible";
70313#endif /* FREECIV_JSON_CONNECTION */
70314 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
70315 RECEIVE_PACKET_FIELD_ERROR(is_visible);
70316 }
70317#ifdef FREECIV_JSON_CONNECTION
70318 field_addr.name = "is_changeable";
70319#endif /* FREECIV_JSON_CONNECTION */
70320 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
70321 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
70322 }
70323#ifdef FREECIV_JSON_CONNECTION
70324 field_addr.name = "initial_setting";
70325#endif /* FREECIV_JSON_CONNECTION */
70326 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
70327 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
70328 }
70329#ifdef FREECIV_JSON_CONNECTION
70330 field_addr.name = "setdef";
70331#endif /* FREECIV_JSON_CONNECTION */
70332 {
70333 int readin;
70334
70335 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70336 RECEIVE_PACKET_FIELD_ERROR(setdef);
70337 }
70338 real_packet->setdef = readin;
70339 }
70340#ifdef FREECIV_JSON_CONNECTION
70341 field_addr.name = "val";
70342#endif /* FREECIV_JSON_CONNECTION */
70343 if (!DIO_GET(string, &din, &field_addr, real_packet->val, sizeof(real_packet->val))) {
70344 RECEIVE_PACKET_FIELD_ERROR(val);
70345 }
70346#ifdef FREECIV_JSON_CONNECTION
70347 field_addr.name = "default_val";
70348#endif /* FREECIV_JSON_CONNECTION */
70349 if (!DIO_GET(string, &din, &field_addr, real_packet->default_val, sizeof(real_packet->default_val))) {
70350 RECEIVE_PACKET_FIELD_ERROR(default_val);
70351 }
70352#endif
70353 log_packet_detailed("packet_server_setting_str_100: got info about (%d)",
70354 real_packet->id);
70355
70356#ifdef FREECIV_DELTA_PROTOCOL
70357 if (NULL == *hash) {
70358 *hash = genhash_new_full(hash_packet_server_setting_str_100, cmp_packet_server_setting_str_100,
70359 NULL, NULL, NULL, free);
70360 }
70361
70362 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
70363 *real_packet = *old;
70364 } else {
70365 int id;
70366
70367 id = real_packet->id;
70368
70369 log_packet_detailed(" no old info");
70370 memset(real_packet, 0, sizeof(*real_packet));
70371
70372 real_packet->id = id;
70373 }
70374
70375 real_packet->is_visible = BV_ISSET(fields, 0);
70376 real_packet->is_changeable = BV_ISSET(fields, 1);
70377 real_packet->initial_setting = BV_ISSET(fields, 2);
70378 if (BV_ISSET(fields, 3)) {
70379 log_packet_detailed(" got field 'setdef'");
70380#ifdef FREECIV_JSON_CONNECTION
70381 field_addr.name = "setdef";
70382#endif /* FREECIV_JSON_CONNECTION */
70383 {
70384 int readin;
70385
70386 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70387 RECEIVE_PACKET_FIELD_ERROR(setdef);
70388 }
70389 real_packet->setdef = readin;
70390 }
70391 }
70392 if (BV_ISSET(fields, 4)) {
70393 log_packet_detailed(" got field 'val'");
70394#ifdef FREECIV_JSON_CONNECTION
70395 field_addr.name = "val";
70396#endif /* FREECIV_JSON_CONNECTION */
70397 if (!DIO_GET(string, &din, &field_addr, real_packet->val, sizeof(real_packet->val))) {
70398 RECEIVE_PACKET_FIELD_ERROR(val);
70399 }
70400 }
70401 if (BV_ISSET(fields, 5)) {
70402 log_packet_detailed(" got field 'default_val'");
70403#ifdef FREECIV_JSON_CONNECTION
70404 field_addr.name = "default_val";
70405#endif /* FREECIV_JSON_CONNECTION */
70406 if (!DIO_GET(string, &din, &field_addr, real_packet->default_val, sizeof(real_packet->default_val))) {
70407 RECEIVE_PACKET_FIELD_ERROR(default_val);
70408 }
70409 }
70410
70411 if (NULL == old) {
70412 old = fc_malloc(sizeof(*old));
70413 *old = *real_packet;
70414 genhash_insert(*hash, old, old);
70415 } else {
70416 *old = *real_packet;
70417 }
70418
70419#endif /* FREECIV_DELTA_PROTOCOL */
70420 RECEIVE_PACKET_END(real_packet);
70421}
70422
70423 static int send_packet_server_setting_str_100(struct connection *pc, const struct packet_server_setting_str *packet)
70424{
70425 const struct packet_server_setting_str *real_packet = packet;
70426 int e;
70427#ifdef FREECIV_DELTA_PROTOCOL
70428 packet_server_setting_str_100_fields fields;
70429 struct packet_server_setting_str *old;
70430 bool differ;
70431 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_STR;
70432 int different = 0;
70433#endif /* FREECIV_DELTA_PROTOCOL */
70434 SEND_PACKET_START(PACKET_SERVER_SETTING_STR);
70435#ifdef FREECIV_JSON_CONNECTION
70436 struct plocation field_addr;
70437 {
70438 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70439 field_addr = *field_addr_tmp;
70440 FC_FREE(field_addr_tmp);
70441 }
70442#endif /* FREECIV_JSON_CONNECTION */
70443
70444 log_packet_detailed("packet_server_setting_str_100: sending info about (%d)",
70445 real_packet->id);
70446
70447#ifdef FREECIV_DELTA_PROTOCOL
70448 if (NULL == *hash) {
70449 *hash = genhash_new_full(hash_packet_server_setting_str_100, cmp_packet_server_setting_str_100,
70450 NULL, NULL, NULL, free);
70451 }
70452 BV_CLR_ALL(fields);
70453
70454 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
70455 old = fc_malloc(sizeof(*old));
70456 *old = *real_packet;
70457 genhash_insert(*hash, old, old);
70458 memset(old, 0, sizeof(*old));
70459 different = 1; /* Force to send. */
70460 }
70461 differ = (old->is_visible != real_packet->is_visible);
70462 if (differ) {
70463 different++;
70464 }
70465 if (packet->is_visible) {
70466 BV_SET(fields, 0);
70467 }
70468
70469 differ = (old->is_changeable != real_packet->is_changeable);
70470 if (differ) {
70471 different++;
70472 }
70473 if (packet->is_changeable) {
70474 BV_SET(fields, 1);
70475 }
70476
70477 differ = (old->initial_setting != real_packet->initial_setting);
70478 if (differ) {
70479 different++;
70480 }
70481 if (packet->initial_setting) {
70482 BV_SET(fields, 2);
70483 }
70484
70485 differ = (old->setdef != real_packet->setdef);
70486 if (differ) {
70487 different++;
70488 BV_SET(fields, 3);
70489 }
70490
70491 differ = (strcmp(old->val, real_packet->val) != 0);
70492 if (differ) {
70493 different++;
70494 BV_SET(fields, 4);
70495 }
70496
70497 differ = (strcmp(old->default_val, real_packet->default_val) != 0);
70498 if (differ) {
70499 different++;
70500 BV_SET(fields, 5);
70501 }
70502
70503 if (different == 0) {
70504 log_packet_detailed(" no change -> discard");
70505 return 0;
70506 }
70507
70508#ifdef FREECIV_JSON_CONNECTION
70509 field_addr.name = "fields";
70510#endif /* FREECIV_JSON_CONNECTION */
70511 e = 0;
70512 e |= DIO_BV_PUT(&dout, &field_addr, fields);
70513 if (e) {
70514 log_packet_detailed("fields bitvector error detected");
70515 }
70516#ifdef FREECIV_JSON_CONNECTION
70517 field_addr.name = "id";
70518#endif /* FREECIV_JSON_CONNECTION */
70519 e = 0;
70520 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
70521 if (e) {
70522 log_packet_detailed("'id' field error detected");
70523 }
70524
70525 /* field 0 is folded into the header */
70526 /* field 1 is folded into the header */
70527 /* field 2 is folded into the header */
70528 if (BV_ISSET(fields, 3)) {
70529 log_packet_detailed(" field 'setdef' has changed");
70530#ifdef FREECIV_JSON_CONNECTION
70531 field_addr.name = "setdef";
70532#endif /* FREECIV_JSON_CONNECTION */
70533 e = 0;
70534 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
70535 if (e) {
70536 log_packet_detailed("'setdef' field error detected");
70537 }
70538 }
70539 if (BV_ISSET(fields, 4)) {
70540 log_packet_detailed(" field 'val' has changed");
70541#ifdef FREECIV_JSON_CONNECTION
70542 field_addr.name = "val";
70543#endif /* FREECIV_JSON_CONNECTION */
70544 e = 0;
70545 e |= DIO_PUT(string, &dout, &field_addr, real_packet->val);
70546 if (e) {
70547 log_packet_detailed("'val' field error detected");
70548 }
70549 }
70550 if (BV_ISSET(fields, 5)) {
70551 log_packet_detailed(" field 'default_val' has changed");
70552#ifdef FREECIV_JSON_CONNECTION
70553 field_addr.name = "default_val";
70554#endif /* FREECIV_JSON_CONNECTION */
70555 e = 0;
70556 e |= DIO_PUT(string, &dout, &field_addr, real_packet->default_val);
70557 if (e) {
70558 log_packet_detailed("'default_val' field error detected");
70559 }
70560 }
70561
70562 *old = *real_packet;
70563#endif /* FREECIV_DELTA_PROTOCOL */
70564#ifndef FREECIV_DELTA_PROTOCOL
70565#ifdef FREECIV_JSON_CONNECTION
70566 field_addr.name = "id";
70567#endif /* FREECIV_JSON_CONNECTION */
70568 e = 0;
70569 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
70570 if (e) {
70571 log_packet_detailed("'id' field error detected");
70572 }
70573#ifdef FREECIV_JSON_CONNECTION
70574 field_addr.name = "is_visible";
70575#endif /* FREECIV_JSON_CONNECTION */
70576 e = 0;
70577 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
70578 if (e) {
70579 log_packet_detailed("'is_visible' field error detected");
70580 }
70581#ifdef FREECIV_JSON_CONNECTION
70582 field_addr.name = "is_changeable";
70583#endif /* FREECIV_JSON_CONNECTION */
70584 e = 0;
70585 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
70586 if (e) {
70587 log_packet_detailed("'is_changeable' field error detected");
70588 }
70589#ifdef FREECIV_JSON_CONNECTION
70590 field_addr.name = "initial_setting";
70591#endif /* FREECIV_JSON_CONNECTION */
70592 e = 0;
70593 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
70594 if (e) {
70595 log_packet_detailed("'initial_setting' field error detected");
70596 }
70597#ifdef FREECIV_JSON_CONNECTION
70598 field_addr.name = "setdef";
70599#endif /* FREECIV_JSON_CONNECTION */
70600 e = 0;
70601 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
70602 if (e) {
70603 log_packet_detailed("'setdef' field error detected");
70604 }
70605#ifdef FREECIV_JSON_CONNECTION
70606 field_addr.name = "val";
70607#endif /* FREECIV_JSON_CONNECTION */
70608 e = 0;
70609 e |= DIO_PUT(string, &dout, &field_addr, real_packet->val);
70610 if (e) {
70611 log_packet_detailed("'val' field error detected");
70612 }
70613#ifdef FREECIV_JSON_CONNECTION
70614 field_addr.name = "default_val";
70615#endif /* FREECIV_JSON_CONNECTION */
70616 e = 0;
70617 e |= DIO_PUT(string, &dout, &field_addr, real_packet->default_val);
70618 if (e) {
70619 log_packet_detailed("'default_val' field error detected");
70620 }
70621
70622#endif
70623 SEND_PACKET_END(PACKET_SERVER_SETTING_STR);
70624}
70625
70626 int send_packet_server_setting_str(struct connection *pc, const struct packet_server_setting_str *packet)
70627{
70628 if (!pc->used) {
70629 log_error("WARNING: trying to send data to the closed connection %s",
70630 conn_description(pc));
70631 return -1;
70632 }
70633 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_STR].packet != NULL, -1,
70634 "Handler for PACKET_SERVER_SETTING_STR not installed");
70635 return pc->phs.handlers->send[PACKET_SERVER_SETTING_STR].packet(pc, packet);
70636}
70637
70638#ifdef FREECIV_DELTA_PROTOCOL
70639static genhash_val_t hash_packet_server_setting_enum_100(const void *vkey)
70640{
70641 const struct packet_server_setting_enum *key = (const struct packet_server_setting_enum *) vkey;
70642 genhash_val_t result = 0;
70643
70644 result += key->id;
70645
70646 result &= 0xFFFFFFFF;
70647 return result;
70648}
70649
70650static bool cmp_packet_server_setting_enum_100(const void *vkey1, const void *vkey2)
70651{
70652 const struct packet_server_setting_enum *old = (const struct packet_server_setting_enum *) vkey1;
70653 const struct packet_server_setting_enum *real_packet = (const struct packet_server_setting_enum *) vkey2;
70654 bool differ;
70655
70656 differ = (old->id != real_packet->id);
70657
70658 return !differ;
70659}
70660 BV_DEFINE(packet_server_setting_enum_100_fields, 9);
70661#endif /* FREECIV_DELTA_PROTOCOL */
70662
70663 static struct packet_server_setting_enum *receive_packet_server_setting_enum_100(struct connection *pc)
70664{
70665#ifdef FREECIV_DELTA_PROTOCOL
70666 packet_server_setting_enum_100_fields fields;
70667 struct packet_server_setting_enum *old;
70668 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_ENUM;
70669#endif /* FREECIV_DELTA_PROTOCOL */
70670 RECEIVE_PACKET_START(packet_server_setting_enum, real_packet);
70671#ifdef FREECIV_JSON_CONNECTION
70672 struct plocation field_addr;
70673 {
70674 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70675 field_addr = *field_addr_tmp;
70676 FC_FREE(field_addr_tmp);
70677 }
70678#endif /* FREECIV_JSON_CONNECTION */
70679
70680#ifdef FREECIV_DELTA_PROTOCOL
70681#ifdef FREECIV_JSON_CONNECTION
70682 field_addr.name = "fields";
70683#endif /* FREECIV_JSON_CONNECTION */
70684 DIO_BV_GET(&din, &field_addr, fields);
70685#ifdef FREECIV_JSON_CONNECTION
70686 field_addr.name = "id";
70687#endif /* FREECIV_JSON_CONNECTION */
70688 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
70689 RECEIVE_PACKET_FIELD_ERROR(id);
70690 }
70691
70692#else /* FREECIV_DELTA_PROTOCOL */
70693#ifdef FREECIV_JSON_CONNECTION
70694 field_addr.name = "id";
70695#endif /* FREECIV_JSON_CONNECTION */
70696 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
70697 RECEIVE_PACKET_FIELD_ERROR(id);
70698 }
70699#ifdef FREECIV_JSON_CONNECTION
70700 field_addr.name = "is_visible";
70701#endif /* FREECIV_JSON_CONNECTION */
70702 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
70703 RECEIVE_PACKET_FIELD_ERROR(is_visible);
70704 }
70705#ifdef FREECIV_JSON_CONNECTION
70706 field_addr.name = "is_changeable";
70707#endif /* FREECIV_JSON_CONNECTION */
70708 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
70709 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
70710 }
70711#ifdef FREECIV_JSON_CONNECTION
70712 field_addr.name = "initial_setting";
70713#endif /* FREECIV_JSON_CONNECTION */
70714 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
70715 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
70716 }
70717#ifdef FREECIV_JSON_CONNECTION
70718 field_addr.name = "setdef";
70719#endif /* FREECIV_JSON_CONNECTION */
70720 {
70721 int readin;
70722
70723 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70724 RECEIVE_PACKET_FIELD_ERROR(setdef);
70725 }
70726 real_packet->setdef = readin;
70727 }
70728#ifdef FREECIV_JSON_CONNECTION
70729 field_addr.name = "val";
70730#endif /* FREECIV_JSON_CONNECTION */
70731 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->val)) {
70732 RECEIVE_PACKET_FIELD_ERROR(val);
70733 }
70734#ifdef FREECIV_JSON_CONNECTION
70735 field_addr.name = "default_val";
70736#endif /* FREECIV_JSON_CONNECTION */
70737 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->default_val)) {
70738 RECEIVE_PACKET_FIELD_ERROR(default_val);
70739 }
70740#ifdef FREECIV_JSON_CONNECTION
70741 field_addr.name = "values_num";
70742#endif /* FREECIV_JSON_CONNECTION */
70743 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->values_num)) {
70744 RECEIVE_PACKET_FIELD_ERROR(values_num);
70745 }
70746#ifdef FREECIV_JSON_CONNECTION
70747 field_addr.name = "support_names";
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->values_num > 64) {
70758 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
70759 }
70760 for (i = 0; i < real_packet->values_num; i++) {
70761#ifdef FREECIV_JSON_CONNECTION
70762 field_addr.sub_location->number = i;
70763#endif /* FREECIV_JSON_CONNECTION */
70764 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
70765 RECEIVE_PACKET_FIELD_ERROR(support_names);
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#ifdef FREECIV_JSON_CONNECTION
70775 field_addr.name = "pretty_names";
70776#endif /* FREECIV_JSON_CONNECTION */
70777 {
70778 int i;
70779
70780#ifdef FREECIV_JSON_CONNECTION
70781 /* Enter array. */
70782 field_addr.sub_location = plocation_elem_new(0);
70783#endif /* FREECIV_JSON_CONNECTION */
70784
70785 if (real_packet->values_num > 64) {
70786 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
70787 }
70788 for (i = 0; i < real_packet->values_num; i++) {
70789#ifdef FREECIV_JSON_CONNECTION
70790 field_addr.sub_location->number = i;
70791#endif /* FREECIV_JSON_CONNECTION */
70792 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
70793 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
70794 }
70795 }
70796
70797#ifdef FREECIV_JSON_CONNECTION
70798 /* Exit array. */
70799 FC_FREE(field_addr.sub_location);
70800#endif /* FREECIV_JSON_CONNECTION */
70801 }
70802#endif
70803 log_packet_detailed("packet_server_setting_enum_100: got info about (%d)",
70804 real_packet->id);
70805
70806#ifdef FREECIV_DELTA_PROTOCOL
70807 if (NULL == *hash) {
70808 *hash = genhash_new_full(hash_packet_server_setting_enum_100, cmp_packet_server_setting_enum_100,
70809 NULL, NULL, NULL, free);
70810 }
70811
70812 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
70813 *real_packet = *old;
70814 } else {
70815 int id;
70816
70817 id = real_packet->id;
70818
70819 log_packet_detailed(" no old info");
70820 memset(real_packet, 0, sizeof(*real_packet));
70821
70822 real_packet->id = id;
70823 }
70824
70825 real_packet->is_visible = BV_ISSET(fields, 0);
70826 real_packet->is_changeable = BV_ISSET(fields, 1);
70827 real_packet->initial_setting = BV_ISSET(fields, 2);
70828 if (BV_ISSET(fields, 3)) {
70829 log_packet_detailed(" got field 'setdef'");
70830#ifdef FREECIV_JSON_CONNECTION
70831 field_addr.name = "setdef";
70832#endif /* FREECIV_JSON_CONNECTION */
70833 {
70834 int readin;
70835
70836 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
70837 RECEIVE_PACKET_FIELD_ERROR(setdef);
70838 }
70839 real_packet->setdef = readin;
70840 }
70841 }
70842 if (BV_ISSET(fields, 4)) {
70843 log_packet_detailed(" got field 'val'");
70844#ifdef FREECIV_JSON_CONNECTION
70845 field_addr.name = "val";
70846#endif /* FREECIV_JSON_CONNECTION */
70847 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->val)) {
70848 RECEIVE_PACKET_FIELD_ERROR(val);
70849 }
70850 }
70851 if (BV_ISSET(fields, 5)) {
70852 log_packet_detailed(" got field 'default_val'");
70853#ifdef FREECIV_JSON_CONNECTION
70854 field_addr.name = "default_val";
70855#endif /* FREECIV_JSON_CONNECTION */
70856 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->default_val)) {
70857 RECEIVE_PACKET_FIELD_ERROR(default_val);
70858 }
70859 }
70860 if (BV_ISSET(fields, 6)) {
70861 log_packet_detailed(" got field 'values_num'");
70862#ifdef FREECIV_JSON_CONNECTION
70863 field_addr.name = "values_num";
70864#endif /* FREECIV_JSON_CONNECTION */
70865 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->values_num)) {
70866 RECEIVE_PACKET_FIELD_ERROR(values_num);
70867 }
70868 }
70869 if (BV_ISSET(fields, 7)) {
70870 log_packet_detailed(" got field 'support_names'");
70871#ifdef FREECIV_JSON_CONNECTION
70872 field_addr.name = "support_names";
70873#endif /* FREECIV_JSON_CONNECTION */
70874 {
70875 int i;
70876
70877#ifdef FREECIV_JSON_CONNECTION
70878 /* Enter array. */
70879 field_addr.sub_location = plocation_elem_new(0);
70880#endif /* FREECIV_JSON_CONNECTION */
70881
70882 if (real_packet->values_num > 64) {
70883 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
70884 }
70885 for (i = 0; i < real_packet->values_num; i++) {
70886#ifdef FREECIV_JSON_CONNECTION
70887 field_addr.sub_location->number = i;
70888#endif /* FREECIV_JSON_CONNECTION */
70889 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
70890 RECEIVE_PACKET_FIELD_ERROR(support_names);
70891 }
70892 }
70893
70894#ifdef FREECIV_JSON_CONNECTION
70895 /* Exit array. */
70896 FC_FREE(field_addr.sub_location);
70897#endif /* FREECIV_JSON_CONNECTION */
70898 }
70899 }
70900 if (BV_ISSET(fields, 8)) {
70901 log_packet_detailed(" got field 'pretty_names'");
70902#ifdef FREECIV_JSON_CONNECTION
70903 field_addr.name = "pretty_names";
70904#endif /* FREECIV_JSON_CONNECTION */
70905 {
70906 int i;
70907
70908#ifdef FREECIV_JSON_CONNECTION
70909 /* Enter array. */
70910 field_addr.sub_location = plocation_elem_new(0);
70911#endif /* FREECIV_JSON_CONNECTION */
70912
70913 if (real_packet->values_num > 64) {
70914 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
70915 }
70916 for (i = 0; i < real_packet->values_num; i++) {
70917#ifdef FREECIV_JSON_CONNECTION
70918 field_addr.sub_location->number = i;
70919#endif /* FREECIV_JSON_CONNECTION */
70920 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
70921 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
70922 }
70923 }
70924
70925#ifdef FREECIV_JSON_CONNECTION
70926 /* Exit array. */
70927 FC_FREE(field_addr.sub_location);
70928#endif /* FREECIV_JSON_CONNECTION */
70929 }
70930 }
70931
70932 if (NULL == old) {
70933 old = fc_malloc(sizeof(*old));
70934 *old = *real_packet;
70935 genhash_insert(*hash, old, old);
70936 } else {
70937 *old = *real_packet;
70938 }
70939
70940#endif /* FREECIV_DELTA_PROTOCOL */
70941 RECEIVE_PACKET_END(real_packet);
70942}
70943
70944 static int send_packet_server_setting_enum_100(struct connection *pc, const struct packet_server_setting_enum *packet)
70945{
70946 const struct packet_server_setting_enum *real_packet = packet;
70947 int e;
70948#ifdef FREECIV_DELTA_PROTOCOL
70949 packet_server_setting_enum_100_fields fields;
70950 struct packet_server_setting_enum *old;
70951 bool differ;
70952 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_ENUM;
70953 int different = 0;
70954#endif /* FREECIV_DELTA_PROTOCOL */
70955 SEND_PACKET_START(PACKET_SERVER_SETTING_ENUM);
70956#ifdef FREECIV_JSON_CONNECTION
70957 struct plocation field_addr;
70958 {
70959 struct plocation *field_addr_tmp = plocation_field_new(NULL);
70960 field_addr = *field_addr_tmp;
70961 FC_FREE(field_addr_tmp);
70962 }
70963#endif /* FREECIV_JSON_CONNECTION */
70964
70965 log_packet_detailed("packet_server_setting_enum_100: sending info about (%d)",
70966 real_packet->id);
70967
70968#ifdef FREECIV_DELTA_PROTOCOL
70969 if (NULL == *hash) {
70970 *hash = genhash_new_full(hash_packet_server_setting_enum_100, cmp_packet_server_setting_enum_100,
70971 NULL, NULL, NULL, free);
70972 }
70973 BV_CLR_ALL(fields);
70974
70975 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
70976 old = fc_malloc(sizeof(*old));
70977 *old = *real_packet;
70978 genhash_insert(*hash, old, old);
70979 memset(old, 0, sizeof(*old));
70980 different = 1; /* Force to send. */
70981 }
70982 differ = (old->is_visible != real_packet->is_visible);
70983 if (differ) {
70984 different++;
70985 }
70986 if (packet->is_visible) {
70987 BV_SET(fields, 0);
70988 }
70989
70990 differ = (old->is_changeable != real_packet->is_changeable);
70991 if (differ) {
70992 different++;
70993 }
70994 if (packet->is_changeable) {
70995 BV_SET(fields, 1);
70996 }
70997
70998 differ = (old->initial_setting != real_packet->initial_setting);
70999 if (differ) {
71000 different++;
71001 }
71002 if (packet->initial_setting) {
71003 BV_SET(fields, 2);
71004 }
71005
71006 differ = (old->setdef != real_packet->setdef);
71007 if (differ) {
71008 different++;
71009 BV_SET(fields, 3);
71010 }
71011
71012 differ = (old->val != real_packet->val);
71013 if (differ) {
71014 different++;
71015 BV_SET(fields, 4);
71016 }
71017
71018 differ = (old->default_val != real_packet->default_val);
71019 if (differ) {
71020 different++;
71021 BV_SET(fields, 5);
71022 }
71023
71024 differ = (old->values_num != real_packet->values_num);
71025 if (differ) {
71026 different++;
71027 BV_SET(fields, 6);
71028 }
71029
71030 differ = (old->values_num != real_packet->values_num);
71031 if (!differ) {
71032 int i;
71033
71034 for (i = 0; i < real_packet->values_num; i++) {
71035 differ = (strcmp(old->support_names[i], real_packet->support_names[i]) != 0);
71036 if (differ) {
71037 break;
71038 }
71039 }
71040 }
71041 if (differ) {
71042 different++;
71043 BV_SET(fields, 7);
71044 }
71045
71046 differ = (old->values_num != real_packet->values_num);
71047 if (!differ) {
71048 int i;
71049
71050 for (i = 0; i < real_packet->values_num; i++) {
71051 differ = (strcmp(old->pretty_names[i], real_packet->pretty_names[i]) != 0);
71052 if (differ) {
71053 break;
71054 }
71055 }
71056 }
71057 if (differ) {
71058 different++;
71059 BV_SET(fields, 8);
71060 }
71061
71062 if (different == 0) {
71063 log_packet_detailed(" no change -> discard");
71064 return 0;
71065 }
71066
71067#ifdef FREECIV_JSON_CONNECTION
71068 field_addr.name = "fields";
71069#endif /* FREECIV_JSON_CONNECTION */
71070 e = 0;
71071 e |= DIO_BV_PUT(&dout, &field_addr, fields);
71072 if (e) {
71073 log_packet_detailed("fields bitvector error detected");
71074 }
71075#ifdef FREECIV_JSON_CONNECTION
71076 field_addr.name = "id";
71077#endif /* FREECIV_JSON_CONNECTION */
71078 e = 0;
71079 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
71080 if (e) {
71081 log_packet_detailed("'id' field error detected");
71082 }
71083
71084 /* field 0 is folded into the header */
71085 /* field 1 is folded into the header */
71086 /* field 2 is folded into the header */
71087 if (BV_ISSET(fields, 3)) {
71088 log_packet_detailed(" field 'setdef' has changed");
71089#ifdef FREECIV_JSON_CONNECTION
71090 field_addr.name = "setdef";
71091#endif /* FREECIV_JSON_CONNECTION */
71092 e = 0;
71093 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
71094 if (e) {
71095 log_packet_detailed("'setdef' field error detected");
71096 }
71097 }
71098 if (BV_ISSET(fields, 4)) {
71099 log_packet_detailed(" field 'val' has changed");
71100#ifdef FREECIV_JSON_CONNECTION
71101 field_addr.name = "val";
71102#endif /* FREECIV_JSON_CONNECTION */
71103 e = 0;
71104 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->val);
71105 if (e) {
71106 log_packet_detailed("'val' field error detected");
71107 }
71108 }
71109 if (BV_ISSET(fields, 5)) {
71110 log_packet_detailed(" field 'default_val' has changed");
71111#ifdef FREECIV_JSON_CONNECTION
71112 field_addr.name = "default_val";
71113#endif /* FREECIV_JSON_CONNECTION */
71114 e = 0;
71115 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_val);
71116 if (e) {
71117 log_packet_detailed("'default_val' field error detected");
71118 }
71119 }
71120 if (BV_ISSET(fields, 6)) {
71121 log_packet_detailed(" field 'values_num' has changed");
71122#ifdef FREECIV_JSON_CONNECTION
71123 field_addr.name = "values_num";
71124#endif /* FREECIV_JSON_CONNECTION */
71125 e = 0;
71126 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->values_num);
71127 if (e) {
71128 log_packet_detailed("'values_num' field error detected");
71129 }
71130 }
71131 if (BV_ISSET(fields, 7)) {
71132 log_packet_detailed(" field 'support_names' has changed");
71133#ifdef FREECIV_JSON_CONNECTION
71134 field_addr.name = "support_names";
71135#endif /* FREECIV_JSON_CONNECTION */
71136 e = 0;
71137 {
71138 int i;
71139
71140#ifdef FREECIV_JSON_CONNECTION
71141 /* Create the array. */
71142 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
71143
71144 /* Enter the array. */
71145 field_addr.sub_location = plocation_elem_new(0);
71146#endif /* FREECIV_JSON_CONNECTION */
71147
71148 for (i = 0; i < real_packet->values_num; i++) {
71149#ifdef FREECIV_JSON_CONNECTION
71150 /* Next array element. */
71151 field_addr.sub_location->number = i;
71152#endif /* FREECIV_JSON_CONNECTION */
71153 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
71154 }
71155
71156#ifdef FREECIV_JSON_CONNECTION
71157 /* Exit array. */
71158 FC_FREE(field_addr.sub_location);
71159#endif /* FREECIV_JSON_CONNECTION */
71160 }
71161 if (e) {
71162 log_packet_detailed("'support_names' field error detected");
71163 }
71164 }
71165 if (BV_ISSET(fields, 8)) {
71166 log_packet_detailed(" field 'pretty_names' has changed");
71167#ifdef FREECIV_JSON_CONNECTION
71168 field_addr.name = "pretty_names";
71169#endif /* FREECIV_JSON_CONNECTION */
71170 e = 0;
71171 {
71172 int i;
71173
71174#ifdef FREECIV_JSON_CONNECTION
71175 /* Create the array. */
71176 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
71177
71178 /* Enter the array. */
71179 field_addr.sub_location = plocation_elem_new(0);
71180#endif /* FREECIV_JSON_CONNECTION */
71181
71182 for (i = 0; i < real_packet->values_num; i++) {
71183#ifdef FREECIV_JSON_CONNECTION
71184 /* Next array element. */
71185 field_addr.sub_location->number = i;
71186#endif /* FREECIV_JSON_CONNECTION */
71187 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
71188 }
71189
71190#ifdef FREECIV_JSON_CONNECTION
71191 /* Exit array. */
71192 FC_FREE(field_addr.sub_location);
71193#endif /* FREECIV_JSON_CONNECTION */
71194 }
71195 if (e) {
71196 log_packet_detailed("'pretty_names' field error detected");
71197 }
71198 }
71199
71200 *old = *real_packet;
71201#endif /* FREECIV_DELTA_PROTOCOL */
71202#ifndef FREECIV_DELTA_PROTOCOL
71203#ifdef FREECIV_JSON_CONNECTION
71204 field_addr.name = "id";
71205#endif /* FREECIV_JSON_CONNECTION */
71206 e = 0;
71207 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
71208 if (e) {
71209 log_packet_detailed("'id' field error detected");
71210 }
71211#ifdef FREECIV_JSON_CONNECTION
71212 field_addr.name = "is_visible";
71213#endif /* FREECIV_JSON_CONNECTION */
71214 e = 0;
71215 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
71216 if (e) {
71217 log_packet_detailed("'is_visible' field error detected");
71218 }
71219#ifdef FREECIV_JSON_CONNECTION
71220 field_addr.name = "is_changeable";
71221#endif /* FREECIV_JSON_CONNECTION */
71222 e = 0;
71223 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
71224 if (e) {
71225 log_packet_detailed("'is_changeable' field error detected");
71226 }
71227#ifdef FREECIV_JSON_CONNECTION
71228 field_addr.name = "initial_setting";
71229#endif /* FREECIV_JSON_CONNECTION */
71230 e = 0;
71231 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
71232 if (e) {
71233 log_packet_detailed("'initial_setting' field error detected");
71234 }
71235#ifdef FREECIV_JSON_CONNECTION
71236 field_addr.name = "setdef";
71237#endif /* FREECIV_JSON_CONNECTION */
71238 e = 0;
71239 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
71240 if (e) {
71241 log_packet_detailed("'setdef' field error detected");
71242 }
71243#ifdef FREECIV_JSON_CONNECTION
71244 field_addr.name = "val";
71245#endif /* FREECIV_JSON_CONNECTION */
71246 e = 0;
71247 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->val);
71248 if (e) {
71249 log_packet_detailed("'val' field error detected");
71250 }
71251#ifdef FREECIV_JSON_CONNECTION
71252 field_addr.name = "default_val";
71253#endif /* FREECIV_JSON_CONNECTION */
71254 e = 0;
71255 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->default_val);
71256 if (e) {
71257 log_packet_detailed("'default_val' field error detected");
71258 }
71259#ifdef FREECIV_JSON_CONNECTION
71260 field_addr.name = "values_num";
71261#endif /* FREECIV_JSON_CONNECTION */
71262 e = 0;
71263 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->values_num);
71264 if (e) {
71265 log_packet_detailed("'values_num' field error detected");
71266 }
71267#ifdef FREECIV_JSON_CONNECTION
71268 field_addr.name = "support_names";
71269#endif /* FREECIV_JSON_CONNECTION */
71270 e = 0;
71271 {
71272 int i;
71273
71274#ifdef FREECIV_JSON_CONNECTION
71275 /* Create the array. */
71276 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
71277
71278 /* Enter the array. */
71279 field_addr.sub_location = plocation_elem_new(0);
71280#endif /* FREECIV_JSON_CONNECTION */
71281
71282 for (i = 0; i < real_packet->values_num; i++) {
71283#ifdef FREECIV_JSON_CONNECTION
71284 /* Next array element. */
71285 field_addr.sub_location->number = i;
71286#endif /* FREECIV_JSON_CONNECTION */
71287 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
71288 }
71289
71290#ifdef FREECIV_JSON_CONNECTION
71291 /* Exit array. */
71292 FC_FREE(field_addr.sub_location);
71293#endif /* FREECIV_JSON_CONNECTION */
71294 }
71295 if (e) {
71296 log_packet_detailed("'support_names' field error detected");
71297 }
71298#ifdef FREECIV_JSON_CONNECTION
71299 field_addr.name = "pretty_names";
71300#endif /* FREECIV_JSON_CONNECTION */
71301 e = 0;
71302 {
71303 int i;
71304
71305#ifdef FREECIV_JSON_CONNECTION
71306 /* Create the array. */
71307 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->values_num);
71308
71309 /* Enter the array. */
71310 field_addr.sub_location = plocation_elem_new(0);
71311#endif /* FREECIV_JSON_CONNECTION */
71312
71313 for (i = 0; i < real_packet->values_num; i++) {
71314#ifdef FREECIV_JSON_CONNECTION
71315 /* Next array element. */
71316 field_addr.sub_location->number = i;
71317#endif /* FREECIV_JSON_CONNECTION */
71318 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
71319 }
71320
71321#ifdef FREECIV_JSON_CONNECTION
71322 /* Exit array. */
71323 FC_FREE(field_addr.sub_location);
71324#endif /* FREECIV_JSON_CONNECTION */
71325 }
71326 if (e) {
71327 log_packet_detailed("'pretty_names' field error detected");
71328 }
71329
71330#endif
71331 SEND_PACKET_END(PACKET_SERVER_SETTING_ENUM);
71332}
71333
71334 int send_packet_server_setting_enum(struct connection *pc, const struct packet_server_setting_enum *packet)
71335{
71336 if (!pc->used) {
71337 log_error("WARNING: trying to send data to the closed connection %s",
71338 conn_description(pc));
71339 return -1;
71340 }
71341 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_ENUM].packet != NULL, -1,
71342 "Handler for PACKET_SERVER_SETTING_ENUM not installed");
71343 return pc->phs.handlers->send[PACKET_SERVER_SETTING_ENUM].packet(pc, packet);
71344}
71345
71346#ifdef FREECIV_DELTA_PROTOCOL
71347static genhash_val_t hash_packet_server_setting_bitwise_100(const void *vkey)
71348{
71349 const struct packet_server_setting_bitwise *key = (const struct packet_server_setting_bitwise *) vkey;
71350 genhash_val_t result = 0;
71351
71352 result += key->id;
71353
71354 result &= 0xFFFFFFFF;
71355 return result;
71356}
71357
71358static bool cmp_packet_server_setting_bitwise_100(const void *vkey1, const void *vkey2)
71359{
71360 const struct packet_server_setting_bitwise *old = (const struct packet_server_setting_bitwise *) vkey1;
71361 const struct packet_server_setting_bitwise *real_packet = (const struct packet_server_setting_bitwise *) vkey2;
71362 bool differ;
71363
71364 differ = (old->id != real_packet->id);
71365
71366 return !differ;
71367}
71368 BV_DEFINE(packet_server_setting_bitwise_100_fields, 9);
71369#endif /* FREECIV_DELTA_PROTOCOL */
71370
71371 static struct packet_server_setting_bitwise *receive_packet_server_setting_bitwise_100(struct connection *pc)
71372{
71373#ifdef FREECIV_DELTA_PROTOCOL
71374 packet_server_setting_bitwise_100_fields fields;
71375 struct packet_server_setting_bitwise *old;
71376 struct genhash **hash = pc->phs.received + PACKET_SERVER_SETTING_BITWISE;
71377#endif /* FREECIV_DELTA_PROTOCOL */
71378 RECEIVE_PACKET_START(packet_server_setting_bitwise, real_packet);
71379#ifdef FREECIV_JSON_CONNECTION
71380 struct plocation field_addr;
71381 {
71382 struct plocation *field_addr_tmp = plocation_field_new(NULL);
71383 field_addr = *field_addr_tmp;
71384 FC_FREE(field_addr_tmp);
71385 }
71386#endif /* FREECIV_JSON_CONNECTION */
71387
71388#ifdef FREECIV_DELTA_PROTOCOL
71389#ifdef FREECIV_JSON_CONNECTION
71390 field_addr.name = "fields";
71391#endif /* FREECIV_JSON_CONNECTION */
71392 DIO_BV_GET(&din, &field_addr, fields);
71393#ifdef FREECIV_JSON_CONNECTION
71394 field_addr.name = "id";
71395#endif /* FREECIV_JSON_CONNECTION */
71396 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
71397 RECEIVE_PACKET_FIELD_ERROR(id);
71398 }
71399
71400#else /* FREECIV_DELTA_PROTOCOL */
71401#ifdef FREECIV_JSON_CONNECTION
71402 field_addr.name = "id";
71403#endif /* FREECIV_JSON_CONNECTION */
71404 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
71405 RECEIVE_PACKET_FIELD_ERROR(id);
71406 }
71407#ifdef FREECIV_JSON_CONNECTION
71408 field_addr.name = "is_visible";
71409#endif /* FREECIV_JSON_CONNECTION */
71410 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_visible)) {
71411 RECEIVE_PACKET_FIELD_ERROR(is_visible);
71412 }
71413#ifdef FREECIV_JSON_CONNECTION
71414 field_addr.name = "is_changeable";
71415#endif /* FREECIV_JSON_CONNECTION */
71416 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_changeable)) {
71417 RECEIVE_PACKET_FIELD_ERROR(is_changeable);
71418 }
71419#ifdef FREECIV_JSON_CONNECTION
71420 field_addr.name = "initial_setting";
71421#endif /* FREECIV_JSON_CONNECTION */
71422 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->initial_setting)) {
71423 RECEIVE_PACKET_FIELD_ERROR(initial_setting);
71424 }
71425#ifdef FREECIV_JSON_CONNECTION
71426 field_addr.name = "setdef";
71427#endif /* FREECIV_JSON_CONNECTION */
71428 {
71429 int readin;
71430
71431 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
71432 RECEIVE_PACKET_FIELD_ERROR(setdef);
71433 }
71434 real_packet->setdef = readin;
71435 }
71436#ifdef FREECIV_JSON_CONNECTION
71437 field_addr.name = "val";
71438#endif /* FREECIV_JSON_CONNECTION */
71439 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->val)) {
71440 RECEIVE_PACKET_FIELD_ERROR(val);
71441 }
71442#ifdef FREECIV_JSON_CONNECTION
71443 field_addr.name = "default_val";
71444#endif /* FREECIV_JSON_CONNECTION */
71445 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->default_val)) {
71446 RECEIVE_PACKET_FIELD_ERROR(default_val);
71447 }
71448#ifdef FREECIV_JSON_CONNECTION
71449 field_addr.name = "bits_num";
71450#endif /* FREECIV_JSON_CONNECTION */
71451 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bits_num)) {
71452 RECEIVE_PACKET_FIELD_ERROR(bits_num);
71453 }
71454#ifdef FREECIV_JSON_CONNECTION
71455 field_addr.name = "support_names";
71456#endif /* FREECIV_JSON_CONNECTION */
71457 {
71458 int i;
71459
71460#ifdef FREECIV_JSON_CONNECTION
71461 /* Enter array. */
71462 field_addr.sub_location = plocation_elem_new(0);
71463#endif /* FREECIV_JSON_CONNECTION */
71464
71465 if (real_packet->bits_num > 64) {
71466 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
71467 }
71468 for (i = 0; i < real_packet->bits_num; i++) {
71469#ifdef FREECIV_JSON_CONNECTION
71470 field_addr.sub_location->number = i;
71471#endif /* FREECIV_JSON_CONNECTION */
71472 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
71473 RECEIVE_PACKET_FIELD_ERROR(support_names);
71474 }
71475 }
71476
71477#ifdef FREECIV_JSON_CONNECTION
71478 /* Exit array. */
71479 FC_FREE(field_addr.sub_location);
71480#endif /* FREECIV_JSON_CONNECTION */
71481 }
71482#ifdef FREECIV_JSON_CONNECTION
71483 field_addr.name = "pretty_names";
71484#endif /* FREECIV_JSON_CONNECTION */
71485 {
71486 int i;
71487
71488#ifdef FREECIV_JSON_CONNECTION
71489 /* Enter array. */
71490 field_addr.sub_location = plocation_elem_new(0);
71491#endif /* FREECIV_JSON_CONNECTION */
71492
71493 if (real_packet->bits_num > 64) {
71494 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
71495 }
71496 for (i = 0; i < real_packet->bits_num; i++) {
71497#ifdef FREECIV_JSON_CONNECTION
71498 field_addr.sub_location->number = i;
71499#endif /* FREECIV_JSON_CONNECTION */
71500 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
71501 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
71502 }
71503 }
71504
71505#ifdef FREECIV_JSON_CONNECTION
71506 /* Exit array. */
71507 FC_FREE(field_addr.sub_location);
71508#endif /* FREECIV_JSON_CONNECTION */
71509 }
71510#endif
71511 log_packet_detailed("packet_server_setting_bitwise_100: got info about (%d)",
71512 real_packet->id);
71513
71514#ifdef FREECIV_DELTA_PROTOCOL
71515 if (NULL == *hash) {
71516 *hash = genhash_new_full(hash_packet_server_setting_bitwise_100, cmp_packet_server_setting_bitwise_100,
71517 NULL, NULL, NULL, free);
71518 }
71519
71520 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
71521 *real_packet = *old;
71522 } else {
71523 int id;
71524
71525 id = real_packet->id;
71526
71527 log_packet_detailed(" no old info");
71528 memset(real_packet, 0, sizeof(*real_packet));
71529
71530 real_packet->id = id;
71531 }
71532
71533 real_packet->is_visible = BV_ISSET(fields, 0);
71534 real_packet->is_changeable = BV_ISSET(fields, 1);
71535 real_packet->initial_setting = BV_ISSET(fields, 2);
71536 if (BV_ISSET(fields, 3)) {
71537 log_packet_detailed(" got field 'setdef'");
71538#ifdef FREECIV_JSON_CONNECTION
71539 field_addr.name = "setdef";
71540#endif /* FREECIV_JSON_CONNECTION */
71541 {
71542 int readin;
71543
71544 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
71545 RECEIVE_PACKET_FIELD_ERROR(setdef);
71546 }
71547 real_packet->setdef = readin;
71548 }
71549 }
71550 if (BV_ISSET(fields, 4)) {
71551 log_packet_detailed(" got field 'val'");
71552#ifdef FREECIV_JSON_CONNECTION
71553 field_addr.name = "val";
71554#endif /* FREECIV_JSON_CONNECTION */
71555 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->val)) {
71556 RECEIVE_PACKET_FIELD_ERROR(val);
71557 }
71558 }
71559 if (BV_ISSET(fields, 5)) {
71560 log_packet_detailed(" got field 'default_val'");
71561#ifdef FREECIV_JSON_CONNECTION
71562 field_addr.name = "default_val";
71563#endif /* FREECIV_JSON_CONNECTION */
71564 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->default_val)) {
71565 RECEIVE_PACKET_FIELD_ERROR(default_val);
71566 }
71567 }
71568 if (BV_ISSET(fields, 6)) {
71569 log_packet_detailed(" got field 'bits_num'");
71570#ifdef FREECIV_JSON_CONNECTION
71571 field_addr.name = "bits_num";
71572#endif /* FREECIV_JSON_CONNECTION */
71573 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->bits_num)) {
71574 RECEIVE_PACKET_FIELD_ERROR(bits_num);
71575 }
71576 }
71577 if (BV_ISSET(fields, 7)) {
71578 log_packet_detailed(" got field 'support_names'");
71579#ifdef FREECIV_JSON_CONNECTION
71580 field_addr.name = "support_names";
71581#endif /* FREECIV_JSON_CONNECTION */
71582 {
71583 int i;
71584
71585#ifdef FREECIV_JSON_CONNECTION
71586 /* Enter array. */
71587 field_addr.sub_location = plocation_elem_new(0);
71588#endif /* FREECIV_JSON_CONNECTION */
71589
71590 if (real_packet->bits_num > 64) {
71591 RECEIVE_PACKET_FIELD_ERROR(support_names, ": truncation array");
71592 }
71593 for (i = 0; i < real_packet->bits_num; i++) {
71594#ifdef FREECIV_JSON_CONNECTION
71595 field_addr.sub_location->number = i;
71596#endif /* FREECIV_JSON_CONNECTION */
71597 if (!DIO_GET(string, &din, &field_addr, real_packet->support_names[i], sizeof(real_packet->support_names[i]))) {
71598 RECEIVE_PACKET_FIELD_ERROR(support_names);
71599 }
71600 }
71601
71602#ifdef FREECIV_JSON_CONNECTION
71603 /* Exit array. */
71604 FC_FREE(field_addr.sub_location);
71605#endif /* FREECIV_JSON_CONNECTION */
71606 }
71607 }
71608 if (BV_ISSET(fields, 8)) {
71609 log_packet_detailed(" got field 'pretty_names'");
71610#ifdef FREECIV_JSON_CONNECTION
71611 field_addr.name = "pretty_names";
71612#endif /* FREECIV_JSON_CONNECTION */
71613 {
71614 int i;
71615
71616#ifdef FREECIV_JSON_CONNECTION
71617 /* Enter array. */
71618 field_addr.sub_location = plocation_elem_new(0);
71619#endif /* FREECIV_JSON_CONNECTION */
71620
71621 if (real_packet->bits_num > 64) {
71622 RECEIVE_PACKET_FIELD_ERROR(pretty_names, ": truncation array");
71623 }
71624 for (i = 0; i < real_packet->bits_num; i++) {
71625#ifdef FREECIV_JSON_CONNECTION
71626 field_addr.sub_location->number = i;
71627#endif /* FREECIV_JSON_CONNECTION */
71628 if (!DIO_GET(string, &din, &field_addr, real_packet->pretty_names[i], sizeof(real_packet->pretty_names[i]))) {
71629 RECEIVE_PACKET_FIELD_ERROR(pretty_names);
71630 }
71631 }
71632
71633#ifdef FREECIV_JSON_CONNECTION
71634 /* Exit array. */
71635 FC_FREE(field_addr.sub_location);
71636#endif /* FREECIV_JSON_CONNECTION */
71637 }
71638 }
71639
71640 if (NULL == old) {
71641 old = fc_malloc(sizeof(*old));
71642 *old = *real_packet;
71643 genhash_insert(*hash, old, old);
71644 } else {
71645 *old = *real_packet;
71646 }
71647
71648#endif /* FREECIV_DELTA_PROTOCOL */
71649 RECEIVE_PACKET_END(real_packet);
71650}
71651
71652 static int send_packet_server_setting_bitwise_100(struct connection *pc, const struct packet_server_setting_bitwise *packet)
71653{
71654 const struct packet_server_setting_bitwise *real_packet = packet;
71655 int e;
71656#ifdef FREECIV_DELTA_PROTOCOL
71657 packet_server_setting_bitwise_100_fields fields;
71658 struct packet_server_setting_bitwise *old;
71659 bool differ;
71660 struct genhash **hash = pc->phs.sent + PACKET_SERVER_SETTING_BITWISE;
71661 int different = 0;
71662#endif /* FREECIV_DELTA_PROTOCOL */
71663 SEND_PACKET_START(PACKET_SERVER_SETTING_BITWISE);
71664#ifdef FREECIV_JSON_CONNECTION
71665 struct plocation field_addr;
71666 {
71667 struct plocation *field_addr_tmp = plocation_field_new(NULL);
71668 field_addr = *field_addr_tmp;
71669 FC_FREE(field_addr_tmp);
71670 }
71671#endif /* FREECIV_JSON_CONNECTION */
71672
71673 log_packet_detailed("packet_server_setting_bitwise_100: sending info about (%d)",
71674 real_packet->id);
71675
71676#ifdef FREECIV_DELTA_PROTOCOL
71677 if (NULL == *hash) {
71678 *hash = genhash_new_full(hash_packet_server_setting_bitwise_100, cmp_packet_server_setting_bitwise_100,
71679 NULL, NULL, NULL, free);
71680 }
71681 BV_CLR_ALL(fields);
71682
71683 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
71684 old = fc_malloc(sizeof(*old));
71685 *old = *real_packet;
71686 genhash_insert(*hash, old, old);
71687 memset(old, 0, sizeof(*old));
71688 different = 1; /* Force to send. */
71689 }
71690 differ = (old->is_visible != real_packet->is_visible);
71691 if (differ) {
71692 different++;
71693 }
71694 if (packet->is_visible) {
71695 BV_SET(fields, 0);
71696 }
71697
71698 differ = (old->is_changeable != real_packet->is_changeable);
71699 if (differ) {
71700 different++;
71701 }
71702 if (packet->is_changeable) {
71703 BV_SET(fields, 1);
71704 }
71705
71706 differ = (old->initial_setting != real_packet->initial_setting);
71707 if (differ) {
71708 different++;
71709 }
71710 if (packet->initial_setting) {
71711 BV_SET(fields, 2);
71712 }
71713
71714 differ = (old->setdef != real_packet->setdef);
71715 if (differ) {
71716 different++;
71717 BV_SET(fields, 3);
71718 }
71719
71720 differ = (old->val != real_packet->val);
71721 if (differ) {
71722 different++;
71723 BV_SET(fields, 4);
71724 }
71725
71726 differ = (old->default_val != real_packet->default_val);
71727 if (differ) {
71728 different++;
71729 BV_SET(fields, 5);
71730 }
71731
71732 differ = (old->bits_num != real_packet->bits_num);
71733 if (differ) {
71734 different++;
71735 BV_SET(fields, 6);
71736 }
71737
71738 differ = (old->bits_num != real_packet->bits_num);
71739 if (!differ) {
71740 int i;
71741
71742 for (i = 0; i < real_packet->bits_num; i++) {
71743 differ = (strcmp(old->support_names[i], real_packet->support_names[i]) != 0);
71744 if (differ) {
71745 break;
71746 }
71747 }
71748 }
71749 if (differ) {
71750 different++;
71751 BV_SET(fields, 7);
71752 }
71753
71754 differ = (old->bits_num != real_packet->bits_num);
71755 if (!differ) {
71756 int i;
71757
71758 for (i = 0; i < real_packet->bits_num; i++) {
71759 differ = (strcmp(old->pretty_names[i], real_packet->pretty_names[i]) != 0);
71760 if (differ) {
71761 break;
71762 }
71763 }
71764 }
71765 if (differ) {
71766 different++;
71767 BV_SET(fields, 8);
71768 }
71769
71770 if (different == 0) {
71771 log_packet_detailed(" no change -> discard");
71772 return 0;
71773 }
71774
71775#ifdef FREECIV_JSON_CONNECTION
71776 field_addr.name = "fields";
71777#endif /* FREECIV_JSON_CONNECTION */
71778 e = 0;
71779 e |= DIO_BV_PUT(&dout, &field_addr, fields);
71780 if (e) {
71781 log_packet_detailed("fields bitvector error detected");
71782 }
71783#ifdef FREECIV_JSON_CONNECTION
71784 field_addr.name = "id";
71785#endif /* FREECIV_JSON_CONNECTION */
71786 e = 0;
71787 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
71788 if (e) {
71789 log_packet_detailed("'id' field error detected");
71790 }
71791
71792 /* field 0 is folded into the header */
71793 /* field 1 is folded into the header */
71794 /* field 2 is folded into the header */
71795 if (BV_ISSET(fields, 3)) {
71796 log_packet_detailed(" field 'setdef' has changed");
71797#ifdef FREECIV_JSON_CONNECTION
71798 field_addr.name = "setdef";
71799#endif /* FREECIV_JSON_CONNECTION */
71800 e = 0;
71801 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
71802 if (e) {
71803 log_packet_detailed("'setdef' field error detected");
71804 }
71805 }
71806 if (BV_ISSET(fields, 4)) {
71807 log_packet_detailed(" field 'val' has changed");
71808#ifdef FREECIV_JSON_CONNECTION
71809 field_addr.name = "val";
71810#endif /* FREECIV_JSON_CONNECTION */
71811 e = 0;
71812 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->val);
71813 if (e) {
71814 log_packet_detailed("'val' field error detected");
71815 }
71816 }
71817 if (BV_ISSET(fields, 5)) {
71818 log_packet_detailed(" field 'default_val' has changed");
71819#ifdef FREECIV_JSON_CONNECTION
71820 field_addr.name = "default_val";
71821#endif /* FREECIV_JSON_CONNECTION */
71822 e = 0;
71823 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->default_val);
71824 if (e) {
71825 log_packet_detailed("'default_val' field error detected");
71826 }
71827 }
71828 if (BV_ISSET(fields, 6)) {
71829 log_packet_detailed(" field 'bits_num' has changed");
71830#ifdef FREECIV_JSON_CONNECTION
71831 field_addr.name = "bits_num";
71832#endif /* FREECIV_JSON_CONNECTION */
71833 e = 0;
71834 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bits_num);
71835 if (e) {
71836 log_packet_detailed("'bits_num' field error detected");
71837 }
71838 }
71839 if (BV_ISSET(fields, 7)) {
71840 log_packet_detailed(" field 'support_names' has changed");
71841#ifdef FREECIV_JSON_CONNECTION
71842 field_addr.name = "support_names";
71843#endif /* FREECIV_JSON_CONNECTION */
71844 e = 0;
71845 {
71846 int i;
71847
71848#ifdef FREECIV_JSON_CONNECTION
71849 /* Create the array. */
71850 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
71851
71852 /* Enter the array. */
71853 field_addr.sub_location = plocation_elem_new(0);
71854#endif /* FREECIV_JSON_CONNECTION */
71855
71856 for (i = 0; i < real_packet->bits_num; i++) {
71857#ifdef FREECIV_JSON_CONNECTION
71858 /* Next array element. */
71859 field_addr.sub_location->number = i;
71860#endif /* FREECIV_JSON_CONNECTION */
71861 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
71862 }
71863
71864#ifdef FREECIV_JSON_CONNECTION
71865 /* Exit array. */
71866 FC_FREE(field_addr.sub_location);
71867#endif /* FREECIV_JSON_CONNECTION */
71868 }
71869 if (e) {
71870 log_packet_detailed("'support_names' field error detected");
71871 }
71872 }
71873 if (BV_ISSET(fields, 8)) {
71874 log_packet_detailed(" field 'pretty_names' has changed");
71875#ifdef FREECIV_JSON_CONNECTION
71876 field_addr.name = "pretty_names";
71877#endif /* FREECIV_JSON_CONNECTION */
71878 e = 0;
71879 {
71880 int i;
71881
71882#ifdef FREECIV_JSON_CONNECTION
71883 /* Create the array. */
71884 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
71885
71886 /* Enter the array. */
71887 field_addr.sub_location = plocation_elem_new(0);
71888#endif /* FREECIV_JSON_CONNECTION */
71889
71890 for (i = 0; i < real_packet->bits_num; i++) {
71891#ifdef FREECIV_JSON_CONNECTION
71892 /* Next array element. */
71893 field_addr.sub_location->number = i;
71894#endif /* FREECIV_JSON_CONNECTION */
71895 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
71896 }
71897
71898#ifdef FREECIV_JSON_CONNECTION
71899 /* Exit array. */
71900 FC_FREE(field_addr.sub_location);
71901#endif /* FREECIV_JSON_CONNECTION */
71902 }
71903 if (e) {
71904 log_packet_detailed("'pretty_names' field error detected");
71905 }
71906 }
71907
71908 *old = *real_packet;
71909#endif /* FREECIV_DELTA_PROTOCOL */
71910#ifndef FREECIV_DELTA_PROTOCOL
71911#ifdef FREECIV_JSON_CONNECTION
71912 field_addr.name = "id";
71913#endif /* FREECIV_JSON_CONNECTION */
71914 e = 0;
71915 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
71916 if (e) {
71917 log_packet_detailed("'id' field error detected");
71918 }
71919#ifdef FREECIV_JSON_CONNECTION
71920 field_addr.name = "is_visible";
71921#endif /* FREECIV_JSON_CONNECTION */
71922 e = 0;
71923 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_visible);
71924 if (e) {
71925 log_packet_detailed("'is_visible' field error detected");
71926 }
71927#ifdef FREECIV_JSON_CONNECTION
71928 field_addr.name = "is_changeable";
71929#endif /* FREECIV_JSON_CONNECTION */
71930 e = 0;
71931 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_changeable);
71932 if (e) {
71933 log_packet_detailed("'is_changeable' field error detected");
71934 }
71935#ifdef FREECIV_JSON_CONNECTION
71936 field_addr.name = "initial_setting";
71937#endif /* FREECIV_JSON_CONNECTION */
71938 e = 0;
71939 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->initial_setting);
71940 if (e) {
71941 log_packet_detailed("'initial_setting' field error detected");
71942 }
71943#ifdef FREECIV_JSON_CONNECTION
71944 field_addr.name = "setdef";
71945#endif /* FREECIV_JSON_CONNECTION */
71946 e = 0;
71947 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->setdef);
71948 if (e) {
71949 log_packet_detailed("'setdef' field error detected");
71950 }
71951#ifdef FREECIV_JSON_CONNECTION
71952 field_addr.name = "val";
71953#endif /* FREECIV_JSON_CONNECTION */
71954 e = 0;
71955 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->val);
71956 if (e) {
71957 log_packet_detailed("'val' field error detected");
71958 }
71959#ifdef FREECIV_JSON_CONNECTION
71960 field_addr.name = "default_val";
71961#endif /* FREECIV_JSON_CONNECTION */
71962 e = 0;
71963 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->default_val);
71964 if (e) {
71965 log_packet_detailed("'default_val' field error detected");
71966 }
71967#ifdef FREECIV_JSON_CONNECTION
71968 field_addr.name = "bits_num";
71969#endif /* FREECIV_JSON_CONNECTION */
71970 e = 0;
71971 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->bits_num);
71972 if (e) {
71973 log_packet_detailed("'bits_num' field error detected");
71974 }
71975#ifdef FREECIV_JSON_CONNECTION
71976 field_addr.name = "support_names";
71977#endif /* FREECIV_JSON_CONNECTION */
71978 e = 0;
71979 {
71980 int i;
71981
71982#ifdef FREECIV_JSON_CONNECTION
71983 /* Create the array. */
71984 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
71985
71986 /* Enter the array. */
71987 field_addr.sub_location = plocation_elem_new(0);
71988#endif /* FREECIV_JSON_CONNECTION */
71989
71990 for (i = 0; i < real_packet->bits_num; i++) {
71991#ifdef FREECIV_JSON_CONNECTION
71992 /* Next array element. */
71993 field_addr.sub_location->number = i;
71994#endif /* FREECIV_JSON_CONNECTION */
71995 e |= DIO_PUT(string, &dout, &field_addr, real_packet->support_names[i]);
71996 }
71997
71998#ifdef FREECIV_JSON_CONNECTION
71999 /* Exit array. */
72000 FC_FREE(field_addr.sub_location);
72001#endif /* FREECIV_JSON_CONNECTION */
72002 }
72003 if (e) {
72004 log_packet_detailed("'support_names' field error detected");
72005 }
72006#ifdef FREECIV_JSON_CONNECTION
72007 field_addr.name = "pretty_names";
72008#endif /* FREECIV_JSON_CONNECTION */
72009 e = 0;
72010 {
72011 int i;
72012
72013#ifdef FREECIV_JSON_CONNECTION
72014 /* Create the array. */
72015 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->bits_num);
72016
72017 /* Enter the array. */
72018 field_addr.sub_location = plocation_elem_new(0);
72019#endif /* FREECIV_JSON_CONNECTION */
72020
72021 for (i = 0; i < real_packet->bits_num; i++) {
72022#ifdef FREECIV_JSON_CONNECTION
72023 /* Next array element. */
72024 field_addr.sub_location->number = i;
72025#endif /* FREECIV_JSON_CONNECTION */
72026 e |= DIO_PUT(string, &dout, &field_addr, real_packet->pretty_names[i]);
72027 }
72028
72029#ifdef FREECIV_JSON_CONNECTION
72030 /* Exit array. */
72031 FC_FREE(field_addr.sub_location);
72032#endif /* FREECIV_JSON_CONNECTION */
72033 }
72034 if (e) {
72035 log_packet_detailed("'pretty_names' field error detected");
72036 }
72037
72038#endif
72039 SEND_PACKET_END(PACKET_SERVER_SETTING_BITWISE);
72040}
72041
72042 int send_packet_server_setting_bitwise(struct connection *pc, const struct packet_server_setting_bitwise *packet)
72043{
72044 if (!pc->used) {
72045 log_error("WARNING: trying to send data to the closed connection %s",
72046 conn_description(pc));
72047 return -1;
72048 }
72049 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SERVER_SETTING_BITWISE].packet != NULL, -1,
72050 "Handler for PACKET_SERVER_SETTING_BITWISE not installed");
72051 return pc->phs.handlers->send[PACKET_SERVER_SETTING_BITWISE].packet(pc, packet);
72052}
72053
72054#ifdef FREECIV_DELTA_PROTOCOL
72055#define hash_packet_set_topology_100 hash_const
72056
72057#define cmp_packet_set_topology_100 cmp_const
72058
72059 BV_DEFINE(packet_set_topology_100_fields, 2);
72060#endif /* FREECIV_DELTA_PROTOCOL */
72061
72062 static struct packet_set_topology *receive_packet_set_topology_100(struct connection *pc)
72063{
72064#ifdef FREECIV_DELTA_PROTOCOL
72065 packet_set_topology_100_fields fields;
72066 struct packet_set_topology *old;
72067 struct genhash **hash = pc->phs.received + PACKET_SET_TOPOLOGY;
72068#endif /* FREECIV_DELTA_PROTOCOL */
72069 RECEIVE_PACKET_START(packet_set_topology, real_packet);
72070#ifdef FREECIV_JSON_CONNECTION
72071 struct plocation field_addr;
72072 {
72073 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72074 field_addr = *field_addr_tmp;
72075 FC_FREE(field_addr_tmp);
72076 }
72077#endif /* FREECIV_JSON_CONNECTION */
72078
72079#ifdef FREECIV_DELTA_PROTOCOL
72080#ifdef FREECIV_JSON_CONNECTION
72081 field_addr.name = "fields";
72082#endif /* FREECIV_JSON_CONNECTION */
72083 DIO_BV_GET(&din, &field_addr, fields);
72084
72085#else /* FREECIV_DELTA_PROTOCOL */
72086#ifdef FREECIV_JSON_CONNECTION
72087 field_addr.name = "topology_id";
72088#endif /* FREECIV_JSON_CONNECTION */
72089 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
72090 RECEIVE_PACKET_FIELD_ERROR(topology_id);
72091 }
72092#ifdef FREECIV_JSON_CONNECTION
72093 field_addr.name = "wrap_id";
72094#endif /* FREECIV_JSON_CONNECTION */
72095 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
72096 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
72097 }
72098#endif
72099 log_packet_detailed("packet_set_topology_100: got info about ()");
72100
72101#ifdef FREECIV_DELTA_PROTOCOL
72102 if (NULL == *hash) {
72103 *hash = genhash_new_full(hash_packet_set_topology_100, cmp_packet_set_topology_100,
72104 NULL, NULL, NULL, free);
72105 }
72106
72107 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72108 *real_packet = *old;
72109 } else {
72110 log_packet_detailed(" no old info");
72111 memset(real_packet, 0, sizeof(*real_packet));
72112 }
72113
72114 if (BV_ISSET(fields, 0)) {
72115 log_packet_detailed(" got field 'topology_id'");
72116#ifdef FREECIV_JSON_CONNECTION
72117 field_addr.name = "topology_id";
72118#endif /* FREECIV_JSON_CONNECTION */
72119 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->topology_id)) {
72120 RECEIVE_PACKET_FIELD_ERROR(topology_id);
72121 }
72122 }
72123 if (BV_ISSET(fields, 1)) {
72124 log_packet_detailed(" got field 'wrap_id'");
72125#ifdef FREECIV_JSON_CONNECTION
72126 field_addr.name = "wrap_id";
72127#endif /* FREECIV_JSON_CONNECTION */
72128 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->wrap_id)) {
72129 RECEIVE_PACKET_FIELD_ERROR(wrap_id);
72130 }
72131 }
72132
72133 if (NULL == old) {
72134 old = fc_malloc(sizeof(*old));
72135 *old = *real_packet;
72136 genhash_insert(*hash, old, old);
72137 } else {
72138 *old = *real_packet;
72139 }
72140
72141#endif /* FREECIV_DELTA_PROTOCOL */
72142 RECEIVE_PACKET_END(real_packet);
72143}
72144
72145 static int send_packet_set_topology_100(struct connection *pc, const struct packet_set_topology *packet)
72146{
72147 const struct packet_set_topology *real_packet = packet;
72148 int e;
72149#ifdef FREECIV_DELTA_PROTOCOL
72150 packet_set_topology_100_fields fields;
72151 struct packet_set_topology *old;
72152 bool differ;
72153 struct genhash **hash = pc->phs.sent + PACKET_SET_TOPOLOGY;
72154#endif /* FREECIV_DELTA_PROTOCOL */
72155 SEND_PACKET_START(PACKET_SET_TOPOLOGY);
72156#ifdef FREECIV_JSON_CONNECTION
72157 struct plocation field_addr;
72158 {
72159 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72160 field_addr = *field_addr_tmp;
72161 FC_FREE(field_addr_tmp);
72162 }
72163#endif /* FREECIV_JSON_CONNECTION */
72164
72165 log_packet_detailed("packet_set_topology_100: sending info about ()");
72166
72167#ifdef FREECIV_DELTA_PROTOCOL
72168 if (NULL == *hash) {
72169 *hash = genhash_new_full(hash_packet_set_topology_100, cmp_packet_set_topology_100,
72170 NULL, NULL, NULL, free);
72171 }
72172 BV_CLR_ALL(fields);
72173
72174 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
72175 old = fc_malloc(sizeof(*old));
72176 *old = *real_packet;
72177 genhash_insert(*hash, old, old);
72178 memset(old, 0, sizeof(*old));
72179 }
72180 differ = (old->topology_id != real_packet->topology_id);
72181 if (differ) {
72182 BV_SET(fields, 0);
72183 }
72184
72185 differ = (old->wrap_id != real_packet->wrap_id);
72186 if (differ) {
72187 BV_SET(fields, 1);
72188 }
72189
72190
72191#ifdef FREECIV_JSON_CONNECTION
72192 field_addr.name = "fields";
72193#endif /* FREECIV_JSON_CONNECTION */
72194 e = 0;
72195 e |= DIO_BV_PUT(&dout, &field_addr, fields);
72196 if (e) {
72197 log_packet_detailed("fields bitvector error detected");
72198 }
72199
72200 if (BV_ISSET(fields, 0)) {
72201 log_packet_detailed(" field 'topology_id' has changed");
72202#ifdef FREECIV_JSON_CONNECTION
72203 field_addr.name = "topology_id";
72204#endif /* FREECIV_JSON_CONNECTION */
72205 e = 0;
72206 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
72207 if (e) {
72208 log_packet_detailed("'topology_id' field error detected");
72209 }
72210 }
72211 if (BV_ISSET(fields, 1)) {
72212 log_packet_detailed(" field 'wrap_id' has changed");
72213#ifdef FREECIV_JSON_CONNECTION
72214 field_addr.name = "wrap_id";
72215#endif /* FREECIV_JSON_CONNECTION */
72216 e = 0;
72217 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
72218 if (e) {
72219 log_packet_detailed("'wrap_id' field error detected");
72220 }
72221 }
72222
72223 *old = *real_packet;
72224#endif /* FREECIV_DELTA_PROTOCOL */
72225#ifndef FREECIV_DELTA_PROTOCOL
72226#ifdef FREECIV_JSON_CONNECTION
72227 field_addr.name = "topology_id";
72228#endif /* FREECIV_JSON_CONNECTION */
72229 e = 0;
72230 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->topology_id);
72231 if (e) {
72232 log_packet_detailed("'topology_id' field error detected");
72233 }
72234#ifdef FREECIV_JSON_CONNECTION
72235 field_addr.name = "wrap_id";
72236#endif /* FREECIV_JSON_CONNECTION */
72237 e = 0;
72238 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->wrap_id);
72239 if (e) {
72240 log_packet_detailed("'wrap_id' field error detected");
72241 }
72242
72243#endif
72244 SEND_PACKET_END(PACKET_SET_TOPOLOGY);
72245}
72246
72247 int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
72248{
72249 if (!pc->used) {
72250 log_error("WARNING: trying to send data to the closed connection %s",
72251 conn_description(pc));
72252 return -1;
72253 }
72254 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SET_TOPOLOGY].packet != NULL, -1,
72255 "Handler for PACKET_SET_TOPOLOGY not installed");
72256 return pc->phs.handlers->send[PACKET_SET_TOPOLOGY].packet(pc, packet);
72257}
72258
72259#ifdef FREECIV_DELTA_PROTOCOL
72260#define hash_packet_ruleset_effect_100 hash_const
72261
72262#define cmp_packet_ruleset_effect_100 cmp_const
72263
72264 BV_DEFINE(packet_ruleset_effect_100_fields, 6);
72265#endif /* FREECIV_DELTA_PROTOCOL */
72266
72267 static struct packet_ruleset_effect *receive_packet_ruleset_effect_100(struct connection *pc)
72268{
72269#ifdef FREECIV_DELTA_PROTOCOL
72270 packet_ruleset_effect_100_fields fields;
72271 struct packet_ruleset_effect *old;
72272 struct genhash **hash = pc->phs.received + PACKET_RULESET_EFFECT;
72273#endif /* FREECIV_DELTA_PROTOCOL */
72274 RECEIVE_PACKET_START(packet_ruleset_effect, real_packet);
72275#ifdef FREECIV_JSON_CONNECTION
72276 struct plocation field_addr;
72277 {
72278 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72279 field_addr = *field_addr_tmp;
72280 FC_FREE(field_addr_tmp);
72281 }
72282#endif /* FREECIV_JSON_CONNECTION */
72283
72284#ifdef FREECIV_DELTA_PROTOCOL
72285#ifdef FREECIV_JSON_CONNECTION
72286 field_addr.name = "fields";
72287#endif /* FREECIV_JSON_CONNECTION */
72288 DIO_BV_GET(&din, &field_addr, fields);
72289
72290#else /* FREECIV_DELTA_PROTOCOL */
72291#ifdef FREECIV_JSON_CONNECTION
72292 field_addr.name = "effect_type";
72293#endif /* FREECIV_JSON_CONNECTION */
72294 {
72295 int readin;
72296
72297 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72298 RECEIVE_PACKET_FIELD_ERROR(effect_type);
72299 }
72300 real_packet->effect_type = readin;
72301 }
72302#ifdef FREECIV_JSON_CONNECTION
72303 field_addr.name = "effect_value";
72304#endif /* FREECIV_JSON_CONNECTION */
72305 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->effect_value)) {
72306 RECEIVE_PACKET_FIELD_ERROR(effect_value);
72307 }
72308#ifdef FREECIV_JSON_CONNECTION
72309 field_addr.name = "has_multiplier";
72310#endif /* FREECIV_JSON_CONNECTION */
72311 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->has_multiplier)) {
72312 RECEIVE_PACKET_FIELD_ERROR(has_multiplier);
72313 }
72314#ifdef FREECIV_JSON_CONNECTION
72315 field_addr.name = "multiplier";
72316#endif /* FREECIV_JSON_CONNECTION */
72317 {
72318 int readin;
72319
72320 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72321 RECEIVE_PACKET_FIELD_ERROR(multiplier);
72322 }
72323 real_packet->multiplier = readin;
72324 }
72325#ifdef FREECIV_JSON_CONNECTION
72326 field_addr.name = "reqs_count";
72327#endif /* FREECIV_JSON_CONNECTION */
72328 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
72329 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
72330 }
72331#ifdef FREECIV_JSON_CONNECTION
72332 field_addr.name = "reqs";
72333#endif /* FREECIV_JSON_CONNECTION */
72334 {
72335 int i;
72336
72337#ifdef FREECIV_JSON_CONNECTION
72338 /* Enter array. */
72339 field_addr.sub_location = plocation_elem_new(0);
72340#endif /* FREECIV_JSON_CONNECTION */
72341
72342 if (real_packet->reqs_count > MAX_NUM_REQS) {
72343 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
72344 }
72345 for (i = 0; i < real_packet->reqs_count; i++) {
72346#ifdef FREECIV_JSON_CONNECTION
72347 field_addr.sub_location->number = i;
72348#endif /* FREECIV_JSON_CONNECTION */
72349 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
72350 RECEIVE_PACKET_FIELD_ERROR(reqs);
72351 }
72352 }
72353
72354#ifdef FREECIV_JSON_CONNECTION
72355 /* Exit array. */
72356 FC_FREE(field_addr.sub_location);
72357#endif /* FREECIV_JSON_CONNECTION */
72358 }
72359#endif
72360 log_packet_detailed("packet_ruleset_effect_100: got info about ()");
72361
72362#ifdef FREECIV_DELTA_PROTOCOL
72363 if (NULL == *hash) {
72364 *hash = genhash_new_full(hash_packet_ruleset_effect_100, cmp_packet_ruleset_effect_100,
72365 NULL, NULL, NULL, free);
72366 }
72367
72368 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72369 *real_packet = *old;
72370 } else {
72371 log_packet_detailed(" no old info");
72372 memset(real_packet, 0, sizeof(*real_packet));
72373 }
72374
72375 if (BV_ISSET(fields, 0)) {
72376 log_packet_detailed(" got field 'effect_type'");
72377#ifdef FREECIV_JSON_CONNECTION
72378 field_addr.name = "effect_type";
72379#endif /* FREECIV_JSON_CONNECTION */
72380 {
72381 int readin;
72382
72383 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72384 RECEIVE_PACKET_FIELD_ERROR(effect_type);
72385 }
72386 real_packet->effect_type = readin;
72387 }
72388 }
72389 if (BV_ISSET(fields, 1)) {
72390 log_packet_detailed(" got field 'effect_value'");
72391#ifdef FREECIV_JSON_CONNECTION
72392 field_addr.name = "effect_value";
72393#endif /* FREECIV_JSON_CONNECTION */
72394 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->effect_value)) {
72395 RECEIVE_PACKET_FIELD_ERROR(effect_value);
72396 }
72397 }
72398 real_packet->has_multiplier = BV_ISSET(fields, 2);
72399 if (BV_ISSET(fields, 3)) {
72400 log_packet_detailed(" got field 'multiplier'");
72401#ifdef FREECIV_JSON_CONNECTION
72402 field_addr.name = "multiplier";
72403#endif /* FREECIV_JSON_CONNECTION */
72404 {
72405 int readin;
72406
72407 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
72408 RECEIVE_PACKET_FIELD_ERROR(multiplier);
72409 }
72410 real_packet->multiplier = readin;
72411 }
72412 }
72413 if (BV_ISSET(fields, 4)) {
72414 log_packet_detailed(" got field 'reqs_count'");
72415#ifdef FREECIV_JSON_CONNECTION
72416 field_addr.name = "reqs_count";
72417#endif /* FREECIV_JSON_CONNECTION */
72418 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->reqs_count)) {
72419 RECEIVE_PACKET_FIELD_ERROR(reqs_count);
72420 }
72421 }
72422 if (BV_ISSET(fields, 5)) {
72423 log_packet_detailed(" got field 'reqs'");
72424#ifdef FREECIV_JSON_CONNECTION
72425 field_addr.name = "reqs";
72426#endif /* FREECIV_JSON_CONNECTION */
72427 {
72428 int i;
72429
72430#ifdef FREECIV_JSON_CONNECTION
72431 /* Enter array. */
72432 field_addr.sub_location = plocation_elem_new(0);
72433#endif /* FREECIV_JSON_CONNECTION */
72434
72435 if (real_packet->reqs_count > MAX_NUM_REQS) {
72436 RECEIVE_PACKET_FIELD_ERROR(reqs, ": truncation array");
72437 }
72438 for (i = 0; i < real_packet->reqs_count; i++) {
72439#ifdef FREECIV_JSON_CONNECTION
72440 field_addr.sub_location->number = i;
72441#endif /* FREECIV_JSON_CONNECTION */
72442 if (!DIO_GET(requirement, &din, &field_addr, &real_packet->reqs[i])) {
72443 RECEIVE_PACKET_FIELD_ERROR(reqs);
72444 }
72445 }
72446
72447#ifdef FREECIV_JSON_CONNECTION
72448 /* Exit array. */
72449 FC_FREE(field_addr.sub_location);
72450#endif /* FREECIV_JSON_CONNECTION */
72451 }
72452 }
72453
72454 if (NULL == old) {
72455 old = fc_malloc(sizeof(*old));
72456 *old = *real_packet;
72457 genhash_insert(*hash, old, old);
72458 } else {
72459 *old = *real_packet;
72460 }
72461
72462#endif /* FREECIV_DELTA_PROTOCOL */
72463 RECEIVE_PACKET_END(real_packet);
72464}
72465
72466 static int send_packet_ruleset_effect_100(struct connection *pc, const struct packet_ruleset_effect *packet)
72467{
72468 const struct packet_ruleset_effect *real_packet = packet;
72469 int e;
72470#ifdef FREECIV_DELTA_PROTOCOL
72471 packet_ruleset_effect_100_fields fields;
72472 struct packet_ruleset_effect *old;
72473 bool differ;
72474 struct genhash **hash = pc->phs.sent + PACKET_RULESET_EFFECT;
72475#endif /* FREECIV_DELTA_PROTOCOL */
72476 SEND_PACKET_START(PACKET_RULESET_EFFECT);
72477#ifdef FREECIV_JSON_CONNECTION
72478 struct plocation field_addr;
72479 {
72480 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72481 field_addr = *field_addr_tmp;
72482 FC_FREE(field_addr_tmp);
72483 }
72484#endif /* FREECIV_JSON_CONNECTION */
72485
72486 log_packet_detailed("packet_ruleset_effect_100: sending info about ()");
72487
72488#ifdef FREECIV_DELTA_PROTOCOL
72489 if (NULL == *hash) {
72490 *hash = genhash_new_full(hash_packet_ruleset_effect_100, cmp_packet_ruleset_effect_100,
72491 NULL, NULL, NULL, free);
72492 }
72493 BV_CLR_ALL(fields);
72494
72495 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
72496 old = fc_malloc(sizeof(*old));
72497 *old = *real_packet;
72498 genhash_insert(*hash, old, old);
72499 memset(old, 0, sizeof(*old));
72500 }
72501 differ = (old->effect_type != real_packet->effect_type);
72502 if (differ) {
72503 BV_SET(fields, 0);
72504 }
72505
72506 differ = (old->effect_value != real_packet->effect_value);
72507 if (differ) {
72508 BV_SET(fields, 1);
72509 }
72510
72511 if (packet->has_multiplier) {
72512 BV_SET(fields, 2);
72513 }
72514
72515 differ = (old->multiplier != real_packet->multiplier);
72516 if (differ) {
72517 BV_SET(fields, 3);
72518 }
72519
72520 differ = (old->reqs_count != real_packet->reqs_count);
72521 if (differ) {
72522 BV_SET(fields, 4);
72523 }
72524
72525 differ = (old->reqs_count != real_packet->reqs_count);
72526 if (!differ) {
72527 int i;
72528
72529 for (i = 0; i < real_packet->reqs_count; i++) {
72530 differ = !are_requirements_equal(&old->reqs[i], &real_packet->reqs[i]);
72531 if (differ) {
72532 break;
72533 }
72534 }
72535 }
72536 if (differ) {
72537 BV_SET(fields, 5);
72538 }
72539
72540
72541#ifdef FREECIV_JSON_CONNECTION
72542 field_addr.name = "fields";
72543#endif /* FREECIV_JSON_CONNECTION */
72544 e = 0;
72545 e |= DIO_BV_PUT(&dout, &field_addr, fields);
72546 if (e) {
72547 log_packet_detailed("fields bitvector error detected");
72548 }
72549
72550 if (BV_ISSET(fields, 0)) {
72551 log_packet_detailed(" field 'effect_type' has changed");
72552#ifdef FREECIV_JSON_CONNECTION
72553 field_addr.name = "effect_type";
72554#endif /* FREECIV_JSON_CONNECTION */
72555 e = 0;
72556 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->effect_type);
72557 if (e) {
72558 log_packet_detailed("'effect_type' field error detected");
72559 }
72560 }
72561 if (BV_ISSET(fields, 1)) {
72562 log_packet_detailed(" field 'effect_value' has changed");
72563#ifdef FREECIV_JSON_CONNECTION
72564 field_addr.name = "effect_value";
72565#endif /* FREECIV_JSON_CONNECTION */
72566 e = 0;
72567 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->effect_value);
72568 if (e) {
72569 log_packet_detailed("'effect_value' field error detected");
72570 }
72571 }
72572 /* field 2 is folded into the header */
72573 if (BV_ISSET(fields, 3)) {
72574 log_packet_detailed(" field 'multiplier' has changed");
72575#ifdef FREECIV_JSON_CONNECTION
72576 field_addr.name = "multiplier";
72577#endif /* FREECIV_JSON_CONNECTION */
72578 e = 0;
72579 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multiplier);
72580 if (e) {
72581 log_packet_detailed("'multiplier' field error detected");
72582 }
72583 }
72584 if (BV_ISSET(fields, 4)) {
72585 log_packet_detailed(" field 'reqs_count' has changed");
72586#ifdef FREECIV_JSON_CONNECTION
72587 field_addr.name = "reqs_count";
72588#endif /* FREECIV_JSON_CONNECTION */
72589 e = 0;
72590 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
72591 if (e) {
72592 log_packet_detailed("'reqs_count' field error detected");
72593 }
72594 }
72595 if (BV_ISSET(fields, 5)) {
72596 log_packet_detailed(" field 'reqs' has changed");
72597#ifdef FREECIV_JSON_CONNECTION
72598 field_addr.name = "reqs";
72599#endif /* FREECIV_JSON_CONNECTION */
72600 e = 0;
72601 {
72602 int i;
72603
72604#ifdef FREECIV_JSON_CONNECTION
72605 /* Create the array. */
72606 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
72607
72608 /* Enter the array. */
72609 field_addr.sub_location = plocation_elem_new(0);
72610#endif /* FREECIV_JSON_CONNECTION */
72611
72612 for (i = 0; i < real_packet->reqs_count; i++) {
72613#ifdef FREECIV_JSON_CONNECTION
72614 /* Next array element. */
72615 field_addr.sub_location->number = i;
72616#endif /* FREECIV_JSON_CONNECTION */
72617 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
72618 }
72619
72620#ifdef FREECIV_JSON_CONNECTION
72621 /* Exit array. */
72622 FC_FREE(field_addr.sub_location);
72623#endif /* FREECIV_JSON_CONNECTION */
72624 }
72625 if (e) {
72626 log_packet_detailed("'reqs' field error detected");
72627 }
72628 }
72629
72630 *old = *real_packet;
72631#endif /* FREECIV_DELTA_PROTOCOL */
72632#ifndef FREECIV_DELTA_PROTOCOL
72633#ifdef FREECIV_JSON_CONNECTION
72634 field_addr.name = "effect_type";
72635#endif /* FREECIV_JSON_CONNECTION */
72636 e = 0;
72637 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->effect_type);
72638 if (e) {
72639 log_packet_detailed("'effect_type' field error detected");
72640 }
72641#ifdef FREECIV_JSON_CONNECTION
72642 field_addr.name = "effect_value";
72643#endif /* FREECIV_JSON_CONNECTION */
72644 e = 0;
72645 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->effect_value);
72646 if (e) {
72647 log_packet_detailed("'effect_value' field error detected");
72648 }
72649#ifdef FREECIV_JSON_CONNECTION
72650 field_addr.name = "has_multiplier";
72651#endif /* FREECIV_JSON_CONNECTION */
72652 e = 0;
72653 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->has_multiplier);
72654 if (e) {
72655 log_packet_detailed("'has_multiplier' field error detected");
72656 }
72657#ifdef FREECIV_JSON_CONNECTION
72658 field_addr.name = "multiplier";
72659#endif /* FREECIV_JSON_CONNECTION */
72660 e = 0;
72661 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->multiplier);
72662 if (e) {
72663 log_packet_detailed("'multiplier' field error detected");
72664 }
72665#ifdef FREECIV_JSON_CONNECTION
72666 field_addr.name = "reqs_count";
72667#endif /* FREECIV_JSON_CONNECTION */
72668 e = 0;
72669 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->reqs_count);
72670 if (e) {
72671 log_packet_detailed("'reqs_count' field error detected");
72672 }
72673#ifdef FREECIV_JSON_CONNECTION
72674 field_addr.name = "reqs";
72675#endif /* FREECIV_JSON_CONNECTION */
72676 e = 0;
72677 {
72678 int i;
72679
72680#ifdef FREECIV_JSON_CONNECTION
72681 /* Create the array. */
72682 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->reqs_count);
72683
72684 /* Enter the array. */
72685 field_addr.sub_location = plocation_elem_new(0);
72686#endif /* FREECIV_JSON_CONNECTION */
72687
72688 for (i = 0; i < real_packet->reqs_count; i++) {
72689#ifdef FREECIV_JSON_CONNECTION
72690 /* Next array element. */
72691 field_addr.sub_location->number = i;
72692#endif /* FREECIV_JSON_CONNECTION */
72693 e |= DIO_PUT(requirement, &dout, &field_addr, &real_packet->reqs[i]);
72694 }
72695
72696#ifdef FREECIV_JSON_CONNECTION
72697 /* Exit array. */
72698 FC_FREE(field_addr.sub_location);
72699#endif /* FREECIV_JSON_CONNECTION */
72700 }
72701 if (e) {
72702 log_packet_detailed("'reqs' field error detected");
72703 }
72704
72705#endif
72706 SEND_PACKET_END(PACKET_RULESET_EFFECT);
72707}
72708
72709 int send_packet_ruleset_effect(struct connection *pc, const struct packet_ruleset_effect *packet)
72710{
72711 if (!pc->used) {
72712 log_error("WARNING: trying to send data to the closed connection %s",
72713 conn_description(pc));
72714 return -1;
72715 }
72716 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_EFFECT].packet != NULL, -1,
72717 "Handler for PACKET_RULESET_EFFECT not installed");
72718 return pc->phs.handlers->send[PACKET_RULESET_EFFECT].packet(pc, packet);
72719}
72720
72721 void lsend_packet_ruleset_effect(struct conn_list *dest, const struct packet_ruleset_effect *packet)
72722{
72723 conn_list_iterate(dest, pconn) {
72724 send_packet_ruleset_effect(pconn, packet);
72725 } conn_list_iterate_end;
72726}
72727
72728#ifdef FREECIV_DELTA_PROTOCOL
72729#define hash_packet_ruleset_resource_100 hash_const
72730
72731#define cmp_packet_ruleset_resource_100 cmp_const
72732
72733 BV_DEFINE(packet_ruleset_resource_100_fields, 2);
72734#endif /* FREECIV_DELTA_PROTOCOL */
72735
72736 static struct packet_ruleset_resource *receive_packet_ruleset_resource_100(struct connection *pc)
72737{
72738#ifdef FREECIV_DELTA_PROTOCOL
72739 packet_ruleset_resource_100_fields fields;
72740 struct packet_ruleset_resource *old;
72741 struct genhash **hash = pc->phs.received + PACKET_RULESET_RESOURCE;
72742#endif /* FREECIV_DELTA_PROTOCOL */
72743 RECEIVE_PACKET_START(packet_ruleset_resource, real_packet);
72744#ifdef FREECIV_JSON_CONNECTION
72745 struct plocation field_addr;
72746 {
72747 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72748 field_addr = *field_addr_tmp;
72749 FC_FREE(field_addr_tmp);
72750 }
72751#endif /* FREECIV_JSON_CONNECTION */
72752
72753#ifdef FREECIV_DELTA_PROTOCOL
72754#ifdef FREECIV_JSON_CONNECTION
72755 field_addr.name = "fields";
72756#endif /* FREECIV_JSON_CONNECTION */
72757 DIO_BV_GET(&din, &field_addr, fields);
72758
72759#else /* FREECIV_DELTA_PROTOCOL */
72760#ifdef FREECIV_JSON_CONNECTION
72761 field_addr.name = "id";
72762#endif /* FREECIV_JSON_CONNECTION */
72763 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72764 RECEIVE_PACKET_FIELD_ERROR(id);
72765 }
72766#ifdef FREECIV_JSON_CONNECTION
72767 field_addr.name = "output";
72768#endif /* FREECIV_JSON_CONNECTION */
72769 {
72770 int i;
72771
72772#ifdef FREECIV_JSON_CONNECTION
72773 /* Enter array. */
72774 field_addr.sub_location = plocation_elem_new(0);
72775#endif /* FREECIV_JSON_CONNECTION */
72776
72777 for (i = 0; i < O_LAST; i++) {
72778#ifdef FREECIV_JSON_CONNECTION
72779 field_addr.sub_location->number = i;
72780#endif /* FREECIV_JSON_CONNECTION */
72781 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
72782 RECEIVE_PACKET_FIELD_ERROR(output);
72783 }
72784 }
72785
72786#ifdef FREECIV_JSON_CONNECTION
72787 /* Exit array. */
72788 FC_FREE(field_addr.sub_location);
72789#endif /* FREECIV_JSON_CONNECTION */
72790 }
72791#endif
72792 log_packet_detailed("packet_ruleset_resource_100: got info about ()");
72793
72794#ifdef FREECIV_DELTA_PROTOCOL
72795 if (NULL == *hash) {
72796 *hash = genhash_new_full(hash_packet_ruleset_resource_100, cmp_packet_ruleset_resource_100,
72797 NULL, NULL, NULL, free);
72798 }
72799
72800 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
72801 *real_packet = *old;
72802 } else {
72803 log_packet_detailed(" no old info");
72804 memset(real_packet, 0, sizeof(*real_packet));
72805 }
72806
72807 if (BV_ISSET(fields, 0)) {
72808 log_packet_detailed(" got field 'id'");
72809#ifdef FREECIV_JSON_CONNECTION
72810 field_addr.name = "id";
72811#endif /* FREECIV_JSON_CONNECTION */
72812 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->id)) {
72813 RECEIVE_PACKET_FIELD_ERROR(id);
72814 }
72815 }
72816 if (BV_ISSET(fields, 1)) {
72817 log_packet_detailed(" got field 'output'");
72818#ifdef FREECIV_JSON_CONNECTION
72819 field_addr.name = "output";
72820#endif /* FREECIV_JSON_CONNECTION */
72821 {
72822 int i;
72823
72824#ifdef FREECIV_JSON_CONNECTION
72825 /* Enter array. */
72826 field_addr.sub_location = plocation_elem_new(0);
72827#endif /* FREECIV_JSON_CONNECTION */
72828
72829 for (i = 0; i < O_LAST; i++) {
72830#ifdef FREECIV_JSON_CONNECTION
72831 field_addr.sub_location->number = i;
72832#endif /* FREECIV_JSON_CONNECTION */
72833 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output[i])) {
72834 RECEIVE_PACKET_FIELD_ERROR(output);
72835 }
72836 }
72837
72838#ifdef FREECIV_JSON_CONNECTION
72839 /* Exit array. */
72840 FC_FREE(field_addr.sub_location);
72841#endif /* FREECIV_JSON_CONNECTION */
72842 }
72843 }
72844
72845 if (NULL == old) {
72846 old = fc_malloc(sizeof(*old));
72847 *old = *real_packet;
72848 genhash_insert(*hash, old, old);
72849 } else {
72850 *old = *real_packet;
72851 }
72852
72853#endif /* FREECIV_DELTA_PROTOCOL */
72854 RECEIVE_PACKET_END(real_packet);
72855}
72856
72857 static int send_packet_ruleset_resource_100(struct connection *pc, const struct packet_ruleset_resource *packet)
72858{
72859 const struct packet_ruleset_resource *real_packet = packet;
72860 int e;
72861#ifdef FREECIV_DELTA_PROTOCOL
72862 packet_ruleset_resource_100_fields fields;
72863 struct packet_ruleset_resource *old;
72864 bool differ;
72865 struct genhash **hash = pc->phs.sent + PACKET_RULESET_RESOURCE;
72866#endif /* FREECIV_DELTA_PROTOCOL */
72867 SEND_PACKET_START(PACKET_RULESET_RESOURCE);
72868#ifdef FREECIV_JSON_CONNECTION
72869 struct plocation field_addr;
72870 {
72871 struct plocation *field_addr_tmp = plocation_field_new(NULL);
72872 field_addr = *field_addr_tmp;
72873 FC_FREE(field_addr_tmp);
72874 }
72875#endif /* FREECIV_JSON_CONNECTION */
72876
72877 log_packet_detailed("packet_ruleset_resource_100: sending info about ()");
72878
72879#ifdef FREECIV_DELTA_PROTOCOL
72880 if (NULL == *hash) {
72881 *hash = genhash_new_full(hash_packet_ruleset_resource_100, cmp_packet_ruleset_resource_100,
72882 NULL, NULL, NULL, free);
72883 }
72884 BV_CLR_ALL(fields);
72885
72886 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
72887 old = fc_malloc(sizeof(*old));
72888 *old = *real_packet;
72889 genhash_insert(*hash, old, old);
72890 memset(old, 0, sizeof(*old));
72891 }
72892 differ = (old->id != real_packet->id);
72893 if (differ) {
72894 BV_SET(fields, 0);
72895 }
72896
72897 differ = FALSE;
72898 {
72899 int i;
72900
72901 for (i = 0; i < O_LAST; i++) {
72902 differ = (old->output[i] != real_packet->output[i]);
72903 if (differ) {
72904 break;
72905 }
72906 }
72907 }
72908 if (differ) {
72909 BV_SET(fields, 1);
72910 }
72911
72912
72913#ifdef FREECIV_JSON_CONNECTION
72914 field_addr.name = "fields";
72915#endif /* FREECIV_JSON_CONNECTION */
72916 e = 0;
72917 e |= DIO_BV_PUT(&dout, &field_addr, fields);
72918 if (e) {
72919 log_packet_detailed("fields bitvector error detected");
72920 }
72921
72922 if (BV_ISSET(fields, 0)) {
72923 log_packet_detailed(" field 'id' has changed");
72924#ifdef FREECIV_JSON_CONNECTION
72925 field_addr.name = "id";
72926#endif /* FREECIV_JSON_CONNECTION */
72927 e = 0;
72928 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
72929 if (e) {
72930 log_packet_detailed("'id' field error detected");
72931 }
72932 }
72933 if (BV_ISSET(fields, 1)) {
72934 log_packet_detailed(" field 'output' has changed");
72935#ifdef FREECIV_JSON_CONNECTION
72936 field_addr.name = "output";
72937#endif /* FREECIV_JSON_CONNECTION */
72938 e = 0;
72939 {
72940 int i;
72941
72942#ifdef FREECIV_JSON_CONNECTION
72943 /* Create the array. */
72944 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
72945
72946 /* Enter the array. */
72947 field_addr.sub_location = plocation_elem_new(0);
72948#endif /* FREECIV_JSON_CONNECTION */
72949
72950 for (i = 0; i < O_LAST; i++) {
72951#ifdef FREECIV_JSON_CONNECTION
72952 /* Next array element. */
72953 field_addr.sub_location->number = i;
72954#endif /* FREECIV_JSON_CONNECTION */
72955 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
72956 }
72957
72958#ifdef FREECIV_JSON_CONNECTION
72959 /* Exit array. */
72960 FC_FREE(field_addr.sub_location);
72961#endif /* FREECIV_JSON_CONNECTION */
72962 }
72963 if (e) {
72964 log_packet_detailed("'output' field error detected");
72965 }
72966 }
72967
72968 *old = *real_packet;
72969#endif /* FREECIV_DELTA_PROTOCOL */
72970#ifndef FREECIV_DELTA_PROTOCOL
72971#ifdef FREECIV_JSON_CONNECTION
72972 field_addr.name = "id";
72973#endif /* FREECIV_JSON_CONNECTION */
72974 e = 0;
72975 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
72976 if (e) {
72977 log_packet_detailed("'id' field error detected");
72978 }
72979#ifdef FREECIV_JSON_CONNECTION
72980 field_addr.name = "output";
72981#endif /* FREECIV_JSON_CONNECTION */
72982 e = 0;
72983 {
72984 int i;
72985
72986#ifdef FREECIV_JSON_CONNECTION
72987 /* Create the array. */
72988 e |= DIO_PUT(farray, &dout, &field_addr, O_LAST);
72989
72990 /* Enter the array. */
72991 field_addr.sub_location = plocation_elem_new(0);
72992#endif /* FREECIV_JSON_CONNECTION */
72993
72994 for (i = 0; i < O_LAST; i++) {
72995#ifdef FREECIV_JSON_CONNECTION
72996 /* Next array element. */
72997 field_addr.sub_location->number = i;
72998#endif /* FREECIV_JSON_CONNECTION */
72999 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output[i]);
73000 }
73001
73002#ifdef FREECIV_JSON_CONNECTION
73003 /* Exit array. */
73004 FC_FREE(field_addr.sub_location);
73005#endif /* FREECIV_JSON_CONNECTION */
73006 }
73007 if (e) {
73008 log_packet_detailed("'output' field error detected");
73009 }
73010
73011#endif
73012 SEND_PACKET_END(PACKET_RULESET_RESOURCE);
73013}
73014
73015 int send_packet_ruleset_resource(struct connection *pc, const struct packet_ruleset_resource *packet)
73016{
73017 if (!pc->used) {
73018 log_error("WARNING: trying to send data to the closed connection %s",
73019 conn_description(pc));
73020 return -1;
73021 }
73022 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_RULESET_RESOURCE].packet != NULL, -1,
73023 "Handler for PACKET_RULESET_RESOURCE not installed");
73024 return pc->phs.handlers->send[PACKET_RULESET_RESOURCE].packet(pc, packet);
73025}
73026
73027 void lsend_packet_ruleset_resource(struct conn_list *dest, const struct packet_ruleset_resource *packet)
73028{
73029 conn_list_iterate(dest, pconn) {
73030 send_packet_ruleset_resource(pconn, packet);
73031 } conn_list_iterate_end;
73032}
73033
73034#ifdef FREECIV_DELTA_PROTOCOL
73035#define hash_packet_scenario_info_100 hash_const
73036
73037#define cmp_packet_scenario_info_100 cmp_const
73038
73039 BV_DEFINE(packet_scenario_info_100_fields, 14);
73040#endif /* FREECIV_DELTA_PROTOCOL */
73041
73042 static struct packet_scenario_info *receive_packet_scenario_info_100(struct connection *pc)
73043{
73044#ifdef FREECIV_DELTA_PROTOCOL
73045 packet_scenario_info_100_fields fields;
73046 struct packet_scenario_info *old;
73047 struct genhash **hash = pc->phs.received + PACKET_SCENARIO_INFO;
73048#endif /* FREECIV_DELTA_PROTOCOL */
73049 RECEIVE_PACKET_START(packet_scenario_info, real_packet);
73050#ifdef FREECIV_JSON_CONNECTION
73051 struct plocation field_addr;
73052 {
73053 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73054 field_addr = *field_addr_tmp;
73055 FC_FREE(field_addr_tmp);
73056 }
73057#endif /* FREECIV_JSON_CONNECTION */
73058
73059#ifdef FREECIV_DELTA_PROTOCOL
73060#ifdef FREECIV_JSON_CONNECTION
73061 field_addr.name = "fields";
73062#endif /* FREECIV_JSON_CONNECTION */
73063 DIO_BV_GET(&din, &field_addr, fields);
73064
73065#else /* FREECIV_DELTA_PROTOCOL */
73066#ifdef FREECIV_JSON_CONNECTION
73067 field_addr.name = "is_scenario";
73068#endif /* FREECIV_JSON_CONNECTION */
73069 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_scenario)) {
73070 RECEIVE_PACKET_FIELD_ERROR(is_scenario);
73071 }
73072#ifdef FREECIV_JSON_CONNECTION
73073 field_addr.name = "name";
73074#endif /* FREECIV_JSON_CONNECTION */
73075 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
73076 RECEIVE_PACKET_FIELD_ERROR(name);
73077 }
73078#ifdef FREECIV_JSON_CONNECTION
73079 field_addr.name = "authors";
73080#endif /* FREECIV_JSON_CONNECTION */
73081 if (!DIO_GET(string, &din, &field_addr, real_packet->authors, sizeof(real_packet->authors))) {
73082 RECEIVE_PACKET_FIELD_ERROR(authors);
73083 }
73084#ifdef FREECIV_JSON_CONNECTION
73085 field_addr.name = "players";
73086#endif /* FREECIV_JSON_CONNECTION */
73087 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->players)) {
73088 RECEIVE_PACKET_FIELD_ERROR(players);
73089 }
73090#ifdef FREECIV_JSON_CONNECTION
73091 field_addr.name = "startpos_nations";
73092#endif /* FREECIV_JSON_CONNECTION */
73093 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->startpos_nations)) {
73094 RECEIVE_PACKET_FIELD_ERROR(startpos_nations);
73095 }
73096#ifdef FREECIV_JSON_CONNECTION
73097 field_addr.name = "save_random";
73098#endif /* FREECIV_JSON_CONNECTION */
73099 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->save_random)) {
73100 RECEIVE_PACKET_FIELD_ERROR(save_random);
73101 }
73102#ifdef FREECIV_JSON_CONNECTION
73103 field_addr.name = "prevent_new_cities";
73104#endif /* FREECIV_JSON_CONNECTION */
73105 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->prevent_new_cities)) {
73106 RECEIVE_PACKET_FIELD_ERROR(prevent_new_cities);
73107 }
73108#ifdef FREECIV_JSON_CONNECTION
73109 field_addr.name = "lake_flooding";
73110#endif /* FREECIV_JSON_CONNECTION */
73111 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->lake_flooding)) {
73112 RECEIVE_PACKET_FIELD_ERROR(lake_flooding);
73113 }
73114#ifdef FREECIV_JSON_CONNECTION
73115 field_addr.name = "handmade";
73116#endif /* FREECIV_JSON_CONNECTION */
73117 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->handmade)) {
73118 RECEIVE_PACKET_FIELD_ERROR(handmade);
73119 }
73120#ifdef FREECIV_JSON_CONNECTION
73121 field_addr.name = "allow_ai_type_fallback";
73122#endif /* FREECIV_JSON_CONNECTION */
73123 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->allow_ai_type_fallback)) {
73124 RECEIVE_PACKET_FIELD_ERROR(allow_ai_type_fallback);
73125 }
73126#ifdef FREECIV_JSON_CONNECTION
73127 field_addr.name = "ruleset_locked";
73128#endif /* FREECIV_JSON_CONNECTION */
73129 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ruleset_locked)) {
73130 RECEIVE_PACKET_FIELD_ERROR(ruleset_locked);
73131 }
73132#ifdef FREECIV_JSON_CONNECTION
73133 field_addr.name = "datafile";
73134#endif /* FREECIV_JSON_CONNECTION */
73135 if (!DIO_GET(string, &din, &field_addr, real_packet->datafile, sizeof(real_packet->datafile))) {
73136 RECEIVE_PACKET_FIELD_ERROR(datafile);
73137 }
73138#ifdef FREECIV_JSON_CONNECTION
73139 field_addr.name = "have_resources";
73140#endif /* FREECIV_JSON_CONNECTION */
73141 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->have_resources)) {
73142 RECEIVE_PACKET_FIELD_ERROR(have_resources);
73143 }
73144#ifdef FREECIV_JSON_CONNECTION
73145 field_addr.name = "req_caps";
73146#endif /* FREECIV_JSON_CONNECTION */
73147 if (!DIO_GET(string, &din, &field_addr, real_packet->req_caps, sizeof(real_packet->req_caps))) {
73148 RECEIVE_PACKET_FIELD_ERROR(req_caps);
73149 }
73150#endif
73151 log_packet_detailed("packet_scenario_info_100: got info about ()");
73152
73153#ifdef FREECIV_DELTA_PROTOCOL
73154 if (NULL == *hash) {
73155 *hash = genhash_new_full(hash_packet_scenario_info_100, cmp_packet_scenario_info_100,
73156 NULL, NULL, NULL, free);
73157 }
73158
73159 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73160 *real_packet = *old;
73161 } else {
73162 log_packet_detailed(" no old info");
73163 memset(real_packet, 0, sizeof(*real_packet));
73164 }
73165
73166 real_packet->is_scenario = BV_ISSET(fields, 0);
73167 if (BV_ISSET(fields, 1)) {
73168 log_packet_detailed(" got field 'name'");
73169#ifdef FREECIV_JSON_CONNECTION
73170 field_addr.name = "name";
73171#endif /* FREECIV_JSON_CONNECTION */
73172 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
73173 RECEIVE_PACKET_FIELD_ERROR(name);
73174 }
73175 }
73176 if (BV_ISSET(fields, 2)) {
73177 log_packet_detailed(" got field 'authors'");
73178#ifdef FREECIV_JSON_CONNECTION
73179 field_addr.name = "authors";
73180#endif /* FREECIV_JSON_CONNECTION */
73181 if (!DIO_GET(string, &din, &field_addr, real_packet->authors, sizeof(real_packet->authors))) {
73182 RECEIVE_PACKET_FIELD_ERROR(authors);
73183 }
73184 }
73185 real_packet->players = BV_ISSET(fields, 3);
73186 real_packet->startpos_nations = BV_ISSET(fields, 4);
73187 real_packet->save_random = BV_ISSET(fields, 5);
73188 real_packet->prevent_new_cities = BV_ISSET(fields, 6);
73189 real_packet->lake_flooding = BV_ISSET(fields, 7);
73190 real_packet->handmade = BV_ISSET(fields, 8);
73191 real_packet->allow_ai_type_fallback = BV_ISSET(fields, 9);
73192 real_packet->ruleset_locked = BV_ISSET(fields, 10);
73193 if (BV_ISSET(fields, 11)) {
73194 log_packet_detailed(" got field 'datafile'");
73195#ifdef FREECIV_JSON_CONNECTION
73196 field_addr.name = "datafile";
73197#endif /* FREECIV_JSON_CONNECTION */
73198 if (!DIO_GET(string, &din, &field_addr, real_packet->datafile, sizeof(real_packet->datafile))) {
73199 RECEIVE_PACKET_FIELD_ERROR(datafile);
73200 }
73201 }
73202 real_packet->have_resources = BV_ISSET(fields, 12);
73203 if (BV_ISSET(fields, 13)) {
73204 log_packet_detailed(" got field 'req_caps'");
73205#ifdef FREECIV_JSON_CONNECTION
73206 field_addr.name = "req_caps";
73207#endif /* FREECIV_JSON_CONNECTION */
73208 if (!DIO_GET(string, &din, &field_addr, real_packet->req_caps, sizeof(real_packet->req_caps))) {
73209 RECEIVE_PACKET_FIELD_ERROR(req_caps);
73210 }
73211 }
73212
73213 if (NULL == old) {
73214 old = fc_malloc(sizeof(*old));
73215 *old = *real_packet;
73216 genhash_insert(*hash, old, old);
73217 } else {
73218 *old = *real_packet;
73219 }
73220
73221#endif /* FREECIV_DELTA_PROTOCOL */
73222 RECEIVE_PACKET_END(real_packet);
73223}
73224
73225 static int send_packet_scenario_info_100(struct connection *pc, const struct packet_scenario_info *packet)
73226{
73227 const struct packet_scenario_info *real_packet = packet;
73228 int e;
73229#ifdef FREECIV_DELTA_PROTOCOL
73230 packet_scenario_info_100_fields fields;
73231 struct packet_scenario_info *old;
73232 bool differ;
73233 struct genhash **hash = pc->phs.sent + PACKET_SCENARIO_INFO;
73234#endif /* FREECIV_DELTA_PROTOCOL */
73235 SEND_PACKET_START(PACKET_SCENARIO_INFO);
73236#ifdef FREECIV_JSON_CONNECTION
73237 struct plocation field_addr;
73238 {
73239 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73240 field_addr = *field_addr_tmp;
73241 FC_FREE(field_addr_tmp);
73242 }
73243#endif /* FREECIV_JSON_CONNECTION */
73244
73245 log_packet_detailed("packet_scenario_info_100: sending info about ()");
73246
73247#ifdef FREECIV_DELTA_PROTOCOL
73248 if (NULL == *hash) {
73249 *hash = genhash_new_full(hash_packet_scenario_info_100, cmp_packet_scenario_info_100,
73250 NULL, NULL, NULL, free);
73251 }
73252 BV_CLR_ALL(fields);
73253
73254 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73255 old = fc_malloc(sizeof(*old));
73256 *old = *real_packet;
73257 genhash_insert(*hash, old, old);
73258 memset(old, 0, sizeof(*old));
73259 }
73260 if (packet->is_scenario) {
73261 BV_SET(fields, 0);
73262 }
73263
73264 differ = (strcmp(old->name, real_packet->name) != 0);
73265 if (differ) {
73266 BV_SET(fields, 1);
73267 }
73268
73269 differ = (strcmp(old->authors, real_packet->authors) != 0);
73270 if (differ) {
73271 BV_SET(fields, 2);
73272 }
73273
73274 if (packet->players) {
73275 BV_SET(fields, 3);
73276 }
73277
73278 if (packet->startpos_nations) {
73279 BV_SET(fields, 4);
73280 }
73281
73282 if (packet->save_random) {
73283 BV_SET(fields, 5);
73284 }
73285
73286 if (packet->prevent_new_cities) {
73287 BV_SET(fields, 6);
73288 }
73289
73290 if (packet->lake_flooding) {
73291 BV_SET(fields, 7);
73292 }
73293
73294 if (packet->handmade) {
73295 BV_SET(fields, 8);
73296 }
73297
73298 if (packet->allow_ai_type_fallback) {
73299 BV_SET(fields, 9);
73300 }
73301
73302 if (packet->ruleset_locked) {
73303 BV_SET(fields, 10);
73304 }
73305
73306 differ = (strcmp(old->datafile, real_packet->datafile) != 0);
73307 if (differ) {
73308 BV_SET(fields, 11);
73309 }
73310
73311 if (packet->have_resources) {
73312 BV_SET(fields, 12);
73313 }
73314
73315 differ = (strcmp(old->req_caps, real_packet->req_caps) != 0);
73316 if (differ) {
73317 BV_SET(fields, 13);
73318 }
73319
73320
73321#ifdef FREECIV_JSON_CONNECTION
73322 field_addr.name = "fields";
73323#endif /* FREECIV_JSON_CONNECTION */
73324 e = 0;
73325 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73326 if (e) {
73327 log_packet_detailed("fields bitvector error detected");
73328 }
73329
73330 /* field 0 is folded into the header */
73331 if (BV_ISSET(fields, 1)) {
73332 log_packet_detailed(" field 'name' has changed");
73333#ifdef FREECIV_JSON_CONNECTION
73334 field_addr.name = "name";
73335#endif /* FREECIV_JSON_CONNECTION */
73336 e = 0;
73337 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
73338 if (e) {
73339 log_packet_detailed("'name' field error detected");
73340 }
73341 }
73342 if (BV_ISSET(fields, 2)) {
73343 log_packet_detailed(" field 'authors' has changed");
73344#ifdef FREECIV_JSON_CONNECTION
73345 field_addr.name = "authors";
73346#endif /* FREECIV_JSON_CONNECTION */
73347 e = 0;
73348 e |= DIO_PUT(string, &dout, &field_addr, real_packet->authors);
73349 if (e) {
73350 log_packet_detailed("'authors' field error detected");
73351 }
73352 }
73353 /* field 3 is folded into the header */
73354 /* field 4 is folded into the header */
73355 /* field 5 is folded into the header */
73356 /* field 6 is folded into the header */
73357 /* field 7 is folded into the header */
73358 /* field 8 is folded into the header */
73359 /* field 9 is folded into the header */
73360 /* field 10 is folded into the header */
73361 if (BV_ISSET(fields, 11)) {
73362 log_packet_detailed(" field 'datafile' has changed");
73363#ifdef FREECIV_JSON_CONNECTION
73364 field_addr.name = "datafile";
73365#endif /* FREECIV_JSON_CONNECTION */
73366 e = 0;
73367 e |= DIO_PUT(string, &dout, &field_addr, real_packet->datafile);
73368 if (e) {
73369 log_packet_detailed("'datafile' field error detected");
73370 }
73371 }
73372 /* field 12 is folded into the header */
73373 if (BV_ISSET(fields, 13)) {
73374 log_packet_detailed(" field 'req_caps' has changed");
73375#ifdef FREECIV_JSON_CONNECTION
73376 field_addr.name = "req_caps";
73377#endif /* FREECIV_JSON_CONNECTION */
73378 e = 0;
73379 e |= DIO_PUT(string, &dout, &field_addr, real_packet->req_caps);
73380 if (e) {
73381 log_packet_detailed("'req_caps' field error detected");
73382 }
73383 }
73384
73385 *old = *real_packet;
73386#endif /* FREECIV_DELTA_PROTOCOL */
73387#ifndef FREECIV_DELTA_PROTOCOL
73388#ifdef FREECIV_JSON_CONNECTION
73389 field_addr.name = "is_scenario";
73390#endif /* FREECIV_JSON_CONNECTION */
73391 e = 0;
73392 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_scenario);
73393 if (e) {
73394 log_packet_detailed("'is_scenario' field error detected");
73395 }
73396#ifdef FREECIV_JSON_CONNECTION
73397 field_addr.name = "name";
73398#endif /* FREECIV_JSON_CONNECTION */
73399 e = 0;
73400 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
73401 if (e) {
73402 log_packet_detailed("'name' field error detected");
73403 }
73404#ifdef FREECIV_JSON_CONNECTION
73405 field_addr.name = "authors";
73406#endif /* FREECIV_JSON_CONNECTION */
73407 e = 0;
73408 e |= DIO_PUT(string, &dout, &field_addr, real_packet->authors);
73409 if (e) {
73410 log_packet_detailed("'authors' field error detected");
73411 }
73412#ifdef FREECIV_JSON_CONNECTION
73413 field_addr.name = "players";
73414#endif /* FREECIV_JSON_CONNECTION */
73415 e = 0;
73416 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->players);
73417 if (e) {
73418 log_packet_detailed("'players' field error detected");
73419 }
73420#ifdef FREECIV_JSON_CONNECTION
73421 field_addr.name = "startpos_nations";
73422#endif /* FREECIV_JSON_CONNECTION */
73423 e = 0;
73424 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->startpos_nations);
73425 if (e) {
73426 log_packet_detailed("'startpos_nations' field error detected");
73427 }
73428#ifdef FREECIV_JSON_CONNECTION
73429 field_addr.name = "save_random";
73430#endif /* FREECIV_JSON_CONNECTION */
73431 e = 0;
73432 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->save_random);
73433 if (e) {
73434 log_packet_detailed("'save_random' field error detected");
73435 }
73436#ifdef FREECIV_JSON_CONNECTION
73437 field_addr.name = "prevent_new_cities";
73438#endif /* FREECIV_JSON_CONNECTION */
73439 e = 0;
73440 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->prevent_new_cities);
73441 if (e) {
73442 log_packet_detailed("'prevent_new_cities' field error detected");
73443 }
73444#ifdef FREECIV_JSON_CONNECTION
73445 field_addr.name = "lake_flooding";
73446#endif /* FREECIV_JSON_CONNECTION */
73447 e = 0;
73448 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->lake_flooding);
73449 if (e) {
73450 log_packet_detailed("'lake_flooding' field error detected");
73451 }
73452#ifdef FREECIV_JSON_CONNECTION
73453 field_addr.name = "handmade";
73454#endif /* FREECIV_JSON_CONNECTION */
73455 e = 0;
73456 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->handmade);
73457 if (e) {
73458 log_packet_detailed("'handmade' field error detected");
73459 }
73460#ifdef FREECIV_JSON_CONNECTION
73461 field_addr.name = "allow_ai_type_fallback";
73462#endif /* FREECIV_JSON_CONNECTION */
73463 e = 0;
73464 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->allow_ai_type_fallback);
73465 if (e) {
73466 log_packet_detailed("'allow_ai_type_fallback' field error detected");
73467 }
73468#ifdef FREECIV_JSON_CONNECTION
73469 field_addr.name = "ruleset_locked";
73470#endif /* FREECIV_JSON_CONNECTION */
73471 e = 0;
73472 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->ruleset_locked);
73473 if (e) {
73474 log_packet_detailed("'ruleset_locked' field error detected");
73475 }
73476#ifdef FREECIV_JSON_CONNECTION
73477 field_addr.name = "datafile";
73478#endif /* FREECIV_JSON_CONNECTION */
73479 e = 0;
73480 e |= DIO_PUT(string, &dout, &field_addr, real_packet->datafile);
73481 if (e) {
73482 log_packet_detailed("'datafile' field error detected");
73483 }
73484#ifdef FREECIV_JSON_CONNECTION
73485 field_addr.name = "have_resources";
73486#endif /* FREECIV_JSON_CONNECTION */
73487 e = 0;
73488 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->have_resources);
73489 if (e) {
73490 log_packet_detailed("'have_resources' field error detected");
73491 }
73492#ifdef FREECIV_JSON_CONNECTION
73493 field_addr.name = "req_caps";
73494#endif /* FREECIV_JSON_CONNECTION */
73495 e = 0;
73496 e |= DIO_PUT(string, &dout, &field_addr, real_packet->req_caps);
73497 if (e) {
73498 log_packet_detailed("'req_caps' field error detected");
73499 }
73500
73501#endif
73502 SEND_PACKET_END(PACKET_SCENARIO_INFO);
73503}
73504
73505 int send_packet_scenario_info(struct connection *pc, const struct packet_scenario_info *packet)
73506{
73507 if (!pc->used) {
73508 log_error("WARNING: trying to send data to the closed connection %s",
73509 conn_description(pc));
73510 return -1;
73511 }
73512 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SCENARIO_INFO].packet != NULL, -1,
73513 "Handler for PACKET_SCENARIO_INFO not installed");
73514 return pc->phs.handlers->send[PACKET_SCENARIO_INFO].packet(pc, packet);
73515}
73516
73517#ifdef FREECIV_DELTA_PROTOCOL
73518#define hash_packet_scenario_description_100 hash_const
73519
73520#define cmp_packet_scenario_description_100 cmp_const
73521
73522 BV_DEFINE(packet_scenario_description_100_fields, 1);
73523#endif /* FREECIV_DELTA_PROTOCOL */
73524
73525 static struct packet_scenario_description *receive_packet_scenario_description_100(struct connection *pc)
73526{
73527#ifdef FREECIV_DELTA_PROTOCOL
73528 packet_scenario_description_100_fields fields;
73529 struct packet_scenario_description *old;
73530 struct genhash **hash = pc->phs.received + PACKET_SCENARIO_DESCRIPTION;
73531#endif /* FREECIV_DELTA_PROTOCOL */
73532 RECEIVE_PACKET_START(packet_scenario_description, real_packet);
73533#ifdef FREECIV_JSON_CONNECTION
73534 struct plocation field_addr;
73535 {
73536 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73537 field_addr = *field_addr_tmp;
73538 FC_FREE(field_addr_tmp);
73539 }
73540#endif /* FREECIV_JSON_CONNECTION */
73541
73542#ifdef FREECIV_DELTA_PROTOCOL
73543#ifdef FREECIV_JSON_CONNECTION
73544 field_addr.name = "fields";
73545#endif /* FREECIV_JSON_CONNECTION */
73546 DIO_BV_GET(&din, &field_addr, fields);
73547
73548#else /* FREECIV_DELTA_PROTOCOL */
73549#ifdef FREECIV_JSON_CONNECTION
73550 field_addr.name = "description";
73551#endif /* FREECIV_JSON_CONNECTION */
73552 if (!DIO_GET(string, &din, &field_addr, real_packet->description, sizeof(real_packet->description))) {
73553 RECEIVE_PACKET_FIELD_ERROR(description);
73554 }
73555#endif
73556 log_packet_detailed("packet_scenario_description_100: got info about ()");
73557
73558#ifdef FREECIV_DELTA_PROTOCOL
73559 if (NULL == *hash) {
73560 *hash = genhash_new_full(hash_packet_scenario_description_100, cmp_packet_scenario_description_100,
73561 NULL, NULL, NULL, free);
73562 }
73563
73564 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73565 *real_packet = *old;
73566 } else {
73567 log_packet_detailed(" no old info");
73568 memset(real_packet, 0, sizeof(*real_packet));
73569 }
73570
73571 if (BV_ISSET(fields, 0)) {
73572 log_packet_detailed(" got field 'description'");
73573#ifdef FREECIV_JSON_CONNECTION
73574 field_addr.name = "description";
73575#endif /* FREECIV_JSON_CONNECTION */
73576 if (!DIO_GET(string, &din, &field_addr, real_packet->description, sizeof(real_packet->description))) {
73577 RECEIVE_PACKET_FIELD_ERROR(description);
73578 }
73579 }
73580
73581 if (NULL == old) {
73582 old = fc_malloc(sizeof(*old));
73583 *old = *real_packet;
73584 genhash_insert(*hash, old, old);
73585 } else {
73586 *old = *real_packet;
73587 }
73588
73589#endif /* FREECIV_DELTA_PROTOCOL */
73590 RECEIVE_PACKET_END(real_packet);
73591}
73592
73593 static int send_packet_scenario_description_100(struct connection *pc, const struct packet_scenario_description *packet)
73594{
73595 const struct packet_scenario_description *real_packet = packet;
73596 int e;
73597#ifdef FREECIV_DELTA_PROTOCOL
73598 packet_scenario_description_100_fields fields;
73599 struct packet_scenario_description *old;
73600 bool differ;
73601 struct genhash **hash = pc->phs.sent + PACKET_SCENARIO_DESCRIPTION;
73602#endif /* FREECIV_DELTA_PROTOCOL */
73603 SEND_PACKET_START(PACKET_SCENARIO_DESCRIPTION);
73604#ifdef FREECIV_JSON_CONNECTION
73605 struct plocation field_addr;
73606 {
73607 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73608 field_addr = *field_addr_tmp;
73609 FC_FREE(field_addr_tmp);
73610 }
73611#endif /* FREECIV_JSON_CONNECTION */
73612
73613 log_packet_detailed("packet_scenario_description_100: sending info about ()");
73614
73615#ifdef FREECIV_DELTA_PROTOCOL
73616 if (NULL == *hash) {
73617 *hash = genhash_new_full(hash_packet_scenario_description_100, cmp_packet_scenario_description_100,
73618 NULL, NULL, NULL, free);
73619 }
73620 BV_CLR_ALL(fields);
73621
73622 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73623 old = fc_malloc(sizeof(*old));
73624 *old = *real_packet;
73625 genhash_insert(*hash, old, old);
73626 memset(old, 0, sizeof(*old));
73627 }
73628 differ = (strcmp(old->description, real_packet->description) != 0);
73629 if (differ) {
73630 BV_SET(fields, 0);
73631 }
73632
73633
73634#ifdef FREECIV_JSON_CONNECTION
73635 field_addr.name = "fields";
73636#endif /* FREECIV_JSON_CONNECTION */
73637 e = 0;
73638 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73639 if (e) {
73640 log_packet_detailed("fields bitvector error detected");
73641 }
73642
73643 if (BV_ISSET(fields, 0)) {
73644 log_packet_detailed(" field 'description' has changed");
73645#ifdef FREECIV_JSON_CONNECTION
73646 field_addr.name = "description";
73647#endif /* FREECIV_JSON_CONNECTION */
73648 e = 0;
73649 e |= DIO_PUT(string, &dout, &field_addr, real_packet->description);
73650 if (e) {
73651 log_packet_detailed("'description' field error detected");
73652 }
73653 }
73654
73655 *old = *real_packet;
73656#endif /* FREECIV_DELTA_PROTOCOL */
73657#ifndef FREECIV_DELTA_PROTOCOL
73658#ifdef FREECIV_JSON_CONNECTION
73659 field_addr.name = "description";
73660#endif /* FREECIV_JSON_CONNECTION */
73661 e = 0;
73662 e |= DIO_PUT(string, &dout, &field_addr, real_packet->description);
73663 if (e) {
73664 log_packet_detailed("'description' field error detected");
73665 }
73666
73667#endif
73668 SEND_PACKET_END(PACKET_SCENARIO_DESCRIPTION);
73669}
73670
73671 int send_packet_scenario_description(struct connection *pc, const struct packet_scenario_description *packet)
73672{
73673 if (!pc->used) {
73674 log_error("WARNING: trying to send data to the closed connection %s",
73675 conn_description(pc));
73676 return -1;
73677 }
73678 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SCENARIO_DESCRIPTION].packet != NULL, -1,
73679 "Handler for PACKET_SCENARIO_DESCRIPTION not installed");
73680 return pc->phs.handlers->send[PACKET_SCENARIO_DESCRIPTION].packet(pc, packet);
73681}
73682
73683#ifdef FREECIV_DELTA_PROTOCOL
73684#define hash_packet_save_scenario_100 hash_const
73685
73686#define cmp_packet_save_scenario_100 cmp_const
73687
73688 BV_DEFINE(packet_save_scenario_100_fields, 1);
73689#endif /* FREECIV_DELTA_PROTOCOL */
73690
73691 static struct packet_save_scenario *receive_packet_save_scenario_100(struct connection *pc)
73692{
73693#ifdef FREECIV_DELTA_PROTOCOL
73694 packet_save_scenario_100_fields fields;
73695 struct packet_save_scenario *old;
73696 struct genhash **hash = pc->phs.received + PACKET_SAVE_SCENARIO;
73697#endif /* FREECIV_DELTA_PROTOCOL */
73698 RECEIVE_PACKET_START(packet_save_scenario, real_packet);
73699#ifdef FREECIV_JSON_CONNECTION
73700 struct plocation field_addr;
73701 {
73702 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73703 field_addr = *field_addr_tmp;
73704 FC_FREE(field_addr_tmp);
73705 }
73706#endif /* FREECIV_JSON_CONNECTION */
73707
73708#ifdef FREECIV_DELTA_PROTOCOL
73709#ifdef FREECIV_JSON_CONNECTION
73710 field_addr.name = "fields";
73711#endif /* FREECIV_JSON_CONNECTION */
73712 DIO_BV_GET(&din, &field_addr, fields);
73713
73714#else /* FREECIV_DELTA_PROTOCOL */
73715#ifdef FREECIV_JSON_CONNECTION
73716 field_addr.name = "name";
73717#endif /* FREECIV_JSON_CONNECTION */
73718 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
73719 RECEIVE_PACKET_FIELD_ERROR(name);
73720 }
73721#endif
73722 log_packet_detailed("packet_save_scenario_100: got info about ()");
73723
73724#ifdef FREECIV_DELTA_PROTOCOL
73725 if (NULL == *hash) {
73726 *hash = genhash_new_full(hash_packet_save_scenario_100, cmp_packet_save_scenario_100,
73727 NULL, NULL, NULL, free);
73728 }
73729
73730 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73731 *real_packet = *old;
73732 } else {
73733 log_packet_detailed(" no old info");
73734 memset(real_packet, 0, sizeof(*real_packet));
73735 }
73736
73737 if (BV_ISSET(fields, 0)) {
73738 log_packet_detailed(" got field 'name'");
73739#ifdef FREECIV_JSON_CONNECTION
73740 field_addr.name = "name";
73741#endif /* FREECIV_JSON_CONNECTION */
73742 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
73743 RECEIVE_PACKET_FIELD_ERROR(name);
73744 }
73745 }
73746
73747 if (NULL == old) {
73748 old = fc_malloc(sizeof(*old));
73749 *old = *real_packet;
73750 genhash_insert(*hash, old, old);
73751 } else {
73752 *old = *real_packet;
73753 }
73754
73755#endif /* FREECIV_DELTA_PROTOCOL */
73756 RECEIVE_PACKET_END(real_packet);
73757}
73758
73759 static int send_packet_save_scenario_100(struct connection *pc, const struct packet_save_scenario *packet)
73760{
73761 const struct packet_save_scenario *real_packet = packet;
73762 int e;
73763#ifdef FREECIV_DELTA_PROTOCOL
73764 packet_save_scenario_100_fields fields;
73765 struct packet_save_scenario *old;
73766 bool differ;
73767 struct genhash **hash = pc->phs.sent + PACKET_SAVE_SCENARIO;
73768#endif /* FREECIV_DELTA_PROTOCOL */
73769 SEND_PACKET_START(PACKET_SAVE_SCENARIO);
73770#ifdef FREECIV_JSON_CONNECTION
73771 struct plocation field_addr;
73772 {
73773 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73774 field_addr = *field_addr_tmp;
73775 FC_FREE(field_addr_tmp);
73776 }
73777#endif /* FREECIV_JSON_CONNECTION */
73778
73779 log_packet_detailed("packet_save_scenario_100: sending info about ()");
73780
73781#ifdef FREECIV_DELTA_PROTOCOL
73782 if (NULL == *hash) {
73783 *hash = genhash_new_full(hash_packet_save_scenario_100, cmp_packet_save_scenario_100,
73784 NULL, NULL, NULL, free);
73785 }
73786 BV_CLR_ALL(fields);
73787
73788 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
73789 old = fc_malloc(sizeof(*old));
73790 *old = *real_packet;
73791 genhash_insert(*hash, old, old);
73792 memset(old, 0, sizeof(*old));
73793 }
73794 differ = (strcmp(old->name, real_packet->name) != 0);
73795 if (differ) {
73796 BV_SET(fields, 0);
73797 }
73798
73799
73800#ifdef FREECIV_JSON_CONNECTION
73801 field_addr.name = "fields";
73802#endif /* FREECIV_JSON_CONNECTION */
73803 e = 0;
73804 e |= DIO_BV_PUT(&dout, &field_addr, fields);
73805 if (e) {
73806 log_packet_detailed("fields bitvector error detected");
73807 }
73808
73809 if (BV_ISSET(fields, 0)) {
73810 log_packet_detailed(" field 'name' has changed");
73811#ifdef FREECIV_JSON_CONNECTION
73812 field_addr.name = "name";
73813#endif /* FREECIV_JSON_CONNECTION */
73814 e = 0;
73815 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
73816 if (e) {
73817 log_packet_detailed("'name' field error detected");
73818 }
73819 }
73820
73821 *old = *real_packet;
73822#endif /* FREECIV_DELTA_PROTOCOL */
73823#ifndef FREECIV_DELTA_PROTOCOL
73824#ifdef FREECIV_JSON_CONNECTION
73825 field_addr.name = "name";
73826#endif /* FREECIV_JSON_CONNECTION */
73827 e = 0;
73828 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
73829 if (e) {
73830 log_packet_detailed("'name' field error detected");
73831 }
73832
73833#endif
73834 SEND_PACKET_END(PACKET_SAVE_SCENARIO);
73835}
73836
73837 int send_packet_save_scenario(struct connection *pc, const struct packet_save_scenario *packet)
73838{
73839 if (!pc->used) {
73840 log_error("WARNING: trying to send data to the closed connection %s",
73841 conn_description(pc));
73842 return -1;
73843 }
73844 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_SAVE_SCENARIO].packet != NULL, -1,
73845 "Handler for PACKET_SAVE_SCENARIO not installed");
73846 return pc->phs.handlers->send[PACKET_SAVE_SCENARIO].packet(pc, packet);
73847}
73848
73849 int dsend_packet_save_scenario(struct connection *pc, const char *name)
73850{
73851 struct packet_save_scenario packet, *real_packet = &packet;
73852
73853 sz_strlcpy(real_packet->name, name);
73854
73855 return send_packet_save_scenario(pc, real_packet);
73856}
73857
73858#ifdef FREECIV_DELTA_PROTOCOL
73859#define hash_packet_vote_new_100 hash_const
73860
73861#define cmp_packet_vote_new_100 cmp_const
73862
73863 BV_DEFINE(packet_vote_new_100_fields, 5);
73864#endif /* FREECIV_DELTA_PROTOCOL */
73865
73866 static struct packet_vote_new *receive_packet_vote_new_100(struct connection *pc)
73867{
73868#ifdef FREECIV_DELTA_PROTOCOL
73869 packet_vote_new_100_fields fields;
73870 struct packet_vote_new *old;
73871 struct genhash **hash = pc->phs.received + PACKET_VOTE_NEW;
73872#endif /* FREECIV_DELTA_PROTOCOL */
73873 RECEIVE_PACKET_START(packet_vote_new, real_packet);
73874#ifdef FREECIV_JSON_CONNECTION
73875 struct plocation field_addr;
73876 {
73877 struct plocation *field_addr_tmp = plocation_field_new(NULL);
73878 field_addr = *field_addr_tmp;
73879 FC_FREE(field_addr_tmp);
73880 }
73881#endif /* FREECIV_JSON_CONNECTION */
73882
73883#ifdef FREECIV_DELTA_PROTOCOL
73884#ifdef FREECIV_JSON_CONNECTION
73885 field_addr.name = "fields";
73886#endif /* FREECIV_JSON_CONNECTION */
73887 DIO_BV_GET(&din, &field_addr, fields);
73888
73889#else /* FREECIV_DELTA_PROTOCOL */
73890#ifdef FREECIV_JSON_CONNECTION
73891 field_addr.name = "vote_no";
73892#endif /* FREECIV_JSON_CONNECTION */
73893 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
73894 RECEIVE_PACKET_FIELD_ERROR(vote_no);
73895 }
73896#ifdef FREECIV_JSON_CONNECTION
73897 field_addr.name = "user";
73898#endif /* FREECIV_JSON_CONNECTION */
73899 if (!DIO_GET(string, &din, &field_addr, real_packet->user, sizeof(real_packet->user))) {
73900 RECEIVE_PACKET_FIELD_ERROR(user);
73901 }
73902#ifdef FREECIV_JSON_CONNECTION
73903 field_addr.name = "desc";
73904#endif /* FREECIV_JSON_CONNECTION */
73905 if (!DIO_GET(string, &din, &field_addr, real_packet->desc, sizeof(real_packet->desc))) {
73906 RECEIVE_PACKET_FIELD_ERROR(desc);
73907 }
73908#ifdef FREECIV_JSON_CONNECTION
73909 field_addr.name = "percent_required";
73910#endif /* FREECIV_JSON_CONNECTION */
73911 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->percent_required)) {
73912 RECEIVE_PACKET_FIELD_ERROR(percent_required);
73913 }
73914#ifdef FREECIV_JSON_CONNECTION
73915 field_addr.name = "flags";
73916#endif /* FREECIV_JSON_CONNECTION */
73917 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->flags)) {
73918 RECEIVE_PACKET_FIELD_ERROR(flags);
73919 }
73920#endif
73921 log_packet_detailed("packet_vote_new_100: got info about ()");
73922
73923#ifdef FREECIV_DELTA_PROTOCOL
73924 if (NULL == *hash) {
73925 *hash = genhash_new_full(hash_packet_vote_new_100, cmp_packet_vote_new_100,
73926 NULL, NULL, NULL, free);
73927 }
73928
73929 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
73930 *real_packet = *old;
73931 } else {
73932 log_packet_detailed(" no old info");
73933 memset(real_packet, 0, sizeof(*real_packet));
73934 }
73935
73936 if (BV_ISSET(fields, 0)) {
73937 log_packet_detailed(" got field 'vote_no'");
73938#ifdef FREECIV_JSON_CONNECTION
73939 field_addr.name = "vote_no";
73940#endif /* FREECIV_JSON_CONNECTION */
73941 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
73942 RECEIVE_PACKET_FIELD_ERROR(vote_no);
73943 }
73944 }
73945 if (BV_ISSET(fields, 1)) {
73946 log_packet_detailed(" got field 'user'");
73947#ifdef FREECIV_JSON_CONNECTION
73948 field_addr.name = "user";
73949#endif /* FREECIV_JSON_CONNECTION */
73950 if (!DIO_GET(string, &din, &field_addr, real_packet->user, sizeof(real_packet->user))) {
73951 RECEIVE_PACKET_FIELD_ERROR(user);
73952 }
73953 }
73954 if (BV_ISSET(fields, 2)) {
73955 log_packet_detailed(" got field 'desc'");
73956#ifdef FREECIV_JSON_CONNECTION
73957 field_addr.name = "desc";
73958#endif /* FREECIV_JSON_CONNECTION */
73959 if (!DIO_GET(string, &din, &field_addr, real_packet->desc, sizeof(real_packet->desc))) {
73960 RECEIVE_PACKET_FIELD_ERROR(desc);
73961 }
73962 }
73963 if (BV_ISSET(fields, 3)) {
73964 log_packet_detailed(" got field 'percent_required'");
73965#ifdef FREECIV_JSON_CONNECTION
73966 field_addr.name = "percent_required";
73967#endif /* FREECIV_JSON_CONNECTION */
73968 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->percent_required)) {
73969 RECEIVE_PACKET_FIELD_ERROR(percent_required);
73970 }
73971 }
73972 if (BV_ISSET(fields, 4)) {
73973 log_packet_detailed(" got field 'flags'");
73974#ifdef FREECIV_JSON_CONNECTION
73975 field_addr.name = "flags";
73976#endif /* FREECIV_JSON_CONNECTION */
73977 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->flags)) {
73978 RECEIVE_PACKET_FIELD_ERROR(flags);
73979 }
73980 }
73981
73982 if (NULL == old) {
73983 old = fc_malloc(sizeof(*old));
73984 *old = *real_packet;
73985 genhash_insert(*hash, old, old);
73986 } else {
73987 *old = *real_packet;
73988 }
73989
73990#endif /* FREECIV_DELTA_PROTOCOL */
73991 RECEIVE_PACKET_END(real_packet);
73992}
73993
73994 static int send_packet_vote_new_100(struct connection *pc, const struct packet_vote_new *packet)
73995{
73996 const struct packet_vote_new *real_packet = packet;
73997 int e;
73998#ifdef FREECIV_DELTA_PROTOCOL
73999 packet_vote_new_100_fields fields;
74000 struct packet_vote_new *old;
74001 bool differ;
74002 struct genhash **hash = pc->phs.sent + PACKET_VOTE_NEW;
74003#endif /* FREECIV_DELTA_PROTOCOL */
74004 SEND_PACKET_START(PACKET_VOTE_NEW);
74005#ifdef FREECIV_JSON_CONNECTION
74006 struct plocation field_addr;
74007 {
74008 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74009 field_addr = *field_addr_tmp;
74010 FC_FREE(field_addr_tmp);
74011 }
74012#endif /* FREECIV_JSON_CONNECTION */
74013
74014 log_packet_detailed("packet_vote_new_100: sending info about ()");
74015
74016#ifdef FREECIV_DELTA_PROTOCOL
74017 if (NULL == *hash) {
74018 *hash = genhash_new_full(hash_packet_vote_new_100, cmp_packet_vote_new_100,
74019 NULL, NULL, NULL, free);
74020 }
74021 BV_CLR_ALL(fields);
74022
74023 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74024 old = fc_malloc(sizeof(*old));
74025 *old = *real_packet;
74026 genhash_insert(*hash, old, old);
74027 memset(old, 0, sizeof(*old));
74028 }
74029 differ = (old->vote_no != real_packet->vote_no);
74030 if (differ) {
74031 BV_SET(fields, 0);
74032 }
74033
74034 differ = (strcmp(old->user, real_packet->user) != 0);
74035 if (differ) {
74036 BV_SET(fields, 1);
74037 }
74038
74039 differ = (strcmp(old->desc, real_packet->desc) != 0);
74040 if (differ) {
74041 BV_SET(fields, 2);
74042 }
74043
74044 differ = (old->percent_required != real_packet->percent_required);
74045 if (differ) {
74046 BV_SET(fields, 3);
74047 }
74048
74049 differ = (old->flags != real_packet->flags);
74050 if (differ) {
74051 BV_SET(fields, 4);
74052 }
74053
74054
74055#ifdef FREECIV_JSON_CONNECTION
74056 field_addr.name = "fields";
74057#endif /* FREECIV_JSON_CONNECTION */
74058 e = 0;
74059 e |= DIO_BV_PUT(&dout, &field_addr, fields);
74060 if (e) {
74061 log_packet_detailed("fields bitvector error detected");
74062 }
74063
74064 if (BV_ISSET(fields, 0)) {
74065 log_packet_detailed(" field 'vote_no' has changed");
74066#ifdef FREECIV_JSON_CONNECTION
74067 field_addr.name = "vote_no";
74068#endif /* FREECIV_JSON_CONNECTION */
74069 e = 0;
74070 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74071 if (e) {
74072 log_packet_detailed("'vote_no' field error detected");
74073 }
74074 }
74075 if (BV_ISSET(fields, 1)) {
74076 log_packet_detailed(" field 'user' has changed");
74077#ifdef FREECIV_JSON_CONNECTION
74078 field_addr.name = "user";
74079#endif /* FREECIV_JSON_CONNECTION */
74080 e = 0;
74081 e |= DIO_PUT(string, &dout, &field_addr, real_packet->user);
74082 if (e) {
74083 log_packet_detailed("'user' field error detected");
74084 }
74085 }
74086 if (BV_ISSET(fields, 2)) {
74087 log_packet_detailed(" field 'desc' has changed");
74088#ifdef FREECIV_JSON_CONNECTION
74089 field_addr.name = "desc";
74090#endif /* FREECIV_JSON_CONNECTION */
74091 e = 0;
74092 e |= DIO_PUT(string, &dout, &field_addr, real_packet->desc);
74093 if (e) {
74094 log_packet_detailed("'desc' field error detected");
74095 }
74096 }
74097 if (BV_ISSET(fields, 3)) {
74098 log_packet_detailed(" field 'percent_required' has changed");
74099#ifdef FREECIV_JSON_CONNECTION
74100 field_addr.name = "percent_required";
74101#endif /* FREECIV_JSON_CONNECTION */
74102 e = 0;
74103 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->percent_required);
74104 if (e) {
74105 log_packet_detailed("'percent_required' field error detected");
74106 }
74107 }
74108 if (BV_ISSET(fields, 4)) {
74109 log_packet_detailed(" field 'flags' has changed");
74110#ifdef FREECIV_JSON_CONNECTION
74111 field_addr.name = "flags";
74112#endif /* FREECIV_JSON_CONNECTION */
74113 e = 0;
74114 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->flags);
74115 if (e) {
74116 log_packet_detailed("'flags' field error detected");
74117 }
74118 }
74119
74120 *old = *real_packet;
74121#endif /* FREECIV_DELTA_PROTOCOL */
74122#ifndef FREECIV_DELTA_PROTOCOL
74123#ifdef FREECIV_JSON_CONNECTION
74124 field_addr.name = "vote_no";
74125#endif /* FREECIV_JSON_CONNECTION */
74126 e = 0;
74127 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74128 if (e) {
74129 log_packet_detailed("'vote_no' field error detected");
74130 }
74131#ifdef FREECIV_JSON_CONNECTION
74132 field_addr.name = "user";
74133#endif /* FREECIV_JSON_CONNECTION */
74134 e = 0;
74135 e |= DIO_PUT(string, &dout, &field_addr, real_packet->user);
74136 if (e) {
74137 log_packet_detailed("'user' field error detected");
74138 }
74139#ifdef FREECIV_JSON_CONNECTION
74140 field_addr.name = "desc";
74141#endif /* FREECIV_JSON_CONNECTION */
74142 e = 0;
74143 e |= DIO_PUT(string, &dout, &field_addr, real_packet->desc);
74144 if (e) {
74145 log_packet_detailed("'desc' field error detected");
74146 }
74147#ifdef FREECIV_JSON_CONNECTION
74148 field_addr.name = "percent_required";
74149#endif /* FREECIV_JSON_CONNECTION */
74150 e = 0;
74151 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->percent_required);
74152 if (e) {
74153 log_packet_detailed("'percent_required' field error detected");
74154 }
74155#ifdef FREECIV_JSON_CONNECTION
74156 field_addr.name = "flags";
74157#endif /* FREECIV_JSON_CONNECTION */
74158 e = 0;
74159 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->flags);
74160 if (e) {
74161 log_packet_detailed("'flags' field error detected");
74162 }
74163
74164#endif
74165 SEND_PACKET_END(PACKET_VOTE_NEW);
74166}
74167
74168 int send_packet_vote_new(struct connection *pc, const struct packet_vote_new *packet)
74169{
74170 if (!pc->used) {
74171 log_error("WARNING: trying to send data to the closed connection %s",
74172 conn_description(pc));
74173 return -1;
74174 }
74175 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_NEW].packet != NULL, -1,
74176 "Handler for PACKET_VOTE_NEW not installed");
74177 return pc->phs.handlers->send[PACKET_VOTE_NEW].packet(pc, packet);
74178}
74179
74180#ifdef FREECIV_DELTA_PROTOCOL
74181static genhash_val_t hash_packet_vote_update_100(const void *vkey)
74182{
74183 const struct packet_vote_update *key = (const struct packet_vote_update *) vkey;
74184 genhash_val_t result = 0;
74185
74186 result += key->vote_no;
74187
74188 result &= 0xFFFFFFFF;
74189 return result;
74190}
74191
74192static bool cmp_packet_vote_update_100(const void *vkey1, const void *vkey2)
74193{
74194 const struct packet_vote_update *old = (const struct packet_vote_update *) vkey1;
74195 const struct packet_vote_update *real_packet = (const struct packet_vote_update *) vkey2;
74196 bool differ;
74197
74198 differ = (old->vote_no != real_packet->vote_no);
74199
74200 return !differ;
74201}
74202 BV_DEFINE(packet_vote_update_100_fields, 4);
74203#endif /* FREECIV_DELTA_PROTOCOL */
74204
74205 static struct packet_vote_update *receive_packet_vote_update_100(struct connection *pc)
74206{
74207#ifdef FREECIV_DELTA_PROTOCOL
74208 packet_vote_update_100_fields fields;
74209 struct packet_vote_update *old;
74210 struct genhash **hash = pc->phs.received + PACKET_VOTE_UPDATE;
74211#endif /* FREECIV_DELTA_PROTOCOL */
74212 RECEIVE_PACKET_START(packet_vote_update, real_packet);
74213#ifdef FREECIV_JSON_CONNECTION
74214 struct plocation field_addr;
74215 {
74216 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74217 field_addr = *field_addr_tmp;
74218 FC_FREE(field_addr_tmp);
74219 }
74220#endif /* FREECIV_JSON_CONNECTION */
74221
74222#ifdef FREECIV_DELTA_PROTOCOL
74223#ifdef FREECIV_JSON_CONNECTION
74224 field_addr.name = "fields";
74225#endif /* FREECIV_JSON_CONNECTION */
74226 DIO_BV_GET(&din, &field_addr, fields);
74227#ifdef FREECIV_JSON_CONNECTION
74228 field_addr.name = "vote_no";
74229#endif /* FREECIV_JSON_CONNECTION */
74230 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
74231 RECEIVE_PACKET_FIELD_ERROR(vote_no);
74232 }
74233
74234#else /* FREECIV_DELTA_PROTOCOL */
74235#ifdef FREECIV_JSON_CONNECTION
74236 field_addr.name = "vote_no";
74237#endif /* FREECIV_JSON_CONNECTION */
74238 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
74239 RECEIVE_PACKET_FIELD_ERROR(vote_no);
74240 }
74241#ifdef FREECIV_JSON_CONNECTION
74242 field_addr.name = "yes";
74243#endif /* FREECIV_JSON_CONNECTION */
74244 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->yes)) {
74245 RECEIVE_PACKET_FIELD_ERROR(yes);
74246 }
74247#ifdef FREECIV_JSON_CONNECTION
74248 field_addr.name = "no";
74249#endif /* FREECIV_JSON_CONNECTION */
74250 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->no)) {
74251 RECEIVE_PACKET_FIELD_ERROR(no);
74252 }
74253#ifdef FREECIV_JSON_CONNECTION
74254 field_addr.name = "abstain";
74255#endif /* FREECIV_JSON_CONNECTION */
74256 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->abstain)) {
74257 RECEIVE_PACKET_FIELD_ERROR(abstain);
74258 }
74259#ifdef FREECIV_JSON_CONNECTION
74260 field_addr.name = "num_voters";
74261#endif /* FREECIV_JSON_CONNECTION */
74262 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_voters)) {
74263 RECEIVE_PACKET_FIELD_ERROR(num_voters);
74264 }
74265#endif
74266 log_packet_detailed("packet_vote_update_100: got info about (%d)",
74267 real_packet->vote_no);
74268
74269#ifdef FREECIV_DELTA_PROTOCOL
74270 if (NULL == *hash) {
74271 *hash = genhash_new_full(hash_packet_vote_update_100, cmp_packet_vote_update_100,
74272 NULL, NULL, NULL, free);
74273 }
74274
74275 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74276 *real_packet = *old;
74277 } else {
74278 int vote_no;
74279
74280 vote_no = real_packet->vote_no;
74281
74282 log_packet_detailed(" no old info");
74283 memset(real_packet, 0, sizeof(*real_packet));
74284
74285 real_packet->vote_no = vote_no;
74286 }
74287
74288 if (BV_ISSET(fields, 0)) {
74289 log_packet_detailed(" got field 'yes'");
74290#ifdef FREECIV_JSON_CONNECTION
74291 field_addr.name = "yes";
74292#endif /* FREECIV_JSON_CONNECTION */
74293 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->yes)) {
74294 RECEIVE_PACKET_FIELD_ERROR(yes);
74295 }
74296 }
74297 if (BV_ISSET(fields, 1)) {
74298 log_packet_detailed(" got field 'no'");
74299#ifdef FREECIV_JSON_CONNECTION
74300 field_addr.name = "no";
74301#endif /* FREECIV_JSON_CONNECTION */
74302 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->no)) {
74303 RECEIVE_PACKET_FIELD_ERROR(no);
74304 }
74305 }
74306 if (BV_ISSET(fields, 2)) {
74307 log_packet_detailed(" got field 'abstain'");
74308#ifdef FREECIV_JSON_CONNECTION
74309 field_addr.name = "abstain";
74310#endif /* FREECIV_JSON_CONNECTION */
74311 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->abstain)) {
74312 RECEIVE_PACKET_FIELD_ERROR(abstain);
74313 }
74314 }
74315 if (BV_ISSET(fields, 3)) {
74316 log_packet_detailed(" got field 'num_voters'");
74317#ifdef FREECIV_JSON_CONNECTION
74318 field_addr.name = "num_voters";
74319#endif /* FREECIV_JSON_CONNECTION */
74320 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->num_voters)) {
74321 RECEIVE_PACKET_FIELD_ERROR(num_voters);
74322 }
74323 }
74324
74325 if (NULL == old) {
74326 old = fc_malloc(sizeof(*old));
74327 *old = *real_packet;
74328 genhash_insert(*hash, old, old);
74329 } else {
74330 *old = *real_packet;
74331 }
74332
74333#endif /* FREECIV_DELTA_PROTOCOL */
74334 RECEIVE_PACKET_END(real_packet);
74335}
74336
74337 static int send_packet_vote_update_100(struct connection *pc, const struct packet_vote_update *packet)
74338{
74339 const struct packet_vote_update *real_packet = packet;
74340 int e;
74341#ifdef FREECIV_DELTA_PROTOCOL
74342 packet_vote_update_100_fields fields;
74343 struct packet_vote_update *old;
74344 bool differ;
74345 struct genhash **hash = pc->phs.sent + PACKET_VOTE_UPDATE;
74346 int different = 0;
74347#endif /* FREECIV_DELTA_PROTOCOL */
74348 SEND_PACKET_START(PACKET_VOTE_UPDATE);
74349#ifdef FREECIV_JSON_CONNECTION
74350 struct plocation field_addr;
74351 {
74352 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74353 field_addr = *field_addr_tmp;
74354 FC_FREE(field_addr_tmp);
74355 }
74356#endif /* FREECIV_JSON_CONNECTION */
74357
74358 log_packet_detailed("packet_vote_update_100: sending info about (%d)",
74359 real_packet->vote_no);
74360
74361#ifdef FREECIV_DELTA_PROTOCOL
74362 if (NULL == *hash) {
74363 *hash = genhash_new_full(hash_packet_vote_update_100, cmp_packet_vote_update_100,
74364 NULL, NULL, NULL, free);
74365 }
74366 BV_CLR_ALL(fields);
74367
74368 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74369 old = fc_malloc(sizeof(*old));
74370 *old = *real_packet;
74371 genhash_insert(*hash, old, old);
74372 memset(old, 0, sizeof(*old));
74373 different = 1; /* Force to send. */
74374 }
74375 differ = (old->yes != real_packet->yes);
74376 if (differ) {
74377 different++;
74378 BV_SET(fields, 0);
74379 }
74380
74381 differ = (old->no != real_packet->no);
74382 if (differ) {
74383 different++;
74384 BV_SET(fields, 1);
74385 }
74386
74387 differ = (old->abstain != real_packet->abstain);
74388 if (differ) {
74389 different++;
74390 BV_SET(fields, 2);
74391 }
74392
74393 differ = (old->num_voters != real_packet->num_voters);
74394 if (differ) {
74395 different++;
74396 BV_SET(fields, 3);
74397 }
74398
74399 if (different == 0) {
74400 log_packet_detailed(" no change -> discard");
74401 return 0;
74402 }
74403
74404#ifdef FREECIV_JSON_CONNECTION
74405 field_addr.name = "fields";
74406#endif /* FREECIV_JSON_CONNECTION */
74407 e = 0;
74408 e |= DIO_BV_PUT(&dout, &field_addr, fields);
74409 if (e) {
74410 log_packet_detailed("fields bitvector error detected");
74411 }
74412#ifdef FREECIV_JSON_CONNECTION
74413 field_addr.name = "vote_no";
74414#endif /* FREECIV_JSON_CONNECTION */
74415 e = 0;
74416 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74417 if (e) {
74418 log_packet_detailed("'vote_no' field error detected");
74419 }
74420
74421 if (BV_ISSET(fields, 0)) {
74422 log_packet_detailed(" field 'yes' has changed");
74423#ifdef FREECIV_JSON_CONNECTION
74424 field_addr.name = "yes";
74425#endif /* FREECIV_JSON_CONNECTION */
74426 e = 0;
74427 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->yes);
74428 if (e) {
74429 log_packet_detailed("'yes' field error detected");
74430 }
74431 }
74432 if (BV_ISSET(fields, 1)) {
74433 log_packet_detailed(" field 'no' has changed");
74434#ifdef FREECIV_JSON_CONNECTION
74435 field_addr.name = "no";
74436#endif /* FREECIV_JSON_CONNECTION */
74437 e = 0;
74438 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->no);
74439 if (e) {
74440 log_packet_detailed("'no' field error detected");
74441 }
74442 }
74443 if (BV_ISSET(fields, 2)) {
74444 log_packet_detailed(" field 'abstain' has changed");
74445#ifdef FREECIV_JSON_CONNECTION
74446 field_addr.name = "abstain";
74447#endif /* FREECIV_JSON_CONNECTION */
74448 e = 0;
74449 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->abstain);
74450 if (e) {
74451 log_packet_detailed("'abstain' field error detected");
74452 }
74453 }
74454 if (BV_ISSET(fields, 3)) {
74455 log_packet_detailed(" field 'num_voters' has changed");
74456#ifdef FREECIV_JSON_CONNECTION
74457 field_addr.name = "num_voters";
74458#endif /* FREECIV_JSON_CONNECTION */
74459 e = 0;
74460 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_voters);
74461 if (e) {
74462 log_packet_detailed("'num_voters' field error detected");
74463 }
74464 }
74465
74466 *old = *real_packet;
74467#endif /* FREECIV_DELTA_PROTOCOL */
74468#ifndef FREECIV_DELTA_PROTOCOL
74469#ifdef FREECIV_JSON_CONNECTION
74470 field_addr.name = "vote_no";
74471#endif /* FREECIV_JSON_CONNECTION */
74472 e = 0;
74473 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74474 if (e) {
74475 log_packet_detailed("'vote_no' field error detected");
74476 }
74477#ifdef FREECIV_JSON_CONNECTION
74478 field_addr.name = "yes";
74479#endif /* FREECIV_JSON_CONNECTION */
74480 e = 0;
74481 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->yes);
74482 if (e) {
74483 log_packet_detailed("'yes' field error detected");
74484 }
74485#ifdef FREECIV_JSON_CONNECTION
74486 field_addr.name = "no";
74487#endif /* FREECIV_JSON_CONNECTION */
74488 e = 0;
74489 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->no);
74490 if (e) {
74491 log_packet_detailed("'no' field error detected");
74492 }
74493#ifdef FREECIV_JSON_CONNECTION
74494 field_addr.name = "abstain";
74495#endif /* FREECIV_JSON_CONNECTION */
74496 e = 0;
74497 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->abstain);
74498 if (e) {
74499 log_packet_detailed("'abstain' field error detected");
74500 }
74501#ifdef FREECIV_JSON_CONNECTION
74502 field_addr.name = "num_voters";
74503#endif /* FREECIV_JSON_CONNECTION */
74504 e = 0;
74505 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->num_voters);
74506 if (e) {
74507 log_packet_detailed("'num_voters' field error detected");
74508 }
74509
74510#endif
74511 SEND_PACKET_END(PACKET_VOTE_UPDATE);
74512}
74513
74514 int send_packet_vote_update(struct connection *pc, const struct packet_vote_update *packet)
74515{
74516 if (!pc->used) {
74517 log_error("WARNING: trying to send data to the closed connection %s",
74518 conn_description(pc));
74519 return -1;
74520 }
74521 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_UPDATE].packet != NULL, -1,
74522 "Handler for PACKET_VOTE_UPDATE not installed");
74523 return pc->phs.handlers->send[PACKET_VOTE_UPDATE].packet(pc, packet);
74524}
74525
74526#ifdef FREECIV_DELTA_PROTOCOL
74527#define hash_packet_vote_remove_100 hash_const
74528
74529#define cmp_packet_vote_remove_100 cmp_const
74530
74531 BV_DEFINE(packet_vote_remove_100_fields, 1);
74532#endif /* FREECIV_DELTA_PROTOCOL */
74533
74534 static struct packet_vote_remove *receive_packet_vote_remove_100(struct connection *pc)
74535{
74536#ifdef FREECIV_DELTA_PROTOCOL
74537 packet_vote_remove_100_fields fields;
74538 struct packet_vote_remove *old;
74539 struct genhash **hash = pc->phs.received + PACKET_VOTE_REMOVE;
74540#endif /* FREECIV_DELTA_PROTOCOL */
74541 RECEIVE_PACKET_START(packet_vote_remove, real_packet);
74542#ifdef FREECIV_JSON_CONNECTION
74543 struct plocation field_addr;
74544 {
74545 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74546 field_addr = *field_addr_tmp;
74547 FC_FREE(field_addr_tmp);
74548 }
74549#endif /* FREECIV_JSON_CONNECTION */
74550
74551#ifdef FREECIV_DELTA_PROTOCOL
74552#ifdef FREECIV_JSON_CONNECTION
74553 field_addr.name = "fields";
74554#endif /* FREECIV_JSON_CONNECTION */
74555 DIO_BV_GET(&din, &field_addr, fields);
74556
74557#else /* FREECIV_DELTA_PROTOCOL */
74558#ifdef FREECIV_JSON_CONNECTION
74559 field_addr.name = "vote_no";
74560#endif /* FREECIV_JSON_CONNECTION */
74561 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
74562 RECEIVE_PACKET_FIELD_ERROR(vote_no);
74563 }
74564#endif
74565 log_packet_detailed("packet_vote_remove_100: got info about ()");
74566
74567#ifdef FREECIV_DELTA_PROTOCOL
74568 if (NULL == *hash) {
74569 *hash = genhash_new_full(hash_packet_vote_remove_100, cmp_packet_vote_remove_100,
74570 NULL, NULL, NULL, free);
74571 }
74572
74573 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74574 *real_packet = *old;
74575 } else {
74576 log_packet_detailed(" no old info");
74577 memset(real_packet, 0, sizeof(*real_packet));
74578 }
74579
74580 if (BV_ISSET(fields, 0)) {
74581 log_packet_detailed(" got field 'vote_no'");
74582#ifdef FREECIV_JSON_CONNECTION
74583 field_addr.name = "vote_no";
74584#endif /* FREECIV_JSON_CONNECTION */
74585 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
74586 RECEIVE_PACKET_FIELD_ERROR(vote_no);
74587 }
74588 }
74589
74590 if (NULL == old) {
74591 old = fc_malloc(sizeof(*old));
74592 *old = *real_packet;
74593 genhash_insert(*hash, old, old);
74594 } else {
74595 *old = *real_packet;
74596 }
74597
74598#endif /* FREECIV_DELTA_PROTOCOL */
74599 RECEIVE_PACKET_END(real_packet);
74600}
74601
74602 static int send_packet_vote_remove_100(struct connection *pc, const struct packet_vote_remove *packet)
74603{
74604 const struct packet_vote_remove *real_packet = packet;
74605 int e;
74606#ifdef FREECIV_DELTA_PROTOCOL
74607 packet_vote_remove_100_fields fields;
74608 struct packet_vote_remove *old;
74609 bool differ;
74610 struct genhash **hash = pc->phs.sent + PACKET_VOTE_REMOVE;
74611#endif /* FREECIV_DELTA_PROTOCOL */
74612 SEND_PACKET_START(PACKET_VOTE_REMOVE);
74613#ifdef FREECIV_JSON_CONNECTION
74614 struct plocation field_addr;
74615 {
74616 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74617 field_addr = *field_addr_tmp;
74618 FC_FREE(field_addr_tmp);
74619 }
74620#endif /* FREECIV_JSON_CONNECTION */
74621
74622 log_packet_detailed("packet_vote_remove_100: sending info about ()");
74623
74624#ifdef FREECIV_DELTA_PROTOCOL
74625 if (NULL == *hash) {
74626 *hash = genhash_new_full(hash_packet_vote_remove_100, cmp_packet_vote_remove_100,
74627 NULL, NULL, NULL, free);
74628 }
74629 BV_CLR_ALL(fields);
74630
74631 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74632 old = fc_malloc(sizeof(*old));
74633 *old = *real_packet;
74634 genhash_insert(*hash, old, old);
74635 memset(old, 0, sizeof(*old));
74636 }
74637 differ = (old->vote_no != real_packet->vote_no);
74638 if (differ) {
74639 BV_SET(fields, 0);
74640 }
74641
74642
74643#ifdef FREECIV_JSON_CONNECTION
74644 field_addr.name = "fields";
74645#endif /* FREECIV_JSON_CONNECTION */
74646 e = 0;
74647 e |= DIO_BV_PUT(&dout, &field_addr, fields);
74648 if (e) {
74649 log_packet_detailed("fields bitvector error detected");
74650 }
74651
74652 if (BV_ISSET(fields, 0)) {
74653 log_packet_detailed(" field 'vote_no' has changed");
74654#ifdef FREECIV_JSON_CONNECTION
74655 field_addr.name = "vote_no";
74656#endif /* FREECIV_JSON_CONNECTION */
74657 e = 0;
74658 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74659 if (e) {
74660 log_packet_detailed("'vote_no' field error detected");
74661 }
74662 }
74663
74664 *old = *real_packet;
74665#endif /* FREECIV_DELTA_PROTOCOL */
74666#ifndef FREECIV_DELTA_PROTOCOL
74667#ifdef FREECIV_JSON_CONNECTION
74668 field_addr.name = "vote_no";
74669#endif /* FREECIV_JSON_CONNECTION */
74670 e = 0;
74671 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74672 if (e) {
74673 log_packet_detailed("'vote_no' field error detected");
74674 }
74675
74676#endif
74677 SEND_PACKET_END(PACKET_VOTE_REMOVE);
74678}
74679
74680 int send_packet_vote_remove(struct connection *pc, const struct packet_vote_remove *packet)
74681{
74682 if (!pc->used) {
74683 log_error("WARNING: trying to send data to the closed connection %s",
74684 conn_description(pc));
74685 return -1;
74686 }
74687 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_REMOVE].packet != NULL, -1,
74688 "Handler for PACKET_VOTE_REMOVE not installed");
74689 return pc->phs.handlers->send[PACKET_VOTE_REMOVE].packet(pc, packet);
74690}
74691
74692#ifdef FREECIV_DELTA_PROTOCOL
74693#define hash_packet_vote_resolve_100 hash_const
74694
74695#define cmp_packet_vote_resolve_100 cmp_const
74696
74697 BV_DEFINE(packet_vote_resolve_100_fields, 2);
74698#endif /* FREECIV_DELTA_PROTOCOL */
74699
74700 static struct packet_vote_resolve *receive_packet_vote_resolve_100(struct connection *pc)
74701{
74702#ifdef FREECIV_DELTA_PROTOCOL
74703 packet_vote_resolve_100_fields fields;
74704 struct packet_vote_resolve *old;
74705 struct genhash **hash = pc->phs.received + PACKET_VOTE_RESOLVE;
74706#endif /* FREECIV_DELTA_PROTOCOL */
74707 RECEIVE_PACKET_START(packet_vote_resolve, real_packet);
74708#ifdef FREECIV_JSON_CONNECTION
74709 struct plocation field_addr;
74710 {
74711 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74712 field_addr = *field_addr_tmp;
74713 FC_FREE(field_addr_tmp);
74714 }
74715#endif /* FREECIV_JSON_CONNECTION */
74716
74717#ifdef FREECIV_DELTA_PROTOCOL
74718#ifdef FREECIV_JSON_CONNECTION
74719 field_addr.name = "fields";
74720#endif /* FREECIV_JSON_CONNECTION */
74721 DIO_BV_GET(&din, &field_addr, fields);
74722
74723#else /* FREECIV_DELTA_PROTOCOL */
74724#ifdef FREECIV_JSON_CONNECTION
74725 field_addr.name = "vote_no";
74726#endif /* FREECIV_JSON_CONNECTION */
74727 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
74728 RECEIVE_PACKET_FIELD_ERROR(vote_no);
74729 }
74730#ifdef FREECIV_JSON_CONNECTION
74731 field_addr.name = "passed";
74732#endif /* FREECIV_JSON_CONNECTION */
74733 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->passed)) {
74734 RECEIVE_PACKET_FIELD_ERROR(passed);
74735 }
74736#endif
74737 log_packet_detailed("packet_vote_resolve_100: got info about ()");
74738
74739#ifdef FREECIV_DELTA_PROTOCOL
74740 if (NULL == *hash) {
74741 *hash = genhash_new_full(hash_packet_vote_resolve_100, cmp_packet_vote_resolve_100,
74742 NULL, NULL, NULL, free);
74743 }
74744
74745 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
74746 *real_packet = *old;
74747 } else {
74748 log_packet_detailed(" no old info");
74749 memset(real_packet, 0, sizeof(*real_packet));
74750 }
74751
74752 if (BV_ISSET(fields, 0)) {
74753 log_packet_detailed(" got field 'vote_no'");
74754#ifdef FREECIV_JSON_CONNECTION
74755 field_addr.name = "vote_no";
74756#endif /* FREECIV_JSON_CONNECTION */
74757 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
74758 RECEIVE_PACKET_FIELD_ERROR(vote_no);
74759 }
74760 }
74761 real_packet->passed = BV_ISSET(fields, 1);
74762
74763 if (NULL == old) {
74764 old = fc_malloc(sizeof(*old));
74765 *old = *real_packet;
74766 genhash_insert(*hash, old, old);
74767 } else {
74768 *old = *real_packet;
74769 }
74770
74771#endif /* FREECIV_DELTA_PROTOCOL */
74772 RECEIVE_PACKET_END(real_packet);
74773}
74774
74775 static int send_packet_vote_resolve_100(struct connection *pc, const struct packet_vote_resolve *packet)
74776{
74777 const struct packet_vote_resolve *real_packet = packet;
74778 int e;
74779#ifdef FREECIV_DELTA_PROTOCOL
74780 packet_vote_resolve_100_fields fields;
74781 struct packet_vote_resolve *old;
74782 bool differ;
74783 struct genhash **hash = pc->phs.sent + PACKET_VOTE_RESOLVE;
74784#endif /* FREECIV_DELTA_PROTOCOL */
74785 SEND_PACKET_START(PACKET_VOTE_RESOLVE);
74786#ifdef FREECIV_JSON_CONNECTION
74787 struct plocation field_addr;
74788 {
74789 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74790 field_addr = *field_addr_tmp;
74791 FC_FREE(field_addr_tmp);
74792 }
74793#endif /* FREECIV_JSON_CONNECTION */
74794
74795 log_packet_detailed("packet_vote_resolve_100: sending info about ()");
74796
74797#ifdef FREECIV_DELTA_PROTOCOL
74798 if (NULL == *hash) {
74799 *hash = genhash_new_full(hash_packet_vote_resolve_100, cmp_packet_vote_resolve_100,
74800 NULL, NULL, NULL, free);
74801 }
74802 BV_CLR_ALL(fields);
74803
74804 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
74805 old = fc_malloc(sizeof(*old));
74806 *old = *real_packet;
74807 genhash_insert(*hash, old, old);
74808 memset(old, 0, sizeof(*old));
74809 }
74810 differ = (old->vote_no != real_packet->vote_no);
74811 if (differ) {
74812 BV_SET(fields, 0);
74813 }
74814
74815 if (packet->passed) {
74816 BV_SET(fields, 1);
74817 }
74818
74819
74820#ifdef FREECIV_JSON_CONNECTION
74821 field_addr.name = "fields";
74822#endif /* FREECIV_JSON_CONNECTION */
74823 e = 0;
74824 e |= DIO_BV_PUT(&dout, &field_addr, fields);
74825 if (e) {
74826 log_packet_detailed("fields bitvector error detected");
74827 }
74828
74829 if (BV_ISSET(fields, 0)) {
74830 log_packet_detailed(" field 'vote_no' has changed");
74831#ifdef FREECIV_JSON_CONNECTION
74832 field_addr.name = "vote_no";
74833#endif /* FREECIV_JSON_CONNECTION */
74834 e = 0;
74835 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74836 if (e) {
74837 log_packet_detailed("'vote_no' field error detected");
74838 }
74839 }
74840 /* field 1 is folded into the header */
74841
74842 *old = *real_packet;
74843#endif /* FREECIV_DELTA_PROTOCOL */
74844#ifndef FREECIV_DELTA_PROTOCOL
74845#ifdef FREECIV_JSON_CONNECTION
74846 field_addr.name = "vote_no";
74847#endif /* FREECIV_JSON_CONNECTION */
74848 e = 0;
74849 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74850 if (e) {
74851 log_packet_detailed("'vote_no' field error detected");
74852 }
74853#ifdef FREECIV_JSON_CONNECTION
74854 field_addr.name = "passed";
74855#endif /* FREECIV_JSON_CONNECTION */
74856 e = 0;
74857 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->passed);
74858 if (e) {
74859 log_packet_detailed("'passed' field error detected");
74860 }
74861
74862#endif
74863 SEND_PACKET_END(PACKET_VOTE_RESOLVE);
74864}
74865
74866 int send_packet_vote_resolve(struct connection *pc, const struct packet_vote_resolve *packet)
74867{
74868 if (!pc->used) {
74869 log_error("WARNING: trying to send data to the closed connection %s",
74870 conn_description(pc));
74871 return -1;
74872 }
74873 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_RESOLVE].packet != NULL, -1,
74874 "Handler for PACKET_VOTE_RESOLVE not installed");
74875 return pc->phs.handlers->send[PACKET_VOTE_RESOLVE].packet(pc, packet);
74876}
74877
74878 static struct packet_vote_submit *receive_packet_vote_submit_100(struct connection *pc)
74879{
74880 RECEIVE_PACKET_START(packet_vote_submit, real_packet);
74881#ifdef FREECIV_JSON_CONNECTION
74882 struct plocation field_addr;
74883 {
74884 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74885 field_addr = *field_addr_tmp;
74886 FC_FREE(field_addr_tmp);
74887 }
74888#endif /* FREECIV_JSON_CONNECTION */
74889#if 1 /* To match endif */
74890#ifdef FREECIV_JSON_CONNECTION
74891 field_addr.name = "vote_no";
74892#endif /* FREECIV_JSON_CONNECTION */
74893 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->vote_no)) {
74894 RECEIVE_PACKET_FIELD_ERROR(vote_no);
74895 }
74896#ifdef FREECIV_JSON_CONNECTION
74897 field_addr.name = "value";
74898#endif /* FREECIV_JSON_CONNECTION */
74899 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->value)) {
74900 RECEIVE_PACKET_FIELD_ERROR(value);
74901 }
74902#endif
74903 log_packet_detailed("packet_vote_submit_100: got info about ()");
74904 RECEIVE_PACKET_END(real_packet);
74905}
74906
74907 static int send_packet_vote_submit_100(struct connection *pc, const struct packet_vote_submit *packet)
74908{
74909 const struct packet_vote_submit *real_packet = packet;
74910 int e;
74911 SEND_PACKET_START(PACKET_VOTE_SUBMIT);
74912#ifdef FREECIV_JSON_CONNECTION
74913 struct plocation field_addr;
74914 {
74915 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74916 field_addr = *field_addr_tmp;
74917 FC_FREE(field_addr_tmp);
74918 }
74919#endif /* FREECIV_JSON_CONNECTION */
74920
74921 log_packet_detailed("packet_vote_submit_100: sending info about ()");
74922#if 1 /* To match endif */
74923#ifdef FREECIV_JSON_CONNECTION
74924 field_addr.name = "vote_no";
74925#endif /* FREECIV_JSON_CONNECTION */
74926 e = 0;
74927 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->vote_no);
74928 if (e) {
74929 log_packet_detailed("'vote_no' field error detected");
74930 }
74931#ifdef FREECIV_JSON_CONNECTION
74932 field_addr.name = "value";
74933#endif /* FREECIV_JSON_CONNECTION */
74934 e = 0;
74935 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->value);
74936 if (e) {
74937 log_packet_detailed("'value' field error detected");
74938 }
74939
74940#endif
74941 SEND_PACKET_END(PACKET_VOTE_SUBMIT);
74942}
74943
74944 int send_packet_vote_submit(struct connection *pc, const struct packet_vote_submit *packet)
74945{
74946 if (!pc->used) {
74947 log_error("WARNING: trying to send data to the closed connection %s",
74948 conn_description(pc));
74949 return -1;
74950 }
74951 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_VOTE_SUBMIT].packet != NULL, -1,
74952 "Handler for PACKET_VOTE_SUBMIT not installed");
74953 return pc->phs.handlers->send[PACKET_VOTE_SUBMIT].packet(pc, packet);
74954}
74955
74956#ifdef FREECIV_DELTA_PROTOCOL
74957#define hash_packet_edit_mode_100 hash_const
74958
74959#define cmp_packet_edit_mode_100 cmp_const
74960
74961 BV_DEFINE(packet_edit_mode_100_fields, 1);
74962#endif /* FREECIV_DELTA_PROTOCOL */
74963
74964 static struct packet_edit_mode *receive_packet_edit_mode_100(struct connection *pc)
74965{
74966#ifdef FREECIV_DELTA_PROTOCOL
74967 packet_edit_mode_100_fields fields;
74968 struct packet_edit_mode *old;
74969 struct genhash **hash = pc->phs.received + PACKET_EDIT_MODE;
74970#endif /* FREECIV_DELTA_PROTOCOL */
74971 RECEIVE_PACKET_START(packet_edit_mode, real_packet);
74972#ifdef FREECIV_JSON_CONNECTION
74973 struct plocation field_addr;
74974 {
74975 struct plocation *field_addr_tmp = plocation_field_new(NULL);
74976 field_addr = *field_addr_tmp;
74977 FC_FREE(field_addr_tmp);
74978 }
74979#endif /* FREECIV_JSON_CONNECTION */
74980
74981#ifdef FREECIV_DELTA_PROTOCOL
74982#ifdef FREECIV_JSON_CONNECTION
74983 field_addr.name = "fields";
74984#endif /* FREECIV_JSON_CONNECTION */
74985 DIO_BV_GET(&din, &field_addr, fields);
74986
74987#else /* FREECIV_DELTA_PROTOCOL */
74988#ifdef FREECIV_JSON_CONNECTION
74989 field_addr.name = "state";
74990#endif /* FREECIV_JSON_CONNECTION */
74991 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->state)) {
74992 RECEIVE_PACKET_FIELD_ERROR(state);
74993 }
74994#endif
74995 log_packet_detailed("packet_edit_mode_100: got info about ()");
74996
74997#ifdef FREECIV_DELTA_PROTOCOL
74998 if (NULL == *hash) {
74999 *hash = genhash_new_full(hash_packet_edit_mode_100, cmp_packet_edit_mode_100,
75000 NULL, NULL, NULL, free);
75001 }
75002
75003 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75004 *real_packet = *old;
75005 } else {
75006 log_packet_detailed(" no old info");
75007 memset(real_packet, 0, sizeof(*real_packet));
75008 }
75009
75010 real_packet->state = BV_ISSET(fields, 0);
75011
75012 if (NULL == old) {
75013 old = fc_malloc(sizeof(*old));
75014 *old = *real_packet;
75015 genhash_insert(*hash, old, old);
75016 } else {
75017 *old = *real_packet;
75018 }
75019
75020#endif /* FREECIV_DELTA_PROTOCOL */
75021 RECEIVE_PACKET_END(real_packet);
75022}
75023
75024 static int send_packet_edit_mode_100(struct connection *pc, const struct packet_edit_mode *packet)
75025{
75026 const struct packet_edit_mode *real_packet = packet;
75027 int e;
75028#ifdef FREECIV_DELTA_PROTOCOL
75029 packet_edit_mode_100_fields fields;
75030 struct packet_edit_mode *old;
75031 struct genhash **hash = pc->phs.sent + PACKET_EDIT_MODE;
75032#endif /* FREECIV_DELTA_PROTOCOL */
75033 SEND_PACKET_START(PACKET_EDIT_MODE);
75034#ifdef FREECIV_JSON_CONNECTION
75035 struct plocation field_addr;
75036 {
75037 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75038 field_addr = *field_addr_tmp;
75039 FC_FREE(field_addr_tmp);
75040 }
75041#endif /* FREECIV_JSON_CONNECTION */
75042
75043 log_packet_detailed("packet_edit_mode_100: sending info about ()");
75044
75045#ifdef FREECIV_DELTA_PROTOCOL
75046 if (NULL == *hash) {
75047 *hash = genhash_new_full(hash_packet_edit_mode_100, cmp_packet_edit_mode_100,
75048 NULL, NULL, NULL, free);
75049 }
75050 BV_CLR_ALL(fields);
75051
75052 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75053 old = fc_malloc(sizeof(*old));
75054 *old = *real_packet;
75055 genhash_insert(*hash, old, old);
75056 memset(old, 0, sizeof(*old));
75057 }
75058 if (packet->state) {
75059 BV_SET(fields, 0);
75060 }
75061
75062
75063#ifdef FREECIV_JSON_CONNECTION
75064 field_addr.name = "fields";
75065#endif /* FREECIV_JSON_CONNECTION */
75066 e = 0;
75067 e |= DIO_BV_PUT(&dout, &field_addr, fields);
75068 if (e) {
75069 log_packet_detailed("fields bitvector error detected");
75070 }
75071
75072 /* field 0 is folded into the header */
75073
75074 *old = *real_packet;
75075#endif /* FREECIV_DELTA_PROTOCOL */
75076#ifndef FREECIV_DELTA_PROTOCOL
75077#ifdef FREECIV_JSON_CONNECTION
75078 field_addr.name = "state";
75079#endif /* FREECIV_JSON_CONNECTION */
75080 e = 0;
75081 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->state);
75082 if (e) {
75083 log_packet_detailed("'state' field error detected");
75084 }
75085
75086#endif
75087 SEND_PACKET_END(PACKET_EDIT_MODE);
75088}
75089
75090 int send_packet_edit_mode(struct connection *pc, const struct packet_edit_mode *packet)
75091{
75092 if (!pc->used) {
75093 log_error("WARNING: trying to send data to the closed connection %s",
75094 conn_description(pc));
75095 return -1;
75096 }
75097 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_MODE].packet != NULL, -1,
75098 "Handler for PACKET_EDIT_MODE not installed");
75099 return pc->phs.handlers->send[PACKET_EDIT_MODE].packet(pc, packet);
75100}
75101
75102 int dsend_packet_edit_mode(struct connection *pc, bool state)
75103{
75104 struct packet_edit_mode packet, *real_packet = &packet;
75105
75106 real_packet->state = state;
75107
75108 return send_packet_edit_mode(pc, real_packet);
75109}
75110
75111 static struct packet_edit_recalculate_borders *receive_packet_edit_recalculate_borders_100(struct connection *pc)
75112{
75113 RECEIVE_PACKET_START(packet_edit_recalculate_borders, real_packet);
75114#if 1 /* To match endif */
75115 real_packet->__dummy = 0xff;
75116#endif
75117 log_packet_detailed("packet_edit_recalculate_borders_100: got info about ()");
75118 RECEIVE_PACKET_END(real_packet);
75119}
75120
75121 static int send_packet_edit_recalculate_borders_100(struct connection *pc)
75122{
75123 SEND_PACKET_START(PACKET_EDIT_RECALCULATE_BORDERS);
75124
75125 log_packet_detailed("packet_edit_recalculate_borders_100: sending info about ()");
75126 SEND_PACKET_END(PACKET_EDIT_RECALCULATE_BORDERS);
75127}
75128
75129 int send_packet_edit_recalculate_borders(struct connection *pc)
75130{
75131 if (!pc->used) {
75132 log_error("WARNING: trying to send data to the closed connection %s",
75133 conn_description(pc));
75134 return -1;
75135 }
75136 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet != NULL, -1,
75137 "Handler for PACKET_EDIT_RECALCULATE_BORDERS not installed");
75138 return pc->phs.handlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet(pc);
75139}
75140
75141 static struct packet_edit_check_tiles *receive_packet_edit_check_tiles_100(struct connection *pc)
75142{
75143 RECEIVE_PACKET_START(packet_edit_check_tiles, real_packet);
75144#if 1 /* To match endif */
75145 real_packet->__dummy = 0xff;
75146#endif
75147 log_packet_detailed("packet_edit_check_tiles_100: got info about ()");
75148 RECEIVE_PACKET_END(real_packet);
75149}
75150
75151 static int send_packet_edit_check_tiles_100(struct connection *pc)
75152{
75153 SEND_PACKET_START(PACKET_EDIT_CHECK_TILES);
75154
75155 log_packet_detailed("packet_edit_check_tiles_100: sending info about ()");
75156 SEND_PACKET_END(PACKET_EDIT_CHECK_TILES);
75157}
75158
75159 int send_packet_edit_check_tiles(struct connection *pc)
75160{
75161 if (!pc->used) {
75162 log_error("WARNING: trying to send data to the closed connection %s",
75163 conn_description(pc));
75164 return -1;
75165 }
75166 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CHECK_TILES].no_packet != NULL, -1,
75167 "Handler for PACKET_EDIT_CHECK_TILES not installed");
75168 return pc->phs.handlers->send[PACKET_EDIT_CHECK_TILES].no_packet(pc);
75169}
75170
75171#ifdef FREECIV_DELTA_PROTOCOL
75172#define hash_packet_edit_toggle_fogofwar_100 hash_const
75173
75174#define cmp_packet_edit_toggle_fogofwar_100 cmp_const
75175
75176 BV_DEFINE(packet_edit_toggle_fogofwar_100_fields, 1);
75177#endif /* FREECIV_DELTA_PROTOCOL */
75178
75179 static struct packet_edit_toggle_fogofwar *receive_packet_edit_toggle_fogofwar_100(struct connection *pc)
75180{
75181#ifdef FREECIV_DELTA_PROTOCOL
75182 packet_edit_toggle_fogofwar_100_fields fields;
75183 struct packet_edit_toggle_fogofwar *old;
75184 struct genhash **hash = pc->phs.received + PACKET_EDIT_TOGGLE_FOGOFWAR;
75185#endif /* FREECIV_DELTA_PROTOCOL */
75186 RECEIVE_PACKET_START(packet_edit_toggle_fogofwar, real_packet);
75187#ifdef FREECIV_JSON_CONNECTION
75188 struct plocation field_addr;
75189 {
75190 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75191 field_addr = *field_addr_tmp;
75192 FC_FREE(field_addr_tmp);
75193 }
75194#endif /* FREECIV_JSON_CONNECTION */
75195
75196#ifdef FREECIV_DELTA_PROTOCOL
75197#ifdef FREECIV_JSON_CONNECTION
75198 field_addr.name = "fields";
75199#endif /* FREECIV_JSON_CONNECTION */
75200 DIO_BV_GET(&din, &field_addr, fields);
75201
75202#else /* FREECIV_DELTA_PROTOCOL */
75203#ifdef FREECIV_JSON_CONNECTION
75204 field_addr.name = "player";
75205#endif /* FREECIV_JSON_CONNECTION */
75206 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
75207 RECEIVE_PACKET_FIELD_ERROR(player);
75208 }
75209#endif
75210 log_packet_detailed("packet_edit_toggle_fogofwar_100: got info about ()");
75211
75212#ifdef FREECIV_DELTA_PROTOCOL
75213 if (NULL == *hash) {
75214 *hash = genhash_new_full(hash_packet_edit_toggle_fogofwar_100, cmp_packet_edit_toggle_fogofwar_100,
75215 NULL, NULL, NULL, free);
75216 }
75217
75218 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75219 *real_packet = *old;
75220 } else {
75221 log_packet_detailed(" no old info");
75222 memset(real_packet, 0, sizeof(*real_packet));
75223 }
75224
75225 if (BV_ISSET(fields, 0)) {
75226 log_packet_detailed(" got field 'player'");
75227#ifdef FREECIV_JSON_CONNECTION
75228 field_addr.name = "player";
75229#endif /* FREECIV_JSON_CONNECTION */
75230 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
75231 RECEIVE_PACKET_FIELD_ERROR(player);
75232 }
75233 }
75234
75235 if (NULL == old) {
75236 old = fc_malloc(sizeof(*old));
75237 *old = *real_packet;
75238 genhash_insert(*hash, old, old);
75239 } else {
75240 *old = *real_packet;
75241 }
75242
75243#endif /* FREECIV_DELTA_PROTOCOL */
75244 RECEIVE_PACKET_END(real_packet);
75245}
75246
75247 static int send_packet_edit_toggle_fogofwar_100(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
75248{
75249 const struct packet_edit_toggle_fogofwar *real_packet = packet;
75250 int e;
75251#ifdef FREECIV_DELTA_PROTOCOL
75252 packet_edit_toggle_fogofwar_100_fields fields;
75253 struct packet_edit_toggle_fogofwar *old;
75254 bool differ;
75255 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TOGGLE_FOGOFWAR;
75256#endif /* FREECIV_DELTA_PROTOCOL */
75257 SEND_PACKET_START(PACKET_EDIT_TOGGLE_FOGOFWAR);
75258#ifdef FREECIV_JSON_CONNECTION
75259 struct plocation field_addr;
75260 {
75261 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75262 field_addr = *field_addr_tmp;
75263 FC_FREE(field_addr_tmp);
75264 }
75265#endif /* FREECIV_JSON_CONNECTION */
75266
75267 log_packet_detailed("packet_edit_toggle_fogofwar_100: sending info about ()");
75268
75269#ifdef FREECIV_DELTA_PROTOCOL
75270 if (NULL == *hash) {
75271 *hash = genhash_new_full(hash_packet_edit_toggle_fogofwar_100, cmp_packet_edit_toggle_fogofwar_100,
75272 NULL, NULL, NULL, free);
75273 }
75274 BV_CLR_ALL(fields);
75275
75276 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75277 old = fc_malloc(sizeof(*old));
75278 *old = *real_packet;
75279 genhash_insert(*hash, old, old);
75280 memset(old, 0, sizeof(*old));
75281 }
75282 differ = (old->player != real_packet->player);
75283 if (differ) {
75284 BV_SET(fields, 0);
75285 }
75286
75287
75288#ifdef FREECIV_JSON_CONNECTION
75289 field_addr.name = "fields";
75290#endif /* FREECIV_JSON_CONNECTION */
75291 e = 0;
75292 e |= DIO_BV_PUT(&dout, &field_addr, fields);
75293 if (e) {
75294 log_packet_detailed("fields bitvector error detected");
75295 }
75296
75297 if (BV_ISSET(fields, 0)) {
75298 log_packet_detailed(" field 'player' has changed");
75299#ifdef FREECIV_JSON_CONNECTION
75300 field_addr.name = "player";
75301#endif /* FREECIV_JSON_CONNECTION */
75302 e = 0;
75303 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
75304 if (e) {
75305 log_packet_detailed("'player' field error detected");
75306 }
75307 }
75308
75309 *old = *real_packet;
75310#endif /* FREECIV_DELTA_PROTOCOL */
75311#ifndef FREECIV_DELTA_PROTOCOL
75312#ifdef FREECIV_JSON_CONNECTION
75313 field_addr.name = "player";
75314#endif /* FREECIV_JSON_CONNECTION */
75315 e = 0;
75316 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
75317 if (e) {
75318 log_packet_detailed("'player' field error detected");
75319 }
75320
75321#endif
75322 SEND_PACKET_END(PACKET_EDIT_TOGGLE_FOGOFWAR);
75323}
75324
75325 int send_packet_edit_toggle_fogofwar(struct connection *pc, const struct packet_edit_toggle_fogofwar *packet)
75326{
75327 if (!pc->used) {
75328 log_error("WARNING: trying to send data to the closed connection %s",
75329 conn_description(pc));
75330 return -1;
75331 }
75332 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet != NULL, -1,
75333 "Handler for PACKET_EDIT_TOGGLE_FOGOFWAR not installed");
75334 return pc->phs.handlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet(pc, packet);
75335}
75336
75337 int dsend_packet_edit_toggle_fogofwar(struct connection *pc, int player)
75338{
75339 struct packet_edit_toggle_fogofwar packet, *real_packet = &packet;
75340
75341 real_packet->player = player;
75342
75343 return send_packet_edit_toggle_fogofwar(pc, real_packet);
75344}
75345
75346#ifdef FREECIV_DELTA_PROTOCOL
75347static genhash_val_t hash_packet_edit_tile_terrain_100(const void *vkey)
75348{
75349 const struct packet_edit_tile_terrain *key = (const struct packet_edit_tile_terrain *) vkey;
75350 genhash_val_t result = 0;
75351
75352 result += key->tile;
75353
75354 result &= 0xFFFFFFFF;
75355 return result;
75356}
75357
75358static bool cmp_packet_edit_tile_terrain_100(const void *vkey1, const void *vkey2)
75359{
75360 const struct packet_edit_tile_terrain *old = (const struct packet_edit_tile_terrain *) vkey1;
75361 const struct packet_edit_tile_terrain *real_packet = (const struct packet_edit_tile_terrain *) vkey2;
75362 bool differ;
75363
75364 differ = (old->tile != real_packet->tile);
75365
75366 return !differ;
75367}
75368 BV_DEFINE(packet_edit_tile_terrain_100_fields, 2);
75369#endif /* FREECIV_DELTA_PROTOCOL */
75370
75371 static struct packet_edit_tile_terrain *receive_packet_edit_tile_terrain_100(struct connection *pc)
75372{
75373#ifdef FREECIV_DELTA_PROTOCOL
75374 packet_edit_tile_terrain_100_fields fields;
75375 struct packet_edit_tile_terrain *old;
75376 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE_TERRAIN;
75377#endif /* FREECIV_DELTA_PROTOCOL */
75378 RECEIVE_PACKET_START(packet_edit_tile_terrain, real_packet);
75379#ifdef FREECIV_JSON_CONNECTION
75380 struct plocation field_addr;
75381 {
75382 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75383 field_addr = *field_addr_tmp;
75384 FC_FREE(field_addr_tmp);
75385 }
75386#endif /* FREECIV_JSON_CONNECTION */
75387
75388#ifdef FREECIV_DELTA_PROTOCOL
75389#ifdef FREECIV_JSON_CONNECTION
75390 field_addr.name = "fields";
75391#endif /* FREECIV_JSON_CONNECTION */
75392 DIO_BV_GET(&din, &field_addr, fields);
75393#ifdef FREECIV_JSON_CONNECTION
75394 field_addr.name = "tile";
75395#endif /* FREECIV_JSON_CONNECTION */
75396 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
75397 RECEIVE_PACKET_FIELD_ERROR(tile);
75398 }
75399
75400#else /* FREECIV_DELTA_PROTOCOL */
75401#ifdef FREECIV_JSON_CONNECTION
75402 field_addr.name = "tile";
75403#endif /* FREECIV_JSON_CONNECTION */
75404 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
75405 RECEIVE_PACKET_FIELD_ERROR(tile);
75406 }
75407#ifdef FREECIV_JSON_CONNECTION
75408 field_addr.name = "terrain";
75409#endif /* FREECIV_JSON_CONNECTION */
75410 {
75411 int readin;
75412
75413 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75414 RECEIVE_PACKET_FIELD_ERROR(terrain);
75415 }
75416 real_packet->terrain = readin;
75417 }
75418#ifdef FREECIV_JSON_CONNECTION
75419 field_addr.name = "size";
75420#endif /* FREECIV_JSON_CONNECTION */
75421 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
75422 RECEIVE_PACKET_FIELD_ERROR(size);
75423 }
75424#endif
75425 log_packet_detailed("packet_edit_tile_terrain_100: got info about (%d)",
75426 real_packet->tile);
75427
75428#ifdef FREECIV_DELTA_PROTOCOL
75429 if (NULL == *hash) {
75430 *hash = genhash_new_full(hash_packet_edit_tile_terrain_100, cmp_packet_edit_tile_terrain_100,
75431 NULL, NULL, NULL, free);
75432 }
75433
75434 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75435 *real_packet = *old;
75436 } else {
75437 int tile;
75438
75439 tile = real_packet->tile;
75440
75441 log_packet_detailed(" no old info");
75442 memset(real_packet, 0, sizeof(*real_packet));
75443
75444 real_packet->tile = tile;
75445 }
75446
75447 if (BV_ISSET(fields, 0)) {
75448 log_packet_detailed(" got field 'terrain'");
75449#ifdef FREECIV_JSON_CONNECTION
75450 field_addr.name = "terrain";
75451#endif /* FREECIV_JSON_CONNECTION */
75452 {
75453 int readin;
75454
75455 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
75456 RECEIVE_PACKET_FIELD_ERROR(terrain);
75457 }
75458 real_packet->terrain = readin;
75459 }
75460 }
75461 if (BV_ISSET(fields, 1)) {
75462 log_packet_detailed(" got field 'size'");
75463#ifdef FREECIV_JSON_CONNECTION
75464 field_addr.name = "size";
75465#endif /* FREECIV_JSON_CONNECTION */
75466 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
75467 RECEIVE_PACKET_FIELD_ERROR(size);
75468 }
75469 }
75470
75471 if (NULL == old) {
75472 old = fc_malloc(sizeof(*old));
75473 *old = *real_packet;
75474 genhash_insert(*hash, old, old);
75475 } else {
75476 *old = *real_packet;
75477 }
75478
75479#endif /* FREECIV_DELTA_PROTOCOL */
75480 RECEIVE_PACKET_END(real_packet);
75481}
75482
75483 static int send_packet_edit_tile_terrain_100(struct connection *pc, const struct packet_edit_tile_terrain *packet)
75484{
75485 const struct packet_edit_tile_terrain *real_packet = packet;
75486 int e;
75487#ifdef FREECIV_DELTA_PROTOCOL
75488 packet_edit_tile_terrain_100_fields fields;
75489 struct packet_edit_tile_terrain *old;
75490 bool differ;
75491 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE_TERRAIN;
75492#endif /* FREECIV_DELTA_PROTOCOL */
75493 SEND_PACKET_START(PACKET_EDIT_TILE_TERRAIN);
75494#ifdef FREECIV_JSON_CONNECTION
75495 struct plocation field_addr;
75496 {
75497 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75498 field_addr = *field_addr_tmp;
75499 FC_FREE(field_addr_tmp);
75500 }
75501#endif /* FREECIV_JSON_CONNECTION */
75502
75503 log_packet_detailed("packet_edit_tile_terrain_100: sending info about (%d)",
75504 real_packet->tile);
75505
75506#ifdef FREECIV_DELTA_PROTOCOL
75507 if (NULL == *hash) {
75508 *hash = genhash_new_full(hash_packet_edit_tile_terrain_100, cmp_packet_edit_tile_terrain_100,
75509 NULL, NULL, NULL, free);
75510 }
75511 BV_CLR_ALL(fields);
75512
75513 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75514 old = fc_malloc(sizeof(*old));
75515 *old = *real_packet;
75516 genhash_insert(*hash, old, old);
75517 memset(old, 0, sizeof(*old));
75518 }
75519 differ = (old->terrain != real_packet->terrain);
75520 if (differ) {
75521 BV_SET(fields, 0);
75522 }
75523
75524 differ = (old->size != real_packet->size);
75525 if (differ) {
75526 BV_SET(fields, 1);
75527 }
75528
75529
75530#ifdef FREECIV_JSON_CONNECTION
75531 field_addr.name = "fields";
75532#endif /* FREECIV_JSON_CONNECTION */
75533 e = 0;
75534 e |= DIO_BV_PUT(&dout, &field_addr, fields);
75535 if (e) {
75536 log_packet_detailed("fields bitvector error detected");
75537 }
75538#ifdef FREECIV_JSON_CONNECTION
75539 field_addr.name = "tile";
75540#endif /* FREECIV_JSON_CONNECTION */
75541 e = 0;
75542 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
75543 if (e) {
75544 log_packet_detailed("'tile' field error detected");
75545 }
75546
75547 if (BV_ISSET(fields, 0)) {
75548 log_packet_detailed(" field 'terrain' has changed");
75549#ifdef FREECIV_JSON_CONNECTION
75550 field_addr.name = "terrain";
75551#endif /* FREECIV_JSON_CONNECTION */
75552 e = 0;
75553 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
75554 if (e) {
75555 log_packet_detailed("'terrain' field error detected");
75556 }
75557 }
75558 if (BV_ISSET(fields, 1)) {
75559 log_packet_detailed(" field 'size' has changed");
75560#ifdef FREECIV_JSON_CONNECTION
75561 field_addr.name = "size";
75562#endif /* FREECIV_JSON_CONNECTION */
75563 e = 0;
75564 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
75565 if (e) {
75566 log_packet_detailed("'size' field error detected");
75567 }
75568 }
75569
75570 *old = *real_packet;
75571#endif /* FREECIV_DELTA_PROTOCOL */
75572#ifndef FREECIV_DELTA_PROTOCOL
75573#ifdef FREECIV_JSON_CONNECTION
75574 field_addr.name = "tile";
75575#endif /* FREECIV_JSON_CONNECTION */
75576 e = 0;
75577 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
75578 if (e) {
75579 log_packet_detailed("'tile' field error detected");
75580 }
75581#ifdef FREECIV_JSON_CONNECTION
75582 field_addr.name = "terrain";
75583#endif /* FREECIV_JSON_CONNECTION */
75584 e = 0;
75585 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
75586 if (e) {
75587 log_packet_detailed("'terrain' field error detected");
75588 }
75589#ifdef FREECIV_JSON_CONNECTION
75590 field_addr.name = "size";
75591#endif /* FREECIV_JSON_CONNECTION */
75592 e = 0;
75593 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
75594 if (e) {
75595 log_packet_detailed("'size' field error detected");
75596 }
75597
75598#endif
75599 SEND_PACKET_END(PACKET_EDIT_TILE_TERRAIN);
75600}
75601
75602 int send_packet_edit_tile_terrain(struct connection *pc, const struct packet_edit_tile_terrain *packet)
75603{
75604 if (!pc->used) {
75605 log_error("WARNING: trying to send data to the closed connection %s",
75606 conn_description(pc));
75607 return -1;
75608 }
75609 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE_TERRAIN].packet != NULL, -1,
75610 "Handler for PACKET_EDIT_TILE_TERRAIN not installed");
75611 return pc->phs.handlers->send[PACKET_EDIT_TILE_TERRAIN].packet(pc, packet);
75612}
75613
75614 int dsend_packet_edit_tile_terrain(struct connection *pc, int tile, Terrain_type_id terrain, int size)
75615{
75616 struct packet_edit_tile_terrain packet, *real_packet = &packet;
75617
75618 real_packet->tile = tile;
75619 real_packet->terrain = terrain;
75620 real_packet->size = size;
75621
75622 return send_packet_edit_tile_terrain(pc, real_packet);
75623}
75624
75625#ifdef FREECIV_DELTA_PROTOCOL
75626static genhash_val_t hash_packet_edit_tile_extra_100(const void *vkey)
75627{
75628 const struct packet_edit_tile_extra *key = (const struct packet_edit_tile_extra *) vkey;
75629 genhash_val_t result = 0;
75630
75631 result += key->tile;
75632
75633 result &= 0xFFFFFFFF;
75634 return result;
75635}
75636
75637static bool cmp_packet_edit_tile_extra_100(const void *vkey1, const void *vkey2)
75638{
75639 const struct packet_edit_tile_extra *old = (const struct packet_edit_tile_extra *) vkey1;
75640 const struct packet_edit_tile_extra *real_packet = (const struct packet_edit_tile_extra *) vkey2;
75641 bool differ;
75642
75643 differ = (old->tile != real_packet->tile);
75644
75645 return !differ;
75646}
75647 BV_DEFINE(packet_edit_tile_extra_100_fields, 4);
75648#endif /* FREECIV_DELTA_PROTOCOL */
75649
75650 static struct packet_edit_tile_extra *receive_packet_edit_tile_extra_100(struct connection *pc)
75651{
75652#ifdef FREECIV_DELTA_PROTOCOL
75653 packet_edit_tile_extra_100_fields fields;
75654 struct packet_edit_tile_extra *old;
75655 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE_EXTRA;
75656#endif /* FREECIV_DELTA_PROTOCOL */
75657 RECEIVE_PACKET_START(packet_edit_tile_extra, real_packet);
75658#ifdef FREECIV_JSON_CONNECTION
75659 struct plocation field_addr;
75660 {
75661 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75662 field_addr = *field_addr_tmp;
75663 FC_FREE(field_addr_tmp);
75664 }
75665#endif /* FREECIV_JSON_CONNECTION */
75666
75667#ifdef FREECIV_DELTA_PROTOCOL
75668#ifdef FREECIV_JSON_CONNECTION
75669 field_addr.name = "fields";
75670#endif /* FREECIV_JSON_CONNECTION */
75671 DIO_BV_GET(&din, &field_addr, fields);
75672#ifdef FREECIV_JSON_CONNECTION
75673 field_addr.name = "tile";
75674#endif /* FREECIV_JSON_CONNECTION */
75675 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
75676 RECEIVE_PACKET_FIELD_ERROR(tile);
75677 }
75678
75679#else /* FREECIV_DELTA_PROTOCOL */
75680#ifdef FREECIV_JSON_CONNECTION
75681 field_addr.name = "tile";
75682#endif /* FREECIV_JSON_CONNECTION */
75683 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
75684 RECEIVE_PACKET_FIELD_ERROR(tile);
75685 }
75686#ifdef FREECIV_JSON_CONNECTION
75687 field_addr.name = "extra_type_id";
75688#endif /* FREECIV_JSON_CONNECTION */
75689 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra_type_id)) {
75690 RECEIVE_PACKET_FIELD_ERROR(extra_type_id);
75691 }
75692#ifdef FREECIV_JSON_CONNECTION
75693 field_addr.name = "removal";
75694#endif /* FREECIV_JSON_CONNECTION */
75695 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removal)) {
75696 RECEIVE_PACKET_FIELD_ERROR(removal);
75697 }
75698#ifdef FREECIV_JSON_CONNECTION
75699 field_addr.name = "eowner";
75700#endif /* FREECIV_JSON_CONNECTION */
75701 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
75702 RECEIVE_PACKET_FIELD_ERROR(eowner);
75703 }
75704#ifdef FREECIV_JSON_CONNECTION
75705 field_addr.name = "size";
75706#endif /* FREECIV_JSON_CONNECTION */
75707 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
75708 RECEIVE_PACKET_FIELD_ERROR(size);
75709 }
75710#endif
75711 log_packet_detailed("packet_edit_tile_extra_100: got info about (%d)",
75712 real_packet->tile);
75713
75714#ifdef FREECIV_DELTA_PROTOCOL
75715 if (NULL == *hash) {
75716 *hash = genhash_new_full(hash_packet_edit_tile_extra_100, cmp_packet_edit_tile_extra_100,
75717 NULL, NULL, NULL, free);
75718 }
75719
75720 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
75721 *real_packet = *old;
75722 } else {
75723 int tile;
75724
75725 tile = real_packet->tile;
75726
75727 log_packet_detailed(" no old info");
75728 memset(real_packet, 0, sizeof(*real_packet));
75729
75730 real_packet->tile = tile;
75731 }
75732
75733 if (BV_ISSET(fields, 0)) {
75734 log_packet_detailed(" got field 'extra_type_id'");
75735#ifdef FREECIV_JSON_CONNECTION
75736 field_addr.name = "extra_type_id";
75737#endif /* FREECIV_JSON_CONNECTION */
75738 if (!DIO_GET(sint8, &din, &field_addr, &real_packet->extra_type_id)) {
75739 RECEIVE_PACKET_FIELD_ERROR(extra_type_id);
75740 }
75741 }
75742 real_packet->removal = BV_ISSET(fields, 1);
75743 if (BV_ISSET(fields, 2)) {
75744 log_packet_detailed(" got field 'eowner'");
75745#ifdef FREECIV_JSON_CONNECTION
75746 field_addr.name = "eowner";
75747#endif /* FREECIV_JSON_CONNECTION */
75748 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
75749 RECEIVE_PACKET_FIELD_ERROR(eowner);
75750 }
75751 }
75752 if (BV_ISSET(fields, 3)) {
75753 log_packet_detailed(" got field 'size'");
75754#ifdef FREECIV_JSON_CONNECTION
75755 field_addr.name = "size";
75756#endif /* FREECIV_JSON_CONNECTION */
75757 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
75758 RECEIVE_PACKET_FIELD_ERROR(size);
75759 }
75760 }
75761
75762 if (NULL == old) {
75763 old = fc_malloc(sizeof(*old));
75764 *old = *real_packet;
75765 genhash_insert(*hash, old, old);
75766 } else {
75767 *old = *real_packet;
75768 }
75769
75770#endif /* FREECIV_DELTA_PROTOCOL */
75771 RECEIVE_PACKET_END(real_packet);
75772}
75773
75774 static int send_packet_edit_tile_extra_100(struct connection *pc, const struct packet_edit_tile_extra *packet)
75775{
75776 const struct packet_edit_tile_extra *real_packet = packet;
75777 int e;
75778#ifdef FREECIV_DELTA_PROTOCOL
75779 packet_edit_tile_extra_100_fields fields;
75780 struct packet_edit_tile_extra *old;
75781 bool differ;
75782 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE_EXTRA;
75783#endif /* FREECIV_DELTA_PROTOCOL */
75784 SEND_PACKET_START(PACKET_EDIT_TILE_EXTRA);
75785#ifdef FREECIV_JSON_CONNECTION
75786 struct plocation field_addr;
75787 {
75788 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75789 field_addr = *field_addr_tmp;
75790 FC_FREE(field_addr_tmp);
75791 }
75792#endif /* FREECIV_JSON_CONNECTION */
75793
75794 log_packet_detailed("packet_edit_tile_extra_100: sending info about (%d)",
75795 real_packet->tile);
75796
75797#ifdef FREECIV_DELTA_PROTOCOL
75798 if (NULL == *hash) {
75799 *hash = genhash_new_full(hash_packet_edit_tile_extra_100, cmp_packet_edit_tile_extra_100,
75800 NULL, NULL, NULL, free);
75801 }
75802 BV_CLR_ALL(fields);
75803
75804 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
75805 old = fc_malloc(sizeof(*old));
75806 *old = *real_packet;
75807 genhash_insert(*hash, old, old);
75808 memset(old, 0, sizeof(*old));
75809 }
75810 differ = (old->extra_type_id != real_packet->extra_type_id);
75811 if (differ) {
75812 BV_SET(fields, 0);
75813 }
75814
75815 if (packet->removal) {
75816 BV_SET(fields, 1);
75817 }
75818
75819 differ = (old->eowner != real_packet->eowner);
75820 if (differ) {
75821 BV_SET(fields, 2);
75822 }
75823
75824 differ = (old->size != real_packet->size);
75825 if (differ) {
75826 BV_SET(fields, 3);
75827 }
75828
75829
75830#ifdef FREECIV_JSON_CONNECTION
75831 field_addr.name = "fields";
75832#endif /* FREECIV_JSON_CONNECTION */
75833 e = 0;
75834 e |= DIO_BV_PUT(&dout, &field_addr, fields);
75835 if (e) {
75836 log_packet_detailed("fields bitvector error detected");
75837 }
75838#ifdef FREECIV_JSON_CONNECTION
75839 field_addr.name = "tile";
75840#endif /* FREECIV_JSON_CONNECTION */
75841 e = 0;
75842 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
75843 if (e) {
75844 log_packet_detailed("'tile' field error detected");
75845 }
75846
75847 if (BV_ISSET(fields, 0)) {
75848 log_packet_detailed(" field 'extra_type_id' has changed");
75849#ifdef FREECIV_JSON_CONNECTION
75850 field_addr.name = "extra_type_id";
75851#endif /* FREECIV_JSON_CONNECTION */
75852 e = 0;
75853 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra_type_id);
75854 if (e) {
75855 log_packet_detailed("'extra_type_id' field error detected");
75856 }
75857 }
75858 /* field 1 is folded into the header */
75859 if (BV_ISSET(fields, 2)) {
75860 log_packet_detailed(" field 'eowner' has changed");
75861#ifdef FREECIV_JSON_CONNECTION
75862 field_addr.name = "eowner";
75863#endif /* FREECIV_JSON_CONNECTION */
75864 e = 0;
75865 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
75866 if (e) {
75867 log_packet_detailed("'eowner' field error detected");
75868 }
75869 }
75870 if (BV_ISSET(fields, 3)) {
75871 log_packet_detailed(" field 'size' has changed");
75872#ifdef FREECIV_JSON_CONNECTION
75873 field_addr.name = "size";
75874#endif /* FREECIV_JSON_CONNECTION */
75875 e = 0;
75876 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
75877 if (e) {
75878 log_packet_detailed("'size' field error detected");
75879 }
75880 }
75881
75882 *old = *real_packet;
75883#endif /* FREECIV_DELTA_PROTOCOL */
75884#ifndef FREECIV_DELTA_PROTOCOL
75885#ifdef FREECIV_JSON_CONNECTION
75886 field_addr.name = "tile";
75887#endif /* FREECIV_JSON_CONNECTION */
75888 e = 0;
75889 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
75890 if (e) {
75891 log_packet_detailed("'tile' field error detected");
75892 }
75893#ifdef FREECIV_JSON_CONNECTION
75894 field_addr.name = "extra_type_id";
75895#endif /* FREECIV_JSON_CONNECTION */
75896 e = 0;
75897 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->extra_type_id);
75898 if (e) {
75899 log_packet_detailed("'extra_type_id' field error detected");
75900 }
75901#ifdef FREECIV_JSON_CONNECTION
75902 field_addr.name = "removal";
75903#endif /* FREECIV_JSON_CONNECTION */
75904 e = 0;
75905 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->removal);
75906 if (e) {
75907 log_packet_detailed("'removal' field error detected");
75908 }
75909#ifdef FREECIV_JSON_CONNECTION
75910 field_addr.name = "eowner";
75911#endif /* FREECIV_JSON_CONNECTION */
75912 e = 0;
75913 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
75914 if (e) {
75915 log_packet_detailed("'eowner' field error detected");
75916 }
75917#ifdef FREECIV_JSON_CONNECTION
75918 field_addr.name = "size";
75919#endif /* FREECIV_JSON_CONNECTION */
75920 e = 0;
75921 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
75922 if (e) {
75923 log_packet_detailed("'size' field error detected");
75924 }
75925
75926#endif
75927 SEND_PACKET_END(PACKET_EDIT_TILE_EXTRA);
75928}
75929
75930 int send_packet_edit_tile_extra(struct connection *pc, const struct packet_edit_tile_extra *packet)
75931{
75932 if (!pc->used) {
75933 log_error("WARNING: trying to send data to the closed connection %s",
75934 conn_description(pc));
75935 return -1;
75936 }
75937 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE_EXTRA].packet != NULL, -1,
75938 "Handler for PACKET_EDIT_TILE_EXTRA not installed");
75939 return pc->phs.handlers->send[PACKET_EDIT_TILE_EXTRA].packet(pc, packet);
75940}
75941
75942 int dsend_packet_edit_tile_extra(struct connection *pc, int tile, int extra_type_id, bool removal, int eowner, int size)
75943{
75944 struct packet_edit_tile_extra packet, *real_packet = &packet;
75945
75946 real_packet->tile = tile;
75947 real_packet->extra_type_id = extra_type_id;
75948 real_packet->removal = removal;
75949 real_packet->eowner = eowner;
75950 real_packet->size = size;
75951
75952 return send_packet_edit_tile_extra(pc, real_packet);
75953}
75954
75955 static struct packet_edit_startpos *receive_packet_edit_startpos_100(struct connection *pc)
75956{
75957 RECEIVE_PACKET_START(packet_edit_startpos, real_packet);
75958#ifdef FREECIV_JSON_CONNECTION
75959 struct plocation field_addr;
75960 {
75961 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75962 field_addr = *field_addr_tmp;
75963 FC_FREE(field_addr_tmp);
75964 }
75965#endif /* FREECIV_JSON_CONNECTION */
75966#if 1 /* To match endif */
75967#ifdef FREECIV_JSON_CONNECTION
75968 field_addr.name = "id";
75969#endif /* FREECIV_JSON_CONNECTION */
75970 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
75971 RECEIVE_PACKET_FIELD_ERROR(id);
75972 }
75973#ifdef FREECIV_JSON_CONNECTION
75974 field_addr.name = "removal";
75975#endif /* FREECIV_JSON_CONNECTION */
75976 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->removal)) {
75977 RECEIVE_PACKET_FIELD_ERROR(removal);
75978 }
75979#ifdef FREECIV_JSON_CONNECTION
75980 field_addr.name = "tag";
75981#endif /* FREECIV_JSON_CONNECTION */
75982 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
75983 RECEIVE_PACKET_FIELD_ERROR(tag);
75984 }
75985#endif
75986 log_packet_detailed("packet_edit_startpos_100: got info about ()");
75987 RECEIVE_PACKET_END(real_packet);
75988}
75989
75990 static int send_packet_edit_startpos_100(struct connection *pc, const struct packet_edit_startpos *packet)
75991{
75992 const struct packet_edit_startpos *real_packet = packet;
75993 int e;
75994 SEND_PACKET_START(PACKET_EDIT_STARTPOS);
75995#ifdef FREECIV_JSON_CONNECTION
75996 struct plocation field_addr;
75997 {
75998 struct plocation *field_addr_tmp = plocation_field_new(NULL);
75999 field_addr = *field_addr_tmp;
76000 FC_FREE(field_addr_tmp);
76001 }
76002#endif /* FREECIV_JSON_CONNECTION */
76003
76004 log_packet_detailed("packet_edit_startpos_100: sending info about ()");
76005#if 1 /* To match endif */
76006#ifdef FREECIV_JSON_CONNECTION
76007 field_addr.name = "id";
76008#endif /* FREECIV_JSON_CONNECTION */
76009 e = 0;
76010 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
76011 if (e) {
76012 log_packet_detailed("'id' field error detected");
76013 }
76014#ifdef FREECIV_JSON_CONNECTION
76015 field_addr.name = "removal";
76016#endif /* FREECIV_JSON_CONNECTION */
76017 e = 0;
76018 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->removal);
76019 if (e) {
76020 log_packet_detailed("'removal' field error detected");
76021 }
76022#ifdef FREECIV_JSON_CONNECTION
76023 field_addr.name = "tag";
76024#endif /* FREECIV_JSON_CONNECTION */
76025 e = 0;
76026 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
76027 if (e) {
76028 log_packet_detailed("'tag' field error detected");
76029 }
76030
76031#endif
76032 SEND_PACKET_END(PACKET_EDIT_STARTPOS);
76033}
76034
76035 int send_packet_edit_startpos(struct connection *pc, const struct packet_edit_startpos *packet)
76036{
76037 if (!pc->used) {
76038 log_error("WARNING: trying to send data to the closed connection %s",
76039 conn_description(pc));
76040 return -1;
76041 }
76042 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_STARTPOS].packet != NULL, -1,
76043 "Handler for PACKET_EDIT_STARTPOS not installed");
76044 return pc->phs.handlers->send[PACKET_EDIT_STARTPOS].packet(pc, packet);
76045}
76046
76047 int dsend_packet_edit_startpos(struct connection *pc, int id, bool removal, int tag)
76048{
76049 struct packet_edit_startpos packet, *real_packet = &packet;
76050
76051 real_packet->id = id;
76052 real_packet->removal = removal;
76053 real_packet->tag = tag;
76054
76055 return send_packet_edit_startpos(pc, real_packet);
76056}
76057
76058 static struct packet_edit_startpos_full *receive_packet_edit_startpos_full_100(struct connection *pc)
76059{
76060 RECEIVE_PACKET_START(packet_edit_startpos_full, real_packet);
76061#ifdef FREECIV_JSON_CONNECTION
76062 struct plocation field_addr;
76063 {
76064 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76065 field_addr = *field_addr_tmp;
76066 FC_FREE(field_addr_tmp);
76067 }
76068#endif /* FREECIV_JSON_CONNECTION */
76069#if 1 /* To match endif */
76070#ifdef FREECIV_JSON_CONNECTION
76071 field_addr.name = "id";
76072#endif /* FREECIV_JSON_CONNECTION */
76073 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
76074 RECEIVE_PACKET_FIELD_ERROR(id);
76075 }
76076#ifdef FREECIV_JSON_CONNECTION
76077 field_addr.name = "exclude";
76078#endif /* FREECIV_JSON_CONNECTION */
76079 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->exclude)) {
76080 RECEIVE_PACKET_FIELD_ERROR(exclude);
76081 }
76082#ifdef FREECIV_JSON_CONNECTION
76083 field_addr.name = "nations";
76084#endif /* FREECIV_JSON_CONNECTION */
76085 if (!DIO_BV_GET(&din, &field_addr, real_packet->nations)) {
76086 RECEIVE_PACKET_FIELD_ERROR(nations);
76087 }
76088#endif
76089 log_packet_detailed("packet_edit_startpos_full_100: got info about ()");
76090 RECEIVE_PACKET_END(real_packet);
76091}
76092
76093 static int send_packet_edit_startpos_full_100(struct connection *pc, const struct packet_edit_startpos_full *packet)
76094{
76095 const struct packet_edit_startpos_full *real_packet = packet;
76096 int e;
76097 SEND_PACKET_START(PACKET_EDIT_STARTPOS_FULL);
76098#ifdef FREECIV_JSON_CONNECTION
76099 struct plocation field_addr;
76100 {
76101 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76102 field_addr = *field_addr_tmp;
76103 FC_FREE(field_addr_tmp);
76104 }
76105#endif /* FREECIV_JSON_CONNECTION */
76106
76107 log_packet_detailed("packet_edit_startpos_full_100: sending info about ()");
76108#if 1 /* To match endif */
76109#ifdef FREECIV_JSON_CONNECTION
76110 field_addr.name = "id";
76111#endif /* FREECIV_JSON_CONNECTION */
76112 e = 0;
76113 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
76114 if (e) {
76115 log_packet_detailed("'id' field error detected");
76116 }
76117#ifdef FREECIV_JSON_CONNECTION
76118 field_addr.name = "exclude";
76119#endif /* FREECIV_JSON_CONNECTION */
76120 e = 0;
76121 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->exclude);
76122 if (e) {
76123 log_packet_detailed("'exclude' field error detected");
76124 }
76125#ifdef FREECIV_JSON_CONNECTION
76126 field_addr.name = "nations";
76127#endif /* FREECIV_JSON_CONNECTION */
76128 e = 0;
76129 e |= DIO_BV_PUT(&dout, &field_addr, packet->nations);
76130 if (e) {
76131 log_packet_detailed("'nations' field error detected");
76132 }
76133
76134#endif
76135 SEND_PACKET_END(PACKET_EDIT_STARTPOS_FULL);
76136}
76137
76138 int send_packet_edit_startpos_full(struct connection *pc, const struct packet_edit_startpos_full *packet)
76139{
76140 if (!pc->used) {
76141 log_error("WARNING: trying to send data to the closed connection %s",
76142 conn_description(pc));
76143 return -1;
76144 }
76145 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_STARTPOS_FULL].packet != NULL, -1,
76146 "Handler for PACKET_EDIT_STARTPOS_FULL not installed");
76147 return pc->phs.handlers->send[PACKET_EDIT_STARTPOS_FULL].packet(pc, packet);
76148}
76149
76150#ifdef FREECIV_DELTA_PROTOCOL
76151static genhash_val_t hash_packet_edit_tile_100(const void *vkey)
76152{
76153 const struct packet_edit_tile *key = (const struct packet_edit_tile *) vkey;
76154 genhash_val_t result = 0;
76155
76156 result += key->tile;
76157
76158 result &= 0xFFFFFFFF;
76159 return result;
76160}
76161
76162static bool cmp_packet_edit_tile_100(const void *vkey1, const void *vkey2)
76163{
76164 const struct packet_edit_tile *old = (const struct packet_edit_tile *) vkey1;
76165 const struct packet_edit_tile *real_packet = (const struct packet_edit_tile *) vkey2;
76166 bool differ;
76167
76168 differ = (old->tile != real_packet->tile);
76169
76170 return !differ;
76171}
76172 BV_DEFINE(packet_edit_tile_100_fields, 6);
76173#endif /* FREECIV_DELTA_PROTOCOL */
76174
76175 static struct packet_edit_tile *receive_packet_edit_tile_100(struct connection *pc)
76176{
76177#ifdef FREECIV_DELTA_PROTOCOL
76178 packet_edit_tile_100_fields fields;
76179 struct packet_edit_tile *old;
76180 struct genhash **hash = pc->phs.received + PACKET_EDIT_TILE;
76181#endif /* FREECIV_DELTA_PROTOCOL */
76182 RECEIVE_PACKET_START(packet_edit_tile, real_packet);
76183#ifdef FREECIV_JSON_CONNECTION
76184 struct plocation field_addr;
76185 {
76186 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76187 field_addr = *field_addr_tmp;
76188 FC_FREE(field_addr_tmp);
76189 }
76190#endif /* FREECIV_JSON_CONNECTION */
76191
76192#ifdef FREECIV_DELTA_PROTOCOL
76193#ifdef FREECIV_JSON_CONNECTION
76194 field_addr.name = "fields";
76195#endif /* FREECIV_JSON_CONNECTION */
76196 DIO_BV_GET(&din, &field_addr, fields);
76197#ifdef FREECIV_JSON_CONNECTION
76198 field_addr.name = "tile";
76199#endif /* FREECIV_JSON_CONNECTION */
76200 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
76201 RECEIVE_PACKET_FIELD_ERROR(tile);
76202 }
76203
76204#else /* FREECIV_DELTA_PROTOCOL */
76205#ifdef FREECIV_JSON_CONNECTION
76206 field_addr.name = "tile";
76207#endif /* FREECIV_JSON_CONNECTION */
76208 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
76209 RECEIVE_PACKET_FIELD_ERROR(tile);
76210 }
76211#ifdef FREECIV_JSON_CONNECTION
76212 field_addr.name = "extras";
76213#endif /* FREECIV_JSON_CONNECTION */
76214 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
76215 RECEIVE_PACKET_FIELD_ERROR(extras);
76216 }
76217#ifdef FREECIV_JSON_CONNECTION
76218 field_addr.name = "resource";
76219#endif /* FREECIV_JSON_CONNECTION */
76220 {
76221 int readin;
76222
76223 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76224 RECEIVE_PACKET_FIELD_ERROR(resource);
76225 }
76226 real_packet->resource = readin;
76227 }
76228#ifdef FREECIV_JSON_CONNECTION
76229 field_addr.name = "terrain";
76230#endif /* FREECIV_JSON_CONNECTION */
76231 {
76232 int readin;
76233
76234 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76235 RECEIVE_PACKET_FIELD_ERROR(terrain);
76236 }
76237 real_packet->terrain = readin;
76238 }
76239#ifdef FREECIV_JSON_CONNECTION
76240 field_addr.name = "startpos_nation";
76241#endif /* FREECIV_JSON_CONNECTION */
76242 {
76243 int readin;
76244
76245 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
76246 RECEIVE_PACKET_FIELD_ERROR(startpos_nation);
76247 }
76248 real_packet->startpos_nation = readin;
76249 }
76250#ifdef FREECIV_JSON_CONNECTION
76251 field_addr.name = "eowner";
76252#endif /* FREECIV_JSON_CONNECTION */
76253 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
76254 RECEIVE_PACKET_FIELD_ERROR(eowner);
76255 }
76256#ifdef FREECIV_JSON_CONNECTION
76257 field_addr.name = "label";
76258#endif /* FREECIV_JSON_CONNECTION */
76259 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
76260 RECEIVE_PACKET_FIELD_ERROR(label);
76261 }
76262#endif
76263 log_packet_detailed("packet_edit_tile_100: got info about (%d)",
76264 real_packet->tile);
76265
76266#ifdef FREECIV_DELTA_PROTOCOL
76267 if (NULL == *hash) {
76268 *hash = genhash_new_full(hash_packet_edit_tile_100, cmp_packet_edit_tile_100,
76269 NULL, NULL, NULL, free);
76270 }
76271
76272 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
76273 *real_packet = *old;
76274 } else {
76275 int tile;
76276
76277 tile = real_packet->tile;
76278
76279 log_packet_detailed(" no old info");
76280 memset(real_packet, 0, sizeof(*real_packet));
76281
76282 real_packet->tile = tile;
76283 }
76284
76285 if (BV_ISSET(fields, 0)) {
76286 log_packet_detailed(" got field 'extras'");
76287#ifdef FREECIV_JSON_CONNECTION
76288 field_addr.name = "extras";
76289#endif /* FREECIV_JSON_CONNECTION */
76290 if (!DIO_BV_GET(&din, &field_addr, real_packet->extras)) {
76291 RECEIVE_PACKET_FIELD_ERROR(extras);
76292 }
76293 }
76294 if (BV_ISSET(fields, 1)) {
76295 log_packet_detailed(" got field 'resource'");
76296#ifdef FREECIV_JSON_CONNECTION
76297 field_addr.name = "resource";
76298#endif /* FREECIV_JSON_CONNECTION */
76299 {
76300 int readin;
76301
76302 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76303 RECEIVE_PACKET_FIELD_ERROR(resource);
76304 }
76305 real_packet->resource = readin;
76306 }
76307 }
76308 if (BV_ISSET(fields, 2)) {
76309 log_packet_detailed(" got field 'terrain'");
76310#ifdef FREECIV_JSON_CONNECTION
76311 field_addr.name = "terrain";
76312#endif /* FREECIV_JSON_CONNECTION */
76313 {
76314 int readin;
76315
76316 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76317 RECEIVE_PACKET_FIELD_ERROR(terrain);
76318 }
76319 real_packet->terrain = readin;
76320 }
76321 }
76322 if (BV_ISSET(fields, 3)) {
76323 log_packet_detailed(" got field 'startpos_nation'");
76324#ifdef FREECIV_JSON_CONNECTION
76325 field_addr.name = "startpos_nation";
76326#endif /* FREECIV_JSON_CONNECTION */
76327 {
76328 int readin;
76329
76330 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
76331 RECEIVE_PACKET_FIELD_ERROR(startpos_nation);
76332 }
76333 real_packet->startpos_nation = readin;
76334 }
76335 }
76336 if (BV_ISSET(fields, 4)) {
76337 log_packet_detailed(" got field 'eowner'");
76338#ifdef FREECIV_JSON_CONNECTION
76339 field_addr.name = "eowner";
76340#endif /* FREECIV_JSON_CONNECTION */
76341 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->eowner)) {
76342 RECEIVE_PACKET_FIELD_ERROR(eowner);
76343 }
76344 }
76345 if (BV_ISSET(fields, 5)) {
76346 log_packet_detailed(" got field 'label'");
76347#ifdef FREECIV_JSON_CONNECTION
76348 field_addr.name = "label";
76349#endif /* FREECIV_JSON_CONNECTION */
76350 if (!DIO_GET(string, &din, &field_addr, real_packet->label, sizeof(real_packet->label))) {
76351 RECEIVE_PACKET_FIELD_ERROR(label);
76352 }
76353 }
76354
76355 if (NULL == old) {
76356 old = fc_malloc(sizeof(*old));
76357 *old = *real_packet;
76358 genhash_insert(*hash, old, old);
76359 } else {
76360 *old = *real_packet;
76361 }
76362
76363#endif /* FREECIV_DELTA_PROTOCOL */
76364 RECEIVE_PACKET_END(real_packet);
76365}
76366
76367 static int send_packet_edit_tile_100(struct connection *pc, const struct packet_edit_tile *packet)
76368{
76369 const struct packet_edit_tile *real_packet = packet;
76370 int e;
76371#ifdef FREECIV_DELTA_PROTOCOL
76372 packet_edit_tile_100_fields fields;
76373 struct packet_edit_tile *old;
76374 bool differ;
76375 struct genhash **hash = pc->phs.sent + PACKET_EDIT_TILE;
76376#endif /* FREECIV_DELTA_PROTOCOL */
76377 SEND_PACKET_START(PACKET_EDIT_TILE);
76378#ifdef FREECIV_JSON_CONNECTION
76379 struct plocation field_addr;
76380 {
76381 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76382 field_addr = *field_addr_tmp;
76383 FC_FREE(field_addr_tmp);
76384 }
76385#endif /* FREECIV_JSON_CONNECTION */
76386
76387 log_packet_detailed("packet_edit_tile_100: sending info about (%d)",
76388 real_packet->tile);
76389
76390#ifdef FREECIV_DELTA_PROTOCOL
76391 if (NULL == *hash) {
76392 *hash = genhash_new_full(hash_packet_edit_tile_100, cmp_packet_edit_tile_100,
76393 NULL, NULL, NULL, free);
76394 }
76395 BV_CLR_ALL(fields);
76396
76397 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
76398 old = fc_malloc(sizeof(*old));
76399 *old = *real_packet;
76400 genhash_insert(*hash, old, old);
76401 memset(old, 0, sizeof(*old));
76402 }
76403 differ = !BV_ARE_EQUAL(old->extras, real_packet->extras);
76404 if (differ) {
76405 BV_SET(fields, 0);
76406 }
76407
76408 differ = (old->resource != real_packet->resource);
76409 if (differ) {
76410 BV_SET(fields, 1);
76411 }
76412
76413 differ = (old->terrain != real_packet->terrain);
76414 if (differ) {
76415 BV_SET(fields, 2);
76416 }
76417
76418 differ = (old->startpos_nation != real_packet->startpos_nation);
76419 if (differ) {
76420 BV_SET(fields, 3);
76421 }
76422
76423 differ = (old->eowner != real_packet->eowner);
76424 if (differ) {
76425 BV_SET(fields, 4);
76426 }
76427
76428 differ = (strcmp(old->label, real_packet->label) != 0);
76429 if (differ) {
76430 BV_SET(fields, 5);
76431 }
76432
76433
76434#ifdef FREECIV_JSON_CONNECTION
76435 field_addr.name = "fields";
76436#endif /* FREECIV_JSON_CONNECTION */
76437 e = 0;
76438 e |= DIO_BV_PUT(&dout, &field_addr, fields);
76439 if (e) {
76440 log_packet_detailed("fields bitvector error detected");
76441 }
76442#ifdef FREECIV_JSON_CONNECTION
76443 field_addr.name = "tile";
76444#endif /* FREECIV_JSON_CONNECTION */
76445 e = 0;
76446 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
76447 if (e) {
76448 log_packet_detailed("'tile' field error detected");
76449 }
76450
76451 if (BV_ISSET(fields, 0)) {
76452 log_packet_detailed(" field 'extras' has changed");
76453#ifdef FREECIV_JSON_CONNECTION
76454 field_addr.name = "extras";
76455#endif /* FREECIV_JSON_CONNECTION */
76456 e = 0;
76457 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
76458 if (e) {
76459 log_packet_detailed("'extras' field error detected");
76460 }
76461 }
76462 if (BV_ISSET(fields, 1)) {
76463 log_packet_detailed(" field 'resource' has changed");
76464#ifdef FREECIV_JSON_CONNECTION
76465 field_addr.name = "resource";
76466#endif /* FREECIV_JSON_CONNECTION */
76467 e = 0;
76468 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
76469 if (e) {
76470 log_packet_detailed("'resource' field error detected");
76471 }
76472 }
76473 if (BV_ISSET(fields, 2)) {
76474 log_packet_detailed(" field 'terrain' has changed");
76475#ifdef FREECIV_JSON_CONNECTION
76476 field_addr.name = "terrain";
76477#endif /* FREECIV_JSON_CONNECTION */
76478 e = 0;
76479 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
76480 if (e) {
76481 log_packet_detailed("'terrain' field error detected");
76482 }
76483 }
76484 if (BV_ISSET(fields, 3)) {
76485 log_packet_detailed(" field 'startpos_nation' has changed");
76486#ifdef FREECIV_JSON_CONNECTION
76487 field_addr.name = "startpos_nation";
76488#endif /* FREECIV_JSON_CONNECTION */
76489 e = 0;
76490 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->startpos_nation);
76491 if (e) {
76492 log_packet_detailed("'startpos_nation' field error detected");
76493 }
76494 }
76495 if (BV_ISSET(fields, 4)) {
76496 log_packet_detailed(" field 'eowner' has changed");
76497#ifdef FREECIV_JSON_CONNECTION
76498 field_addr.name = "eowner";
76499#endif /* FREECIV_JSON_CONNECTION */
76500 e = 0;
76501 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
76502 if (e) {
76503 log_packet_detailed("'eowner' field error detected");
76504 }
76505 }
76506 if (BV_ISSET(fields, 5)) {
76507 log_packet_detailed(" field 'label' has changed");
76508#ifdef FREECIV_JSON_CONNECTION
76509 field_addr.name = "label";
76510#endif /* FREECIV_JSON_CONNECTION */
76511 e = 0;
76512 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
76513 if (e) {
76514 log_packet_detailed("'label' field error detected");
76515 }
76516 }
76517
76518 *old = *real_packet;
76519#endif /* FREECIV_DELTA_PROTOCOL */
76520#ifndef FREECIV_DELTA_PROTOCOL
76521#ifdef FREECIV_JSON_CONNECTION
76522 field_addr.name = "tile";
76523#endif /* FREECIV_JSON_CONNECTION */
76524 e = 0;
76525 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
76526 if (e) {
76527 log_packet_detailed("'tile' field error detected");
76528 }
76529#ifdef FREECIV_JSON_CONNECTION
76530 field_addr.name = "extras";
76531#endif /* FREECIV_JSON_CONNECTION */
76532 e = 0;
76533 e |= DIO_BV_PUT(&dout, &field_addr, packet->extras);
76534 if (e) {
76535 log_packet_detailed("'extras' field error detected");
76536 }
76537#ifdef FREECIV_JSON_CONNECTION
76538 field_addr.name = "resource";
76539#endif /* FREECIV_JSON_CONNECTION */
76540 e = 0;
76541 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->resource);
76542 if (e) {
76543 log_packet_detailed("'resource' field error detected");
76544 }
76545#ifdef FREECIV_JSON_CONNECTION
76546 field_addr.name = "terrain";
76547#endif /* FREECIV_JSON_CONNECTION */
76548 e = 0;
76549 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->terrain);
76550 if (e) {
76551 log_packet_detailed("'terrain' field error detected");
76552 }
76553#ifdef FREECIV_JSON_CONNECTION
76554 field_addr.name = "startpos_nation";
76555#endif /* FREECIV_JSON_CONNECTION */
76556 e = 0;
76557 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->startpos_nation);
76558 if (e) {
76559 log_packet_detailed("'startpos_nation' field error detected");
76560 }
76561#ifdef FREECIV_JSON_CONNECTION
76562 field_addr.name = "eowner";
76563#endif /* FREECIV_JSON_CONNECTION */
76564 e = 0;
76565 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->eowner);
76566 if (e) {
76567 log_packet_detailed("'eowner' field error detected");
76568 }
76569#ifdef FREECIV_JSON_CONNECTION
76570 field_addr.name = "label";
76571#endif /* FREECIV_JSON_CONNECTION */
76572 e = 0;
76573 e |= DIO_PUT(string, &dout, &field_addr, real_packet->label);
76574 if (e) {
76575 log_packet_detailed("'label' field error detected");
76576 }
76577
76578#endif
76579 SEND_PACKET_END(PACKET_EDIT_TILE);
76580}
76581
76582 int send_packet_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
76583{
76584 if (!pc->used) {
76585 log_error("WARNING: trying to send data to the closed connection %s",
76586 conn_description(pc));
76587 return -1;
76588 }
76589 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_TILE].packet != NULL, -1,
76590 "Handler for PACKET_EDIT_TILE not installed");
76591 return pc->phs.handlers->send[PACKET_EDIT_TILE].packet(pc, packet);
76592}
76593
76594#ifdef FREECIV_DELTA_PROTOCOL
76595#define hash_packet_edit_unit_create_100 hash_const
76596
76597#define cmp_packet_edit_unit_create_100 cmp_const
76598
76599 BV_DEFINE(packet_edit_unit_create_100_fields, 5);
76600#endif /* FREECIV_DELTA_PROTOCOL */
76601
76602 static struct packet_edit_unit_create *receive_packet_edit_unit_create_100(struct connection *pc)
76603{
76604#ifdef FREECIV_DELTA_PROTOCOL
76605 packet_edit_unit_create_100_fields fields;
76606 struct packet_edit_unit_create *old;
76607 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_CREATE;
76608#endif /* FREECIV_DELTA_PROTOCOL */
76609 RECEIVE_PACKET_START(packet_edit_unit_create, real_packet);
76610#ifdef FREECIV_JSON_CONNECTION
76611 struct plocation field_addr;
76612 {
76613 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76614 field_addr = *field_addr_tmp;
76615 FC_FREE(field_addr_tmp);
76616 }
76617#endif /* FREECIV_JSON_CONNECTION */
76618
76619#ifdef FREECIV_DELTA_PROTOCOL
76620#ifdef FREECIV_JSON_CONNECTION
76621 field_addr.name = "fields";
76622#endif /* FREECIV_JSON_CONNECTION */
76623 DIO_BV_GET(&din, &field_addr, fields);
76624
76625#else /* FREECIV_DELTA_PROTOCOL */
76626#ifdef FREECIV_JSON_CONNECTION
76627 field_addr.name = "owner";
76628#endif /* FREECIV_JSON_CONNECTION */
76629 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
76630 RECEIVE_PACKET_FIELD_ERROR(owner);
76631 }
76632#ifdef FREECIV_JSON_CONNECTION
76633 field_addr.name = "tile";
76634#endif /* FREECIV_JSON_CONNECTION */
76635 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
76636 RECEIVE_PACKET_FIELD_ERROR(tile);
76637 }
76638#ifdef FREECIV_JSON_CONNECTION
76639 field_addr.name = "type";
76640#endif /* FREECIV_JSON_CONNECTION */
76641 {
76642 int readin;
76643
76644 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76645 RECEIVE_PACKET_FIELD_ERROR(type);
76646 }
76647 real_packet->type = readin;
76648 }
76649#ifdef FREECIV_JSON_CONNECTION
76650 field_addr.name = "count";
76651#endif /* FREECIV_JSON_CONNECTION */
76652 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
76653 RECEIVE_PACKET_FIELD_ERROR(count);
76654 }
76655#ifdef FREECIV_JSON_CONNECTION
76656 field_addr.name = "tag";
76657#endif /* FREECIV_JSON_CONNECTION */
76658 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
76659 RECEIVE_PACKET_FIELD_ERROR(tag);
76660 }
76661#endif
76662 log_packet_detailed("packet_edit_unit_create_100: got info about ()");
76663
76664#ifdef FREECIV_DELTA_PROTOCOL
76665 if (NULL == *hash) {
76666 *hash = genhash_new_full(hash_packet_edit_unit_create_100, cmp_packet_edit_unit_create_100,
76667 NULL, NULL, NULL, free);
76668 }
76669
76670 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
76671 *real_packet = *old;
76672 } else {
76673 log_packet_detailed(" no old info");
76674 memset(real_packet, 0, sizeof(*real_packet));
76675 }
76676
76677 if (BV_ISSET(fields, 0)) {
76678 log_packet_detailed(" got field 'owner'");
76679#ifdef FREECIV_JSON_CONNECTION
76680 field_addr.name = "owner";
76681#endif /* FREECIV_JSON_CONNECTION */
76682 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
76683 RECEIVE_PACKET_FIELD_ERROR(owner);
76684 }
76685 }
76686 if (BV_ISSET(fields, 1)) {
76687 log_packet_detailed(" got field 'tile'");
76688#ifdef FREECIV_JSON_CONNECTION
76689 field_addr.name = "tile";
76690#endif /* FREECIV_JSON_CONNECTION */
76691 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
76692 RECEIVE_PACKET_FIELD_ERROR(tile);
76693 }
76694 }
76695 if (BV_ISSET(fields, 2)) {
76696 log_packet_detailed(" got field 'type'");
76697#ifdef FREECIV_JSON_CONNECTION
76698 field_addr.name = "type";
76699#endif /* FREECIV_JSON_CONNECTION */
76700 {
76701 int readin;
76702
76703 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76704 RECEIVE_PACKET_FIELD_ERROR(type);
76705 }
76706 real_packet->type = readin;
76707 }
76708 }
76709 if (BV_ISSET(fields, 3)) {
76710 log_packet_detailed(" got field 'count'");
76711#ifdef FREECIV_JSON_CONNECTION
76712 field_addr.name = "count";
76713#endif /* FREECIV_JSON_CONNECTION */
76714 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
76715 RECEIVE_PACKET_FIELD_ERROR(count);
76716 }
76717 }
76718 if (BV_ISSET(fields, 4)) {
76719 log_packet_detailed(" got field 'tag'");
76720#ifdef FREECIV_JSON_CONNECTION
76721 field_addr.name = "tag";
76722#endif /* FREECIV_JSON_CONNECTION */
76723 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
76724 RECEIVE_PACKET_FIELD_ERROR(tag);
76725 }
76726 }
76727
76728 if (NULL == old) {
76729 old = fc_malloc(sizeof(*old));
76730 *old = *real_packet;
76731 genhash_insert(*hash, old, old);
76732 } else {
76733 *old = *real_packet;
76734 }
76735
76736#endif /* FREECIV_DELTA_PROTOCOL */
76737 RECEIVE_PACKET_END(real_packet);
76738}
76739
76740 static int send_packet_edit_unit_create_100(struct connection *pc, const struct packet_edit_unit_create *packet)
76741{
76742 const struct packet_edit_unit_create *real_packet = packet;
76743 int e;
76744#ifdef FREECIV_DELTA_PROTOCOL
76745 packet_edit_unit_create_100_fields fields;
76746 struct packet_edit_unit_create *old;
76747 bool differ;
76748 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_CREATE;
76749#endif /* FREECIV_DELTA_PROTOCOL */
76750 SEND_PACKET_START(PACKET_EDIT_UNIT_CREATE);
76751#ifdef FREECIV_JSON_CONNECTION
76752 struct plocation field_addr;
76753 {
76754 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76755 field_addr = *field_addr_tmp;
76756 FC_FREE(field_addr_tmp);
76757 }
76758#endif /* FREECIV_JSON_CONNECTION */
76759
76760 log_packet_detailed("packet_edit_unit_create_100: sending info about ()");
76761
76762#ifdef FREECIV_DELTA_PROTOCOL
76763 if (NULL == *hash) {
76764 *hash = genhash_new_full(hash_packet_edit_unit_create_100, cmp_packet_edit_unit_create_100,
76765 NULL, NULL, NULL, free);
76766 }
76767 BV_CLR_ALL(fields);
76768
76769 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
76770 old = fc_malloc(sizeof(*old));
76771 *old = *real_packet;
76772 genhash_insert(*hash, old, old);
76773 memset(old, 0, sizeof(*old));
76774 }
76775 differ = (old->owner != real_packet->owner);
76776 if (differ) {
76777 BV_SET(fields, 0);
76778 }
76779
76780 differ = (old->tile != real_packet->tile);
76781 if (differ) {
76782 BV_SET(fields, 1);
76783 }
76784
76785 differ = (old->type != real_packet->type);
76786 if (differ) {
76787 BV_SET(fields, 2);
76788 }
76789
76790 differ = (old->count != real_packet->count);
76791 if (differ) {
76792 BV_SET(fields, 3);
76793 }
76794
76795 differ = (old->tag != real_packet->tag);
76796 if (differ) {
76797 BV_SET(fields, 4);
76798 }
76799
76800
76801#ifdef FREECIV_JSON_CONNECTION
76802 field_addr.name = "fields";
76803#endif /* FREECIV_JSON_CONNECTION */
76804 e = 0;
76805 e |= DIO_BV_PUT(&dout, &field_addr, fields);
76806 if (e) {
76807 log_packet_detailed("fields bitvector error detected");
76808 }
76809
76810 if (BV_ISSET(fields, 0)) {
76811 log_packet_detailed(" field 'owner' has changed");
76812#ifdef FREECIV_JSON_CONNECTION
76813 field_addr.name = "owner";
76814#endif /* FREECIV_JSON_CONNECTION */
76815 e = 0;
76816 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
76817 if (e) {
76818 log_packet_detailed("'owner' field error detected");
76819 }
76820 }
76821 if (BV_ISSET(fields, 1)) {
76822 log_packet_detailed(" field 'tile' has changed");
76823#ifdef FREECIV_JSON_CONNECTION
76824 field_addr.name = "tile";
76825#endif /* FREECIV_JSON_CONNECTION */
76826 e = 0;
76827 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
76828 if (e) {
76829 log_packet_detailed("'tile' field error detected");
76830 }
76831 }
76832 if (BV_ISSET(fields, 2)) {
76833 log_packet_detailed(" field 'type' has changed");
76834#ifdef FREECIV_JSON_CONNECTION
76835 field_addr.name = "type";
76836#endif /* FREECIV_JSON_CONNECTION */
76837 e = 0;
76838 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
76839 if (e) {
76840 log_packet_detailed("'type' field error detected");
76841 }
76842 }
76843 if (BV_ISSET(fields, 3)) {
76844 log_packet_detailed(" field 'count' has changed");
76845#ifdef FREECIV_JSON_CONNECTION
76846 field_addr.name = "count";
76847#endif /* FREECIV_JSON_CONNECTION */
76848 e = 0;
76849 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
76850 if (e) {
76851 log_packet_detailed("'count' field error detected");
76852 }
76853 }
76854 if (BV_ISSET(fields, 4)) {
76855 log_packet_detailed(" field 'tag' has changed");
76856#ifdef FREECIV_JSON_CONNECTION
76857 field_addr.name = "tag";
76858#endif /* FREECIV_JSON_CONNECTION */
76859 e = 0;
76860 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
76861 if (e) {
76862 log_packet_detailed("'tag' field error detected");
76863 }
76864 }
76865
76866 *old = *real_packet;
76867#endif /* FREECIV_DELTA_PROTOCOL */
76868#ifndef FREECIV_DELTA_PROTOCOL
76869#ifdef FREECIV_JSON_CONNECTION
76870 field_addr.name = "owner";
76871#endif /* FREECIV_JSON_CONNECTION */
76872 e = 0;
76873 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
76874 if (e) {
76875 log_packet_detailed("'owner' field error detected");
76876 }
76877#ifdef FREECIV_JSON_CONNECTION
76878 field_addr.name = "tile";
76879#endif /* FREECIV_JSON_CONNECTION */
76880 e = 0;
76881 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
76882 if (e) {
76883 log_packet_detailed("'tile' field error detected");
76884 }
76885#ifdef FREECIV_JSON_CONNECTION
76886 field_addr.name = "type";
76887#endif /* FREECIV_JSON_CONNECTION */
76888 e = 0;
76889 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
76890 if (e) {
76891 log_packet_detailed("'type' field error detected");
76892 }
76893#ifdef FREECIV_JSON_CONNECTION
76894 field_addr.name = "count";
76895#endif /* FREECIV_JSON_CONNECTION */
76896 e = 0;
76897 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
76898 if (e) {
76899 log_packet_detailed("'count' field error detected");
76900 }
76901#ifdef FREECIV_JSON_CONNECTION
76902 field_addr.name = "tag";
76903#endif /* FREECIV_JSON_CONNECTION */
76904 e = 0;
76905 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
76906 if (e) {
76907 log_packet_detailed("'tag' field error detected");
76908 }
76909
76910#endif
76911 SEND_PACKET_END(PACKET_EDIT_UNIT_CREATE);
76912}
76913
76914 int send_packet_edit_unit_create(struct connection *pc, const struct packet_edit_unit_create *packet)
76915{
76916 if (!pc->used) {
76917 log_error("WARNING: trying to send data to the closed connection %s",
76918 conn_description(pc));
76919 return -1;
76920 }
76921 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_CREATE].packet != NULL, -1,
76922 "Handler for PACKET_EDIT_UNIT_CREATE not installed");
76923 return pc->phs.handlers->send[PACKET_EDIT_UNIT_CREATE].packet(pc, packet);
76924}
76925
76926 int dsend_packet_edit_unit_create(struct connection *pc, int owner, int tile, Unit_type_id type, int count, int tag)
76927{
76928 struct packet_edit_unit_create packet, *real_packet = &packet;
76929
76930 real_packet->owner = owner;
76931 real_packet->tile = tile;
76932 real_packet->type = type;
76933 real_packet->count = count;
76934 real_packet->tag = tag;
76935
76936 return send_packet_edit_unit_create(pc, real_packet);
76937}
76938
76939#ifdef FREECIV_DELTA_PROTOCOL
76940#define hash_packet_edit_unit_remove_100 hash_const
76941
76942#define cmp_packet_edit_unit_remove_100 cmp_const
76943
76944 BV_DEFINE(packet_edit_unit_remove_100_fields, 4);
76945#endif /* FREECIV_DELTA_PROTOCOL */
76946
76947 static struct packet_edit_unit_remove *receive_packet_edit_unit_remove_100(struct connection *pc)
76948{
76949#ifdef FREECIV_DELTA_PROTOCOL
76950 packet_edit_unit_remove_100_fields fields;
76951 struct packet_edit_unit_remove *old;
76952 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_REMOVE;
76953#endif /* FREECIV_DELTA_PROTOCOL */
76954 RECEIVE_PACKET_START(packet_edit_unit_remove, real_packet);
76955#ifdef FREECIV_JSON_CONNECTION
76956 struct plocation field_addr;
76957 {
76958 struct plocation *field_addr_tmp = plocation_field_new(NULL);
76959 field_addr = *field_addr_tmp;
76960 FC_FREE(field_addr_tmp);
76961 }
76962#endif /* FREECIV_JSON_CONNECTION */
76963
76964#ifdef FREECIV_DELTA_PROTOCOL
76965#ifdef FREECIV_JSON_CONNECTION
76966 field_addr.name = "fields";
76967#endif /* FREECIV_JSON_CONNECTION */
76968 DIO_BV_GET(&din, &field_addr, fields);
76969
76970#else /* FREECIV_DELTA_PROTOCOL */
76971#ifdef FREECIV_JSON_CONNECTION
76972 field_addr.name = "owner";
76973#endif /* FREECIV_JSON_CONNECTION */
76974 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
76975 RECEIVE_PACKET_FIELD_ERROR(owner);
76976 }
76977#ifdef FREECIV_JSON_CONNECTION
76978 field_addr.name = "tile";
76979#endif /* FREECIV_JSON_CONNECTION */
76980 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
76981 RECEIVE_PACKET_FIELD_ERROR(tile);
76982 }
76983#ifdef FREECIV_JSON_CONNECTION
76984 field_addr.name = "type";
76985#endif /* FREECIV_JSON_CONNECTION */
76986 {
76987 int readin;
76988
76989 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
76990 RECEIVE_PACKET_FIELD_ERROR(type);
76991 }
76992 real_packet->type = readin;
76993 }
76994#ifdef FREECIV_JSON_CONNECTION
76995 field_addr.name = "count";
76996#endif /* FREECIV_JSON_CONNECTION */
76997 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
76998 RECEIVE_PACKET_FIELD_ERROR(count);
76999 }
77000#endif
77001 log_packet_detailed("packet_edit_unit_remove_100: got info about ()");
77002
77003#ifdef FREECIV_DELTA_PROTOCOL
77004 if (NULL == *hash) {
77005 *hash = genhash_new_full(hash_packet_edit_unit_remove_100, cmp_packet_edit_unit_remove_100,
77006 NULL, NULL, NULL, free);
77007 }
77008
77009 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
77010 *real_packet = *old;
77011 } else {
77012 log_packet_detailed(" no old info");
77013 memset(real_packet, 0, sizeof(*real_packet));
77014 }
77015
77016 if (BV_ISSET(fields, 0)) {
77017 log_packet_detailed(" got field 'owner'");
77018#ifdef FREECIV_JSON_CONNECTION
77019 field_addr.name = "owner";
77020#endif /* FREECIV_JSON_CONNECTION */
77021 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
77022 RECEIVE_PACKET_FIELD_ERROR(owner);
77023 }
77024 }
77025 if (BV_ISSET(fields, 1)) {
77026 log_packet_detailed(" got field 'tile'");
77027#ifdef FREECIV_JSON_CONNECTION
77028 field_addr.name = "tile";
77029#endif /* FREECIV_JSON_CONNECTION */
77030 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
77031 RECEIVE_PACKET_FIELD_ERROR(tile);
77032 }
77033 }
77034 if (BV_ISSET(fields, 2)) {
77035 log_packet_detailed(" got field 'type'");
77036#ifdef FREECIV_JSON_CONNECTION
77037 field_addr.name = "type";
77038#endif /* FREECIV_JSON_CONNECTION */
77039 {
77040 int readin;
77041
77042 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77043 RECEIVE_PACKET_FIELD_ERROR(type);
77044 }
77045 real_packet->type = readin;
77046 }
77047 }
77048 if (BV_ISSET(fields, 3)) {
77049 log_packet_detailed(" got field 'count'");
77050#ifdef FREECIV_JSON_CONNECTION
77051 field_addr.name = "count";
77052#endif /* FREECIV_JSON_CONNECTION */
77053 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->count)) {
77054 RECEIVE_PACKET_FIELD_ERROR(count);
77055 }
77056 }
77057
77058 if (NULL == old) {
77059 old = fc_malloc(sizeof(*old));
77060 *old = *real_packet;
77061 genhash_insert(*hash, old, old);
77062 } else {
77063 *old = *real_packet;
77064 }
77065
77066#endif /* FREECIV_DELTA_PROTOCOL */
77067 RECEIVE_PACKET_END(real_packet);
77068}
77069
77070 static int send_packet_edit_unit_remove_100(struct connection *pc, const struct packet_edit_unit_remove *packet)
77071{
77072 const struct packet_edit_unit_remove *real_packet = packet;
77073 int e;
77074#ifdef FREECIV_DELTA_PROTOCOL
77075 packet_edit_unit_remove_100_fields fields;
77076 struct packet_edit_unit_remove *old;
77077 bool differ;
77078 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_REMOVE;
77079#endif /* FREECIV_DELTA_PROTOCOL */
77080 SEND_PACKET_START(PACKET_EDIT_UNIT_REMOVE);
77081#ifdef FREECIV_JSON_CONNECTION
77082 struct plocation field_addr;
77083 {
77084 struct plocation *field_addr_tmp = plocation_field_new(NULL);
77085 field_addr = *field_addr_tmp;
77086 FC_FREE(field_addr_tmp);
77087 }
77088#endif /* FREECIV_JSON_CONNECTION */
77089
77090 log_packet_detailed("packet_edit_unit_remove_100: sending info about ()");
77091
77092#ifdef FREECIV_DELTA_PROTOCOL
77093 if (NULL == *hash) {
77094 *hash = genhash_new_full(hash_packet_edit_unit_remove_100, cmp_packet_edit_unit_remove_100,
77095 NULL, NULL, NULL, free);
77096 }
77097 BV_CLR_ALL(fields);
77098
77099 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
77100 old = fc_malloc(sizeof(*old));
77101 *old = *real_packet;
77102 genhash_insert(*hash, old, old);
77103 memset(old, 0, sizeof(*old));
77104 }
77105 differ = (old->owner != real_packet->owner);
77106 if (differ) {
77107 BV_SET(fields, 0);
77108 }
77109
77110 differ = (old->tile != real_packet->tile);
77111 if (differ) {
77112 BV_SET(fields, 1);
77113 }
77114
77115 differ = (old->type != real_packet->type);
77116 if (differ) {
77117 BV_SET(fields, 2);
77118 }
77119
77120 differ = (old->count != real_packet->count);
77121 if (differ) {
77122 BV_SET(fields, 3);
77123 }
77124
77125
77126#ifdef FREECIV_JSON_CONNECTION
77127 field_addr.name = "fields";
77128#endif /* FREECIV_JSON_CONNECTION */
77129 e = 0;
77130 e |= DIO_BV_PUT(&dout, &field_addr, fields);
77131 if (e) {
77132 log_packet_detailed("fields bitvector error detected");
77133 }
77134
77135 if (BV_ISSET(fields, 0)) {
77136 log_packet_detailed(" field 'owner' has changed");
77137#ifdef FREECIV_JSON_CONNECTION
77138 field_addr.name = "owner";
77139#endif /* FREECIV_JSON_CONNECTION */
77140 e = 0;
77141 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
77142 if (e) {
77143 log_packet_detailed("'owner' field error detected");
77144 }
77145 }
77146 if (BV_ISSET(fields, 1)) {
77147 log_packet_detailed(" field 'tile' has changed");
77148#ifdef FREECIV_JSON_CONNECTION
77149 field_addr.name = "tile";
77150#endif /* FREECIV_JSON_CONNECTION */
77151 e = 0;
77152 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
77153 if (e) {
77154 log_packet_detailed("'tile' field error detected");
77155 }
77156 }
77157 if (BV_ISSET(fields, 2)) {
77158 log_packet_detailed(" field 'type' has changed");
77159#ifdef FREECIV_JSON_CONNECTION
77160 field_addr.name = "type";
77161#endif /* FREECIV_JSON_CONNECTION */
77162 e = 0;
77163 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
77164 if (e) {
77165 log_packet_detailed("'type' field error detected");
77166 }
77167 }
77168 if (BV_ISSET(fields, 3)) {
77169 log_packet_detailed(" field 'count' has changed");
77170#ifdef FREECIV_JSON_CONNECTION
77171 field_addr.name = "count";
77172#endif /* FREECIV_JSON_CONNECTION */
77173 e = 0;
77174 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
77175 if (e) {
77176 log_packet_detailed("'count' field error detected");
77177 }
77178 }
77179
77180 *old = *real_packet;
77181#endif /* FREECIV_DELTA_PROTOCOL */
77182#ifndef FREECIV_DELTA_PROTOCOL
77183#ifdef FREECIV_JSON_CONNECTION
77184 field_addr.name = "owner";
77185#endif /* FREECIV_JSON_CONNECTION */
77186 e = 0;
77187 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
77188 if (e) {
77189 log_packet_detailed("'owner' field error detected");
77190 }
77191#ifdef FREECIV_JSON_CONNECTION
77192 field_addr.name = "tile";
77193#endif /* FREECIV_JSON_CONNECTION */
77194 e = 0;
77195 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
77196 if (e) {
77197 log_packet_detailed("'tile' field error detected");
77198 }
77199#ifdef FREECIV_JSON_CONNECTION
77200 field_addr.name = "type";
77201#endif /* FREECIV_JSON_CONNECTION */
77202 e = 0;
77203 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->type);
77204 if (e) {
77205 log_packet_detailed("'type' field error detected");
77206 }
77207#ifdef FREECIV_JSON_CONNECTION
77208 field_addr.name = "count";
77209#endif /* FREECIV_JSON_CONNECTION */
77210 e = 0;
77211 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->count);
77212 if (e) {
77213 log_packet_detailed("'count' field error detected");
77214 }
77215
77216#endif
77217 SEND_PACKET_END(PACKET_EDIT_UNIT_REMOVE);
77218}
77219
77220 int send_packet_edit_unit_remove(struct connection *pc, const struct packet_edit_unit_remove *packet)
77221{
77222 if (!pc->used) {
77223 log_error("WARNING: trying to send data to the closed connection %s",
77224 conn_description(pc));
77225 return -1;
77226 }
77227 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE].packet != NULL, -1,
77228 "Handler for PACKET_EDIT_UNIT_REMOVE not installed");
77229 return pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE].packet(pc, packet);
77230}
77231
77232 int dsend_packet_edit_unit_remove(struct connection *pc, int owner, int tile, Unit_type_id type, int count)
77233{
77234 struct packet_edit_unit_remove packet, *real_packet = &packet;
77235
77236 real_packet->owner = owner;
77237 real_packet->tile = tile;
77238 real_packet->type = type;
77239 real_packet->count = count;
77240
77241 return send_packet_edit_unit_remove(pc, real_packet);
77242}
77243
77244#ifdef FREECIV_DELTA_PROTOCOL
77245#define hash_packet_edit_unit_remove_by_id_100 hash_const
77246
77247#define cmp_packet_edit_unit_remove_by_id_100 cmp_const
77248
77249 BV_DEFINE(packet_edit_unit_remove_by_id_100_fields, 1);
77250#endif /* FREECIV_DELTA_PROTOCOL */
77251
77252 static struct packet_edit_unit_remove_by_id *receive_packet_edit_unit_remove_by_id_100(struct connection *pc)
77253{
77254#ifdef FREECIV_DELTA_PROTOCOL
77255 packet_edit_unit_remove_by_id_100_fields fields;
77256 struct packet_edit_unit_remove_by_id *old;
77257 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT_REMOVE_BY_ID;
77258#endif /* FREECIV_DELTA_PROTOCOL */
77259 RECEIVE_PACKET_START(packet_edit_unit_remove_by_id, real_packet);
77260#ifdef FREECIV_JSON_CONNECTION
77261 struct plocation field_addr;
77262 {
77263 struct plocation *field_addr_tmp = plocation_field_new(NULL);
77264 field_addr = *field_addr_tmp;
77265 FC_FREE(field_addr_tmp);
77266 }
77267#endif /* FREECIV_JSON_CONNECTION */
77268
77269#ifdef FREECIV_DELTA_PROTOCOL
77270#ifdef FREECIV_JSON_CONNECTION
77271 field_addr.name = "fields";
77272#endif /* FREECIV_JSON_CONNECTION */
77273 DIO_BV_GET(&din, &field_addr, fields);
77274
77275#else /* FREECIV_DELTA_PROTOCOL */
77276#ifdef FREECIV_JSON_CONNECTION
77277 field_addr.name = "id";
77278#endif /* FREECIV_JSON_CONNECTION */
77279 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
77280 RECEIVE_PACKET_FIELD_ERROR(id);
77281 }
77282#endif
77283 log_packet_detailed("packet_edit_unit_remove_by_id_100: got info about ()");
77284
77285#ifdef FREECIV_DELTA_PROTOCOL
77286 if (NULL == *hash) {
77287 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_100, cmp_packet_edit_unit_remove_by_id_100,
77288 NULL, NULL, NULL, free);
77289 }
77290
77291 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
77292 *real_packet = *old;
77293 } else {
77294 log_packet_detailed(" no old info");
77295 memset(real_packet, 0, sizeof(*real_packet));
77296 }
77297
77298 if (BV_ISSET(fields, 0)) {
77299 log_packet_detailed(" got field 'id'");
77300#ifdef FREECIV_JSON_CONNECTION
77301 field_addr.name = "id";
77302#endif /* FREECIV_JSON_CONNECTION */
77303 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
77304 RECEIVE_PACKET_FIELD_ERROR(id);
77305 }
77306 }
77307
77308 if (NULL == old) {
77309 old = fc_malloc(sizeof(*old));
77310 *old = *real_packet;
77311 genhash_insert(*hash, old, old);
77312 } else {
77313 *old = *real_packet;
77314 }
77315
77316#endif /* FREECIV_DELTA_PROTOCOL */
77317 RECEIVE_PACKET_END(real_packet);
77318}
77319
77320 static int send_packet_edit_unit_remove_by_id_100(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
77321{
77322 const struct packet_edit_unit_remove_by_id *real_packet = packet;
77323 int e;
77324#ifdef FREECIV_DELTA_PROTOCOL
77325 packet_edit_unit_remove_by_id_100_fields fields;
77326 struct packet_edit_unit_remove_by_id *old;
77327 bool differ;
77328 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT_REMOVE_BY_ID;
77329#endif /* FREECIV_DELTA_PROTOCOL */
77330 SEND_PACKET_START(PACKET_EDIT_UNIT_REMOVE_BY_ID);
77331#ifdef FREECIV_JSON_CONNECTION
77332 struct plocation field_addr;
77333 {
77334 struct plocation *field_addr_tmp = plocation_field_new(NULL);
77335 field_addr = *field_addr_tmp;
77336 FC_FREE(field_addr_tmp);
77337 }
77338#endif /* FREECIV_JSON_CONNECTION */
77339
77340 log_packet_detailed("packet_edit_unit_remove_by_id_100: sending info about ()");
77341
77342#ifdef FREECIV_DELTA_PROTOCOL
77343 if (NULL == *hash) {
77344 *hash = genhash_new_full(hash_packet_edit_unit_remove_by_id_100, cmp_packet_edit_unit_remove_by_id_100,
77345 NULL, NULL, NULL, free);
77346 }
77347 BV_CLR_ALL(fields);
77348
77349 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
77350 old = fc_malloc(sizeof(*old));
77351 *old = *real_packet;
77352 genhash_insert(*hash, old, old);
77353 memset(old, 0, sizeof(*old));
77354 }
77355 differ = (old->id != real_packet->id);
77356 if (differ) {
77357 BV_SET(fields, 0);
77358 }
77359
77360
77361#ifdef FREECIV_JSON_CONNECTION
77362 field_addr.name = "fields";
77363#endif /* FREECIV_JSON_CONNECTION */
77364 e = 0;
77365 e |= DIO_BV_PUT(&dout, &field_addr, fields);
77366 if (e) {
77367 log_packet_detailed("fields bitvector error detected");
77368 }
77369
77370 if (BV_ISSET(fields, 0)) {
77371 log_packet_detailed(" field 'id' has changed");
77372#ifdef FREECIV_JSON_CONNECTION
77373 field_addr.name = "id";
77374#endif /* FREECIV_JSON_CONNECTION */
77375 e = 0;
77376 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
77377 if (e) {
77378 log_packet_detailed("'id' field error detected");
77379 }
77380 }
77381
77382 *old = *real_packet;
77383#endif /* FREECIV_DELTA_PROTOCOL */
77384#ifndef FREECIV_DELTA_PROTOCOL
77385#ifdef FREECIV_JSON_CONNECTION
77386 field_addr.name = "id";
77387#endif /* FREECIV_JSON_CONNECTION */
77388 e = 0;
77389 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
77390 if (e) {
77391 log_packet_detailed("'id' field error detected");
77392 }
77393
77394#endif
77395 SEND_PACKET_END(PACKET_EDIT_UNIT_REMOVE_BY_ID);
77396}
77397
77398 int send_packet_edit_unit_remove_by_id(struct connection *pc, const struct packet_edit_unit_remove_by_id *packet)
77399{
77400 if (!pc->used) {
77401 log_error("WARNING: trying to send data to the closed connection %s",
77402 conn_description(pc));
77403 return -1;
77404 }
77405 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet != NULL, -1,
77406 "Handler for PACKET_EDIT_UNIT_REMOVE_BY_ID not installed");
77407 return pc->phs.handlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet(pc, packet);
77408}
77409
77410 int dsend_packet_edit_unit_remove_by_id(struct connection *pc, int id)
77411{
77412 struct packet_edit_unit_remove_by_id packet, *real_packet = &packet;
77413
77414 real_packet->id = id;
77415
77416 return send_packet_edit_unit_remove_by_id(pc, real_packet);
77417}
77418
77419#ifdef FREECIV_DELTA_PROTOCOL
77420static genhash_val_t hash_packet_edit_unit_100(const void *vkey)
77421{
77422 const struct packet_edit_unit *key = (const struct packet_edit_unit *) vkey;
77423 genhash_val_t result = 0;
77424
77425 result += key->id;
77426
77427 result &= 0xFFFFFFFF;
77428 return result;
77429}
77430
77431static bool cmp_packet_edit_unit_100(const void *vkey1, const void *vkey2)
77432{
77433 const struct packet_edit_unit *old = (const struct packet_edit_unit *) vkey1;
77434 const struct packet_edit_unit *real_packet = (const struct packet_edit_unit *) vkey2;
77435 bool differ;
77436
77437 differ = (old->id != real_packet->id);
77438
77439 return !differ;
77440}
77441 BV_DEFINE(packet_edit_unit_100_fields, 16);
77442#endif /* FREECIV_DELTA_PROTOCOL */
77443
77444 static struct packet_edit_unit *receive_packet_edit_unit_100(struct connection *pc)
77445{
77446#ifdef FREECIV_DELTA_PROTOCOL
77447 packet_edit_unit_100_fields fields;
77448 struct packet_edit_unit *old;
77449 struct genhash **hash = pc->phs.received + PACKET_EDIT_UNIT;
77450#endif /* FREECIV_DELTA_PROTOCOL */
77451 RECEIVE_PACKET_START(packet_edit_unit, real_packet);
77452#ifdef FREECIV_JSON_CONNECTION
77453 struct plocation field_addr;
77454 {
77455 struct plocation *field_addr_tmp = plocation_field_new(NULL);
77456 field_addr = *field_addr_tmp;
77457 FC_FREE(field_addr_tmp);
77458 }
77459#endif /* FREECIV_JSON_CONNECTION */
77460
77461#ifdef FREECIV_DELTA_PROTOCOL
77462#ifdef FREECIV_JSON_CONNECTION
77463 field_addr.name = "fields";
77464#endif /* FREECIV_JSON_CONNECTION */
77465 DIO_BV_GET(&din, &field_addr, fields);
77466#ifdef FREECIV_JSON_CONNECTION
77467 field_addr.name = "id";
77468#endif /* FREECIV_JSON_CONNECTION */
77469 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
77470 RECEIVE_PACKET_FIELD_ERROR(id);
77471 }
77472
77473#else /* FREECIV_DELTA_PROTOCOL */
77474#ifdef FREECIV_JSON_CONNECTION
77475 field_addr.name = "id";
77476#endif /* FREECIV_JSON_CONNECTION */
77477 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
77478 RECEIVE_PACKET_FIELD_ERROR(id);
77479 }
77480#ifdef FREECIV_JSON_CONNECTION
77481 field_addr.name = "utype";
77482#endif /* FREECIV_JSON_CONNECTION */
77483 {
77484 int readin;
77485
77486 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77487 RECEIVE_PACKET_FIELD_ERROR(utype);
77488 }
77489 real_packet->utype = readin;
77490 }
77491#ifdef FREECIV_JSON_CONNECTION
77492 field_addr.name = "owner";
77493#endif /* FREECIV_JSON_CONNECTION */
77494 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
77495 RECEIVE_PACKET_FIELD_ERROR(owner);
77496 }
77497#ifdef FREECIV_JSON_CONNECTION
77498 field_addr.name = "homecity";
77499#endif /* FREECIV_JSON_CONNECTION */
77500 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
77501 RECEIVE_PACKET_FIELD_ERROR(homecity);
77502 }
77503#ifdef FREECIV_JSON_CONNECTION
77504 field_addr.name = "moves_left";
77505#endif /* FREECIV_JSON_CONNECTION */
77506 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
77507 RECEIVE_PACKET_FIELD_ERROR(moves_left);
77508 }
77509#ifdef FREECIV_JSON_CONNECTION
77510 field_addr.name = "hp";
77511#endif /* FREECIV_JSON_CONNECTION */
77512 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
77513 RECEIVE_PACKET_FIELD_ERROR(hp);
77514 }
77515#ifdef FREECIV_JSON_CONNECTION
77516 field_addr.name = "veteran";
77517#endif /* FREECIV_JSON_CONNECTION */
77518 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
77519 RECEIVE_PACKET_FIELD_ERROR(veteran);
77520 }
77521#ifdef FREECIV_JSON_CONNECTION
77522 field_addr.name = "fuel";
77523#endif /* FREECIV_JSON_CONNECTION */
77524 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
77525 RECEIVE_PACKET_FIELD_ERROR(fuel);
77526 }
77527#ifdef FREECIV_JSON_CONNECTION
77528 field_addr.name = "activity";
77529#endif /* FREECIV_JSON_CONNECTION */
77530 {
77531 int readin;
77532
77533 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77534 RECEIVE_PACKET_FIELD_ERROR(activity);
77535 }
77536 real_packet->activity = readin;
77537 }
77538#ifdef FREECIV_JSON_CONNECTION
77539 field_addr.name = "activity_count";
77540#endif /* FREECIV_JSON_CONNECTION */
77541 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
77542 RECEIVE_PACKET_FIELD_ERROR(activity_count);
77543 }
77544#ifdef FREECIV_JSON_CONNECTION
77545 field_addr.name = "activity_base";
77546#endif /* FREECIV_JSON_CONNECTION */
77547 {
77548 int readin;
77549
77550 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
77551 RECEIVE_PACKET_FIELD_ERROR(activity_base);
77552 }
77553 real_packet->activity_base = readin;
77554 }
77555#ifdef FREECIV_JSON_CONNECTION
77556 field_addr.name = "debug";
77557#endif /* FREECIV_JSON_CONNECTION */
77558 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
77559 RECEIVE_PACKET_FIELD_ERROR(debug);
77560 }
77561#ifdef FREECIV_JSON_CONNECTION
77562 field_addr.name = "moved";
77563#endif /* FREECIV_JSON_CONNECTION */
77564 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->moved)) {
77565 RECEIVE_PACKET_FIELD_ERROR(moved);
77566 }
77567#ifdef FREECIV_JSON_CONNECTION
77568 field_addr.name = "paradropped";
77569#endif /* FREECIV_JSON_CONNECTION */
77570 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->paradropped)) {
77571 RECEIVE_PACKET_FIELD_ERROR(paradropped);
77572 }
77573#ifdef FREECIV_JSON_CONNECTION
77574 field_addr.name = "done_moving";
77575#endif /* FREECIV_JSON_CONNECTION */
77576 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->done_moving)) {
77577 RECEIVE_PACKET_FIELD_ERROR(done_moving);
77578 }
77579#ifdef FREECIV_JSON_CONNECTION
77580 field_addr.name = "transported_by";
77581#endif /* FREECIV_JSON_CONNECTION */
77582 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
77583 RECEIVE_PACKET_FIELD_ERROR(transported_by);
77584 }
77585#ifdef FREECIV_JSON_CONNECTION
77586 field_addr.name = "stay";
77587#endif /* FREECIV_JSON_CONNECTION */
77588 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->stay)) {
77589 RECEIVE_PACKET_FIELD_ERROR(stay);
77590 }
77591#endif
77592 log_packet_detailed("packet_edit_unit_100: got info about (%d)",
77593 real_packet->id);
77594
77595#ifdef FREECIV_DELTA_PROTOCOL
77596 if (NULL == *hash) {
77597 *hash = genhash_new_full(hash_packet_edit_unit_100, cmp_packet_edit_unit_100,
77598 NULL, NULL, NULL, free);
77599 }
77600
77601 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
77602 *real_packet = *old;
77603 } else {
77604 int id;
77605
77606 id = real_packet->id;
77607
77608 log_packet_detailed(" no old info");
77609 memset(real_packet, 0, sizeof(*real_packet));
77610
77611 real_packet->id = id;
77612 }
77613
77614 if (BV_ISSET(fields, 0)) {
77615 log_packet_detailed(" got field 'utype'");
77616#ifdef FREECIV_JSON_CONNECTION
77617 field_addr.name = "utype";
77618#endif /* FREECIV_JSON_CONNECTION */
77619 {
77620 int readin;
77621
77622 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77623 RECEIVE_PACKET_FIELD_ERROR(utype);
77624 }
77625 real_packet->utype = readin;
77626 }
77627 }
77628 if (BV_ISSET(fields, 1)) {
77629 log_packet_detailed(" got field 'owner'");
77630#ifdef FREECIV_JSON_CONNECTION
77631 field_addr.name = "owner";
77632#endif /* FREECIV_JSON_CONNECTION */
77633 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
77634 RECEIVE_PACKET_FIELD_ERROR(owner);
77635 }
77636 }
77637 if (BV_ISSET(fields, 2)) {
77638 log_packet_detailed(" got field 'homecity'");
77639#ifdef FREECIV_JSON_CONNECTION
77640 field_addr.name = "homecity";
77641#endif /* FREECIV_JSON_CONNECTION */
77642 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->homecity)) {
77643 RECEIVE_PACKET_FIELD_ERROR(homecity);
77644 }
77645 }
77646 if (BV_ISSET(fields, 3)) {
77647 log_packet_detailed(" got field 'moves_left'");
77648#ifdef FREECIV_JSON_CONNECTION
77649 field_addr.name = "moves_left";
77650#endif /* FREECIV_JSON_CONNECTION */
77651 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->moves_left)) {
77652 RECEIVE_PACKET_FIELD_ERROR(moves_left);
77653 }
77654 }
77655 if (BV_ISSET(fields, 4)) {
77656 log_packet_detailed(" got field 'hp'");
77657#ifdef FREECIV_JSON_CONNECTION
77658 field_addr.name = "hp";
77659#endif /* FREECIV_JSON_CONNECTION */
77660 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->hp)) {
77661 RECEIVE_PACKET_FIELD_ERROR(hp);
77662 }
77663 }
77664 if (BV_ISSET(fields, 5)) {
77665 log_packet_detailed(" got field 'veteran'");
77666#ifdef FREECIV_JSON_CONNECTION
77667 field_addr.name = "veteran";
77668#endif /* FREECIV_JSON_CONNECTION */
77669 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->veteran)) {
77670 RECEIVE_PACKET_FIELD_ERROR(veteran);
77671 }
77672 }
77673 if (BV_ISSET(fields, 6)) {
77674 log_packet_detailed(" got field 'fuel'");
77675#ifdef FREECIV_JSON_CONNECTION
77676 field_addr.name = "fuel";
77677#endif /* FREECIV_JSON_CONNECTION */
77678 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->fuel)) {
77679 RECEIVE_PACKET_FIELD_ERROR(fuel);
77680 }
77681 }
77682 if (BV_ISSET(fields, 7)) {
77683 log_packet_detailed(" got field 'activity'");
77684#ifdef FREECIV_JSON_CONNECTION
77685 field_addr.name = "activity";
77686#endif /* FREECIV_JSON_CONNECTION */
77687 {
77688 int readin;
77689
77690 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
77691 RECEIVE_PACKET_FIELD_ERROR(activity);
77692 }
77693 real_packet->activity = readin;
77694 }
77695 }
77696 if (BV_ISSET(fields, 8)) {
77697 log_packet_detailed(" got field 'activity_count'");
77698#ifdef FREECIV_JSON_CONNECTION
77699 field_addr.name = "activity_count";
77700#endif /* FREECIV_JSON_CONNECTION */
77701 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->activity_count)) {
77702 RECEIVE_PACKET_FIELD_ERROR(activity_count);
77703 }
77704 }
77705 if (BV_ISSET(fields, 9)) {
77706 log_packet_detailed(" got field 'activity_base'");
77707#ifdef FREECIV_JSON_CONNECTION
77708 field_addr.name = "activity_base";
77709#endif /* FREECIV_JSON_CONNECTION */
77710 {
77711 int readin;
77712
77713 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
77714 RECEIVE_PACKET_FIELD_ERROR(activity_base);
77715 }
77716 real_packet->activity_base = readin;
77717 }
77718 }
77719 real_packet->debug = BV_ISSET(fields, 10);
77720 real_packet->moved = BV_ISSET(fields, 11);
77721 real_packet->paradropped = BV_ISSET(fields, 12);
77722 real_packet->done_moving = BV_ISSET(fields, 13);
77723 if (BV_ISSET(fields, 14)) {
77724 log_packet_detailed(" got field 'transported_by'");
77725#ifdef FREECIV_JSON_CONNECTION
77726 field_addr.name = "transported_by";
77727#endif /* FREECIV_JSON_CONNECTION */
77728 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->transported_by)) {
77729 RECEIVE_PACKET_FIELD_ERROR(transported_by);
77730 }
77731 }
77732 real_packet->stay = BV_ISSET(fields, 15);
77733
77734 if (NULL == old) {
77735 old = fc_malloc(sizeof(*old));
77736 *old = *real_packet;
77737 genhash_insert(*hash, old, old);
77738 } else {
77739 *old = *real_packet;
77740 }
77741
77742#endif /* FREECIV_DELTA_PROTOCOL */
77743 RECEIVE_PACKET_END(real_packet);
77744}
77745
77746 static int send_packet_edit_unit_100(struct connection *pc, const struct packet_edit_unit *packet)
77747{
77748 const struct packet_edit_unit *real_packet = packet;
77749 int e;
77750#ifdef FREECIV_DELTA_PROTOCOL
77751 packet_edit_unit_100_fields fields;
77752 struct packet_edit_unit *old;
77753 bool differ;
77754 struct genhash **hash = pc->phs.sent + PACKET_EDIT_UNIT;
77755#endif /* FREECIV_DELTA_PROTOCOL */
77756 SEND_PACKET_START(PACKET_EDIT_UNIT);
77757#ifdef FREECIV_JSON_CONNECTION
77758 struct plocation field_addr;
77759 {
77760 struct plocation *field_addr_tmp = plocation_field_new(NULL);
77761 field_addr = *field_addr_tmp;
77762 FC_FREE(field_addr_tmp);
77763 }
77764#endif /* FREECIV_JSON_CONNECTION */
77765
77766 log_packet_detailed("packet_edit_unit_100: sending info about (%d)",
77767 real_packet->id);
77768
77769#ifdef FREECIV_DELTA_PROTOCOL
77770 if (NULL == *hash) {
77771 *hash = genhash_new_full(hash_packet_edit_unit_100, cmp_packet_edit_unit_100,
77772 NULL, NULL, NULL, free);
77773 }
77774 BV_CLR_ALL(fields);
77775
77776 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
77777 old = fc_malloc(sizeof(*old));
77778 *old = *real_packet;
77779 genhash_insert(*hash, old, old);
77780 memset(old, 0, sizeof(*old));
77781 }
77782 differ = (old->utype != real_packet->utype);
77783 if (differ) {
77784 BV_SET(fields, 0);
77785 }
77786
77787 differ = (old->owner != real_packet->owner);
77788 if (differ) {
77789 BV_SET(fields, 1);
77790 }
77791
77792 differ = (old->homecity != real_packet->homecity);
77793 if (differ) {
77794 BV_SET(fields, 2);
77795 }
77796
77797 differ = (old->moves_left != real_packet->moves_left);
77798 if (differ) {
77799 BV_SET(fields, 3);
77800 }
77801
77802 differ = (old->hp != real_packet->hp);
77803 if (differ) {
77804 BV_SET(fields, 4);
77805 }
77806
77807 differ = (old->veteran != real_packet->veteran);
77808 if (differ) {
77809 BV_SET(fields, 5);
77810 }
77811
77812 differ = (old->fuel != real_packet->fuel);
77813 if (differ) {
77814 BV_SET(fields, 6);
77815 }
77816
77817 differ = (old->activity != real_packet->activity);
77818 if (differ) {
77819 BV_SET(fields, 7);
77820 }
77821
77822 differ = (old->activity_count != real_packet->activity_count);
77823 if (differ) {
77824 BV_SET(fields, 8);
77825 }
77826
77827 differ = (old->activity_base != real_packet->activity_base);
77828 if (differ) {
77829 BV_SET(fields, 9);
77830 }
77831
77832 if (packet->debug) {
77833 BV_SET(fields, 10);
77834 }
77835
77836 if (packet->moved) {
77837 BV_SET(fields, 11);
77838 }
77839
77840 if (packet->paradropped) {
77841 BV_SET(fields, 12);
77842 }
77843
77844 if (packet->done_moving) {
77845 BV_SET(fields, 13);
77846 }
77847
77848 differ = (old->transported_by != real_packet->transported_by);
77849 if (differ) {
77850 BV_SET(fields, 14);
77851 }
77852
77853 if (packet->stay) {
77854 BV_SET(fields, 15);
77855 }
77856
77857
77858#ifdef FREECIV_JSON_CONNECTION
77859 field_addr.name = "fields";
77860#endif /* FREECIV_JSON_CONNECTION */
77861 e = 0;
77862 e |= DIO_BV_PUT(&dout, &field_addr, fields);
77863 if (e) {
77864 log_packet_detailed("fields bitvector error detected");
77865 }
77866#ifdef FREECIV_JSON_CONNECTION
77867 field_addr.name = "id";
77868#endif /* FREECIV_JSON_CONNECTION */
77869 e = 0;
77870 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
77871 if (e) {
77872 log_packet_detailed("'id' field error detected");
77873 }
77874
77875 if (BV_ISSET(fields, 0)) {
77876 log_packet_detailed(" field 'utype' has changed");
77877#ifdef FREECIV_JSON_CONNECTION
77878 field_addr.name = "utype";
77879#endif /* FREECIV_JSON_CONNECTION */
77880 e = 0;
77881 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->utype);
77882 if (e) {
77883 log_packet_detailed("'utype' field error detected");
77884 }
77885 }
77886 if (BV_ISSET(fields, 1)) {
77887 log_packet_detailed(" field 'owner' has changed");
77888#ifdef FREECIV_JSON_CONNECTION
77889 field_addr.name = "owner";
77890#endif /* FREECIV_JSON_CONNECTION */
77891 e = 0;
77892 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
77893 if (e) {
77894 log_packet_detailed("'owner' field error detected");
77895 }
77896 }
77897 if (BV_ISSET(fields, 2)) {
77898 log_packet_detailed(" field 'homecity' has changed");
77899#ifdef FREECIV_JSON_CONNECTION
77900 field_addr.name = "homecity";
77901#endif /* FREECIV_JSON_CONNECTION */
77902 e = 0;
77903 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
77904 if (e) {
77905 log_packet_detailed("'homecity' field error detected");
77906 }
77907 }
77908 if (BV_ISSET(fields, 3)) {
77909 log_packet_detailed(" field 'moves_left' has changed");
77910#ifdef FREECIV_JSON_CONNECTION
77911 field_addr.name = "moves_left";
77912#endif /* FREECIV_JSON_CONNECTION */
77913 e = 0;
77914 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
77915 if (e) {
77916 log_packet_detailed("'moves_left' field error detected");
77917 }
77918 }
77919 if (BV_ISSET(fields, 4)) {
77920 log_packet_detailed(" field 'hp' has changed");
77921#ifdef FREECIV_JSON_CONNECTION
77922 field_addr.name = "hp";
77923#endif /* FREECIV_JSON_CONNECTION */
77924 e = 0;
77925 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
77926 if (e) {
77927 log_packet_detailed("'hp' field error detected");
77928 }
77929 }
77930 if (BV_ISSET(fields, 5)) {
77931 log_packet_detailed(" field 'veteran' has changed");
77932#ifdef FREECIV_JSON_CONNECTION
77933 field_addr.name = "veteran";
77934#endif /* FREECIV_JSON_CONNECTION */
77935 e = 0;
77936 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
77937 if (e) {
77938 log_packet_detailed("'veteran' field error detected");
77939 }
77940 }
77941 if (BV_ISSET(fields, 6)) {
77942 log_packet_detailed(" field 'fuel' has changed");
77943#ifdef FREECIV_JSON_CONNECTION
77944 field_addr.name = "fuel";
77945#endif /* FREECIV_JSON_CONNECTION */
77946 e = 0;
77947 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
77948 if (e) {
77949 log_packet_detailed("'fuel' field error detected");
77950 }
77951 }
77952 if (BV_ISSET(fields, 7)) {
77953 log_packet_detailed(" field 'activity' has changed");
77954#ifdef FREECIV_JSON_CONNECTION
77955 field_addr.name = "activity";
77956#endif /* FREECIV_JSON_CONNECTION */
77957 e = 0;
77958 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
77959 if (e) {
77960 log_packet_detailed("'activity' field error detected");
77961 }
77962 }
77963 if (BV_ISSET(fields, 8)) {
77964 log_packet_detailed(" field 'activity_count' has changed");
77965#ifdef FREECIV_JSON_CONNECTION
77966 field_addr.name = "activity_count";
77967#endif /* FREECIV_JSON_CONNECTION */
77968 e = 0;
77969 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
77970 if (e) {
77971 log_packet_detailed("'activity_count' field error detected");
77972 }
77973 }
77974 if (BV_ISSET(fields, 9)) {
77975 log_packet_detailed(" field 'activity_base' has changed");
77976#ifdef FREECIV_JSON_CONNECTION
77977 field_addr.name = "activity_base";
77978#endif /* FREECIV_JSON_CONNECTION */
77979 e = 0;
77980 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
77981 if (e) {
77982 log_packet_detailed("'activity_base' field error detected");
77983 }
77984 }
77985 /* field 10 is folded into the header */
77986 /* field 11 is folded into the header */
77987 /* field 12 is folded into the header */
77988 /* field 13 is folded into the header */
77989 if (BV_ISSET(fields, 14)) {
77990 log_packet_detailed(" field 'transported_by' has changed");
77991#ifdef FREECIV_JSON_CONNECTION
77992 field_addr.name = "transported_by";
77993#endif /* FREECIV_JSON_CONNECTION */
77994 e = 0;
77995 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
77996 if (e) {
77997 log_packet_detailed("'transported_by' field error detected");
77998 }
77999 }
78000 /* field 15 is folded into the header */
78001
78002 *old = *real_packet;
78003#endif /* FREECIV_DELTA_PROTOCOL */
78004#ifndef FREECIV_DELTA_PROTOCOL
78005#ifdef FREECIV_JSON_CONNECTION
78006 field_addr.name = "id";
78007#endif /* FREECIV_JSON_CONNECTION */
78008 e = 0;
78009 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
78010 if (e) {
78011 log_packet_detailed("'id' field error detected");
78012 }
78013#ifdef FREECIV_JSON_CONNECTION
78014 field_addr.name = "utype";
78015#endif /* FREECIV_JSON_CONNECTION */
78016 e = 0;
78017 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->utype);
78018 if (e) {
78019 log_packet_detailed("'utype' field error detected");
78020 }
78021#ifdef FREECIV_JSON_CONNECTION
78022 field_addr.name = "owner";
78023#endif /* FREECIV_JSON_CONNECTION */
78024 e = 0;
78025 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
78026 if (e) {
78027 log_packet_detailed("'owner' field error detected");
78028 }
78029#ifdef FREECIV_JSON_CONNECTION
78030 field_addr.name = "homecity";
78031#endif /* FREECIV_JSON_CONNECTION */
78032 e = 0;
78033 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->homecity);
78034 if (e) {
78035 log_packet_detailed("'homecity' field error detected");
78036 }
78037#ifdef FREECIV_JSON_CONNECTION
78038 field_addr.name = "moves_left";
78039#endif /* FREECIV_JSON_CONNECTION */
78040 e = 0;
78041 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->moves_left);
78042 if (e) {
78043 log_packet_detailed("'moves_left' field error detected");
78044 }
78045#ifdef FREECIV_JSON_CONNECTION
78046 field_addr.name = "hp";
78047#endif /* FREECIV_JSON_CONNECTION */
78048 e = 0;
78049 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->hp);
78050 if (e) {
78051 log_packet_detailed("'hp' field error detected");
78052 }
78053#ifdef FREECIV_JSON_CONNECTION
78054 field_addr.name = "veteran";
78055#endif /* FREECIV_JSON_CONNECTION */
78056 e = 0;
78057 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->veteran);
78058 if (e) {
78059 log_packet_detailed("'veteran' field error detected");
78060 }
78061#ifdef FREECIV_JSON_CONNECTION
78062 field_addr.name = "fuel";
78063#endif /* FREECIV_JSON_CONNECTION */
78064 e = 0;
78065 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->fuel);
78066 if (e) {
78067 log_packet_detailed("'fuel' field error detected");
78068 }
78069#ifdef FREECIV_JSON_CONNECTION
78070 field_addr.name = "activity";
78071#endif /* FREECIV_JSON_CONNECTION */
78072 e = 0;
78073 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->activity);
78074 if (e) {
78075 log_packet_detailed("'activity' field error detected");
78076 }
78077#ifdef FREECIV_JSON_CONNECTION
78078 field_addr.name = "activity_count";
78079#endif /* FREECIV_JSON_CONNECTION */
78080 e = 0;
78081 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->activity_count);
78082 if (e) {
78083 log_packet_detailed("'activity_count' field error detected");
78084 }
78085#ifdef FREECIV_JSON_CONNECTION
78086 field_addr.name = "activity_base";
78087#endif /* FREECIV_JSON_CONNECTION */
78088 e = 0;
78089 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->activity_base);
78090 if (e) {
78091 log_packet_detailed("'activity_base' field error detected");
78092 }
78093#ifdef FREECIV_JSON_CONNECTION
78094 field_addr.name = "debug";
78095#endif /* FREECIV_JSON_CONNECTION */
78096 e = 0;
78097 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
78098 if (e) {
78099 log_packet_detailed("'debug' field error detected");
78100 }
78101#ifdef FREECIV_JSON_CONNECTION
78102 field_addr.name = "moved";
78103#endif /* FREECIV_JSON_CONNECTION */
78104 e = 0;
78105 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->moved);
78106 if (e) {
78107 log_packet_detailed("'moved' field error detected");
78108 }
78109#ifdef FREECIV_JSON_CONNECTION
78110 field_addr.name = "paradropped";
78111#endif /* FREECIV_JSON_CONNECTION */
78112 e = 0;
78113 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->paradropped);
78114 if (e) {
78115 log_packet_detailed("'paradropped' field error detected");
78116 }
78117#ifdef FREECIV_JSON_CONNECTION
78118 field_addr.name = "done_moving";
78119#endif /* FREECIV_JSON_CONNECTION */
78120 e = 0;
78121 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->done_moving);
78122 if (e) {
78123 log_packet_detailed("'done_moving' field error detected");
78124 }
78125#ifdef FREECIV_JSON_CONNECTION
78126 field_addr.name = "transported_by";
78127#endif /* FREECIV_JSON_CONNECTION */
78128 e = 0;
78129 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->transported_by);
78130 if (e) {
78131 log_packet_detailed("'transported_by' field error detected");
78132 }
78133#ifdef FREECIV_JSON_CONNECTION
78134 field_addr.name = "stay";
78135#endif /* FREECIV_JSON_CONNECTION */
78136 e = 0;
78137 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->stay);
78138 if (e) {
78139 log_packet_detailed("'stay' field error detected");
78140 }
78141
78142#endif
78143 SEND_PACKET_END(PACKET_EDIT_UNIT);
78144}
78145
78146 int send_packet_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
78147{
78148 if (!pc->used) {
78149 log_error("WARNING: trying to send data to the closed connection %s",
78150 conn_description(pc));
78151 return -1;
78152 }
78153 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_UNIT].packet != NULL, -1,
78154 "Handler for PACKET_EDIT_UNIT not installed");
78155 return pc->phs.handlers->send[PACKET_EDIT_UNIT].packet(pc, packet);
78156}
78157
78158#ifdef FREECIV_DELTA_PROTOCOL
78159#define hash_packet_edit_city_create_100 hash_const
78160
78161#define cmp_packet_edit_city_create_100 cmp_const
78162
78163 BV_DEFINE(packet_edit_city_create_100_fields, 4);
78164#endif /* FREECIV_DELTA_PROTOCOL */
78165
78166 static struct packet_edit_city_create *receive_packet_edit_city_create_100(struct connection *pc)
78167{
78168#ifdef FREECIV_DELTA_PROTOCOL
78169 packet_edit_city_create_100_fields fields;
78170 struct packet_edit_city_create *old;
78171 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY_CREATE;
78172#endif /* FREECIV_DELTA_PROTOCOL */
78173 RECEIVE_PACKET_START(packet_edit_city_create, real_packet);
78174#ifdef FREECIV_JSON_CONNECTION
78175 struct plocation field_addr;
78176 {
78177 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78178 field_addr = *field_addr_tmp;
78179 FC_FREE(field_addr_tmp);
78180 }
78181#endif /* FREECIV_JSON_CONNECTION */
78182
78183#ifdef FREECIV_DELTA_PROTOCOL
78184#ifdef FREECIV_JSON_CONNECTION
78185 field_addr.name = "fields";
78186#endif /* FREECIV_JSON_CONNECTION */
78187 DIO_BV_GET(&din, &field_addr, fields);
78188
78189#else /* FREECIV_DELTA_PROTOCOL */
78190#ifdef FREECIV_JSON_CONNECTION
78191 field_addr.name = "owner";
78192#endif /* FREECIV_JSON_CONNECTION */
78193 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
78194 RECEIVE_PACKET_FIELD_ERROR(owner);
78195 }
78196#ifdef FREECIV_JSON_CONNECTION
78197 field_addr.name = "tile";
78198#endif /* FREECIV_JSON_CONNECTION */
78199 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
78200 RECEIVE_PACKET_FIELD_ERROR(tile);
78201 }
78202#ifdef FREECIV_JSON_CONNECTION
78203 field_addr.name = "size";
78204#endif /* FREECIV_JSON_CONNECTION */
78205 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
78206 RECEIVE_PACKET_FIELD_ERROR(size);
78207 }
78208#ifdef FREECIV_JSON_CONNECTION
78209 field_addr.name = "tag";
78210#endif /* FREECIV_JSON_CONNECTION */
78211 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
78212 RECEIVE_PACKET_FIELD_ERROR(tag);
78213 }
78214#endif
78215 log_packet_detailed("packet_edit_city_create_100: got info about ()");
78216
78217#ifdef FREECIV_DELTA_PROTOCOL
78218 if (NULL == *hash) {
78219 *hash = genhash_new_full(hash_packet_edit_city_create_100, cmp_packet_edit_city_create_100,
78220 NULL, NULL, NULL, free);
78221 }
78222
78223 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78224 *real_packet = *old;
78225 } else {
78226 log_packet_detailed(" no old info");
78227 memset(real_packet, 0, sizeof(*real_packet));
78228 }
78229
78230 if (BV_ISSET(fields, 0)) {
78231 log_packet_detailed(" got field 'owner'");
78232#ifdef FREECIV_JSON_CONNECTION
78233 field_addr.name = "owner";
78234#endif /* FREECIV_JSON_CONNECTION */
78235 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
78236 RECEIVE_PACKET_FIELD_ERROR(owner);
78237 }
78238 }
78239 if (BV_ISSET(fields, 1)) {
78240 log_packet_detailed(" got field 'tile'");
78241#ifdef FREECIV_JSON_CONNECTION
78242 field_addr.name = "tile";
78243#endif /* FREECIV_JSON_CONNECTION */
78244 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
78245 RECEIVE_PACKET_FIELD_ERROR(tile);
78246 }
78247 }
78248 if (BV_ISSET(fields, 2)) {
78249 log_packet_detailed(" got field 'size'");
78250#ifdef FREECIV_JSON_CONNECTION
78251 field_addr.name = "size";
78252#endif /* FREECIV_JSON_CONNECTION */
78253 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
78254 RECEIVE_PACKET_FIELD_ERROR(size);
78255 }
78256 }
78257 if (BV_ISSET(fields, 3)) {
78258 log_packet_detailed(" got field 'tag'");
78259#ifdef FREECIV_JSON_CONNECTION
78260 field_addr.name = "tag";
78261#endif /* FREECIV_JSON_CONNECTION */
78262 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
78263 RECEIVE_PACKET_FIELD_ERROR(tag);
78264 }
78265 }
78266
78267 if (NULL == old) {
78268 old = fc_malloc(sizeof(*old));
78269 *old = *real_packet;
78270 genhash_insert(*hash, old, old);
78271 } else {
78272 *old = *real_packet;
78273 }
78274
78275#endif /* FREECIV_DELTA_PROTOCOL */
78276 RECEIVE_PACKET_END(real_packet);
78277}
78278
78279 static int send_packet_edit_city_create_100(struct connection *pc, const struct packet_edit_city_create *packet)
78280{
78281 const struct packet_edit_city_create *real_packet = packet;
78282 int e;
78283#ifdef FREECIV_DELTA_PROTOCOL
78284 packet_edit_city_create_100_fields fields;
78285 struct packet_edit_city_create *old;
78286 bool differ;
78287 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY_CREATE;
78288#endif /* FREECIV_DELTA_PROTOCOL */
78289 SEND_PACKET_START(PACKET_EDIT_CITY_CREATE);
78290#ifdef FREECIV_JSON_CONNECTION
78291 struct plocation field_addr;
78292 {
78293 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78294 field_addr = *field_addr_tmp;
78295 FC_FREE(field_addr_tmp);
78296 }
78297#endif /* FREECIV_JSON_CONNECTION */
78298
78299 log_packet_detailed("packet_edit_city_create_100: sending info about ()");
78300
78301#ifdef FREECIV_DELTA_PROTOCOL
78302 if (NULL == *hash) {
78303 *hash = genhash_new_full(hash_packet_edit_city_create_100, cmp_packet_edit_city_create_100,
78304 NULL, NULL, NULL, free);
78305 }
78306 BV_CLR_ALL(fields);
78307
78308 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78309 old = fc_malloc(sizeof(*old));
78310 *old = *real_packet;
78311 genhash_insert(*hash, old, old);
78312 memset(old, 0, sizeof(*old));
78313 }
78314 differ = (old->owner != real_packet->owner);
78315 if (differ) {
78316 BV_SET(fields, 0);
78317 }
78318
78319 differ = (old->tile != real_packet->tile);
78320 if (differ) {
78321 BV_SET(fields, 1);
78322 }
78323
78324 differ = (old->size != real_packet->size);
78325 if (differ) {
78326 BV_SET(fields, 2);
78327 }
78328
78329 differ = (old->tag != real_packet->tag);
78330 if (differ) {
78331 BV_SET(fields, 3);
78332 }
78333
78334
78335#ifdef FREECIV_JSON_CONNECTION
78336 field_addr.name = "fields";
78337#endif /* FREECIV_JSON_CONNECTION */
78338 e = 0;
78339 e |= DIO_BV_PUT(&dout, &field_addr, fields);
78340 if (e) {
78341 log_packet_detailed("fields bitvector error detected");
78342 }
78343
78344 if (BV_ISSET(fields, 0)) {
78345 log_packet_detailed(" field 'owner' has changed");
78346#ifdef FREECIV_JSON_CONNECTION
78347 field_addr.name = "owner";
78348#endif /* FREECIV_JSON_CONNECTION */
78349 e = 0;
78350 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
78351 if (e) {
78352 log_packet_detailed("'owner' field error detected");
78353 }
78354 }
78355 if (BV_ISSET(fields, 1)) {
78356 log_packet_detailed(" field 'tile' has changed");
78357#ifdef FREECIV_JSON_CONNECTION
78358 field_addr.name = "tile";
78359#endif /* FREECIV_JSON_CONNECTION */
78360 e = 0;
78361 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
78362 if (e) {
78363 log_packet_detailed("'tile' field error detected");
78364 }
78365 }
78366 if (BV_ISSET(fields, 2)) {
78367 log_packet_detailed(" field 'size' has changed");
78368#ifdef FREECIV_JSON_CONNECTION
78369 field_addr.name = "size";
78370#endif /* FREECIV_JSON_CONNECTION */
78371 e = 0;
78372 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
78373 if (e) {
78374 log_packet_detailed("'size' field error detected");
78375 }
78376 }
78377 if (BV_ISSET(fields, 3)) {
78378 log_packet_detailed(" field 'tag' has changed");
78379#ifdef FREECIV_JSON_CONNECTION
78380 field_addr.name = "tag";
78381#endif /* FREECIV_JSON_CONNECTION */
78382 e = 0;
78383 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
78384 if (e) {
78385 log_packet_detailed("'tag' field error detected");
78386 }
78387 }
78388
78389 *old = *real_packet;
78390#endif /* FREECIV_DELTA_PROTOCOL */
78391#ifndef FREECIV_DELTA_PROTOCOL
78392#ifdef FREECIV_JSON_CONNECTION
78393 field_addr.name = "owner";
78394#endif /* FREECIV_JSON_CONNECTION */
78395 e = 0;
78396 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
78397 if (e) {
78398 log_packet_detailed("'owner' field error detected");
78399 }
78400#ifdef FREECIV_JSON_CONNECTION
78401 field_addr.name = "tile";
78402#endif /* FREECIV_JSON_CONNECTION */
78403 e = 0;
78404 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
78405 if (e) {
78406 log_packet_detailed("'tile' field error detected");
78407 }
78408#ifdef FREECIV_JSON_CONNECTION
78409 field_addr.name = "size";
78410#endif /* FREECIV_JSON_CONNECTION */
78411 e = 0;
78412 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
78413 if (e) {
78414 log_packet_detailed("'size' field error detected");
78415 }
78416#ifdef FREECIV_JSON_CONNECTION
78417 field_addr.name = "tag";
78418#endif /* FREECIV_JSON_CONNECTION */
78419 e = 0;
78420 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
78421 if (e) {
78422 log_packet_detailed("'tag' field error detected");
78423 }
78424
78425#endif
78426 SEND_PACKET_END(PACKET_EDIT_CITY_CREATE);
78427}
78428
78429 int send_packet_edit_city_create(struct connection *pc, const struct packet_edit_city_create *packet)
78430{
78431 if (!pc->used) {
78432 log_error("WARNING: trying to send data to the closed connection %s",
78433 conn_description(pc));
78434 return -1;
78435 }
78436 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY_CREATE].packet != NULL, -1,
78437 "Handler for PACKET_EDIT_CITY_CREATE not installed");
78438 return pc->phs.handlers->send[PACKET_EDIT_CITY_CREATE].packet(pc, packet);
78439}
78440
78441 int dsend_packet_edit_city_create(struct connection *pc, int owner, int tile, int size, int tag)
78442{
78443 struct packet_edit_city_create packet, *real_packet = &packet;
78444
78445 real_packet->owner = owner;
78446 real_packet->tile = tile;
78447 real_packet->size = size;
78448 real_packet->tag = tag;
78449
78450 return send_packet_edit_city_create(pc, real_packet);
78451}
78452
78453#ifdef FREECIV_DELTA_PROTOCOL
78454#define hash_packet_edit_city_remove_100 hash_const
78455
78456#define cmp_packet_edit_city_remove_100 cmp_const
78457
78458 BV_DEFINE(packet_edit_city_remove_100_fields, 1);
78459#endif /* FREECIV_DELTA_PROTOCOL */
78460
78461 static struct packet_edit_city_remove *receive_packet_edit_city_remove_100(struct connection *pc)
78462{
78463#ifdef FREECIV_DELTA_PROTOCOL
78464 packet_edit_city_remove_100_fields fields;
78465 struct packet_edit_city_remove *old;
78466 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY_REMOVE;
78467#endif /* FREECIV_DELTA_PROTOCOL */
78468 RECEIVE_PACKET_START(packet_edit_city_remove, real_packet);
78469#ifdef FREECIV_JSON_CONNECTION
78470 struct plocation field_addr;
78471 {
78472 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78473 field_addr = *field_addr_tmp;
78474 FC_FREE(field_addr_tmp);
78475 }
78476#endif /* FREECIV_JSON_CONNECTION */
78477
78478#ifdef FREECIV_DELTA_PROTOCOL
78479#ifdef FREECIV_JSON_CONNECTION
78480 field_addr.name = "fields";
78481#endif /* FREECIV_JSON_CONNECTION */
78482 DIO_BV_GET(&din, &field_addr, fields);
78483
78484#else /* FREECIV_DELTA_PROTOCOL */
78485#ifdef FREECIV_JSON_CONNECTION
78486 field_addr.name = "id";
78487#endif /* FREECIV_JSON_CONNECTION */
78488 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
78489 RECEIVE_PACKET_FIELD_ERROR(id);
78490 }
78491#endif
78492 log_packet_detailed("packet_edit_city_remove_100: got info about ()");
78493
78494#ifdef FREECIV_DELTA_PROTOCOL
78495 if (NULL == *hash) {
78496 *hash = genhash_new_full(hash_packet_edit_city_remove_100, cmp_packet_edit_city_remove_100,
78497 NULL, NULL, NULL, free);
78498 }
78499
78500 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78501 *real_packet = *old;
78502 } else {
78503 log_packet_detailed(" no old info");
78504 memset(real_packet, 0, sizeof(*real_packet));
78505 }
78506
78507 if (BV_ISSET(fields, 0)) {
78508 log_packet_detailed(" got field 'id'");
78509#ifdef FREECIV_JSON_CONNECTION
78510 field_addr.name = "id";
78511#endif /* FREECIV_JSON_CONNECTION */
78512 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
78513 RECEIVE_PACKET_FIELD_ERROR(id);
78514 }
78515 }
78516
78517 if (NULL == old) {
78518 old = fc_malloc(sizeof(*old));
78519 *old = *real_packet;
78520 genhash_insert(*hash, old, old);
78521 } else {
78522 *old = *real_packet;
78523 }
78524
78525#endif /* FREECIV_DELTA_PROTOCOL */
78526 RECEIVE_PACKET_END(real_packet);
78527}
78528
78529 static int send_packet_edit_city_remove_100(struct connection *pc, const struct packet_edit_city_remove *packet)
78530{
78531 const struct packet_edit_city_remove *real_packet = packet;
78532 int e;
78533#ifdef FREECIV_DELTA_PROTOCOL
78534 packet_edit_city_remove_100_fields fields;
78535 struct packet_edit_city_remove *old;
78536 bool differ;
78537 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY_REMOVE;
78538#endif /* FREECIV_DELTA_PROTOCOL */
78539 SEND_PACKET_START(PACKET_EDIT_CITY_REMOVE);
78540#ifdef FREECIV_JSON_CONNECTION
78541 struct plocation field_addr;
78542 {
78543 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78544 field_addr = *field_addr_tmp;
78545 FC_FREE(field_addr_tmp);
78546 }
78547#endif /* FREECIV_JSON_CONNECTION */
78548
78549 log_packet_detailed("packet_edit_city_remove_100: sending info about ()");
78550
78551#ifdef FREECIV_DELTA_PROTOCOL
78552 if (NULL == *hash) {
78553 *hash = genhash_new_full(hash_packet_edit_city_remove_100, cmp_packet_edit_city_remove_100,
78554 NULL, NULL, NULL, free);
78555 }
78556 BV_CLR_ALL(fields);
78557
78558 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
78559 old = fc_malloc(sizeof(*old));
78560 *old = *real_packet;
78561 genhash_insert(*hash, old, old);
78562 memset(old, 0, sizeof(*old));
78563 }
78564 differ = (old->id != real_packet->id);
78565 if (differ) {
78566 BV_SET(fields, 0);
78567 }
78568
78569
78570#ifdef FREECIV_JSON_CONNECTION
78571 field_addr.name = "fields";
78572#endif /* FREECIV_JSON_CONNECTION */
78573 e = 0;
78574 e |= DIO_BV_PUT(&dout, &field_addr, fields);
78575 if (e) {
78576 log_packet_detailed("fields bitvector error detected");
78577 }
78578
78579 if (BV_ISSET(fields, 0)) {
78580 log_packet_detailed(" field 'id' has changed");
78581#ifdef FREECIV_JSON_CONNECTION
78582 field_addr.name = "id";
78583#endif /* FREECIV_JSON_CONNECTION */
78584 e = 0;
78585 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
78586 if (e) {
78587 log_packet_detailed("'id' field error detected");
78588 }
78589 }
78590
78591 *old = *real_packet;
78592#endif /* FREECIV_DELTA_PROTOCOL */
78593#ifndef FREECIV_DELTA_PROTOCOL
78594#ifdef FREECIV_JSON_CONNECTION
78595 field_addr.name = "id";
78596#endif /* FREECIV_JSON_CONNECTION */
78597 e = 0;
78598 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
78599 if (e) {
78600 log_packet_detailed("'id' field error detected");
78601 }
78602
78603#endif
78604 SEND_PACKET_END(PACKET_EDIT_CITY_REMOVE);
78605}
78606
78607 int send_packet_edit_city_remove(struct connection *pc, const struct packet_edit_city_remove *packet)
78608{
78609 if (!pc->used) {
78610 log_error("WARNING: trying to send data to the closed connection %s",
78611 conn_description(pc));
78612 return -1;
78613 }
78614 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY_REMOVE].packet != NULL, -1,
78615 "Handler for PACKET_EDIT_CITY_REMOVE not installed");
78616 return pc->phs.handlers->send[PACKET_EDIT_CITY_REMOVE].packet(pc, packet);
78617}
78618
78619 int dsend_packet_edit_city_remove(struct connection *pc, int id)
78620{
78621 struct packet_edit_city_remove packet, *real_packet = &packet;
78622
78623 real_packet->id = id;
78624
78625 return send_packet_edit_city_remove(pc, real_packet);
78626}
78627
78628#ifdef FREECIV_DELTA_PROTOCOL
78629static genhash_val_t hash_packet_edit_city_100(const void *vkey)
78630{
78631 const struct packet_edit_city *key = (const struct packet_edit_city *) vkey;
78632 genhash_val_t result = 0;
78633
78634 result += key->id;
78635
78636 result &= 0xFFFFFFFF;
78637 return result;
78638}
78639
78640static bool cmp_packet_edit_city_100(const void *vkey1, const void *vkey2)
78641{
78642 const struct packet_edit_city *old = (const struct packet_edit_city *) vkey1;
78643 const struct packet_edit_city *real_packet = (const struct packet_edit_city *) vkey2;
78644 bool differ;
78645
78646 differ = (old->id != real_packet->id);
78647
78648 return !differ;
78649}
78650 BV_DEFINE(packet_edit_city_100_fields, 28);
78651#endif /* FREECIV_DELTA_PROTOCOL */
78652
78653 static struct packet_edit_city *receive_packet_edit_city_100(struct connection *pc)
78654{
78655#ifdef FREECIV_DELTA_PROTOCOL
78656 packet_edit_city_100_fields fields;
78657 struct packet_edit_city *old;
78658 struct genhash **hash = pc->phs.received + PACKET_EDIT_CITY;
78659#endif /* FREECIV_DELTA_PROTOCOL */
78660 RECEIVE_PACKET_START(packet_edit_city, real_packet);
78661#ifdef FREECIV_JSON_CONNECTION
78662 struct plocation field_addr;
78663 {
78664 struct plocation *field_addr_tmp = plocation_field_new(NULL);
78665 field_addr = *field_addr_tmp;
78666 FC_FREE(field_addr_tmp);
78667 }
78668#endif /* FREECIV_JSON_CONNECTION */
78669
78670#ifdef FREECIV_DELTA_PROTOCOL
78671#ifdef FREECIV_JSON_CONNECTION
78672 field_addr.name = "fields";
78673#endif /* FREECIV_JSON_CONNECTION */
78674 DIO_BV_GET(&din, &field_addr, fields);
78675#ifdef FREECIV_JSON_CONNECTION
78676 field_addr.name = "id";
78677#endif /* FREECIV_JSON_CONNECTION */
78678 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
78679 RECEIVE_PACKET_FIELD_ERROR(id);
78680 }
78681
78682#else /* FREECIV_DELTA_PROTOCOL */
78683#ifdef FREECIV_JSON_CONNECTION
78684 field_addr.name = "id";
78685#endif /* FREECIV_JSON_CONNECTION */
78686 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
78687 RECEIVE_PACKET_FIELD_ERROR(id);
78688 }
78689#ifdef FREECIV_JSON_CONNECTION
78690 field_addr.name = "name";
78691#endif /* FREECIV_JSON_CONNECTION */
78692 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
78693 RECEIVE_PACKET_FIELD_ERROR(name);
78694 }
78695#ifdef FREECIV_JSON_CONNECTION
78696 field_addr.name = "owner";
78697#endif /* FREECIV_JSON_CONNECTION */
78698 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
78699 RECEIVE_PACKET_FIELD_ERROR(owner);
78700 }
78701#ifdef FREECIV_JSON_CONNECTION
78702 field_addr.name = "original";
78703#endif /* FREECIV_JSON_CONNECTION */
78704 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
78705 RECEIVE_PACKET_FIELD_ERROR(original);
78706 }
78707#ifdef FREECIV_JSON_CONNECTION
78708 field_addr.name = "size";
78709#endif /* FREECIV_JSON_CONNECTION */
78710 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
78711 RECEIVE_PACKET_FIELD_ERROR(size);
78712 }
78713#ifdef FREECIV_JSON_CONNECTION
78714 field_addr.name = "history";
78715#endif /* FREECIV_JSON_CONNECTION */
78716 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
78717 RECEIVE_PACKET_FIELD_ERROR(history);
78718 }
78719#ifdef FREECIV_JSON_CONNECTION
78720 field_addr.name = "ppl_happy";
78721#endif /* FREECIV_JSON_CONNECTION */
78722 {
78723 int i;
78724
78725#ifdef FREECIV_JSON_CONNECTION
78726 /* Enter array. */
78727 field_addr.sub_location = plocation_elem_new(0);
78728#endif /* FREECIV_JSON_CONNECTION */
78729
78730 for (i = 0; i < 5; i++) {
78731#ifdef FREECIV_JSON_CONNECTION
78732 field_addr.sub_location->number = i;
78733#endif /* FREECIV_JSON_CONNECTION */
78734 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
78735 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
78736 }
78737 }
78738
78739#ifdef FREECIV_JSON_CONNECTION
78740 /* Exit array. */
78741 FC_FREE(field_addr.sub_location);
78742#endif /* FREECIV_JSON_CONNECTION */
78743 }
78744#ifdef FREECIV_JSON_CONNECTION
78745 field_addr.name = "ppl_content";
78746#endif /* FREECIV_JSON_CONNECTION */
78747 {
78748 int i;
78749
78750#ifdef FREECIV_JSON_CONNECTION
78751 /* Enter array. */
78752 field_addr.sub_location = plocation_elem_new(0);
78753#endif /* FREECIV_JSON_CONNECTION */
78754
78755 for (i = 0; i < 5; i++) {
78756#ifdef FREECIV_JSON_CONNECTION
78757 field_addr.sub_location->number = i;
78758#endif /* FREECIV_JSON_CONNECTION */
78759 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
78760 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
78761 }
78762 }
78763
78764#ifdef FREECIV_JSON_CONNECTION
78765 /* Exit array. */
78766 FC_FREE(field_addr.sub_location);
78767#endif /* FREECIV_JSON_CONNECTION */
78768 }
78769#ifdef FREECIV_JSON_CONNECTION
78770 field_addr.name = "ppl_unhappy";
78771#endif /* FREECIV_JSON_CONNECTION */
78772 {
78773 int i;
78774
78775#ifdef FREECIV_JSON_CONNECTION
78776 /* Enter array. */
78777 field_addr.sub_location = plocation_elem_new(0);
78778#endif /* FREECIV_JSON_CONNECTION */
78779
78780 for (i = 0; i < 5; i++) {
78781#ifdef FREECIV_JSON_CONNECTION
78782 field_addr.sub_location->number = i;
78783#endif /* FREECIV_JSON_CONNECTION */
78784 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
78785 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
78786 }
78787 }
78788
78789#ifdef FREECIV_JSON_CONNECTION
78790 /* Exit array. */
78791 FC_FREE(field_addr.sub_location);
78792#endif /* FREECIV_JSON_CONNECTION */
78793 }
78794#ifdef FREECIV_JSON_CONNECTION
78795 field_addr.name = "ppl_angry";
78796#endif /* FREECIV_JSON_CONNECTION */
78797 {
78798 int i;
78799
78800#ifdef FREECIV_JSON_CONNECTION
78801 /* Enter array. */
78802 field_addr.sub_location = plocation_elem_new(0);
78803#endif /* FREECIV_JSON_CONNECTION */
78804
78805 for (i = 0; i < 5; i++) {
78806#ifdef FREECIV_JSON_CONNECTION
78807 field_addr.sub_location->number = i;
78808#endif /* FREECIV_JSON_CONNECTION */
78809 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
78810 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
78811 }
78812 }
78813
78814#ifdef FREECIV_JSON_CONNECTION
78815 /* Exit array. */
78816 FC_FREE(field_addr.sub_location);
78817#endif /* FREECIV_JSON_CONNECTION */
78818 }
78819#ifdef FREECIV_JSON_CONNECTION
78820 field_addr.name = "specialists_size";
78821#endif /* FREECIV_JSON_CONNECTION */
78822 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
78823 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
78824 }
78825#ifdef FREECIV_JSON_CONNECTION
78826 field_addr.name = "specialists";
78827#endif /* FREECIV_JSON_CONNECTION */
78828 {
78829 int i;
78830
78831#ifdef FREECIV_JSON_CONNECTION
78832 /* Enter array. */
78833 field_addr.sub_location = plocation_elem_new(0);
78834#endif /* FREECIV_JSON_CONNECTION */
78835
78836 if (real_packet->specialists_size > SP_MAX) {
78837 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
78838 }
78839 for (i = 0; i < real_packet->specialists_size; i++) {
78840#ifdef FREECIV_JSON_CONNECTION
78841 field_addr.sub_location->number = i;
78842#endif /* FREECIV_JSON_CONNECTION */
78843 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
78844 RECEIVE_PACKET_FIELD_ERROR(specialists);
78845 }
78846 }
78847
78848#ifdef FREECIV_JSON_CONNECTION
78849 /* Exit array. */
78850 FC_FREE(field_addr.sub_location);
78851#endif /* FREECIV_JSON_CONNECTION */
78852 }
78853#ifdef FREECIV_JSON_CONNECTION
78854 field_addr.name = "food_stock";
78855#endif /* FREECIV_JSON_CONNECTION */
78856 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
78857 RECEIVE_PACKET_FIELD_ERROR(food_stock);
78858 }
78859#ifdef FREECIV_JSON_CONNECTION
78860 field_addr.name = "shield_stock";
78861#endif /* FREECIV_JSON_CONNECTION */
78862 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
78863 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
78864 }
78865#ifdef FREECIV_JSON_CONNECTION
78866 field_addr.name = "airlift";
78867#endif /* FREECIV_JSON_CONNECTION */
78868 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->airlift)) {
78869 RECEIVE_PACKET_FIELD_ERROR(airlift);
78870 }
78871#ifdef FREECIV_JSON_CONNECTION
78872 field_addr.name = "debug";
78873#endif /* FREECIV_JSON_CONNECTION */
78874 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->debug)) {
78875 RECEIVE_PACKET_FIELD_ERROR(debug);
78876 }
78877#ifdef FREECIV_JSON_CONNECTION
78878 field_addr.name = "did_buy";
78879#endif /* FREECIV_JSON_CONNECTION */
78880 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_buy)) {
78881 RECEIVE_PACKET_FIELD_ERROR(did_buy);
78882 }
78883#ifdef FREECIV_JSON_CONNECTION
78884 field_addr.name = "did_sell";
78885#endif /* FREECIV_JSON_CONNECTION */
78886 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->did_sell)) {
78887 RECEIVE_PACKET_FIELD_ERROR(did_sell);
78888 }
78889#ifdef FREECIV_JSON_CONNECTION
78890 field_addr.name = "was_happy";
78891#endif /* FREECIV_JSON_CONNECTION */
78892 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->was_happy)) {
78893 RECEIVE_PACKET_FIELD_ERROR(was_happy);
78894 }
78895#ifdef FREECIV_JSON_CONNECTION
78896 field_addr.name = "had_famine";
78897#endif /* FREECIV_JSON_CONNECTION */
78898 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->had_famine)) {
78899 RECEIVE_PACKET_FIELD_ERROR(had_famine);
78900 }
78901#ifdef FREECIV_JSON_CONNECTION
78902 field_addr.name = "anarchy";
78903#endif /* FREECIV_JSON_CONNECTION */
78904 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
78905 RECEIVE_PACKET_FIELD_ERROR(anarchy);
78906 }
78907#ifdef FREECIV_JSON_CONNECTION
78908 field_addr.name = "rapture";
78909#endif /* FREECIV_JSON_CONNECTION */
78910 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
78911 RECEIVE_PACKET_FIELD_ERROR(rapture);
78912 }
78913#ifdef FREECIV_JSON_CONNECTION
78914 field_addr.name = "steal";
78915#endif /* FREECIV_JSON_CONNECTION */
78916 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
78917 RECEIVE_PACKET_FIELD_ERROR(steal);
78918 }
78919#ifdef FREECIV_JSON_CONNECTION
78920 field_addr.name = "turn_founded";
78921#endif /* FREECIV_JSON_CONNECTION */
78922 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
78923 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
78924 }
78925#ifdef FREECIV_JSON_CONNECTION
78926 field_addr.name = "turn_last_built";
78927#endif /* FREECIV_JSON_CONNECTION */
78928 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
78929 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
78930 }
78931#ifdef FREECIV_JSON_CONNECTION
78932 field_addr.name = "built";
78933#endif /* FREECIV_JSON_CONNECTION */
78934 {
78935 int i;
78936
78937#ifdef FREECIV_JSON_CONNECTION
78938 /* Enter array. */
78939 field_addr.sub_location = plocation_elem_new(0);
78940#endif /* FREECIV_JSON_CONNECTION */
78941
78942 for (i = 0; i < B_LAST; i++) {
78943#ifdef FREECIV_JSON_CONNECTION
78944 field_addr.sub_location->number = i;
78945#endif /* FREECIV_JSON_CONNECTION */
78946 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
78947 RECEIVE_PACKET_FIELD_ERROR(built);
78948 }
78949 }
78950
78951#ifdef FREECIV_JSON_CONNECTION
78952 /* Exit array. */
78953 FC_FREE(field_addr.sub_location);
78954#endif /* FREECIV_JSON_CONNECTION */
78955 }
78956#ifdef FREECIV_JSON_CONNECTION
78957 field_addr.name = "production_kind";
78958#endif /* FREECIV_JSON_CONNECTION */
78959 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
78960 RECEIVE_PACKET_FIELD_ERROR(production_kind);
78961 }
78962#ifdef FREECIV_JSON_CONNECTION
78963 field_addr.name = "production_value";
78964#endif /* FREECIV_JSON_CONNECTION */
78965 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
78966 RECEIVE_PACKET_FIELD_ERROR(production_value);
78967 }
78968#ifdef FREECIV_JSON_CONNECTION
78969 field_addr.name = "city_options";
78970#endif /* FREECIV_JSON_CONNECTION */
78971 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
78972 RECEIVE_PACKET_FIELD_ERROR(city_options);
78973 }
78974#endif
78975 log_packet_detailed("packet_edit_city_100: got info about (%d)",
78976 real_packet->id);
78977
78978#ifdef FREECIV_DELTA_PROTOCOL
78979 if (NULL == *hash) {
78980 *hash = genhash_new_full(hash_packet_edit_city_100, cmp_packet_edit_city_100,
78981 NULL, NULL, NULL, free);
78982 }
78983
78984 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
78985 *real_packet = *old;
78986 } else {
78987 int id;
78988
78989 id = real_packet->id;
78990
78991 log_packet_detailed(" no old info");
78992 memset(real_packet, 0, sizeof(*real_packet));
78993
78994 real_packet->id = id;
78995 }
78996
78997 if (BV_ISSET(fields, 0)) {
78998 log_packet_detailed(" got field 'name'");
78999#ifdef FREECIV_JSON_CONNECTION
79000 field_addr.name = "name";
79001#endif /* FREECIV_JSON_CONNECTION */
79002 if (!DIO_GET(estring, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
79003 RECEIVE_PACKET_FIELD_ERROR(name);
79004 }
79005 }
79006 if (BV_ISSET(fields, 1)) {
79007 log_packet_detailed(" got field 'owner'");
79008#ifdef FREECIV_JSON_CONNECTION
79009 field_addr.name = "owner";
79010#endif /* FREECIV_JSON_CONNECTION */
79011 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->owner)) {
79012 RECEIVE_PACKET_FIELD_ERROR(owner);
79013 }
79014 }
79015 if (BV_ISSET(fields, 2)) {
79016 log_packet_detailed(" got field 'original'");
79017#ifdef FREECIV_JSON_CONNECTION
79018 field_addr.name = "original";
79019#endif /* FREECIV_JSON_CONNECTION */
79020 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->original)) {
79021 RECEIVE_PACKET_FIELD_ERROR(original);
79022 }
79023 }
79024 if (BV_ISSET(fields, 3)) {
79025 log_packet_detailed(" got field 'size'");
79026#ifdef FREECIV_JSON_CONNECTION
79027 field_addr.name = "size";
79028#endif /* FREECIV_JSON_CONNECTION */
79029 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
79030 RECEIVE_PACKET_FIELD_ERROR(size);
79031 }
79032 }
79033 if (BV_ISSET(fields, 4)) {
79034 log_packet_detailed(" got field 'history'");
79035#ifdef FREECIV_JSON_CONNECTION
79036 field_addr.name = "history";
79037#endif /* FREECIV_JSON_CONNECTION */
79038 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->history)) {
79039 RECEIVE_PACKET_FIELD_ERROR(history);
79040 }
79041 }
79042 if (BV_ISSET(fields, 5)) {
79043 log_packet_detailed(" got field 'ppl_happy'");
79044#ifdef FREECIV_JSON_CONNECTION
79045 field_addr.name = "ppl_happy";
79046#endif /* FREECIV_JSON_CONNECTION */
79047 {
79048 int i;
79049
79050#ifdef FREECIV_JSON_CONNECTION
79051 /* Enter array. */
79052 field_addr.sub_location = plocation_elem_new(0);
79053#endif /* FREECIV_JSON_CONNECTION */
79054
79055 for (i = 0; i < 5; i++) {
79056#ifdef FREECIV_JSON_CONNECTION
79057 field_addr.sub_location->number = i;
79058#endif /* FREECIV_JSON_CONNECTION */
79059 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_happy[i])) {
79060 RECEIVE_PACKET_FIELD_ERROR(ppl_happy);
79061 }
79062 }
79063
79064#ifdef FREECIV_JSON_CONNECTION
79065 /* Exit array. */
79066 FC_FREE(field_addr.sub_location);
79067#endif /* FREECIV_JSON_CONNECTION */
79068 }
79069 }
79070 if (BV_ISSET(fields, 6)) {
79071 log_packet_detailed(" got field 'ppl_content'");
79072#ifdef FREECIV_JSON_CONNECTION
79073 field_addr.name = "ppl_content";
79074#endif /* FREECIV_JSON_CONNECTION */
79075 {
79076 int i;
79077
79078#ifdef FREECIV_JSON_CONNECTION
79079 /* Enter array. */
79080 field_addr.sub_location = plocation_elem_new(0);
79081#endif /* FREECIV_JSON_CONNECTION */
79082
79083 for (i = 0; i < 5; i++) {
79084#ifdef FREECIV_JSON_CONNECTION
79085 field_addr.sub_location->number = i;
79086#endif /* FREECIV_JSON_CONNECTION */
79087 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_content[i])) {
79088 RECEIVE_PACKET_FIELD_ERROR(ppl_content);
79089 }
79090 }
79091
79092#ifdef FREECIV_JSON_CONNECTION
79093 /* Exit array. */
79094 FC_FREE(field_addr.sub_location);
79095#endif /* FREECIV_JSON_CONNECTION */
79096 }
79097 }
79098 if (BV_ISSET(fields, 7)) {
79099 log_packet_detailed(" got field 'ppl_unhappy'");
79100#ifdef FREECIV_JSON_CONNECTION
79101 field_addr.name = "ppl_unhappy";
79102#endif /* FREECIV_JSON_CONNECTION */
79103 {
79104 int i;
79105
79106#ifdef FREECIV_JSON_CONNECTION
79107 /* Enter array. */
79108 field_addr.sub_location = plocation_elem_new(0);
79109#endif /* FREECIV_JSON_CONNECTION */
79110
79111 for (i = 0; i < 5; i++) {
79112#ifdef FREECIV_JSON_CONNECTION
79113 field_addr.sub_location->number = i;
79114#endif /* FREECIV_JSON_CONNECTION */
79115 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_unhappy[i])) {
79116 RECEIVE_PACKET_FIELD_ERROR(ppl_unhappy);
79117 }
79118 }
79119
79120#ifdef FREECIV_JSON_CONNECTION
79121 /* Exit array. */
79122 FC_FREE(field_addr.sub_location);
79123#endif /* FREECIV_JSON_CONNECTION */
79124 }
79125 }
79126 if (BV_ISSET(fields, 8)) {
79127 log_packet_detailed(" got field 'ppl_angry'");
79128#ifdef FREECIV_JSON_CONNECTION
79129 field_addr.name = "ppl_angry";
79130#endif /* FREECIV_JSON_CONNECTION */
79131 {
79132 int i;
79133
79134#ifdef FREECIV_JSON_CONNECTION
79135 /* Enter array. */
79136 field_addr.sub_location = plocation_elem_new(0);
79137#endif /* FREECIV_JSON_CONNECTION */
79138
79139 for (i = 0; i < 5; i++) {
79140#ifdef FREECIV_JSON_CONNECTION
79141 field_addr.sub_location->number = i;
79142#endif /* FREECIV_JSON_CONNECTION */
79143 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->ppl_angry[i])) {
79144 RECEIVE_PACKET_FIELD_ERROR(ppl_angry);
79145 }
79146 }
79147
79148#ifdef FREECIV_JSON_CONNECTION
79149 /* Exit array. */
79150 FC_FREE(field_addr.sub_location);
79151#endif /* FREECIV_JSON_CONNECTION */
79152 }
79153 }
79154 if (BV_ISSET(fields, 9)) {
79155 log_packet_detailed(" got field 'specialists_size'");
79156#ifdef FREECIV_JSON_CONNECTION
79157 field_addr.name = "specialists_size";
79158#endif /* FREECIV_JSON_CONNECTION */
79159 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists_size)) {
79160 RECEIVE_PACKET_FIELD_ERROR(specialists_size);
79161 }
79162 }
79163 if (BV_ISSET(fields, 10)) {
79164 log_packet_detailed(" got field 'specialists'");
79165#ifdef FREECIV_JSON_CONNECTION
79166 field_addr.name = "specialists";
79167#endif /* FREECIV_JSON_CONNECTION */
79168 {
79169 int i;
79170
79171#ifdef FREECIV_JSON_CONNECTION
79172 /* Enter array. */
79173 field_addr.sub_location = plocation_elem_new(0);
79174#endif /* FREECIV_JSON_CONNECTION */
79175
79176 if (real_packet->specialists_size > SP_MAX) {
79177 RECEIVE_PACKET_FIELD_ERROR(specialists, ": truncation array");
79178 }
79179 for (i = 0; i < real_packet->specialists_size; i++) {
79180#ifdef FREECIV_JSON_CONNECTION
79181 field_addr.sub_location->number = i;
79182#endif /* FREECIV_JSON_CONNECTION */
79183 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->specialists[i])) {
79184 RECEIVE_PACKET_FIELD_ERROR(specialists);
79185 }
79186 }
79187
79188#ifdef FREECIV_JSON_CONNECTION
79189 /* Exit array. */
79190 FC_FREE(field_addr.sub_location);
79191#endif /* FREECIV_JSON_CONNECTION */
79192 }
79193 }
79194 if (BV_ISSET(fields, 11)) {
79195 log_packet_detailed(" got field 'food_stock'");
79196#ifdef FREECIV_JSON_CONNECTION
79197 field_addr.name = "food_stock";
79198#endif /* FREECIV_JSON_CONNECTION */
79199 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->food_stock)) {
79200 RECEIVE_PACKET_FIELD_ERROR(food_stock);
79201 }
79202 }
79203 if (BV_ISSET(fields, 12)) {
79204 log_packet_detailed(" got field 'shield_stock'");
79205#ifdef FREECIV_JSON_CONNECTION
79206 field_addr.name = "shield_stock";
79207#endif /* FREECIV_JSON_CONNECTION */
79208 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->shield_stock)) {
79209 RECEIVE_PACKET_FIELD_ERROR(shield_stock);
79210 }
79211 }
79212 real_packet->airlift = BV_ISSET(fields, 13);
79213 real_packet->debug = BV_ISSET(fields, 14);
79214 real_packet->did_buy = BV_ISSET(fields, 15);
79215 real_packet->did_sell = BV_ISSET(fields, 16);
79216 real_packet->was_happy = BV_ISSET(fields, 17);
79217 real_packet->had_famine = BV_ISSET(fields, 18);
79218 if (BV_ISSET(fields, 19)) {
79219 log_packet_detailed(" got field 'anarchy'");
79220#ifdef FREECIV_JSON_CONNECTION
79221 field_addr.name = "anarchy";
79222#endif /* FREECIV_JSON_CONNECTION */
79223 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->anarchy)) {
79224 RECEIVE_PACKET_FIELD_ERROR(anarchy);
79225 }
79226 }
79227 if (BV_ISSET(fields, 20)) {
79228 log_packet_detailed(" got field 'rapture'");
79229#ifdef FREECIV_JSON_CONNECTION
79230 field_addr.name = "rapture";
79231#endif /* FREECIV_JSON_CONNECTION */
79232 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->rapture)) {
79233 RECEIVE_PACKET_FIELD_ERROR(rapture);
79234 }
79235 }
79236 if (BV_ISSET(fields, 21)) {
79237 log_packet_detailed(" got field 'steal'");
79238#ifdef FREECIV_JSON_CONNECTION
79239 field_addr.name = "steal";
79240#endif /* FREECIV_JSON_CONNECTION */
79241 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->steal)) {
79242 RECEIVE_PACKET_FIELD_ERROR(steal);
79243 }
79244 }
79245 if (BV_ISSET(fields, 22)) {
79246 log_packet_detailed(" got field 'turn_founded'");
79247#ifdef FREECIV_JSON_CONNECTION
79248 field_addr.name = "turn_founded";
79249#endif /* FREECIV_JSON_CONNECTION */
79250 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_founded)) {
79251 RECEIVE_PACKET_FIELD_ERROR(turn_founded);
79252 }
79253 }
79254 if (BV_ISSET(fields, 23)) {
79255 log_packet_detailed(" got field 'turn_last_built'");
79256#ifdef FREECIV_JSON_CONNECTION
79257 field_addr.name = "turn_last_built";
79258#endif /* FREECIV_JSON_CONNECTION */
79259 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->turn_last_built)) {
79260 RECEIVE_PACKET_FIELD_ERROR(turn_last_built);
79261 }
79262 }
79263 if (BV_ISSET(fields, 24)) {
79264 log_packet_detailed(" got field 'built'");
79265#ifdef FREECIV_JSON_CONNECTION
79266 field_addr.name = "built";
79267#endif /* FREECIV_JSON_CONNECTION */
79268 {
79269#ifdef FREECIV_JSON_CONNECTION
79270 int count;
79271
79272 /* Enter array. */
79273 field_addr.sub_location = plocation_elem_new(0);
79274
79275 for (count = 0;; count++) {
79276 int i;
79277
79278 field_addr.sub_location->number = count;
79279
79280 /* Enter diff array element (start at the index address). */
79281 field_addr.sub_location->sub_location = plocation_elem_new(0);
79282#else /* FREECIV_JSON_CONNECTION */
79283 while (TRUE) {
79284 int i;
79285#endif /* FREECIV_JSON_CONNECTION */
79286
79287 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
79288 RECEIVE_PACKET_FIELD_ERROR(built);
79289 }
79290 if (i == MAX_UINT16) {
79291#ifdef FREECIV_JSON_CONNECTION
79292 /* Exit diff array element. */
79293 FC_FREE(field_addr.sub_location->sub_location);
79294
79295 /* Exit diff array. */
79296 FC_FREE(field_addr.sub_location);
79297#endif /* FREECIV_JSON_CONNECTION */
79298
79299 break;
79300 }
79301 if (i > B_LAST) {
79302 RECEIVE_PACKET_FIELD_ERROR(built,
79303 ": unexpected value %d "
79304 "(> B_LAST) in array diff",
79305 i);
79306 } else {
79307#ifdef FREECIV_JSON_CONNECTION
79308 /* Content address. */
79309 field_addr.sub_location->sub_location->number = 1;
79310#endif /* FREECIV_JSON_CONNECTION */
79311 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->built[i])) {
79312 RECEIVE_PACKET_FIELD_ERROR(built);
79313 }
79314 }
79315
79316#ifdef FREECIV_JSON_CONNECTION
79317 /* Exit diff array element. */
79318 FC_FREE(field_addr.sub_location->sub_location);
79319#endif /* FREECIV_JSON_CONNECTION */
79320 }
79321
79322#ifdef FREECIV_JSON_CONNECTION
79323 /* Exit array. */
79324 FC_FREE(field_addr.sub_location);
79325#endif /* FREECIV_JSON_CONNECTION */
79326 }
79327 }
79328 if (BV_ISSET(fields, 25)) {
79329 log_packet_detailed(" got field 'production_kind'");
79330#ifdef FREECIV_JSON_CONNECTION
79331 field_addr.name = "production_kind";
79332#endif /* FREECIV_JSON_CONNECTION */
79333 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_kind)) {
79334 RECEIVE_PACKET_FIELD_ERROR(production_kind);
79335 }
79336 }
79337 if (BV_ISSET(fields, 26)) {
79338 log_packet_detailed(" got field 'production_value'");
79339#ifdef FREECIV_JSON_CONNECTION
79340 field_addr.name = "production_value";
79341#endif /* FREECIV_JSON_CONNECTION */
79342 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->production_value)) {
79343 RECEIVE_PACKET_FIELD_ERROR(production_value);
79344 }
79345 }
79346 if (BV_ISSET(fields, 27)) {
79347 log_packet_detailed(" got field 'city_options'");
79348#ifdef FREECIV_JSON_CONNECTION
79349 field_addr.name = "city_options";
79350#endif /* FREECIV_JSON_CONNECTION */
79351 if (!DIO_BV_GET(&din, &field_addr, real_packet->city_options)) {
79352 RECEIVE_PACKET_FIELD_ERROR(city_options);
79353 }
79354 }
79355
79356 if (NULL == old) {
79357 old = fc_malloc(sizeof(*old));
79358 *old = *real_packet;
79359 genhash_insert(*hash, old, old);
79360 } else {
79361 *old = *real_packet;
79362 }
79363
79364#endif /* FREECIV_DELTA_PROTOCOL */
79365 RECEIVE_PACKET_END(real_packet);
79366}
79367
79368 static int send_packet_edit_city_100(struct connection *pc, const struct packet_edit_city *packet)
79369{
79370 const struct packet_edit_city *real_packet = packet;
79371 int e;
79372#ifdef FREECIV_DELTA_PROTOCOL
79373 packet_edit_city_100_fields fields;
79374 struct packet_edit_city *old;
79375 bool differ;
79376 struct genhash **hash = pc->phs.sent + PACKET_EDIT_CITY;
79377#endif /* FREECIV_DELTA_PROTOCOL */
79378 SEND_PACKET_START(PACKET_EDIT_CITY);
79379#ifdef FREECIV_JSON_CONNECTION
79380 struct plocation field_addr;
79381 {
79382 struct plocation *field_addr_tmp = plocation_field_new(NULL);
79383 field_addr = *field_addr_tmp;
79384 FC_FREE(field_addr_tmp);
79385 }
79386#endif /* FREECIV_JSON_CONNECTION */
79387
79388 log_packet_detailed("packet_edit_city_100: sending info about (%d)",
79389 real_packet->id);
79390
79391#ifdef FREECIV_DELTA_PROTOCOL
79392 if (NULL == *hash) {
79393 *hash = genhash_new_full(hash_packet_edit_city_100, cmp_packet_edit_city_100,
79394 NULL, NULL, NULL, free);
79395 }
79396 BV_CLR_ALL(fields);
79397
79398 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
79399 old = fc_malloc(sizeof(*old));
79400 *old = *real_packet;
79401 genhash_insert(*hash, old, old);
79402 memset(old, 0, sizeof(*old));
79403 }
79404 differ = (strcmp(old->name, real_packet->name) != 0);
79405 if (differ) {
79406 BV_SET(fields, 0);
79407 }
79408
79409 differ = (old->owner != real_packet->owner);
79410 if (differ) {
79411 BV_SET(fields, 1);
79412 }
79413
79414 differ = (old->original != real_packet->original);
79415 if (differ) {
79416 BV_SET(fields, 2);
79417 }
79418
79419 differ = (old->size != real_packet->size);
79420 if (differ) {
79421 BV_SET(fields, 3);
79422 }
79423
79424 differ = (old->history != real_packet->history);
79425 if (differ) {
79426 BV_SET(fields, 4);
79427 }
79428
79429 differ = FALSE;
79430 {
79431 int i;
79432
79433 for (i = 0; i < 5; i++) {
79434 differ = (old->ppl_happy[i] != real_packet->ppl_happy[i]);
79435 if (differ) {
79436 break;
79437 }
79438 }
79439 }
79440 if (differ) {
79441 BV_SET(fields, 5);
79442 }
79443
79444 differ = FALSE;
79445 {
79446 int i;
79447
79448 for (i = 0; i < 5; i++) {
79449 differ = (old->ppl_content[i] != real_packet->ppl_content[i]);
79450 if (differ) {
79451 break;
79452 }
79453 }
79454 }
79455 if (differ) {
79456 BV_SET(fields, 6);
79457 }
79458
79459 differ = FALSE;
79460 {
79461 int i;
79462
79463 for (i = 0; i < 5; i++) {
79464 differ = (old->ppl_unhappy[i] != real_packet->ppl_unhappy[i]);
79465 if (differ) {
79466 break;
79467 }
79468 }
79469 }
79470 if (differ) {
79471 BV_SET(fields, 7);
79472 }
79473
79474 differ = FALSE;
79475 {
79476 int i;
79477
79478 for (i = 0; i < 5; i++) {
79479 differ = (old->ppl_angry[i] != real_packet->ppl_angry[i]);
79480 if (differ) {
79481 break;
79482 }
79483 }
79484 }
79485 if (differ) {
79486 BV_SET(fields, 8);
79487 }
79488
79489 differ = (old->specialists_size != real_packet->specialists_size);
79490 if (differ) {
79491 BV_SET(fields, 9);
79492 }
79493
79494 differ = (old->specialists_size != real_packet->specialists_size);
79495 if (!differ) {
79496 int i;
79497
79498 for (i = 0; i < real_packet->specialists_size; i++) {
79499 differ = (old->specialists[i] != real_packet->specialists[i]);
79500 if (differ) {
79501 break;
79502 }
79503 }
79504 }
79505 if (differ) {
79506 BV_SET(fields, 10);
79507 }
79508
79509 differ = (old->food_stock != real_packet->food_stock);
79510 if (differ) {
79511 BV_SET(fields, 11);
79512 }
79513
79514 differ = (old->shield_stock != real_packet->shield_stock);
79515 if (differ) {
79516 BV_SET(fields, 12);
79517 }
79518
79519 if (packet->airlift) {
79520 BV_SET(fields, 13);
79521 }
79522
79523 if (packet->debug) {
79524 BV_SET(fields, 14);
79525 }
79526
79527 if (packet->did_buy) {
79528 BV_SET(fields, 15);
79529 }
79530
79531 if (packet->did_sell) {
79532 BV_SET(fields, 16);
79533 }
79534
79535 if (packet->was_happy) {
79536 BV_SET(fields, 17);
79537 }
79538
79539 if (packet->had_famine) {
79540 BV_SET(fields, 18);
79541 }
79542
79543 differ = (old->anarchy != real_packet->anarchy);
79544 if (differ) {
79545 BV_SET(fields, 19);
79546 }
79547
79548 differ = (old->rapture != real_packet->rapture);
79549 if (differ) {
79550 BV_SET(fields, 20);
79551 }
79552
79553 differ = (old->steal != real_packet->steal);
79554 if (differ) {
79555 BV_SET(fields, 21);
79556 }
79557
79558 differ = (old->turn_founded != real_packet->turn_founded);
79559 if (differ) {
79560 BV_SET(fields, 22);
79561 }
79562
79563 differ = (old->turn_last_built != real_packet->turn_last_built);
79564 if (differ) {
79565 BV_SET(fields, 23);
79566 }
79567
79568 differ = FALSE;
79569 {
79570 int i;
79571
79572 for (i = 0; i < B_LAST; i++) {
79573 differ = (old->built[i] != real_packet->built[i]);
79574 if (differ) {
79575 break;
79576 }
79577 }
79578 }
79579 if (differ) {
79580 BV_SET(fields, 24);
79581 }
79582
79583 differ = (old->production_kind != real_packet->production_kind);
79584 if (differ) {
79585 BV_SET(fields, 25);
79586 }
79587
79588 differ = (old->production_value != real_packet->production_value);
79589 if (differ) {
79590 BV_SET(fields, 26);
79591 }
79592
79593 differ = !BV_ARE_EQUAL(old->city_options, real_packet->city_options);
79594 if (differ) {
79595 BV_SET(fields, 27);
79596 }
79597
79598
79599#ifdef FREECIV_JSON_CONNECTION
79600 field_addr.name = "fields";
79601#endif /* FREECIV_JSON_CONNECTION */
79602 e = 0;
79603 e |= DIO_BV_PUT(&dout, &field_addr, fields);
79604 if (e) {
79605 log_packet_detailed("fields bitvector error detected");
79606 }
79607#ifdef FREECIV_JSON_CONNECTION
79608 field_addr.name = "id";
79609#endif /* FREECIV_JSON_CONNECTION */
79610 e = 0;
79611 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
79612 if (e) {
79613 log_packet_detailed("'id' field error detected");
79614 }
79615
79616 if (BV_ISSET(fields, 0)) {
79617 log_packet_detailed(" field 'name' has changed");
79618#ifdef FREECIV_JSON_CONNECTION
79619 field_addr.name = "name";
79620#endif /* FREECIV_JSON_CONNECTION */
79621 e = 0;
79622 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
79623 if (e) {
79624 log_packet_detailed("'name' field error detected");
79625 }
79626 }
79627 if (BV_ISSET(fields, 1)) {
79628 log_packet_detailed(" field 'owner' has changed");
79629#ifdef FREECIV_JSON_CONNECTION
79630 field_addr.name = "owner";
79631#endif /* FREECIV_JSON_CONNECTION */
79632 e = 0;
79633 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
79634 if (e) {
79635 log_packet_detailed("'owner' field error detected");
79636 }
79637 }
79638 if (BV_ISSET(fields, 2)) {
79639 log_packet_detailed(" field 'original' has changed");
79640#ifdef FREECIV_JSON_CONNECTION
79641 field_addr.name = "original";
79642#endif /* FREECIV_JSON_CONNECTION */
79643 e = 0;
79644 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
79645 if (e) {
79646 log_packet_detailed("'original' field error detected");
79647 }
79648 }
79649 if (BV_ISSET(fields, 3)) {
79650 log_packet_detailed(" field 'size' has changed");
79651#ifdef FREECIV_JSON_CONNECTION
79652 field_addr.name = "size";
79653#endif /* FREECIV_JSON_CONNECTION */
79654 e = 0;
79655 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
79656 if (e) {
79657 log_packet_detailed("'size' field error detected");
79658 }
79659 }
79660 if (BV_ISSET(fields, 4)) {
79661 log_packet_detailed(" field 'history' has changed");
79662#ifdef FREECIV_JSON_CONNECTION
79663 field_addr.name = "history";
79664#endif /* FREECIV_JSON_CONNECTION */
79665 e = 0;
79666 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
79667 if (e) {
79668 log_packet_detailed("'history' field error detected");
79669 }
79670 }
79671 if (BV_ISSET(fields, 5)) {
79672 log_packet_detailed(" field 'ppl_happy' has changed");
79673#ifdef FREECIV_JSON_CONNECTION
79674 field_addr.name = "ppl_happy";
79675#endif /* FREECIV_JSON_CONNECTION */
79676 e = 0;
79677 {
79678 int i;
79679
79680#ifdef FREECIV_JSON_CONNECTION
79681 /* Create the array. */
79682 e |= DIO_PUT(farray, &dout, &field_addr, 5);
79683
79684 /* Enter the array. */
79685 field_addr.sub_location = plocation_elem_new(0);
79686#endif /* FREECIV_JSON_CONNECTION */
79687
79688 for (i = 0; i < 5; i++) {
79689#ifdef FREECIV_JSON_CONNECTION
79690 /* Next array element. */
79691 field_addr.sub_location->number = i;
79692#endif /* FREECIV_JSON_CONNECTION */
79693 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
79694 }
79695
79696#ifdef FREECIV_JSON_CONNECTION
79697 /* Exit array. */
79698 FC_FREE(field_addr.sub_location);
79699#endif /* FREECIV_JSON_CONNECTION */
79700 }
79701 if (e) {
79702 log_packet_detailed("'ppl_happy' field error detected");
79703 }
79704 }
79705 if (BV_ISSET(fields, 6)) {
79706 log_packet_detailed(" field 'ppl_content' has changed");
79707#ifdef FREECIV_JSON_CONNECTION
79708 field_addr.name = "ppl_content";
79709#endif /* FREECIV_JSON_CONNECTION */
79710 e = 0;
79711 {
79712 int i;
79713
79714#ifdef FREECIV_JSON_CONNECTION
79715 /* Create the array. */
79716 e |= DIO_PUT(farray, &dout, &field_addr, 5);
79717
79718 /* Enter the array. */
79719 field_addr.sub_location = plocation_elem_new(0);
79720#endif /* FREECIV_JSON_CONNECTION */
79721
79722 for (i = 0; i < 5; i++) {
79723#ifdef FREECIV_JSON_CONNECTION
79724 /* Next array element. */
79725 field_addr.sub_location->number = i;
79726#endif /* FREECIV_JSON_CONNECTION */
79727 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
79728 }
79729
79730#ifdef FREECIV_JSON_CONNECTION
79731 /* Exit array. */
79732 FC_FREE(field_addr.sub_location);
79733#endif /* FREECIV_JSON_CONNECTION */
79734 }
79735 if (e) {
79736 log_packet_detailed("'ppl_content' field error detected");
79737 }
79738 }
79739 if (BV_ISSET(fields, 7)) {
79740 log_packet_detailed(" field 'ppl_unhappy' has changed");
79741#ifdef FREECIV_JSON_CONNECTION
79742 field_addr.name = "ppl_unhappy";
79743#endif /* FREECIV_JSON_CONNECTION */
79744 e = 0;
79745 {
79746 int i;
79747
79748#ifdef FREECIV_JSON_CONNECTION
79749 /* Create the array. */
79750 e |= DIO_PUT(farray, &dout, &field_addr, 5);
79751
79752 /* Enter the array. */
79753 field_addr.sub_location = plocation_elem_new(0);
79754#endif /* FREECIV_JSON_CONNECTION */
79755
79756 for (i = 0; i < 5; i++) {
79757#ifdef FREECIV_JSON_CONNECTION
79758 /* Next array element. */
79759 field_addr.sub_location->number = i;
79760#endif /* FREECIV_JSON_CONNECTION */
79761 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
79762 }
79763
79764#ifdef FREECIV_JSON_CONNECTION
79765 /* Exit array. */
79766 FC_FREE(field_addr.sub_location);
79767#endif /* FREECIV_JSON_CONNECTION */
79768 }
79769 if (e) {
79770 log_packet_detailed("'ppl_unhappy' field error detected");
79771 }
79772 }
79773 if (BV_ISSET(fields, 8)) {
79774 log_packet_detailed(" field 'ppl_angry' has changed");
79775#ifdef FREECIV_JSON_CONNECTION
79776 field_addr.name = "ppl_angry";
79777#endif /* FREECIV_JSON_CONNECTION */
79778 e = 0;
79779 {
79780 int i;
79781
79782#ifdef FREECIV_JSON_CONNECTION
79783 /* Create the array. */
79784 e |= DIO_PUT(farray, &dout, &field_addr, 5);
79785
79786 /* Enter the array. */
79787 field_addr.sub_location = plocation_elem_new(0);
79788#endif /* FREECIV_JSON_CONNECTION */
79789
79790 for (i = 0; i < 5; i++) {
79791#ifdef FREECIV_JSON_CONNECTION
79792 /* Next array element. */
79793 field_addr.sub_location->number = i;
79794#endif /* FREECIV_JSON_CONNECTION */
79795 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
79796 }
79797
79798#ifdef FREECIV_JSON_CONNECTION
79799 /* Exit array. */
79800 FC_FREE(field_addr.sub_location);
79801#endif /* FREECIV_JSON_CONNECTION */
79802 }
79803 if (e) {
79804 log_packet_detailed("'ppl_angry' field error detected");
79805 }
79806 }
79807 if (BV_ISSET(fields, 9)) {
79808 log_packet_detailed(" field 'specialists_size' has changed");
79809#ifdef FREECIV_JSON_CONNECTION
79810 field_addr.name = "specialists_size";
79811#endif /* FREECIV_JSON_CONNECTION */
79812 e = 0;
79813 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
79814 if (e) {
79815 log_packet_detailed("'specialists_size' field error detected");
79816 }
79817 }
79818 if (BV_ISSET(fields, 10)) {
79819 log_packet_detailed(" field 'specialists' has changed");
79820#ifdef FREECIV_JSON_CONNECTION
79821 field_addr.name = "specialists";
79822#endif /* FREECIV_JSON_CONNECTION */
79823 e = 0;
79824 {
79825 int i;
79826
79827#ifdef FREECIV_JSON_CONNECTION
79828 /* Create the array. */
79829 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
79830
79831 /* Enter the array. */
79832 field_addr.sub_location = plocation_elem_new(0);
79833#endif /* FREECIV_JSON_CONNECTION */
79834
79835 for (i = 0; i < real_packet->specialists_size; i++) {
79836#ifdef FREECIV_JSON_CONNECTION
79837 /* Next array element. */
79838 field_addr.sub_location->number = i;
79839#endif /* FREECIV_JSON_CONNECTION */
79840 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
79841 }
79842
79843#ifdef FREECIV_JSON_CONNECTION
79844 /* Exit array. */
79845 FC_FREE(field_addr.sub_location);
79846#endif /* FREECIV_JSON_CONNECTION */
79847 }
79848 if (e) {
79849 log_packet_detailed("'specialists' field error detected");
79850 }
79851 }
79852 if (BV_ISSET(fields, 11)) {
79853 log_packet_detailed(" field 'food_stock' has changed");
79854#ifdef FREECIV_JSON_CONNECTION
79855 field_addr.name = "food_stock";
79856#endif /* FREECIV_JSON_CONNECTION */
79857 e = 0;
79858 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
79859 if (e) {
79860 log_packet_detailed("'food_stock' field error detected");
79861 }
79862 }
79863 if (BV_ISSET(fields, 12)) {
79864 log_packet_detailed(" field 'shield_stock' has changed");
79865#ifdef FREECIV_JSON_CONNECTION
79866 field_addr.name = "shield_stock";
79867#endif /* FREECIV_JSON_CONNECTION */
79868 e = 0;
79869 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
79870 if (e) {
79871 log_packet_detailed("'shield_stock' field error detected");
79872 }
79873 }
79874 /* field 13 is folded into the header */
79875 /* field 14 is folded into the header */
79876 /* field 15 is folded into the header */
79877 /* field 16 is folded into the header */
79878 /* field 17 is folded into the header */
79879 /* field 18 is folded into the header */
79880 if (BV_ISSET(fields, 19)) {
79881 log_packet_detailed(" field 'anarchy' has changed");
79882#ifdef FREECIV_JSON_CONNECTION
79883 field_addr.name = "anarchy";
79884#endif /* FREECIV_JSON_CONNECTION */
79885 e = 0;
79886 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
79887 if (e) {
79888 log_packet_detailed("'anarchy' field error detected");
79889 }
79890 }
79891 if (BV_ISSET(fields, 20)) {
79892 log_packet_detailed(" field 'rapture' has changed");
79893#ifdef FREECIV_JSON_CONNECTION
79894 field_addr.name = "rapture";
79895#endif /* FREECIV_JSON_CONNECTION */
79896 e = 0;
79897 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
79898 if (e) {
79899 log_packet_detailed("'rapture' field error detected");
79900 }
79901 }
79902 if (BV_ISSET(fields, 21)) {
79903 log_packet_detailed(" field 'steal' has changed");
79904#ifdef FREECIV_JSON_CONNECTION
79905 field_addr.name = "steal";
79906#endif /* FREECIV_JSON_CONNECTION */
79907 e = 0;
79908 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
79909 if (e) {
79910 log_packet_detailed("'steal' field error detected");
79911 }
79912 }
79913 if (BV_ISSET(fields, 22)) {
79914 log_packet_detailed(" field 'turn_founded' has changed");
79915#ifdef FREECIV_JSON_CONNECTION
79916 field_addr.name = "turn_founded";
79917#endif /* FREECIV_JSON_CONNECTION */
79918 e = 0;
79919 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
79920 if (e) {
79921 log_packet_detailed("'turn_founded' field error detected");
79922 }
79923 }
79924 if (BV_ISSET(fields, 23)) {
79925 log_packet_detailed(" field 'turn_last_built' has changed");
79926#ifdef FREECIV_JSON_CONNECTION
79927 field_addr.name = "turn_last_built";
79928#endif /* FREECIV_JSON_CONNECTION */
79929 e = 0;
79930 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
79931 if (e) {
79932 log_packet_detailed("'turn_last_built' field error detected");
79933 }
79934 }
79935 if (BV_ISSET(fields, 24)) {
79936 log_packet_detailed(" field 'built' has changed");
79937#ifdef FREECIV_JSON_CONNECTION
79938 field_addr.name = "built";
79939#endif /* FREECIV_JSON_CONNECTION */
79940 e = 0;
79941 {
79942 int i;
79943
79944#ifdef FREECIV_JSON_CONNECTION
79945 size_t count_i = 0;
79946
79947 /* Create the array. */
79948 e |= DIO_PUT(farray, &dout, &field_addr, 0);
79949
79950 /* Enter array. */
79951 field_addr.sub_location = plocation_elem_new(0);
79952#endif /* FREECIV_JSON_CONNECTION */
79953
79954 fc_assert(B_LAST < MAX_UINT16);
79955
79956 for (i = 0; i < B_LAST; i++) {
79957 differ = (old->built[i] != real_packet->built[i]);
79958
79959 if (differ) {
79960#ifdef FREECIV_JSON_CONNECTION
79961 /* Append next diff array element. */
79962 field_addr.sub_location->number = -1;
79963
79964 /* Create the diff array element. */
79965 e |= DIO_PUT(farray, &dout, &field_addr, 2);
79966
79967 /* Enter diff array element (start at the index address). */
79968 field_addr.sub_location->number = count_i++;
79969 field_addr.sub_location->sub_location = plocation_elem_new(0);
79970#endif /* FREECIV_JSON_CONNECTION */
79971 e |= DIO_PUT(uint16, &dout, &field_addr, i);
79972
79973#ifdef FREECIV_JSON_CONNECTION
79974 /* Content address. */
79975 field_addr.sub_location->sub_location->number = 1;
79976#endif /* FREECIV_JSON_CONNECTION */
79977 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
79978
79979#ifdef FREECIV_JSON_CONNECTION
79980 /* Exit diff array element. */
79981 FC_FREE(field_addr.sub_location->sub_location);
79982#endif /* FREECIV_JSON_CONNECTION */
79983 }
79984 }
79985#ifdef FREECIV_JSON_CONNECTION
79986 /* Append diff array element. */
79987 field_addr.sub_location->number = -1;
79988
79989 /* Create the terminating diff array element. */
79990 e |= DIO_PUT(farray, &dout, &field_addr, 1);
79991
79992 /* Enter diff array element (start at the index address). */
79993 field_addr.sub_location->number = count_i;
79994 field_addr.sub_location->sub_location = plocation_elem_new(0);
79995#endif /* FREECIV_JSON_CONNECTION */
79996 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
79997
79998#ifdef FREECIV_JSON_CONNECTION
79999 /* Exit diff array element. */
80000 FC_FREE(field_addr.sub_location->sub_location);
80001
80002 /* Exit array. */
80003 FC_FREE(field_addr.sub_location);
80004#endif /* FREECIV_JSON_CONNECTION */
80005 }
80006 if (e) {
80007 log_packet_detailed("'built' field error detected");
80008 }
80009 }
80010 if (BV_ISSET(fields, 25)) {
80011 log_packet_detailed(" field 'production_kind' has changed");
80012#ifdef FREECIV_JSON_CONNECTION
80013 field_addr.name = "production_kind";
80014#endif /* FREECIV_JSON_CONNECTION */
80015 e = 0;
80016 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
80017 if (e) {
80018 log_packet_detailed("'production_kind' field error detected");
80019 }
80020 }
80021 if (BV_ISSET(fields, 26)) {
80022 log_packet_detailed(" field 'production_value' has changed");
80023#ifdef FREECIV_JSON_CONNECTION
80024 field_addr.name = "production_value";
80025#endif /* FREECIV_JSON_CONNECTION */
80026 e = 0;
80027 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
80028 if (e) {
80029 log_packet_detailed("'production_value' field error detected");
80030 }
80031 }
80032 if (BV_ISSET(fields, 27)) {
80033 log_packet_detailed(" field 'city_options' has changed");
80034#ifdef FREECIV_JSON_CONNECTION
80035 field_addr.name = "city_options";
80036#endif /* FREECIV_JSON_CONNECTION */
80037 e = 0;
80038 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
80039 if (e) {
80040 log_packet_detailed("'city_options' field error detected");
80041 }
80042 }
80043
80044 *old = *real_packet;
80045#endif /* FREECIV_DELTA_PROTOCOL */
80046#ifndef FREECIV_DELTA_PROTOCOL
80047#ifdef FREECIV_JSON_CONNECTION
80048 field_addr.name = "id";
80049#endif /* FREECIV_JSON_CONNECTION */
80050 e = 0;
80051 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
80052 if (e) {
80053 log_packet_detailed("'id' field error detected");
80054 }
80055#ifdef FREECIV_JSON_CONNECTION
80056 field_addr.name = "name";
80057#endif /* FREECIV_JSON_CONNECTION */
80058 e = 0;
80059 e |= DIO_PUT(estring, &dout, &field_addr, real_packet->name);
80060 if (e) {
80061 log_packet_detailed("'name' field error detected");
80062 }
80063#ifdef FREECIV_JSON_CONNECTION
80064 field_addr.name = "owner";
80065#endif /* FREECIV_JSON_CONNECTION */
80066 e = 0;
80067 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->owner);
80068 if (e) {
80069 log_packet_detailed("'owner' field error detected");
80070 }
80071#ifdef FREECIV_JSON_CONNECTION
80072 field_addr.name = "original";
80073#endif /* FREECIV_JSON_CONNECTION */
80074 e = 0;
80075 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->original);
80076 if (e) {
80077 log_packet_detailed("'original' field error detected");
80078 }
80079#ifdef FREECIV_JSON_CONNECTION
80080 field_addr.name = "size";
80081#endif /* FREECIV_JSON_CONNECTION */
80082 e = 0;
80083 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
80084 if (e) {
80085 log_packet_detailed("'size' field error detected");
80086 }
80087#ifdef FREECIV_JSON_CONNECTION
80088 field_addr.name = "history";
80089#endif /* FREECIV_JSON_CONNECTION */
80090 e = 0;
80091 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->history);
80092 if (e) {
80093 log_packet_detailed("'history' field error detected");
80094 }
80095#ifdef FREECIV_JSON_CONNECTION
80096 field_addr.name = "ppl_happy";
80097#endif /* FREECIV_JSON_CONNECTION */
80098 e = 0;
80099 {
80100 int i;
80101
80102#ifdef FREECIV_JSON_CONNECTION
80103 /* Create the array. */
80104 e |= DIO_PUT(farray, &dout, &field_addr, 5);
80105
80106 /* Enter the array. */
80107 field_addr.sub_location = plocation_elem_new(0);
80108#endif /* FREECIV_JSON_CONNECTION */
80109
80110 for (i = 0; i < 5; i++) {
80111#ifdef FREECIV_JSON_CONNECTION
80112 /* Next array element. */
80113 field_addr.sub_location->number = i;
80114#endif /* FREECIV_JSON_CONNECTION */
80115 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_happy[i]);
80116 }
80117
80118#ifdef FREECIV_JSON_CONNECTION
80119 /* Exit array. */
80120 FC_FREE(field_addr.sub_location);
80121#endif /* FREECIV_JSON_CONNECTION */
80122 }
80123 if (e) {
80124 log_packet_detailed("'ppl_happy' field error detected");
80125 }
80126#ifdef FREECIV_JSON_CONNECTION
80127 field_addr.name = "ppl_content";
80128#endif /* FREECIV_JSON_CONNECTION */
80129 e = 0;
80130 {
80131 int i;
80132
80133#ifdef FREECIV_JSON_CONNECTION
80134 /* Create the array. */
80135 e |= DIO_PUT(farray, &dout, &field_addr, 5);
80136
80137 /* Enter the array. */
80138 field_addr.sub_location = plocation_elem_new(0);
80139#endif /* FREECIV_JSON_CONNECTION */
80140
80141 for (i = 0; i < 5; i++) {
80142#ifdef FREECIV_JSON_CONNECTION
80143 /* Next array element. */
80144 field_addr.sub_location->number = i;
80145#endif /* FREECIV_JSON_CONNECTION */
80146 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_content[i]);
80147 }
80148
80149#ifdef FREECIV_JSON_CONNECTION
80150 /* Exit array. */
80151 FC_FREE(field_addr.sub_location);
80152#endif /* FREECIV_JSON_CONNECTION */
80153 }
80154 if (e) {
80155 log_packet_detailed("'ppl_content' field error detected");
80156 }
80157#ifdef FREECIV_JSON_CONNECTION
80158 field_addr.name = "ppl_unhappy";
80159#endif /* FREECIV_JSON_CONNECTION */
80160 e = 0;
80161 {
80162 int i;
80163
80164#ifdef FREECIV_JSON_CONNECTION
80165 /* Create the array. */
80166 e |= DIO_PUT(farray, &dout, &field_addr, 5);
80167
80168 /* Enter the array. */
80169 field_addr.sub_location = plocation_elem_new(0);
80170#endif /* FREECIV_JSON_CONNECTION */
80171
80172 for (i = 0; i < 5; i++) {
80173#ifdef FREECIV_JSON_CONNECTION
80174 /* Next array element. */
80175 field_addr.sub_location->number = i;
80176#endif /* FREECIV_JSON_CONNECTION */
80177 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_unhappy[i]);
80178 }
80179
80180#ifdef FREECIV_JSON_CONNECTION
80181 /* Exit array. */
80182 FC_FREE(field_addr.sub_location);
80183#endif /* FREECIV_JSON_CONNECTION */
80184 }
80185 if (e) {
80186 log_packet_detailed("'ppl_unhappy' field error detected");
80187 }
80188#ifdef FREECIV_JSON_CONNECTION
80189 field_addr.name = "ppl_angry";
80190#endif /* FREECIV_JSON_CONNECTION */
80191 e = 0;
80192 {
80193 int i;
80194
80195#ifdef FREECIV_JSON_CONNECTION
80196 /* Create the array. */
80197 e |= DIO_PUT(farray, &dout, &field_addr, 5);
80198
80199 /* Enter the array. */
80200 field_addr.sub_location = plocation_elem_new(0);
80201#endif /* FREECIV_JSON_CONNECTION */
80202
80203 for (i = 0; i < 5; i++) {
80204#ifdef FREECIV_JSON_CONNECTION
80205 /* Next array element. */
80206 field_addr.sub_location->number = i;
80207#endif /* FREECIV_JSON_CONNECTION */
80208 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->ppl_angry[i]);
80209 }
80210
80211#ifdef FREECIV_JSON_CONNECTION
80212 /* Exit array. */
80213 FC_FREE(field_addr.sub_location);
80214#endif /* FREECIV_JSON_CONNECTION */
80215 }
80216 if (e) {
80217 log_packet_detailed("'ppl_angry' field error detected");
80218 }
80219#ifdef FREECIV_JSON_CONNECTION
80220 field_addr.name = "specialists_size";
80221#endif /* FREECIV_JSON_CONNECTION */
80222 e = 0;
80223 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists_size);
80224 if (e) {
80225 log_packet_detailed("'specialists_size' field error detected");
80226 }
80227#ifdef FREECIV_JSON_CONNECTION
80228 field_addr.name = "specialists";
80229#endif /* FREECIV_JSON_CONNECTION */
80230 e = 0;
80231 {
80232 int i;
80233
80234#ifdef FREECIV_JSON_CONNECTION
80235 /* Create the array. */
80236 e |= DIO_PUT(farray, &dout, &field_addr, real_packet->specialists_size);
80237
80238 /* Enter the array. */
80239 field_addr.sub_location = plocation_elem_new(0);
80240#endif /* FREECIV_JSON_CONNECTION */
80241
80242 for (i = 0; i < real_packet->specialists_size; i++) {
80243#ifdef FREECIV_JSON_CONNECTION
80244 /* Next array element. */
80245 field_addr.sub_location->number = i;
80246#endif /* FREECIV_JSON_CONNECTION */
80247 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->specialists[i]);
80248 }
80249
80250#ifdef FREECIV_JSON_CONNECTION
80251 /* Exit array. */
80252 FC_FREE(field_addr.sub_location);
80253#endif /* FREECIV_JSON_CONNECTION */
80254 }
80255 if (e) {
80256 log_packet_detailed("'specialists' field error detected");
80257 }
80258#ifdef FREECIV_JSON_CONNECTION
80259 field_addr.name = "food_stock";
80260#endif /* FREECIV_JSON_CONNECTION */
80261 e = 0;
80262 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->food_stock);
80263 if (e) {
80264 log_packet_detailed("'food_stock' field error detected");
80265 }
80266#ifdef FREECIV_JSON_CONNECTION
80267 field_addr.name = "shield_stock";
80268#endif /* FREECIV_JSON_CONNECTION */
80269 e = 0;
80270 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->shield_stock);
80271 if (e) {
80272 log_packet_detailed("'shield_stock' field error detected");
80273 }
80274#ifdef FREECIV_JSON_CONNECTION
80275 field_addr.name = "airlift";
80276#endif /* FREECIV_JSON_CONNECTION */
80277 e = 0;
80278 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->airlift);
80279 if (e) {
80280 log_packet_detailed("'airlift' field error detected");
80281 }
80282#ifdef FREECIV_JSON_CONNECTION
80283 field_addr.name = "debug";
80284#endif /* FREECIV_JSON_CONNECTION */
80285 e = 0;
80286 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->debug);
80287 if (e) {
80288 log_packet_detailed("'debug' field error detected");
80289 }
80290#ifdef FREECIV_JSON_CONNECTION
80291 field_addr.name = "did_buy";
80292#endif /* FREECIV_JSON_CONNECTION */
80293 e = 0;
80294 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_buy);
80295 if (e) {
80296 log_packet_detailed("'did_buy' field error detected");
80297 }
80298#ifdef FREECIV_JSON_CONNECTION
80299 field_addr.name = "did_sell";
80300#endif /* FREECIV_JSON_CONNECTION */
80301 e = 0;
80302 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->did_sell);
80303 if (e) {
80304 log_packet_detailed("'did_sell' field error detected");
80305 }
80306#ifdef FREECIV_JSON_CONNECTION
80307 field_addr.name = "was_happy";
80308#endif /* FREECIV_JSON_CONNECTION */
80309 e = 0;
80310 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->was_happy);
80311 if (e) {
80312 log_packet_detailed("'was_happy' field error detected");
80313 }
80314#ifdef FREECIV_JSON_CONNECTION
80315 field_addr.name = "had_famine";
80316#endif /* FREECIV_JSON_CONNECTION */
80317 e = 0;
80318 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->had_famine);
80319 if (e) {
80320 log_packet_detailed("'had_famine' field error detected");
80321 }
80322#ifdef FREECIV_JSON_CONNECTION
80323 field_addr.name = "anarchy";
80324#endif /* FREECIV_JSON_CONNECTION */
80325 e = 0;
80326 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->anarchy);
80327 if (e) {
80328 log_packet_detailed("'anarchy' field error detected");
80329 }
80330#ifdef FREECIV_JSON_CONNECTION
80331 field_addr.name = "rapture";
80332#endif /* FREECIV_JSON_CONNECTION */
80333 e = 0;
80334 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->rapture);
80335 if (e) {
80336 log_packet_detailed("'rapture' field error detected");
80337 }
80338#ifdef FREECIV_JSON_CONNECTION
80339 field_addr.name = "steal";
80340#endif /* FREECIV_JSON_CONNECTION */
80341 e = 0;
80342 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->steal);
80343 if (e) {
80344 log_packet_detailed("'steal' field error detected");
80345 }
80346#ifdef FREECIV_JSON_CONNECTION
80347 field_addr.name = "turn_founded";
80348#endif /* FREECIV_JSON_CONNECTION */
80349 e = 0;
80350 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_founded);
80351 if (e) {
80352 log_packet_detailed("'turn_founded' field error detected");
80353 }
80354#ifdef FREECIV_JSON_CONNECTION
80355 field_addr.name = "turn_last_built";
80356#endif /* FREECIV_JSON_CONNECTION */
80357 e = 0;
80358 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->turn_last_built);
80359 if (e) {
80360 log_packet_detailed("'turn_last_built' field error detected");
80361 }
80362#ifdef FREECIV_JSON_CONNECTION
80363 field_addr.name = "built";
80364#endif /* FREECIV_JSON_CONNECTION */
80365 e = 0;
80366 {
80367 int i;
80368
80369#ifdef FREECIV_JSON_CONNECTION
80370 /* Create the array. */
80371 e |= DIO_PUT(farray, &dout, &field_addr, B_LAST);
80372
80373 /* Enter the array. */
80374 field_addr.sub_location = plocation_elem_new(0);
80375#endif /* FREECIV_JSON_CONNECTION */
80376
80377 for (i = 0; i < B_LAST; i++) {
80378#ifdef FREECIV_JSON_CONNECTION
80379 /* Next array element. */
80380 field_addr.sub_location->number = i;
80381#endif /* FREECIV_JSON_CONNECTION */
80382 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->built[i]);
80383 }
80384
80385#ifdef FREECIV_JSON_CONNECTION
80386 /* Exit array. */
80387 FC_FREE(field_addr.sub_location);
80388#endif /* FREECIV_JSON_CONNECTION */
80389 }
80390 if (e) {
80391 log_packet_detailed("'built' field error detected");
80392 }
80393#ifdef FREECIV_JSON_CONNECTION
80394 field_addr.name = "production_kind";
80395#endif /* FREECIV_JSON_CONNECTION */
80396 e = 0;
80397 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_kind);
80398 if (e) {
80399 log_packet_detailed("'production_kind' field error detected");
80400 }
80401#ifdef FREECIV_JSON_CONNECTION
80402 field_addr.name = "production_value";
80403#endif /* FREECIV_JSON_CONNECTION */
80404 e = 0;
80405 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->production_value);
80406 if (e) {
80407 log_packet_detailed("'production_value' field error detected");
80408 }
80409#ifdef FREECIV_JSON_CONNECTION
80410 field_addr.name = "city_options";
80411#endif /* FREECIV_JSON_CONNECTION */
80412 e = 0;
80413 e |= DIO_BV_PUT(&dout, &field_addr, packet->city_options);
80414 if (e) {
80415 log_packet_detailed("'city_options' field error detected");
80416 }
80417
80418#endif
80419 SEND_PACKET_END(PACKET_EDIT_CITY);
80420}
80421
80422 int send_packet_edit_city(struct connection *pc, const struct packet_edit_city *packet)
80423{
80424 if (!pc->used) {
80425 log_error("WARNING: trying to send data to the closed connection %s",
80426 conn_description(pc));
80427 return -1;
80428 }
80429 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_CITY].packet != NULL, -1,
80430 "Handler for PACKET_EDIT_CITY not installed");
80431 return pc->phs.handlers->send[PACKET_EDIT_CITY].packet(pc, packet);
80432}
80433
80434#ifdef FREECIV_DELTA_PROTOCOL
80435#define hash_packet_edit_player_create_100 hash_const
80436
80437#define cmp_packet_edit_player_create_100 cmp_const
80438
80439 BV_DEFINE(packet_edit_player_create_100_fields, 1);
80440#endif /* FREECIV_DELTA_PROTOCOL */
80441
80442 static struct packet_edit_player_create *receive_packet_edit_player_create_100(struct connection *pc)
80443{
80444#ifdef FREECIV_DELTA_PROTOCOL
80445 packet_edit_player_create_100_fields fields;
80446 struct packet_edit_player_create *old;
80447 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_CREATE;
80448#endif /* FREECIV_DELTA_PROTOCOL */
80449 RECEIVE_PACKET_START(packet_edit_player_create, real_packet);
80450#ifdef FREECIV_JSON_CONNECTION
80451 struct plocation field_addr;
80452 {
80453 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80454 field_addr = *field_addr_tmp;
80455 FC_FREE(field_addr_tmp);
80456 }
80457#endif /* FREECIV_JSON_CONNECTION */
80458
80459#ifdef FREECIV_DELTA_PROTOCOL
80460#ifdef FREECIV_JSON_CONNECTION
80461 field_addr.name = "fields";
80462#endif /* FREECIV_JSON_CONNECTION */
80463 DIO_BV_GET(&din, &field_addr, fields);
80464
80465#else /* FREECIV_DELTA_PROTOCOL */
80466#ifdef FREECIV_JSON_CONNECTION
80467 field_addr.name = "tag";
80468#endif /* FREECIV_JSON_CONNECTION */
80469 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
80470 RECEIVE_PACKET_FIELD_ERROR(tag);
80471 }
80472#endif
80473 log_packet_detailed("packet_edit_player_create_100: got info about ()");
80474
80475#ifdef FREECIV_DELTA_PROTOCOL
80476 if (NULL == *hash) {
80477 *hash = genhash_new_full(hash_packet_edit_player_create_100, cmp_packet_edit_player_create_100,
80478 NULL, NULL, NULL, free);
80479 }
80480
80481 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80482 *real_packet = *old;
80483 } else {
80484 log_packet_detailed(" no old info");
80485 memset(real_packet, 0, sizeof(*real_packet));
80486 }
80487
80488 if (BV_ISSET(fields, 0)) {
80489 log_packet_detailed(" got field 'tag'");
80490#ifdef FREECIV_JSON_CONNECTION
80491 field_addr.name = "tag";
80492#endif /* FREECIV_JSON_CONNECTION */
80493 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
80494 RECEIVE_PACKET_FIELD_ERROR(tag);
80495 }
80496 }
80497
80498 if (NULL == old) {
80499 old = fc_malloc(sizeof(*old));
80500 *old = *real_packet;
80501 genhash_insert(*hash, old, old);
80502 } else {
80503 *old = *real_packet;
80504 }
80505
80506#endif /* FREECIV_DELTA_PROTOCOL */
80507 RECEIVE_PACKET_END(real_packet);
80508}
80509
80510 static int send_packet_edit_player_create_100(struct connection *pc, const struct packet_edit_player_create *packet)
80511{
80512 const struct packet_edit_player_create *real_packet = packet;
80513 int e;
80514#ifdef FREECIV_DELTA_PROTOCOL
80515 packet_edit_player_create_100_fields fields;
80516 struct packet_edit_player_create *old;
80517 bool differ;
80518 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_CREATE;
80519#endif /* FREECIV_DELTA_PROTOCOL */
80520 SEND_PACKET_START(PACKET_EDIT_PLAYER_CREATE);
80521#ifdef FREECIV_JSON_CONNECTION
80522 struct plocation field_addr;
80523 {
80524 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80525 field_addr = *field_addr_tmp;
80526 FC_FREE(field_addr_tmp);
80527 }
80528#endif /* FREECIV_JSON_CONNECTION */
80529
80530 log_packet_detailed("packet_edit_player_create_100: sending info about ()");
80531
80532#ifdef FREECIV_DELTA_PROTOCOL
80533 if (NULL == *hash) {
80534 *hash = genhash_new_full(hash_packet_edit_player_create_100, cmp_packet_edit_player_create_100,
80535 NULL, NULL, NULL, free);
80536 }
80537 BV_CLR_ALL(fields);
80538
80539 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80540 old = fc_malloc(sizeof(*old));
80541 *old = *real_packet;
80542 genhash_insert(*hash, old, old);
80543 memset(old, 0, sizeof(*old));
80544 }
80545 differ = (old->tag != real_packet->tag);
80546 if (differ) {
80547 BV_SET(fields, 0);
80548 }
80549
80550
80551#ifdef FREECIV_JSON_CONNECTION
80552 field_addr.name = "fields";
80553#endif /* FREECIV_JSON_CONNECTION */
80554 e = 0;
80555 e |= DIO_BV_PUT(&dout, &field_addr, fields);
80556 if (e) {
80557 log_packet_detailed("fields bitvector error detected");
80558 }
80559
80560 if (BV_ISSET(fields, 0)) {
80561 log_packet_detailed(" field 'tag' has changed");
80562#ifdef FREECIV_JSON_CONNECTION
80563 field_addr.name = "tag";
80564#endif /* FREECIV_JSON_CONNECTION */
80565 e = 0;
80566 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
80567 if (e) {
80568 log_packet_detailed("'tag' field error detected");
80569 }
80570 }
80571
80572 *old = *real_packet;
80573#endif /* FREECIV_DELTA_PROTOCOL */
80574#ifndef FREECIV_DELTA_PROTOCOL
80575#ifdef FREECIV_JSON_CONNECTION
80576 field_addr.name = "tag";
80577#endif /* FREECIV_JSON_CONNECTION */
80578 e = 0;
80579 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
80580 if (e) {
80581 log_packet_detailed("'tag' field error detected");
80582 }
80583
80584#endif
80585 SEND_PACKET_END(PACKET_EDIT_PLAYER_CREATE);
80586}
80587
80588 int send_packet_edit_player_create(struct connection *pc, const struct packet_edit_player_create *packet)
80589{
80590 if (!pc->used) {
80591 log_error("WARNING: trying to send data to the closed connection %s",
80592 conn_description(pc));
80593 return -1;
80594 }
80595 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_CREATE].packet != NULL, -1,
80596 "Handler for PACKET_EDIT_PLAYER_CREATE not installed");
80597 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_CREATE].packet(pc, packet);
80598}
80599
80600 int dsend_packet_edit_player_create(struct connection *pc, int tag)
80601{
80602 struct packet_edit_player_create packet, *real_packet = &packet;
80603
80604 real_packet->tag = tag;
80605
80606 return send_packet_edit_player_create(pc, real_packet);
80607}
80608
80609#ifdef FREECIV_DELTA_PROTOCOL
80610#define hash_packet_edit_player_remove_100 hash_const
80611
80612#define cmp_packet_edit_player_remove_100 cmp_const
80613
80614 BV_DEFINE(packet_edit_player_remove_100_fields, 1);
80615#endif /* FREECIV_DELTA_PROTOCOL */
80616
80617 static struct packet_edit_player_remove *receive_packet_edit_player_remove_100(struct connection *pc)
80618{
80619#ifdef FREECIV_DELTA_PROTOCOL
80620 packet_edit_player_remove_100_fields fields;
80621 struct packet_edit_player_remove *old;
80622 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_REMOVE;
80623#endif /* FREECIV_DELTA_PROTOCOL */
80624 RECEIVE_PACKET_START(packet_edit_player_remove, real_packet);
80625#ifdef FREECIV_JSON_CONNECTION
80626 struct plocation field_addr;
80627 {
80628 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80629 field_addr = *field_addr_tmp;
80630 FC_FREE(field_addr_tmp);
80631 }
80632#endif /* FREECIV_JSON_CONNECTION */
80633
80634#ifdef FREECIV_DELTA_PROTOCOL
80635#ifdef FREECIV_JSON_CONNECTION
80636 field_addr.name = "fields";
80637#endif /* FREECIV_JSON_CONNECTION */
80638 DIO_BV_GET(&din, &field_addr, fields);
80639
80640#else /* FREECIV_DELTA_PROTOCOL */
80641#ifdef FREECIV_JSON_CONNECTION
80642 field_addr.name = "id";
80643#endif /* FREECIV_JSON_CONNECTION */
80644 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80645 RECEIVE_PACKET_FIELD_ERROR(id);
80646 }
80647#endif
80648 log_packet_detailed("packet_edit_player_remove_100: got info about ()");
80649
80650#ifdef FREECIV_DELTA_PROTOCOL
80651 if (NULL == *hash) {
80652 *hash = genhash_new_full(hash_packet_edit_player_remove_100, cmp_packet_edit_player_remove_100,
80653 NULL, NULL, NULL, free);
80654 }
80655
80656 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
80657 *real_packet = *old;
80658 } else {
80659 log_packet_detailed(" no old info");
80660 memset(real_packet, 0, sizeof(*real_packet));
80661 }
80662
80663 if (BV_ISSET(fields, 0)) {
80664 log_packet_detailed(" got field 'id'");
80665#ifdef FREECIV_JSON_CONNECTION
80666 field_addr.name = "id";
80667#endif /* FREECIV_JSON_CONNECTION */
80668 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80669 RECEIVE_PACKET_FIELD_ERROR(id);
80670 }
80671 }
80672
80673 if (NULL == old) {
80674 old = fc_malloc(sizeof(*old));
80675 *old = *real_packet;
80676 genhash_insert(*hash, old, old);
80677 } else {
80678 *old = *real_packet;
80679 }
80680
80681#endif /* FREECIV_DELTA_PROTOCOL */
80682 RECEIVE_PACKET_END(real_packet);
80683}
80684
80685 static int send_packet_edit_player_remove_100(struct connection *pc, const struct packet_edit_player_remove *packet)
80686{
80687 const struct packet_edit_player_remove *real_packet = packet;
80688 int e;
80689#ifdef FREECIV_DELTA_PROTOCOL
80690 packet_edit_player_remove_100_fields fields;
80691 struct packet_edit_player_remove *old;
80692 bool differ;
80693 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_REMOVE;
80694#endif /* FREECIV_DELTA_PROTOCOL */
80695 SEND_PACKET_START(PACKET_EDIT_PLAYER_REMOVE);
80696#ifdef FREECIV_JSON_CONNECTION
80697 struct plocation field_addr;
80698 {
80699 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80700 field_addr = *field_addr_tmp;
80701 FC_FREE(field_addr_tmp);
80702 }
80703#endif /* FREECIV_JSON_CONNECTION */
80704
80705 log_packet_detailed("packet_edit_player_remove_100: sending info about ()");
80706
80707#ifdef FREECIV_DELTA_PROTOCOL
80708 if (NULL == *hash) {
80709 *hash = genhash_new_full(hash_packet_edit_player_remove_100, cmp_packet_edit_player_remove_100,
80710 NULL, NULL, NULL, free);
80711 }
80712 BV_CLR_ALL(fields);
80713
80714 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
80715 old = fc_malloc(sizeof(*old));
80716 *old = *real_packet;
80717 genhash_insert(*hash, old, old);
80718 memset(old, 0, sizeof(*old));
80719 }
80720 differ = (old->id != real_packet->id);
80721 if (differ) {
80722 BV_SET(fields, 0);
80723 }
80724
80725
80726#ifdef FREECIV_JSON_CONNECTION
80727 field_addr.name = "fields";
80728#endif /* FREECIV_JSON_CONNECTION */
80729 e = 0;
80730 e |= DIO_BV_PUT(&dout, &field_addr, fields);
80731 if (e) {
80732 log_packet_detailed("fields bitvector error detected");
80733 }
80734
80735 if (BV_ISSET(fields, 0)) {
80736 log_packet_detailed(" field 'id' has changed");
80737#ifdef FREECIV_JSON_CONNECTION
80738 field_addr.name = "id";
80739#endif /* FREECIV_JSON_CONNECTION */
80740 e = 0;
80741 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80742 if (e) {
80743 log_packet_detailed("'id' field error detected");
80744 }
80745 }
80746
80747 *old = *real_packet;
80748#endif /* FREECIV_DELTA_PROTOCOL */
80749#ifndef FREECIV_DELTA_PROTOCOL
80750#ifdef FREECIV_JSON_CONNECTION
80751 field_addr.name = "id";
80752#endif /* FREECIV_JSON_CONNECTION */
80753 e = 0;
80754 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
80755 if (e) {
80756 log_packet_detailed("'id' field error detected");
80757 }
80758
80759#endif
80760 SEND_PACKET_END(PACKET_EDIT_PLAYER_REMOVE);
80761}
80762
80763 int send_packet_edit_player_remove(struct connection *pc, const struct packet_edit_player_remove *packet)
80764{
80765 if (!pc->used) {
80766 log_error("WARNING: trying to send data to the closed connection %s",
80767 conn_description(pc));
80768 return -1;
80769 }
80770 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_REMOVE].packet != NULL, -1,
80771 "Handler for PACKET_EDIT_PLAYER_REMOVE not installed");
80772 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_REMOVE].packet(pc, packet);
80773}
80774
80775 int dsend_packet_edit_player_remove(struct connection *pc, int id)
80776{
80777 struct packet_edit_player_remove packet, *real_packet = &packet;
80778
80779 real_packet->id = id;
80780
80781 return send_packet_edit_player_remove(pc, real_packet);
80782}
80783
80784#ifdef FREECIV_DELTA_PROTOCOL
80785static genhash_val_t hash_packet_edit_player_100(const void *vkey)
80786{
80787 const struct packet_edit_player *key = (const struct packet_edit_player *) vkey;
80788 genhash_val_t result = 0;
80789
80790 result += key->id;
80791
80792 result &= 0xFFFFFFFF;
80793 return result;
80794}
80795
80796static bool cmp_packet_edit_player_100(const void *vkey1, const void *vkey2)
80797{
80798 const struct packet_edit_player *old = (const struct packet_edit_player *) vkey1;
80799 const struct packet_edit_player *real_packet = (const struct packet_edit_player *) vkey2;
80800 bool differ;
80801
80802 differ = (old->id != real_packet->id);
80803
80804 return !differ;
80805}
80806 BV_DEFINE(packet_edit_player_100_fields, 25);
80807#endif /* FREECIV_DELTA_PROTOCOL */
80808
80809 static struct packet_edit_player *receive_packet_edit_player_100(struct connection *pc)
80810{
80811#ifdef FREECIV_DELTA_PROTOCOL
80812 packet_edit_player_100_fields fields;
80813 struct packet_edit_player *old;
80814 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER;
80815#endif /* FREECIV_DELTA_PROTOCOL */
80816 RECEIVE_PACKET_START(packet_edit_player, real_packet);
80817#ifdef FREECIV_JSON_CONNECTION
80818 struct plocation field_addr;
80819 {
80820 struct plocation *field_addr_tmp = plocation_field_new(NULL);
80821 field_addr = *field_addr_tmp;
80822 FC_FREE(field_addr_tmp);
80823 }
80824#endif /* FREECIV_JSON_CONNECTION */
80825
80826#ifdef FREECIV_DELTA_PROTOCOL
80827#ifdef FREECIV_JSON_CONNECTION
80828 field_addr.name = "fields";
80829#endif /* FREECIV_JSON_CONNECTION */
80830 DIO_BV_GET(&din, &field_addr, fields);
80831#ifdef FREECIV_JSON_CONNECTION
80832 field_addr.name = "id";
80833#endif /* FREECIV_JSON_CONNECTION */
80834 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80835 RECEIVE_PACKET_FIELD_ERROR(id);
80836 }
80837
80838#else /* FREECIV_DELTA_PROTOCOL */
80839#ifdef FREECIV_JSON_CONNECTION
80840 field_addr.name = "id";
80841#endif /* FREECIV_JSON_CONNECTION */
80842 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->id)) {
80843 RECEIVE_PACKET_FIELD_ERROR(id);
80844 }
80845#ifdef FREECIV_JSON_CONNECTION
80846 field_addr.name = "name";
80847#endif /* FREECIV_JSON_CONNECTION */
80848 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
80849 RECEIVE_PACKET_FIELD_ERROR(name);
80850 }
80851#ifdef FREECIV_JSON_CONNECTION
80852 field_addr.name = "username";
80853#endif /* FREECIV_JSON_CONNECTION */
80854 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
80855 RECEIVE_PACKET_FIELD_ERROR(username);
80856 }
80857#ifdef FREECIV_JSON_CONNECTION
80858 field_addr.name = "ranked_username";
80859#endif /* FREECIV_JSON_CONNECTION */
80860 if (!DIO_GET(string, &din, &field_addr, real_packet->ranked_username, sizeof(real_packet->ranked_username))) {
80861 RECEIVE_PACKET_FIELD_ERROR(ranked_username);
80862 }
80863#ifdef FREECIV_JSON_CONNECTION
80864 field_addr.name = "user_turns";
80865#endif /* FREECIV_JSON_CONNECTION */
80866 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->user_turns)) {
80867 RECEIVE_PACKET_FIELD_ERROR(user_turns);
80868 }
80869#ifdef FREECIV_JSON_CONNECTION
80870 field_addr.name = "is_male";
80871#endif /* FREECIV_JSON_CONNECTION */
80872 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_male)) {
80873 RECEIVE_PACKET_FIELD_ERROR(is_male);
80874 }
80875#ifdef FREECIV_JSON_CONNECTION
80876 field_addr.name = "government";
80877#endif /* FREECIV_JSON_CONNECTION */
80878 {
80879 int readin;
80880
80881 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
80882 RECEIVE_PACKET_FIELD_ERROR(government);
80883 }
80884 real_packet->government = readin;
80885 }
80886#ifdef FREECIV_JSON_CONNECTION
80887 field_addr.name = "target_government";
80888#endif /* FREECIV_JSON_CONNECTION */
80889 {
80890 int readin;
80891
80892 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
80893 RECEIVE_PACKET_FIELD_ERROR(target_government);
80894 }
80895 real_packet->target_government = readin;
80896 }
80897#ifdef FREECIV_JSON_CONNECTION
80898 field_addr.name = "nation";
80899#endif /* FREECIV_JSON_CONNECTION */
80900 {
80901 int readin;
80902
80903 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
80904 RECEIVE_PACKET_FIELD_ERROR(nation);
80905 }
80906 real_packet->nation = readin;
80907 }
80908#ifdef FREECIV_JSON_CONNECTION
80909 field_addr.name = "team";
80910#endif /* FREECIV_JSON_CONNECTION */
80911 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
80912 RECEIVE_PACKET_FIELD_ERROR(team);
80913 }
80914#ifdef FREECIV_JSON_CONNECTION
80915 field_addr.name = "phase_done";
80916#endif /* FREECIV_JSON_CONNECTION */
80917 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->phase_done)) {
80918 RECEIVE_PACKET_FIELD_ERROR(phase_done);
80919 }
80920#ifdef FREECIV_JSON_CONNECTION
80921 field_addr.name = "nturns_idle";
80922#endif /* FREECIV_JSON_CONNECTION */
80923 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
80924 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
80925 }
80926#ifdef FREECIV_JSON_CONNECTION
80927 field_addr.name = "is_alive";
80928#endif /* FREECIV_JSON_CONNECTION */
80929 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->is_alive)) {
80930 RECEIVE_PACKET_FIELD_ERROR(is_alive);
80931 }
80932#ifdef FREECIV_JSON_CONNECTION
80933 field_addr.name = "revolution_finishes";
80934#endif /* FREECIV_JSON_CONNECTION */
80935 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
80936 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
80937 }
80938#ifdef FREECIV_JSON_CONNECTION
80939 field_addr.name = "autoselect_weight";
80940#endif /* FREECIV_JSON_CONNECTION */
80941 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
80942 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
80943 }
80944#ifdef FREECIV_JSON_CONNECTION
80945 field_addr.name = "embassy";
80946#endif /* FREECIV_JSON_CONNECTION */
80947 if (!DIO_BV_GET(&din, &field_addr, real_packet->embassy)) {
80948 RECEIVE_PACKET_FIELD_ERROR(embassy);
80949 }
80950#ifdef FREECIV_JSON_CONNECTION
80951 field_addr.name = "gold";
80952#endif /* FREECIV_JSON_CONNECTION */
80953 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
80954 RECEIVE_PACKET_FIELD_ERROR(gold);
80955 }
80956#ifdef FREECIV_JSON_CONNECTION
80957 field_addr.name = "tax";
80958#endif /* FREECIV_JSON_CONNECTION */
80959 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
80960 RECEIVE_PACKET_FIELD_ERROR(tax);
80961 }
80962#ifdef FREECIV_JSON_CONNECTION
80963 field_addr.name = "science";
80964#endif /* FREECIV_JSON_CONNECTION */
80965 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
80966 RECEIVE_PACKET_FIELD_ERROR(science);
80967 }
80968#ifdef FREECIV_JSON_CONNECTION
80969 field_addr.name = "luxury";
80970#endif /* FREECIV_JSON_CONNECTION */
80971 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
80972 RECEIVE_PACKET_FIELD_ERROR(luxury);
80973 }
80974#ifdef FREECIV_JSON_CONNECTION
80975 field_addr.name = "future_tech";
80976#endif /* FREECIV_JSON_CONNECTION */
80977 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
80978 RECEIVE_PACKET_FIELD_ERROR(future_tech);
80979 }
80980#ifdef FREECIV_JSON_CONNECTION
80981 field_addr.name = "researching";
80982#endif /* FREECIV_JSON_CONNECTION */
80983 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
80984 RECEIVE_PACKET_FIELD_ERROR(researching);
80985 }
80986#ifdef FREECIV_JSON_CONNECTION
80987 field_addr.name = "bulbs_researched";
80988#endif /* FREECIV_JSON_CONNECTION */
80989 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
80990 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
80991 }
80992#ifdef FREECIV_JSON_CONNECTION
80993 field_addr.name = "inventions";
80994#endif /* FREECIV_JSON_CONNECTION */
80995 {
80996 int i;
80997
80998#ifdef FREECIV_JSON_CONNECTION
80999 /* Enter array. */
81000 field_addr.sub_location = plocation_elem_new(0);
81001#endif /* FREECIV_JSON_CONNECTION */
81002
81003 for (i = 0; i < A_LAST + 1; i++) {
81004#ifdef FREECIV_JSON_CONNECTION
81005 field_addr.sub_location->number = i;
81006#endif /* FREECIV_JSON_CONNECTION */
81007 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->inventions[i])) {
81008 RECEIVE_PACKET_FIELD_ERROR(inventions);
81009 }
81010 }
81011
81012#ifdef FREECIV_JSON_CONNECTION
81013 /* Exit array. */
81014 FC_FREE(field_addr.sub_location);
81015#endif /* FREECIV_JSON_CONNECTION */
81016 }
81017#ifdef FREECIV_JSON_CONNECTION
81018 field_addr.name = "ai";
81019#endif /* FREECIV_JSON_CONNECTION */
81020 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ai)) {
81021 RECEIVE_PACKET_FIELD_ERROR(ai);
81022 }
81023#ifdef FREECIV_JSON_CONNECTION
81024 field_addr.name = "scenario_reserved";
81025#endif /* FREECIV_JSON_CONNECTION */
81026 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_reserved)) {
81027 RECEIVE_PACKET_FIELD_ERROR(scenario_reserved);
81028 }
81029#endif
81030 log_packet_detailed("packet_edit_player_100: got info about (%d)",
81031 real_packet->id);
81032
81033#ifdef FREECIV_DELTA_PROTOCOL
81034 if (NULL == *hash) {
81035 *hash = genhash_new_full(hash_packet_edit_player_100, cmp_packet_edit_player_100,
81036 NULL, NULL, NULL, free);
81037 }
81038
81039 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
81040 *real_packet = *old;
81041 } else {
81042 int id;
81043
81044 id = real_packet->id;
81045
81046 log_packet_detailed(" no old info");
81047 memset(real_packet, 0, sizeof(*real_packet));
81048
81049 real_packet->id = id;
81050 }
81051
81052 if (BV_ISSET(fields, 0)) {
81053 log_packet_detailed(" got field 'name'");
81054#ifdef FREECIV_JSON_CONNECTION
81055 field_addr.name = "name";
81056#endif /* FREECIV_JSON_CONNECTION */
81057 if (!DIO_GET(string, &din, &field_addr, real_packet->name, sizeof(real_packet->name))) {
81058 RECEIVE_PACKET_FIELD_ERROR(name);
81059 }
81060 }
81061 if (BV_ISSET(fields, 1)) {
81062 log_packet_detailed(" got field 'username'");
81063#ifdef FREECIV_JSON_CONNECTION
81064 field_addr.name = "username";
81065#endif /* FREECIV_JSON_CONNECTION */
81066 if (!DIO_GET(string, &din, &field_addr, real_packet->username, sizeof(real_packet->username))) {
81067 RECEIVE_PACKET_FIELD_ERROR(username);
81068 }
81069 }
81070 if (BV_ISSET(fields, 2)) {
81071 log_packet_detailed(" got field 'ranked_username'");
81072#ifdef FREECIV_JSON_CONNECTION
81073 field_addr.name = "ranked_username";
81074#endif /* FREECIV_JSON_CONNECTION */
81075 if (!DIO_GET(string, &din, &field_addr, real_packet->ranked_username, sizeof(real_packet->ranked_username))) {
81076 RECEIVE_PACKET_FIELD_ERROR(ranked_username);
81077 }
81078 }
81079 if (BV_ISSET(fields, 3)) {
81080 log_packet_detailed(" got field 'user_turns'");
81081#ifdef FREECIV_JSON_CONNECTION
81082 field_addr.name = "user_turns";
81083#endif /* FREECIV_JSON_CONNECTION */
81084 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->user_turns)) {
81085 RECEIVE_PACKET_FIELD_ERROR(user_turns);
81086 }
81087 }
81088 real_packet->is_male = BV_ISSET(fields, 4);
81089 if (BV_ISSET(fields, 5)) {
81090 log_packet_detailed(" got field 'government'");
81091#ifdef FREECIV_JSON_CONNECTION
81092 field_addr.name = "government";
81093#endif /* FREECIV_JSON_CONNECTION */
81094 {
81095 int readin;
81096
81097 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
81098 RECEIVE_PACKET_FIELD_ERROR(government);
81099 }
81100 real_packet->government = readin;
81101 }
81102 }
81103 if (BV_ISSET(fields, 6)) {
81104 log_packet_detailed(" got field 'target_government'");
81105#ifdef FREECIV_JSON_CONNECTION
81106 field_addr.name = "target_government";
81107#endif /* FREECIV_JSON_CONNECTION */
81108 {
81109 int readin;
81110
81111 if (!DIO_GET(sint8, &din, &field_addr, &readin)) {
81112 RECEIVE_PACKET_FIELD_ERROR(target_government);
81113 }
81114 real_packet->target_government = readin;
81115 }
81116 }
81117 if (BV_ISSET(fields, 7)) {
81118 log_packet_detailed(" got field 'nation'");
81119#ifdef FREECIV_JSON_CONNECTION
81120 field_addr.name = "nation";
81121#endif /* FREECIV_JSON_CONNECTION */
81122 {
81123 int readin;
81124
81125 if (!DIO_GET(sint16, &din, &field_addr, &readin)) {
81126 RECEIVE_PACKET_FIELD_ERROR(nation);
81127 }
81128 real_packet->nation = readin;
81129 }
81130 }
81131 if (BV_ISSET(fields, 8)) {
81132 log_packet_detailed(" got field 'team'");
81133#ifdef FREECIV_JSON_CONNECTION
81134 field_addr.name = "team";
81135#endif /* FREECIV_JSON_CONNECTION */
81136 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->team)) {
81137 RECEIVE_PACKET_FIELD_ERROR(team);
81138 }
81139 }
81140 real_packet->phase_done = BV_ISSET(fields, 9);
81141 if (BV_ISSET(fields, 10)) {
81142 log_packet_detailed(" got field 'nturns_idle'");
81143#ifdef FREECIV_JSON_CONNECTION
81144 field_addr.name = "nturns_idle";
81145#endif /* FREECIV_JSON_CONNECTION */
81146 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->nturns_idle)) {
81147 RECEIVE_PACKET_FIELD_ERROR(nturns_idle);
81148 }
81149 }
81150 real_packet->is_alive = BV_ISSET(fields, 11);
81151 if (BV_ISSET(fields, 12)) {
81152 log_packet_detailed(" got field 'revolution_finishes'");
81153#ifdef FREECIV_JSON_CONNECTION
81154 field_addr.name = "revolution_finishes";
81155#endif /* FREECIV_JSON_CONNECTION */
81156 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->revolution_finishes)) {
81157 RECEIVE_PACKET_FIELD_ERROR(revolution_finishes);
81158 }
81159 }
81160 if (BV_ISSET(fields, 13)) {
81161 log_packet_detailed(" got field 'autoselect_weight'");
81162#ifdef FREECIV_JSON_CONNECTION
81163 field_addr.name = "autoselect_weight";
81164#endif /* FREECIV_JSON_CONNECTION */
81165 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->autoselect_weight)) {
81166 RECEIVE_PACKET_FIELD_ERROR(autoselect_weight);
81167 }
81168 }
81169 if (BV_ISSET(fields, 14)) {
81170 log_packet_detailed(" got field 'embassy'");
81171#ifdef FREECIV_JSON_CONNECTION
81172 field_addr.name = "embassy";
81173#endif /* FREECIV_JSON_CONNECTION */
81174 if (!DIO_BV_GET(&din, &field_addr, real_packet->embassy)) {
81175 RECEIVE_PACKET_FIELD_ERROR(embassy);
81176 }
81177 }
81178 if (BV_ISSET(fields, 15)) {
81179 log_packet_detailed(" got field 'gold'");
81180#ifdef FREECIV_JSON_CONNECTION
81181 field_addr.name = "gold";
81182#endif /* FREECIV_JSON_CONNECTION */
81183 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->gold)) {
81184 RECEIVE_PACKET_FIELD_ERROR(gold);
81185 }
81186 }
81187 if (BV_ISSET(fields, 16)) {
81188 log_packet_detailed(" got field 'tax'");
81189#ifdef FREECIV_JSON_CONNECTION
81190 field_addr.name = "tax";
81191#endif /* FREECIV_JSON_CONNECTION */
81192 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->tax)) {
81193 RECEIVE_PACKET_FIELD_ERROR(tax);
81194 }
81195 }
81196 if (BV_ISSET(fields, 17)) {
81197 log_packet_detailed(" got field 'science'");
81198#ifdef FREECIV_JSON_CONNECTION
81199 field_addr.name = "science";
81200#endif /* FREECIV_JSON_CONNECTION */
81201 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->science)) {
81202 RECEIVE_PACKET_FIELD_ERROR(science);
81203 }
81204 }
81205 if (BV_ISSET(fields, 18)) {
81206 log_packet_detailed(" got field 'luxury'");
81207#ifdef FREECIV_JSON_CONNECTION
81208 field_addr.name = "luxury";
81209#endif /* FREECIV_JSON_CONNECTION */
81210 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->luxury)) {
81211 RECEIVE_PACKET_FIELD_ERROR(luxury);
81212 }
81213 }
81214 if (BV_ISSET(fields, 19)) {
81215 log_packet_detailed(" got field 'future_tech'");
81216#ifdef FREECIV_JSON_CONNECTION
81217 field_addr.name = "future_tech";
81218#endif /* FREECIV_JSON_CONNECTION */
81219 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->future_tech)) {
81220 RECEIVE_PACKET_FIELD_ERROR(future_tech);
81221 }
81222 }
81223 if (BV_ISSET(fields, 20)) {
81224 log_packet_detailed(" got field 'researching'");
81225#ifdef FREECIV_JSON_CONNECTION
81226 field_addr.name = "researching";
81227#endif /* FREECIV_JSON_CONNECTION */
81228 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->researching)) {
81229 RECEIVE_PACKET_FIELD_ERROR(researching);
81230 }
81231 }
81232 if (BV_ISSET(fields, 21)) {
81233 log_packet_detailed(" got field 'bulbs_researched'");
81234#ifdef FREECIV_JSON_CONNECTION
81235 field_addr.name = "bulbs_researched";
81236#endif /* FREECIV_JSON_CONNECTION */
81237 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->bulbs_researched)) {
81238 RECEIVE_PACKET_FIELD_ERROR(bulbs_researched);
81239 }
81240 }
81241 if (BV_ISSET(fields, 22)) {
81242 log_packet_detailed(" got field 'inventions'");
81243#ifdef FREECIV_JSON_CONNECTION
81244 field_addr.name = "inventions";
81245#endif /* FREECIV_JSON_CONNECTION */
81246 {
81247#ifdef FREECIV_JSON_CONNECTION
81248 int count;
81249
81250 /* Enter array. */
81251 field_addr.sub_location = plocation_elem_new(0);
81252
81253 for (count = 0;; count++) {
81254 int i;
81255
81256 field_addr.sub_location->number = count;
81257
81258 /* Enter diff array element (start at the index address). */
81259 field_addr.sub_location->sub_location = plocation_elem_new(0);
81260#else /* FREECIV_JSON_CONNECTION */
81261 while (TRUE) {
81262 int i;
81263#endif /* FREECIV_JSON_CONNECTION */
81264
81265 if (!DIO_GET(uint16, &din, &field_addr, &i)) {
81266 RECEIVE_PACKET_FIELD_ERROR(inventions);
81267 }
81268 if (i == MAX_UINT16) {
81269#ifdef FREECIV_JSON_CONNECTION
81270 /* Exit diff array element. */
81271 FC_FREE(field_addr.sub_location->sub_location);
81272
81273 /* Exit diff array. */
81274 FC_FREE(field_addr.sub_location);
81275#endif /* FREECIV_JSON_CONNECTION */
81276
81277 break;
81278 }
81279 if (i > A_LAST + 1) {
81280 RECEIVE_PACKET_FIELD_ERROR(inventions,
81281 ": unexpected value %d "
81282 "(> A_LAST + 1) in array diff",
81283 i);
81284 } else {
81285#ifdef FREECIV_JSON_CONNECTION
81286 /* Content address. */
81287 field_addr.sub_location->sub_location->number = 1;
81288#endif /* FREECIV_JSON_CONNECTION */
81289 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->inventions[i])) {
81290 RECEIVE_PACKET_FIELD_ERROR(inventions);
81291 }
81292 }
81293
81294#ifdef FREECIV_JSON_CONNECTION
81295 /* Exit diff array element. */
81296 FC_FREE(field_addr.sub_location->sub_location);
81297#endif /* FREECIV_JSON_CONNECTION */
81298 }
81299
81300#ifdef FREECIV_JSON_CONNECTION
81301 /* Exit array. */
81302 FC_FREE(field_addr.sub_location);
81303#endif /* FREECIV_JSON_CONNECTION */
81304 }
81305 }
81306 real_packet->ai = BV_ISSET(fields, 23);
81307 real_packet->scenario_reserved = BV_ISSET(fields, 24);
81308
81309 if (NULL == old) {
81310 old = fc_malloc(sizeof(*old));
81311 *old = *real_packet;
81312 genhash_insert(*hash, old, old);
81313 } else {
81314 *old = *real_packet;
81315 }
81316
81317#endif /* FREECIV_DELTA_PROTOCOL */
81318 RECEIVE_PACKET_END(real_packet);
81319}
81320
81321 static int send_packet_edit_player_100(struct connection *pc, const struct packet_edit_player *packet)
81322{
81323 const struct packet_edit_player *real_packet = packet;
81324 int e;
81325#ifdef FREECIV_DELTA_PROTOCOL
81326 packet_edit_player_100_fields fields;
81327 struct packet_edit_player *old;
81328 bool differ;
81329 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER;
81330#endif /* FREECIV_DELTA_PROTOCOL */
81331 SEND_PACKET_START(PACKET_EDIT_PLAYER);
81332#ifdef FREECIV_JSON_CONNECTION
81333 struct plocation field_addr;
81334 {
81335 struct plocation *field_addr_tmp = plocation_field_new(NULL);
81336 field_addr = *field_addr_tmp;
81337 FC_FREE(field_addr_tmp);
81338 }
81339#endif /* FREECIV_JSON_CONNECTION */
81340
81341 log_packet_detailed("packet_edit_player_100: sending info about (%d)",
81342 real_packet->id);
81343
81344#ifdef FREECIV_DELTA_PROTOCOL
81345 if (NULL == *hash) {
81346 *hash = genhash_new_full(hash_packet_edit_player_100, cmp_packet_edit_player_100,
81347 NULL, NULL, NULL, free);
81348 }
81349 BV_CLR_ALL(fields);
81350
81351 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
81352 old = fc_malloc(sizeof(*old));
81353 *old = *real_packet;
81354 genhash_insert(*hash, old, old);
81355 memset(old, 0, sizeof(*old));
81356 }
81357 differ = (strcmp(old->name, real_packet->name) != 0);
81358 if (differ) {
81359 BV_SET(fields, 0);
81360 }
81361
81362 differ = (strcmp(old->username, real_packet->username) != 0);
81363 if (differ) {
81364 BV_SET(fields, 1);
81365 }
81366
81367 differ = (strcmp(old->ranked_username, real_packet->ranked_username) != 0);
81368 if (differ) {
81369 BV_SET(fields, 2);
81370 }
81371
81372 differ = (old->user_turns != real_packet->user_turns);
81373 if (differ) {
81374 BV_SET(fields, 3);
81375 }
81376
81377 if (packet->is_male) {
81378 BV_SET(fields, 4);
81379 }
81380
81381 differ = (old->government != real_packet->government);
81382 if (differ) {
81383 BV_SET(fields, 5);
81384 }
81385
81386 differ = (old->target_government != real_packet->target_government);
81387 if (differ) {
81388 BV_SET(fields, 6);
81389 }
81390
81391 differ = (old->nation != real_packet->nation);
81392 if (differ) {
81393 BV_SET(fields, 7);
81394 }
81395
81396 differ = (old->team != real_packet->team);
81397 if (differ) {
81398 BV_SET(fields, 8);
81399 }
81400
81401 if (packet->phase_done) {
81402 BV_SET(fields, 9);
81403 }
81404
81405 differ = (old->nturns_idle != real_packet->nturns_idle);
81406 if (differ) {
81407 BV_SET(fields, 10);
81408 }
81409
81410 if (packet->is_alive) {
81411 BV_SET(fields, 11);
81412 }
81413
81414 differ = (old->revolution_finishes != real_packet->revolution_finishes);
81415 if (differ) {
81416 BV_SET(fields, 12);
81417 }
81418
81419 differ = (old->autoselect_weight != real_packet->autoselect_weight);
81420 if (differ) {
81421 BV_SET(fields, 13);
81422 }
81423
81424 differ = !BV_ARE_EQUAL(old->embassy, real_packet->embassy);
81425 if (differ) {
81426 BV_SET(fields, 14);
81427 }
81428
81429 differ = (old->gold != real_packet->gold);
81430 if (differ) {
81431 BV_SET(fields, 15);
81432 }
81433
81434 differ = (old->tax != real_packet->tax);
81435 if (differ) {
81436 BV_SET(fields, 16);
81437 }
81438
81439 differ = (old->science != real_packet->science);
81440 if (differ) {
81441 BV_SET(fields, 17);
81442 }
81443
81444 differ = (old->luxury != real_packet->luxury);
81445 if (differ) {
81446 BV_SET(fields, 18);
81447 }
81448
81449 differ = (old->future_tech != real_packet->future_tech);
81450 if (differ) {
81451 BV_SET(fields, 19);
81452 }
81453
81454 differ = (old->researching != real_packet->researching);
81455 if (differ) {
81456 BV_SET(fields, 20);
81457 }
81458
81459 differ = (old->bulbs_researched != real_packet->bulbs_researched);
81460 if (differ) {
81461 BV_SET(fields, 21);
81462 }
81463
81464 differ = FALSE;
81465 {
81466 int i;
81467
81468 for (i = 0; i < A_LAST + 1; i++) {
81469 differ = (old->inventions[i] != real_packet->inventions[i]);
81470 if (differ) {
81471 break;
81472 }
81473 }
81474 }
81475 if (differ) {
81476 BV_SET(fields, 22);
81477 }
81478
81479 if (packet->ai) {
81480 BV_SET(fields, 23);
81481 }
81482
81483 if (packet->scenario_reserved) {
81484 BV_SET(fields, 24);
81485 }
81486
81487
81488#ifdef FREECIV_JSON_CONNECTION
81489 field_addr.name = "fields";
81490#endif /* FREECIV_JSON_CONNECTION */
81491 e = 0;
81492 e |= DIO_BV_PUT(&dout, &field_addr, fields);
81493 if (e) {
81494 log_packet_detailed("fields bitvector error detected");
81495 }
81496#ifdef FREECIV_JSON_CONNECTION
81497 field_addr.name = "id";
81498#endif /* FREECIV_JSON_CONNECTION */
81499 e = 0;
81500 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
81501 if (e) {
81502 log_packet_detailed("'id' field error detected");
81503 }
81504
81505 if (BV_ISSET(fields, 0)) {
81506 log_packet_detailed(" field 'name' has changed");
81507#ifdef FREECIV_JSON_CONNECTION
81508 field_addr.name = "name";
81509#endif /* FREECIV_JSON_CONNECTION */
81510 e = 0;
81511 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
81512 if (e) {
81513 log_packet_detailed("'name' field error detected");
81514 }
81515 }
81516 if (BV_ISSET(fields, 1)) {
81517 log_packet_detailed(" field 'username' has changed");
81518#ifdef FREECIV_JSON_CONNECTION
81519 field_addr.name = "username";
81520#endif /* FREECIV_JSON_CONNECTION */
81521 e = 0;
81522 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
81523 if (e) {
81524 log_packet_detailed("'username' field error detected");
81525 }
81526 }
81527 if (BV_ISSET(fields, 2)) {
81528 log_packet_detailed(" field 'ranked_username' has changed");
81529#ifdef FREECIV_JSON_CONNECTION
81530 field_addr.name = "ranked_username";
81531#endif /* FREECIV_JSON_CONNECTION */
81532 e = 0;
81533 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ranked_username);
81534 if (e) {
81535 log_packet_detailed("'ranked_username' field error detected");
81536 }
81537 }
81538 if (BV_ISSET(fields, 3)) {
81539 log_packet_detailed(" field 'user_turns' has changed");
81540#ifdef FREECIV_JSON_CONNECTION
81541 field_addr.name = "user_turns";
81542#endif /* FREECIV_JSON_CONNECTION */
81543 e = 0;
81544 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->user_turns);
81545 if (e) {
81546 log_packet_detailed("'user_turns' field error detected");
81547 }
81548 }
81549 /* field 4 is folded into the header */
81550 if (BV_ISSET(fields, 5)) {
81551 log_packet_detailed(" field 'government' has changed");
81552#ifdef FREECIV_JSON_CONNECTION
81553 field_addr.name = "government";
81554#endif /* FREECIV_JSON_CONNECTION */
81555 e = 0;
81556 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
81557 if (e) {
81558 log_packet_detailed("'government' field error detected");
81559 }
81560 }
81561 if (BV_ISSET(fields, 6)) {
81562 log_packet_detailed(" field 'target_government' has changed");
81563#ifdef FREECIV_JSON_CONNECTION
81564 field_addr.name = "target_government";
81565#endif /* FREECIV_JSON_CONNECTION */
81566 e = 0;
81567 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
81568 if (e) {
81569 log_packet_detailed("'target_government' field error detected");
81570 }
81571 }
81572 if (BV_ISSET(fields, 7)) {
81573 log_packet_detailed(" field 'nation' has changed");
81574#ifdef FREECIV_JSON_CONNECTION
81575 field_addr.name = "nation";
81576#endif /* FREECIV_JSON_CONNECTION */
81577 e = 0;
81578 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
81579 if (e) {
81580 log_packet_detailed("'nation' field error detected");
81581 }
81582 }
81583 if (BV_ISSET(fields, 8)) {
81584 log_packet_detailed(" field 'team' has changed");
81585#ifdef FREECIV_JSON_CONNECTION
81586 field_addr.name = "team";
81587#endif /* FREECIV_JSON_CONNECTION */
81588 e = 0;
81589 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
81590 if (e) {
81591 log_packet_detailed("'team' field error detected");
81592 }
81593 }
81594 /* field 9 is folded into the header */
81595 if (BV_ISSET(fields, 10)) {
81596 log_packet_detailed(" field 'nturns_idle' has changed");
81597#ifdef FREECIV_JSON_CONNECTION
81598 field_addr.name = "nturns_idle";
81599#endif /* FREECIV_JSON_CONNECTION */
81600 e = 0;
81601 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
81602 if (e) {
81603 log_packet_detailed("'nturns_idle' field error detected");
81604 }
81605 }
81606 /* field 11 is folded into the header */
81607 if (BV_ISSET(fields, 12)) {
81608 log_packet_detailed(" field 'revolution_finishes' has changed");
81609#ifdef FREECIV_JSON_CONNECTION
81610 field_addr.name = "revolution_finishes";
81611#endif /* FREECIV_JSON_CONNECTION */
81612 e = 0;
81613 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
81614 if (e) {
81615 log_packet_detailed("'revolution_finishes' field error detected");
81616 }
81617 }
81618 if (BV_ISSET(fields, 13)) {
81619 log_packet_detailed(" field 'autoselect_weight' has changed");
81620#ifdef FREECIV_JSON_CONNECTION
81621 field_addr.name = "autoselect_weight";
81622#endif /* FREECIV_JSON_CONNECTION */
81623 e = 0;
81624 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
81625 if (e) {
81626 log_packet_detailed("'autoselect_weight' field error detected");
81627 }
81628 }
81629 if (BV_ISSET(fields, 14)) {
81630 log_packet_detailed(" field 'embassy' has changed");
81631#ifdef FREECIV_JSON_CONNECTION
81632 field_addr.name = "embassy";
81633#endif /* FREECIV_JSON_CONNECTION */
81634 e = 0;
81635 e |= DIO_BV_PUT(&dout, &field_addr, packet->embassy);
81636 if (e) {
81637 log_packet_detailed("'embassy' field error detected");
81638 }
81639 }
81640 if (BV_ISSET(fields, 15)) {
81641 log_packet_detailed(" field 'gold' has changed");
81642#ifdef FREECIV_JSON_CONNECTION
81643 field_addr.name = "gold";
81644#endif /* FREECIV_JSON_CONNECTION */
81645 e = 0;
81646 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
81647 if (e) {
81648 log_packet_detailed("'gold' field error detected");
81649 }
81650 }
81651 if (BV_ISSET(fields, 16)) {
81652 log_packet_detailed(" field 'tax' has changed");
81653#ifdef FREECIV_JSON_CONNECTION
81654 field_addr.name = "tax";
81655#endif /* FREECIV_JSON_CONNECTION */
81656 e = 0;
81657 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
81658 if (e) {
81659 log_packet_detailed("'tax' field error detected");
81660 }
81661 }
81662 if (BV_ISSET(fields, 17)) {
81663 log_packet_detailed(" field 'science' has changed");
81664#ifdef FREECIV_JSON_CONNECTION
81665 field_addr.name = "science";
81666#endif /* FREECIV_JSON_CONNECTION */
81667 e = 0;
81668 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
81669 if (e) {
81670 log_packet_detailed("'science' field error detected");
81671 }
81672 }
81673 if (BV_ISSET(fields, 18)) {
81674 log_packet_detailed(" field 'luxury' has changed");
81675#ifdef FREECIV_JSON_CONNECTION
81676 field_addr.name = "luxury";
81677#endif /* FREECIV_JSON_CONNECTION */
81678 e = 0;
81679 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
81680 if (e) {
81681 log_packet_detailed("'luxury' field error detected");
81682 }
81683 }
81684 if (BV_ISSET(fields, 19)) {
81685 log_packet_detailed(" field 'future_tech' has changed");
81686#ifdef FREECIV_JSON_CONNECTION
81687 field_addr.name = "future_tech";
81688#endif /* FREECIV_JSON_CONNECTION */
81689 e = 0;
81690 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
81691 if (e) {
81692 log_packet_detailed("'future_tech' field error detected");
81693 }
81694 }
81695 if (BV_ISSET(fields, 20)) {
81696 log_packet_detailed(" field 'researching' has changed");
81697#ifdef FREECIV_JSON_CONNECTION
81698 field_addr.name = "researching";
81699#endif /* FREECIV_JSON_CONNECTION */
81700 e = 0;
81701 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
81702 if (e) {
81703 log_packet_detailed("'researching' field error detected");
81704 }
81705 }
81706 if (BV_ISSET(fields, 21)) {
81707 log_packet_detailed(" field 'bulbs_researched' has changed");
81708#ifdef FREECIV_JSON_CONNECTION
81709 field_addr.name = "bulbs_researched";
81710#endif /* FREECIV_JSON_CONNECTION */
81711 e = 0;
81712 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
81713 if (e) {
81714 log_packet_detailed("'bulbs_researched' field error detected");
81715 }
81716 }
81717 if (BV_ISSET(fields, 22)) {
81718 log_packet_detailed(" field 'inventions' has changed");
81719#ifdef FREECIV_JSON_CONNECTION
81720 field_addr.name = "inventions";
81721#endif /* FREECIV_JSON_CONNECTION */
81722 e = 0;
81723 {
81724 int i;
81725
81726#ifdef FREECIV_JSON_CONNECTION
81727 size_t count_i = 0;
81728
81729 /* Create the array. */
81730 e |= DIO_PUT(farray, &dout, &field_addr, 0);
81731
81732 /* Enter array. */
81733 field_addr.sub_location = plocation_elem_new(0);
81734#endif /* FREECIV_JSON_CONNECTION */
81735
81736 fc_assert(A_LAST + 1 < MAX_UINT16);
81737
81738 for (i = 0; i < A_LAST + 1; i++) {
81739 differ = (old->inventions[i] != real_packet->inventions[i]);
81740
81741 if (differ) {
81742#ifdef FREECIV_JSON_CONNECTION
81743 /* Append next diff array element. */
81744 field_addr.sub_location->number = -1;
81745
81746 /* Create the diff array element. */
81747 e |= DIO_PUT(farray, &dout, &field_addr, 2);
81748
81749 /* Enter diff array element (start at the index address). */
81750 field_addr.sub_location->number = count_i++;
81751 field_addr.sub_location->sub_location = plocation_elem_new(0);
81752#endif /* FREECIV_JSON_CONNECTION */
81753 e |= DIO_PUT(uint16, &dout, &field_addr, i);
81754
81755#ifdef FREECIV_JSON_CONNECTION
81756 /* Content address. */
81757 field_addr.sub_location->sub_location->number = 1;
81758#endif /* FREECIV_JSON_CONNECTION */
81759 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->inventions[i]);
81760
81761#ifdef FREECIV_JSON_CONNECTION
81762 /* Exit diff array element. */
81763 FC_FREE(field_addr.sub_location->sub_location);
81764#endif /* FREECIV_JSON_CONNECTION */
81765 }
81766 }
81767#ifdef FREECIV_JSON_CONNECTION
81768 /* Append diff array element. */
81769 field_addr.sub_location->number = -1;
81770
81771 /* Create the terminating diff array element. */
81772 e |= DIO_PUT(farray, &dout, &field_addr, 1);
81773
81774 /* Enter diff array element (start at the index address). */
81775 field_addr.sub_location->number = count_i;
81776 field_addr.sub_location->sub_location = plocation_elem_new(0);
81777#endif /* FREECIV_JSON_CONNECTION */
81778 e |= DIO_PUT(uint16, &dout, &field_addr, MAX_UINT16);
81779
81780#ifdef FREECIV_JSON_CONNECTION
81781 /* Exit diff array element. */
81782 FC_FREE(field_addr.sub_location->sub_location);
81783
81784 /* Exit array. */
81785 FC_FREE(field_addr.sub_location);
81786#endif /* FREECIV_JSON_CONNECTION */
81787 }
81788 if (e) {
81789 log_packet_detailed("'inventions' field error detected");
81790 }
81791 }
81792 /* field 23 is folded into the header */
81793 /* field 24 is folded into the header */
81794
81795 *old = *real_packet;
81796#endif /* FREECIV_DELTA_PROTOCOL */
81797#ifndef FREECIV_DELTA_PROTOCOL
81798#ifdef FREECIV_JSON_CONNECTION
81799 field_addr.name = "id";
81800#endif /* FREECIV_JSON_CONNECTION */
81801 e = 0;
81802 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->id);
81803 if (e) {
81804 log_packet_detailed("'id' field error detected");
81805 }
81806#ifdef FREECIV_JSON_CONNECTION
81807 field_addr.name = "name";
81808#endif /* FREECIV_JSON_CONNECTION */
81809 e = 0;
81810 e |= DIO_PUT(string, &dout, &field_addr, real_packet->name);
81811 if (e) {
81812 log_packet_detailed("'name' field error detected");
81813 }
81814#ifdef FREECIV_JSON_CONNECTION
81815 field_addr.name = "username";
81816#endif /* FREECIV_JSON_CONNECTION */
81817 e = 0;
81818 e |= DIO_PUT(string, &dout, &field_addr, real_packet->username);
81819 if (e) {
81820 log_packet_detailed("'username' field error detected");
81821 }
81822#ifdef FREECIV_JSON_CONNECTION
81823 field_addr.name = "ranked_username";
81824#endif /* FREECIV_JSON_CONNECTION */
81825 e = 0;
81826 e |= DIO_PUT(string, &dout, &field_addr, real_packet->ranked_username);
81827 if (e) {
81828 log_packet_detailed("'ranked_username' field error detected");
81829 }
81830#ifdef FREECIV_JSON_CONNECTION
81831 field_addr.name = "user_turns";
81832#endif /* FREECIV_JSON_CONNECTION */
81833 e = 0;
81834 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->user_turns);
81835 if (e) {
81836 log_packet_detailed("'user_turns' field error detected");
81837 }
81838#ifdef FREECIV_JSON_CONNECTION
81839 field_addr.name = "is_male";
81840#endif /* FREECIV_JSON_CONNECTION */
81841 e = 0;
81842 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_male);
81843 if (e) {
81844 log_packet_detailed("'is_male' field error detected");
81845 }
81846#ifdef FREECIV_JSON_CONNECTION
81847 field_addr.name = "government";
81848#endif /* FREECIV_JSON_CONNECTION */
81849 e = 0;
81850 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->government);
81851 if (e) {
81852 log_packet_detailed("'government' field error detected");
81853 }
81854#ifdef FREECIV_JSON_CONNECTION
81855 field_addr.name = "target_government";
81856#endif /* FREECIV_JSON_CONNECTION */
81857 e = 0;
81858 e |= DIO_PUT(sint8, &dout, &field_addr, real_packet->target_government);
81859 if (e) {
81860 log_packet_detailed("'target_government' field error detected");
81861 }
81862#ifdef FREECIV_JSON_CONNECTION
81863 field_addr.name = "nation";
81864#endif /* FREECIV_JSON_CONNECTION */
81865 e = 0;
81866 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nation);
81867 if (e) {
81868 log_packet_detailed("'nation' field error detected");
81869 }
81870#ifdef FREECIV_JSON_CONNECTION
81871 field_addr.name = "team";
81872#endif /* FREECIV_JSON_CONNECTION */
81873 e = 0;
81874 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->team);
81875 if (e) {
81876 log_packet_detailed("'team' field error detected");
81877 }
81878#ifdef FREECIV_JSON_CONNECTION
81879 field_addr.name = "phase_done";
81880#endif /* FREECIV_JSON_CONNECTION */
81881 e = 0;
81882 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->phase_done);
81883 if (e) {
81884 log_packet_detailed("'phase_done' field error detected");
81885 }
81886#ifdef FREECIV_JSON_CONNECTION
81887 field_addr.name = "nturns_idle";
81888#endif /* FREECIV_JSON_CONNECTION */
81889 e = 0;
81890 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->nturns_idle);
81891 if (e) {
81892 log_packet_detailed("'nturns_idle' field error detected");
81893 }
81894#ifdef FREECIV_JSON_CONNECTION
81895 field_addr.name = "is_alive";
81896#endif /* FREECIV_JSON_CONNECTION */
81897 e = 0;
81898 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->is_alive);
81899 if (e) {
81900 log_packet_detailed("'is_alive' field error detected");
81901 }
81902#ifdef FREECIV_JSON_CONNECTION
81903 field_addr.name = "revolution_finishes";
81904#endif /* FREECIV_JSON_CONNECTION */
81905 e = 0;
81906 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->revolution_finishes);
81907 if (e) {
81908 log_packet_detailed("'revolution_finishes' field error detected");
81909 }
81910#ifdef FREECIV_JSON_CONNECTION
81911 field_addr.name = "autoselect_weight";
81912#endif /* FREECIV_JSON_CONNECTION */
81913 e = 0;
81914 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->autoselect_weight);
81915 if (e) {
81916 log_packet_detailed("'autoselect_weight' field error detected");
81917 }
81918#ifdef FREECIV_JSON_CONNECTION
81919 field_addr.name = "embassy";
81920#endif /* FREECIV_JSON_CONNECTION */
81921 e = 0;
81922 e |= DIO_BV_PUT(&dout, &field_addr, packet->embassy);
81923 if (e) {
81924 log_packet_detailed("'embassy' field error detected");
81925 }
81926#ifdef FREECIV_JSON_CONNECTION
81927 field_addr.name = "gold";
81928#endif /* FREECIV_JSON_CONNECTION */
81929 e = 0;
81930 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->gold);
81931 if (e) {
81932 log_packet_detailed("'gold' field error detected");
81933 }
81934#ifdef FREECIV_JSON_CONNECTION
81935 field_addr.name = "tax";
81936#endif /* FREECIV_JSON_CONNECTION */
81937 e = 0;
81938 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->tax);
81939 if (e) {
81940 log_packet_detailed("'tax' field error detected");
81941 }
81942#ifdef FREECIV_JSON_CONNECTION
81943 field_addr.name = "science";
81944#endif /* FREECIV_JSON_CONNECTION */
81945 e = 0;
81946 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->science);
81947 if (e) {
81948 log_packet_detailed("'science' field error detected");
81949 }
81950#ifdef FREECIV_JSON_CONNECTION
81951 field_addr.name = "luxury";
81952#endif /* FREECIV_JSON_CONNECTION */
81953 e = 0;
81954 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->luxury);
81955 if (e) {
81956 log_packet_detailed("'luxury' field error detected");
81957 }
81958#ifdef FREECIV_JSON_CONNECTION
81959 field_addr.name = "future_tech";
81960#endif /* FREECIV_JSON_CONNECTION */
81961 e = 0;
81962 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->future_tech);
81963 if (e) {
81964 log_packet_detailed("'future_tech' field error detected");
81965 }
81966#ifdef FREECIV_JSON_CONNECTION
81967 field_addr.name = "researching";
81968#endif /* FREECIV_JSON_CONNECTION */
81969 e = 0;
81970 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->researching);
81971 if (e) {
81972 log_packet_detailed("'researching' field error detected");
81973 }
81974#ifdef FREECIV_JSON_CONNECTION
81975 field_addr.name = "bulbs_researched";
81976#endif /* FREECIV_JSON_CONNECTION */
81977 e = 0;
81978 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->bulbs_researched);
81979 if (e) {
81980 log_packet_detailed("'bulbs_researched' field error detected");
81981 }
81982#ifdef FREECIV_JSON_CONNECTION
81983 field_addr.name = "inventions";
81984#endif /* FREECIV_JSON_CONNECTION */
81985 e = 0;
81986 {
81987 int i;
81988
81989#ifdef FREECIV_JSON_CONNECTION
81990 /* Create the array. */
81991 e |= DIO_PUT(farray, &dout, &field_addr, A_LAST + 1);
81992
81993 /* Enter the array. */
81994 field_addr.sub_location = plocation_elem_new(0);
81995#endif /* FREECIV_JSON_CONNECTION */
81996
81997 for (i = 0; i < A_LAST + 1; i++) {
81998#ifdef FREECIV_JSON_CONNECTION
81999 /* Next array element. */
82000 field_addr.sub_location->number = i;
82001#endif /* FREECIV_JSON_CONNECTION */
82002 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->inventions[i]);
82003 }
82004
82005#ifdef FREECIV_JSON_CONNECTION
82006 /* Exit array. */
82007 FC_FREE(field_addr.sub_location);
82008#endif /* FREECIV_JSON_CONNECTION */
82009 }
82010 if (e) {
82011 log_packet_detailed("'inventions' field error detected");
82012 }
82013#ifdef FREECIV_JSON_CONNECTION
82014 field_addr.name = "ai";
82015#endif /* FREECIV_JSON_CONNECTION */
82016 e = 0;
82017 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->ai);
82018 if (e) {
82019 log_packet_detailed("'ai' field error detected");
82020 }
82021#ifdef FREECIV_JSON_CONNECTION
82022 field_addr.name = "scenario_reserved";
82023#endif /* FREECIV_JSON_CONNECTION */
82024 e = 0;
82025 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_reserved);
82026 if (e) {
82027 log_packet_detailed("'scenario_reserved' field error detected");
82028 }
82029
82030#endif
82031 SEND_PACKET_END(PACKET_EDIT_PLAYER);
82032}
82033
82034 int send_packet_edit_player(struct connection *pc, const struct packet_edit_player *packet)
82035{
82036 if (!pc->used) {
82037 log_error("WARNING: trying to send data to the closed connection %s",
82038 conn_description(pc));
82039 return -1;
82040 }
82041 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER].packet != NULL, -1,
82042 "Handler for PACKET_EDIT_PLAYER not installed");
82043 return pc->phs.handlers->send[PACKET_EDIT_PLAYER].packet(pc, packet);
82044}
82045
82046 void lsend_packet_edit_player(struct conn_list *dest, const struct packet_edit_player *packet)
82047{
82048 conn_list_iterate(dest, pconn) {
82049 send_packet_edit_player(pconn, packet);
82050 } conn_list_iterate_end;
82051}
82052
82053#ifdef FREECIV_DELTA_PROTOCOL
82054#define hash_packet_edit_player_vision_100 hash_const
82055
82056#define cmp_packet_edit_player_vision_100 cmp_const
82057
82058 BV_DEFINE(packet_edit_player_vision_100_fields, 4);
82059#endif /* FREECIV_DELTA_PROTOCOL */
82060
82061 static struct packet_edit_player_vision *receive_packet_edit_player_vision_100(struct connection *pc)
82062{
82063#ifdef FREECIV_DELTA_PROTOCOL
82064 packet_edit_player_vision_100_fields fields;
82065 struct packet_edit_player_vision *old;
82066 struct genhash **hash = pc->phs.received + PACKET_EDIT_PLAYER_VISION;
82067#endif /* FREECIV_DELTA_PROTOCOL */
82068 RECEIVE_PACKET_START(packet_edit_player_vision, real_packet);
82069#ifdef FREECIV_JSON_CONNECTION
82070 struct plocation field_addr;
82071 {
82072 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82073 field_addr = *field_addr_tmp;
82074 FC_FREE(field_addr_tmp);
82075 }
82076#endif /* FREECIV_JSON_CONNECTION */
82077
82078#ifdef FREECIV_DELTA_PROTOCOL
82079#ifdef FREECIV_JSON_CONNECTION
82080 field_addr.name = "fields";
82081#endif /* FREECIV_JSON_CONNECTION */
82082 DIO_BV_GET(&din, &field_addr, fields);
82083
82084#else /* FREECIV_DELTA_PROTOCOL */
82085#ifdef FREECIV_JSON_CONNECTION
82086 field_addr.name = "player";
82087#endif /* FREECIV_JSON_CONNECTION */
82088 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
82089 RECEIVE_PACKET_FIELD_ERROR(player);
82090 }
82091#ifdef FREECIV_JSON_CONNECTION
82092 field_addr.name = "tile";
82093#endif /* FREECIV_JSON_CONNECTION */
82094 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
82095 RECEIVE_PACKET_FIELD_ERROR(tile);
82096 }
82097#ifdef FREECIV_JSON_CONNECTION
82098 field_addr.name = "known";
82099#endif /* FREECIV_JSON_CONNECTION */
82100 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->known)) {
82101 RECEIVE_PACKET_FIELD_ERROR(known);
82102 }
82103#ifdef FREECIV_JSON_CONNECTION
82104 field_addr.name = "size";
82105#endif /* FREECIV_JSON_CONNECTION */
82106 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
82107 RECEIVE_PACKET_FIELD_ERROR(size);
82108 }
82109#endif
82110 log_packet_detailed("packet_edit_player_vision_100: got info about ()");
82111
82112#ifdef FREECIV_DELTA_PROTOCOL
82113 if (NULL == *hash) {
82114 *hash = genhash_new_full(hash_packet_edit_player_vision_100, cmp_packet_edit_player_vision_100,
82115 NULL, NULL, NULL, free);
82116 }
82117
82118 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82119 *real_packet = *old;
82120 } else {
82121 log_packet_detailed(" no old info");
82122 memset(real_packet, 0, sizeof(*real_packet));
82123 }
82124
82125 if (BV_ISSET(fields, 0)) {
82126 log_packet_detailed(" got field 'player'");
82127#ifdef FREECIV_JSON_CONNECTION
82128 field_addr.name = "player";
82129#endif /* FREECIV_JSON_CONNECTION */
82130 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->player)) {
82131 RECEIVE_PACKET_FIELD_ERROR(player);
82132 }
82133 }
82134 if (BV_ISSET(fields, 1)) {
82135 log_packet_detailed(" got field 'tile'");
82136#ifdef FREECIV_JSON_CONNECTION
82137 field_addr.name = "tile";
82138#endif /* FREECIV_JSON_CONNECTION */
82139 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tile)) {
82140 RECEIVE_PACKET_FIELD_ERROR(tile);
82141 }
82142 }
82143 real_packet->known = BV_ISSET(fields, 2);
82144 if (BV_ISSET(fields, 3)) {
82145 log_packet_detailed(" got field 'size'");
82146#ifdef FREECIV_JSON_CONNECTION
82147 field_addr.name = "size";
82148#endif /* FREECIV_JSON_CONNECTION */
82149 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->size)) {
82150 RECEIVE_PACKET_FIELD_ERROR(size);
82151 }
82152 }
82153
82154 if (NULL == old) {
82155 old = fc_malloc(sizeof(*old));
82156 *old = *real_packet;
82157 genhash_insert(*hash, old, old);
82158 } else {
82159 *old = *real_packet;
82160 }
82161
82162#endif /* FREECIV_DELTA_PROTOCOL */
82163 RECEIVE_PACKET_END(real_packet);
82164}
82165
82166 static int send_packet_edit_player_vision_100(struct connection *pc, const struct packet_edit_player_vision *packet)
82167{
82168 const struct packet_edit_player_vision *real_packet = packet;
82169 int e;
82170#ifdef FREECIV_DELTA_PROTOCOL
82171 packet_edit_player_vision_100_fields fields;
82172 struct packet_edit_player_vision *old;
82173 bool differ;
82174 struct genhash **hash = pc->phs.sent + PACKET_EDIT_PLAYER_VISION;
82175#endif /* FREECIV_DELTA_PROTOCOL */
82176 SEND_PACKET_START(PACKET_EDIT_PLAYER_VISION);
82177#ifdef FREECIV_JSON_CONNECTION
82178 struct plocation field_addr;
82179 {
82180 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82181 field_addr = *field_addr_tmp;
82182 FC_FREE(field_addr_tmp);
82183 }
82184#endif /* FREECIV_JSON_CONNECTION */
82185
82186 log_packet_detailed("packet_edit_player_vision_100: sending info about ()");
82187
82188#ifdef FREECIV_DELTA_PROTOCOL
82189 if (NULL == *hash) {
82190 *hash = genhash_new_full(hash_packet_edit_player_vision_100, cmp_packet_edit_player_vision_100,
82191 NULL, NULL, NULL, free);
82192 }
82193 BV_CLR_ALL(fields);
82194
82195 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82196 old = fc_malloc(sizeof(*old));
82197 *old = *real_packet;
82198 genhash_insert(*hash, old, old);
82199 memset(old, 0, sizeof(*old));
82200 }
82201 differ = (old->player != real_packet->player);
82202 if (differ) {
82203 BV_SET(fields, 0);
82204 }
82205
82206 differ = (old->tile != real_packet->tile);
82207 if (differ) {
82208 BV_SET(fields, 1);
82209 }
82210
82211 if (packet->known) {
82212 BV_SET(fields, 2);
82213 }
82214
82215 differ = (old->size != real_packet->size);
82216 if (differ) {
82217 BV_SET(fields, 3);
82218 }
82219
82220
82221#ifdef FREECIV_JSON_CONNECTION
82222 field_addr.name = "fields";
82223#endif /* FREECIV_JSON_CONNECTION */
82224 e = 0;
82225 e |= DIO_BV_PUT(&dout, &field_addr, fields);
82226 if (e) {
82227 log_packet_detailed("fields bitvector error detected");
82228 }
82229
82230 if (BV_ISSET(fields, 0)) {
82231 log_packet_detailed(" field 'player' has changed");
82232#ifdef FREECIV_JSON_CONNECTION
82233 field_addr.name = "player";
82234#endif /* FREECIV_JSON_CONNECTION */
82235 e = 0;
82236 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
82237 if (e) {
82238 log_packet_detailed("'player' field error detected");
82239 }
82240 }
82241 if (BV_ISSET(fields, 1)) {
82242 log_packet_detailed(" field 'tile' has changed");
82243#ifdef FREECIV_JSON_CONNECTION
82244 field_addr.name = "tile";
82245#endif /* FREECIV_JSON_CONNECTION */
82246 e = 0;
82247 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82248 if (e) {
82249 log_packet_detailed("'tile' field error detected");
82250 }
82251 }
82252 /* field 2 is folded into the header */
82253 if (BV_ISSET(fields, 3)) {
82254 log_packet_detailed(" field 'size' has changed");
82255#ifdef FREECIV_JSON_CONNECTION
82256 field_addr.name = "size";
82257#endif /* FREECIV_JSON_CONNECTION */
82258 e = 0;
82259 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
82260 if (e) {
82261 log_packet_detailed("'size' field error detected");
82262 }
82263 }
82264
82265 *old = *real_packet;
82266#endif /* FREECIV_DELTA_PROTOCOL */
82267#ifndef FREECIV_DELTA_PROTOCOL
82268#ifdef FREECIV_JSON_CONNECTION
82269 field_addr.name = "player";
82270#endif /* FREECIV_JSON_CONNECTION */
82271 e = 0;
82272 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->player);
82273 if (e) {
82274 log_packet_detailed("'player' field error detected");
82275 }
82276#ifdef FREECIV_JSON_CONNECTION
82277 field_addr.name = "tile";
82278#endif /* FREECIV_JSON_CONNECTION */
82279 e = 0;
82280 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tile);
82281 if (e) {
82282 log_packet_detailed("'tile' field error detected");
82283 }
82284#ifdef FREECIV_JSON_CONNECTION
82285 field_addr.name = "known";
82286#endif /* FREECIV_JSON_CONNECTION */
82287 e = 0;
82288 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->known);
82289 if (e) {
82290 log_packet_detailed("'known' field error detected");
82291 }
82292#ifdef FREECIV_JSON_CONNECTION
82293 field_addr.name = "size";
82294#endif /* FREECIV_JSON_CONNECTION */
82295 e = 0;
82296 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->size);
82297 if (e) {
82298 log_packet_detailed("'size' field error detected");
82299 }
82300
82301#endif
82302 SEND_PACKET_END(PACKET_EDIT_PLAYER_VISION);
82303}
82304
82305 int send_packet_edit_player_vision(struct connection *pc, const struct packet_edit_player_vision *packet)
82306{
82307 if (!pc->used) {
82308 log_error("WARNING: trying to send data to the closed connection %s",
82309 conn_description(pc));
82310 return -1;
82311 }
82312 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_PLAYER_VISION].packet != NULL, -1,
82313 "Handler for PACKET_EDIT_PLAYER_VISION not installed");
82314 return pc->phs.handlers->send[PACKET_EDIT_PLAYER_VISION].packet(pc, packet);
82315}
82316
82317 int dsend_packet_edit_player_vision(struct connection *pc, int player, int tile, bool known, int size)
82318{
82319 struct packet_edit_player_vision packet, *real_packet = &packet;
82320
82321 real_packet->player = player;
82322 real_packet->tile = tile;
82323 real_packet->known = known;
82324 real_packet->size = size;
82325
82326 return send_packet_edit_player_vision(pc, real_packet);
82327}
82328
82329#ifdef FREECIV_DELTA_PROTOCOL
82330#define hash_packet_edit_game_100 hash_const
82331
82332#define cmp_packet_edit_game_100 cmp_const
82333
82334 BV_DEFINE(packet_edit_game_100_fields, 9);
82335#endif /* FREECIV_DELTA_PROTOCOL */
82336
82337 static struct packet_edit_game *receive_packet_edit_game_100(struct connection *pc)
82338{
82339#ifdef FREECIV_DELTA_PROTOCOL
82340 packet_edit_game_100_fields fields;
82341 struct packet_edit_game *old;
82342 struct genhash **hash = pc->phs.received + PACKET_EDIT_GAME;
82343#endif /* FREECIV_DELTA_PROTOCOL */
82344 RECEIVE_PACKET_START(packet_edit_game, real_packet);
82345#ifdef FREECIV_JSON_CONNECTION
82346 struct plocation field_addr;
82347 {
82348 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82349 field_addr = *field_addr_tmp;
82350 FC_FREE(field_addr_tmp);
82351 }
82352#endif /* FREECIV_JSON_CONNECTION */
82353
82354#ifdef FREECIV_DELTA_PROTOCOL
82355#ifdef FREECIV_JSON_CONNECTION
82356 field_addr.name = "fields";
82357#endif /* FREECIV_JSON_CONNECTION */
82358 DIO_BV_GET(&din, &field_addr, fields);
82359
82360#else /* FREECIV_DELTA_PROTOCOL */
82361#ifdef FREECIV_JSON_CONNECTION
82362 field_addr.name = "scenario";
82363#endif /* FREECIV_JSON_CONNECTION */
82364 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario)) {
82365 RECEIVE_PACKET_FIELD_ERROR(scenario);
82366 }
82367#ifdef FREECIV_JSON_CONNECTION
82368 field_addr.name = "scenario_name";
82369#endif /* FREECIV_JSON_CONNECTION */
82370 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_name, sizeof(real_packet->scenario_name))) {
82371 RECEIVE_PACKET_FIELD_ERROR(scenario_name);
82372 }
82373#ifdef FREECIV_JSON_CONNECTION
82374 field_addr.name = "scenario_authors";
82375#endif /* FREECIV_JSON_CONNECTION */
82376 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_authors, sizeof(real_packet->scenario_authors))) {
82377 RECEIVE_PACKET_FIELD_ERROR(scenario_authors);
82378 }
82379#ifdef FREECIV_JSON_CONNECTION
82380 field_addr.name = "scenario_random";
82381#endif /* FREECIV_JSON_CONNECTION */
82382 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_random)) {
82383 RECEIVE_PACKET_FIELD_ERROR(scenario_random);
82384 }
82385#ifdef FREECIV_JSON_CONNECTION
82386 field_addr.name = "scenario_players";
82387#endif /* FREECIV_JSON_CONNECTION */
82388 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->scenario_players)) {
82389 RECEIVE_PACKET_FIELD_ERROR(scenario_players);
82390 }
82391#ifdef FREECIV_JSON_CONNECTION
82392 field_addr.name = "startpos_nations";
82393#endif /* FREECIV_JSON_CONNECTION */
82394 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->startpos_nations)) {
82395 RECEIVE_PACKET_FIELD_ERROR(startpos_nations);
82396 }
82397#ifdef FREECIV_JSON_CONNECTION
82398 field_addr.name = "prevent_new_cities";
82399#endif /* FREECIV_JSON_CONNECTION */
82400 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->prevent_new_cities)) {
82401 RECEIVE_PACKET_FIELD_ERROR(prevent_new_cities);
82402 }
82403#ifdef FREECIV_JSON_CONNECTION
82404 field_addr.name = "lake_flooding";
82405#endif /* FREECIV_JSON_CONNECTION */
82406 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->lake_flooding)) {
82407 RECEIVE_PACKET_FIELD_ERROR(lake_flooding);
82408 }
82409#ifdef FREECIV_JSON_CONNECTION
82410 field_addr.name = "ruleset_locked";
82411#endif /* FREECIV_JSON_CONNECTION */
82412 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->ruleset_locked)) {
82413 RECEIVE_PACKET_FIELD_ERROR(ruleset_locked);
82414 }
82415#endif
82416 log_packet_detailed("packet_edit_game_100: got info about ()");
82417
82418#ifdef FREECIV_DELTA_PROTOCOL
82419 if (NULL == *hash) {
82420 *hash = genhash_new_full(hash_packet_edit_game_100, cmp_packet_edit_game_100,
82421 NULL, NULL, NULL, free);
82422 }
82423
82424 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82425 *real_packet = *old;
82426 } else {
82427 log_packet_detailed(" no old info");
82428 memset(real_packet, 0, sizeof(*real_packet));
82429 }
82430
82431 real_packet->scenario = BV_ISSET(fields, 0);
82432 if (BV_ISSET(fields, 1)) {
82433 log_packet_detailed(" got field 'scenario_name'");
82434#ifdef FREECIV_JSON_CONNECTION
82435 field_addr.name = "scenario_name";
82436#endif /* FREECIV_JSON_CONNECTION */
82437 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_name, sizeof(real_packet->scenario_name))) {
82438 RECEIVE_PACKET_FIELD_ERROR(scenario_name);
82439 }
82440 }
82441 if (BV_ISSET(fields, 2)) {
82442 log_packet_detailed(" got field 'scenario_authors'");
82443#ifdef FREECIV_JSON_CONNECTION
82444 field_addr.name = "scenario_authors";
82445#endif /* FREECIV_JSON_CONNECTION */
82446 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_authors, sizeof(real_packet->scenario_authors))) {
82447 RECEIVE_PACKET_FIELD_ERROR(scenario_authors);
82448 }
82449 }
82450 real_packet->scenario_random = BV_ISSET(fields, 3);
82451 real_packet->scenario_players = BV_ISSET(fields, 4);
82452 real_packet->startpos_nations = BV_ISSET(fields, 5);
82453 real_packet->prevent_new_cities = BV_ISSET(fields, 6);
82454 real_packet->lake_flooding = BV_ISSET(fields, 7);
82455 real_packet->ruleset_locked = BV_ISSET(fields, 8);
82456
82457 if (NULL == old) {
82458 old = fc_malloc(sizeof(*old));
82459 *old = *real_packet;
82460 genhash_insert(*hash, old, old);
82461 } else {
82462 *old = *real_packet;
82463 }
82464
82465#endif /* FREECIV_DELTA_PROTOCOL */
82466 RECEIVE_PACKET_END(real_packet);
82467}
82468
82469 static int send_packet_edit_game_100(struct connection *pc, const struct packet_edit_game *packet)
82470{
82471 const struct packet_edit_game *real_packet = packet;
82472 int e;
82473#ifdef FREECIV_DELTA_PROTOCOL
82474 packet_edit_game_100_fields fields;
82475 struct packet_edit_game *old;
82476 bool differ;
82477 struct genhash **hash = pc->phs.sent + PACKET_EDIT_GAME;
82478#endif /* FREECIV_DELTA_PROTOCOL */
82479 SEND_PACKET_START(PACKET_EDIT_GAME);
82480#ifdef FREECIV_JSON_CONNECTION
82481 struct plocation field_addr;
82482 {
82483 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82484 field_addr = *field_addr_tmp;
82485 FC_FREE(field_addr_tmp);
82486 }
82487#endif /* FREECIV_JSON_CONNECTION */
82488
82489 log_packet_detailed("packet_edit_game_100: sending info about ()");
82490
82491#ifdef FREECIV_DELTA_PROTOCOL
82492 if (NULL == *hash) {
82493 *hash = genhash_new_full(hash_packet_edit_game_100, cmp_packet_edit_game_100,
82494 NULL, NULL, NULL, free);
82495 }
82496 BV_CLR_ALL(fields);
82497
82498 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82499 old = fc_malloc(sizeof(*old));
82500 *old = *real_packet;
82501 genhash_insert(*hash, old, old);
82502 memset(old, 0, sizeof(*old));
82503 }
82504 if (packet->scenario) {
82505 BV_SET(fields, 0);
82506 }
82507
82508 differ = (strcmp(old->scenario_name, real_packet->scenario_name) != 0);
82509 if (differ) {
82510 BV_SET(fields, 1);
82511 }
82512
82513 differ = (strcmp(old->scenario_authors, real_packet->scenario_authors) != 0);
82514 if (differ) {
82515 BV_SET(fields, 2);
82516 }
82517
82518 if (packet->scenario_random) {
82519 BV_SET(fields, 3);
82520 }
82521
82522 if (packet->scenario_players) {
82523 BV_SET(fields, 4);
82524 }
82525
82526 if (packet->startpos_nations) {
82527 BV_SET(fields, 5);
82528 }
82529
82530 if (packet->prevent_new_cities) {
82531 BV_SET(fields, 6);
82532 }
82533
82534 if (packet->lake_flooding) {
82535 BV_SET(fields, 7);
82536 }
82537
82538 if (packet->ruleset_locked) {
82539 BV_SET(fields, 8);
82540 }
82541
82542
82543#ifdef FREECIV_JSON_CONNECTION
82544 field_addr.name = "fields";
82545#endif /* FREECIV_JSON_CONNECTION */
82546 e = 0;
82547 e |= DIO_BV_PUT(&dout, &field_addr, fields);
82548 if (e) {
82549 log_packet_detailed("fields bitvector error detected");
82550 }
82551
82552 /* field 0 is folded into the header */
82553 if (BV_ISSET(fields, 1)) {
82554 log_packet_detailed(" field 'scenario_name' has changed");
82555#ifdef FREECIV_JSON_CONNECTION
82556 field_addr.name = "scenario_name";
82557#endif /* FREECIV_JSON_CONNECTION */
82558 e = 0;
82559 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_name);
82560 if (e) {
82561 log_packet_detailed("'scenario_name' field error detected");
82562 }
82563 }
82564 if (BV_ISSET(fields, 2)) {
82565 log_packet_detailed(" field 'scenario_authors' has changed");
82566#ifdef FREECIV_JSON_CONNECTION
82567 field_addr.name = "scenario_authors";
82568#endif /* FREECIV_JSON_CONNECTION */
82569 e = 0;
82570 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_authors);
82571 if (e) {
82572 log_packet_detailed("'scenario_authors' field error detected");
82573 }
82574 }
82575 /* field 3 is folded into the header */
82576 /* field 4 is folded into the header */
82577 /* field 5 is folded into the header */
82578 /* field 6 is folded into the header */
82579 /* field 7 is folded into the header */
82580 /* field 8 is folded into the header */
82581
82582 *old = *real_packet;
82583#endif /* FREECIV_DELTA_PROTOCOL */
82584#ifndef FREECIV_DELTA_PROTOCOL
82585#ifdef FREECIV_JSON_CONNECTION
82586 field_addr.name = "scenario";
82587#endif /* FREECIV_JSON_CONNECTION */
82588 e = 0;
82589 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario);
82590 if (e) {
82591 log_packet_detailed("'scenario' field error detected");
82592 }
82593#ifdef FREECIV_JSON_CONNECTION
82594 field_addr.name = "scenario_name";
82595#endif /* FREECIV_JSON_CONNECTION */
82596 e = 0;
82597 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_name);
82598 if (e) {
82599 log_packet_detailed("'scenario_name' field error detected");
82600 }
82601#ifdef FREECIV_JSON_CONNECTION
82602 field_addr.name = "scenario_authors";
82603#endif /* FREECIV_JSON_CONNECTION */
82604 e = 0;
82605 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_authors);
82606 if (e) {
82607 log_packet_detailed("'scenario_authors' field error detected");
82608 }
82609#ifdef FREECIV_JSON_CONNECTION
82610 field_addr.name = "scenario_random";
82611#endif /* FREECIV_JSON_CONNECTION */
82612 e = 0;
82613 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_random);
82614 if (e) {
82615 log_packet_detailed("'scenario_random' field error detected");
82616 }
82617#ifdef FREECIV_JSON_CONNECTION
82618 field_addr.name = "scenario_players";
82619#endif /* FREECIV_JSON_CONNECTION */
82620 e = 0;
82621 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->scenario_players);
82622 if (e) {
82623 log_packet_detailed("'scenario_players' field error detected");
82624 }
82625#ifdef FREECIV_JSON_CONNECTION
82626 field_addr.name = "startpos_nations";
82627#endif /* FREECIV_JSON_CONNECTION */
82628 e = 0;
82629 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->startpos_nations);
82630 if (e) {
82631 log_packet_detailed("'startpos_nations' field error detected");
82632 }
82633#ifdef FREECIV_JSON_CONNECTION
82634 field_addr.name = "prevent_new_cities";
82635#endif /* FREECIV_JSON_CONNECTION */
82636 e = 0;
82637 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->prevent_new_cities);
82638 if (e) {
82639 log_packet_detailed("'prevent_new_cities' field error detected");
82640 }
82641#ifdef FREECIV_JSON_CONNECTION
82642 field_addr.name = "lake_flooding";
82643#endif /* FREECIV_JSON_CONNECTION */
82644 e = 0;
82645 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->lake_flooding);
82646 if (e) {
82647 log_packet_detailed("'lake_flooding' field error detected");
82648 }
82649#ifdef FREECIV_JSON_CONNECTION
82650 field_addr.name = "ruleset_locked";
82651#endif /* FREECIV_JSON_CONNECTION */
82652 e = 0;
82653 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->ruleset_locked);
82654 if (e) {
82655 log_packet_detailed("'ruleset_locked' field error detected");
82656 }
82657
82658#endif
82659 SEND_PACKET_END(PACKET_EDIT_GAME);
82660}
82661
82662 int send_packet_edit_game(struct connection *pc, const struct packet_edit_game *packet)
82663{
82664 if (!pc->used) {
82665 log_error("WARNING: trying to send data to the closed connection %s",
82666 conn_description(pc));
82667 return -1;
82668 }
82669 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_GAME].packet != NULL, -1,
82670 "Handler for PACKET_EDIT_GAME not installed");
82671 return pc->phs.handlers->send[PACKET_EDIT_GAME].packet(pc, packet);
82672}
82673
82674#ifdef FREECIV_DELTA_PROTOCOL
82675#define hash_packet_edit_scenario_desc_100 hash_const
82676
82677#define cmp_packet_edit_scenario_desc_100 cmp_const
82678
82679 BV_DEFINE(packet_edit_scenario_desc_100_fields, 1);
82680#endif /* FREECIV_DELTA_PROTOCOL */
82681
82682 static struct packet_edit_scenario_desc *receive_packet_edit_scenario_desc_100(struct connection *pc)
82683{
82684#ifdef FREECIV_DELTA_PROTOCOL
82685 packet_edit_scenario_desc_100_fields fields;
82686 struct packet_edit_scenario_desc *old;
82687 struct genhash **hash = pc->phs.received + PACKET_EDIT_SCENARIO_DESC;
82688#endif /* FREECIV_DELTA_PROTOCOL */
82689 RECEIVE_PACKET_START(packet_edit_scenario_desc, real_packet);
82690#ifdef FREECIV_JSON_CONNECTION
82691 struct plocation field_addr;
82692 {
82693 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82694 field_addr = *field_addr_tmp;
82695 FC_FREE(field_addr_tmp);
82696 }
82697#endif /* FREECIV_JSON_CONNECTION */
82698
82699#ifdef FREECIV_DELTA_PROTOCOL
82700#ifdef FREECIV_JSON_CONNECTION
82701 field_addr.name = "fields";
82702#endif /* FREECIV_JSON_CONNECTION */
82703 DIO_BV_GET(&din, &field_addr, fields);
82704
82705#else /* FREECIV_DELTA_PROTOCOL */
82706#ifdef FREECIV_JSON_CONNECTION
82707 field_addr.name = "scenario_desc";
82708#endif /* FREECIV_JSON_CONNECTION */
82709 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_desc, sizeof(real_packet->scenario_desc))) {
82710 RECEIVE_PACKET_FIELD_ERROR(scenario_desc);
82711 }
82712#endif
82713 log_packet_detailed("packet_edit_scenario_desc_100: got info about ()");
82714
82715#ifdef FREECIV_DELTA_PROTOCOL
82716 if (NULL == *hash) {
82717 *hash = genhash_new_full(hash_packet_edit_scenario_desc_100, cmp_packet_edit_scenario_desc_100,
82718 NULL, NULL, NULL, free);
82719 }
82720
82721 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82722 *real_packet = *old;
82723 } else {
82724 log_packet_detailed(" no old info");
82725 memset(real_packet, 0, sizeof(*real_packet));
82726 }
82727
82728 if (BV_ISSET(fields, 0)) {
82729 log_packet_detailed(" got field 'scenario_desc'");
82730#ifdef FREECIV_JSON_CONNECTION
82731 field_addr.name = "scenario_desc";
82732#endif /* FREECIV_JSON_CONNECTION */
82733 if (!DIO_GET(string, &din, &field_addr, real_packet->scenario_desc, sizeof(real_packet->scenario_desc))) {
82734 RECEIVE_PACKET_FIELD_ERROR(scenario_desc);
82735 }
82736 }
82737
82738 if (NULL == old) {
82739 old = fc_malloc(sizeof(*old));
82740 *old = *real_packet;
82741 genhash_insert(*hash, old, old);
82742 } else {
82743 *old = *real_packet;
82744 }
82745
82746#endif /* FREECIV_DELTA_PROTOCOL */
82747 RECEIVE_PACKET_END(real_packet);
82748}
82749
82750 static int send_packet_edit_scenario_desc_100(struct connection *pc, const struct packet_edit_scenario_desc *packet)
82751{
82752 const struct packet_edit_scenario_desc *real_packet = packet;
82753 int e;
82754#ifdef FREECIV_DELTA_PROTOCOL
82755 packet_edit_scenario_desc_100_fields fields;
82756 struct packet_edit_scenario_desc *old;
82757 bool differ;
82758 struct genhash **hash = pc->phs.sent + PACKET_EDIT_SCENARIO_DESC;
82759#endif /* FREECIV_DELTA_PROTOCOL */
82760 SEND_PACKET_START(PACKET_EDIT_SCENARIO_DESC);
82761#ifdef FREECIV_JSON_CONNECTION
82762 struct plocation field_addr;
82763 {
82764 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82765 field_addr = *field_addr_tmp;
82766 FC_FREE(field_addr_tmp);
82767 }
82768#endif /* FREECIV_JSON_CONNECTION */
82769
82770 log_packet_detailed("packet_edit_scenario_desc_100: sending info about ()");
82771
82772#ifdef FREECIV_DELTA_PROTOCOL
82773 if (NULL == *hash) {
82774 *hash = genhash_new_full(hash_packet_edit_scenario_desc_100, cmp_packet_edit_scenario_desc_100,
82775 NULL, NULL, NULL, free);
82776 }
82777 BV_CLR_ALL(fields);
82778
82779 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82780 old = fc_malloc(sizeof(*old));
82781 *old = *real_packet;
82782 genhash_insert(*hash, old, old);
82783 memset(old, 0, sizeof(*old));
82784 }
82785 differ = (strcmp(old->scenario_desc, real_packet->scenario_desc) != 0);
82786 if (differ) {
82787 BV_SET(fields, 0);
82788 }
82789
82790
82791#ifdef FREECIV_JSON_CONNECTION
82792 field_addr.name = "fields";
82793#endif /* FREECIV_JSON_CONNECTION */
82794 e = 0;
82795 e |= DIO_BV_PUT(&dout, &field_addr, fields);
82796 if (e) {
82797 log_packet_detailed("fields bitvector error detected");
82798 }
82799
82800 if (BV_ISSET(fields, 0)) {
82801 log_packet_detailed(" field 'scenario_desc' has changed");
82802#ifdef FREECIV_JSON_CONNECTION
82803 field_addr.name = "scenario_desc";
82804#endif /* FREECIV_JSON_CONNECTION */
82805 e = 0;
82806 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_desc);
82807 if (e) {
82808 log_packet_detailed("'scenario_desc' field error detected");
82809 }
82810 }
82811
82812 *old = *real_packet;
82813#endif /* FREECIV_DELTA_PROTOCOL */
82814#ifndef FREECIV_DELTA_PROTOCOL
82815#ifdef FREECIV_JSON_CONNECTION
82816 field_addr.name = "scenario_desc";
82817#endif /* FREECIV_JSON_CONNECTION */
82818 e = 0;
82819 e |= DIO_PUT(string, &dout, &field_addr, real_packet->scenario_desc);
82820 if (e) {
82821 log_packet_detailed("'scenario_desc' field error detected");
82822 }
82823
82824#endif
82825 SEND_PACKET_END(PACKET_EDIT_SCENARIO_DESC);
82826}
82827
82828 int send_packet_edit_scenario_desc(struct connection *pc, const struct packet_edit_scenario_desc *packet)
82829{
82830 if (!pc->used) {
82831 log_error("WARNING: trying to send data to the closed connection %s",
82832 conn_description(pc));
82833 return -1;
82834 }
82835 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_SCENARIO_DESC].packet != NULL, -1,
82836 "Handler for PACKET_EDIT_SCENARIO_DESC not installed");
82837 return pc->phs.handlers->send[PACKET_EDIT_SCENARIO_DESC].packet(pc, packet);
82838}
82839
82840#ifdef FREECIV_DELTA_PROTOCOL
82841#define hash_packet_edit_object_created_100 hash_const
82842
82843#define cmp_packet_edit_object_created_100 cmp_const
82844
82845 BV_DEFINE(packet_edit_object_created_100_fields, 2);
82846#endif /* FREECIV_DELTA_PROTOCOL */
82847
82848 static struct packet_edit_object_created *receive_packet_edit_object_created_100(struct connection *pc)
82849{
82850#ifdef FREECIV_DELTA_PROTOCOL
82851 packet_edit_object_created_100_fields fields;
82852 struct packet_edit_object_created *old;
82853 struct genhash **hash = pc->phs.received + PACKET_EDIT_OBJECT_CREATED;
82854#endif /* FREECIV_DELTA_PROTOCOL */
82855 RECEIVE_PACKET_START(packet_edit_object_created, real_packet);
82856#ifdef FREECIV_JSON_CONNECTION
82857 struct plocation field_addr;
82858 {
82859 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82860 field_addr = *field_addr_tmp;
82861 FC_FREE(field_addr_tmp);
82862 }
82863#endif /* FREECIV_JSON_CONNECTION */
82864
82865#ifdef FREECIV_DELTA_PROTOCOL
82866#ifdef FREECIV_JSON_CONNECTION
82867 field_addr.name = "fields";
82868#endif /* FREECIV_JSON_CONNECTION */
82869 DIO_BV_GET(&din, &field_addr, fields);
82870
82871#else /* FREECIV_DELTA_PROTOCOL */
82872#ifdef FREECIV_JSON_CONNECTION
82873 field_addr.name = "tag";
82874#endif /* FREECIV_JSON_CONNECTION */
82875 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
82876 RECEIVE_PACKET_FIELD_ERROR(tag);
82877 }
82878#ifdef FREECIV_JSON_CONNECTION
82879 field_addr.name = "id";
82880#endif /* FREECIV_JSON_CONNECTION */
82881 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
82882 RECEIVE_PACKET_FIELD_ERROR(id);
82883 }
82884#endif
82885 log_packet_detailed("packet_edit_object_created_100: got info about ()");
82886
82887#ifdef FREECIV_DELTA_PROTOCOL
82888 if (NULL == *hash) {
82889 *hash = genhash_new_full(hash_packet_edit_object_created_100, cmp_packet_edit_object_created_100,
82890 NULL, NULL, NULL, free);
82891 }
82892
82893 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
82894 *real_packet = *old;
82895 } else {
82896 log_packet_detailed(" no old info");
82897 memset(real_packet, 0, sizeof(*real_packet));
82898 }
82899
82900 if (BV_ISSET(fields, 0)) {
82901 log_packet_detailed(" got field 'tag'");
82902#ifdef FREECIV_JSON_CONNECTION
82903 field_addr.name = "tag";
82904#endif /* FREECIV_JSON_CONNECTION */
82905 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->tag)) {
82906 RECEIVE_PACKET_FIELD_ERROR(tag);
82907 }
82908 }
82909 if (BV_ISSET(fields, 1)) {
82910 log_packet_detailed(" got field 'id'");
82911#ifdef FREECIV_JSON_CONNECTION
82912 field_addr.name = "id";
82913#endif /* FREECIV_JSON_CONNECTION */
82914 if (!DIO_GET(sint32, &din, &field_addr, &real_packet->id)) {
82915 RECEIVE_PACKET_FIELD_ERROR(id);
82916 }
82917 }
82918
82919 if (NULL == old) {
82920 old = fc_malloc(sizeof(*old));
82921 *old = *real_packet;
82922 genhash_insert(*hash, old, old);
82923 } else {
82924 *old = *real_packet;
82925 }
82926
82927#endif /* FREECIV_DELTA_PROTOCOL */
82928 RECEIVE_PACKET_END(real_packet);
82929}
82930
82931 static int send_packet_edit_object_created_100(struct connection *pc, const struct packet_edit_object_created *packet)
82932{
82933 const struct packet_edit_object_created *real_packet = packet;
82934 int e;
82935#ifdef FREECIV_DELTA_PROTOCOL
82936 packet_edit_object_created_100_fields fields;
82937 struct packet_edit_object_created *old;
82938 bool differ;
82939 struct genhash **hash = pc->phs.sent + PACKET_EDIT_OBJECT_CREATED;
82940#endif /* FREECIV_DELTA_PROTOCOL */
82941 SEND_PACKET_START(PACKET_EDIT_OBJECT_CREATED);
82942#ifdef FREECIV_JSON_CONNECTION
82943 struct plocation field_addr;
82944 {
82945 struct plocation *field_addr_tmp = plocation_field_new(NULL);
82946 field_addr = *field_addr_tmp;
82947 FC_FREE(field_addr_tmp);
82948 }
82949#endif /* FREECIV_JSON_CONNECTION */
82950
82951 log_packet_detailed("packet_edit_object_created_100: sending info about ()");
82952
82953#ifdef FREECIV_DELTA_PROTOCOL
82954 if (NULL == *hash) {
82955 *hash = genhash_new_full(hash_packet_edit_object_created_100, cmp_packet_edit_object_created_100,
82956 NULL, NULL, NULL, free);
82957 }
82958 BV_CLR_ALL(fields);
82959
82960 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
82961 old = fc_malloc(sizeof(*old));
82962 *old = *real_packet;
82963 genhash_insert(*hash, old, old);
82964 memset(old, 0, sizeof(*old));
82965 }
82966 differ = (old->tag != real_packet->tag);
82967 if (differ) {
82968 BV_SET(fields, 0);
82969 }
82970
82971 differ = (old->id != real_packet->id);
82972 if (differ) {
82973 BV_SET(fields, 1);
82974 }
82975
82976
82977#ifdef FREECIV_JSON_CONNECTION
82978 field_addr.name = "fields";
82979#endif /* FREECIV_JSON_CONNECTION */
82980 e = 0;
82981 e |= DIO_BV_PUT(&dout, &field_addr, fields);
82982 if (e) {
82983 log_packet_detailed("fields bitvector error detected");
82984 }
82985
82986 if (BV_ISSET(fields, 0)) {
82987 log_packet_detailed(" field 'tag' has changed");
82988#ifdef FREECIV_JSON_CONNECTION
82989 field_addr.name = "tag";
82990#endif /* FREECIV_JSON_CONNECTION */
82991 e = 0;
82992 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
82993 if (e) {
82994 log_packet_detailed("'tag' field error detected");
82995 }
82996 }
82997 if (BV_ISSET(fields, 1)) {
82998 log_packet_detailed(" field 'id' has changed");
82999#ifdef FREECIV_JSON_CONNECTION
83000 field_addr.name = "id";
83001#endif /* FREECIV_JSON_CONNECTION */
83002 e = 0;
83003 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
83004 if (e) {
83005 log_packet_detailed("'id' field error detected");
83006 }
83007 }
83008
83009 *old = *real_packet;
83010#endif /* FREECIV_DELTA_PROTOCOL */
83011#ifndef FREECIV_DELTA_PROTOCOL
83012#ifdef FREECIV_JSON_CONNECTION
83013 field_addr.name = "tag";
83014#endif /* FREECIV_JSON_CONNECTION */
83015 e = 0;
83016 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->tag);
83017 if (e) {
83018 log_packet_detailed("'tag' field error detected");
83019 }
83020#ifdef FREECIV_JSON_CONNECTION
83021 field_addr.name = "id";
83022#endif /* FREECIV_JSON_CONNECTION */
83023 e = 0;
83024 e |= DIO_PUT(sint32, &dout, &field_addr, real_packet->id);
83025 if (e) {
83026 log_packet_detailed("'id' field error detected");
83027 }
83028
83029#endif
83030 SEND_PACKET_END(PACKET_EDIT_OBJECT_CREATED);
83031}
83032
83033 int send_packet_edit_object_created(struct connection *pc, const struct packet_edit_object_created *packet)
83034{
83035 if (!pc->used) {
83036 log_error("WARNING: trying to send data to the closed connection %s",
83037 conn_description(pc));
83038 return -1;
83039 }
83040 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_EDIT_OBJECT_CREATED].packet != NULL, -1,
83041 "Handler for PACKET_EDIT_OBJECT_CREATED not installed");
83042 return pc->phs.handlers->send[PACKET_EDIT_OBJECT_CREATED].packet(pc, packet);
83043}
83044
83045 int dsend_packet_edit_object_created(struct connection *pc, int tag, int id)
83046{
83047 struct packet_edit_object_created packet, *real_packet = &packet;
83048
83049 real_packet->tag = tag;
83050 real_packet->id = id;
83051
83052 return send_packet_edit_object_created(pc, real_packet);
83053}
83054
83055#ifdef FREECIV_DELTA_PROTOCOL
83056#define hash_packet_play_music_100 hash_const
83057
83058#define cmp_packet_play_music_100 cmp_const
83059
83060 BV_DEFINE(packet_play_music_100_fields, 1);
83061#endif /* FREECIV_DELTA_PROTOCOL */
83062
83063 static struct packet_play_music *receive_packet_play_music_100(struct connection *pc)
83064{
83065#ifdef FREECIV_DELTA_PROTOCOL
83066 packet_play_music_100_fields fields;
83067 struct packet_play_music *old;
83068 struct genhash **hash = pc->phs.received + PACKET_PLAY_MUSIC;
83069#endif /* FREECIV_DELTA_PROTOCOL */
83070 RECEIVE_PACKET_START(packet_play_music, real_packet);
83071#ifdef FREECIV_JSON_CONNECTION
83072 struct plocation field_addr;
83073 {
83074 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83075 field_addr = *field_addr_tmp;
83076 FC_FREE(field_addr_tmp);
83077 }
83078#endif /* FREECIV_JSON_CONNECTION */
83079
83080#ifdef FREECIV_DELTA_PROTOCOL
83081#ifdef FREECIV_JSON_CONNECTION
83082 field_addr.name = "fields";
83083#endif /* FREECIV_JSON_CONNECTION */
83084 DIO_BV_GET(&din, &field_addr, fields);
83085
83086#else /* FREECIV_DELTA_PROTOCOL */
83087#ifdef FREECIV_JSON_CONNECTION
83088 field_addr.name = "tag";
83089#endif /* FREECIV_JSON_CONNECTION */
83090 if (!DIO_GET(string, &din, &field_addr, real_packet->tag, sizeof(real_packet->tag))) {
83091 RECEIVE_PACKET_FIELD_ERROR(tag);
83092 }
83093#endif
83094 log_packet_detailed("packet_play_music_100: got info about ()");
83095
83096#ifdef FREECIV_DELTA_PROTOCOL
83097 if (NULL == *hash) {
83098 *hash = genhash_new_full(hash_packet_play_music_100, cmp_packet_play_music_100,
83099 NULL, NULL, NULL, free);
83100 }
83101
83102 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83103 *real_packet = *old;
83104 } else {
83105 log_packet_detailed(" no old info");
83106 memset(real_packet, 0, sizeof(*real_packet));
83107 }
83108
83109 if (BV_ISSET(fields, 0)) {
83110 log_packet_detailed(" got field 'tag'");
83111#ifdef FREECIV_JSON_CONNECTION
83112 field_addr.name = "tag";
83113#endif /* FREECIV_JSON_CONNECTION */
83114 if (!DIO_GET(string, &din, &field_addr, real_packet->tag, sizeof(real_packet->tag))) {
83115 RECEIVE_PACKET_FIELD_ERROR(tag);
83116 }
83117 }
83118
83119 if (NULL == old) {
83120 old = fc_malloc(sizeof(*old));
83121 *old = *real_packet;
83122 genhash_insert(*hash, old, old);
83123 } else {
83124 *old = *real_packet;
83125 }
83126
83127#endif /* FREECIV_DELTA_PROTOCOL */
83128 RECEIVE_PACKET_END(real_packet);
83129}
83130
83131 static int send_packet_play_music_100(struct connection *pc, const struct packet_play_music *packet)
83132{
83133 const struct packet_play_music *real_packet = packet;
83134 int e;
83135#ifdef FREECIV_DELTA_PROTOCOL
83136 packet_play_music_100_fields fields;
83137 struct packet_play_music *old;
83138 bool differ;
83139 struct genhash **hash = pc->phs.sent + PACKET_PLAY_MUSIC;
83140#endif /* FREECIV_DELTA_PROTOCOL */
83141 SEND_PACKET_START(PACKET_PLAY_MUSIC);
83142#ifdef FREECIV_JSON_CONNECTION
83143 struct plocation field_addr;
83144 {
83145 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83146 field_addr = *field_addr_tmp;
83147 FC_FREE(field_addr_tmp);
83148 }
83149#endif /* FREECIV_JSON_CONNECTION */
83150
83151 log_packet_detailed("packet_play_music_100: sending info about ()");
83152
83153#ifdef FREECIV_DELTA_PROTOCOL
83154 if (NULL == *hash) {
83155 *hash = genhash_new_full(hash_packet_play_music_100, cmp_packet_play_music_100,
83156 NULL, NULL, NULL, free);
83157 }
83158 BV_CLR_ALL(fields);
83159
83160 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
83161 old = fc_malloc(sizeof(*old));
83162 *old = *real_packet;
83163 genhash_insert(*hash, old, old);
83164 memset(old, 0, sizeof(*old));
83165 }
83166 differ = (strcmp(old->tag, real_packet->tag) != 0);
83167 if (differ) {
83168 BV_SET(fields, 0);
83169 }
83170
83171
83172#ifdef FREECIV_JSON_CONNECTION
83173 field_addr.name = "fields";
83174#endif /* FREECIV_JSON_CONNECTION */
83175 e = 0;
83176 e |= DIO_BV_PUT(&dout, &field_addr, fields);
83177 if (e) {
83178 log_packet_detailed("fields bitvector error detected");
83179 }
83180
83181 if (BV_ISSET(fields, 0)) {
83182 log_packet_detailed(" field 'tag' has changed");
83183#ifdef FREECIV_JSON_CONNECTION
83184 field_addr.name = "tag";
83185#endif /* FREECIV_JSON_CONNECTION */
83186 e = 0;
83187 e |= DIO_PUT(string, &dout, &field_addr, real_packet->tag);
83188 if (e) {
83189 log_packet_detailed("'tag' field error detected");
83190 }
83191 }
83192
83193 *old = *real_packet;
83194#endif /* FREECIV_DELTA_PROTOCOL */
83195#ifndef FREECIV_DELTA_PROTOCOL
83196#ifdef FREECIV_JSON_CONNECTION
83197 field_addr.name = "tag";
83198#endif /* FREECIV_JSON_CONNECTION */
83199 e = 0;
83200 e |= DIO_PUT(string, &dout, &field_addr, real_packet->tag);
83201 if (e) {
83202 log_packet_detailed("'tag' field error detected");
83203 }
83204
83205#endif
83206 SEND_PACKET_END(PACKET_PLAY_MUSIC);
83207}
83208
83209 int send_packet_play_music(struct connection *pc, const struct packet_play_music *packet)
83210{
83211 if (!pc->used) {
83212 log_error("WARNING: trying to send data to the closed connection %s",
83213 conn_description(pc));
83214 return -1;
83215 }
83216 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_PLAY_MUSIC].packet != NULL, -1,
83217 "Handler for PACKET_PLAY_MUSIC not installed");
83218 return pc->phs.handlers->send[PACKET_PLAY_MUSIC].packet(pc, packet);
83219}
83220
83221 void lsend_packet_play_music(struct conn_list *dest, const struct packet_play_music *packet)
83222{
83223 conn_list_iterate(dest, pconn) {
83224 send_packet_play_music(pconn, packet);
83225 } conn_list_iterate_end;
83226}
83227
83228#ifdef FREECIV_DELTA_PROTOCOL
83229static genhash_val_t hash_packet_web_city_info_addition_100(const void *vkey)
83230{
83231 const struct packet_web_city_info_addition *key = (const struct packet_web_city_info_addition *) vkey;
83232 genhash_val_t result = 0;
83233
83234 result += key->id;
83235
83236 result &= 0xFFFFFFFF;
83237 return result;
83238}
83239
83240static bool cmp_packet_web_city_info_addition_100(const void *vkey1, const void *vkey2)
83241{
83242 const struct packet_web_city_info_addition *old = (const struct packet_web_city_info_addition *) vkey1;
83243 const struct packet_web_city_info_addition *real_packet = (const struct packet_web_city_info_addition *) vkey2;
83244 bool differ;
83245
83246 differ = (old->id != real_packet->id);
83247
83248 return !differ;
83249}
83250 BV_DEFINE(packet_web_city_info_addition_100_fields, 9);
83251#endif /* FREECIV_DELTA_PROTOCOL */
83252
83253 static struct packet_web_city_info_addition *receive_packet_web_city_info_addition_100(struct connection *pc)
83254{
83255#ifdef FREECIV_DELTA_PROTOCOL
83256 packet_web_city_info_addition_100_fields fields;
83257 struct packet_web_city_info_addition *old;
83258 struct genhash **hash = pc->phs.received + PACKET_WEB_CITY_INFO_ADDITION;
83259#endif /* FREECIV_DELTA_PROTOCOL */
83260 RECEIVE_PACKET_START(packet_web_city_info_addition, real_packet);
83261#ifdef FREECIV_JSON_CONNECTION
83262 struct plocation field_addr;
83263 {
83264 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83265 field_addr = *field_addr_tmp;
83266 FC_FREE(field_addr_tmp);
83267 }
83268#endif /* FREECIV_JSON_CONNECTION */
83269
83270#ifdef FREECIV_DELTA_PROTOCOL
83271#ifdef FREECIV_JSON_CONNECTION
83272 field_addr.name = "fields";
83273#endif /* FREECIV_JSON_CONNECTION */
83274 DIO_BV_GET(&din, &field_addr, fields);
83275#ifdef FREECIV_JSON_CONNECTION
83276 field_addr.name = "id";
83277#endif /* FREECIV_JSON_CONNECTION */
83278 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
83279 RECEIVE_PACKET_FIELD_ERROR(id);
83280 }
83281
83282#else /* FREECIV_DELTA_PROTOCOL */
83283#ifdef FREECIV_JSON_CONNECTION
83284 field_addr.name = "id";
83285#endif /* FREECIV_JSON_CONNECTION */
83286 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
83287 RECEIVE_PACKET_FIELD_ERROR(id);
83288 }
83289#ifdef FREECIV_JSON_CONNECTION
83290 field_addr.name = "cma_enabled";
83291#endif /* FREECIV_JSON_CONNECTION */
83292 if (!DIO_GET(bool8, &din, &field_addr, &real_packet->cma_enabled)) {
83293 RECEIVE_PACKET_FIELD_ERROR(cma_enabled);
83294 }
83295#ifdef FREECIV_JSON_CONNECTION
83296 field_addr.name = "cm_parameter";
83297#endif /* FREECIV_JSON_CONNECTION */
83298 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
83299 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
83300 }
83301#ifdef FREECIV_JSON_CONNECTION
83302 field_addr.name = "granary_size";
83303#endif /* FREECIV_JSON_CONNECTION */
83304 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
83305 RECEIVE_PACKET_FIELD_ERROR(granary_size);
83306 }
83307#ifdef FREECIV_JSON_CONNECTION
83308 field_addr.name = "granary_turns";
83309#endif /* FREECIV_JSON_CONNECTION */
83310 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
83311 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
83312 }
83313#ifdef FREECIV_JSON_CONNECTION
83314 field_addr.name = "can_build_unit";
83315#endif /* FREECIV_JSON_CONNECTION */
83316 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_unit)) {
83317 RECEIVE_PACKET_FIELD_ERROR(can_build_unit);
83318 }
83319#ifdef FREECIV_JSON_CONNECTION
83320 field_addr.name = "can_build_improvement";
83321#endif /* FREECIV_JSON_CONNECTION */
83322 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_improvement)) {
83323 RECEIVE_PACKET_FIELD_ERROR(can_build_improvement);
83324 }
83325#ifdef FREECIV_JSON_CONNECTION
83326 field_addr.name = "output_food";
83327#endif /* FREECIV_JSON_CONNECTION */
83328 {
83329 int i;
83330
83331#ifdef FREECIV_JSON_CONNECTION
83332 /* Enter array. */
83333 field_addr.sub_location = plocation_elem_new(0);
83334#endif /* FREECIV_JSON_CONNECTION */
83335
83336 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83337#ifdef FREECIV_JSON_CONNECTION
83338 field_addr.sub_location->number = i;
83339#endif /* FREECIV_JSON_CONNECTION */
83340 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_food[i])) {
83341 RECEIVE_PACKET_FIELD_ERROR(output_food);
83342 }
83343 }
83344
83345#ifdef FREECIV_JSON_CONNECTION
83346 /* Exit array. */
83347 FC_FREE(field_addr.sub_location);
83348#endif /* FREECIV_JSON_CONNECTION */
83349 }
83350#ifdef FREECIV_JSON_CONNECTION
83351 field_addr.name = "output_shield";
83352#endif /* FREECIV_JSON_CONNECTION */
83353 {
83354 int i;
83355
83356#ifdef FREECIV_JSON_CONNECTION
83357 /* Enter array. */
83358 field_addr.sub_location = plocation_elem_new(0);
83359#endif /* FREECIV_JSON_CONNECTION */
83360
83361 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83362#ifdef FREECIV_JSON_CONNECTION
83363 field_addr.sub_location->number = i;
83364#endif /* FREECIV_JSON_CONNECTION */
83365 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_shield[i])) {
83366 RECEIVE_PACKET_FIELD_ERROR(output_shield);
83367 }
83368 }
83369
83370#ifdef FREECIV_JSON_CONNECTION
83371 /* Exit array. */
83372 FC_FREE(field_addr.sub_location);
83373#endif /* FREECIV_JSON_CONNECTION */
83374 }
83375#ifdef FREECIV_JSON_CONNECTION
83376 field_addr.name = "output_trade";
83377#endif /* FREECIV_JSON_CONNECTION */
83378 {
83379 int i;
83380
83381#ifdef FREECIV_JSON_CONNECTION
83382 /* Enter array. */
83383 field_addr.sub_location = plocation_elem_new(0);
83384#endif /* FREECIV_JSON_CONNECTION */
83385
83386 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83387#ifdef FREECIV_JSON_CONNECTION
83388 field_addr.sub_location->number = i;
83389#endif /* FREECIV_JSON_CONNECTION */
83390 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_trade[i])) {
83391 RECEIVE_PACKET_FIELD_ERROR(output_trade);
83392 }
83393 }
83394
83395#ifdef FREECIV_JSON_CONNECTION
83396 /* Exit array. */
83397 FC_FREE(field_addr.sub_location);
83398#endif /* FREECIV_JSON_CONNECTION */
83399 }
83400#endif
83401 log_packet_detailed("packet_web_city_info_addition_100: got info about (%d)",
83402 real_packet->id);
83403
83404#ifdef FREECIV_DELTA_PROTOCOL
83405 if (NULL == *hash) {
83406 *hash = genhash_new_full(hash_packet_web_city_info_addition_100, cmp_packet_web_city_info_addition_100,
83407 NULL, NULL, NULL, free);
83408 }
83409
83410 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
83411 *real_packet = *old;
83412 } else {
83413 int id;
83414
83415 id = real_packet->id;
83416
83417 log_packet_detailed(" no old info");
83418 memset(real_packet, 0, sizeof(*real_packet));
83419
83420 real_packet->id = id;
83421 }
83422
83423 real_packet->cma_enabled = BV_ISSET(fields, 0);
83424 if (BV_ISSET(fields, 1)) {
83425 log_packet_detailed(" got field 'cm_parameter'");
83426#ifdef FREECIV_JSON_CONNECTION
83427 field_addr.name = "cm_parameter";
83428#endif /* FREECIV_JSON_CONNECTION */
83429 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
83430 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
83431 }
83432 }
83433 if (BV_ISSET(fields, 2)) {
83434 log_packet_detailed(" got field 'granary_size'");
83435#ifdef FREECIV_JSON_CONNECTION
83436 field_addr.name = "granary_size";
83437#endif /* FREECIV_JSON_CONNECTION */
83438 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->granary_size)) {
83439 RECEIVE_PACKET_FIELD_ERROR(granary_size);
83440 }
83441 }
83442 if (BV_ISSET(fields, 3)) {
83443 log_packet_detailed(" got field 'granary_turns'");
83444#ifdef FREECIV_JSON_CONNECTION
83445 field_addr.name = "granary_turns";
83446#endif /* FREECIV_JSON_CONNECTION */
83447 if (!DIO_GET(sint16, &din, &field_addr, &real_packet->granary_turns)) {
83448 RECEIVE_PACKET_FIELD_ERROR(granary_turns);
83449 }
83450 }
83451 if (BV_ISSET(fields, 4)) {
83452 log_packet_detailed(" got field 'can_build_unit'");
83453#ifdef FREECIV_JSON_CONNECTION
83454 field_addr.name = "can_build_unit";
83455#endif /* FREECIV_JSON_CONNECTION */
83456 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_unit)) {
83457 RECEIVE_PACKET_FIELD_ERROR(can_build_unit);
83458 }
83459 }
83460 if (BV_ISSET(fields, 5)) {
83461 log_packet_detailed(" got field 'can_build_improvement'");
83462#ifdef FREECIV_JSON_CONNECTION
83463 field_addr.name = "can_build_improvement";
83464#endif /* FREECIV_JSON_CONNECTION */
83465 if (!DIO_BV_GET(&din, &field_addr, real_packet->can_build_improvement)) {
83466 RECEIVE_PACKET_FIELD_ERROR(can_build_improvement);
83467 }
83468 }
83469 if (BV_ISSET(fields, 6)) {
83470 log_packet_detailed(" got field 'output_food'");
83471#ifdef FREECIV_JSON_CONNECTION
83472 field_addr.name = "output_food";
83473#endif /* FREECIV_JSON_CONNECTION */
83474 {
83475 int i;
83476
83477#ifdef FREECIV_JSON_CONNECTION
83478 /* Enter array. */
83479 field_addr.sub_location = plocation_elem_new(0);
83480#endif /* FREECIV_JSON_CONNECTION */
83481
83482 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83483#ifdef FREECIV_JSON_CONNECTION
83484 field_addr.sub_location->number = i;
83485#endif /* FREECIV_JSON_CONNECTION */
83486 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_food[i])) {
83487 RECEIVE_PACKET_FIELD_ERROR(output_food);
83488 }
83489 }
83490
83491#ifdef FREECIV_JSON_CONNECTION
83492 /* Exit array. */
83493 FC_FREE(field_addr.sub_location);
83494#endif /* FREECIV_JSON_CONNECTION */
83495 }
83496 }
83497 if (BV_ISSET(fields, 7)) {
83498 log_packet_detailed(" got field 'output_shield'");
83499#ifdef FREECIV_JSON_CONNECTION
83500 field_addr.name = "output_shield";
83501#endif /* FREECIV_JSON_CONNECTION */
83502 {
83503 int i;
83504
83505#ifdef FREECIV_JSON_CONNECTION
83506 /* Enter array. */
83507 field_addr.sub_location = plocation_elem_new(0);
83508#endif /* FREECIV_JSON_CONNECTION */
83509
83510 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83511#ifdef FREECIV_JSON_CONNECTION
83512 field_addr.sub_location->number = i;
83513#endif /* FREECIV_JSON_CONNECTION */
83514 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_shield[i])) {
83515 RECEIVE_PACKET_FIELD_ERROR(output_shield);
83516 }
83517 }
83518
83519#ifdef FREECIV_JSON_CONNECTION
83520 /* Exit array. */
83521 FC_FREE(field_addr.sub_location);
83522#endif /* FREECIV_JSON_CONNECTION */
83523 }
83524 }
83525 if (BV_ISSET(fields, 8)) {
83526 log_packet_detailed(" got field 'output_trade'");
83527#ifdef FREECIV_JSON_CONNECTION
83528 field_addr.name = "output_trade";
83529#endif /* FREECIV_JSON_CONNECTION */
83530 {
83531 int i;
83532
83533#ifdef FREECIV_JSON_CONNECTION
83534 /* Enter array. */
83535 field_addr.sub_location = plocation_elem_new(0);
83536#endif /* FREECIV_JSON_CONNECTION */
83537
83538 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83539#ifdef FREECIV_JSON_CONNECTION
83540 field_addr.sub_location->number = i;
83541#endif /* FREECIV_JSON_CONNECTION */
83542 if (!DIO_GET(uint8, &din, &field_addr, &real_packet->output_trade[i])) {
83543 RECEIVE_PACKET_FIELD_ERROR(output_trade);
83544 }
83545 }
83546
83547#ifdef FREECIV_JSON_CONNECTION
83548 /* Exit array. */
83549 FC_FREE(field_addr.sub_location);
83550#endif /* FREECIV_JSON_CONNECTION */
83551 }
83552 }
83553
83554 if (NULL == old) {
83555 old = fc_malloc(sizeof(*old));
83556 *old = *real_packet;
83557 genhash_insert(*hash, old, old);
83558 } else {
83559 *old = *real_packet;
83560 }
83561
83562 hash = pc->phs.received + PACKET_CITY_SHORT_INFO;
83563 if (NULL != *hash) {
83564 genhash_remove(*hash, real_packet);
83565 }
83566
83567#endif /* FREECIV_DELTA_PROTOCOL */
83568 RECEIVE_PACKET_END(real_packet);
83569}
83570
83571 static int send_packet_web_city_info_addition_100(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
83572{
83573 const struct packet_web_city_info_addition *real_packet = packet;
83574 int e;
83575#ifdef FREECIV_DELTA_PROTOCOL
83576 packet_web_city_info_addition_100_fields fields;
83577 struct packet_web_city_info_addition *old;
83578 bool differ;
83579 struct genhash **hash = pc->phs.sent + PACKET_WEB_CITY_INFO_ADDITION;
83580 int different = force_to_send;
83581#endif /* FREECIV_DELTA_PROTOCOL */
83582 SEND_PACKET_START(PACKET_WEB_CITY_INFO_ADDITION);
83583#ifdef FREECIV_JSON_CONNECTION
83584 struct plocation field_addr;
83585 {
83586 struct plocation *field_addr_tmp = plocation_field_new(NULL);
83587 field_addr = *field_addr_tmp;
83588 FC_FREE(field_addr_tmp);
83589 }
83590#endif /* FREECIV_JSON_CONNECTION */
83591
83592 log_packet_detailed("packet_web_city_info_addition_100: sending info about (%d)",
83593 real_packet->id);
83594
83595#ifdef FREECIV_DELTA_PROTOCOL
83596 if (NULL == *hash) {
83597 *hash = genhash_new_full(hash_packet_web_city_info_addition_100, cmp_packet_web_city_info_addition_100,
83598 NULL, NULL, NULL, free);
83599 }
83600 BV_CLR_ALL(fields);
83601
83602 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
83603 old = fc_malloc(sizeof(*old));
83604 *old = *real_packet;
83605 genhash_insert(*hash, old, old);
83606 memset(old, 0, sizeof(*old));
83607 different = 1; /* Force to send. */
83608 }
83609 differ = (old->cma_enabled != real_packet->cma_enabled);
83610 if (differ) {
83611 different++;
83612 }
83613 if (packet->cma_enabled) {
83614 BV_SET(fields, 0);
83615 }
83616
83617 differ = !cm_are_parameter_equal(&old->cm_parameter, &real_packet->cm_parameter);
83618 if (differ) {
83619 different++;
83620 BV_SET(fields, 1);
83621 }
83622
83623 differ = (old->granary_size != real_packet->granary_size);
83624 if (differ) {
83625 different++;
83626 BV_SET(fields, 2);
83627 }
83628
83629 differ = (old->granary_turns != real_packet->granary_turns);
83630 if (differ) {
83631 different++;
83632 BV_SET(fields, 3);
83633 }
83634
83635 differ = !BV_ARE_EQUAL(old->can_build_unit, real_packet->can_build_unit);
83636 if (differ) {
83637 different++;
83638 BV_SET(fields, 4);
83639 }
83640
83641 differ = !BV_ARE_EQUAL(old->can_build_improvement, real_packet->can_build_improvement);
83642 if (differ) {
83643 different++;
83644 BV_SET(fields, 5);
83645 }
83646
83647 differ = FALSE;
83648 {
83649 int i;
83650
83651 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83652 differ = (old->output_food[i] != real_packet->output_food[i]);
83653 if (differ) {
83654 break;
83655 }
83656 }
83657 }
83658 if (differ) {
83659 different++;
83660 BV_SET(fields, 6);
83661 }
83662
83663 differ = FALSE;
83664 {
83665 int i;
83666
83667 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83668 differ = (old->output_shield[i] != real_packet->output_shield[i]);
83669 if (differ) {
83670 break;
83671 }
83672 }
83673 }
83674 if (differ) {
83675 different++;
83676 BV_SET(fields, 7);
83677 }
83678
83679 differ = FALSE;
83680 {
83681 int i;
83682
83683 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83684 differ = (old->output_trade[i] != real_packet->output_trade[i]);
83685 if (differ) {
83686 break;
83687 }
83688 }
83689 }
83690 if (differ) {
83691 different++;
83692 BV_SET(fields, 8);
83693 }
83694
83695 if (different == 0) {
83696 log_packet_detailed(" no change -> discard");
83697 return 0;
83698 }
83699
83700#ifdef FREECIV_JSON_CONNECTION
83701 field_addr.name = "fields";
83702#endif /* FREECIV_JSON_CONNECTION */
83703 e = 0;
83704 e |= DIO_BV_PUT(&dout, &field_addr, fields);
83705 if (e) {
83706 log_packet_detailed("fields bitvector error detected");
83707 }
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
83717 /* field 0 is folded into the header */
83718 if (BV_ISSET(fields, 1)) {
83719 log_packet_detailed(" field 'cm_parameter' has changed");
83720#ifdef FREECIV_JSON_CONNECTION
83721 field_addr.name = "cm_parameter";
83722#endif /* FREECIV_JSON_CONNECTION */
83723 e = 0;
83724 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
83725 if (e) {
83726 log_packet_detailed("'cm_parameter' field error detected");
83727 }
83728 }
83729 if (BV_ISSET(fields, 2)) {
83730 log_packet_detailed(" field 'granary_size' has changed");
83731#ifdef FREECIV_JSON_CONNECTION
83732 field_addr.name = "granary_size";
83733#endif /* FREECIV_JSON_CONNECTION */
83734 e = 0;
83735 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
83736 if (e) {
83737 log_packet_detailed("'granary_size' field error detected");
83738 }
83739 }
83740 if (BV_ISSET(fields, 3)) {
83741 log_packet_detailed(" field 'granary_turns' has changed");
83742#ifdef FREECIV_JSON_CONNECTION
83743 field_addr.name = "granary_turns";
83744#endif /* FREECIV_JSON_CONNECTION */
83745 e = 0;
83746 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
83747 if (e) {
83748 log_packet_detailed("'granary_turns' field error detected");
83749 }
83750 }
83751 if (BV_ISSET(fields, 4)) {
83752 log_packet_detailed(" field 'can_build_unit' has changed");
83753#ifdef FREECIV_JSON_CONNECTION
83754 field_addr.name = "can_build_unit";
83755#endif /* FREECIV_JSON_CONNECTION */
83756 e = 0;
83757 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_unit);
83758 if (e) {
83759 log_packet_detailed("'can_build_unit' field error detected");
83760 }
83761 }
83762 if (BV_ISSET(fields, 5)) {
83763 log_packet_detailed(" field 'can_build_improvement' has changed");
83764#ifdef FREECIV_JSON_CONNECTION
83765 field_addr.name = "can_build_improvement";
83766#endif /* FREECIV_JSON_CONNECTION */
83767 e = 0;
83768 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_improvement);
83769 if (e) {
83770 log_packet_detailed("'can_build_improvement' field error detected");
83771 }
83772 }
83773 if (BV_ISSET(fields, 6)) {
83774 log_packet_detailed(" field 'output_food' has changed");
83775#ifdef FREECIV_JSON_CONNECTION
83776 field_addr.name = "output_food";
83777#endif /* FREECIV_JSON_CONNECTION */
83778 e = 0;
83779 {
83780 int i;
83781
83782#ifdef FREECIV_JSON_CONNECTION
83783 /* Create the array. */
83784 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
83785
83786 /* Enter the array. */
83787 field_addr.sub_location = plocation_elem_new(0);
83788#endif /* FREECIV_JSON_CONNECTION */
83789
83790 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83791#ifdef FREECIV_JSON_CONNECTION
83792 /* Next array element. */
83793 field_addr.sub_location->number = i;
83794#endif /* FREECIV_JSON_CONNECTION */
83795 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_food[i]);
83796 }
83797
83798#ifdef FREECIV_JSON_CONNECTION
83799 /* Exit array. */
83800 FC_FREE(field_addr.sub_location);
83801#endif /* FREECIV_JSON_CONNECTION */
83802 }
83803 if (e) {
83804 log_packet_detailed("'output_food' field error detected");
83805 }
83806 }
83807 if (BV_ISSET(fields, 7)) {
83808 log_packet_detailed(" field 'output_shield' has changed");
83809#ifdef FREECIV_JSON_CONNECTION
83810 field_addr.name = "output_shield";
83811#endif /* FREECIV_JSON_CONNECTION */
83812 e = 0;
83813 {
83814 int i;
83815
83816#ifdef FREECIV_JSON_CONNECTION
83817 /* Create the array. */
83818 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
83819
83820 /* Enter the array. */
83821 field_addr.sub_location = plocation_elem_new(0);
83822#endif /* FREECIV_JSON_CONNECTION */
83823
83824 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83825#ifdef FREECIV_JSON_CONNECTION
83826 /* Next array element. */
83827 field_addr.sub_location->number = i;
83828#endif /* FREECIV_JSON_CONNECTION */
83829 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_shield[i]);
83830 }
83831
83832#ifdef FREECIV_JSON_CONNECTION
83833 /* Exit array. */
83834 FC_FREE(field_addr.sub_location);
83835#endif /* FREECIV_JSON_CONNECTION */
83836 }
83837 if (e) {
83838 log_packet_detailed("'output_shield' field error detected");
83839 }
83840 }
83841 if (BV_ISSET(fields, 8)) {
83842 log_packet_detailed(" field 'output_trade' has changed");
83843#ifdef FREECIV_JSON_CONNECTION
83844 field_addr.name = "output_trade";
83845#endif /* FREECIV_JSON_CONNECTION */
83846 e = 0;
83847 {
83848 int i;
83849
83850#ifdef FREECIV_JSON_CONNECTION
83851 /* Create the array. */
83852 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
83853
83854 /* Enter the array. */
83855 field_addr.sub_location = plocation_elem_new(0);
83856#endif /* FREECIV_JSON_CONNECTION */
83857
83858 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83859#ifdef FREECIV_JSON_CONNECTION
83860 /* Next array element. */
83861 field_addr.sub_location->number = i;
83862#endif /* FREECIV_JSON_CONNECTION */
83863 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_trade[i]);
83864 }
83865
83866#ifdef FREECIV_JSON_CONNECTION
83867 /* Exit array. */
83868 FC_FREE(field_addr.sub_location);
83869#endif /* FREECIV_JSON_CONNECTION */
83870 }
83871 if (e) {
83872 log_packet_detailed("'output_trade' field error detected");
83873 }
83874 }
83875
83876 *old = *real_packet;
83877
83878 hash = pc->phs.sent + PACKET_CITY_SHORT_INFO;
83879 if (NULL != *hash) {
83880 genhash_remove(*hash, real_packet);
83881 }
83882#endif /* FREECIV_DELTA_PROTOCOL */
83883#ifndef FREECIV_DELTA_PROTOCOL
83884#ifdef FREECIV_JSON_CONNECTION
83885 field_addr.name = "id";
83886#endif /* FREECIV_JSON_CONNECTION */
83887 e = 0;
83888 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
83889 if (e) {
83890 log_packet_detailed("'id' field error detected");
83891 }
83892#ifdef FREECIV_JSON_CONNECTION
83893 field_addr.name = "cma_enabled";
83894#endif /* FREECIV_JSON_CONNECTION */
83895 e = 0;
83896 e |= DIO_PUT(bool8, &dout, &field_addr, real_packet->cma_enabled);
83897 if (e) {
83898 log_packet_detailed("'cma_enabled' field error detected");
83899 }
83900#ifdef FREECIV_JSON_CONNECTION
83901 field_addr.name = "cm_parameter";
83902#endif /* FREECIV_JSON_CONNECTION */
83903 e = 0;
83904 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
83905 if (e) {
83906 log_packet_detailed("'cm_parameter' field error detected");
83907 }
83908#ifdef FREECIV_JSON_CONNECTION
83909 field_addr.name = "granary_size";
83910#endif /* FREECIV_JSON_CONNECTION */
83911 e = 0;
83912 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->granary_size);
83913 if (e) {
83914 log_packet_detailed("'granary_size' field error detected");
83915 }
83916#ifdef FREECIV_JSON_CONNECTION
83917 field_addr.name = "granary_turns";
83918#endif /* FREECIV_JSON_CONNECTION */
83919 e = 0;
83920 e |= DIO_PUT(sint16, &dout, &field_addr, real_packet->granary_turns);
83921 if (e) {
83922 log_packet_detailed("'granary_turns' field error detected");
83923 }
83924#ifdef FREECIV_JSON_CONNECTION
83925 field_addr.name = "can_build_unit";
83926#endif /* FREECIV_JSON_CONNECTION */
83927 e = 0;
83928 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_unit);
83929 if (e) {
83930 log_packet_detailed("'can_build_unit' field error detected");
83931 }
83932#ifdef FREECIV_JSON_CONNECTION
83933 field_addr.name = "can_build_improvement";
83934#endif /* FREECIV_JSON_CONNECTION */
83935 e = 0;
83936 e |= DIO_BV_PUT(&dout, &field_addr, packet->can_build_improvement);
83937 if (e) {
83938 log_packet_detailed("'can_build_improvement' field error detected");
83939 }
83940#ifdef FREECIV_JSON_CONNECTION
83941 field_addr.name = "output_food";
83942#endif /* FREECIV_JSON_CONNECTION */
83943 e = 0;
83944 {
83945 int i;
83946
83947#ifdef FREECIV_JSON_CONNECTION
83948 /* Create the array. */
83949 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
83950
83951 /* Enter the array. */
83952 field_addr.sub_location = plocation_elem_new(0);
83953#endif /* FREECIV_JSON_CONNECTION */
83954
83955 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83956#ifdef FREECIV_JSON_CONNECTION
83957 /* Next array element. */
83958 field_addr.sub_location->number = i;
83959#endif /* FREECIV_JSON_CONNECTION */
83960 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_food[i]);
83961 }
83962
83963#ifdef FREECIV_JSON_CONNECTION
83964 /* Exit array. */
83965 FC_FREE(field_addr.sub_location);
83966#endif /* FREECIV_JSON_CONNECTION */
83967 }
83968 if (e) {
83969 log_packet_detailed("'output_food' field error detected");
83970 }
83971#ifdef FREECIV_JSON_CONNECTION
83972 field_addr.name = "output_shield";
83973#endif /* FREECIV_JSON_CONNECTION */
83974 e = 0;
83975 {
83976 int i;
83977
83978#ifdef FREECIV_JSON_CONNECTION
83979 /* Create the array. */
83980 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
83981
83982 /* Enter the array. */
83983 field_addr.sub_location = plocation_elem_new(0);
83984#endif /* FREECIV_JSON_CONNECTION */
83985
83986 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
83987#ifdef FREECIV_JSON_CONNECTION
83988 /* Next array element. */
83989 field_addr.sub_location->number = i;
83990#endif /* FREECIV_JSON_CONNECTION */
83991 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_shield[i]);
83992 }
83993
83994#ifdef FREECIV_JSON_CONNECTION
83995 /* Exit array. */
83996 FC_FREE(field_addr.sub_location);
83997#endif /* FREECIV_JSON_CONNECTION */
83998 }
83999 if (e) {
84000 log_packet_detailed("'output_shield' field error detected");
84001 }
84002#ifdef FREECIV_JSON_CONNECTION
84003 field_addr.name = "output_trade";
84004#endif /* FREECIV_JSON_CONNECTION */
84005 e = 0;
84006 {
84007 int i;
84008
84009#ifdef FREECIV_JSON_CONNECTION
84010 /* Create the array. */
84011 e |= DIO_PUT(farray, &dout, &field_addr, MAX_CITY_TILES + 1);
84012
84013 /* Enter the array. */
84014 field_addr.sub_location = plocation_elem_new(0);
84015#endif /* FREECIV_JSON_CONNECTION */
84016
84017 for (i = 0; i < MAX_CITY_TILES + 1; i++) {
84018#ifdef FREECIV_JSON_CONNECTION
84019 /* Next array element. */
84020 field_addr.sub_location->number = i;
84021#endif /* FREECIV_JSON_CONNECTION */
84022 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->output_trade[i]);
84023 }
84024
84025#ifdef FREECIV_JSON_CONNECTION
84026 /* Exit array. */
84027 FC_FREE(field_addr.sub_location);
84028#endif /* FREECIV_JSON_CONNECTION */
84029 }
84030 if (e) {
84031 log_packet_detailed("'output_trade' field error detected");
84032 }
84033
84034#endif
84035 SEND_PACKET_END(PACKET_WEB_CITY_INFO_ADDITION);
84036}
84037
84038 int send_packet_web_city_info_addition(struct connection *pc, const struct packet_web_city_info_addition *packet, bool force_to_send)
84039{
84040 if (!pc->used) {
84041 log_error("WARNING: trying to send data to the closed connection %s",
84042 conn_description(pc));
84043 return -1;
84044 }
84045 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send != NULL, -1,
84046 "Handler for PACKET_WEB_CITY_INFO_ADDITION not installed");
84047 return pc->phs.handlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send(pc, packet, force_to_send);
84048}
84049
84050 void lsend_packet_web_city_info_addition(struct conn_list *dest, const struct packet_web_city_info_addition *packet, bool force_to_send)
84051{
84052 conn_list_iterate(dest, pconn) {
84053 send_packet_web_city_info_addition(pconn, packet, force_to_send);
84054 } conn_list_iterate_end;
84055}
84056
84057#ifdef FREECIV_DELTA_PROTOCOL
84058static genhash_val_t hash_packet_web_cma_set_100(const void *vkey)
84059{
84060 const struct packet_web_cma_set *key = (const struct packet_web_cma_set *) vkey;
84061 genhash_val_t result = 0;
84062
84063 result += key->id;
84064
84065 result &= 0xFFFFFFFF;
84066 return result;
84067}
84068
84069static bool cmp_packet_web_cma_set_100(const void *vkey1, const void *vkey2)
84070{
84071 const struct packet_web_cma_set *old = (const struct packet_web_cma_set *) vkey1;
84072 const struct packet_web_cma_set *real_packet = (const struct packet_web_cma_set *) vkey2;
84073 bool differ;
84074
84075 differ = (old->id != real_packet->id);
84076
84077 return !differ;
84078}
84079 BV_DEFINE(packet_web_cma_set_100_fields, 1);
84080#endif /* FREECIV_DELTA_PROTOCOL */
84081
84082 static struct packet_web_cma_set *receive_packet_web_cma_set_100(struct connection *pc)
84083{
84084#ifdef FREECIV_DELTA_PROTOCOL
84085 packet_web_cma_set_100_fields fields;
84086 struct packet_web_cma_set *old;
84087 struct genhash **hash = pc->phs.received + PACKET_WEB_CMA_SET;
84088#endif /* FREECIV_DELTA_PROTOCOL */
84089 RECEIVE_PACKET_START(packet_web_cma_set, real_packet);
84090#ifdef FREECIV_JSON_CONNECTION
84091 struct plocation field_addr;
84092 {
84093 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84094 field_addr = *field_addr_tmp;
84095 FC_FREE(field_addr_tmp);
84096 }
84097#endif /* FREECIV_JSON_CONNECTION */
84098
84099#ifdef FREECIV_DELTA_PROTOCOL
84100#ifdef FREECIV_JSON_CONNECTION
84101 field_addr.name = "fields";
84102#endif /* FREECIV_JSON_CONNECTION */
84103 DIO_BV_GET(&din, &field_addr, fields);
84104#ifdef FREECIV_JSON_CONNECTION
84105 field_addr.name = "id";
84106#endif /* FREECIV_JSON_CONNECTION */
84107 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84108 RECEIVE_PACKET_FIELD_ERROR(id);
84109 }
84110
84111#else /* FREECIV_DELTA_PROTOCOL */
84112#ifdef FREECIV_JSON_CONNECTION
84113 field_addr.name = "id";
84114#endif /* FREECIV_JSON_CONNECTION */
84115 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84116 RECEIVE_PACKET_FIELD_ERROR(id);
84117 }
84118#ifdef FREECIV_JSON_CONNECTION
84119 field_addr.name = "cm_parameter";
84120#endif /* FREECIV_JSON_CONNECTION */
84121 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
84122 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
84123 }
84124#endif
84125 log_packet_detailed("packet_web_cma_set_100: got info about (%d)",
84126 real_packet->id);
84127
84128#ifdef FREECIV_DELTA_PROTOCOL
84129 if (NULL == *hash) {
84130 *hash = genhash_new_full(hash_packet_web_cma_set_100, cmp_packet_web_cma_set_100,
84131 NULL, NULL, NULL, free);
84132 }
84133
84134 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84135 *real_packet = *old;
84136 } else {
84137 int id;
84138
84139 id = real_packet->id;
84140
84141 log_packet_detailed(" no old info");
84142 memset(real_packet, 0, sizeof(*real_packet));
84143
84144 real_packet->id = id;
84145 }
84146
84147 if (BV_ISSET(fields, 0)) {
84148 log_packet_detailed(" got field 'cm_parameter'");
84149#ifdef FREECIV_JSON_CONNECTION
84150 field_addr.name = "cm_parameter";
84151#endif /* FREECIV_JSON_CONNECTION */
84152 if (!DIO_GET(cm_parameter, &din, &field_addr, &real_packet->cm_parameter)) {
84153 RECEIVE_PACKET_FIELD_ERROR(cm_parameter);
84154 }
84155 }
84156
84157 if (NULL == old) {
84158 old = fc_malloc(sizeof(*old));
84159 *old = *real_packet;
84160 genhash_insert(*hash, old, old);
84161 } else {
84162 *old = *real_packet;
84163 }
84164
84165#endif /* FREECIV_DELTA_PROTOCOL */
84166 RECEIVE_PACKET_END(real_packet);
84167}
84168
84169 static int send_packet_web_cma_set_100(struct connection *pc, const struct packet_web_cma_set *packet)
84170{
84171 const struct packet_web_cma_set *real_packet = packet;
84172 int e;
84173#ifdef FREECIV_DELTA_PROTOCOL
84174 packet_web_cma_set_100_fields fields;
84175 struct packet_web_cma_set *old;
84176 bool differ;
84177 struct genhash **hash = pc->phs.sent + PACKET_WEB_CMA_SET;
84178#endif /* FREECIV_DELTA_PROTOCOL */
84179 SEND_PACKET_START(PACKET_WEB_CMA_SET);
84180#ifdef FREECIV_JSON_CONNECTION
84181 struct plocation field_addr;
84182 {
84183 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84184 field_addr = *field_addr_tmp;
84185 FC_FREE(field_addr_tmp);
84186 }
84187#endif /* FREECIV_JSON_CONNECTION */
84188
84189 log_packet_detailed("packet_web_cma_set_100: sending info about (%d)",
84190 real_packet->id);
84191
84192#ifdef FREECIV_DELTA_PROTOCOL
84193 if (NULL == *hash) {
84194 *hash = genhash_new_full(hash_packet_web_cma_set_100, cmp_packet_web_cma_set_100,
84195 NULL, NULL, NULL, free);
84196 }
84197 BV_CLR_ALL(fields);
84198
84199 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84200 old = fc_malloc(sizeof(*old));
84201 *old = *real_packet;
84202 genhash_insert(*hash, old, old);
84203 memset(old, 0, sizeof(*old));
84204 }
84205 differ = !cm_are_parameter_equal(&old->cm_parameter, &real_packet->cm_parameter);
84206 if (differ) {
84207 BV_SET(fields, 0);
84208 }
84209
84210
84211#ifdef FREECIV_JSON_CONNECTION
84212 field_addr.name = "fields";
84213#endif /* FREECIV_JSON_CONNECTION */
84214 e = 0;
84215 e |= DIO_BV_PUT(&dout, &field_addr, fields);
84216 if (e) {
84217 log_packet_detailed("fields bitvector error detected");
84218 }
84219#ifdef FREECIV_JSON_CONNECTION
84220 field_addr.name = "id";
84221#endif /* FREECIV_JSON_CONNECTION */
84222 e = 0;
84223 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
84224 if (e) {
84225 log_packet_detailed("'id' field error detected");
84226 }
84227
84228 if (BV_ISSET(fields, 0)) {
84229 log_packet_detailed(" field 'cm_parameter' has changed");
84230#ifdef FREECIV_JSON_CONNECTION
84231 field_addr.name = "cm_parameter";
84232#endif /* FREECIV_JSON_CONNECTION */
84233 e = 0;
84234 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
84235 if (e) {
84236 log_packet_detailed("'cm_parameter' field error detected");
84237 }
84238 }
84239
84240 *old = *real_packet;
84241#endif /* FREECIV_DELTA_PROTOCOL */
84242#ifndef FREECIV_DELTA_PROTOCOL
84243#ifdef FREECIV_JSON_CONNECTION
84244 field_addr.name = "id";
84245#endif /* FREECIV_JSON_CONNECTION */
84246 e = 0;
84247 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
84248 if (e) {
84249 log_packet_detailed("'id' field error detected");
84250 }
84251#ifdef FREECIV_JSON_CONNECTION
84252 field_addr.name = "cm_parameter";
84253#endif /* FREECIV_JSON_CONNECTION */
84254 e = 0;
84255 e |= DIO_PUT(cm_parameter, &dout, &field_addr, &real_packet->cm_parameter);
84256 if (e) {
84257 log_packet_detailed("'cm_parameter' field error detected");
84258 }
84259
84260#endif
84261 SEND_PACKET_END(PACKET_WEB_CMA_SET);
84262}
84263
84264 int send_packet_web_cma_set(struct connection *pc, const struct packet_web_cma_set *packet)
84265{
84266 if (!pc->used) {
84267 log_error("WARNING: trying to send data to the closed connection %s",
84268 conn_description(pc));
84269 return -1;
84270 }
84271 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_CMA_SET].packet != NULL, -1,
84272 "Handler for PACKET_WEB_CMA_SET not installed");
84273 return pc->phs.handlers->send[PACKET_WEB_CMA_SET].packet(pc, packet);
84274}
84275
84276#ifdef FREECIV_DELTA_PROTOCOL
84277#define hash_packet_web_cma_clear_100 hash_const
84278
84279#define cmp_packet_web_cma_clear_100 cmp_const
84280
84281 BV_DEFINE(packet_web_cma_clear_100_fields, 1);
84282#endif /* FREECIV_DELTA_PROTOCOL */
84283
84284 static struct packet_web_cma_clear *receive_packet_web_cma_clear_100(struct connection *pc)
84285{
84286#ifdef FREECIV_DELTA_PROTOCOL
84287 packet_web_cma_clear_100_fields fields;
84288 struct packet_web_cma_clear *old;
84289 struct genhash **hash = pc->phs.received + PACKET_WEB_CMA_CLEAR;
84290#endif /* FREECIV_DELTA_PROTOCOL */
84291 RECEIVE_PACKET_START(packet_web_cma_clear, real_packet);
84292#ifdef FREECIV_JSON_CONNECTION
84293 struct plocation field_addr;
84294 {
84295 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84296 field_addr = *field_addr_tmp;
84297 FC_FREE(field_addr_tmp);
84298 }
84299#endif /* FREECIV_JSON_CONNECTION */
84300
84301#ifdef FREECIV_DELTA_PROTOCOL
84302#ifdef FREECIV_JSON_CONNECTION
84303 field_addr.name = "fields";
84304#endif /* FREECIV_JSON_CONNECTION */
84305 DIO_BV_GET(&din, &field_addr, fields);
84306
84307#else /* FREECIV_DELTA_PROTOCOL */
84308#ifdef FREECIV_JSON_CONNECTION
84309 field_addr.name = "id";
84310#endif /* FREECIV_JSON_CONNECTION */
84311 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84312 RECEIVE_PACKET_FIELD_ERROR(id);
84313 }
84314#endif
84315 log_packet_detailed("packet_web_cma_clear_100: got info about ()");
84316
84317#ifdef FREECIV_DELTA_PROTOCOL
84318 if (NULL == *hash) {
84319 *hash = genhash_new_full(hash_packet_web_cma_clear_100, cmp_packet_web_cma_clear_100,
84320 NULL, NULL, NULL, free);
84321 }
84322
84323 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84324 *real_packet = *old;
84325 } else {
84326 log_packet_detailed(" no old info");
84327 memset(real_packet, 0, sizeof(*real_packet));
84328 }
84329
84330 if (BV_ISSET(fields, 0)) {
84331 log_packet_detailed(" got field 'id'");
84332#ifdef FREECIV_JSON_CONNECTION
84333 field_addr.name = "id";
84334#endif /* FREECIV_JSON_CONNECTION */
84335 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->id)) {
84336 RECEIVE_PACKET_FIELD_ERROR(id);
84337 }
84338 }
84339
84340 if (NULL == old) {
84341 old = fc_malloc(sizeof(*old));
84342 *old = *real_packet;
84343 genhash_insert(*hash, old, old);
84344 } else {
84345 *old = *real_packet;
84346 }
84347
84348#endif /* FREECIV_DELTA_PROTOCOL */
84349 RECEIVE_PACKET_END(real_packet);
84350}
84351
84352 static int send_packet_web_cma_clear_100(struct connection *pc, const struct packet_web_cma_clear *packet)
84353{
84354 const struct packet_web_cma_clear *real_packet = packet;
84355 int e;
84356#ifdef FREECIV_DELTA_PROTOCOL
84357 packet_web_cma_clear_100_fields fields;
84358 struct packet_web_cma_clear *old;
84359 bool differ;
84360 struct genhash **hash = pc->phs.sent + PACKET_WEB_CMA_CLEAR;
84361#endif /* FREECIV_DELTA_PROTOCOL */
84362 SEND_PACKET_START(PACKET_WEB_CMA_CLEAR);
84363#ifdef FREECIV_JSON_CONNECTION
84364 struct plocation field_addr;
84365 {
84366 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84367 field_addr = *field_addr_tmp;
84368 FC_FREE(field_addr_tmp);
84369 }
84370#endif /* FREECIV_JSON_CONNECTION */
84371
84372 log_packet_detailed("packet_web_cma_clear_100: sending info about ()");
84373
84374#ifdef FREECIV_DELTA_PROTOCOL
84375 if (NULL == *hash) {
84376 *hash = genhash_new_full(hash_packet_web_cma_clear_100, cmp_packet_web_cma_clear_100,
84377 NULL, NULL, NULL, free);
84378 }
84379 BV_CLR_ALL(fields);
84380
84381 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84382 old = fc_malloc(sizeof(*old));
84383 *old = *real_packet;
84384 genhash_insert(*hash, old, old);
84385 memset(old, 0, sizeof(*old));
84386 }
84387 differ = (old->id != real_packet->id);
84388 if (differ) {
84389 BV_SET(fields, 0);
84390 }
84391
84392
84393#ifdef FREECIV_JSON_CONNECTION
84394 field_addr.name = "fields";
84395#endif /* FREECIV_JSON_CONNECTION */
84396 e = 0;
84397 e |= DIO_BV_PUT(&dout, &field_addr, fields);
84398 if (e) {
84399 log_packet_detailed("fields bitvector error detected");
84400 }
84401
84402 if (BV_ISSET(fields, 0)) {
84403 log_packet_detailed(" field 'id' has changed");
84404#ifdef FREECIV_JSON_CONNECTION
84405 field_addr.name = "id";
84406#endif /* FREECIV_JSON_CONNECTION */
84407 e = 0;
84408 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
84409 if (e) {
84410 log_packet_detailed("'id' field error detected");
84411 }
84412 }
84413
84414 *old = *real_packet;
84415#endif /* FREECIV_DELTA_PROTOCOL */
84416#ifndef FREECIV_DELTA_PROTOCOL
84417#ifdef FREECIV_JSON_CONNECTION
84418 field_addr.name = "id";
84419#endif /* FREECIV_JSON_CONNECTION */
84420 e = 0;
84421 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->id);
84422 if (e) {
84423 log_packet_detailed("'id' field error detected");
84424 }
84425
84426#endif
84427 SEND_PACKET_END(PACKET_WEB_CMA_CLEAR);
84428}
84429
84430 int send_packet_web_cma_clear(struct connection *pc, const struct packet_web_cma_clear *packet)
84431{
84432 if (!pc->used) {
84433 log_error("WARNING: trying to send data to the closed connection %s",
84434 conn_description(pc));
84435 return -1;
84436 }
84437 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_CMA_CLEAR].packet != NULL, -1,
84438 "Handler for PACKET_WEB_CMA_CLEAR not installed");
84439 return pc->phs.handlers->send[PACKET_WEB_CMA_CLEAR].packet(pc, packet);
84440}
84441
84442#ifdef FREECIV_DELTA_PROTOCOL
84443static genhash_val_t hash_packet_web_player_info_addition_100(const void *vkey)
84444{
84445 const struct packet_web_player_info_addition *key = (const struct packet_web_player_info_addition *) vkey;
84446 genhash_val_t result = 0;
84447
84448 result += key->playerno;
84449
84450 result &= 0xFFFFFFFF;
84451 return result;
84452}
84453
84454static bool cmp_packet_web_player_info_addition_100(const void *vkey1, const void *vkey2)
84455{
84456 const struct packet_web_player_info_addition *old = (const struct packet_web_player_info_addition *) vkey1;
84457 const struct packet_web_player_info_addition *real_packet = (const struct packet_web_player_info_addition *) vkey2;
84458 bool differ;
84459
84460 differ = (old->playerno != real_packet->playerno);
84461
84462 return !differ;
84463}
84464 BV_DEFINE(packet_web_player_info_addition_100_fields, 1);
84465#endif /* FREECIV_DELTA_PROTOCOL */
84466
84467 static struct packet_web_player_info_addition *receive_packet_web_player_info_addition_100(struct connection *pc)
84468{
84469#ifdef FREECIV_DELTA_PROTOCOL
84470 packet_web_player_info_addition_100_fields fields;
84471 struct packet_web_player_info_addition *old;
84472 struct genhash **hash = pc->phs.received + PACKET_WEB_PLAYER_INFO_ADDITION;
84473#endif /* FREECIV_DELTA_PROTOCOL */
84474 RECEIVE_PACKET_START(packet_web_player_info_addition, real_packet);
84475#ifdef FREECIV_JSON_CONNECTION
84476 struct plocation field_addr;
84477 {
84478 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84479 field_addr = *field_addr_tmp;
84480 FC_FREE(field_addr_tmp);
84481 }
84482#endif /* FREECIV_JSON_CONNECTION */
84483
84484#ifdef FREECIV_DELTA_PROTOCOL
84485#ifdef FREECIV_JSON_CONNECTION
84486 field_addr.name = "fields";
84487#endif /* FREECIV_JSON_CONNECTION */
84488 DIO_BV_GET(&din, &field_addr, fields);
84489#ifdef FREECIV_JSON_CONNECTION
84490 field_addr.name = "playerno";
84491#endif /* FREECIV_JSON_CONNECTION */
84492 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
84493 RECEIVE_PACKET_FIELD_ERROR(playerno);
84494 }
84495
84496#else /* FREECIV_DELTA_PROTOCOL */
84497#ifdef FREECIV_JSON_CONNECTION
84498 field_addr.name = "playerno";
84499#endif /* FREECIV_JSON_CONNECTION */
84500 if (!DIO_GET(uint16, &din, &field_addr, &real_packet->playerno)) {
84501 RECEIVE_PACKET_FIELD_ERROR(playerno);
84502 }
84503#ifdef FREECIV_JSON_CONNECTION
84504 field_addr.name = "expected_income";
84505#endif /* FREECIV_JSON_CONNECTION */
84506 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->expected_income)) {
84507 RECEIVE_PACKET_FIELD_ERROR(expected_income);
84508 }
84509#endif
84510 log_packet_detailed("packet_web_player_info_addition_100: got info about (%d)",
84511 real_packet->playerno);
84512
84513#ifdef FREECIV_DELTA_PROTOCOL
84514 if (NULL == *hash) {
84515 *hash = genhash_new_full(hash_packet_web_player_info_addition_100, cmp_packet_web_player_info_addition_100,
84516 NULL, NULL, NULL, free);
84517 }
84518
84519 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84520 *real_packet = *old;
84521 } else {
84522 int playerno;
84523
84524 playerno = real_packet->playerno;
84525
84526 log_packet_detailed(" no old info");
84527 memset(real_packet, 0, sizeof(*real_packet));
84528
84529 real_packet->playerno = playerno;
84530 }
84531
84532 if (BV_ISSET(fields, 0)) {
84533 log_packet_detailed(" got field 'expected_income'");
84534#ifdef FREECIV_JSON_CONNECTION
84535 field_addr.name = "expected_income";
84536#endif /* FREECIV_JSON_CONNECTION */
84537 if (!DIO_GET(uint32, &din, &field_addr, &real_packet->expected_income)) {
84538 RECEIVE_PACKET_FIELD_ERROR(expected_income);
84539 }
84540 }
84541
84542 if (NULL == old) {
84543 old = fc_malloc(sizeof(*old));
84544 *old = *real_packet;
84545 genhash_insert(*hash, old, old);
84546 } else {
84547 *old = *real_packet;
84548 }
84549
84550#endif /* FREECIV_DELTA_PROTOCOL */
84551 RECEIVE_PACKET_END(real_packet);
84552}
84553
84554 static int send_packet_web_player_info_addition_100(struct connection *pc, const struct packet_web_player_info_addition *packet)
84555{
84556 const struct packet_web_player_info_addition *real_packet = packet;
84557 int e;
84558#ifdef FREECIV_DELTA_PROTOCOL
84559 packet_web_player_info_addition_100_fields fields;
84560 struct packet_web_player_info_addition *old;
84561 bool differ;
84562 struct genhash **hash = pc->phs.sent + PACKET_WEB_PLAYER_INFO_ADDITION;
84563 int different = 0;
84564#endif /* FREECIV_DELTA_PROTOCOL */
84565 SEND_PACKET_START(PACKET_WEB_PLAYER_INFO_ADDITION);
84566#ifdef FREECIV_JSON_CONNECTION
84567 struct plocation field_addr;
84568 {
84569 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84570 field_addr = *field_addr_tmp;
84571 FC_FREE(field_addr_tmp);
84572 }
84573#endif /* FREECIV_JSON_CONNECTION */
84574
84575 log_packet_detailed("packet_web_player_info_addition_100: sending info about (%d)",
84576 real_packet->playerno);
84577
84578#ifdef FREECIV_DELTA_PROTOCOL
84579 if (NULL == *hash) {
84580 *hash = genhash_new_full(hash_packet_web_player_info_addition_100, cmp_packet_web_player_info_addition_100,
84581 NULL, NULL, NULL, free);
84582 }
84583 BV_CLR_ALL(fields);
84584
84585 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84586 old = fc_malloc(sizeof(*old));
84587 *old = *real_packet;
84588 genhash_insert(*hash, old, old);
84589 memset(old, 0, sizeof(*old));
84590 different = 1; /* Force to send. */
84591 }
84592 differ = (old->expected_income != real_packet->expected_income);
84593 if (differ) {
84594 different++;
84595 BV_SET(fields, 0);
84596 }
84597
84598 if (different == 0) {
84599 log_packet_detailed(" no change -> discard");
84600 return 0;
84601 }
84602
84603#ifdef FREECIV_JSON_CONNECTION
84604 field_addr.name = "fields";
84605#endif /* FREECIV_JSON_CONNECTION */
84606 e = 0;
84607 e |= DIO_BV_PUT(&dout, &field_addr, fields);
84608 if (e) {
84609 log_packet_detailed("fields bitvector error detected");
84610 }
84611#ifdef FREECIV_JSON_CONNECTION
84612 field_addr.name = "playerno";
84613#endif /* FREECIV_JSON_CONNECTION */
84614 e = 0;
84615 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
84616 if (e) {
84617 log_packet_detailed("'playerno' field error detected");
84618 }
84619
84620 if (BV_ISSET(fields, 0)) {
84621 log_packet_detailed(" field 'expected_income' has changed");
84622#ifdef FREECIV_JSON_CONNECTION
84623 field_addr.name = "expected_income";
84624#endif /* FREECIV_JSON_CONNECTION */
84625 e = 0;
84626 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->expected_income);
84627 if (e) {
84628 log_packet_detailed("'expected_income' field error detected");
84629 }
84630 }
84631
84632 *old = *real_packet;
84633#endif /* FREECIV_DELTA_PROTOCOL */
84634#ifndef FREECIV_DELTA_PROTOCOL
84635#ifdef FREECIV_JSON_CONNECTION
84636 field_addr.name = "playerno";
84637#endif /* FREECIV_JSON_CONNECTION */
84638 e = 0;
84639 e |= DIO_PUT(uint16, &dout, &field_addr, real_packet->playerno);
84640 if (e) {
84641 log_packet_detailed("'playerno' field error detected");
84642 }
84643#ifdef FREECIV_JSON_CONNECTION
84644 field_addr.name = "expected_income";
84645#endif /* FREECIV_JSON_CONNECTION */
84646 e = 0;
84647 e |= DIO_PUT(uint32, &dout, &field_addr, real_packet->expected_income);
84648 if (e) {
84649 log_packet_detailed("'expected_income' field error detected");
84650 }
84651
84652#endif
84653 SEND_PACKET_END(PACKET_WEB_PLAYER_INFO_ADDITION);
84654}
84655
84656 int send_packet_web_player_info_addition(struct connection *pc, const struct packet_web_player_info_addition *packet)
84657{
84658 if (!pc->used) {
84659 log_error("WARNING: trying to send data to the closed connection %s",
84660 conn_description(pc));
84661 return -1;
84662 }
84663 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet != NULL, -1,
84664 "Handler for PACKET_WEB_PLAYER_INFO_ADDITION not installed");
84665 return pc->phs.handlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet(pc, packet);
84666}
84667
84668#ifdef FREECIV_DELTA_PROTOCOL
84669static genhash_val_t hash_packet_web_ruleset_unit_addition_100(const void *vkey)
84670{
84671 const struct packet_web_ruleset_unit_addition *key = (const struct packet_web_ruleset_unit_addition *) vkey;
84672 genhash_val_t result = 0;
84673
84674 result += key->id;
84675
84676 result &= 0xFFFFFFFF;
84677 return result;
84678}
84679
84680static bool cmp_packet_web_ruleset_unit_addition_100(const void *vkey1, const void *vkey2)
84681{
84682 const struct packet_web_ruleset_unit_addition *old = (const struct packet_web_ruleset_unit_addition *) vkey1;
84683 const struct packet_web_ruleset_unit_addition *real_packet = (const struct packet_web_ruleset_unit_addition *) vkey2;
84684 bool differ;
84685
84686 differ = (old->id != real_packet->id);
84687
84688 return !differ;
84689}
84690 BV_DEFINE(packet_web_ruleset_unit_addition_100_fields, 1);
84691#endif /* FREECIV_DELTA_PROTOCOL */
84692
84693 static struct packet_web_ruleset_unit_addition *receive_packet_web_ruleset_unit_addition_100(struct connection *pc)
84694{
84695#ifdef FREECIV_DELTA_PROTOCOL
84696 packet_web_ruleset_unit_addition_100_fields fields;
84697 struct packet_web_ruleset_unit_addition *old;
84698 struct genhash **hash = pc->phs.received + PACKET_WEB_RULESET_UNIT_ADDITION;
84699#endif /* FREECIV_DELTA_PROTOCOL */
84700 RECEIVE_PACKET_START(packet_web_ruleset_unit_addition, real_packet);
84701#ifdef FREECIV_JSON_CONNECTION
84702 struct plocation field_addr;
84703 {
84704 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84705 field_addr = *field_addr_tmp;
84706 FC_FREE(field_addr_tmp);
84707 }
84708#endif /* FREECIV_JSON_CONNECTION */
84709
84710#ifdef FREECIV_DELTA_PROTOCOL
84711#ifdef FREECIV_JSON_CONNECTION
84712 field_addr.name = "fields";
84713#endif /* FREECIV_JSON_CONNECTION */
84714 DIO_BV_GET(&din, &field_addr, fields);
84715#ifdef FREECIV_JSON_CONNECTION
84716 field_addr.name = "id";
84717#endif /* FREECIV_JSON_CONNECTION */
84718 {
84719 int readin;
84720
84721 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
84722 RECEIVE_PACKET_FIELD_ERROR(id);
84723 }
84724 real_packet->id = readin;
84725 }
84726
84727#else /* FREECIV_DELTA_PROTOCOL */
84728#ifdef FREECIV_JSON_CONNECTION
84729 field_addr.name = "id";
84730#endif /* FREECIV_JSON_CONNECTION */
84731 {
84732 int readin;
84733
84734 if (!DIO_GET(uint8, &din, &field_addr, &readin)) {
84735 RECEIVE_PACKET_FIELD_ERROR(id);
84736 }
84737 real_packet->id = readin;
84738 }
84739#ifdef FREECIV_JSON_CONNECTION
84740 field_addr.name = "utype_actions";
84741#endif /* FREECIV_JSON_CONNECTION */
84742 if (!DIO_BV_GET(&din, &field_addr, real_packet->utype_actions)) {
84743 RECEIVE_PACKET_FIELD_ERROR(utype_actions);
84744 }
84745#endif
84746 log_packet_detailed("packet_web_ruleset_unit_addition_100: got info about (%d)",
84747 real_packet->id);
84748
84749#ifdef FREECIV_DELTA_PROTOCOL
84750 if (NULL == *hash) {
84751 *hash = genhash_new_full(hash_packet_web_ruleset_unit_addition_100, cmp_packet_web_ruleset_unit_addition_100,
84752 NULL, NULL, NULL, free);
84753 }
84754
84755 if (genhash_lookup(*hash, real_packet, (void **) &old)) {
84756 *real_packet = *old;
84757 } else {
84758 Unit_type_id id;
84759
84760 id = real_packet->id;
84761
84762 log_packet_detailed(" no old info");
84763 memset(real_packet, 0, sizeof(*real_packet));
84764
84765 real_packet->id = id;
84766 }
84767
84768 if (BV_ISSET(fields, 0)) {
84769 log_packet_detailed(" got field 'utype_actions'");
84770#ifdef FREECIV_JSON_CONNECTION
84771 field_addr.name = "utype_actions";
84772#endif /* FREECIV_JSON_CONNECTION */
84773 if (!DIO_BV_GET(&din, &field_addr, real_packet->utype_actions)) {
84774 RECEIVE_PACKET_FIELD_ERROR(utype_actions);
84775 }
84776 }
84777
84778 if (NULL == old) {
84779 old = fc_malloc(sizeof(*old));
84780 *old = *real_packet;
84781 genhash_insert(*hash, old, old);
84782 } else {
84783 *old = *real_packet;
84784 }
84785
84786#endif /* FREECIV_DELTA_PROTOCOL */
84787 RECEIVE_PACKET_END(real_packet);
84788}
84789
84790 static int send_packet_web_ruleset_unit_addition_100(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
84791{
84792 const struct packet_web_ruleset_unit_addition *real_packet = packet;
84793 int e;
84794#ifdef FREECIV_DELTA_PROTOCOL
84795 packet_web_ruleset_unit_addition_100_fields fields;
84796 struct packet_web_ruleset_unit_addition *old;
84797 bool differ;
84798 struct genhash **hash = pc->phs.sent + PACKET_WEB_RULESET_UNIT_ADDITION;
84799#endif /* FREECIV_DELTA_PROTOCOL */
84800 SEND_PACKET_START(PACKET_WEB_RULESET_UNIT_ADDITION);
84801#ifdef FREECIV_JSON_CONNECTION
84802 struct plocation field_addr;
84803 {
84804 struct plocation *field_addr_tmp = plocation_field_new(NULL);
84805 field_addr = *field_addr_tmp;
84806 FC_FREE(field_addr_tmp);
84807 }
84808#endif /* FREECIV_JSON_CONNECTION */
84809
84810 log_packet_detailed("packet_web_ruleset_unit_addition_100: sending info about (%d)",
84811 real_packet->id);
84812
84813#ifdef FREECIV_DELTA_PROTOCOL
84814 if (NULL == *hash) {
84815 *hash = genhash_new_full(hash_packet_web_ruleset_unit_addition_100, cmp_packet_web_ruleset_unit_addition_100,
84816 NULL, NULL, NULL, free);
84817 }
84818 BV_CLR_ALL(fields);
84819
84820 if (!genhash_lookup(*hash, real_packet, (void **) &old)) {
84821 old = fc_malloc(sizeof(*old));
84822 *old = *real_packet;
84823 genhash_insert(*hash, old, old);
84824 memset(old, 0, sizeof(*old));
84825 }
84826 differ = !BV_ARE_EQUAL(old->utype_actions, real_packet->utype_actions);
84827 if (differ) {
84828 BV_SET(fields, 0);
84829 }
84830
84831
84832#ifdef FREECIV_JSON_CONNECTION
84833 field_addr.name = "fields";
84834#endif /* FREECIV_JSON_CONNECTION */
84835 e = 0;
84836 e |= DIO_BV_PUT(&dout, &field_addr, fields);
84837 if (e) {
84838 log_packet_detailed("fields bitvector error detected");
84839 }
84840#ifdef FREECIV_JSON_CONNECTION
84841 field_addr.name = "id";
84842#endif /* FREECIV_JSON_CONNECTION */
84843 e = 0;
84844 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
84845 if (e) {
84846 log_packet_detailed("'id' field error detected");
84847 }
84848
84849 if (BV_ISSET(fields, 0)) {
84850 log_packet_detailed(" field 'utype_actions' has changed");
84851#ifdef FREECIV_JSON_CONNECTION
84852 field_addr.name = "utype_actions";
84853#endif /* FREECIV_JSON_CONNECTION */
84854 e = 0;
84855 e |= DIO_BV_PUT(&dout, &field_addr, packet->utype_actions);
84856 if (e) {
84857 log_packet_detailed("'utype_actions' field error detected");
84858 }
84859 }
84860
84861 *old = *real_packet;
84862#endif /* FREECIV_DELTA_PROTOCOL */
84863#ifndef FREECIV_DELTA_PROTOCOL
84864#ifdef FREECIV_JSON_CONNECTION
84865 field_addr.name = "id";
84866#endif /* FREECIV_JSON_CONNECTION */
84867 e = 0;
84868 e |= DIO_PUT(uint8, &dout, &field_addr, real_packet->id);
84869 if (e) {
84870 log_packet_detailed("'id' field error detected");
84871 }
84872#ifdef FREECIV_JSON_CONNECTION
84873 field_addr.name = "utype_actions";
84874#endif /* FREECIV_JSON_CONNECTION */
84875 e = 0;
84876 e |= DIO_BV_PUT(&dout, &field_addr, packet->utype_actions);
84877 if (e) {
84878 log_packet_detailed("'utype_actions' field error detected");
84879 }
84880
84881#endif
84882 SEND_PACKET_END(PACKET_WEB_RULESET_UNIT_ADDITION);
84883}
84884
84885 int send_packet_web_ruleset_unit_addition(struct connection *pc, const struct packet_web_ruleset_unit_addition *packet)
84886{
84887 if (!pc->used) {
84888 log_error("WARNING: trying to send data to the closed connection %s",
84889 conn_description(pc));
84890 return -1;
84891 }
84892 fc_assert_ret_val_msg(pc->phs.handlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet != NULL, -1,
84893 "Handler for PACKET_WEB_RULESET_UNIT_ADDITION not installed");
84894 return pc->phs.handlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet(pc, packet);
84895}
84896
84897 void lsend_packet_web_ruleset_unit_addition(struct conn_list *dest, const struct packet_web_ruleset_unit_addition *packet)
84898{
84899 conn_list_iterate(dest, pconn) {
84900 send_packet_web_ruleset_unit_addition(pconn, packet);
84901 } conn_list_iterate_end;
84902}
84903
84904 void packet_handlers_fill_initial(struct packet_handlers *phandlers)
84905{
84906 phandlers->send[PACKET_CITY_RALLY_POINT].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_rally_point_100;
84907 phandlers->receive[PACKET_CITY_RALLY_POINT] = (void *(*)(struct connection *)) receive_packet_city_rally_point_100;
84908 phandlers->send[PACKET_WORKER_TASK].packet = (int(*)(struct connection *, const void *)) send_packet_worker_task_100;
84909 phandlers->receive[PACKET_WORKER_TASK] = (void *(*)(struct connection *)) receive_packet_worker_task_100;
84910 phandlers->send[PACKET_PLAYER_ATTRIBUTE_CHUNK].packet = (int(*)(struct connection *, const void *)) send_packet_player_attribute_chunk_100;
84911 phandlers->receive[PACKET_PLAYER_ATTRIBUTE_CHUNK] = (void *(*)(struct connection *)) receive_packet_player_attribute_chunk_100;
84912 phandlers->send[PACKET_EDIT_STARTPOS].packet = (int(*)(struct connection *, const void *)) send_packet_edit_startpos_100;
84913 phandlers->receive[PACKET_EDIT_STARTPOS] = (void *(*)(struct connection *)) receive_packet_edit_startpos_100;
84914 phandlers->send[PACKET_EDIT_STARTPOS_FULL].packet = (int(*)(struct connection *, const void *)) send_packet_edit_startpos_full_100;
84915 phandlers->receive[PACKET_EDIT_STARTPOS_FULL] = (void *(*)(struct connection *)) receive_packet_edit_startpos_full_100;
84916 if (is_server()) {
84917 phandlers->send[PACKET_PROCESSING_STARTED].no_packet = (int(*)(struct connection *)) send_packet_processing_started_100;
84918 phandlers->send[PACKET_PROCESSING_FINISHED].no_packet = (int(*)(struct connection *)) send_packet_processing_finished_100;
84919 phandlers->send[PACKET_INVESTIGATE_STARTED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_started_100;
84920 phandlers->send[PACKET_INVESTIGATE_FINISHED].packet = (int(*)(struct connection *, const void *)) send_packet_investigate_finished_100;
84921 phandlers->send[PACKET_SERVER_JOIN_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_server_join_reply_100;
84922 phandlers->send[PACKET_AUTHENTICATION_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_authentication_req_100;
84923 phandlers->send[PACKET_SERVER_SHUTDOWN].no_packet = (int(*)(struct connection *)) send_packet_server_shutdown_100;
84924 phandlers->send[PACKET_ENDGAME_REPORT].packet = (int(*)(struct connection *, const void *)) send_packet_endgame_report_100;
84925 phandlers->send[PACKET_ENDGAME_PLAYER].packet = (int(*)(struct connection *, const void *)) send_packet_endgame_player_100;
84926 phandlers->send[PACKET_TILE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_tile_info_100;
84927 phandlers->send[PACKET_GAME_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_game_info_100;
84928 phandlers->send[PACKET_CALENDAR_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_calendar_info_100;
84929 phandlers->send[PACKET_TIMEOUT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_timeout_info_100;
84930 phandlers->send[PACKET_MAP_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_map_info_100;
84931 phandlers->send[PACKET_NUKE_TILE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_nuke_tile_info_100;
84932 phandlers->send[PACKET_TEAM_NAME_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_team_name_info_100;
84933 phandlers->send[PACKET_ACHIEVEMENT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_achievement_info_100;
84934 phandlers->send[PACKET_CHAT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_chat_msg_100;
84935 phandlers->send[PACKET_EARLY_CHAT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_early_chat_msg_100;
84936 phandlers->send[PACKET_CONNECT_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_connect_msg_100;
84937 phandlers->send[PACKET_SERVER_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_server_info_100;
84938 phandlers->send[PACKET_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_city_remove_100;
84939 phandlers->send[PACKET_CITY_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_info_100;
84940 phandlers->send[PACKET_CITY_NATIONALITIES].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_city_nationalities_100;
84941 phandlers->send[PACKET_CITY_UPDATE_COUNTERS].packet = (int(*)(struct connection *, const void *)) send_packet_city_update_counters_100;
84942 phandlers->send[PACKET_CITY_SHORT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_short_info_100;
84943 phandlers->send[PACKET_TRADE_ROUTE_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_trade_route_info_100;
84944 phandlers->send[PACKET_CITY_NAME_SUGGESTION_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_info_100;
84945 phandlers->send[PACKET_CITY_SABOTAGE_LIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_sabotage_list_100;
84946 phandlers->send[PACKET_PLAYER_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_player_remove_100;
84947 phandlers->send[PACKET_PLAYER_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_player_info_100;
84948 phandlers->send[PACKET_PLAYER_DIPLSTATE].packet = (int(*)(struct connection *, const void *)) send_packet_player_diplstate_100;
84949 phandlers->send[PACKET_RESEARCH_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_research_info_100;
84950 phandlers->send[PACKET_UNKNOWN_RESEARCH].packet = (int(*)(struct connection *, const void *)) send_packet_unknown_research_100;
84951 phandlers->send[PACKET_UNIT_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_unit_remove_100;
84952 phandlers->send[PACKET_UNIT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_info_100;
84953 phandlers->send[PACKET_UNIT_SHORT_INFO].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_unit_short_info_100;
84954 phandlers->send[PACKET_UNIT_COMBAT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_unit_combat_info_100;
84955 phandlers->send[PACKET_UNIT_ACTION_ANSWER].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_answer_100;
84956 phandlers->send[PACKET_UNIT_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_actions_100;
84957 phandlers->send[PACKET_DIPLOMACY_INIT_MEETING].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_init_meeting_100;
84958 phandlers->send[PACKET_DIPLOMACY_CANCEL_MEETING].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_meeting_100;
84959 phandlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_create_clause_100;
84960 phandlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_remove_clause_100;
84961 phandlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_accept_treaty_100;
84962 phandlers->send[PACKET_PAGE_MSG].packet = (int(*)(struct connection *, const void *)) send_packet_page_msg_100;
84963 phandlers->send[PACKET_PAGE_MSG_PART].packet = (int(*)(struct connection *, const void *)) send_packet_page_msg_part_100;
84964 phandlers->send[PACKET_CONN_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_conn_info_100;
84965 phandlers->send[PACKET_CONN_PING_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_conn_ping_info_100;
84966 phandlers->send[PACKET_CONN_PING].no_packet = (int(*)(struct connection *)) send_packet_conn_ping_100;
84967 phandlers->send[PACKET_END_PHASE].no_packet = (int(*)(struct connection *)) send_packet_end_phase_100;
84968 phandlers->send[PACKET_START_PHASE].packet = (int(*)(struct connection *, const void *)) send_packet_start_phase_100;
84969 phandlers->send[PACKET_NEW_YEAR].packet = (int(*)(struct connection *, const void *)) send_packet_new_year_100;
84970 phandlers->send[PACKET_BEGIN_TURN].no_packet = (int(*)(struct connection *)) send_packet_begin_turn_100;
84971 phandlers->send[PACKET_END_TURN].no_packet = (int(*)(struct connection *)) send_packet_end_turn_100;
84972 phandlers->send[PACKET_FREEZE_CLIENT].no_packet = (int(*)(struct connection *)) send_packet_freeze_client_100;
84973 phandlers->send[PACKET_THAW_CLIENT].no_packet = (int(*)(struct connection *)) send_packet_thaw_client_100;
84974 phandlers->send[PACKET_SPACESHIP_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_spaceship_info_100;
84975 phandlers->send[PACKET_RULESET_UNIT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_100;
84976 phandlers->send[PACKET_RULESET_UNIT_BONUS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_bonus_100;
84977 phandlers->send[PACKET_RULESET_UNIT_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_flag_100;
84978 phandlers->send[PACKET_RULESET_UNIT_CLASS_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_class_flag_100;
84979 phandlers->send[PACKET_RULESET_GAME].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_game_100;
84980 phandlers->send[PACKET_RULESET_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_specialist_100;
84981 phandlers->send[PACKET_RULESET_GOVERNMENT_RULER_TITLE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_government_ruler_title_100;
84982 phandlers->send[PACKET_RULESET_TECH].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_100;
84983 phandlers->send[PACKET_RULESET_TECH_CLASS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_class_100;
84984 phandlers->send[PACKET_RULESET_TECH_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_tech_flag_100;
84985 phandlers->send[PACKET_RULESET_GOVERNMENT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_government_100;
84986 phandlers->send[PACKET_RULESET_TERRAIN_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_control_100;
84987 phandlers->send[PACKET_RULESETS_READY].no_packet = (int(*)(struct connection *)) send_packet_rulesets_ready_100;
84988 phandlers->send[PACKET_RULESET_NATION_SETS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_sets_100;
84989 phandlers->send[PACKET_RULESET_NATION_GROUPS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_groups_100;
84990 phandlers->send[PACKET_RULESET_NATION].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_nation_100;
84991 phandlers->send[PACKET_NATION_AVAILABILITY].packet = (int(*)(struct connection *, const void *)) send_packet_nation_availability_100;
84992 phandlers->send[PACKET_RULESET_STYLE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_style_100;
84993 phandlers->send[PACKET_RULESET_CITY].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_city_100;
84994 phandlers->send[PACKET_RULESET_BUILDING].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_building_100;
84995 phandlers->send[PACKET_RULESET_IMPR_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_impr_flag_100;
84996 phandlers->send[PACKET_RULESET_TERRAIN].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_100;
84997 phandlers->send[PACKET_RULESET_TERRAIN_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_terrain_flag_100;
84998 phandlers->send[PACKET_RULESET_UNIT_CLASS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_unit_class_100;
84999 phandlers->send[PACKET_RULESET_EXTRA].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_extra_100;
85000 phandlers->send[PACKET_RULESET_EXTRA_FLAG].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_extra_flag_100;
85001 phandlers->send[PACKET_RULESET_BASE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_base_100;
85002 phandlers->send[PACKET_RULESET_ROAD].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_road_100;
85003 phandlers->send[PACKET_RULESET_GOODS].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_goods_100;
85004 phandlers->send[PACKET_RULESET_DISASTER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_disaster_100;
85005 phandlers->send[PACKET_RULESET_ACHIEVEMENT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_achievement_100;
85006 phandlers->send[PACKET_RULESET_TRADE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_trade_100;
85007 phandlers->send[PACKET_RULESET_ACTION].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_100;
85008 phandlers->send[PACKET_RULESET_ACTION_ENABLER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_enabler_100;
85009 phandlers->send[PACKET_RULESET_ACTION_AUTO].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_action_auto_100;
85010 phandlers->send[PACKET_RULESET_COUNTER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_counter_100;
85011 phandlers->send[PACKET_RULESET_MUSIC].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_music_100;
85012 phandlers->send[PACKET_RULESET_MULTIPLIER].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_multiplier_100;
85013 phandlers->send[PACKET_RULESET_CLAUSE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_clause_100;
85014 phandlers->send[PACKET_RULESET_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_control_100;
85015 phandlers->send[PACKET_RULESET_SUMMARY].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_summary_100;
85016 phandlers->send[PACKET_RULESET_DESCRIPTION_PART].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_description_part_100;
85017 phandlers->send[PACKET_SINGLE_WANT_HACK_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_single_want_hack_reply_100;
85018 phandlers->send[PACKET_RULESET_CHOICES].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_choices_100;
85019 phandlers->send[PACKET_GAME_LOAD].packet = (int(*)(struct connection *, const void *)) send_packet_game_load_100;
85020 phandlers->send[PACKET_SERVER_SETTING_CONTROL].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_control_100;
85021 phandlers->send[PACKET_SERVER_SETTING_CONST].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_const_100;
85022 phandlers->send[PACKET_SERVER_SETTING_BOOL].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_bool_100;
85023 phandlers->send[PACKET_SERVER_SETTING_INT].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_int_100;
85024 phandlers->send[PACKET_SERVER_SETTING_STR].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_str_100;
85025 phandlers->send[PACKET_SERVER_SETTING_ENUM].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_enum_100;
85026 phandlers->send[PACKET_SERVER_SETTING_BITWISE].packet = (int(*)(struct connection *, const void *)) send_packet_server_setting_bitwise_100;
85027 phandlers->send[PACKET_SET_TOPOLOGY].packet = (int(*)(struct connection *, const void *)) send_packet_set_topology_100;
85028 phandlers->send[PACKET_RULESET_EFFECT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_effect_100;
85029 phandlers->send[PACKET_RULESET_RESOURCE].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_resource_100;
85030 phandlers->send[PACKET_SCENARIO_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_scenario_info_100;
85031 phandlers->send[PACKET_SCENARIO_DESCRIPTION].packet = (int(*)(struct connection *, const void *)) send_packet_scenario_description_100;
85032 phandlers->send[PACKET_VOTE_NEW].packet = (int(*)(struct connection *, const void *)) send_packet_vote_new_100;
85033 phandlers->send[PACKET_VOTE_UPDATE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_update_100;
85034 phandlers->send[PACKET_VOTE_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_remove_100;
85035 phandlers->send[PACKET_VOTE_RESOLVE].packet = (int(*)(struct connection *, const void *)) send_packet_vote_resolve_100;
85036 phandlers->send[PACKET_EDIT_OBJECT_CREATED].packet = (int(*)(struct connection *, const void *)) send_packet_edit_object_created_100;
85037 phandlers->send[PACKET_PLAY_MUSIC].packet = (int(*)(struct connection *, const void *)) send_packet_play_music_100;
85038 phandlers->send[PACKET_WEB_CITY_INFO_ADDITION].force_to_send = (int(*)(struct connection *, const void *, bool)) send_packet_web_city_info_addition_100;
85039 phandlers->send[PACKET_WEB_PLAYER_INFO_ADDITION].packet = (int(*)(struct connection *, const void *)) send_packet_web_player_info_addition_100;
85040 phandlers->send[PACKET_WEB_RULESET_UNIT_ADDITION].packet = (int(*)(struct connection *, const void *)) send_packet_web_ruleset_unit_addition_100;
85041 phandlers->receive[PACKET_SERVER_JOIN_REQ] = (void *(*)(struct connection *)) receive_packet_server_join_req_100;
85042 phandlers->receive[PACKET_AUTHENTICATION_REPLY] = (void *(*)(struct connection *)) receive_packet_authentication_reply_100;
85043 phandlers->receive[PACKET_NATION_SELECT_REQ] = (void *(*)(struct connection *)) receive_packet_nation_select_req_100;
85044 phandlers->receive[PACKET_PLAYER_READY] = (void *(*)(struct connection *)) receive_packet_player_ready_100;
85045 phandlers->receive[PACKET_CHAT_MSG_REQ] = (void *(*)(struct connection *)) receive_packet_chat_msg_req_100;
85046 phandlers->receive[PACKET_CITY_SELL] = (void *(*)(struct connection *)) receive_packet_city_sell_100;
85047 phandlers->receive[PACKET_CITY_BUY] = (void *(*)(struct connection *)) receive_packet_city_buy_100;
85048 phandlers->receive[PACKET_CITY_CHANGE] = (void *(*)(struct connection *)) receive_packet_city_change_100;
85049 phandlers->receive[PACKET_CITY_WORKLIST] = (void *(*)(struct connection *)) receive_packet_city_worklist_100;
85050 phandlers->receive[PACKET_CITY_MAKE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_make_specialist_100;
85051 phandlers->receive[PACKET_CITY_MAKE_WORKER] = (void *(*)(struct connection *)) receive_packet_city_make_worker_100;
85052 phandlers->receive[PACKET_CITY_CHANGE_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_city_change_specialist_100;
85053 phandlers->receive[PACKET_CITY_RENAME] = (void *(*)(struct connection *)) receive_packet_city_rename_100;
85054 phandlers->receive[PACKET_CITY_OPTIONS_REQ] = (void *(*)(struct connection *)) receive_packet_city_options_req_100;
85055 phandlers->receive[PACKET_CITY_REFRESH] = (void *(*)(struct connection *)) receive_packet_city_refresh_100;
85056 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_REQ] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_req_100;
85057 phandlers->receive[PACKET_PLAYER_PHASE_DONE] = (void *(*)(struct connection *)) receive_packet_player_phase_done_100;
85058 phandlers->receive[PACKET_PLAYER_RATES] = (void *(*)(struct connection *)) receive_packet_player_rates_100;
85059 phandlers->receive[PACKET_PLAYER_CHANGE_GOVERNMENT] = (void *(*)(struct connection *)) receive_packet_player_change_government_100;
85060 phandlers->receive[PACKET_PLAYER_PLACE_INFRA] = (void *(*)(struct connection *)) receive_packet_player_place_infra_100;
85061 phandlers->receive[PACKET_PLAYER_ATTRIBUTE_BLOCK] = (void *(*)(struct connection *)) receive_packet_player_attribute_block_100;
85062 phandlers->receive[PACKET_PLAYER_MULTIPLIER] = (void *(*)(struct connection *)) receive_packet_player_multiplier_100;
85063 phandlers->receive[PACKET_PLAYER_RESEARCH] = (void *(*)(struct connection *)) receive_packet_player_research_100;
85064 phandlers->receive[PACKET_PLAYER_TECH_GOAL] = (void *(*)(struct connection *)) receive_packet_player_tech_goal_100;
85065 phandlers->receive[PACKET_UNIT_SSCS_SET] = (void *(*)(struct connection *)) receive_packet_unit_sscs_set_100;
85066 phandlers->receive[PACKET_UNIT_ORDERS] = (void *(*)(struct connection *)) receive_packet_unit_orders_100;
85067 phandlers->receive[PACKET_UNIT_SERVER_SIDE_AGENT_SET] = (void *(*)(struct connection *)) receive_packet_unit_server_side_agent_set_100;
85068 phandlers->receive[PACKET_UNIT_ACTION_QUERY] = (void *(*)(struct connection *)) receive_packet_unit_action_query_100;
85069 phandlers->receive[PACKET_UNIT_TYPE_UPGRADE] = (void *(*)(struct connection *)) receive_packet_unit_type_upgrade_100;
85070 phandlers->receive[PACKET_UNIT_DO_ACTION] = (void *(*)(struct connection *)) receive_packet_unit_do_action_100;
85071 phandlers->receive[PACKET_UNIT_GET_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_get_actions_100;
85072 phandlers->receive[PACKET_UNIT_CHANGE_ACTIVITY] = (void *(*)(struct connection *)) receive_packet_unit_change_activity_100;
85073 phandlers->receive[PACKET_DIPLOMACY_INIT_MEETING_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_init_meeting_req_100;
85074 phandlers->receive[PACKET_DIPLOMACY_CANCEL_MEETING_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_meeting_req_100;
85075 phandlers->receive[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_create_clause_req_100;
85076 phandlers->receive[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_remove_clause_req_100;
85077 phandlers->receive[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ] = (void *(*)(struct connection *)) receive_packet_diplomacy_accept_treaty_req_100;
85078 phandlers->receive[PACKET_DIPLOMACY_CANCEL_PACT] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_pact_100;
85079 phandlers->receive[PACKET_REPORT_REQ] = (void *(*)(struct connection *)) receive_packet_report_req_100;
85080 phandlers->receive[PACKET_CONN_PONG] = (void *(*)(struct connection *)) receive_packet_conn_pong_100;
85081 phandlers->receive[PACKET_CLIENT_HEARTBEAT] = (void *(*)(struct connection *)) receive_packet_client_heartbeat_100;
85082 phandlers->receive[PACKET_CLIENT_INFO] = (void *(*)(struct connection *)) receive_packet_client_info_100;
85083 phandlers->receive[PACKET_SPACESHIP_LAUNCH] = (void *(*)(struct connection *)) receive_packet_spaceship_launch_100;
85084 phandlers->receive[PACKET_SPACESHIP_PLACE] = (void *(*)(struct connection *)) receive_packet_spaceship_place_100;
85085 phandlers->receive[PACKET_SINGLE_WANT_HACK_REQ] = (void *(*)(struct connection *)) receive_packet_single_want_hack_req_100;
85086 phandlers->receive[PACKET_RULESET_SELECT] = (void *(*)(struct connection *)) receive_packet_ruleset_select_100;
85087 phandlers->receive[PACKET_SAVE_SCENARIO] = (void *(*)(struct connection *)) receive_packet_save_scenario_100;
85088 phandlers->receive[PACKET_VOTE_SUBMIT] = (void *(*)(struct connection *)) receive_packet_vote_submit_100;
85089 phandlers->receive[PACKET_EDIT_MODE] = (void *(*)(struct connection *)) receive_packet_edit_mode_100;
85090 phandlers->receive[PACKET_EDIT_RECALCULATE_BORDERS] = (void *(*)(struct connection *)) receive_packet_edit_recalculate_borders_100;
85091 phandlers->receive[PACKET_EDIT_CHECK_TILES] = (void *(*)(struct connection *)) receive_packet_edit_check_tiles_100;
85092 phandlers->receive[PACKET_EDIT_TOGGLE_FOGOFWAR] = (void *(*)(struct connection *)) receive_packet_edit_toggle_fogofwar_100;
85093 phandlers->receive[PACKET_EDIT_TILE_TERRAIN] = (void *(*)(struct connection *)) receive_packet_edit_tile_terrain_100;
85094 phandlers->receive[PACKET_EDIT_TILE_EXTRA] = (void *(*)(struct connection *)) receive_packet_edit_tile_extra_100;
85095 phandlers->receive[PACKET_EDIT_TILE] = (void *(*)(struct connection *)) receive_packet_edit_tile_100;
85096 phandlers->receive[PACKET_EDIT_UNIT_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_unit_create_100;
85097 phandlers->receive[PACKET_EDIT_UNIT_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_unit_remove_100;
85098 phandlers->receive[PACKET_EDIT_UNIT_REMOVE_BY_ID] = (void *(*)(struct connection *)) receive_packet_edit_unit_remove_by_id_100;
85099 phandlers->receive[PACKET_EDIT_UNIT] = (void *(*)(struct connection *)) receive_packet_edit_unit_100;
85100 phandlers->receive[PACKET_EDIT_CITY_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_city_create_100;
85101 phandlers->receive[PACKET_EDIT_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_city_remove_100;
85102 phandlers->receive[PACKET_EDIT_CITY] = (void *(*)(struct connection *)) receive_packet_edit_city_100;
85103 phandlers->receive[PACKET_EDIT_PLAYER_CREATE] = (void *(*)(struct connection *)) receive_packet_edit_player_create_100;
85104 phandlers->receive[PACKET_EDIT_PLAYER_REMOVE] = (void *(*)(struct connection *)) receive_packet_edit_player_remove_100;
85105 phandlers->receive[PACKET_EDIT_PLAYER] = (void *(*)(struct connection *)) receive_packet_edit_player_100;
85106 phandlers->receive[PACKET_EDIT_PLAYER_VISION] = (void *(*)(struct connection *)) receive_packet_edit_player_vision_100;
85107 phandlers->receive[PACKET_EDIT_GAME] = (void *(*)(struct connection *)) receive_packet_edit_game_100;
85108 phandlers->receive[PACKET_EDIT_SCENARIO_DESC] = (void *(*)(struct connection *)) receive_packet_edit_scenario_desc_100;
85109 phandlers->receive[PACKET_WEB_CMA_SET] = (void *(*)(struct connection *)) receive_packet_web_cma_set_100;
85110 phandlers->receive[PACKET_WEB_CMA_CLEAR] = (void *(*)(struct connection *)) receive_packet_web_cma_clear_100;
85111 } else {
85112 phandlers->send[PACKET_SERVER_JOIN_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_server_join_req_100;
85113 phandlers->send[PACKET_AUTHENTICATION_REPLY].packet = (int(*)(struct connection *, const void *)) send_packet_authentication_reply_100;
85114 phandlers->send[PACKET_NATION_SELECT_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_nation_select_req_100;
85115 phandlers->send[PACKET_PLAYER_READY].packet = (int(*)(struct connection *, const void *)) send_packet_player_ready_100;
85116 phandlers->send[PACKET_CHAT_MSG_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_chat_msg_req_100;
85117 phandlers->send[PACKET_CITY_SELL].packet = (int(*)(struct connection *, const void *)) send_packet_city_sell_100;
85118 phandlers->send[PACKET_CITY_BUY].packet = (int(*)(struct connection *, const void *)) send_packet_city_buy_100;
85119 phandlers->send[PACKET_CITY_CHANGE].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_100;
85120 phandlers->send[PACKET_CITY_WORKLIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_worklist_100;
85121 phandlers->send[PACKET_CITY_MAKE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_specialist_100;
85122 phandlers->send[PACKET_CITY_MAKE_WORKER].packet = (int(*)(struct connection *, const void *)) send_packet_city_make_worker_100;
85123 phandlers->send[PACKET_CITY_CHANGE_SPECIALIST].packet = (int(*)(struct connection *, const void *)) send_packet_city_change_specialist_100;
85124 phandlers->send[PACKET_CITY_RENAME].packet = (int(*)(struct connection *, const void *)) send_packet_city_rename_100;
85125 phandlers->send[PACKET_CITY_OPTIONS_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_options_req_100;
85126 phandlers->send[PACKET_CITY_REFRESH].packet = (int(*)(struct connection *, const void *)) send_packet_city_refresh_100;
85127 phandlers->send[PACKET_CITY_NAME_SUGGESTION_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_city_name_suggestion_req_100;
85128 phandlers->send[PACKET_PLAYER_PHASE_DONE].packet = (int(*)(struct connection *, const void *)) send_packet_player_phase_done_100;
85129 phandlers->send[PACKET_PLAYER_RATES].packet = (int(*)(struct connection *, const void *)) send_packet_player_rates_100;
85130 phandlers->send[PACKET_PLAYER_CHANGE_GOVERNMENT].packet = (int(*)(struct connection *, const void *)) send_packet_player_change_government_100;
85131 phandlers->send[PACKET_PLAYER_PLACE_INFRA].packet = (int(*)(struct connection *, const void *)) send_packet_player_place_infra_100;
85132 phandlers->send[PACKET_PLAYER_ATTRIBUTE_BLOCK].no_packet = (int(*)(struct connection *)) send_packet_player_attribute_block_100;
85133 phandlers->send[PACKET_PLAYER_MULTIPLIER].packet = (int(*)(struct connection *, const void *)) send_packet_player_multiplier_100;
85134 phandlers->send[PACKET_PLAYER_RESEARCH].packet = (int(*)(struct connection *, const void *)) send_packet_player_research_100;
85135 phandlers->send[PACKET_PLAYER_TECH_GOAL].packet = (int(*)(struct connection *, const void *)) send_packet_player_tech_goal_100;
85136 phandlers->send[PACKET_UNIT_SSCS_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_sscs_set_100;
85137 phandlers->send[PACKET_UNIT_ORDERS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_orders_100;
85138 phandlers->send[PACKET_UNIT_SERVER_SIDE_AGENT_SET].packet = (int(*)(struct connection *, const void *)) send_packet_unit_server_side_agent_set_100;
85139 phandlers->send[PACKET_UNIT_ACTION_QUERY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_action_query_100;
85140 phandlers->send[PACKET_UNIT_TYPE_UPGRADE].packet = (int(*)(struct connection *, const void *)) send_packet_unit_type_upgrade_100;
85141 phandlers->send[PACKET_UNIT_DO_ACTION].packet = (int(*)(struct connection *, const void *)) send_packet_unit_do_action_100;
85142 phandlers->send[PACKET_UNIT_GET_ACTIONS].packet = (int(*)(struct connection *, const void *)) send_packet_unit_get_actions_100;
85143 phandlers->send[PACKET_UNIT_CHANGE_ACTIVITY].packet = (int(*)(struct connection *, const void *)) send_packet_unit_change_activity_100;
85144 phandlers->send[PACKET_DIPLOMACY_INIT_MEETING_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_init_meeting_req_100;
85145 phandlers->send[PACKET_DIPLOMACY_CANCEL_MEETING_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_meeting_req_100;
85146 phandlers->send[PACKET_DIPLOMACY_CREATE_CLAUSE_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_create_clause_req_100;
85147 phandlers->send[PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_remove_clause_req_100;
85148 phandlers->send[PACKET_DIPLOMACY_ACCEPT_TREATY_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_accept_treaty_req_100;
85149 phandlers->send[PACKET_DIPLOMACY_CANCEL_PACT].packet = (int(*)(struct connection *, const void *)) send_packet_diplomacy_cancel_pact_100;
85150 phandlers->send[PACKET_REPORT_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_report_req_100;
85151 phandlers->send[PACKET_CONN_PONG].no_packet = (int(*)(struct connection *)) send_packet_conn_pong_100;
85152 phandlers->send[PACKET_CLIENT_HEARTBEAT].no_packet = (int(*)(struct connection *)) send_packet_client_heartbeat_100;
85153 phandlers->send[PACKET_CLIENT_INFO].packet = (int(*)(struct connection *, const void *)) send_packet_client_info_100;
85154 phandlers->send[PACKET_SPACESHIP_LAUNCH].no_packet = (int(*)(struct connection *)) send_packet_spaceship_launch_100;
85155 phandlers->send[PACKET_SPACESHIP_PLACE].packet = (int(*)(struct connection *, const void *)) send_packet_spaceship_place_100;
85156 phandlers->send[PACKET_SINGLE_WANT_HACK_REQ].packet = (int(*)(struct connection *, const void *)) send_packet_single_want_hack_req_100;
85157 phandlers->send[PACKET_RULESET_SELECT].packet = (int(*)(struct connection *, const void *)) send_packet_ruleset_select_100;
85158 phandlers->send[PACKET_SAVE_SCENARIO].packet = (int(*)(struct connection *, const void *)) send_packet_save_scenario_100;
85159 phandlers->send[PACKET_VOTE_SUBMIT].packet = (int(*)(struct connection *, const void *)) send_packet_vote_submit_100;
85160 phandlers->send[PACKET_EDIT_MODE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_mode_100;
85161 phandlers->send[PACKET_EDIT_RECALCULATE_BORDERS].no_packet = (int(*)(struct connection *)) send_packet_edit_recalculate_borders_100;
85162 phandlers->send[PACKET_EDIT_CHECK_TILES].no_packet = (int(*)(struct connection *)) send_packet_edit_check_tiles_100;
85163 phandlers->send[PACKET_EDIT_TOGGLE_FOGOFWAR].packet = (int(*)(struct connection *, const void *)) send_packet_edit_toggle_fogofwar_100;
85164 phandlers->send[PACKET_EDIT_TILE_TERRAIN].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_terrain_100;
85165 phandlers->send[PACKET_EDIT_TILE_EXTRA].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_extra_100;
85166 phandlers->send[PACKET_EDIT_TILE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_tile_100;
85167 phandlers->send[PACKET_EDIT_UNIT_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_create_100;
85168 phandlers->send[PACKET_EDIT_UNIT_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_remove_100;
85169 phandlers->send[PACKET_EDIT_UNIT_REMOVE_BY_ID].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_remove_by_id_100;
85170 phandlers->send[PACKET_EDIT_UNIT].packet = (int(*)(struct connection *, const void *)) send_packet_edit_unit_100;
85171 phandlers->send[PACKET_EDIT_CITY_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_create_100;
85172 phandlers->send[PACKET_EDIT_CITY_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_remove_100;
85173 phandlers->send[PACKET_EDIT_CITY].packet = (int(*)(struct connection *, const void *)) send_packet_edit_city_100;
85174 phandlers->send[PACKET_EDIT_PLAYER_CREATE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_create_100;
85175 phandlers->send[PACKET_EDIT_PLAYER_REMOVE].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_remove_100;
85176 phandlers->send[PACKET_EDIT_PLAYER].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_100;
85177 phandlers->send[PACKET_EDIT_PLAYER_VISION].packet = (int(*)(struct connection *, const void *)) send_packet_edit_player_vision_100;
85178 phandlers->send[PACKET_EDIT_GAME].packet = (int(*)(struct connection *, const void *)) send_packet_edit_game_100;
85179 phandlers->send[PACKET_EDIT_SCENARIO_DESC].packet = (int(*)(struct connection *, const void *)) send_packet_edit_scenario_desc_100;
85180 phandlers->send[PACKET_WEB_CMA_SET].packet = (int(*)(struct connection *, const void *)) send_packet_web_cma_set_100;
85181 phandlers->send[PACKET_WEB_CMA_CLEAR].packet = (int(*)(struct connection *, const void *)) send_packet_web_cma_clear_100;
85182 phandlers->receive[PACKET_PROCESSING_STARTED] = (void *(*)(struct connection *)) receive_packet_processing_started_100;
85183 phandlers->receive[PACKET_PROCESSING_FINISHED] = (void *(*)(struct connection *)) receive_packet_processing_finished_100;
85184 phandlers->receive[PACKET_INVESTIGATE_STARTED] = (void *(*)(struct connection *)) receive_packet_investigate_started_100;
85185 phandlers->receive[PACKET_INVESTIGATE_FINISHED] = (void *(*)(struct connection *)) receive_packet_investigate_finished_100;
85186 phandlers->receive[PACKET_SERVER_JOIN_REPLY] = (void *(*)(struct connection *)) receive_packet_server_join_reply_100;
85187 phandlers->receive[PACKET_AUTHENTICATION_REQ] = (void *(*)(struct connection *)) receive_packet_authentication_req_100;
85188 phandlers->receive[PACKET_SERVER_SHUTDOWN] = (void *(*)(struct connection *)) receive_packet_server_shutdown_100;
85189 phandlers->receive[PACKET_ENDGAME_REPORT] = (void *(*)(struct connection *)) receive_packet_endgame_report_100;
85190 phandlers->receive[PACKET_ENDGAME_PLAYER] = (void *(*)(struct connection *)) receive_packet_endgame_player_100;
85191 phandlers->receive[PACKET_TILE_INFO] = (void *(*)(struct connection *)) receive_packet_tile_info_100;
85192 phandlers->receive[PACKET_GAME_INFO] = (void *(*)(struct connection *)) receive_packet_game_info_100;
85193 phandlers->receive[PACKET_CALENDAR_INFO] = (void *(*)(struct connection *)) receive_packet_calendar_info_100;
85194 phandlers->receive[PACKET_TIMEOUT_INFO] = (void *(*)(struct connection *)) receive_packet_timeout_info_100;
85195 phandlers->receive[PACKET_MAP_INFO] = (void *(*)(struct connection *)) receive_packet_map_info_100;
85196 phandlers->receive[PACKET_NUKE_TILE_INFO] = (void *(*)(struct connection *)) receive_packet_nuke_tile_info_100;
85197 phandlers->receive[PACKET_TEAM_NAME_INFO] = (void *(*)(struct connection *)) receive_packet_team_name_info_100;
85198 phandlers->receive[PACKET_ACHIEVEMENT_INFO] = (void *(*)(struct connection *)) receive_packet_achievement_info_100;
85199 phandlers->receive[PACKET_CHAT_MSG] = (void *(*)(struct connection *)) receive_packet_chat_msg_100;
85200 phandlers->receive[PACKET_EARLY_CHAT_MSG] = (void *(*)(struct connection *)) receive_packet_early_chat_msg_100;
85201 phandlers->receive[PACKET_CONNECT_MSG] = (void *(*)(struct connection *)) receive_packet_connect_msg_100;
85202 phandlers->receive[PACKET_SERVER_INFO] = (void *(*)(struct connection *)) receive_packet_server_info_100;
85203 phandlers->receive[PACKET_CITY_REMOVE] = (void *(*)(struct connection *)) receive_packet_city_remove_100;
85204 phandlers->receive[PACKET_CITY_INFO] = (void *(*)(struct connection *)) receive_packet_city_info_100;
85205 phandlers->receive[PACKET_CITY_NATIONALITIES] = (void *(*)(struct connection *)) receive_packet_city_nationalities_100;
85206 phandlers->receive[PACKET_CITY_UPDATE_COUNTERS] = (void *(*)(struct connection *)) receive_packet_city_update_counters_100;
85207 phandlers->receive[PACKET_CITY_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_city_short_info_100;
85208 phandlers->receive[PACKET_TRADE_ROUTE_INFO] = (void *(*)(struct connection *)) receive_packet_trade_route_info_100;
85209 phandlers->receive[PACKET_CITY_NAME_SUGGESTION_INFO] = (void *(*)(struct connection *)) receive_packet_city_name_suggestion_info_100;
85210 phandlers->receive[PACKET_CITY_SABOTAGE_LIST] = (void *(*)(struct connection *)) receive_packet_city_sabotage_list_100;
85211 phandlers->receive[PACKET_PLAYER_REMOVE] = (void *(*)(struct connection *)) receive_packet_player_remove_100;
85212 phandlers->receive[PACKET_PLAYER_INFO] = (void *(*)(struct connection *)) receive_packet_player_info_100;
85213 phandlers->receive[PACKET_PLAYER_DIPLSTATE] = (void *(*)(struct connection *)) receive_packet_player_diplstate_100;
85214 phandlers->receive[PACKET_RESEARCH_INFO] = (void *(*)(struct connection *)) receive_packet_research_info_100;
85215 phandlers->receive[PACKET_UNKNOWN_RESEARCH] = (void *(*)(struct connection *)) receive_packet_unknown_research_100;
85216 phandlers->receive[PACKET_UNIT_REMOVE] = (void *(*)(struct connection *)) receive_packet_unit_remove_100;
85217 phandlers->receive[PACKET_UNIT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_info_100;
85218 phandlers->receive[PACKET_UNIT_SHORT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_short_info_100;
85219 phandlers->receive[PACKET_UNIT_COMBAT_INFO] = (void *(*)(struct connection *)) receive_packet_unit_combat_info_100;
85220 phandlers->receive[PACKET_UNIT_ACTION_ANSWER] = (void *(*)(struct connection *)) receive_packet_unit_action_answer_100;
85221 phandlers->receive[PACKET_UNIT_ACTIONS] = (void *(*)(struct connection *)) receive_packet_unit_actions_100;
85222 phandlers->receive[PACKET_DIPLOMACY_INIT_MEETING] = (void *(*)(struct connection *)) receive_packet_diplomacy_init_meeting_100;
85223 phandlers->receive[PACKET_DIPLOMACY_CANCEL_MEETING] = (void *(*)(struct connection *)) receive_packet_diplomacy_cancel_meeting_100;
85224 phandlers->receive[PACKET_DIPLOMACY_CREATE_CLAUSE] = (void *(*)(struct connection *)) receive_packet_diplomacy_create_clause_100;
85225 phandlers->receive[PACKET_DIPLOMACY_REMOVE_CLAUSE] = (void *(*)(struct connection *)) receive_packet_diplomacy_remove_clause_100;
85226 phandlers->receive[PACKET_DIPLOMACY_ACCEPT_TREATY] = (void *(*)(struct connection *)) receive_packet_diplomacy_accept_treaty_100;
85227 phandlers->receive[PACKET_PAGE_MSG] = (void *(*)(struct connection *)) receive_packet_page_msg_100;
85228 phandlers->receive[PACKET_PAGE_MSG_PART] = (void *(*)(struct connection *)) receive_packet_page_msg_part_100;
85229 phandlers->receive[PACKET_CONN_INFO] = (void *(*)(struct connection *)) receive_packet_conn_info_100;
85230 phandlers->receive[PACKET_CONN_PING_INFO] = (void *(*)(struct connection *)) receive_packet_conn_ping_info_100;
85231 phandlers->receive[PACKET_CONN_PING] = (void *(*)(struct connection *)) receive_packet_conn_ping_100;
85232 phandlers->receive[PACKET_END_PHASE] = (void *(*)(struct connection *)) receive_packet_end_phase_100;
85233 phandlers->receive[PACKET_START_PHASE] = (void *(*)(struct connection *)) receive_packet_start_phase_100;
85234 phandlers->receive[PACKET_NEW_YEAR] = (void *(*)(struct connection *)) receive_packet_new_year_100;
85235 phandlers->receive[PACKET_BEGIN_TURN] = (void *(*)(struct connection *)) receive_packet_begin_turn_100;
85236 phandlers->receive[PACKET_END_TURN] = (void *(*)(struct connection *)) receive_packet_end_turn_100;
85237 phandlers->receive[PACKET_FREEZE_CLIENT] = (void *(*)(struct connection *)) receive_packet_freeze_client_100;
85238 phandlers->receive[PACKET_THAW_CLIENT] = (void *(*)(struct connection *)) receive_packet_thaw_client_100;
85239 phandlers->receive[PACKET_SPACESHIP_INFO] = (void *(*)(struct connection *)) receive_packet_spaceship_info_100;
85240 phandlers->receive[PACKET_RULESET_UNIT] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_100;
85241 phandlers->receive[PACKET_RULESET_UNIT_BONUS] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_bonus_100;
85242 phandlers->receive[PACKET_RULESET_UNIT_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_flag_100;
85243 phandlers->receive[PACKET_RULESET_UNIT_CLASS_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_class_flag_100;
85244 phandlers->receive[PACKET_RULESET_GAME] = (void *(*)(struct connection *)) receive_packet_ruleset_game_100;
85245 phandlers->receive[PACKET_RULESET_SPECIALIST] = (void *(*)(struct connection *)) receive_packet_ruleset_specialist_100;
85246 phandlers->receive[PACKET_RULESET_GOVERNMENT_RULER_TITLE] = (void *(*)(struct connection *)) receive_packet_ruleset_government_ruler_title_100;
85247 phandlers->receive[PACKET_RULESET_TECH] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_100;
85248 phandlers->receive[PACKET_RULESET_TECH_CLASS] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_class_100;
85249 phandlers->receive[PACKET_RULESET_TECH_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_tech_flag_100;
85250 phandlers->receive[PACKET_RULESET_GOVERNMENT] = (void *(*)(struct connection *)) receive_packet_ruleset_government_100;
85251 phandlers->receive[PACKET_RULESET_TERRAIN_CONTROL] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_control_100;
85252 phandlers->receive[PACKET_RULESETS_READY] = (void *(*)(struct connection *)) receive_packet_rulesets_ready_100;
85253 phandlers->receive[PACKET_RULESET_NATION_SETS] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_sets_100;
85254 phandlers->receive[PACKET_RULESET_NATION_GROUPS] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_groups_100;
85255 phandlers->receive[PACKET_RULESET_NATION] = (void *(*)(struct connection *)) receive_packet_ruleset_nation_100;
85256 phandlers->receive[PACKET_NATION_AVAILABILITY] = (void *(*)(struct connection *)) receive_packet_nation_availability_100;
85257 phandlers->receive[PACKET_RULESET_STYLE] = (void *(*)(struct connection *)) receive_packet_ruleset_style_100;
85258 phandlers->receive[PACKET_RULESET_CITY] = (void *(*)(struct connection *)) receive_packet_ruleset_city_100;
85259 phandlers->receive[PACKET_RULESET_BUILDING] = (void *(*)(struct connection *)) receive_packet_ruleset_building_100;
85260 phandlers->receive[PACKET_RULESET_IMPR_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_impr_flag_100;
85261 phandlers->receive[PACKET_RULESET_TERRAIN] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_100;
85262 phandlers->receive[PACKET_RULESET_TERRAIN_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_terrain_flag_100;
85263 phandlers->receive[PACKET_RULESET_UNIT_CLASS] = (void *(*)(struct connection *)) receive_packet_ruleset_unit_class_100;
85264 phandlers->receive[PACKET_RULESET_EXTRA] = (void *(*)(struct connection *)) receive_packet_ruleset_extra_100;
85265 phandlers->receive[PACKET_RULESET_EXTRA_FLAG] = (void *(*)(struct connection *)) receive_packet_ruleset_extra_flag_100;
85266 phandlers->receive[PACKET_RULESET_BASE] = (void *(*)(struct connection *)) receive_packet_ruleset_base_100;
85267 phandlers->receive[PACKET_RULESET_ROAD] = (void *(*)(struct connection *)) receive_packet_ruleset_road_100;
85268 phandlers->receive[PACKET_RULESET_GOODS] = (void *(*)(struct connection *)) receive_packet_ruleset_goods_100;
85269 phandlers->receive[PACKET_RULESET_DISASTER] = (void *(*)(struct connection *)) receive_packet_ruleset_disaster_100;
85270 phandlers->receive[PACKET_RULESET_ACHIEVEMENT] = (void *(*)(struct connection *)) receive_packet_ruleset_achievement_100;
85271 phandlers->receive[PACKET_RULESET_TRADE] = (void *(*)(struct connection *)) receive_packet_ruleset_trade_100;
85272 phandlers->receive[PACKET_RULESET_ACTION] = (void *(*)(struct connection *)) receive_packet_ruleset_action_100;
85273 phandlers->receive[PACKET_RULESET_ACTION_ENABLER] = (void *(*)(struct connection *)) receive_packet_ruleset_action_enabler_100;
85274 phandlers->receive[PACKET_RULESET_ACTION_AUTO] = (void *(*)(struct connection *)) receive_packet_ruleset_action_auto_100;
85275 phandlers->receive[PACKET_RULESET_COUNTER] = (void *(*)(struct connection *)) receive_packet_ruleset_counter_100;
85276 phandlers->receive[PACKET_RULESET_MUSIC] = (void *(*)(struct connection *)) receive_packet_ruleset_music_100;
85277 phandlers->receive[PACKET_RULESET_MULTIPLIER] = (void *(*)(struct connection *)) receive_packet_ruleset_multiplier_100;
85278 phandlers->receive[PACKET_RULESET_CLAUSE] = (void *(*)(struct connection *)) receive_packet_ruleset_clause_100;
85279 phandlers->receive[PACKET_RULESET_CONTROL] = (void *(*)(struct connection *)) receive_packet_ruleset_control_100;
85280 phandlers->receive[PACKET_RULESET_SUMMARY] = (void *(*)(struct connection *)) receive_packet_ruleset_summary_100;
85281 phandlers->receive[PACKET_RULESET_DESCRIPTION_PART] = (void *(*)(struct connection *)) receive_packet_ruleset_description_part_100;
85282 phandlers->receive[PACKET_SINGLE_WANT_HACK_REPLY] = (void *(*)(struct connection *)) receive_packet_single_want_hack_reply_100;
85283 phandlers->receive[PACKET_RULESET_CHOICES] = (void *(*)(struct connection *)) receive_packet_ruleset_choices_100;
85284 phandlers->receive[PACKET_GAME_LOAD] = (void *(*)(struct connection *)) receive_packet_game_load_100;
85285 phandlers->receive[PACKET_SERVER_SETTING_CONTROL] = (void *(*)(struct connection *)) receive_packet_server_setting_control_100;
85286 phandlers->receive[PACKET_SERVER_SETTING_CONST] = (void *(*)(struct connection *)) receive_packet_server_setting_const_100;
85287 phandlers->receive[PACKET_SERVER_SETTING_BOOL] = (void *(*)(struct connection *)) receive_packet_server_setting_bool_100;
85288 phandlers->receive[PACKET_SERVER_SETTING_INT] = (void *(*)(struct connection *)) receive_packet_server_setting_int_100;
85289 phandlers->receive[PACKET_SERVER_SETTING_STR] = (void *(*)(struct connection *)) receive_packet_server_setting_str_100;
85290 phandlers->receive[PACKET_SERVER_SETTING_ENUM] = (void *(*)(struct connection *)) receive_packet_server_setting_enum_100;
85291 phandlers->receive[PACKET_SERVER_SETTING_BITWISE] = (void *(*)(struct connection *)) receive_packet_server_setting_bitwise_100;
85292 phandlers->receive[PACKET_SET_TOPOLOGY] = (void *(*)(struct connection *)) receive_packet_set_topology_100;
85293 phandlers->receive[PACKET_RULESET_EFFECT] = (void *(*)(struct connection *)) receive_packet_ruleset_effect_100;
85294 phandlers->receive[PACKET_RULESET_RESOURCE] = (void *(*)(struct connection *)) receive_packet_ruleset_resource_100;
85295 phandlers->receive[PACKET_SCENARIO_INFO] = (void *(*)(struct connection *)) receive_packet_scenario_info_100;
85296 phandlers->receive[PACKET_SCENARIO_DESCRIPTION] = (void *(*)(struct connection *)) receive_packet_scenario_description_100;
85297 phandlers->receive[PACKET_VOTE_NEW] = (void *(*)(struct connection *)) receive_packet_vote_new_100;
85298 phandlers->receive[PACKET_VOTE_UPDATE] = (void *(*)(struct connection *)) receive_packet_vote_update_100;
85299 phandlers->receive[PACKET_VOTE_REMOVE] = (void *(*)(struct connection *)) receive_packet_vote_remove_100;
85300 phandlers->receive[PACKET_VOTE_RESOLVE] = (void *(*)(struct connection *)) receive_packet_vote_resolve_100;
85301 phandlers->receive[PACKET_EDIT_OBJECT_CREATED] = (void *(*)(struct connection *)) receive_packet_edit_object_created_100;
85302 phandlers->receive[PACKET_PLAY_MUSIC] = (void *(*)(struct connection *)) receive_packet_play_music_100;
85303 phandlers->receive[PACKET_WEB_CITY_INFO_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_city_info_addition_100;
85304 phandlers->receive[PACKET_WEB_PLAYER_INFO_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_player_info_addition_100;
85305 phandlers->receive[PACKET_WEB_RULESET_UNIT_ADDITION] = (void *(*)(struct connection *)) receive_packet_web_ruleset_unit_addition_100;
85306 }
85307}
85308
85309 void packet_handlers_fill_capability(struct packet_handlers *phandlers,
85310 const char *capability)
85311{
85312}
are_action_probabilitys_equal
bool are_action_probabilitys_equal(const struct act_prob *ap1, const struct act_prob *ap2)
Definition actions.c:5874
MAX_NUM_ACTIONS
#define MAX_NUM_ACTIONS
Definition actions.h:312
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:99
resources
char * resources
Definition comments.c:36
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
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:171
DIO_BV_GET
#define DIO_BV_GET(pdin, location, bv)
Definition dataio_json.h:100
DIO_GET
#define DIO_GET(f, d, l,...)
Definition dataio_json.h:104
DIO_PUT
#define DIO_PUT(f, d, l,...)
Definition dataio_json.h:174
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:415
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:413
Nation_type_id
int Nation_type_id
Definition fc_types.h:383
Terrain_type_id
int Terrain_type_id
Definition fc_types.h:376
action_id
int action_id
Definition fc_types.h:392
SP_MAX
#define SP_MAX
Definition fc_types.h:412
Specialist_type_id
int Specialist_type_id
Definition fc_types.h:378
Government_type_id
int Government_type_id
Definition fc_types.h:384
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:1297
Unit_type_id
int Unit_type_id
Definition fc_types.h:385
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:389
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
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:128
RECEIVE_PACKET_START
#define RECEIVE_PACKET_START(packet_type, result)
Definition packets.h:146
SEND_PACKET_END
#define SEND_PACKET_END(packet_type)
Definition packets.h:136
RECEIVE_PACKET_FIELD_ERROR
#define RECEIVE_PACKET_FIELD_ERROR(field,...)
Definition packets.h:170
RECEIVE_PACKET_END
#define RECEIVE_PACKET_END(result)
Definition packets.h:161
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:10325
receive_packet_set_topology_100
static struct packet_set_topology * receive_packet_set_topology_100(struct connection *pc)
Definition packets_gen.c:72062
receive_packet_chat_msg_100
static struct packet_chat_msg * receive_packet_chat_msg_100(struct connection *pc)
Definition packets_gen.c:11180
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:20699
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:50209
receive_packet_edit_tile_100
static struct packet_edit_tile * receive_packet_edit_tile_100(struct connection *pc)
Definition packets_gen.c:76175
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:36747
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:78441
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:33614
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:41159
lsend_packet_ruleset_summary
void lsend_packet_ruleset_summary(struct conn_list *dest, const struct packet_ruleset_summary *packet)
Definition packets_gen.c:67542
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:35199
receive_packet_thaw_client_100
static struct packet_thaw_client * receive_packet_thaw_client_100(struct connection *pc)
Definition packets_gen.c:38889
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:34732
send_packet_conn_ping
int send_packet_conn_ping(struct connection *pc)
Definition packets_gen.c:37973
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:35037
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:3051
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:34298
receive_packet_unit_actions_100
static struct packet_unit_actions * receive_packet_unit_actions_100(struct connection *pc)
Definition packets_gen.c:32853
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:24966
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:36066
send_packet_ruleset_counter
int send_packet_ruleset_counter(struct connection *pc, const struct packet_ruleset_counter *packet)
Definition packets_gen.c:64240
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:54605
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:25382
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:21281
delta_stats_reset
void delta_stats_reset(void)
Definition packets_gen.c:46
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:12179
send_packet_vote_resolve
int send_packet_vote_resolve(struct connection *pc, const struct packet_vote_resolve *packet)
Definition packets_gen.c:74866
lsend_packet_start_phase
void lsend_packet_start_phase(struct conn_list *dest, const struct packet_start_phase *packet)
Definition packets_gen.c:38502
lsend_packet_ruleset_building
void lsend_packet_ruleset_building(struct conn_list *dest, const struct packet_ruleset_building *packet)
Definition packets_gen.c:53473
send_packet_edit_city
int send_packet_edit_city(struct connection *pc, const struct packet_edit_city *packet)
Definition packets_gen.c:80422
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:72042
lsend_packet_new_year
void lsend_packet_new_year(struct conn_list *dest, const struct packet_new_year *packet)
Definition packets_gen.c:38771
receive_packet_game_info_100
static struct packet_game_info * receive_packet_game_info_100(struct connection *pc)
Definition packets_gen.c:3875
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:68178
lsend_packet_endgame_player
void lsend_packet_endgame_player(struct conn_list *dest, const struct packet_endgame_player *packet)
Definition packets_gen.c:3147
send_packet_player_attribute_block_100
static int send_packet_player_attribute_block_100(struct connection *pc)
Definition packets_gen.c:25212
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:64439
send_packet_conn_pong_100
static int send_packet_conn_pong_100(struct connection *pc)
Definition packets_gen.c:37995
send_packet_ruleset_game
int send_packet_ruleset_game(struct connection *pc, const struct packet_ruleset_game *packet)
Definition packets_gen.c:44978
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:43600
send_packet_unknown_research
int send_packet_unknown_research(struct connection *pc, const struct packet_unknown_research *packet)
Definition packets_gen.c:26955
lsend_packet_tile_info
void lsend_packet_tile_info(struct conn_list *dest, const struct packet_tile_info *packet)
Definition packets_gen.c:3860
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:25739
receive_packet_ruleset_control_100
static struct packet_ruleset_control * receive_packet_ruleset_control_100(struct connection *pc)
Definition packets_gen.c:66060
send_packet_ruleset_resource
int send_packet_ruleset_resource(struct connection *pc, const struct packet_ruleset_resource *packet)
Definition packets_gen.c:73015
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:31338
dsend_packet_player_rates
int dsend_packet_player_rates(struct connection *pc, int tax, int luxury, int science)
Definition packets_gen.c:24791
dsend_packet_spaceship_place
int dsend_packet_spaceship_place(struct connection *pc, enum spaceship_place_type type, int num)
Definition packets_gen.c:39171
dlsend_packet_city_remove
void dlsend_packet_city_remove(struct conn_list *dest, int city_id)
Definition packets_gen.c:12845
send_packet_processing_finished_100
static int send_packet_processing_finished_100(struct connection *pc)
Definition packets_gen.c:1134
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:43086
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:76914
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:39533
lsend_packet_edit_player
void lsend_packet_edit_player(struct conn_list *dest, const struct packet_edit_player *packet)
Definition packets_gen.c:82046
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:48369
send_packet_end_turn
int send_packet_end_turn(struct connection *pc)
Definition packets_gen.c:38833
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:17196
send_packet_ruleset_achievement
int send_packet_ruleset_achievement(struct connection *pc, const struct packet_ruleset_achievement *packet)
Definition packets_gen.c:61762
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:63503
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:82166
receive_packet_conn_ping_100
static struct packet_conn_ping * receive_packet_conn_ping_100(struct connection *pc)
Definition packets_gen.c:37955
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:78429
lsend_packet_research_info
void lsend_packet_research_info(struct conn_list *dest, const struct packet_research_info *packet)
Definition packets_gen.c:26777
send_packet_worker_task
int send_packet_worker_task(struct connection *pc, const struct packet_worker_task *packet)
Definition packets_gen.c:21620
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:16906
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:84897
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 char *helptext)
Definition packets_gen.c:65466
lsend_packet_map_info
void lsend_packet_map_info(struct conn_list *dest, const struct packet_map_info *packet)
Definition packets_gen.c:10535
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:48959
receive_packet_ruleset_city_100
static struct packet_ruleset_city * receive_packet_ruleset_city_100(struct connection *pc)
Definition packets_gen.c:51847
receive_packet_ruleset_choices_100
static struct packet_ruleset_choices * receive_packet_ruleset_choices_100(struct connection *pc)
Definition packets_gen.c:68051
dsend_packet_connect_msg
int dsend_packet_connect_msg(struct connection *pc, const char *message)
Definition packets_gen.c:12269
receive_packet_rulesets_ready_100
static struct packet_rulesets_ready * receive_packet_rulesets_ready_100(struct connection *pc)
Definition packets_gen.c:48324
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:75325
lsend_packet_game_load
void lsend_packet_game_load(struct conn_list *dest, const struct packet_game_load *packet)
Definition packets_gen.c:68700
lsend_packet_ruleset_achievement
void lsend_packet_ruleset_achievement(struct conn_list *dest, const struct packet_ruleset_achievement *packet)
Definition packets_gen.c:61774
receive_packet_ruleset_unit_100
static struct packet_ruleset_unit * receive_packet_ruleset_unit_100(struct connection *pc)
Definition packets_gen.c:40062
receive_packet_report_req_100
static struct packet_report_req * receive_packet_report_req_100(struct connection *pc)
Definition packets_gen.c:36852
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:48944
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:20514
send_packet_ruleset_government
int send_packet_ruleset_government(struct connection *pc, const struct packet_ruleset_government *packet)
Definition packets_gen.c:47741
receive_packet_city_info_100
static struct packet_city_info * receive_packet_city_info_100(struct connection *pc)
Definition packets_gen.c:12879
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:82848
send_packet_unit_remove
int send_packet_unit_remove(struct connection *pc, const struct packet_unit_remove *packet)
Definition packets_gen.c:27491
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:2454
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:16533
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:84352
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:24526
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:73225
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:76058
receive_packet_ruleset_multiplier_100
static struct packet_ruleset_multiplier * receive_packet_ruleset_multiplier_100(struct connection *pc)
Definition packets_gen.c:64696
receive_packet_tile_info_100
static struct packet_tile_info * receive_packet_tile_info_100(struct connection *pc)
Definition packets_gen.c:3179
receive_packet_page_msg_100
static struct packet_page_msg * receive_packet_page_msg_100(struct connection *pc)
Definition packets_gen.c:36340
receive_packet_vote_update_100
static struct packet_vote_update * receive_packet_vote_update_100(struct connection *pc)
Definition packets_gen.c:74205
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:76367
lsend_packet_ruleset_multiplier
void lsend_packet_ruleset_multiplier(struct conn_list *dest, const struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:65432
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:10758
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:65734
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:31828
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:46784
send_packet_edit_check_tiles_100
static int send_packet_edit_check_tiles_100(struct connection *pc)
Definition packets_gen.c:75151
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:2725
send_packet_conn_ping_100
static int send_packet_conn_ping_100(struct connection *pc)
Definition packets_gen.c:37965
dsend_packet_diplomacy_cancel_meeting
int dsend_packet_diplomacy_cancel_meeting(struct connection *pc, int counterpart, int initiated_from)
Definition packets_gen.c:34419
receive_packet_endgame_report_100
static struct packet_endgame_report * receive_packet_endgame_report_100(struct connection *pc)
Definition packets_gen.c:2838
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:68597
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:63252
dsend_packet_player_remove
int dsend_packet_player_remove(struct connection *pc, int playerno)
Definition packets_gen.c:21815
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:52378
send_packet_edit_recalculate_borders_100
static int send_packet_edit_recalculate_borders_100(struct connection *pc)
Definition packets_gen.c:75121
send_packet_edit_game
int send_packet_edit_game(struct connection *pc, const struct packet_edit_game *packet)
Definition packets_gen.c:82662
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:31643
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:34412
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:36322
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:30056
send_packet_nation_availability
int send_packet_nation_availability(struct connection *pc, const struct packet_nation_availability *packet)
Definition packets_gen.c:51569
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:47985
dsend_packet_authentication_req
int dsend_packet_authentication_req(struct connection *pc, enum authentication_type type, const char *message)
Definition packets_gen.c:2103
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:48932
dsend_packet_city_sell
int dsend_packet_city_sell(struct connection *pc, int city_id, int build_id)
Definition packets_gen.c:18181
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:20900
lsend_packet_ruleset_unit
void lsend_packet_ruleset_unit(struct conn_list *dest, const struct packet_ruleset_unit *packet)
Definition packets_gen.c:42758
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:69985
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:31611
dsend_packet_diplomacy_init_meeting_req
int dsend_packet_diplomacy_init_meeting_req(struct connection *pc, int counterpart)
Definition packets_gen.c:33791
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:66570
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:32152
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:19029
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:71371
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:56524
receive_packet_spaceship_info_100
static struct packet_spaceship_info * receive_packet_spaceship_info_100(struct connection *pc)
Definition packets_gen.c:39206
send_packet_ruleset_multiplier
int send_packet_ruleset_multiplier(struct connection *pc, const struct packet_ruleset_multiplier *packet)
Definition packets_gen.c:65420
receive_packet_city_worklist_100
static struct packet_city_worklist * receive_packet_city_worklist_100(struct connection *pc)
Definition packets_gen.c:18629
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:58880
lsend_packet_unit_remove
void lsend_packet_unit_remove(struct conn_list *dest, const struct packet_unit_remove *packet)
Definition packets_gen.c:27503
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:35673
send_packet_city_rename
int send_packet_city_rename(struct connection *pc, const struct packet_city_rename *packet)
Definition packets_gen.c:19734
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:77070
receive_packet_ruleset_game_100
static struct packet_ruleset_game * receive_packet_ruleset_game_100(struct connection *pc)
Definition packets_gen.c:43615
dlsend_packet_diplomacy_init_meeting
void dlsend_packet_diplomacy_init_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:34022
send_packet_ruleset_select
int send_packet_ruleset_select(struct connection *pc, const struct packet_ruleset_select *packet)
Definition packets_gen.c:68502
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:43113
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:16257
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:36115
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:11333
send_packet_endgame_player
int send_packet_endgame_player(struct connection *pc, const struct packet_endgame_player *packet)
Definition packets_gen.c:3135
lsend_packet_ruleset_clause
void lsend_packet_ruleset_clause(struct conn_list *dest, const struct packet_ruleset_clause *packet)
Definition packets_gen.c:66045
send_packet_new_year
int send_packet_new_year(struct connection *pc, const struct packet_new_year *packet)
Definition packets_gen.c:38759
receive_packet_edit_mode_100
static struct packet_edit_mode * receive_packet_edit_mode_100(struct connection *pc)
Definition packets_gen.c:74964
receive_packet_spaceship_place_100
static struct packet_spaceship_place * receive_packet_spaceship_place_100(struct connection *pc)
Definition packets_gen.c:38964
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:67896
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:59706
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:70626
send_packet_ruleset_road
int send_packet_ruleset_road(struct connection *pc, const struct packet_ruleset_road *packet)
Definition packets_gen.c:60272
lsend_packet_chat_msg
void lsend_packet_chat_msg(struct conn_list *dest, const struct packet_chat_msg *packet)
Definition packets_gen.c:11543
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:43337
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:82469
send_packet_ruleset_city
int send_packet_ruleset_city(struct connection *pc, const struct packet_ruleset_city *packet)
Definition packets_gen.c:52366
send_packet_ruleset_goods
int send_packet_ruleset_goods(struct connection *pc, const struct packet_ruleset_goods *packet)
Definition packets_gen.c:60896
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:1618
lsend_packet_begin_turn
void lsend_packet_begin_turn(struct conn_list *dest)
Definition packets_gen.c:38808
send_packet_thaw_client_100
static int send_packet_thaw_client_100(struct connection *pc)
Definition packets_gen.c:38899
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:31799
receive_packet_ruleset_building_100
static struct packet_ruleset_building * receive_packet_ruleset_building_100(struct connection *pc)
Definition packets_gen.c:52393
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:67557
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:1142
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:2189
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:43349
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:24653
send_packet_page_msg
int send_packet_page_msg(struct connection *pc, const struct packet_page_msg *packet)
Definition packets_gen.c:36652
send_packet_conn_pong
int send_packet_conn_pong(struct connection *pc)
Definition packets_gen.c:38003
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:17759
send_packet_player_multiplier
int send_packet_player_multiplier(struct connection *pc, const struct packet_player_multiplier *packet)
Definition packets_gen.c:26259
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:51694
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:64018
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:1740
lsend_packet_endgame_report
void lsend_packet_endgame_report(struct conn_list *dest, const struct packet_endgame_report *packet)
Definition packets_gen.c:2975
send_packet_endgame_report
int send_packet_endgame_report(struct connection *pc, const struct packet_endgame_report *packet)
Definition packets_gen.c:2963
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:52064
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:74602
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:69414
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:12714
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:78461
send_packet_city_remove
int send_packet_city_remove(struct connection *pc, const struct packet_city_remove *packet)
Definition packets_gen.c:12817
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:69583
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:45733
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:19961
lsend_packet_conn_info
void lsend_packet_conn_info(struct conn_list *dest, const struct packet_conn_info *packet)
Definition packets_gen.c:37497
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:75483
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:30837
send_packet_server_info
int send_packet_server_info(struct connection *pc, const struct packet_server_info *packet)
Definition packets_gen.c:12588
receive_packet_achievement_info_100
static struct packet_achievement_info * receive_packet_achievement_info_100(struct connection *pc)
Definition packets_gen.c:10967
receive_packet_authentication_reply_100
static struct packet_authentication_reply * receive_packet_authentication_reply_100(struct connection *pc)
Definition packets_gen.c:2121
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:1814
receive_packet_map_info_100
static struct packet_map_info * receive_packet_map_info_100(struct connection *pc)
Definition packets_gen.c:10182
receive_packet_server_info_100
static struct packet_server_info * receive_packet_server_info_100(struct connection *pc)
Definition packets_gen.c:12286
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:67956
receive_packet_city_remove_100
static struct packet_city_remove * receive_packet_city_remove_100(struct connection *pc)
Definition packets_gen.c:12621
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:70663
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:32173
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:77220
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:6092
send_packet_freeze_client_100
static int send_packet_freeze_client_100(struct connection *pc)
Definition packets_gen.c:38862
receive_packet_spaceship_launch_100
static struct packet_spaceship_launch * receive_packet_spaceship_launch_100(struct connection *pc)
Definition packets_gen.c:38926
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:31308
dsend_packet_investigate_finished
int dsend_packet_investigate_finished(struct connection *pc, int unit_id, int city_id)
Definition packets_gen.c:1598
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:11921
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:20300
receive_packet_nation_availability_100
static struct packet_nation_availability * receive_packet_nation_availability_100(struct connection *pc)
Definition packets_gen.c:51264
send_packet_ruleset_extra
int send_packet_ruleset_extra(struct connection *pc, const struct packet_ruleset_extra *packet)
Definition packets_gen.c:58629
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:16008
lsend_packet_ruleset_action
void lsend_packet_ruleset_action(struct conn_list *dest, const struct packet_ruleset_action *packet)
Definition packets_gen.c:62698
receive_packet_ruleset_effect_100
static struct packet_ruleset_effect * receive_packet_ruleset_effect_100(struct connection *pc)
Definition packets_gen.c:72267
send_packet_unit_actions
int send_packet_unit_actions(struct connection *pc, const struct packet_unit_actions *packet)
Definition packets_gen.c:33327
receive_packet_player_multiplier_100
static struct packet_player_multiplier * receive_packet_player_multiplier_100(struct connection *pc)
Definition packets_gen.c:25974
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:46934
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:47059
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:31113
receive_packet_save_scenario_100
static struct packet_save_scenario * receive_packet_save_scenario_100(struct connection *pc)
Definition packets_gen.c:73691
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:75371
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:17969
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:36078
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:1752
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:16565
send_packet_ruleset_summary
int send_packet_ruleset_summary(struct connection *pc, const struct packet_ruleset_summary *packet)
Definition packets_gen.c:67530
lsend_packet_ruleset_extra
void lsend_packet_ruleset_extra(struct conn_list *dest, const struct packet_ruleset_extra *packet)
Definition packets_gen.c:58641
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:75930
receive_packet_edit_game_100
static struct packet_edit_game * receive_packet_edit_game_100(struct connection *pc)
Definition packets_gen.c:82337
packet_handlers_fill_capability
void packet_handlers_fill_capability(struct packet_handlers *phandlers, const char *capability)
Definition packets_gen.c:85309
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:12600
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:49395
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:77320
receive_packet_ruleset_counter_100
static struct packet_ruleset_counter * receive_packet_ruleset_counter_100(struct connection *pc)
Definition packets_gen.c:63840
receive_packet_edit_player_100
static struct packet_edit_player * receive_packet_edit_player_100(struct connection *pc)
Definition packets_gen.c:80809
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:48317
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:67876
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:35685
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:33476
receive_packet_ruleset_trade_100
static struct packet_ruleset_trade * receive_packet_ruleset_trade_100(struct connection *pc)
Definition packets_gen.c:61789
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:45895
send_packet_scenario_info
int send_packet_scenario_info(struct connection *pc, const struct packet_scenario_info *packet)
Definition packets_gen.c:73505
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:70275
send_packet_ruleset_base
int send_packet_ruleset_base(struct connection *pc, const struct packet_ruleset_base *packet)
Definition packets_gen.c:59258
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:76947
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:58656
dlsend_packet_unit_remove
void dlsend_packet_unit_remove(struct conn_list *dest, int unit_id)
Definition packets_gen.c:27519
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:82061
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:10550
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:70238
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:84885
lsend_packet_ruleset_music
void lsend_packet_ruleset_music(struct conn_list *dest, const struct packet_ruleset_music *packet)
Definition packets_gen.c:64681
send_packet_ruleset_choices
int send_packet_ruleset_choices(struct connection *pc, const struct packet_ruleset_choices *packet)
Definition packets_gen.c:68336
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:78166
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:69068
receive_packet_timeout_info_100
static struct packet_timeout_info * receive_packet_timeout_info_100(struct connection *pc)
Definition packets_gen.c:9977
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:61922
receive_packet_ruleset_tech_100
static struct packet_ruleset_tech * receive_packet_ruleset_tech_100(struct connection *pc)
Definition packets_gen.c:45910
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:33701
dsend_packet_chat_msg_req
int dsend_packet_chat_msg_req(struct connection *pc, const char *message)
Definition packets_gen.c:12094
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:1766
send_packet_play_music
int send_packet_play_music(struct connection *pc, const struct packet_play_music *packet)
Definition packets_gen.c:83209
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:29638
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:69770
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:27150
dsend_packet_unit_remove
int dsend_packet_unit_remove(struct connection *pc, int unit_id)
Definition packets_gen.c:27510
dsend_packet_city_worklist
int dsend_packet_city_worklist(struct connection *pc, int city_id, const struct worklist *worklist)
Definition packets_gen.c:18826
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:19274
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:3471
receive_packet_city_rename_100
static struct packet_city_rename * receive_packet_city_rename_100(struct connection *pc)
Definition packets_gen.c:19549
receive_packet_investigate_started_100
static struct packet_investigate_started * receive_packet_investigate_started_100(struct connection *pc)
Definition packets_gen.c:1162
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:76093
send_packet_city_change
int send_packet_city_change(struct connection *pc, const struct packet_city_change *packet)
Definition packets_gen.c:18598
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:69105
send_packet_processing_started
int send_packet_processing_started(struct connection *pc)
Definition packets_gen.c:1112
receive_packet_vote_new_100
static struct packet_vote_new * receive_packet_vote_new_100(struct connection *pc)
Definition packets_gen.c:73866
receive_packet_unit_orders_100
static struct packet_unit_orders * receive_packet_unit_orders_100(struct connection *pc)
Definition packets_gen.c:30651
send_packet_report_req
int send_packet_report_req(struct connection *pc, const struct packet_report_req *packet)
Definition packets_gen.c:37008
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:35044
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:81321
send_packet_vote_submit
int send_packet_vote_submit(struct connection *pc, const struct packet_vote_submit *packet)
Definition packets_gen.c:74944
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:17957
receive_packet_unit_info_100
static struct packet_unit_info * receive_packet_unit_info_100(struct connection *pc)
Definition packets_gen.c:27553
receive_packet_new_year_100
static struct packet_new_year * receive_packet_new_year_100(struct connection *pc)
Definition packets_gen.c:38535
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:16020
packet_functional_capability
const char *const packet_functional_capability
Definition packets_gen.c:30
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:1671
dsend_packet_city_make_specialist
int dsend_packet_city_make_specialist(struct connection *pc, int city_id, int tile_id)
Definition packets_gen.c:19041
send_packet_chat_msg
int send_packet_chat_msg(struct connection *pc, const struct packet_chat_msg *packet)
Definition packets_gen.c:11531
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:35773
lsend_packet_ruleset_control
void lsend_packet_ruleset_control(struct conn_list *dest, const struct packet_ruleset_control *packet)
Definition packets_gen.c:67369
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:75990
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:32140
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:35962
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:2324
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:11909
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:46209
receive_packet_city_buy_100
static struct packet_city_buy * receive_packet_city_buy_100(struct connection *pc)
Definition packets_gen.c:18199
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:77252
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:68424
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:63813
dsend_packet_nuke_tile_info
int dsend_packet_nuke_tile_info(struct connection *pc, int tile)
Definition packets_gen.c:10715
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:26488
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:19244
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:67625
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:9724
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:35349
dsend_packet_diplomacy_cancel_meeting_req
int dsend_packet_diplomacy_cancel_meeting_req(struct connection *pc, int counterpart)
Definition packets_gen.c:34198
send_packet_unit_orders
int send_packet_unit_orders(struct connection *pc, const struct packet_unit_orders *packet)
Definition packets_gen.c:31093
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:37936
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:32832
dsend_packet_player_tech_goal
int dsend_packet_player_tech_goal(struct connection *pc, int tech)
Definition packets_gen.c:27308
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:62939
send_packet_player_rates
int send_packet_player_rates(struct connection *pc, const struct packet_player_rates *packet)
Definition packets_gen.c:24779
send_packet_player_diplstate
int send_packet_player_diplstate(struct connection *pc, const struct packet_player_diplstate *packet)
Definition packets_gen.c:25954
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:18610
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:80763
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:84284
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:69451
receive_packet_endgame_player_100
static struct packet_endgame_player * receive_packet_endgame_player_100(struct connection *pc)
Definition packets_gen.c:2982
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:18927
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:75247
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:34215
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:20873
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:76740
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:20047
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:37698
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:34570
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:10952
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:38161
dlsend_packet_investigate_finished
void dlsend_packet_investigate_finished(struct conn_list *dest, int unit_id, int city_id)
Definition packets_gen.c:1608
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:76602
receive_packet_city_nationalities_100
static struct packet_city_nationalities * receive_packet_city_nationalities_100(struct connection *pc)
Definition packets_gen.c:16052
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:84430
lsend_packet_ruleset_effect
void lsend_packet_ruleset_effect(struct conn_list *dest, const struct packet_ruleset_effect *packet)
Definition packets_gen.c:72721
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 char *helptext)
Definition packets_gen.c:65439
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:73994
send_packet_city_refresh
int send_packet_city_refresh(struct connection *pc, const struct packet_city_refresh *packet)
Definition packets_gen.c:20125
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:30041
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:18267
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:20222
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:35851
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:32485
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:73593
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:56090
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:56536
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:16711
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:11936
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:84082
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:10060
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:34447
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:31320
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:82305
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:68022
receive_packet_ruleset_terrain_100
static struct packet_ruleset_terrain * receive_packet_ruleset_terrain_100(struct connection *pc)
Definition packets_gen.c:53739
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:56278
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:22859
send_packet_end_phase
int send_packet_end_phase(struct connection *pc)
Definition packets_gen.c:38317
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:76138
lsend_packet_ruleset_disaster
void lsend_packet_ruleset_disaster(struct conn_list *dest, const struct packet_ruleset_disaster *packet)
Definition packets_gen.c:61415
lsend_packet_spaceship_info
void lsend_packet_spaceship_info(struct conn_list *dest, const struct packet_spaceship_info *packet)
Definition packets_gen.c:40047
dsend_packet_diplomacy_init_meeting
int dsend_packet_diplomacy_init_meeting(struct connection *pc, int counterpart, int initiated_from)
Definition packets_gen.c:34012
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:17596
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:80442
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:73759
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:19530
send_packet_ruleset_terrain
int send_packet_ruleset_terrain(struct connection *pc, const struct packet_ruleset_terrain *packet)
Definition packets_gen.c:55827
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:43462
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:75774
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:20412
lsend_packet_page_msg
void lsend_packet_page_msg(struct conn_list *dest, const struct packet_page_msg *packet)
Definition packets_gen.c:36664
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:31721
send_packet_player_info
int send_packet_player_info(struct connection *pc, const struct packet_player_info *packet)
Definition packets_gen.c:24360
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:25078
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:19949
send_packet_end_phase_100
static int send_packet_end_phase_100(struct connection *pc)
Definition packets_gen.c:38309
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:2629
send_packet_ruleset_clause
int send_packet_ruleset_clause(struct connection *pc, const struct packet_ruleset_clause *packet)
Definition packets_gen.c:66033
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:34720
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:21446
receive_packet_ruleset_government_100
static struct packet_ruleset_government * receive_packet_ruleset_government_100(struct connection *pc)
Definition packets_gen.c:47212
send_packet_spaceship_launch_100
static int send_packet_spaceship_launch_100(struct connection *pc)
Definition packets_gen.c:38936
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:16521
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:80685
dsend_packet_edit_startpos
int dsend_packet_edit_startpos(struct connection *pc, int id, bool removal, int tag)
Definition packets_gen.c:76047
receive_packet_ruleset_music_100
static struct packet_ruleset_music * receive_packet_ruleset_music_100(struct connection *pc)
Definition packets_gen.c:64267
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:31966
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:2617
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:56105
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:67715
send_packet_end_turn_100
static int send_packet_end_turn_100(struct connection *pc)
Definition packets_gen.c:38825
receive_packet_connect_msg_100
static struct packet_connect_msg * receive_packet_connect_msg_100(struct connection *pc)
Definition packets_gen.c:12111
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:17581
dsend_packet_city_refresh
int dsend_packet_city_refresh(struct connection *pc, int city_id)
Definition packets_gen.c:20137
lsend_packet_ruleset_government
void lsend_packet_ruleset_government(struct conn_list *dest, const struct packet_ruleset_government *packet)
Definition packets_gen.c:47753
send_packet_ruleset_tech
int send_packet_ruleset_tech(struct connection *pc, const struct packet_ruleset_tech *packet)
Definition packets_gen.c:46644
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:10618
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:70944
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:62713
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:33368
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:35504
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:24448
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:25180
send_packet_ruleset_nation
int send_packet_ruleset_nation(struct connection *pc, const struct packet_ruleset_nation *packet)
Definition packets_gen.c:51237
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:19142
send_packet_server_shutdown_100
static int send_packet_server_shutdown_100(struct connection *pc)
Definition packets_gen.c:2289
send_packet_begin_turn
int send_packet_begin_turn(struct connection *pc)
Definition packets_gen.c:38796
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:43098
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:30386
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:59060
dlsend_packet_nuke_tile_info
void dlsend_packet_nuke_tile_info(struct conn_list *dest, int tile)
Definition packets_gen.c:10724
receive_packet_client_info_100
static struct packet_client_info * receive_packet_client_info_100(struct connection *pc)
Definition packets_gen.c:38053
send_packet_connect_msg
int send_packet_connect_msg(struct connection *pc, const struct packet_connect_msg *packet)
Definition packets_gen.c:12257
receive_packet_unit_remove_100
static struct packet_unit_remove * receive_packet_unit_remove_100(struct connection *pc)
Definition packets_gen.c:27325
dsend_packet_city_make_worker
int dsend_packet_city_make_worker(struct connection *pc, int city_id, int tile_id)
Definition packets_gen.c:19256
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:72466
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:44196
receive_packet_calendar_info_100
static struct packet_calendar_info * receive_packet_calendar_info_100(struct connection *pc)
Definition packets_gen.c:9566
send_packet_player_remove
int send_packet_player_remove(struct connection *pc, const struct packet_player_remove *packet)
Definition packets_gen.c:21803
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:34752
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:84467
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:34186
receive_packet_play_music_100
static struct packet_play_music * receive_packet_play_music_100(struct connection *pc)
Definition packets_gen.c:83063
lsend_packet_worker_task
void lsend_packet_worker_task(struct conn_list *dest, const struct packet_worker_task *packet)
Definition packets_gen.c:21632
dsend_packet_player_phase_done
int dsend_packet_player_phase_done(struct connection *pc, int turn)
Definition packets_gen.c:24538
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:30494
send_packet_investigate_started
int send_packet_investigate_started(struct connection *pc, const struct packet_investigate_started *packet)
Definition packets_gen.c:1347
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:11711
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:32311
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:20329
send_packet_investigate_finished
int send_packet_investigate_finished(struct connection *pc, const struct packet_investigate_finished *packet)
Definition packets_gen.c:1579
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:83131
send_packet_client_heartbeat
int send_packet_client_heartbeat(struct connection *pc)
Definition packets_gen.c:38033
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:17569
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:83033
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:26101
send_packet_authentication_reply
int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
Definition packets_gen.c:2267
send_packet_edit_player
int send_packet_edit_player(struct connection *pc, const struct packet_edit_player *packet)
Definition packets_gen.c:82034
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:19392
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:78529
receive_packet_ruleset_style_100
static struct packet_ruleset_style * receive_packet_ruleset_style_100(struct connection *pc)
Definition packets_gen.c:51596
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:79368
lsend_packet_ruleset_base
void lsend_packet_ruleset_base(struct conn_list *dest, const struct packet_ruleset_base *packet)
Definition packets_gen.c:59270
dsend_packet_game_load
int dsend_packet_game_load(struct connection *pc, bool load_successful, const char *load_filename)
Definition packets_gen.c:68707
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:33339
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:34875
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:53586
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:30029
receive_packet_end_turn_100
static struct packet_end_turn * receive_packet_end_turn_100(struct connection *pc)
Definition packets_gen.c:38815
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:56078
lsend_packet_unit_info
void lsend_packet_unit_info(struct conn_list *dest, const struct packet_unit_info *packet)
Definition packets_gen.c:29330
dsend_packet_player_change_government
int dsend_packet_player_change_government(struct connection *pc, Government_type_id government)
Definition packets_gen.c:24978
lsend_packet_ruleset_resource
void lsend_packet_ruleset_resource(struct conn_list *dest, const struct packet_ruleset_resource *packet)
Definition packets_gen.c:73027
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:74337
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:35056
receive_packet_vote_remove_100
static struct packet_vote_remove * receive_packet_vote_remove_100(struct connection *pc)
Definition packets_gen.c:74534
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:16894
lsend_packet_ruleset_specialist
void lsend_packet_ruleset_specialist(struct conn_list *dest, const struct packet_ruleset_specialist *packet)
Definition packets_gen.c:45585
send_packet_conn_info
int send_packet_conn_info(struct connection *pc, const struct packet_conn_info *packet)
Definition packets_gen.c:37485
lsend_packet_play_music
void lsend_packet_play_music(struct conn_list *dest, const struct packet_play_music *packet)
Definition packets_gen.c:83221
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:27218
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:33633
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:18472
send_packet_game_info
int send_packet_game_info(struct connection *pc, const struct packet_game_info *packet)
Definition packets_gen.c:9546
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:60546
dsend_packet_edit_player_create
int dsend_packet_edit_player_create(struct connection *pc, int tag)
Definition packets_gen.c:80600
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:20526
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:2895
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:71652
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:84038
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:77398
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:36310
receive_packet_vote_resolve_100
static struct packet_vote_resolve * receive_packet_vote_resolve_100(struct connection *pc)
Definition packets_gen.c:74700
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:36096
receive_packet_ruleset_resource_100
static struct packet_ruleset_resource * receive_packet_ruleset_resource_100(struct connection *pc)
Definition packets_gen.c:72736
receive_packet_research_info_100
static struct packet_research_info * receive_packet_research_info_100(struct connection *pc)
Definition packets_gen.c:26296
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:36930
receive_packet_ruleset_goods_100
static struct packet_ruleset_goods * receive_packet_ruleset_goods_100(struct connection *pc)
Definition packets_gen.c:60299
send_packet_edit_recalculate_borders
int send_packet_edit_recalculate_borders(struct connection *pc)
Definition packets_gen.c:75129
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:37232
send_packet_set_topology
int send_packet_set_topology(struct connection *pc, const struct packet_set_topology *packet)
Definition packets_gen.c:72247
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:83571
send_packet_spaceship_place
int send_packet_spaceship_place(struct connection *pc, const struct packet_spaceship_place *packet)
Definition packets_gen.c:39159
dlsend_packet_start_phase
void dlsend_packet_start_phase(struct conn_list *dest, int phase)
Definition packets_gen.c:38518
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:46961
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:20543
lsend_packet_ruleset_tech
void lsend_packet_ruleset_tech(struct conn_list *dest, const struct packet_ruleset_tech *packet)
Definition packets_gen.c:46656
send_packet_authentication_req
int send_packet_authentication_req(struct connection *pc, const struct packet_authentication_req *packet)
Definition packets_gen.c:2091
lsend_packet_ruleset_trade
void lsend_packet_ruleset_trade(struct conn_list *dest, const struct packet_ruleset_trade *packet)
Definition packets_gen.c:62084
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:75111
send_packet_map_info
int send_packet_map_info(struct connection *pc, const struct packet_map_info *packet)
Definition packets_gen.c:10523
send_packet_freeze_client
int send_packet_freeze_client(struct connection *pc)
Definition packets_gen.c:38870
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:53488
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:25530
send_packet_tile_info
int send_packet_tile_info(struct connection *pc, const struct packet_tile_info *packet)
Definition packets_gen.c:3848
send_packet_edit_unit
int send_packet_edit_unit(struct connection *pc, const struct packet_edit_unit *packet)
Definition packets_gen.c:78146
receive_packet_scenario_description_100
static struct packet_scenario_description * receive_packet_scenario_description_100(struct connection *pc)
Definition packets_gen.c:73525
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:67798
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:38412
dsend_packet_player_research
int dsend_packet_player_research(struct connection *pc, int tech)
Definition packets_gen.c:27133
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:43364
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:19764
receive_packet_client_heartbeat_100
static struct packet_client_heartbeat * receive_packet_client_heartbeat_100(struct connection *pc)
Definition packets_gen.c:38015
receive_packet_begin_turn_100
static struct packet_begin_turn * receive_packet_begin_turn_100(struct connection *pc)
Definition packets_gen.c:38778
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:1477
receive_packet_processing_started_100
static struct packet_processing_started * receive_packet_processing_started_100(struct connection *pc)
Definition packets_gen.c:1094
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:31623
dsend_packet_city_remove
int dsend_packet_city_remove(struct connection *pc, int city_id)
Definition packets_gen.c:12836
receive_packet_investigate_finished_100
static struct packet_investigate_finished * receive_packet_investigate_finished_100(struct connection *pc)
Definition packets_gen.c:1394
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:10696
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:43588
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:75141
dsend_packet_city_rename
int dsend_packet_city_rename(struct connection *pc, int city_id, const char *name)
Definition packets_gen.c:19746
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:45247
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:72145
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:58754
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:61125
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:34040
receive_packet_ruleset_disaster_100
static struct packet_ruleset_disaster * receive_packet_ruleset_disaster_100(struct connection *pc)
Definition packets_gen.c:60923
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:48305
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:35381
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:63237
receive_packet_ruleset_nation_100
static struct packet_ruleset_nation * receive_packet_ruleset_nation_100(struct connection *pc)
Definition packets_gen.c:49427
send_packet_city_buy
int send_packet_city_buy(struct connection *pc, const struct packet_city_buy *packet)
Definition packets_gen.c:18345
dlsend_packet_game_load
void dlsend_packet_game_load(struct conn_list *dest, bool load_successful, const char *load_filename)
Definition packets_gen.c:68717
dsend_packet_edit_object_created
int dsend_packet_edit_object_created(struct connection *pc, int tag, int id)
Definition packets_gen.c:83045
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:43211
receive_packet_city_sell_100
static struct packet_city_sell * receive_packet_city_sell_100(struct connection *pc)
Definition packets_gen.c:17984
dlsend_packet_investigate_started
void dlsend_packet_investigate_started(struct conn_list *dest, int unit_id, int city_id)
Definition packets_gen.c:1376
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:82828
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:64998
receive_packet_scenario_info_100
static struct packet_scenario_info * receive_packet_scenario_info_100(struct connection *pc)
Definition packets_gen.c:73042
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:57389
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:35025
receive_packet_ruleset_select_100
static struct packet_ruleset_select * receive_packet_ruleset_select_100(struct connection *pc)
Definition packets_gen.c:68356
send_packet_ruleset_trade
int send_packet_ruleset_trade(struct connection *pc, const struct packet_ruleset_trade *packet)
Definition packets_gen.c:62072
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:24888
send_packet_player_ready
int send_packet_player_ready(struct connection *pc, const struct packet_player_ready *packet)
Definition packets_gen.c:2816
receive_packet_edit_unit_100
static struct packet_edit_unit * receive_packet_edit_unit_100(struct connection *pc)
Definition packets_gen.c:77444
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:35705
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:68735
receive_packet_player_remove_100
static struct packet_player_remove * receive_packet_player_remove_100(struct connection *pc)
Definition packets_gen.c:21647
receive_packet_vote_submit_100
static struct packet_vote_submit * receive_packet_vote_submit_100(struct connection *pc)
Definition packets_gen.c:74878
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:36208
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:10708
lsend_packet_freeze_client
void lsend_packet_freeze_client(struct conn_list *dest)
Definition packets_gen.c:38882
dlsend_packet_diplomacy_cancel_meeting
void dlsend_packet_diplomacy_cancel_meeting(struct conn_list *dest, int counterpart, int initiated_from)
Definition packets_gen.c:34429
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:42923
lsend_packet_nation_availability
void lsend_packet_nation_availability(struct conn_list *dest, const struct packet_nation_availability *packet)
Definition packets_gen.c:51581
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:77232
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:77746
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:19518
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:84169
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:55854
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:84050
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:82931
send_packet_calendar_info
int send_packet_calendar_info(struct connection *pc, const struct packet_calendar_info *packet)
Definition packets_gen.c:9957
dsend_packet_investigate_started
int dsend_packet_investigate_started(struct connection *pc, int unit_id, int city_id)
Definition packets_gen.c:1366
dsend_packet_edit_unit_remove_by_id
int dsend_packet_edit_unit_remove_by_id(struct connection *pc, int id)
Definition packets_gen.c:77410
receive_packet_unknown_research_100
static struct packet_unknown_research * receive_packet_unknown_research_100(struct connection *pc)
Definition packets_gen.c:26792
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:24995
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:21720
receive_packet_authentication_req_100
static struct packet_authentication_req * receive_packet_authentication_req_100(struct connection *pc)
Definition packets_gen.c:1896
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:35361
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:82682
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:18844
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:75179
receive_packet_player_ready_100
static struct packet_player_ready * receive_packet_player_ready_100(struct connection *pc)
Definition packets_gen.c:2650
send_packet_vote_remove
int send_packet_vote_remove(struct connection *pc, const struct packet_vote_remove *packet)
Definition packets_gen.c:74680
dsend_packet_city_buy
int dsend_packet_city_buy(struct connection *pc, int city_id)
Definition packets_gen.c:18357
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:32820
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:33602
receive_packet_city_refresh_100
static struct packet_city_refresh * receive_packet_city_refresh_100(struct connection *pc)
Definition packets_gen.c:19979
dsend_packet_start_phase
int dsend_packet_start_phase(struct connection *pc, int phase)
Definition packets_gen.c:38509
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:31206
receive_packet_game_load_100
static struct packet_game_load * receive_packet_game_load_100(struct connection *pc)
Definition packets_gen.c:68522
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:75024
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:69237
lsend_packet_ruleset_style
void lsend_packet_ruleset_style(struct conn_list *dest, const struct packet_ruleset_style *packet)
Definition packets_gen.c:51832
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:12082
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:37948
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:12414
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:52839
lsend_packet_end_phase
void lsend_packet_end_phase(struct conn_list *dest)
Definition packets_gen.c:38329
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:76926
dsend_packet_edit_player_remove
int dsend_packet_edit_player_remove(struct connection *pc, int id)
Definition packets_gen.c:80775
dsend_packet_unit_type_upgrade
int dsend_packet_unit_type_upgrade(struct connection *pc, Unit_type_id type)
Definition packets_gen.c:31811
send_packet_ruleset_action
int send_packet_ruleset_action(struct connection *pc, const struct packet_ruleset_action *packet)
Definition packets_gen.c:62686
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:30371
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:32646
receive_packet_player_diplstate_100
static struct packet_player_diplstate * receive_packet_player_diplstate_100(struct connection *pc)
Definition packets_gen.c:25567
receive_packet_edit_city_100
static struct packet_edit_city * receive_packet_edit_city_100(struct connection *pc)
Definition packets_gen.c:78653
receive_packet_conn_pong_100
static struct packet_conn_pong * receive_packet_conn_pong_100(struct connection *pc)
Definition packets_gen.c:37985
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:46671
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:78607
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:33808
send_packet_ruleset_effect
int send_packet_ruleset_effect(struct connection *pc, const struct packet_ruleset_effect *packet)
Definition packets_gen.c:72709
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:62366
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:70423
receive_packet_ruleset_action_100
static struct packet_ruleset_action * receive_packet_ruleset_action_100(struct connection *pc)
Definition packets_gen.c:62099
send_packet_edit_mode
int send_packet_edit_mode(struct connection *pc, const struct packet_edit_mode *packet)
Definition packets_gen.c:75090
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:67452
dsend_packet_player_place_infra
int dsend_packet_player_place_infra(struct connection *pc, int tile, int extra)
Definition packets_gen.c:25192
send_packet_ruleset_style
int send_packet_ruleset_style(struct connection *pc, const struct packet_ruleset_style *packet)
Definition packets_gen.c:51820
receive_packet_ruleset_road_100
static struct packet_ruleset_road * receive_packet_ruleset_road_100(struct connection *pc)
Definition packets_gen.c:59285
send_packet_ruleset_disaster
int send_packet_ruleset_disaster(struct connection *pc, const struct packet_ruleset_disaster *packet)
Definition packets_gen.c:61403
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:33049
lsend_packet_server_shutdown
void lsend_packet_server_shutdown(struct conn_list *dest)
Definition packets_gen.c:2309
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:82750
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:36085
receive_packet_player_info_100
static struct packet_player_info * receive_packet_player_info_100(struct connection *pc)
Definition packets_gen.c:21849
send_packet_ruleset_unit
int send_packet_ruleset_unit(struct connection *pc, const struct packet_ruleset_unit *packet)
Definition packets_gen.c:42746
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:61575
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:11558
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:55952
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:80617
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:45600
send_packet_vote_update
int send_packet_vote_update(struct connection *pc, const struct packet_vote_update *packet)
Definition packets_gen.c:74514
dsend_packet_save_scenario
int dsend_packet_save_scenario(struct connection *pc, const char *name)
Definition packets_gen.c:73849
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:24380
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:1245
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:75942
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:49383
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:1876
send_packet_edit_startpos
int send_packet_edit_startpos(struct connection *pc, const struct packet_edit_startpos *packet)
Definition packets_gen.c:76035
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:47197
lsend_packet_investigate_finished
void lsend_packet_investigate_finished(struct conn_list *dest, const struct packet_investigate_finished *packet)
Definition packets_gen.c:1591
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:32497
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:75602
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:16938
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:31461
send_packet_edit_tile
int send_packet_edit_tile(struct connection *pc, const struct packet_edit_tile *packet)
Definition packets_gen.c:76582
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:35076
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:68877
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:24810
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:71334
lsend_packet_achievement_info
void lsend_packet_achievement_info(struct conn_list *dest, const struct packet_achievement_info *packet)
Definition packets_gen.c:11165
send_packet_edit_check_tiles
int send_packet_edit_check_tiles(struct connection *pc)
Definition packets_gen.c:75159
send_packet_ruleset_control
int send_packet_ruleset_control(struct connection *pc, const struct packet_ruleset_control *packet)
Definition packets_gen.c:67357
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:12004
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:20885
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:83253
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:25257
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:35654
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:38633
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:45883
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:34400
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:30183
receive_packet_conn_info_100
static struct packet_conn_info * receive_packet_conn_info_100(struct connection *pc)
Definition packets_gen.c:37054
send_packet_thaw_client
int send_packet_thaw_client(struct connection *pc)
Definition packets_gen.c:38907
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:19632
receive_packet_ruleset_extra_100
static struct packet_ruleset_extra * receive_packet_ruleset_extra_100(struct connection *pc)
Definition packets_gen.c:56551
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:80588
send_packet_unit_info
int send_packet_unit_info(struct connection *pc, const struct packet_unit_info *packet)
Definition packets_gen.c:29318
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:63225
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:1989
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:18712
send_packet_rulesets_ready_100
static int send_packet_rulesets_ready_100(struct connection *pc)
Definition packets_gen.c:48334
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:27296
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:33993
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:35880
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:28263
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:10940
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:75650
receive_packet_server_shutdown_100
static struct packet_server_shutdown * receive_packet_server_shutdown_100(struct connection *pc)
Definition packets_gen.c:2279
dsend_packet_single_want_hack_reply
int dsend_packet_single_want_hack_reply(struct connection *pc, bool you_have_hack)
Definition packets_gen.c:68034
send_packet_client_heartbeat_100
static int send_packet_client_heartbeat_100(struct connection *pc)
Definition packets_gen.c:38025
send_packet_server_shutdown
int send_packet_server_shutdown(struct connection *pc)
Definition packets_gen.c:2297
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:19847
send_packet_research_info
int send_packet_research_info(struct connection *pc, const struct packet_research_info *packet)
Definition packets_gen.c:26765
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:69807
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:27043
receive_packet_freeze_client_100
static struct packet_freeze_client * receive_packet_freeze_client_100(struct connection *pc)
Definition packets_gen.c:38852
send_packet_vote_new
int send_packet_vote_new(struct connection *pc, const struct packet_vote_new *packet)
Definition packets_gen.c:74168
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:30620
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:46946
send_packet_scenario_description
int send_packet_scenario_description(struct connection *pc, const struct packet_scenario_description *packet)
Definition packets_gen.c:73671
send_packet_player_attribute_block
int send_packet_player_attribute_block(struct connection *pc)
Definition packets_gen.c:25220
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:48614
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:34108
send_packet_achievement_info
int send_packet_achievement_info(struct connection *pc, const struct packet_achievement_info *packet)
Definition packets_gen.c:11153
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:84656
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:84264
receive_packet_start_phase_100
static struct packet_start_phase * receive_packet_start_phase_100(struct connection *pc)
Definition packets_gen.c:38344
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:84554
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:32518
dsend_packet_report_req
int dsend_packet_report_req(struct connection *pc, enum report_type type)
Definition packets_gen.c:37020
receive_packet_player_research_100
static struct packet_player_research * receive_packet_player_research_100(struct connection *pc)
Definition packets_gen.c:26975
lsend_packet_ruleset_goods
void lsend_packet_ruleset_goods(struct conn_list *dest, const struct packet_ruleset_goods *packet)
Definition packets_gen.c:60908
send_packet_spaceship_launch
int send_packet_spaceship_launch(struct connection *pc)
Definition packets_gen.c:38944
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:10845
lsend_packet_end_turn
void lsend_packet_end_turn(struct conn_list *dest)
Definition packets_gen.c:38845
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:84790
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:35666
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:47768
send_packet_spaceship_info
int send_packet_spaceship_info(struct connection *pc, const struct packet_spaceship_info *packet)
Definition packets_gen.c:40035
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:51398
receive_packet_edit_startpos_100
static struct packet_edit_startpos * receive_packet_edit_startpos_100(struct connection *pc)
Definition packets_gen.c:75955
receive_packet_ruleset_specialist_100
static struct packet_ruleset_specialist * receive_packet_ruleset_specialist_100(struct connection *pc)
Definition packets_gen.c:45005
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:36825
lsend_packet_ruleset_game
void lsend_packet_ruleset_game(struct conn_list *dest, const struct packet_ruleset_game *packet)
Definition packets_gen.c:44990
send_packet_ruleset_building
int send_packet_ruleset_building(struct connection *pc, const struct packet_ruleset_building *packet)
Definition packets_gen.c:53461
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:14100
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:36478
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:36837
lsend_packet_ruleset_nation
void lsend_packet_ruleset_nation(struct conn_list *dest, const struct packet_ruleset_nation *packet)
Definition packets_gen.c:51249
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:33779
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:11049
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:75614
lsend_packet_ruleset_counter
void lsend_packet_ruleset_counter(struct conn_list *dest, const struct packet_ruleset_counter *packet)
Definition packets_gen.c:64252
receive_packet_ruleset_summary_100
static struct packet_ruleset_summary * receive_packet_ruleset_summary_100(struct connection *pc)
Definition packets_gen.c:67384
lsend_packet_rulesets_ready
void lsend_packet_rulesets_ready(struct conn_list *dest)
Definition packets_gen.c:48354
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:26865
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:49145
dsend_packet_edit_city_remove
int dsend_packet_edit_city_remove(struct connection *pc, int id)
Definition packets_gen.c:78619
receive_packet_ruleset_clause_100
static struct packet_ruleset_clause * receive_packet_ruleset_clause_100(struct connection *pc)
Definition packets_gen.c:65501
dsend_packet_diplomacy_accept_treaty_req
int dsend_packet_diplomacy_accept_treaty_req(struct connection *pc, int counterpart)
Definition packets_gen.c:35863
dsend_packet_city_name_suggestion_req
int dsend_packet_city_name_suggestion_req(struct connection *pc, int unit_id)
Definition packets_gen.c:20312
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:84693
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:74775
receive_packet_end_phase_100
static struct packet_end_phase * receive_packet_end_phase_100(struct connection *pc)
Definition packets_gen.c:38299
send_packet_processing_started_100
static int send_packet_processing_started_100(struct connection *pc)
Definition packets_gen.c:1104
send_packet_rulesets_ready
int send_packet_rulesets_ready(struct connection *pc)
Definition packets_gen.c:48342
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:80510
lsend_packet_city_remove
void lsend_packet_city_remove(struct conn_list *dest, const struct packet_city_remove *packet)
Definition packets_gen.c:12829
send_packet_timeout_info
int send_packet_timeout_info(struct connection *pc, const struct packet_timeout_info *packet)
Definition packets_gen.c:10162
send_packet_player_research
int send_packet_player_research(struct connection *pc, const struct packet_player_research *packet)
Definition packets_gen.c:27121
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:53724
send_packet_ruleset_music
int send_packet_ruleset_music(struct connection *pc, const struct packet_ruleset_music *packet)
Definition packets_gen.c:64669
send_packet_start_phase
int send_packet_start_phase(struct connection *pc, const struct packet_start_phase *packet)
Definition packets_gen.c:38490
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:27403
receive_packet_worker_task_100
static struct packet_worker_task * receive_packet_worker_task_100(struct connection *pc)
Definition packets_gen.c:21308
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:58892
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:19059
send_packet_city_worklist
int send_packet_city_worklist(struct connection *pc, const struct packet_city_worklist *packet)
Definition packets_gen.c:18814
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:78279
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:34005
lsend_packet_ruleset_road
void lsend_packet_ruleset_road(struct conn_list *dest, const struct packet_ruleset_road *packet)
Definition packets_gen.c:60284
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:33891
lsend_packet_investigate_started
void lsend_packet_investigate_started(struct conn_list *dest, const struct packet_investigate_started *packet)
Definition packets_gen.c:1359
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:67730
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:20154
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:21056
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:47185
lsend_packet_thaw_client
void lsend_packet_thaw_client(struct conn_list *dest)
Definition packets_gen.c:38919
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:67703
receive_packet_ruleset_base_100
static struct packet_ruleset_base * receive_packet_ruleset_base_100(struct connection *pc)
Definition packets_gen.c:58907
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:74907
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:82317
dsend_packet_edit_toggle_fogofwar
int dsend_packet_edit_toggle_fogofwar(struct connection *pc, int player)
Definition packets_gen.c:75337
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:39057
lsend_packet_ruleset_terrain
void lsend_packet_ruleset_terrain(struct conn_list *dest, const struct packet_ruleset_terrain *packet)
Definition packets_gen.c:55839
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:30632
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:18067
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:37512
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:20561
receive_packet_city_change_100
static struct packet_city_change * receive_packet_city_change_100(struct connection *pc)
Definition packets_gen.c:18374
receive_packet_processing_finished_100
static struct packet_processing_finished * receive_packet_processing_finished_100(struct connection *pc)
Definition packets_gen.c:1124
send_packet_begin_turn_100
static int send_packet_begin_turn_100(struct connection *pc)
Definition packets_gen.c:38788
receive_packet_ruleset_achievement_100
static struct packet_ruleset_achievement * receive_packet_ruleset_achievement_100(struct connection *pc)
Definition packets_gen.c:61430
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:53712
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:63825
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:42773
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:47439
send_packet_ruleset_specialist
int send_packet_ruleset_specialist(struct connection *pc, const struct packet_ruleset_specialist *packet)
Definition packets_gen.c:45573
dsend_packet_player_ready
int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
Definition packets_gen.c:2828
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:29362
send_packet_client_info
int send_packet_client_info(struct connection *pc, const struct packet_client_info *packet)
Definition packets_gen.c:38287
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:72857
packet_handlers_fill_initial
void packet_handlers_fill_initial(struct packet_handlers *phandlers)
Definition packets_gen.c:84904
send_packet_game_load
int send_packet_game_load(struct connection *pc, const struct packet_game_load *packet)
Definition packets_gen.c:68688
dsend_packet_edit_mode
int dsend_packet_edit_mode(struct connection *pc, bool state)
Definition packets_gen.c:75102
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:25202
send_packet_city_sell
int send_packet_city_sell(struct connection *pc, const struct packet_city_sell *packet)
Definition packets_gen.c:18169
receive_packet_player_rates_100
static struct packet_player_rates * receive_packet_player_rates_100(struct connection *pc)
Definition packets_gen.c:24555
send_packet_save_scenario
int send_packet_save_scenario(struct connection *pc, const struct packet_save_scenario *packet)
Definition packets_gen.c:73837
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:36679
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:20533
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:30359
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:21293
packet_type
packet_type
Definition packets_gen.h:1893
PACKET_PLAYER_MULTIPLIER
@ PACKET_PLAYER_MULTIPLIER
Definition packets_gen.h:2071
PACKET_DIPLOMACY_ACCEPT_TREATY
@ PACKET_DIPLOMACY_ACCEPT_TREATY
Definition packets_gen.h:1974
PACKET_PLAYER_CHANGE_GOVERNMENT
@ PACKET_PLAYER_CHANGE_GOVERNMENT
Definition packets_gen.h:1941
PACKET_WEB_PLAYER_INFO_ADDITION
@ PACKET_WEB_PLAYER_INFO_ADDITION
Definition packets_gen.h:2088
PACKET_SAVE_SCENARIO
@ PACKET_SAVE_SCENARIO
Definition packets_gen.h:2022
PACKET_RULESET_MULTIPLIER
@ PACKET_RULESET_MULTIPLIER
Definition packets_gen.h:2072
PACKET_THAW_CLIENT
@ PACKET_THAW_CLIENT
Definition packets_gen.h:1987
PACKET_EDIT_TOGGLE_FOGOFWAR
@ PACKET_EDIT_TOGGLE_FOGOFWAR
Definition packets_gen.h:2031
PACKET_WEB_CMA_SET
@ PACKET_WEB_CMA_SET
Definition packets_gen.h:2086
PACKET_EDIT_MODE
@ PACKET_EDIT_MODE
Definition packets_gen.h:2028
PACKET_RULESET_MUSIC
@ PACKET_RULESET_MUSIC
Definition packets_gen.h:2069
PACKET_LAST
@ PACKET_LAST
Definition packets_gen.h:2094
PACKET_RULESET_GOODS
@ PACKET_RULESET_GOODS
Definition packets_gen.h:2077
PACKET_ENDGAME_PLAYER
@ PACKET_ENDGAME_PLAYER
Definition packets_gen.h:2052
PACKET_UNIT_ACTION_ANSWER
@ PACKET_UNIT_ACTION_ANSWER
Definition packets_gen.h:1960
PACKET_EDIT_PLAYER
@ PACKET_EDIT_PLAYER
Definition packets_gen.h:2046
PACKET_DIPLOMACY_CANCEL_MEETING_REQ
@ PACKET_DIPLOMACY_CANCEL_MEETING_REQ
Definition packets_gen.h:1967
PACKET_SERVER_SETTING_ENUM
@ PACKET_SERVER_SETTING_ENUM
Definition packets_gen.h:2016
PACKET_SET_TOPOLOGY
@ PACKET_SET_TOPOLOGY
Definition packets_gen.h:2082
PACKET_WEB_CITY_INFO_ADDITION
@ PACKET_WEB_CITY_INFO_ADDITION
Definition packets_gen.h:2085
PACKET_CONN_PING
@ PACKET_CONN_PING
Definition packets_gen.h:1962
PACKET_CITY_MAKE_WORKER
@ PACKET_CITY_MAKE_WORKER
Definition packets_gen.h:1928
PACKET_CITY_OPTIONS_REQ
@ PACKET_CITY_OPTIONS_REQ
Definition packets_gen.h:1931
PACKET_RULESET_COUNTER
@ PACKET_RULESET_COUNTER
Definition packets_gen.h:2091
PACKET_VOTE_UPDATE
@ PACKET_VOTE_UPDATE
Definition packets_gen.h:2024
PACKET_CITY_NAME_SUGGESTION_INFO
@ PACKET_CITY_NAME_SUGGESTION_INFO
Definition packets_gen.h:1934
PACKET_CITY_CHANGE
@ PACKET_CITY_CHANGE
Definition packets_gen.h:1925
PACKET_UNIT_SSCS_SET
@ PACKET_UNIT_SSCS_SET
Definition packets_gen.h:1954
PACKET_PROCESSING_STARTED
@ PACKET_PROCESSING_STARTED
Definition packets_gen.h:1894
PACKET_UNIT_DO_ACTION
@ PACKET_UNIT_DO_ACTION
Definition packets_gen.h:1959
PACKET_UNIT_REMOVE
@ PACKET_UNIT_REMOVE
Definition packets_gen.h:1949
PACKET_END_PHASE
@ PACKET_END_PHASE
Definition packets_gen.h:1981
PACKET_SERVER_SETTING_INT
@ PACKET_SERVER_SETTING_INT
Definition packets_gen.h:2014
PACKET_RULESET_EXTRA
@ PACKET_RULESET_EXTRA
Definition packets_gen.h:2061
PACKET_EDIT_PLAYER_CREATE
@ PACKET_EDIT_PLAYER_CREATE
Definition packets_gen.h:2044
PACKET_EDIT_GAME
@ PACKET_EDIT_GAME
Definition packets_gen.h:2048
PACKET_CONN_PING_INFO
@ PACKET_CONN_PING_INFO
Definition packets_gen.h:1979
PACKET_END_TURN
@ PACKET_END_TURN
Definition packets_gen.h:1985
PACKET_EDIT_TILE_EXTRA
@ PACKET_EDIT_TILE_EXTRA
Definition packets_gen.h:2033
PACKET_SPACESHIP_PLACE
@ PACKET_SPACESHIP_PLACE
Definition packets_gen.h:1989
PACKET_NEW_YEAR
@ PACKET_NEW_YEAR
Definition packets_gen.h:1983
PACKET_NATION_SELECT_REQ
@ PACKET_NATION_SELECT_REQ
Definition packets_gen.h:1902
PACKET_ENDGAME_REPORT
@ PACKET_ENDGAME_REPORT
Definition packets_gen.h:1904
PACKET_RULESET_ACTION_AUTO
@ PACKET_RULESET_ACTION_AUTO
Definition packets_gen.h:2081
PACKET_UNIT_COMBAT_INFO
@ PACKET_UNIT_COMBAT_INFO
Definition packets_gen.h:1952
PACKET_RULESETS_READY
@ PACKET_RULESETS_READY
Definition packets_gen.h:2054
PACKET_UNIT_SHORT_INFO
@ PACKET_UNIT_SHORT_INFO
Definition packets_gen.h:1951
PACKET_SERVER_JOIN_REQ
@ PACKET_SERVER_JOIN_REQ
Definition packets_gen.h:1896
PACKET_REPORT_REQ
@ PACKET_REPORT_REQ
Definition packets_gen.h:1977
PACKET_RULESET_UNIT_CLASS_FLAG
@ PACKET_RULESET_UNIT_CLASS_FLAG
Definition packets_gen.h:2059
PACKET_RULESET_TECH_CLASS
@ PACKET_RULESET_TECH_CLASS
Definition packets_gen.h:1901
PACKET_EDIT_CITY_CREATE
@ PACKET_EDIT_CITY_CREATE
Definition packets_gen.h:2041
PACKET_SINGLE_WANT_HACK_REPLY
@ PACKET_SINGLE_WANT_HACK_REPLY
Definition packets_gen.h:2008
PACKET_GAME_INFO
@ PACKET_GAME_INFO
Definition packets_gen.h:1908
PACKET_DIPLOMACY_INIT_MEETING_REQ
@ PACKET_DIPLOMACY_INIT_MEETING_REQ
Definition packets_gen.h:1965
PACKET_PROCESSING_FINISHED
@ PACKET_PROCESSING_FINISHED
Definition packets_gen.h:1895
PACKET_RULESET_ACTION
@ PACKET_RULESET_ACTION
Definition packets_gen.h:2075
PACKET_PLAYER_ATTRIBUTE_BLOCK
@ PACKET_PLAYER_ATTRIBUTE_BLOCK
Definition packets_gen.h:1944
PACKET_CITY_SELL
@ PACKET_CITY_SELL
Definition packets_gen.h:1923
PACKET_CITY_NAME_SUGGESTION_REQ
@ PACKET_CITY_NAME_SUGGESTION_REQ
Definition packets_gen.h:1933
PACKET_UNKNOWN_RESEARCH
@ PACKET_UNKNOWN_RESEARCH
Definition packets_gen.h:1953
PACKET_CHAT_MSG_REQ
@ PACKET_CHAT_MSG_REQ
Definition packets_gen.h:1916
PACKET_NUKE_TILE_INFO
@ PACKET_NUKE_TILE_INFO
Definition packets_gen.h:1910
PACKET_PLAYER_DIPLSTATE
@ PACKET_PLAYER_DIPLSTATE
Definition packets_gen.h:1946
PACKET_RULESET_IMPR_FLAG
@ PACKET_RULESET_IMPR_FLAG
Definition packets_gen.h:1912
PACKET_RULESET_TECH
@ PACKET_RULESET_TECH
Definition packets_gen.h:1996
PACKET_CLIENT_HEARTBEAT
@ PACKET_CLIENT_HEARTBEAT
Definition packets_gen.h:2083
PACKET_RULESET_ROAD
@ PACKET_RULESET_ROAD
Definition packets_gen.h:2050
PACKET_RULESET_NATION_SETS
@ PACKET_RULESET_NATION_SETS
Definition packets_gen.h:2065
PACKET_CITY_SABOTAGE_LIST
@ PACKET_CITY_SABOTAGE_LIST
Definition packets_gen.h:1935
PACKET_MAP_INFO
@ PACKET_MAP_INFO
Definition packets_gen.h:1909
PACKET_RULESET_CLAUSE
@ PACKET_RULESET_CLAUSE
Definition packets_gen.h:2090
PACKET_DIPLOMACY_CREATE_CLAUSE_REQ
@ PACKET_DIPLOMACY_CREATE_CLAUSE_REQ
Definition packets_gen.h:1969
PACKET_CITY_BUY
@ PACKET_CITY_BUY
Definition packets_gen.h:1924
PACKET_CHAT_MSG
@ PACKET_CHAT_MSG
Definition packets_gen.h:1915
PACKET_EDIT_CITY_REMOVE
@ PACKET_EDIT_CITY_REMOVE
Definition packets_gen.h:2042
PACKET_EDIT_STARTPOS
@ PACKET_EDIT_STARTPOS
Definition packets_gen.h:2034
PACKET_SERVER_SETTING_CONST
@ PACKET_SERVER_SETTING_CONST
Definition packets_gen.h:2012
PACKET_PLAYER_RESEARCH
@ PACKET_PLAYER_RESEARCH
Definition packets_gen.h:1942
PACKET_BEGIN_TURN
@ PACKET_BEGIN_TURN
Definition packets_gen.h:1984
PACKET_RULESET_TERRAIN_CONTROL
@ PACKET_RULESET_TERRAIN_CONTROL
Definition packets_gen.h:1998
PACKET_PLAYER_PHASE_DONE
@ PACKET_PLAYER_PHASE_DONE
Definition packets_gen.h:1939
PACKET_RULESET_SELECT
@ PACKET_RULESET_SELECT
Definition packets_gen.h:2018
PACKET_GAME_LOAD
@ PACKET_GAME_LOAD
Definition packets_gen.h:2010
PACKET_CITY_UPDATE_COUNTERS
@ PACKET_CITY_UPDATE_COUNTERS
Definition packets_gen.h:2092
PACKET_PLAYER_REMOVE
@ PACKET_PLAYER_REMOVE
Definition packets_gen.h:1937
PACKET_CLIENT_INFO
@ PACKET_CLIENT_INFO
Definition packets_gen.h:1980
PACKET_CITY_WORKLIST
@ PACKET_CITY_WORKLIST
Definition packets_gen.h:1926
PACKET_DIPLOMACY_CANCEL_MEETING
@ PACKET_DIPLOMACY_CANCEL_MEETING
Definition packets_gen.h:1968
PACKET_UNIT_TYPE_UPGRADE
@ PACKET_UNIT_TYPE_UPGRADE
Definition packets_gen.h:1958
PACKET_START_PHASE
@ PACKET_START_PHASE
Definition packets_gen.h:1982
PACKET_AUTHENTICATION_REPLY
@ PACKET_AUTHENTICATION_REPLY
Definition packets_gen.h:1899
PACKET_SPACESHIP_INFO
@ PACKET_SPACESHIP_INFO
Definition packets_gen.h:1990
PACKET_UNIT_GET_ACTIONS
@ PACKET_UNIT_GET_ACTIONS
Definition packets_gen.h:1961
PACKET_PLAYER_ATTRIBUTE_CHUNK
@ PACKET_PLAYER_ATTRIBUTE_CHUNK
Definition packets_gen.h:1945
PACKET_RULESET_TERRAIN_FLAG
@ PACKET_RULESET_TERRAIN_FLAG
Definition packets_gen.h:2060
PACKET_CITY_MAKE_SPECIALIST
@ PACKET_CITY_MAKE_SPECIALIST
Definition packets_gen.h:1927
PACKET_RULESET_ACHIEVEMENT
@ PACKET_RULESET_ACHIEVEMENT
Definition packets_gen.h:2062
PACKET_RULESET_EFFECT
@ PACKET_RULESET_EFFECT
Definition packets_gen.h:2019
PACKET_RULESET_DISASTER
@ PACKET_RULESET_DISASTER
Definition packets_gen.h:2053
PACKET_RULESET_CONTROL
@ PACKET_RULESET_CONTROL
Definition packets_gen.h:2006
PACKET_SINGLE_WANT_HACK_REQ
@ PACKET_SINGLE_WANT_HACK_REQ
Definition packets_gen.h:2007
PACKET_PLAYER_PLACE_INFRA
@ PACKET_PLAYER_PLACE_INFRA
Definition packets_gen.h:1948
PACKET_VOTE_NEW
@ PACKET_VOTE_NEW
Definition packets_gen.h:2023
PACKET_AUTHENTICATION_REQ
@ PACKET_AUTHENTICATION_REQ
Definition packets_gen.h:1898
PACKET_RULESET_TRADE
@ PACKET_RULESET_TRADE
Definition packets_gen.h:2056
PACKET_EDIT_PLAYER_REMOVE
@ PACKET_EDIT_PLAYER_REMOVE
Definition packets_gen.h:2045
PACKET_CONN_INFO
@ PACKET_CONN_INFO
Definition packets_gen.h:1978
PACKET_SERVER_SETTING_BITWISE
@ PACKET_SERVER_SETTING_BITWISE
Definition packets_gen.h:2017
PACKET_EDIT_TILE_TERRAIN
@ PACKET_EDIT_TILE_TERRAIN
Definition packets_gen.h:2032
PACKET_DIPLOMACY_INIT_MEETING
@ PACKET_DIPLOMACY_INIT_MEETING
Definition packets_gen.h:1966
PACKET_RULESET_SUMMARY
@ PACKET_RULESET_SUMMARY
Definition packets_gen.h:2080
PACKET_UNIT_ACTION_QUERY
@ PACKET_UNIT_ACTION_QUERY
Definition packets_gen.h:1957
PACKET_PLAY_MUSIC
@ PACKET_PLAY_MUSIC
Definition packets_gen.h:2074
PACKET_TRADE_ROUTE_INFO
@ PACKET_TRADE_ROUTE_INFO
Definition packets_gen.h:2078
PACKET_RULESET_STYLE
@ PACKET_RULESET_STYLE
Definition packets_gen.h:2068
PACKET_RULESET_CITY
@ PACKET_RULESET_CITY
Definition packets_gen.h:2001
PACKET_CITY_NATIONALITIES
@ PACKET_CITY_NATIONALITIES
Definition packets_gen.h:1936
PACKET_EDIT_SCENARIO_DESC
@ PACKET_EDIT_SCENARIO_DESC
Definition packets_gen.h:1906
PACKET_FREEZE_CLIENT
@ PACKET_FREEZE_CLIENT
Definition packets_gen.h:1986
PACKET_VOTE_RESOLVE
@ PACKET_VOTE_RESOLVE
Definition packets_gen.h:2026
PACKET_EDIT_UNIT_CREATE
@ PACKET_EDIT_UNIT_CREATE
Definition packets_gen.h:2037
PACKET_TIMEOUT_INFO
@ PACKET_TIMEOUT_INFO
Definition packets_gen.h:2073
PACKET_RULESET_GAME
@ PACKET_RULESET_GAME
Definition packets_gen.h:1993
PACKET_UNIT_CHANGE_ACTIVITY
@ PACKET_UNIT_CHANGE_ACTIVITY
Definition packets_gen.h:2051
PACKET_EDIT_UNIT_REMOVE
@ PACKET_EDIT_UNIT_REMOVE
Definition packets_gen.h:2038
PACKET_RULESET_UNIT_FLAG
@ PACKET_RULESET_UNIT_FLAG
Definition packets_gen.h:2058
PACKET_DIPLOMACY_REMOVE_CLAUSE
@ PACKET_DIPLOMACY_REMOVE_CLAUSE
Definition packets_gen.h:1972
PACKET_TILE_INFO
@ PACKET_TILE_INFO
Definition packets_gen.h:1907
PACKET_EDIT_OBJECT_CREATED
@ PACKET_EDIT_OBJECT_CREATED
Definition packets_gen.h:2049
PACKET_CITY_SHORT_INFO
@ PACKET_CITY_SHORT_INFO
Definition packets_gen.h:1922
PACKET_CALENDAR_INFO
@ PACKET_CALENDAR_INFO
Definition packets_gen.h:2084
PACKET_SERVER_JOIN_REPLY
@ PACKET_SERVER_JOIN_REPLY
Definition packets_gen.h:1897
PACKET_SERVER_SETTING_STR
@ PACKET_SERVER_SETTING_STR
Definition packets_gen.h:2015
PACKET_VOTE_SUBMIT
@ PACKET_VOTE_SUBMIT
Definition packets_gen.h:2027
PACKET_WEB_CMA_CLEAR
@ PACKET_WEB_CMA_CLEAR
Definition packets_gen.h:2087
PACKET_EDIT_PLAYER_VISION
@ PACKET_EDIT_PLAYER_VISION
Definition packets_gen.h:2047
PACKET_SCENARIO_INFO
@ PACKET_SCENARIO_INFO
Definition packets_gen.h:2021
PACKET_EDIT_CHECK_TILES
@ PACKET_EDIT_CHECK_TILES
Definition packets_gen.h:2030
PACKET_RULESET_CHOICES
@ PACKET_RULESET_CHOICES
Definition packets_gen.h:2009
PACKET_CITY_CHANGE_SPECIALIST
@ PACKET_CITY_CHANGE_SPECIALIST
Definition packets_gen.h:1929
PACKET_RULESET_SPECIALIST
@ PACKET_RULESET_SPECIALIST
Definition packets_gen.h:1994
PACKET_CITY_REFRESH
@ PACKET_CITY_REFRESH
Definition packets_gen.h:1932
PACKET_CITY_REMOVE
@ PACKET_CITY_REMOVE
Definition packets_gen.h:1920
PACKET_UNIT_INFO
@ PACKET_UNIT_INFO
Definition packets_gen.h:1950
PACKET_RULESET_NATION_GROUPS
@ PACKET_RULESET_NATION_GROUPS
Definition packets_gen.h:1999
PACKET_CONNECT_MSG
@ PACKET_CONNECT_MSG
Definition packets_gen.h:1917
PACKET_EARLY_CHAT_MSG
@ PACKET_EARLY_CHAT_MSG
Definition packets_gen.h:1918
PACKET_RULESET_UNIT_CLASS
@ PACKET_RULESET_UNIT_CLASS
Definition packets_gen.h:2004
PACKET_PLAYER_INFO
@ PACKET_PLAYER_INFO
Definition packets_gen.h:1938
PACKET_EDIT_TILE
@ PACKET_EDIT_TILE
Definition packets_gen.h:2036
PACKET_PLAYER_READY
@ PACKET_PLAYER_READY
Definition packets_gen.h:1903
PACKET_WEB_RULESET_UNIT_ADDITION
@ PACKET_WEB_RULESET_UNIT_ADDITION
Definition packets_gen.h:2089
PACKET_SERVER_SHUTDOWN
@ PACKET_SERVER_SHUTDOWN
Definition packets_gen.h:1900
PACKET_RULESET_TERRAIN
@ PACKET_RULESET_TERRAIN
Definition packets_gen.h:2003
PACKET_RULESET_EXTRA_FLAG
@ PACKET_RULESET_EXTRA_FLAG
Definition packets_gen.h:2055
PACKET_RULESET_DESCRIPTION_PART
@ PACKET_RULESET_DESCRIPTION_PART
Definition packets_gen.h:2076
PACKET_EDIT_UNIT
@ PACKET_EDIT_UNIT
Definition packets_gen.h:2040
PACKET_RULESET_BASE
@ PACKET_RULESET_BASE
Definition packets_gen.h:2005
PACKET_SERVER_SETTING_BOOL
@ PACKET_SERVER_SETTING_BOOL
Definition packets_gen.h:2013
PACKET_RESEARCH_INFO
@ PACKET_RESEARCH_INFO
Definition packets_gen.h:1947
PACKET_CONN_PONG
@ PACKET_CONN_PONG
Definition packets_gen.h:1963
PACKET_EDIT_RECALCULATE_BORDERS
@ PACKET_EDIT_RECALCULATE_BORDERS
Definition packets_gen.h:2029
PACKET_PAGE_MSG_PART
@ PACKET_PAGE_MSG_PART
Definition packets_gen.h:2079
PACKET_EDIT_CITY
@ PACKET_EDIT_CITY
Definition packets_gen.h:2043
PACKET_RULESET_UNIT
@ PACKET_RULESET_UNIT
Definition packets_gen.h:1992
PACKET_PLAYER_TECH_GOAL
@ PACKET_PLAYER_TECH_GOAL
Definition packets_gen.h:1943
PACKET_UNIT_ACTIONS
@ PACKET_UNIT_ACTIONS
Definition packets_gen.h:1964
PACKET_INVESTIGATE_FINISHED
@ PACKET_INVESTIGATE_FINISHED
Definition packets_gen.h:1914
PACKET_RULESET_ACTION_ENABLER
@ PACKET_RULESET_ACTION_ENABLER
Definition packets_gen.h:2064
PACKET_INVESTIGATE_STARTED
@ PACKET_INVESTIGATE_STARTED
Definition packets_gen.h:1913
PACKET_CITY_RALLY_POINT
@ PACKET_CITY_RALLY_POINT
Definition packets_gen.h:1991
PACKET_RULESET_UNIT_BONUS
@ PACKET_RULESET_UNIT_BONUS
Definition packets_gen.h:2057
PACKET_RULESET_BUILDING
@ PACKET_RULESET_BUILDING
Definition packets_gen.h:2002
PACKET_RULESET_NATION
@ PACKET_RULESET_NATION
Definition packets_gen.h:2000
PACKET_UNIT_SERVER_SIDE_AGENT_SET
@ PACKET_UNIT_SERVER_SIDE_AGENT_SET
Definition packets_gen.h:1956
PACKET_SERVER_INFO
@ PACKET_SERVER_INFO
Definition packets_gen.h:1919
PACKET_RULESET_GOVERNMENT_RULER_TITLE
@ PACKET_RULESET_GOVERNMENT_RULER_TITLE
Definition packets_gen.h:1995
PACKET_SPACESHIP_LAUNCH
@ PACKET_SPACESHIP_LAUNCH
Definition packets_gen.h:1988
PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ
@ PACKET_DIPLOMACY_REMOVE_CLAUSE_REQ
Definition packets_gen.h:1971
PACKET_DIPLOMACY_ACCEPT_TREATY_REQ
@ PACKET_DIPLOMACY_ACCEPT_TREATY_REQ
Definition packets_gen.h:1973
PACKET_DIPLOMACY_CREATE_CLAUSE
@ PACKET_DIPLOMACY_CREATE_CLAUSE
Definition packets_gen.h:1970
PACKET_RULESET_GOVERNMENT
@ PACKET_RULESET_GOVERNMENT
Definition packets_gen.h:1997
PACKET_SCENARIO_DESCRIPTION
@ PACKET_SCENARIO_DESCRIPTION
Definition packets_gen.h:1905
PACKET_SERVER_SETTING_CONTROL
@ PACKET_SERVER_SETTING_CONTROL
Definition packets_gen.h:2011
PACKET_ACHIEVEMENT_INFO
@ PACKET_ACHIEVEMENT_INFO
Definition packets_gen.h:2067
PACKET_PAGE_MSG
@ PACKET_PAGE_MSG
Definition packets_gen.h:1976
PACKET_RULESET_TECH_FLAG
@ PACKET_RULESET_TECH_FLAG
Definition packets_gen.h:2063
PACKET_RULESET_RESOURCE
@ PACKET_RULESET_RESOURCE
Definition packets_gen.h:2020
PACKET_UNIT_ORDERS
@ PACKET_UNIT_ORDERS
Definition packets_gen.h:1955
PACKET_EDIT_UNIT_REMOVE_BY_ID
@ PACKET_EDIT_UNIT_REMOVE_BY_ID
Definition packets_gen.h:2039
PACKET_EDIT_STARTPOS_FULL
@ PACKET_EDIT_STARTPOS_FULL
Definition packets_gen.h:2035
PACKET_DIPLOMACY_CANCEL_PACT
@ PACKET_DIPLOMACY_CANCEL_PACT
Definition packets_gen.h:1975
PACKET_TEAM_NAME_INFO
@ PACKET_TEAM_NAME_INFO
Definition packets_gen.h:1911
PACKET_CITY_INFO
@ PACKET_CITY_INFO
Definition packets_gen.h:1921
PACKET_PLAYER_RATES
@ PACKET_PLAYER_RATES
Definition packets_gen.h:1940
PACKET_NATION_AVAILABILITY
@ PACKET_NATION_AVAILABILITY
Definition packets_gen.h:2066
PACKET_CITY_RENAME
@ PACKET_CITY_RENAME
Definition packets_gen.h:1930
PACKET_VOTE_REMOVE
@ PACKET_VOTE_REMOVE
Definition packets_gen.h:2025
PACKET_WORKER_TASK
@ PACKET_WORKER_TASK
Definition packets_gen.h:2070
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:1493
gives_shared_vision
bool gives_shared_vision(const struct player *me, const struct player *them)
Definition player.c:1485
are_requirements_equal
bool are_requirements_equal(const struct requirement *req1, const struct requirement *req2)
Definition requirements.c:1450
compat
static struct compatibility compat[]
Definition savecompat.c:110
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:2464
act_prob
Definition fc_types.h:1241
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:285
packet_achievement_info::id
int id
Definition packets_gen.h:286
packet_achievement_info::gained
bool gained
Definition packets_gen.h:287
packet_achievement_info::first
bool first
Definition packets_gen.h:288
packet_authentication_reply
Definition packets_gen.h:64
packet_authentication_reply::password
char password[MAX_LEN_PASSWORD]
Definition packets_gen.h:65
packet_authentication_req
Definition packets_gen.h:59
packet_authentication_req::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:61
packet_authentication_req::type
enum authentication_type type
Definition packets_gen.h:60
packet_begin_turn
Definition packets_gen.h:898
packet_calendar_info
Definition packets_gen.h:254
packet_calendar_info::positive_year_label
char positive_year_label[MAX_LEN_NAME]
Definition packets_gen.h:255
packet_calendar_info::calendar_skip_0
bool calendar_skip_0
Definition packets_gen.h:259
packet_calendar_info::negative_year_label
char negative_year_label[MAX_LEN_NAME]
Definition packets_gen.h:256
packet_calendar_info::calendar_fragments
int calendar_fragments
Definition packets_gen.h:257
packet_calendar_info::calendar_fragment_name
char calendar_fragment_name[MAX_CALENDAR_FRAGMENTS][MAX_LEN_NAME]
Definition packets_gen.h:258
packet_chat_msg_req
Definition packets_gen.h:309
packet_chat_msg_req::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:310
packet_chat_msg
Definition packets_gen.h:291
packet_chat_msg::phase
int phase
Definition packets_gen.h:296
packet_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:292
packet_chat_msg::conn_id
int conn_id
Definition packets_gen.h:297
packet_chat_msg::event
enum event_type event
Definition packets_gen.h:294
packet_chat_msg::turn
int turn
Definition packets_gen.h:295
packet_chat_msg::tile
int tile
Definition packets_gen.h:293
packet_city_buy
Definition packets_gen.h:426
packet_city_buy::city_id
int city_id
Definition packets_gen.h:427
packet_city_change_specialist
Definition packets_gen.h:451
packet_city_change_specialist::to
Specialist_type_id to
Definition packets_gen.h:454
packet_city_change_specialist::from
Specialist_type_id from
Definition packets_gen.h:453
packet_city_change_specialist::city_id
int city_id
Definition packets_gen.h:452
packet_city_change
Definition packets_gen.h:430
packet_city_change::city_id
int city_id
Definition packets_gen.h:431
packet_city_change::production_kind
int production_kind
Definition packets_gen.h:432
packet_city_change::production_value
int production_value
Definition packets_gen.h:433
packet_city_info
Definition packets_gen.h:329
packet_city_info::style
int style
Definition packets_gen.h:336
packet_city_info::last_turns_shield_surplus
int last_turns_shield_surplus
Definition packets_gen.h:367
packet_city_info::usage
int usage[O_LAST]
Definition packets_gen.h:352
packet_city_info::before_change_shields
int before_change_shields
Definition packets_gen.h:364
packet_city_info::ppl_content
int ppl_content[FEELING_LAST]
Definition packets_gen.h:339
packet_city_info::city_options
bv_city_options city_options
Definition packets_gen.h:379
packet_city_info::capital
enum capital_type capital
Definition packets_gen.h:337
packet_city_info::surplus
int surplus[O_LAST]
Definition packets_gen.h:347
packet_city_info::had_famine
bool had_famine
Definition packets_gen.h:372
packet_city_info::ppl_unhappy
int ppl_unhappy[FEELING_LAST]
Definition packets_gen.h:340
packet_city_info::original
int original
Definition packets_gen.h:333
packet_city_info::citizen_base
int citizen_base[O_LAST]
Definition packets_gen.h:351
packet_city_info::changed_from_kind
int changed_from_kind
Definition packets_gen.h:362
packet_city_info::specialists
int specialists[SP_MAX]
Definition packets_gen.h:343
packet_city_info::changed_from_value
int changed_from_value
Definition packets_gen.h:363
packet_city_info::ppl_angry
int ppl_angry[FEELING_LAST]
Definition packets_gen.h:341
packet_city_info::food_stock
int food_stock
Definition packets_gen.h:353
packet_city_info::id
int id
Definition packets_gen.h:330
packet_city_info::specialists_size
int specialists_size
Definition packets_gen.h:342
packet_city_info::owner
int owner
Definition packets_gen.h:332
packet_city_info::walls
int walls
Definition packets_gen.h:374
packet_city_info::improvements
bv_imprs improvements
Definition packets_gen.h:378
packet_city_info::shield_stock
int shield_stock
Definition packets_gen.h:354
packet_city_info::was_happy
bool was_happy
Definition packets_gen.h:371
packet_city_info::worklist
struct worklist worklist
Definition packets_gen.h:377
packet_city_info::steal
int steal
Definition packets_gen.h:376
packet_city_info::airlift
int airlift
Definition packets_gen.h:368
packet_city_info::did_buy
bool did_buy
Definition packets_gen.h:369
packet_city_info::turn_founded
int turn_founded
Definition packets_gen.h:360
packet_city_info::buy_cost
int buy_cost
Definition packets_gen.h:346
packet_city_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:380
packet_city_info::pollution
int pollution
Definition packets_gen.h:356
packet_city_info::trade_route_count
int trade_route_count
Definition packets_gen.h:355
packet_city_info::ppl_happy
int ppl_happy[FEELING_LAST]
Definition packets_gen.h:338
packet_city_info::did_sell
bool did_sell
Definition packets_gen.h:370
packet_city_info::production_value
int production_value
Definition packets_gen.h:359
packet_city_info::prod
int prod[O_LAST]
Definition packets_gen.h:350
packet_city_info::caravan_shields
int caravan_shields
Definition packets_gen.h:366
packet_city_info::illness_trade
int illness_trade
Definition packets_gen.h:357
packet_city_info::culture
int culture
Definition packets_gen.h:345
packet_city_info::diplomat_investigate
bool diplomat_investigate
Definition packets_gen.h:373
packet_city_info::unhappy_penalty
int unhappy_penalty[O_LAST]
Definition packets_gen.h:349
packet_city_info::history
int history
Definition packets_gen.h:344
packet_city_info::turn_last_built
int turn_last_built
Definition packets_gen.h:361
packet_city_info::city_image
int city_image
Definition packets_gen.h:375
packet_city_info::disbanded_shields
int disbanded_shields
Definition packets_gen.h:365
packet_city_info::production_kind
int production_kind
Definition packets_gen.h:358
packet_city_info::tile
int tile
Definition packets_gen.h:331
packet_city_info::size
int size
Definition packets_gen.h:334
packet_city_info::city_radius_sq
int city_radius_sq
Definition packets_gen.h:335
packet_city_info::waste
int waste[O_LAST]
Definition packets_gen.h:348
packet_city_make_specialist
Definition packets_gen.h:441
packet_city_make_specialist::tile_id
int tile_id
Definition packets_gen.h:443
packet_city_make_specialist::city_id
int city_id
Definition packets_gen.h:442
packet_city_make_worker
Definition packets_gen.h:446
packet_city_make_worker::city_id
int city_id
Definition packets_gen.h:447
packet_city_make_worker::tile_id
int tile_id
Definition packets_gen.h:448
packet_city_name_suggestion_info
Definition packets_gen.h:475
packet_city_name_suggestion_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:477
packet_city_name_suggestion_info::unit_id
int unit_id
Definition packets_gen.h:476
packet_city_name_suggestion_req
Definition packets_gen.h:471
packet_city_name_suggestion_req::unit_id
int unit_id
Definition packets_gen.h:472
packet_city_nationalities
Definition packets_gen.h:383
packet_city_nationalities::nation_id
int nation_id[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:386
packet_city_nationalities::id
int id
Definition packets_gen.h:384
packet_city_nationalities::nation_citizens
int nation_citizens[MAX_CITY_NATIONALITIES]
Definition packets_gen.h:387
packet_city_nationalities::nationalities_count
int nationalities_count
Definition packets_gen.h:385
packet_city_options_req
Definition packets_gen.h:462
packet_city_options_req::city_id
int city_id
Definition packets_gen.h:463
packet_city_options_req::options
bv_city_options options
Definition packets_gen.h:464
packet_city_rally_point
Definition packets_gen.h:488
packet_city_rally_point::persistent
bool persistent
Definition packets_gen.h:491
packet_city_rally_point::id
int id
Definition packets_gen.h:489
packet_city_rally_point::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:493
packet_city_rally_point::vigilant
bool vigilant
Definition packets_gen.h:492
packet_city_rally_point::length
int length
Definition packets_gen.h:490
packet_city_refresh
Definition packets_gen.h:467
packet_city_refresh::city_id
int city_id
Definition packets_gen.h:468
packet_city_remove
Definition packets_gen.h:325
packet_city_remove::city_id
int city_id
Definition packets_gen.h:326
packet_city_rename
Definition packets_gen.h:457
packet_city_rename::city_id
int city_id
Definition packets_gen.h:458
packet_city_rename::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:459
packet_city_sabotage_list
Definition packets_gen.h:480
packet_city_sabotage_list::request_kind
int request_kind
Definition packets_gen.h:485
packet_city_sabotage_list::improvements
bv_imprs improvements
Definition packets_gen.h:483
packet_city_sabotage_list::actor_id
int actor_id
Definition packets_gen.h:481
packet_city_sabotage_list::city_id
int city_id
Definition packets_gen.h:482
packet_city_sabotage_list::act_id
action_id act_id
Definition packets_gen.h:484
packet_city_sell
Definition packets_gen.h:421
packet_city_sell::build_id
int build_id
Definition packets_gen.h:423
packet_city_sell::city_id
int city_id
Definition packets_gen.h:422
packet_city_short_info
Definition packets_gen.h:396
packet_city_short_info::walls
int walls
Definition packets_gen.h:404
packet_city_short_info::style
int style
Definition packets_gen.h:401
packet_city_short_info::size
int size
Definition packets_gen.h:400
packet_city_short_info::improvements
bv_imprs improvements
Definition packets_gen.h:408
packet_city_short_info::capital
enum capital_type capital
Definition packets_gen.h:402
packet_city_short_info::owner
int owner
Definition packets_gen.h:399
packet_city_short_info::id
int id
Definition packets_gen.h:397
packet_city_short_info::city_image
int city_image
Definition packets_gen.h:407
packet_city_short_info::happy
bool happy
Definition packets_gen.h:405
packet_city_short_info::unhappy
bool unhappy
Definition packets_gen.h:406
packet_city_short_info::tile
int tile
Definition packets_gen.h:398
packet_city_short_info::occupied
bool occupied
Definition packets_gen.h:403
packet_city_short_info::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:409
packet_city_update_counters
Definition packets_gen.h:390
packet_city_update_counters::count
int count
Definition packets_gen.h:392
packet_city_update_counters::counters
int counters[MAX_COUNTERS]
Definition packets_gen.h:393
packet_city_update_counters::city
int city
Definition packets_gen.h:391
packet_city_worklist
Definition packets_gen.h:436
packet_city_worklist::city_id
int city_id
Definition packets_gen.h:437
packet_city_worklist::worklist
struct worklist worklist
Definition packets_gen.h:438
packet_client_heartbeat
Definition packets_gen.h:874
packet_client_info
Definition packets_gen.h:878
packet_client_info::distribution
char distribution[MAX_LEN_NAME]
Definition packets_gen.h:881
packet_client_info::emerg_version
int emerg_version
Definition packets_gen.h:880
packet_client_info::gui
enum gui_type gui
Definition packets_gen.h:879
packet_conn_info
Definition packets_gen.h:848
packet_conn_info::capability
char capability[MAX_LEN_CAPSTR]
Definition packets_gen.h:857
packet_conn_info::established
bool established
Definition packets_gen.h:851
packet_conn_info::observer
bool observer
Definition packets_gen.h:852
packet_conn_info::used
bool used
Definition packets_gen.h:850
packet_conn_info::addr
char addr[MAX_LEN_ADDR]
Definition packets_gen.h:856
packet_conn_info::player_num
int player_num
Definition packets_gen.h:853
packet_conn_info::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:855
packet_conn_info::id
int id
Definition packets_gen.h:849
packet_conn_info::access_level
enum cmdlevel access_level
Definition packets_gen.h:854
packet_conn_ping_info
Definition packets_gen.h:860
packet_conn_ping_info::connections
int connections
Definition packets_gen.h:861
packet_conn_ping_info::ping_time
float ping_time[MAX_NUM_CONNECTIONS]
Definition packets_gen.h:863
packet_conn_ping_info::conn_id
int conn_id[MAX_NUM_CONNECTIONS]
Definition packets_gen.h:862
packet_conn_ping
Definition packets_gen.h:866
packet_conn_pong
Definition packets_gen.h:870
packet_connect_msg
Definition packets_gen.h:313
packet_connect_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:314
packet_diplomacy_accept_treaty_req
Definition packets_gen.h:817
packet_diplomacy_accept_treaty_req::counterpart
int counterpart
Definition packets_gen.h:818
packet_diplomacy_accept_treaty
Definition packets_gen.h:821
packet_diplomacy_accept_treaty::I_accepted
bool I_accepted
Definition packets_gen.h:823
packet_diplomacy_accept_treaty::counterpart
int counterpart
Definition packets_gen.h:822
packet_diplomacy_accept_treaty::other_accepted
bool other_accepted
Definition packets_gen.h:824
packet_diplomacy_cancel_meeting_req
Definition packets_gen.h:780
packet_diplomacy_cancel_meeting_req::counterpart
int counterpart
Definition packets_gen.h:781
packet_diplomacy_cancel_meeting
Definition packets_gen.h:784
packet_diplomacy_cancel_meeting::counterpart
int counterpart
Definition packets_gen.h:785
packet_diplomacy_cancel_meeting::initiated_from
int initiated_from
Definition packets_gen.h:786
packet_diplomacy_cancel_pact
Definition packets_gen.h:827
packet_diplomacy_cancel_pact::other_player_id
int other_player_id
Definition packets_gen.h:828
packet_diplomacy_cancel_pact::clause
enum clause_type clause
Definition packets_gen.h:829
packet_diplomacy_create_clause_req
Definition packets_gen.h:789
packet_diplomacy_create_clause_req::value
int value
Definition packets_gen.h:793
packet_diplomacy_create_clause_req::giver
int giver
Definition packets_gen.h:791
packet_diplomacy_create_clause_req::counterpart
int counterpart
Definition packets_gen.h:790
packet_diplomacy_create_clause_req::type
enum clause_type type
Definition packets_gen.h:792
packet_diplomacy_create_clause
Definition packets_gen.h:796
packet_diplomacy_create_clause::giver
int giver
Definition packets_gen.h:798
packet_diplomacy_create_clause::type
enum clause_type type
Definition packets_gen.h:799
packet_diplomacy_create_clause::counterpart
int counterpart
Definition packets_gen.h:797
packet_diplomacy_create_clause::value
int value
Definition packets_gen.h:800
packet_diplomacy_init_meeting_req
Definition packets_gen.h:771
packet_diplomacy_init_meeting_req::counterpart
int counterpart
Definition packets_gen.h:772
packet_diplomacy_init_meeting
Definition packets_gen.h:775
packet_diplomacy_init_meeting::initiated_from
int initiated_from
Definition packets_gen.h:777
packet_diplomacy_init_meeting::counterpart
int counterpart
Definition packets_gen.h:776
packet_diplomacy_remove_clause_req
Definition packets_gen.h:803
packet_diplomacy_remove_clause_req::type
enum clause_type type
Definition packets_gen.h:806
packet_diplomacy_remove_clause_req::giver
int giver
Definition packets_gen.h:805
packet_diplomacy_remove_clause_req::counterpart
int counterpart
Definition packets_gen.h:804
packet_diplomacy_remove_clause_req::value
int value
Definition packets_gen.h:807
packet_diplomacy_remove_clause
Definition packets_gen.h:810
packet_diplomacy_remove_clause::counterpart
int counterpart
Definition packets_gen.h:811
packet_diplomacy_remove_clause::value
int value
Definition packets_gen.h:814
packet_diplomacy_remove_clause::giver
int giver
Definition packets_gen.h:812
packet_diplomacy_remove_clause::type
enum clause_type type
Definition packets_gen.h:813
packet_early_chat_msg
Definition packets_gen.h:300
packet_early_chat_msg::event
enum event_type event
Definition packets_gen.h:303
packet_early_chat_msg::message
char message[MAX_LEN_MSG]
Definition packets_gen.h:301
packet_early_chat_msg::phase
int phase
Definition packets_gen.h:305
packet_early_chat_msg::conn_id
int conn_id
Definition packets_gen.h:306
packet_early_chat_msg::turn
int turn
Definition packets_gen.h:304
packet_early_chat_msg::tile
int tile
Definition packets_gen.h:302
packet_edit_check_tiles
Definition packets_gen.h:1666
packet_edit_city_create
Definition packets_gen.h:1749
packet_edit_city_create::size
int size
Definition packets_gen.h:1752
packet_edit_city_create::tag
int tag
Definition packets_gen.h:1753
packet_edit_city_create::owner
int owner
Definition packets_gen.h:1750
packet_edit_city_create::tile
int tile
Definition packets_gen.h:1751
packet_edit_city_remove
Definition packets_gen.h:1756
packet_edit_city_remove::id
int id
Definition packets_gen.h:1757
packet_edit_city
Definition packets_gen.h:1760
packet_edit_city::turn_founded
int turn_founded
Definition packets_gen.h:1784
packet_edit_city::turn_last_built
int turn_last_built
Definition packets_gen.h:1785
packet_edit_city::production_value
int production_value
Definition packets_gen.h:1788
packet_edit_city::specialists_size
int specialists_size
Definition packets_gen.h:1771
packet_edit_city::ppl_content
int ppl_content[5]
Definition packets_gen.h:1768
packet_edit_city::shield_stock
int shield_stock
Definition packets_gen.h:1774
packet_edit_city::specialists
int specialists[SP_MAX]
Definition packets_gen.h:1772
packet_edit_city::built
int built[B_LAST]
Definition packets_gen.h:1786
packet_edit_city::steal
int steal
Definition packets_gen.h:1783
packet_edit_city::ppl_angry
int ppl_angry[5]
Definition packets_gen.h:1770
packet_edit_city::name
char name[MAX_LEN_CITYNAME]
Definition packets_gen.h:1762
packet_edit_city::ppl_happy
int ppl_happy[5]
Definition packets_gen.h:1767
packet_edit_city::was_happy
bool was_happy
Definition packets_gen.h:1779
packet_edit_city::anarchy
int anarchy
Definition packets_gen.h:1781
packet_edit_city::production_kind
int production_kind
Definition packets_gen.h:1787
packet_edit_city::did_sell
bool did_sell
Definition packets_gen.h:1778
packet_edit_city::debug
bool debug
Definition packets_gen.h:1776
packet_edit_city::did_buy
bool did_buy
Definition packets_gen.h:1777
packet_edit_city::history
int history
Definition packets_gen.h:1766
packet_edit_city::rapture
int rapture
Definition packets_gen.h:1782
packet_edit_city::original
int original
Definition packets_gen.h:1764
packet_edit_city::airlift
bool airlift
Definition packets_gen.h:1775
packet_edit_city::food_stock
int food_stock
Definition packets_gen.h:1773
packet_edit_city::had_famine
bool had_famine
Definition packets_gen.h:1780
packet_edit_city::city_options
bv_city_options city_options
Definition packets_gen.h:1789
packet_edit_city::owner
int owner
Definition packets_gen.h:1763
packet_edit_city::ppl_unhappy
int ppl_unhappy[5]
Definition packets_gen.h:1769
packet_edit_city::size
int size
Definition packets_gen.h:1765
packet_edit_city::id
int id
Definition packets_gen.h:1761
packet_edit_game
Definition packets_gen.h:1836
packet_edit_game::ruleset_locked
bool ruleset_locked
Definition packets_gen.h:1845
packet_edit_game::scenario_players
bool scenario_players
Definition packets_gen.h:1841
packet_edit_game::lake_flooding
bool lake_flooding
Definition packets_gen.h:1844
packet_edit_game::startpos_nations
bool startpos_nations
Definition packets_gen.h:1842
packet_edit_game::scenario_name
char scenario_name[256]
Definition packets_gen.h:1838
packet_edit_game::prevent_new_cities
bool prevent_new_cities
Definition packets_gen.h:1843
packet_edit_game::scenario
bool scenario
Definition packets_gen.h:1837
packet_edit_game::scenario_authors
char scenario_authors[MAX_LEN_PACKET/3]
Definition packets_gen.h:1839
packet_edit_game::scenario_random
bool scenario_random
Definition packets_gen.h:1840
packet_edit_mode
Definition packets_gen.h:1658
packet_edit_mode::state
bool state
Definition packets_gen.h:1659
packet_edit_object_created
Definition packets_gen.h:1852
packet_edit_object_created::id
int id
Definition packets_gen.h:1854
packet_edit_object_created::tag
int tag
Definition packets_gen.h:1853
packet_edit_player_create
Definition packets_gen.h:1792
packet_edit_player_create::tag
int tag
Definition packets_gen.h:1793
packet_edit_player_remove
Definition packets_gen.h:1796
packet_edit_player_remove::id
int id
Definition packets_gen.h:1797
packet_edit_player_vision
Definition packets_gen.h:1829
packet_edit_player_vision::tile
int tile
Definition packets_gen.h:1831
packet_edit_player_vision::known
bool known
Definition packets_gen.h:1832
packet_edit_player_vision::player
int player
Definition packets_gen.h:1830
packet_edit_player_vision::size
int size
Definition packets_gen.h:1833
packet_edit_player
Definition packets_gen.h:1800
packet_edit_player::ranked_username
char ranked_username[MAX_LEN_NAME]
Definition packets_gen.h:1804
packet_edit_player::gold
int gold
Definition packets_gen.h:1817
packet_edit_player::team
int team
Definition packets_gen.h:1810
packet_edit_player::scenario_reserved
bool scenario_reserved
Definition packets_gen.h:1826
packet_edit_player::nation
Nation_type_id nation
Definition packets_gen.h:1809
packet_edit_player::user_turns
int user_turns
Definition packets_gen.h:1805
packet_edit_player::tax
int tax
Definition packets_gen.h:1818
packet_edit_player::ai
bool ai
Definition packets_gen.h:1825
packet_edit_player::luxury
int luxury
Definition packets_gen.h:1820
packet_edit_player::nturns_idle
int nturns_idle
Definition packets_gen.h:1812
packet_edit_player::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:1803
packet_edit_player::revolution_finishes
int revolution_finishes
Definition packets_gen.h:1814
packet_edit_player::is_male
bool is_male
Definition packets_gen.h:1806
packet_edit_player::science
int science
Definition packets_gen.h:1819
packet_edit_player::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1802
packet_edit_player::embassy
bv_player embassy
Definition packets_gen.h:1816
packet_edit_player::phase_done
bool phase_done
Definition packets_gen.h:1811
packet_edit_player::autoselect_weight
int autoselect_weight
Definition packets_gen.h:1815
packet_edit_player::id
int id
Definition packets_gen.h:1801
packet_edit_player::government
Government_type_id government
Definition packets_gen.h:1807
packet_edit_player::inventions
bool inventions[A_LAST+1]
Definition packets_gen.h:1824
packet_edit_player::bulbs_researched
int bulbs_researched
Definition packets_gen.h:1823
packet_edit_player::is_alive
bool is_alive
Definition packets_gen.h:1813
packet_edit_player::researching
int researching
Definition packets_gen.h:1822
packet_edit_player::future_tech
int future_tech
Definition packets_gen.h:1821
packet_edit_player::target_government
Government_type_id target_government
Definition packets_gen.h:1808
packet_edit_recalculate_borders
Definition packets_gen.h:1662
packet_edit_scenario_desc
Definition packets_gen.h:1848
packet_edit_scenario_desc::scenario_desc
char scenario_desc[MAX_LEN_CONTENT]
Definition packets_gen.h:1849
packet_edit_startpos_full
Definition packets_gen.h:1694
packet_edit_startpos_full::nations
bv_startpos_nations nations
Definition packets_gen.h:1697
packet_edit_startpos
Definition packets_gen.h:1688
packet_edit_startpos::removal
bool removal
Definition packets_gen.h:1690
packet_edit_startpos::tag
int tag
Definition packets_gen.h:1691
packet_edit_startpos::id
int id
Definition packets_gen.h:1689
packet_edit_tile_extra
Definition packets_gen.h:1680
packet_edit_tile_extra::tile
int tile
Definition packets_gen.h:1681
packet_edit_tile_extra::extra_type_id
int extra_type_id
Definition packets_gen.h:1682
packet_edit_tile_extra::removal
bool removal
Definition packets_gen.h:1683
packet_edit_tile_extra::size
int size
Definition packets_gen.h:1685
packet_edit_tile_extra::eowner
int eowner
Definition packets_gen.h:1684
packet_edit_tile_terrain
Definition packets_gen.h:1674
packet_edit_tile_terrain::size
int size
Definition packets_gen.h:1677
packet_edit_tile_terrain::tile
int tile
Definition packets_gen.h:1675
packet_edit_tile_terrain::terrain
Terrain_type_id terrain
Definition packets_gen.h:1676
packet_edit_tile
Definition packets_gen.h:1700
packet_edit_tile::resource
Resource_type_id resource
Definition packets_gen.h:1703
packet_edit_tile::startpos_nation
Nation_type_id startpos_nation
Definition packets_gen.h:1705
packet_edit_tile::eowner
int eowner
Definition packets_gen.h:1706
packet_edit_tile::label
char label[MAX_LEN_NAME]
Definition packets_gen.h:1707
packet_edit_tile::extras
bv_extras extras
Definition packets_gen.h:1702
packet_edit_tile::tile
int tile
Definition packets_gen.h:1701
packet_edit_tile::terrain
Terrain_type_id terrain
Definition packets_gen.h:1704
packet_edit_toggle_fogofwar
Definition packets_gen.h:1670
packet_edit_toggle_fogofwar::player
int player
Definition packets_gen.h:1671
packet_edit_unit_create
Definition packets_gen.h:1710
packet_edit_unit_create::tag
int tag
Definition packets_gen.h:1715
packet_edit_unit_create::count
int count
Definition packets_gen.h:1714
packet_edit_unit_create::type
Unit_type_id type
Definition packets_gen.h:1713
packet_edit_unit_create::tile
int tile
Definition packets_gen.h:1712
packet_edit_unit_create::owner
int owner
Definition packets_gen.h:1711
packet_edit_unit_remove_by_id
Definition packets_gen.h:1725
packet_edit_unit_remove_by_id::id
int id
Definition packets_gen.h:1726
packet_edit_unit_remove
Definition packets_gen.h:1718
packet_edit_unit_remove::count
int count
Definition packets_gen.h:1722
packet_edit_unit_remove::tile
int tile
Definition packets_gen.h:1720
packet_edit_unit_remove::owner
int owner
Definition packets_gen.h:1719
packet_edit_unit_remove::type
Unit_type_id type
Definition packets_gen.h:1721
packet_edit_unit
Definition packets_gen.h:1729
packet_edit_unit::owner
int owner
Definition packets_gen.h:1732
packet_edit_unit::activity_count
int activity_count
Definition packets_gen.h:1739
packet_edit_unit::stay
bool stay
Definition packets_gen.h:1746
packet_edit_unit::moved
bool moved
Definition packets_gen.h:1742
packet_edit_unit::transported_by
int transported_by
Definition packets_gen.h:1745
packet_edit_unit::debug
bool debug
Definition packets_gen.h:1741
packet_edit_unit::paradropped
bool paradropped
Definition packets_gen.h:1743
packet_edit_unit::done_moving
bool done_moving
Definition packets_gen.h:1744
packet_edit_unit::homecity
int homecity
Definition packets_gen.h:1733
packet_edit_unit::moves_left
int moves_left
Definition packets_gen.h:1734
packet_edit_unit::id
int id
Definition packets_gen.h:1730
packet_edit_unit::hp
int hp
Definition packets_gen.h:1735
packet_edit_unit::utype
Unit_type_id utype
Definition packets_gen.h:1731
packet_edit_unit::activity
enum unit_activity activity
Definition packets_gen.h:1738
packet_edit_unit::fuel
int fuel
Definition packets_gen.h:1737
packet_edit_unit::veteran
int veteran
Definition packets_gen.h:1736
packet_edit_unit::activity_base
Base_type_id activity_base
Definition packets_gen.h:1740
packet_end_phase
Definition packets_gen.h:884
packet_end_turn
Definition packets_gen.h:902
packet_endgame_player
Definition packets_gen.h:91
packet_endgame_report
Definition packets_gen.h:85
packet_freeze_client
Definition packets_gen.h:906
packet_game_info
Definition packets_gen.h:115
packet_game_info::tech_steal_allow_holes
bool tech_steal_allow_holes
Definition packets_gen.h:211
packet_game_info::coolinglevel
int coolinglevel
Definition packets_gen.h:147
packet_game_info::min_trade_route_val
int min_trade_route_val
Definition packets_gen.h:158
packet_game_info::shieldbox
int shieldbox
Definition packets_gen.h:221
packet_game_info::illness_trade_infection
int illness_trade_infection
Definition packets_gen.h:183
packet_game_info::fulltradesize
int fulltradesize
Definition packets_gen.h:156
packet_game_info::gameloss_style
enum gameloss_style gameloss_style
Definition packets_gen.h:232
packet_game_info::history_interest_pml
int history_interest_pml
Definition packets_gen.h:136
packet_game_info::citizen_partisans_pct
int citizen_partisans_pct
Definition packets_gen.h:144
packet_game_info::restrictinfra
bool restrictinfra
Definition packets_gen.h:218
packet_game_info::celebratesize
int celebratesize
Definition packets_gen.h:137
packet_game_info::goods_selection
enum goods_selection_method goods_selection
Definition packets_gen.h:160
packet_game_info::borders
enum borders_mode borders
Definition packets_gen.h:130
packet_game_info::team_pooled_research
bool team_pooled_research
Definition packets_gen.h:224
packet_game_info::illness_base_factor
int illness_base_factor
Definition packets_gen.h:179
packet_game_info::illness_min_size
int illness_min_size
Definition packets_gen.h:180
packet_game_info::aifill
int aifill
Definition packets_gen.h:117
packet_game_info::happyborders
enum happyborders_type happyborders
Definition packets_gen.h:177
packet_game_info::add_to_size_limit
int add_to_size_limit
Definition packets_gen.h:116
packet_game_info::forced_science
int forced_science
Definition packets_gen.h:155
packet_game_info::disasters
int disasters
Definition packets_gen.h:217
packet_game_info::trading_city
bool trading_city
Definition packets_gen.h:238
packet_game_info::granary_num_inis
int granary_num_inis
Definition packets_gen.h:174
packet_game_info::government_during_revolution_id
Government_type_id government_during_revolution_id
Definition packets_gen.h:171
packet_game_info::first_timeout
int first_timeout
Definition packets_gen.h:234
packet_game_info::globalwarming
int globalwarming
Definition packets_gen.h:164
packet_game_info::gold_upkeep_style
enum gold_upkeep_style gold_upkeep_style
Definition packets_gen.h:166
packet_game_info::pop_report_zeroes
int pop_report_zeroes
Definition packets_gen.h:139
packet_game_info::nuclearwinter
int nuclearwinter
Definition packets_gen.h:205
packet_game_info::killstack
bool killstack
Definition packets_gen.h:188
packet_game_info::damage_reduces_bombard_rate
bool damage_reduces_bombard_rate
Definition packets_gen.h:192
packet_game_info::techloss_forgiveness
int techloss_forgiveness
Definition packets_gen.h:230
packet_game_info::citizen_nationality
bool citizen_nationality
Definition packets_gen.h:140
packet_game_info::nuke_pop_loss_pct
int nuke_pop_loss_pct
Definition packets_gen.h:197
packet_game_info::nuke_defender_survival_chance_pct
int nuke_defender_survival_chance_pct
Definition packets_gen.h:198
packet_game_info::angrycitizen
int angrycitizen
Definition packets_gen.h:122
packet_game_info::granary_food_inc
int granary_food_inc
Definition packets_gen.h:172
packet_game_info::tech_upkeep_style
enum tech_upkeep_style tech_upkeep_style
Definition packets_gen.h:229
packet_game_info::notradesize
int notradesize
Definition packets_gen.h:203
packet_game_info::tech_trade_loss_allow_holes
bool tech_trade_loss_allow_holes
Definition packets_gen.h:213
packet_game_info::granary_food_ini
int granary_food_ini[MAX_GRANARY_INIS]
Definition packets_gen.h:173
packet_game_info::culture_vic_lead
int culture_vic_lead
Definition packets_gen.h:134
packet_game_info::diplomacy
enum diplomacy_mode diplomacy
Definition packets_gen.h:149
packet_game_info::trading_gold
bool trading_gold
Definition packets_gen.h:239
packet_game_info::trade_world_rel_pct
int trade_world_rel_pct
Definition packets_gen.h:157
packet_game_info::free_tech_method
enum free_tech_method free_tech_method
Definition packets_gen.h:231
packet_game_info::changable_tax
bool changable_tax
Definition packets_gen.h:138
packet_game_info::rapturedelay
int rapturedelay
Definition packets_gen.h:216
packet_game_info::tech_leak_pct
int tech_leak_pct
Definition packets_gen.h:126
packet_game_info::steal_maps_reveals_all_cities
bool steal_maps_reveals_all_cities
Definition packets_gen.h:209
packet_game_info::init_city_radius_sq
int init_city_radius_sq
Definition packets_gen.h:184
packet_game_info::granularity
int granularity
Definition packets_gen.h:250
packet_game_info::conquest_convert_pct
int conquest_convert_pct
Definition packets_gen.h:143
packet_game_info::trade_revenue_style
enum trade_revenue_style trade_revenue_style
Definition packets_gen.h:237
packet_game_info::muuk_food_wipe
bool muuk_food_wipe
Definition packets_gen.h:200
packet_game_info::homeless_gold_upkeep
bool homeless_gold_upkeep
Definition packets_gen.h:167
packet_game_info::tired_attack
bool tired_attack
Definition packets_gen.h:235
packet_game_info::only_real_fight_makes_veteran
bool only_real_fight_makes_veteran
Definition packets_gen.h:190
packet_game_info::year_0_hack
bool year_0_hack
Definition packets_gen.h:244
packet_game_info::great_wonder_owners
int great_wonder_owners[B_LAST]
Definition packets_gen.h:175
packet_game_info::cooling
int cooling
Definition packets_gen.h:146
packet_game_info::low_firepower_pearl_harbour
int low_firepower_pearl_harbour
Definition packets_gen.h:194
packet_game_info::base_pollution
int base_pollution
Definition packets_gen.h:123
packet_game_info::is_edit_mode
bool is_edit_mode
Definition packets_gen.h:185
packet_game_info::trading_tech
bool trading_tech
Definition packets_gen.h:240
packet_game_info::citizen_convert_speed
int citizen_convert_speed
Definition packets_gen.h:142
packet_game_info::forced_gold
int forced_gold
Definition packets_gen.h:153
packet_game_info::global_advances
bool global_advances[A_LAST]
Definition packets_gen.h:162
packet_game_info::illness_pollution_factor
int illness_pollution_factor
Definition packets_gen.h:182
packet_game_info::is_new_game
bool is_new_game
Definition packets_gen.h:186
packet_game_info::fragment_count
int fragment_count
Definition packets_gen.h:246
packet_game_info::infrapoints
int infrapoints
Definition packets_gen.h:168
packet_game_info::base_tech_cost
int base_tech_cost
Definition packets_gen.h:124
packet_game_info::warminglevel
int warminglevel
Definition packets_gen.h:242
packet_game_info::airlifting_style
enum airlifting_style airlifting_style
Definition packets_gen.h:119
packet_game_info::happy_cost
int happy_cost
Definition packets_gen.h:176
packet_game_info::civil_war_enabled
bool civil_war_enabled
Definition packets_gen.h:247
packet_game_info::muuk_gold_wipe
bool muuk_gold_wipe
Definition packets_gen.h:201
packet_game_info::food_cost
int food_cost
Definition packets_gen.h:151
packet_game_info::tech_leakage
enum tech_leakage_style tech_leakage
Definition packets_gen.h:227
packet_game_info::skill_level
enum ai_level skill_level
Definition packets_gen.h:222
packet_game_info::revolentype
enum revolen_type revolentype
Definition packets_gen.h:169
packet_game_info::gold
int gold
Definition packets_gen.h:165
packet_game_info::phase_mode
enum phase_mode_type phase_mode
Definition packets_gen.h:207
packet_game_info::reveal_trade_partner
bool reveal_trade_partner
Definition packets_gen.h:159
packet_game_info::airlift_from_always_enabled
bool airlift_from_always_enabled
Definition packets_gen.h:120
packet_game_info::caravan_bonus_style
enum caravan_bonus_style caravan_bonus_style
Definition packets_gen.h:132
packet_game_info::min_tech_cost
int min_tech_cost
Definition packets_gen.h:125
packet_game_info::tech
int tech
Definition packets_gen.h:225
packet_game_info::illness_on
bool illness_on
Definition packets_gen.h:181
packet_game_info::civil_war_bonus_unhappy
int civil_war_bonus_unhappy
Definition packets_gen.h:249
packet_game_info::only_killing_makes_veteran
bool only_killing_makes_veteran
Definition packets_gen.h:189
packet_game_info::poison_empties_food_stock
bool poison_empties_food_stock
Definition packets_gen.h:210
packet_game_info::tech_loss_allow_holes
bool tech_loss_allow_holes
Definition packets_gen.h:215
packet_game_info::diplchance_initial_odds
bv_actions diplchance_initial_odds
Definition packets_gen.h:148
packet_game_info::tech_trade_allow_holes
bool tech_trade_allow_holes
Definition packets_gen.h:212
packet_game_info::heating
int heating
Definition packets_gen.h:178
packet_game_info::turn
int turn
Definition packets_gen.h:241
packet_game_info::low_firepower_nonnat_bombard
int low_firepower_nonnat_bombard
Definition packets_gen.h:196
packet_game_info::year
int year
Definition packets_gen.h:243
packet_game_info::border_size_effect
int border_size_effect
Definition packets_gen.h:128
packet_game_info::tech_upkeep_divider
int tech_upkeep_divider
Definition packets_gen.h:228
packet_game_info::sciencebox
int sciencebox
Definition packets_gen.h:220
packet_game_info::pillage_select
bool pillage_select
Definition packets_gen.h:208
packet_game_info::top_cities_count
int top_cities_count
Definition packets_gen.h:245
packet_game_info::phase
int phase
Definition packets_gen.h:206
packet_game_info::tech_parasite_allow_holes
bool tech_parasite_allow_holes
Definition packets_gen.h:214
packet_game_info::muuk_shield_wipe
bool muuk_shield_wipe
Definition packets_gen.h:202
packet_game_info::base_bribe_cost
int base_bribe_cost
Definition packets_gen.h:131
packet_game_info::trademindist
int trademindist
Definition packets_gen.h:236
packet_game_info::nuclear_winter
bool nuclear_winter
Definition packets_gen.h:204
packet_game_info::low_firepower_combat_bonus
int low_firepower_combat_bonus
Definition packets_gen.h:195
packet_game_info::culture_migration_pml
int culture_migration_pml
Definition packets_gen.h:135
packet_game_info::border_city_permanent_radius_sq
int border_city_permanent_radius_sq
Definition packets_gen.h:129
packet_game_info::unreachable_protects
bool unreachable_protects
Definition packets_gen.h:219
packet_game_info::culture_vic_points
int culture_vic_points
Definition packets_gen.h:133
packet_game_info::persistent_ready
enum persistent_ready persistent_ready
Definition packets_gen.h:118
packet_game_info::low_firepower_badwallattacker
int low_firepower_badwallattacker
Definition packets_gen.h:193
packet_game_info::airlift_to_always_enabled
bool airlift_to_always_enabled
Definition packets_gen.h:121
packet_game_info::fogofwar
bool fogofwar
Definition packets_gen.h:150
packet_game_info::small_wonder_visibility
enum wonder_visib_type small_wonder_visibility
Definition packets_gen.h:251
packet_game_info::tech_cost_style
enum tech_cost_style tech_cost_style
Definition packets_gen.h:226
packet_game_info::foodbox
int foodbox
Definition packets_gen.h:152
packet_game_info::combat_odds_scaled_veterancy
bool combat_odds_scaled_veterancy
Definition packets_gen.h:191
packet_game_info::unit_builders_nationality
bool unit_builders_nationality
Definition packets_gen.h:141
packet_game_info::victory_conditions
enum victory_condition_type victory_conditions
Definition packets_gen.h:223
packet_game_info::civil_war_bonus_celebrating
int civil_war_bonus_celebrating
Definition packets_gen.h:248
packet_game_info::border_city_radius_sq
int border_city_radius_sq
Definition packets_gen.h:127
packet_game_info::global_warming
bool global_warming
Definition packets_gen.h:163
packet_game_info::citymindist
int citymindist
Definition packets_gen.h:145
packet_game_info::default_government_id
Government_type_id default_government_id
Definition packets_gen.h:170
packet_game_info::forced_luxury
int forced_luxury
Definition packets_gen.h:154
packet_game_info::global_advance_count
int global_advance_count
Definition packets_gen.h:161
packet_game_info::min_city_center_output
int min_city_center_output[O_LAST]
Definition packets_gen.h:199
packet_game_info::killcitizen
bool killcitizen
Definition packets_gen.h:187
packet_game_info::timeout
int timeout
Definition packets_gen.h:233
packet_game_load
Definition packets_gen.h:1507
packet_game_load::load_successful
bool load_successful
Definition packets_gen.h:1508
packet_game_load::load_filename
char load_filename[MAX_LEN_PACKET]
Definition packets_gen.h:1509
packet_handlers
Definition packets.h:74
packet_investigate_finished
Definition packets_gen.h:37
packet_investigate_finished::city_id
int city_id
Definition packets_gen.h:39
packet_investigate_finished::unit_id
int unit_id
Definition packets_gen.h:38
packet_investigate_started
Definition packets_gen.h:32
packet_investigate_started::city_id
int city_id
Definition packets_gen.h:34
packet_investigate_started::unit_id
int unit_id
Definition packets_gen.h:33
packet_map_info
Definition packets_gen.h:267
packet_map_info::wrap_id
int wrap_id
Definition packets_gen.h:271
packet_map_info::south_latitude
int south_latitude
Definition packets_gen.h:273
packet_map_info::ysize
int ysize
Definition packets_gen.h:269
packet_map_info::topology_id
int topology_id
Definition packets_gen.h:270
packet_map_info::xsize
int xsize
Definition packets_gen.h:268
packet_map_info::north_latitude
int north_latitude
Definition packets_gen.h:272
packet_nation_availability
Definition packets_gen.h:1152
packet_nation_availability::ncount
int ncount
Definition packets_gen.h:1153
packet_nation_availability::is_pickable
bool is_pickable[MAX_NUM_NATIONS]
Definition packets_gen.h:1154
packet_nation_availability::nationset_change
bool nationset_change
Definition packets_gen.h:1155
packet_nation_select_req
Definition packets_gen.h:72
packet_nation_select_req::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:76
packet_nation_select_req::nation_no
Nation_type_id nation_no
Definition packets_gen.h:74
packet_nation_select_req::player_no
int player_no
Definition packets_gen.h:73
packet_nation_select_req::is_male
bool is_male
Definition packets_gen.h:75
packet_nation_select_req::style
int style
Definition packets_gen.h:77
packet_new_year
Definition packets_gen.h:892
packet_new_year::year
int year
Definition packets_gen.h:893
packet_new_year::turn
int turn
Definition packets_gen.h:895
packet_new_year::fragments
int fragments
Definition packets_gen.h:894
packet_nuke_tile_info
Definition packets_gen.h:276
packet_nuke_tile_info::tile
int tile
Definition packets_gen.h:277
packet_page_msg_part
Definition packets_gen.h:840
packet_page_msg_part::lines
char lines[MAX_LEN_CONTENT]
Definition packets_gen.h:841
packet_page_msg
Definition packets_gen.h:832
packet_page_msg::event
enum event_type event
Definition packets_gen.h:835
packet_page_msg::headline
char headline[MAX_LEN_MSG]
Definition packets_gen.h:834
packet_page_msg::parts
int parts
Definition packets_gen.h:837
packet_page_msg::caption
char caption[MAX_LEN_MSG]
Definition packets_gen.h:833
packet_page_msg::len
int len
Definition packets_gen.h:836
packet_play_music
Definition packets_gen.h:1857
packet_play_music::tag
char tag[MAX_LEN_NAME]
Definition packets_gen.h:1858
packet_player_attribute_block
Definition packets_gen.h:578
packet_player_attribute_chunk
Definition packets_gen.h:582
packet_player_attribute_chunk::chunk_length
int chunk_length
Definition packets_gen.h:585
packet_player_attribute_chunk::data
unsigned char data[ATTRIBUTE_CHUNK_SIZE]
Definition packets_gen.h:586
packet_player_attribute_chunk::total_length
int total_length
Definition packets_gen.h:584
packet_player_attribute_chunk::offset
int offset
Definition packets_gen.h:583
packet_player_change_government
Definition packets_gen.h:569
packet_player_change_government::government
Government_type_id government
Definition packets_gen.h:570
packet_player_diplstate
Definition packets_gen.h:589
packet_player_diplstate::plr1
int plr1
Definition packets_gen.h:591
packet_player_diplstate::diplstate_id
int diplstate_id
Definition packets_gen.h:590
packet_player_diplstate::type
enum diplstate_type type
Definition packets_gen.h:593
packet_player_diplstate::has_reason_to_cancel
int has_reason_to_cancel
Definition packets_gen.h:595
packet_player_diplstate::turns_left
int turns_left
Definition packets_gen.h:594
packet_player_diplstate::plr2
int plr2
Definition packets_gen.h:592
packet_player_diplstate::contact_turns_left
int contact_turns_left
Definition packets_gen.h:596
packet_player_info
Definition packets_gen.h:508
packet_player_info::ai_skill_level
enum ai_level ai_skill_level
Definition packets_gen.h:539
packet_player_info::phase_done
bool phase_done
Definition packets_gen.h:525
packet_player_info::is_alive
bool is_alive
Definition packets_gen.h:528
packet_player_info::is_male
bool is_male
Definition packets_gen.h:514
packet_player_info::luxury
int luxury
Definition packets_gen.h:533
packet_player_info::turns_alive
int turns_alive
Definition packets_gen.h:527
packet_player_info::color_red
int color_red
Definition packets_gen.h:548
packet_player_info::is_ready
bool is_ready
Definition packets_gen.h:524
packet_player_info::multiplier
int multiplier[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:554
packet_player_info::username
char username[MAX_LEN_NAME]
Definition packets_gen.h:511
packet_player_info::tech_upkeep
int tech_upkeep
Definition packets_gen.h:535
packet_player_info::style
int style
Definition packets_gen.h:520
packet_player_info::culture
int culture
Definition packets_gen.h:544
packet_player_info::flags
bv_plr_flags flags
Definition packets_gen.h:551
packet_player_info::mood
enum mood_type mood
Definition packets_gen.h:519
packet_player_info::color_green
int color_green
Definition packets_gen.h:549
packet_player_info::color_valid
bool color_valid
Definition packets_gen.h:546
packet_player_info::gives_shared_vision
bv_player gives_shared_vision
Definition packets_gen.h:541
packet_player_info::team
int team
Definition packets_gen.h:523
packet_player_info::love
int love[MAX_NUM_PLAYER_SLOTS]
Definition packets_gen.h:545
packet_player_info::autoselect_weight
int autoselect_weight
Definition packets_gen.h:529
packet_player_info::was_created
bool was_created
Definition packets_gen.h:515
packet_player_info::target_government
Government_type_id target_government
Definition packets_gen.h:517
packet_player_info::multiplier_target
int multiplier_target[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:555
packet_player_info::is_connected
bool is_connected
Definition packets_gen.h:537
packet_player_info::unassigned_user
bool unassigned_user
Definition packets_gen.h:512
packet_player_info::multiplier_changed
int multiplier_changed[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:556
packet_player_info::gives_shared_tiles
bv_player gives_shared_tiles
Definition packets_gen.h:542
packet_player_info::nturns_idle
int nturns_idle
Definition packets_gen.h:526
packet_player_info::score
int score
Definition packets_gen.h:513
packet_player_info::multip_count
int multip_count
Definition packets_gen.h:553
packet_player_info::nation
Nation_type_id nation
Definition packets_gen.h:522
packet_player_info::science_cost
int science_cost
Definition packets_gen.h:536
packet_player_info::barbarian_type
enum barbarian_type barbarian_type
Definition packets_gen.h:540
packet_player_info::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:510
packet_player_info::government
Government_type_id government
Definition packets_gen.h:516
packet_player_info::real_embassy
bv_player real_embassy
Definition packets_gen.h:518
packet_player_info::wonders
int wonders[B_LAST]
Definition packets_gen.h:552
packet_player_info::tax
int tax
Definition packets_gen.h:531
packet_player_info::music_style
int music_style
Definition packets_gen.h:521
packet_player_info::history
int history
Definition packets_gen.h:543
packet_player_info::science
int science
Definition packets_gen.h:532
packet_player_info::gold
int gold
Definition packets_gen.h:530
packet_player_info::revolution_finishes
int revolution_finishes
Definition packets_gen.h:538
packet_player_info::color_changeable
bool color_changeable
Definition packets_gen.h:547
packet_player_info::color_blue
int color_blue
Definition packets_gen.h:550
packet_player_info::infrapoints
int infrapoints
Definition packets_gen.h:534
packet_player_info::playerno
int playerno
Definition packets_gen.h:509
packet_player_multiplier
Definition packets_gen.h:599
packet_player_multiplier::count
int count
Definition packets_gen.h:600
packet_player_multiplier::multipliers
int multipliers[MAX_NUM_MULTIPLIERS]
Definition packets_gen.h:601
packet_player_phase_done
Definition packets_gen.h:559
packet_player_phase_done::turn
int turn
Definition packets_gen.h:560
packet_player_place_infra
Definition packets_gen.h:573
packet_player_place_infra::tile
int tile
Definition packets_gen.h:574
packet_player_place_infra::extra
int extra
Definition packets_gen.h:575
packet_player_rates
Definition packets_gen.h:563
packet_player_rates::science
int science
Definition packets_gen.h:566
packet_player_rates::luxury
int luxury
Definition packets_gen.h:565
packet_player_rates::tax
int tax
Definition packets_gen.h:564
packet_player_ready
Definition packets_gen.h:80
packet_player_ready::player_no
int player_no
Definition packets_gen.h:81
packet_player_ready::is_ready
bool is_ready
Definition packets_gen.h:82
packet_player_remove
Definition packets_gen.h:504
packet_player_remove::playerno
int playerno
Definition packets_gen.h:505
packet_player_research
Definition packets_gen.h:620
packet_player_research::tech
int tech
Definition packets_gen.h:621
packet_player_tech_goal
Definition packets_gen.h:624
packet_player_tech_goal::tech
int tech
Definition packets_gen.h:625
packet_processing_finished
Definition packets_gen.h:28
packet_processing_started
Definition packets_gen.h:24
packet_report_req
Definition packets_gen.h:844
packet_report_req::type
enum report_type type
Definition packets_gen.h:845
packet_research_info
Definition packets_gen.h:604
packet_research_info::tech_goal
int tech_goal
Definition packets_gen.h:611
packet_research_info::researching
int researching
Definition packets_gen.h:608
packet_research_info::inventions
char inventions[A_LAST+1]
Definition packets_gen.h:613
packet_research_info::techs_researched
int techs_researched
Definition packets_gen.h:606
packet_research_info::id
int id
Definition packets_gen.h:605
packet_research_info::future_tech
int future_tech
Definition packets_gen.h:607
packet_research_info::bulbs_researched
int bulbs_researched
Definition packets_gen.h:610
packet_research_info::researching_cost
int researching_cost
Definition packets_gen.h:609
packet_research_info::total_bulbs_prod
int total_bulbs_prod
Definition packets_gen.h:612
packet_ruleset_achievement
Definition packets_gen.h:1357
packet_ruleset_achievement::id
int id
Definition packets_gen.h:1358
packet_ruleset_achievement::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1360
packet_ruleset_achievement::unique
bool unique
Definition packets_gen.h:1362
packet_ruleset_achievement::value
int value
Definition packets_gen.h:1363
packet_ruleset_achievement::type
enum achievement_type type
Definition packets_gen.h:1361
packet_ruleset_achievement::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1359
packet_ruleset_action_auto
Definition packets_gen.h:1396
packet_ruleset_action_auto::id
int id
Definition packets_gen.h:1397
packet_ruleset_action_auto::alternatives
action_id alternatives[MAX_NUM_ACTIONS]
Definition packets_gen.h:1402
packet_ruleset_action_auto::reqs_count
int reqs_count
Definition packets_gen.h:1399
packet_ruleset_action_auto::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1400
packet_ruleset_action_auto::alternatives_count
int alternatives_count
Definition packets_gen.h:1401
packet_ruleset_action_auto::cause
enum action_auto_perf_cause cause
Definition packets_gen.h:1398
packet_ruleset_action_enabler
Definition packets_gen.h:1388
packet_ruleset_action_enabler::enabled_action
action_id enabled_action
Definition packets_gen.h:1389
packet_ruleset_action_enabler::actor_reqs_count
int actor_reqs_count
Definition packets_gen.h:1390
packet_ruleset_action_enabler::actor_reqs
struct requirement actor_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1391
packet_ruleset_action_enabler::target_reqs
struct requirement target_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1393
packet_ruleset_action_enabler::target_reqs_count
int target_reqs_count
Definition packets_gen.h:1392
packet_ruleset_action
Definition packets_gen.h:1373
packet_ruleset_action::quiet
bool quiet
Definition packets_gen.h:1376
packet_ruleset_action::sub_tgt_kind
enum action_sub_target_kind sub_tgt_kind
Definition packets_gen.h:1382
packet_ruleset_action::act_kind
enum action_actor_kind act_kind
Definition packets_gen.h:1380
packet_ruleset_action::actor_consuming_always
bool actor_consuming_always
Definition packets_gen.h:1379
packet_ruleset_action::blocked_by
bv_actions blocked_by
Definition packets_gen.h:1385
packet_ruleset_action::max_distance
int max_distance
Definition packets_gen.h:1384
packet_ruleset_action::id
action_id id
Definition packets_gen.h:1374
packet_ruleset_action::min_distance
int min_distance
Definition packets_gen.h:1383
packet_ruleset_action::sub_results
bv_action_sub_results sub_results
Definition packets_gen.h:1378
packet_ruleset_action::ui_name
char ui_name[MAX_LEN_NAME]
Definition packets_gen.h:1375
packet_ruleset_action::tgt_kind
enum action_target_kind tgt_kind
Definition packets_gen.h:1381
packet_ruleset_action::result
enum action_result result
Definition packets_gen.h:1377
packet_ruleset_base
Definition packets_gen.h:1310
packet_ruleset_base::vision_subs_sq
int vision_subs_sq
Definition packets_gen.h:1316
packet_ruleset_base::vision_invis_sq
int vision_invis_sq
Definition packets_gen.h:1315
packet_ruleset_base::border_sq
int border_sq
Definition packets_gen.h:1313
packet_ruleset_base::vision_main_sq
int vision_main_sq
Definition packets_gen.h:1314
packet_ruleset_base::gui_type
enum base_gui_type gui_type
Definition packets_gen.h:1312
packet_ruleset_base::id
int id
Definition packets_gen.h:1311
packet_ruleset_building
Definition packets_gen.h:1175
packet_ruleset_building::flags
bv_impr_flags flags
Definition packets_gen.h:1190
packet_ruleset_building::id
Impr_type_id id
Definition packets_gen.h:1176
packet_ruleset_building::build_cost
int build_cost
Definition packets_gen.h:1187
packet_ruleset_building::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1194
packet_ruleset_building::obs_reqs
struct requirement obs_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1186
packet_ruleset_building::upkeep
int upkeep
Definition packets_gen.h:1188
packet_ruleset_building::soundtag_alt
char soundtag_alt[MAX_LEN_NAME]
Definition packets_gen.h:1192
packet_ruleset_building::reqs_count
int reqs_count
Definition packets_gen.h:1183
packet_ruleset_building::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1184
packet_ruleset_building::genus
enum impr_genus_id genus
Definition packets_gen.h:1177
packet_ruleset_building::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1178
packet_ruleset_building::soundtag
char soundtag[MAX_LEN_NAME]
Definition packets_gen.h:1191
packet_ruleset_building::sabotage
int sabotage
Definition packets_gen.h:1189
packet_ruleset_building::soundtag_alt2
char soundtag_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1193
packet_ruleset_building::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1179
packet_ruleset_building::obs_count
int obs_count
Definition packets_gen.h:1185
packet_ruleset_building::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1182
packet_ruleset_building::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1180
packet_ruleset_building::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1181
packet_ruleset_choices
Definition packets_gen.h:1498
packet_ruleset_choices::ruleset_count
int ruleset_count
Definition packets_gen.h:1499
packet_ruleset_choices::rulesets
char rulesets[MAX_NUM_RULESETS][MAX_RULESET_NAME_LENGTH]
Definition packets_gen.h:1500
packet_ruleset_city
Definition packets_gen.h:1164
packet_ruleset_city::citizens_graphic
char citizens_graphic[MAX_LEN_NAME]
Definition packets_gen.h:1168
packet_ruleset_city::style_id
int style_id
Definition packets_gen.h:1165
packet_ruleset_city::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1166
packet_ruleset_city::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1167
packet_ruleset_city::reqs_count
int reqs_count
Definition packets_gen.h:1169
packet_ruleset_city::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1172
packet_ruleset_city::graphic
char graphic[MAX_LEN_NAME]
Definition packets_gen.h:1171
packet_ruleset_city::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1170
packet_ruleset_clause
Definition packets_gen.h:1439
packet_ruleset_clause::type
enum clause_type type
Definition packets_gen.h:1440
packet_ruleset_clause::receiver_reqs
struct requirement receiver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1445
packet_ruleset_clause::receiver_reqs_count
int receiver_reqs_count
Definition packets_gen.h:1444
packet_ruleset_clause::giver_reqs_count
int giver_reqs_count
Definition packets_gen.h:1442
packet_ruleset_clause::enabled
bool enabled
Definition packets_gen.h:1441
packet_ruleset_clause::giver_reqs
struct requirement giver_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1443
packet_ruleset_control
Definition packets_gen.h:1448
packet_ruleset_control::num_goods_types
int num_goods_types
Definition packets_gen.h:1458
packet_ruleset_control::preferred_soundset
char preferred_soundset[MAX_LEN_NAME]
Definition packets_gen.h:1472
packet_ruleset_control::num_styles
int num_styles
Definition packets_gen.h:1462
packet_ruleset_control::num_extra_types
int num_extra_types
Definition packets_gen.h:1454
packet_ruleset_control::num_unit_types
int num_unit_types
Definition packets_gen.h:1450
packet_ruleset_control::version
char version[MAX_LEN_NAME]
Definition packets_gen.h:1476
packet_ruleset_control::num_impr_types
int num_impr_types
Definition packets_gen.h:1451
packet_ruleset_control::nation_count
int nation_count
Definition packets_gen.h:1465
packet_ruleset_control::num_road_types
int num_road_types
Definition packets_gen.h:1456
packet_ruleset_control::terrain_count
int terrain_count
Definition packets_gen.h:1467
packet_ruleset_control::preferred_tileset
char preferred_tileset[MAX_LEN_NAME]
Definition packets_gen.h:1471
packet_ruleset_control::popup_tech_help
bool popup_tech_help
Definition packets_gen.h:1474
packet_ruleset_control::num_music_styles
int num_music_styles
Definition packets_gen.h:1463
packet_ruleset_control::num_tech_types
int num_tech_types
Definition packets_gen.h:1453
packet_ruleset_control::government_count
int government_count
Definition packets_gen.h:1464
packet_ruleset_control::num_disaster_types
int num_disaster_types
Definition packets_gen.h:1459
packet_ruleset_control::alt_dir
char alt_dir[MAX_LEN_NAME]
Definition packets_gen.h:1477
packet_ruleset_control::num_achievement_types
int num_achievement_types
Definition packets_gen.h:1460
packet_ruleset_control::num_counters
int num_counters
Definition packets_gen.h:1479
packet_ruleset_control::num_specialist_types
int num_specialist_types
Definition packets_gen.h:1468
packet_ruleset_control::preferred_musicset
char preferred_musicset[MAX_LEN_NAME]
Definition packets_gen.h:1473
packet_ruleset_control::num_tech_classes
int num_tech_classes
Definition packets_gen.h:1452
packet_ruleset_control::num_unit_classes
int num_unit_classes
Definition packets_gen.h:1449
packet_ruleset_control::num_city_styles
int num_city_styles
Definition packets_gen.h:1466
packet_ruleset_control::num_resource_types
int num_resource_types
Definition packets_gen.h:1457
packet_ruleset_control::num_multipliers
int num_multipliers
Definition packets_gen.h:1461
packet_ruleset_control::num_nation_sets
int num_nation_sets
Definition packets_gen.h:1470
packet_ruleset_control::desc_length
int desc_length
Definition packets_gen.h:1478
packet_ruleset_control::num_nation_groups
int num_nation_groups
Definition packets_gen.h:1469
packet_ruleset_control::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1475
packet_ruleset_control::num_base_types
int num_base_types
Definition packets_gen.h:1455
packet_ruleset_counter
Definition packets_gen.h:1405
packet_ruleset_counter::checkpoint
int checkpoint
Definition packets_gen.h:1410
packet_ruleset_counter::behaviour
enum counter_behaviour behaviour
Definition packets_gen.h:1412
packet_ruleset_counter::type
enum counter_target type
Definition packets_gen.h:1411
packet_ruleset_counter::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1406
packet_ruleset_counter::def
int def
Definition packets_gen.h:1409
packet_ruleset_counter::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1407
packet_ruleset_counter::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1408
packet_ruleset_description_part
Definition packets_gen.h:1486
packet_ruleset_description_part::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1487
packet_ruleset_disaster
Definition packets_gen.h:1347
packet_ruleset_disaster::frequency
int frequency
Definition packets_gen.h:1353
packet_ruleset_disaster::id
int id
Definition packets_gen.h:1348
packet_ruleset_disaster::reqs_count
int reqs_count
Definition packets_gen.h:1351
packet_ruleset_disaster::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1350
packet_ruleset_disaster::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1352
packet_ruleset_disaster::effects
bv_disaster_effects effects
Definition packets_gen.h:1354
packet_ruleset_disaster::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1349
packet_ruleset_effect
Definition packets_gen.h:1589
packet_ruleset_effect::reqs_count
int reqs_count
Definition packets_gen.h:1594
packet_ruleset_effect::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1595
packet_ruleset_effect::multiplier
Multiplier_type_id multiplier
Definition packets_gen.h:1593
packet_ruleset_effect::effect_value
int effect_value
Definition packets_gen.h:1591
packet_ruleset_effect::has_multiplier
bool has_multiplier
Definition packets_gen.h:1592
packet_ruleset_effect::effect_type
enum effect_type effect_type
Definition packets_gen.h:1590
packet_ruleset_extra_flag
Definition packets_gen.h:1304
packet_ruleset_extra_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1307
packet_ruleset_extra_flag::id
int id
Definition packets_gen.h:1305
packet_ruleset_extra_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1306
packet_ruleset_extra
Definition packets_gen.h:1260
packet_ruleset_extra::id
int id
Definition packets_gen.h:1261
packet_ruleset_extra::removal_time
int removal_time
Definition packets_gen.h:1290
packet_ruleset_extra::defense_bonus
int defense_bonus
Definition packets_gen.h:1293
packet_ruleset_extra::infracost
int infracost
Definition packets_gen.h:1292
packet_ruleset_extra::native_to
bv_unit_classes native_to
Definition packets_gen.h:1295
packet_ruleset_extra::appearance_reqs_count
int appearance_reqs_count
Definition packets_gen.h:1280
packet_ruleset_extra::build_time_factor
int build_time_factor
Definition packets_gen.h:1289
packet_ruleset_extra::rmact_gfx_alt2
char rmact_gfx_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1272
packet_ruleset_extra::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1276
packet_ruleset_extra::generated
bool generated
Definition packets_gen.h:1287
packet_ruleset_extra::disappearance_reqs_count
int disappearance_reqs_count
Definition packets_gen.h:1283
packet_ruleset_extra::appearance_chance
int appearance_chance
Definition packets_gen.h:1279
packet_ruleset_extra::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1274
packet_ruleset_extra::rmcauses
bv_rmcauses rmcauses
Definition packets_gen.h:1266
packet_ruleset_extra::act_gfx_alt2
char act_gfx_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1269
packet_ruleset_extra::removal_time_factor
int removal_time_factor
Definition packets_gen.h:1291
packet_ruleset_extra::reqs_count
int reqs_count
Definition packets_gen.h:1275
packet_ruleset_extra::buildable
bool buildable
Definition packets_gen.h:1286
packet_ruleset_extra::disappearance_reqs
struct requirement disappearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1284
packet_ruleset_extra::flags
bv_extra_flags flags
Definition packets_gen.h:1296
packet_ruleset_extra::act_gfx_alt
char act_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1268
packet_ruleset_extra::hidden_by
bv_extras hidden_by
Definition packets_gen.h:1297
packet_ruleset_extra::activity_gfx
char activity_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1267
packet_ruleset_extra::build_time
int build_time
Definition packets_gen.h:1288
packet_ruleset_extra::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1263
packet_ruleset_extra::eus
enum extra_unit_seen_type eus
Definition packets_gen.h:1294
packet_ruleset_extra::appearance_reqs
struct requirement appearance_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1281
packet_ruleset_extra::category
int category
Definition packets_gen.h:1264
packet_ruleset_extra::disappearance_chance
int disappearance_chance
Definition packets_gen.h:1282
packet_ruleset_extra::rmreqs_count
int rmreqs_count
Definition packets_gen.h:1277
packet_ruleset_extra::bridged_over
bv_extras bridged_over
Definition packets_gen.h:1298
packet_ruleset_extra::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1262
packet_ruleset_extra::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1273
packet_ruleset_extra::no_aggr_near_city
int no_aggr_near_city
Definition packets_gen.h:1300
packet_ruleset_extra::rmact_gfx_alt
char rmact_gfx_alt[MAX_LEN_NAME]
Definition packets_gen.h:1271
packet_ruleset_extra::rmact_gfx
char rmact_gfx[MAX_LEN_NAME]
Definition packets_gen.h:1270
packet_ruleset_extra::conflicts
bv_extras conflicts
Definition packets_gen.h:1299
packet_ruleset_extra::rmreqs
struct requirement rmreqs[MAX_NUM_REQS]
Definition packets_gen.h:1278
packet_ruleset_extra::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1301
packet_ruleset_extra::visibility_req
int visibility_req
Definition packets_gen.h:1285
packet_ruleset_extra::causes
bv_causes causes
Definition packets_gen.h:1265
packet_ruleset_game
Definition packets_gen.h:1015
packet_ruleset_game::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1026
packet_ruleset_game::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:1025
packet_ruleset_game::global_init_techs
int global_init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1018
packet_ruleset_game::veteran_levels
int veteran_levels
Definition packets_gen.h:1021
packet_ruleset_game::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:1024
packet_ruleset_game::global_init_techs_count
int global_init_techs_count
Definition packets_gen.h:1017
packet_ruleset_game::background_red
int background_red
Definition packets_gen.h:1027
packet_ruleset_game::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:1022
packet_ruleset_game::global_init_buildings
Impr_type_id global_init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1020
packet_ruleset_game::global_init_buildings_count
int global_init_buildings_count
Definition packets_gen.h:1019
packet_ruleset_game::default_specialist
int default_specialist
Definition packets_gen.h:1016
packet_ruleset_game::background_green
int background_green
Definition packets_gen.h:1028
packet_ruleset_game::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:1023
packet_ruleset_game::background_blue
int background_blue
Definition packets_gen.h:1029
packet_ruleset_goods
Definition packets_gen.h:1334
packet_ruleset_goods::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1344
packet_ruleset_goods::flags
bv_goods_flags flags
Definition packets_gen.h:1343
packet_ruleset_goods::from_pct
int from_pct
Definition packets_gen.h:1340
packet_ruleset_goods::onetime_pct
int onetime_pct
Definition packets_gen.h:1342
packet_ruleset_goods::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1336
packet_ruleset_goods::reqs_count
int reqs_count
Definition packets_gen.h:1338
packet_ruleset_goods::to_pct
int to_pct
Definition packets_gen.h:1341
packet_ruleset_goods::id
int id
Definition packets_gen.h:1335
packet_ruleset_goods::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1337
packet_ruleset_goods::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1339
packet_ruleset_government_ruler_title
Definition packets_gen.h:1044
packet_ruleset_government_ruler_title::nation
Nation_type_id nation
Definition packets_gen.h:1046
packet_ruleset_government_ruler_title::female_title
char female_title[MAX_LEN_NAME]
Definition packets_gen.h:1048
packet_ruleset_government_ruler_title::gov
Government_type_id gov
Definition packets_gen.h:1045
packet_ruleset_government_ruler_title::male_title
char male_title[MAX_LEN_NAME]
Definition packets_gen.h:1047
packet_ruleset_government
Definition packets_gen.h:1081
packet_ruleset_government::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1088
packet_ruleset_government::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1086
packet_ruleset_government::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1085
packet_ruleset_government::id
Government_type_id id
Definition packets_gen.h:1082
packet_ruleset_government::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1087
packet_ruleset_government::reqs_count
int reqs_count
Definition packets_gen.h:1083
packet_ruleset_government::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1084
packet_ruleset_government::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1089
packet_ruleset_impr_flag
Definition packets_gen.h:1197
packet_ruleset_impr_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1199
packet_ruleset_impr_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1200
packet_ruleset_impr_flag::id
int id
Definition packets_gen.h:1198
packet_ruleset_multiplier
Definition packets_gen.h:1423
packet_ruleset_multiplier::stop
int stop
Definition packets_gen.h:1426
packet_ruleset_multiplier::step
int step
Definition packets_gen.h:1427
packet_ruleset_multiplier::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1432
packet_ruleset_multiplier::id
Multiplier_type_id id
Definition packets_gen.h:1424
packet_ruleset_multiplier::offset
int offset
Definition packets_gen.h:1429
packet_ruleset_multiplier::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1435
packet_ruleset_multiplier::def
int def
Definition packets_gen.h:1428
packet_ruleset_multiplier::start
int start
Definition packets_gen.h:1425
packet_ruleset_multiplier::minimum_turns
int minimum_turns
Definition packets_gen.h:1431
packet_ruleset_multiplier::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1433
packet_ruleset_multiplier::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1436
packet_ruleset_multiplier::factor
int factor
Definition packets_gen.h:1430
packet_ruleset_multiplier::reqs_count
int reqs_count
Definition packets_gen.h:1434
packet_ruleset_music
Definition packets_gen.h:1415
packet_ruleset_music::music_combat
char music_combat[MAX_LEN_NAME]
Definition packets_gen.h:1418
packet_ruleset_music::id
int id
Definition packets_gen.h:1416
packet_ruleset_music::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1420
packet_ruleset_music::reqs_count
int reqs_count
Definition packets_gen.h:1419
packet_ruleset_music::music_peaceful
char music_peaceful[MAX_LEN_NAME]
Definition packets_gen.h:1417
packet_ruleset_nation_groups
Definition packets_gen.h:1118
packet_ruleset_nation_groups::ngroups
int ngroups
Definition packets_gen.h:1119
packet_ruleset_nation_groups::groups
char groups[MAX_NUM_NATION_GROUPS][MAX_LEN_NAME]
Definition packets_gen.h:1120
packet_ruleset_nation_groups::hidden
bool hidden[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1121
packet_ruleset_nation_sets
Definition packets_gen.h:1111
packet_ruleset_nation_sets::rule_names
char rule_names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1114
packet_ruleset_nation_sets::names
char names[MAX_NUM_NATION_SETS][MAX_LEN_NAME]
Definition packets_gen.h:1113
packet_ruleset_nation_sets::nsets
int nsets
Definition packets_gen.h:1112
packet_ruleset_nation_sets::descriptions
char descriptions[MAX_NUM_NATION_SETS][MAX_LEN_MSG]
Definition packets_gen.h:1115
packet_ruleset_nation
Definition packets_gen.h:1124
packet_ruleset_nation::ngroups
int ngroups
Definition packets_gen.h:1141
packet_ruleset_nation::init_techs
int init_techs[MAX_NUM_TECH_LIST]
Definition packets_gen.h:1145
packet_ruleset_nation::leader_name
char leader_name[MAX_NUM_LEADERS][MAX_LEN_NAME]
Definition packets_gen.h:1135
packet_ruleset_nation::style
int style
Definition packets_gen.h:1133
packet_ruleset_nation::is_playable
bool is_playable
Definition packets_gen.h:1137
packet_ruleset_nation::id
Nation_type_id id
Definition packets_gen.h:1125
packet_ruleset_nation::noun_plural
char noun_plural[MAX_LEN_NAME]
Definition packets_gen.h:1129
packet_ruleset_nation::init_units_count
int init_units_count
Definition packets_gen.h:1146
packet_ruleset_nation::adjective
char adjective[MAX_LEN_NAME]
Definition packets_gen.h:1127
packet_ruleset_nation::init_buildings
Impr_type_id init_buildings[MAX_NUM_BUILDING_LIST]
Definition packets_gen.h:1149
packet_ruleset_nation::init_units
Unit_type_id init_units[MAX_NUM_UNIT_LIST]
Definition packets_gen.h:1147
packet_ruleset_nation::init_techs_count
int init_techs_count
Definition packets_gen.h:1144
packet_ruleset_nation::leader_is_male
bool leader_is_male[MAX_NUM_LEADERS]
Definition packets_gen.h:1136
packet_ruleset_nation::translation_domain
char translation_domain[MAX_LEN_NAME]
Definition packets_gen.h:1126
packet_ruleset_nation::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1130
packet_ruleset_nation::init_government_id
Government_type_id init_government_id
Definition packets_gen.h:1143
packet_ruleset_nation::leader_count
int leader_count
Definition packets_gen.h:1134
packet_ruleset_nation::groups
int groups[MAX_NUM_NATION_GROUPS]
Definition packets_gen.h:1142
packet_ruleset_nation::barbarian_type
enum barbarian_type barbarian_type
Definition packets_gen.h:1138
packet_ruleset_nation::sets
int sets[MAX_NUM_NATION_SETS]
Definition packets_gen.h:1140
packet_ruleset_nation::init_buildings_count
int init_buildings_count
Definition packets_gen.h:1148
packet_ruleset_nation::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1131
packet_ruleset_nation::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1128
packet_ruleset_nation::legend
char legend[MAX_LEN_MSG]
Definition packets_gen.h:1132
packet_ruleset_nation::nsets
int nsets
Definition packets_gen.h:1139
packet_ruleset_resource
Definition packets_gen.h:1598
packet_ruleset_resource::id
int id
Definition packets_gen.h:1599
packet_ruleset_resource::output
int output[O_LAST]
Definition packets_gen.h:1600
packet_ruleset_road
Definition packets_gen.h:1319
packet_ruleset_road::flags
bv_road_flags flags
Definition packets_gen.h:1331
packet_ruleset_road::tile_incr_const
int tile_incr_const[O_LAST]
Definition packets_gen.h:1326
packet_ruleset_road::gui_type
enum road_gui_type gui_type
Definition packets_gen.h:1321
packet_ruleset_road::integrates
bv_max_extras integrates
Definition packets_gen.h:1330
packet_ruleset_road::move_cost
int move_cost
Definition packets_gen.h:1324
packet_ruleset_road::compat
enum road_compat compat
Definition packets_gen.h:1329
packet_ruleset_road::move_mode
enum road_move_mode move_mode
Definition packets_gen.h:1325
packet_ruleset_road::first_reqs_count
int first_reqs_count
Definition packets_gen.h:1322
packet_ruleset_road::tile_bonus
int tile_bonus[O_LAST]
Definition packets_gen.h:1328
packet_ruleset_road::tile_incr
int tile_incr[O_LAST]
Definition packets_gen.h:1327
packet_ruleset_road::id
int id
Definition packets_gen.h:1320
packet_ruleset_road::first_reqs
struct requirement first_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1323
packet_ruleset_select
Definition packets_gen.h:1503
packet_ruleset_select::modpack
char modpack[MAX_RULESET_NAME_LENGTH]
Definition packets_gen.h:1504
packet_ruleset_specialist
Definition packets_gen.h:1032
packet_ruleset_specialist::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1035
packet_ruleset_specialist::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1038
packet_ruleset_specialist::reqs
struct requirement reqs[MAX_NUM_REQS]
Definition packets_gen.h:1040
packet_ruleset_specialist::id
Specialist_type_id id
Definition packets_gen.h:1033
packet_ruleset_specialist::reqs_count
int reqs_count
Definition packets_gen.h:1039
packet_ruleset_specialist::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1041
packet_ruleset_specialist::short_name
char short_name[MAX_LEN_NAME]
Definition packets_gen.h:1036
packet_ruleset_specialist::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1037
packet_ruleset_specialist::plural_name
char plural_name[MAX_LEN_NAME]
Definition packets_gen.h:1034
packet_ruleset_style
Definition packets_gen.h:1158
packet_ruleset_style::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1160
packet_ruleset_style::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1161
packet_ruleset_style::id
int id
Definition packets_gen.h:1159
packet_ruleset_summary
Definition packets_gen.h:1482
packet_ruleset_summary::text
char text[MAX_LEN_CONTENT]
Definition packets_gen.h:1483
packet_ruleset_tech_class
Definition packets_gen.h:1068
packet_ruleset_tech_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1070
packet_ruleset_tech_class::id
int id
Definition packets_gen.h:1069
packet_ruleset_tech_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1071
packet_ruleset_tech_class::cost_pct
int cost_pct
Definition packets_gen.h:1072
packet_ruleset_tech_flag
Definition packets_gen.h:1075
packet_ruleset_tech_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1077
packet_ruleset_tech_flag::id
int id
Definition packets_gen.h:1076
packet_ruleset_tech_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1078
packet_ruleset_tech
Definition packets_gen.h:1051
packet_ruleset_tech::research_reqs_count
int research_reqs_count
Definition packets_gen.h:1054
packet_ruleset_tech::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1061
packet_ruleset_tech::removed
bool removed
Definition packets_gen.h:1057
packet_ruleset_tech::research_reqs
struct requirement research_reqs[MAX_NUM_REQS]
Definition packets_gen.h:1055
packet_ruleset_tech::id
int id
Definition packets_gen.h:1052
packet_ruleset_tech::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1064
packet_ruleset_tech::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1062
packet_ruleset_tech::num_reqs
int num_reqs
Definition packets_gen.h:1060
packet_ruleset_tech::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1065
packet_ruleset_tech::flags
bv_tech_flags flags
Definition packets_gen.h:1058
packet_ruleset_tech::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1063
packet_ruleset_tech::tclass
int tclass
Definition packets_gen.h:1056
packet_ruleset_tech::root_req
int root_req
Definition packets_gen.h:1053
packet_ruleset_tech::cost
float cost
Definition packets_gen.h:1059
packet_ruleset_terrain_control
Definition packets_gen.h:1092
packet_ruleset_terrain_control::lake_max_size
int lake_max_size
Definition packets_gen.h:1097
packet_ruleset_terrain_control::min_start_native_area
int min_start_native_area
Definition packets_gen.h:1098
packet_ruleset_terrain_control::ocean_reclaim_requirement_pct
int ocean_reclaim_requirement_pct
Definition packets_gen.h:1093
packet_ruleset_terrain_control::pythagorean_diagonal
bool pythagorean_diagonal
Definition packets_gen.h:1101
packet_ruleset_terrain_control::terrain_thaw_requirement_pct
int terrain_thaw_requirement_pct
Definition packets_gen.h:1095
packet_ruleset_terrain_control::infrapoints
bool infrapoints
Definition packets_gen.h:1102
packet_ruleset_terrain_control::gui_type_base0
char gui_type_base0[MAX_LEN_NAME]
Definition packets_gen.h:1103
packet_ruleset_terrain_control::move_fragments
int move_fragments
Definition packets_gen.h:1099
packet_ruleset_terrain_control::land_channel_requirement_pct
int land_channel_requirement_pct
Definition packets_gen.h:1094
packet_ruleset_terrain_control::igter_cost
int igter_cost
Definition packets_gen.h:1100
packet_ruleset_terrain_control::gui_type_base1
char gui_type_base1[MAX_LEN_NAME]
Definition packets_gen.h:1104
packet_ruleset_terrain_control::terrain_freeze_requirement_pct
int terrain_freeze_requirement_pct
Definition packets_gen.h:1096
packet_ruleset_terrain_flag
Definition packets_gen.h:1243
packet_ruleset_terrain_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1245
packet_ruleset_terrain_flag::id
int id
Definition packets_gen.h:1244
packet_ruleset_terrain_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1246
packet_ruleset_terrain
Definition packets_gen.h:1203
packet_ruleset_terrain::extra_removal_times
int extra_removal_times[MAX_EXTRA_TYPES]
Definition packets_gen.h:1236
packet_ruleset_terrain::cultivate_time
int cultivate_time
Definition packets_gen.h:1223
packet_ruleset_terrain::irrigation_food_incr
int irrigation_food_incr
Definition packets_gen.h:1226
packet_ruleset_terrain::base_time
int base_time
Definition packets_gen.h:1220
packet_ruleset_terrain::transform_result
Terrain_type_id transform_result
Definition packets_gen.h:1231
packet_ruleset_terrain::tclass
int tclass
Definition packets_gen.h:1205
packet_ruleset_terrain::extra_count
int extra_count
Definition packets_gen.h:1235
packet_ruleset_terrain::mining_shield_incr
int mining_shield_incr
Definition packets_gen.h:1228
packet_ruleset_terrain::resource_freq
int resource_freq[MAX_EXTRA_TYPES]
Definition packets_gen.h:1218
packet_ruleset_terrain::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1240
packet_ruleset_terrain::resources
Resource_type_id resources[MAX_EXTRA_TYPES]
Definition packets_gen.h:1217
packet_ruleset_terrain::irrigation_time
int irrigation_time
Definition packets_gen.h:1227
packet_ruleset_terrain::placing_time
int placing_time
Definition packets_gen.h:1233
packet_ruleset_terrain::flags
bv_terrain_flags flags
Definition packets_gen.h:1206
packet_ruleset_terrain::transform_time
int transform_time
Definition packets_gen.h:1232
packet_ruleset_terrain::defense_bonus
int defense_bonus
Definition packets_gen.h:1214
packet_ruleset_terrain::plant_time
int plant_time
Definition packets_gen.h:1225
packet_ruleset_terrain::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:1210
packet_ruleset_terrain::num_resources
int num_resources
Definition packets_gen.h:1216
packet_ruleset_terrain::output
int output[O_LAST]
Definition packets_gen.h:1215
packet_ruleset_terrain::animal
int animal
Definition packets_gen.h:1230
packet_ruleset_terrain::color_red
int color_red
Definition packets_gen.h:1237
packet_ruleset_terrain::native_to
bv_unit_classes native_to
Definition packets_gen.h:1207
packet_ruleset_terrain::pillage_time
int pillage_time
Definition packets_gen.h:1234
packet_ruleset_terrain::cultivate_result
Terrain_type_id cultivate_result
Definition packets_gen.h:1222
packet_ruleset_terrain::color_green
int color_green
Definition packets_gen.h:1238
packet_ruleset_terrain::road_time
int road_time
Definition packets_gen.h:1221
packet_ruleset_terrain::plant_result
Terrain_type_id plant_result
Definition packets_gen.h:1224
packet_ruleset_terrain::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1208
packet_ruleset_terrain::road_output_incr_pct
int road_output_incr_pct[O_LAST]
Definition packets_gen.h:1219
packet_ruleset_terrain::movement_cost
int movement_cost
Definition packets_gen.h:1213
packet_ruleset_terrain::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:1211
packet_ruleset_terrain::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:1212
packet_ruleset_terrain::mining_time
int mining_time
Definition packets_gen.h:1229
packet_ruleset_terrain::id
Terrain_type_id id
Definition packets_gen.h:1204
packet_ruleset_terrain::color_blue
int color_blue
Definition packets_gen.h:1239
packet_ruleset_terrain::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1209
packet_ruleset_trade
Definition packets_gen.h:1366
packet_ruleset_trade::cancelling
enum trade_route_illegal_cancelling cancelling
Definition packets_gen.h:1369
packet_ruleset_trade::trade_pct
int trade_pct
Definition packets_gen.h:1368
packet_ruleset_trade::id
int id
Definition packets_gen.h:1367
packet_ruleset_trade::bonus_type
enum trade_route_bonus_type bonus_type
Definition packets_gen.h:1370
packet_ruleset_unit_bonus
Definition packets_gen.h:995
packet_ruleset_unit_bonus::type
enum combat_bonus_type type
Definition packets_gen.h:998
packet_ruleset_unit_bonus::unit
Unit_type_id unit
Definition packets_gen.h:996
packet_ruleset_unit_bonus::quiet
bool quiet
Definition packets_gen.h:1000
packet_ruleset_unit_bonus::value
int value
Definition packets_gen.h:999
packet_ruleset_unit_bonus::flag
enum unit_type_flag_id flag
Definition packets_gen.h:997
packet_ruleset_unit_class_flag
Definition packets_gen.h:1009
packet_ruleset_unit_class_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1011
packet_ruleset_unit_class_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1012
packet_ruleset_unit_class_flag::id
int id
Definition packets_gen.h:1010
packet_ruleset_unit_class
Definition packets_gen.h:1249
packet_ruleset_unit_class::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:1252
packet_ruleset_unit_class::flags
bv_unit_class_flags flags
Definition packets_gen.h:1256
packet_ruleset_unit_class::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1251
packet_ruleset_unit_class::non_native_def_pct
int non_native_def_pct
Definition packets_gen.h:1255
packet_ruleset_unit_class::hp_loss_pct
int hp_loss_pct
Definition packets_gen.h:1254
packet_ruleset_unit_class::id
int id
Definition packets_gen.h:1250
packet_ruleset_unit_class::min_speed
int min_speed
Definition packets_gen.h:1253
packet_ruleset_unit_class::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:1257
packet_ruleset_unit_flag
Definition packets_gen.h:1003
packet_ruleset_unit_flag::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1005
packet_ruleset_unit_flag::id
int id
Definition packets_gen.h:1004
packet_ruleset_unit_flag::helptxt
char helptxt[MAX_LEN_PACKET]
Definition packets_gen.h:1006
packet_ruleset_unit
Definition packets_gen.h:944
packet_ruleset_unit::paratroopers_range
int paratroopers_range
Definition packets_gen.h:973
packet_ruleset_unit::graphic_alt
char graphic_alt[MAX_LEN_NAME]
Definition packets_gen.h:949
packet_ruleset_unit::vlayer
enum vision_layer vlayer
Definition packets_gen.h:988
packet_ruleset_unit::tp_defense
enum transp_def_type tp_defense
Definition packets_gen.h:983
packet_ruleset_unit::unit_class_id
int unit_class_id
Definition packets_gen.h:955
packet_ruleset_unit::rule_name
char rule_name[MAX_LEN_NAME]
Definition packets_gen.h:947
packet_ruleset_unit::vision_radius_sq
int vision_radius_sq
Definition packets_gen.h:963
packet_ruleset_unit::obsoleted_by
int obsoleted_by
Definition packets_gen.h:967
packet_ruleset_unit::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:972
packet_ruleset_unit::power_fact
int power_fact[MAX_VET_LEVELS]
Definition packets_gen.h:976
packet_ruleset_unit::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:946
packet_ruleset_unit::hp
int hp
Definition packets_gen.h:965
packet_ruleset_unit::pop_cost
int pop_cost
Definition packets_gen.h:957
packet_ruleset_unit::city_slots
int city_slots
Definition packets_gen.h:982
packet_ruleset_unit::graphic_alt2
char graphic_alt2[MAX_LEN_NAME]
Definition packets_gen.h:950
packet_ruleset_unit::firepower
int firepower
Definition packets_gen.h:966
packet_ruleset_unit::fuel
int fuel
Definition packets_gen.h:970
packet_ruleset_unit::graphic_str
char graphic_str[MAX_LEN_NAME]
Definition packets_gen.h:948
packet_ruleset_unit::convert_time
int convert_time
Definition packets_gen.h:969
packet_ruleset_unit::sound_fight_alt
char sound_fight_alt[MAX_LEN_NAME]
Definition packets_gen.h:954
packet_ruleset_unit::disembarks
bv_unit_classes disembarks
Definition packets_gen.h:987
packet_ruleset_unit::veteran_levels
int veteran_levels
Definition packets_gen.h:974
packet_ruleset_unit::move_rate
int move_rate
Definition packets_gen.h:960
packet_ruleset_unit::attack_strength
int attack_strength
Definition packets_gen.h:958
packet_ruleset_unit::cargo
bv_unit_classes cargo
Definition packets_gen.h:984
packet_ruleset_unit::build_cost
int build_cost
Definition packets_gen.h:956
packet_ruleset_unit::transport_capacity
int transport_capacity
Definition packets_gen.h:964
packet_ruleset_unit::flags
bv_unit_type_flags flags
Definition packets_gen.h:990
packet_ruleset_unit::sound_move_alt
char sound_move_alt[MAX_LEN_NAME]
Definition packets_gen.h:952
packet_ruleset_unit::happy_cost
int happy_cost
Definition packets_gen.h:971
packet_ruleset_unit::worker
bool worker
Definition packets_gen.h:992
packet_ruleset_unit::targets
bv_unit_classes targets
Definition packets_gen.h:985
packet_ruleset_unit::defense_strength
int defense_strength
Definition packets_gen.h:959
packet_ruleset_unit::build_reqs
struct requirement build_reqs[MAX_NUM_REQS]
Definition packets_gen.h:962
packet_ruleset_unit::base_raise_chance
int base_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:978
packet_ruleset_unit::work_raise_chance
int work_raise_chance[MAX_VET_LEVELS]
Definition packets_gen.h:979
packet_ruleset_unit::sound_fight
char sound_fight[MAX_LEN_NAME]
Definition packets_gen.h:953
packet_ruleset_unit::embarks
bv_unit_classes embarks
Definition packets_gen.h:986
packet_ruleset_unit::build_reqs_count
int build_reqs_count
Definition packets_gen.h:961
packet_ruleset_unit::city_size
int city_size
Definition packets_gen.h:981
packet_ruleset_unit::bombard_rate
int bombard_rate
Definition packets_gen.h:980
packet_ruleset_unit::veteran_name
char veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]
Definition packets_gen.h:975
packet_ruleset_unit::converted_to
int converted_to
Definition packets_gen.h:968
packet_ruleset_unit::sound_move
char sound_move[MAX_LEN_NAME]
Definition packets_gen.h:951
packet_ruleset_unit::helptext
char helptext[MAX_LEN_PACKET]
Definition packets_gen.h:989
packet_ruleset_unit::roles
bv_unit_type_roles roles
Definition packets_gen.h:991
packet_ruleset_unit::id
Unit_type_id id
Definition packets_gen.h:945
packet_ruleset_unit::move_bonus
int move_bonus[MAX_VET_LEVELS]
Definition packets_gen.h:977
packet_rulesets_ready
Definition packets_gen.h:1107
packet_save_scenario
Definition packets_gen.h:1624
packet_save_scenario::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1625
packet_scenario_description
Definition packets_gen.h:1620
packet_scenario_description::description
char description[MAX_LEN_CONTENT]
Definition packets_gen.h:1621
packet_scenario_info
Definition packets_gen.h:1603
packet_scenario_info::lake_flooding
bool lake_flooding
Definition packets_gen.h:1611
packet_scenario_info::req_caps
char req_caps[257]
Definition packets_gen.h:1617
packet_scenario_info::datafile
char datafile[MAX_LEN_NAME]
Definition packets_gen.h:1615
packet_scenario_info::have_resources
bool have_resources
Definition packets_gen.h:1616
packet_scenario_info::is_scenario
bool is_scenario
Definition packets_gen.h:1604
packet_scenario_info::ruleset_locked
bool ruleset_locked
Definition packets_gen.h:1614
packet_scenario_info::allow_ai_type_fallback
bool allow_ai_type_fallback
Definition packets_gen.h:1613
packet_scenario_info::players
bool players
Definition packets_gen.h:1607
packet_scenario_info::authors
char authors[MAX_LEN_PACKET/3]
Definition packets_gen.h:1606
packet_scenario_info::name
char name[256]
Definition packets_gen.h:1605
packet_scenario_info::prevent_new_cities
bool prevent_new_cities
Definition packets_gen.h:1610
packet_scenario_info::handmade
bool handmade
Definition packets_gen.h:1612
packet_scenario_info::startpos_nations
bool startpos_nations
Definition packets_gen.h:1608
packet_scenario_info::save_random
bool save_random
Definition packets_gen.h:1609
packet_server_info
Definition packets_gen.h:317
packet_server_info::major_version
int major_version
Definition packets_gen.h:319
packet_server_info::version_label
char version_label[48]
Definition packets_gen.h:318
packet_server_info::patch_version
int patch_version
Definition packets_gen.h:321
packet_server_info::minor_version
int minor_version
Definition packets_gen.h:320
packet_server_info::emerg_version
int emerg_version
Definition packets_gen.h:322
packet_server_join_reply
Definition packets_gen.h:51
packet_server_join_req
Definition packets_gen.h:42
packet_server_join_req::version_label
char version_label[48]
Definition packets_gen.h:45
packet_server_join_req::capability
char capability[512]
Definition packets_gen.h:44
packet_server_join_req::minor_version
int minor_version
Definition packets_gen.h:47
packet_server_join_req::patch_version
int patch_version
Definition packets_gen.h:48
packet_server_join_req::major_version
int major_version
Definition packets_gen.h:46
packet_server_join_req::username
char username[48]
Definition packets_gen.h:43
packet_server_setting_bitwise
Definition packets_gen.h:1571
packet_server_setting_bitwise::support_names
char support_names[64][MAX_LEN_NAME]
Definition packets_gen.h:1580
packet_server_setting_bitwise::val
int val
Definition packets_gen.h:1577
packet_server_setting_bitwise::initial_setting
bool initial_setting
Definition packets_gen.h:1575
packet_server_setting_bitwise::bits_num
int bits_num
Definition packets_gen.h:1579
packet_server_setting_bitwise::default_val
int default_val
Definition packets_gen.h:1578
packet_server_setting_bitwise::is_changeable
bool is_changeable
Definition packets_gen.h:1574
packet_server_setting_bitwise::pretty_names
char pretty_names[64][MAX_LEN_ENUM]
Definition packets_gen.h:1581
packet_server_setting_bitwise::setdef
enum setting_default_level setdef
Definition packets_gen.h:1576
packet_server_setting_bitwise::is_visible
bool is_visible
Definition packets_gen.h:1573
packet_server_setting_bitwise::id
int id
Definition packets_gen.h:1572
packet_server_setting_bool
Definition packets_gen.h:1526
packet_server_setting_bool::val
bool val
Definition packets_gen.h:1532
packet_server_setting_bool::setdef
enum setting_default_level setdef
Definition packets_gen.h:1531
packet_server_setting_bool::is_changeable
bool is_changeable
Definition packets_gen.h:1529
packet_server_setting_bool::is_visible
bool is_visible
Definition packets_gen.h:1528
packet_server_setting_bool::default_val
bool default_val
Definition packets_gen.h:1533
packet_server_setting_bool::id
int id
Definition packets_gen.h:1527
packet_server_setting_bool::initial_setting
bool initial_setting
Definition packets_gen.h:1530
packet_server_setting_const
Definition packets_gen.h:1518
packet_server_setting_const::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:1520
packet_server_setting_const::category
int category
Definition packets_gen.h:1523
packet_server_setting_const::short_help
char short_help[MAX_LEN_PACKET]
Definition packets_gen.h:1521
packet_server_setting_const::id
int id
Definition packets_gen.h:1519
packet_server_setting_const::extra_help
char extra_help[MAX_LEN_PACKET]
Definition packets_gen.h:1522
packet_server_setting_control
Definition packets_gen.h:1512
packet_server_setting_control::categories_num
int categories_num
Definition packets_gen.h:1514
packet_server_setting_control::settings_num
int settings_num
Definition packets_gen.h:1513
packet_server_setting_control::category_names
char category_names[256][MAX_LEN_NAME]
Definition packets_gen.h:1515
packet_server_setting_enum
Definition packets_gen.h:1558
packet_server_setting_enum::initial_setting
bool initial_setting
Definition packets_gen.h:1562
packet_server_setting_enum::is_visible
bool is_visible
Definition packets_gen.h:1560
packet_server_setting_enum::is_changeable
bool is_changeable
Definition packets_gen.h:1561
packet_server_setting_enum::setdef
enum setting_default_level setdef
Definition packets_gen.h:1563
packet_server_setting_enum::default_val
int default_val
Definition packets_gen.h:1565
packet_server_setting_enum::values_num
int values_num
Definition packets_gen.h:1566
packet_server_setting_enum::id
int id
Definition packets_gen.h:1559
packet_server_setting_enum::val
int val
Definition packets_gen.h:1564
packet_server_setting_enum::pretty_names
char pretty_names[64][MAX_LEN_ENUM]
Definition packets_gen.h:1568
packet_server_setting_enum::support_names
char support_names[64][MAX_LEN_NAME]
Definition packets_gen.h:1567
packet_server_setting_int
Definition packets_gen.h:1536
packet_server_setting_int::is_changeable
bool is_changeable
Definition packets_gen.h:1539
packet_server_setting_int::max_val
int max_val
Definition packets_gen.h:1545
packet_server_setting_int::is_visible
bool is_visible
Definition packets_gen.h:1538
packet_server_setting_int::min_val
int min_val
Definition packets_gen.h:1544
packet_server_setting_int::id
int id
Definition packets_gen.h:1537
packet_server_setting_int::val
int val
Definition packets_gen.h:1542
packet_server_setting_int::initial_setting
bool initial_setting
Definition packets_gen.h:1540
packet_server_setting_int::default_val
int default_val
Definition packets_gen.h:1543
packet_server_setting_int::setdef
enum setting_default_level setdef
Definition packets_gen.h:1541
packet_server_setting_str
Definition packets_gen.h:1548
packet_server_setting_str::default_val
char default_val[MAX_LEN_PACKET]
Definition packets_gen.h:1555
packet_server_setting_str::id
int id
Definition packets_gen.h:1549
packet_server_setting_str::val
char val[MAX_LEN_PACKET]
Definition packets_gen.h:1554
packet_server_setting_str::is_visible
bool is_visible
Definition packets_gen.h:1550
packet_server_setting_str::setdef
enum setting_default_level setdef
Definition packets_gen.h:1553
packet_server_setting_str::initial_setting
bool initial_setting
Definition packets_gen.h:1552
packet_server_setting_str::is_changeable
bool is_changeable
Definition packets_gen.h:1551
packet_server_shutdown
Definition packets_gen.h:68
packet_set_topology
Definition packets_gen.h:1584
packet_set_topology::wrap_id
int wrap_id
Definition packets_gen.h:1586
packet_set_topology::topology_id
int topology_id
Definition packets_gen.h:1585
packet_single_want_hack_reply
Definition packets_gen.h:1494
packet_single_want_hack_reply::you_have_hack
bool you_have_hack
Definition packets_gen.h:1495
packet_single_want_hack_req
Definition packets_gen.h:1490
packet_single_want_hack_req::token
char token[MAX_LEN_NAME]
Definition packets_gen.h:1491
packet_spaceship_info
Definition packets_gen.h:923
packet_spaceship_info::sship_state
int sship_state
Definition packets_gen.h:925
packet_spaceship_info::propulsion
int propulsion
Definition packets_gen.h:930
packet_spaceship_info::habitation
int habitation
Definition packets_gen.h:931
packet_spaceship_info::mass
int mass
Definition packets_gen.h:936
packet_spaceship_info::life_support
int life_support
Definition packets_gen.h:932
packet_spaceship_info::structure
bv_spaceship_structure structure
Definition packets_gen.h:937
packet_spaceship_info::structurals
int structurals
Definition packets_gen.h:926
packet_spaceship_info::fuel
int fuel
Definition packets_gen.h:929
packet_spaceship_info::population
int population
Definition packets_gen.h:935
packet_spaceship_info::success_rate
float success_rate
Definition packets_gen.h:940
packet_spaceship_info::player_num
int player_num
Definition packets_gen.h:924
packet_spaceship_info::launch_year
int launch_year
Definition packets_gen.h:934
packet_spaceship_info::travel_time
float travel_time
Definition packets_gen.h:941
packet_spaceship_info::energy_rate
float energy_rate
Definition packets_gen.h:939
packet_spaceship_info::solar_panels
int solar_panels
Definition packets_gen.h:933
packet_spaceship_info::support_rate
float support_rate
Definition packets_gen.h:938
packet_spaceship_info::modules
int modules
Definition packets_gen.h:928
packet_spaceship_info::components
int components
Definition packets_gen.h:927
packet_spaceship_launch
Definition packets_gen.h:914
packet_spaceship_place
Definition packets_gen.h:918
packet_spaceship_place::num
int num
Definition packets_gen.h:920
packet_spaceship_place::type
enum spaceship_place_type type
Definition packets_gen.h:919
packet_start_phase
Definition packets_gen.h:888
packet_start_phase::phase
int phase
Definition packets_gen.h:889
packet_team_name_info
Definition packets_gen.h:280
packet_team_name_info::team_name
char team_name[MAX_LEN_NAME]
Definition packets_gen.h:282
packet_team_name_info::team_id
int team_id
Definition packets_gen.h:281
packet_thaw_client
Definition packets_gen.h:910
packet_tile_info
Definition packets_gen.h:99
packet_tile_info::resource
Resource_type_id resource
Definition packets_gen.h:107
packet_tile_info::extras
bv_extras extras
Definition packets_gen.h:108
packet_tile_info::place_turn
int place_turn
Definition packets_gen.h:110
packet_tile_info::placing
int placing
Definition packets_gen.h:109
packet_tile_info::owner
int owner
Definition packets_gen.h:103
packet_tile_info::known
enum known_type known
Definition packets_gen.h:102
packet_tile_info::label
char label[MAX_LEN_MAP_LABEL]
Definition packets_gen.h:112
packet_tile_info::extras_owner
int extras_owner
Definition packets_gen.h:104
packet_tile_info::tile
int tile
Definition packets_gen.h:100
packet_tile_info::continent
Continent_id continent
Definition packets_gen.h:101
packet_tile_info::terrain
Terrain_type_id terrain
Definition packets_gen.h:106
packet_tile_info::worked
int worked
Definition packets_gen.h:105
packet_tile_info::spec_sprite
char spec_sprite[MAX_LEN_NAME]
Definition packets_gen.h:111
packet_timeout_info
Definition packets_gen.h:262
packet_timeout_info::seconds_to_phasedone
float seconds_to_phasedone
Definition packets_gen.h:263
packet_timeout_info::last_turn_change_time
float last_turn_change_time
Definition packets_gen.h:264
packet_trade_route_info
Definition packets_gen.h:412
packet_trade_route_info::city
int city
Definition packets_gen.h:413
packet_trade_route_info::value
int value
Definition packets_gen.h:416
packet_trade_route_info::partner
int partner
Definition packets_gen.h:415
packet_trade_route_info::goods
Goods_type_id goods
Definition packets_gen.h:418
packet_trade_route_info::direction
enum route_direction direction
Definition packets_gen.h:417
packet_trade_route_info::index
int index
Definition packets_gen.h:414
packet_unit_action_answer
Definition packets_gen.h:739
packet_unit_action_answer::request_kind
int request_kind
Definition packets_gen.h:744
packet_unit_action_answer::action_type
action_id action_type
Definition packets_gen.h:743
packet_unit_action_answer::cost
int cost
Definition packets_gen.h:742
packet_unit_action_answer::actor_id
int actor_id
Definition packets_gen.h:740
packet_unit_action_answer::target_id
int target_id
Definition packets_gen.h:741
packet_unit_action_query
Definition packets_gen.h:720
packet_unit_action_query::target_id
int target_id
Definition packets_gen.h:722
packet_unit_action_query::request_kind
int request_kind
Definition packets_gen.h:724
packet_unit_action_query::actor_id
int actor_id
Definition packets_gen.h:721
packet_unit_action_query::action_type
action_id action_type
Definition packets_gen.h:723
packet_unit_actions
Definition packets_gen.h:755
packet_unit_actions::target_unit_id
int target_unit_id
Definition packets_gen.h:757
packet_unit_actions::target_city_id
int target_city_id
Definition packets_gen.h:758
packet_unit_actions::action_probabilities
struct act_prob action_probabilities[MAX_NUM_ACTIONS]
Definition packets_gen.h:762
packet_unit_actions::target_extra_id
int target_extra_id
Definition packets_gen.h:760
packet_unit_actions::request_kind
int request_kind
Definition packets_gen.h:761
packet_unit_actions::actor_unit_id
int actor_unit_id
Definition packets_gen.h:756
packet_unit_actions::target_tile_id
int target_tile_id
Definition packets_gen.h:759
packet_unit_change_activity
Definition packets_gen.h:765
packet_unit_change_activity::activity
enum unit_activity activity
Definition packets_gen.h:767
packet_unit_change_activity::unit_id
int unit_id
Definition packets_gen.h:766
packet_unit_change_activity::target
int target
Definition packets_gen.h:768
packet_unit_combat_info
Definition packets_gen.h:690
packet_unit_combat_info::defender_hp
int defender_hp
Definition packets_gen.h:694
packet_unit_combat_info::attacker_hp
int attacker_hp
Definition packets_gen.h:693
packet_unit_combat_info::make_att_veteran
bool make_att_veteran
Definition packets_gen.h:695
packet_unit_combat_info::make_def_veteran
bool make_def_veteran
Definition packets_gen.h:696
packet_unit_combat_info::attacker_unit_id
int attacker_unit_id
Definition packets_gen.h:691
packet_unit_combat_info::defender_unit_id
int defender_unit_id
Definition packets_gen.h:692
packet_unit_do_action
Definition packets_gen.h:731
packet_unit_do_action::action_type
action_id action_type
Definition packets_gen.h:736
packet_unit_do_action::name
char name[MAX_LEN_NAME]
Definition packets_gen.h:735
packet_unit_do_action::sub_tgt_id
int sub_tgt_id
Definition packets_gen.h:734
packet_unit_do_action::actor_id
int actor_id
Definition packets_gen.h:732
packet_unit_do_action::target_id
int target_id
Definition packets_gen.h:733
packet_unit_get_actions
Definition packets_gen.h:747
packet_unit_get_actions::target_extra_id
int target_extra_id
Definition packets_gen.h:751
packet_unit_get_actions::target_tile_id
int target_tile_id
Definition packets_gen.h:750
packet_unit_get_actions::actor_unit_id
int actor_unit_id
Definition packets_gen.h:748
packet_unit_get_actions::target_unit_id
int target_unit_id
Definition packets_gen.h:749
packet_unit_get_actions::request_kind
int request_kind
Definition packets_gen.h:752
packet_unit_info
Definition packets_gen.h:632
packet_unit_info::movesleft
int movesleft
Definition packets_gen.h:652
packet_unit_info::upkeep
int upkeep[O_LAST]
Definition packets_gen.h:639
packet_unit_info::carrying
int carrying
Definition packets_gen.h:651
packet_unit_info::action_decision_want
enum action_decision action_decision_want
Definition packets_gen.h:669
packet_unit_info::owner
int owner
Definition packets_gen.h:634
packet_unit_info::has_orders
bool has_orders
Definition packets_gen.h:663
packet_unit_info::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:668
packet_unit_info::fuel
int fuel
Definition packets_gen.h:654
packet_unit_info::activity
enum unit_activity activity
Definition packets_gen.h:658
packet_unit_info::activity_tgt
int activity_tgt
Definition packets_gen.h:659
packet_unit_info::current_form_turn
int current_form_turn
Definition packets_gen.h:648
packet_unit_info::nationality
int nationality
Definition packets_gen.h:635
packet_unit_info::transported
bool transported
Definition packets_gen.h:644
packet_unit_info::goto_tile
int goto_tile
Definition packets_gen.h:657
packet_unit_info::orders_index
int orders_index
Definition packets_gen.h:665
packet_unit_info::type
Unit_type_id type
Definition packets_gen.h:649
packet_unit_info::changed_from
enum unit_activity changed_from
Definition packets_gen.h:660
packet_unit_info::homecity
int homecity
Definition packets_gen.h:638
packet_unit_info::orders_length
int orders_length
Definition packets_gen.h:664
packet_unit_info::transported_by
int transported_by
Definition packets_gen.h:650
packet_unit_info::veteran
int veteran
Definition packets_gen.h:640
packet_unit_info::orders_repeat
bool orders_repeat
Definition packets_gen.h:666
packet_unit_info::activity_count
int activity_count
Definition packets_gen.h:655
packet_unit_info::id
int id
Definition packets_gen.h:633
packet_unit_info::occupied
bool occupied
Definition packets_gen.h:643
packet_unit_info::action_decision_tile
int action_decision_tile
Definition packets_gen.h:670
packet_unit_info::battlegroup
int battlegroup
Definition packets_gen.h:662
packet_unit_info::facing
enum direction8 facing
Definition packets_gen.h:637
packet_unit_info::orders_vigilant
bool orders_vigilant
Definition packets_gen.h:667
packet_unit_info::hp
int hp
Definition packets_gen.h:653
packet_unit_info::changed_from_count
int changed_from_count
Definition packets_gen.h:656
packet_unit_info::stay
bool stay
Definition packets_gen.h:646
packet_unit_info::tile
int tile
Definition packets_gen.h:636
packet_unit_info::birth_turn
int birth_turn
Definition packets_gen.h:647
packet_unit_info::ssa_controller
enum server_side_agent ssa_controller
Definition packets_gen.h:641
packet_unit_info::done_moving
bool done_moving
Definition packets_gen.h:645
packet_unit_info::paradropped
bool paradropped
Definition packets_gen.h:642
packet_unit_info::changed_from_tgt
int changed_from_tgt
Definition packets_gen.h:661
packet_unit_orders
Definition packets_gen.h:705
packet_unit_orders::src_tile
int src_tile
Definition packets_gen.h:707
packet_unit_orders::length
int length
Definition packets_gen.h:708
packet_unit_orders::unit_id
int unit_id
Definition packets_gen.h:706
packet_unit_orders::dest_tile
int dest_tile
Definition packets_gen.h:712
packet_unit_orders::repeat
bool repeat
Definition packets_gen.h:709
packet_unit_orders::vigilant
bool vigilant
Definition packets_gen.h:710
packet_unit_orders::orders
struct unit_order orders[MAX_LEN_ROUTE]
Definition packets_gen.h:711
packet_unit_remove
Definition packets_gen.h:628
packet_unit_remove::unit_id
int unit_id
Definition packets_gen.h:629
packet_unit_server_side_agent_set
Definition packets_gen.h:715
packet_unit_server_side_agent_set::unit_id
int unit_id
Definition packets_gen.h:716
packet_unit_server_side_agent_set::agent
enum server_side_agent agent
Definition packets_gen.h:717
packet_unit_short_info
Definition packets_gen.h:673
packet_unit_short_info::activity
int activity
Definition packets_gen.h:683
packet_unit_short_info::packet_use
int packet_use
Definition packets_gen.h:686
packet_unit_short_info::tile
int tile
Definition packets_gen.h:676
packet_unit_short_info::transported
bool transported
Definition packets_gen.h:681
packet_unit_short_info::hp
int hp
Definition packets_gen.h:682
packet_unit_short_info::id
int id
Definition packets_gen.h:674
packet_unit_short_info::veteran
int veteran
Definition packets_gen.h:679
packet_unit_short_info::info_city_id
int info_city_id
Definition packets_gen.h:687
packet_unit_short_info::type
Unit_type_id type
Definition packets_gen.h:678
packet_unit_short_info::owner
int owner
Definition packets_gen.h:675
packet_unit_short_info::occupied
bool occupied
Definition packets_gen.h:680
packet_unit_short_info::transported_by
int transported_by
Definition packets_gen.h:685
packet_unit_short_info::facing
enum direction8 facing
Definition packets_gen.h:677
packet_unit_short_info::activity_tgt
int activity_tgt
Definition packets_gen.h:684
packet_unit_sscs_set
Definition packets_gen.h:699
packet_unit_sscs_set::type
enum unit_ss_data_type type
Definition packets_gen.h:701
packet_unit_sscs_set::unit_id
int unit_id
Definition packets_gen.h:700
packet_unit_sscs_set::value
int value
Definition packets_gen.h:702
packet_unit_type_upgrade
Definition packets_gen.h:727
packet_unit_type_upgrade::type
Unit_type_id type
Definition packets_gen.h:728
packet_unknown_research
Definition packets_gen.h:616
packet_unknown_research::id
int id
Definition packets_gen.h:617
packet_vote_new
Definition packets_gen.h:1628
packet_vote_new::flags
int flags
Definition packets_gen.h:1633
packet_vote_new::vote_no
int vote_no
Definition packets_gen.h:1629
packet_vote_new::desc
char desc[512]
Definition packets_gen.h:1631
packet_vote_new::percent_required
int percent_required
Definition packets_gen.h:1632
packet_vote_new::user
char user[MAX_LEN_NAME]
Definition packets_gen.h:1630
packet_vote_remove
Definition packets_gen.h:1644
packet_vote_remove::vote_no
int vote_no
Definition packets_gen.h:1645
packet_vote_resolve
Definition packets_gen.h:1648
packet_vote_resolve::passed
bool passed
Definition packets_gen.h:1650
packet_vote_resolve::vote_no
int vote_no
Definition packets_gen.h:1649
packet_vote_submit
Definition packets_gen.h:1653
packet_vote_update
Definition packets_gen.h:1636
packet_vote_update::abstain
int abstain
Definition packets_gen.h:1640
packet_vote_update::num_voters
int num_voters
Definition packets_gen.h:1641
packet_vote_update::yes
int yes
Definition packets_gen.h:1638
packet_vote_update::no
int no
Definition packets_gen.h:1639
packet_vote_update::vote_no
int vote_no
Definition packets_gen.h:1637
packet_web_city_info_addition
Definition packets_gen.h:1861
packet_web_city_info_addition::can_build_improvement
bv_imprs can_build_improvement
Definition packets_gen.h:1868
packet_web_city_info_addition::cm_parameter
struct cm_parameter cm_parameter
Definition packets_gen.h:1864
packet_web_city_info_addition::output_shield
int output_shield[MAX_CITY_TILES+1]
Definition packets_gen.h:1870
packet_web_city_info_addition::id
int id
Definition packets_gen.h:1862
packet_web_city_info_addition::cma_enabled
bool cma_enabled
Definition packets_gen.h:1863
packet_web_city_info_addition::output_trade
int output_trade[MAX_CITY_TILES+1]
Definition packets_gen.h:1871
packet_web_city_info_addition::output_food
int output_food[MAX_CITY_TILES+1]
Definition packets_gen.h:1869
packet_web_city_info_addition::granary_size
int granary_size
Definition packets_gen.h:1865
packet_web_city_info_addition::can_build_unit
bv_utypes can_build_unit
Definition packets_gen.h:1867
packet_web_city_info_addition::granary_turns
int granary_turns
Definition packets_gen.h:1866
packet_web_cma_clear
Definition packets_gen.h:1879
packet_web_cma_clear::id
int id
Definition packets_gen.h:1880
packet_web_cma_set
Definition packets_gen.h:1874
packet_web_cma_set::id
int id
Definition packets_gen.h:1875
packet_web_cma_set::cm_parameter
struct cm_parameter cm_parameter
Definition packets_gen.h:1876
packet_web_player_info_addition
Definition packets_gen.h:1883
packet_web_player_info_addition::expected_income
int expected_income
Definition packets_gen.h:1885
packet_web_player_info_addition::playerno
int playerno
Definition packets_gen.h:1884
packet_web_ruleset_unit_addition
Definition packets_gen.h:1888
packet_web_ruleset_unit_addition::utype_actions
bv_actions utype_actions
Definition packets_gen.h:1890
packet_web_ruleset_unit_addition::id
Unit_type_id id
Definition packets_gen.h:1889
packet_worker_task
Definition packets_gen.h:496
packet_worker_task::city_id
int city_id
Definition packets_gen.h:497
packet_worker_task::tile_id
int tile_id
Definition packets_gen.h:498
packet_worker_task::activity
enum unit_activity activity
Definition packets_gen.h:499
packet_worker_task::want
int want
Definition packets_gen.h:501
packet_worker_task::tgt
int tgt
Definition packets_gen.h:500
player
Definition player.h:247
plocation
Definition dataio_raw.h:63
requirement
Definition requirements.h:81
team
Definition team.c:40
terrain
Definition terrain.h:182
tile
Definition tile.h:50
unit_order
Definition unit.h:92
unit
Definition unit.h:138
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